From 4c279eec5790dddf31322ab026f5668190ea59ce Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 11 Jan 2024 18:11:21 +1300 Subject: [PATCH] ENH MutliLinkField sorting --- client/dist/js/bundle.js | 6519 ++++++++++++++++- client/dist/styles/bundle.css | 175 +- client/lang/en.js | 4 +- client/lang/src/en.json | 4 +- client/src/components/LinkField/LinkField.js | 60 +- .../src/components/LinkPicker/LinkPicker.scss | 19 +- .../components/LinkPicker/LinkPickerTitle.js | 45 +- package.json | 13 +- src/Controllers/LinkFieldController.php | 63 +- src/Models/Link.php | 3 + yarn.lock | 224 +- 11 files changed, 6927 insertions(+), 202 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index e9cac687..d5ccb2c2 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1,6518 @@ -!function(){"use strict";var e={274:function(e,t,n){var r,l=(r=n(521))&&r.__esModule?r:{default:r};document.addEventListener("DOMContentLoaded",(()=>{(0,l.default)()}))},521:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(648)),l=u(n(809)),a=u(n(852)),o=u(n(117)),i=u(n(606));function u(e){return e&&e.__esModule?e:{default:e}}var s=()=>{r.default.component.registerMany({LinkPicker:l.default,LinkField:a.default,"LinkModal.FormBuilderModal":o.default,"LinkModal.InsertMediaModal":i.default})};t.default=s},852:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.LinkFieldContext=t.Component=void 0;var r=O(n(363)),l=n(827),a=n(624),o=(n(648),m(n(42))),i=m(n(809)),u=m(n(734)),s=m(n(264)),d=(m(n(686)),m(n(697))),c=O(n(123)),f=m(n(159)),p=m(n(510)),y=m(n(86)),v=m(n(754)),_=m(n(872)),k=m(n(902));function m(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}function O(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=l?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}const g=(0,r.createContext)(null);t.LinkFieldContext=g;const b="SilverStripe\\LinkField\\Controllers\\LinkFieldController",C=e=>{var t;let{value:n=null,onChange:l,types:a=[],actions:o,isMulti:c=!1,canCreate:y,ownerID:m,ownerClass:h,ownerRelation:O}=e;const[C,E]=(0,r.useState)({}),[M,R]=(0,r.useState)(0),[w,D]=(0,r.useState)(!1);let j=n;Array.isArray(j)||("number"==typeof j&&0!=j&&(j=[j]),j||(j=[])),(0,r.useEffect)((()=>{if(!M&&j.length>0){D(!0);const e=[];for(const t of j)e.push(`itemIDs[]=${t}`);const t=`${p.default.getSection(b).form.linkForm.dataUrl}?${e.join("&")}`;f.default.get(t).then((e=>e.json())).then((e=>{E(e),D(!1)})).catch((()=>{o.toasts.error(v.default._t("LinkField.FAILED_TO_LOAD_LINKS","Failed to load links")),D(!1)}))}}),[M,n&&n.length]);const I=()=>{R(0)},L=e=>{R(0);const t=[...j];t.includes(e)||t.push(e),l(c?t:t[0]),o.toasts.success(v.default._t("LinkField.SAVE_SUCCESS","Saved link"))},S=e=>{var t;let n=`${p.default.getSection(b).form.linkForm.deleteUrl}/${e}`;const r=_.default.parse(n),a=k.default.parse(r.query);a.ownerID=m,a.ownerClass=h,a.ownerRelation=O,n=_.default.format({...r,search:k.default.stringify(a)});const i=(null===(t=C[e])||void 0===t?void 0:t.versionState)||"",u=["draft","modified","published"].includes(i),s=u?v.default._t("LinkField.ARCHIVE_SUCCESS","Archived link"):v.default._t("LinkField.DELETE_SUCCESS","Deleted link"),d=u?v.default._t("LinkField.ARCHIVE_ERROR","Failed to archive link"):v.default._t("LinkField.DELETE_ERROR","Failed to delete link");f.default.delete(n,{},{"X-SecurityID":p.default.get("SecurityID")}).then((()=>o.toasts.success(s))).catch((()=>o.toasts.error(d)));const y={...C};delete y[e],E(y),l(c?Object.keys(y):0)},F=0===m,P=!F&&(c||0===Object.keys(C).length),T=!F&&Boolean(M),q=v.default._t("LinkField.SAVE_RECORD_FIRST","Cannot add links until the record has been saved");return w&&!F?r.default.createElement("div",{className:"link-field__loading"},r.default.createElement(s.default,null)):r.default.createElement(g.Provider,{value:{ownerID:m,ownerClass:h,ownerRelation:O,actions:o}},F&&r.default.createElement("div",{className:"link-field__save-record-first"},q),P&&r.default.createElement(i.default,{onModalSuccess:L,onModalClosed:I,types:a,canCreate:y}),r.default.createElement("div",null," ",(()=>{const e=[];for(const d of j){var t,n,l,o,i,s;if(!C[d])continue;const c=a.hasOwnProperty(null===(t=C[d])||void 0===t?void 0:t.typeKey)?a[null===(n=C[d])||void 0===n?void 0:n.typeKey]:{};e.push(r.default.createElement(u.default,{key:d,id:d,title:null===(l=C[d])||void 0===l?void 0:l.Title,description:null===(o=C[d])||void 0===o?void 0:o.description,versionState:null===(i=C[d])||void 0===i?void 0:i.versionState,typeTitle:c.title||"",onDelete:S,onClick:()=>{R(d)},canDelete:!(null===(s=C[d])||void 0===s||!s.canDelete)}))}return e})()," "),T&&r.default.createElement(d.default,{types:a,typeKey:null===(t=C[M])||void 0===t?void 0:t.typeKey,isOpen:Boolean(M),onSuccess:L,onClosed:I,linkID:M}))};t.Component=C,C.propTypes={value:y.default.oneOfType([y.default.arrayOf(y.default.number),y.default.number]),onChange:y.default.func.isRequired,types:y.default.array.isRequired,actions:y.default.object.isRequired,isMulti:y.default.bool,canCreate:y.default.bool.isRequired,ownerID:y.default.number.isRequired,ownerClass:y.default.string.isRequired,ownerRelation:y.default.string.isRequired};var E=(0,l.compose)(o.default,(0,a.connect)(null,(e=>({actions:{toasts:(0,l.bindActionCreators)(c,e)}}))))(C);t.default=E},606:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;s(n(754));var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=l?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(363)),l=s(n(475)),a=n(624),o=s(n(686)),i=s(n(86));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function s(e){return e&&e.__esModule?e:{default:e}}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{type:t,editing:n,data:a,actions:o,onSubmit:i,...u}=e;if(!t)return!1;(0,r.useEffect)((()=>{n?o.initModal():o.reset()}),[n]);const s=a?{ID:a.FileID,Description:a.Title,TargetBlank:!!a.OpenInNew}:{};return r.default.createElement(l.default,d({isOpen:n,type:"insert-link",title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:s,onInsert:e=>{let{ID:n,Description:r,TargetBlank:l}=e;return i({FileID:n,Title:r,OpenInNew:l,typeKey:t.key},"",(()=>{}))}},u))};c.propTypes={type:o.default.isRequired,editing:i.default.bool.isRequired,data:i.default.object.isRequired,actions:i.default.object.isRequired,onClick:i.default.func.isRequired};var f=(0,a.connect)((function(){return{}}),(function(e){return{actions:{initModal:()=>e({type:"INIT_FORM_SCHEMA_STACK",payload:{formSchema:{type:"insert-link",nextType:"admin"}}}),reset:()=>e({type:"RESET"})}}}))(c);t.default=f},117:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=l?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(363)),l=d(n(912)),a=n(852),o=d(n(872)),i=d(n(902)),u=d(n(510)),s=d(n(86));function d(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}const f=(e,t)=>{const{schemaUrl:n}=u.default.getSection("SilverStripe\\LinkField\\Controllers\\LinkFieldController").form.linkForm,l=o.default.parse(n),s=i.default.parse(l.query);s.typeKey=e;const{ownerID:d,ownerClass:c,ownerRelation:f}=(0,r.useContext)(a.LinkFieldContext);s.ownerID=d,s.ownerClass=c,s.ownerRelation=f;for(const e of["href","path","pathname"])l[e]=`${l[e]}/${t}`;return o.default.format({...l,search:i.default.stringify(s)})},p=e=>{let{typeTitle:t,typeKey:n,linkID:o=0,isOpen:i,onSuccess:u,onClosed:s}=e;const{actions:d}=(0,r.useContext)(a.LinkFieldContext);if(!n)return!1;return r.default.createElement(l.default,{title:t,isOpen:i,schemaUrl:f(n,o),identifier:"Link.EditingLinkInfo",onSubmit:async(e,t,n)=>{let r=null;try{r=await n()}catch(e){return d.toasts.error(i18n._t("LinkField.FAILED_TO_SAVE_LINK","Failed to save link")),Promise.resolve()}if(!r.id.match(/\/schema\/linkfield\/([0-9]+)/)){const e=r.id.match(/\/linkForm\/([0-9]+)/),t=parseInt(e[1],10);u(t)}return Promise.resolve()},onClosed:s})};p.propTypes={typeTitle:s.default.string.isRequired,typeKey:s.default.string.isRequired,linkID:s.default.number,isOpen:s.default.bool.isRequired,onSuccess:s.default.func.isRequired,onClosed:s.default.func.isRequired};var y=p;t.default=y},809:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(754)),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=l?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(363)),a=d(n(86)),o=d(n(820)),i=d(n(97)),u=(d(n(686)),d(n(697)));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}const c=e=>{let{types:t,onModalSuccess:n,onModalClosed:a,canCreate:s}=e;const[d,c]=(0,l.useState)(""),f=""!==d,p=(0,o.default)("link-picker","form-control"),y=Object.values(t);return s?l.default.createElement("div",{className:p},l.default.createElement(i.default,{types:y,onSelect:e=>{c(e)}}),f&&l.default.createElement(u.default,{types:t,typeKey:d,isOpen:f,onSuccess:e=>{c(""),n(e)},onClosed:()=>{"function"==typeof a&&a(),c("")}})):l.default.createElement("div",{className:p},l.default.createElement("div",{className:"link-picker__cannot-create"},r.default._t("LinkField.CANNOT_CREATE_LINK","Cannot create link")))};t.Component=c,c.propTypes={types:a.default.array.isRequired,onModalSuccess:a.default.func.isRequired,onModalClosed:a.default.func,canCreate:a.default.bool.isRequired};var f=c;t.default=f},97:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(754)),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=l?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(363)),a=s(n(86)),o=n(127),i=s(n(686));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function s(e){return e&&e.__esModule?e:{default:e}}const d=e=>{let{types:t,onSelect:n}=e;const[a,i]=(0,l.useState)(!1);return l.default.createElement(o.Dropdown,{isOpen:a,toggle:()=>i((e=>!e)),className:"link-picker__menu"},l.default.createElement(o.DropdownToggle,{className:"link-picker__menu-toggle font-icon-plus-1",caret:!0},r.default._t("LinkField.ADD_LINK","Add Link")),l.default.createElement(o.DropdownMenu,null,t.map((e=>{let{key:t,title:r}=e;return l.default.createElement(o.DropdownItem,{key:t,onClick:()=>n(t)},r)}))))};d.propTypes={types:a.default.arrayOf(i.default).isRequired,onSelect:a.default.func.isRequired};var c=d;t.default=c},734:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(820)),l=u(n(754)),a=u(n(363)),o=u(n(86)),i=n(127);function u(e){return e&&e.__esModule?e:{default:e}}const s=e=>t=>{t.nativeEvent.stopImmediatePropagation(),t.preventDefault(),t.nativeEvent.preventDefault(),t.stopPropagation(),e&&e()},d=e=>{let{id:t,title:n,description:o,versionState:u,typeTitle:d,onDelete:c,onClick:f,canDelete:p}=e;const y={"link-picker__link":!0,"form-control":!0};u&&(y[` link-picker__link--${u}`]=!0);const v=(0,r.default)(y),_=["unversioned","unsaved"].includes(u)?l.default._t("LinkField.DELETE","Delete"):l.default._t("LinkField.ARCHIVE","Archive");return a.default.createElement("div",{className:v},a.default.createElement(i.Button,{className:"link-picker__button font-icon-link",color:"secondary",onClick:s(f)},a.default.createElement("div",{className:"link-picker__link-detail"},a.default.createElement("div",{className:"link-picker__title"},a.default.createElement("span",{className:"link-picker__title-text"},n),(e=>{let t="",n="";if("draft"===e)t=l.default._t("LinkField.LINK_DRAFT_TITLE","Link has draft changes"),n=l.default._t("LinkField.LINK_DRAFT_LABEL","Draft");else{if("modified"!==e)return null;t=l.default._t("LinkField.LINK_MODIFIED_TITLE","Link has unpublished changes"),n=l.default._t("LinkField.LINK_MODIFIED_LABEL","Modified")}const o=(0,r.default)("badge",`status-${e}`);return a.default.createElement("span",{className:o,title:t},n)})(u)),a.default.createElement("small",{className:"link-picker__type"},d,": ",a.default.createElement("span",{className:"link-picker__url"},o)))),p&&a.default.createElement(i.Button,{className:"link-picker__delete",color:"link",onClick:s((()=>c(t)))},_))};d.propTypes={id:o.default.number.isRequired,title:o.default.string,description:o.default.string,versionState:o.default.string,typeTitle:o.default.string.isRequired,onDelete:o.default.func.isRequired,onClick:o.default.func.isRequired,canDelete:o.default.bool.isRequired};var c=d;t.default=c},697:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=o(n(363)),l=n(648),a=o(n(86));function o(e){return e&&e.__esModule?e:{default:e}}const i=e=>{let{types:t,typeKey:n,linkID:a=0,isOpen:o,onSuccess:i,onClosed:u}=e;if(!n)return!1;const s=t.hasOwnProperty(n)?t[n]:{},d=s&&s.hasOwnProperty("handlerName")?s.handlerName:"FormBuilderModal",c=(0,l.loadComponent)(`LinkModal.${d}`);return r.default.createElement(c,{typeTitle:s.title||"",typeKey:n,linkID:a,isOpen:o,onSuccess:i,onClosed:u})};i.propTypes={types:a.default.array.isRequired,typeKey:a.default.string.isRequired,linkID:a.default.number,isOpen:a.default.bool.isRequired,onSuccess:a.default.func.isRequired,onClosed:a.default.func.isRequired};var u=i;t.default=u},41:function(e,t,n){var r=i(n(311)),l=i(n(363)),a=i(n(691)),o=n(648);function i(e){return e&&e.__esModule?e:{default:e}}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e(".js-injector-boot .entwine-linkfield").entwine({Component:null,Root:null,onmatch(){const e=this.closest(".cms-content").attr("id"),t=e?{context:e}:{},n=this.data("schema-component"),r=(0,o.loadComponent)(n,t);this.setComponent(r),this.setRoot(a.default.createRoot(this[0])),this._super(),this.refresh()},refresh(){const e=this.getProps();this.getInputField().val(e.value);const t=this.getComponent();this.getRoot().render(l.default.createElement(t,u({},e,{noHolder:!0})))},handleChange(e){this.getInputField().data("value",e),this.refresh()},getProps(){const e=this.getInputField();return{value:e.data("value"),ownerID:e.data("owner-id"),ownerClass:e.data("owner-class"),ownerRelation:e.data("owner-relation"),onChange:this.handleChange.bind(this),isMulti:this.data("is-multi")??!1,types:this.data("types")??[],canCreate:this.getInputField().data("can-create")??!1}},getInputField(){const t=this.data("field-id");return e(`#${t}`)},onunmatch(){const e=this.getRoot();e&&e.unmount()}})}))},686:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,l=(r=n(86))&&r.__esModule?r:{default:r};var a=l.default.shape({key:l.default.string.isRequired,title:l.default.string.isRequired});t.default=a},159:function(e){e.exports=Backend},510:function(e){e.exports=Config},42:function(e){e.exports=FieldHolder},912:function(e){e.exports=FormBuilderModal},648:function(e){e.exports=Injector},475:function(e){e.exports=InsertMediaModal},264:function(e){e.exports=Loading},872:function(e){e.exports=NodeUrl},86:function(e){e.exports=PropTypes},363:function(e){e.exports=React},691:function(e){e.exports=ReactDomClient},624:function(e){e.exports=ReactRedux},127:function(e){e.exports=Reactstrap},827:function(e){e.exports=Redux},123:function(e){e.exports=ToastsActions},820:function(e){e.exports=classnames},754:function(e){e.exports=i18n},311:function(e){e.exports=jQuery},902:function(e){e.exports=qs}},t={};function n(r){var l=t[r];if(void 0!==l)return l.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n(274),n(41)}(); \ No newline at end of file +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js ***! + \***********************************************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "HiddenText": function() { return /* binding */ HiddenText; }, +/* harmony export */ "LiveRegion": function() { return /* binding */ LiveRegion; }, +/* harmony export */ "useAnnouncement": function() { return /* binding */ useAnnouncement; } +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + + +const hiddenStyles = { + display: 'none' +}; +function HiddenText(_ref) { + let { + id, + value + } = _ref; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { + id: id, + style: hiddenStyles + }, value); +} + +function LiveRegion(_ref) { + let { + id, + announcement, + ariaLiveType = "assertive" + } = _ref; + // Hide element visually but keep it readable by screen readers + const visuallyHidden = { + position: 'fixed', + width: 1, + height: 1, + margin: -1, + border: 0, + padding: 0, + overflow: 'hidden', + clip: 'rect(0 0 0 0)', + clipPath: 'inset(100%)', + whiteSpace: 'nowrap' + }; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { + id: id, + style: visuallyHidden, + role: "status", + "aria-live": ariaLiveType, + "aria-atomic": true + }, announcement); +} + +function useAnnouncement() { + const [announcement, setAnnouncement] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(''); + const announce = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(value => { + if (value != null) { + setAnnouncement(value); + } + }, []); + return { + announce, + announcement + }; +} + + +//# sourceMappingURL=accessibility.esm.js.map + + +/***/ }), + +/***/ "./node_modules/@dnd-kit/core/dist/core.esm.js": +/*!*****************************************************!*\ + !*** ./node_modules/@dnd-kit/core/dist/core.esm.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "AutoScrollActivator": function() { return /* binding */ AutoScrollActivator; }, +/* harmony export */ "DndContext": function() { return /* binding */ DndContext; }, +/* harmony export */ "DragOverlay": function() { return /* binding */ DragOverlay; }, +/* harmony export */ "KeyboardCode": function() { return /* binding */ KeyboardCode; }, +/* harmony export */ "KeyboardSensor": function() { return /* binding */ KeyboardSensor; }, +/* harmony export */ "MeasuringFrequency": function() { return /* binding */ MeasuringFrequency; }, +/* harmony export */ "MeasuringStrategy": function() { return /* binding */ MeasuringStrategy; }, +/* harmony export */ "MouseSensor": function() { return /* binding */ MouseSensor; }, +/* harmony export */ "PointerSensor": function() { return /* binding */ PointerSensor; }, +/* harmony export */ "TouchSensor": function() { return /* binding */ TouchSensor; }, +/* harmony export */ "TraversalOrder": function() { return /* binding */ TraversalOrder; }, +/* harmony export */ "applyModifiers": function() { return /* binding */ applyModifiers; }, +/* harmony export */ "closestCenter": function() { return /* binding */ closestCenter; }, +/* harmony export */ "closestCorners": function() { return /* binding */ closestCorners; }, +/* harmony export */ "defaultAnnouncements": function() { return /* binding */ defaultAnnouncements; }, +/* harmony export */ "defaultCoordinates": function() { return /* binding */ defaultCoordinates; }, +/* harmony export */ "defaultDropAnimation": function() { return /* binding */ defaultDropAnimationConfiguration; }, +/* harmony export */ "defaultDropAnimationSideEffects": function() { return /* binding */ defaultDropAnimationSideEffects; }, +/* harmony export */ "defaultScreenReaderInstructions": function() { return /* binding */ defaultScreenReaderInstructions; }, +/* harmony export */ "getClientRect": function() { return /* binding */ getClientRect; }, +/* harmony export */ "getFirstCollision": function() { return /* binding */ getFirstCollision; }, +/* harmony export */ "getScrollableAncestors": function() { return /* binding */ getScrollableAncestors; }, +/* harmony export */ "pointerWithin": function() { return /* binding */ pointerWithin; }, +/* harmony export */ "rectIntersection": function() { return /* binding */ rectIntersection; }, +/* harmony export */ "useDndContext": function() { return /* binding */ useDndContext; }, +/* harmony export */ "useDndMonitor": function() { return /* binding */ useDndMonitor; }, +/* harmony export */ "useDraggable": function() { return /* binding */ useDraggable; }, +/* harmony export */ "useDroppable": function() { return /* binding */ useDroppable; }, +/* harmony export */ "useSensor": function() { return /* binding */ useSensor; }, +/* harmony export */ "useSensors": function() { return /* binding */ useSensors; } +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "react-dom"); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @dnd-kit/utilities */ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js"); +/* harmony import */ var _dnd_kit_accessibility__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @dnd-kit/accessibility */ "./node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js"); + + + + + +const DndMonitorContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null); + +function useDndMonitor(listener) { + const registerListener = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(DndMonitorContext); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!registerListener) { + throw new Error('useDndMonitor must be used within a children of '); + } + + const unsubscribe = registerListener(listener); + return unsubscribe; + }, [listener, registerListener]); +} + +function useDndMonitorProvider() { + const [listeners] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => new Set()); + const registerListener = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(listener => { + listeners.add(listener); + return () => listeners.delete(listener); + }, [listeners]); + const dispatch = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(_ref => { + let { + type, + event + } = _ref; + listeners.forEach(listener => { + var _listener$type; + + return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event); + }); + }, [listeners]); + return [dispatch, registerListener]; +} + +const defaultScreenReaderInstructions = { + draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " +}; +const defaultAnnouncements = { + onDragStart(_ref) { + let { + active + } = _ref; + return "Picked up draggable item " + active.id + "."; + }, + + onDragOver(_ref2) { + let { + active, + over + } = _ref2; + + if (over) { + return "Draggable item " + active.id + " was moved over droppable area " + over.id + "."; + } + + return "Draggable item " + active.id + " is no longer over a droppable area."; + }, + + onDragEnd(_ref3) { + let { + active, + over + } = _ref3; + + if (over) { + return "Draggable item " + active.id + " was dropped over droppable area " + over.id; + } + + return "Draggable item " + active.id + " was dropped."; + }, + + onDragCancel(_ref4) { + let { + active + } = _ref4; + return "Dragging was cancelled. Draggable item " + active.id + " was dropped."; + } + +}; + +function Accessibility(_ref) { + let { + announcements = defaultAnnouncements, + container, + hiddenTextDescribedById, + screenReaderInstructions = defaultScreenReaderInstructions + } = _ref; + const { + announce, + announcement + } = (0,_dnd_kit_accessibility__WEBPACK_IMPORTED_MODULE_3__.useAnnouncement)(); + const liveRegionId = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)("DndLiveRegion"); + const [mounted, setMounted] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + setMounted(true); + }, []); + useDndMonitor((0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + onDragStart(_ref2) { + let { + active + } = _ref2; + announce(announcements.onDragStart({ + active + })); + }, + + onDragMove(_ref3) { + let { + active, + over + } = _ref3; + + if (announcements.onDragMove) { + announce(announcements.onDragMove({ + active, + over + })); + } + }, + + onDragOver(_ref4) { + let { + active, + over + } = _ref4; + announce(announcements.onDragOver({ + active, + over + })); + }, + + onDragEnd(_ref5) { + let { + active, + over + } = _ref5; + announce(announcements.onDragEnd({ + active, + over + })); + }, + + onDragCancel(_ref6) { + let { + active, + over + } = _ref6; + announce(announcements.onDragCancel({ + active, + over + })); + } + + }), [announce, announcements])); + + if (!mounted) { + return null; + } + + const markup = react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_dnd_kit_accessibility__WEBPACK_IMPORTED_MODULE_3__.HiddenText, { + id: hiddenTextDescribedById, + value: screenReaderInstructions.draggable + }), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_dnd_kit_accessibility__WEBPACK_IMPORTED_MODULE_3__.LiveRegion, { + id: liveRegionId, + announcement: announcement + })); + return container ? (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(markup, container) : markup; +} + +var Action; + +(function (Action) { + Action["DragStart"] = "dragStart"; + Action["DragMove"] = "dragMove"; + Action["DragEnd"] = "dragEnd"; + Action["DragCancel"] = "dragCancel"; + Action["DragOver"] = "dragOver"; + Action["RegisterDroppable"] = "registerDroppable"; + Action["SetDroppableDisabled"] = "setDroppableDisabled"; + Action["UnregisterDroppable"] = "unregisterDroppable"; +})(Action || (Action = {})); + +function noop() {} + +function useSensor(sensor, options) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + sensor, + options: options != null ? options : {} + }), // eslint-disable-next-line react-hooks/exhaustive-deps + [sensor, options]); +} + +function useSensors() { + for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) { + sensors[_key] = arguments[_key]; + } + + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => [...sensors].filter(sensor => sensor != null), // eslint-disable-next-line react-hooks/exhaustive-deps + [...sensors]); +} + +const defaultCoordinates = /*#__PURE__*/Object.freeze({ + x: 0, + y: 0 +}); + +/** + * Returns the distance between two points + */ +function distanceBetween(p1, p2) { + return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); +} + +function getRelativeTransformOrigin(event, rect) { + const eventCoordinates = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getEventCoordinates)(event); + + if (!eventCoordinates) { + return '0 0'; + } + + const transformOrigin = { + x: (eventCoordinates.x - rect.left) / rect.width * 100, + y: (eventCoordinates.y - rect.top) / rect.height * 100 + }; + return transformOrigin.x + "% " + transformOrigin.y + "%"; +} + +/** + * Sort collisions from smallest to greatest value + */ +function sortCollisionsAsc(_ref, _ref2) { + let { + data: { + value: a + } + } = _ref; + let { + data: { + value: b + } + } = _ref2; + return a - b; +} +/** + * Sort collisions from greatest to smallest value + */ + +function sortCollisionsDesc(_ref3, _ref4) { + let { + data: { + value: a + } + } = _ref3; + let { + data: { + value: b + } + } = _ref4; + return b - a; +} +/** + * Returns the coordinates of the corners of a given rectangle: + * [TopLeft {x, y}, TopRight {x, y}, BottomLeft {x, y}, BottomRight {x, y}] + */ + +function cornersOfRectangle(_ref5) { + let { + left, + top, + height, + width + } = _ref5; + return [{ + x: left, + y: top + }, { + x: left + width, + y: top + }, { + x: left, + y: top + height + }, { + x: left + width, + y: top + height + }]; +} +function getFirstCollision(collisions, property) { + if (!collisions || collisions.length === 0) { + return null; + } + + const [firstCollision] = collisions; + return property ? firstCollision[property] : firstCollision; +} + +/** + * Returns the coordinates of the center of a given ClientRect + */ + +function centerOfRectangle(rect, left, top) { + if (left === void 0) { + left = rect.left; + } + + if (top === void 0) { + top = rect.top; + } + + return { + x: left + rect.width * 0.5, + y: top + rect.height * 0.5 + }; +} +/** + * Returns the closest rectangles from an array of rectangles to the center of a given + * rectangle. + */ + + +const closestCenter = _ref => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top); + const collisions = []; + + for (const droppableContainer of droppableContainers) { + const { + id + } = droppableContainer; + const rect = droppableRects.get(id); + + if (rect) { + const distBetween = distanceBetween(centerOfRectangle(rect), centerRect); + collisions.push({ + id, + data: { + droppableContainer, + value: distBetween + } + }); + } + } + + return collisions.sort(sortCollisionsAsc); +}; + +/** + * Returns the closest rectangles from an array of rectangles to the corners of + * another rectangle. + */ + +const closestCorners = _ref => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const corners = cornersOfRectangle(collisionRect); + const collisions = []; + + for (const droppableContainer of droppableContainers) { + const { + id + } = droppableContainer; + const rect = droppableRects.get(id); + + if (rect) { + const rectCorners = cornersOfRectangle(rect); + const distances = corners.reduce((accumulator, corner, index) => { + return accumulator + distanceBetween(rectCorners[index], corner); + }, 0); + const effectiveDistance = Number((distances / 4).toFixed(4)); + collisions.push({ + id, + data: { + droppableContainer, + value: effectiveDistance + } + }); + } + } + + return collisions.sort(sortCollisionsAsc); +}; + +/** + * Returns the intersecting rectangle area between two rectangles + */ + +function getIntersectionRatio(entry, target) { + const top = Math.max(target.top, entry.top); + const left = Math.max(target.left, entry.left); + const right = Math.min(target.left + target.width, entry.left + entry.width); + const bottom = Math.min(target.top + target.height, entry.top + entry.height); + const width = right - left; + const height = bottom - top; + + if (left < right && top < bottom) { + const targetArea = target.width * target.height; + const entryArea = entry.width * entry.height; + const intersectionArea = width * height; + const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea); + return Number(intersectionRatio.toFixed(4)); + } // Rectangles do not overlap, or overlap has an area of zero (edge/corner overlap) + + + return 0; +} +/** + * Returns the rectangles that has the greatest intersection area with a given + * rectangle in an array of rectangles. + */ + +const rectIntersection = _ref => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const collisions = []; + + for (const droppableContainer of droppableContainers) { + const { + id + } = droppableContainer; + const rect = droppableRects.get(id); + + if (rect) { + const intersectionRatio = getIntersectionRatio(rect, collisionRect); + + if (intersectionRatio > 0) { + collisions.push({ + id, + data: { + droppableContainer, + value: intersectionRatio + } + }); + } + } + } + + return collisions.sort(sortCollisionsDesc); +}; + +/** + * Check if a given point is contained within a bounding rectangle + */ + +function isPointWithinRect(point, rect) { + const { + top, + left, + bottom, + right + } = rect; + return top <= point.y && point.y <= bottom && left <= point.x && point.x <= right; +} +/** + * Returns the rectangles that the pointer is hovering over + */ + + +const pointerWithin = _ref => { + let { + droppableContainers, + droppableRects, + pointerCoordinates + } = _ref; + + if (!pointerCoordinates) { + return []; + } + + const collisions = []; + + for (const droppableContainer of droppableContainers) { + const { + id + } = droppableContainer; + const rect = droppableRects.get(id); + + if (rect && isPointWithinRect(pointerCoordinates, rect)) { + /* There may be more than a single rectangle intersecting + * with the pointer coordinates. In order to sort the + * colliding rectangles, we measure the distance between + * the pointer and the corners of the intersecting rectangle + */ + const corners = cornersOfRectangle(rect); + const distances = corners.reduce((accumulator, corner) => { + return accumulator + distanceBetween(pointerCoordinates, corner); + }, 0); + const effectiveDistance = Number((distances / 4).toFixed(4)); + collisions.push({ + id, + data: { + droppableContainer, + value: effectiveDistance + } + }); + } + } + + return collisions.sort(sortCollisionsAsc); +}; + +function adjustScale(transform, rect1, rect2) { + return { ...transform, + scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1, + scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1 + }; +} + +function getRectDelta(rect1, rect2) { + return rect1 && rect2 ? { + x: rect1.left - rect2.left, + y: rect1.top - rect2.top + } : defaultCoordinates; +} + +function createRectAdjustmentFn(modifier) { + return function adjustClientRect(rect) { + for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + adjustments[_key - 1] = arguments[_key]; + } + + return adjustments.reduce((acc, adjustment) => ({ ...acc, + top: acc.top + modifier * adjustment.y, + bottom: acc.bottom + modifier * adjustment.y, + left: acc.left + modifier * adjustment.x, + right: acc.right + modifier * adjustment.x + }), { ...rect + }); + }; +} +const getAdjustedRect = /*#__PURE__*/createRectAdjustmentFn(1); + +function parseTransform(transform) { + if (transform.startsWith('matrix3d(')) { + const transformArray = transform.slice(9, -1).split(/, /); + return { + x: +transformArray[12], + y: +transformArray[13], + scaleX: +transformArray[0], + scaleY: +transformArray[5] + }; + } else if (transform.startsWith('matrix(')) { + const transformArray = transform.slice(7, -1).split(/, /); + return { + x: +transformArray[4], + y: +transformArray[5], + scaleX: +transformArray[0], + scaleY: +transformArray[3] + }; + } + + return null; +} + +function inverseTransform(rect, transform, transformOrigin) { + const parsedTransform = parseTransform(transform); + + if (!parsedTransform) { + return rect; + } + + const { + scaleX, + scaleY, + x: translateX, + y: translateY + } = parsedTransform; + const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin); + const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(' ') + 1)); + const w = scaleX ? rect.width / scaleX : rect.width; + const h = scaleY ? rect.height / scaleY : rect.height; + return { + width: w, + height: h, + top: y, + right: x + w, + bottom: y + h, + left: x + }; +} + +const defaultOptions = { + ignoreTransform: false +}; +/** + * Returns the bounding client rect of an element relative to the viewport. + */ + +function getClientRect(element, options) { + if (options === void 0) { + options = defaultOptions; + } + + let rect = element.getBoundingClientRect(); + + if (options.ignoreTransform) { + const { + transform, + transformOrigin + } = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element).getComputedStyle(element); + + if (transform) { + rect = inverseTransform(rect, transform, transformOrigin); + } + } + + const { + top, + left, + width, + height, + bottom, + right + } = rect; + return { + top, + left, + width, + height, + bottom, + right + }; +} +/** + * Returns the bounding client rect of an element relative to the viewport. + * + * @remarks + * The ClientRect returned by this method does not take into account transforms + * applied to the element it measures. + * + */ + +function getTransformAgnosticClientRect(element) { + return getClientRect(element, { + ignoreTransform: true + }); +} + +function getWindowClientRect(element) { + const width = element.innerWidth; + const height = element.innerHeight; + return { + top: 0, + left: 0, + right: width, + bottom: height, + width, + height + }; +} + +function isFixed(node, computedStyle) { + if (computedStyle === void 0) { + computedStyle = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(node).getComputedStyle(node); + } + + return computedStyle.position === 'fixed'; +} + +function isScrollable(element, computedStyle) { + if (computedStyle === void 0) { + computedStyle = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element).getComputedStyle(element); + } + + const overflowRegex = /(auto|scroll|overlay)/; + const properties = ['overflow', 'overflowX', 'overflowY']; + return properties.some(property => { + const value = computedStyle[property]; + return typeof value === 'string' ? overflowRegex.test(value) : false; + }); +} + +function getScrollableAncestors(element, limit) { + const scrollParents = []; + + function findScrollableAncestors(node) { + if (limit != null && scrollParents.length >= limit) { + return scrollParents; + } + + if (!node) { + return scrollParents; + } + + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isDocument)(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) { + scrollParents.push(node.scrollingElement); + return scrollParents; + } + + if (!(0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(node) || (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isSVGElement)(node)) { + return scrollParents; + } + + if (scrollParents.includes(node)) { + return scrollParents; + } + + const computedStyle = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element).getComputedStyle(node); + + if (node !== element) { + if (isScrollable(node, computedStyle)) { + scrollParents.push(node); + } + } + + if (isFixed(node, computedStyle)) { + return scrollParents; + } + + return findScrollableAncestors(node.parentNode); + } + + if (!element) { + return scrollParents; + } + + return findScrollableAncestors(element); +} +function getFirstScrollableAncestor(node) { + const [firstScrollableAncestor] = getScrollableAncestors(node, 1); + return firstScrollableAncestor != null ? firstScrollableAncestor : null; +} + +function getScrollableElement(element) { + if (!_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.canUseDOM || !element) { + return null; + } + + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isWindow)(element)) { + return element; + } + + if (!(0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isNode)(element)) { + return null; + } + + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isDocument)(element) || element === (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(element).scrollingElement) { + return window; + } + + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element)) { + return element; + } + + return null; +} + +function getScrollXCoordinate(element) { + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isWindow)(element)) { + return element.scrollX; + } + + return element.scrollLeft; +} +function getScrollYCoordinate(element) { + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isWindow)(element)) { + return element.scrollY; + } + + return element.scrollTop; +} +function getScrollCoordinates(element) { + return { + x: getScrollXCoordinate(element), + y: getScrollYCoordinate(element) + }; +} + +var Direction; + +(function (Direction) { + Direction[Direction["Forward"] = 1] = "Forward"; + Direction[Direction["Backward"] = -1] = "Backward"; +})(Direction || (Direction = {})); + +function isDocumentScrollingElement(element) { + if (!_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.canUseDOM || !element) { + return false; + } + + return element === document.scrollingElement; +} + +function getScrollPosition(scrollingContainer) { + const minScroll = { + x: 0, + y: 0 + }; + const dimensions = isDocumentScrollingElement(scrollingContainer) ? { + height: window.innerHeight, + width: window.innerWidth + } : { + height: scrollingContainer.clientHeight, + width: scrollingContainer.clientWidth + }; + const maxScroll = { + x: scrollingContainer.scrollWidth - dimensions.width, + y: scrollingContainer.scrollHeight - dimensions.height + }; + const isTop = scrollingContainer.scrollTop <= minScroll.y; + const isLeft = scrollingContainer.scrollLeft <= minScroll.x; + const isBottom = scrollingContainer.scrollTop >= maxScroll.y; + const isRight = scrollingContainer.scrollLeft >= maxScroll.x; + return { + isTop, + isLeft, + isBottom, + isRight, + maxScroll, + minScroll + }; +} + +const defaultThreshold = { + x: 0.2, + y: 0.2 +}; +function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) { + let { + top, + left, + right, + bottom + } = _ref; + + if (acceleration === void 0) { + acceleration = 10; + } + + if (thresholdPercentage === void 0) { + thresholdPercentage = defaultThreshold; + } + + const { + isTop, + isBottom, + isLeft, + isRight + } = getScrollPosition(scrollContainer); + const direction = { + x: 0, + y: 0 + }; + const speed = { + x: 0, + y: 0 + }; + const threshold = { + height: scrollContainerRect.height * thresholdPercentage.y, + width: scrollContainerRect.width * thresholdPercentage.x + }; + + if (!isTop && top <= scrollContainerRect.top + threshold.height) { + // Scroll Up + direction.y = Direction.Backward; + speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height); + } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) { + // Scroll Down + direction.y = Direction.Forward; + speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height); + } + + if (!isRight && right >= scrollContainerRect.right - threshold.width) { + // Scroll Right + direction.x = Direction.Forward; + speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width); + } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) { + // Scroll Left + direction.x = Direction.Backward; + speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width); + } + + return { + direction, + speed + }; +} + +function getScrollElementRect(element) { + if (element === document.scrollingElement) { + const { + innerWidth, + innerHeight + } = window; + return { + top: 0, + left: 0, + right: innerWidth, + bottom: innerHeight, + width: innerWidth, + height: innerHeight + }; + } + + const { + top, + left, + right, + bottom + } = element.getBoundingClientRect(); + return { + top, + left, + right, + bottom, + width: element.clientWidth, + height: element.clientHeight + }; +} + +function getScrollOffsets(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(acc, getScrollCoordinates(node)); + }, defaultCoordinates); +} +function getScrollXOffset(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return acc + getScrollXCoordinate(node); + }, 0); +} +function getScrollYOffset(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return acc + getScrollYCoordinate(node); + }, 0); +} + +function scrollIntoViewIfNeeded(element, measure) { + if (measure === void 0) { + measure = getClientRect; + } + + if (!element) { + return; + } + + const { + top, + left, + bottom, + right + } = measure(element); + const firstScrollableAncestor = getFirstScrollableAncestor(element); + + if (!firstScrollableAncestor) { + return; + } + + if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) { + element.scrollIntoView({ + block: 'center', + inline: 'center' + }); + } +} + +const properties = [['x', ['left', 'right'], getScrollXOffset], ['y', ['top', 'bottom'], getScrollYOffset]]; +class Rect { + constructor(rect, element) { + this.rect = void 0; + this.width = void 0; + this.height = void 0; + this.top = void 0; + this.bottom = void 0; + this.right = void 0; + this.left = void 0; + const scrollableAncestors = getScrollableAncestors(element); + const scrollOffsets = getScrollOffsets(scrollableAncestors); + this.rect = { ...rect + }; + this.width = rect.width; + this.height = rect.height; + + for (const [axis, keys, getScrollOffset] of properties) { + for (const key of keys) { + Object.defineProperty(this, key, { + get: () => { + const currentOffsets = getScrollOffset(scrollableAncestors); + const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets; + return this.rect[key] + scrollOffsetsDeltla; + }, + enumerable: true + }); + } + } + + Object.defineProperty(this, 'rect', { + enumerable: false + }); + } + +} + +class Listeners { + constructor(target) { + this.target = void 0; + this.listeners = []; + + this.removeAll = () => { + this.listeners.forEach(listener => { + var _this$target; + + return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener); + }); + }; + + this.target = target; + } + + add(eventName, handler, options) { + var _this$target2; + + (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options); + this.listeners.push([eventName, handler, options]); + } + +} + +function getEventListenerTarget(target) { + // If the `event.target` element is removed from the document events will still be targeted + // at it, and hence won't always bubble up to the window or document anymore. + // If there is any risk of an element being removed while it is being dragged, + // the best practice is to attach the event listeners directly to the target. + // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget + const { + EventTarget + } = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(target); + return target instanceof EventTarget ? target : (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(target); +} + +function hasExceededDistance(delta, measurement) { + const dx = Math.abs(delta.x); + const dy = Math.abs(delta.y); + + if (typeof measurement === 'number') { + return Math.sqrt(dx ** 2 + dy ** 2) > measurement; + } + + if ('x' in measurement && 'y' in measurement) { + return dx > measurement.x && dy > measurement.y; + } + + if ('x' in measurement) { + return dx > measurement.x; + } + + if ('y' in measurement) { + return dy > measurement.y; + } + + return false; +} + +var EventName; + +(function (EventName) { + EventName["Click"] = "click"; + EventName["DragStart"] = "dragstart"; + EventName["Keydown"] = "keydown"; + EventName["ContextMenu"] = "contextmenu"; + EventName["Resize"] = "resize"; + EventName["SelectionChange"] = "selectionchange"; + EventName["VisibilityChange"] = "visibilitychange"; +})(EventName || (EventName = {})); + +function preventDefault(event) { + event.preventDefault(); +} +function stopPropagation(event) { + event.stopPropagation(); +} + +var KeyboardCode; + +(function (KeyboardCode) { + KeyboardCode["Space"] = "Space"; + KeyboardCode["Down"] = "ArrowDown"; + KeyboardCode["Right"] = "ArrowRight"; + KeyboardCode["Left"] = "ArrowLeft"; + KeyboardCode["Up"] = "ArrowUp"; + KeyboardCode["Esc"] = "Escape"; + KeyboardCode["Enter"] = "Enter"; +})(KeyboardCode || (KeyboardCode = {})); + +const defaultKeyboardCodes = { + start: [KeyboardCode.Space, KeyboardCode.Enter], + cancel: [KeyboardCode.Esc], + end: [KeyboardCode.Space, KeyboardCode.Enter] +}; +const defaultKeyboardCoordinateGetter = (event, _ref) => { + let { + currentCoordinates + } = _ref; + + switch (event.code) { + case KeyboardCode.Right: + return { ...currentCoordinates, + x: currentCoordinates.x + 25 + }; + + case KeyboardCode.Left: + return { ...currentCoordinates, + x: currentCoordinates.x - 25 + }; + + case KeyboardCode.Down: + return { ...currentCoordinates, + y: currentCoordinates.y + 25 + }; + + case KeyboardCode.Up: + return { ...currentCoordinates, + y: currentCoordinates.y - 25 + }; + } + + return undefined; +}; + +class KeyboardSensor { + constructor(props) { + this.props = void 0; + this.autoScrollEnabled = false; + this.referenceCoordinates = void 0; + this.listeners = void 0; + this.windowListeners = void 0; + this.props = props; + const { + event: { + target + } + } = props; + this.props = props; + this.listeners = new Listeners((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(target)); + this.windowListeners = new Listeners((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(target)); + this.handleKeyDown = this.handleKeyDown.bind(this); + this.handleCancel = this.handleCancel.bind(this); + this.attach(); + } + + attach() { + this.handleStart(); + this.windowListeners.add(EventName.Resize, this.handleCancel); + this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); + setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown)); + } + + handleStart() { + const { + activeNode, + onStart + } = this.props; + const node = activeNode.node.current; + + if (node) { + scrollIntoViewIfNeeded(node); + } + + onStart(defaultCoordinates); + } + + handleKeyDown(event) { + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isKeyboardEvent)(event)) { + const { + active, + context, + options + } = this.props; + const { + keyboardCodes = defaultKeyboardCodes, + coordinateGetter = defaultKeyboardCoordinateGetter, + scrollBehavior = 'smooth' + } = options; + const { + code + } = event; + + if (keyboardCodes.end.includes(code)) { + this.handleEnd(event); + return; + } + + if (keyboardCodes.cancel.includes(code)) { + this.handleCancel(event); + return; + } + + const { + collisionRect + } = context.current; + const currentCoordinates = collisionRect ? { + x: collisionRect.left, + y: collisionRect.top + } : defaultCoordinates; + + if (!this.referenceCoordinates) { + this.referenceCoordinates = currentCoordinates; + } + + const newCoordinates = coordinateGetter(event, { + active, + context: context.current, + currentCoordinates + }); + + if (newCoordinates) { + const coordinatesDelta = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(newCoordinates, currentCoordinates); + const scrollDelta = { + x: 0, + y: 0 + }; + const { + scrollableAncestors + } = context.current; + + for (const scrollContainer of scrollableAncestors) { + const direction = event.code; + const { + isTop, + isRight, + isLeft, + isBottom, + maxScroll, + minScroll + } = getScrollPosition(scrollContainer); + const scrollElementRect = getScrollElementRect(scrollContainer); + const clampedCoordinates = { + x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)), + y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y)) + }; + const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft; + const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop; + + if (canScrollX && clampedCoordinates.x !== newCoordinates.x) { + const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x; + const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x; + + if (canScrollToNewCoordinates && !coordinatesDelta.y) { + // We don't need to update coordinates, the scroll adjustment alone will trigger + // logic to auto-detect the new container we are over + scrollContainer.scrollTo({ + left: newScrollCoordinates, + behavior: scrollBehavior + }); + return; + } + + if (canScrollToNewCoordinates) { + scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates; + } else { + scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x; + } + + if (scrollDelta.x) { + scrollContainer.scrollBy({ + left: -scrollDelta.x, + behavior: scrollBehavior + }); + } + + break; + } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) { + const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y; + const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y; + + if (canScrollToNewCoordinates && !coordinatesDelta.x) { + // We don't need to update coordinates, the scroll adjustment alone will trigger + // logic to auto-detect the new container we are over + scrollContainer.scrollTo({ + top: newScrollCoordinates, + behavior: scrollBehavior + }); + return; + } + + if (canScrollToNewCoordinates) { + scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates; + } else { + scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y; + } + + if (scrollDelta.y) { + scrollContainer.scrollBy({ + top: -scrollDelta.y, + behavior: scrollBehavior + }); + } + + break; + } + } + + this.handleMove(event, (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(newCoordinates, this.referenceCoordinates), scrollDelta)); + } + } + } + + handleMove(event, coordinates) { + const { + onMove + } = this.props; + event.preventDefault(); + onMove(coordinates); + } + + handleEnd(event) { + const { + onEnd + } = this.props; + event.preventDefault(); + this.detach(); + onEnd(); + } + + handleCancel(event) { + const { + onCancel + } = this.props; + event.preventDefault(); + this.detach(); + onCancel(); + } + + detach() { + this.listeners.removeAll(); + this.windowListeners.removeAll(); + } + +} +KeyboardSensor.activators = [{ + eventName: 'onKeyDown', + handler: (event, _ref, _ref2) => { + let { + keyboardCodes = defaultKeyboardCodes, + onActivation + } = _ref; + let { + active + } = _ref2; + const { + code + } = event.nativeEvent; + + if (keyboardCodes.start.includes(code)) { + const activator = active.activatorNode.current; + + if (activator && event.target !== activator) { + return false; + } + + event.preventDefault(); + onActivation == null ? void 0 : onActivation({ + event: event.nativeEvent + }); + return true; + } + + return false; + } +}]; + +function isDistanceConstraint(constraint) { + return Boolean(constraint && 'distance' in constraint); +} + +function isDelayConstraint(constraint) { + return Boolean(constraint && 'delay' in constraint); +} + +class AbstractPointerSensor { + constructor(props, events, listenerTarget) { + var _getEventCoordinates; + + if (listenerTarget === void 0) { + listenerTarget = getEventListenerTarget(props.event.target); + } + + this.props = void 0; + this.events = void 0; + this.autoScrollEnabled = true; + this.document = void 0; + this.activated = false; + this.initialCoordinates = void 0; + this.timeoutId = null; + this.listeners = void 0; + this.documentListeners = void 0; + this.windowListeners = void 0; + this.props = props; + this.events = events; + const { + event + } = props; + const { + target + } = event; + this.props = props; + this.events = events; + this.document = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(target); + this.documentListeners = new Listeners(this.document); + this.listeners = new Listeners(listenerTarget); + this.windowListeners = new Listeners((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(target)); + this.initialCoordinates = (_getEventCoordinates = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getEventCoordinates)(event)) != null ? _getEventCoordinates : defaultCoordinates; + this.handleStart = this.handleStart.bind(this); + this.handleMove = this.handleMove.bind(this); + this.handleEnd = this.handleEnd.bind(this); + this.handleCancel = this.handleCancel.bind(this); + this.handleKeydown = this.handleKeydown.bind(this); + this.removeTextSelection = this.removeTextSelection.bind(this); + this.attach(); + } + + attach() { + const { + events, + props: { + options: { + activationConstraint, + bypassActivationConstraint + } + } + } = this; + this.listeners.add(events.move.name, this.handleMove, { + passive: false + }); + this.listeners.add(events.end.name, this.handleEnd); + this.windowListeners.add(EventName.Resize, this.handleCancel); + this.windowListeners.add(EventName.DragStart, preventDefault); + this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); + this.windowListeners.add(EventName.ContextMenu, preventDefault); + this.documentListeners.add(EventName.Keydown, this.handleKeydown); + + if (activationConstraint) { + if (bypassActivationConstraint != null && bypassActivationConstraint({ + event: this.props.event, + activeNode: this.props.activeNode, + options: this.props.options + })) { + return this.handleStart(); + } + + if (isDelayConstraint(activationConstraint)) { + this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay); + return; + } + + if (isDistanceConstraint(activationConstraint)) { + return; + } + } + + this.handleStart(); + } + + detach() { + this.listeners.removeAll(); + this.windowListeners.removeAll(); // Wait until the next event loop before removing document listeners + // This is necessary because we listen for `click` and `selection` events on the document + + setTimeout(this.documentListeners.removeAll, 50); + + if (this.timeoutId !== null) { + clearTimeout(this.timeoutId); + this.timeoutId = null; + } + } + + handleStart() { + const { + initialCoordinates + } = this; + const { + onStart + } = this.props; + + if (initialCoordinates) { + this.activated = true; // Stop propagation of click events once activation constraints are met + + this.documentListeners.add(EventName.Click, stopPropagation, { + capture: true + }); // Remove any text selection from the document + + this.removeTextSelection(); // Prevent further text selection while dragging + + this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection); + onStart(initialCoordinates); + } + } + + handleMove(event) { + var _getEventCoordinates2; + + const { + activated, + initialCoordinates, + props + } = this; + const { + onMove, + options: { + activationConstraint + } + } = props; + + if (!initialCoordinates) { + return; + } + + const coordinates = (_getEventCoordinates2 = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getEventCoordinates)(event)) != null ? _getEventCoordinates2 : defaultCoordinates; + const delta = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(initialCoordinates, coordinates); // Constraint validation + + if (!activated && activationConstraint) { + if (isDistanceConstraint(activationConstraint)) { + if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) { + return this.handleCancel(); + } + + if (hasExceededDistance(delta, activationConstraint.distance)) { + return this.handleStart(); + } + } + + if (isDelayConstraint(activationConstraint)) { + if (hasExceededDistance(delta, activationConstraint.tolerance)) { + return this.handleCancel(); + } + } + + return; + } + + if (event.cancelable) { + event.preventDefault(); + } + + onMove(coordinates); + } + + handleEnd() { + const { + onEnd + } = this.props; + this.detach(); + onEnd(); + } + + handleCancel() { + const { + onCancel + } = this.props; + this.detach(); + onCancel(); + } + + handleKeydown(event) { + if (event.code === KeyboardCode.Esc) { + this.handleCancel(); + } + } + + removeTextSelection() { + var _this$document$getSel; + + (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges(); + } + +} + +const events = { + move: { + name: 'pointermove' + }, + end: { + name: 'pointerup' + } +}; +class PointerSensor extends AbstractPointerSensor { + constructor(props) { + const { + event + } = props; // Pointer events stop firing if the target is unmounted while dragging + // Therefore we attach listeners to the owner document instead + + const listenerTarget = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(event.target); + super(props, events, listenerTarget); + } + +} +PointerSensor.activators = [{ + eventName: 'onPointerDown', + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + + if (!event.isPrimary || event.button !== 0) { + return false; + } + + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; + +const events$1 = { + move: { + name: 'mousemove' + }, + end: { + name: 'mouseup' + } +}; +var MouseButton; + +(function (MouseButton) { + MouseButton[MouseButton["RightClick"] = 2] = "RightClick"; +})(MouseButton || (MouseButton = {})); + +class MouseSensor extends AbstractPointerSensor { + constructor(props) { + super(props, events$1, (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(props.event.target)); + } + +} +MouseSensor.activators = [{ + eventName: 'onMouseDown', + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + + if (event.button === MouseButton.RightClick) { + return false; + } + + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; + +const events$2 = { + move: { + name: 'touchmove' + }, + end: { + name: 'touchend' + } +}; +class TouchSensor extends AbstractPointerSensor { + constructor(props) { + super(props, events$2); + } + + static setup() { + // Adding a non-capture and non-passive `touchmove` listener in order + // to force `event.preventDefault()` calls to work in dynamically added + // touchmove event handlers. This is required for iOS Safari. + window.addEventListener(events$2.move.name, noop, { + capture: false, + passive: false + }); + return function teardown() { + window.removeEventListener(events$2.move.name, noop); + }; // We create a new handler because the teardown function of another sensor + // could remove our event listener if we use a referentially equal listener. + + function noop() {} + } + +} +TouchSensor.activators = [{ + eventName: 'onTouchStart', + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + const { + touches + } = event; + + if (touches.length > 1) { + return false; + } + + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; + +var AutoScrollActivator; + +(function (AutoScrollActivator) { + AutoScrollActivator[AutoScrollActivator["Pointer"] = 0] = "Pointer"; + AutoScrollActivator[AutoScrollActivator["DraggableRect"] = 1] = "DraggableRect"; +})(AutoScrollActivator || (AutoScrollActivator = {})); + +var TraversalOrder; + +(function (TraversalOrder) { + TraversalOrder[TraversalOrder["TreeOrder"] = 0] = "TreeOrder"; + TraversalOrder[TraversalOrder["ReversedTreeOrder"] = 1] = "ReversedTreeOrder"; +})(TraversalOrder || (TraversalOrder = {})); + +function useAutoScroller(_ref) { + let { + acceleration, + activator = AutoScrollActivator.Pointer, + canScroll, + draggingRect, + enabled, + interval = 5, + order = TraversalOrder.TreeOrder, + pointerCoordinates, + scrollableAncestors, + scrollableAncestorRects, + delta, + threshold + } = _ref; + const scrollIntent = useScrollIntent({ + delta, + disabled: !enabled + }); + const [setAutoScrollInterval, clearAutoScrollInterval] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useInterval)(); + const scrollSpeed = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + x: 0, + y: 0 + }); + const scrollDirection = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + x: 0, + y: 0 + }); + const rect = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + switch (activator) { + case AutoScrollActivator.Pointer: + return pointerCoordinates ? { + top: pointerCoordinates.y, + bottom: pointerCoordinates.y, + left: pointerCoordinates.x, + right: pointerCoordinates.x + } : null; + + case AutoScrollActivator.DraggableRect: + return draggingRect; + } + }, [activator, draggingRect, pointerCoordinates]); + const scrollContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const autoScroll = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + const scrollContainer = scrollContainerRef.current; + + if (!scrollContainer) { + return; + } + + const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x; + const scrollTop = scrollSpeed.current.y * scrollDirection.current.y; + scrollContainer.scrollBy(scrollLeft, scrollTop); + }, []); + const sortedScrollableAncestors = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!enabled || !scrollableAncestors.length || !rect) { + clearAutoScrollInterval(); + return; + } + + for (const scrollContainer of sortedScrollableAncestors) { + if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) { + continue; + } + + const index = scrollableAncestors.indexOf(scrollContainer); + const scrollContainerRect = scrollableAncestorRects[index]; + + if (!scrollContainerRect) { + continue; + } + + const { + direction, + speed + } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold); + + for (const axis of ['x', 'y']) { + if (!scrollIntent[axis][direction[axis]]) { + speed[axis] = 0; + direction[axis] = 0; + } + } + + if (speed.x > 0 || speed.y > 0) { + clearAutoScrollInterval(); + scrollContainerRef.current = scrollContainer; + setAutoScrollInterval(autoScroll, interval); + scrollSpeed.current = speed; + scrollDirection.current = direction; + return; + } + } + + scrollSpeed.current = { + x: 0, + y: 0 + }; + scrollDirection.current = { + x: 0, + y: 0 + }; + clearAutoScrollInterval(); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [acceleration, autoScroll, canScroll, clearAutoScrollInterval, enabled, interval, // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(rect), // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(scrollIntent), setAutoScrollInterval, scrollableAncestors, sortedScrollableAncestors, scrollableAncestorRects, // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(threshold)]); +} +const defaultScrollIntent = { + x: { + [Direction.Backward]: false, + [Direction.Forward]: false + }, + y: { + [Direction.Backward]: false, + [Direction.Forward]: false + } +}; + +function useScrollIntent(_ref2) { + let { + delta, + disabled + } = _ref2; + const previousDelta = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.usePrevious)(delta); + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(previousIntent => { + if (disabled || !previousDelta || !previousIntent) { + // Reset scroll intent tracking when auto-scrolling is disabled + return defaultScrollIntent; + } + + const direction = { + x: Math.sign(delta.x - previousDelta.x), + y: Math.sign(delta.y - previousDelta.y) + }; // Keep track of the user intent to scroll in each direction for both axis + + return { + x: { + [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1, + [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1 + }, + y: { + [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1, + [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1 + } + }; + }, [disabled, delta, previousDelta]); +} + +function useCachedNode(draggableNodes, id) { + const draggableNode = id !== null ? draggableNodes.get(id) : undefined; + const node = draggableNode ? draggableNode.node.current : null; + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(cachedNode => { + var _ref; + + if (id === null) { + return null; + } // In some cases, the draggable node can unmount while dragging + // This is the case for virtualized lists. In those situations, + // we fall back to the last known value for that node. + + + return (_ref = node != null ? node : cachedNode) != null ? _ref : null; + }, [node, id]); +} + +function useCombineActivators(sensors, getSyntheticHandler) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => sensors.reduce((accumulator, sensor) => { + const { + sensor: Sensor + } = sensor; + const sensorActivators = Sensor.activators.map(activator => ({ + eventName: activator.eventName, + handler: getSyntheticHandler(activator.handler, sensor) + })); + return [...accumulator, ...sensorActivators]; + }, []), [sensors, getSyntheticHandler]); +} + +var MeasuringStrategy; + +(function (MeasuringStrategy) { + MeasuringStrategy[MeasuringStrategy["Always"] = 0] = "Always"; + MeasuringStrategy[MeasuringStrategy["BeforeDragging"] = 1] = "BeforeDragging"; + MeasuringStrategy[MeasuringStrategy["WhileDragging"] = 2] = "WhileDragging"; +})(MeasuringStrategy || (MeasuringStrategy = {})); + +var MeasuringFrequency; + +(function (MeasuringFrequency) { + MeasuringFrequency["Optimized"] = "optimized"; +})(MeasuringFrequency || (MeasuringFrequency = {})); + +const defaultValue = /*#__PURE__*/new Map(); +function useDroppableMeasuring(containers, _ref) { + let { + dragging, + dependencies, + config + } = _ref; + const [queue, setQueue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const { + frequency, + measure, + strategy + } = config; + const containersRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(containers); + const disabled = isDisabled(); + const disabledRef = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(disabled); + const measureDroppableContainers = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (ids) { + if (ids === void 0) { + ids = []; + } + + if (disabledRef.current) { + return; + } + + setQueue(value => { + if (value === null) { + return ids; + } + + return value.concat(ids.filter(id => !value.includes(id))); + }); + }, [disabledRef]); + const timeoutId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const droppableRects = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(previousValue => { + if (disabled && !dragging) { + return defaultValue; + } + + if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) { + const map = new Map(); + + for (let container of containers) { + if (!container) { + continue; + } + + if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) { + // This container does not need to be re-measured + map.set(container.id, container.rect.current); + continue; + } + + const node = container.node.current; + const rect = node ? new Rect(measure(node), node) : null; + container.rect.current = rect; + + if (rect) { + map.set(container.id, rect); + } + } + + return map; + } + + return previousValue; + }, [containers, queue, dragging, disabled, measure]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + containersRef.current = containers; + }, [containers]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (disabled) { + return; + } + + measureDroppableContainers(); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [dragging, disabled]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (queue && queue.length > 0) { + setQueue(null); + } + }, //eslint-disable-next-line react-hooks/exhaustive-deps + [JSON.stringify(queue)]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (disabled || typeof frequency !== 'number' || timeoutId.current !== null) { + return; + } + + timeoutId.current = setTimeout(() => { + measureDroppableContainers(); + timeoutId.current = null; + }, frequency); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [frequency, disabled, measureDroppableContainers, ...dependencies]); + return { + droppableRects, + measureDroppableContainers, + measuringScheduled: queue != null + }; + + function isDisabled() { + switch (strategy) { + case MeasuringStrategy.Always: + return false; + + case MeasuringStrategy.BeforeDragging: + return dragging; + + default: + return !dragging; + } + } +} + +function useInitialValue(value, computeFn) { + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(previousValue => { + if (!value) { + return null; + } + + if (previousValue) { + return previousValue; + } + + return typeof computeFn === 'function' ? computeFn(value) : value; + }, [computeFn, value]); +} + +function useInitialRect(node, measure) { + return useInitialValue(node, measure); +} + +/** + * Returns a new MutationObserver instance. + * If `MutationObserver` is undefined in the execution environment, returns `undefined`. + */ + +function useMutationObserver(_ref) { + let { + callback, + disabled + } = _ref; + const handleMutations = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useEvent)(callback); + const mutationObserver = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (disabled || typeof window === 'undefined' || typeof window.MutationObserver === 'undefined') { + return undefined; + } + + const { + MutationObserver + } = window; + return new MutationObserver(handleMutations); + }, [handleMutations, disabled]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + return () => mutationObserver == null ? void 0 : mutationObserver.disconnect(); + }, [mutationObserver]); + return mutationObserver; +} + +/** + * Returns a new ResizeObserver instance bound to the `onResize` callback. + * If `ResizeObserver` is undefined in the execution environment, returns `undefined`. + */ + +function useResizeObserver(_ref) { + let { + callback, + disabled + } = _ref; + const handleResize = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useEvent)(callback); + const resizeObserver = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (disabled || typeof window === 'undefined' || typeof window.ResizeObserver === 'undefined') { + return undefined; + } + + const { + ResizeObserver + } = window; + return new ResizeObserver(handleResize); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [disabled]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + return () => resizeObserver == null ? void 0 : resizeObserver.disconnect(); + }, [resizeObserver]); + return resizeObserver; +} + +function defaultMeasure(element) { + return new Rect(getClientRect(element), element); +} + +function useRect(element, measure, fallbackRect) { + if (measure === void 0) { + measure = defaultMeasure; + } + + const [rect, measureRect] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(reducer, null); + const mutationObserver = useMutationObserver({ + callback(records) { + if (!element) { + return; + } + + for (const record of records) { + const { + type, + target + } = record; + + if (type === 'childList' && target instanceof HTMLElement && target.contains(element)) { + measureRect(); + break; + } + } + } + + }); + const resizeObserver = useResizeObserver({ + callback: measureRect + }); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + measureRect(); + + if (element) { + resizeObserver == null ? void 0 : resizeObserver.observe(element); + mutationObserver == null ? void 0 : mutationObserver.observe(document.body, { + childList: true, + subtree: true + }); + } else { + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + mutationObserver == null ? void 0 : mutationObserver.disconnect(); + } + }, [element]); + return rect; + + function reducer(currentRect) { + if (!element) { + return null; + } + + if (element.isConnected === false) { + var _ref; + + // Fall back to last rect we measured if the element is + // no longer connected to the DOM. + return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null; + } + + const newRect = measure(element); + + if (JSON.stringify(currentRect) === JSON.stringify(newRect)) { + return currentRect; + } + + return newRect; + } +} + +function useRectDelta(rect) { + const initialRect = useInitialValue(rect); + return getRectDelta(rect, initialRect); +} + +const defaultValue$1 = []; +function useScrollableAncestors(node) { + const previousNode = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(node); + const ancestors = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(previousValue => { + if (!node) { + return defaultValue$1; + } + + if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) { + return previousValue; + } + + return getScrollableAncestors(node); + }, [node]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + previousNode.current = node; + }, [node]); + return ancestors; +} + +function useScrollOffsets(elements) { + const [scrollCoordinates, setScrollCoordinates] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const prevElements = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(elements); // To-do: Throttle the handleScroll callback + + const handleScroll = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(event => { + const scrollingElement = getScrollableElement(event.target); + + if (!scrollingElement) { + return; + } + + setScrollCoordinates(scrollCoordinates => { + if (!scrollCoordinates) { + return null; + } + + scrollCoordinates.set(scrollingElement, getScrollCoordinates(scrollingElement)); + return new Map(scrollCoordinates); + }); + }, []); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const previousElements = prevElements.current; + + if (elements !== previousElements) { + cleanup(previousElements); + const entries = elements.map(element => { + const scrollableElement = getScrollableElement(element); + + if (scrollableElement) { + scrollableElement.addEventListener('scroll', handleScroll, { + passive: true + }); + return [scrollableElement, getScrollCoordinates(scrollableElement)]; + } + + return null; + }).filter(entry => entry != null); + setScrollCoordinates(entries.length ? new Map(entries) : null); + prevElements.current = elements; + } + + return () => { + cleanup(elements); + cleanup(previousElements); + }; + + function cleanup(elements) { + elements.forEach(element => { + const scrollableElement = getScrollableElement(element); + scrollableElement == null ? void 0 : scrollableElement.removeEventListener('scroll', handleScroll); + }); + } + }, [handleScroll, elements]); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (elements.length) { + return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements); + } + + return defaultCoordinates; + }, [elements, scrollCoordinates]); +} + +function useScrollOffsetsDelta(scrollOffsets, dependencies) { + if (dependencies === void 0) { + dependencies = []; + } + + const initialScrollOffsets = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + initialScrollOffsets.current = null; + }, // eslint-disable-next-line react-hooks/exhaustive-deps + dependencies); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const hasScrollOffsets = scrollOffsets !== defaultCoordinates; + + if (hasScrollOffsets && !initialScrollOffsets.current) { + initialScrollOffsets.current = scrollOffsets; + } + + if (!hasScrollOffsets && initialScrollOffsets.current) { + initialScrollOffsets.current = null; + } + }, [scrollOffsets]); + return initialScrollOffsets.current ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates; +} + +function useSensorSetup(sensors) { + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.canUseDOM) { + return; + } + + const teardownFns = sensors.map(_ref => { + let { + sensor + } = _ref; + return sensor.setup == null ? void 0 : sensor.setup(); + }); + return () => { + for (const teardown of teardownFns) { + teardown == null ? void 0 : teardown(); + } + }; + }, // TO-DO: Sensors length could theoretically change which would not be a valid dependency + // eslint-disable-next-line react-hooks/exhaustive-deps + sensors.map(_ref2 => { + let { + sensor + } = _ref2; + return sensor; + })); +} + +function useSyntheticListeners(listeners, id) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return listeners.reduce((acc, _ref) => { + let { + eventName, + handler + } = _ref; + + acc[eventName] = event => { + handler(event, id); + }; + + return acc; + }, {}); + }, [listeners, id]); +} + +function useWindowRect(element) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => element ? getWindowClientRect(element) : null, [element]); +} + +const defaultValue$2 = []; +function useRects(elements, measure) { + if (measure === void 0) { + measure = getClientRect; + } + + const [firstElement] = elements; + const windowRect = useWindowRect(firstElement ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(firstElement) : null); + const [rects, measureRects] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(reducer, defaultValue$2); + const resizeObserver = useResizeObserver({ + callback: measureRects + }); + + if (elements.length > 0 && rects === defaultValue$2) { + measureRects(); + } + + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (elements.length) { + elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element)); + } else { + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + measureRects(); + } + }, [elements]); + return rects; + + function reducer() { + if (!elements.length) { + return defaultValue$2; + } + + return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element)); + } +} + +function getMeasurableNode(node) { + if (!node) { + return null; + } + + if (node.children.length > 1) { + return node; + } + + const firstChild = node.children[0]; + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(firstChild) ? firstChild : node; +} + +function useDragOverlayMeasuring(_ref) { + let { + measure + } = _ref; + const [rect, setRect] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const handleResize = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(entries => { + for (const { + target + } of entries) { + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(target)) { + setRect(rect => { + const newRect = measure(target); + return rect ? { ...rect, + width: newRect.width, + height: newRect.height + } : newRect; + }); + break; + } + } + }, [measure]); + const resizeObserver = useResizeObserver({ + callback: handleResize + }); + const handleNodeChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(element => { + const node = getMeasurableNode(element); + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + + if (node) { + resizeObserver == null ? void 0 : resizeObserver.observe(node); + } + + setRect(node ? measure(node) : null); + }, [measure, resizeObserver]); + const [nodeRef, setRef] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useNodeRef)(handleNodeChange); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + nodeRef, + rect, + setRef + }), [rect, nodeRef, setRef]); +} + +const defaultSensors = [{ + sensor: PointerSensor, + options: {} +}, { + sensor: KeyboardSensor, + options: {} +}]; +const defaultData = { + current: {} +}; +const defaultMeasuringConfiguration = { + draggable: { + measure: getTransformAgnosticClientRect + }, + droppable: { + measure: getTransformAgnosticClientRect, + strategy: MeasuringStrategy.WhileDragging, + frequency: MeasuringFrequency.Optimized + }, + dragOverlay: { + measure: getClientRect + } +}; + +class DroppableContainersMap extends Map { + get(id) { + var _super$get; + + return id != null ? (_super$get = super.get(id)) != null ? _super$get : undefined : undefined; + } + + toArray() { + return Array.from(this.values()); + } + + getEnabled() { + return this.toArray().filter(_ref => { + let { + disabled + } = _ref; + return !disabled; + }); + } + + getNodeFor(id) { + var _this$get$node$curren, _this$get; + + return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : undefined; + } + +} + +const defaultPublicContext = { + activatorEvent: null, + active: null, + activeNode: null, + activeNodeRect: null, + collisions: null, + containerNodeRect: null, + draggableNodes: /*#__PURE__*/new Map(), + droppableRects: /*#__PURE__*/new Map(), + droppableContainers: /*#__PURE__*/new DroppableContainersMap(), + over: null, + dragOverlay: { + nodeRef: { + current: null + }, + rect: null, + setRef: noop + }, + scrollableAncestors: [], + scrollableAncestorRects: [], + measuringConfiguration: defaultMeasuringConfiguration, + measureDroppableContainers: noop, + windowRect: null, + measuringScheduled: false +}; +const defaultInternalContext = { + activatorEvent: null, + activators: [], + active: null, + activeNodeRect: null, + ariaDescribedById: { + draggable: '' + }, + dispatch: noop, + draggableNodes: /*#__PURE__*/new Map(), + over: null, + measureDroppableContainers: noop +}; +const InternalContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(defaultInternalContext); +const PublicContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(defaultPublicContext); + +function getInitialState() { + return { + draggable: { + active: null, + initialCoordinates: { + x: 0, + y: 0 + }, + nodes: new Map(), + translate: { + x: 0, + y: 0 + } + }, + droppable: { + containers: new DroppableContainersMap() + } + }; +} +function reducer(state, action) { + switch (action.type) { + case Action.DragStart: + return { ...state, + draggable: { ...state.draggable, + initialCoordinates: action.initialCoordinates, + active: action.active + } + }; + + case Action.DragMove: + if (!state.draggable.active) { + return state; + } + + return { ...state, + draggable: { ...state.draggable, + translate: { + x: action.coordinates.x - state.draggable.initialCoordinates.x, + y: action.coordinates.y - state.draggable.initialCoordinates.y + } + } + }; + + case Action.DragEnd: + case Action.DragCancel: + return { ...state, + draggable: { ...state.draggable, + active: null, + initialCoordinates: { + x: 0, + y: 0 + }, + translate: { + x: 0, + y: 0 + } + } + }; + + case Action.RegisterDroppable: + { + const { + element + } = action; + const { + id + } = element; + const containers = new DroppableContainersMap(state.droppable.containers); + containers.set(id, element); + return { ...state, + droppable: { ...state.droppable, + containers + } + }; + } + + case Action.SetDroppableDisabled: + { + const { + id, + key, + disabled + } = action; + const element = state.droppable.containers.get(id); + + if (!element || key !== element.key) { + return state; + } + + const containers = new DroppableContainersMap(state.droppable.containers); + containers.set(id, { ...element, + disabled + }); + return { ...state, + droppable: { ...state.droppable, + containers + } + }; + } + + case Action.UnregisterDroppable: + { + const { + id, + key + } = action; + const element = state.droppable.containers.get(id); + + if (!element || key !== element.key) { + return state; + } + + const containers = new DroppableContainersMap(state.droppable.containers); + containers.delete(id); + return { ...state, + droppable: { ...state.droppable, + containers + } + }; + } + + default: + { + return state; + } + } +} + +function RestoreFocus(_ref) { + let { + disabled + } = _ref; + const { + active, + activatorEvent, + draggableNodes + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(InternalContext); + const previousActivatorEvent = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.usePrevious)(activatorEvent); + const previousActiveId = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.usePrevious)(active == null ? void 0 : active.id); // Restore keyboard focus on the activator node + + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (disabled) { + return; + } + + if (!activatorEvent && previousActivatorEvent && previousActiveId != null) { + if (!(0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isKeyboardEvent)(previousActivatorEvent)) { + return; + } + + if (document.activeElement === previousActivatorEvent.target) { + // No need to restore focus + return; + } + + const draggableNode = draggableNodes.get(previousActiveId); + + if (!draggableNode) { + return; + } + + const { + activatorNode, + node + } = draggableNode; + + if (!activatorNode.current && !node.current) { + return; + } + + requestAnimationFrame(() => { + for (const element of [activatorNode.current, node.current]) { + if (!element) { + continue; + } + + const focusableNode = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.findFirstFocusableNode)(element); + + if (focusableNode) { + focusableNode.focus(); + break; + } + } + }); + } + }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]); + return null; +} + +function applyModifiers(modifiers, _ref) { + let { + transform, + ...args + } = _ref; + return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => { + return modifier({ + transform: accumulator, + ...args + }); + }, transform) : transform; +} + +function useMeasuringConfiguration(config) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + draggable: { ...defaultMeasuringConfiguration.draggable, + ...(config == null ? void 0 : config.draggable) + }, + droppable: { ...defaultMeasuringConfiguration.droppable, + ...(config == null ? void 0 : config.droppable) + }, + dragOverlay: { ...defaultMeasuringConfiguration.dragOverlay, + ...(config == null ? void 0 : config.dragOverlay) + } + }), // eslint-disable-next-line react-hooks/exhaustive-deps + [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay]); +} + +function useLayoutShiftScrollCompensation(_ref) { + let { + activeNode, + measure, + initialRect, + config = true + } = _ref; + const initialized = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + const { + x, + y + } = typeof config === 'boolean' ? { + x: config, + y: config + } : config; + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + const disabled = !x && !y; + + if (disabled || !activeNode) { + initialized.current = false; + return; + } + + if (initialized.current || !initialRect) { + // Return early if layout shift scroll compensation was already attempted + // or if there is no initialRect to compare to. + return; + } // Get the most up to date node ref for the active draggable + + + const node = activeNode == null ? void 0 : activeNode.node.current; + + if (!node || node.isConnected === false) { + // Return early if there is no attached node ref or if the node is + // disconnected from the document. + return; + } + + const rect = measure(node); + const rectDelta = getRectDelta(rect, initialRect); + + if (!x) { + rectDelta.x = 0; + } + + if (!y) { + rectDelta.y = 0; + } // Only perform layout shift scroll compensation once + + + initialized.current = true; + + if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) { + const firstScrollableAncestor = getFirstScrollableAncestor(node); + + if (firstScrollableAncestor) { + firstScrollableAncestor.scrollBy({ + top: rectDelta.y, + left: rectDelta.x + }); + } + } + }, [activeNode, x, y, initialRect, measure]); +} + +const ActiveDraggableContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({ ...defaultCoordinates, + scaleX: 1, + scaleY: 1 +}); +var Status; + +(function (Status) { + Status[Status["Uninitialized"] = 0] = "Uninitialized"; + Status[Status["Initializing"] = 1] = "Initializing"; + Status[Status["Initialized"] = 2] = "Initialized"; +})(Status || (Status = {})); + +const DndContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)(function DndContext(_ref) { + var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect; + + let { + id, + accessibility, + autoScroll = true, + children, + sensors = defaultSensors, + collisionDetection = rectIntersection, + measuring, + modifiers, + ...props + } = _ref; + const store = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(reducer, undefined, getInitialState); + const [state, dispatch] = store; + const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider(); + const [status, setStatus] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(Status.Uninitialized); + const isInitialized = status === Status.Initialized; + const { + draggable: { + active: activeId, + nodes: draggableNodes, + translate + }, + droppable: { + containers: droppableContainers + } + } = state; + const node = activeId ? draggableNodes.get(activeId) : null; + const activeRects = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + initial: null, + translated: null + }); + const active = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + var _node$data; + + return activeId != null ? { + id: activeId, + // It's possible for the active node to unmount while dragging + data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData, + rect: activeRects + } : null; + }, [activeId, node]); + const activeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const [activeSensor, setActiveSensor] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const [activatorEvent, setActivatorEvent] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const latestProps = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(props, Object.values(props)); + const draggableDescribedById = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)("DndDescribedBy", id); + const enabledDroppableContainers = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => droppableContainers.getEnabled(), [droppableContainers]); + const measuringConfiguration = useMeasuringConfiguration(measuring); + const { + droppableRects, + measureDroppableContainers, + measuringScheduled + } = useDroppableMeasuring(enabledDroppableContainers, { + dragging: isInitialized, + dependencies: [translate.x, translate.y], + config: measuringConfiguration.droppable + }); + const activeNode = useCachedNode(draggableNodes, activeId); + const activationCoordinates = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => activatorEvent ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getEventCoordinates)(activatorEvent) : null, [activatorEvent]); + const autoScrollOptions = getAutoScrollerOptions(); + const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure); + useLayoutShiftScrollCompensation({ + activeNode: activeId ? draggableNodes.get(activeId) : null, + config: autoScrollOptions.layoutShiftCompensation, + initialRect: initialActiveNodeRect, + measure: measuringConfiguration.draggable.measure + }); + const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect); + const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null); + const sensorContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + activatorEvent: null, + active: null, + activeNode, + collisionRect: null, + collisions: null, + droppableRects, + draggableNodes, + draggingNode: null, + draggingNodeRect: null, + droppableContainers, + over: null, + scrollableAncestors: [], + scrollAdjustedTranslate: null + }); + const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id); + const dragOverlay = useDragOverlayMeasuring({ + measure: measuringConfiguration.dragOverlay.measure + }); // Use the rect of the drag overlay if it is mounted + + const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode; + const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null; + const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); // The delta between the previous and new position of the draggable node + // is only relevant when there is no drag overlay + + const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); // Get the window rect of the dragging node + + const windowRect = useWindowRect(draggingNode ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(draggingNode) : null); // Get scrollable ancestors of the dragging node + + const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null); + const scrollableAncestorRects = useRects(scrollableAncestors); // Apply modifiers + + const modifiedTranslate = applyModifiers(modifiers, { + transform: { + x: translate.x - nodeRectDelta.x, + y: translate.y - nodeRectDelta.y, + scaleX: 1, + scaleY: 1 + }, + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggingNodeRect, + over: sensorContext.current.over, + overlayNodeRect: dragOverlay.rect, + scrollableAncestors, + scrollableAncestorRects, + windowRect + }); + const pointerCoordinates = activationCoordinates ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(activationCoordinates, translate) : null; + const scrollOffsets = useScrollOffsets(scrollableAncestors); // Represents the scroll delta since dragging was initiated + + const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); // Represents the scroll delta since the last time the active node rect was measured + + const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]); + const scrollAdjustedTranslate = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(modifiedTranslate, scrollAdjustment); + const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null; + const collisions = active && collisionRect ? collisionDetection({ + active, + collisionRect, + droppableRects, + droppableContainers: enabledDroppableContainers, + pointerCoordinates + }) : null; + const overId = getFirstCollision(collisions, 'id'); + const [over, setOver] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); // When there is no drag overlay used, we need to account for the + // window scroll delta + + const appliedTranslate = usesDragOverlay ? modifiedTranslate : (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(modifiedTranslate, activeNodeScrollDelta); + const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect); + const instantiateSensor = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((event, _ref2) => { + let { + sensor: Sensor, + options + } = _ref2; + + if (activeRef.current == null) { + return; + } + + const activeNode = draggableNodes.get(activeRef.current); + + if (!activeNode) { + return; + } + + const activatorEvent = event.nativeEvent; + const sensorInstance = new Sensor({ + active: activeRef.current, + activeNode, + event: activatorEvent, + options, + // Sensors need to be instantiated with refs for arguments that change over time + // otherwise they are frozen in time with the stale arguments + context: sensorContext, + + onStart(initialCoordinates) { + const id = activeRef.current; + + if (id == null) { + return; + } + + const draggableNode = draggableNodes.get(id); + + if (!draggableNode) { + return; + } + + const { + onDragStart + } = latestProps.current; + const event = { + active: { + id, + data: draggableNode.data, + rect: activeRects + } + }; + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + onDragStart == null ? void 0 : onDragStart(event); + setStatus(Status.Initializing); + dispatch({ + type: Action.DragStart, + initialCoordinates, + active: id + }); + dispatchMonitorEvent({ + type: 'onDragStart', + event + }); + }); + }, + + onMove(coordinates) { + dispatch({ + type: Action.DragMove, + coordinates + }); + }, + + onEnd: createHandler(Action.DragEnd), + onCancel: createHandler(Action.DragCancel) + }); + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + setActiveSensor(sensorInstance); + setActivatorEvent(event.nativeEvent); + }); + + function createHandler(type) { + return async function handler() { + const { + active, + collisions, + over, + scrollAdjustedTranslate + } = sensorContext.current; + let event = null; + + if (active && scrollAdjustedTranslate) { + const { + cancelDrop + } = latestProps.current; + event = { + activatorEvent, + active: active, + collisions, + delta: scrollAdjustedTranslate, + over + }; + + if (type === Action.DragEnd && typeof cancelDrop === 'function') { + const shouldCancel = await Promise.resolve(cancelDrop(event)); + + if (shouldCancel) { + type = Action.DragCancel; + } + } + } + + activeRef.current = null; + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + dispatch({ + type + }); + setStatus(Status.Uninitialized); + setOver(null); + setActiveSensor(null); + setActivatorEvent(null); + const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel'; + + if (event) { + const handler = latestProps.current[eventName]; + handler == null ? void 0 : handler(event); + dispatchMonitorEvent({ + type: eventName, + event + }); + } + }); + }; + } + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [draggableNodes]); + const bindActivatorToSensorInstantiator = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((handler, sensor) => { + return (event, active) => { + const nativeEvent = event.nativeEvent; + const activeDraggableNode = draggableNodes.get(active); + + if ( // Another sensor is already instantiating + activeRef.current !== null || // No active draggable + !activeDraggableNode || // Event has already been captured + nativeEvent.dndKit || nativeEvent.defaultPrevented) { + return; + } + + const activationContext = { + active: activeDraggableNode + }; + const shouldActivate = handler(event, sensor.options, activationContext); + + if (shouldActivate === true) { + nativeEvent.dndKit = { + capturedBy: sensor.sensor + }; + activeRef.current = active; + instantiateSensor(event, sensor); + } + }; + }, [draggableNodes, instantiateSensor]); + const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator); + useSensorSetup(sensors); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (activeNodeRect && status === Status.Initializing) { + setStatus(Status.Initialized); + } + }, [activeNodeRect, status]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const { + onDragMove + } = latestProps.current; + const { + active, + activatorEvent, + collisions, + over + } = sensorContext.current; + + if (!active || !activatorEvent) { + return; + } + + const event = { + active, + activatorEvent, + collisions, + delta: { + x: scrollAdjustedTranslate.x, + y: scrollAdjustedTranslate.y + }, + over + }; + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + onDragMove == null ? void 0 : onDragMove(event); + dispatchMonitorEvent({ + type: 'onDragMove', + event + }); + }); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const { + active, + activatorEvent, + collisions, + droppableContainers, + scrollAdjustedTranslate + } = sensorContext.current; + + if (!active || activeRef.current == null || !activatorEvent || !scrollAdjustedTranslate) { + return; + } + + const { + onDragOver + } = latestProps.current; + const overContainer = droppableContainers.get(overId); + const over = overContainer && overContainer.rect.current ? { + id: overContainer.id, + rect: overContainer.rect.current, + data: overContainer.data, + disabled: overContainer.disabled + } : null; + const event = { + active, + activatorEvent, + collisions, + delta: { + x: scrollAdjustedTranslate.x, + y: scrollAdjustedTranslate.y + }, + over + }; + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + setOver(over); + onDragOver == null ? void 0 : onDragOver(event); + dispatchMonitorEvent({ + type: 'onDragOver', + event + }); + }); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [overId]); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + sensorContext.current = { + activatorEvent, + active, + activeNode, + collisionRect, + collisions, + droppableRects, + draggableNodes, + draggingNode, + draggingNodeRect, + droppableContainers, + over, + scrollableAncestors, + scrollAdjustedTranslate + }; + activeRects.current = { + initial: draggingNodeRect, + translated: collisionRect + }; + }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]); + useAutoScroller({ ...autoScrollOptions, + delta: translate, + draggingRect: collisionRect, + pointerCoordinates, + scrollableAncestors, + scrollableAncestorRects + }); + const publicContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + const context = { + active, + activeNode, + activeNodeRect, + activatorEvent, + collisions, + containerNodeRect, + dragOverlay, + draggableNodes, + droppableContainers, + droppableRects, + over, + measureDroppableContainers, + scrollableAncestors, + scrollableAncestorRects, + measuringConfiguration, + measuringScheduled, + windowRect + }; + return context; + }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]); + const internalContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + const context = { + activatorEvent, + activators, + active, + activeNodeRect, + ariaDescribedById: { + draggable: draggableDescribedById + }, + dispatch, + draggableNodes, + over, + measureDroppableContainers + }; + return context; + }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]); + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(DndMonitorContext.Provider, { + value: registerMonitorListener + }, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(InternalContext.Provider, { + value: internalContext + }, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PublicContext.Provider, { + value: publicContext + }, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ActiveDraggableContext.Provider, { + value: transform + }, children)), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(RestoreFocus, { + disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false + })), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Accessibility, { ...accessibility, + hiddenTextDescribedById: draggableDescribedById + })); + + function getAutoScrollerOptions() { + const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false; + const autoScrollGloballyDisabled = typeof autoScroll === 'object' ? autoScroll.enabled === false : autoScroll === false; + const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled; + + if (typeof autoScroll === 'object') { + return { ...autoScroll, + enabled + }; + } + + return { + enabled + }; + } +}); + +const NullContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null); +const defaultRole = 'button'; +const ID_PREFIX = 'Droppable'; +function useDraggable(_ref) { + let { + id, + data, + disabled = false, + attributes + } = _ref; + const key = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)(ID_PREFIX); + const { + activators, + activatorEvent, + active, + activeNodeRect, + ariaDescribedById, + draggableNodes, + over + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(InternalContext); + const { + role = defaultRole, + roleDescription = 'draggable', + tabIndex = 0 + } = attributes != null ? attributes : {}; + const isDragging = (active == null ? void 0 : active.id) === id; + const transform = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(isDragging ? ActiveDraggableContext : NullContext); + const [node, setNodeRef] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useNodeRef)(); + const [activatorNode, setActivatorNodeRef] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useNodeRef)(); + const listeners = useSyntheticListeners(activators, id); + const dataRef = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(data); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + draggableNodes.set(id, { + id, + key, + node, + activatorNode, + data: dataRef + }); + return () => { + const node = draggableNodes.get(id); + + if (node && node.key === key) { + draggableNodes.delete(id); + } + }; + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [draggableNodes, id]); + const memoizedAttributes = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + role, + tabIndex, + 'aria-disabled': disabled, + 'aria-pressed': isDragging && role === defaultRole ? true : undefined, + 'aria-roledescription': roleDescription, + 'aria-describedby': ariaDescribedById.draggable + }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]); + return { + active, + activatorEvent, + activeNodeRect, + attributes: memoizedAttributes, + isDragging, + listeners: disabled ? undefined : listeners, + node, + over, + setNodeRef, + setActivatorNodeRef, + transform + }; +} + +function useDndContext() { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(PublicContext); +} + +const ID_PREFIX$1 = 'Droppable'; +const defaultResizeObserverConfig = { + timeout: 25 +}; +function useDroppable(_ref) { + let { + data, + disabled = false, + id, + resizeObserverConfig + } = _ref; + const key = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)(ID_PREFIX$1); + const { + active, + dispatch, + over, + measureDroppableContainers + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(InternalContext); + const previous = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + disabled + }); + const resizeObserverConnected = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + const rect = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const callbackId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const { + disabled: resizeObserverDisabled, + updateMeasurementsFor, + timeout: resizeObserverTimeout + } = { ...defaultResizeObserverConfig, + ...resizeObserverConfig + }; + const ids = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(updateMeasurementsFor != null ? updateMeasurementsFor : id); + const handleResize = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + if (!resizeObserverConnected.current) { + // ResizeObserver invokes the `handleResize` callback as soon as `observe` is called, + // assuming the element is rendered and displayed. + resizeObserverConnected.current = true; + return; + } + + if (callbackId.current != null) { + clearTimeout(callbackId.current); + } + + callbackId.current = setTimeout(() => { + measureDroppableContainers(Array.isArray(ids.current) ? ids.current : [ids.current]); + callbackId.current = null; + }, resizeObserverTimeout); + }, //eslint-disable-next-line react-hooks/exhaustive-deps + [resizeObserverTimeout]); + const resizeObserver = useResizeObserver({ + callback: handleResize, + disabled: resizeObserverDisabled || !active + }); + const handleNodeChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((newElement, previousElement) => { + if (!resizeObserver) { + return; + } + + if (previousElement) { + resizeObserver.unobserve(previousElement); + resizeObserverConnected.current = false; + } + + if (newElement) { + resizeObserver.observe(newElement); + } + }, [resizeObserver]); + const [nodeRef, setNodeRef] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useNodeRef)(handleNodeChange); + const dataRef = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(data); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!resizeObserver || !nodeRef.current) { + return; + } + + resizeObserver.disconnect(); + resizeObserverConnected.current = false; + resizeObserver.observe(nodeRef.current); + }, [nodeRef, resizeObserver]); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + dispatch({ + type: Action.RegisterDroppable, + element: { + id, + key, + disabled, + node: nodeRef, + rect, + data: dataRef + } + }); + return () => dispatch({ + type: Action.UnregisterDroppable, + key, + id + }); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [id]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (disabled !== previous.current.disabled) { + dispatch({ + type: Action.SetDroppableDisabled, + id, + key, + disabled + }); + previous.current.disabled = disabled; + } + }, [id, key, disabled, dispatch]); + return { + active, + rect, + isOver: (over == null ? void 0 : over.id) === id, + node: nodeRef, + over, + setNodeRef + }; +} + +function AnimationManager(_ref) { + let { + animation, + children + } = _ref; + const [clonedChildren, setClonedChildren] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const [element, setElement] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const previousChildren = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.usePrevious)(children); + + if (!children && !clonedChildren && previousChildren) { + setClonedChildren(previousChildren); + } + + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (!element) { + return; + } + + const key = clonedChildren == null ? void 0 : clonedChildren.key; + const id = clonedChildren == null ? void 0 : clonedChildren.props.id; + + if (key == null || id == null) { + setClonedChildren(null); + return; + } + + Promise.resolve(animation(id, element)).then(() => { + setClonedChildren(null); + }); + }, [animation, clonedChildren, element]); + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, children, clonedChildren ? (0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(clonedChildren, { + ref: setElement + }) : null); +} + +const defaultTransform = { + x: 0, + y: 0, + scaleX: 1, + scaleY: 1 +}; +function NullifiedContextProvider(_ref) { + let { + children + } = _ref; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(InternalContext.Provider, { + value: defaultInternalContext + }, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ActiveDraggableContext.Provider, { + value: defaultTransform + }, children)); +} + +const baseStyles = { + position: 'fixed', + touchAction: 'none' +}; + +const defaultTransition = activatorEvent => { + const isKeyboardActivator = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isKeyboardEvent)(activatorEvent); + return isKeyboardActivator ? 'transform 250ms ease' : undefined; +}; + +const PositionedOverlay = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)((_ref, ref) => { + let { + as, + activatorEvent, + adjustScale, + children, + className, + rect, + style, + transform, + transition = defaultTransition + } = _ref; + + if (!rect) { + return null; + } + + const scaleAdjustedTransform = adjustScale ? transform : { ...transform, + scaleX: 1, + scaleY: 1 + }; + const styles = { ...baseStyles, + width: rect.width, + height: rect.height, + top: rect.top, + left: rect.left, + transform: _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transform.toString(scaleAdjustedTransform), + transformOrigin: adjustScale && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : undefined, + transition: typeof transition === 'function' ? transition(activatorEvent) : transition, + ...style + }; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(as, { + className, + style: styles, + ref + }, children); +}); + +const defaultDropAnimationSideEffects = options => _ref => { + let { + active, + dragOverlay + } = _ref; + const originalStyles = {}; + const { + styles, + className + } = options; + + if (styles != null && styles.active) { + for (const [key, value] of Object.entries(styles.active)) { + if (value === undefined) { + continue; + } + + originalStyles[key] = active.node.style.getPropertyValue(key); + active.node.style.setProperty(key, value); + } + } + + if (styles != null && styles.dragOverlay) { + for (const [key, value] of Object.entries(styles.dragOverlay)) { + if (value === undefined) { + continue; + } + + dragOverlay.node.style.setProperty(key, value); + } + } + + if (className != null && className.active) { + active.node.classList.add(className.active); + } + + if (className != null && className.dragOverlay) { + dragOverlay.node.classList.add(className.dragOverlay); + } + + return function cleanup() { + for (const [key, value] of Object.entries(originalStyles)) { + active.node.style.setProperty(key, value); + } + + if (className != null && className.active) { + active.node.classList.remove(className.active); + } + }; +}; + +const defaultKeyframeResolver = _ref2 => { + let { + transform: { + initial, + final + } + } = _ref2; + return [{ + transform: _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transform.toString(initial) + }, { + transform: _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transform.toString(final) + }]; +}; + +const defaultDropAnimationConfiguration = { + duration: 250, + easing: 'ease', + keyframes: defaultKeyframeResolver, + sideEffects: /*#__PURE__*/defaultDropAnimationSideEffects({ + styles: { + active: { + opacity: '0' + } + } + }) +}; +function useDropAnimation(_ref3) { + let { + config, + draggableNodes, + droppableContainers, + measuringConfiguration + } = _ref3; + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useEvent)((id, node) => { + if (config === null) { + return; + } + + const activeDraggable = draggableNodes.get(id); + + if (!activeDraggable) { + return; + } + + const activeNode = activeDraggable.node.current; + + if (!activeNode) { + return; + } + + const measurableNode = getMeasurableNode(node); + + if (!measurableNode) { + return; + } + + const { + transform + } = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(node).getComputedStyle(node); + const parsedTransform = parseTransform(transform); + + if (!parsedTransform) { + return; + } + + const animation = typeof config === 'function' ? config : createDefaultDropAnimation(config); + scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure); + return animation({ + active: { + id, + data: activeDraggable.data, + node: activeNode, + rect: measuringConfiguration.draggable.measure(activeNode) + }, + draggableNodes, + dragOverlay: { + node, + rect: measuringConfiguration.dragOverlay.measure(measurableNode) + }, + droppableContainers, + measuringConfiguration, + transform: parsedTransform + }); + }); +} + +function createDefaultDropAnimation(options) { + const { + duration, + easing, + sideEffects, + keyframes + } = { ...defaultDropAnimationConfiguration, + ...options + }; + return _ref4 => { + let { + active, + dragOverlay, + transform, + ...rest + } = _ref4; + + if (!duration) { + // Do not animate if animation duration is zero. + return; + } + + const delta = { + x: dragOverlay.rect.left - active.rect.left, + y: dragOverlay.rect.top - active.rect.top + }; + const scale = { + scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1, + scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1 + }; + const finalTransform = { + x: transform.x - delta.x, + y: transform.y - delta.y, + ...scale + }; + const animationKeyframes = keyframes({ ...rest, + active, + dragOverlay, + transform: { + initial: transform, + final: finalTransform + } + }); + const [firstKeyframe] = animationKeyframes; + const lastKeyframe = animationKeyframes[animationKeyframes.length - 1]; + + if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) { + // The start and end keyframes are the same, infer that there is no animation needed. + return; + } + + const cleanup = sideEffects == null ? void 0 : sideEffects({ + active, + dragOverlay, + ...rest + }); + const animation = dragOverlay.node.animate(animationKeyframes, { + duration, + easing, + fill: 'forwards' + }); + return new Promise(resolve => { + animation.onfinish = () => { + cleanup == null ? void 0 : cleanup(); + resolve(); + }; + }); + }; +} + +let key = 0; +function useKey(id) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (id == null) { + return; + } + + key++; + return key; + }, [id]); +} + +const DragOverlay = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().memo(_ref => { + let { + adjustScale = false, + children, + dropAnimation: dropAnimationConfig, + style, + transition, + modifiers, + wrapperElement = 'div', + className, + zIndex = 999 + } = _ref; + const { + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggableNodes, + droppableContainers, + dragOverlay, + over, + measuringConfiguration, + scrollableAncestors, + scrollableAncestorRects, + windowRect + } = useDndContext(); + const transform = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ActiveDraggableContext); + const key = useKey(active == null ? void 0 : active.id); + const modifiedTransform = applyModifiers(modifiers, { + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggingNodeRect: dragOverlay.rect, + over, + overlayNodeRect: dragOverlay.rect, + scrollableAncestors, + scrollableAncestorRects, + transform, + windowRect + }); + const initialRect = useInitialValue(activeNodeRect); + const dropAnimation = useDropAnimation({ + config: dropAnimationConfig, + draggableNodes, + droppableContainers, + measuringConfiguration + }); // We need to wait for the active node to be measured before connecting the drag overlay ref + // otherwise collisions can be computed against a mispositioned drag overlay + + const ref = initialRect ? dragOverlay.setRef : undefined; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(NullifiedContextProvider, null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(AnimationManager, { + animation: dropAnimation + }, active && key ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PositionedOverlay, { + key: key, + id: active.id, + ref: ref, + as: wrapperElement, + activatorEvent: activatorEvent, + adjustScale: adjustScale, + className: className, + transition: transition, + rect: initialRect, + style: { + zIndex, + ...style + }, + transform: modifiedTransform + }, children) : null)); +}); + + +//# sourceMappingURL=core.esm.js.map + + +/***/ }), + +/***/ "./node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js": +/*!***************************************************************!*\ + !*** ./node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "createSnapModifier": function() { return /* binding */ createSnapModifier; }, +/* harmony export */ "restrictToFirstScrollableAncestor": function() { return /* binding */ restrictToFirstScrollableAncestor; }, +/* harmony export */ "restrictToHorizontalAxis": function() { return /* binding */ restrictToHorizontalAxis; }, +/* harmony export */ "restrictToParentElement": function() { return /* binding */ restrictToParentElement; }, +/* harmony export */ "restrictToVerticalAxis": function() { return /* binding */ restrictToVerticalAxis; }, +/* harmony export */ "restrictToWindowEdges": function() { return /* binding */ restrictToWindowEdges; }, +/* harmony export */ "snapCenterToCursor": function() { return /* binding */ snapCenterToCursor; } +/* harmony export */ }); +/* harmony import */ var _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @dnd-kit/utilities */ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js"); + + +function createSnapModifier(gridSize) { + return _ref => { + let { + transform + } = _ref; + return { ...transform, + x: Math.ceil(transform.x / gridSize) * gridSize, + y: Math.ceil(transform.y / gridSize) * gridSize + }; + }; +} + +const restrictToHorizontalAxis = _ref => { + let { + transform + } = _ref; + return { ...transform, + y: 0 + }; +}; + +function restrictToBoundingRect(transform, rect, boundingRect) { + const value = { ...transform + }; + + if (rect.top + transform.y <= boundingRect.top) { + value.y = boundingRect.top - rect.top; + } else if (rect.bottom + transform.y >= boundingRect.top + boundingRect.height) { + value.y = boundingRect.top + boundingRect.height - rect.bottom; + } + + if (rect.left + transform.x <= boundingRect.left) { + value.x = boundingRect.left - rect.left; + } else if (rect.right + transform.x >= boundingRect.left + boundingRect.width) { + value.x = boundingRect.left + boundingRect.width - rect.right; + } + + return value; +} + +const restrictToParentElement = _ref => { + let { + containerNodeRect, + draggingNodeRect, + transform + } = _ref; + + if (!draggingNodeRect || !containerNodeRect) { + return transform; + } + + return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect); +}; + +const restrictToFirstScrollableAncestor = _ref => { + let { + draggingNodeRect, + transform, + scrollableAncestorRects + } = _ref; + const firstScrollableAncestorRect = scrollableAncestorRects[0]; + + if (!draggingNodeRect || !firstScrollableAncestorRect) { + return transform; + } + + return restrictToBoundingRect(transform, draggingNodeRect, firstScrollableAncestorRect); +}; + +const restrictToVerticalAxis = _ref => { + let { + transform + } = _ref; + return { ...transform, + x: 0 + }; +}; + +const restrictToWindowEdges = _ref => { + let { + transform, + draggingNodeRect, + windowRect + } = _ref; + + if (!draggingNodeRect || !windowRect) { + return transform; + } + + return restrictToBoundingRect(transform, draggingNodeRect, windowRect); +}; + +const snapCenterToCursor = _ref => { + let { + activatorEvent, + draggingNodeRect, + transform + } = _ref; + + if (draggingNodeRect && activatorEvent) { + const activatorCoordinates = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_0__.getEventCoordinates)(activatorEvent); + + if (!activatorCoordinates) { + return transform; + } + + const offsetX = activatorCoordinates.x - draggingNodeRect.left; + const offsetY = activatorCoordinates.y - draggingNodeRect.top; + return { ...transform, + x: transform.x + offsetX - draggingNodeRect.width / 2, + y: transform.y + offsetY - draggingNodeRect.height / 2 + }; + } + + return transform; +}; + + +//# sourceMappingURL=modifiers.esm.js.map + + +/***/ }), + +/***/ "./node_modules/@dnd-kit/sortable/dist/sortable.esm.js": +/*!*************************************************************!*\ + !*** ./node_modules/@dnd-kit/sortable/dist/sortable.esm.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "SortableContext": function() { return /* binding */ SortableContext; }, +/* harmony export */ "arrayMove": function() { return /* binding */ arrayMove; }, +/* harmony export */ "arraySwap": function() { return /* binding */ arraySwap; }, +/* harmony export */ "defaultAnimateLayoutChanges": function() { return /* binding */ defaultAnimateLayoutChanges; }, +/* harmony export */ "defaultNewIndexGetter": function() { return /* binding */ defaultNewIndexGetter; }, +/* harmony export */ "hasSortableData": function() { return /* binding */ hasSortableData; }, +/* harmony export */ "horizontalListSortingStrategy": function() { return /* binding */ horizontalListSortingStrategy; }, +/* harmony export */ "rectSortingStrategy": function() { return /* binding */ rectSortingStrategy; }, +/* harmony export */ "rectSwappingStrategy": function() { return /* binding */ rectSwappingStrategy; }, +/* harmony export */ "sortableKeyboardCoordinates": function() { return /* binding */ sortableKeyboardCoordinates; }, +/* harmony export */ "useSortable": function() { return /* binding */ useSortable; }, +/* harmony export */ "verticalListSortingStrategy": function() { return /* binding */ verticalListSortingStrategy; } +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dnd-kit/core */ "./node_modules/@dnd-kit/core/dist/core.esm.js"); +/* harmony import */ var _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @dnd-kit/utilities */ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js"); + + + + +/** + * Move an array item to a different position. Returns a new array with the item moved to the new position. + */ +function arrayMove(array, from, to) { + const newArray = array.slice(); + newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]); + return newArray; +} + +/** + * Swap an array item to a different position. Returns a new array with the item swapped to the new position. + */ +function arraySwap(array, from, to) { + const newArray = array.slice(); + newArray[from] = array[to]; + newArray[to] = array[from]; + return newArray; +} + +function getSortedRects(items, rects) { + return items.reduce((accumulator, id, index) => { + const rect = rects.get(id); + + if (rect) { + accumulator[index] = rect; + } + + return accumulator; + }, Array(items.length)); +} + +function isValidIndex(index) { + return index !== null && index >= 0; +} + +function itemsEqual(a, b) { + if (a === b) { + return true; + } + + if (a.length !== b.length) { + return false; + } + + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + + return true; +} + +function normalizeDisabled(disabled) { + if (typeof disabled === 'boolean') { + return { + draggable: disabled, + droppable: disabled + }; + } + + return disabled; +} + +// To-do: We should be calculating scale transformation +const defaultScale = { + scaleX: 1, + scaleY: 1 +}; +const horizontalListSortingStrategy = _ref => { + var _rects$activeIndex; + + let { + rects, + activeNodeRect: fallbackActiveRect, + activeIndex, + overIndex, + index + } = _ref; + const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect; + + if (!activeNodeRect) { + return null; + } + + const itemGap = getItemGap(rects, index, activeIndex); + + if (index === activeIndex) { + const newIndexRect = rects[overIndex]; + + if (!newIndexRect) { + return null; + } + + return { + x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left, + y: 0, + ...defaultScale + }; + } + + if (index > activeIndex && index <= overIndex) { + return { + x: -activeNodeRect.width - itemGap, + y: 0, + ...defaultScale + }; + } + + if (index < activeIndex && index >= overIndex) { + return { + x: activeNodeRect.width + itemGap, + y: 0, + ...defaultScale + }; + } + + return { + x: 0, + y: 0, + ...defaultScale + }; +}; + +function getItemGap(rects, index, activeIndex) { + const currentRect = rects[index]; + const previousRect = rects[index - 1]; + const nextRect = rects[index + 1]; + + if (!currentRect || !previousRect && !nextRect) { + return 0; + } + + if (activeIndex < index) { + return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width); + } + + return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width); +} + +const rectSortingStrategy = _ref => { + let { + rects, + activeIndex, + overIndex, + index + } = _ref; + const newRects = arrayMove(rects, overIndex, activeIndex); + const oldRect = rects[index]; + const newRect = newRects[index]; + + if (!newRect || !oldRect) { + return null; + } + + return { + x: newRect.left - oldRect.left, + y: newRect.top - oldRect.top, + scaleX: newRect.width / oldRect.width, + scaleY: newRect.height / oldRect.height + }; +}; + +const rectSwappingStrategy = _ref => { + let { + activeIndex, + index, + rects, + overIndex + } = _ref; + let oldRect; + let newRect; + + if (index === activeIndex) { + oldRect = rects[index]; + newRect = rects[overIndex]; + } + + if (index === overIndex) { + oldRect = rects[index]; + newRect = rects[activeIndex]; + } + + if (!newRect || !oldRect) { + return null; + } + + return { + x: newRect.left - oldRect.left, + y: newRect.top - oldRect.top, + scaleX: newRect.width / oldRect.width, + scaleY: newRect.height / oldRect.height + }; +}; + +// To-do: We should be calculating scale transformation +const defaultScale$1 = { + scaleX: 1, + scaleY: 1 +}; +const verticalListSortingStrategy = _ref => { + var _rects$activeIndex; + + let { + activeIndex, + activeNodeRect: fallbackActiveRect, + index, + rects, + overIndex + } = _ref; + const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect; + + if (!activeNodeRect) { + return null; + } + + if (index === activeIndex) { + const overIndexRect = rects[overIndex]; + + if (!overIndexRect) { + return null; + } + + return { + x: 0, + y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top, + ...defaultScale$1 + }; + } + + const itemGap = getItemGap$1(rects, index, activeIndex); + + if (index > activeIndex && index <= overIndex) { + return { + x: 0, + y: -activeNodeRect.height - itemGap, + ...defaultScale$1 + }; + } + + if (index < activeIndex && index >= overIndex) { + return { + x: 0, + y: activeNodeRect.height + itemGap, + ...defaultScale$1 + }; + } + + return { + x: 0, + y: 0, + ...defaultScale$1 + }; +}; + +function getItemGap$1(clientRects, index, activeIndex) { + const currentRect = clientRects[index]; + const previousRect = clientRects[index - 1]; + const nextRect = clientRects[index + 1]; + + if (!currentRect) { + return 0; + } + + if (activeIndex < index) { + return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0; + } + + return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0; +} + +const ID_PREFIX = 'Sortable'; +const Context = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({ + activeIndex: -1, + containerId: ID_PREFIX, + disableTransforms: false, + items: [], + overIndex: -1, + useDragOverlay: false, + sortedRects: [], + strategy: rectSortingStrategy, + disabled: { + draggable: false, + droppable: false + } +}); +function SortableContext(_ref) { + let { + children, + id, + items: userDefinedItems, + strategy = rectSortingStrategy, + disabled: disabledProp = false + } = _ref; + const { + active, + dragOverlay, + droppableRects, + over, + measureDroppableContainers + } = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.useDndContext)(); + const containerId = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)(ID_PREFIX, id); + const useDragOverlay = Boolean(dragOverlay.rect !== null); + const items = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => userDefinedItems.map(item => typeof item === 'object' && 'id' in item ? item.id : item), [userDefinedItems]); + const isDragging = active != null; + const activeIndex = active ? items.indexOf(active.id) : -1; + const overIndex = over ? items.indexOf(over.id) : -1; + const previousItemsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(items); + const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current); + const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged; + const disabled = normalizeDisabled(disabledProp); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (itemsHaveChanged && isDragging) { + measureDroppableContainers(items); + } + }, [itemsHaveChanged, items, isDragging, measureDroppableContainers]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + previousItemsRef.current = items; + }, [items]); + const contextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + activeIndex, + containerId, + disabled, + disableTransforms, + items, + overIndex, + useDragOverlay, + sortedRects: getSortedRects(items, droppableRects), + strategy + }), // eslint-disable-next-line react-hooks/exhaustive-deps + [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]); + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Context.Provider, { + value: contextValue + }, children); +} + +const defaultNewIndexGetter = _ref => { + let { + id, + items, + activeIndex, + overIndex + } = _ref; + return arrayMove(items, activeIndex, overIndex).indexOf(id); +}; +const defaultAnimateLayoutChanges = _ref2 => { + let { + containerId, + isSorting, + wasDragging, + index, + items, + newIndex, + previousItems, + previousContainerId, + transition + } = _ref2; + + if (!transition || !wasDragging) { + return false; + } + + if (previousItems !== items && index === newIndex) { + return false; + } + + if (isSorting) { + return true; + } + + return newIndex !== index && containerId === previousContainerId; +}; +const defaultTransition = { + duration: 200, + easing: 'ease' +}; +const transitionProperty = 'transform'; +const disabledTransition = /*#__PURE__*/_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transition.toString({ + property: transitionProperty, + duration: 0, + easing: 'linear' +}); +const defaultAttributes = { + roleDescription: 'sortable' +}; + +/* + * When the index of an item changes while sorting, + * we need to temporarily disable the transforms + */ + +function useDerivedTransform(_ref) { + let { + disabled, + index, + node, + rect + } = _ref; + const [derivedTransform, setDerivedtransform] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const previousIndex = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(index); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (!disabled && index !== previousIndex.current && node.current) { + const initial = rect.current; + + if (initial) { + const current = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.getClientRect)(node.current, { + ignoreTransform: true + }); + const delta = { + x: initial.left - current.left, + y: initial.top - current.top, + scaleX: initial.width / current.width, + scaleY: initial.height / current.height + }; + + if (delta.x || delta.y) { + setDerivedtransform(delta); + } + } + } + + if (index !== previousIndex.current) { + previousIndex.current = index; + } + }, [disabled, index, node, rect]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (derivedTransform) { + setDerivedtransform(null); + } + }, [derivedTransform]); + return derivedTransform; +} + +function useSortable(_ref) { + let { + animateLayoutChanges = defaultAnimateLayoutChanges, + attributes: userDefinedAttributes, + disabled: localDisabled, + data: customData, + getNewIndex = defaultNewIndexGetter, + id, + strategy: localStrategy, + resizeObserverConfig, + transition = defaultTransition + } = _ref; + const { + items, + containerId, + activeIndex, + disabled: globalDisabled, + disableTransforms, + sortedRects, + overIndex, + useDragOverlay, + strategy: globalStrategy + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(Context); + const disabled = normalizeLocalDisabled(localDisabled, globalDisabled); + const index = items.indexOf(id); + const data = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + sortable: { + containerId, + index, + items + }, + ...customData + }), [containerId, customData, index, items]); + const itemsAfterCurrentSortable = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => items.slice(items.indexOf(id)), [items, id]); + const { + rect, + node, + isOver, + setNodeRef: setDroppableNodeRef + } = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.useDroppable)({ + id, + data, + disabled: disabled.droppable, + resizeObserverConfig: { + updateMeasurementsFor: itemsAfterCurrentSortable, + ...resizeObserverConfig + } + }); + const { + active, + activatorEvent, + activeNodeRect, + attributes, + setNodeRef: setDraggableNodeRef, + listeners, + isDragging, + over, + setActivatorNodeRef, + transform + } = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.useDraggable)({ + id, + data, + attributes: { ...defaultAttributes, + ...userDefinedAttributes + }, + disabled: disabled.draggable + }); + const setNodeRef = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useCombinedRefs)(setDroppableNodeRef, setDraggableNodeRef); + const isSorting = Boolean(active); + const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex); + const shouldDisplaceDragSource = !useDragOverlay && isDragging; + const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null; + const strategy = localStrategy != null ? localStrategy : globalStrategy; + const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({ + rects: sortedRects, + activeNodeRect, + activeIndex, + overIndex, + index + }) : null; + const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({ + id, + items, + activeIndex, + overIndex + }) : index; + const activeId = active == null ? void 0 : active.id; + const previous = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + activeId, + items, + newIndex, + containerId + }); + const itemsHaveChanged = items !== previous.current.items; + const shouldAnimateLayoutChanges = animateLayoutChanges({ + active, + containerId, + isDragging, + isSorting, + id, + index, + items, + newIndex: previous.current.newIndex, + previousItems: previous.current.items, + previousContainerId: previous.current.containerId, + transition, + wasDragging: previous.current.activeId != null + }); + const derivedTransform = useDerivedTransform({ + disabled: !shouldAnimateLayoutChanges, + index, + node, + rect + }); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (isSorting && previous.current.newIndex !== newIndex) { + previous.current.newIndex = newIndex; + } + + if (containerId !== previous.current.containerId) { + previous.current.containerId = containerId; + } + + if (items !== previous.current.items) { + previous.current.items = items; + } + }, [isSorting, newIndex, containerId, items]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (activeId === previous.current.activeId) { + return; + } + + if (activeId && !previous.current.activeId) { + previous.current.activeId = activeId; + return; + } + + const timeoutId = setTimeout(() => { + previous.current.activeId = activeId; + }, 50); + return () => clearTimeout(timeoutId); + }, [activeId]); + return { + active, + activeIndex, + attributes, + data, + rect, + index, + newIndex, + items, + isOver, + isSorting, + isDragging, + listeners, + node, + overIndex, + over, + setNodeRef, + setActivatorNodeRef, + setDroppableNodeRef, + setDraggableNodeRef, + transform: derivedTransform != null ? derivedTransform : finalTransform, + transition: getTransition() + }; + + function getTransition() { + if ( // Temporarily disable transitions for a single frame to set up derived transforms + derivedTransform || // Or to prevent items jumping to back to their "new" position when items change + itemsHaveChanged && previous.current.newIndex === index) { + return disabledTransition; + } + + if (shouldDisplaceDragSource && !(0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isKeyboardEvent)(activatorEvent) || !transition) { + return undefined; + } + + if (isSorting || shouldAnimateLayoutChanges) { + return _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transition.toString({ ...transition, + property: transitionProperty + }); + } + + return undefined; + } +} + +function normalizeLocalDisabled(localDisabled, globalDisabled) { + var _localDisabled$dragga, _localDisabled$droppa; + + if (typeof localDisabled === 'boolean') { + return { + draggable: localDisabled, + // Backwards compatibility + droppable: false + }; + } + + return { + draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable, + droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable + }; +} + +function hasSortableData(entry) { + if (!entry) { + return false; + } + + const data = entry.data.current; + + if (data && 'sortable' in data && typeof data.sortable === 'object' && 'containerId' in data.sortable && 'items' in data.sortable && 'index' in data.sortable) { + return true; + } + + return false; +} + +const directions = [_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Down, _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Right, _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Up, _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Left]; +const sortableKeyboardCoordinates = (event, _ref) => { + let { + context: { + active, + collisionRect, + droppableRects, + droppableContainers, + over, + scrollableAncestors + } + } = _ref; + + if (directions.includes(event.code)) { + event.preventDefault(); + + if (!active || !collisionRect) { + return; + } + + const filteredContainers = []; + droppableContainers.getEnabled().forEach(entry => { + if (!entry || entry != null && entry.disabled) { + return; + } + + const rect = droppableRects.get(entry.id); + + if (!rect) { + return; + } + + switch (event.code) { + case _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Down: + if (collisionRect.top < rect.top) { + filteredContainers.push(entry); + } + + break; + + case _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Up: + if (collisionRect.top > rect.top) { + filteredContainers.push(entry); + } + + break; + + case _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Left: + if (collisionRect.left > rect.left) { + filteredContainers.push(entry); + } + + break; + + case _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Right: + if (collisionRect.left < rect.left) { + filteredContainers.push(entry); + } + + break; + } + }); + const collisions = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.closestCorners)({ + active, + collisionRect: collisionRect, + droppableRects, + droppableContainers: filteredContainers, + pointerCoordinates: null + }); + let closestId = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.getFirstCollision)(collisions, 'id'); + + if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) { + closestId = collisions[1].id; + } + + if (closestId != null) { + const activeDroppable = droppableContainers.get(active.id); + const newDroppable = droppableContainers.get(closestId); + const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null; + const newNode = newDroppable == null ? void 0 : newDroppable.node.current; + + if (newNode && newRect && activeDroppable && newDroppable) { + const newScrollAncestors = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.getScrollableAncestors)(newNode); + const hasDifferentScrollAncestors = newScrollAncestors.some((element, index) => scrollableAncestors[index] !== element); + const hasSameContainer = isSameContainer(activeDroppable, newDroppable); + const isAfterActive = isAfter(activeDroppable, newDroppable); + const offset = hasDifferentScrollAncestors || !hasSameContainer ? { + x: 0, + y: 0 + } : { + x: isAfterActive ? collisionRect.width - newRect.width : 0, + y: isAfterActive ? collisionRect.height - newRect.height : 0 + }; + const rectCoordinates = { + x: newRect.left, + y: newRect.top + }; + const newCoordinates = offset.x && offset.y ? rectCoordinates : (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(rectCoordinates, offset); + return newCoordinates; + } + } + } + + return undefined; +}; + +function isSameContainer(a, b) { + if (!hasSortableData(a) || !hasSortableData(b)) { + return false; + } + + return a.data.current.sortable.containerId === b.data.current.sortable.containerId; +} + +function isAfter(a, b) { + if (!hasSortableData(a) || !hasSortableData(b)) { + return false; + } + + if (!isSameContainer(a, b)) { + return false; + } + + return a.data.current.sortable.index < b.data.current.sortable.index; +} + + +//# sourceMappingURL=sortable.esm.js.map + + +/***/ }), + +/***/ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js": +/*!***************************************************************!*\ + !*** ./node_modules/@dnd-kit/utilities/dist/utilities.esm.js ***! + \***************************************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "CSS": function() { return /* binding */ CSS; }, +/* harmony export */ "add": function() { return /* binding */ add; }, +/* harmony export */ "canUseDOM": function() { return /* binding */ canUseDOM; }, +/* harmony export */ "findFirstFocusableNode": function() { return /* binding */ findFirstFocusableNode; }, +/* harmony export */ "getEventCoordinates": function() { return /* binding */ getEventCoordinates; }, +/* harmony export */ "getOwnerDocument": function() { return /* binding */ getOwnerDocument; }, +/* harmony export */ "getWindow": function() { return /* binding */ getWindow; }, +/* harmony export */ "hasViewportRelativeCoordinates": function() { return /* binding */ hasViewportRelativeCoordinates; }, +/* harmony export */ "isDocument": function() { return /* binding */ isDocument; }, +/* harmony export */ "isHTMLElement": function() { return /* binding */ isHTMLElement; }, +/* harmony export */ "isKeyboardEvent": function() { return /* binding */ isKeyboardEvent; }, +/* harmony export */ "isNode": function() { return /* binding */ isNode; }, +/* harmony export */ "isSVGElement": function() { return /* binding */ isSVGElement; }, +/* harmony export */ "isTouchEvent": function() { return /* binding */ isTouchEvent; }, +/* harmony export */ "isWindow": function() { return /* binding */ isWindow; }, +/* harmony export */ "subtract": function() { return /* binding */ subtract; }, +/* harmony export */ "useCombinedRefs": function() { return /* binding */ useCombinedRefs; }, +/* harmony export */ "useEvent": function() { return /* binding */ useEvent; }, +/* harmony export */ "useInterval": function() { return /* binding */ useInterval; }, +/* harmony export */ "useIsomorphicLayoutEffect": function() { return /* binding */ useIsomorphicLayoutEffect; }, +/* harmony export */ "useLatestValue": function() { return /* binding */ useLatestValue; }, +/* harmony export */ "useLazyMemo": function() { return /* binding */ useLazyMemo; }, +/* harmony export */ "useNodeRef": function() { return /* binding */ useNodeRef; }, +/* harmony export */ "usePrevious": function() { return /* binding */ usePrevious; }, +/* harmony export */ "useUniqueId": function() { return /* binding */ useUniqueId; } +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + + +function useCombinedRefs() { + for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { + refs[_key] = arguments[_key]; + } + + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => node => { + refs.forEach(ref => ref(node)); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + refs); +} + +// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js +const canUseDOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'; + +function isWindow(element) { + const elementString = Object.prototype.toString.call(element); + return elementString === '[object Window]' || // In Electron context the Window object serializes to [object global] + elementString === '[object global]'; +} + +function isNode(node) { + return 'nodeType' in node; +} + +function getWindow(target) { + var _target$ownerDocument, _target$ownerDocument2; + + if (!target) { + return window; + } + + if (isWindow(target)) { + return target; + } + + if (!isNode(target)) { + return window; + } + + return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window; +} + +function isDocument(node) { + const { + Document + } = getWindow(node); + return node instanceof Document; +} + +function isHTMLElement(node) { + if (isWindow(node)) { + return false; + } + + return node instanceof getWindow(node).HTMLElement; +} + +function isSVGElement(node) { + return node instanceof getWindow(node).SVGElement; +} + +function getOwnerDocument(target) { + if (!target) { + return document; + } + + if (isWindow(target)) { + return target.document; + } + + if (!isNode(target)) { + return document; + } + + if (isDocument(target)) { + return target; + } + + if (isHTMLElement(target) || isSVGElement(target)) { + return target.ownerDocument; + } + + return document; +} + +/** + * A hook that resolves to useEffect on the server and useLayoutEffect on the client + * @param callback {function} Callback function that is invoked when the dependencies of the hook change + */ + +const useIsomorphicLayoutEffect = canUseDOM ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect; + +function useEvent(handler) { + const handlerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(handler); + useIsomorphicLayoutEffect(() => { + handlerRef.current = handler; + }); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return handlerRef.current == null ? void 0 : handlerRef.current(...args); + }, []); +} + +function useInterval() { + const intervalRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const set = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((listener, duration) => { + intervalRef.current = setInterval(listener, duration); + }, []); + const clear = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + if (intervalRef.current !== null) { + clearInterval(intervalRef.current); + intervalRef.current = null; + } + }, []); + return [set, clear]; +} + +function useLatestValue(value, dependencies) { + if (dependencies === void 0) { + dependencies = [value]; + } + + const valueRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(value); + useIsomorphicLayoutEffect(() => { + if (valueRef.current !== value) { + valueRef.current = value; + } + }, dependencies); + return valueRef; +} + +function useLazyMemo(callback, dependencies) { + const valueRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + const newValue = callback(valueRef.current); + valueRef.current = newValue; + return newValue; + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [...dependencies]); +} + +function useNodeRef(onChange) { + const onChangeHandler = useEvent(onChange); + const node = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const setNodeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(element => { + if (element !== node.current) { + onChangeHandler == null ? void 0 : onChangeHandler(element, node.current); + } + + node.current = element; + }, //eslint-disable-next-line + []); + return [node, setNodeRef]; +} + +function usePrevious(value) { + const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + ref.current = value; + }, [value]); + return ref.current; +} + +let ids = {}; +function useUniqueId(prefix, value) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (value) { + return value; + } + + const id = ids[prefix] == null ? 0 : ids[prefix] + 1; + ids[prefix] = id; + return prefix + "-" + id; + }, [prefix, value]); +} + +function createAdjustmentFn(modifier) { + return function (object) { + for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + adjustments[_key - 1] = arguments[_key]; + } + + return adjustments.reduce((accumulator, adjustment) => { + const entries = Object.entries(adjustment); + + for (const [key, valueAdjustment] of entries) { + const value = accumulator[key]; + + if (value != null) { + accumulator[key] = value + modifier * valueAdjustment; + } + } + + return accumulator; + }, { ...object + }); + }; +} + +const add = /*#__PURE__*/createAdjustmentFn(1); +const subtract = /*#__PURE__*/createAdjustmentFn(-1); + +function hasViewportRelativeCoordinates(event) { + return 'clientX' in event && 'clientY' in event; +} + +function isKeyboardEvent(event) { + if (!event) { + return false; + } + + const { + KeyboardEvent + } = getWindow(event.target); + return KeyboardEvent && event instanceof KeyboardEvent; +} + +function isTouchEvent(event) { + if (!event) { + return false; + } + + const { + TouchEvent + } = getWindow(event.target); + return TouchEvent && event instanceof TouchEvent; +} + +/** + * Returns the normalized x and y coordinates for mouse and touch events. + */ + +function getEventCoordinates(event) { + if (isTouchEvent(event)) { + if (event.touches && event.touches.length) { + const { + clientX: x, + clientY: y + } = event.touches[0]; + return { + x, + y + }; + } else if (event.changedTouches && event.changedTouches.length) { + const { + clientX: x, + clientY: y + } = event.changedTouches[0]; + return { + x, + y + }; + } + } + + if (hasViewportRelativeCoordinates(event)) { + return { + x: event.clientX, + y: event.clientY + }; + } + + return null; +} + +const CSS = /*#__PURE__*/Object.freeze({ + Translate: { + toString(transform) { + if (!transform) { + return; + } + + const { + x, + y + } = transform; + return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)"; + } + + }, + Scale: { + toString(transform) { + if (!transform) { + return; + } + + const { + scaleX, + scaleY + } = transform; + return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")"; + } + + }, + Transform: { + toString(transform) { + if (!transform) { + return; + } + + return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(' '); + } + + }, + Transition: { + toString(_ref) { + let { + property, + duration, + easing + } = _ref; + return property + " " + duration + "ms " + easing; + } + + } +}); + +const SELECTOR = 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]'; +function findFirstFocusableNode(element) { + if (element.matches(SELECTOR)) { + return element; + } + + return element.querySelector(SELECTOR); +} + + +//# sourceMappingURL=utilities.esm.js.map + + +/***/ }), + +/***/ "./client/src/boot/index.js": +/*!**********************************!*\ + !*** ./client/src/boot/index.js ***! + \**********************************/ +/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + + + +var _registerComponents = _interopRequireDefault(__webpack_require__(/*! ./registerComponents */ "./client/src/boot/registerComponents.js")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +document.addEventListener('DOMContentLoaded', () => { + (0, _registerComponents.default)(); +}); + +/***/ }), + +/***/ "./client/src/boot/registerComponents.js": +/*!***********************************************!*\ + !*** ./client/src/boot/registerComponents.js ***! + \***********************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _Injector = _interopRequireDefault(__webpack_require__(/*! lib/Injector */ "lib/Injector")); +var _LinkPicker = _interopRequireDefault(__webpack_require__(/*! components/LinkPicker/LinkPicker */ "./client/src/components/LinkPicker/LinkPicker.js")); +var _LinkField = _interopRequireDefault(__webpack_require__(/*! components/LinkField/LinkField */ "./client/src/components/LinkField/LinkField.js")); +var _LinkModal = _interopRequireDefault(__webpack_require__(/*! components/LinkModal/LinkModal */ "./client/src/components/LinkModal/LinkModal.js")); +var _FileLinkModal = _interopRequireDefault(__webpack_require__(/*! components/LinkModal/FileLinkModal */ "./client/src/components/LinkModal/FileLinkModal.js")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const registerComponents = () => { + _Injector.default.component.registerMany({ + LinkPicker: _LinkPicker.default, + LinkField: _LinkField.default, + 'LinkModal.FormBuilderModal': _LinkModal.default, + 'LinkModal.InsertMediaModal': _FileLinkModal.default + }); +}; +var _default = registerComponents; +exports["default"] = _default; + +/***/ }), + +/***/ "./client/src/components/LinkField/LinkField.js": +/*!******************************************************!*\ + !*** ./client/src/components/LinkField/LinkField.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = exports.LinkFieldContext = exports.Component = void 0; +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _redux = __webpack_require__(/*! redux */ "redux"); +var _reactRedux = __webpack_require__(/*! react-redux */ "react-redux"); +var _core = __webpack_require__(/*! @dnd-kit/core */ "./node_modules/@dnd-kit/core/dist/core.esm.js"); +var _sortable = __webpack_require__(/*! @dnd-kit/sortable */ "./node_modules/@dnd-kit/sortable/dist/sortable.esm.js"); +var _modifiers = __webpack_require__(/*! @dnd-kit/modifiers */ "./node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js"); +var _Injector = __webpack_require__(/*! lib/Injector */ "lib/Injector"); +var _FieldHolder = _interopRequireDefault(__webpack_require__(/*! components/FieldHolder/FieldHolder */ "components/FieldHolder/FieldHolder")); +var _LinkPicker = _interopRequireDefault(__webpack_require__(/*! components/LinkPicker/LinkPicker */ "./client/src/components/LinkPicker/LinkPicker.js")); +var _LinkPickerTitle = _interopRequireDefault(__webpack_require__(/*! components/LinkPicker/LinkPickerTitle */ "./client/src/components/LinkPicker/LinkPickerTitle.js")); +var _Loading = _interopRequireDefault(__webpack_require__(/*! components/Loading/Loading */ "components/Loading/Loading")); +var _LinkType = _interopRequireDefault(__webpack_require__(/*! types/LinkType */ "./client/src/types/LinkType.js")); +var _LinkModalContainer = _interopRequireDefault(__webpack_require__(/*! containers/LinkModalContainer */ "./client/src/containers/LinkModalContainer.js")); +var toastsActions = _interopRequireWildcard(__webpack_require__(/*! state/toasts/ToastsActions */ "state/toasts/ToastsActions")); +var _Backend = _interopRequireDefault(__webpack_require__(/*! lib/Backend */ "lib/Backend")); +var _Config = _interopRequireDefault(__webpack_require__(/*! lib/Config */ "lib/Config")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "prop-types")); +var _i18n = _interopRequireDefault(__webpack_require__(/*! i18n */ "i18n")); +var _url = _interopRequireDefault(__webpack_require__(/*! url */ "url")); +var _qs = _interopRequireDefault(__webpack_require__(/*! qs */ "qs")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +const LinkFieldContext = (0, _react.createContext)(null); +exports.LinkFieldContext = LinkFieldContext; +const section = 'SilverStripe\\LinkField\\Controllers\\LinkFieldController'; +const LinkField = _ref => { + var _data$editingID; + let { + value = null, + onChange, + types = [], + actions, + isMulti = false, + canCreate, + ownerID, + ownerClass, + ownerRelation + } = _ref; + const [data, setData] = (0, _react.useState)({}); + const [editingID, setEditingID] = (0, _react.useState)(0); + const [loading, setLoading] = (0, _react.useState)(false); + const [forceRerender, setForceRerender] = (0, _react.useState)(0); + const sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.PointerSensor, { + activationConstraint: { + distance: 10 + } + })); + let linkIDs = value; + if (!Array.isArray(linkIDs)) { + if (typeof linkIDs === 'number' && linkIDs != 0) { + linkIDs = [linkIDs]; + } + if (!linkIDs) { + linkIDs = []; + } + } + console.log('X'); + (0, _react.useEffect)(() => { + console.log('A'); + if (!editingID && linkIDs.length > 0) { + console.log('B'); + setLoading(true); + const query = []; + for (const linkID of linkIDs) { + query.push(`itemIDs[]=${linkID}`); + } + const endpoint = `${_Config.default.getSection(section).form.linkForm.dataUrl}?${query.join('&')}`; + _Backend.default.get(endpoint).then(response => response.json()).then(responseJson => { + setData(responseJson); + setLoading(false); + }).catch(() => { + actions.toasts.error(_i18n.default._t('LinkField.FAILED_TO_LOAD_LINKS', 'Failed to load links')); + setLoading(false); + }); + } + }, [editingID, value && value.length, forceRerender]); + const onModalClosed = () => { + setEditingID(0); + }; + const onModalSuccess = value => { + setEditingID(0); + const ids = [...linkIDs]; + if (!ids.includes(value)) { + ids.push(value); + } + onChange(isMulti ? ids : ids[0]); + actions.toasts.success(_i18n.default._t('LinkField.SAVE_SUCCESS', 'Saved link')); + }; + const onDelete = linkID => { + var _data$linkID; + let endpoint = `${_Config.default.getSection(section).form.linkForm.deleteUrl}/${linkID}`; + const parsedURL = _url.default.parse(endpoint); + const parsedQs = _qs.default.parse(parsedURL.query); + parsedQs.ownerID = ownerID; + parsedQs.ownerClass = ownerClass; + parsedQs.ownerRelation = ownerRelation; + endpoint = _url.default.format({ + ...parsedURL, + search: _qs.default.stringify(parsedQs) + }); + const versionState = ((_data$linkID = data[linkID]) === null || _data$linkID === void 0 ? void 0 : _data$linkID.versionState) || ''; + const isVersioned = ['draft', 'modified', 'published'].includes(versionState); + const successText = isVersioned ? _i18n.default._t('LinkField.ARCHIVE_SUCCESS', 'Archived link') : _i18n.default._t('LinkField.DELETE_SUCCESS', 'Deleted link'); + const failedText = isVersioned ? _i18n.default._t('LinkField.ARCHIVE_ERROR', 'Failed to archive link') : _i18n.default._t('LinkField.DELETE_ERROR', 'Failed to delete link'); + _Backend.default.delete(endpoint, {}, { + 'X-SecurityID': _Config.default.get('SecurityID') + }).then(() => actions.toasts.success(successText)).catch(() => actions.toasts.error(failedText)); + const newData = { + ...data + }; + delete newData[linkID]; + setData(newData); + onChange(isMulti ? Object.keys(newData) : 0); + }; + const renderLinks = () => { + const links = []; + for (const linkID of linkIDs) { + var _data$linkID2, _data$linkID3, _data$linkID4, _data$linkID5, _data$linkID6, _data$linkID7; + const linkData = data[linkID]; + if (!linkData) { + continue; + } + const type = types.hasOwnProperty((_data$linkID2 = data[linkID]) === null || _data$linkID2 === void 0 ? void 0 : _data$linkID2.typeKey) ? types[(_data$linkID3 = data[linkID]) === null || _data$linkID3 === void 0 ? void 0 : _data$linkID3.typeKey] : {}; + links.push(_react.default.createElement(_LinkPickerTitle.default, { + key: linkID, + id: linkID, + title: (_data$linkID4 = data[linkID]) === null || _data$linkID4 === void 0 ? void 0 : _data$linkID4.Title, + description: (_data$linkID5 = data[linkID]) === null || _data$linkID5 === void 0 ? void 0 : _data$linkID5.description, + versionState: (_data$linkID6 = data[linkID]) === null || _data$linkID6 === void 0 ? void 0 : _data$linkID6.versionState, + typeTitle: type.title || '', + onDelete: onDelete, + onClick: () => { + setEditingID(linkID); + }, + canDelete: (_data$linkID7 = data[linkID]) !== null && _data$linkID7 !== void 0 && _data$linkID7.canDelete ? true : false + })); + } + return links; + }; + const handleDragEnd = event => { + const { + active, + over + } = event; + if (active.id === over.id) { + return; + } + const fromIndex = linkIDs.indexOf(active.id); + const toIndex = linkIDs.indexOf(over.id); + const newLinkIDs = (0, _sortable.arrayMove)(linkIDs, fromIndex, toIndex); + let endpoint = `${_Config.default.getSection(section).form.linkForm.sortUrl}`; + _Backend.default.post(endpoint, { + newLinkIDs + }, { + 'X-SecurityID': _Config.default.get('SecurityID') + }).then(() => { + onChange(newLinkIDs); + actions.toasts.success(_i18n.default._t('LinkField.SORT_SUCCESS', 'Updated link sort order')); + setForceRerender(forceRerender + 1); + }).catch(() => { + actions.toasts.error(_i18n.default._t('LinkField.SORT_ERROR', 'Failed to sort links')); + }); + }; + const saveRecordFirst = ownerID === 0; + const renderPicker = !saveRecordFirst && (isMulti || Object.keys(data).length === 0); + const renderModal = !saveRecordFirst && Boolean(editingID); + const saveRecordFirstText = _i18n.default._t('LinkField.SAVE_RECORD_FIRST', 'Cannot add links until the record has been saved'); + const links = renderLinks(); + if (loading && !saveRecordFirst) { + return _react.default.createElement("div", { + className: "link-field__loading" + }, _react.default.createElement(_Loading.default, null)); + } + return _react.default.createElement(LinkFieldContext.Provider, { + value: { + ownerID, + ownerClass, + ownerRelation, + actions + } + }, saveRecordFirst && _react.default.createElement("div", { + className: "link-field__save-record-first" + }, saveRecordFirstText), renderPicker && _react.default.createElement(_LinkPicker.default, { + onModalSuccess: onModalSuccess, + onModalClosed: onModalClosed, + types: types, + canCreate: canCreate + }), isMulti && _react.default.createElement("div", null, _react.default.createElement(_core.DndContext, { + modifiers: [_modifiers.restrictToVerticalAxis, _modifiers.restrictToParentElement], + sensors: sensors, + collisionDetection: _core.closestCenter, + onDragEnd: handleDragEnd + }, _react.default.createElement(_sortable.SortableContext, { + items: linkIDs, + strategy: _sortable.verticalListSortingStrategy + }, links))), !isMulti && _react.default.createElement("div", null, renderLinks()), renderModal && _react.default.createElement(_LinkModalContainer.default, { + types: types, + typeKey: (_data$editingID = data[editingID]) === null || _data$editingID === void 0 ? void 0 : _data$editingID.typeKey, + isOpen: Boolean(editingID), + onSuccess: onModalSuccess, + onClosed: onModalClosed, + linkID: editingID + })); +}; +exports.Component = LinkField; +LinkField.propTypes = { + value: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.number]), + onChange: _propTypes.default.func.isRequired, + types: _propTypes.default.array.isRequired, + actions: _propTypes.default.object.isRequired, + isMulti: _propTypes.default.bool, + canCreate: _propTypes.default.bool.isRequired, + ownerID: _propTypes.default.number.isRequired, + ownerClass: _propTypes.default.string.isRequired, + ownerRelation: _propTypes.default.string.isRequired +}; +const mapDispatchToProps = dispatch => ({ + actions: { + toasts: (0, _redux.bindActionCreators)(toastsActions, dispatch) + } +}); +var _default = (0, _redux.compose)(_FieldHolder.default, (0, _reactRedux.connect)(null, mapDispatchToProps))(LinkField); +exports["default"] = _default; + +/***/ }), + +/***/ "./client/src/components/LinkModal/FileLinkModal.js": +/*!**********************************************************!*\ + !*** ./client/src/components/LinkModal/FileLinkModal.js ***! + \**********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _i18n = _interopRequireDefault(__webpack_require__(/*! i18n */ "i18n")); +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _InsertMediaModal = _interopRequireDefault(__webpack_require__(/*! containers/InsertMediaModal/InsertMediaModal */ "containers/InsertMediaModal/InsertMediaModal")); +var _reactRedux = __webpack_require__(/*! react-redux */ "react-redux"); +var _LinkType = _interopRequireDefault(__webpack_require__(/*! types/LinkType */ "./client/src/types/LinkType.js")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "prop-types")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +const FileLinkModal = _ref => { + let { + type, + editing, + data, + actions, + onSubmit, + ...props + } = _ref; + if (!type) { + return false; + } + (0, _react.useEffect)(() => { + if (editing) { + actions.initModal(); + } else { + actions.reset(); + } + }, [editing]); + const attrs = data ? { + ID: data.FileID, + Description: data.Title, + TargetBlank: data.OpenInNew ? true : false + } : {}; + const onInsert = _ref2 => { + let { + ID, + Description, + TargetBlank + } = _ref2; + return onSubmit({ + FileID: ID, + Title: Description, + OpenInNew: TargetBlank, + typeKey: type.key + }, '', () => {}); + }; + return _react.default.createElement(_InsertMediaModal.default, _extends({ + isOpen: editing, + type: "insert-link", + title: false, + bodyClassName: "modal__dialog", + className: "insert-link__dialog-wrapper--internal", + fileAttributes: attrs, + onInsert: onInsert + }, props)); +}; +FileLinkModal.propTypes = { + type: _LinkType.default.isRequired, + editing: _propTypes.default.bool.isRequired, + data: _propTypes.default.object.isRequired, + actions: _propTypes.default.object.isRequired, + onClick: _propTypes.default.func.isRequired +}; +function mapStateToProps() { + return {}; +} +function mapDispatchToProps(dispatch) { + return { + actions: { + initModal: () => dispatch({ + type: 'INIT_FORM_SCHEMA_STACK', + payload: { + formSchema: { + type: 'insert-link', + nextType: 'admin' + } + } + }), + reset: () => dispatch({ + type: 'RESET' + }) + } + }; +} +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(FileLinkModal); +exports["default"] = _default; + +/***/ }), + +/***/ "./client/src/components/LinkModal/LinkModal.js": +/*!******************************************************!*\ + !*** ./client/src/components/LinkModal/LinkModal.js ***! + \******************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _FormBuilderModal = _interopRequireDefault(__webpack_require__(/*! components/FormBuilderModal/FormBuilderModal */ "components/FormBuilderModal/FormBuilderModal")); +var _LinkField = __webpack_require__(/*! components/LinkField/LinkField */ "./client/src/components/LinkField/LinkField.js"); +var _url = _interopRequireDefault(__webpack_require__(/*! url */ "url")); +var _qs = _interopRequireDefault(__webpack_require__(/*! qs */ "qs")); +var _Config = _interopRequireDefault(__webpack_require__(/*! lib/Config */ "lib/Config")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "prop-types")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +const buildSchemaUrl = (typeKey, linkID) => { + const { + schemaUrl + } = _Config.default.getSection('SilverStripe\\LinkField\\Controllers\\LinkFieldController').form.linkForm; + const parsedURL = _url.default.parse(schemaUrl); + const parsedQs = _qs.default.parse(parsedURL.query); + parsedQs.typeKey = typeKey; + const { + ownerID, + ownerClass, + ownerRelation + } = (0, _react.useContext)(_LinkField.LinkFieldContext); + parsedQs.ownerID = ownerID; + parsedQs.ownerClass = ownerClass; + parsedQs.ownerRelation = ownerRelation; + for (const prop of ['href', 'path', 'pathname']) { + parsedURL[prop] = `${parsedURL[prop]}/${linkID}`; + } + return _url.default.format({ + ...parsedURL, + search: _qs.default.stringify(parsedQs) + }); +}; +const LinkModal = _ref => { + let { + typeTitle, + typeKey, + linkID = 0, + isOpen, + onSuccess, + onClosed + } = _ref; + const { + actions + } = (0, _react.useContext)(_LinkField.LinkFieldContext); + if (!typeKey) { + return false; + } + const onSubmit = async (modalData, action, submitFn) => { + let formSchema = null; + try { + formSchema = await submitFn(); + } catch (error) { + actions.toasts.error(i18n._t('LinkField.FAILED_TO_SAVE_LINK', 'Failed to save link')); + return Promise.resolve(); + } + const hasValidationErrors = formSchema.id.match(/\/schema\/linkfield\/([0-9]+)/); + if (!hasValidationErrors) { + const match = formSchema.id.match(/\/linkForm\/([0-9]+)/); + const valueFromSchemaResponse = parseInt(match[1], 10); + onSuccess(valueFromSchemaResponse); + } + return Promise.resolve(); + }; + return _react.default.createElement(_FormBuilderModal.default, { + title: typeTitle, + isOpen: isOpen, + schemaUrl: buildSchemaUrl(typeKey, linkID), + identifier: "Link.EditingLinkInfo", + onSubmit: onSubmit, + onClosed: onClosed + }); +}; +LinkModal.propTypes = { + typeTitle: _propTypes.default.string.isRequired, + typeKey: _propTypes.default.string.isRequired, + linkID: _propTypes.default.number, + isOpen: _propTypes.default.bool.isRequired, + onSuccess: _propTypes.default.func.isRequired, + onClosed: _propTypes.default.func.isRequired +}; +LinkModal.defaultProps; +var _default = LinkModal; +exports["default"] = _default; + +/***/ }), + +/***/ "./client/src/components/LinkPicker/LinkPicker.js": +/*!********************************************************!*\ + !*** ./client/src/components/LinkPicker/LinkPicker.js ***! + \********************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = exports.Component = void 0; +var _i18n = _interopRequireDefault(__webpack_require__(/*! i18n */ "i18n")); +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "prop-types")); +var _classnames = _interopRequireDefault(__webpack_require__(/*! classnames */ "classnames")); +var _LinkPickerMenu = _interopRequireDefault(__webpack_require__(/*! ./LinkPickerMenu */ "./client/src/components/LinkPicker/LinkPickerMenu.js")); +var _LinkType = _interopRequireDefault(__webpack_require__(/*! types/LinkType */ "./client/src/types/LinkType.js")); +var _LinkModalContainer = _interopRequireDefault(__webpack_require__(/*! containers/LinkModalContainer */ "./client/src/containers/LinkModalContainer.js")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const LinkPicker = _ref => { + let { + types, + onModalSuccess, + onModalClosed, + canCreate + } = _ref; + const [typeKey, setTypeKey] = (0, _react.useState)(''); + const handleSelect = key => { + setTypeKey(key); + }; + const handleClosed = () => { + if (typeof onModalClosed === 'function') { + onModalClosed(); + } + setTypeKey(''); + }; + const handleSuccess = value => { + setTypeKey(''); + onModalSuccess(value); + }; + const shouldOpenModal = typeKey !== ''; + const className = (0, _classnames.default)('link-picker', 'form-control'); + const typeArray = Object.values(types); + if (!canCreate) { + return _react.default.createElement("div", { + className: className + }, _react.default.createElement("div", { + className: "link-picker__cannot-create" + }, _i18n.default._t('LinkField.CANNOT_CREATE_LINK', 'Cannot create link'))); + } + return _react.default.createElement("div", { + className: className + }, _react.default.createElement(_LinkPickerMenu.default, { + types: typeArray, + onSelect: handleSelect + }), shouldOpenModal && _react.default.createElement(_LinkModalContainer.default, { + types: types, + typeKey: typeKey, + isOpen: shouldOpenModal, + onSuccess: handleSuccess, + onClosed: handleClosed + })); +}; +exports.Component = LinkPicker; +LinkPicker.propTypes = { + types: _propTypes.default.array.isRequired, + onModalSuccess: _propTypes.default.func.isRequired, + onModalClosed: _propTypes.default.func, + canCreate: _propTypes.default.bool.isRequired +}; +var _default = LinkPicker; +exports["default"] = _default; + +/***/ }), + +/***/ "./client/src/components/LinkPicker/LinkPickerMenu.js": +/*!************************************************************!*\ + !*** ./client/src/components/LinkPicker/LinkPickerMenu.js ***! + \************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _i18n = _interopRequireDefault(__webpack_require__(/*! i18n */ "i18n")); +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "prop-types")); +var _reactstrap = __webpack_require__(/*! reactstrap */ "reactstrap"); +var _LinkType = _interopRequireDefault(__webpack_require__(/*! types/LinkType */ "./client/src/types/LinkType.js")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const LinkPickerMenu = _ref => { + let { + types, + onSelect + } = _ref; + const [isOpen, setIsOpen] = (0, _react.useState)(false); + const toggle = () => setIsOpen(prevState => !prevState); + return _react.default.createElement(_reactstrap.Dropdown, { + isOpen: isOpen, + toggle: toggle, + className: "link-picker__menu" + }, _react.default.createElement(_reactstrap.DropdownToggle, { + className: "link-picker__menu-toggle font-icon-plus-1", + caret: true + }, _i18n.default._t('LinkField.ADD_LINK', 'Add Link')), _react.default.createElement(_reactstrap.DropdownMenu, null, types.map(_ref2 => { + let { + key, + title + } = _ref2; + return _react.default.createElement(_reactstrap.DropdownItem, { + key: key, + onClick: () => onSelect(key) + }, title); + }))); +}; +LinkPickerMenu.propTypes = { + types: _propTypes.default.arrayOf(_LinkType.default).isRequired, + onSelect: _propTypes.default.func.isRequired +}; +var _default = LinkPickerMenu; +exports["default"] = _default; + +/***/ }), + +/***/ "./client/src/components/LinkPicker/LinkPickerTitle.js": +/*!*************************************************************!*\ + !*** ./client/src/components/LinkPicker/LinkPickerTitle.js ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _classnames = _interopRequireDefault(__webpack_require__(/*! classnames */ "classnames")); +var _i18n = _interopRequireDefault(__webpack_require__(/*! i18n */ "i18n")); +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "prop-types")); +var _reactstrap = __webpack_require__(/*! reactstrap */ "reactstrap"); +var _sortable = __webpack_require__(/*! @dnd-kit/sortable */ "./node_modules/@dnd-kit/sortable/dist/sortable.esm.js"); +var _utilities = __webpack_require__(/*! @dnd-kit/utilities */ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js"); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +const stopPropagation = fn => e => { + e.nativeEvent.stopImmediatePropagation(); + e.preventDefault(); + e.nativeEvent.preventDefault(); + e.stopPropagation(); + fn && fn(); +}; +const getVersionedBadge = versionState => { + let title = ''; + let label = ''; + if (versionState === 'draft') { + title = _i18n.default._t('LinkField.LINK_DRAFT_TITLE', 'Link has draft changes'); + label = _i18n.default._t('LinkField.LINK_DRAFT_LABEL', 'Draft'); + } else if (versionState === 'modified') { + title = _i18n.default._t('LinkField.LINK_MODIFIED_TITLE', 'Link has unpublished changes'); + label = _i18n.default._t('LinkField.LINK_MODIFIED_LABEL', 'Modified'); + } else { + return null; + } + const className = (0, _classnames.default)('badge', `status-${versionState}`); + return _react.default.createElement("span", { + className: className, + title: title + }, label); +}; +const LinkPickerTitle = _ref => { + let { + id, + title, + description, + versionState, + typeTitle, + onDelete, + onClick, + canDelete + } = _ref; + const { + attributes, + listeners, + setNodeRef, + transform, + transition + } = (0, _sortable.useSortable)({ + id + }); + const style = { + transform: _utilities.CSS.Transform.toString(transform), + transition + }; + const classes = { + 'link-picker__link': true, + 'form-control': true + }; + if (versionState) { + classes[`link-picker__link--${versionState}`] = true; + } + const className = (0, _classnames.default)(classes); + const deleteText = ['unversioned', 'unsaved'].includes(versionState) ? _i18n.default._t('LinkField.DELETE', 'Delete') : _i18n.default._t('LinkField.ARCHIVE', 'Archive'); + return _react.default.createElement("div", _extends({ + className: className, + ref: setNodeRef, + style: style + }, attributes, listeners), _react.default.createElement("div", { + class: "link-picker__drag-handle" + }, _react.default.createElement("i", { + class: "font-icon-drag-handle" + })), _react.default.createElement(_reactstrap.Button, { + className: "link-picker__button font-icon-link", + color: "secondary", + onClick: stopPropagation(onClick) + }, _react.default.createElement("div", { + className: "link-picker__link-detail" + }, _react.default.createElement("div", { + className: "link-picker__title" + }, _react.default.createElement("span", { + className: "link-picker__title-text" + }, title), getVersionedBadge(versionState)), _react.default.createElement("small", { + className: "link-picker__type" + }, typeTitle, ":\xA0", _react.default.createElement("span", { + className: "link-picker__url" + }, description)))), canDelete && _react.default.createElement(_reactstrap.Button, { + className: "link-picker__delete", + color: "link", + onClick: stopPropagation(() => onDelete(id)) + }, deleteText)); +}; +LinkPickerTitle.propTypes = { + id: _propTypes.default.number.isRequired, + title: _propTypes.default.string, + description: _propTypes.default.string, + versionState: _propTypes.default.string, + typeTitle: _propTypes.default.string.isRequired, + onDelete: _propTypes.default.func.isRequired, + onClick: _propTypes.default.func.isRequired, + canDelete: _propTypes.default.bool.isRequired +}; +var _default = LinkPickerTitle; +exports["default"] = _default; + +/***/ }), + +/***/ "./client/src/containers/LinkModalContainer.js": +/*!*****************************************************!*\ + !*** ./client/src/containers/LinkModalContainer.js ***! + \*****************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); +var _Injector = __webpack_require__(/*! lib/Injector */ "lib/Injector"); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "prop-types")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const LinkModalContainer = _ref => { + let { + types, + typeKey, + linkID = 0, + isOpen, + onSuccess, + onClosed + } = _ref; + if (!typeKey) { + return false; + } + const type = types.hasOwnProperty(typeKey) ? types[typeKey] : {}; + const handlerName = type && type.hasOwnProperty('handlerName') ? type.handlerName : 'FormBuilderModal'; + const LinkModal = (0, _Injector.loadComponent)(`LinkModal.${handlerName}`); + return _react.default.createElement(LinkModal, { + typeTitle: type.title || '', + typeKey: typeKey, + linkID: linkID, + isOpen: isOpen, + onSuccess: onSuccess, + onClosed: onClosed + }); +}; +LinkModalContainer.propTypes = { + types: _propTypes.default.array.isRequired, + typeKey: _propTypes.default.string.isRequired, + linkID: _propTypes.default.number, + isOpen: _propTypes.default.bool.isRequired, + onSuccess: _propTypes.default.func.isRequired, + onClosed: _propTypes.default.func.isRequired +}; +var _default = LinkModalContainer; +exports["default"] = _default; + +/***/ }), + +/***/ "./client/src/entwine/LinkField.js": +/*!*****************************************!*\ + !*** ./client/src/entwine/LinkField.js ***! + \*****************************************/ +/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + + + +var _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ "jquery")); +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); +var _client = _interopRequireDefault(__webpack_require__(/*! react-dom/client */ "react-dom/client")); +var _Injector = __webpack_require__(/*! lib/Injector */ "lib/Injector"); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +_jquery.default.entwine('ss', $ => { + $('.js-injector-boot .entwine-linkfield').entwine({ + Component: null, + Root: null, + onmatch() { + const cmsContent = this.closest('.cms-content').attr('id'); + const context = cmsContent ? { + context: cmsContent + } : {}; + const schemaComponent = this.data('schema-component'); + const ReactField = (0, _Injector.loadComponent)(schemaComponent, context); + this.setComponent(ReactField); + this.setRoot(_client.default.createRoot(this[0])); + this._super(); + this.refresh(); + }, + refresh() { + const props = this.getProps(); + this.getInputField().val(props.value); + const ReactField = this.getComponent(); + const Root = this.getRoot(); + Root.render(_react.default.createElement(ReactField, _extends({}, props, { + noHolder: true + }))); + }, + handleChange(value) { + this.getInputField().data('value', value); + this.refresh(); + }, + getProps() { + const inputField = this.getInputField(); + return { + value: inputField.data('value'), + ownerID: inputField.data('owner-id'), + ownerClass: inputField.data('owner-class'), + ownerRelation: inputField.data('owner-relation'), + onChange: this.handleChange.bind(this), + isMulti: this.data('is-multi') ?? false, + types: this.data('types') ?? [], + canCreate: this.getInputField().data('can-create') ?? false + }; + }, + getInputField() { + const fieldID = this.data('field-id'); + return $(`#${fieldID}`); + }, + onunmatch() { + const Root = this.getRoot(); + if (Root) { + Root.unmount(); + } + } + }); +}); + +/***/ }), + +/***/ "./client/src/types/LinkType.js": +/*!**************************************!*\ + !*** ./client/src/types/LinkType.js ***! + \**************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "prop-types")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const LinkType = _propTypes.default.shape({ + key: _propTypes.default.string.isRequired, + title: _propTypes.default.string.isRequired +}); +var _default = LinkType; +exports["default"] = _default; + +/***/ }), + +/***/ "lib/Backend": +/*!**************************!*\ + !*** external "Backend" ***! + \**************************/ +/***/ (function(module) { + +module.exports = Backend; + +/***/ }), + +/***/ "lib/Config": +/*!*************************!*\ + !*** external "Config" ***! + \*************************/ +/***/ (function(module) { + +module.exports = Config; + +/***/ }), + +/***/ "components/FieldHolder/FieldHolder": +/*!******************************!*\ + !*** external "FieldHolder" ***! + \******************************/ +/***/ (function(module) { + +module.exports = FieldHolder; + +/***/ }), + +/***/ "components/FormBuilderModal/FormBuilderModal": +/*!***********************************!*\ + !*** external "FormBuilderModal" ***! + \***********************************/ +/***/ (function(module) { + +module.exports = FormBuilderModal; + +/***/ }), + +/***/ "lib/Injector": +/*!***************************!*\ + !*** external "Injector" ***! + \***************************/ +/***/ (function(module) { + +module.exports = Injector; + +/***/ }), + +/***/ "containers/InsertMediaModal/InsertMediaModal": +/*!***********************************!*\ + !*** external "InsertMediaModal" ***! + \***********************************/ +/***/ (function(module) { + +module.exports = InsertMediaModal; + +/***/ }), + +/***/ "components/Loading/Loading": +/*!**************************!*\ + !*** external "Loading" ***! + \**************************/ +/***/ (function(module) { + +module.exports = Loading; + +/***/ }), + +/***/ "url": +/*!**************************!*\ + !*** external "NodeUrl" ***! + \**************************/ +/***/ (function(module) { + +module.exports = NodeUrl; + +/***/ }), + +/***/ "prop-types": +/*!****************************!*\ + !*** external "PropTypes" ***! + \****************************/ +/***/ (function(module) { + +module.exports = PropTypes; + +/***/ }), + +/***/ "react": +/*!************************!*\ + !*** external "React" ***! + \************************/ +/***/ (function(module) { + +module.exports = React; + +/***/ }), + +/***/ "react-dom": +/*!***************************!*\ + !*** external "ReactDom" ***! + \***************************/ +/***/ (function(module) { + +module.exports = ReactDom; + +/***/ }), + +/***/ "react-dom/client": +/*!*********************************!*\ + !*** external "ReactDomClient" ***! + \*********************************/ +/***/ (function(module) { + +module.exports = ReactDomClient; + +/***/ }), + +/***/ "react-redux": +/*!*****************************!*\ + !*** external "ReactRedux" ***! + \*****************************/ +/***/ (function(module) { + +module.exports = ReactRedux; + +/***/ }), + +/***/ "reactstrap": +/*!*****************************!*\ + !*** external "Reactstrap" ***! + \*****************************/ +/***/ (function(module) { + +module.exports = Reactstrap; + +/***/ }), + +/***/ "redux": +/*!************************!*\ + !*** external "Redux" ***! + \************************/ +/***/ (function(module) { + +module.exports = Redux; + +/***/ }), + +/***/ "state/toasts/ToastsActions": +/*!********************************!*\ + !*** external "ToastsActions" ***! + \********************************/ +/***/ (function(module) { + +module.exports = ToastsActions; + +/***/ }), + +/***/ "classnames": +/*!*****************************!*\ + !*** external "classnames" ***! + \*****************************/ +/***/ (function(module) { + +module.exports = classnames; + +/***/ }), + +/***/ "i18n": +/*!***********************!*\ + !*** external "i18n" ***! + \***********************/ +/***/ (function(module) { + +module.exports = i18n; + +/***/ }), + +/***/ "jquery": +/*!*************************!*\ + !*** external "jQuery" ***! + \*************************/ +/***/ (function(module) { + +module.exports = jQuery; + +/***/ }), + +/***/ "qs": +/*!*********************!*\ + !*** external "qs" ***! + \*********************/ +/***/ (function(module) { + +module.exports = qs; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/*!**************************************!*\ + !*** ./client/src/bundles/bundle.js ***! + \**************************************/ + + +__webpack_require__(/*! boot */ "./client/src/boot/index.js"); +__webpack_require__(/*! entwine/LinkField */ "./client/src/entwine/LinkField.js"); +}(); +/******/ })() +; +//# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/client/dist/styles/bundle.css b/client/dist/styles/bundle.css index cecbd233..d2254cb4 100644 --- a/client/dist/styles/bundle.css +++ b/client/dist/styles/bundle.css @@ -1 +1,174 @@ -.link-field__save-record-first{padding-top:7px}.link-field__loading .cms-content-loading-spinner{position:initial}.link-field__loading .ui-widget-overlay-light{opacity:0}.link-picker__link,.link-picker{display:flex;height:auto;width:100%;min-height:54px;background:#fff;padding:0}.link-picker{align-items:stretch;cursor:pointer;box-shadow:none}.link-picker:not(:last-child){margin-bottom:10px}.link-picker.font-icon-link::before{margin:.76925rem}.link-picker__cannot-create{cursor:default;flex-grow:1;padding:16px 13px}.link-picker__menu{flex-grow:1}.link-picker__menu-toggle{width:100%;height:100%;text-align:left}.link-picker__menu-toggle::before{padding:.76925rem}.link-picker__link{align-items:center;text-align:left;margin-right:0;justify-content:space-between;position:relative}.link-picker__link:not(:last-child){border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.link-picker__link:not(:first-child){border-top:0;border-top-left-radius:0;border-top-right-radius:0}.link-picker__link:hover,.link-picker__link:focus{background:#eef0f4;text-decoration:none;color:inherit}.link-picker__link::before{top:29px;left:32px;content:" ";position:absolute;border:1px solid #cf3f00;border-radius:100%;bottom:6px;box-shadow:0 0 1px .5px #fff;display:block;height:8px;width:8px;z-index:1}.link-picker__link--draft::before{background-color:#ff7f22}.link-picker__link--modified::before{background-color:#fff7f0}.link-picker__link--unsaved::before,.link-picker__link--unversioned::before,.link-picker__link--published::before{display:none}.link-picker__button{display:flex;align-items:center;flex-grow:1;height:100%;min-width:0;text-align:left;border:none;margin-right:0}.link-picker__button[class*=font-icon-]::before{position:absolute;font-size:1.231rem;padding:.76925rem;margin-right:6px;flex-grow:0}.link-picker__link-detail{flex-grow:1;width:100%;padding-left:3.5rem}.link-picker__delete{flex-grow:0}.link-picker__url{color:#0071c4}.link-picker__type,.link-picker__title-text{display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.link-picker__title{display:flex;align-items:center;width:100%}.link-picker__title .badge{color:#cf3f00;background-color:#fff2ea;padding:2px 3px 2px 4px}.link-picker__title-text{min-width:0;margin-right:5px}.link-picker__type{width:100%} +/*!*****************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[0].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[0].use[4]!./client/src/styles/bundle.scss ***! + \*****************************************************************************************************************************************************************************************************************************************************************************************************************************/ +.link-field__save-record-first { + padding-top: 7px; +} + +.link-field__loading .cms-content-loading-spinner { + position: initial; +} +.link-field__loading .ui-widget-overlay-light { + opacity: 0; +} + +.link-picker__link, .link-picker { + display: flex; + height: auto; + width: 100%; + min-height: 54px; + background: white; + padding: 0; +} + +.link-picker { + align-items: stretch; + cursor: pointer; + box-shadow: none; +} +.link-picker:not(:last-child) { + margin-bottom: 10px; +} +.link-picker.font-icon-link::before { + margin: 0.76925rem; +} + +.link-picker__cannot-create { + cursor: default; + flex-grow: 1; + padding: 16px 13px; +} + +.link-picker__menu { + flex-grow: 1; +} + +.link-picker__menu-toggle { + width: 100%; + height: 100%; + text-align: left; +} +.link-picker__menu-toggle::before { + padding: 0.76925rem; +} + +.link-picker__link { + align-items: center; + text-align: left; + margin-right: 0; + justify-content: space-between; + position: relative; +} +.link-picker__link:not(:last-child) { + border-bottom: 0; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} +.link-picker__link:not(:first-child) { + border-top: 0; + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.link-picker__link:hover, .link-picker__link:focus { + text-decoration: none; + color: inherit; +} +.link-picker__link:active { + cursor: grabbing; +} +.link-picker__link::before { + top: 29px; + left: 32px; + content: " "; + position: absolute; + border: 1px solid #cf3f00; + border-radius: 100%; + bottom: 6px; + box-shadow: 0 0 1px 0.5px #fff; + display: block; + height: 8px; + width: 8px; + z-index: 1; +} +.link-picker__link--draft::before { + background-color: #ff7f22; +} +.link-picker__link--modified::before { + background-color: #fff7f0; +} +.link-picker__link--unsaved::before, .link-picker__link--unversioned::before, .link-picker__link--published::before { + display: none; +} + +.link-picker__button { + display: flex; + align-items: center; + flex-grow: 1; + height: 100%; + min-width: 0; + text-align: left; + border: none; + margin-right: 0; +} +.link-picker__button[class*=font-icon-]::before { + position: absolute; + font-size: 1.231rem; + padding: 0.76925rem; + margin-right: 6px; + flex-grow: 0; +} + +.link-picker__drag-handle { + cursor: grab; + display: none; + left: 5px; + position: absolute; + z-index: 100; +} + +.link-picker__link:hover .link-picker__drag-handle { + display: block; +} + +.link-picker__link-detail { + flex-grow: 1; + width: 100%; + padding-left: 3.5rem; +} + +.link-picker__delete { + flex-grow: 0; +} + +.link-picker__url { + color: #0071c4; +} + +.link-picker__type, .link-picker__title-text { + display: inline-block; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.link-picker__title { + display: flex; + align-items: center; + width: 100%; +} +.link-picker__title .badge { + color: #cf3f00; + background-color: #fff2ea; + padding: 2px 3px 2px 4px; +} + +.link-picker__title-text { + min-width: 0; + margin-right: 5px; +} + +.link-picker__type { + width: 100%; +} + +/*# sourceMappingURL=bundle.css.map*/ \ No newline at end of file diff --git a/client/lang/en.js b/client/lang/en.js index 9e00cc42..7ab6d941 100644 --- a/client/lang/en.js +++ b/client/lang/en.js @@ -21,6 +21,8 @@ if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') { "LinkField.CANNOT_CREATE_LINK": "Cannot create link", "LinkField.FAILED_TO_LOAD_LINKS": "Failed to load links", "LinkField.FAILED_TO_SAVE_LINK": "Failed to save link", - "LinkField.SAVE_RECORD_FIRST": "Cannot add links until the record has been saved" + "LinkField.SAVE_RECORD_FIRST": "Cannot add links until the record has been saved", + "LinkField.SORT_SUCCESS": "Updated link sort order", + "LinkField.SORT_ERROR": "Unable to sort links" }); } \ No newline at end of file diff --git a/client/lang/src/en.json b/client/lang/src/en.json index 67c0c3af..f57fa51e 100644 --- a/client/lang/src/en.json +++ b/client/lang/src/en.json @@ -14,5 +14,7 @@ "LinkField.CANNOT_CREATE_LINK": "Cannot create link", "LinkField.FAILED_TO_LOAD_LINKS": "Failed to load links", "LinkField.FAILED_TO_SAVE_LINK": "Failed to save link", - "LinkField.SAVE_RECORD_FIRST": "Cannot add links until the record has been saved" + "LinkField.SAVE_RECORD_FIRST": "Cannot add links until the record has been saved", + "LinkField.SORT_SUCCESS": "Updated link sort order", + "LinkField.SORT_ERROR": "Unable to sort links" } diff --git a/client/src/components/LinkField/LinkField.js b/client/src/components/LinkField/LinkField.js index 137ebc72..de3671c9 100644 --- a/client/src/components/LinkField/LinkField.js +++ b/client/src/components/LinkField/LinkField.js @@ -2,6 +2,9 @@ import React, { useState, useEffect, createContext } from 'react'; import { bindActionCreators, compose } from 'redux'; import { connect } from 'react-redux'; +import { DndContext, closestCenter, PointerSensor, useSensor, useSensors } from '@dnd-kit/core'; +import { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'; +import { restrictToVerticalAxis, restrictToParentElement } from '@dnd-kit/modifiers'; import { injectGraphql } from 'lib/Injector'; import fieldHolder from 'components/FieldHolder/FieldHolder'; import LinkPicker from 'components/LinkPicker/LinkPicker'; @@ -47,6 +50,15 @@ const LinkField = ({ const [data, setData] = useState({}); const [editingID, setEditingID] = useState(0); const [loading, setLoading] = useState(false); + const [forceRerender, setForceRerender] = useState(0); + + const sensors = useSensors( + useSensor(PointerSensor, { + activationConstraint: { + distance: 10 + } + }) + ); // Ensure we have a valid array let linkIDs = value; @@ -61,8 +73,12 @@ const LinkField = ({ // Read data from endpoint and update component state // This happens any time a link is added or removed and triggers a re-render + + console.log('X'); useEffect(() => { + console.log('A'); if (!editingID && linkIDs.length > 0) { + console.log('B'); setLoading(true); const query = []; for (const linkID of linkIDs) { @@ -80,7 +96,7 @@ const LinkField = ({ setLoading(false); }); } - }, [editingID, value && value.length]); + }, [editingID, value && value.length, forceRerender]); /** * Unset the editing ID when the editing modal is closed @@ -172,10 +188,36 @@ const LinkField = ({ return links; }; + /** + * Drag and drop handler for MultiLinkField's + */ + const handleDragEnd = (event) => { + const {active, over} = event; + if (active.id === over.id) { + return; + } + const fromIndex = linkIDs.indexOf(active.id); + const toIndex = linkIDs.indexOf(over.id); + const newLinkIDs = arrayMove(linkIDs, fromIndex, toIndex); + let endpoint = `${Config.getSection(section).form.linkForm.sortUrl}`; + // CSRF token 'X-SecurityID' headers needs to be present + backend.post(endpoint, { newLinkIDs }, { 'X-SecurityID': Config.get('SecurityID') }) + .then(() => { + onChange(newLinkIDs); + actions.toasts.success(i18n._t('LinkField.SORT_SUCCESS', 'Updated link sort order')); + // force a rerender to refetch links for server so that versionState badges are up to date + setForceRerender(forceRerender + 1); + }) + .catch(() => { + actions.toasts.error(i18n._t('LinkField.SORT_ERROR', 'Failed to sort links')); + }); + } + const saveRecordFirst = ownerID === 0; const renderPicker = !saveRecordFirst && (isMulti || Object.keys(data).length === 0); const renderModal = !saveRecordFirst && Boolean(editingID); const saveRecordFirstText = i18n._t('LinkField.SAVE_RECORD_FIRST', 'Cannot add links until the record has been saved'); + const links = renderLinks(); if (loading && !saveRecordFirst) { return
; @@ -189,7 +231,21 @@ const LinkField = ({ types={types} canCreate={canCreate} /> } -
{ renderLinks() }
+ { isMulti &&
+ + + {links} + + +
} + { !isMulti &&
{ renderLinks() }
} { renderModal && (e) => { e.nativeEvent.stopImmediatePropagation(); @@ -37,30 +39,47 @@ const LinkPickerTitle = ({ typeTitle, onDelete, onClick, - canDelete + canDelete, }) => { + const { + attributes, + listeners, + setNodeRef, + transform, + transition, + } = useSortable({id}); + const style = { + transform: CSS.Transform.toString(transform), + transition, + }; const classes = { 'link-picker__link': true, 'form-control': true, }; if (versionState) { - classes[` link-picker__link--${versionState}`] = true; + classes[`link-picker__link--${versionState}`] = true; } const className = classnames(classes); const deleteText = ['unversioned', 'unsaved'].includes(versionState) ? i18n._t('LinkField.DELETE', 'Delete') : i18n._t('LinkField.ARCHIVE', 'Archive'); - return
- {canDelete && diff --git a/package.json b/package.json index 817804aa..556e055e 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,16 @@ { - "name": "silverstripe-link", + "name": "silverstripe-linkfield", "version": "0.0.0", "description": "Link management for the SilverStripe CMS", "main": "./client/src/boot/index.js", "license": "BSD-3-Clause", "repository": { "type": "git", - "url": "git+https://github.com/silverstripe/silverstripe-link.git" + "url": "git+https://github.com/silverstripe/silverstripe-linkfield.git" }, - "homepage": "https://github.com/silverstripe/silverstripNe-link", + "homepage": "https://github.com/silverstripe/silverstripNe-linkfield", "bugs": { - "url": "https://github.com/silverstripe/silverstripe-link/issues" + "url": "https://github.com/silverstripe/silverstripe-linkfield/issues" }, "author": "SilverStripe Ltd", "engines": { @@ -61,14 +61,15 @@ }, "dependencies": { "@apollo/client": "^3.7.1", + "@dnd-kit/core": "^6.1.0", + "@dnd-kit/modifiers": "^7.0.0", + "@dnd-kit/sortable": "^8.0.0", "bootstrap": "^4.6.2", "classnames": "^2.2.5", "core-js": "^3.26.0", "prop-types": "^15.8.1", "qs": "^6.11.0", "react": "^18.2.0", - "react-dnd": "^5.0.0", - "react-dnd-html5-backend": "^5.0.1", "react-dom": "^18.2.0", "react-redux": "^8.0.4", "react-router": "^6.4.2", diff --git a/src/Controllers/LinkFieldController.php b/src/Controllers/LinkFieldController.php index 98ed211b..0c482d3e 100644 --- a/src/Controllers/LinkFieldController.php +++ b/src/Controllers/LinkFieldController.php @@ -31,12 +31,14 @@ class LinkFieldController extends LeftAndMain 'linkForm/$ItemID' => 'linkForm', 'GET data/$ItemID' => 'linkData', 'DELETE delete/$ItemID' => 'linkDelete', + 'POST sort' => 'linkSort', ]; private static $allowed_actions = [ 'linkForm', 'linkData', 'linkDelete', + 'linkSort', ]; public function getClientConfig() @@ -49,6 +51,7 @@ public function getClientConfig() 'schemaUrl' => $this->Link('schema/linkForm'), 'deleteUrl' => $this->Link('delete'), 'dataUrl' => $this->Link('data'), + 'sortUrl' => $this->Link('sort'), 'saveMethod' => 'post', 'formNameTemplate' => sprintf(self::FORM_NAME_TEMPLATE, '{id}'), ]; @@ -197,7 +200,10 @@ public function save(array $data, Form $form): HTTPResponse } // Ensure that ItemID url param matches the ID in the form data - if (isset($data['ID']) && ((int) $data['ID'] !== $id)) { + // Ensure that Sort is not being passed in + if ((isset($data['ID']) && ((int) $data['ID'] !== $id)) + || isset($data['Sort']) + ) { $this->jsonError(400, _t('LinkField.BAD_DATA', 'Bad data')); } @@ -253,6 +259,58 @@ public function save(array $data, Form $form): HTTPResponse return $response; } + /** + * Update Link Sort fields based frontend drag and drop sort logic + * /admin/linkfield/sort + */ + public function linkSort() + { + $request = $this->getRequest(); + $json = json_decode($request->getBody(), true); + $newLinkIDs = (array) $json['newLinkIDs']; + if (empty($newLinkIDs)) { + $this->jsonError(400, _t('LinkField.BAD_DATA', 'Bad data')); + } + // Update index so that it can be used for the value of $sort + $newLinkIDs = array_values($newLinkIDs); + array_unshift($newLinkIDs, null); + unset($newLinkIDs[0]); + // Fetch and validate links + $links = Link::get()->filter(['ID' => $newLinkIDs])->toArray(); + $linkIDToLink = []; + $ownerID = null; + $ownerRelation = null; + foreach ($links as $link) { + if (!$link->canEdit()) { + $this->jsonError(403, _t(__CLASS__ . '.UNAUTHORIZED', 'Unauthorized')); + } + if (is_null($ownerID)) { + $ownerID = $link->OwnerID; + } elseif ($link->OwnerID !== $ownerID) { + $this->jsonError(400, _t('LinkField.BAD_DATA', 'Bad data')); + } + if (is_null($ownerRelation)) { + $ownerRelation = $link->OwnerRelation; + } elseif ($link->OwnerRelation !== $ownerRelation) { + $this->jsonError(400, _t('LinkField.BAD_DATA', 'Bad data')); + } + $linkIDToLink[$link->ID] = $link; + } + // Update Sort field on links + foreach ($newLinkIDs as $sort => $linkID) { + $linkID = $newLinkIDs[$sort]; + $link = $linkIDToLink[$linkID]; + if ($link->Sort !== $sort) { + $link->Sort = $sort; + $link->write(); + } + } + // Send response + $response = $this->getResponse(); + $response->addHeader('Content-type', 'application/json'); + $response->setBody(json_encode(['success' => true])); + return $response; + } /** * Create the Form used to content manage a Link in a modal @@ -271,6 +329,9 @@ private function createLinkForm(Link $link, string $operation): Form $ownerClassName = $owner->ClassName; $ownerRelation = $this->ownerRelationFromRequest(); + // Remove Sort field + $form->Fields()->removeByName('Sort'); + // Add hidden form fields for OwnerID, OwnerClass and OwnerRelation if ($operation === 'create') { $form->Fields()->push(HiddenField::create('OwnerID')->setValue($ownerID)); diff --git a/src/Models/Link.php b/src/Models/Link.php index 2beea0b2..79639dde 100644 --- a/src/Models/Link.php +++ b/src/Models/Link.php @@ -33,6 +33,7 @@ class Link extends DataObject private static array $db = [ 'Title' => 'Varchar', 'OpenInNew' => 'Boolean', + 'Sort' => 'Int', ]; private static array $has_one = [ @@ -46,6 +47,8 @@ class Link extends DataObject ], ]; + private static $default_sort = '"Sort"'; + private static array $extensions = [ Versioned::class, ]; diff --git a/yarn.lock b/yarn.lock index d94c9dff..8b4046bd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1067,6 +1067,45 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== +"@dnd-kit/accessibility@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@dnd-kit/accessibility/-/accessibility-3.1.0.tgz#1054e19be276b5f1154ced7947fc0cb5d99192e0" + integrity sha512-ea7IkhKvlJUv9iSHJOnxinBcoOI3ppGnnL+VDJ75O45Nss6HtZd8IdN8touXPDtASfeI2T2LImb8VOZcL47wjQ== + dependencies: + tslib "^2.0.0" + +"@dnd-kit/core@^6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@dnd-kit/core/-/core-6.1.0.tgz#e81a3d10d9eca5d3b01cbf054171273a3fe01def" + integrity sha512-J3cQBClB4TVxwGo3KEjssGEXNJqGVWx17aRTZ1ob0FliR5IjYgTxl5YJbKTzA6IzrtelotH19v6y7uoIRUZPSg== + dependencies: + "@dnd-kit/accessibility" "^3.1.0" + "@dnd-kit/utilities" "^3.2.2" + tslib "^2.0.0" + +"@dnd-kit/modifiers@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@dnd-kit/modifiers/-/modifiers-7.0.0.tgz#229666dd4e8b9487f348035117f993af755b3db9" + integrity sha512-BG/ETy3eBjFap7+zIti53f0PCLGDzNXyTmn6fSdrudORf+OH04MxrW4p5+mPu4mgMk9kM41iYONjc3DOUWTcfg== + dependencies: + "@dnd-kit/utilities" "^3.2.2" + tslib "^2.0.0" + +"@dnd-kit/sortable@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@dnd-kit/sortable/-/sortable-8.0.0.tgz#086b7ac6723d4618a4ccb6f0227406d8a8862a96" + integrity sha512-U3jk5ebVXe1Lr7c2wU7SBZjcWdQP+j7peHJfCspnA81enlu88Mgd7CC8Q+pub9ubP7eKVETzJW+IBAhsqbSu/g== + dependencies: + "@dnd-kit/utilities" "^3.2.2" + tslib "^2.0.0" + +"@dnd-kit/utilities@^3.2.2": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@dnd-kit/utilities/-/utilities-3.2.2.tgz#5a32b6af356dc5f74d61b37d6f7129a4040ced7b" + integrity sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg== + dependencies: + tslib "^2.0.0" + "@emotion/babel-plugin@^11.10.6": version "11.10.6" resolved "https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.10.6.tgz#a68ee4b019d661d6f37dec4b8903255766925ead" @@ -2439,7 +2478,7 @@ array.prototype.tosorted@^1.1.1: es-shim-unscopables "^1.0.0" get-intrinsic "^1.1.3" -asap@^2.0.0, asap@^2.0.6, asap@~2.0.3: +asap@^2.0.0: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= @@ -2454,11 +2493,6 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -autobind-decorator@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/autobind-decorator/-/autobind-decorator-2.4.0.tgz#ea9e1c98708cf3b5b356f7cf9f10f265ff18239c" - integrity sha512-OGYhWUO72V6DafbF8PM8rm3EPbfuyMZcJhtm5/n26IDwO18pohE4eNazLoCGhPiXOCD0gEGmrbU3849QvM8bbw== - autoprefixer@^10.4.13: version "10.4.13" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.13.tgz#b5136b59930209a321e9fa3dca2e7c4d223e83a8" @@ -2589,14 +2623,6 @@ babel-preset-jest@^29.4.3: babel-plugin-jest-hoist "^29.4.3" babel-preset-current-node-syntax "^1.0.0" -babel-runtime@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" - integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.11.0" - balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -2772,11 +2798,6 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" -change-emitter@^0.1.2: - version "0.1.6" - resolved "https://registry.yarnpkg.com/change-emitter/-/change-emitter-0.1.6.tgz#e8b2fe3d7f1ab7d69a32199aff91ea6931409515" - integrity sha1-6LL+PX8at9aaMhma/5HqaTFAlRU= - char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -3038,16 +3059,6 @@ core-js-compat@^3.25.1: dependencies: browserslist "^4.21.5" -core-js@^1.0.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" - integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= - -core-js@^2.4.0: - version "2.6.11" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" - integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== - core-js@^3.26.0: version "3.29.0" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.29.0.tgz#0273e142b67761058bcde5615c503c7406b572d6" @@ -3292,16 +3303,6 @@ diff@^5.1.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.1.0.tgz#bc52d298c5ea8df9194800224445ed43ffc87e40" integrity sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw== -dnd-core@^4.0.5: - version "4.0.5" - resolved "https://registry.yarnpkg.com/dnd-core/-/dnd-core-4.0.5.tgz#3b83d138d0d5e265c73ec978dec5e1ed441dc665" - integrity sha1-O4PRONDV4mXHPsl43sXh7UQdxmU= - dependencies: - asap "^2.0.6" - invariant "^2.2.4" - lodash "^4.17.10" - redux "^4.0.0" - doctrine@^1.2.2: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" @@ -3381,13 +3382,6 @@ emojis-list@^3.0.0: resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" integrity sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q== -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= - dependencies: - iconv-lite "~0.4.13" - encoding@^0.1.13: version "0.1.13" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" @@ -4036,19 +4030,6 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -fbjs@^0.8.1: - version "0.8.17" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" - integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90= - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.18" - figures@^1.3.5: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" @@ -4462,11 +4443,6 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" -hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.0: - version "2.5.5" - resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" - integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw== - hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" @@ -4534,13 +4510,6 @@ iconv-lite@0.6.3, iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -iconv-lite@~0.4.13: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - icss-utils@^5.0.0, icss-utils@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" @@ -4681,7 +4650,7 @@ interpret@^3.1.1: resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== -invariant@^2.1.0, invariant@^2.2.4: +invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== @@ -4936,11 +4905,6 @@ is-shared-array-buffer@^1.0.2: dependencies: call-bind "^1.0.2" -is-stream@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= - is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" @@ -5023,14 +4987,6 @@ isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -isomorphic-fetch@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" @@ -5848,7 +5804,7 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.15, lodash@^4.3.0, lodash@~4.17.12: +lodash@^4.0.0, lodash@^4.17.15, lodash@^4.3.0, lodash@~4.17.12: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -6192,14 +6148,6 @@ next-tick@~1.0.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= -node-fetch@^1.0.1: - version "1.7.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" - integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - node-gyp@^9.0.0, node-gyp@^9.1.0: version "9.3.1" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.3.1.tgz#1e19f5f290afcc9c46973d68700cbd21a96192e4" @@ -6914,13 +6862,6 @@ promise-retry@^2.0.1: err-code "^2.0.2" retry "^0.12.0" -promise@^7.1.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" - integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== - dependencies: - asap "~2.0.3" - prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -6993,28 +6934,6 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -react-dnd-html5-backend@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/react-dnd-html5-backend/-/react-dnd-html5-backend-5.0.1.tgz#0b578d79c5c01317c70414c8d717f632b919d4f1" - integrity sha1-C1eNecXAExfHBBTI1xf2MrkZ1PE= - dependencies: - autobind-decorator "^2.1.0" - dnd-core "^4.0.5" - lodash "^4.17.10" - shallowequal "^1.0.2" - -react-dnd@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/react-dnd/-/react-dnd-5.0.0.tgz#c4a17c70109e456dad8906be838e6ee8f32b06b5" - integrity sha1-xKF8cBCeRW2tiQa+g45u6PMrBrU= - dependencies: - dnd-core "^4.0.5" - hoist-non-react-statics "^2.5.0" - invariant "^2.1.0" - lodash "^4.17.10" - recompose "^0.27.1" - shallowequal "^1.0.2" - react-dom@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" @@ -7038,7 +6957,7 @@ react-is@^18.0.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== -react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4: +react-lifecycles-compat@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== @@ -7221,18 +7140,6 @@ rechoir@^0.8.0: dependencies: resolve "^1.20.0" -recompose@^0.27.1: - version "0.27.1" - resolved "https://registry.yarnpkg.com/recompose/-/recompose-0.27.1.tgz#1a49e931f183634516633bbb4f4edbfd3f38a7ba" - integrity sha512-p7xsyi/rfNjHfdP7vPU02uSFa+Q1eHhjKrvO+3+kRP4Ortj+MxEmpmd+UQtBGM2D2iNAjzNI5rCyBKp9Ob5McA== - dependencies: - babel-runtime "^6.26.0" - change-emitter "^0.1.2" - fbjs "^0.8.1" - hoist-non-react-statics "^2.3.1" - react-lifecycles-compat "^3.0.2" - symbol-observable "^1.0.4" - redux-form@^8.3.8: version "8.3.9" resolved "https://registry.yarnpkg.com/redux-form/-/redux-form-8.3.9.tgz#bffd5c90b16c1559466f765374ecdd6cf4529155" @@ -7252,14 +7159,6 @@ redux-thunk@^2.4.1: resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.4.2.tgz#b9d05d11994b99f7a91ea223e8b04cf0afa5ef3b" integrity sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q== -redux@^4.0.0: - version "4.0.5" - resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.5.tgz#4db5de5816e17891de8a80c424232d06f051d93f" - integrity sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w== - dependencies: - loose-envify "^1.4.0" - symbol-observable "^1.2.0" - redux@^4.2.0: version "4.2.1" resolved "https://registry.yarnpkg.com/redux/-/redux-4.2.1.tgz#c08f4306826c49b5e9dc901dee0452ea8fce6197" @@ -7279,11 +7178,6 @@ regenerate@^1.4.2: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== -regenerator-runtime@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" - integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== - regenerator-runtime@^0.13.11: version "0.13.11" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" @@ -7511,7 +7405,7 @@ safe-regex-test@^1.0.0: get-intrinsic "^1.1.3" is-regex "^1.1.4" -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": +"safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -7610,11 +7504,6 @@ set-blocking@^2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -setimmediate@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= - shallow-clone@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" @@ -7622,11 +7511,6 @@ shallow-clone@^3.0.0: dependencies: kind-of "^6.0.2" -shallowequal@^1.0.2: - version "1.1.0" - resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" - integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== - shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -8004,11 +7888,6 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -symbol-observable@^1.0.4, symbol-observable@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" - integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== - symbol-observable@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205" @@ -8154,6 +8033,11 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" +tslib@^2.0.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + tslib@^2.1.0, tslib@^2.3.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" @@ -8217,11 +8101,6 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -ua-parser-js@^0.7.18: - version "0.7.21" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777" - integrity sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ== - uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" @@ -8491,11 +8370,6 @@ whatwg-encoding@^2.0.0: dependencies: iconv-lite "0.6.3" -whatwg-fetch@>=0.10.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" - integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== - whatwg-mimetype@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7"