@orangelogic/design-system 4.38.0 → 4.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/library/chunks/{alert.D8Gwfkvy.js → alert.C7jo45Pq.js} +2 -2
  2. package/library/chunks/{array-line-clamp.DSzPRb_y.js → array-line-clamp.BWWMLJhi.js} +2 -2
  3. package/library/chunks/asset-link-format.COPyGdND.js +22 -0
  4. package/library/chunks/{asset-link-format.vbmd2KkO.js → asset-link-format.P8WKO488.js} +1124 -578
  5. package/library/chunks/{audio.RwF9cR3b.js → audio.C8rPv9iZ.js} +2 -2
  6. package/library/chunks/{bicolor-picker.CoEkuFFa.js → bicolor-picker.Dbag6AHo.js} +1 -1
  7. package/library/chunks/{block-width.Bpxcj778.js → block-width.C5qELJEx.js} +394 -389
  8. package/library/chunks/{border-input-group.B7tkimlE.js → border-input-group.B12EFZFD.js} +3 -3
  9. package/library/chunks/{breadcrumb.C_NpOjQB.js → breadcrumb.BLCAOe89.js} +1 -1
  10. package/library/chunks/{button.BlhGCsjP.js → button.DnOMjl_G.js} +2 -2
  11. package/library/chunks/{color-picker.Cs91unvg.js → color-picker.Dz6vVcZS.js} +10 -10
  12. package/library/chunks/{color-swatch-group.BF_AFUh6.js → color-swatch-group.CZx1bZyC.js} +22 -22
  13. package/library/chunks/{color-swatch.By2bJtpB.js → color-swatch.C3Elv0dG.js} +3 -3
  14. package/library/chunks/{config-manager.CfFtxFHj.js → config-manager.Dsb1DCbi.js} +28 -28
  15. package/library/chunks/{configs-controller.DSc6DiFO.js → configs-controller.Cm21QV6C.js} +425 -416
  16. package/library/chunks/{confirm-popover.CNgNi7H6.js → confirm-popover.CahmeTbf.js} +4 -4
  17. package/library/chunks/{copy-button.D9kDKwlR.js → copy-button.D2ZwXadV.js} +2 -2
  18. package/library/chunks/{corner-position-input-group.Cc0hzrPR.js → corner-position-input-group.BV8b7GsS.js} +4 -4
  19. package/library/chunks/{cropper.D4ymxgab.js → cropper.BRsN8h2t.js} +1 -1
  20. package/library/chunks/{date-calendar.Dc3XKO0t.js → date-calendar.BpfgvrtE.js} +1 -1
  21. package/library/chunks/{details.BacO3ROq.js → details.BGlfx87d.js} +1 -1
  22. package/library/chunks/{dialog.Ci7Q_ZOR.js → dialog.BfGASgvs.js} +3 -3
  23. package/library/chunks/{document-viewer.CdA65_RB.js → document-viewer.BtB-RTvP.js} +14 -14
  24. package/library/chunks/{dot-pagination.DDt0UoT8.js → dot-pagination.BUZhiikk.js} +2 -2
  25. package/library/chunks/{drawer.BeMBXsqi.js → drawer.BEXLFfil.js} +2 -2
  26. package/library/chunks/{dropdown.DFLP9K18.js → dropdown.CnT7uTzf.js} +4 -4
  27. package/library/chunks/{dynamic-select.wu648W9-.js → dynamic-select.BeqPRh6t.js} +5 -5
  28. package/library/chunks/{e-chart.fGTLKIDX.js → e-chart.BkqfNGfV.js} +2 -2
  29. package/library/chunks/{element-clamp.B509oA2s.js → element-clamp.CwFlUOET.js} +2 -2
  30. package/library/chunks/{file-on-demand.C17w6fng.js → file-on-demand.BEAjdrt_.js} +16 -16
  31. package/library/chunks/{folder-select.CQllI-Id.js → folder-select.B02Mdr8b.js} +31 -34
  32. package/library/chunks/{format-time.DZCXUWmw.js → format-time.ysWqJKLC.js} +1 -1
  33. package/library/chunks/{header.BDEqW3TI.js → header.NoiopyyV.js} +2 -2
  34. package/library/chunks/{i18n.BJ2p4em8.js → i18n.CQPiI18Q.js} +3 -0
  35. package/library/chunks/{icon-button.Dd-oDRfX.js → icon-button.BAUsYiQh.js} +2 -2
  36. package/library/chunks/{iframe.DsOaw03m.js → iframe.CKoHB0lA.js} +1 -1
  37. package/library/chunks/{image-comparer.FB0ZzA0d.js → image-comparer.WUKRGHqI.js} +1 -1
  38. package/library/chunks/{image.Cmh2WYdP.js → image.CRrj-94o.js} +2 -2
  39. package/library/chunks/{input.Fmdh6pnf.js → input.D1UkXp3F.js} +1 -1
  40. package/library/chunks/{line-clamp.CgiUerew.js → line-clamp.B7QEzpUF.js} +2 -2
  41. package/library/chunks/{markdown.DMexA2xN.js → markdown.CrAalbNm.js} +2 -2
  42. package/library/chunks/{masonry.DqU7fvCr.js → masonry.B5kwpjVE.js} +4 -4
  43. package/library/chunks/{menu-item.Du9N-cKj.js → menu-item.BgoL4QFj.js} +3 -3
  44. package/library/chunks/{menu.gmy0sy3a.js → menu.DJBOpi__.js} +2 -2
  45. package/library/chunks/{option._7i4rjM5.js → option.C97GEvQ6.js} +1 -1
  46. package/library/chunks/{padding-input-group.E8trRZI5.js → padding-input-group.CGDq3Cct.js} +1 -1
  47. package/library/chunks/{pagination.C0YML9vO.js → pagination.GiwV5ZHF.js} +7 -7
  48. package/library/chunks/{popup.uU7UtxmR.js → popup.C2ySgZ9I.js} +1 -1
  49. package/library/chunks/{position-picker.DwDC9gDl.js → position-picker.DzRyAx7a.js} +1 -1
  50. package/library/chunks/{progress-bar.BJfkoZ6G.js → progress-bar.BfHPsueW.js} +1 -1
  51. package/library/chunks/{progress-ring.BSfnNF9M.js → progress-ring.Cn08Dbar.js} +1 -1
  52. package/library/chunks/{radio-card.DOnTPgND.js → radio-card.BPumEe9b.js} +1 -1
  53. package/library/chunks/{range.blqKtzMI.js → range.E1wPWa7j.js} +2 -2
  54. package/library/chunks/{rating.BgUId4FT.js → rating.BjGQtyCk.js} +1 -1
  55. package/library/chunks/{relative-time.BSSaZxeD.js → relative-time.BcpFkSZT.js} +1 -1
  56. package/library/chunks/{select.BddyhkLW.js → select.DGL9C_32.js} +6 -6
  57. package/library/chunks/{shadow-input-group.k4MBg4Pf.js → shadow-input-group.CaCaO1C9.js} +2 -2
  58. package/library/chunks/{share-option-list.8OSETkgd.js → share-option-list.u2Q0zMae.js} +2 -2
  59. package/library/chunks/{sidebar.B1MjUxBY.js → sidebar.CwAW3KaC.js} +1 -1
  60. package/library/chunks/{size-input-group.CR0wHbEO.js → size-input-group.Ciupfrja.js} +5 -5
  61. package/library/chunks/{sortable.esm.W3y3EWKS.js → sortable.esm.BVU0_hc5.js} +339 -334
  62. package/library/chunks/{spinner.o3Rjsff7.js → spinner.DsWszid8.js} +1 -1
  63. package/library/chunks/{split-panel.CVyqM2Dr.js → split-panel.KzmC5IAW.js} +1 -1
  64. package/library/chunks/{src.BBVUYHbX.js → src.HY1opSC4.js} +47 -47
  65. package/library/chunks/{src.CDbx_BKW.js → src.QIRlv8bQ.js} +53 -53
  66. package/library/chunks/{step.7RkKgH1n.js → step.CpXaHTmn.js} +3 -3
  67. package/library/chunks/{stepper-wizard.D7XpenfO.js → stepper-wizard.DZ7up5KF.js} +2 -2
  68. package/library/chunks/{stepper.BhLxi6eC.js → stepper.BAqogLwg.js} +1 -1
  69. package/library/chunks/{endpoints.jOHOmF_t.js → string-array.Dstcqyjm.js} +5 -2
  70. package/library/chunks/{tab-group.DPhCgEOG.js → tab-group.Ib4bahXC.js} +7 -7
  71. package/library/chunks/{tab.Cv9UFQjo.js → tab.BOJ3V4IE.js} +3 -3
  72. package/library/chunks/{tag.V9YP_T0h.js → tag.BySfbRok.js} +3 -3
  73. package/library/chunks/{tooltip.GjnTzFeL.js → tooltip.DWx9VYtS.js} +2 -2
  74. package/library/chunks/{tree.Cvx7TQer.js → tree.B3qvSTCo.js} +4 -4
  75. package/library/chunks/{typeface.CHo-Lj6f.js → typeface.BcNOEnVy.js} +3 -3
  76. package/library/chunks/{video.DFfkHdKQ.js → video.DVuLcN2J.js} +3 -3
  77. package/library/components/alert.js +1 -1
  78. package/library/components/array-line-clamp.js +1 -1
  79. package/library/components/asset-link-format.js +1 -1
  80. package/library/components/atoms.js +48 -48
  81. package/library/components/audio.js +1 -1
  82. package/library/components/bicolor-picker.js +1 -1
  83. package/library/components/border-input-group.js +1 -1
  84. package/library/components/breadcrumb.js +1 -1
  85. package/library/components/button.js +1 -1
  86. package/library/components/color-picker.js +1 -1
  87. package/library/components/color-swatch-group.js +1 -1
  88. package/library/components/color-swatch.js +1 -1
  89. package/library/components/confirm-popover.js +1 -1
  90. package/library/components/copy-button.js +1 -1
  91. package/library/components/corner-position-input-group.js +1 -1
  92. package/library/components/cropper.js +1 -1
  93. package/library/components/date-calendar.js +1 -1
  94. package/library/components/details.js +1 -1
  95. package/library/components/dialog.js +1 -1
  96. package/library/components/document-viewer.js +1 -1
  97. package/library/components/dot-pagination.js +1 -1
  98. package/library/components/drawer.js +1 -1
  99. package/library/components/dropdown.js +1 -1
  100. package/library/components/dynamic-select.js +1 -1
  101. package/library/components/e-chart.js +1 -1
  102. package/library/components/element-clamp.js +1 -1
  103. package/library/components/file-on-demand.js +1 -1
  104. package/library/components/folder-select.js +1 -1
  105. package/library/components/format-bytes.js +1 -1
  106. package/library/components/format-date.js +1 -1
  107. package/library/components/format-number.js +1 -1
  108. package/library/components/format-time.js +1 -1
  109. package/library/components/header.js +1 -1
  110. package/library/components/icon-button.js +1 -1
  111. package/library/components/iframe.js +1 -1
  112. package/library/components/image-comparer.js +1 -1
  113. package/library/components/image.js +1 -1
  114. package/library/components/input.js +1 -1
  115. package/library/components/line-clamp.js +1 -1
  116. package/library/components/markdown.js +1 -1
  117. package/library/components/masonry.js +1 -1
  118. package/library/components/menu-item.js +1 -1
  119. package/library/components/menu.js +1 -1
  120. package/library/components/molecules.js +17 -17
  121. package/library/components/option.js +1 -1
  122. package/library/components/organisms.js +3 -3
  123. package/library/components/padding-input-group.js +1 -1
  124. package/library/components/pagination.js +1 -1
  125. package/library/components/popup.js +1 -1
  126. package/library/components/position-picker.js +1 -1
  127. package/library/components/progress-bar.js +1 -1
  128. package/library/components/progress-ring.js +1 -1
  129. package/library/components/radio-card.js +1 -1
  130. package/library/components/range.js +1 -1
  131. package/library/components/rating.js +1 -1
  132. package/library/components/relative-time.js +1 -1
  133. package/library/components/select.js +1 -1
  134. package/library/components/shadow-input-group.js +1 -1
  135. package/library/components/share-option-list.js +1 -1
  136. package/library/components/sidebar.js +1 -1
  137. package/library/components/size-input-group.js +1 -1
  138. package/library/components/spinner.js +1 -1
  139. package/library/components/split-panel.js +1 -1
  140. package/library/components/step.js +1 -1
  141. package/library/components/stepper-wizard.js +1 -1
  142. package/library/components/stepper.js +1 -1
  143. package/library/components/tab-group.js +1 -1
  144. package/library/components/tab.js +1 -1
  145. package/library/components/tag.js +1 -1
  146. package/library/components/tooltip.js +1 -1
  147. package/library/components/tree-item.js +1 -1
  148. package/library/components/tree.js +1 -1
  149. package/library/components/typeface.js +1 -1
  150. package/library/components/types.js +98 -98
  151. package/library/components/video.js +1 -1
  152. package/library/package.json +1 -1
  153. package/library/packages/events/src/cx-asset-link-format-crop-toggle.d.ts +6 -0
  154. package/library/packages/events/src/cx-asset-link-format-reorder.d.ts +10 -0
  155. package/library/packages/events/src/events.d.ts +2 -0
  156. package/library/packages/hybrid/video-advanced/src/react/plugins/Timeline/Viewer.d.ts +1 -0
  157. package/library/packages/hybrid/video-advanced/src/react/utils/segmentTime.d.ts +2 -0
  158. package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +176 -18
  159. package/library/packages/organisms/src/asset-link-format/components/asset-link-format-crop/asset-link-format-crop.d.ts +10 -0
  160. package/library/packages/organisms/src/asset-link-format/components/asset-link-format-dimensions/asset-link-format-dimensions.d.ts +103 -0
  161. package/library/packages/organisms/src/asset-link-format/components/asset-link-format-dimensions/asset-link-format-dimensions.styles.d.ts +2 -0
  162. package/library/packages/organisms/src/asset-link-format/components/asset-link-format-quality/asset-link-format-quality.d.ts +30 -0
  163. package/library/packages/organisms/src/asset-link-format/components/asset-link-format-rotation/asset-link-format-rotation.d.ts +6 -0
  164. package/library/packages/organisms/src/asset-transformation-dialog/asset-transformation-dialog.d.ts +7 -7
  165. package/library/packages/organisms/src/content-builder/styleController.d.ts +1 -3
  166. package/library/packages/types/src/asset-link-format.d.ts +63 -0
  167. package/library/packages/types/src/content-builder.d.ts +3 -3
  168. package/library/packages/utils/src/custom-element/i18n.d.ts +3 -0
  169. package/library/react-web-component.d.ts +18 -26
  170. package/library/utils.js +2 -2
  171. package/package.json +1 -1
  172. package/library/chunks/asset-link-format.DhdgEsA0.js +0 -12
@@ -3,45 +3,48 @@ import { a as r, i, n as a, r as o, t as s } from "./cortex-element.DTrNUtdr.js"
3
3
  import { t as c } from "./query.B1yi7t71.js";
4
4
  import { t as l } from "./component.styles.0xM1ZmBs.js";
5
5
  import { t as u } from "./custom-element.BEMYNDK1.js";
6
- import { t as d } from "./i18n.BJ2p4em8.js";
6
+ import { t as d } from "./i18n.CQPiI18Q.js";
7
7
  import { t as f } from "./watch.Ub5r8btz.js";
8
- import { t as p } from "./icon-button.Dd-oDRfX.js";
8
+ import { t as p } from "./icon-button.BAUsYiQh.js";
9
9
  import { t as m } from "./when.BUskJLtZ.js";
10
10
  import { t as h } from "./icon.CeQpEaQz.js";
11
11
  import { t as g } from "./style-map.DPGQIxip.js";
12
- import { t as _ } from "./button.BlhGCsjP.js";
12
+ import { t as _ } from "./button.DnOMjl_G.js";
13
13
  import { m as ee } from "./string.DAuTpyw8.js";
14
- import { t as te } from "./tooltip.GjnTzFeL.js";
14
+ import { t as te } from "./tooltip.DWx9VYtS.js";
15
15
  import { n as v } from "./position-picker.dY_vgF_H.js";
16
- import { l as ne, r as y } from "./number.CNp5LKkv.js";
17
- import { t as re } from "./image.C0s1gL4z.js";
18
- import { t as b } from "./typography.B0mkhqTB.js";
19
- import { t as ie } from "./button-group.CPfXrqyq.js";
20
- import { t as ae } from "./checkbox.aFoOxk2j.js";
21
- import { t as x } from "./repeat.CKv9FPlC.js";
22
- import { t as oe } from "./input.Fmdh6pnf.js";
23
- import { t as S } from "./option._7i4rjM5.js";
24
- import { t as C } from "./space.Dd8jezXK.js";
25
- import { t as w } from "./select.BddyhkLW.js";
26
- import { E as se, T as ce, b as le, d as ue, h as T, p as de, w as fe, y as pe } from "./src.CDbx_BKW.js";
27
- import { t as E } from "./details.BacO3ROq.js";
28
- import { t as me } from "./divider.CqSNZCU8.js";
29
- import { i as D, n as O, r as k } from "./asset-link-format.DhdgEsA0.js";
30
- import { t as he } from "./v4.JyXW8GUB.js";
31
- import "./cropper.D4ymxgab.js";
32
- import { t as ge } from "./_baseUniq.h_pGICPH.js";
33
- import { a as _e, f as A, n as ve, o as ye, r as be, t as xe, u as Se } from "./endpoints.jOHOmF_t.js";
34
- import { t as j } from "./position-picker.DwDC9gDl.js";
16
+ import { l as ne, r as re } from "./number.CNp5LKkv.js";
17
+ import { t as ie } from "./image.C0s1gL4z.js";
18
+ import { t as y } from "./typography.B0mkhqTB.js";
19
+ import { t as ae } from "./button-group.CPfXrqyq.js";
20
+ import { t as oe } from "./checkbox.aFoOxk2j.js";
21
+ import { t as b } from "./repeat.CKv9FPlC.js";
22
+ import { t as se } from "./input.D1UkXp3F.js";
23
+ import { t as x } from "./option.C97GEvQ6.js";
24
+ import { t as S } from "./space.Dd8jezXK.js";
25
+ import { t as C } from "./select.DGL9C_32.js";
26
+ import { t as ce } from "./visually-hidden.Bv3SInZp.js";
27
+ import { E as le, T as ue, b as de, d as fe, h as w, p as pe, w as me, y as he } from "./src.QIRlv8bQ.js";
28
+ import { t as T } from "./details.BGlfx87d.js";
29
+ import { t as E } from "./divider.CqSNZCU8.js";
30
+ import { a as D, c as O, l as k, n as ge, o as A, r as j, s as M, t as N } from "./asset-link-format.COPyGdND.js";
31
+ import { t as _e } from "./menu-label.B-FOyfAX.js";
32
+ import { t as ve } from "./switch.CBho2RVW.js";
33
+ import { t as ye } from "./v4.JyXW8GUB.js";
34
+ import "./cropper.BRsN8h2t.js";
35
+ import { t as be } from "./_baseUniq.h_pGICPH.js";
36
+ import { d as xe, i as Se, n as Ce, o as we, p as P, r as Te, s as Ee, t as De } from "./string-array.Dstcqyjm.js";
37
+ import { t as Oe } from "./position-picker.DzRyAx7a.js";
35
38
  //#region ../../node_modules/lodash-es/uniq.js
