@eightshift/ui-components 2.0.2 → 3.0.1

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 (111) hide show
  1. package/dist/{Button-OQ5EIPvt.js → Button-BPLceDeW.js} +5 -5
  2. package/dist/{Collection-CJM_asJz.js → Collection-CZxddMZS.js} +241 -135
  3. package/dist/{Color-B0HgM8f4.js → Color-MV5kBVXr.js} +1 -1
  4. package/dist/{ColorSwatch-Dv3Wxdl_.js → ColorSwatch-BqQfVu4L.js} +5 -5
  5. package/dist/{ComboBox-BnlZjJ3T.js → ComboBox-_RfyhwZw.js} +42 -21
  6. package/dist/{Dialog-CIh-hX93.js → Dialog-8tYeQ9n4.js} +202 -91
  7. package/dist/{FieldError-D7A6s7O5.js → FieldError-52GVSGgC.js} +2 -2
  8. package/dist/{FocusScope-Cs5_OoeA.js → FocusScope-Cri5BFRz.js} +206 -43
  9. package/dist/{Group-D6tr3U_n.js → Group-_emcIVxI.js} +3 -3
  10. package/dist/{Heading-DiYTXoIW.js → Heading-B2153VXe.js} +1 -1
  11. package/dist/{Hidden-DnOd_jPX.js → Hidden-rE6uR-lr.js} +2 -6
  12. package/dist/{Input-Se0m3ubj.js → Input-BxpFEIXV.js} +10 -10
  13. package/dist/{Label-Ca9uelsn.js → Label-icmbmNdI.js} +2 -2
  14. package/dist/{List-Br274SP1.js → List-CZMUbkFU.js} +3 -1
  15. package/dist/{ListBox-D9dFEh5A.js → ListBox-Ca6hiCqz.js} +29 -28
  16. package/dist/{OverlayArrow-1jx-ZyCR.js → OverlayArrow-CYXQSlEU.js} +7 -7
  17. package/dist/{Select-aab027f3.esm-HFNIFFya.js → Select-aab027f3.esm-PDJCDE95.js} +2 -2
  18. package/dist/{Separator-BhZycTUp.js → Separator-4IIDRlV_.js} +4 -4
  19. package/dist/{Slider-BZNaJylD.js → Slider-rz2XRMGm.js} +15 -16
  20. package/dist/{Text-aOUPPvTO.js → Text-DVSAPY-K.js} +1 -1
  21. package/dist/{VisuallyHidden-ClTQo25k.js → VisuallyHidden-f9zX67a_.js} +2 -2
  22. package/dist/assets/style-admin.css +1289 -1338
  23. package/dist/assets/style-editor.css +433 -482
  24. package/dist/assets/style.css +433 -482
  25. package/dist/assets/wp-font-enhancements.css +3 -3
  26. package/dist/assets/wp-ui-enhancements.css +45 -45
  27. package/dist/components/base-control/base-control.js +1 -1
  28. package/dist/components/button/button.js +6 -6
  29. package/dist/components/checkbox/checkbox.js +13 -10
  30. package/dist/components/color-pickers/color-picker.js +1 -1
  31. package/dist/components/color-pickers/color-swatch.js +3 -3
  32. package/dist/components/color-pickers/gradient-editor.js +4 -4
  33. package/dist/components/color-pickers/solid-color-picker.js +22 -24
  34. package/dist/components/component-toggle/component-toggle.js +1 -1
  35. package/dist/components/container-panel/container-panel.js +9 -3
  36. package/dist/components/draggable/draggable-handle.js +2 -2
  37. package/dist/components/draggable/draggable.js +1167 -871
  38. package/dist/components/draggable-list/draggable-list-item.js +2 -2
  39. package/dist/components/draggable-list/draggable-list.js +2 -2
  40. package/dist/components/expandable/expandable.js +9 -9
  41. package/dist/components/input-field/input-field.js +10 -9
  42. package/dist/components/item-collection/item-collection.js +1 -1
  43. package/dist/components/link-input/link-input.js +9 -10
  44. package/dist/components/matrix-align/matrix-align.js +2 -2
  45. package/dist/components/menu/menu.js +3 -3
  46. package/dist/components/modal/modal.js +7 -7
  47. package/dist/components/number-picker/number-picker.js +15 -13
  48. package/dist/components/option-select/option-select.js +1 -1
  49. package/dist/components/options-panel/options-panel.js +1 -1
  50. package/dist/components/placeholders/file-placeholder.js +1 -1
  51. package/dist/components/placeholders/image-placeholder.js +1 -1
  52. package/dist/components/popover/popover.js +2 -2
  53. package/dist/components/radio/radio.js +20 -17
  54. package/dist/components/repeater/repeater-item.js +10 -3
  55. package/dist/components/repeater/repeater.js +34 -5
  56. package/dist/components/responsive/mini-responsive.js +8 -5
  57. package/dist/components/responsive/responsive-legacy.js +2 -2
  58. package/dist/components/responsive/responsive.js +10 -7
  59. package/dist/components/responsive-preview/responsive-preview.js +1 -1
  60. package/dist/components/rich-label/rich-label.js +4 -3
  61. package/dist/components/select/async-multi-select.js +4 -4
  62. package/dist/components/select/async-single-select.js +3 -3
  63. package/dist/components/select/custom-select-default-components.js +1 -1
  64. package/dist/components/select/multi-select-components.js +3 -3
  65. package/dist/components/select/multi-select.js +4 -4
  66. package/dist/components/select/react-select-component-wrappers.js +1 -1
  67. package/dist/components/select/single-select.js +3 -3
  68. package/dist/components/select/v2/async-select.js +10 -10
  69. package/dist/components/select/v2/shared.js +2 -2
  70. package/dist/components/select/v2/single-select.js +24 -23
  71. package/dist/components/slider/column-config-slider.js +3 -3
  72. package/dist/components/slider/slider.js +3 -3
  73. package/dist/components/slider/utils.js +1 -1
  74. package/dist/components/tabs/tabs.js +46 -26
  75. package/dist/components/toggle/switch.js +7 -7
  76. package/dist/components/toggle/toggle.js +1 -1
  77. package/dist/components/toggle-button/toggle-button.js +6 -6
  78. package/dist/components/tooltip/tooltip.js +18 -24
  79. package/dist/{context-CDOs-GuR.js → context-D2KUdwNL.js} +1 -1
  80. package/dist/{default-i18n-CM1-Xvzf.js → default-i18n-CT_oS1Fy.js} +22 -3
  81. package/dist/icons/icons.js +229 -1629
  82. package/dist/icons/index.js +2 -3
  83. package/dist/icons/jsx-svg.js +1 -1
  84. package/dist/{index-641ee5b8.esm-DbdaYaxR.js → index-641ee5b8.esm-DIuJijyT.js} +31 -31
  85. package/dist/{index-CcCn9HWX.js → index-BKGQ6jGS.js} +1 -1
  86. package/dist/{index-BRp93Yfa.js → index-CFozsmNS.js} +4 -1
  87. package/dist/{multi-select-components-DJfz929p.js → multi-select-components-Sp-JEFEX.js} +4 -4
  88. package/dist/{react-jsx-parser.min-CVit0rZn.js → react-jsx-parser.min-DZCiis5V.js} +48 -20
  89. package/dist/{react-select-async.esm-DcVLw9X5.js → react-select-async.esm-Bql4G5iV.js} +3 -3
  90. package/dist/{react-select.esm-OZ0cmTjg.js → react-select.esm-B_TudhTU.js} +3 -3
  91. package/dist/{textSelection-BlTDSskG.js → textSelection-0UUS8Yfg.js} +8 -47
  92. package/dist/{useButton-CmLbE5vg.js → useButton-Cg474OYB.js} +5 -5
  93. package/dist/{useEvent-cLDJlznQ.js → useEvent-B0b-6KBr.js} +1 -1
  94. package/dist/useFocusRing-CV5l3lf6.js +107 -0
  95. package/dist/{useFormReset-NpLM2e3G.js → useFormReset-C5OggHsw.js} +1 -1
  96. package/dist/{useFormValidation-BWwmZQE2.js → useFormValidation-DhDNSjws.js} +3 -3
  97. package/dist/{focusSafely-CiqTTjWy.js → useHover-DwDr6ozG.js} +305 -98
  98. package/dist/{useLabel-C85N3Hzw.js → useLabel-D7HkNEHT.js} +2 -2
  99. package/dist/{useLabels-C_2wWraB.js → useLabels-D8cxd1Z8.js} +1 -1
  100. package/dist/{useListState-Z7FB_NzO.js → useListState-DVr6aYd_.js} +28 -13
  101. package/dist/{useLocalizedStringFormatter-BQ4TF72x.js → useLocalizedStringFormatter-CFP1YZWQ.js} +1 -1
  102. package/dist/{useNumberField-Bm6_BVl9.js → useNumberField-TwM0Z9D1.js} +10 -10
  103. package/dist/{useNumberFormatter-DlUVKkO7.js → useNumberFormatter-321rAb4J.js} +1 -1
  104. package/dist/{usePress-rg_OQIGW.js → usePress-Cucx-xSA.js} +69 -63
  105. package/dist/{useSingleSelectListState-Cu3xtEJS.js → useSingleSelectListState-CMGsRHHh.js} +2 -2
  106. package/dist/{useToggle-DzlgBLAJ.js → useToggle-C0I3vs0g.js} +9 -7
  107. package/dist/{useToggleState-DhSBQxkp.js → useToggleState-CmQX3SoX.js} +1 -1
  108. package/dist/{utils-39D0mStj.js → utils-DkCSC521.js} +38 -35
  109. package/package.json +32 -32
  110. package/dist/useFocusRing-CGp3guTX.js +0 -41
  111. package/dist/useFocusable-087cO5Ct.js +0 -81
@@ -1,8 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useRef, useEffect, useLayoutEffect, useMemo, useState, createContext, startTransition, useTransition, useContext, useCallback, useId } from "react";
3
- import { _ as __ } from "../../default-i18n-CM1-Xvzf.js";
2
+ import { useEffect, useRef, useLayoutEffect, useMemo, useState, useCallback, startTransition, createContext, useTransition, useContext, useId } from "react";
3
+ import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
4
4
  import { DraggableContext } from "./draggable-context.js";
5
- import { r as reactDomExports } from "../../index-BRp93Yfa.js";
5
+ import { r as reactDomExports } from "../../index-CFozsmNS.js";
6
6
  var i = Symbol.for("preact-signals");
