@wix/editor-react-components 1.2761.0 → 1.2763.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 (163) hide show
  1. package/dist/site/components/AccordionComponent/component.js +1 -1
  2. package/dist/site/components/AccordionComponent/manifest.js +1 -1
  3. package/dist/site/components/AnimatedIcon/manifest.js +1 -1
  4. package/dist/site/components/AudioPlayer/component.js +1 -1
  5. package/dist/site/components/AudioPlayer/manifest.js +1 -1
  6. package/dist/site/components/BoxContainer/component.js +3 -3
  7. package/dist/site/components/BoxContainer/manifest.js +1 -1
  8. package/dist/site/components/Breadcrumbs/component.js +3 -3
  9. package/dist/site/components/Breadcrumbs/manifest.js +1 -1
  10. package/dist/site/components/Button/manifest.js +1 -1
  11. package/dist/site/components/Checkbox/component.js +1 -1
  12. package/dist/site/components/Checkbox/manifest.js +1 -1
  13. package/dist/site/components/CheckboxGroup/component.js +1 -1
  14. package/dist/site/components/CheckboxGroup/manifest.js +1 -1
  15. package/dist/site/components/CollapsibleText/component.js +2 -2
  16. package/dist/site/components/CollapsibleText/manifest.js +1 -1
  17. package/dist/site/components/DatePicker/component.js +2 -2
  18. package/dist/site/components/DatePicker/manifest.js +1 -1
  19. package/dist/site/components/Dropdown/component.js +2 -2
  20. package/dist/site/components/Dropdown/manifest.js +1 -1
  21. package/dist/site/components/GoogleMap/component.js +3 -3
  22. package/dist/site/components/HTMLComponent/component.js +2 -2
  23. package/dist/site/components/HeadingTextBlock/component.js +1 -1
  24. package/dist/site/components/HeadingTextBlock/manifest.js +1 -1
  25. package/dist/site/components/HipaaIcon/component.js +2 -2
  26. package/dist/site/components/HipaaIcon/manifest.js +1 -1
  27. package/dist/site/components/Image3/component.js +2 -2
  28. package/dist/site/components/ImageReveal/component.js +2 -2
  29. package/dist/site/components/ImageReveal/manifest.js +1 -1
  30. package/dist/site/components/Line/component.js +1 -1
  31. package/dist/site/components/LinkBar/component.js +2 -2
  32. package/dist/site/components/LinkBar/manifest.js +1 -1
  33. package/dist/site/components/Logo/component.js +1 -1
  34. package/dist/site/components/Logo/manifest.js +1 -1
  35. package/dist/site/components/Logo/sdk.js +1 -1
  36. package/dist/site/components/Lottie/component.js +3 -3
  37. package/dist/site/components/Lottie/manifest.js +1 -1
  38. package/dist/site/components/MarkdownBlock/component.js +2 -2
  39. package/dist/site/components/MarkdownBlock/manifest.js +1 -1
  40. package/dist/site/components/Menu/component.js +3 -3
  41. package/dist/site/components/Menu/manifest.js +2 -3
  42. package/dist/site/components/MultiStateBox/component.js +1 -1
  43. package/dist/site/components/MultiStateBox/manifest.js +1 -1
  44. package/dist/site/components/ProgressBar/component.js +1 -1
  45. package/dist/site/components/ProgressBar/manifest.js +1 -1
  46. package/dist/site/components/ProgressBar/sdk.js +1 -1
  47. package/dist/site/components/RadioButtons/component.js +1 -1
  48. package/dist/site/components/RadioButtons/manifest.js +1 -1
  49. package/dist/site/components/Repeater/component.js +2 -2
  50. package/dist/site/components/Repeater/manifest.js +1 -1
  51. package/dist/site/components/ShareButtons/component.js +2 -2
  52. package/dist/site/components/ShareButtons/manifest.js +1 -1
  53. package/dist/site/components/Slideshow/component.js +1 -1
  54. package/dist/site/components/Tabs/component.js +1 -1
  55. package/dist/site/components/Tabs/manifest.js +1 -1
  56. package/dist/site/components/TextBox/component.js +1 -1
  57. package/dist/site/components/TextBox/manifest.js +1 -1
  58. package/dist/site/components/TextEffects3d/component.js +1 -1
  59. package/dist/site/components/TextEffects3d/manifest.js +1 -1
  60. package/dist/site/components/TextEffectsBauhaus/component.js +1 -1
  61. package/dist/site/components/TextEffectsBauhaus/manifest.js +1 -1
  62. package/dist/site/components/TextEffectsGlass/component.js +1 -1
  63. package/dist/site/components/TextEffectsGlass/manifest.js +1 -1
  64. package/dist/site/components/TextEffectsGlitch/component.js +1 -1
  65. package/dist/site/components/TextEffectsGlitch/manifest.js +1 -1
  66. package/dist/site/components/TextEffectsLetterPress/component.js +1 -1
  67. package/dist/site/components/TextEffectsLetterPress/manifest.js +1 -1
  68. package/dist/site/components/TextEffectsMatrix/component.js +1 -1
  69. package/dist/site/components/TextEffectsMatrix/manifest.js +1 -1
  70. package/dist/site/components/TextEffectsNeonSign/component.js +1 -1
  71. package/dist/site/components/TextEffectsNeonSign/manifest.js +1 -1
  72. package/dist/site/components/TextEffectsNoisy/component.js +1 -1
  73. package/dist/site/components/TextEffectsNoisy/manifest.js +1 -1
  74. package/dist/site/components/TextEffectsOutlineOut/component.js +2 -2
  75. package/dist/site/components/TextEffectsOutlineOut/manifest.js +1 -1
  76. package/dist/site/components/TextEffectsRetro/component.js +1 -1
  77. package/dist/site/components/TextEffectsRetro/manifest.js +1 -1
  78. package/dist/site/components/TextEffectsShook/component.js +1 -1
  79. package/dist/site/components/TextEffectsShook/manifest.js +1 -1
  80. package/dist/site/components/TextEffectsSticker/component.js +1 -1
  81. package/dist/site/components/TextEffectsSticker/manifest.js +2 -2
  82. package/dist/site/components/TextEffectsStriped/component.js +1 -1
  83. package/dist/site/components/TextEffectsStriped/manifest.js +1 -1
  84. package/dist/site/components/TextInput/component.js +2 -2
  85. package/dist/site/components/TextInput/manifest.js +1 -1
  86. package/dist/site/components/TextMarquee/component.js +1 -1
  87. package/dist/site/components/TimePicker/component.js +2 -2
  88. package/dist/site/components/TimePicker/manifest.js +1 -1
  89. package/dist/site/components/TransparentVideo/component.js +2 -2
  90. package/dist/site/components/VideoScrub/VideoScrub.types.d.ts +37 -0
  91. package/dist/site/components/VideoScrub/component.js +334 -34
  92. package/dist/site/components/VideoScrub/constants.d.ts +8 -3
  93. package/dist/site/components/VideoScrub/css.css +75 -2
  94. package/dist/site/components/VideoScrub/hooks/useScrubProgress.d.ts +4 -2
  95. package/dist/site/components/VideoScrub/hooks/useTimeframes.d.ts +23 -0
  96. package/dist/site/components/VideoScrub/manifest.js +268 -6
  97. package/dist/site/components/VideoScrub/timeframes/index.d.ts +1 -1
  98. package/dist/site/components/VideoScrub/timeframes/types.d.ts +1 -1
  99. package/dist/site/components/VideoScrub/timeframes/useActiveTimeframeIndex.d.ts +2 -0
  100. package/dist/site/components/VideoScrub/utils.d.ts +19 -5
  101. package/dist/site/components/chunks/AnimatedIcon.js +1 -1
  102. package/dist/site/components/chunks/Button.js +2 -2
  103. package/dist/site/components/chunks/Image.js +1 -1
  104. package/dist/site/components/chunks/Link.js +1 -1
  105. package/dist/site/components/chunks/Patterns.js +1 -1
  106. package/dist/site/components/chunks/ResponsiveBox.js +1 -1
  107. package/dist/site/components/chunks/TextEffectsShared.js +2 -2
  108. package/dist/site/components/chunks/a11y.js +4 -4
  109. package/dist/site/components/chunks/constants10.js +20 -65
  110. package/dist/site/components/chunks/constants11.js +12 -14
  111. package/dist/site/components/chunks/constants12.js +9 -9
  112. package/dist/site/components/chunks/constants13.js +8 -10
  113. package/dist/site/components/chunks/constants14.js +13 -9
  114. package/dist/site/components/chunks/constants15.js +17 -14
  115. package/dist/site/components/chunks/constants16.js +12 -17
  116. package/dist/site/components/chunks/constants17.js +13 -11
  117. package/dist/site/components/chunks/constants18.js +96 -21
  118. package/dist/site/components/chunks/constants19.js +50 -92
  119. package/dist/site/components/chunks/constants2.js +126 -47
  120. package/dist/site/components/chunks/constants20.js +50 -54
  121. package/dist/site/components/chunks/constants21.js +52 -49
  122. package/dist/site/components/chunks/constants22.js +310 -43
  123. package/dist/site/components/chunks/constants23.js +65 -310
  124. package/dist/site/components/chunks/constants24.js +99 -70
  125. package/dist/site/components/chunks/constants25.js +30 -101
  126. package/dist/site/components/chunks/constants26.js +17 -35
  127. package/dist/site/components/chunks/constants27.js +447 -16
  128. package/dist/site/components/chunks/constants28.js +29 -441
  129. package/dist/site/components/chunks/constants29.js +78 -26
  130. package/dist/site/components/chunks/constants3.js +84 -118
  131. package/dist/site/components/chunks/constants30.js +15 -85
  132. package/dist/site/components/chunks/constants31.js +42 -11
  133. package/dist/site/components/chunks/constants32.js +45 -41
  134. package/dist/site/components/chunks/constants33.js +24 -49
  135. package/dist/site/components/chunks/constants34.js +56 -25
  136. package/dist/site/components/chunks/constants35.js +13 -58
  137. package/dist/site/components/chunks/constants36.js +206 -14
  138. package/dist/site/components/chunks/constants37.js +153 -182
  139. package/dist/site/components/chunks/constants38.js +49 -162
  140. package/dist/site/components/chunks/constants39.js +102 -51
  141. package/dist/site/components/chunks/constants4.js +13 -88
  142. package/dist/site/components/chunks/constants40.js +39 -69
  143. package/dist/site/components/chunks/constants41.js +79 -72
  144. package/dist/site/components/chunks/constants42.js +77 -83
  145. package/dist/site/components/chunks/constants43.js +56 -75
  146. package/dist/site/components/chunks/constants5.js +19 -10
  147. package/dist/site/components/chunks/constants6.js +14 -14
  148. package/dist/site/components/chunks/constants7.js +10 -11
  149. package/dist/site/components/chunks/constants8.js +14 -14
  150. package/dist/site/components/chunks/constants9.js +65 -22
  151. package/dist/site/components/chunks/customElementInit.js +1 -1
  152. package/dist/site/components/chunks/index4.js +3 -2133
  153. package/dist/site/components/chunks/index5.js +2080 -1414
  154. package/dist/site/components/chunks/index6.js +1467 -3
  155. package/dist/site/components/chunks/manifestBase.js +1 -1
  156. package/dist/site/components/chunks/parseHtml.js +1 -1
  157. package/dist/site/components/chunks/parseSvg.js +1 -1
  158. package/dist/site/components/chunks/types.js +61 -0
  159. package/dist/site/components/chunks/useConsentPolicyProps.js +2 -2
  160. package/dist/site/components/chunks/utils2.js +1 -1
  161. package/dist/site/components/extensions.js +1 -1
  162. package/package.json +2 -2
  163. package/dist/site/components/chunks/constants44.js +0 -72