36
- function Ce(e) {
37
- return e && e.length ? ge(e) : [];
39
+ function ke(e) {
40
+ return e && e.length ? be(e) : [];
38
41
  }
39
42
  //#endregion
40
43
  //#region ../../packages/services/src/api/asset/asset.utils.ts
41
- function M(e) {
44
+ function Ae(e) {
42
45
  return typeof e == "object" && !!e && "URI" in e;
43
46
  }
44
- var we = {
47
+ var je = {
45
48
  artist: "Artist",
46
49
  color: "Color",
47
50
  createDate: "CreateDate",
@@ -63,34 +66,34 @@ var we = {
63
66
  systemIdentifier: "SystemIdentifier",
64
67
  text: "Text",
65
68
  title: "Title"
66
- }, Te = /* @__PURE__ */ new Set([
69
+ }, Me = /* @__PURE__ */ new Set([
67
70
  "mediaDate",
68
71
  "createDate",
69
72
  "editDate"
70
73
  ]);
71
- function N(e) {
74
+ function Ne(e) {
72
75
  return !/[\s&+/*"\\:(),'<>~|[\]{}]/.test(e) && !/^(?:OR|AND|NOT)$/.test(e) ? e : `"${e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
73
76
  }
74
- function Ee(e, t) {
75
- let n = (Array.isArray(t) ? t : [t]).map((t) => `${e}:${N(t)}`);
77
+ function Pe(e, t) {
78
+ let n = (Array.isArray(t) ? t : [t]).map((t) => `${e}:${Ne(t)}`);
76
79
  return n.length > 1 ? `(${n.join(" OR ")})` : n[0] ?? "";
77
80
  }
78
- function De(e, t) {
81
+ function Fe(e, t) {
79
82
  return (Array.isArray(t) ? t : [t]).map((t) => `${e}${t.operator}${t.value}`).join(" AND ");
80
83
  }
81
- function Oe(e) {
84
+ function Ie(e) {
82
85
  let t = [];
83
86
  for (let n of Object.keys(e)) {
84
87
  let r = n, i = e[r];
85
88
  if (i == null) continue;
86
89
  if (r === "custom") {
87
- for (let [e, n] of Object.entries(i)) t.push(Ee(e, n));
90
+ for (let [e, n] of Object.entries(i)) t.push(Pe(e, n));
88
91
  continue;
89
92
  }
90
- let a = we[r];
93
+ let a = je[r];
91
94
  if (a) {
92
- if (Te.has(r)) {
93
- t.push(De(a, i));
95
+ if (Me.has(r)) {
96
+ t.push(Fe(a, i));
94
97
  continue;
95
98
  }
96
99
  if (r === "color") {
@@ -100,87 +103,87 @@ function Oe(e) {
100
103
  if (r === "parentFolderIdentifier") {
101
104
  let e = Array.isArray(i) ? i : [i];
102
105
  if (e.length === 0) continue;
103
- let n = [...e.map((e) => `ParentFolderIdentifier:${N(String(e))}`), ...e.map((e) => `ParentAlbumIdentifier:${N(String(e))}`)];
106
+ let n = [...e.map((e) => `ParentFolderIdentifier:${Ne(String(e))}`), ...e.map((e) => `ParentAlbumIdentifier:${Ne(String(e))}`)];
104
107
  t.push(`(${n.join(" OR ")})`);
105
108
  continue;
106
109
  }
107
- t.push(Ee(a, i));
110
+ t.push(Pe(a, i));
108
111
  }
109
112
  }
110
113
  return t.join(" AND ");
111
114
  }
112
- function P(e) {
113
- if ("and" in e) return e.and.map(P).filter(Boolean).join(" AND ");
115
+ function Le(e) {
116
+ if ("and" in e) return e.and.map(Le).filter(Boolean).join(" AND ");
114
117
  if ("or" in e) {
115
- let t = e.or.map(P).filter(Boolean);
118
+ let t = e.or.map(Le).filter(Boolean);
116
119
  return t.length > 1 ? `(${t.join(" OR ")})` : t[0] ?? "";
117
120
  }
118
121
  if ("not" in e) {
119
- let t = P(e.not);
122
+ let t = Le(e.not);
120
123
  return t ? `NOT (${t})` : "";
121
124
  }
122
- return Oe(e);
125
+ return Ie(e);
123
126
  }
124
127
  //#endregion
125
128
  //#region ../../packages/services/src/api/asset/asset.ts
126
- var ke = "CoreField.LargeSizePreview", F = "CoreField.DocType", I = "Document.Title", Ae = "Document.CaptionLong", L = "Document.FileExtension", R = "CoreField.FileSize", z = "CoreField.Identifier", je = "CoreField.MaxHeight", Me = "CoreField.MaxWidth", B = "Document.RecordID", V = "CoreField.DocSubType", Ne = "CoreField.TitleWithFallback", H = "CoreField.OriginalFileName", Pe = "__width", Fe = "__height", Ie = "CoreField.OriginalPreview", Le = "Document.DocSubType", Re = "Document.InPoint", ze = "Document.OutPoint", Be = {
129
+ var Re = "CoreField.LargeSizePreview", F = "CoreField.DocType", ze = "Document.Title", Be = "Document.CaptionLong", I = "Document.FileExtension", Ve = "CoreField.FileSize", He = "CoreField.Identifier", Ue = "CoreField.MaxHeight", We = "CoreField.MaxWidth", L = "Document.RecordID", Ge = "CoreField.DocSubType", Ke = "CoreField.TitleWithFallback", R = "CoreField.OriginalFileName", qe = "__width", Je = "__height", Ye = "CoreField.OriginalPreview", Xe = "Document.DocSubType", Ze = "Document.InPoint", Qe = "Document.OutPoint", $e = {
127
130
  DEFAULT_VIEW_SIZE: "Document.LargeSizePreview",
128
131
  ORIGINAL_VIEW_SIZE: "Document.OriginalPreview"
129
- }, Ve = {
130
- [ke]: Be.DEFAULT_VIEW_SIZE,
131
- [Ie]: Be.ORIGINAL_VIEW_SIZE
132
- }, He = Object.fromEntries(Object.entries(Ve).map(([e, t]) => [t, e]));
133
- function Ue(e) {
134
- return Ve[e] ?? e;
132
+ }, et = {
133
+ [Re]: $e.DEFAULT_VIEW_SIZE,
134
+ [Ye]: $e.ORIGINAL_VIEW_SIZE
135
+ }, tt = Object.fromEntries(Object.entries(et).map(([e, t]) => [t, e]));
136
+ function nt(e) {
137
+ return et[e] ?? e;
135
138
  }
136
- function We(e) {
137
- return e === "CoreField.TitleWithFallback" ? [I, H] : [Ue(e)];
139
+ function rt(e) {
140
+ return e === "CoreField.TitleWithFallback" ? [ze, R] : [nt(e)];
138
141
  }
139
- function Ge(e) {
142
+ function it(e) {
140
143
  let t = {};
141
144
  for (let [n, r] of Object.entries(e)) {
142
- let e = He[n] ?? n;
145
+ let e = tt[n] ?? n;
143
146
  t[e] = r;
144
147
  }
145
148
  return t;
146
149
  }
147
- function Ke(e, t, n) {
148
- e[n] = U(t, n);
150
+ function at(e, t, n) {
151
+ e[n] = z(t, n);
149
152
  let r = t[n];
150
- return r != null && M(r) && (typeof r.Width == "number" && r.Width > 0 && (e[`${n}${Pe}`] = String(r.Width)), typeof r.Height == "number" && r.Height > 0 && (e[`${n}${Fe}`] = String(r.Height))), e;
153
+ return r != null && Ae(r) && (typeof r.Width == "number" && r.Width > 0 && (e[`${n}${qe}`] = String(r.Width)), typeof r.Height == "number" && r.Height > 0 && (e[`${n}${Je}`] = String(r.Height))), e;
151
154
  }
152
- function qe(e) {
155
+ function ot(e) {
153
156
  let t = new URLSearchParams();
154
157
  for (let [n, r] of Object.entries(e)) r != null && (Array.isArray(r) ? r.forEach((e) => t.append(n, String(e))) : t.append(n, String(r)));
155
158
  return t;
156
159
  }
157
- async function Je({ consistency: e, countPerPage: t, fields: n, getPermanentAssetsPaths: r, httpMethod: i = "GET", isSiteBuilder: a, pageNumber: o, query: s, securityByPassToken: c, siteUrl: l, sort: u, throwOnError: d, token: f, useSession: p }) {
158
- let m = n?.flatMap(We), h = n?.includes("CoreField.TitleWithFallback") ?? !1, g = (e) => {
159
- let t = Ge(e);
160
- return h && (t[Ne] = U(t, "Document.Title") || U(t, "CoreField.OriginalFileName")), t;
160
+ async function st({ consistency: e, countPerPage: t, fields: n, getPermanentAssetsPaths: r, httpMethod: i = "GET", isSiteBuilder: a, pageNumber: o, query: s, securityByPassToken: c, siteUrl: l, sort: u, throwOnError: d, token: f, useSession: p }) {
161
+ let m = n?.flatMap(rt), h = n?.includes("CoreField.TitleWithFallback") ?? !1, g = (e) => {
162
+ let t = it(e);
163
+ return h && (t[Ke] = z(t, "Document.Title") || z(t, "CoreField.OriginalFileName")), t;
161
164
  }, _ = {
162
165
  Consistency: e || void 0,
163
166
  CountPerPage: t,
164
- Fields: Ce(m),
167
+ Fields: ke(m),
165
168
  Format: "json",
166
169
  GetPermanentAssetsPaths: r ?? void 0,
167
170
  PageNumber: o,
168
- Query: P(s),
171
+ Query: Le(s),
169
172
  SecurityByPassToken: c || void 0,
170
173
  Sort: u || void 0,
171
174
  UseSession: p || void 0
172
175
  }, ee = i === "POST";
173
176
  try {
174
- return (await A.request({
177
+ return (await P.request({
175
178
  baseURL: l,
176
179
  headers: f ? { Authorization: `Bearer ${f}` } : void 0,
177
180
  method: i,
178
- ...ee ? { data: qe(_) } : {
181
+ ...ee ? { data: ot(_) } : {
179
182
  params: _,
180
183
  paramsSerializer: { indexes: null }
181
184
  },
182
185
  responseType: "json",
183
- transformResponse: [...Array.isArray(A.defaults.transformResponse) ? A.defaults.transformResponse : [], a ? (e) => ({
186
+ transformResponse: [...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [], a ? (e) => ({
184
187
  items: (e.results?.Items ?? []).map(g),
185
188
  sort: e.results?.GlobalInfo?.Sort ?? "",
186
189
  totalCount: e.results?.GlobalInfo?.TotalCount ?? 0
@@ -189,7 +192,7 @@ async function Je({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
189
192
  sort: e.APIResponse?.GlobalInfo?.Sort ?? "",
190
193
  totalCount: e.APIResponse?.GlobalInfo?.TotalCount ?? 0
191
194
  })],
192
- url: a ? ye.SEARCH_ASSETS : Se["4.0"]
195
+ url: a ? Ee.SEARCH_ASSETS : xe["4.0"]
193
196
  })).data;
194
197
  } catch (e) {
195
198
  if (d) throw e;
@@ -200,9 +203,9 @@ async function Je({ consistency: e, countPerPage: t, fields: n, getPermanentAsse
200
203
  };
201
204
  }
202
205
  }
203
- async function Ye({ assetId: e, extension: t, format: n, siteUrl: r, token: i, transformations: a, useSession: o }) {
206
+ async function ct({ assetId: e, extension: t, format: n, siteUrl: r, token: i, transformations: a, useSession: o }) {
204
207
  try {
205
- return (await A.request({
208
+ return (await P.request({
206
209
  baseURL: r,
207
210
  method: "GET",
208
211
  params: {
@@ -214,19 +217,19 @@ async function Ye({ assetId: e, extension: t, format: n, siteUrl: r, token: i, t
214
217
  UseSession: o || void 0
215
218
  },
216
219
  timeout: 3e5,
217
- url: ve.GET_TRANSFORM_ASSET_LINK
220
+ url: Te.GET_TRANSFORM_ASSET_LINK
218
221
  })).data;
219
222
  } catch {
220
223
  return null;
221
224
  }
222
225
  }
223
- var Xe = 50;
224
- function Ze(e, t) {
226
+ var lt = 50;
227
+ function ut(e, t) {
225
228
  let n = [];
226
229
  for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
227
230
  return n;
228
231
  }
229
- async function Qe({ consistency: e, extraFields: t, getPermanentAssetsPaths: n, isSiteBuilder: r, recordIds: i, securityByPassToken: a, throwOnError: o, token: s }) {
232
+ async function dt({ consistency: e, extraFields: t, getPermanentAssetsPaths: n, isSiteBuilder: r, recordIds: i, securityByPassToken: a, throwOnError: o, token: s }) {
230
233
  if (!Array.isArray(i) || i.length === 0) return {
231
234
  facets: [],
232
235
  items: [],
@@ -234,11 +237,11 @@ async function Qe({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
234
237
  };
235
238
  let c = t?.filter((e) => e && typeof e == "string") ?? [], l = [
236
239
  ...c,
237
- H,
238
- I,
239
- Ae,
240
- B
241
- ], u = Ze(i, Xe), d = await Promise.all(u.map((t) => Je({
240
+ R,
241
+ ze,
242
+ Be,
243
+ L
244
+ ], u = ut(i, lt), d = await Promise.all(u.map((t) => st({
242
245
  consistency: e,
243
246
  countPerPage: t.length,
244
247
  fields: l,
@@ -254,18 +257,18 @@ async function Qe({ consistency: e, extraFields: t, getPermanentAssetsPaths: n,
254
257
  return {
255
258
  facets: [],
256
259
  items: d.flatMap((e) => e.items).map((e) => ({
257
- name: U(e, H),
258
- recordId: U(e, B),
259
- ...c.reduce((t, n) => Ke(t, e, n), {})
260
+ name: z(e, R),
261
+ recordId: z(e, L),
262
+ ...c.reduce((t, n) => at(t, e, n), {})
260
263
  })).sort((e, t) => (f.get(e.recordId) ?? Infinity) - (f.get(t.recordId) ?? Infinity)),
261
264
  totalCount: d.reduce((e, t) => e + t.totalCount, 0)
262
265
  };
263
266
  }
264
- function U(e, t) {
267
+ function z(e, t) {
265
268
  let n = e[t];
266
- return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) : M(n) ? n.URI : "";
269
+ return n == null ? "" : typeof n == "string" ? n : typeof n == "number" || typeof n == "boolean" ? String(n) : Ae(n) ? n.URI : "";
267
270
  }
268
- async function $e({ consistency: e, countPerPage: t, directParentFolderIdentifier: n, extraFields: r, getPermanentAssetsPaths: i, isSiteBuilder: a, limitedDocTypes: o, pageNumber: s, parentFolderIdentifier: c, searchTerm: l, securityByPassToken: u, sortOrder: d, throwOnError: f, token: p }) {
271
+ async function ft({ consistency: e, countPerPage: t, directParentFolderIdentifier: n, extraFields: r, getPermanentAssetsPaths: i, isSiteBuilder: a, limitedDocTypes: o, pageNumber: s, parentFolderIdentifier: c, searchTerm: l, securityByPassToken: u, sortOrder: d, throwOnError: f, token: p }) {
269
272
  if (!n && !c) return {
270
273
  facets: [],
271
274
  items: [],
@@ -276,19 +279,19 @@ async function $e({ consistency: e, countPerPage: t, directParentFolderIdentifie
276
279
  parentFolderIdentifier: c,
277
280
  ...l ? { text: l } : {},
278
281
  ...o && o.length > 0 ? { docType: o } : {}
279
- }, g = await Je({
282
+ }, g = await st({
280
283
  consistency: e,
281
284
  countPerPage: t,
282
285
  fields: [
283
286
  ...m,
284
- Ne,
285
- R,
287
+ Ke,
288
+ Ve,
286
289
  F,
287
- V,
288
- z,
290
+ Ge,
291
+ He,
292
+ I,
289
293
  L,
290
- B,
291
- H
294
+ R
292
295
  ],
293
296
  getPermanentAssetsPaths: i,
294
297
  isSiteBuilder: a,
@@ -302,27 +305,27 @@ async function $e({ consistency: e, countPerPage: t, directParentFolderIdentifie
302
305
  return {
303
306
  facets: [],
304
307
  items: g.items.map((e) => {
305
- let t = U(e, L);
308
+ let t = z(e, I);
306
309
  t && !t.startsWith(".") && (t = "." + t);
307
- let n = U(e, B);
310
+ let n = z(e, L);
308
311
  return {
309
- docSubType: U(e, V),
310
- docType: U(e, "CoreField.DocType") || "",
312
+ docSubType: z(e, Ge),
313
+ docType: z(e, "CoreField.DocType") || "",
311
314
  extension: t,
312
315
  id: n,
313
- identifier: U(e, z),
314
- name: U(e, H),
316
+ identifier: z(e, He),
317
+ name: z(e, R),
315
318
  recordId: n,
316
- size: U(e, "CoreField.FileSize") || "0 MB",
317
- ...m.reduce((t, n) => Ke(t, e, n), {})
319
+ size: z(e, "CoreField.FileSize") || "0 MB",
320
+ ...m.reduce((t, n) => at(t, e, n), {})
318
321
  };
319
322
  }),
320
323
  totalCount: g.totalCount
321
324
  };
322
325
  }
323
- async function et({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, useSession: i }) {
326
+ async function pt({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, useSession: i }) {
324
327
  try {
325
- return (await A.request({
328
+ return (await P.request({
326
329
  method: "GET",
327
330
  params: {
328
331
  AutoCropMode: e,
@@ -333,21 +336,21 @@ async function et({ autoCropMode: e, cropHeight: t, cropWidth: n, imageUrl: r, u
333
336
  },
334
337
  responseType: "json",
335
338
  timeout: 3e5,
336
- transformResponse: [...Array.isArray(A.defaults.transformResponse) ? A.defaults.transformResponse : [], (e) => ({
339
+ transformResponse: [...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [], (e) => ({
337
340
  height: e.cropHeight,
338
341
  width: e.cropWidth,
339
342
  x: e.cropX,
340
343
  y: e.cropY
341
344
  })],
342
- url: ve.GET_CROP_ZONE_SUGGESTION
345
+ url: Te.GET_CROP_ZONE_SUGGESTION
343
346
  })).data;
344
347
  } catch {
345
348
  return null;
346
349
  }
347
350
  }
348
- async function tt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, useSession: i }) {
351
+ async function mt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, useSession: i }) {
349
352
  try {
350
- return (await A.request({
353
+ return (await P.request({
351
354
  baseURL: n,
352
355
  method: "GET",
353
356
  params: {
@@ -356,7 +359,7 @@ async function tt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
356
359
  UseSession: i || void 0
357
360
  },
358
361
  responseType: "json",
359
- transformResponse: [...Array.isArray(A.defaults.transformResponse) ? A.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? [] : e.proxies?.map((e) => ({
362
+ transformResponse: [...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? [] : e.proxies?.map((e) => ({
360
363
  cdnName: e.cdnName,
361
364
  extension: e.extension,
362
365
  formatHeight: e.formatHeight,
@@ -367,31 +370,31 @@ async function tt({ assetRecordId: e, isSiteBuilder: t, siteUrl: n, token: r, us
367
370
  proxyName: e.proxyName,
368
371
  width: e.width
369
372
  })) ?? []],
370
- url: t ? ye.GET_AVAILABLE_PROXIES : _e
373
+ url: t ? Ee.GET_AVAILABLE_PROXIES : we
371
374
  })).data;
372
375
  } catch {
373
376
  return [];
374
377
  }
375
378
  }
376
- async function nt({ siteUrl: e } = {}) {
379
+ async function ht({ siteUrl: e } = {}) {
377
380
  try {
378
- return (await A.request({
381
+ return (await P.request({
379
382
  baseURL: e,
380
383
  method: "GET",
381
384
  responseType: "json",
382
- transformResponse: [...Array.isArray(A.defaults.transformResponse) ? A.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? { formatsByDocType: {
385
+ transformResponse: [...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [], (e) => !e || typeof e != "object" ? { formatsByDocType: {
383
386
  Audio: {},
384
387
  Image: {},
385
388
  Multimedia: {},
386
389
  Video: {}
387
390
  } } : { formatsByDocType: e.formatsByDocType ?? {} }],
388
- url: xe
391
+ url: Ce
389
392
  })).data;
390
393
  } catch {
391
394
  return { formatsByDocType: {} };
392
395
  }
393
396
  }
394
- async function rt({ recordIds: e, rightsToCheck: t }) {
397
+ async function gt({ recordIds: e, rightsToCheck: t }) {
395
398
  let n = {
396
399
  authorizedObjects: [],
397
400
  forbiddenObjectsOfReadPermission: [],
@@ -399,7 +402,7 @@ async function rt({ recordIds: e, rightsToCheck: t }) {
399
402
  invalidObjects: []
400
403
  };
401
404
  try {
402
- let { data: n } = await A.request({
405
+ let { data: n } = await P.request({
403
406
  method: "GET",
404
407
  params: {
405
408
  RecordIDs: e,
@@ -407,7 +410,7 @@ async function rt({ recordIds: e, rightsToCheck: t }) {
407
410
  },
408
411
  paramsSerializer: { indexes: null },
409
412
  responseType: "json",
410
- url: be.GET_AUTHORIZED_OBJECTS
413
+ url: Se.GET_AUTHORIZED_OBJECTS
411
414
  });
412
415
  return n;
413
416
  } catch {
@@ -416,7 +419,7 @@ async function rt({ recordIds: e, rightsToCheck: t }) {
416
419
  }
417
420
  //#endregion
418
421
  //#region ../../packages/tools/src/fetch-image/fetch-image.ts
419
- var it = 20, W = "TR1", G = "TRX", at = /* @__PURE__ */ new Set([".gif"]), ot = /* @__PURE__ */ new Set([
422
+ var _t = 20, B = "TR1", V = "TRX", vt = /* @__PURE__ */ new Set([".gif"]), yt = /* @__PURE__ */ new Set([
420
423
  ".avif",
421
424
  ".bmp",
422
425
  ".gif",
@@ -427,18 +430,18 @@ var it = 20, W = "TR1", G = "TRX", at = /* @__PURE__ */ new Set([".gif"]), ot =
427
430
  ".svg",
428
431
  ".webp"
429
432
  ]);
430
- function st(e) {
433
+ function bt(e) {
431
434
  let t = e.toLowerCase(), n = t.startsWith(".") ? t : `.${t}`;
432
- return ot.has(n);
435
+ return yt.has(n);
433
436
  }
434
- function ct(e, t) {
435
- return e !== void 0 && e !== "" && e !== O.Image ? !1 : !t || st(t);
437
+ function xt(e, t) {
438
+ return e !== void 0 && e !== "" && e !== M.Image ? !1 : !t || bt(t);
436
439
  }
437
- function lt({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i, item: a, manualFormat: o, size: s, useExpiringAssetUrls: c }) {
438
- let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${W}`, f = (n, r) => {
440
+ function St({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i, item: a, manualFormat: o, size: s, useExpiringAssetUrls: c }) {
441
+ let l = r?.toLowerCase() ?? "", u = l.startsWith(".") ? l : `.${l}`, d = `path_${B}`, f = (n, r) => {
439
442
  let i = a[n];
440
443
  if (!i) return;
441
- let s = a[`${n}${Pe}`], u = a[`${n}${Fe}`], d = e && !c ? ue(i, [], {
444
+ let s = a[`${n}${qe}`], u = a[`${n}${Je}`], d = e && !c ? fe(i, [], {
442
445
  autoFormat: !o,
443
446
  extension: l,
444
447
  format: r
@@ -447,31 +450,31 @@ function lt({ autoFormat: e, buildSrcset: t, docType: n, extension: r, format: i
447
450
  maxHeight: u,
448
451
  maxWidth: s,
449
452
  src: d,
450
- srcset: t && !c ? de(d, {
453
+ srcset: t && !c ? pe(d, {
451
454
  extension: l,
452
455
  format: r,
453
- maxWidth: le(o, s)
456
+ maxWidth: de(o, s)
454
457
  }) : ""
455
458
  };
456
459
  };
457
460
  if (c) {
458
- let e = ce(a, ct(n, l), l);
461
+ let e = ue(a, xt(n, l), l);
459
462
  return e ? f(e) ?? {} : {};
460
463
  }
461
464
  if (!o) {
462
- let e = pe(l, s);
463
- return f(`path_${e}`, e) ?? f(d, W) ?? {};
465
+ let e = he(l, s);
466
+ return f(`path_${e}`, e) ?? f(d, B) ?? {};
464
467
  }
465
468
  let p = i ? `path_${i}` : void 0;
466
- return p && a[p] ? i !== G || ct(n, l) ? f(p, i) ?? {} : f(d, W) ?? {} : l && at.has(u) ? f(`path_${G}`, G) ?? f(d, W) ?? {} : f(d, W) ?? {};
469
+ return p && a[p] ? i !== V || xt(n, l) ? f(p, i) ?? {} : f(d, B) ?? {} : l && vt.has(u) ? f(`path_${V}`, V) ?? f(d, B) ?? {} : f(d, B) ?? {};
467
470
  }
468
- var ut = class {
471
+ var Ct = class {
469
472
  constructor(e, t) {
470
- this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = Infinity, this.pageSize = it, this.requestEpoch = 0, this.host = e, this.host.addController?.(this);
473
+ this.data = [], this.folderId = "", this.fetchedPages = /* @__PURE__ */ new Set(), this.totalCount = 0, this.maxEnd = Infinity, this.pageSize = _t, this.requestEpoch = 0, this.host = e, this.host.addController?.(this);
471
474
  let n = t?.maxEnd;
472
475
  this.maxEnd = typeof n == "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : Infinity;
473
476
  let r = t?.pageSize;
474
- this.pageSize = typeof r == "number" && Number.isFinite(r) && r >= 1 ? Math.floor(r) : it, this.authToken = t?.token, this.securityByPassToken = t?.securityByPassToken, this.isSiteBuilder = t?.isSiteBuilder ?? !1, this.autoFormat = t?.autoFormat ?? !1, this.buildSrcset = t?.buildSrcset ?? !1, this.consistency = t?.consistency;
477
+ this.pageSize = typeof r == "number" && Number.isFinite(r) && r >= 1 ? Math.floor(r) : _t, this.authToken = t?.token, this.securityByPassToken = t?.securityByPassToken, this.isSiteBuilder = t?.isSiteBuilder ?? !1, this.autoFormat = t?.autoFormat ?? !1, this.buildSrcset = t?.buildSrcset ?? !1, this.consistency = t?.consistency;
475
478
  }
476
479
  get totalDataCount() {
477
480
  return this.totalCount;
@@ -480,34 +483,34 @@ var ut = class {
480
483
  this.securityByPassToken !== e && (this.securityByPassToken = e, this.resetPageCache());
481
484
  }
482
485
  setPageSize(e) {
483
- let t = Number.isFinite(e) && e >= 1 ? Math.floor(e) : it;
486
+ let t = Number.isFinite(e) && e >= 1 ? Math.floor(e) : _t;
484
487
  if (this.pageSize === t) return;
485
488
  let n = this.fetchedPages.size > 0;
486
489
  n && t < this.pageSize || (this.pageSize = t, n && (this.requestEpoch += 1, this.fetchedPages.clear()));
487
490
  }
488
491
  async fetchImages({ end: e, extraFields: t = [], format: n, manualFormat: r = !0, start: i, throwOnError: a = !1, transformations: o }) {
489
492
  if (e < i || this.totalCount > 0 && e >= this.totalCount && (e = this.totalCount - 1, e < i)) return this.data;
490
- let s = this.requestEpoch, c = fe(this.host.ownerDocument.defaultView);
493
+ let s = this.requestEpoch, c = me(this.host.ownerDocument.defaultView);
491
494
  if (!this.folderId || s !== this.requestEpoch) return this.data;
492
- let l = n ? `path_${n}` : void 0, u = `path_${W}`, d = `path_${G}`, f = c ? [u, d] : [...new Set([
495
+ let l = n ? `path_${n}` : void 0, u = `path_${B}`, d = `path_${V}`, f = c ? [u, d] : [...new Set([
493
496
  l,
494
497
  u,
495
498
  d
496
499
  ].filter((e) => !!e))], p = Math.floor(i / this.pageSize) + 1, m = Math.floor(e / this.pageSize) + 1;
497
500
  for (let e = p; e <= m; e++) {
498
501
  if (this.fetchedPages.has(e)) continue;
499
- let i = await $e({
502
+ let i = await ft({
500
503
  consistency: this.consistency,
501
504
  countPerPage: this.pageSize,
502
505
  directParentFolderIdentifier: this.folderId,
503
506
  extraFields: [...t, ...f],
504
- getPermanentAssetsPaths: se(this.host.ownerDocument.defaultView),
507
+ getPermanentAssetsPaths: le(this.host.ownerDocument.defaultView),
505
508
  isSiteBuilder: this.isSiteBuilder,
506
509
  limitedDocTypes: [
507
- O.Image,
508
- O.Audio,
509
- O.Video,
510
- O.Multimedia
510
+ M.Image,
511
+ M.Audio,
512
+ M.Video,
513
+ M.Multimedia
511
514
  ],
512
515
  pageNumber: e,
513
516
  searchTerm: "",
@@ -521,7 +524,7 @@ var ut = class {
521
524
  let e = Math.min(this.maxEnd, i.totalCount);
522
525
  this.totalCount = e, this.data = Array.from({ length: e }, () => ({
523
526
  alt: "",
524
- id: `temp-${he()}`,
527
+ id: `temp-${ye()}`,
525
528
  name: "",
526
529
  src: ""
527
530
  }));
@@ -530,7 +533,7 @@ var ut = class {
530
533
  for (let e = 0; e < i.items.length; e++) {
531
534
  let a = l + e;
532
535
  if (a < this.data.length) {
533
- let s = i.items[e], { maxHeight: l, maxWidth: u, src: d, srcset: f } = lt({
536
+ let s = i.items[e], { maxHeight: l, maxWidth: u, src: d, srcset: f } = St({
534
537
  autoFormat: this.autoFormat,
535
538
  buildSrcset: this.buildSrcset,
536
539
  docType: s.docType,
@@ -541,7 +544,7 @@ var ut = class {
541
544
  size: s.size,
542
545
  useExpiringAssetUrls: c
543
546
  }), p = d, m = f;
544
- !c && p && o && o.length > 0 && (p = ue(p, o), m = ""), this.data[a] = {
547
+ !c && p && o && o.length > 0 && (p = fe(p, o), m = ""), this.data[a] = {
545
548
  alt: s.name,
546
549
  docType: s.docType,
547
550
  extension: s.extension,
@@ -584,37 +587,37 @@ var ut = class {
584
587
  }
585
588
  async fetchImagesByIDs({ extraFields: e = [], format: t, manualFormat: n = !0, recordIds: r, throwOnError: i = !1, transformations: a }) {
586
589
  if (r.length === 0) return [];
587
- let o = fe(this.host.ownerDocument.defaultView), s = t ? `path_${t}` : void 0, c = `path_${W}`, l = `path_${G}`, u = o ? [c, l] : [...new Set([
590
+ let o = me(this.host.ownerDocument.defaultView), s = t ? `path_${t}` : void 0, c = `path_${B}`, l = `path_${V}`, u = o ? [c, l] : [...new Set([
588
591
  s,
589
592
  c,
590
593
  l
591
- ].filter((e) => !!e))], d = [L, ...o ? [] : [R]], f = [...e, F];
592
- return (await Qe({
594
+ ].filter((e) => !!e))], d = [I, ...o ? [] : [Ve]], f = [...e, F];
595
+ return (await dt({
593
596
  consistency: this.consistency,
594
597
  extraFields: [
595
598
  ...f,
596
599
  ...u,
597
600
  ...d
598
601
  ].filter((e) => e !== ""),
599
- getPermanentAssetsPaths: se(this.host.ownerDocument.defaultView),
602
+ getPermanentAssetsPaths: le(this.host.ownerDocument.defaultView),
600
603
  isSiteBuilder: this.isSiteBuilder,
601
604
  recordIds: r,
602
605
  securityByPassToken: this.securityByPassToken,
603
606
  throwOnError: i,
604
607
  token: this.authToken
605
608
  })).items.map((e) => {
606
- let { maxHeight: r, maxWidth: i, src: s, srcset: c } = lt({
609
+ let { maxHeight: r, maxWidth: i, src: s, srcset: c } = St({
607
610
  autoFormat: this.autoFormat,
608
611
  buildSrcset: this.buildSrcset,
609
612
  docType: e[F],
610
- extension: e[L],
613
+ extension: e[I],
611
614
  format: t,
612
615
  item: e,
613
616
  manualFormat: n,
614
- size: e[R],
617
+ size: e[Ve],
615
618
  useExpiringAssetUrls: o
616
619
  }), l = s, u = c;
617
- return !o && l && a && a.length > 0 && (l = ue(l, a), u = ""), {
620
+ return !o && l && a && a.length > 0 && (l = fe(l, a), u = ""), {
618
621
  alt: e.name,
619
622
  docType: e[F],
620
623
  extension: e["Document.FileExtension"] || "",
@@ -683,42 +686,42 @@ var ut = class {
683
686
  resetFolderState() {
684
687
  this.resetPageCache();
685
688
  }
686
- }, dt = t`.asset-link-format__details{--header-padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__details::part(icon){width:var(--cx-font-size-3x-large);height:var(--cx-font-size-3x-large);background-color:var(--cx-color-neutral-100);border-radius:var(--cx-border-radius-large);color:var(--cx-color-neutral-600);font-size:var(--cx-font-size-large);justify-content:center;align-items:center;display:flex}.asset-link-format__details::part(input-label){color:var(--cx-color-neutral-400);margin-inline-start:var(--cx-spacing-small)}.asset-link-format__header{padding:var(--cx-spacing-medium)}.asset-link-format__section-header{padding:0 var(--cx-spacing-medium);border-top:var(--section-header-border-width,1px) solid var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-50)}.asset-link-format__undo,.asset-link-format__reset{--color:var(--cx-color-primary);--background-color:transparent}.asset-link-format__footer,.asset-link-format__footer>slot{display:block}`, ft = t`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}`, K = class extends s {
689
+ }, wt = t`.asset-link-format__panel{position:relative}.asset-link-format--formats .asset-link-format__panel:not(:last-child){border-bottom:1px solid var(--cx-color-neutral-200)}.asset-link-format__drag-handle{cursor:grab;touch-action:none;width:max-content;margin-inline:auto;position:absolute;inset-block-start:calc(var(--cx-spacing-small) + var(--cx-font-size-3x-large) / 2);inset-inline:0;transform:translateY(-50%)}.asset-link-format__drag-handle::part(base){cursor:grab}.asset-link-format__drag-handle:active,.asset-link-format__drag-handle:active::part(base){cursor:grabbing}.asset-link-format__drag-handle::part(icon){color:var(--cx-color-neutral-300);rotate:90deg}.asset-link-format__announcement{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.asset-link-format__order-hint{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border-bottom:1px solid var(--cx-color-neutral-200);color:var(--cx-color-success);font:var(--cx-font-label-x-small)}.asset-link-format__details{--header-padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__details::part(icon){width:var(--cx-font-size-3x-large);height:var(--cx-font-size-3x-large);background-color:var(--cx-color-neutral-100);border-radius:var(--cx-border-radius-large);color:var(--cx-color-neutral-600);font-size:var(--cx-font-size-large);justify-content:center;align-items:center;display:flex}.asset-link-format__details::part(input-label){color:var(--cx-color-neutral-400);margin-inline-start:var(--cx-spacing-small)}.asset-link-format__formats-summary{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__formats-summary [part=icon]{width:var(--cx-font-size-3x-large);height:var(--cx-font-size-3x-large);background-color:var(--cx-color-neutral-100);border-radius:var(--cx-border-radius-large);color:var(--cx-color-neutral-600);font-size:var(--cx-font-size-large);justify-content:center;align-items:center;display:flex}.asset-link-format__formats-crop cx-asset-link-format-crop{box-sizing:border-box;width:100%;padding:0 var(--cx-spacing-medium) var(--cx-spacing-small)}.asset-link-format__header{padding:var(--cx-spacing-medium)}.asset-link-format__section-header{padding:0 var(--cx-spacing-medium);border-top:var(--section-header-border-width,1px) solid var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-50)}.asset-link-format__undo,.asset-link-format__reset{--color:var(--cx-color-primary);--background-color:transparent}.asset-link-format__footer,.asset-link-format__footer>slot{display:block}`, Tt = t`:host([inline]){display:block}cx-details::part(base){border-bottom-width:0}.details--inline::part(base){border-width:0}.details--inline::part(header){display:none}.details--inline::part(content){padding:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}`, H = class extends s {
687
690
  constructor(...e) {
688
- super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit = D.Pixel, this.disabledApply = !1, this.noRatioModes = !1, this.showPositionPicker = !1, this.lastAppliedSetting = {
689
- [D.Pixel]: {
691
+ super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit = k.Pixel, this.disabledApply = !1, this.noRatioModes = !1, this.showPositionPicker = !1, this.lastAppliedSetting = {
692
+ [k.Pixel]: {
690
693
  height: 0,
691
694
  percentageHeight: 100,
692
695
  percentageWidth: 100,
693
- unit: D.Pixel,
696
+ unit: k.Pixel,
694
697
  width: 0,
695
698
  x: 0,
696
699
  y: 0
697
700
  },
698
- [D.AspectRatio]: {
701
+ [k.AspectRatio]: {
699
702
  height: 1,
700
703
  percentageHeight: 100,
701
704
  percentageWidth: 100,
702
- unit: D.AspectRatio,
705
+ unit: k.AspectRatio,
703
706
  width: 1,
704
707
  x: 0,
705
708
  y: 0
706
709
  }
707
710
  }, this.loading = !1, this.cropModes = [], this.focusModes = [], this.focusMode = "manual", this.cropMode = "free", this.position = v.CenterCenter, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
708
711
  }
709
- static #e = this.styles = [l, ft];
712
+ static #e = this.styles = [l, Tt];
710
713
  static #t = this.dependencies = {
711
714
  "cx-button": _,
712
- "cx-details": E,
713
- "cx-divider": me,
715
+ "cx-details": T,
716
+ "cx-divider": E,
714
717
  "cx-icon": h,
715
718
  "cx-icon-button": p,
716
- "cx-input": oe,
717
- "cx-option": S,
718
- "cx-position-picker": j,
719
- "cx-select": w,
720
- "cx-space": C,
721
- "cx-typography": b
719
+ "cx-input": se,
720
+ "cx-option": x,
721
+ "cx-position-picker": Oe,
722
+ "cx-select": C,
723
+ "cx-space": S,
724
+ "cx-typography": y
722
725
  };
723
726
  get selectedMode() {
724
727
  return this.cropModes.find((e) => e.value === this.cropMode);
@@ -730,11 +733,11 @@ var ut = class {
730
733
  return;
731
734
  }
732
735
  if (this.keepAspectRatio) {
733
- if (this.unit === D.Pixel && this.width && this.height) {
736
+ if (this.unit === k.Pixel && this.width && this.height) {
734
737
  this.aspectRatio = this.width / this.height;
735
738
  return;
736
739
  }
737
- if (this.unit === D.AspectRatio && this.ratioWidth && this.ratioHeight) {
740
+ if (this.unit === k.AspectRatio && this.ratioWidth && this.ratioHeight) {
738
741
  this.aspectRatio = this.ratioWidth / this.ratioHeight;
739
742
  return;
740
743
  }
@@ -757,15 +760,14 @@ var ut = class {
757
760
  }
758
761
  }
759
762
  handleWidthChange(e) {
760
- if (!e.target.value) {
763
+ let t = Number(e.target.value);
764
+ if (!e.target.value || !Number.isFinite(t)) {
761
765
  this.invalidWidth = !0;
762
766
  return;
763
767
  }
764
- this.invalidWidth = !1;
765
- let t = Number(e.target.value);
766
- this.unit === D.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1)), e.target.value = t.toString();
767
- let n = this.unit === D.Pixel ? this.height : this.ratioHeight, r = !1;
768
- this.keepAspectRatio && (n = Math.round(t / this.aspectRatio), this.unit === D.Pixel && n > this.maxHeight && (n = this.maxHeight, r = !0)), this.invalidHeight = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
768
+ this.invalidWidth = !1, this.unit === k.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1));
769
+ let n = this.unit === k.Pixel ? this.height : this.ratioHeight, r = !1;
770
+ this.keepAspectRatio && (n = Math.max(Math.round(t / this.aspectRatio), 1)), this.unit === k.Pixel && this.maxHeight >= 1 && n > this.maxHeight && (n = this.maxHeight, r = this.keepAspectRatio), e.target.value = t.toString(), this.invalidHeight = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
769
771
  breakAspectRatio: r,
770
772
  height: n,
771
773
  keepAspectRatio: this.keepAspectRatio,
@@ -774,15 +776,14 @@ var ut = class {
774
776
  } });
775
777
  }
776
778
  handleHeightChange(e) {
777
- if (!e.target.value) {
779
+ let t = Number(e.target.value);
780
+ if (!e.target.value || !Number.isFinite(t)) {
778
781
  this.invalidHeight = !0;
779
782
  return;
780
783
  }
781
- this.invalidHeight = !1;
782
- let t = Number(e.target.value);
783
- this.unit === D.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1)), e.target.value = t.toString();
784
- let n = this.unit === D.Pixel ? this.width : this.ratioWidth, r = !1;
785
- this.keepAspectRatio && (n = Math.round(t * this.aspectRatio), this.unit === D.Pixel && n > this.maxWidth && (n = this.maxWidth, r = !0)), this.invalidWidth = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
784
+ this.invalidHeight = !1, this.unit === k.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1));
785
+ let n = this.unit === k.Pixel ? this.width : this.ratioWidth, r = !1;
786
+ this.keepAspectRatio && (n = Math.max(Math.round(t * this.aspectRatio), 1)), this.unit === k.Pixel && this.maxWidth >= 1 && n > this.maxWidth && (n = this.maxWidth, r = this.keepAspectRatio), e.target.value = t.toString(), this.invalidWidth = !1, this.emit("cx-asset-link-format-crop-change", { detail: {
786
787
  breakAspectRatio: r,
787
788
  height: t,
788
789
  keepAspectRatio: this.keepAspectRatio,
@@ -793,28 +794,28 @@ var ut = class {
793
794
  onCropModeChange(e) {
794
795
  let t = e.target.value, n = this.cropModes.find((e) => e.value === t)?.auto;
795
796
  if (t === "free") this.selectedMode?.auto && this.emit("cx-asset-link-format-crop-change", { detail: {
796
- height: this.lastAppliedSetting[D.Pixel].height,
797
+ height: this.lastAppliedSetting[k.Pixel].height,
797
798
  keepAspectRatio: !1,
798
799
  silent: !0,
799
- unit: D.Pixel,
800
- width: this.lastAppliedSetting[D.Pixel].width
800
+ unit: k.Pixel,
801
+ width: this.lastAppliedSetting[k.Pixel].width
801
802
  } });
802
803
  else if (!n) {
803
804
  let [e, n] = t.split(":").map(Number);
804
- if (this.unit === D.Pixel) {
805
+ if (this.unit === k.Pixel) {
805
806
  let t = e, r = n;
806
- Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && ({height: r, width: t} = re(this.maxWidth, this.maxHeight, e, n)), this.emit("cx-asset-link-format-crop-change", { detail: {
807
+ Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && ({height: r, width: t} = ie(this.maxWidth, this.maxHeight, e, n)), this.emit("cx-asset-link-format-crop-change", { detail: {
807
808
  height: r,
808
809
  keepAspectRatio: !0,
809
810
  silent: !0,
810
- unit: D.Pixel,
811
+ unit: k.Pixel,
811
812
  width: t
812
813
  } });
813
814
  } else this.emit("cx-asset-link-format-crop-change", { detail: {
814
815
  height: n,
815
816
  keepAspectRatio: !0,
816
817
  silent: !0,
817
- unit: D.AspectRatio,
818
+ unit: k.AspectRatio,
818
819
  width: e
819
820
  } });
820
821
  }
@@ -828,16 +829,16 @@ var ut = class {
828
829
  this.emit("cx-asset-link-format-crop-position-change", { detail: { position: this.positionPicker.value } });
829
830
  }
830
831
  onUnitChange(e) {
831
- e.target.value === D.AspectRatio ? this.emit("cx-asset-link-format-crop-change", { detail: {
832
- height: this.lastAppliedSetting[D.AspectRatio].height,
832
+ e.target.value === k.AspectRatio ? this.emit("cx-asset-link-format-crop-change", { detail: {
833
+ height: this.lastAppliedSetting[k.AspectRatio].height,
833
834
  keepAspectRatio: this.keepAspectRatio,
834
- unit: D.AspectRatio,
835
- width: this.lastAppliedSetting[D.AspectRatio].width
835
+ unit: k.AspectRatio,
836
+ width: this.lastAppliedSetting[k.AspectRatio].width
836
837
  } }) : this.emit("cx-asset-link-format-crop-change", { detail: {
837
- height: this.lastAppliedSetting[D.Pixel].height,
838
+ height: this.lastAppliedSetting[k.Pixel].height,
838
839
  keepAspectRatio: this.keepAspectRatio,
839
- unit: D.Pixel,
840
- width: this.lastAppliedSetting[D.Pixel].width
840
+ unit: k.Pixel,
841
+ width: this.lastAppliedSetting[k.Pixel].width
841
842
  } }), this.emit("cx-asset-link-format-crop-mode-change", { detail: { mode: "free" } });
842
843
  }
843
844
  handleInputChange(e) {
@@ -859,109 +860,118 @@ var ut = class {
859
860
  }
860
861
  handleAspectRatioClick() {
861
862
  this.keepAspectRatio && this.cropMode !== "free" && this.emit("cx-asset-link-format-crop-mode-change", { detail: { mode: "free" } }), this.emit("cx-asset-link-format-crop-change", { detail: {
862
- height: this.unit === D.Pixel ? this.height : this.ratioHeight,
863
+ height: this.unit === k.Pixel ? this.height : this.ratioHeight,
863
864
  keepAspectRatio: !this.keepAspectRatio,
864
865
  unit: this.unit,
865
- width: this.unit === D.Pixel ? this.width : this.ratioWidth
866
+ width: this.unit === k.Pixel ? this.width : this.ratioWidth
866
867
  } });
867
868
  }
869
+ getSizeMaskBlocks(e) {
870
+ let t = this.unit === k.Pixel && e >= 1 ? e : Infinity;
871
+ return { num: {
872
+ autofix: !0,
873
+ mask: Number,
874
+ max: t,
875
+ min: 1,
876
+ radix: ".",
877
+ scale: 0
878
+ } };
879
+ }
868
880
  render() {
869
881
  let t = this.cropModes.filter((e) => !e.auto), n = this.cropModes.filter((e) => e.auto);
870
- return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small">${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${x(t, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}
882
+ return e`<cx-details class="details ${this.inline ? "details--inline" : ""}" ?open=${this.inline || this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small">${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${b(t, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}
871
883
  ${m(n.length > 0, () => e`<cx-divider></cx-divider><small>${this.localize.term("autoCropping")}</small>`)}
872
- ${x(n, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}<cx-space spacing="small"><div class="crop__input-group"><cx-input data-testid="cx-asset-link-format-crop-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: {
873
- mask: Number,
874
- min: 1
875
- } }} value=${this.unit === D.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-change=${this.handleInputChange} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
884
+ ${b(n, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}<cx-space spacing="small"><div class="crop__input-group"><cx-input data-testid="cx-asset-link-format-crop-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${this.getSizeMaskBlocks(this.maxWidth)} value=${this.unit === k.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-change=${this.handleInputChange} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
876
885
  W
877
- </cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-crop-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: {
878
- mask: Number,
879
- min: 1
880
- } }} value=${this.unit === D.Pixel ? this.height.toString() : this.ratioHeight.toString()} ?disabled=${this.loading} @cx-change=${this.handleInputChange} @cx-input=${this.handleHeightChange} required><cx-typography slot="prefix" variant="body3" part="input-label">
886
+ </cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-crop-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${this.getSizeMaskBlocks(this.maxHeight)} value=${this.unit === k.Pixel ? this.height.toString() : this.ratioHeight.toString()} ?disabled=${this.loading} @cx-change=${this.handleInputChange} @cx-input=${this.handleHeightChange} required><cx-typography slot="prefix" variant="body3" part="input-label">
881
887
  H
882
- </cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-unit" value=${this.unit} hoist class="crop__unit-select" ?disabled=${this.loading} @cx-change=${this.onUnitChange}><cx-option value=${D.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${D.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`)}</cx-space>${m(this.focusModes.length > 0, () => e`<cx-select data-testid="cx-asset-link-format-crop-focus-mode" value=${this.focusMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onFocusModeChange} ?disabled=${this.loading || this.selectedMode?.disabledSize}>${x(this.focusModes, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}
883
- ${m(this.showPositionPicker && this.focusMode === "manual", () => e`<cx-position-picker data-testid="cx-asset-link-format-crop-position" value=${this.position} @cx-change=${this.onPositionChange}></cx-position-picker>`)}<cx-button data-testid="cx-asset-link-format-crop-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${g({ marginLeft: "auto" })} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
888
+ </cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-crop-unit" value=${this.unit} hoist class="crop__unit-select" ?disabled=${this.loading} @cx-change=${this.onUnitChange}><cx-option value=${k.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${k.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`)}</cx-space>${m(this.focusModes.length > 0, () => e`<cx-select data-testid="cx-asset-link-format-crop-focus-mode" value=${this.focusMode} hoist style=${g({ width: "100%" })} @cx-change=${this.onFocusModeChange} ?disabled=${this.loading || this.selectedMode?.disabledSize}>${b(this.focusModes, (e) => e.value, ({ label: t, value: n }) => e`<cx-option value=${n}>${t}</cx-option>`)}</cx-select>`)}
889
+ ${m(this.showPositionPicker && this.focusMode === "manual", () => e`<cx-position-picker data-testid="cx-asset-link-format-crop-position" value=${this.position} @cx-change=${this.onPositionChange}></cx-position-picker>`)}
890
+ ${m(!this.inline, () => e`<cx-button data-testid="cx-asset-link-format-crop-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${g({ marginLeft: "auto" })} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space></cx-details>`;
884
891
  }
885
892
  };
886
- a([c(".details"), o("design:type", E === void 0 ? Object : E)], K.prototype, "base", void 0), a([c("cx-position-picker"), o("design:type", j === void 0 ? Object : j)], K.prototype, "positionPicker", void 0), a([r({
893
+ a([c(".details"), o("design:type", T === void 0 ? Object : T)], H.prototype, "base", void 0), a([c("cx-position-picker"), o("design:type", Oe === void 0 ? Object : Oe)], H.prototype, "positionPicker", void 0), a([r({
894
+ reflect: !0,
895
+ type: Boolean
896
+ }), o("design:type", Boolean)], H.prototype, "open", void 0), a([r({
887
897
  reflect: !0,
888
898
  type: Boolean
889
- }), o("design:type", Boolean)], K.prototype, "open", void 0), a([r({
899
+ }), o("design:type", Boolean)], H.prototype, "inline", void 0), a([r({
890
900
  reflect: !0,
891
901
  type: Number
892
- }), o("design:type", Number)], K.prototype, "width", void 0), a([r({
902
+ }), o("design:type", Number)], H.prototype, "width", void 0), a([r({
893
903
  reflect: !0,
894
904
  type: Number
895
- }), o("design:type", Number)], K.prototype, "height", void 0), a([r({
905
+ }), o("design:type", Number)], H.prototype, "height", void 0), a([r({
896
906
  attribute: "max-width",
897
907
  reflect: !0,
898
908
  type: Number
899
- }), o("design:type", Number)], K.prototype, "maxWidth", void 0), a([r({
909
+ }), o("design:type", Number)], H.prototype, "maxWidth", void 0), a([r({
900
910
  attribute: "max-height",
901
911
  reflect: !0,
902
912
  type: Number
903
- }), o("design:type", Number)], K.prototype, "maxHeight", void 0), a([r({
913
+ }), o("design:type", Number)], H.prototype, "maxHeight", void 0), a([r({
904
914
  attribute: "ratio-width",
905
915
  reflect: !0,
906
916
  type: Number
907
- }), o("design:type", Number)], K.prototype, "ratioWidth", void 0), a([r({
917
+ }), o("design:type", Number)], H.prototype, "ratioWidth", void 0), a([r({
908
918
  attribute: "ratio-height",
909
919
  reflect: !0,
910
920
  type: Number
911
- }), o("design:type", Number)], K.prototype, "ratioHeight", void 0), a([r({
921
+ }), o("design:type", Number)], H.prototype, "ratioHeight", void 0), a([r({
912
922
  attribute: "percentage-width",
913
923
  reflect: !0,
914
924
  type: Number
915
- }), o("design:type", Number)], K.prototype, "percentageWidth", void 0), a([r({
925
+ }), o("design:type", Number)], H.prototype, "percentageWidth", void 0), a([r({
916
926
  attribute: "percentage-height",
917
927
  reflect: !0,
918
928
  type: Number
919
- }), o("design:type", Number)], K.prototype, "percentageHeight", void 0), a([r({
929
+ }), o("design:type", Number)], H.prototype, "percentageHeight", void 0), a([r({
920
930
  reflect: !0,
921
931
  type: String
922
- }), o("design:type", D === void 0 ? Object : D)], K.prototype, "unit", void 0), a([r({
932
+ }), o("design:type", k === void 0 ? Object : k)], H.prototype, "unit", void 0), a([r({
923
933
  attribute: "disabled-apply",
924
934
  reflect: !0,
925
935
  type: Boolean
926
- }), o("design:type", Boolean)], K.prototype, "disabledApply", void 0), a([r({
936
+ }), o("design:type", Boolean)], H.prototype, "disabledApply", void 0), a([r({
927
937
  attribute: "no-ratio-modes",
928
938
  reflect: !0,
929
939
  type: Boolean
930
- }), o("design:type", Boolean)], K.prototype, "noRatioModes", void 0), a([r({
940
+ }), o("design:type", Boolean)], H.prototype, "noRatioModes", void 0), a([r({
931
941
  attribute: "show-position-picker",
932
942
  reflect: !0,
933
943
  type: Boolean
934
- }), o("design:type", Boolean)], K.prototype, "showPositionPicker", void 0), a([r({
944
+ }), o("design:type", Boolean)], H.prototype, "showPositionPicker", void 0), a([r({
935
945
  attribute: "last-applied-setting",
936
946
  reflect: !1,
937
947
  type: Object
938
- }), o("design:type", typeof Record > "u" ? Object : Record)], K.prototype, "lastAppliedSetting", void 0), a([r({
948
+ }), o("design:type", typeof Record > "u" ? Object : Record)], H.prototype, "lastAppliedSetting", void 0), a([r({
939
949
  reflect: !0,
940
950
  type: Boolean
941
- }), o("design:type", Boolean)], K.prototype, "loading", void 0), a([r({
951
+ }), o("design:type", Boolean)], H.prototype, "loading", void 0), a([r({
942
952
  attribute: "crop-modes",
943
953
  reflect: !1,
944
954
  type: Array
945
- }), o("design:type", Array)], K.prototype, "cropModes", void 0), a([r({
955
+ }), o("design:type", Array)], H.prototype, "cropModes", void 0), a([r({
946
956
  attribute: "focus-modes",
947
957
  reflect: !1,
948
958
  type: Object
949
- }), o("design:type", Array)], K.prototype, "focusModes", void 0), a([r({
959
+ }), o("design:type", Array)], H.prototype, "focusModes", void 0), a([r({
950
960
  attribute: "focus-mode",
951
961
  reflect: !0,
952
962
  type: String
953
- }), o("design:type", String)], K.prototype, "focusMode", void 0), a([r({
963
+ }), o("design:type", String)], H.prototype, "focusMode", void 0), a([r({
954
964
  attribute: "crop-mode",
955
965
  reflect: !0,
956
966
  type: String
957
- }), o("design:type", String)], K.prototype, "cropMode", void 0), a([r({
967
+ }), o("design:type", String)], H.prototype, "cropMode", void 0), a([r({
958
968
  reflect: !0,
959
969
  type: String
960
- }), o("design:type", v === void 0 ? Object : v)], K.prototype, "position", void 0), a([r({
970
+ }), o("design:type", v === void 0 ? Object : v)], H.prototype, "position", void 0), a([r({
961
971
  attribute: "keep-aspect-ratio",
962
972
  reflect: !0,
963
973
  type: Boolean
964
- }), o("design:type", Boolean)], K.prototype, "keepAspectRatio", void 0), a([i(), o("design:type", Boolean)], K.prototype, "invalidWidth", void 0), a([i(), o("design:type", Boolean)], K.prototype, "invalidHeight", void 0), a([i(), o("design:type", Number)], K.prototype, "aspectRatio", void 0), a([
974
+ }), o("design:type", Boolean)], H.prototype, "keepAspectRatio", void 0), a([i(), o("design:type", Boolean)], H.prototype, "invalidWidth", void 0), a([i(), o("design:type", Boolean)], H.prototype, "invalidHeight", void 0), a([i(), o("design:type", Number)], H.prototype, "aspectRatio", void 0), a([
965
975
  f("cropMode", { waitUntilFirstUpdate: !0 }),
966
976
  f("maxWidth", { waitUntilFirstUpdate: !0 }),
967
977
  f("maxHeight", { waitUntilFirstUpdate: !0 }),
@@ -969,55 +979,225 @@ a([c(".details"), o("design:type", E === void 0 ? Object : E)], K.prototype, "ba
969
979
  o("design:type", Function),
970
980
  o("design:paramtypes", []),
971
981
  o("design:returntype", Promise)
972
- ], K.prototype, "handleCropModeChange", null), a([
982
+ ], H.prototype, "handleCropModeChange", null), a([
973
983
  f("open", { waitUntilFirstUpdate: !0 }),
974
984
  o("design:type", Function),
975
985
  o("design:paramtypes", []),
976
986
  o("design:returntype", Promise)
977
- ], K.prototype, "handleOpenChange", null), K = a([u("cx-asset-link-format-crop")], K);
978
- var pt = K, mt = t`.extension{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border:solid 1px var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-0);& cx-select{flex:1;width:100%}}`, q = class extends s {
987
+ ], H.prototype, "handleOpenChange", null), H = a([u("cx-asset-link-format-crop")], H);
988
+ var Et = H, Dt = t`:host{display:block}.asset-link-format__dimensions-select{width:100%}.details::part(base){border-bottom-width:0}.asset-link-format__dimensions-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__dimensions-inline .asset-link-format__dimensions-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__dimensions-custom{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,7rem);align-items:center;display:grid}.asset-link-format__dimensions-custom cx-input,.asset-link-format__dimensions-custom cx-select{min-width:0}.asset-link-format__dimensions-apply{margin-inline-start:auto}`, Ot = {
989
+ [A.Percent]: { num: {
990
+ mask: Number,
991
+ min: 1,
992
+ radix: ".",
993
+ scale: 2
994
+ } },
995
+ [A.Pixel]: { num: {
996
+ mask: Number,
997
+ min: 1,
998
+ radix: ".",
999
+ scale: 0
1000
+ } }
1001
+ }, U = class extends s {
1002
+ constructor(...e) {
1003
+ super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior = N.Legacy, this.loading = !1, this.items = [], this.canCustom = !1, this.customDimensionsUnit = A.Pixel, this.dimensionsSelection = "", this.customDimensionsDrafts = {
1004
+ [A.Percent]: {
1005
+ height: "100",
1006
+ width: "100"
1007
+ },
1008
+ [A.Pixel]: {
1009
+ height: "1080",
1010
+ width: "1920"
1011
+ }
1012
+ };
1013
+ }
1014
+ static #e = this.styles = [l, Dt];
1015
+ static #t = this.dependencies = {
1016
+ "cx-button": _,
1017
+ "cx-details": T,
1018
+ "cx-divider": E,
1019
+ "cx-icon": h,
1020
+ "cx-input": se,
1021
+ "cx-menu-label": _e,
1022
+ "cx-option": x,
1023
+ "cx-select": C,
1024
+ "cx-space": S,
1025
+ "cx-typography": y
1026
+ };
1027
+ handleDimensionsValueChange() {
1028
+ let e = this.value;
1029
+ this.dimensionsSelection = e?.mode === D.Custom ? D.Custom : e?.mode === D.Preset ? `preset:${e.value}` : "", e?.mode === D.Custom && (this.customDimensionsUnit = e.unit, this.customDimensionsDrafts = {
1030
+ ...this.customDimensionsDrafts,
1031
+ [e.unit]: {
1032
+ height: String(e.height),
1033
+ width: String(e.width)
1034
+ }
1035
+ });
1036
+ }
1037
+ emitDimensionsValue(e) {
1038
+ this.value = e, this.emit("cx-asset-link-format-dimensions-change", { detail: { ...e } });
1039
+ }
1040
+ getCustomDimensionsValue() {
1041
+ let e = this.customDimensionsUnit, t = this.customDimensionsDrafts[e], n = Number(t.width), r = Number(t.height);
1042
+ if (!(!Number.isFinite(n) || !Number.isFinite(r) || n < 1 || r < 1) && (e !== A.Pixel || Number.isInteger(n) && Number.isInteger(r))) return {
1043
+ height: r,
1044
+ mode: D.Custom,
1045
+ unit: e,
1046
+ width: n
1047
+ };
1048
+ }
1049
+ get pendingValue() {
1050
+ if (this.dimensionsSelection === D.Custom) return this.getCustomDimensionsValue();
1051
+ if (this.dimensionsSelection.startsWith("preset:")) {
1052
+ let e = this.items.find((e) => `preset:${e.value}` === this.dimensionsSelection && !e.disabled);
1053
+ return e ? {
1054
+ mode: D.Preset,
1055
+ value: e.value
1056
+ } : void 0;
1057
+ }
1058
+ }
1059
+ get applyDisabled() {
1060
+ let e = this.pendingValue;
1061
+ return !e || !this.value || e.mode !== this.value.mode ? !e : e.mode === D.Preset && this.value.mode === D.Preset ? e.value === this.value.value : e.mode === D.Custom && this.value.mode === D.Custom && e.height === this.value.height && e.unit === this.value.unit && e.width === this.value.width;
1062
+ }
1063
+ applyPendingValue() {
1064
+ let e = this.pendingValue;
1065
+ e && this.emitDimensionsValue(e);
1066
+ }
1067
+ onDimensionsSelectChange(e) {
1068
+ if (e.target !== e.currentTarget || this.loading) return;
1069
+ let t = e.currentTarget.value;
1070
+ if (t === D.Custom && this.canCustom) this.dimensionsSelection = D.Custom, this.applyBehavior !== N.Manual && this.applyPendingValue();
1071
+ else if (t.startsWith("preset:")) {
1072
+ let e = this.items.find((e) => `preset:${e.value}` === t && !e.disabled);
1073
+ e && (this.dimensionsSelection = t, this.applyBehavior !== N.Manual && this.emitDimensionsValue({
1074
+ mode: D.Preset,
1075
+ value: e.value
1076
+ }));
1077
+ }
1078
+ }
1079
+ onDimensionsInput(e) {
1080
+ if (e.target !== e.currentTarget || this.loading || !this.canCustom) return;
1081
+ let t = e.currentTarget, n = t.name === "height" ? "height" : "width", r = this.customDimensionsUnit;
1082
+ this.customDimensionsDrafts = {
1083
+ ...this.customDimensionsDrafts,
1084
+ [r]: {
1085
+ ...this.customDimensionsDrafts[r],
1086
+ [n]: t.value
1087
+ }
1088
+ };
1089
+ }
1090
+ onDimensionsCustomChange(e) {
1091
+ e.target === e.currentTarget && !this.loading && this.canCustom && e.currentTarget.reportValidity() && this.applyBehavior !== N.Manual && this.applyPendingValue();
1092
+ }
1093
+ onDimensionsUnitChange(e) {
1094
+ if (e.target !== e.currentTarget || this.loading || !this.canCustom) return;
1095
+ let t = e.currentTarget.value;
1096
+ (t === A.Pixel || t === A.Percent) && (this.customDimensionsUnit = t, this.applyBehavior !== N.Manual && this.applyPendingValue());
1097
+ }
1098
+ onApply() {
1099
+ !this.loading && !this.applyDisabled && this.applyPendingValue();
1100
+ }
1101
+ onDimensionsShow(e) {
1102
+ e.target !== e.currentTarget && e.stopPropagation();
1103
+ }
1104
+ onDimensionsHide(e) {
1105
+ e.target !== e.currentTarget && e.stopPropagation();
1106
+ }
1107
+ renderCustomDimensions() {
1108
+ let t = this.customDimensionsUnit, n = this.customDimensionsDrafts[t];
1109
+ return e`<cx-space class="asset-link-format__dimensions-custom" spacing="small"><cx-input name="width" mask="num" .maskBlocks=${Ot[t]} aria-label=${this.localize.term("maxWidth")} value=${n.width} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">W</cx-typography></cx-input><cx-input name="height" mask="num" .maskBlocks=${Ot[t]} aria-label=${this.localize.term("maxHeight")} value=${n.height} ?disabled=${this.loading} @cx-input=${this.onDimensionsInput} @cx-change=${this.onDimensionsCustomChange}><cx-typography slot="prefix" variant="body3" part="input-label">H</cx-typography></cx-input><cx-select data-label=${this.localize.term("unit")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsUnitChange}><cx-option value=${A.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${A.Percent}>${this.localize.term("dimensionsPercent")}</cx-option></cx-select></cx-space>`;
1110
+ }
1111
+ renderSummary() {
1112
+ return e`<cx-space class="asset-link-format__dimensions-summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("dimensions")}</cx-typography></cx-space>`;
1113
+ }
1114
+ renderContent() {
1115
+ let t = this.canCustom && this.dimensionsSelection === D.Custom;
1116
+ return e`<cx-space class="asset-link-format__dimensions-content" direction="vertical" spacing="small"><cx-select class="asset-link-format__dimensions-select" data-label=${this.localize.term("dimensions")} value=${this.dimensionsSelection === D.Custom && !this.canCustom ? "" : this.dimensionsSelection} ?disabled=${this.loading} hoist @cx-change=${this.onDimensionsSelectChange}>${b(this.items, (e) => e.value, (t, n) => e`
1117
+ ${m(t.group !== this.items[n - 1]?.group, () => e`
1118
+ ${m(n > 0, () => e`<cx-divider></cx-divider>`)}
1119
+ ${m(!!t.group, () => e`<cx-menu-label>${t.group}</cx-menu-label>`)}
1120
+ `)}<cx-option value=${`preset:${t.value}`} ?disabled=${t.disabled}>${t.label}</cx-option>`)}
1121
+ ${m(this.canCustom, () => e`
1122
+ ${m(this.items.length > 0, () => e`<cx-divider></cx-divider>`)}<cx-option value=${D.Custom}><cx-icon slot="prefix" name="edit"></cx-icon>${this.localize.term("custom")}</cx-option>`)}</cx-select>${m(t, () => this.renderCustomDimensions())}
1123
+ ${m(this.applyBehavior === N.Manual, () => e`<cx-button class="asset-link-format__dimensions-apply" data-testid="cx-asset-link-format-dimensions-apply" variant="primary" ?disabled=${this.applyDisabled} ?loading=${this.loading} @click=${this.onApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space>`;
1124
+ }
1125
+ render() {
1126
+ return this.inline ? e`<div class="asset-link-format__dimensions-inline">${this.renderSummary()}
1127
+ ${this.renderContent()}</div>` : e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onDimensionsShow} @cx-hide=${this.onDimensionsHide}><div slot="summary">${this.renderSummary()}</div>${this.renderContent()}</cx-details>`;
1128
+ }
1129
+ };
1130
+ a([r({
1131
+ reflect: !0,
1132
+ type: Boolean
1133
+ }), o("design:type", Object)], U.prototype, "open", void 0), a([r({
1134
+ reflect: !0,
1135
+ type: Boolean
1136
+ }), o("design:type", Object)], U.prototype, "inline", void 0), a([r({
1137
+ attribute: "apply-behavior",
1138
+ reflect: !0,
1139
+ type: String
1140
+ }), o("design:type", Object)], U.prototype, "applyBehavior", void 0), a([r({
1141
+ reflect: !0,
1142
+ type: Boolean
1143
+ }), o("design:type", Object)], U.prototype, "loading", void 0), a([r({
1144
+ attribute: !1,
1145
+ type: Array
1146
+ }), o("design:type", Array)], U.prototype, "items", void 0), a([r({
1147
+ attribute: "can-custom",
1148
+ type: Boolean
1149
+ }), o("design:type", Object)], U.prototype, "canCustom", void 0), a([r({
1150
+ attribute: !1,
1151
+ type: Object
1152
+ }), o("design:type", Object)], U.prototype, "value", void 0), a([i(), o("design:type", Object)], U.prototype, "customDimensionsUnit", void 0), a([i(), o("design:type", Object)], U.prototype, "dimensionsSelection", void 0), a([i(), o("design:type", Object)], U.prototype, "customDimensionsDrafts", void 0), a([
1153
+ f("value"),
1154
+ o("design:type", Function),
1155
+ o("design:paramtypes", []),
1156
+ o("design:returntype", void 0)
1157
+ ], U.prototype, "handleDimensionsValueChange", null), U = a([u("cx-asset-link-format-dimensions")], U);
1158
+ var kt = U, At = t`.extension{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border:solid 1px var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-0);& cx-select{flex:1;width:100%}}`, W = class extends s {
979
1159
  constructor(...e) {
980
1160
  super(...e), this.localize = new d(this), this.value = "", this.items = [];
981
1161
  }
982
- static #e = this.styles = [l, mt];
1162
+ static #e = this.styles = [l, At];
983
1163
  static #t = this.dependencies = {
984
- "cx-option": S,
985
- "cx-select": w,
986
- "cx-space": C,
987
- "cx-typography": b
1164
+ "cx-option": x,
1165
+ "cx-select": C,
1166
+ "cx-space": S,
1167
+ "cx-typography": y
988
1168
  };
989
1169
  handleExtensionChange(e) {
990
1170
  let t = e.target.value;
991
1171
  this.emit("cx-asset-link-format-extension-change", { detail: t });
992
1172
  }
993
1173
  render() {
994
- return e`<cx-space direction="vertical" spacing="small" class="extension"><cx-typography variant="body2">${this.localize.term("extension")}</cx-typography><cx-select data-label=${this.localize.term("extension")} data-testid="cx-asset-link-format-extension-select" value=${this.value} hoist @cx-change=${this.handleExtensionChange}>${x(this.items, (e) => e.value, (t) => e`<cx-option value=${t.value}>${t.displayName}</cx-option>`)}</cx-select></cx-space>`;
1174
+ return e`<cx-space direction="vertical" spacing="small" class="extension"><cx-typography variant="body2">${this.localize.term("extension")}</cx-typography><cx-select data-label=${this.localize.term("extension")} data-testid="cx-asset-link-format-extension-select" value=${this.value} hoist @cx-change=${this.handleExtensionChange}>${b(this.items, (e) => e.value, (t) => e`<cx-option value=${t.value}>${t.displayName}</cx-option>`)}</cx-select></cx-space>`;
995
1175
  }
996
1176
  };
997
1177
  a([r({
998
1178
  reflect: !0,
999
1179
  type: String
1000
- }), o("design:type", String)], q.prototype, "value", void 0), a([r({
1180
+ }), o("design:type", String)], W.prototype, "value", void 0), a([r({
1001
1181
  reflect: !1,
1002
1182
  type: Array
1003
- }), o("design:type", typeof Array > "u" ? Object : Array)], q.prototype, "items", void 0), q = a([u("cx-asset-link-format-extension")], q);
1004
- var ht = q, gt = t`cx-details::part(base){border-bottom-width:0}`, _t = "auto", J = class extends s {
1183
+ }), o("design:type", typeof Array > "u" ? Object : Array)], W.prototype, "items", void 0), W = a([u("cx-asset-link-format-extension")], W);
1184
+ var jt = W, Mt = t`cx-details::part(base){border-bottom-width:0}`, Nt = "auto", G = class extends s {
1005
1185
  constructor(...e) {
1006
1186
  super(...e), this.localize = new d(this), this.open = !1, this.value = "", this.items = [], this.canAutoFormat = !1, this.autoFormat = !1, this.loading = !1, this.scopedValue = "";
1007
1187
  }
1008
- static #e = this.styles = [l, gt];
1188
+ static #e = this.styles = [l, Mt];
1009
1189
  static #t = this.dependencies = {
1010
1190
  "cx-button": _,
1011
- "cx-details": E,
1012
- "cx-divider": me,
1191
+ "cx-details": T,
1192
+ "cx-divider": E,
1013
1193
  "cx-icon": h,
1014
- "cx-option": S,
1015
- "cx-select": w,
1016
- "cx-space": C,
1017
- "cx-typography": b
1194
+ "cx-option": x,
1195
+ "cx-select": C,
1196
+ "cx-space": S,
1197
+ "cx-typography": y
1018
1198
  };
1019
1199
  get committedValue() {
1020
- return this.autoFormat ? _t : this.value;
1200
+ return this.autoFormat ? Nt : this.value;
1021
1201
  }
1022
1202
  handleValueChange() {
1023
1203
  this.scopedValue = this.committedValue;
@@ -1048,68 +1228,81 @@ var ht = q, gt = t`cx-details::part(base){border-bottom-width:0}`, _t = "auto",
1048
1228
  e.target !== this.base && e.stopPropagation();
1049
1229
  }
1050
1230
  render() {
1051
- return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("format")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small" class="format"><cx-select data-label=${this.localize.term("imageFormat")} data-testid="cx-asset-link-format-proxy-select" value=${this.scopedValue} hoist @cx-change=${this.handleProxyChange} ?disabled=${this.loading}>${x(this.items, (e) => e.id, (t) => e`<cx-option value=${t.id}>${t.proxyLabel}</cx-option>`)}
1052
- ${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${_t}>${this.localize.term("auto")}</cx-option>`, () => n)}</cx-select><cx-button data-testid="cx-asset-link-format-proxy-apply" variant="primary" style=${g({ "margin-left": "auto" })} ?disabled=${this.scopedValue === this.committedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
1231
+ return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("format")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small" class="format"><cx-select data-label=${this.localize.term("imageFormat")} data-testid="cx-asset-link-format-proxy-select" value=${this.scopedValue} hoist @cx-change=${this.handleProxyChange} ?disabled=${this.loading}>${b(this.items, (e) => e.id, (t) => e`<cx-option value=${t.id}>${t.proxyLabel}</cx-option>`)}
1232
+ ${m(this.canAutoFormat, () => e`<cx-divider></cx-divider><cx-option data-testid="cx-asset-link-format-proxy-auto-option" value=${Nt}>${this.localize.term("auto")}</cx-option>`, () => n)}</cx-select><cx-button data-testid="cx-asset-link-format-proxy-apply" variant="primary" style=${g({ "margin-left": "auto" })} ?disabled=${this.scopedValue === this.committedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
1053
1233
  }
1054
1234
  };
1055
- a([c(".details"), o("design:type", E === void 0 ? Object : E)], J.prototype, "base", void 0), a([r({
1235
+ a([c(".details"), o("design:type", T === void 0 ? Object : T)], G.prototype, "base", void 0), a([r({
1056
1236
  reflect: !0,
1057
1237
  type: Boolean
1058
- }), o("design:type", Object)], J.prototype, "open", void 0), a([r({
1238
+ }), o("design:type", Object)], G.prototype, "open", void 0), a([r({
1059
1239
  reflect: !0,
1060
1240
  type: String
1061
- }), o("design:type", Object)], J.prototype, "value", void 0), a([r({
1241
+ }), o("design:type", Object)], G.prototype, "value", void 0), a([r({
1062
1242
  reflect: !1,
1063
1243
  type: Array
1064
- }), o("design:type", Array)], J.prototype, "items", void 0), a([r({
1244
+ }), o("design:type", Array)], G.prototype, "items", void 0), a([r({
1065
1245
  attribute: "can-auto-format",
1066
1246
  reflect: !0,
1067
1247
  type: Boolean
1068
- }), o("design:type", Object)], J.prototype, "canAutoFormat", void 0), a([r({
1248
+ }), o("design:type", Object)], G.prototype, "canAutoFormat", void 0), a([r({
1069
1249
  attribute: "auto-format",
1070
1250
  reflect: !0,
1071
1251
  type: Boolean
1072
- }), o("design:type", Object)], J.prototype, "autoFormat", void 0), a([r({
1252
+ }), o("design:type", Object)], G.prototype, "autoFormat", void 0), a([r({
1073
1253
  reflect: !0,
1074
1254
  type: Boolean
1075
- }), o("design:type", Object)], J.prototype, "loading", void 0), a([i(), o("design:type", Object)], J.prototype, "scopedValue", void 0), a([
1255
+ }), o("design:type", Object)], G.prototype, "loading", void 0), a([i(), o("design:type", Object)], G.prototype, "scopedValue", void 0), a([
1076
1256
  f("autoFormat"),
1077
1257
  f("value"),
1078
1258
  o("design:type", Function),
1079
1259
  o("design:paramtypes", []),
1080
1260
  o("design:returntype", void 0)
1081
- ], J.prototype, "handleValueChange", null), a([
1261
+ ], G.prototype, "handleValueChange", null), a([
1082
1262
  f("open", { waitUntilFirstUpdate: !0 }),
1083
1263
  o("design:type", Function),
1084
1264
  o("design:paramtypes", []),
1085
1265
  o("design:returntype", void 0)
1086
- ], J.prototype, "handleOpenChange", null), J = a([u("cx-asset-link-format-proxy")], J);
1087
- var vt = J, yt = t`cx-details::part(base){border-bottom-width:0}`, Y = class extends s {
1266
+ ], G.prototype, "handleOpenChange", null), G = a([u("cx-asset-link-format-proxy")], G);
1267
+ var Pt = G, Ft = t`cx-details::part(base){border-bottom-width:0}.asset-link-format__quality-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__quality-inline .asset-link-format__quality-summary{margin-block-end:var(--cx-spacing-small)}.asset-link-format__quality-apply{margin-inline-start:auto}`, K = class extends s {
1088
1268
  constructor(...e) {
1089
- super(...e), this.localize = new d(this), this.open = !1, this.value = 100, this.loading = !1, this.scopedValue = 100;
1269
+ super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.applyBehavior = N.Legacy, this.value = 100, this.items = [], this.customSelected = !1, this.loading = !1, this.scopedValue = 100;
1090
1270
  }
1091
- static #e = this.styles = [l, yt];
1271
+ static #e = this.styles = [l, Ft];
1092
1272
  static #t = this.dependencies = {
1093
1273
  "cx-button": _,
1094
- "cx-details": E,
1274
+ "cx-details": T,
1275
+ "cx-divider": E,
1095
1276
  "cx-icon": h,
1096
- "cx-input": oe,
1097
- "cx-space": C,
1277
+ "cx-input": se,
1278
+ "cx-option": x,
1279
+ "cx-select": C,
1280
+ "cx-space": S,
1098
1281
  "cx-tooltip": te,
1099
- "cx-typography": b
1282
+ "cx-typography": y
1100
1283
  };
1101
1284
  get invalidValue() {
1102
1285
  return isNaN(Number(this.scopedValue)) || Number(this.scopedValue) < 1 || Number(this.scopedValue) > 100 || this.value === this.scopedValue;
1103
1286
  }
1104
1287
  handleValueChange() {
1105
- this.scopedValue = this.value;
1288
+ this.scopedValue = this.value, this.customSelected = !1;
1289
+ }
1290
+ handlePresetChange(e) {
1291
+ if (e.target !== e.currentTarget || this.loading) return;
1292
+ let t = e.currentTarget.value;
1293
+ if (this.customSelected = t === "custom", this.customSelected) return;
1294
+ let n = this.items.find((e) => String(e.value) === t && !e.disabled);
1295
+ !n || !Number.isFinite(n.value) || n.value < 1 || n.value > 100 || (this.scopedValue = n.value, n.value !== this.value && this.applyBehavior !== N.Manual && this.handleApply());
1106
1296
  }
1107
1297
  handleQualityChange(e) {
1108
1298
  let t = e.target.value;
1109
- this.scopedValue = Number(t);
1299
+ this.customSelected = !0, this.scopedValue = Number(t);
1300
+ }
1301
+ handleQualityCommit(e) {
1302
+ e.target === e.currentTarget && this.applyBehavior === N.Automatic && this.handleApply();
1110
1303
  }
1111
1304
  handleApply() {
1112
- this.loading || this.emit("cx-asset-link-format-quality-change", { detail: Number(this.scopedValue) });
1305
+ this.loading || this.invalidValue || this.emit("cx-asset-link-format-quality-change", { detail: Number(this.scopedValue) });
1113
1306
  }
1114
1307
  onShowDetails(e) {
1115
1308
  e.target !== this.base && e.stopPropagation();
@@ -1117,53 +1310,83 @@ var vt = J, yt = t`cx-details::part(base){border-bottom-width:0}`, Y = class ext
1117
1310
  onHideDetails(e) {
1118
1311
  e.target !== this.base && e.stopPropagation();
1119
1312
  }
1120
- render() {
1121
- return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="blur_on"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("quality")}</cx-typography></cx-space><cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-quality-tooltip" content=${this.localize.term("qualityHelpText")} hoist><cx-input data-testid="cx-asset-link-format-quality" class="details__checkbox" mask="num" .maskBlocks=${{ num: {
1313
+ renderPresets() {
1314
+ let t = !this.customSelected && this.items.some((e) => e.value === this.scopedValue) ? String(this.scopedValue) : "custom";
1315
+ return e`<cx-select data-label=${this.localize.term("quality")} value=${t} ?disabled=${this.loading} hoist @cx-change=${this.handlePresetChange}>${b(this.items, (e) => e.value, (t) => e`<cx-option value=${String(t.value)} ?disabled=${t.disabled}>${t.label}
1316
+ ${m(!!t.description, () => e`<span slot="help-text">${t.description}</span>`)}</cx-option>`)}<cx-divider></cx-divider><cx-option value="custom"><cx-icon slot="prefix" name="edit"></cx-icon>${this.localize.term("custom")}<span slot="help-text">${this.localize.term("qualityHelpText")}</span></cx-option></cx-select>`;
1317
+ }
1318
+ renderSummary() {
1319
+ return e`<cx-space class="asset-link-format__quality-summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="blur_on"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("quality")}</cx-typography></cx-space>`;
1320
+ }
1321
+ renderApplyButton() {
1322
+ return e`<cx-button class="asset-link-format__quality-apply" data-testid="cx-asset-link-format-quality-apply" variant="primary" ?disabled=${this.invalidValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button>`;
1323
+ }
1324
+ renderContent() {
1325
+ let t = this.items.length === 0 || this.customSelected || !this.items.some((e) => e.value === this.scopedValue);
1326
+ return e`<cx-space class="asset-link-format__quality-content" direction="vertical" spacing="small">${m(this.items.length > 0, () => this.renderPresets())}
1327
+ ${m(t, () => e`<cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-quality-tooltip" content=${this.localize.term("qualityHelpText")} hoist><cx-input data-testid="cx-asset-link-format-quality" class="details__checkbox" mask="num" .maskBlocks=${{ num: {
1122
1328
  mask: Number,
1123
1329
  max: 100,
1124
- min: 1
1125
- } }} value=${this.scopedValue.toString()} style=${g({ flex: "1" })} @cx-input=${this.handleQualityChange}></cx-input></cx-tooltip><cx-button data-testid="cx-asset-link-format-quality-apply" variant="primary" ?disabled=${this.invalidValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
1330
+ min: 1,
1331
+ radix: ".",
1332
+ scale: 0
1333
+ } }} value=${this.scopedValue.toString()} style=${g({ flex: "1" })} @cx-input=${this.handleQualityChange} @cx-change=${this.handleQualityCommit}></cx-input></cx-tooltip>${m(this.applyBehavior === N.Legacy, () => this.renderApplyButton())}</cx-space>`)}
1334
+ ${m(this.applyBehavior === N.Manual, () => this.renderApplyButton())}</cx-space>`;
1335
+ }
1336
+ render() {
1337
+ return this.inline ? e`<div class="asset-link-format__quality-inline">${this.renderSummary()}
1338
+ ${this.renderContent()}</div>` : e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><div slot="summary">${this.renderSummary()}</div>${this.renderContent()}</cx-details>`;
1126
1339
  }
1127
1340
  };
1128
- a([c(".details"), o("design:type", E === void 0 ? Object : E)], Y.prototype, "base", void 0), a([r({
1341
+ a([c(".details"), o("design:type", T === void 0 ? Object : T)], K.prototype, "base", void 0), a([r({
1129
1342
  reflect: !0,
1130
1343
  type: Boolean
1131
- }), o("design:type", Object)], Y.prototype, "open", void 0), a([r({
1344
+ }), o("design:type", Object)], K.prototype, "open", void 0), a([r({
1345
+ reflect: !0,
1346
+ type: Boolean
1347
+ }), o("design:type", Object)], K.prototype, "inline", void 0), a([r({
1348
+ attribute: "apply-behavior",
1349
+ reflect: !0,
1350
+ type: String
1351
+ }), o("design:type", Object)], K.prototype, "applyBehavior", void 0), a([r({
1132
1352
  reflect: !0,
1133
1353
  type: Number
1134
- }), o("design:type", Object)], Y.prototype, "value", void 0), a([r({
1354
+ }), o("design:type", Object)], K.prototype, "value", void 0), a([r({
1355
+ attribute: !1,
1356
+ type: Array
1357
+ }), o("design:type", Array)], K.prototype, "items", void 0), a([i(), o("design:type", Object)], K.prototype, "customSelected", void 0), a([r({
1135
1358
  reflect: !0,
1136
1359
  type: Boolean
1137
- }), o("design:type", Object)], Y.prototype, "loading", void 0), a([i(), o("design:type", Object)], Y.prototype, "scopedValue", void 0), a([
1360
+ }), o("design:type", Object)], K.prototype, "loading", void 0), a([i(), o("design:type", Object)], K.prototype, "scopedValue", void 0), a([
1138
1361
  f("value"),
1139
1362
  o("design:type", Function),
1140
1363
  o("design:paramtypes", []),
1141
1364
  o("design:returntype", void 0)
1142
- ], Y.prototype, "handleValueChange", null), Y = a([u("cx-asset-link-format-quality")], Y);
1143
- var bt = Y, xt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.resize__unit-select{width:120px}.resize__input-group{flex:1;display:flex}`, X = class extends s {
1365
+ ], K.prototype, "handleValueChange", null), K = a([u("cx-asset-link-format-quality")], K);
1366
+ var It = K, Lt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.resize__unit-select{width:120px}.resize__input-group{flex:1;display:flex}`, q = class extends s {
1144
1367
  constructor(...e) {
1145
- super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit = D.Pixel, this.lastAppliedSetting = {
1146
- [D.Pixel]: {
1368
+ super(...e), this.localize = new d(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit = k.Pixel, this.lastAppliedSetting = {
1369
+ [k.Pixel]: {
1147
1370
  height: 0,
1148
1371
  width: 0
1149
1372
  },
1150
- [D.AspectRatio]: {
1373
+ [k.AspectRatio]: {
1151
1374
  height: 1,
1152
1375
  width: 1
1153
1376
  }
1154
1377
  }, this.loading = !1, this.noRatioModes = !1, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
1155
1378
  }
1156
- static #e = this.styles = [l, xt];
1379
+ static #e = this.styles = [l, Lt];
1157
1380
  static #t = this.dependencies = {
1158
1381
  "cx-button": _,
1159
- "cx-details": E,
1382
+ "cx-details": T,
1160
1383
  "cx-icon": h,
1161
1384
  "cx-icon-button": p,
1162
- "cx-input": oe,
1163
- "cx-option": S,
1164
- "cx-select": w,
1165
- "cx-space": C,
1166
- "cx-typography": b
1385
+ "cx-input": se,
1386
+ "cx-option": x,
1387
+ "cx-select": C,
1388
+ "cx-space": S,
1389
+ "cx-typography": y
1167
1390
  };
1168
1391
  get disabledApply() {
1169
1392
  return this.lastAppliedSetting[this.unit].width === this.width && this.lastAppliedSetting[this.unit].height === this.height;
@@ -1171,11 +1394,11 @@ var bt = Y, xt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
1171
1394
  async handleCropModeChange() {
1172
1395
  let e = Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && this.maxWidth > 0 && this.maxHeight > 0;
1173
1396
  if (this.keepAspectRatio) {
1174
- if (this.unit === D.AspectRatio && this.ratioWidth && this.ratioHeight) {
1397
+ if (this.unit === k.AspectRatio && this.ratioWidth && this.ratioHeight) {
1175
1398
  this.aspectRatio = this.ratioWidth / this.ratioHeight;
1176
1399
  return;
1177
1400
  }
1178
- if (this.unit === D.Pixel && !e && this.width && this.height) {
1401
+ if (this.unit === k.Pixel && !e && this.width && this.height) {
1179
1402
  this.aspectRatio = this.width / this.height;
1180
1403
  return;
1181
1404
  }
@@ -1198,15 +1421,14 @@ var bt = Y, xt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
1198
1421
  }
1199
1422
  }
1200
1423
  handleWidthChange(e) {
1201
- if (!e.target.value) {
1424
+ let t = Number(e.target.value);
1425
+ if (!e.target.value || !Number.isFinite(t)) {
1202
1426
  this.invalidWidth = !0;
1203
1427
  return;
1204
1428
  }
1205
- this.invalidWidth = !1;
1206
- let t = Number(e.target.value);
1207
- this.unit === D.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1)), e.target.value = t.toString();
1208
- let n = this.unit === D.Pixel ? this.height : this.ratioHeight;
1209
- this.keepAspectRatio && (n = Math.min(Math.round(t / this.aspectRatio), this.maxHeight), this.invalidHeight = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
1429
+ this.invalidWidth = !1, this.unit === k.Pixel && (t = Math.max(Math.min(t, this.maxWidth), 1)), e.target.value = t.toString();
1430
+ let n = this.unit === k.Pixel ? this.height : this.ratioHeight;
1431
+ this.keepAspectRatio && (n = Math.max(Math.min(Math.round(t / this.aspectRatio), this.maxHeight), 1), this.invalidHeight = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
1210
1432
  height: n,
1211
1433
  keepAspectRatio: this.keepAspectRatio,
1212
1434
  unit: this.unit,
@@ -1214,15 +1436,14 @@ var bt = Y, xt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
1214
1436
  } });
1215
1437
  }
1216
1438
  handleHeightChange(e) {
1217
- if (!e.target.value) {
1439
+ let t = Number(e.target.value);
1440
+ if (!e.target.value || !Number.isFinite(t)) {
1218
1441
  this.invalidHeight = !0;
1219
1442
  return;
1220
1443
  }
1221
- this.invalidHeight = !1;
1222
- let t = Number(e.target.value);
1223
- this.unit === D.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1)), e.target.value = t.toString();
1224
- let n = this.unit === D.Pixel ? this.width : this.ratioWidth;
1225
- this.keepAspectRatio && (n = Math.min(Math.round(t * this.aspectRatio), this.maxWidth), this.invalidWidth = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
1444
+ this.invalidHeight = !1, this.unit === k.Pixel && (t = Math.max(Math.min(t, this.maxHeight), 1)), e.target.value = t.toString();
1445
+ let n = this.unit === k.Pixel ? this.width : this.ratioWidth;
1446
+ this.keepAspectRatio && (n = Math.max(Math.min(Math.round(t * this.aspectRatio), this.maxWidth), 1), this.invalidWidth = !1), this.emit("cx-asset-link-format-resize-change", { detail: {
1226
1447
  height: t,
1227
1448
  keepAspectRatio: this.keepAspectRatio,
1228
1449
  unit: this.unit,
@@ -1230,16 +1451,16 @@ var bt = Y, xt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
1230
1451
  } });
1231
1452
  }
1232
1453
  onUnitChange(e) {
1233
- e.target.value === D.AspectRatio ? this.emit("cx-asset-link-format-resize-change", { detail: {
1234
- height: this.lastAppliedSetting[D.AspectRatio].height,
1454
+ e.target.value === k.AspectRatio ? this.emit("cx-asset-link-format-resize-change", { detail: {
1455
+ height: this.lastAppliedSetting[k.AspectRatio].height,
1235
1456
  keepAspectRatio: this.keepAspectRatio,
1236
- unit: D.AspectRatio,
1237
- width: this.lastAppliedSetting[D.AspectRatio].width
1457
+ unit: k.AspectRatio,
1458
+ width: this.lastAppliedSetting[k.AspectRatio].width
1238
1459
  } }) : this.emit("cx-asset-link-format-resize-change", { detail: {
1239
- height: this.lastAppliedSetting[D.Pixel].height,
1460
+ height: this.lastAppliedSetting[k.Pixel].height,
1240
1461
  keepAspectRatio: this.keepAspectRatio,
1241
- unit: D.Pixel,
1242
- width: this.lastAppliedSetting[D.Pixel].width
1462
+ unit: k.Pixel,
1463
+ width: this.lastAppliedSetting[k.Pixel].width
1243
1464
  } });
1244
1465
  }
1245
1466
  handleApply() {
@@ -1257,70 +1478,74 @@ var bt = Y, xt = t`cx-details::part(base){border-bottom-width:0}cx-space{width:1
1257
1478
  }
1258
1479
  handleAspectRatioClick() {
1259
1480
  this.emit("cx-asset-link-format-resize-change", { detail: {
1260
- height: this.unit === D.Pixel ? this.height : this.ratioHeight,
1481
+ height: this.unit === k.Pixel ? this.height : this.ratioHeight,
1261
1482
  keepAspectRatio: !this.keepAspectRatio,
1262
1483
  unit: this.unit,
1263
- width: this.unit === D.Pixel ? this.width : this.ratioWidth
1484
+ width: this.unit === k.Pixel ? this.width : this.ratioWidth
1264
1485
  } });
1265
1486
  }
1266
1487
  render() {
1267
1488
  return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="aspect_ratio"></cx-icon></div><cx-typography variant="body2">${this.localize.term("resize")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small"><cx-space spacing="small"><div class="resize__input-group"><cx-input data-testid="cx-asset-link-format-resize-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: {
1268
1489
  mask: Number,
1269
- min: 1
1270
- } }} value=${this.unit === D.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
1490
+ min: 1,
1491
+ radix: ".",
1492
+ scale: 0
1493
+ } }} value=${this.unit === k.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
1271
1494
  W
1272
1495
  </cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-resize-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${g({ color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0 })} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-resize-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: {
1273
1496
  mask: Number,
1274
- min: 1
1275
- } }} value=${this.unit === D.Pixel ? this.height.toString() : this.ratioHeight.toString()} @cx-input=${this.handleHeightChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
1497
+ min: 1,
1498
+ radix: ".",
1499
+ scale: 0
1500
+ } }} value=${this.unit === k.Pixel ? this.height.toString() : this.ratioHeight.toString()} @cx-input=${this.handleHeightChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
1276
1501
  H
1277
- </cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-resize-unit" value=${this.unit} hoist class="resize__unit-select" @cx-change=${this.onUnitChange}><cx-option value=${D.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${D.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`)}</cx-space><cx-button data-testid="cx-asset-link-format-resize-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${g({ marginLeft: "auto" })} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
1502
+ </cx-typography></cx-input></div>${m(!this.noRatioModes, () => e`<cx-select data-testid="cx-asset-link-format-resize-unit" value=${this.unit} hoist class="resize__unit-select" @cx-change=${this.onUnitChange}><cx-option value=${k.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${k.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select>`)}</cx-space><cx-button data-testid="cx-asset-link-format-resize-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${g({ marginLeft: "auto" })} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
1278
1503
  }
1279
1504
  };
1280
- a([c(".details"), o("design:type", E === void 0 ? Object : E)], X.prototype, "base", void 0), a([r({
1505
+ a([c(".details"), o("design:type", T === void 0 ? Object : T)], q.prototype, "base", void 0), a([r({
1281
1506
  reflect: !0,
1282
1507
  type: Boolean
1283
- }), o("design:type", Boolean)], X.prototype, "open", void 0), a([r({
1508
+ }), o("design:type", Boolean)], q.prototype, "open", void 0), a([r({
1284
1509
  reflect: !0,
1285
1510
  type: Number
1286
- }), o("design:type", Number)], X.prototype, "width", void 0), a([r({
1511
+ }), o("design:type", Number)], q.prototype, "width", void 0), a([r({
1287
1512
  reflect: !0,
1288
1513
  type: Number
1289
- }), o("design:type", Number)], X.prototype, "height", void 0), a([r({
1514
+ }), o("design:type", Number)], q.prototype, "height", void 0), a([r({
1290
1515
  attribute: "max-width",
1291
1516
  reflect: !0,
1292
1517
  type: Number
1293
- }), o("design:type", Number)], X.prototype, "maxWidth", void 0), a([r({
1518
+ }), o("design:type", Number)], q.prototype, "maxWidth", void 0), a([r({
1294
1519
  attribute: "max-height",
1295
1520
  reflect: !0,
1296
1521
  type: Number
1297
- }), o("design:type", Number)], X.prototype, "maxHeight", void 0), a([r({
1522
+ }), o("design:type", Number)], q.prototype, "maxHeight", void 0), a([r({
1298
1523
  attribute: "ratio-width",
1299
1524
  reflect: !0,
1300
1525
  type: Number
1301
- }), o("design:type", Number)], X.prototype, "ratioWidth", void 0), a([r({
1526
+ }), o("design:type", Number)], q.prototype, "ratioWidth", void 0), a([r({
1302
1527
  attribute: "ratio-height",
1303
1528
  reflect: !0,
1304
1529
  type: Number
1305
- }), o("design:type", Number)], X.prototype, "ratioHeight", void 0), a([r({
1530
+ }), o("design:type", Number)], q.prototype, "ratioHeight", void 0), a([r({
1306
1531
  reflect: !0,
1307
1532
  type: String
1308
- }), o("design:type", D === void 0 ? Object : D)], X.prototype, "unit", void 0), a([r({
1533
+ }), o("design:type", k === void 0 ? Object : k)], q.prototype, "unit", void 0), a([r({
1309
1534
  attribute: "last-applied-setting",
1310
1535
  reflect: !1,
1311
1536
  type: Object
1312
- }), o("design:type", typeof Record > "u" ? Object : Record)], X.prototype, "lastAppliedSetting", void 0), a([r({
1537
+ }), o("design:type", typeof Record > "u" ? Object : Record)], q.prototype, "lastAppliedSetting", void 0), a([r({
1313
1538
  reflect: !0,
1314
1539
  type: Boolean
1315
- }), o("design:type", Boolean)], X.prototype, "loading", void 0), a([r({
1540
+ }), o("design:type", Boolean)], q.prototype, "loading", void 0), a([r({
1316
1541
  attribute: "no-ratio-modes",
1317
1542
  reflect: !0,
1318
1543
  type: Boolean
1319
- }), o("design:type", Boolean)], X.prototype, "noRatioModes", void 0), a([r({
1544
+ }), o("design:type", Boolean)], q.prototype, "noRatioModes", void 0), a([r({
1320
1545
  attribute: "keep-aspect-ratio",
1321
1546
  reflect: !0,
1322
1547
  type: Boolean
1323
- }), o("design:type", Boolean)], X.prototype, "keepAspectRatio", void 0), a([i(), o("design:type", Boolean)], X.prototype, "invalidWidth", void 0), a([i(), o("design:type", Boolean)], X.prototype, "invalidHeight", void 0), a([i(), o("design:type", Number)], X.prototype, "aspectRatio", void 0), a([
1548
+ }), o("design:type", Boolean)], q.prototype, "keepAspectRatio", void 0), a([i(), o("design:type", Boolean)], q.prototype, "invalidWidth", void 0), a([i(), o("design:type", Boolean)], q.prototype, "invalidHeight", void 0), a([i(), o("design:type", Number)], q.prototype, "aspectRatio", void 0), a([
1324
1549
  f("cropMode", { waitUntilFirstUpdate: !0 }),
1325
1550
  f("maxWidth", { waitUntilFirstUpdate: !0 }),
1326
1551
  f("maxHeight", { waitUntilFirstUpdate: !0 }),
@@ -1328,25 +1553,25 @@ a([c(".details"), o("design:type", E === void 0 ? Object : E)], X.prototype, "ba
1328
1553
  o("design:type", Function),
1329
1554
  o("design:paramtypes", []),
1330
1555
  o("design:returntype", Promise)
1331
- ], X.prototype, "handleCropModeChange", null), a([
1556
+ ], q.prototype, "handleCropModeChange", null), a([
1332
1557
  f("open", { waitUntilFirstUpdate: !0 }),
1333
1558
  o("design:type", Function),
1334
1559
  o("design:paramtypes", []),
1335
1560
  o("design:returntype", Promise)
1336
- ], X.prototype, "handleOpenChange", null), X = a([u("cx-asset-link-format-resize")], X);
1337
- var St = X, Ct = t`cx-details::part(base){border-bottom-width:0}`, Z = class extends s {
1561
+ ], q.prototype, "handleOpenChange", null), q = a([u("cx-asset-link-format-resize")], q);
1562
+ var Rt = q, zt = t`cx-details::part(base){border-bottom-width:0}.asset-link-format__rotation-inline{padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__rotation-inline .asset-link-format__rotation-summary{margin-block-end:var(--cx-spacing-small)}`, J = class extends s {
1338
1563
  constructor(...e) {
1339
- super(...e), this.localize = new d(this), this.open = !1, this.value = 0, this.defaultValue = 0, this.loading = !1, this.lastAppliedValue = 0;
1564
+ super(...e), this.localize = new d(this), this.open = !1, this.inline = !1, this.value = 0, this.defaultValue = 0, this.loading = !1, this.lastAppliedValue = 0;
1340
1565
  }
1341
- static #e = this.styles = [l, Ct];
1566
+ static #e = this.styles = [l, zt];
1342
1567
  static #t = this.dependencies = {
1343
1568
  "cx-button": _,
1344
- "cx-button-group": ie,
1345
- "cx-details": E,
1569
+ "cx-button-group": ae,
1570
+ "cx-details": T,
1346
1571
  "cx-icon": h,
1347
1572
  "cx-icon-button": p,
1348
- "cx-space": C,
1349
- "cx-typography": b
1573
+ "cx-space": S,
1574
+ "cx-typography": y
1350
1575
  };
1351
1576
  handleOpenChange() {
1352
1577
  this.open || this.emit("cx-asset-link-format-rotation-change", { detail: this.lastAppliedValue });
@@ -1369,54 +1594,66 @@ var St = X, Ct = t`cx-details::part(base){border-bottom-width:0}`, Z = class ext
1369
1594
  handleApply() {
1370
1595
  this.value === 360 || this.value === -360 || this.loading || this.emit("cx-asset-link-format-rotation-apply", { detail: this.value });
1371
1596
  }
1372
- render() {
1373
- return e`<cx-details class="details" ?open=${this.open}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="rotate_90_degrees_cw"></cx-icon></div><cx-typography variant="body2">Rotate</cx-typography></cx-space><cx-space spacing="small"><cx-button-group label=${this.localize.term("history")}><cx-icon-button data-testid="cx-asset-link-format-rotation-ccw" name="rotate_90_degrees_ccw" label=${this.localize.term("undo")} outline size="small" ?disabled=${this.loading || this.value === -360} @click=${this.handleCounterClockwiseClick}></cx-icon-button><cx-icon-button data-testid="cx-asset-link-format-rotation-cw" name="rotate_90_degrees_cw" label=${this.localize.term("redo")} outline size="small" ?disabled=${this.loading || this.value === 360} @click=${this.handleClockwiseClick}></cx-icon-button></cx-button-group><cx-input data-testid="cx-asset-link-format-rotation" value=${(this.value + this.defaultValue).toString()} placeholder="0" mask="num" .maskBlocks=${{ num: {
1597
+ renderSummary() {
1598
+ return e`<cx-space class="asset-link-format__rotation-summary" align-items="center"><div part="icon"><cx-icon name="rotate_90_degrees_cw"></cx-icon></div><cx-typography variant="body2">${this.localize.term("rotate")}</cx-typography></cx-space>`;
1599
+ }
1600
+ renderControls() {
1601
+ return e`<cx-space class="asset-link-format__rotation-controls" spacing="small"><cx-button-group label=${this.localize.term("rotate")}><cx-icon-button data-testid="cx-asset-link-format-rotation-ccw" name="rotate_90_degrees_ccw" label=${this.localize.term("rotateCounterclockwise")} outline size="small" ?disabled=${this.loading || this.value === -360} @click=${this.handleCounterClockwiseClick}></cx-icon-button><cx-icon-button data-testid="cx-asset-link-format-rotation-cw" name="rotate_90_degrees_cw" label=${this.localize.term("rotateClockwise")} outline size="small" ?disabled=${this.loading || this.value === 360} @click=${this.handleClockwiseClick}></cx-icon-button></cx-button-group><cx-input data-testid="cx-asset-link-format-rotation" value=${(this.value + this.defaultValue).toString()} placeholder="0" mask="num" .maskBlocks=${{ num: {
1374
1602
  mask: Number,
1375
1603
  max: 360,
1376
1604
  min: -360,
1605
+ radix: ".",
1606
+ scale: 0,
1377
1607
  signed: !0
1378
1608
  } }} ?disabled=${this.loading} style=${g({
1379
1609
  flex: "none",
1380
1610
  width: "80px"
1381
- })} @cx-input=${this.handleRotationChange}></cx-input><cx-button data-testid="cx-asset-link-format-rotation-apply" variant="primary" ?disabled=${this.value === this.lastAppliedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
1611
+ })} @cx-input=${this.handleRotationChange}></cx-input>${m(!this.inline, () => e`<cx-button data-testid="cx-asset-link-format-rotation-apply" variant="primary" ?disabled=${this.value === this.lastAppliedValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space>`;
1612
+ }
1613
+ render() {
1614
+ return this.inline ? e`<div class="asset-link-format__rotation-inline">${this.renderSummary()}
1615
+ ${this.renderControls()}</div>` : e`<cx-details class="details" ?open=${this.open}><div slot="summary">${this.renderSummary()}</div>${this.renderControls()}</cx-details>`;
1382
1616
  }
1383
1617
  };
1384
- a([c(".details"), o("design:type", E === void 0 ? Object : E)], Z.prototype, "base", void 0), a([r({
1618
+ a([c(".details"), o("design:type", T === void 0 ? Object : T)], J.prototype, "base", void 0), a([r({
1619
+ reflect: !0,
1620
+ type: Boolean
1621
+ }), o("design:type", Object)], J.prototype, "open", void 0), a([r({
1385
1622
  reflect: !0,
1386
1623
  type: Boolean
1387
- }), o("design:type", Object)], Z.prototype, "open", void 0), a([r({
1624
+ }), o("design:type", Object)], J.prototype, "inline", void 0), a([r({
1388
1625
  reflect: !0,
1389
1626
  type: Number
1390
- }), o("design:type", Object)], Z.prototype, "value", void 0), a([r({
1627
+ }), o("design:type", Object)], J.prototype, "value", void 0), a([r({
1391
1628
  attribute: "default-value",
1392
1629
  reflect: !0,
1393
1630
  type: Number
1394
- }), o("design:type", Object)], Z.prototype, "defaultValue", void 0), a([r({
1631
+ }), o("design:type", Object)], J.prototype, "defaultValue", void 0), a([r({
1395
1632
  reflect: !0,
1396
1633
  type: Boolean
1397
- }), o("design:type", Object)], Z.prototype, "loading", void 0), a([r({
1634
+ }), o("design:type", Object)], J.prototype, "loading", void 0), a([r({
1398
1635
  attribute: "last-applied-value",
1399
1636
  reflect: !0,
1400
1637
  type: Number
1401
- }), o("design:type", Object)], Z.prototype, "lastAppliedValue", void 0), a([
1638
+ }), o("design:type", Object)], J.prototype, "lastAppliedValue", void 0), a([
1402
1639
  f("open", { waitUntilFirstUpdate: !0 }),
1403
1640
  o("design:type", Function),
1404
1641
  o("design:paramtypes", []),
1405
1642
  o("design:returntype", void 0)
1406
- ], Z.prototype, "handleOpenChange", null), Z = a([u("cx-asset-link-format-rotation")], Z);
1407
- var wt = Z, Tt = t`cx-details::part(base){border-bottom-width:0}`, Q = class extends s {
1643
+ ], J.prototype, "handleOpenChange", null), J = a([u("cx-asset-link-format-rotation")], J);
1644
+ var Bt = J, Vt = t`cx-details::part(base){border-bottom-width:0}`, Y = class extends s {
1408
1645
  constructor(...e) {
1409
1646
  super(...e), this.localize = new d(this), this.open = !1, this.value = !1;
1410
1647
  }
1411
- static #e = this.styles = [l, Tt];
1648
+ static #e = this.styles = [l, Vt];
1412
1649
  static #t = this.dependencies = {
1413
1650
  "cx-button": _,
1414
- "cx-checkbox": ae,
1415
- "cx-details": E,
1651
+ "cx-checkbox": oe,
1652
+ "cx-details": T,
1416
1653
  "cx-icon": h,
1417
- "cx-space": C,
1654
+ "cx-space": S,
1418
1655
  "cx-tooltip": te,
1419
- "cx-typography": b
1656
+ "cx-typography": y
1420
1657
  };
1421
1658
  handleApply(e) {
1422
1659
  this.emit("cx-asset-link-format-metadata-change", { detail: e.target.checked });
@@ -1431,47 +1668,124 @@ var wt = Z, Tt = t`cx-details::part(base){border-bottom-width:0}`, Q = class ext
1431
1668
  return e`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="short_text"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("metadata")}</cx-typography></cx-space><cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-metadata-tooltip" content=${this.localize.term("metadataHelpText")} hoist><cx-checkbox data-testid="cx-asset-link-format-metadata" class="details__checkbox" ?checked=${this.value} @cx-change=${this.handleApply}>${this.localize.term("preserveMetadata")}</cx-checkbox></cx-tooltip></cx-space></cx-details>`;
1432
1669
  }
1433
1670
  };
1434
- a([c(".details"), o("design:type", E === void 0 ? Object : E)], Q.prototype, "base", void 0), a([r({
1671
+ a([c(".details"), o("design:type", T === void 0 ? Object : T)], Y.prototype, "base", void 0), a([r({
1435
1672
  reflect: !0,
1436
1673
  type: Boolean
1437
- }), o("design:type", Object)], Q.prototype, "open", void 0), a([r({
1674
+ }), o("design:type", Object)], Y.prototype, "open", void 0), a([r({
1438
1675
  reflect: !0,
1439
1676
  type: Boolean
1440
- }), o("design:type", Object)], Q.prototype, "value", void 0), Q = a([u("cx-asset-link-format-metadata")], Q);
1441
- var Et = Q, Dt, $ = class extends s {
1442
- static #e = Dt = this;
1443
- static #t = this.styles = [l, dt];
1677
+ }), o("design:type", Object)], Y.prototype, "value", void 0), Y = a([u("cx-asset-link-format-metadata")], Y);
1678
+ var Ht = Y, X, Ut = {
1679
+ [j.Crop]: O.Crop,
1680
+ [j.Dimensions]: O.Dimensions,
1681
+ [j.Quality]: O.Quality,
1682
+ [j.Resize]: O.Resize,
1683
+ [j.Rotate]: O.Rotate
1684
+ }, Z = [
1685
+ j.Proxy,
1686
+ j.Crop,
1687
+ j.Resize,
1688
+ j.Rotate,
1689
+ j.Quality,
1690
+ j.Metadata
1691
+ ], Wt = [
1692
+ j.Proxy,
1693
+ j.Dimensions,
1694
+ ...Z.slice(1)
1695
+ ], Q = [
1696
+ j.Dimensions,
1697
+ j.Crop,
1698
+ j.Resize,
1699
+ j.Rotate,
1700
+ j.Quality
1701
+ ], $ = class extends s {
1702
+ static #e = X = this;
1703
+ static #t = this.styles = [l, wt];
1444
1704
  static #n = this.dependencies = {
1445
- "cx-asset-link-format-crop": pt,
1446
- "cx-asset-link-format-extension": ht,
1447
- "cx-asset-link-format-metadata": Et,
1448
- "cx-asset-link-format-proxy": vt,
1449
- "cx-asset-link-format-quality": bt,
1450
- "cx-asset-link-format-resize": St,
1451
- "cx-asset-link-format-rotation": wt,
1705
+ "cx-asset-link-format-crop": Et,
1706
+ "cx-asset-link-format-dimensions": kt,
1707
+ "cx-asset-link-format-extension": jt,
1708
+ "cx-asset-link-format-metadata": Ht,
1709
+ "cx-asset-link-format-proxy": Pt,
1710
+ "cx-asset-link-format-quality": It,
1711
+ "cx-asset-link-format-resize": Rt,
1712
+ "cx-asset-link-format-rotation": Bt,
1452
1713
  "cx-button": _,
1453
- "cx-space": C,
1454
- "cx-typography": b
1714
+ "cx-icon": h,
1715
+ "cx-icon-button": p,
1716
+ "cx-space": S,
1717
+ "cx-switch": ve,
1718
+ "cx-typography": y,
1719
+ "cx-visually-hidden": ce
1455
1720
  };
1456
1721
  static getTransformExtension(e) {
1457
- return !e || st(e) ? e : "jpg";
1722
+ return !e || bt(e) ? e : "jpg";
1723
+ }
1724
+ static uniqueTransformations(e) {
1725
+ return [...new Map(e.map((e) => [e.key, e])).values()];
1726
+ }
1727
+ static orderTransformations(e, t) {
1728
+ let n = t.map((e) => Ut[e]).filter((e) => e !== void 0), r = e.filter((e) => n.includes(e.key)).sort((e, t) => n.indexOf(e.key) - n.indexOf(t.key)), i = 0;
1729
+ return e.map((e) => n.includes(e.key) ? r[i++] : e);
1730
+ }
1731
+ static getDimensionsPresetSize(e) {
1732
+ let t = /^(\d+)\s*[x×_]\s*(\d+)$/i.exec(e.trim()), n = Number(t?.[1]), r = Number(t?.[2]);
1733
+ return n >= 1 && r >= 1 ? {
1734
+ height: r,
1735
+ width: n
1736
+ } : void 0;
1737
+ }
1738
+ static getDimensionsSize(e) {
1739
+ if (e?.mode === D.Preset) return X.getDimensionsPresetSize(e.value);
1740
+ if (e?.mode === D.Custom && e.unit === A.Pixel && Number.isInteger(e.width) && Number.isInteger(e.height) && e.width >= 1 && e.height >= 1) return {
1741
+ height: e.height,
1742
+ width: e.width
1743
+ };
1744
+ }
1745
+ static getSizeBoundAfterStep(e, t) {
1746
+ let { height: n = 0, rotation: r = 0, unit: i, width: a = 0 } = t.value, o = Math.round(a) >= 1 && Math.round(n) >= 1;
1747
+ switch (t.key) {
1748
+ case O.Resize: return i !== k.AspectRatio && o ? {
1749
+ height: Math.round(n),
1750
+ width: Math.round(a)
1751
+ } : void 0;
1752
+ case O.Dimensions: return o ? {
1753
+ height: Math.min(e?.height ?? Infinity, Math.round(n)),
1754
+ width: Math.min(e?.width ?? Infinity, Math.round(a))
1755
+ } : e;
1756
+ case O.Rotate: {
1757
+ if (!e) return;
1758
+ let t = r * Math.PI / 180, n = Math.abs(Math.cos(t)), i = Math.abs(Math.sin(t));
1759
+ return {
1760
+ height: Math.ceil(e.width * i + e.height * n - 1e-9),
1761
+ width: Math.ceil(e.width * n + e.height * i - 1e-9)
1762
+ };
1763
+ }
1764
+ default: return e;
1765
+ }
1766
+ }
1767
+ get canReorder() {
1768
+ return this.reorderable && !this.asset;
1769
+ }
1770
+ get isFormatsLayout() {
1771
+ return this.layout === ge.Formats;
1458
1772
  }
1459
1773
  get hasUnfrozenTransformations() {
1460
1774
  return !(this.transformations.length === 0 || this.frozenIndex !== void 0 && this.frozenIndex >= this.transformations.length - 1);
1461
1775
  }
1462
1776
  get lastAppliedCropUnit() {
1463
- return this.transformations.findLast((e) => e.key === k.Crop)?.value.unit ?? D.Pixel;
1777
+ return this.transformations.findLast((e) => e.key === O.Crop)?.value.unit ?? k.Pixel;
1464
1778
  }
1465
1779
  get lastAppliedCropFocusMode() {
1466
- return this.transformations.findLast((e) => e.key === k.Crop)?.value.focusMode ?? "manual";
1780
+ return this.transformations.findLast((e) => e.key === O.Crop)?.value.focusMode ?? "manual";
1467
1781
  }
1468
1782
  get lastAppliedCropPosition() {
1469
- return this.transformations.findLast((e) => e.key === k.Crop)?.value.position ?? v.CenterCenter;
1783
+ return this.transformations.findLast((e) => e.key === O.Crop)?.value.position ?? v.CenterCenter;
1470
1784
  }
1471
1785
  get disabledCropApply() {
1472
1786
  if (!this.asset && this.cropSize.unit !== this.lastAppliedCropUnit) return !1;
1473
- if (this.cropSize.unit === D.AspectRatio && !this.asset) {
1474
- let e = this.lastCropSize[D.AspectRatio];
1787
+ if (this.cropSize.unit === k.AspectRatio && !this.asset) {
1788
+ let e = this.lastCropSize[k.AspectRatio];
1475
1789
  return this.cropSize.ratioWidth === e.width && this.cropSize.ratioHeight === e.height && this.cropSize.focusMode === this.lastAppliedCropFocusMode && this.cropSize.position === this.lastAppliedCropPosition;
1476
1790
  }
1477
1791
  if (!this.asset && this.cropSize.focusMode !== this.lastAppliedCropFocusMode || !this.asset && this.cropSize.position !== this.lastAppliedCropPosition) return !1;
@@ -1482,58 +1796,79 @@ var Et = Q, Dt, $ = class extends s {
1482
1796
  "width",
1483
1797
  "x",
1484
1798
  "y"
1485
- ]) if (this.cropSize[e] !== this.lastCropSize[D.Pixel][e]) return !1;
1799
+ ]) if (this.cropSize[e] !== this.lastCropSize[k.Pixel][e]) return !1;
1486
1800
  return !0;
1487
1801
  }
1488
1802
  get formats() {
1489
1803
  return this.proxies?.filter((e) => !e.cdnName) || [];
1490
1804
  }
1805
+ get activeParts() {
1806
+ let e = new Set(Object.values(j)), t = /* @__PURE__ */ new Set();
1807
+ for (let n of this.parts) e.has(n) && t.add(n);
1808
+ return [...t];
1809
+ }
1491
1810
  get imageSize() {
1492
1811
  return {
1493
1812
  height: this.selectedFormat?.height ?? 0,
1494
1813
  width: this.selectedFormat?.width ?? 0
1495
1814
  };
1496
1815
  }
1816
+ get stepsBeforeCrop() {
1817
+ let e = this.transformations.findIndex((e) => e.key === O.Crop);
1818
+ if (e >= 0) return this.transformations.slice(0, e);
1819
+ if (!this.canReorder) return this.transformations;
1820
+ let t = {
1821
+ key: O.Crop,
1822
+ value: {}
1823
+ }, n = X.orderTransformations([...this.transformations, t], this.activeParts);
1824
+ return n.slice(0, n.indexOf(t));
1825
+ }
1826
+ get cropMaxSize() {
1827
+ return this.stepsBeforeCrop.reduce(X.getSizeBoundAfterStep, void 0) ?? {
1828
+ height: Infinity,
1829
+ width: Infinity
1830
+ };
1831
+ }
1497
1832
  get lastCropSize() {
1498
1833
  if (!this.asset) {
1499
- let e = this.transformations.findLast((e) => e.key === k.Crop);
1500
- if (e?.value.unit === D.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
1501
- [D.AspectRatio]: {
1834
+ let e = this.transformations.findLast((e) => e.key === O.Crop);
1835
+ if (e?.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
1836
+ [k.AspectRatio]: {
1502
1837
  height: e.value.ratioHeight,
1503
1838
  percentageHeight: 100,
1504
1839
  percentageWidth: 100,
1505
- unit: D.AspectRatio,
1840
+ unit: k.AspectRatio,
1506
1841
  width: e.value.ratioWidth,
1507
1842
  x: 0,
1508
1843
  y: 0
1509
1844
  },
1510
- [D.Pixel]: {
1845
+ [k.Pixel]: {
1511
1846
  height: 1,
1512
1847
  percentageHeight: 100,
1513
1848
  percentageWidth: 100,
1514
- unit: D.Pixel,
1849
+ unit: k.Pixel,
1515
1850
  width: 1,
1516
1851
  x: 0,
1517
1852
  y: 0
1518
1853
  }
1519
1854
  };
1520
1855
  if (e?.value.width && e?.value.height) {
1521
- let { height: t, width: n, x: r = 0, y: i = 0 } = e.value, a = y(n, t);
1856
+ let { height: t, width: n, x: r = 0, y: i = 0 } = e.value, a = re(n, t);
1522
1857
  return {
1523
- [D.AspectRatio]: {
1858
+ [k.AspectRatio]: {
1524
1859
  height: a.height,
1525
1860
  percentageHeight: 100,
1526
1861
  percentageWidth: 100,
1527
- unit: D.AspectRatio,
1862
+ unit: k.AspectRatio,
1528
1863
  width: a.width,
1529
1864
  x: 0,
1530
1865
  y: 0
1531
1866
  },
1532
- [D.Pixel]: {
1867
+ [k.Pixel]: {
1533
1868
  height: t,
1534
1869
  percentageHeight: 100,
1535
1870
  percentageWidth: 100,
1536
- unit: D.Pixel,
1871
+ unit: k.Pixel,
1537
1872
  width: n,
1538
1873
  x: r,
1539
1874
  y: i
@@ -1541,25 +1876,25 @@ var Et = Q, Dt, $ = class extends s {
1541
1876
  };
1542
1877
  }
1543
1878
  }
1544
- let e = this.lastImageSize.width && this.lastImageSize.height ? y(this.lastImageSize.width, this.lastImageSize.height) : {
1879
+ let e = this.lastImageSize.width && this.lastImageSize.height ? re(this.lastImageSize.width, this.lastImageSize.height) : {
1545
1880
  height: 1,
1546
1881
  width: 1
1547
1882
  };
1548
1883
  return {
1549
- [D.AspectRatio]: {
1884
+ [k.AspectRatio]: {
1550
1885
  height: e.height,
1551
1886
  percentageHeight: 100,
1552
1887
  percentageWidth: 100,
1553
- unit: D.AspectRatio,
1888
+ unit: k.AspectRatio,
1554
1889
  width: e.width,
1555
1890
  x: 0,
1556
1891
  y: 0
1557
1892
  },
1558
- [D.Pixel]: {
1893
+ [k.Pixel]: {
1559
1894
  height: this.lastImageSize.height,
1560
1895
  percentageHeight: 100,
1561
1896
  percentageWidth: 100,
1562
- unit: D.Pixel,
1897
+ unit: k.Pixel,
1563
1898
  width: this.lastImageSize.width,
1564
1899
  x: 0,
1565
1900
  y: 0
@@ -1568,57 +1903,57 @@ var Et = Q, Dt, $ = class extends s {
1568
1903
  }
1569
1904
  get lastResizeSize() {
1570
1905
  if (!this.asset) {
1571
- let e = this.transformations.findLast((e) => e.key === k.Resize);
1572
- if (e?.value.unit === D.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
1573
- [D.AspectRatio]: {
1906
+ let e = this.transformations.findLast((e) => e.key === O.Resize);
1907
+ if (e?.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) return {
1908
+ [k.AspectRatio]: {
1574
1909
  height: e.value.ratioHeight,
1575
- unit: D.AspectRatio,
1910
+ unit: k.AspectRatio,
1576
1911
  width: e.value.ratioWidth
1577
1912
  },
1578
- [D.Pixel]: {
1913
+ [k.Pixel]: {
1579
1914
  height: 1,
1580
- unit: D.Pixel,
1915
+ unit: k.Pixel,
1581
1916
  width: 1
1582
1917
  }
1583
1918
  };
1584
1919
  if (e?.value.width && e?.value.height) {
1585
- let { height: t, width: n } = e.value, r = y(n, t);
1920
+ let { height: t, width: n } = e.value, r = re(n, t);
1586
1921
  return {
1587
- [D.AspectRatio]: {
1922
+ [k.AspectRatio]: {
1588
1923
  height: r.height,
1589
- unit: D.AspectRatio,
1924
+ unit: k.AspectRatio,
1590
1925
  width: r.width
1591
1926
  },
1592
- [D.Pixel]: {
1927
+ [k.Pixel]: {
1593
1928
  height: t,
1594
- unit: D.Pixel,
1929
+ unit: k.Pixel,
1595
1930
  width: n
1596
1931
  }
1597
1932
  };
1598
1933
  }
1599
1934
  }
1600
- let e = this.lastImageSize.width && this.lastImageSize.height ? y(this.lastImageSize.width, this.lastImageSize.height) : {
1935
+ let e = this.lastImageSize.width && this.lastImageSize.height ? re(this.lastImageSize.width, this.lastImageSize.height) : {
1601
1936
  height: 1,
1602
1937
  width: 1
1603
1938
  };
1604
1939
  return {
1605
- [D.AspectRatio]: {
1940
+ [k.AspectRatio]: {
1606
1941
  height: e.height,
1607
- unit: D.AspectRatio,
1942
+ unit: k.AspectRatio,
1608
1943
  width: e.width
1609
1944
  },
1610
- [D.Pixel]: {
1945
+ [k.Pixel]: {
1611
1946
  height: this.lastImageSize.height,
1612
- unit: D.Pixel,
1947
+ unit: k.Pixel,
1613
1948
  width: this.lastImageSize.width
1614
1949
  }
1615
1950
  };
1616
1951
  }
1617
1952
  get lastRotation() {
1618
- return this.asset ? 0 : this.transformations.findLast((e) => e.key === k.Rotate)?.value.rotation ?? 0;
1953
+ return this.asset ? 0 : this.transformations.findLast((e) => e.key === O.Rotate)?.value.rotation ?? 0;
1619
1954
  }
1620
1955
  get transformationString() {
1621
- return T({
1956
+ return w({
1622
1957
  asset: this.asset,
1623
1958
  baseUrl: "",
1624
1959
  parameters: this.parameters,
@@ -1627,7 +1962,7 @@ var Et = Q, Dt, $ = class extends s {
1627
1962
  }).replace(/\/t\//g, "");
1628
1963
  }
1629
1964
  constructor() {
1630
- super(), this.localize = new d(this), this.baseUrl = void 0, this.token = void 0, this.asset = void 0, this.cropModes = [
1965
+ super(), this.localize = new d(this), this.initialParts = [...Z], this.sortableRevision = 0, this.dragPreviousSibling = null, this.baseUrl = void 0, this.token = void 0, this.asset = void 0, this.cropModes = [
1631
1966
  {
1632
1967
  label: "Free",
1633
1968
  value: "free"
@@ -1686,7 +2021,7 @@ var Et = Q, Dt, $ = class extends s {
1686
2021
  label: "Smart Swatch",
1687
2022
  value: "SmartSwatch"
1688
2023
  }
1689
- ], this.extensions = [], this.proxies = void 0, this.forCropper = void 0, this.useSession = "", this.transformations = [], this.selectedProxy = "", this.defaultProxy = "", this.canAutoFormat = !1, this.autoFormat = !1, this.useCustomExtension = !1, this.noMetadata = !1, this.noFormat = !1, this.noCrop = !1, this.noResize = !1, this.noRotate = !1, this.lastImageSize = {
2024
+ ], this.extensions = [], this.proxies = void 0, this.forCropper = void 0, this.useSession = "", this.transformations = [], this.selectedProxy = "", this.defaultProxy = "", this.canAutoFormat = !1, this.autoFormat = !1, this.useCustomExtension = !1, this.parts = this.initialParts, this.layout = ge.Accordion, this.cropEnabled = !1, this.reorderable = !1, this.dimensionsItems = [], this.qualityItems = [], this.canCustomDimensions = !1, this.lastImageSize = {
1690
2025
  height: 0,
1691
2026
  width: 0
1692
2027
  }, this.hideHeader = !1, this.canReset = !1, this.queryElement = null, this.activeSetting = "cx-asset-link-format-proxy", this.selectedFormat = void 0, this.resizeSize = {
@@ -1694,7 +2029,7 @@ var Et = Q, Dt, $ = class extends s {
1694
2029
  keepAspectRatio: !0,
1695
2030
  ratioHeight: 1,
1696
2031
  ratioWidth: 1,
1697
- unit: D.Pixel,
2032
+ unit: k.Pixel,
1698
2033
  width: 1
1699
2034
  }, this.cropSize = {
1700
2035
  cropMode: "free",
@@ -1706,20 +2041,23 @@ var Et = Q, Dt, $ = class extends s {
1706
2041
  position: v.CenterCenter,
1707
2042
  ratioHeight: 1,
1708
2043
  ratioWidth: 1,
1709
- unit: D.Pixel,
2044
+ unit: k.Pixel,
1710
2045
  width: 1,
1711
2046
  x: 0,
1712
2047
  y: 0
1713
2048
  }, this.rotation = 0, this.defaultSize = {
1714
2049
  height: 0,
1715
2050
  width: 0
1716
- }, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.apiGetTransformAssetLink = Ye, this.apiGetCropFocusMode = et, this.onCropComplete = this.onCropComplete.bind(this), this.onCropDragStart = this.onCropDragStart.bind(this);
2051
+ }, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.reorderAnnouncement = "", this.orderUndo = [], this.apiGetTransformAssetLink = ct, this.apiGetCropFocusMode = pt, this.onCropComplete = this.onCropComplete.bind(this), this.onCropDragStart = this.onCropDragStart.bind(this);
1717
2052
  }
1718
2053
  runConnectedCallback() {
1719
- this.hasUpdated && (this.handleCropperSelectorChange(), this.cropperElement && (this.cropperElement.addEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.addEventListener("cx-cropper-crop-drag-start", this.onCropDragStart)));
2054
+ this.hasUpdated && (this.syncSortable(), this.handleCropperSelectorChange(), this.cropperElement && (this.cropperElement.addEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.addEventListener("cx-cropper-crop-drag-start", this.onCropDragStart)));
1720
2055
  }
1721
2056
  disconnectedCallback() {
1722
- super.disconnectedCallback(), this.cropperElement && (this.cropperElement.removeEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.removeEventListener("cx-cropper-crop-drag-start", this.onCropDragStart));
2057
+ super.disconnectedCallback(), this.sortableRevision++, this.sortable?.destroy(), this.sortable = void 0, this.cropperElement && (this.cropperElement.removeEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.removeEventListener("cx-cropper-crop-drag-start", this.onCropDragStart));
2058
+ }
2059
+ willUpdate(e) {
2060
+ super.willUpdate(e), e.has("dimensionsItems") && this.syncSelectedDimensions(!1);
1723
2061
  }
1724
2062
  updated(e) {
1725
2063
  if ((e.has("forCropper") || e.has("queryElement")) && this.handleCropperSelectorChange(), e.has("asset") && this.handleAssetChange(), e.has("proxies") && this.handleProxiesChange(), this.autoFormat && (e.has("asset") || e.has("proxies"))) {
@@ -1729,7 +2067,7 @@ var Et = Q, Dt, $ = class extends s {
1729
2067
  if (e.has("activeSetting") && this.handleActiveSettingChange(), e.has("selectedFormat") && this.handleSelectedFormatChange(), e.has("resizeSize") && this.handleResizeSizeChange(), e.has("cropSize") && this.handleCropSizeChange(), e.has("rotation") && this.handleRotationChange(), e.has("cropperElement") && this.handleCropperElementChange(), e.has("selectedFormat")) {
1730
2068
  if (!this.asset || !this.selectedFormat || this.selectedFormat.extension === e.get("selectedFormat")?.extension) return;
1731
2069
  this.loading = !0, this.requestTransformAsset().then((e) => {
1732
- this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction === k.Rotate && (this.rotation = 0), this.lastAction = void 0, this.lastImageSize = {
2070
+ this.loading = !1, e?.relativePath && this.selectedFormat && (this.lastAction === O.Rotate && (this.rotation = 0), this.lastAction = void 0, this.lastImageSize = {
1733
2071
  height: e.height,
1734
2072
  width: e.width
1735
2073
  }, this.selectedFormat = {
@@ -1739,7 +2077,7 @@ var Et = Q, Dt, $ = class extends s {
1739
2077
  width: e.width
1740
2078
  });
1741
2079
  });
1742
- let t = T({
2080
+ let t = w({
1743
2081
  asset: this.asset,
1744
2082
  baseUrl: "",
1745
2083
  extension: this.selectedFormat.extension,
@@ -1763,7 +2101,7 @@ var Et = Q, Dt, $ = class extends s {
1763
2101
  get transformRequestOptions() {
1764
2102
  return {
1765
2103
  assetId: this.asset?.id ?? "",
1766
- extension: Dt.getTransformExtension(this.selectedFormat?.extension ?? ""),
2104
+ extension: X.getTransformExtension(this.selectedFormat?.extension ?? ""),
1767
2105
  format: this.proxies?.find((e) => e.id === this.selectedProxy)?.proxyName ?? "",
1768
2106
  siteUrl: this.baseUrl,
1769
2107
  token: this.token,
@@ -1793,50 +2131,81 @@ var Et = Q, Dt, $ = class extends s {
1793
2131
  this.frozenIndex = this.transformations.length - 1;
1794
2132
  }
1795
2133
  upsertTransformation(e) {
2134
+ this.asset || (this.transformations = X.uniqueTransformations(this.transformations));
1796
2135
  let t = this.transformations.findIndex((t) => t.key === e.key);
1797
2136
  if (t >= 0) {
1798
2137
  let n = [...this.transformations];
1799
2138
  n[t] = e, this.transformations = n;
1800
2139
  } else this.transformations = [...this.transformations, e];
2140
+ this.canReorder && (this.transformations = X.orderTransformations(this.transformations, this.activeParts));
2141
+ }
2142
+ isCropPanelSize(e) {
2143
+ let { height: t, ratioHeight: n, ratioWidth: r, unit: i = k.Pixel, width: a } = e.value;
2144
+ return i === this.cropSize.unit ? i === k.AspectRatio ? r === this.cropSize.ratioWidth && n === this.cropSize.ratioHeight : a === this.cropSize.width && t === this.cropSize.height : !1;
2145
+ }
2146
+ capCropToMaxSize() {
2147
+ let e = this.transformations.find((e) => e.key === O.Crop);
2148
+ if (this.asset || !e || (e.value.unit ?? k.Pixel) !== k.Pixel) return;
2149
+ let { height: t = 0, width: n = 0 } = e.value, r = this.cropMaxSize;
2150
+ if (n <= r.width && t <= r.height) return;
2151
+ let i = Math.min(t, r.height), a = Math.min(n, r.width), o = this.isCropPanelSize(e) && n * i === t * a;
2152
+ this.cropSize = {
2153
+ ...this.cropSize,
2154
+ cropMode: o ? this.cropSize.cropMode : "free",
2155
+ height: i,
2156
+ width: a
2157
+ }, this.upsertTransformation({
2158
+ ...e,
2159
+ value: {
2160
+ ...e.value,
2161
+ height: i,
2162
+ width: a
2163
+ }
2164
+ });
1801
2165
  }
1802
- async handleTransformationsChange() {
1803
- if (await this.updateComplete, !this.asset) {
1804
- this.emit("cx-asset-link-format-change", { detail: T({
2166
+ async handleTransformationsChange(e) {
2167
+ let t = e, n = this.canReorder && t !== void 0 && t.length === this.transformations.length && t.every((e) => this.transformations.includes(e));
2168
+ if (!this.asset) {
2169
+ let e = X.uniqueTransformations(this.transformations), t = this.canReorder ? X.orderTransformations(e, this.activeParts) : e;
2170
+ (t.length !== this.transformations.length || t.some((e, t) => e !== this.transformations[t])) && (this.transformations = t);
2171
+ }
2172
+ if (this.syncSelectedDimensions(), await this.updateComplete, !this.asset) {
2173
+ if (this.emit("cx-asset-link-format-change", { detail: w({
1805
2174
  asset: this.asset,
1806
2175
  baseUrl: "",
1807
2176
  options: { omitZeroXY: !0 },
1808
2177
  parameters: this.parameters,
1809
2178
  transformations: this.transformations,
1810
2179
  useSession: this.useSession
1811
- }).replace(/\/t\//g, "") });
1812
- let e = this.transformations.findLast((e) => e.key === k.Crop && (e.value.unit === D.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width && e.value.height));
1813
- if (e?.value.unit === D.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) {
1814
- let { focusMode: t, position: n, ratioHeight: r, ratioWidth: i } = e.value;
2180
+ }).replace(/\/t\//g, "") }), n) return;
2181
+ let e = this.transformations.findLast((e) => e.key === O.Crop && (e.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width && e.value.height)), t = e && this.isCropPanelSize(e) ? this.cropSize.cropMode : "free";
2182
+ if (e?.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight) {
2183
+ let { focusMode: n, position: r, ratioHeight: i, ratioWidth: a } = e.value;
1815
2184
  this.cropSize = {
1816
2185
  ...this.cropSize,
1817
- cropMode: "free",
1818
- focusMode: t ?? "manual",
2186
+ cropMode: t,
2187
+ focusMode: n ?? "manual",
1819
2188
  percentageHeight: 100,
1820
2189
  percentageWidth: 100,
1821
- position: n ?? v.CenterCenter,
1822
- ratioHeight: r,
1823
- ratioWidth: i,
1824
- unit: D.AspectRatio
2190
+ position: r ?? v.CenterCenter,
2191
+ ratioHeight: i,
2192
+ ratioWidth: a,
2193
+ unit: k.AspectRatio
1825
2194
  };
1826
2195
  } else if (e) {
1827
- let { focusMode: t, height: n, position: r, unit: i, width: a, x: o = 0, y: s = 0 } = e.value;
2196
+ let { focusMode: n, height: r, position: i, unit: a, width: o, x: s = 0, y: c = 0 } = e.value;
1828
2197
  this.cropSize = {
1829
2198
  ...this.cropSize,
1830
- cropMode: "free",
1831
- focusMode: t ?? "manual",
1832
- height: n,
2199
+ cropMode: t,
2200
+ focusMode: n ?? "manual",
2201
+ height: r,
1833
2202
  percentageHeight: 100,
1834
2203
  percentageWidth: 100,
1835
- position: r ?? v.CenterCenter,
1836
- unit: i ?? D.Pixel,
1837
- width: a,
1838
- x: o,
1839
- y: s
2204
+ position: i ?? v.CenterCenter,
2205
+ unit: a ?? k.Pixel,
2206
+ width: o,
2207
+ x: s,
2208
+ y: c
1840
2209
  };
1841
2210
  } else this.cropSize = {
1842
2211
  ...this.cropSize,
@@ -1846,46 +2215,46 @@ var Et = Q, Dt, $ = class extends s {
1846
2215
  percentageHeight: 0,
1847
2216
  percentageWidth: 0,
1848
2217
  position: v.CenterCenter,
1849
- unit: D.Pixel,
2218
+ unit: k.Pixel,
1850
2219
  width: 1,
1851
2220
  x: 0,
1852
2221
  y: 0
1853
2222
  };
1854
- let t = this.transformations.findLast((e) => e.key === k.Resize && (e.value.unit === D.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width || e.value.height));
1855
- if (t?.value.unit === D.AspectRatio && t.value.ratioWidth && t.value.ratioHeight) {
1856
- let { ratioHeight: e, ratioWidth: n } = t.value;
2223
+ let r = this.transformations.findLast((e) => e.key === O.Resize && (e.value.unit === k.AspectRatio && e.value.ratioWidth && e.value.ratioHeight || e.value.width || e.value.height));
2224
+ if (r?.value.unit === k.AspectRatio && r.value.ratioWidth && r.value.ratioHeight) {
2225
+ let { ratioHeight: e, ratioWidth: t } = r.value;
1857
2226
  this.resizeSize = {
1858
2227
  ...this.resizeSize,
1859
2228
  ratioHeight: e,
1860
- ratioWidth: n,
1861
- unit: D.AspectRatio
2229
+ ratioWidth: t,
2230
+ unit: k.AspectRatio
1862
2231
  };
1863
- } else if (t) {
1864
- let { height: e = 0, unit: n, width: r = 0 } = t.value;
2232
+ } else if (r) {
2233
+ let { height: e = 0, unit: t, width: n = 0 } = r.value;
1865
2234
  this.resizeSize = {
1866
2235
  ...this.resizeSize,
1867
2236
  height: e,
1868
- unit: n ?? D.Pixel,
1869
- width: r
2237
+ unit: t ?? k.Pixel,
2238
+ width: n
1870
2239
  };
1871
2240
  } else this.resizeSize = {
1872
2241
  ...this.resizeSize,
1873
2242
  height: 1,
1874
- unit: D.Pixel,
2243
+ unit: k.Pixel,
1875
2244
  width: 1
1876
2245
  };
1877
- let n = this.transformations.findLast((e) => e.key === k.Rotate);
1878
- this.rotation = n?.value.rotation ?? 0;
1879
- let r = this.transformations.findLast((e) => e.key === k.Quality)?.value.quality ?? 100, i = this.transformations.some((e) => e.key === k.Metadata);
2246
+ let i = this.transformations.findLast((e) => e.key === O.Rotate);
2247
+ this.rotation = i?.value.rotation ?? 0;
2248
+ let a = this.transformations.findLast((e) => e.key === O.Quality)?.value.quality ?? 100, o = this.transformations.some((e) => e.key === O.Metadata);
1880
2249
  this.selectedFormat = this.selectedFormat ? {
1881
2250
  ...this.selectedFormat,
1882
- keepMetadata: i,
1883
- quality: r
2251
+ keepMetadata: o,
2252
+ quality: a
1884
2253
  } : {
1885
2254
  extension: "",
1886
2255
  height: 0,
1887
- keepMetadata: i,
1888
- quality: r,
2256
+ keepMetadata: o,
2257
+ quality: a,
1889
2258
  rotation: 0,
1890
2259
  url: "",
1891
2260
  width: 0,
@@ -1896,43 +2265,43 @@ var Et = Q, Dt, $ = class extends s {
1896
2265
  }
1897
2266
  if (!this.selectedFormat) return;
1898
2267
  this.loading = !0;
1899
- let e = await this.requestTransformAsset();
1900
- if (this.loading = !1, !e?.relativePath || !this.selectedFormat) return;
2268
+ let r = await this.requestTransformAsset();
2269
+ if (this.loading = !1, !r?.relativePath || !this.selectedFormat) return;
1901
2270
  this.lastImageSize = {
1902
- height: e.height,
1903
- width: e.width
2271
+ height: r.height,
2272
+ width: r.width
1904
2273
  }, this.resizeSize = {
1905
- height: e.height,
2274
+ height: r.height,
1906
2275
  keepAspectRatio: !0,
1907
2276
  ratioHeight: 1,
1908
2277
  ratioWidth: 1,
1909
- unit: D.Pixel,
1910
- width: e.width
2278
+ unit: k.Pixel,
2279
+ width: r.width
1911
2280
  }, this.cropSize = {
1912
2281
  cropMode: "free",
1913
2282
  focusMode: "manual",
1914
- height: e.height,
2283
+ height: r.height,
1915
2284
  keepAspectRatio: this.cropSize.keepAspectRatio,
1916
2285
  percentageHeight: 100,
1917
2286
  percentageWidth: 100,
1918
2287
  position: v.CenterCenter,
1919
2288
  ratioHeight: 1,
1920
2289
  ratioWidth: 1,
1921
- unit: D.Pixel,
1922
- width: e.width,
2290
+ unit: k.Pixel,
2291
+ width: r.width,
1923
2292
  x: 0,
1924
2293
  y: 0
1925
- }, this.lastAction === k.Rotate && (this.rotation = 0), this.lastAction = void 0;
1926
- let t = this.transformations.some((e) => e.key === k.Metadata), n = this.transformations.findLast((e) => e.key === k.Quality);
2294
+ }, this.lastAction === O.Rotate && (this.rotation = 0), this.lastAction = void 0;
2295
+ let i = this.transformations.some((e) => e.key === O.Metadata), a = this.transformations.findLast((e) => e.key === O.Quality);
1927
2296
  this.selectedFormat = {
1928
2297
  ...this.selectedFormat,
1929
- height: e.height,
1930
- keepMetadata: t,
1931
- quality: n?.value?.quality ?? this.selectedFormat.quality,
1932
- url: this.baseUrl && this.baseUrl.length > 0 ? `${this.baseUrl}/${e.relativePath}` : e.relativePath,
1933
- width: e.width
2298
+ height: r.height,
2299
+ keepMetadata: i,
2300
+ quality: a?.value?.quality ?? this.selectedFormat.quality,
2301
+ url: this.baseUrl && this.baseUrl.length > 0 ? `${this.baseUrl}/${r.relativePath}` : r.relativePath,
2302
+ width: r.width
1934
2303
  };
1935
- let r = T({
2304
+ let o = w({
1936
2305
  asset: this.asset,
1937
2306
  baseUrl: "",
1938
2307
  extension: this.selectedFormat.extension,
@@ -1940,7 +2309,7 @@ var Et = Q, Dt, $ = class extends s {
1940
2309
  transformations: this.transformations,
1941
2310
  useSession: this.useSession
1942
2311
  });
1943
- this.emit("cx-asset-link-format-change", { detail: r });
2312
+ this.emit("cx-asset-link-format-change", { detail: o });
1944
2313
  }
1945
2314
  handleCropperElementChange() {
1946
2315
  this.cropperElement && (this.cropperElement.resizer = this.resizeSize, this.cropperElement.cropper = this.cropSize, this.cropperElement.rotation = this.rotation, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop", this.cropperElement.addEventListener("cx-cropper-crop-complete", this.onCropComplete), this.cropperElement.addEventListener("cx-cropper-crop-drag-start", this.onCropDragStart), this.cropperElement.loadable = !0);
@@ -1954,7 +2323,7 @@ var Et = Q, Dt, $ = class extends s {
1954
2323
  height: Number.parseInt(this.asset.height, 10),
1955
2324
  width: Number.parseInt(this.asset.width, 10)
1956
2325
  });
1957
- let e = this.transformations.findLast((e) => e.key === k.Quality);
2326
+ let e = this.transformations.findLast((e) => e.key === O.Quality);
1958
2327
  this.selectedFormat = {
1959
2328
  extension: this.asset.extension,
1960
2329
  height: this.defaultSize.height,
@@ -1979,7 +2348,7 @@ var Et = Q, Dt, $ = class extends s {
1979
2348
  position: v.CenterCenter,
1980
2349
  ratioHeight: 1,
1981
2350
  ratioWidth: 1,
1982
- unit: D.Pixel,
2351
+ unit: k.Pixel,
1983
2352
  width: this.defaultSize.width,
1984
2353
  x: 0,
1985
2354
  y: 0
@@ -1998,7 +2367,7 @@ var Et = Q, Dt, $ = class extends s {
1998
2367
  t.proxyName === "TRX" && (t.formatHeight = Number(this.asset.height), t.formatWidth = Number(this.asset.width));
1999
2368
  let n = this.proxies?.find((t) => t.id === e);
2000
2369
  n && (this.asset && n.proxyName === "TRX" && (n.formatHeight = Number(this.asset.height), n.formatWidth = Number(this.asset.width)), this.transformations = this.transformations.map((e) => {
2001
- if (e.key === k.Crop) {
2370
+ if (e.key === O.Crop) {
2002
2371
  let r = e.value, i = r.width / n.formatWidth * t.formatWidth, a = r.height / n.formatHeight * t.formatHeight, o = r.x / n.formatWidth * t.formatWidth, s = r.y / n.formatHeight * t.formatHeight;
2003
2372
  return {
2004
2373
  ...e,
@@ -2011,7 +2380,7 @@ var Et = Q, Dt, $ = class extends s {
2011
2380
  }
2012
2381
  };
2013
2382
  }
2014
- if (e.key === k.Resize) {
2383
+ if (e.key === O.Resize) {
2015
2384
  let r = e.value, i = r.width / n.formatWidth * t.formatWidth, a = r.height / n.formatHeight * t.formatHeight;
2016
2385
  return {
2017
2386
  ...e,
@@ -2032,24 +2401,24 @@ var Et = Q, Dt, $ = class extends s {
2032
2401
  }, await this.updateComplete, this.cropSize = {
2033
2402
  cropMode: "free",
2034
2403
  focusMode: "manual",
2035
- height: this.lastCropSize[D.Pixel].height,
2404
+ height: this.lastCropSize[k.Pixel].height,
2036
2405
  keepAspectRatio: !0,
2037
2406
  percentageHeight: 100,
2038
2407
  percentageWidth: 100,
2039
2408
  position: v.CenterCenter,
2040
2409
  ratioHeight: 1,
2041
2410
  ratioWidth: 1,
2042
- unit: D.Pixel,
2043
- width: this.lastCropSize[D.Pixel].width,
2411
+ unit: k.Pixel,
2412
+ width: this.lastCropSize[k.Pixel].width,
2044
2413
  x: 0,
2045
2414
  y: 0
2046
2415
  }, this.resizeSize = {
2047
- height: this.lastResizeSize[D.Pixel].height,
2416
+ height: this.lastResizeSize[k.Pixel].height,
2048
2417
  keepAspectRatio: !0,
2049
2418
  ratioHeight: 1,
2050
2419
  ratioWidth: 1,
2051
- unit: D.Pixel,
2052
- width: this.lastResizeSize[D.Pixel].width
2420
+ unit: k.Pixel,
2421
+ width: this.lastResizeSize[k.Pixel].width
2053
2422
  };
2054
2423
  }
2055
2424
  handleLoadingChange() {
@@ -2067,19 +2436,96 @@ var Et = Q, Dt, $ = class extends s {
2067
2436
  handleRotationChange() {
2068
2437
  this.cropperElement && (this.cropperElement.rotation = this.rotation);
2069
2438
  }
2439
+ handlePartsChange() {
2440
+ if (this.activeParts.some((e) => {
2441
+ let t = e === j.Rotate ? "rotation" : e;
2442
+ return this.activeSetting === `cx-asset-link-format-${t}`;
2443
+ }) || (this.activeSetting = ""), this.canReorder) {
2444
+ let e = X.orderTransformations(X.uniqueTransformations(this.transformations), this.activeParts);
2445
+ (e.length !== this.transformations.length || e.some((e, t) => e !== this.transformations[t])) && (this.transformations = e);
2446
+ }
2447
+ }
2448
+ handleReorderableChange() {
2449
+ if (this.orderUndo = [], this.canReorder && this.parts === this.initialParts && this.transformations.length > 0) {
2450
+ let e = X.uniqueTransformations(this.transformations).flatMap((e) => Z.filter((t) => Ut[t] === e.key)), t = [...e, ...Z.filter((t) => Ut[t] && !e.includes(t))], n = 0;
2451
+ this.parts = Z.map((e) => Ut[e] ? t[n++] : e);
2452
+ }
2453
+ this.handlePartsChange(), this.syncSortable();
2454
+ }
2455
+ async syncSortable() {
2456
+ let e = ++this.sortableRevision;
2457
+ if (this.sortable?.destroy(), this.sortable = void 0, !this.canReorder) return;
2458
+ await this.updateComplete;
2459
+ let { default: t } = await import("./sortable.esm.BVU0_hc5.js").then((e) => e.n);
2460
+ if (e !== this.sortableRevision || !this.isConnected || !this.canReorder) return;
2461
+ let n = this.shadowRoot?.querySelector(".asset-link-format__panels");
2462
+ n && (this.sortable = t.create(n, {
2463
+ animation: 0,
2464
+ direction: "vertical",
2465
+ draggable: "[data-reorderable]",
2466
+ handle: ".asset-link-format__drag-handle",
2467
+ invertSwap: !0,
2468
+ invertedSwapThreshold: .5,
2469
+ onEnd: (e) => {
2470
+ let t = e.item.dataset.part, r = [...n.querySelectorAll("[data-reorderable]")].map((e) => e.dataset.part);
2471
+ this.dragPreviousSibling?.after(e.item), this.dragPreviousSibling = null, this.movePart(t, r.indexOf(t));
2472
+ },
2473
+ onStart: (e) => {
2474
+ this.dragPreviousSibling = e.item.previousSibling;
2475
+ }
2476
+ }));
2477
+ }
2478
+ rememberOrder() {
2479
+ this.orderUndo = [...this.orderUndo, {
2480
+ autoFormat: this.autoFormat,
2481
+ parts: [...this.activeParts],
2482
+ selectedProxy: this.selectedProxy,
2483
+ transformations: this.transformations.map((e) => ({
2484
+ ...e,
2485
+ value: { ...e.value }
2486
+ }))
2487
+ }];
2488
+ }
2489
+ emitReorder() {
2490
+ this.emit("cx-asset-link-format-reorder", { detail: {
2491
+ parts: [...this.activeParts],
2492
+ transformations: this.transformations.map((e) => ({
2493
+ ...e,
2494
+ value: { ...e.value }
2495
+ }))
2496
+ } });
2497
+ }
2498
+ movePart(e, t) {
2499
+ if (!this.canReorder || this.loading) return;
2500
+ let n = this.activeParts.filter((e) => Q.includes(e)), r = n.indexOf(e);
2501
+ if (r < 0 || t < 0 || t >= n.length || r === t) return;
2502
+ this.rememberOrder(), n.splice(r, 1), n.splice(t, 0, e);
2503
+ let i = 0;
2504
+ this.parts = this.activeParts.map((e) => Q.includes(e) ? n[i++] : e);
2505
+ let a = X.orderTransformations(this.transformations, this.parts);
2506
+ a.some((e, t) => e !== this.transformations[t]) && (this.transformations = a), this.capCropToMaxSize(), this.reorderAnnouncement = `${this.localize.term(e)}: ${t + 1} / ${n.length}`, this.emitReorder(), this.updateComplete.then(() => {
2507
+ this.shadowRoot?.querySelector(`[data-part="${e}"] .asset-link-format__drag-handle`)?.focus();
2508
+ });
2509
+ }
2510
+ handleReorderKeyDown(e) {
2511
+ if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
2512
+ e.preventDefault(), e.stopPropagation();
2513
+ let t = e.currentTarget.closest("[data-part]")?.dataset.part, n = this.activeParts.filter((e) => Q.includes(e));
2514
+ this.movePart(t, n.indexOf(t) + (e.key === "ArrowUp" ? -1 : 1));
2515
+ }
2070
2516
  handleActiveSettingChange() {
2071
2517
  this.cropperElement && (this.resizeSize = {
2072
- height: this.lastResizeSize[D.Pixel].height,
2518
+ height: this.lastResizeSize[k.Pixel].height,
2073
2519
  keepAspectRatio: !0,
2074
2520
  ratioHeight: 1,
2075
2521
  ratioWidth: 1,
2076
- unit: D.Pixel,
2077
- width: this.lastResizeSize[D.Pixel].width
2522
+ unit: k.Pixel,
2523
+ width: this.lastResizeSize[k.Pixel].width
2078
2524
  }, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop");
2079
2525
  }
2080
2526
  async handleRequestAutoCropSuggestion({ cropMode: e, focusMode: t, height: n, keepAspectRatio: r, percentageHeight: i, percentageWidth: a, ratioHeight: o, ratioWidth: s, unit: c, useCropMode: l, width: u }) {
2081
2527
  if (!this.selectedFormat?.url || t === "manual") return;
2082
- this.loading = !0, this.lastAction = k.Crop;
2528
+ this.loading = !0, this.lastAction = O.Crop;
2083
2529
  let d = await this.apiGetCropFocusMode({
2084
2530
  autoCropMode: t,
2085
2531
  cropHeight: n,
@@ -2150,12 +2596,12 @@ var Et = Q, Dt, $ = class extends s {
2150
2596
  this.activeSetting === e.target.localName && (this.activeSetting = "");
2151
2597
  }
2152
2598
  get autoResolvedProxyId() {
2153
- let e = pe(this.asset?.extension, this.asset?.size);
2599
+ let e = he(this.asset?.extension, this.asset?.size);
2154
2600
  return this.proxies?.find((t) => t.proxyName === e)?.id ?? "";
2155
2601
  }
2156
2602
  onProxyChange(e) {
2157
2603
  let t = e.detail;
2158
- if (this.lastAction = k.Proxy, t.autoFormat) {
2604
+ if (this.lastAction = O.Proxy, t.autoFormat) {
2159
2605
  this.autoFormat = !0;
2160
2606
  let e = this.autoResolvedProxyId;
2161
2607
  e && (this.selectedProxy = e);
@@ -2171,7 +2617,7 @@ var Et = Q, Dt, $ = class extends s {
2171
2617
  });
2172
2618
  else {
2173
2619
  let e = this.focusModes.find((e) => e.value === this.cropSize.focusMode)?.auto, n = this.cropSize.keepAspectRatio, r = this.cropSize.focusMode, i = this.cropSize.x, a = this.cropSize.y;
2174
- t === "free" ? (n = !1, r = "manual") : this.cropSize.unit === D.Pixel && !e && (i = 0, a = 0), e ? await this.handleRequestAutoCropSuggestion({
2620
+ t === "free" ? (n = !1, r = "manual") : this.cropSize.unit === k.Pixel && !e && (i = 0, a = 0), e ? await this.handleRequestAutoCropSuggestion({
2175
2621
  cropMode: t,
2176
2622
  focusMode: r,
2177
2623
  height: this.cropSize.height,
@@ -2186,31 +2632,32 @@ var Et = Q, Dt, $ = class extends s {
2186
2632
  y: a
2187
2633
  };
2188
2634
  }
2635
+ this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
2189
2636
  }
2190
- onCropFocusModeChange(e) {
2637
+ async onCropFocusModeChange(e) {
2191
2638
  let { mode: t } = e.detail;
2192
- this.focusModes.find((e) => e.value === t)?.auto && this.selectedFormat?.url ? this.handleRequestAutoCropSuggestion({
2639
+ this.focusModes.find((e) => e.value === t)?.auto && this.selectedFormat?.url ? await this.handleRequestAutoCropSuggestion({
2193
2640
  focusMode: t,
2194
2641
  height: this.cropSize.height,
2195
2642
  width: this.cropSize.width
2196
2643
  }) : this.cropSize = {
2197
2644
  ...this.cropSize,
2198
2645
  focusMode: t
2199
- };
2646
+ }, this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
2200
2647
  }
2201
2648
  onCropPositionChange(e) {
2202
2649
  this.cropSize = {
2203
2650
  ...this.cropSize,
2204
2651
  position: e.detail.position
2205
- };
2652
+ }, this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
2206
2653
  }
2207
2654
  async onCropChange(e) {
2208
2655
  let t = this.cropSize.unit;
2209
- if (e.detail.unit === D.AspectRatio) {
2656
+ if (e.detail.unit === k.AspectRatio) {
2210
2657
  let t = e.detail.width / e.detail.height, n = this.asset ? Math.min(Math.max(Math.round(this.cropSize.height * t), 0), this.resizeSize.width) : 0, r = this.asset ? Math.min(Math.max(Math.round(n / t), 0), this.resizeSize.height) : 0, i = this.asset ? r * 100 / this.selectedFormat.height : 100, a = this.asset ? n * 100 / this.selectedFormat.width : 100, o = this.cropSize.x, s = this.cropSize.y;
2211
2658
  o + a > 100 && (o = 100 - a), s + i > 100 && (s = 100 - i);
2212
2659
  let c = this.cropSize.cropMode;
2213
- this.cropModes.find((e) => e.value === c)?.auto && (c = "free"), e.detail.silent ? (this.cropSize.height = r, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = a, this.cropSize.ratioHeight = e.detail.height, this.cropSize.ratioWidth = e.detail.width, this.cropSize.unit = D.AspectRatio, this.cropSize.width = n) : this.cropSize = {
2660
+ this.cropModes.find((e) => e.value === c)?.auto && (c = "free"), e.detail.silent ? (this.cropSize.height = r, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = a, this.cropSize.ratioHeight = e.detail.height, this.cropSize.ratioWidth = e.detail.width, this.cropSize.unit = k.AspectRatio, this.cropSize.width = n) : this.cropSize = {
2214
2661
  ...this.cropSize,
2215
2662
  cropMode: c,
2216
2663
  height: r,
@@ -2219,7 +2666,7 @@ var Et = Q, Dt, $ = class extends s {
2219
2666
  percentageWidth: a,
2220
2667
  ratioHeight: e.detail.height,
2221
2668
  ratioWidth: e.detail.width,
2222
- unit: D.AspectRatio,
2669
+ unit: k.AspectRatio,
2223
2670
  width: n,
2224
2671
  x: o,
2225
2672
  y: s
@@ -2228,14 +2675,14 @@ var Et = Q, Dt, $ = class extends s {
2228
2675
  let t = this.asset ? e.detail.height * 100 / this.selectedFormat.height : 100, n = this.asset ? e.detail.width * 100 / this.selectedFormat.width : 100, r = this.cropSize.x, i = this.cropSize.y;
2229
2676
  r + n > 100 && (r = 100 - n), i + t > 100 && (i = 100 - t);
2230
2677
  let a = this.cropSize.cropMode, o = this.cropModes.find((e) => e.value === a)?.auto;
2231
- (e.detail.breakAspectRatio || o) && (a = "free"), e.detail.silent ? (this.cropSize.cropMode = a, this.cropSize.height = e.detail.height, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = t, this.cropSize.percentageWidth = n, this.cropSize.unit = D.Pixel, this.cropSize.width = e.detail.width, this.cropSize.x = r, this.cropSize.y = i) : this.cropSize = {
2678
+ (e.detail.breakAspectRatio || o) && (a = "free"), e.detail.silent ? (this.cropSize.cropMode = a, this.cropSize.height = e.detail.height, this.cropSize.keepAspectRatio = e.detail.keepAspectRatio, this.cropSize.percentageHeight = t, this.cropSize.percentageWidth = n, this.cropSize.unit = k.Pixel, this.cropSize.width = e.detail.width, this.cropSize.x = r, this.cropSize.y = i) : this.cropSize = {
2232
2679
  ...this.cropSize,
2233
2680
  cropMode: a,
2234
2681
  height: e.detail.height,
2235
2682
  keepAspectRatio: e.detail.keepAspectRatio,
2236
2683
  percentageHeight: t,
2237
2684
  percentageWidth: n,
2238
- unit: D.Pixel,
2685
+ unit: k.Pixel,
2239
2686
  width: e.detail.width,
2240
2687
  x: r,
2241
2688
  y: i
@@ -2244,21 +2691,28 @@ var Et = Q, Dt, $ = class extends s {
2244
2691
  t !== this.cropSize.unit && (this.cropSize = {
2245
2692
  ...this.cropSize,
2246
2693
  cropMode: "free"
2247
- }, this.onCropChanged());
2694
+ }, this.onCropChanged()), this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
2248
2695
  }
2249
2696
  async onCropChanged() {
2250
2697
  this.focusModes.find((e) => e.value === this.cropSize.focusMode)?.auto && await this.handleRequestAutoCropSuggestion({
2251
2698
  focusMode: this.cropSize.focusMode,
2252
2699
  height: this.cropSize.height,
2253
2700
  width: this.cropSize.width
2254
- });
2701
+ }), this.isFormatsLayout && this.cropEnabled && this.applyCropTransformation();
2255
2702
  }
2256
2703
  onCropApply(e) {
2257
- if (this.clearResetSnapshot(), this.lastAction = k.Crop, !this.asset) {
2704
+ this.applyCropTransformation(e.detail);
2705
+ }
2706
+ applyCropTransformation(e = {
2707
+ height: this.cropSize.height,
2708
+ unit: this.cropSize.unit,
2709
+ width: this.cropSize.width
2710
+ }) {
2711
+ if (this.clearResetSnapshot(), this.lastAction = O.Crop, !this.asset) {
2258
2712
  let { focusMode: e, height: t, position: n, ratioHeight: r, ratioWidth: i, unit: a, width: o, x: s, y: c } = this.cropSize, l = this.focusModes.find((t) => t.value === e)?.auto ?? !1;
2259
- if (a === D.AspectRatio) {
2713
+ if (a === k.AspectRatio) {
2260
2714
  i && r && this.upsertTransformation({
2261
- key: k.Crop,
2715
+ key: O.Crop,
2262
2716
  value: {
2263
2717
  focusMode: e,
2264
2718
  isFocusModeAuto: l,
@@ -2270,8 +2724,8 @@ var Et = Q, Dt, $ = class extends s {
2270
2724
  });
2271
2725
  return;
2272
2726
  }
2273
- (t || o) && this.upsertTransformation({
2274
- key: k.Crop,
2727
+ (t || o) && Number.isFinite(t) && Number.isFinite(o) && this.upsertTransformation({
2728
+ key: O.Crop,
2275
2729
  value: {
2276
2730
  focusMode: e,
2277
2731
  height: t,
@@ -2285,13 +2739,13 @@ var Et = Q, Dt, $ = class extends s {
2285
2739
  });
2286
2740
  return;
2287
2741
  }
2288
- let { height: t, mode: n, unit: r, width: i } = e.detail;
2742
+ let { height: t, mode: n, unit: r, width: i } = e;
2289
2743
  if (!this.cropperElement || !this.selectedFormat) return;
2290
2744
  let a = this.cropSize.focusMode, o = this.focusModes.find((e) => e.value === a)?.auto ?? !1;
2291
2745
  if (t && i && r) {
2292
2746
  let e = i, s = t;
2293
- if (r === D.AspectRatio && (e = this.cropSize.percentageWidth * this.selectedFormat.width / 100, s = this.cropSize.percentageHeight * this.selectedFormat.height / 100), n) this.transformations = [...this.transformations, {
2294
- key: k.Crop,
2747
+ if (r === k.AspectRatio && (e = this.cropSize.percentageWidth * this.selectedFormat.width / 100, s = this.cropSize.percentageHeight * this.selectedFormat.height / 100), n) this.transformations = [...this.transformations, {
2748
+ key: O.Crop,
2295
2749
  value: {
2296
2750
  focusMode: a,
2297
2751
  height: s,
@@ -2303,7 +2757,7 @@ var Et = Q, Dt, $ = class extends s {
2303
2757
  else {
2304
2758
  let t = this.cropSize.x / 100 * this.selectedFormat.width, n = this.cropSize.y / 100 * this.selectedFormat.height;
2305
2759
  this.transformations = [...this.transformations, {
2306
- key: k.Crop,
2760
+ key: O.Crop,
2307
2761
  value: {
2308
2762
  focusMode: a,
2309
2763
  height: s,
@@ -2316,7 +2770,7 @@ var Et = Q, Dt, $ = class extends s {
2316
2770
  }];
2317
2771
  }
2318
2772
  } else n && (this.transformations = [...this.transformations, {
2319
- key: k.Crop,
2773
+ key: O.Crop,
2320
2774
  value: {
2321
2775
  focusMode: a,
2322
2776
  isFocusModeAuto: o,
@@ -2325,8 +2779,8 @@ var Et = Q, Dt, $ = class extends s {
2325
2779
  }]);
2326
2780
  }
2327
2781
  onResizeChange(e) {
2328
- if (e.detail.unit === D.AspectRatio) {
2329
- let t = e.detail.width / e.detail.height, n = Math.max(Math.round(this.lastResizeSize[D.Pixel].height * t), 0), r = Math.max(Math.round(n / t), 0);
2782
+ if (e.detail.unit === k.AspectRatio) {
2783
+ let t = e.detail.width / e.detail.height, n = Math.max(Math.round(this.lastResizeSize[k.Pixel].height * t), 0), r = Math.max(Math.round(n / t), 0);
2330
2784
  this.resizeSize = {
2331
2785
  ...this.resizeSize,
2332
2786
  height: r,
@@ -2346,11 +2800,12 @@ var Et = Q, Dt, $ = class extends s {
2346
2800
  }
2347
2801
  onResizeApply(e) {
2348
2802
  let { height: t, unit: n, width: r } = e.detail;
2349
- if (this.clearResetSnapshot(), this.lastAction = k.Resize, !this.asset) {
2350
- if (n === D.AspectRatio) {
2803
+ if (!Number.isFinite(r) || !Number.isFinite(t)) return;
2804
+ if (this.clearResetSnapshot(), this.lastAction = O.Resize, !this.asset) {
2805
+ if (n === k.AspectRatio) {
2351
2806
  let { ratioHeight: e, ratioWidth: t } = this.resizeSize;
2352
2807
  t && e && this.upsertTransformation({
2353
- key: k.Resize,
2808
+ key: O.Resize,
2354
2809
  value: {
2355
2810
  ratioHeight: e,
2356
2811
  ratioWidth: t,
@@ -2359,20 +2814,20 @@ var Et = Q, Dt, $ = class extends s {
2359
2814
  });
2360
2815
  return;
2361
2816
  }
2362
- (t || r) && this.upsertTransformation({
2363
- key: k.Resize,
2817
+ (t || r) && (this.upsertTransformation({
2818
+ key: O.Resize,
2364
2819
  value: {
2365
2820
  height: t,
2366
2821
  unit: n,
2367
2822
  width: r
2368
2823
  }
2369
- });
2824
+ }), this.capCropToMaxSize());
2370
2825
  return;
2371
2826
  }
2372
2827
  if (!this.selectedFormat) return;
2373
2828
  let i = this.selectedFormat.width || this.defaultSize.width, a = this.selectedFormat.height || this.defaultSize.height, o = r, s = t;
2374
- this.resizeSize.unit === n ? n === D.AspectRatio && (o = Math.round(r / t * a), s = a) : (o = i, s = a), this.transformations = [...this.transformations, {
2375
- key: k.Resize,
2829
+ this.resizeSize.unit === n ? n === k.AspectRatio && (o = Math.round(r / t * a), s = a) : (o = i, s = a), this.transformations = [...this.transformations, {
2830
+ key: O.Resize,
2376
2831
  value: {
2377
2832
  height: s,
2378
2833
  unit: n,
@@ -2381,27 +2836,29 @@ var Et = Q, Dt, $ = class extends s {
2381
2836
  }];
2382
2837
  }
2383
2838
  onRotationChange(e) {
2384
- this.rotation = e.detail;
2839
+ this.rotation = e.detail, this.isFormatsLayout && this.applyRotationTransformation(e.detail);
2385
2840
  }
2386
2841
  onRotationApply(e) {
2387
- let t = e.detail;
2388
- if (this.clearResetSnapshot(), this.lastAction = k.Rotate, !this.asset) {
2389
- t ? this.upsertTransformation({
2390
- key: k.Rotate,
2391
- value: { rotation: t }
2392
- }) : this.transformations = this.transformations.filter((e) => e.key !== k.Rotate);
2842
+ this.applyRotationTransformation(e.detail);
2843
+ }
2844
+ applyRotationTransformation(e) {
2845
+ if (this.clearResetSnapshot(), this.lastAction = O.Rotate, !this.asset) {
2846
+ e ? this.upsertTransformation({
2847
+ key: O.Rotate,
2848
+ value: { rotation: e }
2849
+ }) : this.transformations = this.transformations.filter((e) => e.key !== O.Rotate);
2393
2850
  return;
2394
2851
  }
2395
2852
  this.selectedFormat && (this.transformations = [...this.transformations, {
2396
- key: k.Rotate,
2397
- value: { rotation: t }
2853
+ key: O.Rotate,
2854
+ value: { rotation: e }
2398
2855
  }]);
2399
2856
  }
2400
2857
  onQualityChange(e) {
2401
2858
  let t = e.detail;
2402
- this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction = k.Quality;
2859
+ this.selectedFormat && (this.selectedFormat.quality = t), this.clearResetSnapshot(), this.lastAction = O.Quality;
2403
2860
  let n = {
2404
- key: k.Quality,
2861
+ key: O.Quality,
2405
2862
  value: { quality: t }
2406
2863
  };
2407
2864
  this.asset ? this.transformations = [...this.transformations, n] : this.upsertTransformation(n);
@@ -2413,15 +2870,15 @@ var Et = Q, Dt, $ = class extends s {
2413
2870
  keepMetadata: t
2414
2871
  }, !this.asset) {
2415
2872
  t ? this.upsertTransformation({
2416
- key: k.Metadata,
2873
+ key: O.Metadata,
2417
2874
  value: { keepMetadata: t }
2418
- }) : this.transformations = this.transformations.filter((e) => e.key !== k.Metadata);
2875
+ }) : this.transformations = this.transformations.filter((e) => e.key !== O.Metadata);
2419
2876
  return;
2420
2877
  }
2421
2878
  t ? this.upsertTransformation({
2422
- key: k.Metadata,
2879
+ key: O.Metadata,
2423
2880
  value: { keepMetadata: t }
2424
- }) : this.transformations = this.transformations.filter((e) => e.key !== k.Metadata);
2881
+ }) : this.transformations = this.transformations.filter((e) => e.key !== O.Metadata);
2425
2882
  }
2426
2883
  onExtensionChange(e) {
2427
2884
  let t = e.detail;
@@ -2431,36 +2888,115 @@ var Et = Q, Dt, $ = class extends s {
2431
2888
  };
2432
2889
  }
2433
2890
  syncQuality() {
2434
- let e = this.transformations.findLast((e) => e.key === k.Quality)?.value?.quality;
2891
+ let e = this.transformations.findLast((e) => e.key === O.Quality)?.value?.quality;
2435
2892
  this.selectedFormat &&= {
2436
2893
  ...this.selectedFormat,
2437
2894
  quality: e ?? 100
2438
2895
  };
2439
2896
  }
2897
+ syncSelectedDimensions(e = !0) {
2898
+ let t = this.transformations.findLast((e) => e.key === O.Dimensions), n = X.getDimensionsSize(this.selectedDimensions);
2899
+ if (!t) {
2900
+ n && (this.selectedDimensions = void 0);
2901
+ return;
2902
+ }
2903
+ let r = Math.round(t.value.width ?? 0), i = Math.round(t.value.height ?? 0);
2904
+ if (e && n?.width === r && n.height === i) return;
2905
+ let a = this.dimensionsItems.find((e) => {
2906
+ let t = X.getDimensionsPresetSize(e.value);
2907
+ return !e.disabled && t?.width === r && t.height === i;
2908
+ });
2909
+ this.selectedDimensions = a ? {
2910
+ mode: D.Preset,
2911
+ value: a.value
2912
+ } : {
2913
+ height: i,
2914
+ mode: D.Custom,
2915
+ unit: A.Pixel,
2916
+ width: r
2917
+ };
2918
+ }
2440
2919
  get hasResettableState() {
2441
- return this.transformations.length > 0 || this.canAutoFormat && !this.autoFormat;
2920
+ let e = Wt.filter((e) => this.activeParts.includes(e));
2921
+ return this.canReorder && this.activeParts.some((t, n) => t !== e[n]) || this.transformations.length > 0 ? !0 : this.canAutoFormat && !this.autoFormat;
2442
2922
  }
2443
2923
  clearResetSnapshot() {
2444
- this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0;
2924
+ this.canReorder && this.rememberOrder(), this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0;
2445
2925
  }
2446
2926
  handleUndo() {
2927
+ if (this.canReorder && this.orderUndo.length > 0) {
2928
+ let e = this.orderUndo[this.orderUndo.length - 1];
2929
+ this.orderUndo = this.orderUndo.slice(0, -1), this.parts = e.parts, this.autoFormat = e.autoFormat, this.selectedProxy = e.selectedProxy, this.transformations = e.transformations, this.preResetTransformations = void 0, this.preResetAutoFormat = void 0, this.preResetSelectedProxy = void 0, this.emitReorder(), this.syncQuality();
2930
+ return;
2931
+ }
2447
2932
  !this.hasUnfrozenTransformations && this.preResetTransformations !== void 0 ? (this.transformations = this.preResetTransformations, this.preResetTransformations = void 0, this.preResetAutoFormat !== void 0 && (this.autoFormat = this.preResetAutoFormat, this.preResetAutoFormat = void 0), this.preResetSelectedProxy !== void 0 && (this.selectedProxy = this.preResetSelectedProxy, this.preResetSelectedProxy = void 0)) : this.transformations = this.transformations.slice(0, -1), this.syncQuality();
2448
2933
  }
2449
2934
  handleReset() {
2450
- if (this.preResetTransformations = [...this.transformations], this.preResetAutoFormat = this.autoFormat, this.preResetSelectedProxy = this.selectedProxy, this.canAutoFormat) this.autoFormat = !0, this.selectedProxy = this.autoResolvedProxyId || this.selectedProxy;
2935
+ if (this.canReorder && this.rememberOrder(), this.preResetTransformations = [...this.transformations], this.preResetAutoFormat = this.autoFormat, this.preResetSelectedProxy = this.selectedProxy, this.canAutoFormat) this.autoFormat = !0, this.selectedProxy = this.autoResolvedProxyId || this.selectedProxy;
2451
2936
  else {
2452
2937
  let e = !!this.defaultProxy && !!this.proxies?.some((e) => e.id === this.defaultProxy);
2453
2938
  this.selectedProxy = e ? this.defaultProxy : this.selectedProxy || this.proxies?.[0]?.id || "";
2454
2939
  }
2455
- this.transformations = [], this.frozenIndex = -1, this.syncQuality();
2940
+ this.transformations = [], this.canReorder && (this.parts = Wt.filter((e) => this.activeParts.includes(e)), this.emitReorder()), this.frozenIndex = -1, this.syncQuality();
2941
+ }
2942
+ onDimensionsChange(e) {
2943
+ e.stopPropagation();
2944
+ let t = X.getDimensionsSize(e.detail);
2945
+ this.clearResetSnapshot(), this.lastAction = O.Dimensions, this.selectedDimensions = { ...e.detail }, t ? this.upsertTransformation({
2946
+ key: O.Dimensions,
2947
+ value: t
2948
+ }) : this.transformations = this.transformations.filter((e) => e.key !== O.Dimensions), this.capCropToMaxSize();
2949
+ }
2950
+ onCropToggle(e) {
2951
+ e.stopPropagation(), this.clearResetSnapshot(), this.cropEnabled = e.currentTarget.checked, this.cropEnabled || (this.transformations = this.transformations.filter((e) => e.key !== O.Crop)), this.emit("cx-asset-link-format-crop-toggle", { detail: this.cropEnabled });
2952
+ }
2953
+ renderDimensionsPart() {
2954
+ return e`<cx-asset-link-format-dimensions class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ? N.Automatic : N.Manual} .inline=${this.isFormatsLayout} ?open=${this.activeSetting === "cx-asset-link-format-dimensions"} ?loading=${this.loading} .items=${this.dimensionsItems} .value=${this.selectedDimensions} ?can-custom=${this.canCustomDimensions} @cx-asset-link-format-dimensions-change=${this.onDimensionsChange}></cx-asset-link-format-dimensions>`;
2955
+ }
2956
+ renderHeader() {
2957
+ return m(!this.hideHeader && !this.isFormatsLayout, () => e`<cx-space class="asset-link-format__section-header" direction="horizontal" spacing="small" align-items="center" justify-content="space-between"><cx-typography variant="body3">${this.localize.term("transformations")}</cx-typography><cx-space direction="horizontal" spacing="3x-small" align-items="center"><cx-button class="asset-link-format__undo" variant="custom" ?disabled=${!this.hasUnfrozenTransformations && this.preResetTransformations === void 0 && (!this.canReorder || this.orderUndo.length === 0)} @click=${this.handleUndo}>${this.localize.term("undo")}</cx-button>${m(this.canReset, () => e`<cx-button class="asset-link-format__reset" variant="custom" ?disabled=${!this.hasResettableState} @click=${this.handleReset}>${this.localize.term("reset")}</cx-button>`)}</cx-space></cx-space>`, () => n);
2958
+ }
2959
+ renderOrderHint() {
2960
+ return m(this.canReorder, () => e`<div class="asset-link-format__order-hint" data-testid="cx-asset-link-format-order-hint">${this.localize.term("transformationOrderHint")}</div>`);
2961
+ }
2962
+ renderProxyPart() {
2963
+ return e`<cx-asset-link-format-proxy class="asset-link-format__details" value=${this.selectedProxy || this.proxies?.[0]?.id || ""} ?open=${this.activeSetting === "cx-asset-link-format-proxy"} ?auto-format=${this.autoFormat} ?can-auto-format=${this.canAutoFormat} .items=${this.formats} ?loading=${this.loading && this.lastAction === O.Proxy} @cx-asset-link-format-proxy-change=${this.onProxyChange}></cx-asset-link-format-proxy>`;
2964
+ }
2965
+ renderCropEditor(t) {
2966
+ let n = this.asset ? this.lastResizeSize[k.Pixel] : this.cropMaxSize;
2967
+ return e`<cx-asset-link-format-crop class="asset-link-format__details" .inline=${t} ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction === O.Crop} ?show-position-picker=${!this.asset} ?keep-aspect-ratio=${this.cropSize.keepAspectRatio} focus-mode=${this.cropSize.focusMode} crop-mode=${this.cropSize.cropMode} width=${this.cropSize.width} height=${this.cropSize.height} max-width=${n.width} max-height=${n.height} percentage-width=${this.cropSize.percentageWidth} percentage-height=${this.cropSize.percentageHeight} position=${this.cropSize.position} ratio-width=${this.cropSize.ratioWidth} ratio-height=${this.cropSize.ratioHeight} unit=${this.cropSize.unit} .lastAppliedSetting=${this.lastCropSize} .cropModes=${this.cropModes} .focusModes=${this.focusModes} @cx-asset-link-format-crop-mode-change=${this.onCropModeChange} @cx-asset-link-format-crop-focus-mode-change=${this.onCropFocusModeChange} @cx-asset-link-format-crop-position-change=${this.onCropPositionChange} @cx-asset-link-format-crop-change=${this.onCropChange} @cx-asset-link-format-crop-changed=${this.onCropChanged} @cx-asset-link-format-crop-apply=${this.onCropApply}></cx-asset-link-format-crop>`;
2968
+ }
2969
+ renderCropPart() {
2970
+ return this.isFormatsLayout ? e`<div class="asset-link-format__formats-crop"><cx-space class="asset-link-format__formats-summary" align-items="center" justify-content="space-between"><cx-space align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-switch data-testid="cx-asset-link-format-crop-toggle" .checked=${this.cropEnabled} ?disabled=${this.loading} @cx-change=${this.onCropToggle}><cx-visually-hidden>${this.localize.term("crop")}</cx-visually-hidden></cx-switch></cx-space>${m(this.cropEnabled, () => this.renderCropEditor(!0))}</div>` : this.renderCropEditor(!1);
2971
+ }
2972
+ renderResizePart() {
2973
+ return e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction === O.Resize} ?no-ratio-modes=${!this.asset} ?keep-aspect-ratio=${this.resizeSize.keepAspectRatio} width=${this.resizeSize.width} height=${this.resizeSize.height} max-width=${this.asset ? this.imageSize.width : Infinity} max-height=${this.asset ? this.imageSize.height : Infinity} ratio-width=${this.resizeSize.ratioWidth} ratio-height=${this.resizeSize.ratioHeight} unit=${this.resizeSize.unit} .lastAppliedSetting=${this.lastResizeSize} @cx-asset-link-format-resize-change=${this.onResizeChange} @cx-asset-link-format-resize-apply=${this.onResizeApply}></cx-asset-link-format-resize>`;
2974
+ }
2975
+ renderRotatePart() {
2976
+ return e`<cx-asset-link-format-rotation class="asset-link-format__details" .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction === O.Rotate} ?open=${this.activeSetting === "cx-asset-link-format-rotation"} default-value=${this.selectedFormat?.rotation ?? 0} last-applied-value=${this.lastRotation} value=${this.rotation} @cx-asset-link-format-rotation-change=${this.onRotationChange} @cx-asset-link-format-rotation-apply=${this.onRotationApply}></cx-asset-link-format-rotation>`;
2977
+ }
2978
+ renderQualityPart() {
2979
+ return e`<cx-asset-link-format-quality class="asset-link-format__details" .applyBehavior=${this.isFormatsLayout ? N.Automatic : N.Manual} .inline=${this.isFormatsLayout} ?loading=${this.loading && this.lastAction === O.Quality} ?open=${this.activeSetting === "cx-asset-link-format-quality"} value=${this.selectedFormat?.quality ?? 100} .items=${this.qualityItems} @cx-asset-link-format-quality-change=${this.onQualityChange}></cx-asset-link-format-quality>`;
2980
+ }
2981
+ renderMetadataPart() {
2982
+ return e`<cx-asset-link-format-metadata class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-metadata"} .value=${this.selectedFormat?.keepMetadata ?? !1} @cx-asset-link-format-metadata-change=${this.onMetadataChange}></cx-asset-link-format-metadata>`;
2983
+ }
2984
+ renderPart(e) {
2985
+ switch (e) {
2986
+ case j.Dimensions: return this.renderDimensionsPart();
2987
+ case j.Proxy: return this.renderProxyPart();
2988
+ case j.Crop: return this.renderCropPart();
2989
+ case j.Resize: return this.renderResizePart();
2990
+ case j.Rotate: return this.renderRotatePart();
2991
+ case j.Quality: return this.renderQualityPart();
2992
+ case j.Metadata: return this.renderMetadataPart();
2993
+ default: return n;
2994
+ }
2456
2995
  }
2457
2996
  render() {
2458
- return e`<div class="asset-link-format" @cx-show=${this.onDetailsShow} @cx-hide=${this.onDetailsHide}>${m(!this.hideHeader, () => e`<cx-space class="asset-link-format__section-header" direction="horizontal" spacing="small" align-items="center" justify-content="space-between"><cx-typography variant="body3">${this.localize.term("transformations")}</cx-typography><cx-space direction="horizontal" spacing="3x-small" align-items="center"><cx-button class="asset-link-format__undo" variant="custom" ?disabled=${!this.hasUnfrozenTransformations && this.preResetTransformations === void 0} @click=${this.handleUndo}>${this.localize.term("undo")}</cx-button>${m(this.canReset, () => e`<cx-button class="asset-link-format__reset" variant="custom" ?disabled=${!this.hasResettableState} @click=${this.handleReset}>${this.localize.term("reset")}</cx-button>`)}</cx-space></cx-space>`, () => n)}
2459
- ${m(!this.noFormat, () => e`<cx-asset-link-format-proxy class="asset-link-format__details" value=${this.selectedProxy || this.proxies?.[0]?.id || ""} ?open=${this.activeSetting === "cx-asset-link-format-proxy"} ?auto-format=${this.autoFormat} ?can-auto-format=${this.canAutoFormat} .items=${this.formats} ?loading=${this.loading && this.lastAction === k.Proxy} @cx-asset-link-format-proxy-change=${this.onProxyChange}></cx-asset-link-format-proxy>`)}
2460
- ${m(!this.noCrop, () => e`<cx-asset-link-format-crop class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?loading=${this.loading && this.lastAction === k.Crop} ?keep-aspect-ratio=${this.cropSize.keepAspectRatio} ?show-position-picker=${!this.asset} focus-mode=${this.cropSize.focusMode} crop-mode=${this.cropSize.cropMode} width=${this.cropSize.width} height=${this.cropSize.height} max-width=${this.asset ? this.lastResizeSize[D.Pixel].width : Infinity} max-height=${this.asset ? this.lastResizeSize[D.Pixel].height : Infinity} percentage-width=${this.cropSize.percentageWidth} percentage-height=${this.cropSize.percentageHeight} position=${this.cropSize.position} ratio-width=${this.cropSize.ratioWidth} ratio-height=${this.cropSize.ratioHeight} unit=${this.cropSize.unit} .lastAppliedSetting=${this.lastCropSize} .cropModes=${this.cropModes} .focusModes=${this.focusModes} @cx-asset-link-format-crop-mode-change=${this.onCropModeChange} @cx-asset-link-format-crop-focus-mode-change=${this.onCropFocusModeChange} @cx-asset-link-format-crop-position-change=${this.onCropPositionChange} @cx-asset-link-format-crop-change=${this.onCropChange} @cx-asset-link-format-crop-changed=${this.onCropChanged} @cx-asset-link-format-crop-apply=${this.onCropApply}></cx-asset-link-format-crop>`)}
2461
- ${m(!this.noResize, () => e`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?loading=${this.loading && this.lastAction === k.Resize} ?no-ratio-modes=${!this.asset} ?keep-aspect-ratio=${this.resizeSize.keepAspectRatio} width=${this.resizeSize.width} height=${this.resizeSize.height} max-width=${this.asset ? this.imageSize.width : Infinity} max-height=${this.asset ? this.imageSize.height : Infinity} ratio-width=${this.resizeSize.ratioWidth} ratio-height=${this.resizeSize.ratioHeight} unit=${this.resizeSize.unit} .lastAppliedSetting=${this.lastResizeSize} @cx-asset-link-format-resize-change=${this.onResizeChange} @cx-asset-link-format-resize-apply=${this.onResizeApply}></cx-asset-link-format-resize>`)}
2462
- ${m(!this.noRotate, () => e`<cx-asset-link-format-rotation class="asset-link-format__details" ?loading=${this.loading && this.lastAction === k.Rotate} ?open=${this.activeSetting === "cx-asset-link-format-rotation"} default-value=${this.selectedFormat?.rotation ?? 0} last-applied-value=${this.lastRotation} value=${this.rotation} @cx-asset-link-format-rotation-change=${this.onRotationChange} @cx-asset-link-format-rotation-apply=${this.onRotationApply}></cx-asset-link-format-rotation>`)}<cx-asset-link-format-quality class="asset-link-format__details" ?loading=${this.loading && this.lastAction === k.Quality} ?open=${this.activeSetting === "cx-asset-link-format-quality"} value=${this.selectedFormat?.quality ?? 100} @cx-asset-link-format-quality-change=${this.onQualityChange}></cx-asset-link-format-quality>${m(!this.noMetadata, () => e`<cx-asset-link-format-metadata class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-metadata"} .value=${this.selectedFormat?.keepMetadata ?? !1} @cx-asset-link-format-metadata-change=${this.onMetadataChange}></cx-asset-link-format-metadata>`)}
2463
- ${m(this.useCustomExtension, () => e`<cx-asset-link-format-extension .items=${this.extensions} value=${this.selectedFormat?.extension ?? ""} @cx-asset-link-format-extension-change=${this.onExtensionChange}></cx-asset-link-format-extension>`)}<div class="asset-link-format__footer"><slot name="footer"></slot></div></div>`;
2997
+ return e`<div class="asset-link-format ${this.isFormatsLayout ? "asset-link-format--formats" : ""}" @cx-show=${this.onDetailsShow} @cx-hide=${this.onDetailsHide}>${this.renderHeader()}
2998
+ ${this.renderOrderHint()}<div class="asset-link-format__panels">${b(this.activeParts, (e) => e, (t) => e`<div class="asset-link-format__panel" data-part=${t} ?data-reorderable=${this.canReorder && Q.includes(t)}>${m(this.canReorder && Q.includes(t), () => e`<cx-icon-button class="asset-link-format__drag-handle" name="drag_indicator" label=${this.localize.term("reorderTransformation", this.localize.term(t))} ?disabled=${this.loading} @keydown=${this.handleReorderKeyDown}></cx-icon-button>`)}
2999
+ ${this.renderPart(t)}</div>`)}</div><span class="asset-link-format__announcement" role="status" aria-live="polite">${this.reorderAnnouncement}</span>${m(this.useCustomExtension, () => e`<cx-asset-link-format-extension .items=${this.extensions} value=${this.selectedFormat?.extension ?? ""} @cx-asset-link-format-extension-change=${this.onExtensionChange}></cx-asset-link-format-extension>`)}<div class="asset-link-format__footer"><slot name="footer"></slot></div></div>`;
2464
3000
  }
2465
3001
  };
2466
3002
  a([r({
@@ -2518,26 +3054,26 @@ a([r({
2518
3054
  reflect: !0,
2519
3055
  type: Boolean
2520
3056
  }), o("design:type", Boolean)], $.prototype, "useCustomExtension", void 0), a([r({
2521
- attribute: "no-metadata",
2522
- reflect: !0,
2523
- type: Boolean
2524
- }), o("design:type", Boolean)], $.prototype, "noMetadata", void 0), a([r({
2525
- attribute: "no-format",
2526
- reflect: !0,
2527
- type: Boolean
2528
- }), o("design:type", Boolean)], $.prototype, "noFormat", void 0), a([r({
2529
- attribute: "no-crop",
3057
+ attribute: "parts",
3058
+ converter: De,
3059
+ type: Array
3060
+ }), o("design:type", Array)], $.prototype, "parts", void 0), a([r({
2530
3061
  reflect: !0,
2531
- type: Boolean
2532
- }), o("design:type", Boolean)], $.prototype, "noCrop", void 0), a([r({
2533
- attribute: "no-resize",
3062
+ type: String
3063
+ }), o("design:type", ge === void 0 ? Object : ge)], $.prototype, "layout", void 0), a([r({
3064
+ attribute: "crop-enabled",
2534
3065
  reflect: !0,
2535
3066
  type: Boolean
2536
- }), o("design:type", Boolean)], $.prototype, "noResize", void 0), a([r({
2537
- attribute: "no-rotate",
2538
- reflect: !0,
3067
+ }), o("design:type", Boolean)], $.prototype, "cropEnabled", void 0), a([r({ type: Boolean }), o("design:type", Object)], $.prototype, "reorderable", void 0), a([r({
3068
+ attribute: !1,
3069
+ type: Array
3070
+ }), o("design:type", Array)], $.prototype, "dimensionsItems", void 0), a([r({
3071
+ attribute: !1,
3072
+ type: Array
3073
+ }), o("design:type", Array)], $.prototype, "qualityItems", void 0), a([r({
3074
+ attribute: "can-custom-dimensions",
2539
3075
  type: Boolean
2540
- }), o("design:type", Boolean)], $.prototype, "noRotate", void 0), a([r({
3076
+ }), o("design:type", Object)], $.prototype, "canCustomDimensions", void 0), a([r({
2541
3077
  attribute: "last-image-size",
2542
3078
  reflect: !1,
2543
3079
  type: Object
@@ -2552,10 +3088,10 @@ a([r({
2552
3088
  attribute: !1,
2553
3089
  reflect: !1,
2554
3090
  type: Object
2555
- }), o("design:type", Object)], $.prototype, "queryElement", void 0), a([i(), o("design:type", String)], $.prototype, "activeSetting", void 0), a([i(), o("design:type", Object)], $.prototype, "selectedFormat", void 0), a([i(), o("design:type", Object)], $.prototype, "resizeSize", void 0), a([i(), o("design:type", Object)], $.prototype, "cropSize", void 0), a([i(), o("design:type", Number)], $.prototype, "rotation", void 0), a([i(), o("design:type", Object)], $.prototype, "defaultSize", void 0), a([i(), o("design:type", Object)], $.prototype, "cropperElement", void 0), a([i(), o("design:type", Array)], $.prototype, "parameters", void 0), a([i(), o("design:type", Boolean)], $.prototype, "loading", void 0), a([i(), o("design:type", Object)], $.prototype, "lastAction", void 0), a([i(), o("design:type", Object)], $.prototype, "frozenIndex", void 0), a([i(), o("design:type", Object)], $.prototype, "preResetTransformations", void 0), a([i(), o("design:type", Object)], $.prototype, "preResetAutoFormat", void 0), a([i(), o("design:type", Object)], $.prototype, "preResetSelectedProxy", void 0), a([
3091
+ }), o("design:type", Object)], $.prototype, "queryElement", void 0), a([i(), o("design:type", String)], $.prototype, "activeSetting", void 0), a([i(), o("design:type", Object)], $.prototype, "selectedFormat", void 0), a([i(), o("design:type", Object)], $.prototype, "resizeSize", void 0), a([i(), o("design:type", Object)], $.prototype, "cropSize", void 0), a([i(), o("design:type", Number)], $.prototype, "rotation", void 0), a([i(), o("design:type", Object)], $.prototype, "defaultSize", void 0), a([i(), o("design:type", Object)], $.prototype, "cropperElement", void 0), a([i(), o("design:type", Array)], $.prototype, "parameters", void 0), a([i(), o("design:type", Boolean)], $.prototype, "loading", void 0), a([i(), o("design:type", Object)], $.prototype, "lastAction", void 0), a([i(), o("design:type", Object)], $.prototype, "frozenIndex", void 0), a([i(), o("design:type", Object)], $.prototype, "preResetTransformations", void 0), a([i(), o("design:type", Object)], $.prototype, "preResetAutoFormat", void 0), a([i(), o("design:type", Object)], $.prototype, "preResetSelectedProxy", void 0), a([i(), o("design:type", Object)], $.prototype, "reorderAnnouncement", void 0), a([i(), o("design:type", Object)], $.prototype, "selectedDimensions", void 0), a([i(), o("design:type", typeof Array > "u" ? Object : Array)], $.prototype, "orderUndo", void 0), a([
2556
3092
  f("transformations"),
2557
3093
  o("design:type", Function),
2558
- o("design:paramtypes", []),
3094
+ o("design:paramtypes", [Object]),
2559
3095
  o("design:returntype", Promise)
2560
3096
  ], $.prototype, "handleTransformationsChange", null), a([
2561
3097
  f("selectedProxy"),
@@ -2567,7 +3103,17 @@ a([r({
2567
3103
  o("design:type", Function),
2568
3104
  o("design:paramtypes", []),
2569
3105
  o("design:returntype", void 0)
2570
- ], $.prototype, "handleLoadingChange", null), $ = Dt = a([u("cx-asset-link-format"), o("design:paramtypes", [])], $);
2571
- var Ot = $;
3106
+ ], $.prototype, "handleLoadingChange", null), a([
3107
+ f("parts"),
3108
+ o("design:type", Function),
3109
+ o("design:paramtypes", []),
3110
+ o("design:returntype", void 0)
3111
+ ], $.prototype, "handlePartsChange", null), a([
3112
+ f(["reorderable", "asset"]),
3113
+ o("design:type", Function),
3114
+ o("design:paramtypes", []),
3115
+ o("design:returntype", void 0)
3116
+ ], $.prototype, "handleReorderableChange", null), $ = X = a([u("cx-asset-link-format"), o("design:paramtypes", [])], $);
3117
+ var Gt = $;
2572
3118
  //#endregion
2573
- export { Je as C, tt as S, Ce as T, Ne as _, Le as a, Qe as b, L as c, Re as d, je as f, V as g, B as h, st as i, R as l, ze as m, ut as n, I as o, Me as p, ct as r, F as s, Ot as t, z as u, Pe as v, M as w, rt as x, nt as y };
3119
+ export { st as C, mt as S, ke as T, Ke as _, Xe as a, dt as b, I as c, Ze as d, Ue as f, Ge as g, L as h, bt as i, Ve as l, Qe as m, Ct as n, ze as o, We as p, xt as r, F as s, Gt as t, He as u, qe as v, Ae as w, gt as x, ht as y };