@wordpress/dom 3.38.0 → 3.40.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 (202) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +2 -2
  3. package/build/data-transfer.js +0 -2
  4. package/build/data-transfer.js.map +1 -1
  5. package/build/dom/caret-range-from-point.js +3 -5
  6. package/build/dom/caret-range-from-point.js.map +1 -1
  7. package/build/dom/clean-node-list.js +25 -42
  8. package/build/dom/clean-node-list.js.map +1 -1
  9. package/build/dom/compute-caret-rect.js +0 -6
  10. package/build/dom/compute-caret-rect.js.map +1 -1
  11. package/build/dom/document-has-selection.js +0 -5
  12. package/build/dom/document-has-selection.js.map +1 -1
  13. package/build/dom/document-has-text-selection.js +0 -2
  14. package/build/dom/document-has-text-selection.js.map +1 -1
  15. package/build/dom/document-has-uncollapsed-selection.js +0 -4
  16. package/build/dom/document-has-uncollapsed-selection.js.map +1 -1
  17. package/build/dom/get-computed-style.js +0 -3
  18. package/build/dom/get-computed-style.js.map +1 -1
  19. package/build/dom/get-offset-parent.js +8 -19
  20. package/build/dom/get-offset-parent.js.map +1 -1
  21. package/build/dom/get-range-height.js +0 -3
  22. package/build/dom/get-range-height.js.map +1 -1
  23. package/build/dom/get-rectangle-from-range.js +15 -22
  24. package/build/dom/get-rectangle-from-range.js.map +1 -1
  25. package/build/dom/get-scroll-container.js +3 -13
  26. package/build/dom/get-scroll-container.js.map +1 -1
  27. package/build/dom/hidden-caret-range-from-point.js +2 -6
  28. package/build/dom/hidden-caret-range-from-point.js.map +1 -1
  29. package/build/dom/index.js +0 -27
  30. package/build/dom/index.js.map +1 -1
  31. package/build/dom/input-field-has-uncollapsed-selection.js +8 -12
  32. package/build/dom/input-field-has-uncollapsed-selection.js.map +1 -1
  33. package/build/dom/insert-after.js +0 -2
  34. package/build/dom/insert-after.js.map +1 -1
  35. package/build/dom/is-edge.js +18 -40
  36. package/build/dom/is-edge.js.map +1 -1
  37. package/build/dom/is-element.js +0 -2
  38. package/build/dom/is-element.js.map +1 -1
  39. package/build/dom/is-empty.js +1 -7
  40. package/build/dom/is-empty.js.map +1 -1
  41. package/build/dom/is-entirely-selected.js +2 -18
  42. package/build/dom/is-entirely-selected.js.map +1 -1
  43. package/build/dom/is-form-element.js +0 -4
  44. package/build/dom/is-form-element.js.map +1 -1
  45. package/build/dom/is-horizontal-edge.js +2 -5
  46. package/build/dom/is-horizontal-edge.js.map +1 -1
  47. package/build/dom/is-html-input-element.js +0 -2
  48. package/build/dom/is-html-input-element.js.map +1 -1
  49. package/build/dom/is-input-or-text-area.js +0 -2
  50. package/build/dom/is-input-or-text-area.js.map +1 -1
  51. package/build/dom/is-number-input.js +0 -6
  52. package/build/dom/is-number-input.js.map +1 -1
  53. package/build/dom/is-rtl.js +0 -3
  54. package/build/dom/is-rtl.js.map +1 -1
  55. package/build/dom/is-selection-forward.js +6 -10
  56. package/build/dom/is-selection-forward.js.map +1 -1
  57. package/build/dom/is-text-field.js +1 -7
  58. package/build/dom/is-text-field.js.map +1 -1
  59. package/build/dom/is-vertical-edge.js +2 -5
  60. package/build/dom/is-vertical-edge.js.map +1 -1
  61. package/build/dom/place-caret-at-edge.js +8 -31
  62. package/build/dom/place-caret-at-edge.js.map +1 -1
  63. package/build/dom/place-caret-at-horizontal-edge.js +0 -3
  64. package/build/dom/place-caret-at-horizontal-edge.js.map +1 -1
  65. package/build/dom/place-caret-at-vertical-edge.js +0 -3
  66. package/build/dom/place-caret-at-vertical-edge.js.map +1 -1
  67. package/build/dom/remove-invalid-html.js +0 -3
  68. package/build/dom/remove-invalid-html.js.map +1 -1
  69. package/build/dom/remove.js +0 -2
  70. package/build/dom/remove.js.map +1 -1
  71. package/build/dom/replace-tag.js +0 -4
  72. package/build/dom/replace-tag.js.map +1 -1
  73. package/build/dom/replace.js +0 -5
  74. package/build/dom/replace.js.map +1 -1
  75. package/build/dom/safe-html.js +0 -8
  76. package/build/dom/safe-html.js.map +1 -1
  77. package/build/dom/scroll-if-no-range.js +31 -0
  78. package/build/dom/scroll-if-no-range.js.map +1 -0
  79. package/build/dom/strip-html.js +0 -3
  80. package/build/dom/strip-html.js.map +1 -1
  81. package/build/dom/unwrap.js +0 -4
  82. package/build/dom/unwrap.js.map +1 -1
  83. package/build/dom/wrap.js +0 -2
  84. package/build/dom/wrap.js.map +1 -1
  85. package/build/focusable.js +5 -18
  86. package/build/focusable.js.map +1 -1
  87. package/build/index.js +0 -11
  88. package/build/index.js.map +1 -1
  89. package/build/phrasing-content.js +13 -14
  90. package/build/phrasing-content.js.map +1 -1
  91. package/build/tabbable.js +21 -37
  92. package/build/tabbable.js.map +1 -1
  93. package/build/utils/assert-is-defined.js +0 -1
  94. package/build/utils/assert-is-defined.js.map +1 -1
  95. package/build-module/data-transfer.js +0 -1
  96. package/build-module/data-transfer.js.map +1 -1
  97. package/build-module/dom/caret-range-from-point.js +3 -4
  98. package/build-module/dom/caret-range-from-point.js.map +1 -1
  99. package/build-module/dom/clean-node-list.js +24 -35
  100. package/build-module/dom/clean-node-list.js.map +1 -1
  101. package/build-module/dom/compute-caret-rect.js +1 -3
  102. package/build-module/dom/compute-caret-rect.js.map +1 -1
  103. package/build-module/dom/document-has-selection.js +1 -1
  104. package/build-module/dom/document-has-selection.js.map +1 -1
  105. package/build-module/dom/document-has-text-selection.js +1 -1
  106. package/build-module/dom/document-has-text-selection.js.map +1 -1
  107. package/build-module/dom/document-has-uncollapsed-selection.js +1 -1
  108. package/build-module/dom/document-has-uncollapsed-selection.js.map +1 -1
  109. package/build-module/dom/get-computed-style.js +1 -2
  110. package/build-module/dom/get-computed-style.js.map +1 -1
  111. package/build-module/dom/get-offset-parent.js +9 -17
  112. package/build-module/dom/get-offset-parent.js.map +1 -1
  113. package/build-module/dom/get-range-height.js +0 -2
  114. package/build-module/dom/get-range-height.js.map +1 -1
  115. package/build-module/dom/get-rectangle-from-range.js +16 -21
  116. package/build-module/dom/get-rectangle-from-range.js.map +1 -1
  117. package/build-module/dom/get-scroll-container.js +4 -11
  118. package/build-module/dom/get-scroll-container.js.map +1 -1
  119. package/build-module/dom/hidden-caret-range-from-point.js +3 -3
  120. package/build-module/dom/hidden-caret-range-from-point.js.map +1 -1
  121. package/build-module/dom/index.js.map +1 -1
  122. package/build-module/dom/input-field-has-uncollapsed-selection.js +9 -9
  123. package/build-module/dom/input-field-has-uncollapsed-selection.js.map +1 -1
  124. package/build-module/dom/insert-after.js +1 -1
  125. package/build-module/dom/insert-after.js.map +1 -1
  126. package/build-module/dom/is-edge.js +19 -32
  127. package/build-module/dom/is-edge.js.map +1 -1
  128. package/build-module/dom/is-element.js +0 -1
  129. package/build-module/dom/is-element.js.map +1 -1
  130. package/build-module/dom/is-empty.js +1 -6
  131. package/build-module/dom/is-empty.js.map +1 -1
  132. package/build-module/dom/is-entirely-selected.js +3 -14
  133. package/build-module/dom/is-entirely-selected.js.map +1 -1
  134. package/build-module/dom/is-form-element.js +1 -2
  135. package/build-module/dom/is-form-element.js.map +1 -1
  136. package/build-module/dom/is-horizontal-edge.js +3 -3
  137. package/build-module/dom/is-horizontal-edge.js.map +1 -1
  138. package/build-module/dom/is-html-input-element.js +0 -1
  139. package/build-module/dom/is-html-input-element.js.map +1 -1
  140. package/build-module/dom/is-input-or-text-area.js +0 -1
  141. package/build-module/dom/is-input-or-text-area.js.map +1 -1
  142. package/build-module/dom/is-number-input.js +2 -4
  143. package/build-module/dom/is-number-input.js.map +1 -1
  144. package/build-module/dom/is-rtl.js +1 -1
  145. package/build-module/dom/is-rtl.js.map +1 -1
  146. package/build-module/dom/is-selection-forward.js +7 -9
  147. package/build-module/dom/is-selection-forward.js.map +1 -1
  148. package/build-module/dom/is-text-field.js +2 -5
  149. package/build-module/dom/is-text-field.js.map +1 -1
  150. package/build-module/dom/is-vertical-edge.js +3 -3
  151. package/build-module/dom/is-vertical-edge.js.map +1 -1
  152. package/build-module/dom/place-caret-at-edge.js +9 -26
  153. package/build-module/dom/place-caret-at-edge.js.map +1 -1
  154. package/build-module/dom/place-caret-at-horizontal-edge.js +1 -1
  155. package/build-module/dom/place-caret-at-horizontal-edge.js.map +1 -1
  156. package/build-module/dom/place-caret-at-vertical-edge.js +1 -1
  157. package/build-module/dom/place-caret-at-vertical-edge.js.map +1 -1
  158. package/build-module/dom/remove-invalid-html.js +1 -1
  159. package/build-module/dom/remove-invalid-html.js.map +1 -1
  160. package/build-module/dom/remove.js +1 -1
  161. package/build-module/dom/remove.js.map +1 -1
  162. package/build-module/dom/replace-tag.js +1 -3
  163. package/build-module/dom/replace-tag.js.map +1 -1
  164. package/build-module/dom/replace.js +1 -1
  165. package/build-module/dom/replace.js.map +1 -1
  166. package/build-module/dom/safe-html.js +1 -6
  167. package/build-module/dom/safe-html.js.map +1 -1
  168. package/build-module/dom/scroll-if-no-range.js +25 -0
  169. package/build-module/dom/scroll-if-no-range.js.map +1 -0
  170. package/build-module/dom/strip-html.js +1 -1
  171. package/build-module/dom/strip-html.js.map +1 -1
  172. package/build-module/dom/unwrap.js +1 -3
  173. package/build-module/dom/unwrap.js.map +1 -1
  174. package/build-module/dom/wrap.js +1 -1
  175. package/build-module/dom/wrap.js.map +1 -1
  176. package/build-module/focusable.js +5 -17
  177. package/build-module/focusable.js.map +1 -1
  178. package/build-module/index.js +1 -1
  179. package/build-module/index.js.map +1 -1
  180. package/build-module/phrasing-content.js +13 -11
  181. package/build-module/phrasing-content.js.map +1 -1
  182. package/build-module/tabbable.js +22 -33
  183. package/build-module/tabbable.js.map +1 -1
  184. package/build-module/utils/assert-is-defined.js.map +1 -1
  185. package/build-types/dom/is-edge.d.ts +4 -4
  186. package/build-types/dom/is-edge.d.ts.map +1 -1
  187. package/build-types/dom/is-horizontal-edge.d.ts +3 -3
  188. package/build-types/dom/is-horizontal-edge.d.ts.map +1 -1
  189. package/build-types/dom/is-vertical-edge.d.ts +3 -3
  190. package/build-types/dom/is-vertical-edge.d.ts.map +1 -1
  191. package/build-types/dom/place-caret-at-edge.d.ts.map +1 -1
  192. package/build-types/dom/scroll-if-no-range.d.ts +12 -0
  193. package/build-types/dom/scroll-if-no-range.d.ts.map +1 -0
  194. package/build-types/index.d.ts +2 -2
  195. package/build-types/index.d.ts.map +1 -1
  196. package/package.json +3 -3
  197. package/src/dom/is-edge.js +6 -8
  198. package/src/dom/is-horizontal-edge.js +2 -2
  199. package/src/dom/is-vertical-edge.js +2 -2
  200. package/src/dom/place-caret-at-edge.js +5 -19
  201. package/src/dom/scroll-if-no-range.js +34 -0
  202. package/tsconfig.tsbuildinfo +1 -1