@@ -1,1469 +1,2135 @@
1
- const API_VERSION = "v1";
2
- const MAX_DEVICE_PIXEL_RATIO = 2;
3
- const DSKTP_MAX_BG_SITE_LEGACY_WIDTH = 1920;
4
- const DSKTP_MAX_BG_SITE_LEGACY_HEIGHT = 1920;
5
- const MOBILE_MAX_BG_SITE_LEGACY_WIDTH = 1e3;
6
- const MOBILE_MAX_BG_SITE_LEGACY_HEIGHT = 1e3;
7
- const fittingTypes = {
8
- SCALE_TO_FILL: "fill",
9
- SCALE_TO_FIT: "fit",
10
- STRETCH: "stretch",
11
- ORIGINAL_SIZE: "original_size",
12
- TILE: "tile",
13
- TILE_HORIZONTAL: "tile_horizontal",
14
- TILE_VERTICAL: "tile_vertical",
15
- FIT_AND_TILE: "fit_and_tile",
16
- LEGACY_STRIP_TILE: "legacy_strip_tile",
17
- LEGACY_STRIP_TILE_HORIZONTAL: "legacy_strip_tile_horizontal",
18
- LEGACY_STRIP_TILE_VERTICAL: "legacy_strip_tile_vertical",
19
- LEGACY_STRIP_SCALE_TO_FILL: "legacy_strip_fill",
20
- LEGACY_STRIP_SCALE_TO_FIT: "legacy_strip_fit",
21
- LEGACY_STRIP_FIT_AND_TILE: "legacy_strip_fit_and_tile",
22
- LEGACY_STRIP_ORIGINAL_SIZE: "legacy_strip_original_size",
23
- LEGACY_ORIGINAL_SIZE: "actual_size",
24
- LEGACY_FIT_WIDTH: "fitWidth",
25
- LEGACY_FIT_HEIGHT: "fitHeight",
26
- LEGACY_FULL: "full",
27
- LEGACY_BG_FIT_AND_TILE: "legacy_tile",
28
- LEGACY_BG_FIT_AND_TILE_HORIZONTAL: "legacy_tile_horizontal",
29
- LEGACY_BG_FIT_AND_TILE_VERTICAL: "legacy_tile_vertical",
30
- LEGACY_BG_NORMAL: "legacy_normal"
31
- };
32
- const transformTypes = {
33
- FIT: "fit",
34
- FILL: "fill",
35
- FILL_FOCAL: "fill_focal",
36
- CROP: "crop",
37
- LEGACY_CROP: "legacy_crop",
38
- LEGACY_FILL: "legacy_fill"
39
- };
40
- const alignTypes = {
41
- CENTER: "center",
42
- TOP: "top",
43
- TOP_LEFT: "top_left",
44
- TOP_RIGHT: "top_right",
45
- BOTTOM: "bottom",
46
- BOTTOM_LEFT: "bottom_left",
47
- BOTTOM_RIGHT: "bottom_right",
48
- LEFT: "left",
49
- RIGHT: "right"
50
- };
51
- const ALIGN_TYPE_TO_FOCAL_POINT = {
52
- [alignTypes.CENTER]: { x: 0.5, y: 0.5 },
53
- [alignTypes.TOP_LEFT]: { x: 0, y: 0 },
54
- [alignTypes.TOP_RIGHT]: { x: 1, y: 0 },
55
- [alignTypes.TOP]: { x: 0.5, y: 0 },
56
- [alignTypes.BOTTOM_LEFT]: { x: 0, y: 1 },
57
- [alignTypes.BOTTOM_RIGHT]: { x: 1, y: 1 },
58
- [alignTypes.BOTTOM]: { x: 0.5, y: 1 },
59
- [alignTypes.RIGHT]: { x: 1, y: 0.5 },
60
- [alignTypes.LEFT]: { x: 0, y: 0.5 }
61
- };
62
- const alignTypesMap = {
63
- center: "c",
64
- top: "t",
65
- top_left: "tl",
66
- top_right: "tr",
67
- bottom: "b",
68
- bottom_left: "bl",
69
- bottom_right: "br",
70
- left: "l",
71
- right: "r"
72
- };
73
- const htmlTag = {
74
- BG: "bg",
75
- SVG: "svg"
76
- };
77
- const upscaleMethods = {
78
- AUTO: "auto",
79
- CLASSIC: "classic",
80
- SUPER: "super"
81
- };
82
- const upscaleMethodsValues = {
83
- classic: 1,
84
- super: 2
85
- };
86
- const defaultUSM = {
87
- radius: "0.66",
88
- amount: "1.00",
89
- threshold: "0.01"
90
- };
91
- const emptyData = {
92
- uri: "",
93
- css: {
94
- img: {},
95
- container: {}
96
- },
97
- attr: {
98
- img: {},
99
- container: {}
100
- },
101
- transformed: false
102
- };
103
- const MAX_TRANSFORMED_IMAGE_WIDTH = 5e3;
104
- const MAX_TRANSFORMED_IMAGE_HEIGHT = 5e3;
105
- const SAFE_TRANSFORMED_AREA = MAX_TRANSFORMED_IMAGE_WIDTH * MAX_TRANSFORMED_IMAGE_HEIGHT;
106
- const SUPER_UPSCALE_MODELS = [1.5, 2, 4];
107
- const imageScaleDefaults = {
108
- HIGH: {
109
- size: 1400 * 1400,
110
- quality: 90,
111
- maxUpscale: 1
112
- },
113
- MEDIUM: {
114
- size: 600 * 600,
115
- quality: 85,
116
- maxUpscale: 1
117
- },
118
- LOW: {
119
- size: 400 * 400,
120
- quality: 80,
121
- maxUpscale: 1.2
122
- },
123
- TINY: {
124
- size: 0,
125
- quality: 80,
126
- maxUpscale: 1.4
127
- }
128
- };
129
- const imageQuality = {
130
- HIGH: "HIGH",
131
- MEDIUM: "MEDIUM",
132
- LOW: "LOW",
133
- TINY: "TINY"
134
- };
135
- const imageFilters = {
136
- CONTRAST: "contrast",
137
- BRIGHTNESS: "brightness",
138
- SATURATION: "saturation",
139
- HUE: "hue",
140
- BLUR: "blur"
141
- };
142
- const fileType = {
143
- JPG: "jpg",
144
- JPEG: "jpeg",
145
- JPE: "jpe",
146
- PNG: "png",
147
- WEBP: "webp",
148
- WIX_ICO_MP: "wix_ico_mp",
149
- WIX_MP: "wix_mp",
150
- GIF: "gif",
151
- AVIF: "avif",
152
- UNRECOGNIZED: "unrecognized"
153
- };
154
- const encodingTypes = {
155
- AVIF: "AVIF",
156
- PAVIF: "PAVIF"
157
- };
158
- function template(strings, ...keys) {
159
- return function(...values) {
160
- const dict = values[values.length - 1] || {};
161
- const result = [strings[0]];
162
- keys.forEach(function(key, i) {
163
- const value = Number.isInteger(key) ? values[key] : dict[key];
164
- result.push(value, strings[i + 1]);
165
- });
166
- return result.join("");
167
- };
168
- }
169
- function last(array) {
170
- return array[array.length - 1];
171
- }
172
- const SUPPORTED_IMAGE_EXTENSIONS = [
173
- fileType.PNG,
174
- fileType.JPEG,
175
- fileType.JPG,
176
- fileType.JPE,
177
- fileType.WIX_ICO_MP,
178
- fileType.WIX_MP,
179
- fileType.WEBP,
180
- fileType.AVIF
181
- ];
182
- const JPG_EXTENSIONS = [
183
- fileType.JPEG,
184
- fileType.JPG,
185
- fileType.JPE
186
- ];
187
- function isImageTypeSupported(uri) {
188
- return SUPPORTED_IMAGE_EXTENSIONS.includes(getFileExtension(uri));
189
- }
190
- function isValidRequest(fittingType, src, target) {
191
- return target && src && !isUrlEmptyOrNone(src.id) && Object.values(fittingTypes).includes(fittingType);
192
- }
193
- function canTransformAnimatedWebpOrAvif(uri, hasAnimation, allowAnimatedTransform) {
194
- const isAvifWebpFormat = isWEBP(uri) || isAVIF(uri);
195
- if (!isAvifWebpFormat || !hasAnimation) {
196
- return true;
197
- }
198
- return allowAnimatedTransform;
199
- }
200
- function canTransformGIF(uri, allowAnimatedTransform, allowFullGIFTransformation) {
201
- if (!isGIF(uri)) {
202
- return false;
203
- }
204
- return !!(allowAnimatedTransform || allowFullGIFTransformation);
205
- }
206
- function isImageTransformApplicable(uri, hasAnimation, allowAnimatedTransform, allowFullGIFTransformation) {
207
- if (isExternalUrl(uri)) {
208
- return false;
209
- }
210
- if (!canTransformAnimatedWebpOrAvif(uri, hasAnimation, allowAnimatedTransform)) {
211
- return false;
212
- }
213
- const isSupportedImageType = isImageTypeSupported(uri);
214
- const isTransformableGif = canTransformGIF(uri, allowAnimatedTransform, allowFullGIFTransformation);
215
- return isSupportedImageType || isTransformableGif;
216
- }
217
- function isJPG(uri) {
218
- return JPG_EXTENSIONS.includes(getFileExtension(uri));
219
- }
220
- function isPNG(uri) {
221
- return getFileExtension(uri) === fileType.PNG;
222
- }
223
- function isWEBP(uri) {
224
- return getFileExtension(uri) === fileType.WEBP;
225
- }
226
- function isGIF(uri) {
227
- return getFileExtension(uri) === fileType.GIF;
228
- }
229
- function isAVIF(uri) {
230
- return getFileExtension(uri) === fileType.AVIF;
231
- }
232
- function isExternalUrl(url) {
233
- return /(^https?)|(^data)|(^\/\/)/.test(url);
234
- }
235
- function isUrlEmptyOrNone(url) {
236
- return !url || !url.trim() || url.toLowerCase() === "none";
237
- }
238
- function isSEOBot(options) {
239
- return (options == null ? void 0 : options.isSEOBot) ?? false;
240
- }
241
- const ILLEGAL_CHARS = ["/", "\\", "?", "<", ">", "|", "“", ":", '"'].map(encodeURIComponent);
242
- const URL_SAFE_ILLEGAL_CHARS = ["\\.", "\\*"];
243
- const ILLEGAL_CHARS_REPLACEMENT = "_";
244
- function getFileName(uri, name) {
245
- const beforeLeadingSlashRegexp = /\/(.*?)$/;
246
- const fileExtensionRegexp = /\.([^.]*)$/;
247
- const illegalCharsRegex = new RegExp(`(${ILLEGAL_CHARS.concat(URL_SAFE_ILLEGAL_CHARS).join("|")})`, "g");
248
- if (name && name.length) {
249
- let fileName2 = name;
250
- const extension = name.match(fileExtensionRegexp);
251
- if (extension && SUPPORTED_IMAGE_EXTENSIONS.includes(extension[1])) {
252
- fileName2 = name.replace(fileExtensionRegexp, "");
1
+ import { g as getDefaultExportFromCjs } from "./_commonjsHelpers.js";
2
+ import React__default from "react";
3
+ import { r as requireCjs } from "./index11.js";
4
+ var lib$3 = {};
5
+ var htmlToDom = {};
6
+ var domparser = {};
7
+ var utilities$1 = {};
8
+ var lib$2 = {};
9
+ var lib$1 = {};
10
+ var hasRequiredLib$3;
11
+ function requireLib$3() {
12
+ if (hasRequiredLib$3) return lib$1;
13
+ hasRequiredLib$3 = 1;
14
+ (function(exports$1) {
15
+ Object.defineProperty(exports$1, "__esModule", { value: true });
16
+ exports$1.Doctype = exports$1.CDATA = exports$1.Tag = exports$1.Style = exports$1.Script = exports$1.Comment = exports$1.Directive = exports$1.Text = exports$1.Root = exports$1.isTag = exports$1.ElementType = void 0;
17
+ var ElementType;
18
+ (function(ElementType2) {
19
+ ElementType2["Root"] = "root";
20
+ ElementType2["Text"] = "text";
21
+ ElementType2["Directive"] = "directive";
22
+ ElementType2["Comment"] = "comment";
23
+ ElementType2["Script"] = "script";
24
+ ElementType2["Style"] = "style";
25
+ ElementType2["Tag"] = "tag";
26
+ ElementType2["CDATA"] = "cdata";
27
+ ElementType2["Doctype"] = "doctype";
28
+ })(ElementType = exports$1.ElementType || (exports$1.ElementType = {}));
29
+ function isTag(elem) {
30
+ return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style;
253
31
  }
254
- return encodeURIComponent(fileName2).replace(illegalCharsRegex, ILLEGAL_CHARS_REPLACEMENT);
255
- }
256
- const trimmed = uri.match(beforeLeadingSlashRegexp);
257
- const fileName = trimmed ? trimmed[1] : uri;
258
- return fileName.replace(fileExtensionRegexp, "");
259
- }
260
- function getFileType(uri) {
261
- if (isJPG(uri)) {
262
- return fileType.JPG;
263
- } else if (isPNG(uri)) {
264
- return fileType.PNG;
265
- } else if (isWEBP(uri)) {
266
- return fileType.WEBP;
267
- } else if (isGIF(uri)) {
268
- return fileType.GIF;
269
- } else if (isAVIF(uri)) {
270
- return fileType.AVIF;
271
- }
272
- return fileType.UNRECOGNIZED;
273
- }
274
- function getFileExtension(uri) {
275
- const splitURI = /[.]([^.]+)$/.exec(uri);
276
- return (splitURI && /[.]([^.]+)$/.exec(uri)[1] || "").toLowerCase();
277
- }
278
- function getFitScaleFactor(sWidth, sHeight, dWidth, dHeight) {
279
- return Math.min(dWidth / sWidth, dHeight / sHeight);
280
- }
281
- function getFillScaleFactor(sWidth, sHeight, dWidth, dHeight) {
282
- return Math.max(dWidth / sWidth, dHeight / sHeight);
283
- }
284
- function getScaleFactor(sWidth, sHeight, dWidth, dHeight, transformType) {
285
- let scaleFactor;
286
- if (transformType === transformTypes.FILL) {
287
- scaleFactor = getFillScaleFactor(sWidth, sHeight, dWidth, dHeight);
288
- } else if (transformType === transformTypes.FIT) {
289
- scaleFactor = getFitScaleFactor(sWidth, sHeight, dWidth, dHeight);
290
- } else {
291
- scaleFactor = 1;
292
- }
293
- return scaleFactor;
294
- }
295
- function getSafeTransformData(sWidth, sHeight, dWidth, dHeight, transformType) {
296
- let scaleFactor;
297
- let width = dWidth;
298
- let height = dHeight;
299
- scaleFactor = getScaleFactor(sWidth, sHeight, dWidth, dHeight, transformType);
300
- if (transformType === transformTypes.FIT) {
301
- width = sWidth * scaleFactor;
302
- height = sHeight * scaleFactor;
303
- }
304
- if (width && height && width * height > SAFE_TRANSFORMED_AREA) {
305
- const dimensionScaleFactor = Math.sqrt(SAFE_TRANSFORMED_AREA / (width * height));
306
- width *= dimensionScaleFactor;
307
- height *= dimensionScaleFactor;
308
- scaleFactor = getScaleFactor(sWidth, sHeight, width, height, transformType);
309
- }
310
- return {
311
- scaleFactor,
312
- width,
313
- height
314
- };
315
- }
316
- function getTransformData(sWidth, sHeight, transformType, target, dpr, upscaleMethod) {
317
- sWidth = sWidth || target.width;
318
- sHeight = sHeight || target.height;
319
- const { scaleFactor, width, height } = getSafeTransformData(sWidth, sHeight, target.width * dpr, target.height * dpr, transformType);
320
- return getOptimizedTransformData(sWidth, sHeight, width, height, upscaleMethod, scaleFactor, transformType);
321
- }
322
- function getFocalPointFrom9GridAlignment(alignment = alignTypes.CENTER) {
323
- return ALIGN_TYPE_TO_FOCAL_POINT[alignment];
324
- }
325
- function getAlignedRect(sRect, dRect, sFP, alignment) {
326
- const fp = getFocalPoint(sFP) || getFocalPointFrom9GridAlignment(alignment);
327
- const x = Math.max(0, Math.min(sRect.width - dRect.width, fp.x * sRect.width - dRect.width / 2));
328
- const y = Math.max(0, Math.min(sRect.height - dRect.height, fp.y * sRect.height - dRect.height / 2));
329
- return {
330
- x,
331
- y,
332
- width: Math.min(sRect.width, dRect.width),
333
- height: Math.min(sRect.height, dRect.height)
334
- };
335
- }
336
- function getOverlappingRect(sRect, dRect) {
337
- const width = Math.max(0, Math.min(sRect.width, dRect.x + dRect.width) - Math.max(0, dRect.x));
338
- const height = Math.max(0, Math.min(sRect.height, dRect.y + dRect.height) - Math.max(0, dRect.y));
339
- const isValidRect = width && height && (sRect.width !== width || sRect.height !== height);
340
- return isValidRect ? {
341
- x: Math.max(0, dRect.x),
342
- y: Math.max(0, dRect.y),
343
- width,
344
- height
345
- } : null;
346
- }
347
- function getDevicePixelRatio(target) {
348
- return Math.min(target.pixelAspectRatio || 1, MAX_DEVICE_PIXEL_RATIO);
349
- }
350
- function getAlignment(target) {
351
- return target.alignment && alignTypesMap[target.alignment] || alignTypesMap[alignTypes.CENTER];
352
- }
353
- function getFocalPoint(focalPoint) {
354
- let fp;
355
- if (focalPoint && typeof focalPoint.x === "number" && !isNaN(focalPoint.x) && typeof focalPoint.y === "number" && !isNaN(focalPoint.y)) {
356
- fp = {
357
- x: roundToFixed(Math.max(0, Math.min(100, focalPoint.x)) / 100, 2),
358
- y: roundToFixed(Math.max(0, Math.min(100, focalPoint.y)) / 100, 2)
32
+ exports$1.isTag = isTag;
33
+ exports$1.Root = ElementType.Root;
34
+ exports$1.Text = ElementType.Text;
35
+ exports$1.Directive = ElementType.Directive;
36
+ exports$1.Comment = ElementType.Comment;
37
+ exports$1.Script = ElementType.Script;
38
+ exports$1.Style = ElementType.Style;
39
+ exports$1.Tag = ElementType.Tag;
40
+ exports$1.CDATA = ElementType.CDATA;
41
+ exports$1.Doctype = ElementType.Doctype;
42
+ })(lib$1);
43
+ return lib$1;
44
+ }
45
+ var node = {};
46
+ var hasRequiredNode;
47
+ function requireNode() {
48
+ if (hasRequiredNode) return node;
49
+ hasRequiredNode = 1;
50
+ var __extends = node && node.__extends || /* @__PURE__ */ (function() {
51
+ var extendStatics = function(d, b) {
52
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
53
+ d2.__proto__ = b2;
54
+ } || function(d2, b2) {
55
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
56
+ };
57
+ return extendStatics(d, b);
359
58
  };
360
- }
361
- return fp;
362
- }
363
- function getPreferredImageQuality(imageWidth, imageHeight) {
364
- return imageScaleDefaults[getImageQualityKey(imageWidth, imageHeight)].quality;
365
- }
366
- function getClassicScaleData(sWidth, sHeight) {
367
- const imageKey = getImageQualityKey(sWidth, sHeight);
368
- return {
369
- optimizedScaleFactor: imageScaleDefaults[imageKey].maxUpscale,
370
- upscaleMethodValue: upscaleMethodsValues.classic,
371
- forceUSM: false
372
- };
373
- }
374
- function getAutoScaleData(sWidth, sHeight) {
375
- const imageKey = getImageQualityKey(sWidth, sHeight);
376
- return {
377
- optimizedScaleFactor: imageScaleDefaults[imageKey].maxUpscale,
378
- upscaleMethodValue: upscaleMethodsValues.classic,
379
- forceUSM: false
380
- };
381
- }
382
- function getSuperScaleData(scaleFactor) {
383
- return {
384
- optimizedScaleFactor: last(SUPER_UPSCALE_MODELS),
385
- upscaleMethodValue: upscaleMethodsValues.super,
386
- forceUSM: !(SUPER_UPSCALE_MODELS.includes(scaleFactor) || scaleFactor > last(SUPER_UPSCALE_MODELS))
387
- };
388
- }
389
- function getOptimizedScaleData(sWidth, sHeight, scaleFactor, upscaleMethod) {
390
- if (upscaleMethod === "auto") {
391
- return getAutoScaleData(sWidth, sHeight);
392
- } else if (upscaleMethod === "super") {
393
- return getSuperScaleData(scaleFactor);
394
- }
395
- return getClassicScaleData(sWidth, sHeight);
396
- }
397
- function getOptimizedTransformData(sWidth, sHeight, tWidth, tHeight, upscaleMethod, scaleFactor, transformType) {
398
- const { optimizedScaleFactor, upscaleMethodValue, forceUSM } = getOptimizedScaleData(sWidth, sHeight, scaleFactor, upscaleMethod);
399
- let width = tWidth;
400
- let height = tHeight;
401
- if (scaleFactor <= optimizedScaleFactor) {
402
- return {
403
- width,
404
- height,
405
- scaleFactor,
406
- upscaleMethodValue,
407
- forceUSM,
408
- cssUpscaleNeeded: false
59
+ return function(d, b) {
60
+ if (typeof b !== "function" && b !== null)
61
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
62
+ extendStatics(d, b);
63
+ function __() {
64
+ this.constructor = d;
65
+ }
66
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
409
67
  };
410
- }
411
- switch (transformType) {
412
- case transformTypes.FILL:
413
- width = tWidth * (optimizedScaleFactor / scaleFactor);
414
- height = tHeight * (optimizedScaleFactor / scaleFactor);
415
- break;
416
- case transformTypes.FIT:
417
- width = sWidth * optimizedScaleFactor;
418
- height = sHeight * optimizedScaleFactor;
419
- break;
420
- }
421
- return {
422
- width,
423
- height,
424
- scaleFactor: optimizedScaleFactor,
425
- upscaleMethodValue,
426
- forceUSM,
427
- cssUpscaleNeeded: true
68
+ })();
69
+ var __assign = node && node.__assign || function() {
70
+ __assign = Object.assign || function(t) {
71
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
72
+ s = arguments[i];
73
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
74
+ t[p] = s[p];
75
+ }
76
+ return t;
77
+ };
78
+ return __assign.apply(this, arguments);
428
79
  };
429
- }
430
- function getImageQualityKey(imageWidth, imageHeight) {
431
- const size = imageWidth * imageHeight;
432
- if (size > imageScaleDefaults[imageQuality.HIGH].size) {
433
- return imageQuality.HIGH;
434
- } else if (size > imageScaleDefaults[imageQuality.MEDIUM].size) {
435
- return imageQuality.MEDIUM;
436
- } else if (size > imageScaleDefaults[imageQuality.LOW].size) {
437
- return imageQuality.LOW;
80
+ Object.defineProperty(node, "__esModule", { value: true });
81
+ node.cloneNode = node.hasChildren = node.isDocument = node.isDirective = node.isComment = node.isText = node.isCDATA = node.isTag = node.Element = node.Document = node.CDATA = node.NodeWithChildren = node.ProcessingInstruction = node.Comment = node.Text = node.DataNode = node.Node = void 0;
82
+ var domelementtype_1 = /* @__PURE__ */ requireLib$3();
83
+ var Node = (
84
+ /** @class */
85
+ (function() {
86
+ function Node2() {
87
+ this.parent = null;
88
+ this.prev = null;
89
+ this.next = null;
90
+ this.startIndex = null;
91
+ this.endIndex = null;
92
+ }
93
+ Object.defineProperty(Node2.prototype, "parentNode", {
94
+ // Read-write aliases for properties
95
+ /**
96
+ * Same as {@link parent}.
97
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
98
+ */
99
+ get: function() {
100
+ return this.parent;
101
+ },
102
+ set: function(parent) {
103
+ this.parent = parent;
104
+ },
105
+ enumerable: false,
106
+ configurable: true
107
+ });
108
+ Object.defineProperty(Node2.prototype, "previousSibling", {
109
+ /**
110
+ * Same as {@link prev}.
111
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
112
+ */
113
+ get: function() {
114
+ return this.prev;
115
+ },
116
+ set: function(prev) {
117
+ this.prev = prev;
118
+ },
119
+ enumerable: false,
120
+ configurable: true
121
+ });
122
+ Object.defineProperty(Node2.prototype, "nextSibling", {
123
+ /**
124
+ * Same as {@link next}.
125
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
126
+ */
127
+ get: function() {
128
+ return this.next;
129
+ },
130
+ set: function(next) {
131
+ this.next = next;
132
+ },
133
+ enumerable: false,
134
+ configurable: true
135
+ });
136
+ Node2.prototype.cloneNode = function(recursive) {
137
+ if (recursive === void 0) {
138
+ recursive = false;
139
+ }
140
+ return cloneNode(this, recursive);
141
+ };
142
+ return Node2;
143
+ })()
144
+ );
145
+ node.Node = Node;
146
+ var DataNode = (
147
+ /** @class */
148
+ (function(_super) {
149
+ __extends(DataNode2, _super);
150
+ function DataNode2(data) {
151
+ var _this = _super.call(this) || this;
152
+ _this.data = data;
153
+ return _this;
154
+ }
155
+ Object.defineProperty(DataNode2.prototype, "nodeValue", {
156
+ /**
157
+ * Same as {@link data}.
158
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
159
+ */
160
+ get: function() {
161
+ return this.data;
162
+ },
163
+ set: function(data) {
164
+ this.data = data;
165
+ },
166
+ enumerable: false,
167
+ configurable: true
168
+ });
169
+ return DataNode2;
170
+ })(Node)
171
+ );
172
+ node.DataNode = DataNode;
173
+ var Text = (
174
+ /** @class */
175
+ (function(_super) {
176
+ __extends(Text2, _super);
177
+ function Text2() {
178
+ var _this = _super !== null && _super.apply(this, arguments) || this;
179
+ _this.type = domelementtype_1.ElementType.Text;
180
+ return _this;
181
+ }
182
+ Object.defineProperty(Text2.prototype, "nodeType", {
183
+ get: function() {
184
+ return 3;
185
+ },
186
+ enumerable: false,
187
+ configurable: true
188
+ });
189
+ return Text2;
190
+ })(DataNode)
191
+ );
192
+ node.Text = Text;
193
+ var Comment = (
194
+ /** @class */
195
+ (function(_super) {
196
+ __extends(Comment2, _super);
197
+ function Comment2() {
198
+ var _this = _super !== null && _super.apply(this, arguments) || this;
199
+ _this.type = domelementtype_1.ElementType.Comment;
200
+ return _this;
201
+ }
202
+ Object.defineProperty(Comment2.prototype, "nodeType", {
203
+ get: function() {
204
+ return 8;
205
+ },
206
+ enumerable: false,
207
+ configurable: true
208
+ });
209
+ return Comment2;
210
+ })(DataNode)
211
+ );
212
+ node.Comment = Comment;
213
+ var ProcessingInstruction = (
214
+ /** @class */
215
+ (function(_super) {
216
+ __extends(ProcessingInstruction2, _super);
217
+ function ProcessingInstruction2(name, data) {
218
+ var _this = _super.call(this, data) || this;
219
+ _this.name = name;
220
+ _this.type = domelementtype_1.ElementType.Directive;
221
+ return _this;
222
+ }
223
+ Object.defineProperty(ProcessingInstruction2.prototype, "nodeType", {
224
+ get: function() {
225
+ return 1;
226
+ },
227
+ enumerable: false,
228
+ configurable: true
229
+ });
230
+ return ProcessingInstruction2;
231
+ })(DataNode)
232
+ );
233
+ node.ProcessingInstruction = ProcessingInstruction;
234
+ var NodeWithChildren = (
235
+ /** @class */
236
+ (function(_super) {
237
+ __extends(NodeWithChildren2, _super);
238
+ function NodeWithChildren2(children) {
239
+ var _this = _super.call(this) || this;
240
+ _this.children = children;
241
+ return _this;
242
+ }
243
+ Object.defineProperty(NodeWithChildren2.prototype, "firstChild", {
244
+ // Aliases
245
+ /** First child of the node. */
246
+ get: function() {
247
+ var _a;
248
+ return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;
249
+ },
250
+ enumerable: false,
251
+ configurable: true
252
+ });
253
+ Object.defineProperty(NodeWithChildren2.prototype, "lastChild", {
254
+ /** Last child of the node. */
255
+ get: function() {
256
+ return this.children.length > 0 ? this.children[this.children.length - 1] : null;
257
+ },
258
+ enumerable: false,
259
+ configurable: true
260
+ });
261
+ Object.defineProperty(NodeWithChildren2.prototype, "childNodes", {
262
+ /**
263
+ * Same as {@link children}.
264
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
265
+ */
266
+ get: function() {
267
+ return this.children;
268
+ },
269
+ set: function(children) {
270
+ this.children = children;
271
+ },
272
+ enumerable: false,
273
+ configurable: true
274
+ });
275
+ return NodeWithChildren2;
276
+ })(Node)
277
+ );
278
+ node.NodeWithChildren = NodeWithChildren;
279
+ var CDATA = (
280
+ /** @class */
281
+ (function(_super) {
282
+ __extends(CDATA2, _super);
283
+ function CDATA2() {
284
+ var _this = _super !== null && _super.apply(this, arguments) || this;
285
+ _this.type = domelementtype_1.ElementType.CDATA;
286
+ return _this;
287
+ }
288
+ Object.defineProperty(CDATA2.prototype, "nodeType", {
289
+ get: function() {
290
+ return 4;
291
+ },
292
+ enumerable: false,
293
+ configurable: true
294
+ });
295
+ return CDATA2;
296
+ })(NodeWithChildren)
297
+ );
298
+ node.CDATA = CDATA;
299
+ var Document = (
300
+ /** @class */
301
+ (function(_super) {
302
+ __extends(Document2, _super);
303
+ function Document2() {
304
+ var _this = _super !== null && _super.apply(this, arguments) || this;
305
+ _this.type = domelementtype_1.ElementType.Root;
306
+ return _this;
307
+ }
308
+ Object.defineProperty(Document2.prototype, "nodeType", {
309
+ get: function() {
310
+ return 9;
311
+ },
312
+ enumerable: false,
313
+ configurable: true
314
+ });
315
+ return Document2;
316
+ })(NodeWithChildren)
317
+ );
318
+ node.Document = Document;
319
+ var Element = (
320
+ /** @class */
321
+ (function(_super) {
322
+ __extends(Element2, _super);
323
+ function Element2(name, attribs, children, type) {
324
+ if (children === void 0) {
325
+ children = [];
326
+ }
327
+ if (type === void 0) {
328
+ type = name === "script" ? domelementtype_1.ElementType.Script : name === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag;
329
+ }
330
+ var _this = _super.call(this, children) || this;
331
+ _this.name = name;
332
+ _this.attribs = attribs;
333
+ _this.type = type;
334
+ return _this;
335
+ }
336
+ Object.defineProperty(Element2.prototype, "nodeType", {
337
+ get: function() {
338
+ return 1;
339
+ },
340
+ enumerable: false,
341
+ configurable: true
342
+ });
343
+ Object.defineProperty(Element2.prototype, "tagName", {
344
+ // DOM Level 1 aliases
345
+ /**
346
+ * Same as {@link name}.
347
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
348
+ */
349
+ get: function() {
350
+ return this.name;
351
+ },
352
+ set: function(name) {
353
+ this.name = name;
354
+ },
355
+ enumerable: false,
356
+ configurable: true
357
+ });
358
+ Object.defineProperty(Element2.prototype, "attributes", {
359
+ get: function() {
360
+ var _this = this;
361
+ return Object.keys(this.attribs).map(function(name) {
362
+ var _a, _b;
363
+ return {
364
+ name,
365
+ value: _this.attribs[name],
366
+ namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name],
367
+ prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name]
368
+ };
369
+ });
370
+ },
371
+ enumerable: false,
372
+ configurable: true
373
+ });
374
+ return Element2;
375
+ })(NodeWithChildren)
376
+ );
377
+ node.Element = Element;
378
+ function isTag(node2) {
379
+ return (0, domelementtype_1.isTag)(node2);
438
380
  }
439
- return imageQuality.TINY;
440
- }
441
- function getDimension(sWidth, sHeight, tWidth, tHeight, transformType) {
442
- const scaleFactor = getScaleFactor(sWidth, sHeight, tWidth, tHeight, transformType);
443
- return {
444
- width: Math.round(sWidth * scaleFactor),
445
- height: Math.round(sHeight * scaleFactor)
446
- };
447
- }
448
- function roundToFixed(value, precision) {
449
- const truncatePrecision = Math.pow(10, precision);
450
- return (value * truncatePrecision / truncatePrecision).toFixed(precision);
451
- }
452
- function getUpscaleString(options) {
453
- if (!options || !options.upscaleMethod) {
454
- return upscaleMethods.AUTO;
381
+ node.isTag = isTag;
382
+ function isCDATA(node2) {
383
+ return node2.type === domelementtype_1.ElementType.CDATA;
455
384
  }
456
- return upscaleMethods[options.upscaleMethod.toUpperCase()] || upscaleMethods.AUTO;
457
- }
458
- function imageIsAnimated(uri, hasAnimation) {
459
- const isAvifWebpFormat = isWEBP(uri) || isAVIF(uri);
460
- return getFileExtension(uri) === fileType.GIF || isAvifWebpFormat && hasAnimation;
461
- }
462
- const globalFeaturesSupportObj = {
463
- /**
464
- * @type {object<boolean>}
465
- */
466
- isMobile: false
467
- };
468
- const getFeature = function(feature) {
469
- return globalFeaturesSupportObj[feature];
470
- };
471
- const setFeature = function(feature, value) {
472
- globalFeaturesSupportObj[feature] = value;
473
- };
474
- function populateGlobalFeatureSupport() {
475
- if (typeof window !== "undefined" && typeof navigator !== "undefined") {
476
- const isSmallScreen = window.matchMedia && window.matchMedia("(max-width: 767px)").matches;
477
- const isMobileAgent = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
478
- setFeature("isMobile", isSmallScreen && isMobileAgent);
385
+ node.isCDATA = isCDATA;
386
+ function isText(node2) {
387
+ return node2.type === domelementtype_1.ElementType.Text;
479
388
  }
480
- }
481
- function getCSS$1(transformsObj, target) {
482
- const attributes = {
483
- css: {
484
- container: {}
485
- }
486
- };
487
- const { css } = attributes;
488
- const { fittingType } = transformsObj;
489
- switch (fittingType) {
490
- case fittingTypes.ORIGINAL_SIZE:
491
- case fittingTypes.LEGACY_ORIGINAL_SIZE:
492
- case fittingTypes.LEGACY_STRIP_ORIGINAL_SIZE:
493
- css.container.backgroundSize = "auto";
494
- css.container.backgroundRepeat = "no-repeat";
495
- break;
496
- case fittingTypes.SCALE_TO_FIT:
497
- case fittingTypes.LEGACY_STRIP_SCALE_TO_FIT:
498
- css.container.backgroundSize = "contain";
499
- css.container.backgroundRepeat = "no-repeat";
500
- break;
501
- case fittingTypes.STRETCH:
502
- css.container.backgroundSize = "100% 100%";
503
- css.container.backgroundRepeat = "no-repeat";
504
- break;
505
- case fittingTypes.SCALE_TO_FILL:
506
- case fittingTypes.LEGACY_STRIP_SCALE_TO_FILL:
507
- css.container.backgroundSize = "cover";
508
- css.container.backgroundRepeat = "no-repeat";
509
- break;
510
- case fittingTypes.TILE_HORIZONTAL:
511
- case fittingTypes.LEGACY_STRIP_TILE_HORIZONTAL:
512
- css.container.backgroundSize = "auto";
513
- css.container.backgroundRepeat = "repeat-x";
514
- break;
515
- case fittingTypes.TILE_VERTICAL:
516
- case fittingTypes.LEGACY_STRIP_TILE_VERTICAL:
517
- css.container.backgroundSize = "auto";
518
- css.container.backgroundRepeat = "repeat-y";
519
- break;
520
- case fittingTypes.TILE:
521
- case fittingTypes.LEGACY_STRIP_TILE:
522
- css.container.backgroundSize = "auto";
523
- css.container.backgroundRepeat = "repeat";
524
- break;
525
- case fittingTypes.LEGACY_STRIP_FIT_AND_TILE:
526
- css.container.backgroundSize = "contain";
527
- css.container.backgroundRepeat = "repeat";
528
- break;
529
- case fittingTypes.FIT_AND_TILE:
530
- css.container.backgroundSize = "auto";
531
- css.container.backgroundRepeat = "repeat";
532
- break;
533
- // Legacy old editor bg types.
534
- case fittingTypes.LEGACY_BG_FIT_AND_TILE:
535
- css.container.backgroundSize = "auto";
536
- css.container.backgroundRepeat = "repeat";
537
- break;
538
- case fittingTypes.LEGACY_BG_FIT_AND_TILE_HORIZONTAL:
539
- css.container.backgroundSize = "auto";
540
- css.container.backgroundRepeat = "repeat-x";
541
- break;
542
- case fittingTypes.LEGACY_BG_FIT_AND_TILE_VERTICAL:
543
- css.container.backgroundSize = "auto";
544
- css.container.backgroundRepeat = "repeat-y";
545
- break;
546
- case fittingTypes.LEGACY_BG_NORMAL:
547
- css.container.backgroundSize = "auto";
548
- css.container.backgroundRepeat = "no-repeat";
549
- break;
389
+ node.isText = isText;
390
+ function isComment(node2) {
391
+ return node2.type === domelementtype_1.ElementType.Comment;
550
392
  }
551
- switch (target.alignment) {
552
- case alignTypes.CENTER:
553
- css.container.backgroundPosition = "center center";
554
- break;
555
- case alignTypes.LEFT:
556
- css.container.backgroundPosition = "left center";
557
- break;
558
- case alignTypes.RIGHT:
559
- css.container.backgroundPosition = "right center";
560
- break;
561
- case alignTypes.TOP:
562
- css.container.backgroundPosition = "center top";
563
- break;
564
- case alignTypes.BOTTOM:
565
- css.container.backgroundPosition = "center bottom";
566
- break;
567
- case alignTypes.TOP_RIGHT:
568
- css.container.backgroundPosition = "right top";
569
- break;
570
- case alignTypes.TOP_LEFT:
571
- css.container.backgroundPosition = "left top";
572
- break;
573
- case alignTypes.BOTTOM_RIGHT:
574
- css.container.backgroundPosition = "right bottom";
575
- break;
576
- case alignTypes.BOTTOM_LEFT:
577
- css.container.backgroundPosition = "left bottom";
578
- break;
393
+ node.isComment = isComment;
394
+ function isDirective(node2) {
395
+ return node2.type === domelementtype_1.ElementType.Directive;
579
396
  }
580
- return attributes;
581
- }
582
- function alignTypeToPosition(verticalMiddle, horizontalMiddle, target) {
583
- return {
584
- [alignTypes.TOP_LEFT]: { top: 0, left: 0 },
585
- [alignTypes.TOP_RIGHT]: { top: 0, right: 0 },
586
- [alignTypes.TOP]: { top: 0, left: horizontalMiddle },
587
- [alignTypes.BOTTOM_LEFT]: { bottom: 0, left: 0 },
588
- [alignTypes.BOTTOM_RIGHT]: { bottom: 0, right: 0 },
589
- [alignTypes.BOTTOM]: { bottom: 0, left: horizontalMiddle },
590
- [alignTypes.RIGHT]: { top: verticalMiddle, right: 0 },
591
- [alignTypes.LEFT]: { top: verticalMiddle, left: 0 },
592
- [alignTypes.CENTER]: {
593
- width: target.width,
594
- height: target.height,
595
- objectFit: "none"
596
- }
597
- };
598
- }
599
- const alignTypeToPositionStr = {
600
- [alignTypes.CENTER]: "center",
601
- [alignTypes.TOP]: "top",
602
- [alignTypes.TOP_LEFT]: "top left",
603
- [alignTypes.TOP_RIGHT]: "top right",
604
- [alignTypes.BOTTOM]: "bottom",
605
- [alignTypes.BOTTOM_LEFT]: "bottom left",
606
- [alignTypes.BOTTOM_RIGHT]: "bottom right",
607
- [alignTypes.LEFT]: "left",
608
- [alignTypes.RIGHT]: "right"
609
- };
610
- const aligmentDefaults = {
611
- position: "absolute",
612
- top: "auto",
613
- right: "auto",
614
- bottom: "auto",
615
- left: "auto"
616
- };
617
- function getCSS(transformsObj, target) {
618
- const attributes = {
619
- css: {
620
- container: {},
621
- img: {}
622
- }
623
- };
624
- const { css } = attributes;
625
- const { fittingType } = transformsObj;
626
- const alignType = target.alignment;
627
- css.container.position = "relative";
628
- switch (fittingType) {
629
- case fittingTypes.ORIGINAL_SIZE:
630
- case fittingTypes.LEGACY_ORIGINAL_SIZE:
631
- if (transformsObj.parts && transformsObj.parts.length) {
632
- css.img.width = transformsObj.parts[0].width;
633
- css.img.height = transformsObj.parts[0].height;
634
- } else {
635
- css.img.width = transformsObj.src.width;
636
- css.img.height = transformsObj.src.height;
637
- }
638
- break;
639
- case fittingTypes.SCALE_TO_FIT:
640
- case fittingTypes.LEGACY_FIT_WIDTH:
641
- case fittingTypes.LEGACY_FIT_HEIGHT:
642
- case fittingTypes.LEGACY_FULL:
643
- css.img.width = target.width;
644
- css.img.height = target.height;
645
- css.img.objectFit = "contain";
646
- css.img.objectPosition = alignTypeToPositionStr[alignType] || "unset";
647
- break;
648
- // BG_NORMAL is a sitebackground legacy for original size fitting type.
649
- // target width and height were modified in transform.js
650
- case fittingTypes.LEGACY_BG_NORMAL:
651
- css.img.width = "100%";
652
- css.img.height = "100%";
653
- css.img.objectFit = "none";
654
- css.img.objectPosition = alignTypeToPositionStr[alignType] || "unset";
655
- break;
656
- case fittingTypes.STRETCH:
657
- css.img.width = target.width;
658
- css.img.height = target.height;
659
- css.img.objectFit = "fill";
660
- break;
661
- case fittingTypes.SCALE_TO_FILL:
662
- css.img.width = target.width;
663
- css.img.height = target.height;
664
- css.img.objectFit = "cover";
665
- break;
397
+ node.isDirective = isDirective;
398
+ function isDocument(node2) {
399
+ return node2.type === domelementtype_1.ElementType.Root;
666
400
  }
667
- if (typeof css.img.width === "number" && typeof css.img.height === "number" && (css.img.width !== target.width || css.img.height !== target.height)) {
668
- const verticalMiddle = Math.round((target.height - css.img.height) / 2);
669
- const horizontalMiddle = Math.round((target.width - css.img.width) / 2);
670
- Object.assign(css.img, aligmentDefaults, alignTypeToPosition(verticalMiddle, horizontalMiddle, target)[alignType]);
401
+ node.isDocument = isDocument;
402
+ function hasChildren(node2) {
403
+ return Object.prototype.hasOwnProperty.call(node2, "children");
671
404
  }
672
- return attributes;
673
- }
674
- function getSvgAttr(transformsObj, target) {
675
- const attributes = {
676
- css: {
677
- container: {}
678
- },
679
- attr: {
680
- container: {},
681
- img: {}
405
+ node.hasChildren = hasChildren;
406
+ function cloneNode(node2, recursive) {
407
+ if (recursive === void 0) {
408
+ recursive = false;
682
409
  }
683
- };
684
- const { css, attr } = attributes;
685
- const { fittingType } = transformsObj;
686
- const alignType = target.alignment;
687
- const { width: sourceWidth, height: sourceHeight } = transformsObj.src;
688
- let imageScale;
689
- css.container.position = "relative";
690
- switch (fittingType) {
691
- case fittingTypes.ORIGINAL_SIZE:
692
- case fittingTypes.LEGACY_ORIGINAL_SIZE:
693
- case fittingTypes.TILE:
694
- if (transformsObj.parts && transformsObj.parts.length) {
695
- attr.img.width = transformsObj.parts[0].width;
696
- attr.img.height = transformsObj.parts[0].height;
697
- } else {
698
- attr.img.width = sourceWidth;
699
- attr.img.height = sourceHeight;
410
+ var result;
411
+ if (isText(node2)) {
412
+ result = new Text(node2.data);
413
+ } else if (isComment(node2)) {
414
+ result = new Comment(node2.data);
415
+ } else if (isTag(node2)) {
416
+ var children = recursive ? cloneChildren(node2.children) : [];
417
+ var clone_1 = new Element(node2.name, __assign({}, node2.attribs), children);
418
+ children.forEach(function(child) {
419
+ return child.parent = clone_1;
420
+ });
421
+ if (node2.namespace != null) {
422
+ clone_1.namespace = node2.namespace;
700
423
  }
701
- attr.img.preserveAspectRatio = "xMidYMid slice";
702
- break;
703
- case fittingTypes.SCALE_TO_FIT:
704
- case fittingTypes.LEGACY_FIT_WIDTH:
705
- case fittingTypes.LEGACY_FIT_HEIGHT:
706
- case fittingTypes.LEGACY_FULL:
707
- attr.img.width = "100%";
708
- attr.img.height = "100%";
709
- attr.img.transform = "";
710
- attr.img.preserveAspectRatio = "";
711
- break;
712
- case fittingTypes.STRETCH:
713
- attr.img.width = target.width;
714
- attr.img.height = target.height;
715
- attr.img.x = 0;
716
- attr.img.y = 0;
717
- attr.img.transform = "";
718
- attr.img.preserveAspectRatio = "none";
719
- break;
720
- case fittingTypes.SCALE_TO_FILL:
721
- if (!isImageTransformApplicable(transformsObj.src.id)) {
722
- imageScale = getDimension(sourceWidth, sourceHeight, target.width, target.height, transformTypes.FILL);
723
- attr.img.width = imageScale.width;
724
- attr.img.height = imageScale.height;
725
- } else {
726
- attr.img.width = target.width;
727
- attr.img.height = target.height;
424
+ if (node2["x-attribsNamespace"]) {
425
+ clone_1["x-attribsNamespace"] = __assign({}, node2["x-attribsNamespace"]);
728
426
  }
729
- attr.img.x = 0;
730
- attr.img.y = 0;
731
- attr.img.transform = "";
732
- attr.img.preserveAspectRatio = "xMidYMid slice";
733
- break;
734
- }
735
- if (typeof attr.img.width === "number" && typeof attr.img.height === "number" && (attr.img.width !== target.width || attr.img.height !== target.height)) {
736
- let x = 0;
737
- let y = 0;
738
- let right;
739
- let bottom;
740
- if (fittingType === fittingTypes.TILE) {
741
- right = target.width % attr.img.width;
742
- bottom = target.height % attr.img.height;
427
+ if (node2["x-attribsPrefix"]) {
428
+ clone_1["x-attribsPrefix"] = __assign({}, node2["x-attribsPrefix"]);
429
+ }
430
+ result = clone_1;
431
+ } else if (isCDATA(node2)) {
432
+ var children = recursive ? cloneChildren(node2.children) : [];
433
+ var clone_2 = new CDATA(children);
434
+ children.forEach(function(child) {
435
+ return child.parent = clone_2;
436
+ });
437
+ result = clone_2;
438
+ } else if (isDocument(node2)) {
439
+ var children = recursive ? cloneChildren(node2.children) : [];
440
+ var clone_3 = new Document(children);
441
+ children.forEach(function(child) {
442
+ return child.parent = clone_3;
443
+ });
444
+ if (node2["x-mode"]) {
445
+ clone_3["x-mode"] = node2["x-mode"];
446
+ }
447
+ result = clone_3;
448
+ } else if (isDirective(node2)) {
449
+ var instruction = new ProcessingInstruction(node2.name, node2.data);
450
+ if (node2["x-name"] != null) {
451
+ instruction["x-name"] = node2["x-name"];
452
+ instruction["x-publicId"] = node2["x-publicId"];
453
+ instruction["x-systemId"] = node2["x-systemId"];
454
+ }
455
+ result = instruction;
743
456
  } else {
744
- right = target.width - attr.img.width;
745
- bottom = target.height - attr.img.height;
457
+ throw new Error("Not implemented yet: ".concat(node2.type));
746
458
  }
747
- const center = Math.round(right / 2);
748
- const middle = Math.round(bottom / 2);
749
- switch (alignType) {
750
- case alignTypes.TOP_LEFT:
751
- x = 0;
752
- y = 0;
753
- break;
754
- case alignTypes.TOP:
755
- x = center;
756
- y = 0;
757
- break;
758
- case alignTypes.TOP_RIGHT:
759
- x = right;
760
- y = 0;
761
- break;
762
- case alignTypes.LEFT:
763
- x = 0;
764
- y = middle;
765
- break;
766
- case alignTypes.CENTER:
767
- x = center;
768
- y = middle;
769
- break;
770
- case alignTypes.RIGHT:
771
- x = right;
772
- y = middle;
773
- break;
774
- case alignTypes.BOTTOM_LEFT:
775
- x = 0;
776
- y = bottom;
777
- break;
778
- case alignTypes.BOTTOM:
779
- x = center;
780
- y = bottom;
781
- break;
782
- case alignTypes.BOTTOM_RIGHT:
783
- x = right;
784
- y = bottom;
785
- break;
459
+ result.startIndex = node2.startIndex;
460
+ result.endIndex = node2.endIndex;
461
+ if (node2.sourceCodeLocation != null) {
462
+ result.sourceCodeLocation = node2.sourceCodeLocation;
786
463
  }
787
- attr.img.x = x;
788
- attr.img.y = y;
789
- }
790
- attr.container.width = target.width;
791
- attr.container.height = target.height;
792
- attr.container.viewBox = [0, 0, target.width, target.height].join(" ");
793
- return attributes;
794
- }
795
- function getAttributes(transformsObj, target) {
796
- let attributesGetter;
797
- if (target.htmlTag === htmlTag.BG) {
798
- attributesGetter = getCSS$1;
799
- } else if (target.htmlTag === htmlTag.SVG) {
800
- attributesGetter = getSvgAttr;
801
- } else {
802
- attributesGetter = getCSS;
464
+ return result;
803
465
  }
804
- return attributesGetter(transformsObj, target);
805
- }
806
- function isMobile() {
807
- return getFeature("isMobile");
808
- }
809
- function setTransformParts(transformsObj, src, target) {
810
- let rect;
811
- if (src.crop) {
812
- rect = getOverlappingRect(src, src.crop);
813
- if (rect) {
814
- transformsObj.src.width = rect.width;
815
- transformsObj.src.height = rect.height;
816
- transformsObj.src.isCropped = true;
817
- transformsObj.parts.push(getCropPart(rect));
466
+ node.cloneNode = cloneNode;
467
+ function cloneChildren(childs) {
468
+ var children = childs.map(function(child) {
469
+ return cloneNode(child, true);
470
+ });
471
+ for (var i = 1; i < children.length; i++) {
472
+ children[i].prev = children[i - 1];
473
+ children[i - 1].next = children[i];
818
474
  }
475
+ return children;
819
476
  }
820
- switch (transformsObj.fittingType) {
821
- case fittingTypes.SCALE_TO_FIT:
822
- case fittingTypes.LEGACY_FIT_WIDTH:
823
- case fittingTypes.LEGACY_FIT_HEIGHT:
824
- case fittingTypes.LEGACY_FULL:
825
- case fittingTypes.FIT_AND_TILE:
826
- case fittingTypes.LEGACY_BG_FIT_AND_TILE:
827
- case fittingTypes.LEGACY_BG_FIT_AND_TILE_HORIZONTAL:
828
- case fittingTypes.LEGACY_BG_FIT_AND_TILE_VERTICAL:
829
- case fittingTypes.LEGACY_BG_NORMAL:
830
- transformsObj.parts.push(getFitPart(transformsObj, target));
831
- break;
832
- case fittingTypes.SCALE_TO_FILL:
833
- transformsObj.parts.push(getFillPart(transformsObj, target));
834
- break;
835
- case fittingTypes.STRETCH:
836
- transformsObj.parts.push(getStretchPart(transformsObj, target));
837
- break;
838
- case fittingTypes.TILE_HORIZONTAL:
839
- case fittingTypes.TILE_VERTICAL:
840
- case fittingTypes.TILE:
841
- case fittingTypes.LEGACY_ORIGINAL_SIZE:
842
- case fittingTypes.ORIGINAL_SIZE:
843
- rect = getAlignedRect(transformsObj.src, target, transformsObj.focalPoint, target.alignment);
844
- if (transformsObj.src.isCropped) {
845
- Object.assign(transformsObj.parts[0], rect);
846
- transformsObj.src.width = rect.width;
847
- transformsObj.src.height = rect.height;
848
- } else {
849
- transformsObj.parts.push(getCropPart(rect));
477
+ return node;
478
+ }
479
+ var hasRequiredLib$2;
480
+ function requireLib$2() {
481
+ if (hasRequiredLib$2) return lib$2;
482
+ hasRequiredLib$2 = 1;
483
+ (function(exports$1) {
484
+ var __createBinding = lib$2 && lib$2.__createBinding || (Object.create ? (function(o, m, k, k2) {
485
+ if (k2 === void 0) k2 = k;
486
+ var desc = Object.getOwnPropertyDescriptor(m, k);
487
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
488
+ desc = { enumerable: true, get: function() {
489
+ return m[k];
490
+ } };
850
491
  }
851
- break;
852
- // ---------------------------------------------------------------------------------------
853
- // handles a legacy bug on bgImageStrip, background html tag
854
- // component Full Width Strip stored incorrect image source width and height
855
- // ---------------------------------------------------------------------------------------
856
- case fittingTypes.LEGACY_STRIP_TILE_HORIZONTAL:
857
- case fittingTypes.LEGACY_STRIP_TILE_VERTICAL:
858
- case fittingTypes.LEGACY_STRIP_TILE:
859
- case fittingTypes.LEGACY_STRIP_ORIGINAL_SIZE:
860
- transformsObj.parts.push(getLegacyCropPart(target));
861
- break;
862
- case fittingTypes.LEGACY_STRIP_SCALE_TO_FIT:
863
- case fittingTypes.LEGACY_STRIP_FIT_AND_TILE:
864
- transformsObj.parts.push(getLegacyFitPart(target));
865
- break;
866
- case fittingTypes.LEGACY_STRIP_SCALE_TO_FILL:
867
- transformsObj.parts.push(getLegacyFillPart(target));
868
- break;
869
- }
870
- }
871
- function getFitPart(transformsObj, target) {
872
- const transformedData = getTransformData(transformsObj.src.width, transformsObj.src.height, transformTypes.FIT, target, transformsObj.devicePixelRatio, transformsObj.upscaleMethod);
873
- const isMissingSrcDimensions = !transformsObj.src.width || !transformsObj.src.height;
874
- const transformType = isMissingSrcDimensions ? transformTypes.FIT : transformTypes.FILL;
875
- return {
876
- transformType,
877
- width: Math.round(transformedData.width),
878
- height: Math.round(transformedData.height),
879
- alignment: alignTypesMap.center,
880
- upscale: transformedData.scaleFactor > 1,
881
- forceUSM: transformedData.forceUSM,
882
- scaleFactor: transformedData.scaleFactor,
883
- cssUpscaleNeeded: transformedData.cssUpscaleNeeded,
884
- upscaleMethodValue: transformedData.upscaleMethodValue
885
- };
886
- }
887
- function getFillPart(transformsObj, target) {
888
- const transformedData = getTransformData(transformsObj.src.width, transformsObj.src.height, transformTypes.FILL, target, transformsObj.devicePixelRatio, transformsObj.upscaleMethod);
889
- const focalPoint = getFocalPoint(transformsObj.focalPoint);
890
- const transformType = focalPoint ? transformTypes.FILL_FOCAL : transformTypes.FILL;
891
- return {
892
- transformType,
893
- width: Math.round(transformedData.width),
894
- height: Math.round(transformedData.height),
895
- alignment: getAlignment(target),
896
- focalPointX: focalPoint && focalPoint.x,
897
- focalPointY: focalPoint && focalPoint.y,
898
- upscale: transformedData.scaleFactor > 1,
899
- forceUSM: transformedData.forceUSM,
900
- scaleFactor: transformedData.scaleFactor,
901
- cssUpscaleNeeded: transformedData.cssUpscaleNeeded,
902
- upscaleMethodValue: transformedData.upscaleMethodValue
903
- };
904
- }
905
- function getStretchPart(transformsObj, target) {
906
- const scaleFactor = getScaleFactor(transformsObj.src.width, transformsObj.src.height, target.width, target.height, transformTypes.FILL);
907
- const clonedTarget = { ...target };
908
- clonedTarget.width = transformsObj.src.width * scaleFactor;
909
- clonedTarget.height = transformsObj.src.height * scaleFactor;
910
- return getFitPart(transformsObj, clonedTarget);
911
- }
912
- function getCropPart(rect) {
913
- return {
914
- transformType: transformTypes.CROP,
915
- x: Math.round(rect.x),
916
- y: Math.round(rect.y),
917
- width: Math.round(rect.width),
918
- height: Math.round(rect.height),
919
- upscale: false,
920
- forceUSM: false,
921
- scaleFactor: 1,
922
- cssUpscaleNeeded: false
923
- };
924
- }
925
- function getLegacyFitPart(target) {
926
- return {
927
- transformType: transformTypes.FIT,
928
- width: Math.round(target.width),
929
- height: Math.round(target.height),
930
- upscale: false,
931
- forceUSM: true,
932
- scaleFactor: 1,
933
- cssUpscaleNeeded: false
934
- };
935
- }
936
- function getLegacyFillPart(target) {
937
- return {
938
- transformType: transformTypes.LEGACY_FILL,
939
- width: Math.round(target.width),
940
- height: Math.round(target.height),
941
- alignment: getAlignment(target),
942
- upscale: false,
943
- forceUSM: true,
944
- scaleFactor: 1,
945
- cssUpscaleNeeded: false
946
- };
947
- }
948
- function getLegacyCropPart(target) {
949
- return {
950
- transformType: transformTypes.LEGACY_CROP,
951
- width: Math.round(target.width),
952
- height: Math.round(target.height),
953
- alignment: getAlignment(target),
954
- upscale: false,
955
- forceUSM: false,
956
- scaleFactor: 1,
957
- cssUpscaleNeeded: false
958
- };
959
- }
960
- function setTransformOptions(transformsObj, options) {
961
- options = options || {};
962
- transformsObj.quality = getQuality(transformsObj, options);
963
- transformsObj.progressive = getProgressive(options);
964
- transformsObj.watermark = getWatermark(options);
965
- transformsObj.autoEncode = options.autoEncode ?? true;
966
- transformsObj.encoding = options == null ? void 0 : options.encoding;
967
- transformsObj.unsharpMask = getUnsharpMask(transformsObj, options);
968
- transformsObj.filters = getFilters(options);
969
- }
970
- function getWatermark(options) {
971
- return options.watermark;
972
- }
973
- function getProgressive(options) {
974
- return options.progressive !== false;
975
- }
976
- function getQuality(transformsObj, options) {
977
- const isPNG2 = transformsObj.fileType === fileType.PNG;
978
- const isJPG2 = transformsObj.fileType === fileType.JPG;
979
- const isWEBP2 = transformsObj.fileType === fileType.WEBP;
980
- const isAVIF2 = transformsObj.fileType === fileType.AVIF;
981
- const isQualitySupported = isJPG2 || isPNG2 || isWEBP2 || isAVIF2;
982
- if (isQualitySupported) {
983
- const transformData = last(transformsObj.parts);
984
- const defaultQuality = getPreferredImageQuality(transformData.width, transformData.height);
985
- let quality = options.quality && options.quality >= 5 && options.quality <= 90 ? options.quality : defaultQuality;
986
- quality = isPNG2 ? quality + 5 : quality;
987
- return quality;
492
+ Object.defineProperty(o, k2, desc);
493
+ }) : (function(o, m, k, k2) {
494
+ if (k2 === void 0) k2 = k;
495
+ o[k2] = m[k];
496
+ }));
497
+ var __exportStar = lib$2 && lib$2.__exportStar || function(m, exports$12) {
498
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
499
+ };
500
+ Object.defineProperty(exports$1, "__esModule", { value: true });
501
+ exports$1.DomHandler = void 0;
502
+ var domelementtype_1 = /* @__PURE__ */ requireLib$3();
503
+ var node_js_1 = /* @__PURE__ */ requireNode();
504
+ __exportStar(/* @__PURE__ */ requireNode(), exports$1);
505
+ var defaultOpts = {
506
+ withStartIndices: false,
507
+ withEndIndices: false,
508
+ xmlMode: false
509
+ };
510
+ var DomHandler = (
511
+ /** @class */
512
+ (function() {
513
+ function DomHandler2(callback, options, elementCB) {
514
+ this.dom = [];
515
+ this.root = new node_js_1.Document(this.dom);
516
+ this.done = false;
517
+ this.tagStack = [this.root];
518
+ this.lastNode = null;
519
+ this.parser = null;
520
+ if (typeof options === "function") {
521
+ elementCB = options;
522
+ options = defaultOpts;
523
+ }
524
+ if (typeof callback === "object") {
525
+ options = callback;
526
+ callback = void 0;
527
+ }
528
+ this.callback = callback !== null && callback !== void 0 ? callback : null;
529
+ this.options = options !== null && options !== void 0 ? options : defaultOpts;
530
+ this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
531
+ }
532
+ DomHandler2.prototype.onparserinit = function(parser) {
533
+ this.parser = parser;
534
+ };
535
+ DomHandler2.prototype.onreset = function() {
536
+ this.dom = [];
537
+ this.root = new node_js_1.Document(this.dom);
538
+ this.done = false;
539
+ this.tagStack = [this.root];
540
+ this.lastNode = null;
541
+ this.parser = null;
542
+ };
543
+ DomHandler2.prototype.onend = function() {
544
+ if (this.done)
545
+ return;
546
+ this.done = true;
547
+ this.parser = null;
548
+ this.handleCallback(null);
549
+ };
550
+ DomHandler2.prototype.onerror = function(error) {
551
+ this.handleCallback(error);
552
+ };
553
+ DomHandler2.prototype.onclosetag = function() {
554
+ this.lastNode = null;
555
+ var elem = this.tagStack.pop();
556
+ if (this.options.withEndIndices) {
557
+ elem.endIndex = this.parser.endIndex;
558
+ }
559
+ if (this.elementCB)
560
+ this.elementCB(elem);
561
+ };
562
+ DomHandler2.prototype.onopentag = function(name, attribs) {
563
+ var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : void 0;
564
+ var element = new node_js_1.Element(name, attribs, void 0, type);
565
+ this.addNode(element);
566
+ this.tagStack.push(element);
567
+ };
568
+ DomHandler2.prototype.ontext = function(data) {
569
+ var lastNode = this.lastNode;
570
+ if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) {
571
+ lastNode.data += data;
572
+ if (this.options.withEndIndices) {
573
+ lastNode.endIndex = this.parser.endIndex;
574
+ }
575
+ } else {
576
+ var node2 = new node_js_1.Text(data);
577
+ this.addNode(node2);
578
+ this.lastNode = node2;
579
+ }
580
+ };
581
+ DomHandler2.prototype.oncomment = function(data) {
582
+ if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) {
583
+ this.lastNode.data += data;
584
+ return;
585
+ }
586
+ var node2 = new node_js_1.Comment(data);
587
+ this.addNode(node2);
588
+ this.lastNode = node2;
589
+ };
590
+ DomHandler2.prototype.oncommentend = function() {
591
+ this.lastNode = null;
592
+ };
593
+ DomHandler2.prototype.oncdatastart = function() {
594
+ var text = new node_js_1.Text("");
595
+ var node2 = new node_js_1.CDATA([text]);
596
+ this.addNode(node2);
597
+ text.parent = node2;
598
+ this.lastNode = text;
599
+ };
600
+ DomHandler2.prototype.oncdataend = function() {
601
+ this.lastNode = null;
602
+ };
603
+ DomHandler2.prototype.onprocessinginstruction = function(name, data) {
604
+ var node2 = new node_js_1.ProcessingInstruction(name, data);
605
+ this.addNode(node2);
606
+ };
607
+ DomHandler2.prototype.handleCallback = function(error) {
608
+ if (typeof this.callback === "function") {
609
+ this.callback(error, this.dom);
610
+ } else if (error) {
611
+ throw error;
612
+ }
613
+ };
614
+ DomHandler2.prototype.addNode = function(node2) {
615
+ var parent = this.tagStack[this.tagStack.length - 1];
616
+ var previousSibling = parent.children[parent.children.length - 1];
617
+ if (this.options.withStartIndices) {
618
+ node2.startIndex = this.parser.startIndex;
619
+ }
620
+ if (this.options.withEndIndices) {
621
+ node2.endIndex = this.parser.endIndex;
622
+ }
623
+ parent.children.push(node2);
624
+ if (previousSibling) {
625
+ node2.prev = previousSibling;
626
+ previousSibling.next = node2;
627
+ }
628
+ node2.parent = parent;
629
+ this.lastNode = null;
630
+ };
631
+ return DomHandler2;
632
+ })()
633
+ );
634
+ exports$1.DomHandler = DomHandler;
635
+ exports$1.default = DomHandler;
636
+ })(lib$2);
637
+ return lib$2;
638
+ }
639
+ var constants = {};
640
+ var hasRequiredConstants;
641
+ function requireConstants() {
642
+ if (hasRequiredConstants) return constants;
643
+ hasRequiredConstants = 1;
644
+ (function(exports$1) {
645
+ Object.defineProperty(exports$1, "__esModule", { value: true });
646
+ exports$1.CARRIAGE_RETURN_PLACEHOLDER_REGEX = exports$1.CARRIAGE_RETURN_PLACEHOLDER = exports$1.CARRIAGE_RETURN_REGEX = exports$1.CARRIAGE_RETURN = exports$1.CASE_SENSITIVE_TAG_NAMES_MAP = exports$1.CASE_SENSITIVE_TAG_NAMES = void 0;
647
+ exports$1.CASE_SENSITIVE_TAG_NAMES = [
648
+ "animateMotion",
649
+ "animateTransform",
650
+ "clipPath",
651
+ "feBlend",
652
+ "feColorMatrix",
653
+ "feComponentTransfer",
654
+ "feComposite",
655
+ "feConvolveMatrix",
656
+ "feDiffuseLighting",
657
+ "feDisplacementMap",
658
+ "feDropShadow",
659
+ "feFlood",
660
+ "feFuncA",
661
+ "feFuncB",
662
+ "feFuncG",
663
+ "feFuncR",
664
+ "feGaussianBlur",
665
+ "feImage",
666
+ "feMerge",
667
+ "feMergeNode",
668
+ "feMorphology",
669
+ "feOffset",
670
+ "fePointLight",
671
+ "feSpecularLighting",
672
+ "feSpotLight",
673
+ "feTile",
674
+ "feTurbulence",
675
+ "foreignObject",
676
+ "linearGradient",
677
+ "radialGradient",
678
+ "textPath"
679
+ ];
680
+ exports$1.CASE_SENSITIVE_TAG_NAMES_MAP = exports$1.CASE_SENSITIVE_TAG_NAMES.reduce(function(accumulator, tagName) {
681
+ accumulator[tagName.toLowerCase()] = tagName;
682
+ return accumulator;
683
+ }, {});
684
+ exports$1.CARRIAGE_RETURN = "\r";
685
+ exports$1.CARRIAGE_RETURN_REGEX = new RegExp(exports$1.CARRIAGE_RETURN, "g");
686
+ exports$1.CARRIAGE_RETURN_PLACEHOLDER = "__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(), "__");
687
+ exports$1.CARRIAGE_RETURN_PLACEHOLDER_REGEX = new RegExp(exports$1.CARRIAGE_RETURN_PLACEHOLDER, "g");
688
+ })(constants);
689
+ return constants;
690
+ }
691
+ var hasRequiredUtilities$1;
692
+ function requireUtilities$1() {
693
+ if (hasRequiredUtilities$1) return utilities$1;
694
+ hasRequiredUtilities$1 = 1;
695
+ Object.defineProperty(utilities$1, "__esModule", { value: true });
696
+ utilities$1.formatAttributes = formatAttributes;
697
+ utilities$1.escapeSpecialCharacters = escapeSpecialCharacters;
698
+ utilities$1.revertEscapedCharacters = revertEscapedCharacters;
699
+ utilities$1.formatDOM = formatDOM;
700
+ var domhandler_1 = /* @__PURE__ */ requireLib$2();
701
+ var constants_1 = requireConstants();
702
+ function getCaseSensitiveTagName(tagName) {
703
+ return constants_1.CASE_SENSITIVE_TAG_NAMES_MAP[tagName];
988
704
  }
989
- return 0;
990
- }
991
- function getFilters(options) {
992
- const filterOptions = options.filters || {};
993
- const filters = {};
994
- if (isValidImageFilter(filterOptions[imageFilters.CONTRAST], -100, 100)) {
995
- filters[imageFilters.CONTRAST] = filterOptions[imageFilters.CONTRAST];
705
+ function formatAttributes(attributes) {
706
+ var map = {};
707
+ var index = 0;
708
+ var attributesLength = attributes.length;
709
+ for (; index < attributesLength; index++) {
710
+ var attribute = attributes[index];
711
+ map[attribute.name] = attribute.value;
712
+ }
713
+ return map;
996
714
  }
997
- if (isValidImageFilter(filterOptions[imageFilters.BRIGHTNESS], -100, 100)) {
998
- filters[imageFilters.BRIGHTNESS] = filterOptions[imageFilters.BRIGHTNESS];
715
+ function formatTagName(tagName) {
716
+ tagName = tagName.toLowerCase();
717
+ var caseSensitiveTagName = getCaseSensitiveTagName(tagName);
718
+ if (caseSensitiveTagName) {
719
+ return caseSensitiveTagName;
720
+ }
721
+ return tagName;
999
722
  }
1000
- if (isValidImageFilter(filterOptions[imageFilters.SATURATION], -100, 100)) {
1001
- filters[imageFilters.SATURATION] = filterOptions[imageFilters.SATURATION];
723
+ function escapeSpecialCharacters(html) {
724
+ return html.replace(constants_1.CARRIAGE_RETURN_REGEX, constants_1.CARRIAGE_RETURN_PLACEHOLDER);
1002
725
  }
1003
- if (isValidImageFilter(filterOptions[imageFilters.HUE], -180, 180)) {
1004
- filters[imageFilters.HUE] = filterOptions[imageFilters.HUE];
726
+ function revertEscapedCharacters(text) {
727
+ return text.replace(constants_1.CARRIAGE_RETURN_PLACEHOLDER_REGEX, constants_1.CARRIAGE_RETURN);
1005
728
  }
1006
- if (isValidImageFilter(filterOptions[imageFilters.BLUR], 0, 100)) {
1007
- filters[imageFilters.BLUR] = filterOptions[imageFilters.BLUR];
729
+ function formatDOM(nodes, parent, directive) {
730
+ if (parent === void 0) {
731
+ parent = null;
732
+ }
733
+ var domNodes = [];
734
+ var current;
735
+ var index = 0;
736
+ var nodesLength = nodes.length;
737
+ for (; index < nodesLength; index++) {
738
+ var node2 = nodes[index];
739
+ switch (node2.nodeType) {
740
+ case 1: {
741
+ var tagName = formatTagName(node2.nodeName);
742
+ current = new domhandler_1.Element(tagName, formatAttributes(node2.attributes));
743
+ current.children = formatDOM(
744
+ // template children are on content
745
+ tagName === "template" ? node2.content.childNodes : node2.childNodes,
746
+ current
747
+ );
748
+ break;
749
+ }
750
+ case 3:
751
+ current = new domhandler_1.Text(revertEscapedCharacters(node2.nodeValue));
752
+ break;
753
+ case 8:
754
+ current = new domhandler_1.Comment(node2.nodeValue);
755
+ break;
756
+ default:
757
+ continue;
758
+ }
759
+ var prev = domNodes[index - 1] || null;
760
+ if (prev) {
761
+ prev.next = current;
762
+ }
763
+ current.parent = parent;
764
+ current.prev = prev;
765
+ current.next = null;
766
+ domNodes.push(current);
767
+ }
768
+ if (directive) {
769
+ current = new domhandler_1.ProcessingInstruction(directive.substring(0, directive.indexOf(" ")).toLowerCase(), directive);
770
+ current.next = domNodes[0] || null;
771
+ current.parent = parent;
772
+ domNodes.unshift(current);
773
+ if (domNodes[1]) {
774
+ domNodes[1].prev = domNodes[0];
775
+ }
776
+ }
777
+ return domNodes;
1008
778
  }
1009
- return filters;
1010
- }
1011
- function isValidImageFilter(filterValue, minValue, maxValue) {
1012
- return typeof filterValue === "number" && !isNaN(filterValue) && filterValue !== 0 && filterValue >= minValue && filterValue <= maxValue;
1013
- }
1014
- function getUnsharpMask(transformsObj, options) {
1015
- var _a, _b, _c;
1016
- if (isUSMValid(options.unsharpMask)) {
1017
- return {
1018
- radius: roundToFixed((_a = options.unsharpMask) == null ? void 0 : _a.radius, 2),
1019
- amount: roundToFixed((_b = options.unsharpMask) == null ? void 0 : _b.amount, 2),
1020
- threshold: roundToFixed((_c = options.unsharpMask) == null ? void 0 : _c.threshold, 2)
779
+ return utilities$1;
780
+ }
781
+ var hasRequiredDomparser;
782
+ function requireDomparser() {
783
+ if (hasRequiredDomparser) return domparser;
784
+ hasRequiredDomparser = 1;
785
+ Object.defineProperty(domparser, "__esModule", { value: true });
786
+ domparser.default = domparser$1;
787
+ var utilities_1 = requireUtilities$1();
788
+ var HTML = "html";
789
+ var HEAD = "head";
790
+ var BODY = "body";
791
+ var FIRST_TAG_REGEX = /<([a-zA-Z]+[0-9]?)/;
792
+ var HEAD_TAG_REGEX = /<head[^]*>/i;
793
+ var BODY_TAG_REGEX = /<body[^]*>/i;
794
+ var parseFromDocument = function(html, tagName) {
795
+ throw new Error("This browser does not support `document.implementation.createHTMLDocument`");
796
+ };
797
+ var parseFromString = function(html, tagName) {
798
+ throw new Error("This browser does not support `DOMParser.prototype.parseFromString`");
799
+ };
800
+ var DOMParser = typeof window === "object" && window.DOMParser;
801
+ if (typeof DOMParser === "function") {
802
+ var domParser_1 = new DOMParser();
803
+ var mimeType_1 = "text/html";
804
+ parseFromString = function(html, tagName) {
805
+ if (tagName) {
806
+ html = "<".concat(tagName, ">").concat(html, "</").concat(tagName, ">");
807
+ }
808
+ return domParser_1.parseFromString(html, mimeType_1);
1021
809
  };
1022
- } else if (!isZeroUSM(options.unsharpMask) && isUSMNeeded(transformsObj)) {
1023
- return defaultUSM;
810
+ parseFromDocument = parseFromString;
1024
811
  }
1025
- return;
1026
- }
1027
- function isUSMNeeded(transformsObj) {
1028
- const transformPart = last(transformsObj.parts);
1029
- const upscale = transformPart.scaleFactor >= 1;
1030
- return !upscale || transformPart.forceUSM || transformPart.transformType === transformTypes.FIT;
1031
- }
1032
- function isUSMValid(usm) {
1033
- usm = usm || {};
1034
- const radius = typeof usm.radius === "number" && !isNaN(usm.radius) && usm.radius >= 0.1 && usm.radius <= 500;
1035
- const amount = typeof usm.amount === "number" && !isNaN(usm.amount) && usm.amount >= 0 && usm.amount <= 10;
1036
- const threshold = typeof usm.threshold === "number" && !isNaN(usm.threshold) && usm.threshold >= 0 && usm.threshold <= 255;
1037
- return radius && amount && threshold;
1038
- }
1039
- function isZeroUSM(usm) {
1040
- usm = usm || {};
1041
- return typeof usm.radius === "number" && !isNaN(usm.radius) && usm.radius === 0 && typeof usm.amount === "number" && !isNaN(usm.amount) && usm.amount === 0 && typeof usm.threshold === "number" && !isNaN(usm.threshold) && usm.threshold === 0;
1042
- }
1043
- function getTransform(fittingType, src, target, options) {
1044
- const _isSEOBot = isSEOBot(options);
1045
- const fileType2 = getFileType(src.id);
1046
- const fileName = getFileName(src.id, src.name);
1047
- const devicePixelRatio = _isSEOBot ? 1 : getDevicePixelRatio(target);
1048
- const fileExtension = getFileExtension(src.id);
1049
- const preferredExtension = fileExtension;
1050
- const canTransformImage = isImageTransformApplicable(src.id, options == null ? void 0 : options.hasAnimation, options == null ? void 0 : options.allowAnimatedTransform, options == null ? void 0 : options.allowFullGIFTransformation);
1051
- const transformsObj = {
1052
- fileName,
1053
- fileExtension,
1054
- fileType: fileType2,
1055
- fittingType,
1056
- preferredExtension,
1057
- src: {
1058
- id: src.id,
1059
- width: src.width,
1060
- height: src.height,
1061
- isCropped: false,
1062
- isAnimated: imageIsAnimated(src.id, options == null ? void 0 : options.hasAnimation)
1063
- },
1064
- focalPoint: {
1065
- x: src.focalPoint && src.focalPoint.x,
1066
- y: src.focalPoint && src.focalPoint.y
1067
- },
1068
- parts: [],
1069
- // options - general
1070
- devicePixelRatio,
1071
- quality: 0,
1072
- upscaleMethod: getUpscaleString(options),
1073
- progressive: true,
1074
- watermark: "",
1075
- unsharpMask: {},
1076
- filters: {},
1077
- transformed: canTransformImage,
1078
- allowFullGIFTransformation: options == null ? void 0 : options.allowFullGIFTransformation,
1079
- isPlaceholderFlow: options == null ? void 0 : options.isPlaceholderFlow
1080
- };
1081
- if (canTransformImage) {
1082
- setTransformParts(transformsObj, src, target);
1083
- setTransformOptions(transformsObj, options);
812
+ if (typeof document === "object" && document.implementation) {
813
+ var htmlDocument_1 = document.implementation.createHTMLDocument();
814
+ parseFromDocument = function(html, tagName) {
815
+ if (tagName) {
816
+ var element = htmlDocument_1.documentElement.querySelector(tagName);
817
+ if (element) {
818
+ element.innerHTML = html;
819
+ }
820
+ return htmlDocument_1;
821
+ }
822
+ htmlDocument_1.documentElement.innerHTML = html;
823
+ return htmlDocument_1;
824
+ };
1084
825
  }
1085
- return transformsObj;
1086
- }
1087
- function getTarget(fittingType, src, target) {
1088
- const targetObj = { ...target };
1089
- const _isMobile = isMobile();
1090
- switch (fittingType) {
1091
- case fittingTypes.LEGACY_BG_FIT_AND_TILE:
1092
- case fittingTypes.LEGACY_BG_FIT_AND_TILE_HORIZONTAL:
1093
- case fittingTypes.LEGACY_BG_FIT_AND_TILE_VERTICAL:
1094
- case fittingTypes.LEGACY_BG_NORMAL:
1095
- const maxBGSiteLegacyWidth = _isMobile ? MOBILE_MAX_BG_SITE_LEGACY_WIDTH : DSKTP_MAX_BG_SITE_LEGACY_WIDTH;
1096
- const maxBGSiteLegacyHeight = _isMobile ? MOBILE_MAX_BG_SITE_LEGACY_HEIGHT : DSKTP_MAX_BG_SITE_LEGACY_HEIGHT;
1097
- targetObj.width = Math.min(maxBGSiteLegacyWidth, src.width);
1098
- targetObj.height = Math.min(maxBGSiteLegacyHeight, Math.round(targetObj.width / (src.width / src.height)));
1099
- targetObj.pixelAspectRatio = 1;
826
+ var template = typeof document === "object" && document.createElement("template");
827
+ var parseFromTemplate;
828
+ if (template && template.content) {
829
+ parseFromTemplate = function(html) {
830
+ template.innerHTML = html;
831
+ return template.content.childNodes;
832
+ };
1100
833
  }
1101
- return targetObj;
1102
- }
1103
- const fitTemplate = template`fit/w_${"width"},h_${"height"}`;
1104
- const fillTemplate = template`fill/w_${"width"},h_${"height"},al_${"alignment"}`;
1105
- const fillFocalTemplate = template`fill/w_${"width"},h_${"height"},fp_${"focalPointX"}_${"focalPointY"}`;
1106
- const cropTemplate = template`crop/x_${"x"},y_${"y"},w_${"width"},h_${"height"}`;
1107
- const legacyCropTemplate = template`crop/w_${"width"},h_${"height"},al_${"alignment"}`;
1108
- const legacyFillTemplate = template`fill/w_${"width"},h_${"height"},al_${"alignment"}`;
1109
- const upscaleTemplate = template`,lg_${"upscaleMethodValue"}`;
1110
- const qualityTemplate = template`,q_${"quality"}`;
1111
- const qualityAutoTemplate = template`,quality_auto`;
1112
- const unSharpMaskTemplate = template`,usm_${"radius"}_${"amount"}_${"threshold"}`;
1113
- const nonProgressiveTemplate = template`,bl`;
1114
- const watermarkTemplate = template`,wm_${"watermark"}`;
1115
- const filterTemplatesMap = {
1116
- [imageFilters.CONTRAST]: template`,con_${"contrast"}`,
1117
- [imageFilters.BRIGHTNESS]: template`,br_${"brightness"}`,
1118
- [imageFilters.SATURATION]: template`,sat_${"saturation"}`,
1119
- [imageFilters.HUE]: template`,hue_${"hue"}`,
1120
- [imageFilters.BLUR]: template`,blur_${"blur"}`
1121
- };
1122
- const autoEncodeTemplate = template`,enc_auto`;
1123
- const AVIFEncodeTemplate = template`,enc_avif`;
1124
- const pAVIFEncodeTemplate = template`,enc_pavif`;
1125
- const animatedTransformTemplate = template`,pstr`;
1126
- const animatedGIFTransformTemplate = template`,anm_all`;
1127
- function getImageURI(transformsObj) {
1128
- var _a;
1129
- const transformsObjStrArr = [];
1130
- transformsObj.parts.forEach((transformPart) => {
1131
- switch (transformPart.transformType) {
1132
- case transformTypes.CROP:
1133
- transformsObjStrArr.push(cropTemplate(transformPart));
1134
- break;
1135
- case transformTypes.LEGACY_CROP:
1136
- transformsObjStrArr.push(legacyCropTemplate(transformPart));
1137
- break;
1138
- case transformTypes.LEGACY_FILL:
1139
- let legacyFillStr = legacyFillTemplate(transformPart);
1140
- if (transformPart.upscale) {
1141
- legacyFillStr += upscaleTemplate(transformPart);
834
+ function domparser$1(html) {
835
+ var _a, _b;
836
+ html = (0, utilities_1.escapeSpecialCharacters)(html);
837
+ var match = html.match(FIRST_TAG_REGEX);
838
+ var firstTagName = match && match[1] ? match[1].toLowerCase() : "";
839
+ switch (firstTagName) {
840
+ case HTML: {
841
+ var doc = parseFromString(html);
842
+ if (!HEAD_TAG_REGEX.test(html)) {
843
+ var element = doc.querySelector(HEAD);
844
+ (_a = element === null || element === void 0 ? void 0 : element.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(element);
1142
845
  }
1143
- transformsObjStrArr.push(legacyFillStr);
1144
- break;
1145
- case transformTypes.FIT:
1146
- let fitStr = fitTemplate(transformPart);
1147
- if (transformPart.upscale) {
1148
- fitStr += upscaleTemplate(transformPart);
846
+ if (!BODY_TAG_REGEX.test(html)) {
847
+ var element = doc.querySelector(BODY);
848
+ (_b = element === null || element === void 0 ? void 0 : element.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(element);
1149
849
  }
1150
- transformsObjStrArr.push(fitStr);
1151
- break;
1152
- case transformTypes.FILL:
1153
- let fillStr = fillTemplate(transformPart);
1154
- if (transformPart.upscale) {
1155
- fillStr += upscaleTemplate(transformPart);
850
+ return doc.querySelectorAll(HTML);
851
+ }
852
+ case HEAD:
853
+ case BODY: {
854
+ var elements = parseFromDocument(html).querySelectorAll(firstTagName);
855
+ if (BODY_TAG_REGEX.test(html) && HEAD_TAG_REGEX.test(html)) {
856
+ return elements[0].parentNode.childNodes;
1156
857
  }
1157
- transformsObjStrArr.push(fillStr);
1158
- break;
1159
- case transformTypes.FILL_FOCAL:
1160
- let fillFocalStr = fillFocalTemplate(transformPart);
1161
- if (transformPart.upscale) {
1162
- fillFocalStr += upscaleTemplate(transformPart);
858
+ return elements;
859
+ }
860
+ // low-level tag or text
861
+ default: {
862
+ if (parseFromTemplate) {
863
+ return parseFromTemplate(html);
1163
864
  }
1164
- transformsObjStrArr.push(fillFocalStr);
1165
- break;
1166
- }
1167
- });
1168
- let transformsStr = transformsObjStrArr.join("/");
1169
- if (transformsObj.quality) {
1170
- transformsStr += qualityTemplate(transformsObj);
1171
- }
1172
- if (transformsObj.unsharpMask) {
1173
- transformsStr += unSharpMaskTemplate(transformsObj.unsharpMask);
1174
- }
1175
- if (!transformsObj.progressive) {
1176
- transformsStr += nonProgressiveTemplate(transformsObj);
1177
- }
1178
- if (transformsObj.watermark) {
1179
- transformsStr += watermarkTemplate(transformsObj);
1180
- }
1181
- if (transformsObj.filters) {
1182
- transformsStr += Object.keys(transformsObj.filters).map((filterName) => filterTemplatesMap[filterName](transformsObj.filters)).join("");
1183
- }
1184
- if (transformsObj.fileType !== fileType.GIF) {
1185
- if (transformsObj.encoding === encodingTypes.AVIF) {
1186
- transformsStr += AVIFEncodeTemplate(transformsObj);
1187
- transformsStr += qualityAutoTemplate(transformsObj);
1188
- } else if (transformsObj.encoding === encodingTypes.PAVIF) {
1189
- transformsStr += pAVIFEncodeTemplate(transformsObj);
1190
- transformsStr += qualityAutoTemplate(transformsObj);
1191
- } else if (transformsObj.autoEncode) {
1192
- transformsStr += autoEncodeTemplate(transformsObj);
865
+ var element = parseFromDocument(html, BODY).querySelector(BODY);
866
+ return element.childNodes;
867
+ }
1193
868
  }
1194
869
  }
1195
- if (((_a = transformsObj.src) == null ? void 0 : _a.isAnimated) && transformsObj.transformed) {
1196
- const isGif = isGIF(transformsObj.src.id);
1197
- const isPlaceholderFlow = transformsObj.isPlaceholderFlow === true;
1198
- const allowFullGIFTransformation = transformsObj.allowFullGIFTransformation === true;
1199
- if (isPlaceholderFlow) {
1200
- transformsStr += animatedTransformTemplate(transformsObj);
1201
- } else if (isGif && allowFullGIFTransformation) {
1202
- transformsStr += animatedGIFTransformTemplate(transformsObj);
870
+ return domparser;
871
+ }
872
+ var hasRequiredHtmlToDom;
873
+ function requireHtmlToDom() {
874
+ if (hasRequiredHtmlToDom) return htmlToDom;
875
+ hasRequiredHtmlToDom = 1;
876
+ var __importDefault = htmlToDom && htmlToDom.__importDefault || function(mod) {
877
+ return mod && mod.__esModule ? mod : { "default": mod };
878
+ };
879
+ Object.defineProperty(htmlToDom, "__esModule", { value: true });
880
+ htmlToDom.default = HTMLDOMParser;
881
+ var domparser_1 = __importDefault(requireDomparser());
882
+ var utilities_1 = requireUtilities$1();
883
+ var DIRECTIVE_REGEX = /<(![a-zA-Z\s]+)>/;
884
+ function HTMLDOMParser(html) {
885
+ if (typeof html !== "string") {
886
+ throw new TypeError("First argument must be a string");
1203
887
  }
1204
- }
1205
- return `${transformsObj.src.id}/${API_VERSION}/${transformsStr}/${transformsObj.fileName}.${transformsObj.preferredExtension}`;
1206
- }
1207
- function getURI(fittingType, src, target, options = {}, transformObj) {
1208
- if (isImageTransformApplicable(src.id, options == null ? void 0 : options.hasAnimation, options == null ? void 0 : options.allowAnimatedTransform, options == null ? void 0 : options.allowFullGIFTransformation)) {
1209
- if ((isWEBP(src.id) || isAVIF(src.id)) && !options.allowWebpAvifTransforms) {
1210
- const { alignment, ...transformTarget } = target;
1211
- src.focalPoint = { x: void 0, y: void 0 };
1212
- src == null ? true : delete src.crop;
1213
- transformObj = getTransform(fittingType, src, transformTarget, options);
1214
- } else {
1215
- transformObj = transformObj || getTransform(fittingType, src, target, options);
888
+ if (!html) {
889
+ return [];
1216
890
  }
1217
- return getImageURI(transformObj);
1218
- }
1219
- return src.id;
1220
- }
1221
- function getSrcset(fittingType, src, target, options, data) {
1222
- const dpr = target.pixelAspectRatio || 1;
1223
- return {
1224
- dpr: [
1225
- `${dpr === 1 ? data.uri : getURI(fittingType, src, {
1226
- ...target,
1227
- pixelAspectRatio: 1
1228
- }, options)} 1x`,
1229
- `${dpr === 2 ? data.uri : getURI(fittingType, src, {
1230
- ...target,
1231
- pixelAspectRatio: 2
1232
- }, options)} 2x`
1233
- ]
1234
- };
1235
- }
1236
- const ALIGN_TYPE_TO_POSITION = {
1237
- [alignTypes.CENTER]: "50% 50%",
1238
- [alignTypes.TOP_LEFT]: "0% 0%",
1239
- [alignTypes.TOP_RIGHT]: "100% 0%",
1240
- [alignTypes.TOP]: "50% 0%",
1241
- [alignTypes.BOTTOM_LEFT]: "0% 100%",
1242
- [alignTypes.BOTTOM_RIGHT]: "100% 100%",
1243
- [alignTypes.BOTTOM]: "50% 100%",
1244
- [alignTypes.RIGHT]: "100% 50%",
1245
- [alignTypes.LEFT]: "0% 50%"
1246
- };
1247
- const POSITION_TO_ALIGN_TYPE = Object.entries(ALIGN_TYPE_TO_POSITION).reduce((acc, [align, position]) => {
1248
- acc[position] = align;
1249
- return acc;
1250
- }, {});
1251
- const TILE_FITTING_TYPES = [
1252
- fittingTypes.TILE,
1253
- fittingTypes.TILE_HORIZONTAL,
1254
- fittingTypes.TILE_VERTICAL,
1255
- fittingTypes.LEGACY_BG_FIT_AND_TILE,
1256
- fittingTypes.LEGACY_BG_FIT_AND_TILE_HORIZONTAL,
1257
- fittingTypes.LEGACY_BG_FIT_AND_TILE_VERTICAL
1258
- ];
1259
- const NON_SCALING_FITTING_TYPES = [
1260
- fittingTypes.LEGACY_ORIGINAL_SIZE,
1261
- fittingTypes.ORIGINAL_SIZE,
1262
- fittingTypes.LEGACY_BG_NORMAL
1263
- ];
1264
- function getIsFakeTile(fittingType, src, { width: targetWidth, height: targetHeight }) {
1265
- return fittingType === fittingTypes.TILE && src.width > targetWidth && src.height > targetHeight;
1266
- }
1267
- function getScaledDimensions(fittingType, src, { width, height }, isSEOBot2 = false) {
1268
- if (isSEOBot2) {
1269
- return { width, height };
891
+ var match = html.match(DIRECTIVE_REGEX);
892
+ var directive = match ? match[1] : void 0;
893
+ return (0, utilities_1.formatDOM)((0, domparser_1.default)(html), null, directive);
1270
894
  }
1271
- const isScalable = !NON_SCALING_FITTING_TYPES.includes(fittingType);
1272
- const isFakeTile = getIsFakeTile(fittingType, src, { width, height });
1273
- const isTile = !isFakeTile && TILE_FITTING_TYPES.includes(fittingType);
1274
- const _width = isTile ? src.width : width;
1275
- const _height = isTile ? src.height : height;
1276
- const scaleFactor = isScalable ? getScaleFactorByWidth(_width, isPNG(src.id)) : 1;
1277
- return {
1278
- width: isFakeTile ? 1920 : _width * scaleFactor,
1279
- height: _height * scaleFactor
895
+ return htmlToDom;
896
+ }
897
+ var attributesToProps = {};
898
+ var lib = {};
899
+ var possibleStandardNamesOptimized = {};
900
+ var hasRequiredPossibleStandardNamesOptimized;
901
+ function requirePossibleStandardNamesOptimized() {
902
+ if (hasRequiredPossibleStandardNamesOptimized) return possibleStandardNamesOptimized;
903
+ hasRequiredPossibleStandardNamesOptimized = 1;
904
+ var SAME = 0;
905
+ possibleStandardNamesOptimized.SAME = SAME;
906
+ var CAMELCASE = 1;
907
+ possibleStandardNamesOptimized.CAMELCASE = CAMELCASE;
908
+ possibleStandardNamesOptimized.possibleStandardNames = {
909
+ accept: 0,
910
+ acceptCharset: 1,
911
+ "accept-charset": "acceptCharset",
912
+ accessKey: 1,
913
+ action: 0,
914
+ allowFullScreen: 1,
915
+ alt: 0,
916
+ as: 0,
917
+ async: 0,
918
+ autoCapitalize: 1,
919
+ autoComplete: 1,
920
+ autoCorrect: 1,
921
+ autoFocus: 1,
922
+ autoPlay: 1,
923
+ autoSave: 1,
924
+ capture: 0,
925
+ cellPadding: 1,
926
+ cellSpacing: 1,
927
+ challenge: 0,
928
+ charSet: 1,
929
+ checked: 0,
930
+ children: 0,
931
+ cite: 0,
932
+ class: "className",
933
+ classID: 1,
934
+ className: 1,
935
+ cols: 0,
936
+ colSpan: 1,
937
+ content: 0,
938
+ contentEditable: 1,
939
+ contextMenu: 1,
940
+ controls: 0,
941
+ controlsList: 1,
942
+ coords: 0,
943
+ crossOrigin: 1,
944
+ dangerouslySetInnerHTML: 1,
945
+ data: 0,
946
+ dateTime: 1,
947
+ default: 0,
948
+ defaultChecked: 1,
949
+ defaultValue: 1,
950
+ defer: 0,
951
+ dir: 0,
952
+ disabled: 0,
953
+ disablePictureInPicture: 1,
954
+ disableRemotePlayback: 1,
955
+ download: 0,
956
+ draggable: 0,
957
+ encType: 1,
958
+ enterKeyHint: 1,
959
+ for: "htmlFor",
960
+ form: 0,
961
+ formMethod: 1,
962
+ formAction: 1,
963
+ formEncType: 1,
964
+ formNoValidate: 1,
965
+ formTarget: 1,
966
+ frameBorder: 1,
967
+ headers: 0,
968
+ height: 0,
969
+ hidden: 0,
970
+ high: 0,
971
+ href: 0,
972
+ hrefLang: 1,
973
+ htmlFor: 1,
974
+ httpEquiv: 1,
975
+ "http-equiv": "httpEquiv",
976
+ icon: 0,
977
+ id: 0,
978
+ innerHTML: 1,
979
+ inputMode: 1,
980
+ integrity: 0,
981
+ is: 0,
982
+ itemID: 1,
983
+ itemProp: 1,
984
+ itemRef: 1,
985
+ itemScope: 1,
986
+ itemType: 1,
987
+ keyParams: 1,
988
+ keyType: 1,
989
+ kind: 0,
990
+ label: 0,
991
+ lang: 0,
992
+ list: 0,
993
+ loop: 0,
994
+ low: 0,
995
+ manifest: 0,
996
+ marginWidth: 1,
997
+ marginHeight: 1,
998
+ max: 0,
999
+ maxLength: 1,
1000
+ media: 0,
1001
+ mediaGroup: 1,
1002
+ method: 0,
1003
+ min: 0,
1004
+ minLength: 1,
1005
+ multiple: 0,
1006
+ muted: 0,
1007
+ name: 0,
1008
+ noModule: 1,
1009
+ nonce: 0,
1010
+ noValidate: 1,
1011
+ open: 0,
1012
+ optimum: 0,
1013
+ pattern: 0,
1014
+ placeholder: 0,
1015
+ playsInline: 1,
1016
+ poster: 0,
1017
+ preload: 0,
1018
+ profile: 0,
1019
+ radioGroup: 1,
1020
+ readOnly: 1,
1021
+ referrerPolicy: 1,
1022
+ rel: 0,
1023
+ required: 0,
1024
+ reversed: 0,
1025
+ role: 0,
1026
+ rows: 0,
1027
+ rowSpan: 1,
1028
+ sandbox: 0,
1029
+ scope: 0,
1030
+ scoped: 0,
1031
+ scrolling: 0,
1032
+ seamless: 0,
1033
+ selected: 0,
1034
+ shape: 0,
1035
+ size: 0,
1036
+ sizes: 0,
1037
+ span: 0,
1038
+ spellCheck: 1,
1039
+ src: 0,
1040
+ srcDoc: 1,
1041
+ srcLang: 1,
1042
+ srcSet: 1,
1043
+ start: 0,
1044
+ step: 0,
1045
+ style: 0,
1046
+ summary: 0,
1047
+ tabIndex: 1,
1048
+ target: 0,
1049
+ title: 0,
1050
+ type: 0,
1051
+ useMap: 1,
1052
+ value: 0,
1053
+ width: 0,
1054
+ wmode: 0,
1055
+ wrap: 0,
1056
+ about: 0,
1057
+ accentHeight: 1,
1058
+ "accent-height": "accentHeight",
1059
+ accumulate: 0,
1060
+ additive: 0,
1061
+ alignmentBaseline: 1,
1062
+ "alignment-baseline": "alignmentBaseline",
1063
+ allowReorder: 1,
1064
+ alphabetic: 0,
1065
+ amplitude: 0,
1066
+ arabicForm: 1,
1067
+ "arabic-form": "arabicForm",
1068
+ ascent: 0,
1069
+ attributeName: 1,
1070
+ attributeType: 1,
1071
+ autoReverse: 1,
1072
+ azimuth: 0,
1073
+ baseFrequency: 1,
1074
+ baselineShift: 1,
1075
+ "baseline-shift": "baselineShift",
1076
+ baseProfile: 1,
1077
+ bbox: 0,
1078
+ begin: 0,
1079
+ bias: 0,
1080
+ by: 0,
1081
+ calcMode: 1,
1082
+ capHeight: 1,
1083
+ "cap-height": "capHeight",
1084
+ clip: 0,
1085
+ clipPath: 1,
1086
+ "clip-path": "clipPath",
1087
+ clipPathUnits: 1,
1088
+ clipRule: 1,
1089
+ "clip-rule": "clipRule",
1090
+ color: 0,
1091
+ colorInterpolation: 1,
1092
+ "color-interpolation": "colorInterpolation",
1093
+ colorInterpolationFilters: 1,
1094
+ "color-interpolation-filters": "colorInterpolationFilters",
1095
+ colorProfile: 1,
1096
+ "color-profile": "colorProfile",
1097
+ colorRendering: 1,
1098
+ "color-rendering": "colorRendering",
1099
+ contentScriptType: 1,
1100
+ contentStyleType: 1,
1101
+ cursor: 0,
1102
+ cx: 0,
1103
+ cy: 0,
1104
+ d: 0,
1105
+ datatype: 0,
1106
+ decelerate: 0,
1107
+ descent: 0,
1108
+ diffuseConstant: 1,
1109
+ direction: 0,
1110
+ display: 0,
1111
+ divisor: 0,
1112
+ dominantBaseline: 1,
1113
+ "dominant-baseline": "dominantBaseline",
1114
+ dur: 0,
1115
+ dx: 0,
1116
+ dy: 0,
1117
+ edgeMode: 1,
1118
+ elevation: 0,
1119
+ enableBackground: 1,
1120
+ "enable-background": "enableBackground",
1121
+ end: 0,
1122
+ exponent: 0,
1123
+ externalResourcesRequired: 1,
1124
+ fill: 0,
1125
+ fillOpacity: 1,
1126
+ "fill-opacity": "fillOpacity",
1127
+ fillRule: 1,
1128
+ "fill-rule": "fillRule",
1129
+ filter: 0,
1130
+ filterRes: 1,
1131
+ filterUnits: 1,
1132
+ floodOpacity: 1,
1133
+ "flood-opacity": "floodOpacity",
1134
+ floodColor: 1,
1135
+ "flood-color": "floodColor",
1136
+ focusable: 0,
1137
+ fontFamily: 1,
1138
+ "font-family": "fontFamily",
1139
+ fontSize: 1,
1140
+ "font-size": "fontSize",
1141
+ fontSizeAdjust: 1,
1142
+ "font-size-adjust": "fontSizeAdjust",
1143
+ fontStretch: 1,
1144
+ "font-stretch": "fontStretch",
1145
+ fontStyle: 1,
1146
+ "font-style": "fontStyle",
1147
+ fontVariant: 1,
1148
+ "font-variant": "fontVariant",
1149
+ fontWeight: 1,
1150
+ "font-weight": "fontWeight",
1151
+ format: 0,
1152
+ from: 0,
1153
+ fx: 0,
1154
+ fy: 0,
1155
+ g1: 0,
1156
+ g2: 0,
1157
+ glyphName: 1,
1158
+ "glyph-name": "glyphName",
1159
+ glyphOrientationHorizontal: 1,
1160
+ "glyph-orientation-horizontal": "glyphOrientationHorizontal",
1161
+ glyphOrientationVertical: 1,
1162
+ "glyph-orientation-vertical": "glyphOrientationVertical",
1163
+ glyphRef: 1,
1164
+ gradientTransform: 1,
1165
+ gradientUnits: 1,
1166
+ hanging: 0,
1167
+ horizAdvX: 1,
1168
+ "horiz-adv-x": "horizAdvX",
1169
+ horizOriginX: 1,
1170
+ "horiz-origin-x": "horizOriginX",
1171
+ ideographic: 0,
1172
+ imageRendering: 1,
1173
+ "image-rendering": "imageRendering",
1174
+ in2: 0,
1175
+ in: 0,
1176
+ inlist: 0,
1177
+ intercept: 0,
1178
+ k1: 0,
1179
+ k2: 0,
1180
+ k3: 0,
1181
+ k4: 0,
1182
+ k: 0,
1183
+ kernelMatrix: 1,
1184
+ kernelUnitLength: 1,
1185
+ kerning: 0,
1186
+ keyPoints: 1,
1187
+ keySplines: 1,
1188
+ keyTimes: 1,
1189
+ lengthAdjust: 1,
1190
+ letterSpacing: 1,
1191
+ "letter-spacing": "letterSpacing",
1192
+ lightingColor: 1,
1193
+ "lighting-color": "lightingColor",
1194
+ limitingConeAngle: 1,
1195
+ local: 0,
1196
+ markerEnd: 1,
1197
+ "marker-end": "markerEnd",
1198
+ markerHeight: 1,
1199
+ markerMid: 1,
1200
+ "marker-mid": "markerMid",
1201
+ markerStart: 1,
1202
+ "marker-start": "markerStart",
1203
+ markerUnits: 1,
1204
+ markerWidth: 1,
1205
+ mask: 0,
1206
+ maskContentUnits: 1,
1207
+ maskUnits: 1,
1208
+ mathematical: 0,
1209
+ mode: 0,
1210
+ numOctaves: 1,
1211
+ offset: 0,
1212
+ opacity: 0,
1213
+ operator: 0,
1214
+ order: 0,
1215
+ orient: 0,
1216
+ orientation: 0,
1217
+ origin: 0,
1218
+ overflow: 0,
1219
+ overlinePosition: 1,
1220
+ "overline-position": "overlinePosition",
1221
+ overlineThickness: 1,
1222
+ "overline-thickness": "overlineThickness",
1223
+ paintOrder: 1,
1224
+ "paint-order": "paintOrder",
1225
+ panose1: 0,
1226
+ "panose-1": "panose1",
1227
+ pathLength: 1,
1228
+ patternContentUnits: 1,
1229
+ patternTransform: 1,
1230
+ patternUnits: 1,
1231
+ pointerEvents: 1,
1232
+ "pointer-events": "pointerEvents",
1233
+ points: 0,
1234
+ pointsAtX: 1,
1235
+ pointsAtY: 1,
1236
+ pointsAtZ: 1,
1237
+ prefix: 0,
1238
+ preserveAlpha: 1,
1239
+ preserveAspectRatio: 1,
1240
+ primitiveUnits: 1,
1241
+ property: 0,
1242
+ r: 0,
1243
+ radius: 0,
1244
+ refX: 1,
1245
+ refY: 1,
1246
+ renderingIntent: 1,
1247
+ "rendering-intent": "renderingIntent",
1248
+ repeatCount: 1,
1249
+ repeatDur: 1,
1250
+ requiredExtensions: 1,
1251
+ requiredFeatures: 1,
1252
+ resource: 0,
1253
+ restart: 0,
1254
+ result: 0,
1255
+ results: 0,
1256
+ rotate: 0,
1257
+ rx: 0,
1258
+ ry: 0,
1259
+ scale: 0,
1260
+ security: 0,
1261
+ seed: 0,
1262
+ shapeRendering: 1,
1263
+ "shape-rendering": "shapeRendering",
1264
+ slope: 0,
1265
+ spacing: 0,
1266
+ specularConstant: 1,
1267
+ specularExponent: 1,
1268
+ speed: 0,
1269
+ spreadMethod: 1,
1270
+ startOffset: 1,
1271
+ stdDeviation: 1,
1272
+ stemh: 0,
1273
+ stemv: 0,
1274
+ stitchTiles: 1,
1275
+ stopColor: 1,
1276
+ "stop-color": "stopColor",
1277
+ stopOpacity: 1,
1278
+ "stop-opacity": "stopOpacity",
1279
+ strikethroughPosition: 1,
1280
+ "strikethrough-position": "strikethroughPosition",
1281
+ strikethroughThickness: 1,
1282
+ "strikethrough-thickness": "strikethroughThickness",
1283
+ string: 0,
1284
+ stroke: 0,
1285
+ strokeDasharray: 1,
1286
+ "stroke-dasharray": "strokeDasharray",
1287
+ strokeDashoffset: 1,
1288
+ "stroke-dashoffset": "strokeDashoffset",
1289
+ strokeLinecap: 1,
1290
+ "stroke-linecap": "strokeLinecap",
1291
+ strokeLinejoin: 1,
1292
+ "stroke-linejoin": "strokeLinejoin",
1293
+ strokeMiterlimit: 1,
1294
+ "stroke-miterlimit": "strokeMiterlimit",
1295
+ strokeWidth: 1,
1296
+ "stroke-width": "strokeWidth",
1297
+ strokeOpacity: 1,
1298
+ "stroke-opacity": "strokeOpacity",
1299
+ suppressContentEditableWarning: 1,
1300
+ suppressHydrationWarning: 1,
1301
+ surfaceScale: 1,
1302
+ systemLanguage: 1,
1303
+ tableValues: 1,
1304
+ targetX: 1,
1305
+ targetY: 1,
1306
+ textAnchor: 1,
1307
+ "text-anchor": "textAnchor",
1308
+ textDecoration: 1,
1309
+ "text-decoration": "textDecoration",
1310
+ textLength: 1,
1311
+ textRendering: 1,
1312
+ "text-rendering": "textRendering",
1313
+ to: 0,
1314
+ transform: 0,
1315
+ typeof: 0,
1316
+ u1: 0,
1317
+ u2: 0,
1318
+ underlinePosition: 1,
1319
+ "underline-position": "underlinePosition",
1320
+ underlineThickness: 1,
1321
+ "underline-thickness": "underlineThickness",
1322
+ unicode: 0,
1323
+ unicodeBidi: 1,
1324
+ "unicode-bidi": "unicodeBidi",
1325
+ unicodeRange: 1,
1326
+ "unicode-range": "unicodeRange",
1327
+ unitsPerEm: 1,
1328
+ "units-per-em": "unitsPerEm",
1329
+ unselectable: 0,
1330
+ vAlphabetic: 1,
1331
+ "v-alphabetic": "vAlphabetic",
1332
+ values: 0,
1333
+ vectorEffect: 1,
1334
+ "vector-effect": "vectorEffect",
1335
+ version: 0,
1336
+ vertAdvY: 1,
1337
+ "vert-adv-y": "vertAdvY",
1338
+ vertOriginX: 1,
1339
+ "vert-origin-x": "vertOriginX",
1340
+ vertOriginY: 1,
1341
+ "vert-origin-y": "vertOriginY",
1342
+ vHanging: 1,
1343
+ "v-hanging": "vHanging",
1344
+ vIdeographic: 1,
1345
+ "v-ideographic": "vIdeographic",
1346
+ viewBox: 1,
1347
+ viewTarget: 1,
1348
+ visibility: 0,
1349
+ vMathematical: 1,
1350
+ "v-mathematical": "vMathematical",
1351
+ vocab: 0,
1352
+ widths: 0,
1353
+ wordSpacing: 1,
1354
+ "word-spacing": "wordSpacing",
1355
+ writingMode: 1,
1356
+ "writing-mode": "writingMode",
1357
+ x1: 0,
1358
+ x2: 0,
1359
+ x: 0,
1360
+ xChannelSelector: 1,
1361
+ xHeight: 1,
1362
+ "x-height": "xHeight",
1363
+ xlinkActuate: 1,
1364
+ "xlink:actuate": "xlinkActuate",
1365
+ xlinkArcrole: 1,
1366
+ "xlink:arcrole": "xlinkArcrole",
1367
+ xlinkHref: 1,
1368
+ "xlink:href": "xlinkHref",
1369
+ xlinkRole: 1,
1370
+ "xlink:role": "xlinkRole",
1371
+ xlinkShow: 1,
1372
+ "xlink:show": "xlinkShow",
1373
+ xlinkTitle: 1,
1374
+ "xlink:title": "xlinkTitle",
1375
+ xlinkType: 1,
1376
+ "xlink:type": "xlinkType",
1377
+ xmlBase: 1,
1378
+ "xml:base": "xmlBase",
1379
+ xmlLang: 1,
1380
+ "xml:lang": "xmlLang",
1381
+ xmlns: 0,
1382
+ "xml:space": "xmlSpace",
1383
+ xmlnsXlink: 1,
1384
+ "xmlns:xlink": "xmlnsXlink",
1385
+ xmlSpace: 1,
1386
+ y1: 0,
1387
+ y2: 0,
1388
+ y: 0,
1389
+ yChannelSelector: 1,
1390
+ z: 0,
1391
+ zoomAndPan: 1
1280
1392
  };
1281
- }
1282
- function getConvertedFitting(fittingType, isFakeTile) {
1283
- const isTile = TILE_FITTING_TYPES.includes(fittingType) && !isFakeTile;
1284
- const isFill = fittingType === fittingTypes.SCALE_TO_FILL;
1285
- return isFill || isTile ? fittingTypes.SCALE_TO_FIT : fittingType;
1286
- }
1287
- function validateTargetDimensions(src, { width, height }) {
1288
- if (!width || !height) {
1289
- const _width = width || Math.min(980, src.width);
1290
- const heightRatio = _width / src.width;
1291
- return {
1292
- width: _width,
1293
- height: height || src.height * heightRatio
1294
- };
1393
+ return possibleStandardNamesOptimized;
1394
+ }
1395
+ var hasRequiredLib$1;
1396
+ function requireLib$1() {
1397
+ if (hasRequiredLib$1) return lib;
1398
+ hasRequiredLib$1 = 1;
1399
+ const RESERVED = 0;
1400
+ const STRING = 1;
1401
+ const BOOLEANISH_STRING = 2;
1402
+ const BOOLEAN = 3;
1403
+ const OVERLOADED_BOOLEAN = 4;
1404
+ const NUMERIC = 5;
1405
+ const POSITIVE_NUMERIC = 6;
1406
+ function getPropertyInfo(name) {
1407
+ return properties.hasOwnProperty(name) ? properties[name] : null;
1295
1408
  }
1296
- return { width, height };
1297
- }
1298
- function getScaleFactorByWidth(width, isHighQuality) {
1299
- if (width > 900) {
1300
- return isHighQuality ? 0.05 : 0.15;
1301
- } else if (width > 500) {
1302
- return isHighQuality ? 0.1 : 0.18;
1303
- } else if (width > 200) {
1304
- return 0.25;
1409
+ function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
1410
+ this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
1411
+ this.attributeName = attributeName;
1412
+ this.attributeNamespace = attributeNamespace;
1413
+ this.mustUseProperty = mustUseProperty;
1414
+ this.propertyName = name;
1415
+ this.type = type;
1416
+ this.sanitizeURL = sanitizeURL;
1417
+ this.removeEmptyString = removeEmptyString;
1305
1418
  }
1306
- return 1;
1307
- }
1308
- function getBlurValue(width, fittingType, isSEOBot2) {
1309
- if (isSEOBot2) {
1310
- return 0;
1311
- }
1312
- if (TILE_FITTING_TYPES.includes(fittingType)) {
1313
- return 1;
1314
- }
1315
- if (width > 200) {
1316
- return 2;
1317
- }
1318
- return 3;
1319
- }
1320
- function getCSSOverrides(fittingType, src, target, alignment = "center") {
1321
- const returnValue = {
1322
- img: {},
1323
- container: {}
1324
- };
1325
- if (fittingType === fittingTypes.SCALE_TO_FILL) {
1326
- const alignTypeFromFocalPoint = src.focalPoint && convertFocalPointToAlignType(src.focalPoint);
1327
- const alignType = alignTypeFromFocalPoint || alignment;
1328
- if (src.focalPoint && !alignTypeFromFocalPoint) {
1329
- returnValue.img = {
1330
- objectPosition: convertFillFocalToPosition(src, target, src.focalPoint)
1331
- };
1419
+ const properties = {};
1420
+ const reservedProps = [
1421
+ "children",
1422
+ "dangerouslySetInnerHTML",
1423
+ // TODO: This prevents the assignment of defaultValue to regular
1424
+ // elements (not just inputs). Now that ReactDOMInput assigns to the
1425
+ // defaultValue property -- do we need this?
1426
+ "defaultValue",
1427
+ "defaultChecked",
1428
+ "innerHTML",
1429
+ "suppressContentEditableWarning",
1430
+ "suppressHydrationWarning",
1431
+ "style"
1432
+ ];
1433
+ reservedProps.forEach((name) => {
1434
+ properties[name] = new PropertyInfoRecord(
1435
+ name,
1436
+ RESERVED,
1437
+ false,
1438
+ // mustUseProperty
1439
+ name,
1440
+ // attributeName
1441
+ null,
1442
+ // attributeNamespace
1443
+ false,
1444
+ // sanitizeURL
1445
+ false
1446
+ // removeEmptyString
1447
+ );
1448
+ });
1449
+ [
1450
+ ["acceptCharset", "accept-charset"],
1451
+ ["className", "class"],
1452
+ ["htmlFor", "for"],
1453
+ ["httpEquiv", "http-equiv"]
1454
+ ].forEach(([name, attributeName]) => {
1455
+ properties[name] = new PropertyInfoRecord(
1456
+ name,
1457
+ STRING,
1458
+ false,
1459
+ // mustUseProperty
1460
+ attributeName,
1461
+ // attributeName
1462
+ null,
1463
+ // attributeNamespace
1464
+ false,
1465
+ // sanitizeURL
1466
+ false
1467
+ // removeEmptyString
1468
+ );
1469
+ });
1470
+ ["contentEditable", "draggable", "spellCheck", "value"].forEach((name) => {
1471
+ properties[name] = new PropertyInfoRecord(
1472
+ name,
1473
+ BOOLEANISH_STRING,
1474
+ false,
1475
+ // mustUseProperty
1476
+ name.toLowerCase(),
1477
+ // attributeName
1478
+ null,
1479
+ // attributeNamespace
1480
+ false,
1481
+ // sanitizeURL
1482
+ false
1483
+ // removeEmptyString
1484
+ );
1485
+ });
1486
+ [
1487
+ "autoReverse",
1488
+ "externalResourcesRequired",
1489
+ "focusable",
1490
+ "preserveAlpha"
1491
+ ].forEach((name) => {
1492
+ properties[name] = new PropertyInfoRecord(
1493
+ name,
1494
+ BOOLEANISH_STRING,
1495
+ false,
1496
+ // mustUseProperty
1497
+ name,
1498
+ // attributeName
1499
+ null,
1500
+ // attributeNamespace
1501
+ false,
1502
+ // sanitizeURL
1503
+ false
1504
+ // removeEmptyString
1505
+ );
1506
+ });
1507
+ [
1508
+ "allowFullScreen",
1509
+ "async",
1510
+ // Note: there is a special case that prevents it from being written to the DOM
1511
+ // on the client side because the browsers are inconsistent. Instead we call focus().
1512
+ "autoFocus",
1513
+ "autoPlay",
1514
+ "controls",
1515
+ "default",
1516
+ "defer",
1517
+ "disabled",
1518
+ "disablePictureInPicture",
1519
+ "disableRemotePlayback",
1520
+ "formNoValidate",
1521
+ "hidden",
1522
+ "loop",
1523
+ "noModule",
1524
+ "noValidate",
1525
+ "open",
1526
+ "playsInline",
1527
+ "readOnly",
1528
+ "required",
1529
+ "reversed",
1530
+ "scoped",
1531
+ "seamless",
1532
+ // Microdata
1533
+ "itemScope"
1534
+ ].forEach((name) => {
1535
+ properties[name] = new PropertyInfoRecord(
1536
+ name,
1537
+ BOOLEAN,
1538
+ false,
1539
+ // mustUseProperty
1540
+ name.toLowerCase(),
1541
+ // attributeName
1542
+ null,
1543
+ // attributeNamespace
1544
+ false,
1545
+ // sanitizeURL
1546
+ false
1547
+ // removeEmptyString
1548
+ );
1549
+ });
1550
+ [
1551
+ "checked",
1552
+ // Note: `option.selected` is not updated if `select.multiple` is
1553
+ // disabled with `removeAttribute`. We have special logic for handling this.
1554
+ "multiple",
1555
+ "muted",
1556
+ "selected"
1557
+ // NOTE: if you add a camelCased prop to this list,
1558
+ // you'll need to set attributeName to name.toLowerCase()
1559
+ // instead in the assignment below.
1560
+ ].forEach((name) => {
1561
+ properties[name] = new PropertyInfoRecord(
1562
+ name,
1563
+ BOOLEAN,
1564
+ true,
1565
+ // mustUseProperty
1566
+ name,
1567
+ // attributeName
1568
+ null,
1569
+ // attributeNamespace
1570
+ false,
1571
+ // sanitizeURL
1572
+ false
1573
+ // removeEmptyString
1574
+ );
1575
+ });
1576
+ [
1577
+ "capture",
1578
+ "download"
1579
+ // NOTE: if you add a camelCased prop to this list,
1580
+ // you'll need to set attributeName to name.toLowerCase()
1581
+ // instead in the assignment below.
1582
+ ].forEach((name) => {
1583
+ properties[name] = new PropertyInfoRecord(
1584
+ name,
1585
+ OVERLOADED_BOOLEAN,
1586
+ false,
1587
+ // mustUseProperty
1588
+ name,
1589
+ // attributeName
1590
+ null,
1591
+ // attributeNamespace
1592
+ false,
1593
+ // sanitizeURL
1594
+ false
1595
+ // removeEmptyString
1596
+ );
1597
+ });
1598
+ [
1599
+ "cols",
1600
+ "rows",
1601
+ "size",
1602
+ "span"
1603
+ // NOTE: if you add a camelCased prop to this list,
1604
+ // you'll need to set attributeName to name.toLowerCase()
1605
+ // instead in the assignment below.
1606
+ ].forEach((name) => {
1607
+ properties[name] = new PropertyInfoRecord(
1608
+ name,
1609
+ POSITIVE_NUMERIC,
1610
+ false,
1611
+ // mustUseProperty
1612
+ name,
1613
+ // attributeName
1614
+ null,
1615
+ // attributeNamespace
1616
+ false,
1617
+ // sanitizeURL
1618
+ false
1619
+ // removeEmptyString
1620
+ );
1621
+ });
1622
+ ["rowSpan", "start"].forEach((name) => {
1623
+ properties[name] = new PropertyInfoRecord(
1624
+ name,
1625
+ NUMERIC,
1626
+ false,
1627
+ // mustUseProperty
1628
+ name.toLowerCase(),
1629
+ // attributeName
1630
+ null,
1631
+ // attributeNamespace
1632
+ false,
1633
+ // sanitizeURL
1634
+ false
1635
+ // removeEmptyString
1636
+ );
1637
+ });
1638
+ const CAMELIZE = /[\-\:]([a-z])/g;
1639
+ const capitalize = (token) => token[1].toUpperCase();
1640
+ [
1641
+ "accent-height",
1642
+ "alignment-baseline",
1643
+ "arabic-form",
1644
+ "baseline-shift",
1645
+ "cap-height",
1646
+ "clip-path",
1647
+ "clip-rule",
1648
+ "color-interpolation",
1649
+ "color-interpolation-filters",
1650
+ "color-profile",
1651
+ "color-rendering",
1652
+ "dominant-baseline",
1653
+ "enable-background",
1654
+ "fill-opacity",
1655
+ "fill-rule",
1656
+ "flood-color",
1657
+ "flood-opacity",
1658
+ "font-family",
1659
+ "font-size",
1660
+ "font-size-adjust",
1661
+ "font-stretch",
1662
+ "font-style",
1663
+ "font-variant",
1664
+ "font-weight",
1665
+ "glyph-name",
1666
+ "glyph-orientation-horizontal",
1667
+ "glyph-orientation-vertical",
1668
+ "horiz-adv-x",
1669
+ "horiz-origin-x",
1670
+ "image-rendering",
1671
+ "letter-spacing",
1672
+ "lighting-color",
1673
+ "marker-end",
1674
+ "marker-mid",
1675
+ "marker-start",
1676
+ "overline-position",
1677
+ "overline-thickness",
1678
+ "paint-order",
1679
+ "panose-1",
1680
+ "pointer-events",
1681
+ "rendering-intent",
1682
+ "shape-rendering",
1683
+ "stop-color",
1684
+ "stop-opacity",
1685
+ "strikethrough-position",
1686
+ "strikethrough-thickness",
1687
+ "stroke-dasharray",
1688
+ "stroke-dashoffset",
1689
+ "stroke-linecap",
1690
+ "stroke-linejoin",
1691
+ "stroke-miterlimit",
1692
+ "stroke-opacity",
1693
+ "stroke-width",
1694
+ "text-anchor",
1695
+ "text-decoration",
1696
+ "text-rendering",
1697
+ "underline-position",
1698
+ "underline-thickness",
1699
+ "unicode-bidi",
1700
+ "unicode-range",
1701
+ "units-per-em",
1702
+ "v-alphabetic",
1703
+ "v-hanging",
1704
+ "v-ideographic",
1705
+ "v-mathematical",
1706
+ "vector-effect",
1707
+ "vert-adv-y",
1708
+ "vert-origin-x",
1709
+ "vert-origin-y",
1710
+ "word-spacing",
1711
+ "writing-mode",
1712
+ "xmlns:xlink",
1713
+ "x-height"
1714
+ // NOTE: if you add a camelCased prop to this list,
1715
+ // you'll need to set attributeName to name.toLowerCase()
1716
+ // instead in the assignment below.
1717
+ ].forEach((attributeName) => {
1718
+ const name = attributeName.replace(CAMELIZE, capitalize);
1719
+ properties[name] = new PropertyInfoRecord(
1720
+ name,
1721
+ STRING,
1722
+ false,
1723
+ // mustUseProperty
1724
+ attributeName,
1725
+ null,
1726
+ // attributeNamespace
1727
+ false,
1728
+ // sanitizeURL
1729
+ false
1730
+ // removeEmptyString
1731
+ );
1732
+ });
1733
+ [
1734
+ "xlink:actuate",
1735
+ "xlink:arcrole",
1736
+ "xlink:role",
1737
+ "xlink:show",
1738
+ "xlink:title",
1739
+ "xlink:type"
1740
+ // NOTE: if you add a camelCased prop to this list,
1741
+ // you'll need to set attributeName to name.toLowerCase()
1742
+ // instead in the assignment below.
1743
+ ].forEach((attributeName) => {
1744
+ const name = attributeName.replace(CAMELIZE, capitalize);
1745
+ properties[name] = new PropertyInfoRecord(
1746
+ name,
1747
+ STRING,
1748
+ false,
1749
+ // mustUseProperty
1750
+ attributeName,
1751
+ "http://www.w3.org/1999/xlink",
1752
+ false,
1753
+ // sanitizeURL
1754
+ false
1755
+ // removeEmptyString
1756
+ );
1757
+ });
1758
+ [
1759
+ "xml:base",
1760
+ "xml:lang",
1761
+ "xml:space"
1762
+ // NOTE: if you add a camelCased prop to this list,
1763
+ // you'll need to set attributeName to name.toLowerCase()
1764
+ // instead in the assignment below.
1765
+ ].forEach((attributeName) => {
1766
+ const name = attributeName.replace(CAMELIZE, capitalize);
1767
+ properties[name] = new PropertyInfoRecord(
1768
+ name,
1769
+ STRING,
1770
+ false,
1771
+ // mustUseProperty
1772
+ attributeName,
1773
+ "http://www.w3.org/XML/1998/namespace",
1774
+ false,
1775
+ // sanitizeURL
1776
+ false
1777
+ // removeEmptyString
1778
+ );
1779
+ });
1780
+ ["tabIndex", "crossOrigin"].forEach((attributeName) => {
1781
+ properties[attributeName] = new PropertyInfoRecord(
1782
+ attributeName,
1783
+ STRING,
1784
+ false,
1785
+ // mustUseProperty
1786
+ attributeName.toLowerCase(),
1787
+ // attributeName
1788
+ null,
1789
+ // attributeNamespace
1790
+ false,
1791
+ // sanitizeURL
1792
+ false
1793
+ // removeEmptyString
1794
+ );
1795
+ });
1796
+ const xlinkHref = "xlinkHref";
1797
+ properties[xlinkHref] = new PropertyInfoRecord(
1798
+ "xlinkHref",
1799
+ STRING,
1800
+ false,
1801
+ // mustUseProperty
1802
+ "xlink:href",
1803
+ "http://www.w3.org/1999/xlink",
1804
+ true,
1805
+ // sanitizeURL
1806
+ false
1807
+ // removeEmptyString
1808
+ );
1809
+ ["src", "href", "action", "formAction"].forEach((attributeName) => {
1810
+ properties[attributeName] = new PropertyInfoRecord(
1811
+ attributeName,
1812
+ STRING,
1813
+ false,
1814
+ // mustUseProperty
1815
+ attributeName.toLowerCase(),
1816
+ // attributeName
1817
+ null,
1818
+ // attributeNamespace
1819
+ true,
1820
+ // sanitizeURL
1821
+ true
1822
+ // removeEmptyString
1823
+ );
1824
+ });
1825
+ const {
1826
+ CAMELCASE,
1827
+ SAME,
1828
+ possibleStandardNames: possibleStandardNamesOptimized2
1829
+ } = requirePossibleStandardNamesOptimized();
1830
+ const ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
1831
+ const ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
1832
+ const isCustomAttribute = RegExp.prototype.test.bind(
1833
+ // eslint-disable-next-line no-misleading-character-class
1834
+ new RegExp("^(data|aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$")
1835
+ );
1836
+ const possibleStandardNames = Object.keys(
1837
+ possibleStandardNamesOptimized2
1838
+ ).reduce((accumulator, standardName) => {
1839
+ const propName = possibleStandardNamesOptimized2[standardName];
1840
+ if (propName === SAME) {
1841
+ accumulator[standardName] = standardName;
1842
+ } else if (propName === CAMELCASE) {
1843
+ accumulator[standardName.toLowerCase()] = standardName;
1332
1844
  } else {
1333
- returnValue.img = {
1334
- objectPosition: ALIGN_TYPE_TO_POSITION[alignType]
1335
- };
1845
+ accumulator[standardName] = propName;
1336
1846
  }
1337
- } else if ([fittingTypes.LEGACY_ORIGINAL_SIZE, fittingTypes.ORIGINAL_SIZE].includes(fittingType)) {
1338
- returnValue.img = {
1339
- objectFit: "none",
1340
- top: "auto",
1341
- left: "auto",
1342
- right: "auto",
1343
- bottom: "auto"
1847
+ return accumulator;
1848
+ }, {});
1849
+ lib.BOOLEAN = BOOLEAN;
1850
+ lib.BOOLEANISH_STRING = BOOLEANISH_STRING;
1851
+ lib.NUMERIC = NUMERIC;
1852
+ lib.OVERLOADED_BOOLEAN = OVERLOADED_BOOLEAN;
1853
+ lib.POSITIVE_NUMERIC = POSITIVE_NUMERIC;
1854
+ lib.RESERVED = RESERVED;
1855
+ lib.STRING = STRING;
1856
+ lib.getPropertyInfo = getPropertyInfo;
1857
+ lib.isCustomAttribute = isCustomAttribute;
1858
+ lib.possibleStandardNames = possibleStandardNames;
1859
+ return lib;
1860
+ }
1861
+ var utilities = {};
1862
+ var hasRequiredUtilities;
1863
+ function requireUtilities() {
1864
+ if (hasRequiredUtilities) return utilities;
1865
+ hasRequiredUtilities = 1;
1866
+ (function(exports$1) {
1867
+ var __importDefault = utilities && utilities.__importDefault || function(mod) {
1868
+ return mod && mod.__esModule ? mod : { "default": mod };
1344
1869
  };
1345
- } else if (TILE_FITTING_TYPES.includes(fittingType)) {
1346
- returnValue.container = {
1347
- backgroundSize: `${src.width}px ${src.height}px`
1870
+ Object.defineProperty(exports$1, "__esModule", { value: true });
1871
+ exports$1.returnFirstArg = exports$1.canTextBeChildOfNode = exports$1.ELEMENTS_WITH_NO_TEXT_CHILDREN = exports$1.PRESERVE_CUSTOM_ATTRIBUTES = void 0;
1872
+ exports$1.isCustomComponent = isCustomComponent;
1873
+ exports$1.setStyleProp = setStyleProp;
1874
+ var react_1 = React__default;
1875
+ var style_to_js_1 = __importDefault(requireCjs());
1876
+ var RESERVED_SVG_MATHML_ELEMENTS = /* @__PURE__ */ new Set([
1877
+ "annotation-xml",
1878
+ "color-profile",
1879
+ "font-face",
1880
+ "font-face-src",
1881
+ "font-face-uri",
1882
+ "font-face-format",
1883
+ "font-face-name",
1884
+ "missing-glyph"
1885
+ ]);
1886
+ function isCustomComponent(tagName, props) {
1887
+ if (!tagName.includes("-")) {
1888
+ return Boolean(props && typeof props.is === "string");
1889
+ }
1890
+ if (RESERVED_SVG_MATHML_ELEMENTS.has(tagName)) {
1891
+ return false;
1892
+ }
1893
+ return true;
1894
+ }
1895
+ var styleOptions = {
1896
+ reactCompat: true
1348
1897
  };
1898
+ function setStyleProp(style, props) {
1899
+ if (typeof style !== "string") {
1900
+ return;
1901
+ }
1902
+ if (!style.trim()) {
1903
+ props.style = {};
1904
+ return;
1905
+ }
1906
+ try {
1907
+ props.style = (0, style_to_js_1.default)(style, styleOptions);
1908
+ } catch (error) {
1909
+ props.style = {};
1910
+ }
1911
+ }
1912
+ exports$1.PRESERVE_CUSTOM_ATTRIBUTES = Number(react_1.version.split(".")[0]) >= 16;
1913
+ exports$1.ELEMENTS_WITH_NO_TEXT_CHILDREN = /* @__PURE__ */ new Set([
1914
+ "tr",
1915
+ "tbody",
1916
+ "thead",
1917
+ "tfoot",
1918
+ "colgroup",
1919
+ "table",
1920
+ "head",
1921
+ "html",
1922
+ "frameset"
1923
+ ]);
1924
+ var canTextBeChildOfNode = function(node2) {
1925
+ return !exports$1.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(node2.name);
1926
+ };
1927
+ exports$1.canTextBeChildOfNode = canTextBeChildOfNode;
1928
+ var returnFirstArg = function(arg) {
1929
+ return arg;
1930
+ };
1931
+ exports$1.returnFirstArg = returnFirstArg;
1932
+ })(utilities);
1933
+ return utilities;
1934
+ }
1935
+ var hasRequiredAttributesToProps;
1936
+ function requireAttributesToProps() {
1937
+ if (hasRequiredAttributesToProps) return attributesToProps;
1938
+ hasRequiredAttributesToProps = 1;
1939
+ Object.defineProperty(attributesToProps, "__esModule", { value: true });
1940
+ attributesToProps.default = attributesToProps$1;
1941
+ var react_property_1 = requireLib$1();
1942
+ var utilities_1 = requireUtilities();
1943
+ var UNCONTROLLED_COMPONENT_ATTRIBUTES = ["checked", "value"];
1944
+ var UNCONTROLLED_COMPONENT_NAMES = ["input", "select", "textarea"];
1945
+ var valueOnlyInputs = {
1946
+ reset: true,
1947
+ submit: true
1948
+ };
1949
+ function attributesToProps$1(attributes, nodeName) {
1950
+ if (attributes === void 0) {
1951
+ attributes = {};
1952
+ }
1953
+ var props = {};
1954
+ var isInputValueOnly = Boolean(attributes.type && valueOnlyInputs[attributes.type]);
1955
+ for (var attributeName in attributes) {
1956
+ var attributeValue = attributes[attributeName];
1957
+ if ((0, react_property_1.isCustomAttribute)(attributeName)) {
1958
+ props[attributeName] = attributeValue;
1959
+ continue;
1960
+ }
1961
+ var attributeNameLowerCased = attributeName.toLowerCase();
1962
+ var propName = getPropName(attributeNameLowerCased);
1963
+ if (propName) {
1964
+ var propertyInfo = (0, react_property_1.getPropertyInfo)(propName);
1965
+ if (UNCONTROLLED_COMPONENT_ATTRIBUTES.includes(propName) && UNCONTROLLED_COMPONENT_NAMES.includes(nodeName) && !isInputValueOnly) {
1966
+ propName = getPropName("default" + attributeNameLowerCased);
1967
+ }
1968
+ props[propName] = attributeValue;
1969
+ switch (propertyInfo && propertyInfo.type) {
1970
+ case react_property_1.BOOLEAN:
1971
+ props[propName] = true;
1972
+ break;
1973
+ case react_property_1.OVERLOADED_BOOLEAN:
1974
+ if (attributeValue === "") {
1975
+ props[propName] = true;
1976
+ }
1977
+ break;
1978
+ }
1979
+ continue;
1980
+ }
1981
+ if (utilities_1.PRESERVE_CUSTOM_ATTRIBUTES) {
1982
+ props[attributeName] = attributeValue;
1983
+ }
1984
+ }
1985
+ (0, utilities_1.setStyleProp)(attributes.style, props);
1986
+ return props;
1349
1987
  }
1350
- return returnValue;
1351
- }
1352
- function convertFocalPointToAlignType(focalPoint) {
1353
- const position = `${focalPoint.x}% ${focalPoint.y}%`;
1354
- return POSITION_TO_ALIGN_TYPE[position] || "";
1355
- }
1356
- function convertFillFocalToPosition(src, target, focalPoint) {
1357
- const { width: sW, height: sH } = src;
1358
- const { width: tW, height: tH } = target;
1359
- const { x: fpX, y: fpY } = focalPoint;
1360
- if (!tW || !tH) {
1361
- return `${fpX}% ${fpY}%`;
1362
- }
1363
- const fillScaleFactor = Math.max(tW / sW, tH / sH);
1364
- const imgScaledW = sW * fillScaleFactor;
1365
- const imgScaledH = sH * fillScaleFactor;
1366
- const x = Math.max(0, Math.min(imgScaledW - tW, imgScaledW * (fpX / 100) - tW / 2));
1367
- const y = Math.max(0, Math.min(imgScaledH - tH, imgScaledH * (fpY / 100) - tH / 2));
1368
- const posX = x && Math.floor(x / (imgScaledW - tW) * 100);
1369
- const posY = y && Math.floor(y / (imgScaledH - tH) * 100);
1370
- return `${posX}% ${posY}%`;
1371
- }
1372
- const PLACEHOLDER_IMG_CSS_OVERRIDES = { width: "100%", height: "100%" };
1373
- function getPlaceholder(fittingType, src, target, options = {}) {
1374
- const { autoEncode = true, isSEOBot: isSEOBot2, shouldLoadHQImage, hasAnimation, allowAnimatedTransform, encoding } = options;
1375
- if (!isValidRequest(fittingType, src, target)) {
1376
- return emptyData;
1377
- }
1378
- const IS_IN_PLACEHOLDER_FLOW = true;
1379
- const shouldAllowAnimatedTransformInPlaceholder = allowAnimatedTransform ?? IS_IN_PLACEHOLDER_FLOW;
1380
- const canTransformImage = isImageTransformApplicable(src.id, hasAnimation, shouldAllowAnimatedTransformInPlaceholder);
1381
- if (!canTransformImage || shouldLoadHQImage) {
1382
- return getData(fittingType, src, target, {
1383
- ...options,
1384
- autoEncode,
1385
- useSrcset: canTransformImage
1386
- });
1988
+ function getPropName(attributeName) {
1989
+ return react_property_1.possibleStandardNames[attributeName];
1387
1990
  }
1388
- const newTarget = {
1389
- ...target,
1390
- ...validateTargetDimensions(src, target)
1991
+ return attributesToProps;
1992
+ }
1993
+ var domToReact = {};
1994
+ var hasRequiredDomToReact;
1995
+ function requireDomToReact() {
1996
+ if (hasRequiredDomToReact) return domToReact;
1997
+ hasRequiredDomToReact = 1;
1998
+ var __importDefault = domToReact && domToReact.__importDefault || function(mod) {
1999
+ return mod && mod.__esModule ? mod : { "default": mod };
1391
2000
  };
1392
- const { alignment, htmlTag: htmlTag2 } = newTarget;
1393
- const isFakeTile = getIsFakeTile(fittingType, src, newTarget);
1394
- const scaledDimensions = getScaledDimensions(fittingType, src, newTarget, isSEOBot2);
1395
- const blur = getBlurValue(newTarget.width, fittingType, isSEOBot2);
1396
- const convertedFittingType = getConvertedFitting(fittingType, isFakeTile);
1397
- const overrideCSS = getCSSOverrides(fittingType, src, target, alignment);
1398
- const { uri } = getData(convertedFittingType, src, {
1399
- ...scaledDimensions,
1400
- alignment,
1401
- htmlTag: htmlTag2
1402
- }, {
1403
- autoEncode,
1404
- filters: blur ? { blur } : {},
1405
- hasAnimation,
1406
- allowAnimatedTransform: shouldAllowAnimatedTransformInPlaceholder,
1407
- encoding,
1408
- isPlaceholderFlow: IS_IN_PLACEHOLDER_FLOW
1409
- });
1410
- const { attr = {}, css } = getData(fittingType, src, {
1411
- ...newTarget,
1412
- alignment,
1413
- htmlTag: htmlTag2
1414
- }, {});
1415
- css.img = css.img || {};
1416
- css.container = css.container || {};
1417
- Object.assign(css.img, overrideCSS.img, PLACEHOLDER_IMG_CSS_OVERRIDES);
1418
- Object.assign(css.container, overrideCSS.container);
1419
- return { uri, css, attr, transformed: true };
1420
- }
1421
- function getData(fittingType, src, target, options) {
1422
- let data = {};
1423
- if (isValidRequest(fittingType, src, target)) {
1424
- const targetObj = getTarget(fittingType, src, target);
1425
- const transformObj = getTransform(fittingType, src, targetObj, options);
1426
- data.uri = getURI(fittingType, src, targetObj, options, transformObj);
1427
- if (options == null ? void 0 : options.useSrcset) {
1428
- data.srcset = getSrcset(fittingType, src, targetObj, options, data);
2001
+ Object.defineProperty(domToReact, "__esModule", { value: true });
2002
+ domToReact.default = domToReact$1;
2003
+ var react_1 = React__default;
2004
+ var attributes_to_props_1 = __importDefault(requireAttributesToProps());
2005
+ var utilities_1 = requireUtilities();
2006
+ var React = {
2007
+ cloneElement: react_1.cloneElement,
2008
+ createElement: react_1.createElement,
2009
+ isValidElement: react_1.isValidElement
2010
+ };
2011
+ function domToReact$1(nodes, options) {
2012
+ if (options === void 0) {
2013
+ options = {};
1429
2014
  }
1430
- Object.assign(data, getAttributes(transformObj, targetObj), {
1431
- transformed: transformObj.transformed
1432
- });
1433
- } else {
1434
- data = emptyData;
2015
+ var reactElements = [];
2016
+ var hasReplace = typeof options.replace === "function";
2017
+ var transform = options.transform || utilities_1.returnFirstArg;
2018
+ var _a = options.library || React, cloneElement = _a.cloneElement, createElement = _a.createElement, isValidElement = _a.isValidElement;
2019
+ var nodesLength = nodes.length;
2020
+ for (var index = 0; index < nodesLength; index++) {
2021
+ var node2 = nodes[index];
2022
+ if (hasReplace) {
2023
+ var replaceElement = options.replace(node2, index);
2024
+ if (isValidElement(replaceElement)) {
2025
+ if (nodesLength > 1) {
2026
+ replaceElement = cloneElement(replaceElement, {
2027
+ key: replaceElement.key || index
2028
+ });
2029
+ }
2030
+ reactElements.push(transform(replaceElement, node2, index));
2031
+ continue;
2032
+ }
2033
+ }
2034
+ if (node2.type === "text") {
2035
+ var isWhitespace = !node2.data.trim().length;
2036
+ if (isWhitespace && node2.parent && !(0, utilities_1.canTextBeChildOfNode)(node2.parent)) {
2037
+ continue;
2038
+ }
2039
+ if (options.trim && isWhitespace) {
2040
+ continue;
2041
+ }
2042
+ reactElements.push(transform(node2.data, node2, index));
2043
+ continue;
2044
+ }
2045
+ var element = node2;
2046
+ var props = {};
2047
+ if (skipAttributesToProps(element)) {
2048
+ (0, utilities_1.setStyleProp)(element.attribs.style, element.attribs);
2049
+ props = element.attribs;
2050
+ } else if (element.attribs) {
2051
+ props = (0, attributes_to_props_1.default)(element.attribs, element.name);
2052
+ }
2053
+ var children = void 0;
2054
+ switch (node2.type) {
2055
+ case "script":
2056
+ case "style":
2057
+ if (node2.children[0]) {
2058
+ props.dangerouslySetInnerHTML = {
2059
+ __html: node2.children[0].data
2060
+ };
2061
+ }
2062
+ break;
2063
+ case "tag":
2064
+ if (node2.name === "textarea" && node2.children[0]) {
2065
+ props.defaultValue = node2.children[0].data;
2066
+ } else if (node2.children && node2.children.length) {
2067
+ children = domToReact$1(node2.children, options);
2068
+ }
2069
+ break;
2070
+ // skip all other cases (e.g., comment)
2071
+ default:
2072
+ continue;
2073
+ }
2074
+ if (nodesLength > 1) {
2075
+ props.key = index;
2076
+ }
2077
+ reactElements.push(transform(createElement(node2.name, props, children), node2, index));
2078
+ }
2079
+ return reactElements.length === 1 ? reactElements[0] : reactElements;
2080
+ }
2081
+ function skipAttributesToProps(node2) {
2082
+ return utilities_1.PRESERVE_CUSTOM_ATTRIBUTES && node2.type === "tag" && (0, utilities_1.isCustomComponent)(node2.name, node2.attribs);
1435
2083
  }
1436
- return data;
2084
+ return domToReact;
2085
+ }
2086
+ var hasRequiredLib;
2087
+ function requireLib() {
2088
+ if (hasRequiredLib) return lib$3;
2089
+ hasRequiredLib = 1;
2090
+ (function(exports$1) {
2091
+ var __importDefault = lib$3 && lib$3.__importDefault || function(mod) {
2092
+ return mod && mod.__esModule ? mod : { "default": mod };
2093
+ };
2094
+ Object.defineProperty(exports$1, "__esModule", { value: true });
2095
+ exports$1.htmlToDOM = exports$1.domToReact = exports$1.attributesToProps = exports$1.Text = exports$1.ProcessingInstruction = exports$1.Element = exports$1.Comment = void 0;
2096
+ exports$1.default = HTMLReactParser2;
2097
+ var html_dom_parser_1 = __importDefault(requireHtmlToDom());
2098
+ exports$1.htmlToDOM = html_dom_parser_1.default;
2099
+ var attributes_to_props_1 = __importDefault(requireAttributesToProps());
2100
+ exports$1.attributesToProps = attributes_to_props_1.default;
2101
+ var dom_to_react_1 = __importDefault(requireDomToReact());
2102
+ exports$1.domToReact = dom_to_react_1.default;
2103
+ var domhandler_1 = /* @__PURE__ */ requireLib$2();
2104
+ Object.defineProperty(exports$1, "Comment", { enumerable: true, get: function() {
2105
+ return domhandler_1.Comment;
2106
+ } });
2107
+ Object.defineProperty(exports$1, "Element", { enumerable: true, get: function() {
2108
+ return domhandler_1.Element;
2109
+ } });
2110
+ Object.defineProperty(exports$1, "ProcessingInstruction", { enumerable: true, get: function() {
2111
+ return domhandler_1.ProcessingInstruction;
2112
+ } });
2113
+ Object.defineProperty(exports$1, "Text", { enumerable: true, get: function() {
2114
+ return domhandler_1.Text;
2115
+ } });
2116
+ var domParserOptions = { lowerCaseAttributeNames: false };
2117
+ function HTMLReactParser2(html, options) {
2118
+ if (typeof html !== "string") {
2119
+ throw new TypeError("First argument must be a string");
2120
+ }
2121
+ if (!html) {
2122
+ return [];
2123
+ }
2124
+ return (0, dom_to_react_1.default)((0, html_dom_parser_1.default)(html, (options === null || options === void 0 ? void 0 : options.htmlparser2) || domParserOptions), options);
2125
+ }
2126
+ })(lib$3);
2127
+ return lib$3;
1437
2128
  }
1438
- const wixStatic = "https://static.wixstatic.com/";
1439
- const wixStaticWithMedia = "https://static.wixstatic.com/media/";
1440
- populateGlobalFeatureSupport();
1441
- populateGlobalFeatureSupport();
1442
- const STATIC_MEDIA_URL = wixStaticWithMedia;
1443
- const MEDIA_ROOT_URL = wixStatic;
1444
- const imageKit = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1445
- __proto__: null,
1446
- MEDIA_ROOT_URL,
1447
- STATIC_MEDIA_URL,
1448
- alignTypes,
1449
- fileType,
1450
- fittingTypes,
1451
- getData,
1452
- getFileExtension,
1453
- getPlaceholder,
1454
- htmlTag,
1455
- isWEBP,
1456
- populateGlobalFeatureSupport,
1457
- upscaleMethods
1458
- }, Symbol.toStringTag, { value: "Module" }));
2129
+ var libExports = requireLib();
2130
+ const HTMLReactParser = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
2131
+ const parse = HTMLReactParser.default || HTMLReactParser;
1459
2132
  export {
1460
- MEDIA_ROOT_URL as M,
1461
- STATIC_MEDIA_URL as S,
1462
- getData as a,
1463
- getFileExtension as b,
1464
- alignTypes as c,
1465
- fittingTypes as d,
1466
- fileType as f,
1467
- getPlaceholder as g,
1468
- imageKit as i
2133
+ libExports as l,
2134
+ parse as p
1469
2135
  };