7
7
  function t() {
8
8
  if (!(s > 1)) {
@@ -449,8 +449,8 @@ var __spreadValues$6 = (a2, b2) => {
449
449
  };
450
450
  var __name$2 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
451
451
  var __decoratorStart$3 = (base) => {
452
- var _a3;
453
- return [, , , __create$3((_a3 = void 0) != null ? _a3 : null)];
452
+ var _a4;
453
+ return [, , , __create$3((_a4 = void 0) != null ? _a4 : null)];
454
454
  };
455
455
  var __decoratorStrings$3 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
456
456
  var __expectFn$3 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
@@ -596,9 +596,35 @@ var Rectangle = class _Rectangle {
596
596
  const { left, width } = this;
597
597
  return left + width;
598
598
  }
599
+ get aspectRatio() {
600
+ const { width, height } = this;
601
+ return width / height;
602
+ }
603
+ get corners() {
604
+ return [
605
+ { x: this.left, y: this.top },
606
+ { x: this.right, y: this.top },
607
+ { x: this.left, y: this.bottom },
608
+ { x: this.right, y: this.bottom }
609
+ ];
610
+ }
599
611
  static from({ top, left, width, height }) {
600
612
  return new _Rectangle(left, top, width, height);
601
613
  }
614
+ static delta(a2, b2, alignment = { x: "center", y: "center" }) {
615
+ const getCoordinate = (rect, axis) => {
616
+ const align = alignment[axis];
617
+ const start = axis === "x" ? rect.left : rect.top;
618
+ const size = axis === "x" ? rect.width : rect.height;
619
+ if (align == "start") return start;
620
+ if (align == "end") return start + size;
621
+ return start + size / 2;
622
+ };
623
+ return Point.delta(
624
+ { x: getCoordinate(a2, "x"), y: getCoordinate(a2, "y") },
625
+ { x: getCoordinate(b2, "x"), y: getCoordinate(b2, "y") }
626
+ );
627
+ }
602
628
  static intersectionRatio(a2, b2) {
603
629
  return _Rectangle.from(a2).intersectionRatio(_Rectangle.from(b2));
604
630
  }
@@ -760,8 +786,8 @@ var __objRest$3 = (source, exclude) => {
760
786
  return target;
761
787
  };
762
788
  var __decoratorStart$2 = (base) => {
763
- var _a3;
764
- return [, , , __create$2((_a3 = base == null ? void 0 : base[__knownSymbol$2("metadata")]) != null ? _a3 : null)];
789
+ var _a4;
790
+ return [, , , __create$2((_a4 = base == null ? void 0 : base[__knownSymbol$2("metadata")]) != null ? _a4 : null)];
765
791
  };
766
792
  var __decoratorStrings$2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
767
793
  var __expectFn$2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$3("Function expected") : fn;
@@ -801,15 +827,15 @@ var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "rea
801
827
  var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
802
828
  var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
803
829
  var __privateMethod$2 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
804
- function configure(plugin, options) {
830
+ function configure(plugin, options2) {
805
831
  return {
806
832
  plugin,
807
- options
833
+ options: options2
808
834
  };
809
835
  }
810
836
  function configurator(plugin) {
811
- return (options) => {
812
- return configure(plugin, options);
837
+ return (options2) => {
838
+ return configure(plugin, options2);
813
839
  };
814
840
  }
815
841
  function descriptor(plugin) {
@@ -821,13 +847,14 @@ function descriptor(plugin) {
821
847
  }
822
848
  return plugin;
823
849
  }
824
- var _disabled_dec, _init$2, _disabled;
850
+ var _disabled_dec, _init$2, _disabled, _cleanupFunctions$1;
825
851
  _disabled_dec = [reactive];
826
852
  var Plugin = class {
827
- constructor(manager, options) {
853
+ constructor(manager, options2) {
828
854
  this.manager = manager;
829
- this.options = options;
855
+ this.options = options2;
830
856
  __privateAdd$3(this, _disabled, __runInitializers$2(_init$2, 8, this, false)), __runInitializers$2(_init$2, 11, this);
857
+ __privateAdd$3(this, _cleanupFunctions$1, /* @__PURE__ */ new Set());
831
858
  }
832
859
  /**
833
860
  * Enable a disabled plugin instance.
@@ -855,25 +882,36 @@ var Plugin = class {
855
882
  /**
856
883
  * Configure a plugin instance with new options.
857
884
  */
858
- configure(options) {
859
- this.options = options;
885
+ configure(options2) {
886
+ this.options = options2;
887
+ }
888
+ /**
889
+ * Register an effect that will be cleaned up when the plugin instance is destroyed.
890
+ * Returns a cleanup function that can be used to dispose of the effect.
891
+ */
892
+ registerEffect(callback) {
893
+ const dispose = E(callback.bind(this));
894
+ __privateGet$3(this, _cleanupFunctions$1).add(dispose);
895
+ return dispose;
860
896
  }
861
897
  /**
862
898
  * Destroy a plugin instance.
863
899
  */
864
900
  destroy() {
901
+ __privateGet$3(this, _cleanupFunctions$1).forEach((cleanup) => cleanup());
865
902
  }
866
903
  /**
867
904
  * Configure a plugin constructor with options.
868
905
  * This method is used to configure the options that the
869
906
  * plugin constructor will use to create plugin instances.
870
907
  */
871
- static configure(options) {
872
- return configure(this, options);
908
+ static configure(options2) {
909
+ return configure(this, options2);
873
910
  }
874
911
  };
875
912
  _init$2 = __decoratorStart$2(null);
876
913
  _disabled = /* @__PURE__ */ new WeakMap();
914
+ _cleanupFunctions$1 = /* @__PURE__ */ new WeakMap();
877
915
  __decorateElement$2(_init$2, 4, "disabled", _disabled_dec, Plugin, _disabled);
878
916
  __decoratorMetadata$2(_init$2, Plugin);
879
917
  var CorePlugin = class extends Plugin {
@@ -904,8 +942,8 @@ var PluginRegistry = class {
904
942
  this.unregister(plugin);
905
943
  }
906
944
  }
907
- for (const { plugin, options } of descriptors) {
908
- this.register(plugin, options);
945
+ for (const { plugin, options: options2 } of descriptors) {
946
+ this.register(plugin, options2);
909
947
  }
910
948
  __privateSet$3(this, _previousValues, constructors);
911
949
  }
@@ -913,12 +951,15 @@ var PluginRegistry = class {
913
951
  const instance = this.instances.get(plugin);
914
952
  return instance;
915
953
  }
916
- register(plugin, options) {
954
+ register(plugin, options2) {
917
955
  const existingInstance = this.instances.get(plugin);
918
956
  if (existingInstance) {
957
+ if (existingInstance.options !== options2) {
958
+ existingInstance.options = options2;
959
+ }
919
960
  return existingInstance;
920
961
  }
921
- const instance = new plugin(this.manager, options);
962
+ const instance = new plugin(this.manager, options2);
922
963
  this.instances.set(plugin, instance);
923
964
  return instance;
924
965
  }
@@ -961,10 +1002,14 @@ var CollisionObserver = class extends Plugin {
961
1002
  const coordinates = n(
962
1003
  () => this.manager.dragOperation.position.current
963
1004
  );
964
- const previousCoordinates = __privateGet$3(this, _previousCoordinates);
965
- __privateSet$3(this, _previousCoordinates, coordinates);
966
- if (previousCoordinates && coordinates.x == previousCoordinates.x && coordinates.y == previousCoordinates.y) {
967
- return;
1005
+ if (collisions !== DEFAULT_VALUE) {
1006
+ const previousCoordinates = __privateGet$3(this, _previousCoordinates);
1007
+ __privateSet$3(this, _previousCoordinates, coordinates);
1008
+ if (previousCoordinates && coordinates.x == previousCoordinates.x && coordinates.y == previousCoordinates.y) {
1009
+ return;
1010
+ }
1011
+ } else {
1012
+ __privateSet$3(this, _previousCoordinates, void 0);
968
1013
  }
969
1014
  __privateGet$3(this, _collisions).value = collisions;
970
1015
  },
@@ -992,6 +1037,7 @@ var CollisionObserver = class extends Plugin {
992
1037
  return DEFAULT_VALUE;
993
1038
  }
994
1039
  const collisions = [];
1040
+ const potentialTargets = [];
995
1041
  for (const entry of entries != null ? entries : registry.droppables) {
996
1042
  if (entry.disabled) {
997
1043
  continue;
@@ -1003,7 +1049,8 @@ var CollisionObserver = class extends Plugin {
1003
1049
  if (!detectCollision) {
1004
1050
  continue;
1005
1051
  }
1006
- entry.shape;
1052
+ potentialTargets.push(entry);
1053
+ void entry.shape;
1007
1054
  const collision = n(
1008
1055
  () => detectCollision({
1009
1056
  droppable: entry,
@@ -1017,6 +1064,9 @@ var CollisionObserver = class extends Plugin {
1017
1064
  collisions.push(collision);
1018
1065
  }
1019
1066
  }
1067
+ if (potentialTargets.length === 0) {
1068
+ return DEFAULT_VALUE;
1069
+ }
1020
1070
  collisions.sort(sortCollisions);
1021
1071
  return collisions;
1022
1072
  }
@@ -1112,8 +1162,8 @@ var CollisionNotifier = class extends CorePlugin {
1112
1162
  }
1113
1163
  const [firstCollision] = collisions;
1114
1164
  n(() => {
1115
- var _a3;
1116
- if ((firstCollision == null ? void 0 : firstCollision.id) !== ((_a3 = manager.dragOperation.target) == null ? void 0 : _a3.id)) {
1165
+ var _a4;
1166
+ if ((firstCollision == null ? void 0 : firstCollision.id) !== ((_a4 = manager.dragOperation.target) == null ? void 0 : _a4.id)) {
1117
1167
  collisionObserver.disable();
1118
1168
  manager.actions.setDropTarget(firstCollision == null ? void 0 : firstCollision.id).then(() => {
1119
1169
  collisionObserver.enable();
@@ -1152,14 +1202,14 @@ var Entity = class {
1152
1202
  __privateAdd$3(this, _id, __runInitializers$2(_init2$1, 12, this)), __runInitializers$2(_init2$1, 15, this);
1153
1203
  __privateAdd$3(this, _data, __runInitializers$2(_init2$1, 16, this)), __runInitializers$2(_init2$1, 19, this);
1154
1204
  __privateAdd$3(this, _disabled2, __runInitializers$2(_init2$1, 20, this)), __runInitializers$2(_init2$1, 23, this);
1155
- const { effects: effects5, id, data = {}, disabled = false } = input;
1205
+ const { effects: effects5, id, data = {}, disabled = false, register = true } = input;
1156
1206
  let previousId = id;
1157
1207
  this.manager = manager;
1158
1208
  this.id = id;
1159
1209
  this.data = data;
1160
1210
  this.disabled = disabled;
1161
1211
  this.effects = () => {
1162
- var _a3;
1212
+ var _a4;
1163
1213
  return [
1164
1214
  () => {
1165
1215
  const { id: id2, manager: manager2 } = this;
@@ -1169,17 +1219,14 @@ var Entity = class {
1169
1219
  manager2 == null ? void 0 : manager2.registry.register(this);
1170
1220
  return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
1171
1221
  },
1172
- ...(_a3 = effects5 == null ? void 0 : effects5()) != null ? _a3 : []
1222
+ ...(_a4 = effects5 == null ? void 0 : effects5()) != null ? _a4 : []
1173
1223
  ];
1174
1224
  };
1175
1225
  this.register = this.register.bind(this);
1176
1226
  this.unregister = this.unregister.bind(this);
1177
1227
  this.destroy = this.destroy.bind(this);
1178
- if (manager) {
1179
- queueMicrotask(() => {
1180
- var _a3;
1181
- return (_a3 = this.manager) == null ? void 0 : _a3.registry.register(this);
1182
- });
1228
+ if (manager && register) {
1229
+ queueMicrotask(this.register);
1183
1230
  }
1184
1231
  }
1185
1232
  /**
@@ -1187,24 +1234,24 @@ var Entity = class {
1187
1234
  * @returns CleanupFunction | void
1188
1235
  */
1189
1236
  register() {
1190
- var _a3;
1191
- return (_a3 = this.manager) == null ? void 0 : _a3.registry.register(this);
1237
+ var _a4;
1238
+ return (_a4 = this.manager) == null ? void 0 : _a4.registry.register(this);
1192
1239
  }
1193
1240
  /**
1194
1241
  * A method that unregisters the entity from the manager.
1195
1242
  * @returns void
1196
1243
  */
1197
1244
  unregister() {
1198
- var _a3;
1199
- (_a3 = this.manager) == null ? void 0 : _a3.registry.unregister(this);
1245
+ var _a4;
1246
+ (_a4 = this.manager) == null ? void 0 : _a4.registry.unregister(this);
1200
1247
  }
1201
1248
  /**
1202
1249
  * A method that cleans up the entity when it is no longer needed.
1203
1250
  * @returns void
1204
1251
  */
1205
1252
  destroy() {
1206
- var _a3;
1207
- (_a3 = this.manager) == null ? void 0 : _a3.registry.unregister(this);
1253
+ var _a4;
1254
+ (_a4 = this.manager) == null ? void 0 : _a4.registry.unregister(this);
1208
1255
  }
1209
1256
  };
1210
1257
  _init2$1 = __decoratorStart$2(null);
@@ -1289,37 +1336,46 @@ var EntityRegistry = class {
1289
1336
  this.map.value = /* @__PURE__ */ new Map();
1290
1337
  }
1291
1338
  };
1292
- var _isDragSource_dec, _status_dec, _type_dec, _modifiers_dec, _c$1, _init3$1, _modifiers, _type, _status;
1293
- var Draggable$2 = class Draggable extends (_c$1 = Entity, _modifiers_dec = [reactive], _type_dec = [reactive], _status_dec = [reactive], _isDragSource_dec = [derived], _c$1) {
1294
- constructor(_a3, manager) {
1295
- var _b2 = _a3, { modifiers, type, sensors } = _b2, input = __objRest$3(_b2, ["modifiers", "type", "sensors"]);
1339
+ var _isDragSource_dec, _isDragging_dec, _isDropping_dec, _status_dec, _modifiers_dec, _type_dec, _c$1, _init3$1, _type, _modifiers, _status;
1340
+ var Draggable$2 = class Draggable extends (_c$1 = Entity, _type_dec = [reactive], _modifiers_dec = [reactive], _status_dec = [reactive], _isDropping_dec = [derived], _isDragging_dec = [derived], _isDragSource_dec = [derived], _c$1) {
1341
+ constructor(_a4, manager) {
1342
+ var _b2 = _a4, { modifiers, type, sensors } = _b2, input = __objRest$3(_b2, ["modifiers", "type", "sensors"]);
1296
1343
  super(input, manager);
1297
1344
  __runInitializers$2(_init3$1, 5, this);
1298
- __privateAdd$3(this, _modifiers, __runInitializers$2(_init3$1, 8, this)), __runInitializers$2(_init3$1, 11, this);
1299
- __privateAdd$3(this, _type, __runInitializers$2(_init3$1, 12, this)), __runInitializers$2(_init3$1, 15, this);
1300
- __privateAdd$3(this, _status, __runInitializers$2(_init3$1, 16, this, "idle")), __runInitializers$2(_init3$1, 19, this);
1345
+ __privateAdd$3(this, _type, __runInitializers$2(_init3$1, 8, this)), __runInitializers$2(_init3$1, 11, this);
1346
+ __privateAdd$3(this, _modifiers, __runInitializers$2(_init3$1, 12, this)), __runInitializers$2(_init3$1, 15, this);
1347
+ __privateAdd$3(this, _status, __runInitializers$2(_init3$1, 16, this, this.isDragSource ? "dragging" : "idle")), __runInitializers$2(_init3$1, 19, this);
1301
1348
  this.type = type;
1302
1349
  this.sensors = sensors;
1303
1350
  this.modifiers = modifiers;
1351
+ this.alignment = input.alignment;
1352
+ }
1353
+ get isDropping() {
1354
+ return this.status === "dropping" && this.isDragSource;
1355
+ }
1356
+ get isDragging() {
1357
+ return this.status === "dragging" && this.isDragSource;
1304
1358
  }
1305
1359
  get isDragSource() {
1306
- var _a3, _b2;
1307
- return ((_b2 = (_a3 = this.manager) == null ? void 0 : _a3.dragOperation.source) == null ? void 0 : _b2.id) === this.id;
1360
+ var _a4, _b2;
1361
+ return ((_b2 = (_a4 = this.manager) == null ? void 0 : _a4.dragOperation.source) == null ? void 0 : _b2.id) === this.id;
1308
1362
  }
1309
1363
  };
1310
1364
  _init3$1 = __decoratorStart$2(_c$1);
1311
- _modifiers = /* @__PURE__ */ new WeakMap();
1312
1365
  _type = /* @__PURE__ */ new WeakMap();
1366
+ _modifiers = /* @__PURE__ */ new WeakMap();
1313
1367
  _status = /* @__PURE__ */ new WeakMap();
1314
- __decorateElement$2(_init3$1, 4, "modifiers", _modifiers_dec, Draggable$2, _modifiers);
1315
1368
  __decorateElement$2(_init3$1, 4, "type", _type_dec, Draggable$2, _type);
1369
+ __decorateElement$2(_init3$1, 4, "modifiers", _modifiers_dec, Draggable$2, _modifiers);
1316
1370
  __decorateElement$2(_init3$1, 4, "status", _status_dec, Draggable$2, _status);
1371
+ __decorateElement$2(_init3$1, 2, "isDropping", _isDropping_dec, Draggable$2);
1372
+ __decorateElement$2(_init3$1, 2, "isDragging", _isDragging_dec, Draggable$2);
1317
1373
  __decorateElement$2(_init3$1, 2, "isDragSource", _isDragSource_dec, Draggable$2);
1318
1374
  __decoratorMetadata$2(_init3$1, Draggable$2);
1319
1375
  var _isDropTarget_dec, _shape_dec, _collisionPriority_dec, _collisionDetector_dec, _type_dec2, _accept_dec, _c2$1, _init4$1, _accept, _type2, _collisionDetector, _collisionPriority, _shape;
1320
1376
  var Droppable$1 = class Droppable extends (_c2$1 = Entity, _accept_dec = [reactive], _type_dec2 = [reactive], _collisionDetector_dec = [reactive], _collisionPriority_dec = [reactive], _shape_dec = [reactive], _isDropTarget_dec = [derived], _c2$1) {
1321
- constructor(_a3, manager) {
1322
- var _b2 = _a3, { accept, collisionDetector, collisionPriority, type } = _b2, input = __objRest$3(_b2, ["accept", "collisionDetector", "collisionPriority", "type"]);
1377
+ constructor(_a4, manager) {
1378
+ var _b2 = _a4, { accept, collisionDetector, collisionPriority, type } = _b2, input = __objRest$3(_b2, ["accept", "collisionDetector", "collisionPriority", "type"]);
1323
1379
  super(input, manager);
1324
1380
  __runInitializers$2(_init4$1, 5, this);
1325
1381
  __privateAdd$3(this, _accept, __runInitializers$2(_init4$1, 8, this)), __runInitializers$2(_init4$1, 11, this);
@@ -1355,8 +1411,8 @@ var Droppable$1 = class Droppable extends (_c2$1 = Entity, _accept_dec = [reacti
1355
1411
  return draggable.type === accept;
1356
1412
  }
1357
1413
  get isDropTarget() {
1358
- var _a3, _b2;
1359
- return ((_b2 = (_a3 = this.manager) == null ? void 0 : _a3.dragOperation.target) == null ? void 0 : _b2.id) === this.id;
1414
+ var _a4, _b2;
1415
+ return ((_b2 = (_a4 = this.manager) == null ? void 0 : _a4.dragOperation.target) == null ? void 0 : _b2.id) === this.id;
1360
1416
  }
1361
1417
  };
1362
1418
  _init4$1 = __decoratorStart$2(_c2$1);
@@ -1373,17 +1429,17 @@ __decorateElement$2(_init4$1, 4, "shape", _shape_dec, Droppable$1, _shape);
1373
1429
  __decorateElement$2(_init4$1, 2, "isDropTarget", _isDropTarget_dec, Droppable$1);
1374
1430
  __decoratorMetadata$2(_init4$1, Droppable$1);
1375
1431
  var Sensor = class extends Plugin {
1376
- constructor(manager, options) {
1377
- super(manager, options);
1432
+ constructor(manager, options2) {
1433
+ super(manager, options2);
1378
1434
  this.manager = manager;
1379
- this.options = options;
1435
+ this.options = options2;
1380
1436
  }
1381
1437
  };
1382
1438
  var Modifier = class extends Plugin {
1383
- constructor(manager, options) {
1384
- super(manager, options);
1439
+ constructor(manager, options2) {
1440
+ super(manager, options2);
1385
1441
  this.manager = manager;
1386
- this.options = options;
1442
+ this.options = options2;
1387
1443
  }
1388
1444
  apply(operation) {
1389
1445
  return operation.transform;
@@ -1397,7 +1453,7 @@ var DragDropRegistry = class {
1397
1453
  this.sensors = new PluginRegistry(manager);
1398
1454
  this.modifiers = new PluginRegistry(manager);
1399
1455
  }
1400
- register(input, options) {
1456
+ register(input, options2) {
1401
1457
  if (input instanceof Draggable$2) {
1402
1458
  return this.draggables.register(input.id, input);
1403
1459
  }
@@ -1405,13 +1461,13 @@ var DragDropRegistry = class {
1405
1461
  return this.droppables.register(input.id, input);
1406
1462
  }
1407
1463
  if (input.prototype instanceof Modifier) {
1408
- return this.modifiers.register(input, options);
1464
+ return this.modifiers.register(input, options2);
1409
1465
  }
1410
1466
  if (input.prototype instanceof Sensor) {
1411
- return this.sensors.register(input, options);
1467
+ return this.sensors.register(input, options2);
1412
1468
  }
1413
1469
  if (input.prototype instanceof Plugin) {
1414
- return this.plugins.register(input, options);
1470
+ return this.plugins.register(input, options2);
1415
1471
  }
1416
1472
  throw new Error("Invalid instance type");
1417
1473
  }
@@ -1486,36 +1542,36 @@ function DragOperationManager(manager) {
1486
1542
  const dragended = d(true);
1487
1543
  let previousSource;
1488
1544
  const source = computed(() => {
1489
- var _a3;
1545
+ var _a4;
1490
1546
  const identifier = sourceIdentifier.value;
1491
1547
  if (identifier == null) return null;
1492
1548
  const value = draggables.get(identifier);
1493
1549
  if (value) {
1494
1550
  previousSource = value;
1495
1551
  }
1496
- return (_a3 = value != null ? value : previousSource) != null ? _a3 : null;
1552
+ return (_a4 = value != null ? value : previousSource) != null ? _a4 : null;
1497
1553
  });
1498
1554
  const target = computed(() => {
1499
- var _a3;
1555
+ var _a4;
1500
1556
  const identifier = targetIdentifier.value;
1501
- return identifier != null ? (_a3 = droppables.get(identifier)) != null ? _a3 : null : null;
1557
+ return identifier != null ? (_a4 = droppables.get(identifier)) != null ? _a4 : null : null;
1502
1558
  });
1503
1559
  const modifiers = d([]);
1504
- E(() => {
1505
- var _a3, _b2, _c3;
1560
+ const dispose = E(() => {
1561
+ var _a4, _b2, _c3;
1506
1562
  const currentModifiers = modifiers.peek();
1507
- if (currentModifiers !== manager.modifiers) {
1563
+ if (!deepEqual(currentModifiers, manager.modifiers)) {
1508
1564
  currentModifiers.forEach((modifier) => modifier.destroy());
1509
1565
  }
1510
- modifiers.value = (_c3 = (_b2 = (_a3 = source.value) == null ? void 0 : _a3.modifiers) == null ? void 0 : _b2.map((modifier) => {
1511
- const { plugin, options } = descriptor(modifier);
1512
- return new plugin(manager, options);
1566
+ modifiers.value = (_c3 = (_b2 = (_a4 = source.value) == null ? void 0 : _a4.modifiers) == null ? void 0 : _b2.map((modifier) => {
1567
+ const { plugin, options: options2 } = descriptor(modifier);
1568
+ return new plugin(manager, options2);
1513
1569
  })) != null ? _c3 : manager.modifiers;
1514
1570
  });
1515
1571
  const transform = computed(() => {
1516
1572
  const { x, y: y2 } = position.delta;
1517
1573
  let transform2 = { x, y: y2 };
1518
- const initialShape = shape.initial.peek();
1574
+ const initialShape = shape.initial.value;
1519
1575
  const currentShape = shape.current.peek();
1520
1576
  const operation2 = {
1521
1577
  activatorEvent: activatorEvent.peek(),
@@ -1581,8 +1637,8 @@ function DragOperationManager(manager) {
1581
1637
  return initial && current ? { initial, current } : null;
1582
1638
  },
1583
1639
  set shape(value) {
1584
- var _a3;
1585
- if (value && ((_a3 = shape.current.peek()) == null ? void 0 : _a3.equals(value))) {
1640
+ var _a4;
1641
+ if (value && ((_a4 = shape.current.peek()) == null ? void 0 : _a4.equals(value))) {
1586
1642
  return;
1587
1643
  }
1588
1644
  const initial = shape.initial.peek();
@@ -1607,126 +1663,160 @@ function DragOperationManager(manager) {
1607
1663
  modifiers.value = [];
1608
1664
  });
1609
1665
  };
1610
- return {
1611
- operation,
1612
- actions: {
1613
- setDragSource(identifier) {
1614
- sourceIdentifier.value = identifier;
1615
- },
1616
- setDropTarget(identifier) {
1617
- const id = identifier != null ? identifier : null;
1618
- if (targetIdentifier.peek() === id) {
1619
- return Promise.resolve(false);
1620
- }
1621
- targetIdentifier.value = id;
1622
- const event = defaultPreventable({
1623
- operation: snapshot(operation)
1624
- });
1625
- if (status.peek() === "dragging") {
1626
- monitor.dispatch("dragover", event);
1627
- }
1628
- return manager.renderer.rendering.then(() => event.defaultPrevented);
1629
- },
1630
- start({ event, coordinates }) {
1631
- const sourceInstance = source.peek();
1632
- if (!sourceInstance) {
1633
- throw new Error(
1634
- "Cannot start a drag operation without a drag source"
1635
- );
1666
+ const actions = {
1667
+ setDragSource(identifier) {
1668
+ sourceIdentifier.value = identifier;
1669
+ },
1670
+ setDropTarget(identifier) {
1671
+ const id = identifier != null ? identifier : null;
1672
+ if (targetIdentifier.peek() === id) {
1673
+ return Promise.resolve(false);
1674
+ }
1675
+ targetIdentifier.value = id;
1676
+ const event = defaultPreventable({
1677
+ operation: snapshot(operation)
1678
+ });
1679
+ if (status.peek() === "dragging") {
1680
+ monitor.dispatch("dragover", event);
1681
+ }
1682
+ return manager.renderer.rendering.then(() => event.defaultPrevented);
1683
+ },
1684
+ start({
1685
+ event: nativeEvent,
1686
+ coordinates
1687
+ }) {
1688
+ const sourceInstance = source.peek();
1689
+ if (!sourceInstance) {
1690
+ throw new Error("Cannot start a drag operation without a drag source");
1691
+ }
1692
+ r(() => {
1693
+ shape.initial.value = null;
1694
+ shape.current.value = null;
1695
+ dragended.value = false;
1696
+ canceled.value = false;
1697
+ activatorEvent.value = nativeEvent != null ? nativeEvent : null;
1698
+ position.reset(coordinates);
1699
+ });
1700
+ const beforeStartEvent = defaultPreventable({
1701
+ operation: snapshot(operation)
1702
+ });
1703
+ monitor.dispatch("beforedragstart", beforeStartEvent);
1704
+ manager.renderer.rendering.then(() => {
1705
+ if (beforeStartEvent.defaultPrevented) {
1706
+ reset();
1707
+ return;
1636
1708
  }
1637
- r(() => {
1638
- shape.initial.value = null;
1639
- shape.current.value = null;
1640
- dragended.value = false;
1641
- canceled.value = false;
1642
- activatorEvent.value = event;
1643
- position.reset(coordinates);
1644
- });
1645
- const beforeStartEvent = defaultPreventable({
1646
- operation: snapshot(operation)
1647
- });
1648
- monitor.dispatch("beforedragstart", beforeStartEvent);
1649
- manager.renderer.rendering.then(() => {
1650
- if (beforeStartEvent.defaultPrevented) {
1651
- reset();
1652
- return;
1653
- }
1654
- status.value = "initializing";
1655
- requestAnimationFrame(() => {
1656
- status.value = "dragging";
1657
- monitor.dispatch("dragstart", {
1658
- operation: snapshot(operation),
1659
- cancelable: false
1660
- });
1709
+ status.value = "initializing";
1710
+ requestAnimationFrame(() => {
1711
+ status.value = "dragging";
1712
+ monitor.dispatch("dragstart", {
1713
+ nativeEvent,
1714
+ operation: snapshot(operation),
1715
+ cancelable: false
1661
1716
  });
1662
1717
  });
1663
- },
1664
- move({
1665
- by,
1666
- to,
1667
- cancelable = true
1668
- }) {
1669
- if (!dragging.peek()) {
1718
+ });
1719
+ },
1720
+ move({
1721
+ by,
1722
+ to,
1723
+ event: nativeEvent,
1724
+ cancelable = true,
1725
+ propagate = true
1726
+ }) {
1727
+ if (!dragging.peek()) {
1728
+ return;
1729
+ }
1730
+ const event = defaultPreventable(
1731
+ {
1732
+ nativeEvent,
1733
+ operation: snapshot(operation),
1734
+ by,
1735
+ to
1736
+ },
1737
+ cancelable
1738
+ );
1739
+ if (propagate) {
1740
+ monitor.dispatch("dragmove", event);
1741
+ }
1742
+ queueMicrotask(() => {
1743
+ if (event.defaultPrevented) {
1670
1744
  return;
1671
1745
  }
1672
- const event = defaultPreventable(
1673
- {
1674
- operation: snapshot(operation),
1675
- by,
1676
- to
1746
+ const coordinates = to != null ? to : {
1747
+ x: position.current.x + by.x,
1748
+ y: position.current.y + by.y
1749
+ };
1750
+ position.update(coordinates);
1751
+ });
1752
+ },
1753
+ stop({
1754
+ canceled: eventCanceled = false,
1755
+ event: nativeEvent
1756
+ } = {}) {
1757
+ let promise;
1758
+ const suspend = () => {
1759
+ const output = {
1760
+ resume: () => {
1677
1761
  },
1678
- cancelable
1679
- );
1680
- monitor.dispatch("dragmove", event);
1681
- queueMicrotask(() => {
1682
- if (event.defaultPrevented) {
1683
- return;
1762
+ abort: () => {
1684
1763
  }
1685
- const coordinates = to != null ? to : {
1686
- x: position.current.x + by.x,
1687
- y: position.current.y + by.y
1688
- };
1689
- position.update(coordinates);
1764
+ };
1765
+ promise = new Promise((resolve, reject) => {
1766
+ output.resume = resolve;
1767
+ output.abort = reject;
1690
1768
  });
1691
- },
1692
- stop({ canceled: eventCanceled = false } = {}) {
1693
- let promise;
1694
- const suspend = () => {
1695
- const output = {
1696
- resume: () => {
1697
- },
1698
- abort: () => {
1699
- }
1700
- };
1701
- promise = new Promise((resolve, reject) => {
1702
- output.resume = resolve;
1703
- output.abort = reject;
1769
+ return output;
1770
+ };
1771
+ const end = () => {
1772
+ manager.renderer.rendering.then(() => {
1773
+ status.value = "dropped";
1774
+ const dropping = n(() => {
1775
+ var _a4;
1776
+ return ((_a4 = source.value) == null ? void 0 : _a4.status) === "dropping";
1704
1777
  });
1705
- return output;
1706
- };
1707
- const end = () => {
1708
- manager.renderer.rendering.then(() => {
1709
- status.value = "dropped";
1778
+ if (dropping) {
1779
+ const currentSource = source.value;
1780
+ const dispose2 = E(() => {
1781
+ if ((currentSource == null ? void 0 : currentSource.status) === "idle") {
1782
+ dispose2();
1783
+ if (source.value !== currentSource) return;
1784
+ reset();
1785
+ }
1786
+ });
1787
+ } else {
1710
1788
  manager.renderer.rendering.then(reset);
1711
- });
1712
- };
1713
- r(() => {
1714
- dragended.value = true;
1715
- canceled.value = eventCanceled;
1716
- });
1717
- monitor.dispatch("dragend", {
1718
- operation: snapshot(operation),
1719
- canceled: eventCanceled,
1720
- suspend
1789
+ }
1721
1790
  });
1722
- if (promise) {
1723
- promise.then(end).catch(reset);
1724
- } else {
1725
- end();
1726
- }
1791
+ };
1792
+ r(() => {
1793
+ dragended.value = true;
1794
+ canceled.value = eventCanceled;
1795
+ });
1796
+ monitor.dispatch("dragend", {
1797
+ nativeEvent,
1798
+ operation: snapshot(operation),
1799
+ canceled: eventCanceled,
1800
+ suspend
1801
+ });
1802
+ if (promise) {
1803
+ promise.then(end).catch(reset);
1804
+ } else {
1805
+ end();
1727
1806
  }
1728
1807
  }
1729
1808
  };
1809
+ return {
1810
+ operation,
1811
+ actions,
1812
+ cleanup() {
1813
+ if (status.peek() !== "idle") {
1814
+ actions.stop({ canceled: true });
1815
+ }
1816
+ modifiers.value.forEach((modifier) => modifier.destroy());
1817
+ dispose();
1818
+ }
1819
+ };
1730
1820
  }
1731
1821
  function snapshot(obj) {
1732
1822
  return __spreadValues$5({}, obj);
@@ -1738,6 +1828,10 @@ var defaultRenderer = {
1738
1828
  };
1739
1829
  var DragDropManager$1 = class DragDropManager {
1740
1830
  constructor(config) {
1831
+ this.destroy = () => {
1832
+ this.registry.destroy();
1833
+ this.collisionObserver.destroy();
1834
+ };
1741
1835
  const {
1742
1836
  plugins = [],
1743
1837
  sensors = [],
@@ -1749,14 +1843,18 @@ var DragDropManager$1 = class DragDropManager {
1749
1843
  this.registry = registry;
1750
1844
  this.monitor = monitor;
1751
1845
  this.renderer = renderer;
1752
- const { actions, operation } = DragOperationManager(this);
1846
+ const { actions, operation, cleanup } = DragOperationManager(this);
1753
1847
  this.actions = actions;
1754
1848
  this.dragOperation = operation;
1755
1849
  this.collisionObserver = new CollisionObserver(this);
1756
1850
  this.plugins = [CollisionNotifier, ...plugins];
1757
1851
  this.modifiers = modifiers;
1758
1852
  this.sensors = sensors;
1759
- this.destroy = this.destroy.bind(this);
1853
+ const { destroy } = this;
1854
+ this.destroy = () => {
1855
+ cleanup();
1856
+ destroy();
1857
+ };
1760
1858
  }
1761
1859
  get plugins() {
1762
1860
  return this.registry.plugins.values;
@@ -1776,10 +1874,6 @@ var DragDropManager$1 = class DragDropManager {
1776
1874
  set sensors(sensors) {
1777
1875
  this.registry.sensors.values = sensors;
1778
1876
  }
1779
- destroy() {
1780
- this.registry.destroy();
1781
- this.collisionObserver.destroy();
1782
- }
1783
1877
  };
1784
1878
  var pointerIntersection = ({
1785
1879
  dragOperation,
@@ -1828,8 +1922,8 @@ var shapeIntersection = ({
1828
1922
  return null;
1829
1923
  };
1830
1924
  var defaultCollisionDetection = (args) => {
1831
- var _a3;
1832
- return (_a3 = pointerIntersection(args)) != null ? _a3 : shapeIntersection(args);
1925
+ var _a4;
1926
+ return (_a4 = pointerIntersection(args)) != null ? _a4 : shapeIntersection(args);
1833
1927
  };
1834
1928
  var closestCorners = (input) => {
1835
1929
  const { dragOperation, droppable } = input;
@@ -1837,31 +1931,15 @@ var closestCorners = (input) => {
1837
1931
  if (!droppable.shape) {
1838
1932
  return null;
1839
1933
  }
1840
- const { left, top, right, bottom } = droppable.shape.boundingRectangle;
1841
- const corners = [
1842
- {
1843
- x: left,
1844
- y: top
1845
- },
1846
- {
1847
- x: right,
1848
- y: top
1849
- },
1850
- {
1851
- x: left,
1852
- y: bottom
1853
- },
1854
- {
1855
- x: right,
1856
- y: bottom
1857
- }
1858
- ];
1859
- const distance = corners.reduce(
1860
- (acc, corner) => {
1861
- var _a3;
1934
+ const shapeCorners = shape ? Rectangle.from(shape.current.boundingRectangle).corners : void 0;
1935
+ const distance = Rectangle.from(
1936
+ droppable.shape.boundingRectangle
1937
+ ).corners.reduce(
1938
+ (acc, corner, index) => {
1939
+ var _a4;
1862
1940
  return acc + Point.distance(
1863
1941
  Point.from(corner),
1864
- (_a3 = shape == null ? void 0 : shape.current.center) != null ? _a3 : position.current
1942
+ (_a4 = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a4 : position.current
1865
1943
  );
1866
1944
  },
1867
1945
  0
@@ -1896,7 +1974,7 @@ function isNode(node) {
1896
1974
  return "nodeType" in node;
1897
1975
  }
1898
1976
  function getWindow(target) {
1899
- var _a3, _b2, _c3;
1977
+ var _a4, _b2, _c3;
1900
1978
  if (!target) {
1901
1979
  return window;
1902
1980
  }
@@ -1907,7 +1985,7 @@ function getWindow(target) {
1907
1985
  return window;
1908
1986
  }
1909
1987
  if ("defaultView" in target) {
1910
- return (_a3 = target.defaultView) != null ? _a3 : window;
1988
+ return (_a4 = target.defaultView) != null ? _a4 : window;
1911
1989
  }
1912
1990
  return (_c3 = (_b2 = target.ownerDocument) == null ? void 0 : _b2.defaultView) != null ? _c3 : window;
1913
1991
  }
@@ -1988,10 +2066,10 @@ function isOverflowVisible(element, style) {
1988
2066
  return overflow === "visible" && overflowX === "visible" && overflowY === "visible";
1989
2067
  }
1990
2068
  function getVisibleBoundingRectangle(element, boundingClientRect = element.getBoundingClientRect(), margin = 0) {
1991
- var _a3;
2069
+ var _a4;
1992
2070
  let rect = boundingClientRect;
1993
2071
  const { ownerDocument } = element;
1994
- const ownerWindow = (_a3 = ownerDocument.defaultView) != null ? _a3 : window;
2072
+ const ownerWindow = (_a4 = ownerDocument.defaultView) != null ? _a4 : window;
1995
2073
  let ancestor = element.parentElement;
1996
2074
  while (ancestor && ancestor !== ownerDocument.documentElement) {
1997
2075
  if (!isOverflowVisible(ancestor)) {
@@ -2050,7 +2128,7 @@ var threshold = Array.from({ length: 100 }, (_2, index) => index / 100);
2050
2128
  var THROTTLE_INTERVAL = 75;
2051
2129
  var _callback, _visible, _previousBoundingClientRect, _resizeObserver, _positionObserver, _visibilityObserver, _debug, _disconnected, _observePosition, _PositionObserver_instances, notify_fn, updateDebug_fn;
2052
2130
  var PositionObserver = class {
2053
- constructor(element, callback, options = { debug: false }) {
2131
+ constructor(element, callback, options2 = { debug: false }) {
2054
2132
  this.element = element;
2055
2133
  __privateAdd$2(this, _PositionObserver_instances);
2056
2134
  __privateAdd$2(this, _callback);
@@ -2062,9 +2140,9 @@ var PositionObserver = class {
2062
2140
  __privateAdd$2(this, _debug);
2063
2141
  __privateAdd$2(this, _disconnected, false);
2064
2142
  __privateAdd$2(this, _observePosition, throttle(() => {
2065
- var _a3, _b2, _c3;
2143
+ var _a4, _b2, _c3;
2066
2144
  const { element: element2 } = this;
2067
- (_a3 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a3.disconnect();
2145
+ (_a4 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a4.disconnect();
2068
2146
  if (__privateGet$2(this, _disconnected) || !__privateGet$2(this, _visible) || !element2.isConnected) {
2069
2147
  return;
2070
2148
  }
@@ -2104,7 +2182,7 @@ var PositionObserver = class {
2104
2182
  this.boundingClientRect = element.getBoundingClientRect();
2105
2183
  __privateSet$2(this, _visible, isVisible(element, this.boundingClientRect));
2106
2184
  const root = element.ownerDocument;
2107
- if (options == null ? void 0 : options.debug) {
2185
+ if (options2 == null ? void 0 : options2.debug) {
2108
2186
  __privateSet$2(this, _debug, document.createElement("div"));
2109
2187
  __privateGet$2(this, _debug).style.background = "rgba(0,0,0,0.15)";
2110
2188
  __privateGet$2(this, _debug).style.position = "fixed";
@@ -2113,7 +2191,7 @@ var PositionObserver = class {
2113
2191
  }
2114
2192
  __privateSet$2(this, _visibilityObserver, new IntersectionObserver(
2115
2193
  (entries) => {
2116
- var _a3, _b2;
2194
+ var _a4, _b2;
2117
2195
  const entry = entries[entries.length - 1];
2118
2196
  const { boundingClientRect, isIntersecting: visible } = entry;
2119
2197
  const { width, height } = boundingClientRect;
@@ -2121,7 +2199,7 @@ var PositionObserver = class {
2121
2199
  __privateSet$2(this, _visible, visible);
2122
2200
  if (!width && !height) return;
2123
2201
  if (previousVisible && !visible) {
2124
- (_a3 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a3.disconnect();
2202
+ (_a4 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a4.disconnect();
2125
2203
  __privateGet$2(this, _callback).call(this, null);
2126
2204
  (_b2 = __privateGet$2(this, _resizeObserver)) == null ? void 0 : _b2.disconnect();
2127
2205
  __privateSet$2(this, _resizeObserver, void 0);
@@ -2145,9 +2223,9 @@ var PositionObserver = class {
2145
2223
  __privateGet$2(this, _visibilityObserver).observe(element);
2146
2224
  }
2147
2225
  disconnect() {
2148
- var _a3, _b2, _c3;
2226
+ var _a4, _b2, _c3;
2149
2227
  __privateSet$2(this, _disconnected, true);
2150
- (_a3 = __privateGet$2(this, _resizeObserver)) == null ? void 0 : _a3.disconnect();
2228
+ (_a4 = __privateGet$2(this, _resizeObserver)) == null ? void 0 : _a4.disconnect();
2151
2229
  (_b2 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _b2.disconnect();
2152
2230
  __privateGet$2(this, _visibilityObserver).disconnect();
2153
2231
  (_c3 = __privateGet$2(this, _debug)) == null ? void 0 : _c3.remove();
@@ -2233,8 +2311,8 @@ var Listeners = class {
2233
2311
  this.entries = /* @__PURE__ */ new Set();
2234
2312
  this.clear = () => {
2235
2313
  for (const entry of this.entries) {
2236
- const [target, { type, listener, options }] = entry;
2237
- target.removeEventListener(type, listener, options);
2314
+ const [target, { type, listener, options: options2 }] = entry;
2315
+ target.removeEventListener(type, listener, options2);
2238
2316
  }
2239
2317
  this.entries.clear();
2240
2318
  };
@@ -2243,15 +2321,15 @@ var Listeners = class {
2243
2321
  const listeners = Array.isArray(input) ? input : [input];
2244
2322
  const entries = [];
2245
2323
  for (const descriptor2 of listeners) {
2246
- const { type, listener, options } = descriptor2;
2324
+ const { type, listener, options: options2 } = descriptor2;
2247
2325
  const entry = [target, descriptor2];
2248
- target.addEventListener(type, listener, options);
2326
+ target.addEventListener(type, listener, options2);
2249
2327
  this.entries.add(entry);
2250
2328
  entries.push(entry);
2251
2329
  }
2252
2330
  return function cleanup() {
2253
- for (const [target2, { type, listener, options }] of entries) {
2254
- target2.removeEventListener(type, listener, options);
2331
+ for (const [target2, { type, listener, options: options2 }] of entries) {
2332
+ target2.removeEventListener(type, listener, options2);
2255
2333
  }
2256
2334
  };
2257
2335
  }
@@ -2339,8 +2417,8 @@ function isScrollable(element, computedStyle = getComputedStyles(element)) {
2339
2417
  var defaultOptions = {
2340
2418
  excludeElement: true
2341
2419
  };
2342
- function getScrollableAncestors(element, options = defaultOptions) {
2343
- const { limit, excludeElement } = options;
2420
+ function getScrollableAncestors(element, options2 = defaultOptions) {
2421
+ const { limit, excludeElement } = options2;
2344
2422
  const scrollParents = /* @__PURE__ */ new Set();
2345
2423
  function findScrollableAncestors(node) {
2346
2424
  if (limit != null && scrollParents.size >= limit) {
@@ -2607,7 +2685,7 @@ var Styles = class {
2607
2685
  function animateTransform({
2608
2686
  element,
2609
2687
  keyframes,
2610
- options,
2688
+ options: options2,
2611
2689
  onReady,
2612
2690
  onFinish
2613
2691
  }) {
@@ -2620,7 +2698,7 @@ function animateTransform({
2620
2698
  ).join(", ") : "none"
2621
2699
  });
2622
2700
  onReady == null ? void 0 : onReady();
2623
- element.animate(keyframes, options).finished.then(() => {
2701
+ element.animate(keyframes, options2).finished.then(() => {
2624
2702
  onFinish == null ? void 0 : onFinish();
2625
2703
  styles.reset();
2626
2704
  });
@@ -2695,7 +2773,7 @@ function parseScale(scale) {
2695
2773
  };
2696
2774
  }
2697
2775
  function parseTransform(computedStyles) {
2698
- var _a3, _b2, _c3, _d2, _e, _f, _g, _h, _i;
2776
+ var _a4, _b2, _c3, _d2, _e, _f, _g, _h, _i;
2699
2777
  const { scale, transform, translate } = computedStyles;
2700
2778
  const parsedScale = parseScale(scale);
2701
2779
  const parsedTranslate = parseTranslate(translate);
@@ -2704,7 +2782,7 @@ function parseTransform(computedStyles) {
2704
2782
  return null;
2705
2783
  }
2706
2784
  const normalizedScale = {
2707
- x: (_a3 = parsedScale == null ? void 0 : parsedScale.x) != null ? _a3 : 1,
2785
+ x: (_a4 = parsedScale == null ? void 0 : parsedScale.x) != null ? _a4 : 1,
2708
2786
  y: (_b2 = parsedScale == null ? void 0 : parsedScale.y) != null ? _b2 : 1
2709
2787
  };
2710
2788
  const normalizedTranslate = {
@@ -2746,35 +2824,42 @@ function parseTransformMatrix(transform) {
2746
2824
  return null;
2747
2825
  }
2748
2826
  var DOMRectangle = class extends Rectangle {
2749
- constructor(element, options = {}) {
2750
- var _a3, _b2;
2827
+ constructor(element, options2 = {}) {
2828
+ var _a4, _b2, _c3, _d2;
2751
2829
  const {
2752
2830
  frameTransform = getFrameTransform(element),
2753
2831
  ignoreTransforms,
2754
2832
  getBoundingClientRect = getBoundingRectangle
2755
- } = options;
2833
+ } = options2;
2756
2834
  const resetAnimations = forceFinishAnimations(element);
2757
2835
  const boundingRectangle = getBoundingClientRect(element);
2758
2836
  let { top, left, width, height } = boundingRectangle;
2837
+ let updated;
2759
2838
  const computedStyles = getComputedStyles(element);
2760
2839
  const parsedTransform = parseTransform(computedStyles);
2761
2840
  const scale = {
2762
- x: (_a3 = parsedTransform == null ? void 0 : parsedTransform.scaleX) != null ? _a3 : 1,
2841
+ x: (_a4 = parsedTransform == null ? void 0 : parsedTransform.scaleX) != null ? _a4 : 1,
2763
2842
  y: (_b2 = parsedTransform == null ? void 0 : parsedTransform.scaleY) != null ? _b2 : 1
2764
2843
  };
2765
2844
  resetAnimations == null ? void 0 : resetAnimations();
2766
2845
  const projectedTransform = getProjectedTransform(element);
2767
- if (parsedTransform && (ignoreTransforms || projectedTransform)) {
2768
- const updated = inverseTransform(
2846
+ if (parsedTransform) {
2847
+ updated = inverseTransform(
2769
2848
  boundingRectangle,
2770
2849
  parsedTransform,
2771
2850
  computedStyles.transformOrigin
2772
2851
  );
2773
- top = updated.top;
2774
- left = updated.left;
2775
- width = updated.width;
2776
- height = updated.height;
2852
+ if (ignoreTransforms || projectedTransform) {
2853
+ top = updated.top;
2854
+ left = updated.left;
2855
+ width = updated.width;
2856
+ height = updated.height;
2857
+ }
2777
2858
  }
2859
+ const intrinsic = {
2860
+ width: (_c3 = updated == null ? void 0 : updated.width) != null ? _c3 : width,
2861
+ height: (_d2 = updated == null ? void 0 : updated.height) != null ? _d2 : height
2862
+ };
2778
2863
  if (projectedTransform && !ignoreTransforms) {
2779
2864
  top = top + projectedTransform.y;
2780
2865
  left = left + projectedTransform.x;
@@ -2795,10 +2880,12 @@ var DOMRectangle = class extends Rectangle {
2795
2880
  }
2796
2881
  super(left, top, width, height);
2797
2882
  this.scale = scale;
2883
+ this.intrinsicWidth = intrinsic.width;
2884
+ this.intrinsicHeight = intrinsic.height;
2798
2885
  }
2799
2886
  };
2800
2887
  function getProjectedTransform(element) {
2801
- var _a3;
2888
+ var _a4;
2802
2889
  const { KeyframeEffect: KeyframeEffect2 } = getWindow(element);
2803
2890
  const animations = element.getAnimations();
2804
2891
  let projectedTransform = null;
@@ -2818,7 +2905,7 @@ function getProjectedTransform(element) {
2818
2905
  projectedTransform = projectedTransform ? {
2819
2906
  x: projectedTransform.x + parsedTransform.x,
2820
2907
  y: projectedTransform.y + parsedTransform.y,
2821
- z: (_a3 = projectedTransform.z) != null ? _a3 : parsedTransform.z,
2908
+ z: (_a4 = projectedTransform.z) != null ? _a4 : parsedTransform.z,
2822
2909
  scaleX: projectedTransform.scaleX * parsedTransform.scaleX,
2823
2910
  scaleY: projectedTransform.scaleY * parsedTransform.scaleY
2824
2911
  } : parsedTransform;
@@ -2912,8 +2999,8 @@ var __objRest$2 = (source, exclude) => {
2912
2999
  return target;
2913
3000
  };
2914
3001
  var __decoratorStart$1 = (base) => {
2915
- var _a3;
2916
- return [, , , __create$1((_a3 = base == null ? void 0 : base[__knownSymbol$1("metadata")]) != null ? _a3 : null)];
3002
+ var _a4;
3003
+ return [, , , __create$1((_a4 = base == null ? void 0 : base[__knownSymbol$1("metadata")]) != null ? _a4 : null)];
2917
3004
  };
2918
3005
  var __decoratorStrings$1 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
2919
3006
  var __expectFn$1 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$1("Function expected") : fn;
@@ -2955,8 +3042,7 @@ var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, membe
2955
3042
  var __privateMethod = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
2956
3043
  var defaultAttributes = {
2957
3044
  role: "button",
2958
- roleDescription: "draggable",
2959
- tabIndex: 0
3045
+ roleDescription: "draggable"
2960
3046
  };
2961
3047
  var defaultDescriptionIdPrefix = `dnd-kit-description`;
2962
3048
  var defaultAnnouncementIdPrefix = `dnd-kit-announcement`;
@@ -3016,7 +3102,7 @@ function createLiveRegion(id) {
3016
3102
  return element;
3017
3103
  }
3018
3104
  var Accessibility = class extends Plugin {
3019
- constructor(manager, options) {
3105
+ constructor(manager, options2) {
3020
3106
  super(manager);
3021
3107
  const {
3022
3108
  id,
@@ -3026,7 +3112,7 @@ var Accessibility = class extends Plugin {
3026
3112
  } = {},
3027
3113
  announcements = defaultAnnouncements,
3028
3114
  screenReaderInstructions = defaultScreenReaderInstructions
3029
- } = options != null ? options : {};
3115
+ } = options2 != null ? options2 : {};
3030
3116
  const descriptionId = id ? `${descriptionPrefix}-${id}` : generateUniqueId(descriptionPrefix);
3031
3117
  const announcementId = id ? `${announcementPrefix}-${id}` : generateUniqueId(announcementPrefix);
3032
3118
  let hiddenTextElement;
@@ -3076,10 +3162,9 @@ var Accessibility = class extends Plugin {
3076
3162
  if (!activator.hasAttribute("aria-describedby")) {
3077
3163
  activator.setAttribute("aria-describedby", descriptionId);
3078
3164
  }
3079
- activator.setAttribute(
3080
- "aria-pressed",
3081
- String(draggable.isDragSource)
3082
- );
3165
+ for (const key of ["aria-pressed", "aria-grabbed"]) {
3166
+ activator.setAttribute(key, String(draggable.isDragSource));
3167
+ }
3083
3168
  activator.setAttribute("aria-disabled", String(draggable.disabled));
3084
3169
  }
3085
3170
  }
@@ -3093,13 +3178,13 @@ var Accessibility = class extends Plugin {
3093
3178
  }
3094
3179
  };
3095
3180
  var Cursor = class extends Plugin {
3096
- constructor(manager, options) {
3097
- super(manager, options);
3181
+ constructor(manager, options2) {
3182
+ super(manager, options2);
3098
3183
  this.manager = manager;
3099
3184
  this.destroy = E(() => {
3100
- var _a3;
3185
+ var _a4;
3101
3186
  const { dragOperation } = this.manager;
3102
- const { cursor = "grabbing" } = (_a3 = this.options) != null ? _a3 : {};
3187
+ const { cursor = "grabbing" } = (_a4 = this.options) != null ? _a4 : {};
3103
3188
  if (dragOperation.status.initialized) {
3104
3189
  const style = document.createElement("style");
3105
3190
  style.innerText = `* { cursor: ${cursor} !important; }`;
@@ -3114,427 +3199,535 @@ var Cursor = class extends Plugin {
3114
3199
  var ATTR_PREFIX = "data-dnd-";
3115
3200
  var CSS_PREFIX = "--dnd-";
3116
3201
  var ATTRIBUTE = `${ATTR_PREFIX}dragging`;
3117
- var cssRules = `[${ATTRIBUTE}] {position: fixed !important;pointer-events: none !important;touch-action: none !important;z-index: calc(infinity);will-change: translate;top: var(${CSS_PREFIX}top, 0px) !important;left: var(${CSS_PREFIX}left, 0px) !important;width: var(${CSS_PREFIX}width, auto) !important;height: var(${CSS_PREFIX}height, auto) !important;box-sizing:border-box;}[${ATTRIBUTE}] *{pointer-events: none !important;}[${ATTRIBUTE}][style*="${CSS_PREFIX}translate"] {translate: var(${CSS_PREFIX}translate) !important;}[style*="${CSS_PREFIX}transition"] {transition: var(${CSS_PREFIX}transition) !important;}*:where([${ATTRIBUTE}][popover]){overflow:visible;background:var(${CSS_PREFIX}background);border:var(${CSS_PREFIX}border);margin:unset;padding:unset;color:inherit;}[${ATTRIBUTE}]::backdrop {display: none}html:has([${ATTRIBUTE}]) * {user-select:none;-webkit-user-select:none;}`;
3118
3202
  var PLACEHOLDER_ATTRIBUTE = `${ATTR_PREFIX}placeholder`;
3119
- var IGNORED_ATTRIBUTES = [ATTRIBUTE, PLACEHOLDER_ATTRIBUTE, "popover"];
3203
+ var IGNORED_ATTRIBUTES = [
3204
+ ATTRIBUTE,
3205
+ PLACEHOLDER_ATTRIBUTE,
3206
+ "popover",
3207
+ "aria-pressed",
3208
+ "aria-grabbing"
3209
+ ];
3120
3210
  var IGNORED_STYLES = ["view-transition-name"];
3121
- var _Feedback = class _Feedback2 extends Plugin {
3122
- constructor(manager, options) {
3211
+ var CSS_RULES = `
3212
+ :root [${ATTRIBUTE}] {
3213
+ position: fixed !important;
3214
+ pointer-events: none !important;
3215
+ touch-action: none;
3216
+ z-index: calc(infinity);
3217
+ will-change: translate;
3218
+ top: var(${CSS_PREFIX}top, 0px) !important;
3219
+ left: var(${CSS_PREFIX}left, 0px) !important;
3220
+ right: unset !important;
3221
+ bottom: unset !important;
3222
+ width: var(${CSS_PREFIX}width, auto);
3223
+ max-width: var(${CSS_PREFIX}width, auto);
3224
+ height: var(${CSS_PREFIX}height, auto);
3225
+ max-height: var(${CSS_PREFIX}height, auto);
3226
+ box-sizing: border-box;
3227
+ }
3228
+ [${ATTRIBUTE}] * {
3229
+ pointer-events: none !important;
3230
+ }
3231
+ [${ATTRIBUTE}][style*='${CSS_PREFIX}translate'] {
3232
+ translate: var(${CSS_PREFIX}translate) !important;
3233
+ }
3234
+ [style*='${CSS_PREFIX}transition'] {
3235
+ transition: var(${CSS_PREFIX}transition) !important;
3236
+ }
3237
+ [style*='${CSS_PREFIX}scale'] {
3238
+ scale: var(${CSS_PREFIX}scale) !important;
3239
+ transform-origin: var(${CSS_PREFIX}transform-origin) !important;
3240
+ }
3241
+ @layer {
3242
+ :where([${ATTRIBUTE}][popover]) {
3243
+ overflow: visible;
3244
+ background: unset;
3245
+ border: unset;
3246
+ margin: unset;
3247
+ padding: unset;
3248
+ color: inherit;
3249
+ }
3250
+ }
3251
+ [${ATTRIBUTE}]::backdrop, [${ATTR_PREFIX}overlay]:not([${ATTRIBUTE}]) {
3252
+ display: none;
3253
+ }
3254
+ `.replace(/\n+/g, " ").replace(/\s+/g, " ").trim();
3255
+ function createPlaceholder(source) {
3256
+ return n(() => {
3257
+ const { element, manager } = source;
3258
+ if (!element || !manager) return;
3259
+ const containedDroppables = findContainedDroppables(
3260
+ element,
3261
+ manager.registry.droppables
3262
+ );
3263
+ const cleanup = [];
3264
+ const placeholder = cloneElement(element);
3265
+ const { remove } = placeholder;
3266
+ proxyDroppableElements(containedDroppables, placeholder, cleanup);
3267
+ configurePlaceholder(placeholder);
3268
+ placeholder.remove = () => {
3269
+ cleanup.forEach((fn) => fn());
3270
+ remove.call(placeholder);
3271
+ };
3272
+ return placeholder;
3273
+ });
3274
+ }
3275
+ function findContainedDroppables(element, droppables) {
3276
+ const containedDroppables = /* @__PURE__ */ new Map();
3277
+ for (const droppable of droppables) {
3278
+ if (!droppable.element) continue;
3279
+ if (element === droppable.element || element.contains(droppable.element)) {
3280
+ const identifierAttribute = `${ATTR_PREFIX}${generateUniqueId("dom-id")}`;
3281
+ droppable.element.setAttribute(identifierAttribute, "");
3282
+ containedDroppables.set(droppable, identifierAttribute);
3283
+ }
3284
+ }
3285
+ return containedDroppables;
3286
+ }
3287
+ function proxyDroppableElements(containedDroppables, placeholder, cleanup) {
3288
+ for (const [droppable, identifierAttribute] of containedDroppables) {
3289
+ if (!droppable.element) continue;
3290
+ const selector = `[${identifierAttribute}]`;
3291
+ const clonedElement = placeholder.matches(selector) ? placeholder : placeholder.querySelector(selector);
3292
+ droppable.element.removeAttribute(identifierAttribute);
3293
+ if (!clonedElement) continue;
3294
+ const originalElement = droppable.element;
3295
+ droppable.proxy = clonedElement;
3296
+ clonedElement.removeAttribute(identifierAttribute);
3297
+ ProxiedElements.set(originalElement, clonedElement);
3298
+ cleanup.push(() => {
3299
+ ProxiedElements.delete(originalElement);
3300
+ droppable.proxy = void 0;
3301
+ });
3302
+ }
3303
+ }
3304
+ function configurePlaceholder(placeholder) {
3305
+ placeholder.setAttribute("inert", "true");
3306
+ placeholder.setAttribute("tab-index", "-1");
3307
+ placeholder.setAttribute("aria-hidden", "true");
3308
+ placeholder.setAttribute(PLACEHOLDER_ATTRIBUTE, "");
3309
+ }
3310
+ function isSameFrame(element, target) {
3311
+ if (element === target) return true;
3312
+ return getFrameElement(element) === getFrameElement(target);
3313
+ }
3314
+ function preventPopoverClose(event) {
3315
+ const { target } = event;
3316
+ if (event instanceof ToggleEvent && event.newState === "closed" && target instanceof Element && target.hasAttribute("popover")) {
3317
+ requestAnimationFrame(() => showPopover(target));
3318
+ }
3319
+ }
3320
+ var _overlay_dec, _a, _init$1, _overlay, _Feedback_instances, render_fn, injectStyles_fn;
3321
+ var _Feedback = class _Feedback2 extends (_a = Plugin, _overlay_dec = [reactive], _a) {
3322
+ constructor(manager, options2) {
3123
3323
  super(manager);
3124
- const styleTags = /* @__PURE__ */ new Map();
3125
- let initialSize;
3126
- let initialCoordinates;
3127
- let initialFrameTransform;
3128
- let initialTranslate = { x: 0, y: 0 };
3129
- let currentTranslate;
3130
- let transformOrigin;
3131
- let moved = false;
3132
- const styleInjectionCleanup = E(() => {
3133
- var _a3, _b2;
3134
- const { status, source, target } = manager.dragOperation;
3135
- if (status.initialized) {
3136
- const sourceDocument = getDocument((_a3 = source == null ? void 0 : source.element) != null ? _a3 : null);
3137
- const targetDocument = getDocument((_b2 = target == null ? void 0 : target.element) != null ? _b2 : null);
3138
- const documents = /* @__PURE__ */ new Set([sourceDocument, targetDocument]);
3139
- for (const doc of documents) {
3140
- if (!styleTags.has(doc)) {
3141
- const style = document.createElement("style");
3142
- style.innerText = cssRules;
3143
- doc.head.prepend(style);
3144
- styleTags.set(doc, style);
3145
- }
3146
- }
3147
- return styleInjectionCleanup;
3148
- }
3324
+ __privateAdd$1(this, _Feedback_instances);
3325
+ __privateAdd$1(this, _overlay, __runInitializers$1(_init$1, 8, this)), __runInitializers$1(_init$1, 11, this);
3326
+ this.state = {
3327
+ initial: {},
3328
+ current: {}
3329
+ };
3330
+ this.registerEffect(__privateMethod(this, _Feedback_instances, injectStyles_fn));
3331
+ this.registerEffect(__privateMethod(this, _Feedback_instances, render_fn));
3332
+ }
3333
+ destroy() {
3334
+ super.destroy();
3335
+ injectedStyleTags.forEach((style) => style.remove());
3336
+ injectedStyleTags.clear();
3337
+ }
3338
+ };
3339
+ _init$1 = __decoratorStart$1(_a);
3340
+ _overlay = /* @__PURE__ */ new WeakMap();
3341
+ _Feedback_instances = /* @__PURE__ */ new WeakSet();
3342
+ render_fn = function() {
3343
+ var _a4, _b2, _c3;
3344
+ const { state, manager, options: options2 } = this;
3345
+ const { dragOperation } = manager;
3346
+ const { position, source, status } = dragOperation;
3347
+ if (status.idle) {
3348
+ state.current = {};
3349
+ state.initial = {};
3350
+ return;
3351
+ }
3352
+ if (!source) return;
3353
+ const { element, feedback } = source;
3354
+ if (!element || feedback === "none" || status.initializing) {
3355
+ return;
3356
+ }
3357
+ const { initial } = state;
3358
+ const feedbackElement = (_a4 = this.overlay) != null ? _a4 : element;
3359
+ const frameTransform = getFrameTransform(feedbackElement);
3360
+ const elementFrameTransform = getFrameTransform(element);
3361
+ const crossFrame = !isSameFrame(element, feedbackElement);
3362
+ const shape = new DOMRectangle(element, {
3363
+ frameTransform: crossFrame ? elementFrameTransform : null,
3364
+ ignoreTransforms: !crossFrame
3365
+ });
3366
+ const scaleDelta = {
3367
+ x: elementFrameTransform.scaleX / frameTransform.scaleX,
3368
+ y: elementFrameTransform.scaleY / frameTransform.scaleY
3369
+ };
3370
+ let cleanup;
3371
+ let { width, height, top, left } = shape;
3372
+ if (crossFrame) {
3373
+ width = width / scaleDelta.x;
3374
+ height = height / scaleDelta.y;
3375
+ }
3376
+ const styles = new Styles(feedbackElement);
3377
+ const { transition, translate } = getComputedStyles(element);
3378
+ const clone = feedback === "clone";
3379
+ const placeholder = feedback !== "move" && !this.overlay ? createPlaceholder(source) : null;
3380
+ const isKeyboardOperation = n(
3381
+ () => isKeyboardEvent(manager.dragOperation.activatorEvent)
3382
+ );
3383
+ if (translate !== "none") {
3384
+ const parsedTranslate = parseTranslate(translate);
3385
+ if (parsedTranslate && !initial.translate) {
3386
+ initial.translate = parsedTranslate;
3387
+ }
3388
+ }
3389
+ if (!initial.transformOrigin) {
3390
+ const current = n(() => position.current);
3391
+ initial.transformOrigin = {
3392
+ x: (current.x - left * frameTransform.scaleX - frameTransform.x) / (width * frameTransform.scaleX),
3393
+ y: (current.y - top * frameTransform.scaleY - frameTransform.y) / (height * frameTransform.scaleY)
3394
+ };
3395
+ }
3396
+ const { transformOrigin } = initial;
3397
+ const relativeTop = top * frameTransform.scaleY + frameTransform.y;
3398
+ const relativeLeft = left * frameTransform.scaleX + frameTransform.x;
3399
+ if (!initial.coordinates) {
3400
+ initial.coordinates = {
3401
+ x: relativeLeft,
3402
+ y: relativeTop
3403
+ };
3404
+ if (scaleDelta.x !== 1 || scaleDelta.y !== 1) {
3405
+ const { scaleX, scaleY } = elementFrameTransform;
3406
+ const { x: tX2, y: tY2 } = transformOrigin;
3407
+ initial.coordinates.x += (width * scaleX - width) * tX2;
3408
+ initial.coordinates.y += (height * scaleY - height) * tY2;
3409
+ }
3410
+ }
3411
+ if (!initial.dimensions) {
3412
+ initial.dimensions = { width, height };
3413
+ }
3414
+ if (!initial.frameTransform) {
3415
+ initial.frameTransform = frameTransform;
3416
+ }
3417
+ const coordinatesDelta = {
3418
+ x: initial.coordinates.x - relativeLeft,
3419
+ y: initial.coordinates.y - relativeTop
3420
+ };
3421
+ const sizeDelta = {
3422
+ width: (initial.dimensions.width * initial.frameTransform.scaleX - width * frameTransform.scaleX) * transformOrigin.x,
3423
+ height: (initial.dimensions.height * initial.frameTransform.scaleY - height * frameTransform.scaleY) * transformOrigin.y
3424
+ };
3425
+ const delta = {
3426
+ x: coordinatesDelta.x / frameTransform.scaleX + sizeDelta.width,
3427
+ y: coordinatesDelta.y / frameTransform.scaleY + sizeDelta.height
3428
+ };
3429
+ const projected = {
3430
+ left: left + delta.x,
3431
+ top: top + delta.y
3432
+ };
3433
+ feedbackElement.setAttribute(ATTRIBUTE, "true");
3434
+ const transform = n(() => dragOperation.transform);
3435
+ const initialTranslate = (_b2 = initial.translate) != null ? _b2 : { x: 0, y: 0 };
3436
+ const tX = transform.x * frameTransform.scaleX + initialTranslate.x;
3437
+ const tY = transform.y * frameTransform.scaleY + initialTranslate.y;
3438
+ const translateString = `${tX}px ${tY}px 0`;
3439
+ styles.set(
3440
+ {
3441
+ width,
3442
+ height,
3443
+ top: projected.top,
3444
+ left: projected.left,
3445
+ translate: translateString,
3446
+ scale: crossFrame ? `${scaleDelta.x} ${scaleDelta.y}` : "",
3447
+ "transform-origin": `${transformOrigin.x * 100}% ${transformOrigin.y * 100}%`
3448
+ },
3449
+ CSS_PREFIX
3450
+ );
3451
+ if (placeholder) {
3452
+ element.insertAdjacentElement("afterend", placeholder);
3453
+ if (options2 == null ? void 0 : options2.rootElement) {
3454
+ const root = typeof options2.rootElement === "function" ? options2.rootElement(source) : options2.rootElement;
3455
+ root.appendChild(element);
3456
+ }
3457
+ }
3458
+ if (supportsPopover(feedbackElement)) {
3459
+ if (!feedbackElement.hasAttribute("popover")) {
3460
+ feedbackElement.setAttribute("popover", "");
3461
+ }
3462
+ showPopover(feedbackElement);
3463
+ feedbackElement.addEventListener("beforetoggle", preventPopoverClose);
3464
+ }
3465
+ const resizeObserver = new ResizeObserver(() => {
3466
+ if (!placeholder) return;
3467
+ const placeholderShape = new DOMRectangle(placeholder, {
3468
+ frameTransform,
3469
+ ignoreTransforms: true
3149
3470
  });
3150
- const cleanupEffect = E(() => {
3151
- var _a3;
3152
- const { dragOperation } = manager;
3153
- const { position, source, status } = dragOperation;
3154
- if (status.idle) {
3155
- currentTranslate = void 0;
3156
- initialCoordinates = void 0;
3157
- initialSize = void 0;
3158
- initialFrameTransform = void 0;
3159
- initialTranslate = { x: 0, y: 0 };
3160
- transformOrigin = void 0;
3161
- return;
3162
- }
3163
- if (!source) return;
3164
- const { element, feedback } = source;
3165
- if (!element || feedback === "none") {
3166
- return;
3471
+ const origin = transformOrigin != null ? transformOrigin : { x: 1, y: 1 };
3472
+ const dX = (width - placeholderShape.width) * origin.x + delta.x;
3473
+ const dY = (height - placeholderShape.height) * origin.y + delta.y;
3474
+ styles.set(
3475
+ {
3476
+ width: placeholderShape.width,
3477
+ height: placeholderShape.height,
3478
+ top: top + dY,
3479
+ left: left + dX
3480
+ },
3481
+ CSS_PREFIX
3482
+ );
3483
+ const window2 = getWindow(element);
3484
+ if (element instanceof window2.HTMLTableRowElement && placeholder instanceof window2.HTMLTableRowElement) {
3485
+ const cells = Array.from(element.cells);
3486
+ const placeholderCells = Array.from(placeholder.cells);
3487
+ for (const [index, cell] of cells.entries()) {
3488
+ const placeholderCell = placeholderCells[index];
3489
+ cell.style.width = `${placeholderCell.offsetWidth}px`;
3167
3490
  }
3168
- let cleanup;
3169
- const frameTransform = getFrameTransform(element);
3170
- const shape = new DOMRectangle(element, {
3171
- frameTransform: null,
3172
- ignoreTransforms: true
3173
- });
3174
- const { width, height, top, left } = shape;
3175
- const styles = new Styles(element);
3176
- const { background, border, transition, translate } = getComputedStyles(element);
3177
- const clone = feedback === "clone";
3178
- const placeholder = feedback !== "move" ? createPlaceholder(source) : null;
3179
- const isKeyboardOperation = n(
3180
- () => isKeyboardEvent(manager.dragOperation.activatorEvent)
3181
- );
3182
- if (translate !== "none") {
3183
- const parsedTranslate = parseTranslate(translate);
3184
- if (parsedTranslate) {
3185
- initialTranslate = parsedTranslate;
3491
+ }
3492
+ dragOperation.shape = new DOMRectangle(element);
3493
+ });
3494
+ dragOperation.shape = new DOMRectangle(feedbackElement);
3495
+ if (n(() => source.status) === "idle") {
3496
+ requestAnimationFrame(() => source.status = "dragging");
3497
+ }
3498
+ let elementMutationObserver;
3499
+ let documentMutationObserver;
3500
+ if (placeholder) {
3501
+ resizeObserver.observe(placeholder);
3502
+ elementMutationObserver = new MutationObserver(() => {
3503
+ for (const attribute of Array.from(element.attributes)) {
3504
+ if (attribute.name.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attribute.name)) {
3505
+ continue;
3186
3506
  }
3507
+ if (attribute.name === "style") {
3508
+ if (supportsStyle(element) && supportsStyle(placeholder)) {
3509
+ placeholder.setAttribute("style", clone ? "" : "opacity: 0;");
3510
+ placeholder.style.setProperty("transition", "none");
3511
+ for (const key of Object.values(element.style)) {
3512
+ if (key.startsWith(CSS_PREFIX) || IGNORED_STYLES.includes(key)) {
3513
+ continue;
3514
+ }
3515
+ placeholder.style.setProperty(
3516
+ key,
3517
+ element.style.getPropertyValue(key)
3518
+ );
3519
+ }
3520
+ }
3521
+ continue;
3522
+ }
3523
+ placeholder.setAttribute(attribute.name, attribute.value);
3187
3524
  }
3188
- const relativeTop = top * frameTransform.scaleY + frameTransform.y;
3189
- const relativeLeft = left * frameTransform.scaleX + frameTransform.x;
3190
- if (!initialCoordinates) {
3191
- initialCoordinates = { x: relativeLeft, y: relativeTop };
3192
- }
3193
- if (!initialSize) {
3194
- initialSize = { width, height };
3195
- }
3196
- if (!initialFrameTransform) {
3197
- initialFrameTransform = frameTransform;
3525
+ if (clone) {
3526
+ placeholder.innerHTML = element.innerHTML;
3198
3527
  }
3199
- if (!transformOrigin) {
3200
- const current = n(() => position.current);
3201
- transformOrigin = {
3202
- x: (current.x - left * frameTransform.scaleX - frameTransform.x) / (width * frameTransform.scaleX),
3203
- y: (current.y - top * frameTransform.scaleY - frameTransform.y) / (height * frameTransform.scaleY)
3204
- };
3528
+ });
3529
+ elementMutationObserver.observe(element, {
3530
+ attributes: true,
3531
+ subtree: true
3532
+ });
3533
+ documentMutationObserver = new MutationObserver((entries) => {
3534
+ for (const entry of entries) {
3535
+ if (entry.addedNodes.length === 0) continue;
3536
+ for (const node of Array.from(entry.addedNodes)) {
3537
+ if (node.contains(element) && element.nextElementSibling !== placeholder) {
3538
+ element.insertAdjacentElement("afterend", placeholder);
3539
+ showPopover(feedbackElement);
3540
+ return;
3541
+ }
3542
+ if (node.contains(placeholder) && placeholder.previousElementSibling !== element) {
3543
+ placeholder.insertAdjacentElement("beforebegin", element);
3544
+ showPopover(feedbackElement);
3545
+ return;
3546
+ }
3547
+ }
3205
3548
  }
3206
- const coordinatesDelta = {
3207
- x: initialCoordinates.x - relativeLeft,
3208
- y: initialCoordinates.y - relativeTop
3209
- };
3210
- const sizeDelta = {
3211
- width: (initialSize.width * initialFrameTransform.scaleX - width * frameTransform.scaleX) * transformOrigin.x,
3212
- height: (initialSize.height * initialFrameTransform.scaleY - height * frameTransform.scaleY) * transformOrigin.y
3213
- };
3214
- const delta = {
3215
- x: coordinatesDelta.x / frameTransform.scaleX + sizeDelta.width,
3216
- y: coordinatesDelta.y / frameTransform.scaleY + sizeDelta.height
3217
- };
3218
- const projected = {
3219
- left: left + delta.x,
3220
- top: top + delta.y
3221
- };
3222
- element.setAttribute(ATTRIBUTE, "true");
3223
- const transform = n(() => dragOperation.transform);
3224
- const translateString = `${transform.x * frameTransform.scaleX + initialTranslate.x}px ${transform.y * frameTransform.scaleY + initialTranslate.y}px 0`;
3549
+ });
3550
+ documentMutationObserver.observe(element.ownerDocument.body, {
3551
+ childList: true,
3552
+ subtree: true
3553
+ });
3554
+ }
3555
+ const cleanupEffect = E(() => {
3556
+ var _a5;
3557
+ const { transform: transform2, status: status2 } = dragOperation;
3558
+ if (!transform2.x && !transform2.y && !state.current.translate) {
3559
+ return;
3560
+ }
3561
+ if (status2.dragging) {
3562
+ const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
3563
+ const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
3564
+ const x = transform2.x / frameTransform.scaleX + initialTranslate2.x;
3565
+ const y2 = transform2.y / frameTransform.scaleY + initialTranslate2.y;
3225
3566
  styles.set(
3226
3567
  {
3227
- width,
3228
- height,
3229
- top: projected.top,
3230
- left: projected.left,
3231
- background,
3232
- border,
3233
- translate: translateString
3568
+ transition: `${transition}, translate ${translateTransition}`,
3569
+ translate: `${x}px ${y2}px 0`
3234
3570
  },
3235
3571
  CSS_PREFIX
3236
3572
  );
3237
- if (placeholder) {
3238
- element.insertAdjacentElement("afterend", placeholder);
3239
- if (options == null ? void 0 : options.rootElement) {
3240
- const root = typeof options.rootElement === "function" ? options.rootElement(source) : options.rootElement;
3241
- root.appendChild(element);
3242
- }
3243
- }
3244
- if (supportsPopover(element)) {
3245
- if (!element.hasAttribute("popover")) {
3246
- element.setAttribute("popover", "");
3247
- }
3248
- showPopover(element);
3249
- }
3250
- const actual = new DOMRectangle(element, {
3251
- ignoreTransforms: true
3252
- });
3253
- const offset = {
3254
- top: projected.top - actual.top,
3255
- left: projected.left - actual.left
3573
+ dragOperation.shape = new DOMRectangle(feedbackElement);
3574
+ state.current.translate = {
3575
+ x,
3576
+ y: y2
3256
3577
  };
3257
- if (Math.abs(offset.left) > 0.01 || Math.abs(offset.top) > 0.01) {
3258
- styles.set(
3259
- {
3260
- top: actual.top + offset.top,
3261
- left: actual.left + offset.left
3262
- },
3263
- CSS_PREFIX
3264
- );
3265
- } else {
3266
- offset.left = 0;
3267
- offset.top = 0;
3578
+ }
3579
+ });
3580
+ const id = (_c3 = manager.dragOperation.source) == null ? void 0 : _c3.id;
3581
+ const restoreFocus = () => {
3582
+ var _a5;
3583
+ if (!isKeyboardOperation || id == null) {
3584
+ return;
3585
+ }
3586
+ const draggable = manager.registry.draggables.get(id);
3587
+ const element2 = (_a5 = draggable == null ? void 0 : draggable.handle) != null ? _a5 : draggable == null ? void 0 : draggable.element;
3588
+ if (element2 instanceof HTMLElement) {
3589
+ element2.focus();
3590
+ }
3591
+ };
3592
+ let dropEffectCleanup;
3593
+ cleanup = () => {
3594
+ elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
3595
+ documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
3596
+ resizeObserver.disconnect();
3597
+ if (supportsPopover(feedbackElement)) {
3598
+ feedbackElement.removeEventListener(
3599
+ "beforetoggle",
3600
+ preventPopoverClose
3601
+ );
3602
+ feedbackElement.removeAttribute("popover");
3603
+ }
3604
+ feedbackElement.removeAttribute(ATTRIBUTE);
3605
+ styles.reset();
3606
+ source.status = "idle";
3607
+ const moved = state.current.translate != null;
3608
+ if (placeholder && (moved || placeholder.parentElement !== feedbackElement.parentElement) && feedbackElement.isConnected) {
3609
+ placeholder.replaceWith(feedbackElement);
3610
+ }
3611
+ placeholder == null ? void 0 : placeholder.remove();
3612
+ cleanupEffect();
3613
+ dropEffectCleanup == null ? void 0 : dropEffectCleanup();
3614
+ };
3615
+ dropEffectCleanup = E(() => {
3616
+ if (dragOperation.status.dropped) {
3617
+ const onComplete = cleanup;
3618
+ cleanup = void 0;
3619
+ source.status = "dropping";
3620
+ let translate2 = state.current.translate;
3621
+ const moved = translate2 != null;
3622
+ if (!translate2 && element !== feedbackElement) {
3623
+ translate2 = {
3624
+ x: 0,
3625
+ y: 0
3626
+ };
3268
3627
  }
3269
- const resizeObserver = new ResizeObserver(() => {
3270
- if (!placeholder) return;
3271
- const placeholderShape = new DOMRectangle(placeholder, {
3272
- ignoreTransforms: true
3273
- });
3274
- const origin = transformOrigin != null ? transformOrigin : { x: 1, y: 1 };
3275
- const dX = (width - placeholderShape.width) * origin.x + delta.x;
3276
- const dY = (height - placeholderShape.height) * origin.y + delta.y;
3277
- styles.set(
3278
- {
3279
- width: placeholderShape.width,
3280
- height: placeholderShape.height,
3281
- top: top + dY,
3282
- left: left + dX
3283
- },
3284
- CSS_PREFIX
3285
- );
3286
- const window2 = getWindow(element);
3287
- if (element instanceof window2.HTMLTableRowElement && placeholder instanceof window2.HTMLTableRowElement) {
3288
- const cells = Array.from(element.cells);
3289
- const placeholderCells = Array.from(placeholder.cells);
3290
- for (const [index, cell] of cells.entries()) {
3291
- const placeholderCell = placeholderCells[index];
3292
- cell.style.width = `${placeholderCell.offsetWidth}px`;
3293
- }
3294
- }
3295
- dragOperation.shape = new DOMRectangle(element);
3296
- });
3297
- dragOperation.shape = new DOMRectangle(element);
3298
- source.status = "dragging";
3299
- let elementMutationObserver;
3300
- let documentMutationObserver;
3301
- if (placeholder) {
3302
- resizeObserver.observe(placeholder);
3303
- elementMutationObserver = new MutationObserver(() => {
3304
- for (const attribute of Array.from(element.attributes)) {
3305
- if (attribute.name.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attribute.name)) {
3306
- continue;
3307
- }
3308
- if (attribute.name === "style") {
3309
- if (supportsStyle(element) && supportsStyle(placeholder)) {
3310
- placeholder.setAttribute("style", clone ? "" : "opacity: 0;");
3311
- placeholder.style.setProperty("transition", "none");
3312
- for (const key of Object.values(element.style)) {
3313
- if (key.startsWith(CSS_PREFIX) || IGNORED_STYLES.includes(key)) {
3314
- continue;
3315
- }
3316
- placeholder.style.setProperty(
3317
- key,
3318
- element.style.getPropertyValue(key)
3319
- );
3320
- }
3628
+ if (!translate2) {
3629
+ onComplete == null ? void 0 : onComplete();
3630
+ return;
3631
+ }
3632
+ manager.renderer.rendering.then(() => {
3633
+ showPopover(feedbackElement);
3634
+ const target = placeholder != null ? placeholder : element;
3635
+ const animations = feedbackElement.getAnimations();
3636
+ if (animations.length) {
3637
+ animations.forEach((animation) => {
3638
+ const { effect: effect9 } = animation;
3639
+ if (effect9 instanceof KeyframeEffect) {
3640
+ if (effect9.getKeyframes().some((keyframe) => keyframe.translate)) {
3641
+ animation.finish();
3321
3642
  }
3322
- continue;
3323
- }
3324
- placeholder.setAttribute(attribute.name, attribute.value);
3325
- }
3326
- if (clone) {
3327
- placeholder.innerHTML = element.innerHTML;
3328
- }
3329
- });
3330
- elementMutationObserver.observe(element, {
3331
- attributes: true,
3332
- subtree: true
3333
- });
3334
- documentMutationObserver = new MutationObserver((entries) => {
3335
- for (const entry of entries) {
3336
- const { addedNodes } = entry;
3337
- if (addedNodes.length > 0 && Array.from(addedNodes).some((node) => node.contains(element))) {
3338
- element.insertAdjacentElement("afterend", placeholder);
3339
- showPopover(element);
3340
- return;
3341
3643
  }
3342
- }
3343
- });
3344
- documentMutationObserver.observe(element.ownerDocument.body, {
3345
- childList: true,
3346
- subtree: true
3347
- });
3348
- }
3349
- const cleanupEffect2 = E(function updateTransform() {
3350
- const { transform: transform2, status: status2 } = dragOperation;
3351
- if (!transform2.x && !transform2.y && !moved) {
3352
- return;
3353
- }
3354
- if (!moved) {
3355
- moved = true;
3356
- }
3357
- if (status2.dragging) {
3358
- const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
3359
- const x = transform2.x / frameTransform.scaleX + initialTranslate.x;
3360
- const y2 = transform2.y / frameTransform.scaleY + initialTranslate.y;
3361
- styles.set(
3362
- {
3363
- transition: `${transition}, translate ${translateTransition}`,
3364
- translate: `${x}px ${y2}px 0`
3365
- },
3366
- CSS_PREFIX
3367
- );
3368
- dragOperation.shape = new DOMRectangle(element);
3369
- currentTranslate = {
3370
- x,
3371
- y: y2
3372
- };
3373
- }
3374
- });
3375
- const id = (_a3 = manager.dragOperation.source) == null ? void 0 : _a3.id;
3376
- const restoreFocus = () => {
3377
- var _a4;
3378
- if (!isKeyboardOperation || id == null) {
3379
- return;
3380
- }
3381
- const draggable = manager.registry.draggables.get(id);
3382
- const element2 = (_a4 = draggable == null ? void 0 : draggable.handle) != null ? _a4 : draggable == null ? void 0 : draggable.element;
3383
- if (element2 instanceof HTMLElement) {
3384
- element2.focus();
3385
- }
3386
- };
3387
- let dropEffectCleanup;
3388
- cleanup = () => {
3389
- elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
3390
- documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
3391
- resizeObserver.disconnect();
3392
- styles.reset();
3393
- if (placeholder && (moved || placeholder.parentElement !== element.parentElement) && element.isConnected) {
3394
- placeholder.replaceWith(element);
3395
- }
3396
- placeholder == null ? void 0 : placeholder.remove();
3397
- element.removeAttribute(ATTRIBUTE);
3398
- if (supportsPopover(element)) {
3399
- element.removeAttribute("popover");
3644
+ });
3400
3645
  }
3401
- cleanupEffect2();
3402
- dropEffectCleanup == null ? void 0 : dropEffectCleanup();
3403
- source.status = "idle";
3404
- moved = false;
3405
- };
3406
- dropEffectCleanup = E(function dropAnimation() {
3407
- if (dragOperation.status.dropped) {
3408
- const onComplete = cleanup;
3409
- cleanup = void 0;
3410
- source.status = "dropping";
3411
- const transform2 = currentTranslate;
3412
- if (!transform2) {
3646
+ const options22 = {
3647
+ frameTransform: isSameFrame(feedbackElement, target) ? null : void 0
3648
+ };
3649
+ const current = new DOMRectangle(feedbackElement, options22);
3650
+ const final = new DOMRectangle(target, options22);
3651
+ const delta2 = Rectangle.delta(current, final, source.alignment);
3652
+ const finalTranslate = {
3653
+ x: translate2.x - delta2.x,
3654
+ y: translate2.y - delta2.y
3655
+ };
3656
+ const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
3657
+ minHeight: [
3658
+ `${current.intrinsicHeight}px`,
3659
+ `${final.intrinsicHeight}px`
3660
+ ],
3661
+ maxHeight: [
3662
+ `${current.intrinsicHeight}px`,
3663
+ `${final.intrinsicHeight}px`
3664
+ ]
3665
+ } : {};
3666
+ const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
3667
+ minWidth: [
3668
+ `${current.intrinsicWidth}px`,
3669
+ `${final.intrinsicWidth}px`
3670
+ ],
3671
+ maxWidth: [
3672
+ `${current.intrinsicWidth}px`,
3673
+ `${final.intrinsicWidth}px`
3674
+ ]
3675
+ } : {};
3676
+ animateTransform({
3677
+ element: feedbackElement,
3678
+ keyframes: __spreadProps$4(__spreadValues$4(__spreadValues$4({}, heightKeyframes), widthKeyframes), {
3679
+ translate: [
3680
+ `${translate2.x}px ${translate2.y}px 0`,
3681
+ `${finalTranslate.x}px ${finalTranslate.y}px 0`
3682
+ ]
3683
+ }),
3684
+ options: {
3685
+ duration: moved || feedbackElement !== element ? 250 : 0,
3686
+ easing: "ease"
3687
+ },
3688
+ onReady() {
3689
+ styles.remove(["translate"], CSS_PREFIX);
3690
+ },
3691
+ onFinish() {
3413
3692
  onComplete == null ? void 0 : onComplete();
3414
- return;
3693
+ requestAnimationFrame(restoreFocus);
3415
3694
  }
3416
- manager.renderer.rendering.then(() => {
3417
- showPopover(element);
3418
- const target = placeholder != null ? placeholder : element;
3419
- const animations = element.getAnimations();
3420
- if (animations.length) {
3421
- animations.forEach((animation) => {
3422
- const { effect: effect9 } = animation;
3423
- if (effect9 instanceof KeyframeEffect) {
3424
- if (effect9.getKeyframes().some((keyframe) => keyframe.translate)) {
3425
- animation.finish();
3426
- }
3427
- }
3428
- });
3429
- }
3430
- const sameFrame = getFrameElement(element) === getFrameElement(target);
3431
- const options2 = {
3432
- frameTransform: sameFrame ? null : void 0
3433
- };
3434
- const current = new DOMRectangle(element, options2);
3435
- const final = new DOMRectangle(target, options2);
3436
- const delta2 = {
3437
- x: current.center.x - final.center.x,
3438
- y: current.center.y - final.center.y
3439
- };
3440
- const finalTransform = {
3441
- x: transform2.x - delta2.x,
3442
- y: transform2.y - delta2.y
3443
- };
3444
- const heightKeyframes = Math.round(current.height) !== Math.round(final.height) ? {
3445
- minHeight: [`${current.height}px`, `${final.height}px`],
3446
- maxHeight: [`${current.height}px`, `${final.height}px`]
3447
- } : {};
3448
- const widthKeyframes = Math.round(current.width) !== Math.round(final.width) ? {
3449
- minWidth: [`${current.width}px`, `${final.width}px`],
3450
- maxWidth: [`${current.width}px`, `${final.width}px`]
3451
- } : {};
3452
- animateTransform({
3453
- element,
3454
- keyframes: __spreadProps$4(__spreadValues$4(__spreadValues$4({}, heightKeyframes), widthKeyframes), {
3455
- translate: [
3456
- `${transform2.x}px ${transform2.y}px 0`,
3457
- `${finalTransform.x}px ${finalTransform.y}px 0`
3458
- ]
3459
- }),
3460
- options: {
3461
- duration: moved ? 250 : 0,
3462
- easing: "ease"
3463
- },
3464
- onReady() {
3465
- styles.remove(["translate"], CSS_PREFIX);
3466
- },
3467
- onFinish() {
3468
- requestAnimationFrame(restoreFocus);
3469
- onComplete == null ? void 0 : onComplete();
3470
- }
3471
- });
3472
- });
3473
- }
3695
+ });
3474
3696
  });
3475
- return () => cleanup == null ? void 0 : cleanup();
3476
- });
3477
- this.destroy = () => {
3478
- styleInjectionCleanup();
3479
- cleanupEffect();
3480
- styleTags.forEach((style) => style.remove());
3481
- };
3697
+ }
3698
+ });
3699
+ return () => cleanup == null ? void 0 : cleanup();
3700
+ };
3701
+ injectStyles_fn = function() {
3702
+ var _a4, _b2;
3703
+ const { status, source, target } = this.manager.dragOperation;
3704
+ if (status.initialized) {
3705
+ const sourceDocument = getDocument((_a4 = source == null ? void 0 : source.element) != null ? _a4 : null);
3706
+ const targetDocument = getDocument((_b2 = target == null ? void 0 : target.element) != null ? _b2 : null);
3707
+ const documents = /* @__PURE__ */ new Set([sourceDocument, targetDocument]);
3708
+ for (const doc of documents) {
3709
+ if (!injectedStyleTags.has(doc)) {
3710
+ const style = document.createElement("style");
3711
+ style.innerText = CSS_RULES;
3712
+ doc.head.prepend(style);
3713
+ injectedStyleTags.set(doc, style);
3714
+ }
3715
+ }
3482
3716
  }
3483
3717
  };
3718
+ __decorateElement$1(_init$1, 4, "overlay", _overlay_dec, _Feedback, _overlay);
3719
+ __decoratorMetadata$1(_init$1, _Feedback);
3484
3720
  _Feedback.configure = configurator(_Feedback);
3485
3721
  var Feedback = _Feedback;
3486
- function createPlaceholder(source) {
3487
- return n(() => {
3488
- var _a3;
3489
- const { element, manager } = source;
3490
- if (!element || !manager) return;
3491
- const { droppables } = manager.registry;
3492
- const containedDroppables = /* @__PURE__ */ new Map();
3493
- for (const droppable of droppables) {
3494
- if (!droppable.element) continue;
3495
- if (element === droppable.element || element.contains(droppable.element)) {
3496
- const identifierAttribute = `${ATTR_PREFIX}${generateUniqueId("dom-id")}`;
3497
- droppable.element.setAttribute(identifierAttribute, "");
3498
- containedDroppables.set(droppable, identifierAttribute);
3499
- }
3500
- }
3501
- const cleanup = [];
3502
- const placeholder = cloneElement(element);
3503
- const { remove } = placeholder;
3504
- for (const [droppable, identifierAttribute] of containedDroppables) {
3505
- if (!droppable.element) continue;
3506
- const selector = `[${identifierAttribute}]`;
3507
- const clonedElement = placeholder.matches(selector) ? placeholder : placeholder.querySelector(selector);
3508
- (_a3 = droppable.element) == null ? void 0 : _a3.removeAttribute(identifierAttribute);
3509
- if (!clonedElement) continue;
3510
- let current = droppable.element;
3511
- droppable.proxy = clonedElement;
3512
- clonedElement.removeAttribute(identifierAttribute);
3513
- ProxiedElements.set(current, clonedElement);
3514
- cleanup.push(() => {
3515
- ProxiedElements.delete(current);
3516
- droppable.proxy = void 0;
3517
- });
3518
- }
3519
- placeholder.setAttribute("inert", "true");
3520
- placeholder.setAttribute("tab-index", "-1");
3521
- placeholder.setAttribute("aria-hidden", "true");
3522
- placeholder.setAttribute(PLACEHOLDER_ATTRIBUTE, "");
3523
- placeholder.remove = () => {
3524
- cleanup.forEach((fn) => fn());
3525
- remove.call(placeholder);
3526
- };
3527
- return placeholder;
3528
- });
3529
- }
3722
+ var injectedStyleTags = /* @__PURE__ */ new Map();
3530
3723
  var LOCKED = true;
3531
3724
  var UNLOCKED = false;
3532
- var _dec, _a, _dec2, _b, _init$1, __b, __a;
3533
- _b = (_dec2 = [reactive], ScrollDirection.Forward), _a = (_dec = [reactive], ScrollDirection.Reverse);
3725
+ var _dec, _a2, _dec2, _b, _init2, __b, __a;
3726
+ _b = (_dec2 = [reactive], ScrollDirection.Forward), _a2 = (_dec = [reactive], ScrollDirection.Reverse);
3534
3727
  var ScrollLock = class {
3535
3728
  constructor() {
3536
- __privateAdd$1(this, __b, __runInitializers$1(_init$1, 8, this, LOCKED)), __runInitializers$1(_init$1, 11, this);
3537
- __privateAdd$1(this, __a, __runInitializers$1(_init$1, 12, this, LOCKED)), __runInitializers$1(_init$1, 15, this);
3729
+ __privateAdd$1(this, __b, __runInitializers$1(_init2, 8, this, LOCKED)), __runInitializers$1(_init2, 11, this);
3730
+ __privateAdd$1(this, __a, __runInitializers$1(_init2, 12, this, LOCKED)), __runInitializers$1(_init2, 15, this);
3538
3731
  }
3539
3732
  isLocked(direction) {
3540
3733
  if (direction === ScrollDirection.Idle) {
@@ -3552,12 +3745,12 @@ var ScrollLock = class {
3552
3745
  this[direction] = UNLOCKED;
3553
3746
  }
3554
3747
  };
3555
- _init$1 = __decoratorStart$1(null);
3748
+ _init2 = __decoratorStart$1(null);
3556
3749
  __b = /* @__PURE__ */ new WeakMap();
3557
3750
  __a = /* @__PURE__ */ new WeakMap();
3558
- __decorateElement$1(_init$1, 4, _b, _dec2, ScrollLock, __b);
3559
- __decorateElement$1(_init$1, 4, _a, _dec, ScrollLock, __a);
3560
- __decoratorMetadata$1(_init$1, ScrollLock);
3751
+ __decorateElement$1(_init2, 4, _b, _dec2, ScrollLock, __b);
3752
+ __decorateElement$1(_init2, 4, _a2, _dec, ScrollLock, __a);
3753
+ __decoratorMetadata$1(_init2, ScrollLock);
3561
3754
  var DIRECTIONS = [ScrollDirection.Forward, ScrollDirection.Reverse];
3562
3755
  var ScrollIntent = class {
3563
3756
  constructor() {
@@ -3609,11 +3802,11 @@ var ScrollIntentTracker = class extends Plugin {
3609
3802
  function getDirection$1(a2, b2) {
3610
3803
  return Math.sign(a2 - b2);
3611
3804
  }
3612
- var _autoScrolling_dec, _a2, _init2, _autoScrolling, _meta, _scroll;
3613
- var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive], _a2) {
3805
+ var _autoScrolling_dec, _a3, _init3, _autoScrolling, _meta, _scroll;
3806
+ var Scroller = class extends (_a3 = CorePlugin, _autoScrolling_dec = [reactive], _a3) {
3614
3807
  constructor(manager) {
3615
3808
  super(manager);
3616
- __privateAdd$1(this, _autoScrolling, __runInitializers$1(_init2, 8, this, false)), __runInitializers$1(_init2, 11, this);
3809
+ __privateAdd$1(this, _autoScrolling, __runInitializers$1(_init3, 8, this, false)), __runInitializers$1(_init3, 11, this);
3617
3810
  __privateAdd$1(this, _meta);
3618
3811
  __privateAdd$1(this, _scroll, () => {
3619
3812
  if (!__privateGet$1(this, _meta)) {
@@ -3623,8 +3816,8 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
3623
3816
  if (by.y) element.scrollTop += by.y;
3624
3817
  if (by.x) element.scrollLeft += by.x;
3625
3818
  });
3626
- this.scroll = (options) => {
3627
- var _a3;
3819
+ this.scroll = (options2) => {
3820
+ var _a4;
3628
3821
  if (this.disabled) {
3629
3822
  return false;
3630
3823
  }
@@ -3636,7 +3829,7 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
3636
3829
  const { position } = this.manager.dragOperation;
3637
3830
  const currentPosition = position == null ? void 0 : position.current;
3638
3831
  if (currentPosition) {
3639
- const { by } = options != null ? options : {};
3832
+ const { by } = options2 != null ? options2 : {};
3640
3833
  const intent = by ? {
3641
3834
  x: getScrollIntent(by.x),
3642
3835
  y: getScrollIntent(by.y)
@@ -3666,7 +3859,7 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
3666
3859
  const scrollLeftBy = x * speed.x;
3667
3860
  const scrollTopBy = y2 * speed.y;
3668
3861
  if (scrollLeftBy || scrollTopBy) {
3669
- const previousScrollBy = (_a3 = __privateGet$1(this, _meta)) == null ? void 0 : _a3.by;
3862
+ const previousScrollBy = (_a4 = __privateGet$1(this, _meta)) == null ? void 0 : _a4.by;
3670
3863
  if (this.autoScrolling && previousScrollBy) {
3671
3864
  const scrollIntentMismatch = previousScrollBy.x && !scrollLeftBy || previousScrollBy.y && !scrollTopBy;
3672
3865
  if (scrollIntentMismatch) continue;
@@ -3742,12 +3935,12 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
3742
3935
  });
3743
3936
  }
3744
3937
  };
3745
- _init2 = __decoratorStart$1(_a2);
3938
+ _init3 = __decoratorStart$1(_a3);
3746
3939
  _autoScrolling = /* @__PURE__ */ new WeakMap();
3747
3940
  _meta = /* @__PURE__ */ new WeakMap();
3748
3941
  _scroll = /* @__PURE__ */ new WeakMap();
3749
- __decorateElement$1(_init2, 4, "autoScrolling", _autoScrolling_dec, Scroller, _autoScrolling);
3750
- __decoratorMetadata$1(_init2, Scroller);
3942
+ __decorateElement$1(_init3, 4, "autoScrolling", _autoScrolling_dec, Scroller, _autoScrolling);
3943
+ __decoratorMetadata$1(_init3, Scroller);
3751
3944
  function getScrollIntent(value) {
3752
3945
  if (value > 0) {
3753
3946
  return ScrollDirection.Forward;
@@ -3804,10 +3997,10 @@ var ScrollListener = class extends CorePlugin {
3804
3997
  };
3805
3998
  const { dragOperation } = this.manager;
3806
3999
  this.destroy = E(() => {
3807
- var _a3, _b2, _c3;
4000
+ var _a4, _b2, _c3;
3808
4001
  const enabled = dragOperation.status.dragging;
3809
4002
  if (enabled) {
3810
- const root = (_c3 = (_b2 = (_a3 = dragOperation.source) == null ? void 0 : _a3.element) == null ? void 0 : _b2.ownerDocument) != null ? _c3 : document;
4003
+ const root = (_c3 = (_b2 = (_a4 = dragOperation.source) == null ? void 0 : _a4.element) == null ? void 0 : _b2.ownerDocument) != null ? _c3 : document;
3811
4004
  root.addEventListener("scroll", this.handleScroll, listenerOptions);
3812
4005
  return () => {
3813
4006
  root.removeEventListener(
@@ -3829,8 +4022,9 @@ var PreventSelection = class extends Plugin {
3829
4022
  const { dragOperation } = this.manager;
3830
4023
  if (dragOperation.status.initialized) {
3831
4024
  const style = document.createElement("style");
3832
- style.innerText = `* { user-select: none !important;, -webkit-user-select: none !important; }`;
4025
+ style.innerText = `* { user-select: none !important; -webkit-user-select: none !important; }`;
3833
4026
  document.head.appendChild(style);
4027
+ removeSelection();
3834
4028
  document.addEventListener("selectionchange", removeSelection, {
3835
4029
  capture: true
3836
4030
  });
@@ -3845,8 +4039,8 @@ var PreventSelection = class extends Plugin {
3845
4039
  }
3846
4040
  };
3847
4041
  function removeSelection() {
3848
- var _a3;
3849
- (_a3 = document.getSelection()) == null ? void 0 : _a3.removeAllRanges();
4042
+ var _a4;
4043
+ (_a4 = document.getSelection()) == null ? void 0 : _a4.removeAllRanges();
3850
4044
  }
3851
4045
  var DEFAULT_KEYBOARD_CODES = {
3852
4046
  start: ["Space", "Enter"],
@@ -3860,13 +4054,13 @@ var DEFAULT_KEYBOARD_CODES = {
3860
4054
  var DEFAULT_OFFSET = 10;
3861
4055
  var _cleanupFunctions;
3862
4056
  var KeyboardSensor = class extends Sensor {
3863
- constructor(manager, options) {
4057
+ constructor(manager, options2) {
3864
4058
  super(manager);
3865
4059
  this.manager = manager;
3866
- this.options = options;
4060
+ this.options = options2;
3867
4061
  __privateAdd$1(this, _cleanupFunctions, []);
3868
4062
  this.listeners = new Listeners();
3869
- this.handleSourceKeyDown = (event, source, options2) => {
4063
+ this.handleSourceKeyDown = (event, source, options3) => {
3870
4064
  if (this.disabled || event.defaultPrevented) {
3871
4065
  return;
3872
4066
  }
@@ -3877,24 +4071,24 @@ var KeyboardSensor = class extends Sensor {
3877
4071
  return;
3878
4072
  }
3879
4073
  if (!source.handle && source.element && event.target === source.element || source.handle && event.target === source.handle) {
3880
- const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options2 != null ? options2 : {};
4074
+ const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options3 != null ? options3 : {};
3881
4075
  if (!keyboardCodes.start.includes(event.code)) {
3882
4076
  return;
3883
4077
  }
3884
4078
  if (!this.manager.dragOperation.status.idle) {
3885
4079
  return;
3886
4080
  }
3887
- this.handleStart(event, source, options2);
4081
+ this.handleStart(event, source, options3);
3888
4082
  }
3889
4083
  };
3890
4084
  }
3891
- bind(source, options = this.options) {
4085
+ bind(source, options2 = this.options) {
3892
4086
  const unbind = E(() => {
3893
- var _a3;
3894
- const target = (_a3 = source.handle) != null ? _a3 : source.element;
4087
+ var _a4;
4088
+ const target = (_a4 = source.handle) != null ? _a4 : source.element;
3895
4089
  const listener = (event) => {
3896
4090
  if (isKeyboardEvent(event)) {
3897
- this.handleSourceKeyDown(event, source, options);
4091
+ this.handleSourceKeyDown(event, source, options2);
3898
4092
  }
3899
4093
  };
3900
4094
  if (target) {
@@ -3906,7 +4100,7 @@ var KeyboardSensor = class extends Sensor {
3906
4100
  });
3907
4101
  return unbind;
3908
4102
  }
3909
- handleStart(event, source, options) {
4103
+ handleStart(event, source, options2) {
3910
4104
  const { element } = source;
3911
4105
  if (!element) {
3912
4106
  throw new Error("Source draggable does not have an associated element");
@@ -3932,22 +4126,22 @@ var KeyboardSensor = class extends Sensor {
3932
4126
  this.listeners.bind(sourceDocument, [
3933
4127
  {
3934
4128
  type: "keydown",
3935
- listener: (event2) => this.handleKeyDown(event2, source, options),
4129
+ listener: (event2) => this.handleKeyDown(event2, source, options2),
3936
4130
  options: { capture: true }
3937
4131
  }
3938
4132
  ]),
3939
4133
  this.listeners.bind(sourceWindow, [
3940
- { type: "resize", listener: () => this.handleEnd(true) }
4134
+ { type: "resize", listener: () => this.handleEnd(event, true) }
3941
4135
  ])
3942
4136
  ];
3943
4137
  __privateGet$1(this, _cleanupFunctions).push(...listeners);
3944
4138
  }
3945
- handleKeyDown(event, _source, options) {
3946
- const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options != null ? options : {};
4139
+ handleKeyDown(event, _source, options2) {
4140
+ const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options2 != null ? options2 : {};
3947
4141
  if (isKeycode(event, [...keyboardCodes.end, ...keyboardCodes.cancel])) {
3948
4142
  event.preventDefault();
3949
4143
  const canceled = isKeycode(event, keyboardCodes.cancel);
3950
- this.handleEnd(canceled);
4144
+ this.handleEnd(event, canceled);
3951
4145
  return;
3952
4146
  }
3953
4147
  if (isKeycode(event, keyboardCodes.up)) {
@@ -3961,8 +4155,9 @@ var KeyboardSensor = class extends Sensor {
3961
4155
  this.handleMove("right", event);
3962
4156
  }
3963
4157
  }
3964
- handleEnd(canceled) {
4158
+ handleEnd(event, canceled) {
3965
4159
  this.manager.actions.stop({
4160
+ event,
3966
4161
  canceled
3967
4162
  });
3968
4163
  this.cleanup();
@@ -3994,6 +4189,7 @@ var KeyboardSensor = class extends Sensor {
3994
4189
  if ((offset == null ? void 0 : offset.x) || (offset == null ? void 0 : offset.y)) {
3995
4190
  event.preventDefault();
3996
4191
  this.manager.actions.move({
4192
+ event,
3997
4193
  by: offset
3998
4194
  });
3999
4195
  }
@@ -4021,10 +4217,10 @@ function isKeycode(event, codes) {
4021
4217
  }
4022
4218
  var _clearTimeout;
4023
4219
  var _PointerSensor = class _PointerSensor2 extends Sensor {
4024
- constructor(manager, options) {
4220
+ constructor(manager, options2) {
4025
4221
  super(manager);
4026
4222
  this.manager = manager;
4027
- this.options = options;
4223
+ this.options = options2;
4028
4224
  this.listeners = new Listeners();
4029
4225
  this.cleanup = /* @__PURE__ */ new Set();
4030
4226
  __privateAdd$1(this, _clearTimeout);
@@ -4032,13 +4228,13 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4032
4228
  this.handlePointerUp = this.handlePointerUp.bind(this);
4033
4229
  this.handleKeyDown = this.handleKeyDown.bind(this);
4034
4230
  }
4035
- bind(source, options = this.options) {
4231
+ bind(source, options2 = this.options) {
4036
4232
  const unbind = E(() => {
4037
- var _a3;
4038
- const target = (_a3 = source.handle) != null ? _a3 : source.element;
4233
+ var _a4;
4234
+ const target = (_a4 = source.handle) != null ? _a4 : source.element;
4039
4235
  const listener = (event) => {
4040
4236
  if (isPointerEvent(event)) {
4041
- this.handlePointerDown(event, source, options);
4237
+ this.handlePointerDown(event, source, options2);
4042
4238
  }
4043
4239
  };
4044
4240
  if (target) {
@@ -4051,7 +4247,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4051
4247
  });
4052
4248
  return unbind;
4053
4249
  }
4054
- handlePointerDown(event, source, options = {}) {
4250
+ handlePointerDown(event, source, options2 = {}) {
4055
4251
  if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled || isCapturedBySensor(event)) {
4056
4252
  return;
4057
4253
  }
@@ -4062,7 +4258,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4062
4258
  x: event.clientX * offset.scaleX + offset.x,
4063
4259
  y: event.clientY * offset.scaleY + offset.y
4064
4260
  };
4065
- const { activationConstraints } = options;
4261
+ const { activationConstraints } = options2;
4066
4262
  const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
4067
4263
  event.sensor = this;
4068
4264
  if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
@@ -4084,7 +4280,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4084
4280
  const unbindListeners = this.listeners.bind(ownerDocument, [
4085
4281
  {
4086
4282
  type: "pointermove",
4087
- listener: (event2) => this.handlePointerMove(event2, source, options)
4283
+ listener: (event2) => this.handlePointerMove(event2, source, options2)
4088
4284
  },
4089
4285
  {
4090
4286
  type: "pointerup",
@@ -4096,18 +4292,21 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4096
4292
  {
4097
4293
  // Cancel activation if there is a competing Drag and Drop interaction
4098
4294
  type: "dragstart",
4099
- listener: isNativeDraggable ? this.handleCancel : preventDefault
4295
+ listener: isNativeDraggable ? this.handleCancel : preventDefault,
4296
+ options: {
4297
+ capture: true
4298
+ }
4100
4299
  }
4101
4300
  ]);
4102
4301
  const cleanup = () => {
4103
- var _a3;
4104
- setTimeout(unbindListeners);
4105
- (_a3 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a3.call(this);
4302
+ var _a4;
4303
+ unbindListeners();
4304
+ (_a4 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
4106
4305
  this.initialCoordinates = void 0;
4107
4306
  };
4108
4307
  this.cleanup.add(cleanup);
4109
4308
  }
4110
- handlePointerMove(event, source, options) {
4309
+ handlePointerMove(event, source, options2) {
4111
4310
  const coordinates = {
4112
4311
  x: event.clientX,
4113
4312
  y: event.clientY
@@ -4118,7 +4317,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4118
4317
  if (this.manager.dragOperation.status.dragging) {
4119
4318
  event.preventDefault();
4120
4319
  event.stopPropagation();
4121
- this.manager.actions.move({ to: coordinates });
4320
+ this.manager.actions.move({ event, to: coordinates });
4122
4321
  return;
4123
4322
  }
4124
4323
  if (!this.initialCoordinates) {
@@ -4128,12 +4327,12 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4128
4327
  x: coordinates.x - this.initialCoordinates.x,
4129
4328
  y: coordinates.y - this.initialCoordinates.y
4130
4329
  };
4131
- const { activationConstraints } = options;
4330
+ const { activationConstraints } = options2;
4132
4331
  const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
4133
4332
  const { distance, delay } = constraints != null ? constraints : {};
4134
4333
  if (distance) {
4135
4334
  if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
4136
- return this.handleCancel();
4335
+ return this.handleCancel(event);
4137
4336
  }
4138
4337
  if (exceedsDistance(delta, distance.value)) {
4139
4338
  return this.handleStart(source, event);
@@ -4141,17 +4340,17 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4141
4340
  }
4142
4341
  if (delay) {
4143
4342
  if (exceedsDistance(delta, delay.tolerance)) {
4144
- return this.handleCancel();
4343
+ return this.handleCancel(event);
4145
4344
  }
4146
4345
  }
4147
4346
  }
4148
4347
  handlePointerUp(event) {
4149
4348
  const { status } = this.manager.dragOperation;
4150
- if (!status.idle) {
4349
+ if (status.dragging) {
4151
4350
  event.preventDefault();
4152
4351
  event.stopPropagation();
4153
4352
  const canceled = !status.initialized;
4154
- this.manager.actions.stop({ canceled });
4353
+ this.manager.actions.stop({ event, canceled });
4155
4354
  }
4156
4355
  this.cleanup.forEach((cleanup) => cleanup());
4157
4356
  this.cleanup.clear();
@@ -4159,13 +4358,13 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4159
4358
  handleKeyDown(event) {
4160
4359
  if (event.key === "Escape") {
4161
4360
  event.preventDefault();
4162
- this.handleCancel();
4361
+ this.handleCancel(event);
4163
4362
  }
4164
4363
  }
4165
4364
  handleStart(source, event) {
4166
- var _a3;
4365
+ var _a4;
4167
4366
  const { manager, initialCoordinates } = this;
4168
- (_a3 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a3.call(this);
4367
+ (_a4 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
4169
4368
  if (!initialCoordinates || manager.dragOperation.status.initialized) {
4170
4369
  return;
4171
4370
  }
@@ -4178,6 +4377,8 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4178
4377
  manager.actions.start({ coordinates: initialCoordinates, event });
4179
4378
  });
4180
4379
  const ownerDocument = getDocument(event.target);
4380
+ const pointerCaptureTarget = ownerDocument.body;
4381
+ pointerCaptureTarget.setPointerCapture(event.pointerId);
4181
4382
  const unbind = this.listeners.bind(ownerDocument, [
4182
4383
  {
4183
4384
  // Prevent scrolling on touch devices
@@ -4192,18 +4393,28 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4192
4393
  type: "click",
4193
4394
  listener: preventDefault
4194
4395
  },
4396
+ {
4397
+ type: "contextmenu",
4398
+ listener: preventDefault
4399
+ },
4195
4400
  {
4196
4401
  type: "keydown",
4197
4402
  listener: this.handleKeyDown
4403
+ },
4404
+ {
4405
+ type: "lostpointercapture",
4406
+ listener: (event2) => {
4407
+ if (event2.target !== pointerCaptureTarget) return;
4408
+ this.handlePointerUp(event2);
4409
+ }
4198
4410
  }
4199
4411
  ]);
4200
- ownerDocument.body.setPointerCapture(event.pointerId);
4201
4412
  this.cleanup.add(unbind);
4202
4413
  }
4203
- handleCancel() {
4414
+ handleCancel(event) {
4204
4415
  const { dragOperation } = this.manager;
4205
4416
  if (dragOperation.status.initialized) {
4206
- this.manager.actions.stop({ canceled: true });
4417
+ this.manager.actions.stop({ event, canceled: true });
4207
4418
  }
4208
4419
  this.cleanup.forEach((cleanup) => cleanup());
4209
4420
  this.cleanup.clear();
@@ -4235,15 +4446,21 @@ function patchWindow(window2) {
4235
4446
  windows.add(window2);
4236
4447
  }
4237
4448
  var defaultPreset = {
4449
+ modifiers: [],
4238
4450
  plugins: [Accessibility, AutoScroller, Cursor, Feedback, PreventSelection],
4239
4451
  sensors: [
4240
4452
  PointerSensor.configure({
4241
4453
  activationConstraints(event, source) {
4242
- var _a3;
4454
+ var _a4;
4243
4455
  const { pointerType, target } = event;
4244
- if (pointerType === "mouse" && isElement(target) && (source.handle === target || ((_a3 = source.handle) == null ? void 0 : _a3.contains(target)))) {
4456
+ if (pointerType === "mouse" && isElement(target) && (source.handle === target || ((_a4 = source.handle) == null ? void 0 : _a4.contains(target)))) {
4245
4457
  return void 0;
4246
4458
  }
4459
+ if (pointerType === "touch") {
4460
+ return {
4461
+ delay: { value: 250, tolerance: 5 }
4462
+ };
4463
+ }
4247
4464
  return {
4248
4465
  delay: { value: 200, tolerance: 10 },
4249
4466
  distance: { value: 5 }
@@ -4267,10 +4484,10 @@ var DragDropManager2 = class extends DragDropManager$1 {
4267
4484
  }));
4268
4485
  }
4269
4486
  };
4270
- var _feedback_dec, _element_dec, _handle_dec, _c, _init3, _handle, _element$1, _feedback;
4487
+ var _feedback_dec, _element_dec, _handle_dec, _c, _init4, _handle, _element$1, _feedback;
4271
4488
  var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [reactive], _element_dec = [reactive], _feedback_dec = [reactive], _c) {
4272
- constructor(_a3, manager) {
4273
- var _b2 = _a3, {
4489
+ constructor(_a4, manager) {
4490
+ var _b2 = _a4, {
4274
4491
  element,
4275
4492
  effects: effects2 = () => [],
4276
4493
  handle,
@@ -4286,16 +4503,16 @@ var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [rea
4286
4503
  effects: () => [
4287
4504
  ...effects2(),
4288
4505
  () => {
4289
- var _a4, _b3;
4506
+ var _a5, _b3;
4290
4507
  const { manager: manager2 } = this;
4291
4508
  if (!manager2) return;
4292
- const sensors = (_b3 = (_a4 = this.sensors) == null ? void 0 : _a4.map(descriptor)) != null ? _b3 : [
4509
+ const sensors = (_b3 = (_a5 = this.sensors) == null ? void 0 : _a5.map(descriptor)) != null ? _b3 : [
4293
4510
  ...manager2.sensors
4294
4511
  ];
4295
4512
  const unbindFunctions = sensors.map((entry) => {
4296
4513
  const sensorInstance = entry instanceof Sensor ? entry : manager2.registry.register(entry.plugin);
4297
- const options = entry instanceof Sensor ? void 0 : entry.options;
4298
- const unbind = sensorInstance.bind(this, options);
4514
+ const options2 = entry instanceof Sensor ? void 0 : entry.options;
4515
+ const unbind = sensorInstance.bind(this, options2);
4299
4516
  return unbind;
4300
4517
  });
4301
4518
  return function cleanup() {
@@ -4306,26 +4523,26 @@ var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [rea
4306
4523
  }, input),
4307
4524
  manager
4308
4525
  );
4309
- __privateAdd$1(this, _handle, __runInitializers$1(_init3, 8, this)), __runInitializers$1(_init3, 11, this);
4310
- __privateAdd$1(this, _element$1, __runInitializers$1(_init3, 12, this)), __runInitializers$1(_init3, 15, this);
4311
- __privateAdd$1(this, _feedback, __runInitializers$1(_init3, 16, this)), __runInitializers$1(_init3, 19, this);
4526
+ __privateAdd$1(this, _handle, __runInitializers$1(_init4, 8, this)), __runInitializers$1(_init4, 11, this);
4527
+ __privateAdd$1(this, _element$1, __runInitializers$1(_init4, 12, this)), __runInitializers$1(_init4, 15, this);
4528
+ __privateAdd$1(this, _feedback, __runInitializers$1(_init4, 16, this)), __runInitializers$1(_init4, 19, this);
4312
4529
  this.element = element;
4313
4530
  this.handle = handle;
4314
4531
  this.feedback = feedback;
4315
4532
  }
4316
4533
  };
4317
- _init3 = __decoratorStart$1(_c);
4534
+ _init4 = __decoratorStart$1(_c);
4318
4535
  _handle = /* @__PURE__ */ new WeakMap();
4319
4536
  _element$1 = /* @__PURE__ */ new WeakMap();
4320
4537
  _feedback = /* @__PURE__ */ new WeakMap();
4321
- __decorateElement$1(_init3, 4, "handle", _handle_dec, Draggable$1, _handle);
4322
- __decorateElement$1(_init3, 4, "element", _element_dec, Draggable$1, _element$1);
4323
- __decorateElement$1(_init3, 4, "feedback", _feedback_dec, Draggable$1, _feedback);
4324
- __decoratorMetadata$1(_init3, Draggable$1);
4325
- var _proxy_dec, _element_dec2, _c2, _init4, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
4538
+ __decorateElement$1(_init4, 4, "handle", _handle_dec, Draggable$1, _handle);
4539
+ __decorateElement$1(_init4, 4, "element", _element_dec, Draggable$1, _element$1);
4540
+ __decorateElement$1(_init4, 4, "feedback", _feedback_dec, Draggable$1, _feedback);
4541
+ __decoratorMetadata$1(_init4, Draggable$1);
4542
+ var _proxy_dec, _element_dec2, _c2, _init5, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
4326
4543
  var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _proxy_dec = [reactive], _c2) {
4327
- constructor(_a3, manager) {
4328
- var _b2 = _a3, { element, effects: effects2 = () => [] } = _b2, input = __objRest$2(_b2, ["element", "effects"]);
4544
+ constructor(_a4, manager) {
4545
+ var _b2 = _a4, { element, effects: effects2 = () => [] } = _b2, input = __objRest$2(_b2, ["element", "effects"]);
4329
4546
  const { collisionDetector = defaultCollisionDetection } = input;
4330
4547
  const updateShape = (boundingClientRect) => {
4331
4548
  const { manager: manager2, element: element2 } = this;
@@ -4371,8 +4588,8 @@ var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _
4371
4588
  }
4372
4589
  },
4373
4590
  () => {
4374
- var _a4;
4375
- if ((_a4 = this.manager) == null ? void 0 : _a4.dragOperation.status.initialized) {
4591
+ var _a5;
4592
+ if ((_a5 = this.manager) == null ? void 0 : _a5.dragOperation.status.initialized) {
4376
4593
  return () => {
4377
4594
  this.shape = void 0;
4378
4595
  };
@@ -4383,8 +4600,8 @@ var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _
4383
4600
  manager
4384
4601
  );
4385
4602
  __privateAdd$1(this, _Droppable_instances);
4386
- __privateAdd$1(this, _element2, __runInitializers$1(_init4, 8, this)), __runInitializers$1(_init4, 11, this);
4387
- __privateAdd$1(this, _proxy, __runInitializers$1(_init4, 12, this)), __runInitializers$1(_init4, 15, this);
4603
+ __privateAdd$1(this, _element2, __runInitializers$1(_init5, 8, this)), __runInitializers$1(_init5, 11, this);
4604
+ __privateAdd$1(this, _proxy, __runInitializers$1(_init5, 12, this)), __runInitializers$1(_init5, 15, this);
4388
4605
  this.element = element;
4389
4606
  this.refreshShape = () => updateShape();
4390
4607
  }
@@ -4392,17 +4609,17 @@ var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _
4392
4609
  __privateSet$1(this, _Droppable_instances, element, element_set);
4393
4610
  }
4394
4611
  get element() {
4395
- var _a3;
4396
- return (_a3 = this.proxy) != null ? _a3 : __privateGet$1(this, _Droppable_instances, element_get);
4612
+ var _a4;
4613
+ return (_a4 = this.proxy) != null ? _a4 : __privateGet$1(this, _Droppable_instances, element_get);
4397
4614
  }
4398
4615
  };
4399
- _init4 = __decoratorStart$1(_c2);
4616
+ _init5 = __decoratorStart$1(_c2);
4400
4617
  _element2 = /* @__PURE__ */ new WeakMap();
4401
4618
  _Droppable_instances = /* @__PURE__ */ new WeakSet();
4402
4619
  _proxy = /* @__PURE__ */ new WeakMap();
4403
- _d = __decorateElement$1(_init4, 20, "#element", _element_dec2, _Droppable_instances, _element2), element_get = _d.get, element_set = _d.set;
4404
- __decorateElement$1(_init4, 4, "proxy", _proxy_dec, Droppable2, _proxy);
4405
- __decoratorMetadata$1(_init4, Droppable2);
4620
+ _d = __decorateElement$1(_init5, 20, "#element", _element_dec2, _Droppable_instances, _element2), element_get = _d.get, element_set = _d.set;
4621
+ __decorateElement$1(_init5, 4, "proxy", _proxy_dec, Droppable2, _proxy);
4622
+ __decoratorMetadata$1(_init5, Droppable2);
4406
4623
  var __create = Object.create;
4407
4624
  var __defProp$3 = Object.defineProperty;
4408
4625
  var __defProps$3 = Object.defineProperties;
@@ -4417,7 +4634,7 @@ var __typeError = (msg) => {
4417
4634
  };
4418
4635
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4419
4636
  var __spreadValues$3 = (a2, b2) => {
4420
- for (var prop in b2)
4637
+ for (var prop in b2 || (b2 = {}))
4421
4638
  if (__hasOwnProp$4.call(b2, prop))
4422
4639
  __defNormalProp$3(a2, prop, b2[prop]);
4423
4640
  if (__getOwnPropSymbols$4)
@@ -4441,8 +4658,8 @@ var __objRest$1 = (source, exclude) => {
4441
4658
  return target;
4442
4659
  };
4443
4660
  var __decoratorStart = (base) => {
4444
- var _a3;
4445
- return [, , , __create((_a3 = void 0) != null ? _a3 : null)];
4661
+ var _a4;
4662
+ return [, , , __create((_a4 = void 0) != null ? _a4 : null)];
4446
4663
  };
4447
4664
  var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
4448
4665
  var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
@@ -4506,11 +4723,11 @@ var SortableKeyboardPlugin = class extends Plugin {
4506
4723
  "dragmove",
4507
4724
  (event, manager2) => {
4508
4725
  queueMicrotask(() => {
4509
- if (this.disabled || event.defaultPrevented) {
4726
+ if (this.disabled || event.defaultPrevented || !event.nativeEvent) {
4510
4727
  return;
4511
4728
  }
4512
4729
  const { dragOperation } = manager2;
4513
- if (!isKeyboardEvent(dragOperation.activatorEvent)) {
4730
+ if (!isKeyboardEvent(event.nativeEvent)) {
4514
4731
  return;
4515
4732
  }
4516
4733
  if (!isSortable(dragOperation.source)) {
@@ -4560,10 +4777,9 @@ var SortableKeyboardPlugin = class extends Plugin {
4560
4777
  }
4561
4778
  const { id } = firstCollision;
4562
4779
  const { index, group } = source.sortable;
4563
- actions.setDropTarget(id).then((defaultPrevented) => {
4564
- if (defaultPrevented) return;
4565
- const { source: source2, target: target2 } = dragOperation;
4566
- if (!source2 || !isSortable(source2)) {
4780
+ actions.setDropTarget(id).then(() => {
4781
+ const { source: source2, target: target2, shape } = dragOperation;
4782
+ if (!source2 || !isSortable(source2) || !shape) {
4567
4783
  return;
4568
4784
  }
4569
4785
  const {
@@ -4575,15 +4791,17 @@ var SortableKeyboardPlugin = class extends Plugin {
4575
4791
  const element = updated ? targetElement : target2 == null ? void 0 : target2.element;
4576
4792
  if (!element) return;
4577
4793
  scrollIntoViewIfNeeded(element);
4578
- const shape = new DOMRectangle(element);
4579
- if (!shape) {
4794
+ const updatedShape = new DOMRectangle(element);
4795
+ if (!updatedShape) {
4580
4796
  return;
4581
4797
  }
4798
+ const delta = Rectangle.delta(
4799
+ updatedShape,
4800
+ Rectangle.from(shape.current.boundingRectangle),
4801
+ source2.alignment
4802
+ );
4582
4803
  actions.move({
4583
- to: {
4584
- x: shape.center.x,
4585
- y: shape.center.y
4586
- }
4804
+ by: delta
4587
4805
  });
4588
4806
  if (updated) {
4589
4807
  actions.setDropTarget(source2.id).then(() => collisionObserver.enable());
@@ -4620,7 +4838,7 @@ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
4620
4838
  var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
4621
4839
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4622
4840
  var __spreadValues2 = (a2, b2) => {
4623
- for (var prop in b2)
4841
+ for (var prop in b2 || (b2 = {}))
4624
4842
  if (__hasOwnProp2.call(b2, prop))
4625
4843
  __defNormalProp2(a2, prop, b2[prop]);
4626
4844
  if (__getOwnPropSymbols2)
@@ -4640,9 +4858,9 @@ function arrayMove$1(array, from, to) {
4640
4858
  return newArray;
4641
4859
  }
4642
4860
  function mutate$1(items, event, mutation) {
4643
- var _a3, _b2;
4861
+ var _a4, _b2;
4644
4862
  const { source, target, canceled } = event.operation;
4645
- if (!source || !target || canceled || source.id === target.id) {
4863
+ if (!source || !target || canceled) {
4646
4864
  if ("preventDefault" in event) event.preventDefault();
4647
4865
  return items;
4648
4866
  }
@@ -4685,7 +4903,7 @@ function mutate$1(items, event, mutation) {
4685
4903
  }
4686
4904
  if (!source.manager) return items;
4687
4905
  const { dragOperation } = source.manager;
4688
- const position = (_b2 = (_a3 = dragOperation.shape) == null ? void 0 : _a3.current.center) != null ? _b2 : dragOperation.position.current;
4906
+ const position = (_b2 = (_a4 = dragOperation.shape) == null ? void 0 : _a4.current.center) != null ? _b2 : dragOperation.position.current;
4689
4907
  if (targetParent == null) {
4690
4908
  if (target.id in items) {
4691
4909
  const insertionIndex = target.shape && position.y > target.shape.center.y ? items[target.id].length : 0;
@@ -4763,12 +4981,12 @@ var OptimisticSortingPlugin = class extends Plugin {
4763
4981
  const targetInstances = sameGroup ? sourceInstances : instances.get(target.sortable.group);
4764
4982
  if (!sourceInstances || !targetInstances) return;
4765
4983
  manager2.renderer.rendering.then(() => {
4766
- var _a3, _b2, _c3;
4984
+ var _a4, _b2, _c3;
4767
4985
  const newInstances = getSortableInstances();
4768
4986
  for (const [group, sortableInstances] of instances.entries()) {
4769
4987
  const entries = Array.from(sortableInstances).entries();
4770
4988
  for (const [index, sortable] of entries) {
4771
- if (sortable.index !== index || sortable.group !== group || !((_a3 = newInstances.get(group)) == null ? void 0 : _a3.has(sortable))) {
4989
+ if (sortable.index !== index || sortable.group !== group || !((_a4 = newInstances.get(group)) == null ? void 0 : _a4.has(sortable))) {
4772
4990
  return;
4773
4991
  }
4774
4992
  }
@@ -4829,7 +5047,7 @@ var OptimisticSortingPlugin = class extends Plugin {
4829
5047
  );
4830
5048
  if (!initialGroupInstances) return;
4831
5049
  manager2.renderer.rendering.then(() => {
4832
- var _a3;
5050
+ var _a4;
4833
5051
  for (const [group, sortableInstances] of instances.entries()) {
4834
5052
  const entries = Array.from(sortableInstances).entries();
4835
5053
  for (const [index, sortable] of entries) {
@@ -4840,7 +5058,7 @@ var OptimisticSortingPlugin = class extends Plugin {
4840
5058
  }
4841
5059
  const initialGroup = sort(initialGroupInstances);
4842
5060
  const sourceElement = source.sortable.element;
4843
- const targetElement = (_a3 = initialGroup[source.sortable.initialIndex]) == null ? void 0 : _a3.element;
5061
+ const targetElement = (_a4 = initialGroup[source.sortable.initialIndex]) == null ? void 0 : _a4.element;
4844
5062
  if (!targetElement || !sourceElement) {
4845
5063
  return;
4846
5064
  }
@@ -4892,22 +5110,22 @@ var defaultSortableTransition = {
4892
5110
  var _group_dec, _index_dec, _init, _index, _group, _element;
4893
5111
  _index_dec = [reactive], _group_dec = [reactive];
4894
5112
  var Sortable2 = class {
4895
- constructor(_a3, manager) {
5113
+ constructor(_a4, manager) {
4896
5114
  __privateAdd(this, _index, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
4897
5115
  __privateAdd(this, _group, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
4898
5116
  __privateAdd(this, _element);
4899
5117
  this.register = () => {
4900
5118
  r(() => {
4901
- var _a4, _b3;
4902
- (_a4 = this.manager) == null ? void 0 : _a4.registry.register(this.droppable);
5119
+ var _a5, _b3;
5120
+ (_a5 = this.manager) == null ? void 0 : _a5.registry.register(this.droppable);
4903
5121
  (_b3 = this.manager) == null ? void 0 : _b3.registry.register(this.draggable);
4904
5122
  });
4905
5123
  return () => this.unregister();
4906
5124
  };
4907
5125
  this.unregister = () => {
4908
5126
  r(() => {
4909
- var _a4, _b3;
4910
- (_a4 = this.manager) == null ? void 0 : _a4.registry.unregister(this.droppable);
5127
+ var _a5, _b3;
5128
+ (_a5 = this.manager) == null ? void 0 : _a5.registry.unregister(this.droppable);
4911
5129
  (_b3 = this.manager) == null ? void 0 : _b3.registry.unregister(this.draggable);
4912
5130
  });
4913
5131
  };
@@ -4917,7 +5135,7 @@ var Sortable2 = class {
4917
5135
  this.draggable.destroy();
4918
5136
  });
4919
5137
  };
4920
- var _b2 = _a3, {
5138
+ var _b2 = _a4, {
4921
5139
  effects: inputEffects = () => [],
4922
5140
  group,
4923
5141
  index,
@@ -4976,6 +5194,7 @@ var Sortable2 = class {
4976
5194
  manager,
4977
5195
  this
4978
5196
  );
5197
+ __privateSet(this, _element, input.element);
4979
5198
  this.manager = manager;
4980
5199
  this.index = index;
4981
5200
  this.previousIndex = index;
@@ -5055,10 +5274,10 @@ var Sortable2 = class {
5055
5274
  });
5056
5275
  }
5057
5276
  get element() {
5058
- var _a3, _b2;
5277
+ var _a4, _b2;
5059
5278
  const element = __privateGet(this, _element);
5060
5279
  if (!element) return;
5061
- return (_b2 = (_a3 = ProxiedElements.get(element)) != null ? _a3 : element) != null ? _b2 : this.droppable.element;
5280
+ return (_b2 = (_a4 = ProxiedElements.get(element)) != null ? _a4 : element) != null ? _b2 : this.droppable.element;
5062
5281
  }
5063
5282
  set target(target) {
5064
5283
  this.droppable.element = target;
@@ -5105,12 +5324,21 @@ var Sortable2 = class {
5105
5324
  set sensors(value) {
5106
5325
  this.draggable.sensors = value;
5107
5326
  }
5327
+ set modifiers(value) {
5328
+ this.draggable.modifiers = value;
5329
+ }
5108
5330
  set collisionPriority(value) {
5109
5331
  this.droppable.collisionPriority = value;
5110
5332
  }
5111
5333
  set collisionDetector(value) {
5112
5334
  this.droppable.collisionDetector = value != null ? value : defaultCollisionDetection;
5113
5335
  }
5336
+ set alignment(value) {
5337
+ this.draggable.alignment = value;
5338
+ }
5339
+ get alignment() {
5340
+ return this.draggable.alignment;
5341
+ }
5114
5342
  set type(type) {
5115
5343
  r(() => {
5116
5344
  this.droppable.type = type;
@@ -5135,6 +5363,18 @@ var Sortable2 = class {
5135
5363
  get isDragSource() {
5136
5364
  return this.draggable.isDragSource;
5137
5365
  }
5366
+ /**
5367
+ * A boolean indicating whether the sortable item is being dragged.
5368
+ */
5369
+ get isDragging() {
5370
+ return this.draggable.isDragging;
5371
+ }
5372
+ /**
5373
+ * A boolean indicating whether the sortable item is being dropped.
5374
+ */
5375
+ get isDropping() {
5376
+ return this.draggable.isDropping;
5377
+ }
5138
5378
  get status() {
5139
5379
  return this.draggable.status;
5140
5380
  }
@@ -5157,6 +5397,9 @@ var SortableDraggable = class extends Draggable$1 {
5157
5397
  super(input, manager);
5158
5398
  this.sortable = sortable;
5159
5399
  }
5400
+ get index() {
5401
+ return this.sortable.index;
5402
+ }
5160
5403
  };
5161
5404
  var SortableDroppable = class extends Droppable2 {
5162
5405
  constructor(input, manager, sortable) {
@@ -5164,6 +5407,19 @@ var SortableDroppable = class extends Droppable2 {
5164
5407
  this.sortable = sortable;
5165
5408
  }
5166
5409
  };
5410
+ function isRef(value) {
5411
+ return value != null && typeof value === "object" && "current" in value;
5412
+ }
5413
+ function currentValue(value) {
5414
+ var _a4;
5415
+ if (value == null) {
5416
+ return void 0;
5417
+ }
5418
+ if (isRef(value)) {
5419
+ return (_a4 = value.current) != null ? _a4 : void 0;
5420
+ }
5421
+ return value;
5422
+ }
5167
5423
  function useConstant(initializer) {
5168
5424
  const ref = useRef(null);
5169
5425
  if (!ref.current) {
@@ -5173,36 +5429,48 @@ function useConstant(initializer) {
5173
5429
  }
5174
5430
  var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
5175
5431
  var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
5176
- function useSignal(signal, sync = false) {
5177
- let val = signal.peek();
5178
- const read = useRef(false);
5179
- const update = useState(val)[1];
5180
- useIsomorphicLayoutEffect(
5181
- () => E(() => {
5182
- if (val !== (val = signal.value)) {
5183
- if (!read.current) return;
5184
- if (sync) {
5185
- reactDomExports.flushSync(() => update(val));
5186
- } else {
5187
- update(val);
5432
+ function useForceUpdate() {
5433
+ const setState = useState(0)[1];
5434
+ return useCallback(() => {
5435
+ setState((value) => value + 1);
5436
+ }, [setState]);
5437
+ }
5438
+ function useDeepSignal(target, synchronous) {
5439
+ const tracked = useRef(/* @__PURE__ */ new Map());
5440
+ const forceUpdate = useForceUpdate();
5441
+ useIsomorphicLayoutEffect(() => {
5442
+ if (!target) {
5443
+ tracked.current.clear();
5444
+ return;
5445
+ }
5446
+ return E(() => {
5447
+ var _a4;
5448
+ let stale = false;
5449
+ let sync = false;
5450
+ for (const entry of tracked.current) {
5451
+ const [key] = entry;
5452
+ const value = n(() => entry[1]);
5453
+ const latestValue = target[key];
5454
+ if (value !== latestValue) {
5455
+ stale = true;
5456
+ tracked.current.set(key, latestValue);
5457
+ sync = (_a4 = synchronous == null ? void 0 : synchronous(key, value, latestValue)) != null ? _a4 : false;
5188
5458
  }
5189
5459
  }
5190
- }),
5191
- [signal, sync]
5192
- );
5193
- return {
5194
- get value() {
5195
- read.current = true;
5196
- return signal.value;
5197
- }
5198
- };
5199
- }
5200
- function useComputed(compute, dependencies = [], sync = false) {
5201
- const $compute = useRef(compute);
5202
- $compute.current = compute;
5203
- return useSignal(
5204
- useMemo(() => computed(() => $compute.current()), dependencies),
5205
- sync
5460
+ if (stale) {
5461
+ sync ? reactDomExports.flushSync(forceUpdate) : forceUpdate();
5462
+ }
5463
+ });
5464
+ }, [target]);
5465
+ return useMemo(
5466
+ () => target ? new Proxy(target, {
5467
+ get(target2, key) {
5468
+ const value = target2[key];
5469
+ tracked.current.set(key, value);
5470
+ return value;
5471
+ }
5472
+ }) : target,
5473
+ [target]
5206
5474
  );
5207
5475
  }
5208
5476
  function useImmediateEffect(callback, _2) {
@@ -5215,9 +5483,9 @@ function useLatest(value) {
5215
5483
  }, [value]);
5216
5484
  return valueRef;
5217
5485
  }
5218
- function useOnValueChange(value, onChange, effect2 = useEffect, compare = Object.is) {
5486
+ function useOnValueChange(value, onChange, effect3 = useEffect, compare = Object.is) {
5219
5487
  const tracked = useRef(value);
5220
- effect2(() => {
5488
+ effect3(() => {
5221
5489
  const oldValue = tracked.current;
5222
5490
  if (!compare(value, oldValue)) {
5223
5491
  tracked.current = value;
@@ -5225,15 +5493,15 @@ function useOnValueChange(value, onChange, effect2 = useEffect, compare = Object
5225
5493
  }
5226
5494
  }, [onChange, value]);
5227
5495
  }
5228
- function currentValue(value) {
5229
- var _a3;
5230
- if (value == null) {
5231
- return void 0;
5232
- }
5233
- if (typeof value === "object" && "current" in value) {
5234
- return (_a3 = value.current) != null ? _a3 : void 0;
5235
- }
5236
- return value;
5496
+ function useOnElementChange(value, onChange) {
5497
+ const previous = useRef(currentValue(value));
5498
+ useIsomorphicLayoutEffect(() => {
5499
+ const current = currentValue(value);
5500
+ if (current !== previous.current) {
5501
+ previous.current = current;
5502
+ onChange(current);
5503
+ }
5504
+ });
5237
5505
  }
5238
5506
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
5239
5507
  var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
@@ -5261,15 +5529,15 @@ function useRenderer() {
5261
5529
  const resolver = useRef(null);
5262
5530
  const renderer = useConstant(() => ({
5263
5531
  get rendering() {
5264
- var _a3;
5265
- return (_a3 = rendering.current) != null ? _a3 : Promise.resolve();
5532
+ var _a4;
5533
+ return (_a4 = rendering.current) != null ? _a4 : Promise.resolve();
5266
5534
  }
5267
5535
  }));
5268
5536
  useOnValueChange(
5269
5537
  transitionCount,
5270
5538
  () => {
5271
- var _a3;
5272
- (_a3 = resolver.current) == null ? void 0 : _a3.call(resolver);
5539
+ var _a4;
5540
+ (_a4 = resolver.current) == null ? void 0 : _a4.call(resolver);
5273
5541
  rendering.current = null;
5274
5542
  },
5275
5543
  useLayoutEffect
@@ -5289,8 +5557,9 @@ function useRenderer() {
5289
5557
  }
5290
5558
  };
5291
5559
  }
5292
- function DragDropProvider(_a3) {
5293
- var _b2 = _a3, {
5560
+ var options = [void 0, deepEqual];
5561
+ function DragDropProvider(_a4) {
5562
+ var _b2 = _a4, {
5294
5563
  children,
5295
5564
  onCollision,
5296
5565
  onBeforeDragStart,
@@ -5332,8 +5601,8 @@ function DragDropProvider(_a3) {
5332
5601
  manager2.monitor.addEventListener(
5333
5602
  "dragstart",
5334
5603
  (event, manager3) => {
5335
- var _a4;
5336
- return (_a4 = handleDragStart.current) == null ? void 0 : _a4.call(handleDragStart, event, manager3);
5604
+ var _a42;
5605
+ return (_a42 = handleDragStart.current) == null ? void 0 : _a42.call(handleDragStart, event, manager3);
5337
5606
  }
5338
5607
  );
5339
5608
  manager2.monitor.addEventListener("dragover", (event, manager3) => {
@@ -5357,8 +5626,8 @@ function DragDropProvider(_a3) {
5357
5626
  manager2.monitor.addEventListener(
5358
5627
  "collision",
5359
5628
  (event, manager3) => {
5360
- var _a4;
5361
- return (_a4 = handleCollision.current) == null ? void 0 : _a4.call(handleCollision, event, manager3);
5629
+ var _a42;
5630
+ return (_a42 = handleCollision.current) == null ? void 0 : _a42.call(handleCollision, event, manager3);
5362
5631
  }
5363
5632
  );
5364
5633
  startTransition(() => setManager(manager2));
@@ -5366,15 +5635,18 @@ function DragDropProvider(_a3) {
5366
5635
  }, [renderer, input.manager]);
5367
5636
  useOnValueChange(
5368
5637
  plugins,
5369
- () => manager && (manager.plugins = plugins != null ? plugins : defaultPreset.plugins)
5638
+ () => manager && (manager.plugins = plugins != null ? plugins : defaultPreset.plugins),
5639
+ ...options
5370
5640
  );
5371
5641
  useOnValueChange(
5372
5642
  sensors,
5373
- () => manager && (manager.sensors = sensors != null ? sensors : defaultPreset.sensors)
5643
+ () => manager && (manager.sensors = sensors != null ? sensors : defaultPreset.sensors),
5644
+ ...options
5374
5645
  );
5375
5646
  useOnValueChange(
5376
5647
  modifiers,
5377
- () => manager && (manager.modifiers = modifiers != null ? modifiers : [])
5648
+ () => manager && (manager.modifiers = modifiers != null ? modifiers : defaultPreset.modifiers),
5649
+ ...options
5378
5650
  );
5379
5651
  return /* @__PURE__ */ jsx(DragDropContext.Provider, { value: manager, children });
5380
5652
  }
@@ -5382,9 +5654,9 @@ function useDragDropManager() {
5382
5654
  return useContext(DragDropContext);
5383
5655
  }
5384
5656
  function useInstance(initializer) {
5385
- var _a3;
5386
- const manager = (_a3 = useDragDropManager()) != null ? _a3 : void 0;
5387
- const [instance] = useState(() => initializer(void 0));
5657
+ var _a4;
5658
+ const manager = (_a4 = useDragDropManager()) != null ? _a4 : void 0;
5659
+ const [instance] = useState(() => initializer(manager));
5388
5660
  if (instance.manager !== manager) {
5389
5661
  instance.manager = manager;
5390
5662
  }
@@ -5399,7 +5671,7 @@ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
5399
5671
  var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
5400
5672
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5401
5673
  var __spreadValues$2 = (a2, b2) => {
5402
- for (var prop in b2)
5674
+ for (var prop in b2 || (b2 = {}))
5403
5675
  if (__hasOwnProp$2.call(b2, prop))
5404
5676
  __defNormalProp$2(a2, prop, b2[prop]);
5405
5677
  if (__getOwnPropSymbols$2)
@@ -5417,31 +5689,32 @@ function useSortable(input) {
5417
5689
  collisionPriority,
5418
5690
  id,
5419
5691
  data,
5692
+ element,
5693
+ handle,
5420
5694
  index,
5421
5695
  group,
5422
5696
  disabled,
5423
5697
  feedback,
5698
+ modifiers,
5424
5699
  sensors,
5425
- transition = defaultSortableTransition,
5700
+ target,
5426
5701
  type
5427
5702
  } = input;
5428
- const handle = currentValue(input.handle);
5429
- const element = currentValue(input.element);
5430
- const target = currentValue(input.target);
5703
+ const transition = __spreadValues$2(__spreadValues$2({}, defaultSortableTransition), input.transition);
5431
5704
  const sortable = useInstance((manager) => {
5432
5705
  return new Sortable2(
5433
5706
  __spreadProps$2(__spreadValues$2({}, input), {
5434
- handle,
5435
- element,
5436
- target,
5707
+ transition,
5708
+ register: false,
5709
+ handle: currentValue(handle),
5710
+ element: currentValue(element),
5711
+ target: currentValue(target),
5437
5712
  feedback
5438
5713
  }),
5439
5714
  manager
5440
5715
  );
5441
5716
  });
5442
- const isDropTarget = useComputed(() => sortable.isDropTarget, [sortable]);
5443
- const isDragSource = useComputed(() => sortable.isDragSource, [sortable]);
5444
- const status = useComputed(() => sortable.status, [sortable]);
5717
+ const trackedSortable = useDeepSignal(sortable, shouldUpdateSynchronously);
5445
5718
  useOnValueChange(id, () => sortable.id = id);
5446
5719
  useIsomorphicLayoutEffect(() => {
5447
5720
  r(() => {
@@ -5460,16 +5733,16 @@ function useSortable(input) {
5460
5733
  useOnValueChange(
5461
5734
  index,
5462
5735
  () => {
5463
- var _a3;
5464
- if (((_a3 = sortable.manager) == null ? void 0 : _a3.dragOperation.status.idle) && (transition == null ? void 0 : transition.idle)) {
5736
+ var _a4;
5737
+ if (((_a4 = sortable.manager) == null ? void 0 : _a4.dragOperation.status.idle) && (transition == null ? void 0 : transition.idle)) {
5465
5738
  sortable.refreshShape();
5466
5739
  }
5467
5740
  },
5468
5741
  useImmediateEffect
5469
5742
  );
5470
- useOnValueChange(handle, () => sortable.handle = handle);
5471
- useOnValueChange(element, () => sortable.element = element);
5472
- useOnValueChange(target, () => sortable.target = target);
5743
+ useOnElementChange(handle, (handle2) => sortable.handle = handle2);
5744
+ useOnElementChange(element, (element2) => sortable.element = element2);
5745
+ useOnElementChange(target, (target2) => sortable.target = target2);
5473
5746
  useOnValueChange(disabled, () => sortable.disabled = disabled === true);
5474
5747
  useOnValueChange(sensors, () => sortable.sensors = sensors);
5475
5748
  useOnValueChange(
@@ -5481,16 +5754,35 @@ function useSortable(input) {
5481
5754
  () => sortable.collisionPriority = collisionPriority
5482
5755
  );
5483
5756
  useOnValueChange(feedback, () => sortable.feedback = feedback != null ? feedback : "default");
5484
- useOnValueChange(transition, () => sortable.transition = transition);
5757
+ useOnValueChange(
5758
+ transition,
5759
+ () => sortable.transition = transition,
5760
+ void 0,
5761
+ deepEqual
5762
+ );
5763
+ useOnValueChange(
5764
+ modifiers,
5765
+ () => sortable.modifiers = modifiers,
5766
+ void 0,
5767
+ deepEqual
5768
+ );
5769
+ useOnValueChange(
5770
+ input.alignment,
5771
+ () => sortable.alignment = input.alignment
5772
+ );
5485
5773
  return {
5774
+ sortable: trackedSortable,
5775
+ get isDragging() {
5776
+ return trackedSortable.isDragging;
5777
+ },
5778
+ get isDropping() {
5779
+ return trackedSortable.isDropping;
5780
+ },
5486
5781
  get isDragSource() {
5487
- return isDragSource.value;
5782
+ return trackedSortable.isDragSource;
5488
5783
  },
5489
5784
  get isDropTarget() {
5490
- return isDropTarget.value;
5491
- },
5492
- get status() {
5493
- return status.value;
5785
+ return trackedSortable.isDropTarget;
5494
5786
  },
5495
5787
  handleRef: useCallback(
5496
5788
  (element2) => {
@@ -5500,8 +5792,8 @@ function useSortable(input) {
5500
5792
  ),
5501
5793
  ref: useCallback(
5502
5794
  (element2) => {
5503
- var _a3, _b2;
5504
- if (!element2 && ((_a3 = sortable.element) == null ? void 0 : _a3.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5795
+ var _a4, _b2;
5796
+ if (!element2 && ((_a4 = sortable.element) == null ? void 0 : _a4.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5505
5797
  return;
5506
5798
  }
5507
5799
  sortable.element = element2 != null ? element2 : void 0;
@@ -5510,8 +5802,8 @@ function useSortable(input) {
5510
5802
  ),
5511
5803
  sourceRef: useCallback(
5512
5804
  (element2) => {
5513
- var _a3, _b2;
5514
- if (!element2 && ((_a3 = sortable.source) == null ? void 0 : _a3.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5805
+ var _a4, _b2;
5806
+ if (!element2 && ((_a4 = sortable.source) == null ? void 0 : _a4.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5515
5807
  return;
5516
5808
  }
5517
5809
  sortable.source = element2 != null ? element2 : void 0;
@@ -5520,8 +5812,8 @@ function useSortable(input) {
5520
5812
  ),
5521
5813
  targetRef: useCallback(
5522
5814
  (element2) => {
5523
- var _a3, _b2;
5524
- if (!element2 && ((_a3 = sortable.target) == null ? void 0 : _a3.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5815
+ var _a4, _b2;
5816
+ if (!element2 && ((_a4 = sortable.target) == null ? void 0 : _a4.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5525
5817
  return;
5526
5818
  }
5527
5819
  sortable.target = element2 != null ? element2 : void 0;
@@ -5530,6 +5822,10 @@ function useSortable(input) {
5530
5822
  )
5531
5823
  };
5532
5824
  }
5825
+ function shouldUpdateSynchronously(key, oldValue, newValue) {
5826
+ if (key === "isDragSource" && !newValue && oldValue) return true;
5827
+ return false;
5828
+ }
5533
5829
  var __defProp$1 = Object.defineProperty;
5534
5830
  var __defProps$1 = Object.defineProperties;
5535
5831
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -5586,8 +5882,8 @@ function restrictShapeToBoundingRectangle(shape, transform, boundingRect) {
5586
5882
  }
5587
5883
  var _SnapModifier = class _SnapModifier2 extends Modifier {
5588
5884
  apply({ transform }) {
5589
- var _a3;
5590
- const { size = 20 } = (_a3 = this.options) != null ? _a3 : {};
5885
+ var _a4;
5886
+ const { size = 20 } = (_a4 = this.options) != null ? _a4 : {};
5591
5887
  const x = typeof size === "number" ? size : size.x;
5592
5888
  const y2 = typeof size === "number" ? size : size.y;
5593
5889
  return __spreadProps$1(__spreadValues$1({}, transform), {
@@ -5598,8 +5894,8 @@ var _SnapModifier = class _SnapModifier2 extends Modifier {
5598
5894
  };
5599
5895
  _SnapModifier.configure = configurator(_SnapModifier);
5600
5896
  var _RestrictToElement = class _RestrictToElement2 extends Modifier {
5601
- constructor(manager, options) {
5602
- super(manager, options);
5897
+ constructor(manager, options2) {
5898
+ super(manager, options2);
5603
5899
  this.boundingRectangle = d(null);
5604
5900
  this.destroy = E(() => {
5605
5901
  if (!this.options) {
@@ -5693,9 +5989,9 @@ function arrayMove(array, from, to) {
5693
5989
  return newArray;
5694
5990
  }
5695
5991
  function mutate(items, event, mutation) {
5696
- var _a3, _b2;
5992
+ var _a4, _b2;
5697
5993
  const { source, target, canceled } = event.operation;
5698
- if (!source || !target || canceled || source.id === target.id) {
5994
+ if (!source || !target || canceled) {
5699
5995
  if ("preventDefault" in event) event.preventDefault();
5700
5996
  return items;
5701
5997
  }
@@ -5738,7 +6034,7 @@ function mutate(items, event, mutation) {
5738
6034
  }
5739
6035
  if (!source.manager) return items;
5740
6036
  const { dragOperation } = source.manager;
5741
- const position = (_b2 = (_a3 = dragOperation.shape) == null ? void 0 : _a3.current.center) != null ? _b2 : dragOperation.position.current;
6037
+ const position = (_b2 = (_a4 = dragOperation.shape) == null ? void 0 : _a4.current.center) != null ? _b2 : dragOperation.position.current;
5742
6038
  if (targetParent == null) {
5743
6039
  if (target.id in items) {
5744
6040
  const insertionIndex = target.shape && position.y > target.shape.center.y ? items[target.id].length : 0;