@@ -8,37 +8,32 @@ import isSelectionForward from './is-selection-forward';
8
8
  import hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';
9
9
  import { assertIsDefined } from '../utils/assert-is-defined';
10
10
  import isInputOrTextArea from './is-input-or-text-area';
11
+ import { scrollIfNoRange } from './scroll-if-no-range';
12
+
11
13
  /**
12
14
  * Check whether the selection is at the edge of the container. Checks for
13
15
  * horizontal position by default. Set `onlyVertical` to true to check only
14
16
  * vertically.
15
17
  *
16
- * @param {Element} container Focusable element.
17
- * @param {boolean} isReverse Set to true to check left, false to check right.
18
- * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.
18
+ * @param {HTMLElement} container Focusable element.
19
+ * @param {boolean} isReverse Set to true to check left, false to check right.
20
+ * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.
19
21
  *
20
22
  * @return {boolean} True if at the edge, false if not.
21
23
  */
22
-
23
24
  export default function isEdge(container, isReverse, onlyVertical = false) {
24
25
  if (isInputOrTextArea(container) && typeof container.selectionStart === 'number') {
25
26
  if (container.selectionStart !== container.selectionEnd) {
26
27
  return false;
27
28
  }
28
-
29
29
  if (isReverse) {
30
30
  return container.selectionStart === 0;
31
31
  }
32
-
33
32
  return container.value.length === container.selectionStart;
34
33
  }
35
-
36
- if (!
37
- /** @type {HTMLElement} */
38
- container.isContentEditable) {
34
+ if (! /** @type {HTMLElement} */container.isContentEditable) {
39
35
  return true;
40
36
  }
41
-
42
37
  const {
43
38
  ownerDocument
44
39
  } = container;
@@ -47,39 +42,37 @@ export default function isEdge(container, isReverse, onlyVertical = false) {
47
42
  } = ownerDocument;
48
43
  assertIsDefined(defaultView, 'defaultView');
49
44
  const selection = defaultView.getSelection();
50
-
51
45
  if (!selection || !selection.rangeCount) {
52
46
  return false;
53
47
  }
54
-
55
48
  const range = selection.getRangeAt(0);
56
49
  const collapsedRange = range.cloneRange();
57
50
  const isForward = isSelectionForward(selection);
58
- const isCollapsed = selection.isCollapsed; // Collapse in direction of selection.
51
+ const isCollapsed = selection.isCollapsed;
59
52
 
53
+ // Collapse in direction of selection.
60
54
  if (!isCollapsed) {
61
55
  collapsedRange.collapse(!isForward);
62
56
  }
63
-
64
57
  const collapsedRangeRect = getRectangleFromRange(collapsedRange);
65
58
  const rangeRect = getRectangleFromRange(range);
66
-
67
59
  if (!collapsedRangeRect || !rangeRect) {
68
60
  return false;
69
- } // Only consider the multiline selection at the edge if the direction is
61
+ }
62
+
63
+ // Only consider the multiline selection at the edge if the direction is
70
64
  // towards the edge. The selection is multiline if it is taller than the
71
65
  // collapsed selection.
72
-
73
-
74
66
  const rangeHeight = getRangeHeight(range);
75
-
76
67
  if (!isCollapsed && rangeHeight && rangeHeight > collapsedRangeRect.height && isForward === isReverse) {
77
68
  return false;
78
- } // In the case of RTL scripts, the horizontal edge is at the opposite side.
79
-
69
+ }
80
70
 
