reactdesk-core
Version:
A powerful React-based desktop environment library for creating Windows 11-like desktop interfaces with window management, taskbar, themes, and more
1 lines • 100 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),i=require("./index-B8LTnm77.js"),o=require("react-dom"),n=require("styled-components"),r=require("./useTitlebarContextMenu-Bggb47Lr.js"),s=require("./WindowActionIcons-Bm1GKve8.js");var a,l,u,c,d,p,h,f,g,m,b,v,y={exports:{}},w={},x={exports:{}};function S(){if(l)return a;l=1;var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;return a=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(n){return!1}}()?Object.assign:function(o,n){for(var r,s,a=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(o),l=1;l<arguments.length;l++){for(var u in r=Object(arguments[l]))e.call(r,u)&&(a[u]=r[u]);if(t){s=t(r);for(var c=0;c<s.length;c++)i.call(r,s[c])&&(a[s[c]]=r[s[c]])}}return a},a}function z(){if(c)return u;c=1;return u="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function E(){return p?d:(p=1,d=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var R=i.reactIsExports;x.exports=function(){if(m)return g;m=1;var t=i.reactIsExports,e=S(),o=z(),n=E(),r=function(){if(f)return h;f=1;var t=function(){};if("production"!==process.env.NODE_ENV){var e=z(),i={},o=E();t=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(i){}}}function n(n,r,s,a,l){if("production"!==process.env.NODE_ENV)for(var u in n)if(o(n,u)){var c;try{if("function"!=typeof n[u]){var d=Error((a||"React class")+": "+s+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}c=n[u](r,u,a,s,null,e)}catch(h){c=h}if(!c||c instanceof Error||t((a||"React class")+": type specification of "+s+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in i)){i[c.message]=!0;var p=l?l():"";t("Failed "+s+" type: "+c.message+(null!=p?p:""))}}}return n.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(i={})},h=n}(),s=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(s=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(i){}}),g=function(i,l){var u="function"==typeof Symbol&&Symbol.iterator,c="<<anonymous>>",d={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:f(a),arrayOf:function(t){return f(function(e,i,n,r,s){if("function"!=typeof t)return new h("Property `"+s+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var a=e[i];if(!Array.isArray(a))return new h("Invalid "+r+" `"+s+"` of type `"+v(a)+"` supplied to `"+n+"`, expected an array.");for(var l=0;l<a.length;l++){var u=t(a,l,n,r,s+"["+l+"]",o);if(u instanceof Error)return u}return null})},element:f(function(t,e,o,n,r){var s=t[e];return i(s)?null:new h("Invalid "+n+" `"+r+"` of type `"+v(s)+"` supplied to `"+o+"`, expected a single ReactElement.")}),elementType:f(function(e,i,o,n,r){var s=e[i];return t.isValidElementType(s)?null:new h("Invalid "+n+" `"+r+"` of type `"+v(s)+"` supplied to `"+o+"`, expected a single ReactElement type.")}),instanceOf:function(t){return f(function(e,i,o,n,r){if(!(e[i]instanceof t)){var s=t.name||c;return new h("Invalid "+n+" `"+r+"` of type `"+((a=e[i]).constructor&&a.constructor.name?a.constructor.name:c)+"` supplied to `"+o+"`, expected instance of `"+s+"`.")}var a;return null})},node:f(function(t,e,i,o,n){return b(t[e])?null:new h("Invalid "+o+" `"+n+"` supplied to `"+i+"`, expected a ReactNode.")}),objectOf:function(t){return f(function(e,i,r,s,a){if("function"!=typeof t)return new h("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var l=e[i],u=v(l);if("object"!==u)return new h("Invalid "+s+" `"+a+"` of type `"+u+"` supplied to `"+r+"`, expected an object.");for(var c in l)if(n(l,c)){var d=t(l,c,r,s,a+"."+c,o);if(d instanceof Error)return d}return null})},oneOf:function(t){return Array.isArray(t)?f(function(e,i,o,n,r){for(var s=e[i],a=0;a<t.length;a++)if(p(s,t[a]))return null;var l=JSON.stringify(t,function(t,e){return"symbol"===y(e)?String(e):e});return new h("Invalid "+n+" `"+r+"` of value `"+String(s)+"` supplied to `"+o+"`, expected one of "+l+".")}):("production"!==process.env.NODE_ENV&&s(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a)},oneOfType:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&s("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var e=0;e<t.length;e++){var i=t[e];if("function"!=typeof i)return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+w(i)+" at index "+e+"."),a}return f(function(e,i,r,s,a){for(var l=[],u=0;u<t.length;u++){var c=(0,t[u])(e,i,r,s,a,o);if(null==c)return null;c.data&&n(c.data,"expectedType")&&l.push(c.data.expectedType)}return new h("Invalid "+s+" `"+a+"` supplied to `"+r+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(t){return f(function(e,i,n,r,s){var a=e[i],l=v(a);if("object"!==l)return new h("Invalid "+r+" `"+s+"` of type `"+l+"` supplied to `"+n+"`, expected `object`.");for(var u in t){var c=t[u];if("function"!=typeof c)return m(n,r,s,u,y(c));var d=c(a,u,n,r,s+"."+u,o);if(d)return d}return null})},exact:function(t){return f(function(i,r,s,a,l){var u=i[r],c=v(u);if("object"!==c)return new h("Invalid "+a+" `"+l+"` of type `"+c+"` supplied to `"+s+"`, expected `object`.");var d=e({},i[r],t);for(var p in d){var f=t[p];if(n(t,p)&&"function"!=typeof f)return m(s,a,l,p,y(f));if(!f)return new h("Invalid "+a+" `"+l+"` key `"+p+"` supplied to `"+s+"`.\nBad object: "+JSON.stringify(i[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var g=f(u,p,s,a,l+"."+p,o);if(g)return g}return null})}};function p(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function h(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function f(t){if("production"!==process.env.NODE_ENV)var e={},i=0;function n(n,r,a,u,d,p,f){if(u=u||c,p=p||a,f!==o){if(l){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var m=u+":"+a;!e[m]&&i<3&&(s("You are manually calling a React.PropTypes validation function for the `"+p+"` prop on `"+u+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),e[m]=!0,i++)}}return null==r[a]?n?null===r[a]?new h("The "+d+" `"+p+"` is marked as required in `"+u+"`, but its value is `null`."):new h("The "+d+" `"+p+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:t(r,a,u,d,p)}var r=n.bind(null,!1);return r.isRequired=n.bind(null,!0),r}function g(t){return f(function(e,i,o,n,r,s){var a=e[i];return v(a)!==t?new h("Invalid "+n+" `"+r+"` of type `"+y(a)+"` supplied to `"+o+"`, expected `"+t+"`.",{expectedType:t}):null})}function m(t,e,i,o,n){return new h((t||"React class")+": "+e+" type `"+i+"."+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+n+"`.")}function b(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(b);if(null===t||i(t))return!0;var e=function(t){var e=t&&(u&&t[u]||t["@@iterator"]);if("function"==typeof e)return e}(t);if(!e)return!1;var o,n=e.call(t);if(e!==t.entries){for(;!(o=n.next()).done;)if(!b(o.value))return!1}else for(;!(o=n.next()).done;){var r=o.value;if(r&&!b(r[1]))return!1}return!0;default:return!1}}function v(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function y(t){if(null==t)return""+t;var e=v(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function w(t){var e=y(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return h.prototype=Error.prototype,d.checkPropTypes=r,d.resetWarningCache=r.resetWarningCache,d.PropTypes=d,d},g}()(R.isElement,!0)}else x.exports=function(){if(v)return b;v=1;var t=z();function e(){}function i(){}return i.resetWarningCache=e,b=function(){function o(e,i,o,n,r,s){if(s!==t){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function n(){return o}o.isRequired=o;var r={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:n,element:o,elementType:o,instanceOf:n,node:o,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:i,resetWarningCache:e};return r.PropTypes=r,r}}()();var C=x.exports;function O(t){var e,i,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t)if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(i=O(t[e]))&&(o&&(o+=" "),o+=i);else for(e in t)t[e]&&(o&&(o+=" "),o+=e);return o}function A(){for(var t,e,i=0,o="";i<arguments.length;)(t=arguments[i++])&&(e=O(t))&&(o&&(o+=" "),o+=e);return o}const N=Object.freeze(Object.defineProperty({__proto__:null,clsx:A,default:A},Symbol.toStringTag,{value:"Module"})),P=i.getAugmentedNamespace(N);var T={},k={};Object.defineProperty(k,"__esModule",{value:!0}),k.dontSetMe=function(t,e,i){if(t[e])return new Error("Invalid prop ".concat(e," passed to ").concat(i," - do not set this, set it on the child."))},k.findInArray=function(t,e){for(let i=0,o=t.length;i<o;i++)if(e.apply(e,[t[i],i,t]))return t[i]},k.int=function(t){return parseInt(t,10)},k.isFunction=function(t){return"function"==typeof t||"[object Function]"===Object.prototype.toString.call(t)},k.isNum=function(t){return"number"==typeof t&&!isNaN(t)};var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.browserPrefixToKey=_,D.browserPrefixToStyle=function(t,e){return e?"-".concat(e.toLowerCase(),"-").concat(t):t},D.default=void 0,D.getPrefix=j;const M=["Moz","Webkit","O","ms"];function j(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";const i=null===(t=window.document)||void 0===t||null===(t=t.documentElement)||void 0===t?void 0:t.style;if(!i)return"";if(e in i)return"";for(let o=0;o<M.length;o++)if(_(e,M[o])in i)return M[o];return""}function _(t,e){return e?"".concat(e).concat(function(t){let e="",i=!0;for(let o=0;o<t.length;o++)i?(e+=t[o].toUpperCase(),i=!1):"-"===t[o]?i=!0:e+=t[o];return e}(t)):t}D.default=j(),Object.defineProperty(T,"__esModule",{value:!0}),T.addClassName=F,T.addEvent=function(t,e,i,o){if(!t)return;const n={capture:!0,...o};t.addEventListener?t.addEventListener(e,i,n):t.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i},T.addUserSelectStyles=function(t){if(!t)return;let e=t.getElementById("react-draggable-style-el");e||(e=t.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",e.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",t.getElementsByTagName("head")[0].appendChild(e));t.body&&F(t.body,"react-draggable-transparent-selection")},T.createCSSTransform=function(t,e){const i=H(t,e,"px");return{[(0,L.browserPrefixToKey)("transform",L.default)]:i}},T.createSVGTransform=function(t,e){return H(t,e,"")},T.getTouch=function(t,e){return t.targetTouches&&(0,W.findInArray)(t.targetTouches,t=>e===t.identifier)||t.changedTouches&&(0,W.findInArray)(t.changedTouches,t=>e===t.identifier)},T.getTouchIdentifier=function(t){if(t.targetTouches&&t.targetTouches[0])return t.targetTouches[0].identifier;if(t.changedTouches&&t.changedTouches[0])return t.changedTouches[0].identifier},T.getTranslation=H,T.innerHeight=function(t){let e=t.clientHeight;const i=t.ownerDocument.defaultView.getComputedStyle(t);return e-=(0,W.int)(i.paddingTop),e-=(0,W.int)(i.paddingBottom),e},T.innerWidth=function(t){let e=t.clientWidth;const i=t.ownerDocument.defaultView.getComputedStyle(t);return e-=(0,W.int)(i.paddingLeft),e-=(0,W.int)(i.paddingRight),e},T.matchesSelector=$,T.matchesSelectorAndParentsTo=function(t,e,i){let o=t;do{if($(o,e))return!0;if(o===i)return!1;o=o.parentNode}while(o);return!1},T.offsetXYFromParent=function(t,e,i){const o=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),n=(t.clientX+e.scrollLeft-o.left)/i,r=(t.clientY+e.scrollTop-o.top)/i;return{x:n,y:r}},T.outerHeight=function(t){let e=t.clientHeight;const i=t.ownerDocument.defaultView.getComputedStyle(t);return e+=(0,W.int)(i.borderTopWidth),e+=(0,W.int)(i.borderBottomWidth),e},T.outerWidth=function(t){let e=t.clientWidth;const i=t.ownerDocument.defaultView.getComputedStyle(t);return e+=(0,W.int)(i.borderLeftWidth),e+=(0,W.int)(i.borderRightWidth),e},T.removeClassName=V,T.removeEvent=function(t,e,i,o){if(!t)return;const n={capture:!0,...o};t.removeEventListener?t.removeEventListener(e,i,n):t.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=null},T.removeUserSelectStyles=function(t){if(!t)return;try{if(t.body&&V(t.body,"react-draggable-transparent-selection"),t.selection)t.selection.empty();else{const e=(t.defaultView||window).getSelection();e&&"Caret"!==e.type&&e.removeAllRanges()}}catch(e){}};var W=k,L=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var i=I(e);if(i&&i.has(t))return i.get(t);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in t)if("default"!==r&&Object.prototype.hasOwnProperty.call(t,r)){var s=n?Object.getOwnPropertyDescriptor(t,r):null;s&&(s.get||s.set)?Object.defineProperty(o,r,s):o[r]=t[r]}o.default=t,i&&i.set(t,o);return o}(D);function I(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(I=function(t){return t?i:e})(t)}let B="";function $(t,e){return B||(B=(0,W.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(e){return(0,W.isFunction)(t[e])})),!!(0,W.isFunction)(t[B])&&t[B](e)}function H(t,e,i){let{x:o,y:n}=t,r="translate(".concat(o).concat(i,",").concat(n).concat(i,")");if(e){const t="".concat("string"==typeof e.x?e.x:e.x+i),o="".concat("string"==typeof e.y?e.y:e.y+i);r="translate(".concat(t,", ").concat(o,")")+r}return r}function F(t,e){t.classList?t.classList.add(e):t.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(t.className+=" ".concat(e))}function V(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var U={};Object.defineProperty(U,"__esModule",{value:!0}),U.canDragX=function(t){return"both"===t.props.axis||"x"===t.props.axis},U.canDragY=function(t){return"both"===t.props.axis||"y"===t.props.axis},U.createCoreData=function(t,e,i){const o=!(0,Y.isNum)(t.lastX),n=X(t);return o?{node:n,deltaX:0,deltaY:0,lastX:e,lastY:i,x:e,y:i}:{node:n,deltaX:e-t.lastX,deltaY:i-t.lastY,lastX:t.lastX,lastY:t.lastY,x:e,y:i}},U.createDraggableData=function(t,e){const i=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/i,y:t.state.y+e.deltaY/i,deltaX:e.deltaX/i,deltaY:e.deltaY/i,lastX:t.state.x,lastY:t.state.y}},U.getBoundPosition=function(t,e,i){if(!t.props.bounds)return[e,i];let{bounds:o}=t.props;o="string"==typeof o?o:function(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}(o);const n=X(t);if("string"==typeof o){const{ownerDocument:t}=n,e=t.defaultView;let i;if(i="parent"===o?n.parentNode:t.querySelector(o),!(i instanceof e.HTMLElement))throw new Error('Bounds selector "'+o+'" could not find an element.');const r=i,s=e.getComputedStyle(n),a=e.getComputedStyle(r);o={left:-n.offsetLeft+(0,Y.int)(a.paddingLeft)+(0,Y.int)(s.marginLeft),top:-n.offsetTop+(0,Y.int)(a.paddingTop)+(0,Y.int)(s.marginTop),right:(0,G.innerWidth)(r)-(0,G.outerWidth)(n)-n.offsetLeft+(0,Y.int)(a.paddingRight)-(0,Y.int)(s.marginRight),bottom:(0,G.innerHeight)(r)-(0,G.outerHeight)(n)-n.offsetTop+(0,Y.int)(a.paddingBottom)-(0,Y.int)(s.marginBottom)}}(0,Y.isNum)(o.right)&&(e=Math.min(e,o.right));(0,Y.isNum)(o.bottom)&&(i=Math.min(i,o.bottom));(0,Y.isNum)(o.left)&&(e=Math.max(e,o.left));(0,Y.isNum)(o.top)&&(i=Math.max(i,o.top));return[e,i]},U.getControlPosition=function(t,e,i){const o="number"==typeof e?(0,G.getTouch)(t,e):null;if("number"==typeof e&&!o)return null;const n=X(i),r=i.props.offsetParent||n.offsetParent||n.ownerDocument.body;return(0,G.offsetXYFromParent)(o||t,r,i.props.scale)},U.snapToGrid=function(t,e,i){const o=Math.round(e/t[0])*t[0],n=Math.round(i/t[1])*t[1];return[o,n]};var Y=k,G=T;function X(t){const e=t.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var q={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.default=function(){},Object.defineProperty(q,"__esModule",{value:!0}),q.default=void 0;var K=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var i=rt(e);if(i&&i.has(t))return i.get(t);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in t)if("default"!==r&&Object.prototype.hasOwnProperty.call(t,r)){var s=n?Object.getOwnPropertyDescriptor(t,r):null;s&&(s.get||s.set)?Object.defineProperty(o,r,s):o[r]=t[r]}o.default=t,i&&i.set(t,o);return o}(e),J=nt(C),Z=nt(o),tt=T,et=U,it=k,ot=nt(Q);function nt(t){return t&&t.__esModule?t:{default:t}}function rt(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(rt=function(t){return t?i:e})(t)}function st(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}const at={start:"touchstart",move:"touchmove",stop:"touchend"},lt={start:"mousedown",move:"mousemove",stop:"mouseup"};let ut=lt,ct=class extends K.Component{constructor(){super(...arguments),st(this,"dragging",!1),st(this,"lastX",NaN),st(this,"lastY",NaN),st(this,"touchIdentifier",null),st(this,"mounted",!1),st(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&"number"==typeof t.button&&0!==t.button)return!1;const e=this.findDOMNode();if(!e||!e.ownerDocument||!e.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:i}=e;if(this.props.disabled||!(t.target instanceof i.defaultView.Node)||this.props.handle&&!(0,tt.matchesSelectorAndParentsTo)(t.target,this.props.handle,e)||this.props.cancel&&(0,tt.matchesSelectorAndParentsTo)(t.target,this.props.cancel,e))return;"touchstart"===t.type&&t.preventDefault();const o=(0,tt.getTouchIdentifier)(t);this.touchIdentifier=o;const n=(0,et.getControlPosition)(t,o,this);if(null==n)return;const{x:r,y:s}=n,a=(0,et.createCoreData)(this,r,s);(0,ot.default)("DraggableCore: handleDragStart: %j",a),(0,ot.default)("calling",this.props.onStart);!1!==this.props.onStart(t,a)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,tt.addUserSelectStyles)(i),this.dragging=!0,this.lastX=r,this.lastY=s,(0,tt.addEvent)(i,ut.move,this.handleDrag),(0,tt.addEvent)(i,ut.stop,this.handleDragStop))}),st(this,"handleDrag",t=>{const e=(0,et.getControlPosition)(t,this.touchIdentifier,this);if(null==e)return;let{x:i,y:o}=e;if(Array.isArray(this.props.grid)){let t=i-this.lastX,e=o-this.lastY;if([t,e]=(0,et.snapToGrid)(this.props.grid,t,e),!t&&!e)return;i=this.lastX+t,o=this.lastY+e}const n=(0,et.createCoreData)(this,i,o);(0,ot.default)("DraggableCore: handleDrag: %j",n);if(!1!==this.props.onDrag(t,n)&&!1!==this.mounted)this.lastX=i,this.lastY=o;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch(r){const t=document.createEvent("MouseEvents");t.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(t)}}),st(this,"handleDragStop",t=>{if(!this.dragging)return;const e=(0,et.getControlPosition)(t,this.touchIdentifier,this);if(null==e)return;let{x:i,y:o}=e;if(Array.isArray(this.props.grid)){let t=i-this.lastX||0,e=o-this.lastY||0;[t,e]=(0,et.snapToGrid)(this.props.grid,t,e),i=this.lastX+t,o=this.lastY+e}const n=(0,et.createCoreData)(this,i,o);if(!1===this.props.onStop(t,n)||!1===this.mounted)return!1;const r=this.findDOMNode();r&&this.props.enableUserSelectHack&&(0,tt.removeUserSelectStyles)(r.ownerDocument),(0,ot.default)("DraggableCore: handleDragStop: %j",n),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,r&&((0,ot.default)("DraggableCore: Removing handlers"),(0,tt.removeEvent)(r.ownerDocument,ut.move,this.handleDrag),(0,tt.removeEvent)(r.ownerDocument,ut.stop,this.handleDragStop))}),st(this,"onMouseDown",t=>(ut=lt,this.handleDragStart(t))),st(this,"onMouseUp",t=>(ut=lt,this.handleDragStop(t))),st(this,"onTouchStart",t=>(ut=at,this.handleDragStart(t))),st(this,"onTouchEnd",t=>(ut=at,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,tt.addEvent)(t,at.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:e}=t;(0,tt.removeEvent)(e,lt.move,this.handleDrag),(0,tt.removeEvent)(e,at.move,this.handleDrag),(0,tt.removeEvent)(e,lt.stop,this.handleDragStop),(0,tt.removeEvent)(e,at.stop,this.handleDragStop),(0,tt.removeEvent)(t,at.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,tt.removeUserSelectStyles)(e)}}findDOMNode(){var t,e;return null!==(t=this.props)&&void 0!==t&&t.nodeRef?null===(e=this.props)||void 0===e||null===(e=e.nodeRef)||void 0===e?void 0:e.current:Z.default.findDOMNode(this)}render(){return K.cloneElement(K.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};q.default=ct,st(ct,"displayName","DraggableCore"),st(ct,"propTypes",{allowAnyClick:J.default.bool,children:J.default.node.isRequired,disabled:J.default.bool,enableUserSelectHack:J.default.bool,offsetParent:function(t,e){if(t[e]&&1!==t[e].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:J.default.arrayOf(J.default.number),handle:J.default.string,cancel:J.default.string,nodeRef:J.default.object,onStart:J.default.func,onDrag:J.default.func,onStop:J.default.func,onMouseDown:J.default.func,scale:J.default.number,className:it.dontSetMe,style:it.dontSetMe,transform:it.dontSetMe}),st(ct,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return c.default}}),t.default=void 0;var i=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var i=h(e);if(i&&i.has(t))return i.get(t);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in t)if("default"!==r&&Object.prototype.hasOwnProperty.call(t,r)){var s=n?Object.getOwnPropertyDescriptor(t,r):null;s&&(s.get||s.set)?Object.defineProperty(o,r,s):o[r]=t[r]}o.default=t,i&&i.set(t,o);return o}(e),n=p(C),r=p(o),s=p(P),a=T,l=U,u=k,c=p(q),d=p(Q);function p(t){return t&&t.__esModule?t:{default:t}}function h(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,i=new WeakMap;return(h=function(t){return t?i:e})(t)}function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},f.apply(this,arguments)}function g(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class m extends i.Component{static getDerivedStateFromProps(t,e){let{position:i}=t,{prevPropsPosition:o}=e;return!i||o&&i.x===o.x&&i.y===o.y?null:((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:i,prevPropsPosition:o}),{x:i.x,y:i.y,prevPropsPosition:{...i}})}constructor(t){super(t),g(this,"onDragStart",(t,e)=>{(0,d.default)("Draggable: onDragStart: %j",e);if(!1===this.props.onStart(t,(0,l.createDraggableData)(this,e)))return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(t,e)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",e);const i=(0,l.createDraggableData)(this,e),o={x:i.x,y:i.y,slackX:0,slackY:0};if(this.props.bounds){const{x:t,y:e}=o;o.x+=this.state.slackX,o.y+=this.state.slackY;const[n,r]=(0,l.getBoundPosition)(this,o.x,o.y);o.x=n,o.y=r,o.slackX=this.state.slackX+(t-o.x),o.slackY=this.state.slackY+(e-o.y),i.x=o.x,i.y=o.y,i.deltaX=o.x-this.state.x,i.deltaY=o.y-this.state.y}if(!1===this.props.onDrag(t,i))return!1;this.setState(o)}),g(this,"onDragStop",(t,e)=>{if(!this.state.dragging)return!1;if(!1===this.props.onStop(t,(0,l.createDraggableData)(this,e)))return!1;(0,d.default)("Draggable: onDragStop: %j",e);const i={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){const{x:t,y:e}=this.props.position;i.x=t,i.y=e}this.setState(i)}),this.state={dragging:!1,dragged:!1,x:t.position?t.position.x:t.defaultPosition.x,y:t.position?t.position.y:t.defaultPosition.y,prevPropsPosition:{...t.position},slackX:0,slackY:0,isElementSVG:!1},!t.position||t.onDrag||t.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var t,e;return null!==(t=null===(e=this.props)||void 0===e||null===(e=e.nodeRef)||void 0===e?void 0:e.current)&&void 0!==t?t:r.default.findDOMNode(this)}render(){const{axis:t,bounds:e,children:o,defaultPosition:n,defaultClassName:r,defaultClassNameDragging:u,defaultClassNameDragged:d,position:p,positionOffset:h,scale:g,...m}=this.props;let b={},v=null;const y=!Boolean(p)||this.state.dragging,w=p||n,x={x:(0,l.canDragX)(this)&&y?this.state.x:w.x,y:(0,l.canDragY)(this)&&y?this.state.y:w.y};this.state.isElementSVG?v=(0,a.createSVGTransform)(x,h):b=(0,a.createCSSTransform)(x,h);const S=(0,s.default)(o.props.className||"",r,{[u]:this.state.dragging,[d]:this.state.dragged});return i.createElement(c.default,f({},m,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),i.cloneElement(i.Children.only(o),{className:S,style:{...o.props.style,...b},transform:v}))}}t.default=m,g(m,"displayName","Draggable"),g(m,"propTypes",{...c.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:u.dontSetMe,style:u.dontSetMe,transform:u.dontSetMe}),g(m,"defaultProps",{...c.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(w);const{default:dt,DraggableCore:pt}=w;y.exports=dt,y.exports.default=dt,y.exports.DraggableCore=pt;var ht=y.exports;const ft=i.getDefaultExportFromCjs(ht);var gt=function(){return gt=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},gt.apply(this,arguments)},mt={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},bt={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},vt={width:"20px",height:"20px",position:"absolute",zIndex:1},yt={top:gt(gt({},mt),{top:"-5px"}),right:gt(gt({},bt),{left:void 0,right:"-5px"}),bottom:gt(gt({},mt),{top:void 0,bottom:"-5px"}),left:gt(gt({},bt),{left:"-5px"}),topRight:gt(gt({},vt),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:gt(gt({},vt),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:gt(gt({},vt),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:gt(gt({},vt),{left:"-10px",top:"-10px",cursor:"nw-resize"})},wt=e.memo(function(i){var o=i.onResizeStart,n=i.direction,r=i.children,s=i.replaceStyles,a=i.className,l=e.useCallback(function(t){o(t,n)},[o,n]),u=e.useCallback(function(t){o(t,n)},[o,n]),c=e.useMemo(function(){return gt(gt({position:"absolute",userSelect:"none"},yt[n]),null!=s?s:{})},[s,n]);return t.jsx("div",{className:a||void 0,style:c,onMouseDown:l,onTouchStart:u,children:r})}),xt=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),St=function(){return St=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},St.apply(this,arguments)},zt={width:"auto",height:"auto"},Et=function(t,e,i){return Math.max(Math.min(t,i),e)},Rt=function(t,e,i){var o=Math.round(t/e);return o*e+i*(o-1)},Ct=function(t,e){return new RegExp(t,"i").test(e)},Ot=function(t){return Boolean(t.touches&&t.touches.length)},At=function(t,e,i){void 0===i&&(i=0);var o=e.reduce(function(i,o,n){return Math.abs(o-t)<Math.abs(e[i]-t)?n:i},0),n=Math.abs(e[o]-t);return 0===i||n<i?e[o]:t},Nt=function(t){return"auto"===(t=t.toString())||t.endsWith("px")||t.endsWith("%")||t.endsWith("vh")||t.endsWith("vw")||t.endsWith("vmax")||t.endsWith("vmin")?t:"".concat(t,"px")},Pt=function(t,e,i,o){if(t&&"string"==typeof t){if(t.endsWith("px"))return Number(t.replace("px",""));if(t.endsWith("%"))return e*(Number(t.replace("%",""))/100);if(t.endsWith("vw"))return i*(Number(t.replace("vw",""))/100);if(t.endsWith("vh"))return o*(Number(t.replace("vh",""))/100)}return t},Tt=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],kt="__resizable_base__",Dt=function(e){function i(t){var i,o,n,r,s=e.call(this,t)||this;return s.ratio=1,s.resizable=null,s.parentLeft=0,s.parentTop=0,s.resizableLeft=0,s.resizableRight=0,s.resizableTop=0,s.resizableBottom=0,s.targetLeft=0,s.targetTop=0,s.delta={width:0,height:0},s.appendBase=function(){if(!s.resizable||!s.window)return null;var t=s.parentNode;if(!t)return null;var e=s.window.document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.position="absolute",e.style.transform="scale(0, 0)",e.style.left="0",e.style.flex="0 0 100%",e.classList?e.classList.add(kt):e.className+=kt,t.appendChild(e),e},s.removeBase=function(t){var e=s.parentNode;e&&e.removeChild(t)},s.state={isResizing:!1,width:null!==(o=null===(i=s.propsSize)||void 0===i?void 0:i.width)&&void 0!==o?o:"auto",height:null!==(r=null===(n=s.propsSize)||void 0===n?void 0:n.height)&&void 0!==r?r:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},s.onResizeStart=s.onResizeStart.bind(s),s.onMouseMove=s.onMouseMove.bind(s),s.onMouseUp=s.onMouseUp.bind(s),s}return xt(i,e),Object.defineProperty(i.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||zt},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){var t=0,e=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,o=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),t="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,e="auto"!==this.resizable.style.height?this.resizable.offsetHeight:o,this.resizable.style.position=n}return{width:t,height:e}},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sizeStyle",{get:function(){var t=this,e=this.props.size,i=function(e){var i;if(void 0===t.state[e]||"auto"===t.state[e])return"auto";if(t.propsSize&&t.propsSize[e]&&(null===(i=t.propsSize[e])||void 0===i?void 0:i.toString().endsWith("%"))){if(t.state[e].toString().endsWith("%"))return t.state[e].toString();var o=t.getParentSize(),n=Number(t.state[e].toString().replace("px",""))/o[e]*100;return"".concat(n,"%")}return Nt(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?Nt(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?Nt(e.height):i("height")}},enumerable:!1,configurable:!0}),i.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var t=this.appendBase();if(!t)return{width:0,height:0};var e=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(e=!0,this.parentNode.style.flexWrap="wrap"),t.style.position="relative",t.style.minWidth="100%",t.style.minHeight="100%";var o={width:t.offsetWidth,height:t.offsetHeight};return e&&(this.parentNode.style.flexWrap=i),this.removeBase(t),o},i.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},i.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},i.prototype.componentDidMount=function(){if(this.resizable&&this.window){var t=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==t.flexBasis?t.flexBasis:void 0})}},i.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},i.prototype.createSizeForCssProperty=function(t,e){var i=this.propsSize&&this.propsSize[e];return"auto"!==this.state[e]||this.state.original[e]!==t||void 0!==i&&"auto"!==i?t:"auto"},i.prototype.calculateNewMaxFromBoundary=function(t,e){var i,o,n=this.props.boundsByDirection,r=this.state.direction,s=n&&Ct("left",r),a=n&&Ct("top",r);if("parent"===this.props.bounds){var l=this.parentNode;l&&(i=s?this.resizableRight-this.parentLeft:l.offsetWidth+(this.parentLeft-this.resizableLeft),o=a?this.resizableBottom-this.parentTop:l.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(i=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,o=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),o=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return i&&Number.isFinite(i)&&(t=t&&t<i?t:i),o&&Number.isFinite(o)&&(e=e&&e<o?e:o),{maxWidth:t,maxHeight:e}},i.prototype.calculateNewSizeFromDirection=function(t,e){var i,o=this.props.scale||1,n=(i=this.props.resizeRatio||1,Array.isArray(i)?i:[i,i]),r=n[0],s=n[1],a=this.state,l=a.direction,u=a.original,c=this.props,d=c.lockAspectRatio,p=c.lockAspectRatioExtraHeight,h=c.lockAspectRatioExtraWidth,f=u.width,g=u.height,m=p||0,b=h||0;return Ct("right",l)&&(f=u.width+(t-u.x)*r/o,d&&(g=(f-b)/this.ratio+m)),Ct("left",l)&&(f=u.width-(t-u.x)*r/o,d&&(g=(f-b)/this.ratio+m)),Ct("bottom",l)&&(g=u.height+(e-u.y)*s/o,d&&(f=(g-m)*this.ratio+b)),Ct("top",l)&&(g=u.height-(e-u.y)*s/o,d&&(f=(g-m)*this.ratio+b)),{newWidth:f,newHeight:g}},i.prototype.calculateNewSizeFromAspectRatio=function(t,e,i,o){var n=this.props,r=n.lockAspectRatio,s=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,l=void 0===o.width?10:o.width,u=void 0===i.width||i.width<0?t:i.width,c=void 0===o.height?10:o.height,d=void 0===i.height||i.height<0?e:i.height,p=s||0,h=a||0;if(r){var f=(c-p)*this.ratio+h,g=(d-p)*this.ratio+h,m=(l-h)/this.ratio+p,b=(u-h)/this.ratio+p,v=Math.max(l,f),y=Math.min(u,g),w=Math.max(c,m),x=Math.min(d,b);t=Et(t,v,y),e=Et(e,w,x)}else t=Et(t,l,u),e=Et(e,c,d);return{newWidth:t,newHeight:e}},i.prototype.setBoundingClientRect=function(){var t=1/(this.props.scale||1);if("parent"===this.props.bounds){var e=this.parentNode;if(e){var i=e.getBoundingClientRect();this.parentLeft=i.left*t,this.parentTop=i.top*t}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left*t,this.targetTop=o.top*t}if(this.resizable){var n=this.resizable.getBoundingClientRect(),r=n.left,s=n.top,a=n.right,l=n.bottom;this.resizableLeft=r*t,this.resizableRight=a*t,this.resizableTop=s*t,this.resizableBottom=l*t}},i.prototype.onResizeStart=function(t,e){if(this.resizable&&this.window){var i,o=0,n=0;if(t.nativeEvent&&function(t){return Boolean((t.clientX||0===t.clientX)&&(t.clientY||0===t.clientY))}(t.nativeEvent)?(o=t.nativeEvent.clientX,n=t.nativeEvent.clientY):t.nativeEvent&&Ot(t.nativeEvent)&&(o=t.nativeEvent.touches[0].clientX,n=t.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(t,e,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var r=this.window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var s=this.parentNode;if(s){var a=this.window.getComputedStyle(s).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var l={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:St(St({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(t.target).cursor||"auto"}),direction:e,flexBasis:i};this.setState(l)}},i.prototype.onMouseMove=function(t){var e=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&Ot(t))try{t.preventDefault(),t.stopPropagation()}catch(M){}var i=this.props,n=i.maxWidth,r=i.maxHeight,s=i.minWidth,a=i.minHeight,l=Ot(t)?t.touches[0].clientX:t.clientX,u=Ot(t)?t.touches[0].clientY:t.clientY,c=this.state,d=c.direction,p=c.original,h=c.width,f=c.height,g=this.getParentSize(),m=function(t,e,i,o,n,r,s){return o=Pt(o,t.width,e,i),n=Pt(n,t.height,e,i),r=Pt(r,t.width,e,i),s=Pt(s,t.height,e,i),{maxWidth:void 0===o?void 0:Number(o),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===r?void 0:Number(r),minHeight:void 0===s?void 0:Number(s)}}(g,this.window.innerWidth,this.window.innerHeight,n,r,s,a);n=m.maxWidth,r=m.maxHeight,s=m.minWidth,a=m.minHeight;var b=this.calculateNewSizeFromDirection(l,u),v=b.newHeight,y=b.newWidth,w=this.calculateNewMaxFromBoundary(n,r);this.props.snap&&this.props.snap.x&&(y=At(y,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=At(v,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(y,v,{width:w.maxWidth,height:w.maxHeight},{width:s,height:a});if(y=x.newWidth,v=x.newHeight,this.props.grid){var S=Rt(y,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),z=Rt(v,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),E=this.props.snapGap||0;y=0===E||Math.abs(S-y)<=E?S:y,v=0===E||Math.abs(z-v)<=E?z:v}var R={width:y-p.width,height:v-p.height};if(this.delta=R,h&&"string"==typeof h)if(h.endsWith("%")){var C=y/g.width*100;y="".concat(C,"%")}else if(h.endsWith("vw")){var O=y/this.window.innerWidth*100;y="".concat(O,"vw")}else if(h.endsWith("vh")){var A=y/this.window.innerHeight*100;y="".concat(A,"vh")}if(f&&"string"==typeof f)if(f.endsWith("%")){C=v/g.height*100;v="".concat(C,"%")}else if(f.endsWith("vw")){O=v/this.window.innerWidth*100;v="".concat(O,"vw")}else if(f.endsWith("vh")){A=v/this.window.innerHeight*100;v="".concat(A,"vh")}var N={width:this.createSizeForCssProperty(y,"width"),height:this.createSizeForCssProperty(v,"height")};"row"===this.flexDir?N.flexBasis=N.width:"column"===this.flexDir&&(N.flexBasis=N.height);var P=this.state.width!==N.width,T=this.state.height!==N.height,k=this.state.flexBasis!==N.flexBasis,D=P||T||k;D&&o.flushSync(function(){e.setState(N)}),this.props.onResize&&D&&this.props.onResize(t,d,this.resizable,R)}},i.prototype.onMouseUp=function(t){var e,i,o=this.state,n=o.isResizing,r=o.direction;o.original,n&&this.resizable&&(this.props.onResizeStop&&this.props.onResizeStop(t,r,this.resizable,this.delta),this.props.size&&this.setState({width:null!==(e=this.props.size.width)&&void 0!==e?e:"auto",height:null!==(i=this.props.size.height)&&void 0!==i?i:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:St(St({},this.state.backgroundStyle),{cursor:"auto"})}))},i.prototype.updateSize=function(t){var e,i;this.setState({width:null!==(e=t.width)&&void 0!==e?e:"auto",height:null!==(i=t.height)&&void 0!==i?i:"auto"})},i.prototype.renderResizer=function(){var e=this,i=this.props,o=i.enable,n=i.handleStyles,r=i.handleClasses,s=i.handleWrapperStyle,a=i.handleWrapperClass,l=i.handleComponent;if(!o)return null;var u=Object.keys(o).map(function(i){return!1!==o[i]?t.jsx(wt,{direction:i,onResizeStart:e.onResizeStart,replaceStyles:n&&n[i],className:r&&r[i],children:l&&l[i]?l[i]:null},i):null});return t.jsx("div",{className:a,style:s,children:u})},i.prototype.render=function(){var e=this,i=Object.keys(this.props).reduce(function(t,i){return-1!==Tt.indexOf(i)||(t[i]=e.props[i]),t},{}),o=St(St(St({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var n=this.props.as||"div";return t.jsxs(n,St({style:o,className:this.props.className},i,{ref:function(t){t&&(e.resizable=t)},children:[this.state.isResizing&&t.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},i.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},i}(e.PureComponent),Mt=function(t,e){return(Mt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};var jt=function(){return jt=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},jt.apply(this,arguments)};var _t={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},Wt=function(t){function i(e){var i=t.call(this,e)||this;return i.resizingPosition={x:0,y:0},i.offsetFromParent={left:0,top:0},i.resizableElement={current:null},i.originalPosition={x:0,y:0},i.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:e.maxWidth,maxHeight:e.maxHeight},i.onResizeStart=i.onResizeStart.bind(i),i.onResize=i.onResize.bind(i),i.onResizeStop=i.onResizeStop.bind(i),i.onDragStart=i.onDragStart.bind(i),i.onDrag=i.onDrag.bind(i),i.onDragStop=i.onDragStop.bind(i),i.getMaxSizesFromProps=i.getMaxSizesFromProps.bind(i),i}return function(t,e){function i(){this.constructor=t}Mt(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(i,t),i.prototype.componentDidMount=function(){this.updateOffsetFromParent();var t=this.offsetFromParent,e=t.left,i=t.top,o=this.getDraggablePosition(),n=o.x,r=o.y;this.draggable.setState({x:n-e,y:r-i}),this.forceUpdate()},i.prototype.getDraggablePosition=function(){var t=this.draggable.state;return{x:t.x,y:t.y}},i.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},i.prototype.getParentSize=function(){return this.resizable.getParentSize()},i.prototype.getMaxSizesFromProps=function(){return{maxWidth:void 0===this.props.maxWidth?Number.MAX_SAFE_INTEGER:this.props.maxWidth,maxHeight:void 0===this.props.maxHeight?Number.MAX_SAFE_INTEGER:this.props.maxHeight}},i.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},i.prototype.getOffsetHeight=function(t){var e=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/e;case"body":return document.body.offsetHeight/e;default:return t.offsetHeight}},i.prototype.getOffsetWidth=function(t){var e=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/e;case"body":return document.body.offsetWidth/e;default:return t.offsetWidth}},i.prototype.onDragStart=function(t,e){this.props.onDragStart&&this.props.onDragStart(t,e);var i=this.getDraggablePosition();if(this.originalPosition=i,this.props.bounds){var o,n=this.getParent(),r=this.props.scale;if("parent"===this.props.bounds)o=n;else{if("body"===this.props.bounds){var s=n.getBoundingClientRect(),a=s.left,l=s.top,u=document.body.getBoundingClientRect(),c=-(a-n.offsetLeft*r-u.left)/r,d=-(l-n.offsetTop*r-u.top)/r,p=(document.body.offsetWidth-this.resizable.size.width*r)/r+c,h=(document.body.offsetHeight-this.resizable.size.height*r)/r+d;return this.setState({bounds:{top:d,right:p,bottom:h,left:c}})}if("window"===this.props.bounds){if(!this.resizable)return;var f=n.getBoundingClientRect(),g=f.left,m=f.top,b=-(g-n.offsetLeft*r)/r,v=-(m-n.offsetTop*r)/r;p=(window.innerWidth-this.resizable.size.width*r)/r+b,h=(window.innerHeight-this.resizable.size.height*r)/r+v;return this.setState({bounds:{top:v,right:p,bottom:h,left:b}})}"string"==typeof this.props.bounds?o=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(o=this.props.bounds)}if(o instanceof HTMLElement&&n instanceof HTMLElement){var y=o.getBoundingClientRect(),w=y.left,x=y.top,S=n.getBoundingClientRect(),z=(w-S.left)/r,E=x-S.top;if(this.resizable){this.updateOffsetFr