formalute
Version:
A flexible drag-and-drop form builder powered by @dnd-kit and React.
1 lines • 178 kB
JavaScript
"use strict";var e=require("react"),t=require("react-dom"),r={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},a=e.createContext&&e.createContext(r),n=["attr","size","title"];function l(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},o.apply(this,arguments)}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){var a;return(t="symbol"==typeof(a=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t);if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?a:a+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(t){return t&&t.map(((t,r)=>e.createElement(t.tag,s({key:r},t.attr),d(t.child))))}function m(t){return r=>e.createElement(u,o({attr:s({},t.attr)},r),d(t.child))}function u(t){var i=r=>{var a,{attr:i,size:c,title:d}=t,m=l(t,n),u=c||r.size||"1em";return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),e.createElement("svg",o({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,i,m,{className:a,style:s(s({color:t.color||r.color},r.style),t.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),d&&e.createElement("title",null,d),t.children)};return void 0!==a?e.createElement(a.Consumer,null,(e=>i(e))):i(r)}function g(e){return m({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"},child:[]}]})(e)}function p(e){return m({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V192H0v272zm320-196c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM192 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM64 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zM400 64h-48V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H160V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H48C21.5 64 0 85.5 0 112v48h448v-48c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function h(e){return m({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 480H48c-26.51 0-48-21.49-48-48V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48zm-204.686-98.059l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.248-16.379-6.249-22.628 0L184 302.745l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.25 16.379 6.25 22.628.001z"},child:[]}]})(e)}function b(e){return m({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM96 424c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm0-96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm0-96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm96-192c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm128 368c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-96c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-96c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16z"},child:[]}]})(e)}function f(e){return m({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"},child:[]}]})(e)}function v(e){return m({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(e)}function y(e){return m({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"},child:[]}]})(e)}function x(e){return m({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(e)}function w(e){return m({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"},child:[]}]})(e)}function E(e){return m({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(e)}function k(e){return m({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"},child:[]}]})(e)}const C=({handleExpandToggle:t,handleSave:r,handleRenderer:a,handleIsMultiPart:n})=>{const[l,o]=e.useState(!1),i=e=>{o(!1),e&&e()};return e.createElement("div",{className:"w-full z-50 bg-white shadow-lg text-gray-800 p-3 flex justify-between items-center rounded-lg border-b border-gray-200"},e.createElement("div",{className:"text-lg md:text-2xl font-semibold tracking-wide text-gray-900"},"Formalute",e.createElement("span",{className:"text-blue-600"},"-JS")),e.createElement("div",{className:"hidden lg:flex space-x-4"},e.createElement("button",{onClick:()=>i(t),className:"flex items-center gap-2 text-gray-800 bg-white border border-green-500 px-4 py-2 rounded-lg hover:bg-green-100 transition"},e.createElement(x,null)," ",e.createElement("span",{className:"hidden sm:inline"},"Add Element")),e.createElement("button",{onClick:()=>i(n),className:"flex items-center gap-2 text-gray-800 bg-white border border-yellow-500 px-4 py-2 rounded-lg hover:bg-yellow-100 transition"},e.createElement(b,null)," ",e.createElement("span",{className:"hidden sm:inline"},"Multi-Part Form")),e.createElement("button",{onClick:()=>i(a),className:"flex items-center gap-2 text-gray-800 bg-white border border-teal-500 px-4 py-2 rounded-lg hover:bg-teal-100 transition"},e.createElement(f,null)," ",e.createElement("span",{className:"hidden sm:inline"},"Preview")),e.createElement("button",{onClick:()=>i(r),className:"flex items-center gap-2 text-gray-800 bg-white border border-blue-500 px-4 py-2 rounded-lg hover:bg-blue-100 transition"},e.createElement(w,null)," ",e.createElement("span",{className:"hidden sm:inline"},"Publish"))),e.createElement("div",{className:"lg:hidden"},e.createElement("button",{onClick:()=>o(!l),className:"text-gray-800 bg-transparent p-2 rounded-lg hover:bg-gray-200 focus:outline-none transition"},l?e.createElement(E,{size:24}):e.createElement(g,{size:24}))),e.createElement("div",{className:"lg:hidden absolute top-0 right-0 h-full w-3/4 max-w-xs bg-white bg-opacity-30 backdrop-blur-lg shadow-xl transition-transform duration-500 ease-in-out "+(l?"translate-x-0":"translate-x-full"),style:{backdropFilter:"blur(12px)"}},e.createElement("div",{className:"flex justify-between items-center p-[1.1rem] border-b border-gray-300"},e.createElement("div",{className:"text-lg font-semibold text-gray-900"},"Menu"),e.createElement("button",{onClick:()=>o(!1),className:"text-gray-800"},e.createElement(E,{size:24}))),e.createElement("div",{className:"flex flex-col items-center mt-6 space-y-4"},e.createElement("button",{onClick:()=>i(t),className:"flex items-center gap-2 text-gray-800 bg-white border border-green-500 px-6 py-3 rounded-lg w-3/4 text-center hover:bg-green-100 transition"},e.createElement(x,null)," Add Element"),e.createElement("button",{onClick:()=>i(n),className:"flex items-center gap-2 text-gray-800 bg-white border border-yellow-500 px-6 py-3 rounded-lg w-3/4 text-center hover:bg-yellow-100 transition"},e.createElement(b,null)," Multi-Part Form"),e.createElement("button",{onClick:()=>i(a),className:"flex items-center gap-2 text-gray-800 bg-white border border-teal-500 px-6 py-3 rounded-lg w-3/4 text-center hover:bg-teal-100 transition"},e.createElement(f,null)," Preview"),e.createElement("button",{onClick:()=>i(r),className:"flex items-center gap-2 text-gray-800 bg-white border border-blue-500 px-6 py-3 rounded-lg w-3/4 text-center hover:bg-blue-100 transition"},e.createElement(w,null)," Publish"))))},N=({handleConfirmDelete:t,setIsDeleteWarningVisible:r})=>e.createElement(e.Fragment,null,e.createElement("div",{className:"modal-overlay"}),e.createElement("div",{className:"modal"},e.createElement("p",null,"Are you sure you want to delete this element?"),e.createElement("button",{onClick:t},"Confirm"),e.createElement("button",{onClick:()=>r(!1)},"Cancel")));const z="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function D(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function M(e){return"nodeType"in e}function S(e){var t,r;return e?D(e)?e:M(e)&&null!=(t=null==(r=e.ownerDocument)?void 0:r.defaultView)?t:window:window}function R(e){const{Document:t}=S(e);return e instanceof t}function P(e){return!D(e)&&e instanceof S(e).HTMLElement}function T(e){return e instanceof S(e).SVGElement}function A(e){return e?D(e)?e.document:M(e)?R(e)?e:P(e)||T(e)?e.ownerDocument:document:document:document}const I=z?e.useLayoutEffect:e.useEffect;function L(t){const r=e.useRef(t);return I((()=>{r.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return null==r.current?void 0:r.current(...t)}),[])}function $(t,r){void 0===r&&(r=[t]);const a=e.useRef(t);return I((()=>{a.current!==t&&(a.current=t)}),r),a}function O(t,r){const a=e.useRef();return e.useMemo((()=>{const e=t(a.current);return a.current=e,e}),[...r])}function F(t){const r=L(t),a=e.useRef(null),n=e.useCallback((e=>{e!==a.current&&(null==r||r(e,a.current)),a.current=e}),[]);return[a,n]}function q(t){const r=e.useRef();return e.useEffect((()=>{r.current=t}),[t]),r.current}let V={};function H(t,r){return e.useMemo((()=>{if(r)return r;const e=null==V[t]?0:V[t]+1;return V[t]=e,t+"-"+e}),[t,r])}function j(e){return function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),n=1;n<r;n++)a[n-1]=arguments[n];return a.reduce(((t,r)=>{const a=Object.entries(r);for(const[r,n]of a){const a=t[r];null!=a&&(t[r]=a+e*n)}return t}),{...t})}}const B=j(1),U=j(-1);function X(e){if(!e)return!1;const{KeyboardEvent:t}=S(e.target);return t&&e instanceof t}function Y(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=S(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const Z=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Z.Translate.toString(e),Z.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}}),W="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function _(e){return e.matches(W)?e:e.querySelector(W)}const J={display:"none"};function K(t){let{id:r,value:a}=t;return e.createElement("div",{id:r,style:J},a)}function Q(t){let{id:r,announcement:a,ariaLiveType:n="assertive"}=t;return e.createElement("div",{id:r,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":n,"aria-atomic":!0},a)}const G=e.createContext(null);const ee={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 "},te={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function re(r){let{announcements:a=te,container:n,hiddenTextDescribedById:l,screenReaderInstructions:o=ee}=r;const{announce:i,announcement:s}=function(){const[t,r]=e.useState("");return{announce:e.useCallback((e=>{null!=e&&r(e)}),[]),announcement:t}}(),c=H("DndLiveRegion"),[d,m]=e.useState(!1);if(e.useEffect((()=>{m(!0)}),[]),function(t){const r=e.useContext(G);e.useEffect((()=>{if(!r)throw new Error("useDndMonitor must be used within a children of <DndContext>");return r(t)}),[t,r])}(e.useMemo((()=>({onDragStart(e){let{active:t}=e;i(a.onDragStart({active:t}))},onDragMove(e){let{active:t,over:r}=e;a.onDragMove&&i(a.onDragMove({active:t,over:r}))},onDragOver(e){let{active:t,over:r}=e;i(a.onDragOver({active:t,over:r}))},onDragEnd(e){let{active:t,over:r}=e;i(a.onDragEnd({active:t,over:r}))},onDragCancel(e){let{active:t,over:r}=e;i(a.onDragCancel({active:t,over:r}))}})),[i,a])),!d)return null;const u=e.createElement(e.Fragment,null,e.createElement(K,{id:l,value:o.draggable}),e.createElement(Q,{id:c,announcement:s}));return n?t.createPortal(u,n):u}var ae;function ne(){}function le(t,r){return e.useMemo((()=>({sensor:t,options:null!=r?r:{}})),[t,r])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(ae||(ae={}));const oe=Object.freeze({x:0,y:0});function ie(e,t){const r=Y(e);if(!r)return"0 0";return(r.x-t.left)/t.width*100+"% "+(r.y-t.top)/t.height*100+"%"}function se(e,t){let{data:{value:r}}=e,{data:{value:a}}=t;return r-a}function ce(e,t){let{data:{value:r}}=e,{data:{value:a}}=t;return a-r}function de(e){let{left:t,top:r,height:a,width:n}=e;return[{x:t,y:r},{x:t+n,y:r},{x:t,y:r+a},{x:t+n,y:r+a}]}function me(e,t){if(!e||0===e.length)return null;const[r]=e;return r[t]}function ue(e,t){const r=Math.max(t.top,e.top),a=Math.max(t.left,e.left),n=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),o=n-a,i=l-r;if(a<n&&r<l){const r=t.width*t.height,a=e.width*e.height,n=o*i;return Number((n/(r+a-n)).toFixed(4))}return 0}const ge=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=e;const n=[];for(const e of a){const{id:a}=e,l=r.get(a);if(l){const r=ue(l,t);r>0&&n.push({id:a,data:{droppableContainer:e,value:r}})}}return n.sort(ce)};function pe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:oe}function he(e){return function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),n=1;n<r;n++)a[n-1]=arguments[n];return a.reduce(((t,r)=>({...t,top:t.top+e*r.y,bottom:t.bottom+e*r.y,left:t.left+e*r.x,right:t.right+e*r.x})),{...t})}}const be=he(1);function fe(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const ve={ignoreTransform:!1};function ye(e,t){void 0===t&&(t=ve);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:a}=S(e).getComputedStyle(e);t&&(r=function(e,t,r){const a=fe(t);if(!a)return e;const{scaleX:n,scaleY:l,x:o,y:i}=a,s=e.left-o-(1-n)*parseFloat(r),c=e.top-i-(1-l)*parseFloat(r.slice(r.indexOf(" ")+1)),d=n?e.width/n:e.width,m=l?e.height/l:e.height;return{width:d,height:m,top:c,right:s+d,bottom:c+m,left:s}}(r,t,a))}const{top:a,left:n,width:l,height:o,bottom:i,right:s}=r;return{top:a,left:n,width:l,height:o,bottom:i,right:s}}function xe(e){return ye(e,{ignoreTransform:!0})}function we(e,t){const r=[];return e?function a(n){if(null!=t&&r.length>=t)return r;if(!n)return r;if(R(n)&&null!=n.scrollingElement&&!r.includes(n.scrollingElement))return r.push(n.scrollingElement),r;if(!P(n)||T(n))return r;if(r.includes(n))return r;const l=S(e).getComputedStyle(n);return n!==e&&function(e,t){void 0===t&&(t=S(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const a=t[e];return"string"==typeof a&&r.test(a)}))}(n,l)&&r.push(n),function(e,t){return void 0===t&&(t=S(e).getComputedStyle(e)),"fixed"===t.position}(n,l)?r:a(n.parentNode)}(e):r}function Ee(e){const[t]=we(e,1);return null!=t?t:null}function ke(e){return z&&e?D(e)?e:M(e)?R(e)||e===A(e).scrollingElement?window:P(e)?e:null:null:null}function Ce(e){return D(e)?e.scrollX:e.scrollLeft}function Ne(e){return D(e)?e.scrollY:e.scrollTop}function ze(e){return{x:Ce(e),y:Ne(e)}}var De;function Me(e){return!(!z||!e)&&e===document.scrollingElement}function Se(e){const t={x:0,y:0},r=Me(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=a.y,isRight:e.scrollLeft>=a.x,maxScroll:a,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(De||(De={}));const Re={x:.2,y:.2};function Pe(e,t,r,a,n){let{top:l,left:o,right:i,bottom:s}=r;void 0===a&&(a=10),void 0===n&&(n=Re);const{isTop:c,isBottom:d,isLeft:m,isRight:u}=Se(e),g={x:0,y:0},p={x:0,y:0},h=t.height*n.y,b=t.width*n.x;return!c&&l<=t.top+h?(g.y=De.Backward,p.y=a*Math.abs((t.top+h-l)/h)):!d&&s>=t.bottom-h&&(g.y=De.Forward,p.y=a*Math.abs((t.bottom-h-s)/h)),!u&&i>=t.right-b?(g.x=De.Forward,p.x=a*Math.abs((t.right-b-i)/b)):!m&&o<=t.left+b&&(g.x=De.Backward,p.x=a*Math.abs((t.left+b-o)/b)),{direction:g,speed:p}}function Te(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:r,right:a,bottom:n}=e.getBoundingClientRect();return{top:t,left:r,right:a,bottom:n,width:e.clientWidth,height:e.clientHeight}}function Ae(e){return e.reduce(((e,t)=>B(e,ze(t))),oe)}function Ie(e,t){if(void 0===t&&(t=ye),!e)return;const{top:r,left:a,bottom:n,right:l}=t(e);Ee(e)&&(n<=0||l<=0||r>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Le=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Ce(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Ne(t)),0)}]];class $e{constructor(e,t){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 r=we(t),a=Ae(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,n]of Le)for(const l of t)Object.defineProperty(this,l,{get:()=>{const t=n(r),o=a[e]-t;return this.rect[l]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Oe{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,r){var a;null==(a=this.target)||a.addEventListener(e,t,r),this.listeners.push([e,t,r])}}function Fe(e,t){const r=Math.abs(e.x),a=Math.abs(e.y);return"number"==typeof t?Math.sqrt(r**2+a**2)>t:"x"in t&&"y"in t?r>t.x&&a>t.y:"x"in t?r>t.x:"y"in t&&a>t.y}var qe,Ve;function He(e){e.preventDefault()}function je(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(qe||(qe={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Ve||(Ve={}));const Be={start:[Ve.Space,Ve.Enter],cancel:[Ve.Esc],end:[Ve.Space,Ve.Enter,Ve.Tab]},Ue=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ve.Right:return{...r,x:r.x+25};case Ve.Left:return{...r,x:r.x-25};case Ve.Down:return{...r,y:r.y+25};case Ve.Up:return{...r,y:r.y-25}}};class Xe{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Oe(A(t)),this.windowListeners=new Oe(S(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qe.Resize,this.handleCancel),this.windowListeners.add(qe.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(qe.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,r=e.node.current;r&&Ie(r),t(oe)}handleKeyDown(e){if(X(e)){const{active:t,context:r,options:a}=this.props,{keyboardCodes:n=Be,coordinateGetter:l=Ue,scrollBehavior:o="smooth"}=a,{code:i}=e;if(n.end.includes(i))return void this.handleEnd(e);if(n.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:s}=r.current,c=s?{x:s.left,y:s.top}:oe;this.referenceCoordinates||(this.referenceCoordinates=c);const d=l(e,{active:t,context:r.current,currentCoordinates:c});if(d){const t=U(d,c),a={x:0,y:0},{scrollableAncestors:n}=r.current;for(const r of n){const n=e.code,{isTop:l,isRight:i,isLeft:s,isBottom:c,maxScroll:m,minScroll:u}=Se(r),g=Te(r),p={x:Math.min(n===Ve.Right?g.right-g.width/2:g.right,Math.max(n===Ve.Right?g.left:g.left+g.width/2,d.x)),y:Math.min(n===Ve.Down?g.bottom-g.height/2:g.bottom,Math.max(n===Ve.Down?g.top:g.top+g.height/2,d.y))},h=n===Ve.Right&&!i||n===Ve.Left&&!s,b=n===Ve.Down&&!c||n===Ve.Up&&!l;if(h&&p.x!==d.x){const e=r.scrollLeft+t.x,l=n===Ve.Right&&e<=m.x||n===Ve.Left&&e>=u.x;if(l&&!t.y)return void r.scrollTo({left:e,behavior:o});a.x=l?r.scrollLeft-e:n===Ve.Right?r.scrollLeft-m.x:r.scrollLeft-u.x,a.x&&r.scrollBy({left:-a.x,behavior:o});break}if(b&&p.y!==d.y){const e=r.scrollTop+t.y,l=n===Ve.Down&&e<=m.y||n===Ve.Up&&e>=u.y;if(l&&!t.x)return void r.scrollTo({top:e,behavior:o});a.y=l?r.scrollTop-e:n===Ve.Down?r.scrollTop-m.y:r.scrollTop-u.y,a.y&&r.scrollBy({top:-a.y,behavior:o});break}}this.handleMove(e,B(U(d,this.referenceCoordinates),a))}}}handleMove(e,t){const{onMove:r}=this.props;e.preventDefault(),r(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Ye(e){return Boolean(e&&"distance"in e)}function Ze(e){return Boolean(e&&"delay"in e)}Xe.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:a=Be,onActivation:n}=t,{active:l}=r;const{code:o}=e.nativeEvent;if(a.start.includes(o)){const t=l.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}return!1}}];class We{constructor(e,t,r){var a;void 0===r&&(r=function(e){const{EventTarget:t}=S(e);return e instanceof t?e:A(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:n}=e,{target:l}=n;this.props=e,this.events=t,this.document=A(l),this.documentListeners=new Oe(this.document),this.listeners=new Oe(r),this.windowListeners=new Oe(S(l)),this.initialCoordinates=null!=(a=Y(n))?a:oe,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:e,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(qe.Resize,this.handleCancel),this.windowListeners.add(qe.DragStart,He),this.windowListeners.add(qe.VisibilityChange,this.handleCancel),this.windowListeners.add(qe.ContextMenu,He),this.documentListeners.add(qe.Keydown,this.handleKeydown),t){if(null!=r&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ze(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Ye(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:r,onPending:a}=this.props;a(r,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(qe.Click,je,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qe.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:r,initialCoordinates:a,props:n}=this,{onMove:l,options:{activationConstraint:o}}=n;if(!a)return;const i=null!=(t=Y(e))?t:oe,s=U(a,i);if(!r&&o){if(Ye(o)){if(null!=o.tolerance&&Fe(s,o.tolerance))return this.handleCancel();if(Fe(s,o.distance))return this.handleStart()}return Ze(o)&&Fe(s,o.tolerance)?this.handleCancel():void this.handlePending(o,s)}e.cancelable&&e.preventDefault(),l(i)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Ve.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const _e={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Je extends We{constructor(e){const{event:t}=e,r=A(t.target);super(e,_e,r)}}Je.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;return!(!r.isPrimary||0!==r.button)&&(null==a||a({event:r}),!0)}}];const Ke={move:{name:"mousemove"},end:{name:"mouseup"}};var Qe;!function(e){e[e.RightClick=2]="RightClick"}(Qe||(Qe={}));(class extends We{constructor(e){super(e,Ke,A(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;return r.button!==Qe.RightClick&&(null==a||a({event:r}),!0)}}];const Ge={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var et,tt;function rt(t){let{acceleration:r,activator:a=et.Pointer,canScroll:n,draggingRect:l,enabled:o,interval:i=5,order:s=tt.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:m,delta:u,threshold:g}=t;const p=function(e){let{delta:t,disabled:r}=e;const a=q(t);return O((e=>{if(r||!a||!e)return at;const n={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[De.Backward]:e.x[De.Backward]||-1===n.x,[De.Forward]:e.x[De.Forward]||1===n.x},y:{[De.Backward]:e.y[De.Backward]||-1===n.y,[De.Forward]:e.y[De.Forward]||1===n.y}}}),[r,t,a])}({delta:u,disabled:!o}),[h,b]=function(){const t=e.useRef(null);return[e.useCallback(((e,r)=>{t.current=setInterval(e,r)}),[]),e.useCallback((()=>{null!==t.current&&(clearInterval(t.current),t.current=null)}),[])]}(),f=e.useRef({x:0,y:0}),v=e.useRef({x:0,y:0}),y=e.useMemo((()=>{switch(a){case et.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case et.DraggableRect:return l}}),[a,l,c]),x=e.useRef(null),w=e.useCallback((()=>{const e=x.current;if(!e)return;const t=f.current.x*v.current.x,r=f.current.y*v.current.y;e.scrollBy(t,r)}),[]),E=e.useMemo((()=>s===tt.TreeOrder?[...d].reverse():d),[s,d]);e.useEffect((()=>{if(o&&d.length&&y){for(const e of E){if(!1===(null==n?void 0:n(e)))continue;const t=d.indexOf(e),a=m[t];if(!a)continue;const{direction:l,speed:o}=Pe(e,a,y,r,g);for(const e of["x","y"])p[e][l[e]]||(o[e]=0,l[e]=0);if(o.x>0||o.y>0)return b(),x.current=e,h(w,i),f.current=o,void(v.current=l)}f.current={x:0,y:0},v.current={x:0,y:0},b()}else b()}),[r,w,n,b,o,i,JSON.stringify(y),JSON.stringify(p),h,d,E,m,JSON.stringify(g)])}(class extends We{constructor(e){super(e,Ge)}static setup(){return window.addEventListener(Ge.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ge.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;const{touches:n}=r;return!(n.length>1)&&(null==a||a({event:r}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(et||(et={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(tt||(tt={}));const at={x:{[De.Backward]:!1,[De.Forward]:!1},y:{[De.Backward]:!1,[De.Forward]:!1}};var nt,lt;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(nt||(nt={})),function(e){e.Optimized="optimized"}(lt||(lt={}));const ot=new Map;function it(e,t){return O((r=>e?r||("function"==typeof t?t(e):e):null),[t,e])}function st(t){let{callback:r,disabled:a}=t;const n=L(r),l=e.useMemo((()=>{if(a||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(n)}),[a]);return e.useEffect((()=>()=>null==l?void 0:l.disconnect()),[l]),l}function ct(e){return new $e(ye(e),e)}function dt(t,r,a){void 0===r&&(r=ct);const[n,l]=e.useState(null);function o(){l((e=>{if(!t)return null;var n;if(!1===t.isConnected)return null!=(n=null!=e?e:a)?n:null;const l=r(t);return JSON.stringify(e)===JSON.stringify(l)?e:l}))}const i=function(t){let{callback:r,disabled:a}=t;const n=L(r),l=e.useMemo((()=>{if(a||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(n)}),[n,a]);return e.useEffect((()=>()=>null==l?void 0:l.disconnect()),[l]),l}({callback(e){if(t)for(const r of e){const{type:e,target:a}=r;if("childList"===e&&a instanceof HTMLElement&&a.contains(t)){o();break}}}}),s=st({callback:o});return I((()=>{o(),t?(null==s||s.observe(t),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==i||i.disconnect())}),[t]),n}const mt=[];function ut(t,r){void 0===r&&(r=[]);const a=e.useRef(null);return e.useEffect((()=>{a.current=null}),r),e.useEffect((()=>{const e=t!==oe;e&&!a.current&&(a.current=t),!e&&a.current&&(a.current=null)}),[t]),a.current?U(t,a.current):oe}function gt(t){return e.useMemo((()=>t?function(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}(t):null),[t])}const pt=[];function ht(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return P(t)?t:e}const bt=[{sensor:Je,options:{}},{sensor:Xe,options:{}}],ft={current:{}},vt={draggable:{measure:xe},droppable:{measure:xe,strategy:nt.WhileDragging,frequency:lt.Optimized},dragOverlay:{measure:ye}};class yt extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,r;return null!=(t=null==(r=this.get(e))?void 0:r.node.current)?t:void 0}}const xt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new yt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ne},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:vt,measureDroppableContainers:ne,windowRect:null,measuringScheduled:!1},wt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ne,draggableNodes:new Map,over:null,measureDroppableContainers:ne},Et=e.createContext(wt),kt=e.createContext(xt);function Ct(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new yt}}}function Nt(e,t){switch(t.type){case ae.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ae.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ae.DragEnd:case ae.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ae.RegisterDroppable:{const{element:r}=t,{id:a}=r,n=new yt(e.droppable.containers);return n.set(a,r),{...e,droppable:{...e.droppable,containers:n}}}case ae.SetDroppableDisabled:{const{id:r,key:a,disabled:n}=t,l=e.droppable.containers.get(r);if(!l||a!==l.key)return e;const o=new yt(e.droppable.containers);return o.set(r,{...l,disabled:n}),{...e,droppable:{...e.droppable,containers:o}}}case ae.UnregisterDroppable:{const{id:r,key:a}=t,n=e.droppable.containers.get(r);if(!n||a!==n.key)return e;const l=new yt(e.droppable.containers);return l.delete(r),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function zt(t){let{disabled:r}=t;const{active:a,activatorEvent:n,draggableNodes:l}=e.useContext(Et),o=q(n),i=q(null==a?void 0:a.id);return e.useEffect((()=>{if(!r&&!n&&o&&null!=i){if(!X(o))return;if(document.activeElement===o.target)return;const e=l.get(i);if(!e)return;const{activatorNode:t,node:r}=e;if(!t.current&&!r.current)return;requestAnimationFrame((()=>{for(const e of[t.current,r.current]){if(!e)continue;const t=_(e);if(t){t.focus();break}}}))}}),[n,r,l,i,o]),null}function Dt(e,t){let{transform:r,...a}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...a})),r):r}const Mt=e.createContext({...oe,scaleX:1,scaleY:1});var St;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(St||(St={}));const Rt=e.memo((function(r){var a,n,l,o;let{id:i,accessibility:s,autoScroll:c=!0,children:d,sensors:m=bt,collisionDetection:u=ge,measuring:g,modifiers:p,...h}=r;const b=e.useReducer(Nt,void 0,Ct),[f,v]=b,[y,x]=function(){const[t]=e.useState((()=>new Set)),r=e.useCallback((e=>(t.add(e),()=>t.delete(e))),[t]);return[e.useCallback((e=>{let{type:r,event:a}=e;t.forEach((e=>{var t;return null==(t=e[r])?void 0:t.call(e,a)}))}),[t]),r]}(),[w,E]=e.useState(St.Uninitialized),k=w===St.Initialized,{draggable:{active:C,nodes:N,translate:D},droppable:{containers:M}}=f,R=null!=C?N.get(C):null,T=e.useRef({initial:null,translated:null}),A=e.useMemo((()=>{var e;return null!=C?{id:C,data:null!=(e=null==R?void 0:R.data)?e:ft,rect:T}:null}),[C,R]),L=e.useRef(null),[q,V]=e.useState(null),[j,U]=e.useState(null),X=$(h,Object.values(h)),Z=H("DndDescribedBy",i),W=e.useMemo((()=>M.getEnabled()),[M]),_=function(t){return e.useMemo((()=>({draggable:{...vt.draggable,...null==t?void 0:t.draggable},droppable:{...vt.droppable,...null==t?void 0:t.droppable},dragOverlay:{...vt.dragOverlay,...null==t?void 0:t.dragOverlay}})),[null==t?void 0:t.draggable,null==t?void 0:t.droppable,null==t?void 0:t.dragOverlay])}(g),{droppableRects:J,measureDroppableContainers:K,measuringScheduled:Q}=function(t,r){let{dragging:a,dependencies:n,config:l}=r;const[o,i]=e.useState(null),{frequency:s,measure:c,strategy:d}=l,m=e.useRef(t),u=function(){switch(d){case nt.Always:return!1;case nt.BeforeDragging:return a;default:return!a}}(),g=$(u),p=e.useCallback((function(e){void 0===e&&(e=[]),g.current||i((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[g]),h=e.useRef(null),b=O((e=>{if(u&&!a)return ot;if(!e||e===ot||m.current!==t||null!=o){const e=new Map;for(let r of t){if(!r)continue;if(o&&o.length>0&&!o.includes(r.id)&&r.rect.current){e.set(r.id,r.rect.current);continue}const t=r.node.current,a=t?new $e(c(t),t):null;r.rect.current=a,a&&e.set(r.id,a)}return e}return e}),[t,o,a,u,c]);return e.useEffect((()=>{m.current=t}),[t]),e.useEffect((()=>{u||p()}),[a,u]),e.useEffect((()=>{o&&o.length>0&&i(null)}),[JSON.stringify(o)]),e.useEffect((()=>{u||"number"!=typeof s||null!==h.current||(h.current=setTimeout((()=>{p(),h.current=null}),s))}),[s,u,p,...n]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:null!=o}}(W,{dragging:k,dependencies:[D.x,D.y],config:_.droppable}),ee=function(e,t){const r=null!=t?e.get(t):void 0,a=r?r.node.current:null;return O((e=>{var r;return null==t?null:null!=(r=null!=a?a:e)?r:null}),[a,t])}(N,C),te=e.useMemo((()=>j?Y(j):null),[j]),ne=function(){const e=!1===(null==q?void 0:q.autoScrollEnabled),t="object"==typeof c?!1===c.enabled:!1===c,r=k&&!e&&!t;if("object"==typeof c)return{...c,enabled:r};return{enabled:r}}(),le=function(e,t){return it(e,t)}(ee,_.draggable.measure);!function(t){let{activeNode:r,measure:a,initialRect:n,config:l=!0}=t;const o=e.useRef(!1),{x:i,y:s}="boolean"==typeof l?{x:l,y:l}:l;I((()=>{if(!i&&!s||!r)return void(o.current=!1);if(o.current||!n)return;const e=null==r?void 0:r.node.current;if(!e||!1===e.isConnected)return;const t=pe(a(e),n);if(i||(t.x=0),s||(t.y=0),o.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){const r=Ee(e);r&&r.scrollBy({top:t.y,left:t.x})}}),[r,i,s,n,a])}({activeNode:null!=C?N.get(C):null,config:ne.layoutShiftCompensation,initialRect:le,measure:_.draggable.measure});const ie=dt(ee,_.draggable.measure,le),se=dt(ee?ee.parentElement:null),ce=e.useRef({activatorEvent:null,active:null,activeNode:ee,collisionRect:null,collisions:null,droppableRects:J,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),de=M.getNodeFor(null==(a=ce.current.over)?void 0:a.id),ue=function(t){let{measure:r}=t;const[a,n]=e.useState(null),l=st({callback:e.useCallback((e=>{for(const{target:t}of e)if(P(t)){n((e=>{const a=r(t);return e?{...e,width:a.width,height:a.height}:a}));break}}),[r])}),o=e.useCallback((e=>{const t=ht(e);null==l||l.disconnect(),t&&(null==l||l.observe(t)),n(t?r(t):null)}),[r,l]),[i,s]=F(o);return e.useMemo((()=>({nodeRef:i,rect:a,setRef:s})),[a,i,s])}({measure:_.dragOverlay.measure}),he=null!=(n=ue.nodeRef.current)?n:ee,fe=k?null!=(l=ue.rect)?l:ie:null,ve=Boolean(ue.nodeRef.current&&ue.rect),xe=pe(Ce=ve?null:ie,it(Ce));var Ce;const Ne=gt(he?S(he):null),De=function(t){const r=e.useRef(t),a=O((e=>t?e&&e!==mt&&t&&r.current&&t.parentNode===r.current.parentNode?e:we(t):mt),[t]);return e.useEffect((()=>{r.current=t}),[t]),a}(k?null!=de?de:ee:null),Se=function(t,r){void 0===r&&(r=ye);const[a]=t,n=gt(a?S(a):null),[l,o]=e.useState(pt);function i(){o((()=>t.length?t.map((e=>Me(e)?n:new $e(r(e),e))):pt))}const s=st({callback:i});return I((()=>{null==s||s.disconnect(),i(),t.forEach((e=>null==s?void 0:s.observe(e)))}),[t]),l}(De),Re=Dt(p,{transform:{x:D.x-xe.x,y:D.y-xe.y,scaleX:1,scaleY:1},activatorEvent:j,active:A,activeNodeRect:ie,containerNodeRect:se,draggingNodeRect:fe,over:ce.current.over,overlayNodeRect:ue.rect,scrollableAncestors:De,scrollableAncestorRects:Se,windowRect:Ne}),Pe=te?B(te,D):null,Te=function(t){const[r,a]=e.useState(null),n=e.useRef(t),l=e.useCallback((e=>{const t=ke(e.target);t&&a((e=>e?(e.set(t,ze(t)),new Map(e)):null))}),[]);return e.useEffect((()=>{const e=n.current;if(t!==e){r(e);const o=t.map((e=>{const t=ke(e);return t?(t.addEventListener("scroll",l,{passive:!0}),[t,ze(t)]):null})).filter((e=>null!=e));a(o.length?new Map(o):null),n.current=t}return()=>{r(t),r(e)};function r(e){e.forEach((e=>{const t=ke(e);null==t||t.removeEventListener("scroll",l)}))}}),[l,t]),e.useMemo((()=>t.length?r?Array.from(r.values()).reduce(((e,t)=>B(e,t)),oe):Ae(t):oe),[t,r])}(De),Ie=ut(Te),Le=ut(Te,[ie]),Oe=B(Re,Ie),Fe=fe?be(fe,Re):null,qe=A&&Fe?u({active:A,collisionRect:Fe,droppableRects:J,droppableContainers:W,pointerCoordinates:Pe}):null,Ve=me(qe,"id"),[He,je]=e.useState(null),Be=function(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}(ve?Re:B(Re,Le),null!=(o=null==He?void 0:He.rect)?o:null,ie),Ue=e.useRef(null),Xe=e.useCallback(((e,r)=>{let{sensor:a,options:n}=r;if(null==L.current)return;const l=N.get(L.current);if(!l)return;const o=e.nativeEvent,i=new a({active:L.current,activeNode:l,event:o,options:n,context:ce,onAbort(e){if(!N.get(e))return;const{onDragAbort:t}=X.current,r={id:e};null==t||t(r),y({type:"onDragAbort",event:r})},onPending(e,t,r,a){if(!N.get(e))return;const{onDragPending:n}=X.current,l={id:e,constraint:t,initialCoordinates:r,offset:a};null==n||n(l),y({type:"onDragPending",event:l})},onStart(e){const r=L.current;if(null==r)return;const a=N.get(r);if(!a)return;const{onDragStart:n}=X.current,l={activatorEvent:o,active:{id:r,data:a.data,rect:T}};t.unstable_batchedUpdates((()=>{null==n||n(l),E(St.Initializing),v({type:ae.DragStart,initialCoordinates:e,active:r}),y({type:"onDragStart",event:l}),V(Ue.current),U(o)}))},onMove(e){v({type:ae.DragMove,coordinates:e})},onEnd:s(ae.DragEnd),onCancel:s(ae.DragCancel)});function s(e){return async function(){const{active:r,collisions:a,over:n,scrollAdjustedTranslate:l}=ce.current;let i=null;if(r&&l){const{cancelDrop:t}=X.current;if(i={activatorEvent:o,active:r,collisions:a,delta:l,over:n},e===ae.DragEnd&&"function"==typeof t){await Promise.resolve(t(i))&&(e=ae.DragCancel)}}L.current=null,t.unstable_batchedUpdates((()=>{v({type:e}),E(St.Uninitialized),je(null),V(null),U(null),Ue.current=null;const t=e===ae.DragEnd?"onDragEnd":"onDragCancel";if(i){const e=X.current[t];null==e||e(i),y({type:t,event:i})}}))}}Ue.current=i}),[N]),Ye=e.useCallback(((e,t)=>(r,a)=>{const n=r.nativeEvent,l=N.get(a);if(null!==L.current||!l||n.dndKit||n.defaultPrevented)return;const o={active:l};!0===e(r,t.options,o)&&(n.dndKit={capturedBy:t.sensor},L.current=a,Xe(r,t))}),[N,Xe]),Ze=function(t,r){return e.useMemo((()=>t.reduce(((e,t)=>{const{sensor:a}=t;return[...e,...a.activators.map((e=>({eventName:e.eventName,handler:r(e.handler,t)})))]}),[])),[t,r])}(m,Ye);!function(t){e.useEffect((()=>{if(!z)return;const e=t.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const t of e)null==t||t()}}),t.map((e=>{let{sensor:t}=e;return t})))}(m),I((()=>{ie&&w===St.Initializing&&E(St.Initialized)}),[ie,w]),e.useEffect((()=>{const{onDragMove:e}=X.current,{active:r,activatorEvent:a,collisions:n,over:l}=ce.current;if(!r||!a)return;const o={active:r,activatorEvent:a,collisions:n,delta:{x:Oe.x,y:Oe.y},over:l};t.unstable_batchedUpdates((()=>{null==e||e(o),y({type:"onDragMove",event:o})}))}),[Oe.x,Oe.y]),e.useEffect((()=>{const{active:e,activatorEvent:r,collisions:a,droppableContainers:n,scrollAdjustedTranslate:l}=ce.current;if(!e||null==L.current||!r||!l)return;const{onDragOver:o}=X.current,i=n.get(Ve),s=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,c={active:e,activatorEvent:r,collisions:a,delta:{x:l.x,y:l.y},over:s};t.unstable_batchedUpdates((()=>{je(s),null==o||o(c),y({type:"onDragOver",event:c})}))}),[Ve]),I((()=>{ce.current={activatorEvent:j,active:A,activeNode:ee,collisionRect:Fe,collisions:qe,droppableRects:J,draggableNodes:N,draggingNode:he,draggingNodeRect:fe,droppableContainers:M,over:He,scrollableAncestors:De,scrollAdjustedTranslate:Oe},T.current={initial:fe,translated:Fe}}),[A,ee,qe,Fe,N,he,fe,J,M,He,De,Oe]),rt({...ne,delta:D,draggingRect:Fe,pointerCoordinates:Pe,scrollableAncestors:De,scrollableAncestorRects:Se});const We=e.useMemo((()=>({active:A,activeNode:ee,activeNodeRect:ie,activatorEvent:j,collisions:qe,containerNodeRect:se,dragOverlay:ue,draggableNodes:N,droppableContainers:M,droppableRects:J,over:He,measureDroppableContainers:K,scrollableAncestors:De,scrollableAncestorRects:Se,measuringConfiguration:_,measuringScheduled:Q,windowRect:Ne})),[A,ee,ie,j,qe,se,ue,N,M,J,He,K,De,Se,_,Q,Ne]),_e=e.useMemo((()=>({activatorEvent:j,activators:Ze,active:A,activeNodeRect:ie,ariaDescribedById:{draggable:Z},dispatch:v,draggableNodes:N,over:He,measureDroppableContainers:K})),[j,Ze,A,ie,v,Z,N,He,K]);return e.createElement(G.Provider,{value:x},e.createElement(Et.Provider,{value:_e},e.createElement(kt.Provider,{value:We},e.createElement(Mt.Provider,{value:Be},d)),e.createElement(zt,{disabled:!1===(null==s?void 0:s.restoreFocus)})),e.createElement(re,{...s,hiddenTextDescribedById:Z}))})),Pt=e.createContext(null),Tt="button";function At(t){let{id:r,data:a,disabled:n=!1,attributes:l}=t;const o=H("Draggable"),{activators:i,activatorEvent:s,active:c,activeNodeRect:d,ariaDescribedById:m,draggableNodes:u,over:g}=e.useContext(Et),{role:p=Tt,roleDescription:h="draggable",tabIndex:b=0}=null!=l?l:{},f=(null==c?void 0:c.id)===r,v=e.useContext(f?Mt:Pt),[y,x]=F(),[w,E]=F(),k=function(t,r){return e.useMemo((()=>t.reduce(((e,t)=>{let{eventName:a,handler:n}=t;return e[a]=e=>{n(e,r)},e}),{})),[t,r])}(i,r),C=$(a);I((()=>(u.set(r,{id:r,key:o,node:y,activatorNode:w,data:C}),()=>{const e=u.get(r);e&&e.key===o&&u.delete(r)})),[u,r]);return{active:c,activatorEvent:s,activeNodeRect:d,attributes:e.useMemo((()=>({role:p,tabIndex:b,"aria-disabled":n,"aria-pressed":!(!f||p!==Tt)||void 0,"aria-roledescription":h,"aria-describedby":m.draggable})),[n,p,b,f,h,m.draggable]),isDragging:f,listeners:n?void 0:k,node:y,over:g,setNodeRef:x,setActivatorNodeRef:E,transform:v}}function It(){return e.useContext(kt)}const Lt={timeout:25};function $t(t){let{animation:r,children:a}=t;const[n,l]=e.useState(null),[o,i]=e.useState(null),s=q(a);return a||n||!s||l(s),I((()=>{if(!o)return;const e=null==n?void 0:n.key,t=null==n?void 0:n.props.id;null!=e&&null!=t?Promise.resolve(r(t,o)).then((()=>{l(null)})):l(null)}),[r,n,o]),e.createElement(e.Fragment