71
+ // In the case of RTL scripts, the horizontal edge is at the opposite side.
81
72
  const isReverseDir = isRTL(container) ? !isReverse : isReverse;
82
- const containerRect = container.getBoundingClientRect(); // To check if a selection is at the edge, we insert a test selection at the
73
+ const containerRect = container.getBoundingClientRect();
74
+
75
+ // To check if a selection is at the edge, we insert a test selection at the
83
76
  // edge of the container and check if the selections have the same vertical
84
77
  // or horizontal position. If they do, the selection is at the edge.
85
78
  // This method proves to be better than a DOM-based calculation for the
@@ -89,28 +82,22 @@ export default function isEdge(container, isReverse, onlyVertical = false) {
89
82
  // It also proves better than using the computed style for the vertical
90
83
  // edge, because we cannot know the padding and line height reliably in
91
84
  // pixels. `getComputedStyle` may return a value with different units.
92
-
93
85
  const x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;
94
86
  const y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;
95
- const testRange = hiddenCaretRangeFromPoint(ownerDocument, x, y,
96
- /** @type {HTMLElement} */
97
- container);
98
-
87
+ const testRange = scrollIfNoRange(container, isReverse, () => hiddenCaretRangeFromPoint(ownerDocument, x, y, container));
99
88
  if (!testRange) {
100
89
  return false;
101
90
  }
102
-
103
91
  const testRect = getRectangleFromRange(testRange);
104
-
105
92
  if (!testRect) {
106
93
  return false;
107
94
  }
108
-
109
95
  const verticalSide = isReverse ? 'top' : 'bottom';
110
96
  const horizontalSide = isReverseDir ? 'left' : 'right';
111
97
  const verticalDiff = testRect[verticalSide] - rangeRect[verticalSide];
112
- const horizontalDiff = testRect[horizontalSide] - collapsedRangeRect[horizontalSide]; // Allow the position to be 1px off.
98
+ const horizontalDiff = testRect[horizontalSide] - collapsedRangeRect[horizontalSide];
113
99
 
100
+ // Allow the position to be 1px off.
114
101
  const hasVerticalDiff = Math.abs(verticalDiff) <= 1;
115
102
  const hasHorizontalDiff = Math.abs(horizontalDiff) <= 1;
116
103
  return onlyVertical ? hasVerticalDiff : hasVerticalDiff && hasHorizontalDiff;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isRTL","getRangeHeight","getRectangleFromRange","isSelectionForward","hiddenCaretRangeFromPoint","assertIsDefined","isInputOrTextArea","isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"mappings":"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","sourcesContent":["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {Element} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! ( /** @type {HTMLElement} */ ( container ).isContentEditable ) ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"]}
1
+ {"version":3,"names":["isRTL","getRangeHeight","getRectangleFromRange","isSelectionForward","hiddenCaretRangeFromPoint","assertIsDefined","isInputOrTextArea","scrollIfNoRange","isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"sources":["@wordpress/dom/src/dom/is-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! ( /** @type {HTMLElement} */ ( container ).isContentEditable ) ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = scrollIfNoRange( container, isReverse, () =>\n\t\thiddenCaretRangeFromPoint( ownerDocument, x, y, container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,UAAU;AAC5B,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,OAAOC,iBAAiB,MAAM,yBAAyB;AACvD,SAASC,eAAe,QAAQ,sBAAsB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,MAAMA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,YAAY,GAAG,KAAK,EAAG;EAC5E,IACCL,iBAAiB,CAAEG,SAAU,CAAC,IAC9B,OAAOA,SAAS,CAACG,cAAc,KAAK,QAAQ,EAC3C;IACD,IAAKH,SAAS,CAACG,cAAc,KAAKH,SAAS,CAACI,YAAY,EAAG;MAC1D,OAAO,KAAK;IACb;IAEA,IAAKH,SAAS,EAAG;MAChB,OAAOD,SAAS,CAACG,cAAc,KAAK,CAAC;IACtC;IAEA,OAAOH,SAAS,CAACK,KAAK,CAACC,MAAM,KAAKN,SAAS,CAACG,cAAc;EAC3D;EAEA,IAAK,EAAI,0BAA6BH,SAAS,CAAGO,iBAAmB,EAAG;IACvE,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC;EAAc,CAAC,GAAGR,SAAS;EACnC,MAAM;IAAES;EAAY,CAAC,GAAGD,aAAa;EAErCZ,eAAe,CAAEa,WAAW,EAAE,aAAc,CAAC;EAC7C,MAAMC,SAAS,GAAGD,WAAW,CAACE,YAAY,CAAC,CAAC;EAE5C,IAAK,CAAED,SAAS,IAAI,CAAEA,SAAS,CAACE,UAAU,EAAG;IAC5C,OAAO,KAAK;EACb;EAEA,MAAMC,KAAK,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC;EACvC,MAAMC,cAAc,GAAGF,KAAK,CAACG,UAAU,CAAC,CAAC;EACzC,MAAMC,SAAS,GAAGvB,kBAAkB,CAAEgB,SAAU,CAAC;EACjD,MAAMQ,WAAW,GAAGR,SAAS,CAACQ,WAAW;;EAEzC;EACA,IAAK,CAAEA,WAAW,EAAG;IACpBH,cAAc,CAACI,QAAQ,CAAE,CAAEF,SAAU,CAAC;EACvC;EAEA,MAAMG,kBAAkB,GAAG3B,qBAAqB,CAAEsB,cAAe,CAAC;EAClE,MAAMM,SAAS,GAAG5B,qBAAqB,CAAEoB,KAAM,CAAC;EAEhD,IAAK,CAAEO,kBAAkB,IAAI,CAAEC,SAAS,EAAG;IAC1C,OAAO,KAAK;EACb;;EAEA;EACA;EACA;EACA,MAAMC,WAAW,GAAG9B,cAAc,CAAEqB,KAAM,CAAC;EAC3C,IACC,CAAEK,WAAW,IACbI,WAAW,IACXA,WAAW,GAAGF,kBAAkB,CAACG,MAAM,IACvCN,SAAS,KAAKhB,SAAS,EACtB;IACD,OAAO,KAAK;EACb;;EAEA;EACA,MAAMuB,YAAY,GAAGjC,KAAK,CAAES,SAAU,CAAC,GAAG,CAAEC,SAAS,GAAGA,SAAS;EACjE,MAAMwB,aAAa,GAAGzB,SAAS,CAAC0B,qBAAqB,CAAC,CAAC;;EAEvD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,CAAC,GAAGH,YAAY,GAAGC,aAAa,CAACG,IAAI,GAAG,CAAC,GAAGH,aAAa,CAACI,KAAK,GAAG,CAAC;EACzE,MAAMC,CAAC,GAAG7B,SAAS,GAAGwB,aAAa,CAACM,GAAG,GAAG,CAAC,GAAGN,aAAa,CAACO,MAAM,GAAG,CAAC;EACtE,MAAMC,SAAS,GAAGnC,eAAe,CAAEE,SAAS,EAAEC,SAAS,EAAE,MACxDN,yBAAyB,CAAEa,aAAa,EAAEmB,CAAC,EAAEG,CAAC,EAAE9B,SAAU,CAC3D,CAAC;EAED,IAAK,CAAEiC,SAAS,EAAG;IAClB,OAAO,KAAK;EACb;EAEA,MAAMC,QAAQ,GAAGzC,qBAAqB,CAAEwC,SAAU,CAAC;EAEnD,IAAK,CAAEC,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EAEA,MAAMC,YAAY,GAAGlC,SAAS,GAAG,KAAK,GAAG,QAAQ;EACjD,MAAMmC,cAAc,GAAGZ,YAAY,GAAG,MAAM,GAAG,OAAO;EACtD,MAAMa,YAAY,GAAGH,QAAQ,CAAEC,YAAY,CAAE,GAAGd,SAAS,CAAEc,YAAY,CAAE;EACzE,MAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAc,CAAE,GAAGhB,kBAAkB,CAAEgB,cAAc,CAAE;;EAElE;EACA,MAAMG,eAAe,GAAGC,IAAI,CAACC,GAAG,CAAEJ,YAAa,CAAC,IAAI,CAAC;EACrD,MAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAG,CAAEH,cAAe,CAAC,IAAI,CAAC;EAEzD,OAAOpC,YAAY,GAChBqC,eAAe,GACfA,eAAe,IAAIG,iBAAiB;AACxC"}
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable jsdoc/valid-types */
2
-
3
2
  /**
4
3
  * @param {Node | null | undefined} node
5
4
  * @return {node is Element} True if node is an Element node
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-element.js"],"names":["isElement","node","nodeType","ELEMENT_NODE"],"mappings":"AAAA;;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,SAAT,CAAoBC,IAApB,EAA2B;AACzC;AACA,SAAO,CAAC,CAAEA,IAAH,IAAWA,IAAI,CAACC,QAAL,KAAkBD,IAAI,CAACE,YAAzC;AACA","sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node | null | undefined} node\n * @return {node is Element} True if node is an Element node\n */\nexport default function isElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn !! node && node.nodeType === node.ELEMENT_NODE;\n}\n"]}
1
+ {"version":3,"names":["isElement","node","nodeType","ELEMENT_NODE"],"sources":["@wordpress/dom/src/dom/is-element.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node | null | undefined} node\n * @return {node is Element} True if node is an Element node\n */\nexport default function isElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn !! node && node.nodeType === node.ELEMENT_NODE;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,SAASA,CAAEC,IAAI,EAAG;EACzC;EACA,OAAO,CAAC,CAAEA,IAAI,IAAIA,IAAI,CAACC,QAAQ,KAAKD,IAAI,CAACE,YAAY;AACtD"}
@@ -12,19 +12,14 @@ export default function isEmpty(element) {
12
12
  // We cannot use \s since it includes special spaces which we want
13
13
  // to preserve.
14
14
  return /^[ \f\n\r\t\v\u00a0]*$/.test(element.nodeValue || '');
15
-
16
15
  case element.ELEMENT_NODE:
17
16
  if (element.hasAttributes()) {
18
17
  return false;
19
18
  } else if (!element.hasChildNodes()) {
20
19
  return true;
21
20
  }
22
-
23
- return (
24
- /** @type {Element[]} */
25
- Array.from(element.childNodes).every(isEmpty)
21
+ return (/** @type {Element[]} */Array.from(element.childNodes).every(isEmpty)
26
22
  );
27
-
28
23
  default:
29
24
  return true;
30
25
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-empty.js"],"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,OAAT,CAAkBC,OAAlB,EAA4B;AAC1C,UAASA,OAAO,CAACC,QAAjB;AACC,SAAKD,OAAO,CAACE,SAAb;AACC;AACA;AACA,aAAO,yBAAyBC,IAAzB,CAA+BH,OAAO,CAACI,SAAR,IAAqB,EAApD,CAAP;;AACD,SAAKJ,OAAO,CAACK,YAAb;AACC,UAAKL,OAAO,CAACM,aAAR,EAAL,EAA+B;AAC9B,eAAO,KAAP;AACA,OAFD,MAEO,IAAK,CAAEN,OAAO,CAACO,aAAR,EAAP,EAAiC;AACvC,eAAO,IAAP;AACA;;AAED;AAAO;AACNC,QAAAA,KAAK,CAACC,IAAN,CAAYT,OAAO,CAACU,UAApB,CAD+B,CAE9BC,KAF8B,CAEvBZ,OAFuB;AAAhC;;AAGD;AACC,aAAO,IAAP;AAhBF;AAkBA","sourcesContent":["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ (\n\t\t\t\tArray.from( element.childNodes )\n\t\t\t).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"sources":["@wordpress/dom/src/dom/is-empty.js"],"sourcesContent":["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ (\n\t\t\t\tArray.from( element.childNodes )\n\t\t\t).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,OAAOA,CAAEC,OAAO,EAAG;EAC1C,QAASA,OAAO,CAACC,QAAQ;IACxB,KAAKD,OAAO,CAACE,SAAS;MACrB;MACA;MACA,OAAO,wBAAwB,CAACC,IAAI,CAAEH,OAAO,CAACI,SAAS,IAAI,EAAG,CAAC;IAChE,KAAKJ,OAAO,CAACK,YAAY;MACxB,IAAKL,OAAO,CAACM,aAAa,CAAC,CAAC,EAAG;QAC9B,OAAO,KAAK;MACb,CAAC,MAAM,IAAK,CAAEN,OAAO,CAACO,aAAa,CAAC,CAAC,EAAG;QACvC,OAAO,IAAI;MACZ;MAEA,OAAO,yBACNC,KAAK,CAACC,IAAI,CAAET,OAAO,CAACU,UAAW,CAAC,CAC/BC,KAAK,CAAEZ,OAAQ;MAAC;IACnB;MACC,OAAO,IAAI;EACb;AACD"}
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { assertIsDefined } from '../utils/assert-is-defined';
5
5
  import isInputOrTextArea from './is-input-or-text-area';
6
+
6
7
  /**
7
8
  * Check whether the contents of the element have been entirely selected.
8
9
  * Returns true if there is no possibility of selection.
@@ -11,16 +12,13 @@ import isInputOrTextArea from './is-input-or-text-area';
11
12
  *
12
13
  * @return {boolean} True if entirely selected, false if not.
13
14
  */
14
-
15
15
  export default function isEntirelySelected(element) {
16
16
  if (isInputOrTextArea(element)) {
17
17
  return element.selectionStart === 0 && element.value.length === element.selectionEnd;
18
18
  }
19
-
20
19
  if (!element.isContentEditable) {
21
20
  return true;
22
21
  }
23
-
24
22
  const {
25
23
  ownerDocument
26
24
  } = element;
@@ -31,29 +29,24 @@ export default function isEntirelySelected(element) {
31
29
  const selection = defaultView.getSelection();
32
30
  assertIsDefined(selection, 'selection');
33
31
  const range = selection.rangeCount ? selection.getRangeAt(0) : null;
34
-
35
32
  if (!range) {
36
33
  return true;
37
34
  }
38
-
39
35
  const {
40
36
  startContainer,
41
37
  endContainer,
42
38
  startOffset,
43
39
  endOffset
44
40
  } = range;
45
-
46
41
  if (startContainer === element && endContainer === element && startOffset === 0 && endOffset === element.childNodes.length) {
47
42
  return true;
48
43
  }
49
-
50
44
  const lastChild = element.lastChild;
51
45
  assertIsDefined(lastChild, 'lastChild');
52
- const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ?
53
- /** @type {Text} */
54
- endContainer.data.length : endContainer.childNodes.length;
46
+ const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ? /** @type {Text} */endContainer.data.length : endContainer.childNodes.length;
55
47
  return isDeepChild(startContainer, element, 'firstChild') && isDeepChild(endContainer, element, 'lastChild') && startOffset === 0 && endOffset === endContainerContentLength;
56
48
  }
49
+
57
50
  /**
58
51
  * Check whether the contents of the element have been entirely selected.
59
52
  * Returns true if there is no possibility of selection.
@@ -64,19 +57,15 @@ export default function isEntirelySelected(element) {
64
57
  *
65
58
  * @return {boolean} True if query is a deep first/last child of container, false otherwise.
66
59
  */
67
-
68
60
  function isDeepChild(query, container, propName) {
69
61
  /** @type {HTMLElement | ChildNode | null} */
70
62
  let candidate = container;
71
-
72
63
  do {
73
64
  if (query === candidate) {
74
65
  return true;
75
66
  }
76
-
77
67
  candidate = candidate[propName];
78
68
  } while (candidate);
79
-
80
69
  return false;
81
70
  }
82
71
  //# sourceMappingURL=is-entirely-selected.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-entirely-selected.js"],"names":["assertIsDefined","isInputOrTextArea","isEntirelySelected","element","selectionStart","value","length","selectionEnd","isContentEditable","ownerDocument","defaultView","selection","getSelection","range","rangeCount","getRangeAt","startContainer","endContainer","startOffset","endOffset","childNodes","lastChild","endContainerContentLength","nodeType","TEXT_NODE","data","isDeepChild","query","container","propName","candidate"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,4BAAhC;AACA,OAAOC,iBAAP,MAA8B,yBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,kBAAT,CAA6BC,OAA7B,EAAuC;AACrD,MAAKF,iBAAiB,CAAEE,OAAF,CAAtB,EAAoC;AACnC,WACCA,OAAO,CAACC,cAAR,KAA2B,CAA3B,IACAD,OAAO,CAACE,KAAR,CAAcC,MAAd,KAAyBH,OAAO,CAACI,YAFlC;AAIA;;AAED,MAAK,CAAEJ,OAAO,CAACK,iBAAf,EAAmC;AAClC,WAAO,IAAP;AACA;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAAoBN,OAA1B;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAkBD,aAAxB;AACAT,EAAAA,eAAe,CAAEU,WAAF,EAAe,aAAf,CAAf;AACA,QAAMC,SAAS,GAAGD,WAAW,CAACE,YAAZ,EAAlB;AACAZ,EAAAA,eAAe,CAAEW,SAAF,EAAa,WAAb,CAAf;AACA,QAAME,KAAK,GAAGF,SAAS,CAACG,UAAV,GAAuBH,SAAS,CAACI,UAAV,CAAsB,CAAtB,CAAvB,GAAmD,IAAjE;;AAEA,MAAK,CAAEF,KAAP,EAAe;AACd,WAAO,IAAP;AACA;;AAED,QAAM;AAAEG,IAAAA,cAAF;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA,WAAhC;AAA6CC,IAAAA;AAA7C,MAA2DN,KAAjE;;AAEA,MACCG,cAAc,KAAKb,OAAnB,IACAc,YAAY,KAAKd,OADjB,IAEAe,WAAW,KAAK,CAFhB,IAGAC,SAAS,KAAKhB,OAAO,CAACiB,UAAR,CAAmBd,MAJlC,EAKE;AACD,WAAO,IAAP;AACA;;AAED,QAAMe,SAAS,GAAGlB,OAAO,CAACkB,SAA1B;AACArB,EAAAA,eAAe,CAAEqB,SAAF,EAAa,WAAb,CAAf;AACA,QAAMC,yBAAyB,GAC9BL,YAAY,CAACM,QAAb,KAA0BN,YAAY,CAACO,SAAvC;AACG;AAAsBP,EAAAA,YAAF,CAAiBQ,IAAjB,CAAsBnB,MAD7C,GAEGW,YAAY,CAACG,UAAb,CAAwBd,MAH5B;AAKA,SACCoB,WAAW,CAAEV,cAAF,EAAkBb,OAAlB,EAA2B,YAA3B,CAAX,IACAuB,WAAW,CAAET,YAAF,EAAgBd,OAAhB,EAAyB,WAAzB,CADX,IAEAe,WAAW,KAAK,CAFhB,IAGAC,SAAS,KAAKG,yBAJf;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASI,WAAT,CAAsBC,KAAtB,EAA6BC,SAA7B,EAAwCC,QAAxC,EAAmD;AAClD;AACA,MAAIC,SAAS,GAAGF,SAAhB;;AACA,KAAG;AACF,QAAKD,KAAK,KAAKG,SAAf,EAA2B;AAC1B,aAAO,IAAP;AACA;;AACDA,IAAAA,SAAS,GAAGA,SAAS,CAAED,QAAF,CAArB;AACA,GALD,QAKUC,SALV;;AAMA,SAAO,KAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement} element The element to check.\n *\n * @return {boolean} True if entirely selected, false if not.\n */\nexport default function isEntirelySelected( element ) {\n\tif ( isInputOrTextArea( element ) ) {\n\t\treturn (\n\t\t\telement.selectionStart === 0 &&\n\t\t\telement.value.length === element.selectionEnd\n\t\t);\n\t}\n\n\tif ( ! element.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn true;\n\t}\n\n\tconst { startContainer, endContainer, startOffset, endOffset } = range;\n\n\tif (\n\t\tstartContainer === element &&\n\t\tendContainer === element &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === element.childNodes.length\n\t) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = element.lastChild;\n\tassertIsDefined( lastChild, 'lastChild' );\n\tconst endContainerContentLength =\n\t\tendContainer.nodeType === endContainer.TEXT_NODE\n\t\t\t? /** @type {Text} */ ( endContainer ).data.length\n\t\t\t: endContainer.childNodes.length;\n\n\treturn (\n\t\tisDeepChild( startContainer, element, 'firstChild' ) &&\n\t\tisDeepChild( endContainer, element, 'lastChild' ) &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === endContainerContentLength\n\t);\n}\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement|Node} query The element to check.\n * @param {HTMLElement} container The container that we suspect \"query\" may be a first or last child of.\n * @param {\"firstChild\"|\"lastChild\"} propName \"firstChild\" or \"lastChild\"\n *\n * @return {boolean} True if query is a deep first/last child of container, false otherwise.\n */\nfunction isDeepChild( query, container, propName ) {\n\t/** @type {HTMLElement | ChildNode | null} */\n\tlet candidate = container;\n\tdo {\n\t\tif ( query === candidate ) {\n\t\t\treturn true;\n\t\t}\n\t\tcandidate = candidate[ propName ];\n\t} while ( candidate );\n\treturn false;\n}\n"]}
1
+ {"version":3,"names":["assertIsDefined","isInputOrTextArea","isEntirelySelected","element","selectionStart","value","length","selectionEnd","isContentEditable","ownerDocument","defaultView","selection","getSelection","range","rangeCount","getRangeAt","startContainer","endContainer","startOffset","endOffset","childNodes","lastChild","endContainerContentLength","nodeType","TEXT_NODE","data","isDeepChild","query","container","propName","candidate"],"sources":["@wordpress/dom/src/dom/is-entirely-selected.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement} element The element to check.\n *\n * @return {boolean} True if entirely selected, false if not.\n */\nexport default function isEntirelySelected( element ) {\n\tif ( isInputOrTextArea( element ) ) {\n\t\treturn (\n\t\t\telement.selectionStart === 0 &&\n\t\t\telement.value.length === element.selectionEnd\n\t\t);\n\t}\n\n\tif ( ! element.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn true;\n\t}\n\n\tconst { startContainer, endContainer, startOffset, endOffset } = range;\n\n\tif (\n\t\tstartContainer === element &&\n\t\tendContainer === element &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === element.childNodes.length\n\t) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = element.lastChild;\n\tassertIsDefined( lastChild, 'lastChild' );\n\tconst endContainerContentLength =\n\t\tendContainer.nodeType === endContainer.TEXT_NODE\n\t\t\t? /** @type {Text} */ ( endContainer ).data.length\n\t\t\t: endContainer.childNodes.length;\n\n\treturn (\n\t\tisDeepChild( startContainer, element, 'firstChild' ) &&\n\t\tisDeepChild( endContainer, element, 'lastChild' ) &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === endContainerContentLength\n\t);\n}\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement|Node} query The element to check.\n * @param {HTMLElement} container The container that we suspect \"query\" may be a first or last child of.\n * @param {\"firstChild\"|\"lastChild\"} propName \"firstChild\" or \"lastChild\"\n *\n * @return {boolean} True if query is a deep first/last child of container, false otherwise.\n */\nfunction isDeepChild( query, container, propName ) {\n\t/** @type {HTMLElement | ChildNode | null} */\n\tlet candidate = container;\n\tdo {\n\t\tif ( query === candidate ) {\n\t\t\treturn true;\n\t\t}\n\t\tcandidate = candidate[ propName ];\n\t} while ( candidate );\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;AAC5D,OAAOC,iBAAiB,MAAM,yBAAyB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,kBAAkBA,CAAEC,OAAO,EAAG;EACrD,IAAKF,iBAAiB,CAAEE,OAAQ,CAAC,EAAG;IACnC,OACCA,OAAO,CAACC,cAAc,KAAK,CAAC,IAC5BD,OAAO,CAACE,KAAK,CAACC,MAAM,KAAKH,OAAO,CAACI,YAAY;EAE/C;EAEA,IAAK,CAAEJ,OAAO,CAACK,iBAAiB,EAAG;IAClC,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC;EAAc,CAAC,GAAGN,OAAO;EACjC,MAAM;IAAEO;EAAY,CAAC,GAAGD,aAAa;EACrCT,eAAe,CAAEU,WAAW,EAAE,aAAc,CAAC;EAC7C,MAAMC,SAAS,GAAGD,WAAW,CAACE,YAAY,CAAC,CAAC;EAC5CZ,eAAe,CAAEW,SAAS,EAAE,WAAY,CAAC;EACzC,MAAME,KAAK,GAAGF,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EAErE,IAAK,CAAEF,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEG,cAAc;IAAEC,YAAY;IAAEC,WAAW;IAAEC;EAAU,CAAC,GAAGN,KAAK;EAEtE,IACCG,cAAc,KAAKb,OAAO,IAC1Bc,YAAY,KAAKd,OAAO,IACxBe,WAAW,KAAK,CAAC,IACjBC,SAAS,KAAKhB,OAAO,CAACiB,UAAU,CAACd,MAAM,EACtC;IACD,OAAO,IAAI;EACZ;EAEA,MAAMe,SAAS,GAAGlB,OAAO,CAACkB,SAAS;EACnCrB,eAAe,CAAEqB,SAAS,EAAE,WAAY,CAAC;EACzC,MAAMC,yBAAyB,GAC9BL,YAAY,CAACM,QAAQ,KAAKN,YAAY,CAACO,SAAS,GAC7C,mBAAsBP,YAAY,CAAGQ,IAAI,CAACnB,MAAM,GAChDW,YAAY,CAACG,UAAU,CAACd,MAAM;EAElC,OACCoB,WAAW,CAAEV,cAAc,EAAEb,OAAO,EAAE,YAAa,CAAC,IACpDuB,WAAW,CAAET,YAAY,EAAEd,OAAO,EAAE,WAAY,CAAC,IACjDe,WAAW,KAAK,CAAC,IACjBC,SAAS,KAAKG,yBAAyB;AAEzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,WAAWA,CAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAG;EAClD;EACA,IAAIC,SAAS,GAAGF,SAAS;EACzB,GAAG;IACF,IAAKD,KAAK,KAAKG,SAAS,EAAG;MAC1B,OAAO,IAAI;IACZ;IACAA,SAAS,GAAGA,SAAS,CAAED,QAAQ,CAAE;EAClC,CAAC,QAASC,SAAS;EACnB,OAAO,KAAK;AACb"}
@@ -2,6 +2,7 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import isInputOrTextArea from './is-input-or-text-area';
5
+
5
6
  /**
6
7
  *
7
8
  * Detects if element is a form element.
@@ -10,12 +11,10 @@ import isInputOrTextArea from './is-input-or-text-area';
10
11
  *
11
12
  * @return {boolean} True if form element and false otherwise.
12
13
  */
13
-
14
14
  export default function isFormElement(element) {
15
15
  if (!element) {
16
16
  return false;
17
17
  }
18
-
19
18
  const {
20
19
  tagName
21
20
  } = element;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-form-element.js"],"names":["isInputOrTextArea","isFormElement","element","tagName","checkForInputTextarea"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,iBAAP,MAA8B,yBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,aAAT,CAAwBC,OAAxB,EAAkC;AAChD,MAAK,CAAEA,OAAP,EAAiB;AAChB,WAAO,KAAP;AACA;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAAcD,OAApB;AACA,QAAME,qBAAqB,GAAGJ,iBAAiB,CAAEE,OAAF,CAA/C;AACA,SACCE,qBAAqB,IAAID,OAAO,KAAK,QAArC,IAAiDA,OAAO,KAAK,QAD9D;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if form element and false otherwise.\n */\nexport default function isFormElement( element ) {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"]}
1
+ {"version":3,"names":["isInputOrTextArea","isFormElement","element","tagName","checkForInputTextarea"],"sources":["@wordpress/dom/src/dom/is-form-element.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if form element and false otherwise.\n */\nexport default function isFormElement( element ) {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,iBAAiB,MAAM,yBAAyB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAAEC,OAAO,EAAG;EAChD,IAAK,CAAEA,OAAO,EAAG;IAChB,OAAO,KAAK;EACb;EAEA,MAAM;IAAEC;EAAQ,CAAC,GAAGD,OAAO;EAC3B,MAAME,qBAAqB,GAAGJ,iBAAiB,CAAEE,OAAQ,CAAC;EAC1D,OACCE,qBAAqB,IAAID,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAK,QAAQ;AAEvE"}
@@ -2,15 +2,15 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import isEdge from './is-edge';
5
+
5
6
  /**
6
7
  * Check whether the selection is horizontally at the edge of the container.
7
8
  *
8
- * @param {Element} container Focusable element.
9
- * @param {boolean} isReverse Set to true to check left, false for right.
9
+ * @param {HTMLElement} container Focusable element.
10
+ * @param {boolean} isReverse Set to true to check left, false for right.
10
11
  *
11
12
  * @return {boolean} True if at the horizontal edge, false if not.
12
13
  */
13
-
14
14
  export default function isHorizontalEdge(container, isReverse) {
15
15
  return isEdge(container, isReverse);
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-horizontal-edge.js"],"names":["isEdge","isHorizontalEdge","container","isReverse"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,WAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,gBAAT,CAA2BC,SAA3B,EAAsCC,SAAtC,EAAkD;AAChE,SAAOH,MAAM,CAAEE,SAAF,EAAaC,SAAb,CAAb;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {Element} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse );\n}\n"]}
1
+ {"version":3,"names":["isEdge","isHorizontalEdge","container","isReverse"],"sources":["@wordpress/dom/src/dom/is-horizontal-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,WAAW;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAChE,OAAOH,MAAM,CAAEE,SAAS,EAAEC,SAAU,CAAC;AACtC"}
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable jsdoc/valid-types */
2
-
3
2
  /**
4
3
  * @param {Node} node
5
4
  * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-html-input-element.js"],"names":["isHTMLInputElement","node","nodeName"],"mappings":"AAAA;;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,kBAAT,CAA6BC,IAA7B,EAAoC;AAClD;AACA,SAAOA,IAAI,EAAEC,QAAN,KAAmB,OAA1B;AACA","sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn node?.nodeName === 'INPUT';\n}\n"]}
1
+ {"version":3,"names":["isHTMLInputElement","node","nodeName"],"sources":["@wordpress/dom/src/dom/is-html-input-element.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn node?.nodeName === 'INPUT';\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,kBAAkBA,CAAEC,IAAI,EAAG;EAClD;EACA,OAAOA,IAAI,EAAEC,QAAQ,KAAK,OAAO;AAClC"}
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable jsdoc/valid-types */
2
-
3
2
  /**
4
3
  * @param {Element} element
5
4
  * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-input-or-text-area.js"],"names":["isInputOrTextArea","element","tagName"],"mappings":"AAAA;;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,iBAAT,CAA4BC,OAA5B,EAAsC;AACpD;AACA,SAAOA,OAAO,CAACC,OAAR,KAAoB,OAApB,IAA+BD,OAAO,CAACC,OAAR,KAAoB,UAA1D;AACA","sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"]}
1
+ {"version":3,"names":["isInputOrTextArea","element","tagName"],"sources":["@wordpress/dom/src/dom/is-input-or-text-area.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,iBAAiBA,CAAEC,OAAO,EAAG;EACpD;EACA,OAAOA,OAAO,CAACC,OAAO,KAAK,OAAO,IAAID,OAAO,CAACC,OAAO,KAAK,UAAU;AACrE"}
@@ -2,13 +2,13 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import deprecated from '@wordpress/deprecated';
5
+
5
6
  /**
6
7
  * Internal dependencies
7
8
  */
8
-
9
9
  import isHTMLInputElement from './is-html-input-element';
10
- /* eslint-disable jsdoc/valid-types */
11
10
 
11
+ /* eslint-disable jsdoc/valid-types */
12
12
  /**
13
13
  * Check whether the given element is an input field of type number.
14
14
  *
@@ -16,14 +16,12 @@ import isHTMLInputElement from './is-html-input-element';
16
16
  *
17
17
  * @return {node is HTMLInputElement} True if the node is number input.
18
18
  */
19
-
20
19
  export default function isNumberInput(node) {
21
20
  deprecated('wp.dom.isNumberInput', {
22
21
  since: '6.1',
23
22
  version: '6.5'
24
23
  });
25
24
  /* eslint-enable jsdoc/valid-types */
26
-
27
25
  return isHTMLInputElement(node) && node.type === 'number' && !isNaN(node.valueAsNumber);
28
26
  }
29
27
  //# sourceMappingURL=is-number-input.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-number-input.js"],"names":["deprecated","isHTMLInputElement","isNumberInput","node","since","version","type","isNaN","valueAsNumber"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,aAAT,CAAwBC,IAAxB,EAA+B;AAC7CH,EAAAA,UAAU,CAAE,sBAAF,EAA0B;AACnCI,IAAAA,KAAK,EAAE,KAD4B;AAEnCC,IAAAA,OAAO,EAAE;AAF0B,GAA1B,CAAV;AAIA;;AACA,SACCJ,kBAAkB,CAAEE,IAAF,CAAlB,IACAA,IAAI,CAACG,IAAL,KAAc,QADd,IAEA,CAAEC,KAAK,CAAEJ,IAAI,CAACK,aAAP,CAHR;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param {Node} node The HTML node.\n *\n * @return {node is HTMLInputElement} True if the node is number input.\n */\nexport default function isNumberInput( node ) {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\t/* eslint-enable jsdoc/valid-types */\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"]}
1
+ {"version":3,"names":["deprecated","isHTMLInputElement","isNumberInput","node","since","version","type","isNaN","valueAsNumber"],"sources":["@wordpress/dom/src/dom/is-number-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param {Node} node The HTML node.\n *\n * @return {node is HTMLInputElement} True if the node is number input.\n */\nexport default function isNumberInput( node ) {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\t/* eslint-enable jsdoc/valid-types */\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,yBAAyB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAAEC,IAAI,EAAG;EAC7CH,UAAU,CAAE,sBAAsB,EAAE;IACnCI,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;EACH;EACA,OACCJ,kBAAkB,CAAEE,IAAK,CAAC,IAC1BA,IAAI,CAACG,IAAI,KAAK,QAAQ,IACtB,CAAEC,KAAK,CAAEJ,IAAI,CAACK,aAAc,CAAC;AAE/B"}
@@ -2,6 +2,7 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import getComputedStyle from './get-computed-style';
5
+
5
6
  /**
6
7
  * Whether the element's text direction is right-to-left.
7
8
  *
@@ -9,7 +10,6 @@ import getComputedStyle from './get-computed-style';
9
10
  *
10
11
  * @return {boolean} True if rtl, false if ltr.
11
12
  */
12
-
13
13
  export default function isRTL(element) {
14
14
  return getComputedStyle(element).direction === 'rtl';
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-rtl.js"],"names":["getComputedStyle","isRTL","element","direction"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAP,MAA6B,sBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,KAAT,CAAgBC,OAAhB,EAA0B;AACxC,SAAOF,gBAAgB,CAAEE,OAAF,CAAhB,CAA4BC,SAA5B,KAA0C,KAAjD;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if rtl, false if ltr.\n */\nexport default function isRTL( element ) {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"]}
1
+ {"version":3,"names":["getComputedStyle","isRTL","element","direction"],"sources":["@wordpress/dom/src/dom/is-rtl.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if rtl, false if ltr.\n */\nexport default function isRTL( element ) {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,sBAAsB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,KAAKA,CAAEC,OAAO,EAAG;EACxC,OAAOF,gBAAgB,CAAEE,OAAQ,CAAC,CAACC,SAAS,KAAK,KAAK;AACvD"}
@@ -2,6 +2,7 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import { assertIsDefined } from '../utils/assert-is-defined';
5
+
5
6
  /**
6
7
  * Returns true if the given selection object is in the forward direction, or
7
8
  * false otherwise.
@@ -12,7 +13,6 @@ import { assertIsDefined } from '../utils/assert-is-defined';
12
13
  *
13
14
  * @return {boolean} Whether the selection is forward.
14
15
  */
15
-
16
16
  export default function isSelectionForward(selection) {
17
17
  const {
18
18
  anchorNode,
@@ -22,30 +22,28 @@ export default function isSelectionForward(selection) {
22
22
  } = selection;
23
23
  assertIsDefined(anchorNode, 'anchorNode');
24
24
  assertIsDefined(focusNode, 'focusNode');
25
- const position = anchorNode.compareDocumentPosition(focusNode); // Disable reason: `Node#compareDocumentPosition` returns a bitmask value,
26
- // so bitwise operators are intended.
25
+ const position = anchorNode.compareDocumentPosition(focusNode);
27
26
 
27
+ // Disable reason: `Node#compareDocumentPosition` returns a bitmask value,
28
+ // so bitwise operators are intended.
28
29
  /* eslint-disable no-bitwise */
29
30
  // Compare whether anchor node precedes focus node. If focus node (where
30
31
  // end of selection occurs) is after the anchor node, it is forward.
31
-
32
32
  if (position & anchorNode.DOCUMENT_POSITION_PRECEDING) {
33
33
  return false;
34
34
  }
35
-
36
35
  if (position & anchorNode.DOCUMENT_POSITION_FOLLOWING) {
37
36
  return true;
38
37
  }
39
38
  /* eslint-enable no-bitwise */
39
+
40
40
  // `compareDocumentPosition` returns 0 when passed the same node, in which
41
41
  // case compare offsets.
42
-
43
-
44
42
  if (position === 0) {
45
43
  return anchorOffset <= focusOffset;
46
- } // This should never be reached, but return true as default case.
47
-
44
+ }
48
45
 
46
+ // This should never be reached, but return true as default case.
49
47
  return true;
50
48
  }
51
49
  //# sourceMappingURL=is-selection-forward.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-selection-forward.js"],"names":["assertIsDefined","isSelectionForward","selection","anchorNode","focusNode","anchorOffset","focusOffset","position","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_FOLLOWING"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,4BAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,kBAAT,CAA6BC,SAA7B,EAAyC;AACvD,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,SAAd;AAAyBC,IAAAA,YAAzB;AAAuCC,IAAAA;AAAvC,MAAuDJ,SAA7D;AAEAF,EAAAA,eAAe,CAAEG,UAAF,EAAc,YAAd,CAAf;AACAH,EAAAA,eAAe,CAAEI,SAAF,EAAa,WAAb,CAAf;AACA,QAAMG,QAAQ,GAAGJ,UAAU,CAACK,uBAAX,CAAoCJ,SAApC,CAAjB,CALuD,CAOvD;AACA;;AACA;AACA;AACA;;AACA,MAAKG,QAAQ,GAAGJ,UAAU,CAACM,2BAA3B,EAAyD;AACxD,WAAO,KAAP;AACA;;AAED,MAAKF,QAAQ,GAAGJ,UAAU,CAACO,2BAA3B,EAAyD;AACxD,WAAO,IAAP;AACA;AACD;AAEA;AACA;;;AACA,MAAKH,QAAQ,KAAK,CAAlB,EAAsB;AACrB,WAAOF,YAAY,IAAIC,WAAvB;AACA,GAzBsD,CA2BvD;;;AACA,SAAO,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param {Selection} selection Selection object to check.\n *\n * @return {boolean} Whether the selection is forward.\n */\nexport default function isSelectionForward( selection ) {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"]}
1
+ {"version":3,"names":["assertIsDefined","isSelectionForward","selection","anchorNode","focusNode","anchorOffset","focusOffset","position","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_FOLLOWING"],"sources":["@wordpress/dom/src/dom/is-selection-forward.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param {Selection} selection Selection object to check.\n *\n * @return {boolean} Whether the selection is forward.\n */\nexport default function isSelectionForward( selection ) {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,kBAAkBA,CAAEC,SAAS,EAAG;EACvD,MAAM;IAAEC,UAAU;IAAEC,SAAS;IAAEC,YAAY;IAAEC;EAAY,CAAC,GAAGJ,SAAS;EAEtEF,eAAe,CAAEG,UAAU,EAAE,YAAa,CAAC;EAC3CH,eAAe,CAAEI,SAAS,EAAE,WAAY,CAAC;EACzC,MAAMG,QAAQ,GAAGJ,UAAU,CAACK,uBAAuB,CAAEJ,SAAU,CAAC;;EAEhE;EACA;EACA;EACA;EACA;EACA,IAAKG,QAAQ,GAAGJ,UAAU,CAACM,2BAA2B,EAAG;IACxD,OAAO,KAAK;EACb;EAEA,IAAKF,QAAQ,GAAGJ,UAAU,CAACO,2BAA2B,EAAG;IACxD,OAAO,IAAI;EACZ;EACA;;EAEA;EACA;EACA,IAAKH,QAAQ,KAAK,CAAC,EAAG;IACrB,OAAOF,YAAY,IAAIC,WAAW;EACnC;;EAEA;EACA,OAAO,IAAI;AACZ"}
@@ -2,8 +2,8 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import isHTMLInputElement from './is-html-input-element';
5
- /* eslint-disable jsdoc/valid-types */
6
5
 
6
+ /* eslint-disable jsdoc/valid-types */
7
7
  /**
8
8
  * Check whether the given element is a text field, where text field is defined
9
9
  * by the ability to select within the input, or that it is contenteditable.
@@ -13,12 +13,9 @@ import isHTMLInputElement from './is-html-input-element';
13
13
  * @param {Node} node The HTML element.
14
14
  * @return {node is HTMLElement} True if the element is an text field, false if not.
15
15
  */
16
-
17
16
  export default function isTextField(node) {
18
17
  /* eslint-enable jsdoc/valid-types */
19
18
  const nonTextInputs = ['button', 'checkbox', 'hidden', 'file', 'radio', 'image', 'range', 'reset', 'submit', 'number', 'email', 'time'];
20
- return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === 'TEXTAREA' ||
21
- /** @type {HTMLElement} */
22
- node.contentEditable === 'true';
19
+ return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === 'TEXTAREA' || /** @type {HTMLElement} */node.contentEditable === 'true';
23
20
  }
24
21
  //# sourceMappingURL=is-text-field.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-text-field.js"],"names":["isHTMLInputElement","isTextField","node","nonTextInputs","type","includes","nodeName","contentEditable"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,kBAAP,MAA+B,yBAA/B;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,WAAT,CAAsBC,IAAtB,EAA6B;AAC3C;AACA,QAAMC,aAAa,GAAG,CACrB,QADqB,EAErB,UAFqB,EAGrB,QAHqB,EAIrB,MAJqB,EAKrB,OALqB,EAMrB,OANqB,EAOrB,OAPqB,EAQrB,OARqB,EASrB,QATqB,EAUrB,QAVqB,EAWrB,OAXqB,EAYrB,MAZqB,CAAtB;AAcA,SACGH,kBAAkB,CAAEE,IAAF,CAAlB,IACDA,IAAI,CAACE,IADJ,IAED,CAAED,aAAa,CAACE,QAAd,CAAwBH,IAAI,CAACE,IAA7B,CAFH,IAGAF,IAAI,CAACI,QAAL,KAAkB,UAHlB;AAIA;AAA6BJ,EAAAA,IAAF,CAASK,eAAT,KAA6B,MALzD;AAOA","sourcesContent":["/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param {Node} node The HTML element.\n * @return {node is HTMLElement} True if the element is an text field, false if not.\n */\nexport default function isTextField( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t/** @type {HTMLElement} */ ( node ).contentEditable === 'true'\n\t);\n}\n"]}
1
+ {"version":3,"names":["isHTMLInputElement","isTextField","node","nonTextInputs","type","includes","nodeName","contentEditable"],"sources":["@wordpress/dom/src/dom/is-text-field.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param {Node} node The HTML element.\n * @return {node is HTMLElement} True if the element is an text field, false if not.\n */\nexport default function isTextField( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t/** @type {HTMLElement} */ ( node ).contentEditable === 'true'\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,kBAAkB,MAAM,yBAAyB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAWA,CAAEC,IAAI,EAAG;EAC3C;EACA,MAAMC,aAAa,GAAG,CACrB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,CACN;EACD,OACGH,kBAAkB,CAAEE,IAAK,CAAC,IAC3BA,IAAI,CAACE,IAAI,IACT,CAAED,aAAa,CAACE,QAAQ,CAAEH,IAAI,CAACE,IAAK,CAAC,IACtCF,IAAI,CAACI,QAAQ,KAAK,UAAU,IAC5B,0BAA6BJ,IAAI,CAAGK,eAAe,KAAK,MAAM;AAEhE"}
@@ -2,15 +2,15 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import isEdge from './is-edge';
5
+
5
6
  /**
6
7
  * Check whether the selection is vertically at the edge of the container.
7
8
  *
8
- * @param {Element} container Focusable element.
9
- * @param {boolean} isReverse Set to true to check top, false for bottom.
9
+ * @param {HTMLElement} container Focusable element.
10
+ * @param {boolean} isReverse Set to true to check top, false for bottom.
10
11
  *
11
12
  * @return {boolean} True if at the vertical edge, false if not.
12
13
  */
13
-
14
14
  export default function isVerticalEdge(container, isReverse) {
15
15
  return isEdge(container, isReverse, true);
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-vertical-edge.js"],"names":["isEdge","isVerticalEdge","container","isReverse"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,WAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,cAAT,CAAyBC,SAAzB,EAAoCC,SAApC,EAAgD;AAC9D,SAAOH,MAAM,CAAEE,SAAF,EAAaC,SAAb,EAAwB,IAAxB,CAAb;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {Element} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse, true );\n}\n"]}
1
+ {"version":3,"names":["isEdge","isVerticalEdge","container","isReverse"],"sources":["@wordpress/dom/src/dom/is-vertical-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse, true );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,WAAW;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC9D,OAAOH,MAAM,CAAEE,SAAS,EAAEC,SAAS,EAAE,IAAK,CAAC;AAC5C"}