/*! For license information please see canvasPanel.cd4ada1146b53ad3284f.js.LICENSE.txt */
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3330],{"./public/app/core/components/Layers/AddLayerButton.tsx":(t,e,n)=>{n.d(e,{f:()=>o});n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js");var r=n("./packages/grafana-ui/src/index.ts"),i=n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const o=t=>{let{onChange:e,options:n,label:o}=t;return(0,i.jsx)(r.ValuePicker,{icon:"plus",label:o,variant:"secondary",options:n,onChange:e,isFullWidth:!0})}},"./public/app/core/components/Layers/LayerDragDropList.tsx":(t,e,n)=>{n.d(e,{E:()=>f});var r=n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),i=n("./.yarn/__virtual__/react-beautiful-dnd-virtual-27e4b658e7/3/opt/drone/yarncache/react-beautiful-dnd-npm-13.1.0-fcf5568b1c-12b7e9fbe8.zip/node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js"),o=n("./.yarn/__virtual__/@emotion-css-virtual-72c314ddb1/3/opt/drone/yarncache/@emotion-css-npm-11.7.1-25ff8755a7-ac1f56656f.zip/node_modules/@emotion/css/dist/emotion-css.esm.js"),a=n("./packages/grafana-ui/src/index.ts"),s=n("./packages/grafana-runtime/src/index.ts"),u=n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const l=t=>{let{name:e,onChange:n,verifyLayerNameUniqueness:i}=t;const o=(0,a.useStyles)(c),[s,l]=(0,r.useState)(!1),[f,p]=(0,r.useState)(null),d=t=>{l(!1),f?p(null):e!==t&&n(t)};return(0,u.jsx)(u.Fragment,{children:(0,u.jsxs)("div",{className:o.wrapper,children:[!s&&(0,u.jsxs)("button",{className:o.layerNameWrapper,title:"Edit layer name",onClick:t=>{l(!0)},"data-testid":"layer-name-div",children:[(0,u.jsx)("span",{className:o.layerName,children:e}),(0,u.jsx)(a.Icon,{name:"pen",className:o.layerEditIcon,size:"sm"})]}),s&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.Input,{type:"text",defaultValue:e,onBlur:t=>{d(t.currentTarget.value.trim())},autoFocus:!0,onKeyDown:t=>{"Enter"===t.key&&d(t.target.value)},onFocus:t=>{t.target.select()},invalid:null!==f,onChange:t=>{const n=t.currentTarget.value.trim();0!==n.length?!i||i(n)||n===e?f&&p(null):p("Layer name already exists"):p("An empty layer name is not allowed")},className:o.layerNameInput,"data-testid":"layer-name-input"}),f&&(0,u.jsx)(a.FieldValidationMessage,{horizontal:!0,children:f})]})]})})},c=t=>({wrapper:o.css`
      label: Wrapper;
      display: flex;
      align-items: center;
      margin-left: ${t.spacing.xs};
    `,layerNameWrapper:o.css`
      display: flex;
      cursor: pointer;
      border: 1px solid transparent;
      border-radius: ${t.border.radius.md};
      align-items: center;
      padding: 0 0 0 ${t.spacing.xs};
      margin: 0;
      background: transparent;

      &:hover {
        background: ${t.colors.bg3};
        border: 1px dashed ${t.colors.border3};
      }

      &:focus {
        border: 2px solid ${t.colors.formInputBorderActive};
      }

      &:hover,
      &:focus {
        .query-name-edit-icon {
          visibility: visible;
        }
      }
    `,layerName:o.css`
      font-weight: ${t.typography.weight.semibold};
      color: ${t.colors.textBlue};
      cursor: pointer;
      overflow: hidden;
      margin-left: ${t.spacing.xs};
    `,layerEditIcon:(0,o.cx)(o.css`
        margin-left: ${t.spacing.md};
        visibility: hidden;
      `,"query-name-edit-icon"),layerNameInput:o.css`
      max-width: 300px;
      margin: -4px 0;
    `}),f=t=>{let{layers:e,getLayerInfo:n,onDragEnd:r,onSelect:c,onDelete:f,onDuplicate:d,isGroup:h,selection:g,excludeBaseLayer:v,onNameChange:m,verifyLayerNameUniqueness:b}=t;const y=p(s.config.theme),x=t=>t?`${y.row} ${y.sel}`:y.row;return(0,u.jsx)(i.Z5,{onDragEnd:r,children:(0,u.jsx)(i.bK,{droppableId:"droppable",children:(t,r)=>(0,u.jsxs)("div",Object.assign({},t.droppableProps,{ref:t.innerRef,children:[(()=>{const t=[],r=v?1:0,s=v?2:1;for(let p=e.length-1;p>=r;p--){const r=e[p],v=r.getName(),E=Boolean(null==g?void 0:g.includes(v));t.push((0,u.jsx)(i._l,{draggableId:v,index:t.length,children:(t,i)=>(0,u.jsxs)("div",Object.assign({className:x(E),ref:t.innerRef},t.draggableProps,t.dragHandleProps,{onMouseDown:()=>c(r),children:[(0,u.jsx)(l,{name:v,onChange:t=>m(r,t),verifyLayerNameUniqueness:null!=b?b:void 0}),(0,u.jsxs)("div",{className:y.textWrapper,children:["  ",n(r)]}),!h(r)&&(0,u.jsxs)(u.Fragment,{children:[d?(0,u.jsx)(a.IconButton,{name:"copy",title:"Duplicate",className:y.actionIcon,onClick:()=>d(r),surface:"header"}):null,(0,u.jsx)(a.IconButton,{name:"trash-alt",title:"remove",className:(0,o.cx)(y.actionIcon,y.dragIcon),onClick:()=>f(r),surface:"header"}),e.length>s&&(0,u.jsx)(a.Icon,{title:"Drag and drop to reorder",name:"draggabledots",size:"lg",className:y.dragIcon})]})]}))},v))}return t})(),t.placeholder]}))})})};f.defaultProps={isGroup:()=>!1};const p=(0,a.stylesFactory)((t=>({wrapper:o.css`
    margin-bottom: ${t.spacing.md};
  `,row:o.css`
    padding: ${t.spacing.xs} ${t.spacing.sm};
    border-radius: ${t.border.radius.sm};
    background: ${t.colors.bg2};
    min-height: ${t.spacing.formInputHeight}px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    cursor: pointer;

    border: 1px solid ${t.colors.formInputBorder};
    &:hover {
      border: 1px solid ${t.colors.formInputBorderHover};
    }
  `,sel:o.css`
    border: 1px solid ${t.colors.formInputBorderActive};
    &:hover {
      border: 1px solid ${t.colors.formInputBorderActive};
    }
  `,dragIcon:o.css`
    cursor: drag;
  `,actionIcon:o.css`
    color: ${t.colors.textWeak};
    &:hover {
      color: ${t.colors.text};
    }
  `,typeWrapper:o.css`
    color: ${t.colors.textBlue};
    margin-right: 5px;
  `,textWrapper:o.css`
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    margin-right: ${t.spacing.sm};
  `})))},"./public/app/plugins/panel/canvas/module.tsx":(t,e,n)=>{n.r(e),n.d(e,{plugin:()=>uu});var r=n("./packages/grafana-data/src/index.ts"),i=n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),o=n("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/Subscription.js"),a=n("./public/app/types/events.ts"),s=n("./.yarn/__virtual__/@emotion-css-virtual-72c314ddb1/3/opt/drone/yarncache/@emotion-css-npm-11.7.1-25ff8755a7-ac1f56656f.zip/node_modules/@emotion/css/dist/emotion-css.esm.js"),u=n("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/ReplaySubject.js"),l=n("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/Subject.js"),c=n("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/operators/first.js");function f(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.map((function(e){return e.split(" ").map((function(e){return e?""+t+e:""})).join(" ")})).join(" ")}function p(t,e){return function(n){n&&(t[e]=n)}}function d(t,e,n){return function(r){r&&(t[e][n]=r)}}function h(t,e){return function(n){var r=n.prototype;t.forEach((function(t){e(r,t)}))}}var g=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,r=this.values,i=n.indexOf(t),o=-1===i?n.length:i;n[o]=t,r[o]=e},t}(),v=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),m="function"==typeof Map,b=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var y=function(){function t(t,e,n,r,i,o,a,s){this.prevList=t,this.list=e,this.added=n,this.removed=r,this.changed=i,this.maintained=o,this.changedBeforeAdded=a,this.fixed=s}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t=function(t,e){var n=[],r=[];return t.forEach((function(t){var e=t[0],i=t[1],o=new b;n[e]=o,r[i]=o})),n.forEach((function(t,e){t.connect(n[e-1])})),t.filter((function(t,n){return!e[n]})).map((function(t,e){var i=t[0],o=t[1];if(i===o)return[0,0];var a=n[i],s=r[o-1],u=a.getIndex();return a.disconnect(),s?a.connect(s,s.next):a.connect(void 0,n[0]),[u,a.getIndex()]}))}(this.changedBeforeAdded,this.fixed),e=this.changed,n=[];this.cacheOrdered=t.filter((function(t,r){var i=t[0],o=t[1],a=e[r],s=a[0],u=a[1];if(i!==o)return n.push([s,u]),!0})),this.cachePureChanged=n},t}();function x(t,e,n){var r=m?Map:n?v:g,i=n||function(t){return t},o=[],a=[],s=[],u=t.map(i),l=e.map(i),c=new r,f=new r,p=[],d=[],h={},b=[],x=0,E=0;return u.forEach((function(t,e){c.set(t,e)})),l.forEach((function(t,e){f.set(t,e)})),u.forEach((function(t,e){var n=f.get(t);void 0===n?(++E,a.push(e)):h[n]=E})),l.forEach((function(t,e){var n=c.get(t);void 0===n?(o.push(e),++x):(s.push([n,e]),E=h[e]||0,p.push([n-E,e-x]),d.push(e===n),n!==e&&b.push([n,e]))})),a.reverse(),new y(t,e,o,a,b,s,p,d)}var E=function(){function t(t,e){void 0===t&&(t=[]),this.findKeyCallback=e,this.list=[].slice.call(t)}return t.prototype.update=function(t){var e=[].slice.call(t),n=x(this.list,e,this.findKeyCallback);return this.list=e,n},t}();const S=E;var C="undefined",w=(typeof document!==C&&document,[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}]),D=1e-7,M={cm:function(t){return 96*t/2.54},mm:function(t){return 96*t/254},in:function(t){return 96*t},pt:function(t){return 96*t/72},pc:function(t){return 96*t/6},"%":function(t,e){return t*e/100},vw:function(t,e){return void 0===e&&(e=window.innerWidth),t/100*e},vh:function(t,e){return void 0===e&&(e=window.innerHeight),t/100*e},vmax:function(t,e){return void 0===e&&(e=Math.max(window.innerWidth,window.innerHeight)),t/100*e},vmin:function(t,e){return void 0===e&&(e=Math.min(window.innerWidth,window.innerHeight)),t/100*e}};function O(t){return typeof t===C}function P(t){return t&&"object"==typeof t}function R(t){return Array.isArray(t)}function T(t){return"string"==typeof t}function k(t){return"function"==typeof t}function B(t,e,n,r,i){return z(t,e,n)?n:function(t,e,n,r,i){for(var o,a=function(n){var a=e[n].trim();if(a===t.close&&!z(t,e,n))return{value:n};var s=n,u=L(i,(function(t){return t.open===a}));if(u&&(s=B(u,e,n,r,i)),-1===s)return o=n,"break";o=n=s},s=n;s<r;++s){var u=a(s);if(s=o,"object"==typeof u)return u.value;if("break"===u)break}return-1}(t,e,n+1,r,i)}function z(t,e,n){if(!t.ignore)return null;var r=e.slice(Math.max(n-3,0),n+3).join("");return new RegExp(t.ignore).exec(r)}function _(t,e){var n=T(e)?{separator:e}:e,r=n.separator,i=void 0===r?",":r,o=n.isSeparateFirst,a=n.isSeparateOnlyOpenClose,s=n.isSeparateOpenClose,u=void 0===s?a:s,l=n.openCloseCharacters,c=void 0===l?w:l,f=c.map((function(t){var e=t.open,n=t.close;return e===n?e:e+"|"+n})).join("|"),p=new RegExp("(\\s*"+i+"\\s*|"+f+"|\\s+)","g"),d=t.split(p).filter(Boolean),h=d.length,g=[],v=[];function m(){return!!v.length&&(g.push(v.join("")),v=[],!0)}for(var b,y=function(t){var e=d[t].trim(),n=t,r=L(c,(function(t){return t.open===e})),s=L(c,(function(t){return t.close===e}));if(r){if(-1!==(n=B(r,d,t,h,c))&&u)return m()&&o?(b=t,"break"):(g.push(d.slice(t,n+1).join("")),t=n,o?(b=t,"break"):(b=t,"continue"))}else{if(s&&!z(s,d,t))throw new Error("invalid format: "+s.close);if(function(t,e){return(""===e||" "==e)&&(""===t||" "==t)||t===e}(e,i)&&!a)return m(),o?(b=t,"break"):(b=t,"continue")}-1===n&&(n=h-1),v.push(d.slice(t,n+1).join("")),b=t=n},x=0;x<h;++x){var E=y(x);if(x=b,"break"===E)break}return v.length&&g.push(v.join("")),g}function G(t){return _(t,"")}function j(t){return _(t,",")}function I(t){var e=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t);return!e||e.length<4?{}:{prefix:e[1],value:e[2],suffix:e[3]}}function A(t){var e=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!e)return{prefix:"",unit:"",value:NaN};var n=e[1],r=e[2];return{prefix:n,unit:e[3],value:parseFloat(r)}}function N(t){return t.replace(/[\s-_]([a-z])/g,(function(t,e){return e.toUpperCase()}))}function F(t,e){return void 0===e&&(e="-"),t.replace(/([a-z])([A-Z])/g,(function(t,n,r){return""+n+e+r.toLowerCase()}))}function Y(){return Date.now?Date.now():(new Date).getTime()}function X(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}function L(t,e,n){var r=X(t,e);return r>-1?t[r]:n}function q(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in e)e.push(n);return e}function W(t,e){var n=A(t),r=n.value,i=n.unit;if(P(e)){var o=e[i];if(o){if(k(o))return o(r);if(M[i])return M[i](r,o)}}else if("%"===i)return r*e/100;return M[i]?M[i](r):r}function H(t,e,n){return Math.max(e,Math.min(t,n))}function V(t,e,n){return[[Q(e[0],D),Q(e[0]*t[1]/t[0],D)],[Q(e[1]*t[0]/t[1],D),Q(e[1],D)]].filter((function(t){return t.every((function(t,r){return n?t<=e[r]:t>=e[r]}))}))[0]||t}function $(t,e,n,r){if(!r)return t.map((function(t,r){return H(t,e[r],n[r])}));var i=t[0],o=t[1],a=V(t,e,!1),s=a[0],u=a[1],l=V(t,n,!0),c=l[0],f=l[1];return i<s||o<u?(i=s,o=u):(i>c||o>f)&&(i=c,o=f),[i,o]}function K(t){for(var e=t.length,n=0,r=e-1;r>=0;--r)n+=t[r];return e?n/e:0}function U(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=Math.atan2(r,n);return i>=0?i:i+2*Math.PI}function Z(t){var e=function(t){return[0,1].map((function(e){return K(t.map((function(t){return t[e]})))}))}(t),n=U(e,t[0]),r=U(e,t[1]);return n<r&&r-n<Math.PI||n>r&&r-n<-Math.PI?1:-1}function J(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function Q(t,e){return e?Math.round(t/e)*e:t}function tt(t,e){return t.forEach((function(n,r){t[r]=Q(t[r],e)})),t}function et(t,e){return t.classList?t.classList.contains(e):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function nt(t,e){t.classList?t.classList.add(e):t.className+=" "+e}function rt(t,e,n,r){t.addEventListener(e,n,r)}function it(t,e,n,r){t.removeEventListener(e,n,r)}var ot=function(t,e){return ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},ot(t,e)};function at(t,e){function n(){this.constructor=t}ot(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var st=function(){return st=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},st.apply(this,arguments)};function ut(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function lt(t,e){if(t===e)return!1;for(var n in t)if(!(n in e))return!0;for(var n in e)if(t[n]!==e[n])return!0;return!1}function ct(t,e){var n=Object.keys(t),r=Object.keys(e),i=x(n,r,(function(t){return t})),o={},a={},s={};return i.added.forEach((function(t){var n=r[t];o[n]=e[n]})),i.removed.forEach((function(e){var r=n[e];a[r]=t[r]})),i.maintained.forEach((function(r){var i=r[0],o=n[i],a=[t[o],e[o]];t[o]!==e[o]&&(s[o]=a)})),{added:o,removed:a,changed:s}}function ft(t){t.forEach((function(t){t()}))}function pt(t){var e=0;return t.map((function(t){return null==t?"$compat"+ ++e:""+t}))}function dt(t,e,n,r){return T(t)||"number"==typeof t?new xt("text_"+t,e,n,r,null,{}):new("string"==typeof t.type?Et:t.type.prototype.render?Mt:wt)(t.type,e,n,r,t.ref,t.props)}function ht(t){var e=[];return t.forEach((function(t){e=e.concat(R(t)?ht(t):t)})),e}function gt(t){var e=t.className,n=ut(t,["className"]);return null!=e&&(n.class=e),delete n.style,delete n.children,n}function vt(t,e){if(!e)return t;for(var n in e)O(t[n])&&(t[n]=e[n]);return t}function mt(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e||{},o=i.key,a=i.ref,s=ut(i,["key","ref"]);return{type:t,key:o,ref:a,props:st(st({},s),{children:ht(n).filter((function(t){return null!=t&&!1!==t}))})}}var bt=function(){function t(t,e,n,r,i,o){void 0===o&&(o={}),this.type=t,this.key=e,this.index=n,this.container=r,this.ref=i,this.props=o,this._providers=[]}var e=t.prototype;return e._should=function(t,e){return!0},e._update=function(t,e,n,r){if(this.base&&!T(e)&&!r&&!this._should(e.props,n))return!1;this.original=e,this._setState(n);var i=this.props;return T(e)||(this.props=e.props,this.ref=e.ref),this._render(t,this.base?i:{},n),!0},e._mounted=function(){var t=this.ref;t&&t(this.base)},e._setState=function(t){},e._updated=function(){var t=this.ref;t&&t(this.base)},e._destroy=function(){var t=this.ref;t&&t(null)},t}();function yt(t){var e={},n={};for(var r in t)0===r.indexOf("on")?n[r.replace("on","").toLowerCase()]=t[r]:e[r]=t[r];return{attributes:e,events:n}}var xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}at(e,t);var n=e.prototype;return n._render=function(t){var e=this,n=!this.base;return n&&(this.base=document.createTextNode(this.type.replace("text_",""))),t.push((function(){n?e._mounted():e._updated()})),!0},n._unmount=function(){this.base.parentNode.removeChild(this.base)},e}(bt),Et=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.events={},e._isSVG=!1,e}at(e,t);var n=e.prototype;return n.addEventListener=function(t,e){var n=this.events;n[t]=function(t){t.nativeEvent=t,e(t)},this.base.addEventListener(t,n[t])},n.removeEventListener=function(t){var e=this.events;this.base.removeEventListener(t,e[t]),delete e[t]},n._should=function(t){return lt(this.props,t)},n._render=function(t,e){var n=this,r=!this.base;if(r){var i=this._hasSVG();this._isSVG=i;var o=this.props.portalContainer;if(!o){var a=this.type;o=i?document.createElementNS("http://www.w3.org/2000/svg",a):document.createElement(a)}this.base=o}kt(this,this._providers,this.props.children,t,null);var s=this.base,u=yt(e),l=u.attributes,c=u.events,f=yt(this.props),p=f.attributes,d=f.events;return function(t,e,n){var r=ct(t,e),i=r.added,o=r.removed,a=r.changed;for(var s in i)n.setAttribute(s,i[s]);for(var s in a)n.setAttribute(s,a[s][1]);for(var s in o)n.removeAttribute(s)}(gt(l),gt(p),s),function(t,e,n){var r=ct(t,e),i=r.added,o=r.removed,a=r.changed;for(var s in o)n.removeEventListener(s);for(var s in i)n.addEventListener(s,i[s]);for(var s in a)n.removeEventListener(s),n.addEventListener(s,a[s][1]);for(var s in o)n.removeEventListener(s)}(c,d,this),function(t,e,n){var r=n.style,i=ct(t,e),o=i.added,a=i.removed,s=i.changed;for(var u in o){var l=F(u,"-");r.setProperty?r.setProperty(l,o[u]):r[l]=o[u]}for(var u in s)l=F(u,"-"),r.setProperty?r.setProperty(l,s[u][1]):r[l]=s[u][1];for(var u in a)l=F(u,"-"),r.removeProperty?r.removeProperty(l):r[l]=""}(e.style||{},this.props.style||{},s),t.push((function(){r?n._mounted():n._updated()})),!0},n._unmount=function(){var t=this.events,e=this.base;for(var n in t)e.removeEventListener(n,t[n]);this._providers.forEach((function(t){t._unmount()})),this.events={},this.props.portalContainer||e.parentNode.removeChild(e)},n._hasSVG=function(){if(this._isSVG||"svg"===this.type)return!0;var t=St(this.container);return t&&"ownerSVGElement"in t},e}(bt);function St(t){if(!t)return null;var e=t.base;return e instanceof Node?e:St(t.container)}function Ct(t){if(!t)return null;if(t instanceof Node)return t;var e=t.$_provider._providers;return e.length?Ct(e[0].base):null}var wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}at(e,t);var n=e.prototype;return n._render=function(t){var e=this.type(this.props);return kt(this,this._providers,e?[e]:[],t),!0},n._unmount=function(){this._providers.forEach((function(t){t._unmount()}))},e}(bt),Dt=function(t){function e(e){var n=t.call(this,"container","container",0,null)||this;return n.base=e,n}at(e,t);var n=e.prototype;return n._render=function(){return!0},n._unmount=function(){},e}(bt),Mt=function(t){function e(e,n,r,i,o,a){return void 0===a&&(a={}),t.call(this,e,n,r,i,o,vt(a,e.defaultProps))||this}at(e,t);var n=e.prototype;return n._should=function(t,e){return this.base.shouldComponentUpdate(vt(t,this.type.defaultProps),e||this.base.state)},n._render=function(t,e,n){var r=this;this.props=vt(this.props,this.type.defaultProps);var i=!this.base;i?(this.base=new this.type(this.props),this.base.$_provider=this):this.base.props=this.props;var o=this.base,a=o.state,s=o.render();s&&s.props&&!s.props.children.length&&(s.props.children=this.props.children),kt(this,this._providers,s?[s]:[],t,n,null),t.push((function(){i?(r._mounted(),o.componentDidMount()):(r._updated(),o.componentDidUpdate(e,a))}))},n._setState=function(t){t&&(this.base.state=t)},n._unmount=function(){this._providers.forEach((function(t){t._unmount()})),clearTimeout(this.base.$_timer),this.base.componentWillUnmount()},e}(bt),Ot=function(){function t(t){void 0===t&&(t={}),this.props=t,this.state={},this.$_timer=0,this.$_state={}}var e=t.prototype;return e.shouldComponentUpdate=function(t,e){return!0},e.render=function(){return null},e.setState=function(t,e,n){var r=this;this.$_timer||(this.$_state={}),clearTimeout(this.$_timer),this.$_timer=0,this.$_state=st(st({},this.$_state),t),n?this.$_setState(e,n):this.$_timer=setTimeout((function(){r.$_timer=0,r.$_setState(e,n)}))},e.forceUpdate=function(t){this.setState({},t,!0)},e.componentDidMount=function(){},e.componentDidUpdate=function(t,e){},e.componentWillUnmount=function(){},e.$_setState=function(t,e){var n=[],r=this.$_provider;kt(r.container,[r],[r.original],n,st(st({},this.state),this.$_state),e)&&(t&&n.push(t),ft(n))},t}(),Pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return at(e,t),e.prototype.shouldComponentUpdate=function(t,e){return lt(this.props,t)||lt(this.state,e)},e}(Ot),Rt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}at(e,t);var n=e.prototype;return n.componentDidMount=function(){var t=this.props,e=t.element,n=t.container;this._portalProvider=new Dt(n),Bt(e,n,this._portalProvider)},n.componentDidUpdate=function(){var t=this.props;Bt(t.element,t.container,this._portalProvider)},n.componentWillUnmount=function(){Bt(null,this.props.container,this._portalProvider),this._portalProvider=null},e}(Pt);function Tt(t,e,n){var r=n.map((function(t){return T(t)?null:t.key})),i=x(pt(e.map((function(t){return t.key}))),pt(r),(function(t){return t}));i.removed.forEach((function(t){e.splice(t,1)[0]._unmount()})),i.ordered.forEach((function(t){var n=t[0],r=t[1],i=e.splice(n,1)[0];e.splice(r,0,i);var o=Ct(i.base),a=Ct(e[r+1]&&e[r+1].base);o&&o.parentNode.insertBefore(o,a)})),i.added.forEach((function(i){e.splice(i,0,dt(n[i],r[i],i,t))}));var o=i.maintained.filter((function(i){i[0];var o=i[1],a=n[o],s=e[o];return(T(a)?"text_"+a:a.type)!==s.type?(s._unmount(),e.splice(o,1,dt(a,r[o],o,t)),!0):(s.index=o,!1)}));return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(i.added,o.map((function(t){t[0];return t[1]})))}function kt(t,e,n,r,i,o){var a=Tt(t,e,n),s=e.filter((function(t,e){return t._update(r,n[e],i,o)})),u=St(t);return u&&a.reverse().forEach((function(n){var r=e[n],i=Ct(r.base);if(i&&u!==i&&!i.parentNode){var o=function(t,e){for(var n=t._providers,r=n.length,i=e.index+1;i<r;++i){var o=Ct(n[i].base);if(o)return o}return null}(t,r);u.insertBefore(i,o)}})),s.length>0}function Bt(t,e,n){void 0===n&&(n=e.__REACT_COMPAT__);var r=!!n;return n||(n=new Dt(e)),function(t,e,n){var r=[];kt(t,t._providers,e,r,n),ft(r)}(n,t?[t]:[]),r||(e.__REACT_COMPAT__=n),n}function zt(t,e,n){var r=e.__REACT_COMPAT__;t&&!r&&(e.innerHTML=""),Bt(t,e,r),n&&n()}function _t(t,e){for(var n=t.length,r=0;r<n;++r)if(e(t[r],r))return!0;return!1}function Gt(t,e){for(var n=t.length,r=0;r<n;++r)if(e(t[r],r))return t[r];return null}function jt(t,e){try{return new RegExp(t,"g").exec(e)}catch(t){return null}}function It(){if("undefined"==typeof navigator||!navigator||!navigator.userAgentData)return!1;var t=navigator.userAgentData,e=t.brands||t.uaList;return!(!e||!e.length)}function At(t){return t.replace(/_/g,".")}function Nt(t,e){var n=null,r="-1";return _t(t,(function(t){var i=jt("("+t.test+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",e);return!(!i||t.brand)&&(n=t,r=i[3]||"-1",t.versionAlias?r=t.versionAlias:t.versionTest&&(r=function(t,e){var n=jt("("+t+")((?:\\/|\\s|:)([0-9|\\.|_]+))",e);return n?n[3]:""}(t.versionTest.toLowerCase(),e)||r),r=At(r),!0)})),{preset:n,version:r}}function Ft(t,e){var n={brand:"",version:"-1"};return _t(t,(function(t){var r=Yt(e,t);return!!r&&(n.brand=t.id,n.version=t.versionAlias||r.version,"-1"!==n.version)})),n}function Yt(t,e){return Gt(t,(function(t){var n=t.brand;return jt(""+e.test,n.toLowerCase())}))}var Xt=[{test:"phantomjs",id:"phantomjs"},{test:"whale",id:"whale"},{test:"edgios|edge|edg",id:"edge"},{test:"msie|trident|windows phone",id:"ie",versionTest:"iemobile|msie|rv"},{test:"miuibrowser",id:"miui browser"},{test:"samsungbrowser",id:"samsung internet"},{test:"samsung",id:"samsung internet",versionTest:"version"},{test:"chrome|crios",id:"chrome"},{test:"firefox|fxios",id:"firefox"},{test:"android",id:"android browser",versionTest:"version"},{test:"safari|iphone|ipad|ipod",id:"safari",versionTest:"version"}],Lt=[{test:"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",id:"chrome",versionTest:"chrome"},{test:"chromium",id:"chrome"},{test:"whale",id:"chrome",versionAlias:"-1",brand:!0}],qt=[{test:"applewebkit",id:"webkit",versionTest:"applewebkit|safari"}],Wt=[{test:"(?=(iphone|ipad))(?!(.*version))",id:"webview"},{test:"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",id:"webview"},{test:"webview",id:"webview"}],Ht=[{test:"windows phone",id:"windows phone"},{test:"windows 2000",id:"window",versionAlias:"5.0"},{test:"windows nt",id:"window"},{test:"iphone|ipad|ipod",id:"ios",versionTest:"iphone os|cpu os"},{test:"mac os x",id:"mac"},{test:"android",id:"android"},{test:"tizen",id:"tizen"},{test:"webos|web0s",id:"webos"}];function Vt(t){var e=navigator.userAgentData,n=(e.uaList||e.brands).slice(),r=e.mobile||!1,i=n[0],o={name:i.brand,version:i.version,majorVersion:-1,webkit:!1,webkitVersion:"-1",chromium:!1,chromiumVersion:"-1",webview:!!Ft(Wt,n).brand},a={name:"unknown",version:"-1",majorVersion:-1};o.webkit=!o.chromium&&_t(qt,(function(t){return Yt(n,t)}));var s=Ft(Lt,n);if(o.chromium=!!s.brand,o.chromiumVersion=s.version,!o.chromium){var u=Ft(qt,n);o.webkit=!!u.brand,o.webkitVersion=u.version}if(t){var l=t.platform.toLowerCase(),c=Gt(Ht,(function(t){return new RegExp(""+t.test,"g").exec(l)}));a.name=c?c.id:l,a.version=t.platformVersion}var f=Ft(Xt,n);return f.brand&&(o.name=f.brand,o.version=t?t.uaFullVersion:f.version),"Linux armv8l"===navigator.platform?a.name="android":o.webkit&&(a.name=r?"ios":"mac"),"ios"===a.name&&o.webview&&(o.version="-1"),a.version=At(a.version),o.version=At(o.version),a.majorVersion=parseInt(a.version,10),o.majorVersion=parseInt(o.version,10),{browser:o,os:a,isMobile:r,isHints:!0}}function $t(t){var e=function(t){var e=t;if(void 0===e){if("undefined"==typeof navigator||!navigator)return"";e=navigator.userAgent||""}return e.toLowerCase()}(t),n=!!/mobi/g.exec(e),r={name:"unknown",version:"-1",majorVersion:-1,webview:!!Nt(Wt,e).preset,chromium:!1,chromiumVersion:"-1",webkit:!1,webkitVersion:"-1"},i={name:"unknown",version:"-1",majorVersion:-1},o=Nt(Xt,e),a=o.preset,s=o.version,u=Nt(Ht,e),l=u.preset,c=u.version,f=Nt(Lt,e);if(r.chromium=!!f.preset,r.chromiumVersion=f.version,!r.chromium){var p=Nt(qt,e);r.webkit=!!p.preset,r.webkitVersion=p.version}return l&&(i.name=l.id,i.version=c,i.majorVersion=parseInt(c,10)),a&&(r.name=a.id,r.version=s,r.webview&&"ios"===i.name&&"safari"!==r.name&&(r.webview=!1)),r.majorVersion=parseInt(r.version,10),{browser:r,os:i,isMobile:n,isHints:!1}}function Kt(t){return void 0===t&&It()?Vt():$t(t)}const Ut=Kt;function Zt(t,e,n,r,i,o){for(var a=0;a<i;++a){var s=n+a*i,u=r+a*i;t[s]+=t[u]*o,e[s]+=e[u]*o}}function Jt(t,e,n,r,i){for(var o=0;o<i;++o){var a=n+o*i,s=r+o*i,u=t[a],l=e[a];t[a]=t[s],t[s]=u,e[a]=e[s],e[s]=l}}function Qt(t,e,n,r,i){for(var o=0;o<r;++o){var a=n+o*r;t[a]/=i,e[a]/=i}}function te(t,e,n){void 0===n&&(n=Math.sqrt(t.length));for(var r=t.slice(),i=0;i<n;++i)r[i*n+e-1]=0,r[(e-1)*n+i]=0;return r[(e-1)*(n+1)]=1,r}function ee(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=t.slice(),r=be(e),i=0;i<e;++i){var o=e*i+i;if(!Q(n[o],D))for(var a=i+1;a<e;++a)if(n[e*i+a]){Jt(n,r,i,a,e);break}if(!Q(n[o],D))return[];Qt(n,r,i,e,n[o]);for(a=0;a<e;++a){var s=a,u=n[a+i*e];Q(u,D)&&i!==a&&Zt(n,r,s,i,e,-u)}}return r}function ne(t,e){for(var n=t.slice(),r=t.length;r<e-1;++r)n[r]=0;return n[e-1]=1,n}function re(t,e,n){if(void 0===e&&(e=Math.sqrt(t.length)),e===n)return t;for(var r=be(n),i=Math.min(e,n),o=0;o<i-1;++o){for(var a=0;a<i-1;++a)r[o*n+a]=t[o*e+a];r[(o+1)*n-1]=t[(o+1)*e-1],r[(n-1)*n+o]=t[(e-1)*e+o]}return r[n*n-1]=t[e*e-1],r}function ie(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=be(t);return e.forEach((function(e){r=oe(r,e,t)})),r}function oe(t,e,n){void 0===n&&(n=Math.sqrt(t.length));var r=[],i=t.length/n,o=e.length/i;if(!i)return e;if(!o)return t;for(var a=0;a<n;++a)for(var s=0;s<o;++s){r[s*n+a]=0;for(var u=0;u<i;++u)r[s*n+a]+=t[u*n+a]*e[s*i+u]}return r}function ae(t,e){for(var n=Math.min(t.length,e.length),r=t.slice(),i=0;i<n;++i)r[i]=r[i]+e[i];return r}function se(t,e){for(var n=Math.min(t.length,e.length),r=t.slice(),i=0;i<n;++i)r[i]=r[i]-e[i];return r}function ue(t,e){return void 0===e&&(e=9===t.length),e?[t[0],t[1],t[3],t[4],t[6],t[7]]:t}function le(t,e,n){void 0===n&&(n=e.length);var r=oe(t,e,n),i=r[n-1];return r.map((function(t){return t/i}))}function ce(t,e){return oe(t,[1,0,0,0,0,Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1],4)}function fe(t,e){return oe(t,[Math.cos(e),0,-Math.sin(e),0,0,1,0,0,Math.sin(e),0,Math.cos(e),0,0,0,0,1],4)}function pe(t,e){return oe(t,me(e,4))}function de(t,e){var n=e[0],r=void 0===n?1:n,i=e[1],o=void 0===i?1:i,a=e[2];return oe(t,[r,0,0,0,0,o,0,0,0,0,void 0===a?1:a,0,0,0,0,1],4)}function he(t,e){return le(me(e,3),ne(t,3))}function ge(t,e){var n=e[0],r=void 0===n?0:n,i=e[1],o=void 0===i?0:i,a=e[2];return oe(t,[1,0,0,0,0,1,0,0,0,0,1,0,r,o,void 0===a?0:a,1],4)}function ve(t,e){return oe(t,e,4)}function me(t,e){var n=Math.cos(t),r=Math.sin(t),i=be(e);return i[0]=n,i[1]=r,i[e]=-r,i[e+1]=n,i}function be(t){for(var e=t*t,n=[],r=0;r<e;++r)n[r]=r%(t+1)?0:1;return n}function ye(t,e){for(var n=be(e),r=Math.min(t.length,e-1),i=0;i<r;++i)n[(e+1)*i]=t[i];return n}function xe(t,e){for(var n=be(e),r=Math.min(t.length,e-1),i=0;i<r;++i)n[e*(e-1)+i]=t[i];return n}function Ee(t,e,n,r,i,o,a,s){var u=t[0],l=t[1],c=e[0],f=e[1],p=n[0],d=n[1],h=r[0],g=r[1],v=i[0],m=i[1],b=o[0],y=o[1],x=a[0],E=a[1],S=s[0],C=s[1],w=ee([u,0,c,0,p,0,h,0,l,0,f,0,d,0,g,0,1,0,1,0,1,0,1,0,0,u,0,c,0,p,0,h,0,l,0,f,0,d,0,g,0,1,0,1,0,1,0,1,-v*u,-m*u,-b*c,-y*c,-x*p,-E*p,-S*h,-C*h,-v*l,-m*l,-b*f,-y*f,-x*d,-E*d,-S*g,-C*g],8);if(!w.length)return[];var D=oe(w,[v,m,b,y,x,E,S,C],8);return D[8]=1,re(function(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=[],r=0;r<e;++r)for(var i=0;i<e;++i)n[i*e+r]=t[e*r+i];return n}(D),3,4)}function Se(t){return we(De(t))}function Ce(t,e){var n=le(t,[e[0],e[1]||0,e[2]||0,1],4),r=n[3]||1;return[n[0]/r,n[1]/r,n[2]/r]}function we(t){var e=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return t.forEach((function(t){var n=t.matrixFunction,r=t.functionValue;n&&(e=n(e,r))})),e}function De(t){return(R(t)?t:G(t)).map((function(t){var e=I(t),n=e.prefix,r=e.value,i=null,o=n,a="";if("translate"===n||"translateX"===n||"translate3d"===n){var s=j(r).map((function(t){return parseFloat(t)})),u=s[0],l=s[1],c=void 0===l?0:l,f=s[2];i=ge,a=[u,c,void 0===f?0:f]}else if("translateY"===n){i=ge,a=[0,c=parseFloat(r),0]}else if("translateZ"===n){i=ge,a=[0,0,parseFloat(r)]}else if("scale"===n||"scale3d"===n){var p=j(r).map((function(t){return parseFloat(t)})),d=p[0],h=p[1],g=void 0===h?d:h,v=p[2];i=de,a=[d,g,void 0===v?1:v]}else if("scaleX"===n){i=de,a=[d=parseFloat(r),1,1]}else if("scaleY"===n){i=de,a=[1,g=parseFloat(r),1]}else if("scaleZ"===n){i=de,a=[1,1,parseFloat(r)]}else if("rotate"===n||"rotateZ"===n||"rotateX"===n||"rotateY"===n){var m=A(r),b=m.unit,y=m.value;"rotate"===n||"rotateZ"===n?(o="rotateZ",i=pe):"rotateX"===n?i=ce:"rotateY"===n&&(i=fe),a="rad"===b?y:y*Math.PI/180}else if("matrix3d"===n)i=ve,a=j(r).map((function(t){return parseFloat(t)}));else if("matrix"===n){var x=j(r).map((function(t){return parseFloat(t)}));i=ve,a=[x[0],x[1],0,0,x[2],x[3],0,0,0,0,1,0,x[4],x[5],0,1]}else o="";return{name:n,functionName:o,value:r,matrixFunction:i,functionValue:a}}))}var Me=function(t,e){return Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Me(t,e)};var Oe,Pe="function"==typeof Map?void 0:(Oe=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++Oe)});function Re(t,e){return x(t,e,Pe)}const Te=function(t){function e(e){return void 0===e&&(e=[]),t.call(this,e,Pe)||this}return function(t,e){function n(){this.constructor=t}Me(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e}(S);function ke(t){return t.length<3?0:Math.abs(function(t){for(var e=0,n=t.length-1;n>=0;--n)e+=t[n];return e}(t.map((function(e,n){var r=t[n+1]||t[0];return e[0]*r[1]-r[0]*e[1]}))))/2}function Be(t,e){var n=e.width,r=e.height,i=e.left,o=e.top,a=ze(t),s=a.minX,u=a.minY,l=a.maxX,c=a.maxY,f=n/(l-s),p=r/(c-u);return t.map((function(t){return[i+(t[0]-s)*f,o+(t[1]-u)*p]}))}function ze(t){var e=t.map((function(t){return t[0]})),n=t.map((function(t){return t[1]}));return{minX:Math.min.apply(Math,e),minY:Math.min.apply(Math,n),maxX:Math.max.apply(Math,e),maxY:Math.max.apply(Math,n)}}function _e(t,e,n){var r=t[0],i=t[1],o=ze(e),a=o.minX,s=o.minY,u=o.maxX,l=o.maxY,c=[[a,i],[u,i]],f=[[r,s],[r,l]],p=Ge(c[0],c[1]),d=Ge(f[0],f[1]),h=Ae(e),g=[],v=[];return h.forEach((function(t){var e=Ge(t[0],t[1]),n=Ie(je(p,e),[c,t]),o=Ie(je(d,e),[f,t]);1===n.length&&t[0][1]===i||g.push.apply(g,n),1===o.length&&t[0][0]===r||v.push.apply(v,o),e[0]||g.push.apply(g,n),e[1]||v.push.apply(v,o)})),!n&&(X(g,(function(t){return t[0]===r}))>-1||X(v,(function(t){return t[1]===i}))>-1)||!!(g.filter((function(t){return t[0]>r})).length%2&&v.filter((function(t){return t[1]>i})).length%2)}function Ge(t,e){var n=t[0],r=t[1],i=e[0],o=e[1];if(n===i&&r===o)return[0,0,0];if(n===i)return[1,0,-n];if(r===o)return[0,1,-r];var a=(i-n)/(r-o);return[1,a,-n-a*r]}function je(t,e){var n,r,i=t[0],o=t[1],a=t[2],s=e[0],u=e[1],l=e[2],c=0===i&&0===s,f=0===o&&0===u;if(c&&f)return[];if(c){var p=-a/o;return p!==-l/u?[]:[[-1/0,p],[1/0,p]]}if(f){var d=-a/i;return d!==-l/s?[]:[[d,-1/0],[d,1/0]]}return 0===i?[[n=-(u*(r=-a/o)+l)/s,r]]:0===s?[[n=-(o*(r=-l/u)+a)/i,r]]:0===o?[[n=-a/i,r=-(s*n+l)/u]]:0===u?[[n=-l/s,r=-(i*n+a)/o]]:[[n=(o*l-u*a)/(u*i-o*s),r=-(i*n+a)/o]]}function Ie(t,e){var n=e.map((function(t){return[0,1].map((function(e){return[Math.min(t[0][e],t[1][e]),Math.max(t[0][e],t[1][e])]}))}));if(2===t.length){var r=t[0],i=r[0],o=r[1];if(i===t[1][0]){var a=Math.max.apply(Math,n.map((function(t){return t[1][0]}))),s=Math.min.apply(Math,n.map((function(t){return t[1][1]})));return a>s?[]:[[i,a],[i,s]]}if(o===t[1][1]){var u=Math.max.apply(Math,n.map((function(t){return t[0][0]}))),l=Math.min.apply(Math,n.map((function(t){return t[0][1]})));return u>l?[]:[[u,o],[l,o]]}}return t.filter((function(t){return n.every((function(e){return e[0][0]<=t[0]&&t[0]<=e[0][1]&&e[1][0]<=t[1]&&t[1]<=e[1][1]}))}))}function Ae(t){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t.slice(1),[t[0]]).map((function(e,n){return[t[n],e]}))}function Ne(t,e){var n=t.slice(),r=e.slice();-1===Z(n)&&n.reverse(),-1===Z(r)&&r.reverse();var i=Ae(n),o=Ae(r),a=i.map((function(t){return Ge(t[0],t[1])})),s=o.map((function(t){return Ge(t[0],t[1])})),u=[];a.forEach((function(t,e){var n=i[e],a=[];s.forEach((function(r,i){var s=Ie(je(t,r),[n,o[i]]);a.push.apply(a,s.map((function(t){return{index1:e,index2:i,pos:t}})))})),a.sort((function(t,e){return J(n[0],t.pos)-J(n[0],e.pos)})),u.push.apply(u,a),_e(n[1],r)&&u.push({index1:e,index2:-1,pos:n[1]})})),o.forEach((function(t,e){if(_e(t[1],n)){var r=!1,i=X(u,(function(t){return t.index2===e?(r=!0,!1):!!r}));-1===i&&(r=!1,i=X(u,(function(t){var n=t.index1,i=t.index2;return-1===n&&i+1===e?(r=!0,!1):!!r}))),-1===i?u.push({index1:-1,index2:e,pos:t[1]}):u.splice(i,0,{index1:-1,index2:e,pos:t[1]})}}));var l=u.map((function(t){return t.pos})),c={};return l.filter((function(t){var e=t[0]+"x"+t[1];return!c[e]&&(c[e]=!0,!0)}))}var Fe=function(){return Fe=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Fe.apply(this,arguments)};var Ye=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(P(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(P(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=X(r,(function(t){return t.listener===e}));i>-1&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(t,e){var n=this;return e&&this._addEvent(t,e,{once:!0}),new Promise((function(e){n._addEvent(t,e,{once:!0})}))},e.emit=function(t,e){var n=this;void 0===e&&(e={});var r=this._events[t];if(!t||!r)return!0;var i=!1;return e.eventType=t,e.stop=function(){i=!0},e.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(r).forEach((function(r){r.listener(e),r.once&&n.off(t,r.listener)})),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(Fe({listener:e},n))},t}();const Xe=Ye;var Le=function(t,e){return Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Le(t,e)};function qe(t){var e=t.container;return e===document.body?[e.scrollLeft||document.documentElement.scrollLeft,e.scrollTop||document.documentElement.scrollTop]:[e.scrollLeft,e.scrollTop]}const We=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.startRect=null,e.startPos=[],e.prevTime=0,e.timer=0,e}!function(t,e){function n(){this.constructor=t}Le(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t);var n=e.prototype;return n.dragStart=function(t,e){var n=e.container,r=0,i=0,o=0,a=0;if(n===document.body)o=window.innerWidth,a=window.innerHeight;else{var s=n.getBoundingClientRect();r=s.top,i=s.left,o=s.width,a=s.height}this.startPos=[t.clientX,t.clientY],this.startRect={top:r,left:i,width:o,height:a}},n.drag=function(t,e){var n=this,r=t.clientX,i=t.clientY,o=e.container,a=e.threshold,s=void 0===a?0:a,u=e.throttleTime,l=void 0===u?0:u,c=e.getScrollPosition,f=void 0===c?qe:c,p=this.startRect,d=this.startPos,h=Y(),g=Math.max(l+this.prevTime-h,0),v=[0,0];if(p.top>i-s?(d[1]>p.top||i<d[1])&&(v[1]=-1):p.top+p.height<i+s&&(d[1]<p.top+p.height||i>d[1])&&(v[1]=1),p.left>r-s?(d[0]>p.left||r<d[0])&&(v[0]=-1):p.left+p.width<r+s&&(d[0]<p.left+p.width||r>d[0])&&(v[0]=1),clearTimeout(this.timer),!v[0]&&!v[1])return!1;if(g>0)return this.timer=window.setTimeout((function(){n.drag(t,e)}),g),!1;this.prevTime=h;var m=f({container:o,direction:v});this.trigger("scroll",{container:o,direction:v,inputEvent:t});var b=f({container:o,direction:v}),y=b[0]-m[0],x=b[1]-m[1];return!(!y&&!x)&&(this.trigger("move",{offsetX:v[0]?y:0,offsetY:v[1]?x:0,inputEvent:t}),l&&(this.timer=window.setTimeout((function(){n.drag(t,e)}),l)),!0)},n.dragEnd=function(){clearTimeout(this.timer)},e}(Xe);var He=function(t,e){return He=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},He(t,e)};var Ve=function(){return Ve=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ve.apply(this,arguments)};function $e(t){return 180*(e=[t[0].clientX,t[0].clientY],n=[t[1].clientX,t[1].clientY],r=n[0]-e[0],i=n[1]-e[1],((o=Math.atan2(i,r))>=0?o:o+2*Math.PI)/Math.PI);var e,n,r,i,o}function Ke(t){return t.touches?function(t){for(var e=Math.min(t.length,2),n=[],r=0;r<e;++r)n.push(Je(t[r]));return n}(t.touches):[Je(t)]}function Ue(t,e,n){var r=n.length,i=Qe(t,r),o=i.clientX,a=i.clientY,s=i.originalClientX,u=i.originalClientY,l=Qe(e,r),c=l.clientX,f=l.clientY,p=Qe(n,r);return{clientX:s,clientY:u,deltaX:o-c,deltaY:a-f,distX:o-p.clientX,distY:a-p.clientY}}function Ze(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function Je(t){return{clientX:t.clientX,clientY:t.clientY}}function Qe(t,e){void 0===e&&(e=t.length);for(var n={clientX:0,clientY:0,originalClientX:0,originalClientY:0},r=0;r<e;++r){var i=t[r];n.originalClientX+="originalClientX"in i?i.originalClientX:i.clientX,n.originalClientY+="originalClientY"in i?i.originalClientY:i.clientY,n.clientX+=i.clientX,n.clientY+=i.clientY}return e?{clientX:n.clientX/e,clientY:n.clientY/e,originalClientX:n.originalClientX/e,originalClientY:n.originalClientY/e}:n}var tn=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}var e=t.prototype;return e.addClients=function(t){void 0===t&&(t=this.prevClients);var e=this.getPosition(t),n=e.deltaX,r=e.deltaY;return this.movement+=Math.sqrt(n*n+r*r),this.prevClients=t,e},e.getAngle=function(t){return void 0===t&&(t=this.prevClients),$e(t)},e.getRotation=function(t){return void 0===t&&(t=this.prevClients),$e(t)-$e(this.startClients)},e.getPosition=function(t){return Ue(t||this.prevClients,this.prevClients,this.startClients)},e.getPositions=function(t){void 0===t&&(t=this.prevClients);var e=this.prevClients;return this.startClients.map((function(n,r){return Ue([t[r]],[e[r]],[n])}))},e.getMovement=function(t){var e=this.movement;if(!t)return e;var n=Qe(t,this.length),r=Qe(this.prevClients,this.length),i=n.clientX-r.clientX,o=n.clientY-r.clientY;return Math.sqrt(i*i+o*o)+e},e.getDistance=function(t){return void 0===t&&(t=this.prevClients),Ze(t)},e.getScale=function(t){return void 0===t&&(t=this.prevClients),Ze(t)/Ze(this.startClients)},e.move=function(t,e){this.startClients.forEach((function(n){n.clientX-=t,n.clientY-=e})),this.prevClients.forEach((function(n){n.clientX-=t,n.clientY-=e}))},t}(),en=["textarea","input"],nn=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;r.options={},r.flag=!1,r.pinchFlag=!1,r.datas={},r.isDrag=!1,r.isPinch=!1,r.isMouse=!1,r.isTouch=!1,r.clientStores=[],r.targets=[],r.prevTime=0,r.doubleFlag=!1,r.onDragStart=function(t,e){if(void 0===e&&(e=!0),r.flag||!1!==t.cancelable){var n=r.options,i=n.container,o=n.pinchOutside,a=n.preventRightClick,s=n.preventDefault,u=n.checkInput,l=r.isTouch,c=!r.flag;if(c){var f=document.activeElement,p=t.target,d=p.tagName.toLowerCase(),h=en.indexOf(d)>-1,g=p.isContentEditable;if(h||g){if(u||f===p)return!1;if(f&&g&&f.isContentEditable&&f.contains(p))return!1}else if((s||"touchstart"===t.type)&&f){var v=f.tagName;(f.isContentEditable||en.indexOf(v)>-1)&&f.blur()}if(r.clientStores=[new tn(Ke(t))],r.flag=!0,r.isDrag=!1,r.datas={},a&&(3===t.which||2===t.button))return r.initDrag(),!1;r.doubleFlag=Y()-r.prevTime<200,!1===r.emit("dragStart",Ve({datas:r.datas,inputEvent:t,isTrusted:e,isDouble:r.doubleFlag},r.getCurrentStore().getPosition()))&&r.initDrag(),r.flag&&s&&t.preventDefault()}if(!r.flag)return!1;var m=0;if(c&&l&&o&&(m=setTimeout((function(){rt(i,"touchstart",r.onDragStart,{passive:!1})}))),!c&&l&&o&&it(i,"touchstart",r.onDragStart),r.flag&&function(t){return t.touches&&t.touches.length>=2}(t)){if(clearTimeout(m),c&&t.touches.length!==t.changedTouches.length)return;r.pinchFlag||r.onPinchStart(t)}}},r.onDrag=function(t,e){if(r.flag){var n=Ke(t),i=r.moveClients(n,t,!1);(r.pinchFlag||i.deltaX||i.deltaY)&&r.emit("drag",Ve({},i,{isScroll:!!e,inputEvent:t})),r.pinchFlag&&r.onPinch(t,n),r.getCurrentStore().addClients(n)}},r.onDragEnd=function(t){if(r.flag){var e=r.options,n=e.pinchOutside,i=e.container;r.isTouch&&n&&it(i,"touchstart",r.onDragStart),r.flag=!1;var o=r.getCurrentStore().getPosition(),a=Y(),s=!r.isDrag&&r.doubleFlag;r.prevTime=r.isDrag||s?0:a,r.emit("dragEnd",Ve({datas:r.datas,isDouble:s,isDrag:r.isDrag,isClick:!r.isDrag,inputEvent:t},o)),r.pinchFlag&&r.onPinchEnd(t),r.clientStores=[]}},r.onBlur=function(){r.onDragEnd()};var i=[].concat(e);r.options=Ve({checkInput:!1,container:i.length>1?window:i[0],preventRightClick:!0,preventDefault:!0,checkWindowBlur:!1,pinchThreshold:0,events:["touch","mouse"]},n);var o=r.options,a=o.container,s=o.events,u=o.checkWindowBlur;if(r.isTouch=s.indexOf("touch")>-1,r.isMouse=s.indexOf("mouse")>-1,r.targets=i,r.isMouse&&(i.forEach((function(t){rt(t,"mousedown",r.onDragStart)})),rt(a,"mousemove",r.onDrag),rt(a,"mouseup",r.onDragEnd),rt(a,"contextmenu",r.onDragEnd)),u&&rt(window,"blur",r.onBlur),r.isTouch){var l={passive:!1};i.forEach((function(t){rt(t,"touchstart",r.onDragStart,l)})),rt(a,"touchmove",r.onDrag,l),rt(a,"touchend",r.onDragEnd,l),rt(a,"touchcancel",r.onDragEnd,l)}return r}!function(t,e){function n(){this.constructor=t}He(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t);var n=e.prototype;return n.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce((function(t,e){return t+e.movement}),0)},n.isDragging=function(){return this.isDrag},n.isFlag=function(){return this.flag},n.isPinchFlag=function(){return this.pinchFlag},n.isDoubleFlag=function(){return this.doubleFlag},n.isPinching=function(){return this.isPinch},n.scrollBy=function(t,e,n,r){void 0===r&&(r=!0),this.flag&&(this.clientStores[0].move(t,e),r&&this.onDrag(n,!0))},n.move=function(t,e){var n=t[0],r=t[1],i=this.getCurrentStore().prevClients;return this.moveClients(i.map((function(t){var e=t.clientX,i=t.clientY;return{clientX:e+n,clientY:i+r,originalClientX:e,originalClientY:i}})),e,!0)},n.triggerDragStart=function(t){this.onDragStart(t,!1)},n.setEventDatas=function(t){var e=this.datas;for(var n in t)e[n]=t[n];return this},n.getEventDatas=function(){return this.datas},n.unset=function(){var t=this,e=this.targets,n=this.options.container;this.off(),it(window,"blur",this.onBlur),this.isMouse&&(e.forEach((function(e){it(e,"mousedown",t.onDragStart)})),it(n,"mousemove",this.onDrag),it(n,"mouseup",this.onDragEnd),it(n,"contextmenu",this.onDragEnd)),this.isTouch&&(e.forEach((function(e){it(e,"touchstart",t.onDragStart)})),it(n,"touchstart",this.onDragStart),it(n,"touchmove",this.onDrag),it(n,"touchend",this.onDragEnd),it(n,"touchcancel",this.onDragEnd))},n.onPinchStart=function(t){var e=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>e)){var n=new tn(Ke(t));this.pinchFlag=!0,this.clientStores.splice(0,0,n),!1===this.emit("pinchStart",Ve({datas:this.datas,angle:n.getAngle(),touches:this.getCurrentStore().getPositions()},n.getPosition(),{inputEvent:t}))&&(this.pinchFlag=!1)}},n.onPinch=function(t,e){if(this.flag&&this.pinchFlag&&!(e.length<2)){var n=this.getCurrentStore();this.isPinch=!0,this.emit("pinch",Ve({datas:this.datas,movement:this.getMovement(e),angle:n.getAngle(e),rotation:n.getRotation(e),touches:n.getPositions(e),scale:n.getScale(e),distance:n.getDistance(e)},n.getPosition(e),{inputEvent:t}))}},n.onPinchEnd=function(t){if(this.pinchFlag){var e=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.getCurrentStore();this.emit("pinchEnd",Ve({datas:this.datas,isPinch:e,touches:n.getPositions()},n.getPosition(),{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}},n.initDrag=function(){this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1},n.getCurrentStore=function(){return this.clientStores[0]},n.moveClients=function(t,e,n){var r=this.getCurrentStore()[n?"addClients":"getPosition"](t);return this.isDrag=!0,Ve({datas:this.datas},r,{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:e})},e}(Xe);const rn=nn;var on=function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return e>>>0};function an(t,e,n,r){var i=document.createElement("style");return i.setAttribute("type","text/css"),i.setAttribute("data-styled-id",t),n.nonce&&i.setAttribute("nonce",n.nonce),i.innerHTML=function(t,e,n){return n.original?e:e.replace(/([^};{\s}][^};{]*|^\s*){/gm,(function(e,n){var r=n.trim();return(r?j(r):[""]).map((function(e){var n=e.trim();return 0===n.indexOf("@")?n:n.indexOf(":global")>-1?n.replace(/\:global/g,""):n.indexOf(":host")>-1?""+n.replace(/\:host/g,"."+t):n?"."+t+" "+n:"."+t})).join(", ")+" {"}))}(t,e,n),(r||document.head||document.body).appendChild(i),i}const sn=function(t){var e,n="rCS"+on(t).toString(36),r=0;return{className:n,inject:function(i,o){void 0===o&&(o={});var a,s=function(t){if(t&&t.getRootNode){var e=t.getRootNode();if(11===e.nodeType)return e}}(i),u=0===r;return(s||u)&&(a=an(n,t,o,s)),u&&(e=a),s||++r,{destroy:function(){s?(i.removeChild(a),a=null):(r>0&&--r,0===r&&e&&(e.parentNode.removeChild(e),e=null))}}}}};var un=function(t,e){return un=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},un(t,e)};function ln(t,e){function n(){this.constructor=t}un(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var cn=function(){return cn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},cn.apply(this,arguments)};var fn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.injectResult=null,e.tag="div",e}ln(e,t);var n=e.prototype;return n.render=function(){var t=this.props,e=t.className,n=void 0===e?"":e,r=(t.cspNonce,t.portalContainer),i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["className","cspNonce","portalContainer"]),o=this.injector.className,a=this.tag,s={};return"simple-1.1.0".indexOf("simple")>-1&&r&&(s={portalContainer:r}),mt(a,cn({ref:p(this,"element"),"data-styled-id":o,className:n+" "+o},s,i))},n.componentDidMount=function(){this.injectResult=this.injector.inject(this.element,{nonce:this.props.cspNonce})},n.componentWillUnmount=function(){this.injectResult.destroy(),this.injectResult=null},n.getElement=function(){return this.element},e}(Ot);const pn=function(t,e){var n=sn(e);return function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.injector=n,r.tag=t,r}return ln(r,e),r}(fn)};var dn=function(t,e){return dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},dn(t,e)};function hn(t,e){function n(){this.constructor=t}dn(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var gn=function(){return gn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},gn.apply(this,arguments)};function vn(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function mn(t,e){var n;return gn({events:{},props:(n={},n[t]=Boolean,n),name:t},e)}function bn(t,e){return'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="'+32*t+'px" height="'+32*t+'px" viewBox="0 0 32 32" ><path d="M 16,5 L 12,10 L 14.5,10 L 14.5,22 L 12,22 L 16,27 L 20,22 L 17.5,22 L 17.5,10 L 20, 10 L 16,5 Z" stroke-linejoin="round" stroke-width="1.2" fill="black" stroke="white" style="transform:rotate('+e+'deg);transform-origin: 16px 16px"></path></svg>'}var yn,xn,En=Ut().browser.webkit,Sn=En&&(yn="undefined"==typeof window?{userAgent:""}:window.navigator,!!(xn=/applewebkit\/([^\s]+)/g.exec(yn.userAgent.toLowerCase()))&&parseFloat(xn[1])<605),Cn="moveable-",wn="\n{\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\tleft: 0;\n\ttop: 0;\n    z-index: 3000;\n    --moveable-color: #4af;\n    --zoom: 1;\n    --zoompx: 1px;\n    will-change: transform;\n}\n.control-box {\n    z-index: 0;\n}\n.line, .control {\n    position: absolute;\n\tleft: 0;\n    top: 0;\n    will-change: transform;\n}\n.control {\n\twidth: 14px;\n\theight: 14px;\n\tborder-radius: 50%;\n\tborder: 2px solid #fff;\n\tbox-sizing: border-box;\n    background: #4af;\n    background: var(--moveable-color);\n\tmargin-top: -7px;\n    margin-left: -7px;\n    border: 2px solid #fff;\n    z-index: 10;\n}\n.padding {\n    position: absolute;\n    top: 0px;\n    left: 0px;\n    width: 100px;\n    height: 100px;\n    transform-origin: 0 0;\n}\n.line {\n\twidth: 1px;\n    height: 1px;\n    background: #4af;\n    background: var(--moveable-color);\n\ttransform-origin: 0px 50%;\n}\n.line.dashed {\n    box-sizing: border-box;\n    background: transparent;\n}\n.line.dashed.horizontal {\n    border-top: 1px dashed #4af;\n    border-top-color: #4af;\n    border-top-color: var(--moveable-color);\n}\n.line.dashed.vertical {\n    border-left: 1px dashed #4af;\n    border-left-color: #4af;\n    border-left-color: var(--moveable-color);\n}\n.line.vertical {\n    transform: translateX(-50%);\n}\n.line.horizontal {\n    transform: translateY(-50%);\n}\n.line.vertical.bold {\n    width: 2px;\n}\n.line.horizontal.bold {\n    height: 2px;\n}\n\n.control.origin {\n\tborder-color: #f55;\n\tbackground: #fff;\n\twidth: 12px;\n\theight: 12px;\n\tmargin-top: -6px;\n    margin-left: -6px;\n\tpointer-events: none;\n}\n"+[0,15,30,45,60,75,90,105,120,135,150,165].map((function(t){return'\n.direction[data-rotation="'+t+'"] {\n\t'+function(t){var e=bn(1,t),n=bn(2,t),r=45*Math.round(t/45)%180,i="ns-resize";return 135===r?i="nwse-resize":45===r?i="nesw-resize":90===r&&(i="ew-resize"),"cursor:"+i+";cursor: url('"+e+"') 16 16, "+i+";cursor: -webkit-image-set(url('"+e+"') 1x, url('"+n+"') 2x) 16 16, "+i+";"}(t)+"\n}\n"})).join("\n")+"\n.group {\n    z-index: -1;\n}\n.area {\n    position: absolute;\n}\n.area-pieces {\n    position: absolute;\n    top: 0;\n    left: 0;\n    display: none;\n}\n.area.avoid, .area.pass {\n    pointer-events: none;\n}\n.area.avoid+.area-pieces {\n    display: block;\n}\n.area-piece {\n    position: absolute;\n}\n\n"+(Sn?':global svg *:before {\n\tcontent:"";\n\ttransform-origin: inherit;\n}':"")+"\n",Dn=[[0,1,2],[1,0,3],[2,0,3],[3,1,2]],Mn=1e-7,On=1e-9,Pn=Math.pow(10,10),Rn=-Pn,Tn=["n","w","s","e","nw","ne","sw","se"],kn={n:[0,1],s:[2,3],w:[2,0],e:[1,3],nw:[0],ne:[1],sw:[2],se:[3]},Bn={n:0,s:180,w:270,e:90,nw:315,ne:45,sw:225,se:135},zn=["isMoveableElement","updateRect","updateTarget","destroy","dragStart","isInside","hitTest","setState","getRect","request","isDragging","getManager"];function _n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return f.apply(void 0,vn([Cn],t))}function Gn(t,e,n){return ie(e,xe(n,e),t,xe(n.map((function(t){return-t})),e))}function jn(t){return In(dr(t,":before")).map((function(e,n){var r=A(e),i=r.value,o=r.unit;return i*function(t,e,n){return"%"===e?Wn(t.ownerSVGElement)[n?"width":"height"]/100:1}(t,o,0===n)}))}function In(t){var e=t.transformOrigin;return e?e.split(" "):["0","0"]}function An(t,e,n){for(var r=document.body,i=!t||n?t:t.parentElement,o=t===e||i===e,a="relative";i&&i!==r;){e===i&&(o=!0);var s=dr(i),u=s.transform;if(a=s.position,"svg"===i.tagName.toLowerCase()||"static"!==a||u&&"none"!==u)break;i=i.parentElement,a="relative"}return{isStatic:"static"===a,isEnd:o||!i||i===r,offsetParent:i||r}}function Nn(t,e,n,r){var i,o=t.tagName.toLowerCase(),a=t.offsetLeft,s=t.offsetTop;if(r){var u=(e||document.documentElement).getBoundingClientRect();a-=u.left,s-=u.top}var l,c,f=O(a),p=!f;return p||"svg"===o?c=(l=In(n).map((function(t){return parseFloat(t)}))).slice():(c=(l=Sn?jn(t):In(n).map((function(t){return parseFloat(t)}))).slice(),p=!0,i=function(t,e){if(!t.getBBox)return[0,0];var n=t.getBBox(),r=Wn(t.ownerSVGElement),i=n.x-r.x,o=n.y-r.y;return[i,o,e[0]-i,e[1]-o]}(t,l),a=i[0],s=i[1],l[0]=i[2],l[1]=i[3]),{tagName:o,isSVG:f,hasOffset:p,offset:[a||0,s||0],origin:l,targetOrigin:c}}function Fn(t,e,n){void 0===n&&(n=dr(t));var r=dr(document.body),i=r.position;if(!(e||i&&"static"!==i))return[0,0];var o=parseInt(r.marginLeft,10),a=parseInt(r.marginTop,10);return"absolute"===n.position&&("auto"===n.top&&"auto"===n.bottom||(a=0),"auto"===n.left&&"auto"===n.right||(o=0)),[o,a]}function Yn(t){t.forEach((function(t){var e=t.matrix;e&&(t.matrix=re(e,3,4))}))}function Xn(t,e,n){for(var r,i,o,a,s,u,l=t,c=[],f=!n&&t===e,p=f,d=!1,h=3,g=An(e,e,!0).offsetParent;l&&!p;){p=f;var v=dr(l),m=v.position,b="fixed"===m,y=(u=v.transform,a=u&&"none"!==u?P(u)?u:I(u).value.split(/s*,\s*/g).map((function(t){return parseFloat(t)})):[1,0,0,1,0,0],void 0===(s=void 0)&&(s=6===a.length),s?[a[0],a[1],0,a[2],a[3],0,a[4],a[5],1]:a),x=y.length;d||16!==x||(d=!0,h=4,Yn(c),o&&(o=re(o,3,4))),d&&9===x&&(y=re(y,3,4));var E=Nn(l,e,v,b),S=E.tagName,C=E.hasOffset,w=E.isSVG,D=E.origin,M=E.targetOrigin,O=E.offset,R=O[0],T=O[1];"svg"===S&&o?(c.push({type:"target",target:l,matrix:Hn(l,h)}),c.push({type:"offset",target:l,matrix:be(h)})):"g"===S&&t!==l&&(R=0,T=0);var k=An(l,e),B=k.offsetParent,z=k.isEnd,_=k.isStatic;En&&C&&!w&&_&&("relative"===m||"static"===m)&&(R-=B.offsetLeft,T-=B.offsetTop,f=f||z);var G=0,j=0;if(C&&g!==B&&(G=B.clientLeft,j=B.clientTop),C&&B===document.body){var A=Fn(l,!1,v);R+=A[0],T+=A[1]}if(c.push({type:"target",target:l,matrix:Gn(y,h,D)}),C?c.push({type:"offset",target:l,matrix:xe([R-l.scrollLeft+G,T-l.scrollTop+j],h)}):c.push({type:"offset",target:l,origin:D}),o||(o=y),r||(r=D),i||(i=M),p||b)break;l=B,f=z,n&&l!==document.body||(p=f)}return o||(o=be(h)),r||(r=[0,0]),i||(i=[0,0]),{offsetContainer:g,matrixes:c,targetMatrix:o,transformOrigin:r,targetOrigin:i,is3d:d}}function Ln(t,e,n,r){var i;void 0===n&&(n=e);var o=0,a=0,s=0,u={};if(t){var l=dr(t);o=t.offsetWidth,a=t.offsetHeight,O(o)&&(o=(i=nr(t,l,!0))[0],a=i[1])}if(t){var c=function(t,e,n,r){void 0===n&&(n=e);var i=Xn(t,e),o=i.matrixes,a=i.is3d,s=i.targetMatrix,u=i.transformOrigin,l=i.targetOrigin,c=Xn(i.offsetContainer,n,!0),f=c.matrixes,p=c.is3d,d=r||p||a,h=d?4:3,g="svg"!==t.tagName.toLowerCase()&&"ownerSVGElement"in t,v=s,m=be(h),b=be(h),y=be(h),x=be(h),E=o.length,S=n||document.body,C=An(S,S,!0).offsetParent;f.reverse(),o.reverse(),!a&&d&&(v=re(v,3,4),Yn(o));!p&&d&&Yn(f);f.forEach((function(t){b=oe(b,t.matrix,h)})),o.forEach((function(t,e){if(E-2===e&&(y=m.slice()),E-1===e&&(x=m.slice()),!t.matrix){var n=function(t,e,n,r,i){var o,a=t.target,s=t.origin,u=e.matrix,l=nr(a,void 0,!0),c=l[0],f=l[1],p=n.getBoundingClientRect(),d=[0,0];n===document.body&&(d=Fn(a,!0));var h=a.getBoundingClientRect(),g=h.left-p.left+n.scrollLeft-(n.clientLeft||0)+d[0],v=h.top-p.top+n.scrollTop-(n.clientTop||0)+d[1],m=h.width,b=h.height,y=ie(r,i,u),x=Un(y,c,f,r),E=x.left,S=x.top,C=x.width,w=x.height,D=Vn(y,s,r),M=se(D,[E,S]),O=[g+M[0]*m/C,v+M[1]*b/w],P=[0,0],R=0;for(;++R<10;){var T=ee(i,r);o=se(Vn(T,O,r),Vn(T,D,r)),P[0]=o[0],P[1]=o[1];var k=Un(ie(r,i,xe(P,r),u),c,f,r),B=k.left-g,z=k.top-v;if(Math.abs(B)<2&&Math.abs(z)<2)break;O[0]-=B,O[1]-=z}return P.map((function(t){return Math.round(t)}))}(t,o[e+1],C,h,oe(b,m,h));t.matrix=xe(n,h)}m=oe(m,t.matrix,h)}));var w=!g&&a;v||(v=be(w?4:3));var D=qn(g&&16===v.length?re(v,4,3):v,w);return{rootMatrix:b=te(b,h,h),beforeMatrix:y,offsetMatrix:x,allMatrix:m,targetMatrix:v,targetTransform:D,transformOrigin:u,targetOrigin:l,is3d:d}}(t,e,n,r),f=Zn(c.allMatrix,c.transformOrigin,o,a);u=gn(gn({},c),f);var p=Zn(c.allMatrix,[50,50],100,100);s=rr([p.pos1,p.pos2],p.direction)}var d=r?4:3;return gn({width:o,height:a,rotation:s,rootMatrix:be(d),beforeMatrix:be(d),offsetMatrix:be(d),allMatrix:be(d),targetMatrix:be(d),targetTransform:"",transformOrigin:[0,0],targetOrigin:[0,0],is3d:!!r,left:0,top:0,right:0,bottom:0,origin:[0,0],pos1:[0,0],pos2:[0,0],pos3:[0,0],pos4:[0,0],direction:1},u)}function qn(t,e){return void 0===e&&(e=t.length>9),(e?"matrix3d":"matrix")+"("+ue(t,!e).join(",")+")"}function Wn(t){var e=t.clientWidth,n=t.clientHeight;if(!t)return{x:0,y:0,width:0,height:0,clientWidth:e,clientHeight:n};var r=t.viewBox,i=r&&r.baseVal||{x:0,y:0,width:0,height:0};return{x:i.x,y:i.y,width:i.width||e,height:i.height||n,clientWidth:e,clientHeight:n}}function Hn(t,e){var n=Wn(t),r=n.width,i=n.height,o=n.clientWidth,a=n.clientHeight,s=o/r,u=a/i,l=t.preserveAspectRatio.baseVal,c=l.align,f=l.meetOrSlice,p=[0,0],d=[s,u],h=[0,0];if(1!==c){var g=(c-2)%3,v=Math.floor((c-2)/3);p[0]=r*g/2,p[1]=i*v/2;var m=2===f?Math.max(u,s):Math.min(s,u);d[0]=m,d[1]=m,h[0]=(o-r)/2*g,h[1]=(a-i)/2*v}var b=ye(d,e);return b[e*(e-1)]=h[0],b[e*(e-1)+1]=h[1],Gn(b,e,p)}function Vn(t,e,n){return le(t,ne(e,n),n)}function $n(t,e,n,r){return[[0,0],[e,0],[0,n],[e,n]].map((function(e){return Vn(t,e,r)}))}function Kn(t){var e=t.map((function(t){return t[0]})),n=t.map((function(t){return t[1]})),r=Math.min.apply(Math,e),i=Math.min.apply(Math,n),o=Math.max.apply(Math,e),a=Math.max.apply(Math,n);return{left:r,top:i,right:o,bottom:a,width:o-r,height:a-i}}function Un(t,e,n,r){return Kn($n(t,e,n,r))}function Zn(t,e,n,r){var i=16===t.length?4:3,o=$n(t,n,r,i),a=o[0],s=a[0],u=a[1],l=o[1],c=l[0],f=l[1],p=o[2],d=p[0],h=p[1],g=o[3],v=g[0],m=g[1],b=Vn(t,e,i),y=b[0],x=b[1],E=Math.min(s,c,d,v),S=Math.min(u,f,h,m),C=Math.max(s,c,d,v);return s=s-E||0,{left:E,top:S,right:C,bottom:Math.max(u,f,h,m),origin:[y=y-E||0,x=x-S||0],pos1:[s,u=u-S||0],pos2:[c=c-E||0,f=f-S||0],pos3:[d=d-E||0,h=h-S||0],pos4:[v=v-E||0,m=m-S||0],direction:Z(o)}}function Jn(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Qn(t,e){return Jn([e[0]-t[0],e[1]-t[1]])}function tr(t,e,n,r){void 0===n&&(n=1),void 0===r&&(r=U(t,e));var i=Qn(t,e);return{transform:"translateY(-50%) translate("+t[0]+"px, "+t[1]+"px) rotate("+r+"rad) scaleY("+n+")",width:i+"px"}}function er(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=n.length,o=n.reduce((function(t,e){return t+e[0]}),0)/i,a=n.reduce((function(t,e){return t+e[1]}),0)/i;return{transform:"translateZ(0px) translate("+o+"px, "+a+"px) rotate("+t+"rad) scale("+e+")"}}function nr(t,e,n,r){void 0===e&&(e=dr(t)),void 0===r&&(r=n||"border-box"===e.boxSizing);var i=t.offsetWidth,o=t.offsetHeight,a=!O(i);if((n||r)&&a)return[i,o];if(!a&&"svg"!==t.tagName.toLowerCase()){var s=t.getBBox();return[s.width,s.height]}return i=t.clientWidth,o=t.clientHeight,n||r?[i+(parseFloat(e.borderLeftWidth)||0)+(parseFloat(e.borderRightWidth)||0),o+(parseFloat(e.borderTopWidth)||0)+(parseFloat(e.borderBottomWidth)||0)]:[i-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0),o-(parseFloat(e.paddingTop)||0)-(parseFloat(e.paddingBottom)||0)]}function rr(t,e){return U(e>0?t[0]:t[1],e>0?t[1]:t[0])}function ir(t,e,n,r,i){var o=1,a=[0,0],s={left:0,right:0,top:0,bottom:0,width:0,height:0,clientLeft:0,clientTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0},u={left:0,right:0,top:0,bottom:0,width:0,height:0,clientLeft:0,clientTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0},l={left:0,right:0,top:0,bottom:0,width:0,height:0,clientLeft:0,clientTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0},c=Ln(e,n,i,!1);if(e){var f=c.is3d?4:3,p=Zn(c.offsetMatrix,ae(c.transformOrigin,function(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=[],r=t[e*e-1],i=0;i<e-1;++i)n[i]=t[e*(e-1)+i]/r;return n[e-1]=0,n}(c.targetMatrix,f)),c.width,c.height);o=p.direction,a=ae(p.origin,[p.left-c.left,p.top-c.top]),s=or(e),u=or(An(r,r,!0).offsetParent||document.body,!0),t&&(l=or(t))}return gn({targetClientRect:s,containerClientRect:u,moveableClientRect:l,beforeDirection:o,beforeOrigin:a,originalBeforeOrigin:a,target:e},c)}function or(t,e){var n=0,r=0,i=0,o=0;if(t===document.body||t===document.documentElement)i=window.innerWidth,o=window.innerHeight,n=-(document.documentElement.scrollLeft||document.body.scrollLeft),r=-(document.documentElement.scrollTop||document.body.scrollTop);else{var a=t.getBoundingClientRect();n=a.left,r=a.top,i=a.width,o=a.height}var s={left:n,right:n+i,top:r,bottom:r+o,width:i,height:o};return e&&(s.clientLeft=t.clientLeft,s.clientTop=t.clientTop,s.clientWidth=t.clientWidth,s.clientHeight=t.clientHeight,s.scrollWidth=t.scrollWidth,s.scrollHeight=t.scrollHeight,s.overflow="visible"!==dr(t).overflow),s}function ar(t){if(t){var e=t.getAttribute("data-direction");if(e){var n=[0,0];return e.indexOf("w")>-1&&(n[0]=-1),e.indexOf("e")>-1&&(n[0]=1),e.indexOf("n")>-1&&(n[1]=-1),e.indexOf("s")>-1&&(n[1]=1),n}}}function sr(t,e){return[ae(e,t[0]),ae(e,t[1]),ae(e,t[2]),ae(e,t[3])]}function ur(t){var e=t.left,n=t.top;return sr([t.pos1,t.pos2,t.pos3,t.pos4],[e,n])}function lr(t,e){t[e]&&(t[e].unset(),t[e]=null)}function cr(t,e,n){var r=e.datas;r.datas||(r.datas={});var i=gn(gn({},n),{target:t.state.target,clientX:e.clientX,clientY:e.clientY,inputEvent:e.inputEvent,currentTarget:t,moveable:t,datas:r.datas});return r.isStartEvent?r.lastEvent=i:r.isStartEvent=!0,i}function fr(t,e,n){var r=e.datas,i="isDrag"in n?n.isDrag:e.isDrag;return r.datas||(r.datas={}),gn(gn({isDrag:i},n),{moveable:t,target:t.state.target,clientX:e.clientX,clientY:e.clientY,inputEvent:e.inputEvent,currentTarget:t,lastEvent:r.lastEvent,isDouble:e.isDouble,datas:r.datas})}function pr(t,e,n,r){return t.triggerEvent(e,n,r)}function dr(t,e){return window.getComputedStyle(t,e)}function hr(t,e,n){var r={},i={};return t.filter((function(t){var o=t.name;if(r[o]||!e.some((function(e){return t[e]})))return!1;if(!n&&t.ableGroup){if(i[t.ableGroup])return!1;i[t.ableGroup]=!0}return r[o]=!0,!0}))}function gr(t,e){return t===e||null==t&&null==e}function vr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.sort((function(t,e){return Math.abs(e)-Math.abs(t)})),t[0]}function mr(t,e,n){return le(ee(t,n),ne(e,n),n)}function br(t,e){var n,r=t.is3d?4:3;return n=mr(t.rootMatrix,[e.distX,e.distY],r),e.distX=n[0],e.distY=n[1],e}function yr(t,e,n,r,i){return se(Vn(t,ae(n,e),i),r)}function xr(t,e,n){return n?t/e*100+"%":t+"px"}function Er(t){return Math.abs(t)<=Mn?0:t}function Sr(t,e){return e.isRequest?("resizable"===e.requestAble||"scalable"===e.requestAble)&&e.parentDirection:et(e.inputEvent.target,_n("direction"))}function Cr(t){var e={};for(var n in t)e[t[n]]=n;return e}function wr(t,e){return t?T(t)?e?document.querySelector(t):t:k(t)?t():"current"in t?t.current:t:null}function Dr(t,e){return t?((n=t)&&P(n)&&(R(n)||"length"in n)?[].slice.call(t):[t]).reduce((function(t,n){return T(n)&&e?vn(t,[].slice.call(document.querySelectorAll(n))):(t.push(wr(n,e)),t)}),[]):[];var n}function Mr(t,e){var n=t.rootMatrix,r=t.is3d,i=ee(n,r?4:3);return r||(i=re(i,3,4)),i[12]=0,i[13]=0,i[14]=0,Ce(i,e)}var Or=mn("pinchable",{events:{onPinchStart:"pinchStart",onPinch:"pinch",onPinchEnd:"pinchEnd",onPinchGroupStart:"pinchGroupStart",onPinchGroup:"pinchGroup",onPinchGroupEnd:"pinchGroupEnd"},dragStart:function(){return!0},pinchStart:function(t,e){var n=e.datas,r=e.targets,i=e.angle,o=e.originalDatas,a=t.props,s=a.pinchable,u=a.ables;if(!s)return!1;var l="onPinch"+(r?"Group":"")+"Start",c="drag"+(r?"Group":"")+"ControlStart",f=(!0===s?t.controlAbles:u.filter((function(t){return s.indexOf(t.name)>-1}))).filter((function(t){return t.canPinch&&t[c]})),p=cr(t,e,{});r&&(p.targets=r);var d=pr(t,l,p);n.isPinch=!1!==d,n.ables=f;var h=n.isPinch;return!!h&&(f.forEach((function(n){if(o[n.name]=o[n.name]||{},n[c]){var r=gn(gn({},e),{datas:o[n.name],parentRotate:i,isPinch:!0});n[c](t,r)}})),t.state.snapRenderInfo={request:e.isRequest,direction:[0,0]},h)},pinch:function(t,e){var n=e.datas,r=e.scale,i=e.distance,o=e.originalDatas,a=e.inputEvent,s=e.targets,u=e.angle;if(n.isPinch){var l=i*(1-1/r),c=cr(t,e,{});s&&(c.targets=s),pr(t,"onPinch"+(s?"Group":""),c);var f=n.ables,p="drag"+(s?"Group":"")+"Control";return f.forEach((function(n){n[p]&&n[p](t,gn(gn({},e),{datas:o[n.name],inputEvent:a,parentDistance:l,parentRotate:u,isPinch:!0}))})),c}},pinchEnd:function(t,e){var n=e.datas,r=e.isPinch,i=e.inputEvent,o=e.targets,a=e.originalDatas;if(n.isPinch){var s="onPinch"+(o?"Group":"")+"End",u=fr(t,e,{isDrag:r});o&&(u.targets=o),pr(t,s,u);var l=n.ables,c="drag"+(o?"Group":"")+"ControlEnd";return l.forEach((function(n){n[c]&&n[c](t,gn(gn({},e),{isDrag:r,datas:a[n.name],inputEvent:i,isPinch:!0}))})),r}},pinchGroupStart:function(t,e){return this.pinchStart(t,gn(gn({},e),{targets:t.props.targets}))},pinchGroup:function(t,e){return this.pinch(t,gn(gn({},e),{targets:t.props.targets}))},pinchGroupEnd:function(t,e){return this.pinchEnd(t,gn(gn({},e),{targets:t.props.targets}))}});function Pr(t,e,n,r,i){var o=e.gesto.move(n,t.inputEvent),a=o.originalDatas||o.datas,s=a.draggable||(a.draggable={});return gn(gn({},i?br(e,o):o),{isDrag:!0,isPinch:!!r,parentEvent:!0,datas:s,originalDatas:t.originalDatas})}var Rr=function(){function t(){this.prevX=0,this.prevY=0,this.startX=0,this.startY=0,this.isDrag=!1,this.isFlag=!1,this.datas={draggable:{}}}var e=t.prototype;return e.dragStart=function(t,e){this.isDrag=!1,this.isFlag=!1;var n=e.originalDatas;return this.datas=n,n.draggable||(n.draggable={}),gn(gn({},this.move(t,e.inputEvent)),{type:"dragstart"})},e.drag=function(t,e){return this.move([t[0]-this.prevX,t[1]-this.prevY],e)},e.move=function(t,e){var n,r;return this.isFlag?(n=this.prevX+t[0],r=this.prevY+t[1],this.isDrag=!0):(this.prevX=t[0],this.prevY=t[1],this.startX=t[0],this.startY=t[1],n=t[0],r=t[1],this.isFlag=!0),this.prevX=n,this.prevY=r,{type:"drag",clientX:n,clientY:r,inputEvent:e,isDrag:this.isDrag,distX:n-this.startX,distY:r-this.startY,deltaX:t[0],deltaY:t[1],datas:this.datas.draggable,originalDatas:this.datas,parentEvent:!0,parentGesto:this}},t}();function Tr(t,e,n){var r=n.originalDatas;r.groupable=r.groupable||{};var i=r.groupable;i.childDatas=i.childDatas||[];var o=i.childDatas;return t.moveables.map((function(t,r){return o[r]=o[r]||{},o[r][e]=o[r][e]||{},gn(gn({},n),{datas:o[r][e],originalDatas:o[r]})}))}function kr(t,e,n,r,i,o){var a=!!n.match(/Start$/g),s=!!n.match(/End$/g),u=i.isPinch,l=i.datas,c=Tr(t,e.name,i),f=t.moveables,p=c.map((function(t,i){var c=f[i],p=t;a?p=(new Rr).dragStart(r,t):(c.state.gesto||(c.state.gesto=l.childGestos[i]),p=Pr(t,c.state,r,u,o));var d=e[n](c,gn(gn({},p),{parentFlag:!0}));return s&&(c.state.gesto=null),d}));return a&&(l.childGestos=f.map((function(t){return t.state.gesto}))),p}function Br(t,e,n,r,i,o){void 0===i&&(i=function(t,e){return e});var a=!!n.match(/End$/g),s=Tr(t,e.name,r),u=t.moveables;return s.map((function(t,r){var s,l=u[r];s=i(l,t);var c=e[n](l,gn(gn({},s),{parentFlag:!0}));return c&&o&&o(l,t,c,r),a&&(l.state.gesto=null),c}))}function zr(t,e){var n=e.clientX,r=e.clientY,i=e.datas,o=t.state,a=o.moveableClientRect,s=o.rootMatrix,u=o.is3d,l=o.pos1,c=se(mr(s,[n-a.left,r-a.top],u?4:3),l),f=Fr({datas:i,distX:c[0],distY:c[1]});return[f[0],f[1]]}function _r(t,e){var n=e.datas,r=t.state,i=r.allMatrix,o=r.beforeMatrix,a=r.is3d,s=r.left,u=r.top,l=r.origin,c=r.offsetMatrix,f=r.targetMatrix,p=r.transformOrigin,d=a?4:3;n.is3d=a,n.matrix=i,n.targetMatrix=f,n.beforeMatrix=o,n.offsetMatrix=c,n.transformOrigin=p,n.inverseMatrix=ee(i,d),n.inverseBeforeMatrix=ee(o,d),n.absoluteOrigin=ne(ae([s,u],l),d),n.startDragBeforeDist=le(n.inverseBeforeMatrix,n.absoluteOrigin,d),n.startDragDist=le(n.inverseMatrix,n.absoluteOrigin,d)}function Gr(t,e){var n=t.datas,r=t.originalDatas.beforeRenderable,i=n.transformIndex,o=r.nextTransforms,a=r.nextTransformAppendedIndexes,s=-1===i?o.length:i+a.filter((function(t){return t<i})).length,u=function(t,e){var n=t.slice(0,e<0?void 0:e),r=t.slice(0,e<0?void 0:e+1),i=t[e]||"",o=e<0?[]:t.slice(e),a=e<0?[]:t.slice(e+1),s=De(n),u=De(r),l=De([i]),c=De(o),f=De(a),p=we(s),d=we(u),h=we(c),g=we(f),v=oe(p,h,4);return{transforms:t,beforeFunctionMatrix:p,beforeFunctionMatrix2:d,targetFunctionMatrix:we(l),afterFunctionMatrix:h,afterFunctionMatrix2:g,allFunctionMatrix:v,beforeFunctions:s,beforeFunctions2:u,targetFunction:l[0],afterFunctions:c,afterFunctions2:f,beforeFunctionTexts:n,beforeFunctionTexts2:r,targetFunctionText:i,afterFunctionTexts:o,afterFunctionTexts2:a}}(o,s),l=u.targetFunction,c="rotate"===e?"rotateZ":e;n.beforeFunctionTexts=u.beforeFunctionTexts,n.afterFunctionTexts=u.afterFunctionTexts,n.beforeTransform=u.beforeFunctionMatrix,n.beforeTransform2=u.beforeFunctionMatrix2,n.targetTansform=u.targetFunctionMatrix,n.afterTransform=u.afterFunctionMatrix,n.afterTransform2=u.afterFunctionMatrix2,n.targetAllTransform=u.allFunctionMatrix,l.functionName===c?(n.afterFunctionTexts.splice(0,1),n.isAppendTransform=!1):(n.isAppendTransform=!0,r.nextTransformAppendedIndexes=vn(a,[s]))}function jr(t,e,n){return t.beforeFunctionTexts.join(" ")+" "+(t.isAppendTransform?n:e)+" "+t.afterFunctionTexts.join(" ")}function Ir(t){var e=t.datas,n=Nr({datas:e,distX:t.distX,distY:t.distY});return le(Ar(e,function(t,e){for(var n=be(e),r=0;r<e-1;++r)n[e*(e-1)+r]=t[r]||0;return n}([n[0],n[1]],4)),ne([0,0,0],4),4)}function Ar(t,e,n){var r=t.beforeTransform,i=t.afterTransform,o=t.beforeTransform2,a=t.afterTransform2,s=t.targetAllTransform,u=n?oe(s,e,4):oe(e,s,4),l=oe(ee(n?o:r,4),u,4);return oe(l,ee(n?a:i,4),4)}function Nr(t){var e=t.datas,n=t.distX,r=t.distY,i=e.inverseBeforeMatrix,o=e.is3d,a=e.startDragBeforeDist,s=o?4:3;return se(le(i,ae(e.absoluteOrigin,[n,r]),s),a)}function Fr(t,e){var n=t.datas,r=t.distX,i=t.distY,o=n.inverseBeforeMatrix,a=n.inverseMatrix,s=n.is3d,u=n.startDragBeforeDist,l=n.startDragDist,c=s?4:3;return se(le(e?o:a,ae(n.absoluteOrigin,[r,i]),c),e?u:l)}function Yr(t){var e=[];return t[1]>=0&&(t[0]>=0&&e.push(3),t[0]<=0&&e.push(2)),t[1]<=0&&(t[0]>=0&&e.push(1),t[0]<=0&&e.push(0)),e}function Xr(t,e){return Yr(e).map((function(e){return t[e]}))}function Lr(t,e){var n=Xr(t,e);return[K(n.map((function(t){return t[0]}))),K(n.map((function(t){return t[1]})))]}function qr(t,e,n,r){return oe(t,Gn(e,r,n),r)}function Wr(t){var e=t.originalDatas.beforeRenderable;return{setTransform:function(n,r){void 0===r&&(r=-1),e.startTransforms=R(n)?n:G(n),Vr(t,r)},setTransformIndex:function(e){Vr(t,e)}}}function Hr(t,e){Vr(t,X(t.originalDatas.beforeRenderable.startTransforms,(function(t){return 0===t.indexOf(e+"(")})))}function Vr(t,e){var n=t.originalDatas.beforeRenderable,r=t.datas;if(r.transformIndex=e,-1!==e){var i=n.startTransforms[e];if(i){var o=De([i]);r.startValue=o[0].functionValue}}}function $r(t,e){t.originalDatas.beforeRenderable.nextTransforms=G(e)}function Kr(t,e,n,r,i){return $r(i,e),{transform:e,drag:to.drag(t,Pr(i,t.state,n,r,!1))}}function Ur(t,e,n,r,i){var o=t.state,a=o.left,s=o.top,u=t.props.groupable,l=function(t,e,n){var r=t.transformOrigin,i=t.offsetMatrix,o=t.is3d,a=e.beforeTransform,s=e.afterTransform,u=o?4:3;return qr(i,re(oe(oe(a,Se([n]),4),s,4),4,u),r,u)}(t.state,i,e),c=u?a:0,f=u?s:0,p=se(r,Jr(t,n,l));return se(p,[c,f])}function Zr(t){var e=t.state,n=e.width,r=e.height,i=e.transformOrigin;return[i[0]/(n/2)-1,i[1]/(r/2)-1]}function Jr(t,e,n){void 0===n&&(n=t.state.allMatrix);var r=t.state,i=r.width,o=r.height,a=r.is3d?4:3;return Vn(n,[i/2*(1+e[0]),o/2*(1+e[1])],a)}function Qr(t,e,n,r,i,o){var a=t.props.groupable,s=t.state,u=s.transformOrigin,l=s.targetMatrix,c=s.offsetMatrix,f=s.is3d,p=s.width,d=s.height,h=s.left,g=s.top,v=f?4:3,m=function(t,e,n,r,i,o){return void 0===r&&(r=e),void 0===i&&(i=n),void 0===o&&(o=[0,0]),t?t.map((function(t,a){var s=A(t),u=s.value,l=s.unit,c=a?i:r,f=a?n:e;return"%"===t||isNaN(u)?f*(c?o[a]/c:0):"%"!==l?u:f*u/100})):o}(o,e,n,p,d,u),b=a?h:0,y=a?g:0,x=function(t,e,n,r,i,o){var a=Lr($n(e,n,r,i),o);return[t[0]-a[0],t[1]-a[1]]}(i,qr(c,l,m,v),e,n,v,r);return se(x,[b,y])}function ti(t,e){return Lr(ur(t.state),e)}var ei=["left","right","center"],ni=["top","bottom","middle"],ri={start:"left",end:"right",center:"center"},ii={start:"top",end:"bottom",center:"middle"};function oi(t,e){var n=t.props,r=n.snappable,i=n.bounds,o=n.innerBounds,a=n.verticalGuidelines,s=n.horizontalGuidelines,u=n.snapGridWidth,l=n.snapGridHeight,c=t.state,f=c.guidelines,p=c.enableSnap;return!(!r||!p||e&&!0!==r&&r.indexOf(e)<0)&&!!(u||l||i||o||f&&f.length||a&&a.length||s&&s.length)}function ai(t){return!1===t?{}:!0!==t&&t?t:{left:!0,right:!0,top:!0,bottom:!0}}function si(t,e){var n=function(t,e){var n=ai(t),r={};for(var i in n)i in e&&n[i]&&(r[i]=e[i]);return r}(t,e),r=ni.filter((function(t){return t in n})),i=ei.filter((function(t){return t in n}));return{horizontal:r.map((function(t){return n[t]})),vertical:i.map((function(t){return n[t]}))}}function ui(t,e,n,r,i,o,a){void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a={left:0,top:0,right:0,bottom:0});var s=[],u=a.left,l=a.top,c=a.bottom,f=n+a.right-u,p=r+c-l;return t&&t.forEach((function(t){s.push({type:"horizontal",pos:[u,Q(t-o+l,.1)],size:f})})),e&&e.forEach((function(t){s.push({type:"vertical",pos:[Q(t-i+u,.1),l],size:p})})),s}function li(t,e){if(!e.length)return[];var n=t.state,r=n.containerClientRect,i=n.targetClientRect,o=i.top,a=i.left,s=n.rootMatrix,u=n.is3d?4:3,l=function(t,e,n){var r=Vn(t,[e.clientLeft,e.clientTop],n);return[e.left+r[0],e.top+r[1]]}(s,r,u),c=l[0],f=l[1],p=ze(ur(n)),d=se([p.minX,p.minY],mr(s,[a-c,o-f],u)).map((function(t){return e=t,Math.round(e%1==-.5?e-1:e);var e})),h=d[0],g=d[1];return e.map((function(t){var e=t.element.getBoundingClientRect(),n=e.left-c,r=e.top-f,i=r+e.height,o=n+e.width,a=mr(s,[n,r],u),l=a[0],p=a[1],d=mr(s,[o,i],u),v=d[0],m=d[1];return gn(gn({},t),{rect:{left:l+h,right:v+h,top:p+g,bottom:m+g,center:(l+v)/2+h,middle:(p+m)/2+g}})}))}function ci(t){var e=t.state,n=e.snapOffset,r=e.containerClientRect,i=r.overflow,o=r.scrollHeight,a=r.scrollWidth,s=r.clientHeight,u=r.clientWidth,l=r.clientLeft,c=r.clientTop,f=t.props,p=f.snapGap,d=void 0===p||p,h=f.verticalGuidelines,g=f.horizontalGuidelines,v=f.snapThreshold,m=void 0===v?5:v,b=f.snapGridWidth,y=void 0===b?0:b,x=f.snapGridHeight,E=void 0===x?0:x,S=function(t){var e=t.state,n=t.props.elementGuidelines,r=void 0===n?[]:n;if(!r.length)return e.elementRects=[],[];var i=(e.elementRects||[]).filter((function(t){return!t.refresh})),o=r.map((function(t){return P(t)&&"element"in t?t:{element:wr(t,!0)}})).filter((function(t){return t.element})),a=Re(i.map((function(t){return t.element})),o.map((function(t){return t.element}))),s=a.maintained,u=a.added,l=[];s.forEach((function(t){var e=t[0],n=t[1];l[n]=i[e]})),li(t,u.map((function(t){return o[t]}))).map((function(t,e){l[u[e]]=t})),e.elementRects=l;var c=ai(t.props.elementSnapDirections),f=[];return l.forEach((function(t){var e=t.element,n=t.top,r=void 0===n?c.top:n,i=t.left,o=void 0===i?c.left:i,a=t.right,s=void 0===a?c.right:a,u=t.bottom,l=void 0===u?c.bottom:u,p=t.center,d=void 0===p?c.center:p,h=t.middle,g=void 0===h?c.middle:h,v=t.className,m=t.rect,b=si({top:r,right:s,left:o,bottom:l,center:d,middle:g},m),y=b.horizontal,x=b.vertical,E=m.top,S=m.left,C=m.right-S,w=m.bottom-E,D=[C,w];x.forEach((function(n){f.push({type:"vertical",element:e,pos:[Q(n,.1),E],size:w,sizes:D,className:v,elementRect:t})})),y.forEach((function(n){f.push({type:"horizontal",element:e,pos:[S,Q(n,.1)],size:C,sizes:D,className:v,elementRect:t})}))})),f}(t),C=vn(S);if(d){var w=Kn(ur(t.state)),D=w.top,M=w.left,O=w.bottom,R=w.right;C.push.apply(C,function(t,e,n){var r=t.state.elementRects,i=[];return[["vertical",ri,ii],["horizontal",ii,ri]].forEach((function(t){var o=t[0],a=t[1],s=t[2],u=e[a.start],l=e[a.end],c=e[a.center],f=e[s.start],p=e[s.end];function d(t){var e=t.rect;return e[a.end]<u+n?u-e[a.end]:l-n<e[a.start]?e[a.start]-l:-1}var h=r.filter((function(t){var e=t.rect;return!(e[s.start]>p||e[s.end]<f)&&d(t)>0})).sort((function(t,e){return d(t)-d(e)})),g=[];h.forEach((function(t){h.forEach((function(e){if(t!==e){var n=t.rect,r=e.rect,i=n[s.start],o=n[s.end],a=r[s.start];i>r[s.end]||a>o||g.push([t,e])}}))})),g.forEach((function(t){var e=t[0],r=t[1],s=e.rect,f=r.rect,p=s[a.start],d=s[a.end],h=f[a.start],g=f[a.end],v=0,m=0,b=!1,y=!1,x=!1;if(d<=u&&l<=h){if(y=!0,m=d+(v=(h-d-(l-u))/2)+(l-u)/2,Math.abs(m-c)>n)return}else if(d<h&&g<u+n){if(b=!0,m=g+(v=h-d),Math.abs(m-u)>n)return}else{if(!(d<h&&l-n<p))return;if(x=!0,m=p-(v=h-d),Math.abs(m-l)>n)return}v&&i.push({type:o,pos:"vertical"===o?[m,0]:[0,m],element:r.element,size:0,className:r.className,isStart:b,isCenter:y,isEnd:x,gap:v,hide:!0,gapRects:[e,r]})}))})),i}(t,{top:D,left:M,bottom:O,right:R,center:(M+R)/2,middle:(D+O)/2},m))}return C.push.apply(C,function(t,e,n,r,i,o){void 0===i&&(i=0);void 0===o&&(o=0);var a=[];if(e)for(var s=0;s<=r;s+=e)a.push({type:"horizontal",pos:[0,Q(s-o,.1)],size:n,hide:!0});if(t)for(s=0;s<=n;s+=t)a.push({type:"vertical",pos:[Q(s-i,.1),0],size:r,hide:!0});return a}(y,E,i?a:u,i?o:s,l,c)),C.push.apply(C,ui(g||!1,h||!1,i?a:u,i?o:s,l,c,n)),C}function fi(t,e,n,r){var i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=t.length-1,r=0;r<n;++r){var i=t[r];if(!O(i))return i}return t[n]}(r,t.props.snapThreshold,5);return pi(t.state.guidelines,e,n,i)}function pi(t,e,n,r){return{vertical:gi(t,"vertical",e,r),horizontal:gi(t,"horizontal",n,r)}}function di(t,e,n){var r=si(t.props.snapDirections,e);return fi(t,r.vertical,r.horizontal,n)}function hi(t){var e=t.isSnap;if(!e)return{isSnap:!1,offset:0,dist:-1,pos:0,guideline:null};var n=t.posInfos[0],r=n.guidelineInfos[0],i=r.offset,o=r.dist,a=r.guideline;return{isSnap:e,offset:i,dist:o,pos:n.pos,guideline:a}}function gi(t,e,n,r){if(!t||!t.length)return{isSnap:!1,index:-1,posInfos:[]};var i="vertical"===e?0:1,o=n.map((function(n,o){var a=t.map((function(t){var e=t.pos,r=n-e[i];return{offset:r,dist:Math.abs(r),guideline:t}})).filter((function(t){var n=t.guideline,i=t.dist;return!(n.type!==e||i>r)})).sort((function(t,e){return t.dist-e.dist}));return{pos:n,index:o,guidelineInfos:a}})).filter((function(t){return t.guidelineInfos.length>0})).sort((function(t,e){return t.guidelineInfos[0].dist-e.guidelineInfos[0].dist})),a=o.length>0;return{isSnap:a,index:a?o[0].index:-1,posInfos:o}}function vi(t,e){var n=Math.abs(t.offset),r=Math.abs(e.offset);return t.isBound&&e.isBound?r-n:t.isBound?-1:e.isBound?1:t.isSnap&&e.isSnap?r-n:t.isSnap?-1:e.isSnap||n<Mn?1:r<Mn?-1:n-r}function mi(t,e){return t.slice().sort((function(t,n){var r=t.sign[e],i=n.sign[e],o=t.offset[e],a=n.offset[e];return r?i?vi({isBound:t.isBound,isSnap:t.isSnap,offset:o},{isBound:n.isBound,isSnap:n.isSnap,offset:a}):-1:1}))[0]}function bi(t,e){var n=K([e[0][0],e[1][0]]),r=K([e[0][1],e[1][1]]);return{vertical:n<=t[0],horizontal:r<=t[1]}}function yi(t,e){var n,r,i=e[0],o=e[1],a=o[0]-i[0],s=o[1]-i[1];if(Math.abs(a)<Mn&&(a=0),Math.abs(s)<Mn&&(s=0),a)if(s){n=s/a*(t[0]-i[0])+i[1],r=t[1]}else n=i[1],r=t[1];else n=i[0],r=t[0];return n-r}function xi(t,e,n){void 0===n&&(n=Mn);var r=yi(t[0],e)<=0;return t.slice(1).every((function(t){var i=yi(t,e);return i<=0===r||Math.abs(i)<=n}))}function Ei(t,e,n,r,i){return void 0===i&&(i=0),r&&e-i<=t||!r&&t<=n+i?{isBound:!0,offset:r?e-t:n-t}:{isBound:!1,offset:0}}function Si(t,e,n,r,i){var o=t[0],a=t[1],s=e[0],u=e[1],l=Er(a[1]-o[1]),c=Er(a[0]-o[0]),f=Er(u[1]-s[1]);if(!Er(u[0]-s[0])){if(i&&!l)return{isBound:!1,offset:0};if(c)return Ei(l/c*(s[0]-o[0])+o[1],s[1],u[1],n,r);var p=s[0]-o[0];return{isBound:d=Math.abs(p)<=(r||0),offset:d?p:0}}if(!f){if(i&&!c)return{isBound:!1,offset:0};if(l)return Ei((s[1]-o[1])/(l/c)+o[0],s[0],u[0],n,r);var d;p=s[1]-o[1];return{isBound:d=Math.abs(p)<=(r||0),offset:d?p:0}}return{isBound:!1,offset:0}}function Ci(t,e,n,r){return e.map((function(e){var i=e[0],o=e[1],a=e[2],s=function(t,e,n){var r=t.props.innerBounds;if(!r)return{isAllBound:!1,isBound:!1,isVerticalBound:!1,isHorizontalBound:!1,offset:[0,0]};var i=r.left,o=r.top,a=r.width,s=r.height,u=[[i,o],[i,o+s]],l=[[i,o],[i+a,o]],c=[[i+a,o],[i+a,o+s]],f=[[i,o+s],[i+a,o+s]],p=bi(n,e),d=p.horizontal,h=p.vertical;if(xi([n,[i,o],[i+a,o],[i,o+s],[i+a,o+s]],e))return{isAllBound:!1,isBound:!1,isVerticalBound:!1,isHorizontalBound:!1,offset:[0,0]};var g=Si(e,l,h),v=Si(e,f,h),m=Si(e,u,d),b=Si(e,c,d),y=g.isBound&&v.isBound,x=g.isBound||v.isBound,E=m.isBound&&b.isBound,S=m.isBound||b.isBound,C=vr(g.offset,v.offset),w=vr(m.offset,b.offset),D=[0,0],M=!1,O=!1;return Math.abs(w)<Math.abs(C)?(D=[C,0],M=x,O=y):(D=[0,w],M=S,O=E),{isAllBound:O,isVerticalBound:x,isHorizontalBound:S,isBound:M,offset:D}}(t,[o,a],n),u=s.isBound,l=s.offset,c=s.isVerticalBound,f=s.isHorizontalBound,p=Fr({datas:r,distX:l[0],distY:l[1]}).map((function(t,e){return t*(i[e]?2/i[e]:0)}));return{sign:i,isBound:u,isVerticalBound:c,isHorizontalBound:f,isSnap:!1,offset:p}}))}function wi(t,e,n){var r,i=Di(e,[0,0],!1).map((function(t){var e=t[0],n=t[1],r=t[2];return[e.map((function(t){return 2*Math.abs(t)})),n,r]})),o=Ci(t,i,Lr(e,[0,0]),n),a=mi(o,0),s=mi(o,1),u=0,l=0,c=a.isVerticalBound||s.isVerticalBound,f=a.isHorizontalBound||s.isHorizontalBound;return(c||f)&&(r=function(t,e){var n=t.datas,r=t.distX,i=t.distY,o=n.beforeMatrix,a=n.matrix,s=n.is3d,u=n.startDragBeforeDist,l=n.startDragDist,c=n.absoluteOrigin,f=s?4:3;return se(le(e?o:a,ae(e?u:l,[r,i]),f),c)}({datas:n,distX:-a.offset[0],distY:-s.offset[1]}),u=r[0],l=r[1]),{vertical:{isBound:c,offset:u},horizontal:{isBound:f,offset:l}}}function Di(t,e,n){return function(t,e){var n=[],r=t[0],i=t[1];return r&&i?n.push([[0,2*i],t,[-r,i]],[[2*r,0],t,[r,-i]]):r?(n.push([[2*r,0],[r,1],[r,-1]]),e&&n.push([[0,-1],[r,-1],[-r,-1]],[[0,1],[r,1],[-r,1]])):i?(n.push([[0,2*i],[1,i],[-1,i]]),e&&n.push([[-1,0],[-1,i],[-1,-i]],[[1,0],[1,i],[1,-i]])):n.push([[-1,0],[-1,-1],[-1,1]],[[1,0],[1,-1],[1,1]],[[0,-1],[-1,-1],[1,-1]],[[0,1],[-1,1],[1,1]]),n}(e,n).map((function(e){var n=e[0],r=e[1],i=e[2];return[n,Lr(t,r),Lr(t,i)]}))}function Mi(t,e,n,r){var i=r?t.map((function(t){return he(t,r)})):t,o=vn([n],e);return[[i[0],i[1]],[i[1],i[3]],[i[3],i[2]],[i[2],i[0]]].some((function(t){return!xi(o,t)}))}function Oi(t,e,n,r,i){var o=t.props.innerBounds,a=i*Math.PI/180;if(!o)return[];var s=o.left,u=o.top,l=o.width,c=o.height,f=s-r[0],p=s+l-r[0],d=u-r[1],h=u+c-r[1],g=[[f,d],[p,d],[f,h],[p,h]],v=Lr(n,[0,0]);if(!Mi(n,g,v,0))return[];var m=[],b=g.map((function(t){return[Jn(t),U([0,0],t)]}));return[[n[0],n[1]],[n[1],n[3]],[n[3],n[2]],[n[2],n[0]]].forEach((function(t){var n=U([0,0],function(t){var e=t[0],n=t[1],r=n[0]-e[0],i=n[1]-e[1];if(!r)return[e[0],0];if(!i)return[0,e[1]];var o=i/r,a=-o*e[0]+e[1];return[-a/(o+1/o),a/(o*o+1)]}(t)),r=function(t){var e=t[0],n=t[1],r=n[0]-e[0],i=n[1]-e[1];if(!r)return Math.abs(e[0]);if(!i)return Math.abs(e[1]);var o=i/r;return Math.abs((-o*e[0]+e[1])/Math.sqrt(Math.pow(o,2)+1))}(t);m.push.apply(m,b.filter((function(t){var e=t[0];return e&&r<=e})).map((function(t){var e=t[0],i=t[1],o=Math.acos(e?r/e:0);return[a+(i+o)-n,a+(i-o)-n]})).reduce((function(t,e){return t.push.apply(t,e),t}),[]).filter((function(t){return!Mi(e,g,v,t)})).map((function(t){return Q(180*t/Math.PI,Mn)})))})),m}function Pi(t,e,n){var r=t||{},i=r.position,o=void 0===i?"client":i,a=r.left,s=void 0===a?-1/0:a,u=r.top,l=void 0===u?-1/0:u,c=r.right,f=void 0===c?1/0:c,p=r.bottom,d={position:o,left:s,top:l,right:f,bottom:void 0===p?1/0:p};return{vertical:Ti(d,e,!0),horizontal:Ti(d,n,!1)}}function Ri(t,e){var n=t.state,r=n.containerClientRect,i=r.clientHeight,o=r.clientWidth,a=r.clientLeft,s=r.clientTop,u=n.snapOffset,l=u.left,c=u.top,f=u.right,p=u.bottom,d=e||t.props.bounds||{},h="css"===(d.position||"client"),g=d.left,v=void 0===g?-1/0:g,m=d.top,b=void 0===m?-1/0:m,y=d.right,x=void 0===y?h?-1/0:1/0:y,E=d.bottom,S=void 0===E?h?-1/0:1/0:E;return h&&(x=o+f-l-x,S=i+p-c-S),{left:v+l-a,right:x+l-a,top:b+c-s,bottom:S+c-s}}function Ti(t,e,n){var r=t[n?"left":"top"],i=t[n?"right":"bottom"],o=Math.min.apply(Math,e),a=Math.max.apply(Math,e),s=[];return r+1>o&&s.push({isBound:!0,offset:o-r,pos:r}),i-1<a&&s.push({isBound:!0,offset:a-i,pos:i}),s.length||s.push({isBound:!1,offset:0,pos:0}),s.sort((function(t,e){return Math.abs(e.offset)-Math.abs(t.offset)}))}function ki(t,e,n){return(n?t.map((function(t){return he(t,n)})):t).some((function(t){return t[0]<e.left&&Math.abs(t[0]-e.left)>.1||t[0]>e.right&&Math.abs(t[0]-e.right)>.1||t[1]<e.top&&Math.abs(t[1]-e.top)>.1||t[1]>e.bottom&&Math.abs(t[1]-e.bottom)>.1}))}function Bi(t,e,n,r,i){if(!t.props.bounds)return[];var o=i*Math.PI/180,a=Ri(t),s=a.left,u=a.top,l=a.right,c=a.bottom,f=s-r[0],p=l-r[0],d=u-r[1],h=c-r[1],g={left:f,top:d,right:p,bottom:h};if(!ki(n,g,0))return[];var v=[];return[[f,0],[p,0],[d,1],[h,1]].forEach((function(t){var r=t[0],i=t[1];n.forEach((function(t){var n=U([0,0],t);v.push.apply(v,function(t,e,n){var r=Jn(t),i=Math.sqrt(r*r-e*e)||0;return[i,-i].sort((function(e,r){return Math.abs(e-t[n?0:1])-Math.abs(r-t[n?0:1])})).map((function(t){return U([0,0],n?[t,e]:[e,t])}))}(t,r,i).map((function(t){return o+t-n})).filter((function(t){return!ki(e,g,t)})).map((function(t){return Q(180*t/Math.PI,Mn)})))}))})),v}function zi(t,e){return function(t,e){var n,r=t.direction,i=t.classNames,o=t.size,a=t.pos,s=t.zoom,u=t.key,l="horizontal"===r,c=l?"Y":"X";return e.createElement("div",{key:u,className:i.join(" "),style:(n={},n[l?"width":"height"]=""+o,n.transform="translate("+a[0]+", "+a[1]+") translate"+c+"(-50%) scale"+c+"("+s+")",n)})}(gn(gn({},t),{classNames:vn([_n("line","guideline",t.direction)],t.classNames).filter((function(t){return t})),size:t.size||t.sizeValue+"px",pos:t.pos||t.posValue.map((function(t){return Q(t,.1)+"px"}))}),e)}function _i(t,e,n,r,i,o,a,s){var u=t.props.zoom;return n.map((function(t,n){var l=t.type,c=t.pos,f=[0,0];return f[a]=r,f[a?0:1]=-i+c,zi({key:e+"TargetGuideline"+n,classNames:[_n("target","bold",l)],posValue:f,sizeValue:o,zoom:u,direction:e},s)}))}function Gi(t,e,n,r,i,o){var a=t.props,s=a.zoom,u=a.isDisplayInnerSnapDigit,l="horizontal"===e?ri:ii,c=i[l.start],f=i[l.end];return n.filter((function(t){var e=t.hide,n=t.elementRect;if(e)return!1;if(u&&n){var r=n.rect;if(r[l.start]<=c&&f<=r[l.end])return!1}return!0})).map((function(t,n){var i=t.pos,a=t.size,u=t.element,l=[-r[0]+i[0],-r[1]+i[1]];return zi({key:e+"-default-guideline-"+n,classNames:u?[_n("bold")]:[],direction:e,posValue:l,sizeValue:a,zoom:s},o)}))}function ji(t,e,n,r,i,o,a,s){var u,l=t.props,c=l.snapDigit,f=void 0===c?0:c,p=l.isDisplaySnapDigit,d=void 0===p||p,h=l.snapDistFormat,g=void 0===h?function(t){return t}:h,v=l.zoom,m="horizontal"===e?"X":"Y",b="vertical"===e?"height":"width",y=Math.abs(i),x=d?parseFloat(y.toFixed(f)):0;return s.createElement("div",{key:e+"-"+n+"-guideline-"+r,className:_n("guideline-group",e),style:(u={left:o[0]+"px",top:o[1]+"px"},u[b]=y+"px",u)},zi({direction:e,classNames:[_n(n),a],size:"100%",posValue:[0,0],sizeValue:y,zoom:v},s),s.createElement("div",{className:_n("size-value","gap"),style:{transform:"translate"+m+"(-50%) scale("+v+")"}},x>0?g(x):""))}function Ii(t,e,n,r,i){var o=t.props.isDisplayInnerSnapDigit,a=[];return["vertical","horizontal"].forEach((function(s){var u=e.filter((function(t){return t.type===s})),l="vertical"===s?1:0,c=l?0:1,f=function(t,e,n,r){var i,o,a,s,u="vertical"===t?0:1,l="vertical"===t?1:0,c=u?ri:ii,f=n[c.start],p=n[c.end];return(i=e,o=function(t){return t.pos[u]},a=[],s=[],i.forEach((function(t,e){var n=o(t,e,i),r=s.indexOf(n),u=a[r]||[];-1===r&&(s.push(n),a.push(u)),u.push(t)})),a).map((function(e){var n=[],i=[];return e.forEach((function(e){var o,a,s=e.element,d=e.elementRect.rect;if(d[c.end]<f)n.push(e);else if(p<d[c.start])i.push(e);else if(d[c.start]<=f&&p<=d[c.end]&&r){var h=e.pos,g={element:s,rect:gn(gn({},d),(o={},o[c.end]=d[c.start],o))},v={element:s,rect:gn(gn({},d),(a={},a[c.start]=d[c.end],a))},m=[0,0],b=[0,0];m[u]=h[u],m[l]=h[l],b[u]=h[u],b[l]=h[l]+e.size,n.push({type:t,pos:m,size:0,elementRect:g}),i.push({type:t,pos:b,size:0,elementRect:v})}})),n.sort((function(t,e){return e.pos[l]-t.pos[l]})),i.sort((function(t,e){return t.pos[l]-e.pos[l]})),{total:e,start:n,end:i,inner:[]}}))}(s,u,r,o),p=l?ii:ri,d=l?ri:ii,h=r[p.start],g=r[p.end];f.forEach((function(e){var o=e.total,u=e.start,f=e.end,v=e.inner,m=n[c]+o[0].pos[c]-r[d.start],b=r;u.forEach((function(e){var r=e.elementRect.rect,o=b[p.start]-r[p.end];if(o>0){var u=[0,0];u[l]=n[l]+b[p.start]-h-o,u[c]=m,a.push(ji(t,s,"dashed",a.length,o,u,e.className,i))}b=r})),b=r,f.forEach((function(e){var r=e.elementRect.rect,o=r[p.start]-b[p.end];if(o>0){var u=[0,0];u[l]=n[l]+b[p.end]-h,u[c]=m,a.push(ji(t,s,"dashed",a.length,o,u,e.className,i))}b=r})),v.forEach((function(e){var r=e.elementRect.rect,o=h-r[p.start],u=r[p.end]-g,f=[0,0],d=[0,0];f[l]=n[l]-o,f[c]=m,d[l]=n[l]+g-h,d[c]=m,a.push(ji(t,s,"dashed",a.length,o,f,e.className,i)),a.push(ji(t,s,"dashed",a.length,u,d,e.className,i))}))}))})),a}function Ai(t,e,n,r,i){var o=function(t,e,n,r){var i=e[0]-t[0],o=e[1]-t[1];if(Math.abs(i)<D&&(i=0),Math.abs(o)<D&&(o=0),!i)return r?[0,0]:[0,n];if(!o)return r?[n,0]:[0,0];var a=o/i,s=t[1]-a*t[0];return r?[n,a*(e[0]+n)+s-e[1]]:[(e[1]+n-s)/a-e[0],n]}(t,e,n,r);if(!o)return{isOutside:!1,offset:[0,0]};var a=J(t,e),s=J(o,t),u=J(o,e),l=s>a||u>a,c=Fr({datas:i,distX:o[0],distY:o[1]});return{offset:[c[0],c[1]],isOutside:l}}function Ni(t,e){return t.isBound?t.offset:e.isSnap?hi(e).offset:0}function Fi(t,e,n,r,i,o){if(!oi(t,"draggable"))return[{isSnap:!1,isBound:!1,offset:0},{isSnap:!1,isBound:!1,offset:0}];var a=sr(o.absolutePoses,[e,n]),s=Kn(a),u=s.left,l=s.right,c=s.top,f=s.bottom,p={horizontal:a.map((function(t){return t[1]})),vertical:a.map((function(t){return t[0]}))},d=Yi(t,i,si(ai(t.props.snapDirections),{left:u,right:l,top:c,bottom:f,center:(u+l)/2,middle:(c+f)/2}),p),h=d.vertical,g=d.horizontal,v=wi(t,a,o),m=v.vertical,b=v.horizontal,y=h.isSnap,x=g.isSnap,E=h.isBound||m.isBound,S=g.isBound||b.isBound,C=function(t,e,n,r,i){var o=e[0],a=e[1],s=n[0],u=n[1],l=r[0],c=r[1],f=i[0],p=i[1],d=-f,h=-p;if(t&&o&&a){d=0,h=0;var g=[];if(s&&u?g.push([0,p],[f,0]):s?g.push([f,0]):u?g.push([0,p]):l&&c?g.push([0,p],[f,0]):l?g.push([f,0]):c&&g.push([0,p]),g.length){g.sort((function(t,e){return Jn(se([o,a],t))-Jn(se([o,a],e))}));var v=g[0];if(v[0]&&Math.abs(o)>D)d=-v[0],h=a*Math.abs(o+d)/Math.abs(o)-a;else if(v[1]&&Math.abs(a)>D){var m=a;h=-v[1],d=o*Math.abs(a+h)/Math.abs(m)-o}if(t&&u&&s)if(Math.abs(d)>D&&Math.abs(d)<Math.abs(f))d*=b=Math.abs(f)/Math.abs(d),h*=b;else if(Math.abs(h)>D&&Math.abs(h)<Math.abs(p)){var b;d*=b=Math.abs(p)/Math.abs(h),h*=b}else d=vr(-f,d),h=vr(-p,h)}}else d=o||s?-f:0,h=a||u?-p:0;return[d,h]}(r,[e,n],[E,S],[y,x],[vr(h.offset,m.offset),vr(g.offset,b.offset)]);return[{isBound:E,isSnap:y,offset:C[0]},{isBound:S,isSnap:x,offset:C[1]}]}function Yi(t,e,n,r){void 0===r&&(r=n);var i=Pi(Ri(t),r.vertical,r.horizontal),o=i.horizontal,a=i.vertical,s=e?{horizontal:{isSnap:!1,index:-1},vertical:{isSnap:!1,index:-1}}:fi(t,n.vertical,n.horizontal),u=s.horizontal,l=s.vertical,c=Ni(o[0],u),f=Ni(a[0],l),p=Math.abs(c),d=Math.abs(f);return{horizontal:{isBound:o[0].isBound,isSnap:u.isSnap,snapIndex:u.index,offset:c,dist:p,bounds:o,snap:u},vertical:{isBound:a[0].isBound,isSnap:l.isSnap,snapIndex:l.index,offset:f,dist:d,bounds:a,snap:l}}}function Xi(t,e,n,r,i){var o=Pi(e,n,r),a=o.horizontal,s=o.vertical,u=pi(t,n,r,i),l=u.horizontal,c=u.vertical,f=Ni(a[0],l),p=Ni(s[0],c),d=Math.abs(f),h=Math.abs(p);return{horizontal:{isBound:a[0].isBound,isSnap:l.isSnap,snapIndex:l.index,offset:f,dist:d,bounds:a,snap:l},vertical:{isBound:s[0].isBound,isSnap:c.isSnap,snapIndex:c.index,offset:p,dist:h,bounds:s,snap:c}}}function Li(t,e,n,r,i,o){return n.map((function(n){var a=n[0],s=n[1],u=Lr(e,a),l=Lr(e,s),c=r?function(t,e,n,r){var i=function(t,e,n){var r=Ri(t),i=r.left,o=r.top,a=r.right,s=r.bottom,u=n[0],l=n[1],c=se(n,e),f=c[0],p=c[1];Math.abs(f)<Mn&&(f=0),Math.abs(p)<Mn&&(p=0);var d=p>0,h=f>0,g={isBound:!1,offset:0,pos:0},v={isBound:!1,offset:0,pos:0};if(0===f&&0===p)return{vertical:g,horizontal:v};if(0===f)d?s<l&&(v.pos=s,v.offset=l-s):o>l&&(v.pos=o,v.offset=l-o);else if(0===p)h?a<u&&(g.pos=a,g.offset=u-a):i>u&&(g.pos=i,g.offset=u-i);else{var m=p/f,b=n[1]-m*u,y=0,x=0,E=!1;h&&a<=u?(y=m*a+b,x=a,E=!0):!h&&u<=i&&(y=m*i+b,x=i,E=!0),E&&(y<o||y>s)&&(E=!1),E||(d&&s<=l?(x=((y=s)-b)/m,E=!0):!d&&l<=o&&(x=((y=o)-b)/m,E=!0)),E&&(g.isBound=!0,g.pos=x,g.offset=u-x,v.isBound=!0,v.pos=y,v.offset=l-y)}return{vertical:g,horizontal:v}}(t,e,n),o=i.horizontal,a=i.vertical,s=r?{horizontal:{isSnap:!1},vertical:{isSnap:!1}}:function(t,e,n){var r=n[0],i=n[1],o=e[0],a=e[1],s=se(n,e),u=s[0],l=s[1],c=l>0,f=u>0;u=Er(u),l=Er(l);var p={isSnap:!1,offset:0,pos:0},d={isSnap:!1,offset:0,pos:0};if(0===u&&0===l)return{vertical:p,horizontal:d};var h=fi(t,u?[r]:[],l?[i]:[]),g=h.vertical,v=h.horizontal;g.posInfos.filter((function(t){var e=t.pos;return f?e>=o:e<=o})),v.posInfos.filter((function(t){var e=t.pos;return c?e>=a:e<=a})),g.isSnap=g.posInfos.length>0,v.isSnap=v.posInfos.length>0;var m=hi(g),b=m.isSnap,y=m.guideline,x=hi(v),E=x.isSnap,S=x.guideline,C=E?S.pos[1]:0,w=b?y.pos[0]:0;if(0===u)E&&(d.isSnap=!0,d.pos=S.pos[1],d.offset=i-d.pos);else if(0===l)b&&(p.isSnap=!0,p.pos=w,p.offset=r-w);else{var D=l/u,M=n[1]-D*r,O=0,P=0,R=!1;b?(O=D*(P=w)+M,R=!0):E&&(P=((O=C)-M)/D,R=!0),R&&(p.isSnap=!0,p.pos=P,p.offset=r-P,d.isSnap=!0,d.pos=O,d.offset=i-O)}return{vertical:p,horizontal:d}}(t,e,n),u=s.horizontal,l=s.vertical,c=qi(o,u),f=qi(a,l),p=Math.abs(c),d=Math.abs(f);return{horizontal:{isBound:o.isBound,isSnap:u.isSnap,offset:c,dist:p},vertical:{isBound:a.isBound,isSnap:l.isSnap,offset:f,dist:d}}}(t,u,l,i):Yi(t,i,{vertical:[l[0]],horizontal:[l[1]]}),f=c.horizontal,p=f.offset,d=f.isBound,h=f.isSnap,g=c.vertical,v=g.offset,m=g.isBound,b=g.isSnap,y=se(s,a);if(!v&&!p)return{isBound:m||d,isSnap:b||h,sign:y,offset:[0,0]};var x=function(t,e,n,r){var i=U(t,e)/Math.PI*180,o=n.vertical,a=o.isBound,s=o.isSnap,u=o.dist,l=n.horizontal,c=l.isBound,f=l.isSnap,p=i%180,d=p<3||p>177,h=p>87&&p<93;return l.dist<u&&(a||s&&!h&&(!r||!d))?"vertical":!c&&(!f||d||r&&h)?"":"horizontal"}(u,l,c,r);if(!x)return{sign:y,isBound:!1,isSnap:!1,offset:[0,0]};var E="vertical"===x,S=Ai(u,l,-(E?v:p),E,o).offset.map((function(t,e){return t*(y[e]?2/y[e]:0)}));return{sign:y,isBound:E?m:d,isSnap:E?b:h,offset:S}}))}function qi(t,e){return t.isBound?t.offset:e.isSnap?e.offset:0}function Wi(t){var e=t.state;if(!e.guidelines||!e.guidelines.length){var n=t.state.container,r=t.props.snapContainer||n,i=e.containerClientRect,o={left:0,top:0,bottom:0,right:0};if(n!==r){var a=wr(r,!0);if(a){var s=or(a),u=Mr(e,[s.left-i.left,s.top-i.top]),l=Mr(e,[s.right-i.right,s.bottom-i.bottom]);o.left=Q(u[0],.1),o.top=Q(u[1],.1),o.right=Q(l[0],.1),o.bottom=Q(l[1],.1)}}e.snapOffset=o,e.guidelines=ci(t),e.enableSnap=!0}}function Hi(t,e,n,r,i,o){var a=$n(t,e,n,o?4:3),s=function(t,e){return Lr(t,e.map((function(t){return-t})))}(a,i);return sr(a,se(r,s))}function Vi(t,e,n,r,i,o){var a=function(t,e){var n=[],r=[-t[0],-t[1]];return t[0]&&t[1]?(n.push([r,[t[0],-t[1]]],[r,[-t[0],t[1]]]),e&&n.push([r,t])):t[0]?e?n.push([r,[r[0],-1]],[r,[r[0],1]],[r,[t[0],-1]],[r,t],[r,[t[0],1]]):n.push([[r[0],-1],[t[0],-1]],[[r[0],0],[t[0],0]],[[r[0],1],[t[0],1]]):t[1]?e?n.push([r,[-1,r[1]]],[r,[1,r[1]]],[r,[-1,t[1]]],[r,[1,t[1]]],[r,t]):n.push([[-1,r[1]],[-1,t[1]]],[[0,r[1]],[0,t[1]]],[[1,r[1]],[1,t[1]]]):n.push([r,[1,0]],[r,[-1,0]],[r,[0,-1]],[r,[0,1]],[[1,0],[1,-1]],[[1,0],[1,1]],[[0,1],[1,1]],[[0,1],[-1,1]],[[-1,0],[-1,-1]],[[-1,0],[-1,1]],[[0,-1],[1,-1]],[[0,-1],[-1,-1]]),n}(n,r),s=Di(e,n,r),u=vn(Li(t,e,a,r,i,o),Ci(t,s,Lr(e,[0,0]),o)),l=mi(u,0),c=mi(u,1);return{width:{isBound:l.isBound,offset:l.offset[0]},height:{isBound:c.isBound,offset:c.offset[1]}}}function $i(t,e,n,r,i,o,a,s){for(var u=ur(t.state),l=t.props.keepRatio,c=0,f=0,p=0;p<2;++p){var d=Vi(t,e(c,f),i,l,a,s),h=d.width,g=d.height,v=h.isBound,m=g.isBound,b=h.offset,y=g.offset;if(1===p&&(v||(b=0),m||(y=0)),0===p&&a&&!v&&!m)return[0,0];if(l){var x=Math.abs(b)*(n?1/n:1),E=Math.abs(y)*(r?1/r:1);(v&&m?x<E:m||!v&&x<E)?b=n*y/r:y=r*b/n}c+=b,f+=y}if(i[0]&&i[1]){var S=function(t,e,n,r,i){var o=[-n[0],-n[1]],a=t.state,s=a.width,u=a.height,l=t.props.bounds,c=1/0,f=1/0;if(l){var p=[[n[0],-n[1]],[-n[0],n[1]]],d=l.left,h=void 0===d?-1/0:d,g=l.top,v=void 0===g?-1/0:g,m=l.right,b=void 0===m?1/0:m,y=l.bottom,x=void 0===y?1/0:y;p.forEach((function(t){var n=t[0]!==o[0],a=t[1]!==o[1],l=Lr(e,t),p=360*U(r,l)/Math.PI;if(a){var d=l.slice();(Math.abs(p-360)<2||Math.abs(p-180)<2)&&(d[1]=r[1]);var g=Ai(r,d,(r[1]<l[1]?x:v)-l[1],!1,i),m=g.offset[1],y=g.isOutside;isNaN(m)||(f=u+(y?1:-1)*Math.abs(m))}if(n){d=l.slice(),(Math.abs(p-90)<2||Math.abs(p-270)<2)&&(d[0]=r[0]);var E=Ai(r,d,(r[0]<l[0]?b:h)-l[0],!0,i),S=E.offset[0],C=E.isOutside;isNaN(S)||(c=s+(C?1:-1)*Math.abs(S))}}))}return{maxWidth:c,maxHeight:f}}(t,u,i,o,s),C=S.maxWidth,w=S.maxHeight,D=function(t,e,n,r,i,o,a,s,u){var l=Lr(e,a),c=Yi(t,s,{vertical:[l[0]],horizontal:[l[1]]}),f=c.horizontal.offset,p=c.vertical.offset;if(p||f){var d=Fr({datas:u,distX:-p,distY:-f}),h=d[0],g=d[1];return[Math.min(i||1/0,n+a[0]*h)-n,Math.min(o||1/0,r+a[1]*g)-r]}return[0,0]}(t,e(c,f).map((function(t){return t.map((function(t){return Q(t,1e-4)}))})),n+c,r+f,C,w,i,a,s);c+=b=D[0],f+=y=D[1]}return[c,f]}function Ki(t,e,n,r){if(!oi(t,"rotatable"))return r;var i=e.pos1,o=e.pos2,a=e.pos3,s=e.pos4,u=r*Math.PI/180,l=[i,o,a,s].map((function(t){return se(t,n)})),c=l.map((function(t){return he(t,u)})),f=vn(Bi(t,l,c,n,r),Oi(t,l,c,n,r));return f.sort((function(t,e){return Math.abs(t-r)-Math.abs(e-r)})),f.length?f[0]:r}function Ui(t,e,n,r,i){var o=i.width,a=i.height,s=i.fixedPosition;if(!oi(t,"scalable"))return[0,0];var u=i.is3d,l=$i(t,(function(t,r){return Hi(function(t,e){var n=t.transformOrigin,r=t.offsetMatrix,i=t.is3d?4:3;return qr(r,oe(t.targetMatrix,ye(e,i),i),n,i)}(i,ae(e,[t/o,r/a])),o,a,s,n,u)}),o,a,n,s,r,i);return[l[0]/o,l[1]/a]}function Zi(t){var e=[];return t.forEach((function(t){t.guidelineInfos.forEach((function(t){var n=t.guideline;e.indexOf(n)>-1||e.push(n)}))})),e}function Ji(t,e,n,r,i,o){var a=Pi(Ri(t,o),e,n),s=a.vertical,u=a.horizontal;s.forEach((function(t){t.isBound&&r.push({type:"bounds",pos:t.pos})})),u.forEach((function(t){t.isBound&&i.push({type:"bounds",pos:t.pos})}));var l=function(t){var e=t.props.innerBounds;if(!e)return{vertical:[],horizontal:[]};var n=t.getRect(),r=n.pos1,i=n.pos2,o=n.pos3,a=n.pos4,s=Lr([r,i,o,a],[0,0]),u=e.left,l=e.top,c=e.width,f=e.height,p=[[u,l],[u,l+f]],d=[[u,l],[u+c,l]],h=[[u+c,l],[u+c,l+f]],g=[[u,l+f],[u+c,l+f]],v=[],m=[],b={top:!1,bottom:!1,left:!1,right:!1};return[[r,i],[i,a],[a,o],[o,r]].forEach((function(t){var e=bi(s,t),n=e.horizontal,r=e.vertical,i=Si(t,d,r,1,!0),o=Si(t,g,r,1,!0),a=Si(t,p,n,1,!0),y=Si(t,h,n,1,!0);i.isBound&&!b.top&&(v.push(l),b.top=!0),o.isBound&&!b.bottom&&(v.push(l+f),b.bottom=!0),a.isBound&&!b.left&&(m.push(u),b.left=!0),y.isBound&&!b.right&&(m.push(u+c),b.right=!0)})),{horizontal:v,vertical:m}}(t),c=l.vertical,f=l.horizontal;c.forEach((function(t){X(r,(function(e){var n=e.type,r=e.pos;return"bounds"===n&&r===t}))>=0||r.push({type:"bounds",pos:t})})),f.forEach((function(t){X(i,(function(e){var n=e.type,r=e.pos;return"bounds"===n&&r===t}))>=0||i.push({type:"bounds",pos:t})}))}var Qi={name:"snappable",props:{snappable:[Boolean,Array],snapContainer:Object,snapDirections:[Boolean,Object],elementSnapDirections:[Boolean,Object],snapGap:Boolean,snapGridWidth:Number,snapGridHeight:Number,isDisplaySnapDigit:Boolean,isDisplayInnerSnapDigit:Boolean,snapDigit:Number,snapThreshold:Number,horizontalGuidelines:Array,verticalGuidelines:Array,elementGuidelines:Array,bounds:Object,innerBounds:Object,snapDistFormat:Function},events:{onSnap:"snap"},css:[":host {\n    --bounds-color: #d66;\n}\n.guideline {\n    pointer-events: none;\n    z-index: 2;\n}\n.guideline.bounds {\n    background: #d66;\n    background: var(--bounds-color);\n}\n.guideline-group {\n    position: absolute;\n    top: 0;\n    left: 0;\n}\n.guideline-group .size-value {\n    position: absolute;\n    color: #f55;\n    font-size: 12px;\n    font-weight: bold;\n}\n.guideline-group.horizontal .size-value {\n    transform-origin: 50% 100%;\n    transform: translateX(-50%);\n    left: 50%;\n    bottom: 5px;\n}\n.guideline-group.vertical .size-value {\n    transform-origin: 0% 50%;\n    top: 50%;\n    transform: translateY(-50%);\n    left: 5px;\n}\n.guideline.gap {\n    background: #f55;\n}\n.size-value.gap {\n    color: #f55;\n}\n"],render:function(t,e){var n=t.state,r=n.top,i=n.left,o=n.pos1,a=n.pos2,s=n.pos3,u=n.pos4,l=n.snapRenderInfo;if(!l||!oi(t,""))return[];n.guidelines=ci(t);var c=Math.min(o[0],a[0],s[0],u[0]),f=Math.min(o[1],a[1],s[1],u[1]),p=l.externalPoses||[],d=ur(t.state),h=[],g=[],v=[],m=[],b=[],y=Kn(d),x=y.width,E=y.height,S=y.top,C=y.left,w=y.bottom,D=y.right,M={left:C,right:D,top:S,bottom:w,center:(C+D)/2,middle:(S+w)/2},O=p.length>0,P=O?Kn(p):{};if(!l.request){if(l.direction&&b.push(function(t,e,n){var r=[];if(n[0]&&n[1])r=[n,[-n[0],n[1]],[n[0],-n[1]]].map((function(t){return Lr(e,t)}));else if(n[0]||n[1])t.props.keepRatio?r=[[-1,-1],[-1,1],[1,-1],[1,1],n].map((function(t){return Lr(e,t)})):(r=Xr(e,n)).length>1&&r.push([(r[0][0]+r[1][0])/2,(r[0][1]+r[1][1])/2]);else for(var i=[e[0],e[1],e[3],e[2],e[0]],o=0;o<4;++o)r.push(i[o]),r.push([(i[o][0]+i[o+1][0])/2,(i[o][1]+i[o+1][1])/2]);return fi(t,r.map((function(t){return t[0]})),r.map((function(t){return t[1]})),1)}(t,d,l.direction)),l.snap){var R=Kn(d);l.center&&(R.middle=(R.top+R.bottom)/2,R.center=(R.left+R.right)/2),b.push(di(t,R,1))}O&&(l.center&&(P.middle=(P.top+P.bottom)/2,P.center=(P.left+P.right)/2),b.push(di(t,P,1))),b.forEach((function(t){var e=t.vertical.posInfos,n=t.horizontal.posInfos;h.push.apply(h,e.filter((function(t){return t.guidelineInfos.some((function(t){return!t.guideline.hide}))})).map((function(t){return{type:"snap",pos:t.pos}}))),g.push.apply(g,n.filter((function(t){return t.guidelineInfos.some((function(t){return!t.guideline.hide}))})).map((function(t){return{type:"snap",pos:t.pos}}))),v.push.apply(v,Zi(e)),m.push.apply(m,Zi(n))}))}Ji(t,[C,D],[S,w],h,g),O&&Ji(t,[P.left,P.right],[P.top,P.bottom],h,g,l.externalBounds);var T=vn(v,m),k=T.filter((function(t){return t.element&&!t.gapRects})),B=T.filter((function(t){return t.gapRects}));return pr(t,"onSnap",{guidelines:T.filter((function(t){return!t.element})),elements:k,gaps:B},!0),vn(Ii(t,k,[c,f],M,e),function(t,e,n,r,i){var o=[];return["horizontal","vertical"].forEach((function(a){var s=e.filter((function(t){return t.type===a})),u="vertical"===a?0:1,l=u?0:1,c=u?ii:ri,f=u?ri:ii,p=r[c.start],d=r[c.end],h=r[f.start],g=r[f.end];s.forEach((function(e){var r=e.gap,a=e.gapRects,s=e.className,v=Math.max.apply(Math,vn([h],a.map((function(t){return t.rect[f.start]})))),m=Math.min.apply(Math,vn([g],a.map((function(t){return t.rect[f.end]})))),b=(v+m)/2;v!==m&&b!==(h+g)/2&&a.forEach((function(e){var a=e.rect,f=[n[0],n[1]];if(a[c.end]<p)f[u]+=a[c.end]-p;else{if(!(d<a[c.start]))return;f[u]+=a[c.start]-p-r}f[l]+=b-h,o.push(ji(t,u?"vertical":"horizontal","gap",o.length,r,f,s,i))}))}))})),o}(t,B,[c,f],M,e),Gi(t,"horizontal",m,[i,r],M,e),Gi(t,"vertical",v,[i,r],M,e),_i(t,"horizontal",g,c,r,x,0,e),_i(t,"vertical",h,f,i,E,1,e))},dragStart:function(t,e){t.state.snapRenderInfo={request:e.isRequest,snap:!0,center:!0},Wi(t)},drag:function(t){t.state.guidelines=ci(t)},pinchStart:function(t){this.unset(t)},dragEnd:function(t){this.unset(t)},dragControlCondition:function(t,e){return!(!Sr(0,e)&&!lo(t,e))||(!e.isRequest&&e.inputEvent?et(e.inputEvent.target,_n("snap-control")):void 0)},dragControlStart:function(t){t.state.snapRenderInfo=null,Wi(t)},dragControl:function(t){this.drag(t)},dragControlEnd:function(t){this.unset(t)},dragGroupStart:function(t,e){this.dragStart(t,e)},dragGroup:function(t){this.drag(t)},dragGroupEnd:function(t){this.unset(t)},dragGroupControlStart:function(t){t.state.snapRenderInfo=null,Wi(t)},dragGroupControl:function(t){this.drag(t)},dragGroupControlEnd:function(t){this.unset(t)},unset:function(t){var e=t.state;e.enableSnap=!1,e.guidelines=[],e.snapRenderInfo=null,e.elementRects=[]}},to={name:"draggable",props:{draggable:Boolean,throttleDrag:Number,throttleDragRotate:Number,startDragRotate:Number,edgeDraggable:Boolean},events:{onDragStart:"dragStart",onDrag:"drag",onDragEnd:"dragEnd",onDragGroupStart:"dragGroupStart",onDragGroup:"dragGroup",onDragGroupEnd:"dragGroupEnd"},render:function(t,e){var n=t.props,r=n.throttleDragRotate,i=n.zoom,o=t.state,a=o.dragInfo,s=o.beforeOrigin;if(!r||!a)return[];var u=a.dist;if(!u[0]&&!u[1])return[];var l=Jn(u),c=U(u,[0,0]);return[e.createElement("div",{className:_n("line","horizontal","dragline","dashed"),key:"dragRotateGuideline",style:{width:l+"px",transform:"translate("+s[0]+"px, "+s[1]+"px) rotate("+c+"rad) scaleY("+i+")"}})]},dragStart:function(t,e){var n=e.datas,r=e.parentEvent,i=e.parentGesto,o=t.state,a=o.target;if(o.gesto)return!1;o.gesto=i||t.targetGesto;var s=dr(a);n.datas={},n.left=parseFloat(s.left||"")||0,n.top=parseFloat(s.top||"")||0,n.bottom=parseFloat(s.bottom||"")||0,n.right=parseFloat(s.right||"")||0,n.startValue=[0,0],_r(t,e),Hr(e,"translate"),function(t,e){e.absolutePoses=ur(t.state)}(t,n),n.prevDist=[0,0],n.prevBeforeDist=[0,0],n.isDrag=!1,n.deltaOffset=[0,0],n.distOffset=[0,0];var u=cr(t,e,gn({set:function(t){n.startValue=t}},Wr(e)));return!1!==(r||pr(t,"onDragStart",u))?(n.isDrag=!0,t.state.dragInfo={startRect:t.getRect(),dist:[0,0]}):(o.gesto=null,n.isPinch=!1),!!n.isDrag&&u},drag:function(t,e){if(e){Gr(e,"translate");var n=e.datas,r=e.parentEvent,i=e.parentFlag,o=e.isPinch,a=e.isRequest,s=e.distX,u=e.distY,l=n.isDrag,c=n.prevDist,f=n.prevBeforeDist,p=n.startValue,d=n.distOffset;if(l){s+=d[0],u+=d[1];var h=t.props,g=h.parentMoveable,v=r?0:h.throttleDrag||0,m=r?0:h.throttleDragRotate||0,b=!1,y=0;if(!r&&m>0&&(s||u)){var x=h.startDragRotate||0,E=Q(x+180*U([0,0],[s,u])/Math.PI,m)-x,S=u*Math.abs(Math.cos((E-90)/180*Math.PI)),C=Jn([s*Math.abs(Math.cos(E/180*Math.PI)),S]);y=E*Math.PI/180,s=C*Math.cos(y),u=C*Math.sin(y)}if(!o&&!r&&!i&&(!m||s||u)){var w=Fi(t,s,u,m,a,n),D=w[0],M=w[1],O=D.isSnap,P=D.isBound,R=D.offset,T=M.isSnap,k=M.isBound;b=O||T||P||k,s+=R,u+=M.offset}var B=ae(Nr({datas:n,distX:s,distY:u}),p),z=ae(Ir({datas:n,distX:s,distY:u}),p);m||b||(tt(z,v),tt(B,v));var _=se(B,p),G=se(z,p),j=se(G,c),I=se(_,f);n.prevDist=G,n.prevBeforeDist=_,n.passDelta=j,n.passDist=G;var A=n.left+_[0],N=n.top+_[1],F=n.right-_[0],Y=n.bottom-_[1],X=jr(n,"translate("+z[0]+"px, "+z[1]+"px)","translate("+G[0]+"px, "+G[1]+"px)");if(t.state.dragInfo.dist=r?[0,0]:G,r||g||!j.every((function(t){return!t}))||!I.some((function(t){return!t}))){var L=t.state,q=cr(t,e,{transform:X,dist:G,delta:j,translate:z,beforeDist:_,beforeDelta:I,beforeTranslate:B,left:A,top:N,right:F,bottom:Y,width:L.width,height:L.height,isPinch:o});return!r&&pr(t,"onDrag",q),q}}}},dragAfter:function(t,e){var n=e.datas,r=e.datas,i=r.deltaOffset,o=r.distOffset;return!(!i[0]&&!i[1])&&(n.deltaOffset=[0,0],o[0]+=i[0],o[1]+=i[1],this.drag(t,e))},dragEnd:function(t,e){var n=e.parentEvent,r=e.datas,i=e.isDrag;if(t.state.gesto=null,t.state.dragInfo=null,r.isDrag)return r.isDrag=!1,!n&&pr(t,"onDragEnd",fr(t,e,{})),i},dragGroupStart:function(t,e){var n=e.datas,r=e.clientX,i=e.clientY,o=this.dragStart(t,e);if(!o)return!1;var a=kr(t,this,"dragStart",[r||0,i||0],e,!1),s=pr(t,"onDragGroupStart",gn(gn({},o),{targets:t.props.targets,events:a}));return n.isDrag=!1!==s,!!n.isDrag&&o},dragGroup:function(t,e){if(e.datas.isDrag){var n=this.drag(t,e),r=kr(t,this,"drag",e.datas.passDelta,e,!1);if(n){var i=gn({targets:t.props.targets,events:r},n);return pr(t,"onDragGroup",i),i}}},dragGroupEnd:function(t,e){var n=e.isDrag;if(e.datas.isDrag)return this.dragEnd(t,e),kr(t,this,"dragEnd",[0,0],e,!1),pr(t,"onDragGroupEnd",fr(t,e,{targets:t.props.targets})),n},request:function(t){var e={},n=t.getRect(),r=0,i=0;return{isControl:!1,requestStart:function(){return{datas:e}},request:function(t){return"x"in t?r=t.x-n.left:"deltaX"in t&&(r+=t.deltaX),"y"in t?i=t.y-n.top:"deltaY"in t&&(i+=t.deltaY),{datas:e,distX:r,distY:i}},requestEnd:function(){return{datas:e,isDrag:!0}}}},unset:function(t){t.state.dragInfo=null}};function eo(t,e,n,r){void 0===r&&(r="");var i=t.state,o=i.renderPoses,a=i.rotation,s=i.direction,u=t.props,l=u.renderDirections,c=void 0===l?e:l,f=u.zoom,p={};if(!c)return[];var d=s>0?1:-1,h=!0===c?Tn:c,g=a/Math.PI*180;return h.forEach((function(t){p[t]=!0})),h.map((function(t){var e=kn[t];if(!e||!p[t])return null;var i=(Q(g,15)+d*Bn[t]+720)%180;return n.createElement("div",{className:_n("control","direction",t,r),"data-rotation":i,"data-direction":t,key:"direction-"+t,style:er.apply(void 0,vn([a,f],e.map((function(t){return o[t]}))))})}))}function no(t,e,n,r,i,o){for(var a=[],s=6;s<arguments.length;s++)a[s-6]=arguments[s];var u=U(n,r),l=e?Q(u/Math.PI*180,15)%180:-1;return t.createElement("div",{key:"line"+o,className:_n.apply(void 0,vn(["line","direction",e],a)),"data-rotation":l,"data-line-index":o,"data-direction":e,style:tr(n,r,i,u)})}function ro(t,e){return eo(t,Tn,e)}function io(t,e){return eo(t,["nw","ne","sw","se"],e)}function oo(t,e,n,r,i,o){var a=t.state.is3d?4:3,s=Vn(t.state.rootMatrix,i,a),u=ae([o.left,o.top],s);e.startAbsoluteOrigin=u,e.prevDeg=U(u,[n,r])/Math.PI*180,e.prevSnapDeg=e.prevDeg,e.startDeg=e.prevDeg,e.loop=0}function ao(t,e,n,r,i,o){var a=n.prevDeg,s=Ki(t,e,n.origin,r);return n.prevDeg=s,[s-a,s,o+s]}function so(t,e,n,r,i,o,a,s){var u=n.prevDeg,l=n.prevSnapDeg,c=n.startDeg,f=n.loop;u>r&&u>270&&r<90?++n.loop:u<r&&u<90&&r>270&&--n.loop;var p=n.loop,d=360*f+l-c+o,h=360*p+r-c+o;n.prevDeg=h-360*p+c-o;var g=i*((h=Q(h,a))-o);return s&&(h=(g=Ki(t,e,n.origin,g))/i+o),n.prevSnapDeg=h-360*p+c-o,[i*(h-d),g,o+g]}function uo(t,e,n,r,i,o,a,s){return so(t,e,n,U(n.startAbsoluteOrigin,[i,o])/Math.PI*180,r,a,s,!0)}function lo(t,e){if(e.isRequest)return"rotatable"===e.requestAble;var n=e.inputEvent.target;if(et(n,_n("rotation-control")))return!0;var r=t.props.rotationTarget;return!!r&&Dr(r,!0).some((function(t){return!!t&&(n===t||n.contains(t))}))}var co={name:"rotatable",canPinch:!0,props:{rotatable:Boolean,rotationPosition:String,throttleRotate:Number,renderDirections:Object,rotationTarget:Object},events:{onRotateStart:"rotateStart",onRotate:"rotate",onRotateEnd:"rotateEnd",onRotateGroupStart:"rotateGroupStart",onRotateGroup:"rotateGroup",onRotateGroupEnd:"rotateGroupEnd"},css:[".rotation {\n            position: absolute;\n            height: 40px;\n            width: 1px;\n            transform-origin: 50% 100%;\n            height: calc(40px * var(--zoom));\n            top: auto;\n            left: 0;\n            bottom: 100%;\n            will-change: transform;\n        }\n        .rotation .rotation-line {\n            display: block;\n            width: 100%;\n            height: 100%;\n            transform-origin: 50% 50%;\n        }\n        .rotation .rotation-control {\n            border-color: #4af;\n            border-color: var(--moveable-color);\n            background:#fff;\n            cursor: alias;\n        }"],render:function(t,e){var n=t.props,r=n.rotatable,i=n.rotationPosition,o=n.zoom,a=n.renderDirections,s=t.state,u=s.renderPoses,l=s.direction;if(!r)return null;var c=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];if("none"!==t){var s=(t||"top").split("-"),u=s[0],l=s[1],c=[r,i];"left"===u?c=[o,r]:"right"===u?c=[i,a]:"bottom"===u&&(c=[a,o]);var f=[(c[0][0]+c[1][0])/2,(c[0][1]+c[1][1])/2],p=rr(c,n);if(l){var d="top"===l||"left"===l,h="bottom"===u||"left"===u;f=c[d&&!h||!d&&h?0:1]}return[f,p]}}(i,u,l),f=[];if(c){var p=c[0],d=c[1];f.push(e.createElement("div",{key:"rotation",className:_n("rotation"),style:{transform:"translate(-50%) translate("+p[0]+"px, "+p[1]+"px) rotate("+d+"rad)"}},e.createElement("div",{className:_n("line rotation-line"),style:{transform:"scaleX("+o+")"}}),e.createElement("div",{className:_n("control rotation-control"),style:{transform:"translate(0.5px) scale("+o+")"}})))}return a&&f.push.apply(f,eo(t,[],e)),f},dragControlCondition:lo,dragControlStart:function(t,e){var n=e.datas,r=e.clientX,i=e.clientY,o=e.parentRotate,a=e.parentFlag,s=e.isPinch,u=e.isRequest,l=t.state,c=l.target,f=l.left,p=l.top,d=l.origin,h=l.beforeOrigin,g=l.direction,v=l.beforeDirection,m=l.targetTransform,b=l.moveableClientRect;if(!u&&!c)return!1;var y=t.getRect();if(n.rect=y,n.transform=m,n.left=f,n.top=p,n.fixedPosition=Jr(t,Zr(t)),n.absoluteInfo={origin:y.origin,startValue:y.rotation},oo(t,n.absoluteInfo,r,i,d,b),u||s||a){var x=o||0;n.beforeInfo={origin:y.beforeOrigin,prevDeg:x,startDeg:x,prevSnapDeg:x,loop:0},n.afterInfo={origin:y.origin,prevDeg:x,startDeg:x,prevSnapDeg:x,loop:0}}else n.beforeInfo={origin:y.beforeOrigin},n.afterInfo={origin:y.origin},oo(t,n.beforeInfo,r,i,h,b),oo(t,n.afterInfo,r,i,d,b);n.direction=g,n.beforeDirection=v,n.startValue=0,n.datas={},Hr(e,"rotate");var E=cr(t,e,gn(gn({set:function(t){n.startValue=t*Math.PI/180}},Wr(e)),{dragStart:to.dragStart(t,(new Rr).dragStart([0,0],e))})),S=pr(t,"onRotateStart",E);return n.isRotate=!1!==S,t.state.snapRenderInfo={request:e.isRequest},!!n.isRotate&&E},dragControl:function(t,e){var n,r,i,o,a,s,u,l,c,f=e.datas,p=e.clientX,d=e.clientY,h=e.parentRotate,g=e.parentFlag,v=e.isPinch,m=e.groupDelta,b=f.beforeDirection,y=f.beforeInfo,x=f.afterInfo,E=f.absoluteInfo,S=f.isRotate,C=f.startValue,w=f.rect;if(S){Gr(e,"rotate");var D,M,O,P,R,T,k,B,z,_=function(t){return Zn(t.datas.beforeTransform,[50,50],100,100).direction}(e),G=b*_,j=t.props,I=j.throttleRotate,A=void 0===I?0:I,N=j.parentMoveable,F=180/Math.PI*C,Y=E.startValue;if(!g&&"parentDist"in e){var X=e.parentDist;D=(n=ao(t,w,x,X,0,F))[0],M=n[1],O=n[2],P=(r=ao(t,w,y,X,0,F))[0],R=r[1],T=r[2],k=(i=ao(t,w,E,X,0,Y))[0],B=i[1],z=i[2]}else v||g?(D=(o=so(t,w,x,h,G,F,A))[0],M=o[1],O=o[2],P=(a=so(t,w,y,h,b,F,A))[0],R=a[1],T=a[2],k=(s=so(t,w,E,h,G,Y,A))[0],B=s[1],z=s[2]):(D=(u=uo(t,w,x,G,p,d,F,A))[0],M=u[1],O=u[2],P=(l=uo(t,w,y,b,p,d,F,A))[0],R=l[1],T=l[2],k=(c=uo(t,w,E,G,p,d,Y,A))[0],B=c[1],z=c[2]);if(k||D||P||N){var L=jr(f,"rotate("+O+"deg)","rotate("+M+"deg)"),q=function(t,e,n,r){return Ur(t,"rotate("+e+"deg)",Zr(t),n,r)}(t,M,f.fixedPosition,f),W=se(ae(m||[0,0],q),f.prevInverseDist||[0,0]);f.prevInverseDist=q;var H=cr(t,e,gn({delta:D,dist:M,rotate:O,beforeDist:R,beforeDelta:P,beforeRotate:T,absoluteDist:B,absoluteDelta:k,absoluteRotate:z,isPinch:!!v},Kr(t,L,W,v,e)));return pr(t,"onRotate",H),H}}},dragControlEnd:function(t,e){var n=e.datas,r=e.isDrag;return!!n.isRotate&&(n.isRotate=!1,pr(t,"onRotateEnd",fr(t,e,{})),r)},dragGroupControlCondition:lo,dragGroupControlStart:function(t,e){var n=e.datas,r=t.state,i=r.left,o=r.top,a=r.beforeOrigin,s=this.dragControlStart(t,e);if(!s)return!1;s.set(n.beforeDirection*t.rotation);var u=Br(t,this,"dragControlStart",e,(function(t,e){var n=t.state,r=n.left,s=n.top,u=n.beforeOrigin,l=ae(se([r,s],[i,o]),se(u,a));return e.datas.groupClient=l,gn(gn({},e),{parentRotate:0})})),l=pr(t,"onRotateGroupStart",gn(gn({},s),{targets:t.props.targets,events:u}));return n.isRotate=!1!==l,!!n.isRotate&&s},dragGroupControl:function(t,e){var n=e.datas;if(n.isRotate){var r=this.dragControl(t,e);if(r){var i=n.beforeDirection,o=r.beforeDist,a=r.beforeDelta/180*Math.PI,s=Br(t,this,"dragControl",e,(function(t,e){var n=e.datas.groupClient,r=n[0],s=n[1],u=he([r,s],a*i),l=u[0],c=u[1],f=[l-r,c-s];return e.datas.groupClient=[l,c],gn(gn({},e),{parentRotate:o,groupDelta:f})}));t.rotation=i*r.beforeRotate;var u=gn({targets:t.props.targets,events:s,set:function(e){t.rotation=e}},r);return pr(t,"onRotateGroup",u),u}}},dragGroupControlEnd:function(t,e){var n=e.isDrag;if(e.datas.isRotate)return this.dragControlEnd(t,e),Br(t,this,"dragControlEnd",e),pr(t,"onRotateGroupEnd",fr(t,e,{targets:t.props.targets})),n},request:function(t){var e={},n=0,r=t.getRotation();return{isControl:!0,requestStart:function(){return{datas:e}},request:function(t){return"deltaRotate"in t?n+=t.deltaRotate:"rotate"in t&&(n=t.rotate-r),{datas:e,parentDist:n}},requestEnd:function(){return{datas:e,isDrag:!0}}}}},fo={name:"resizable",ableGroup:"size",canPinch:!0,props:{resizable:Boolean,throttleResize:Number,renderDirections:Array,keepRatio:Boolean},events:{onResizeStart:"resizeStart",onResize:"resize",onResizeEnd:"resizeEnd",onResizeGroupStart:"resizeGroupStart",onResizeGroup:"resizeGroup",onResizeGroupEnd:"resizeGroupEnd"},render:function(t,e){var n=t.props,r=n.resizable,i=n.edge;if(r)return i?io(t,e):ro(t,e)},dragControlCondition:Sr,dragControlStart:function(t,e){var n,r=e.inputEvent,i=e.isPinch,o=e.parentDirection,a=e.datas,s=e.parentFlag,u=o||(i?[0,0]:ar(r.target)),l=t.state,c=l.target,f=l.width,p=l.height;if(!u||!c)return!1;!i&&_r(t,e),a.datas={},a.direction=u,a.startOffsetWidth=f,a.startOffsetHeight=p,a.prevWidth=0,a.prevHeight=0,n=function(t){var e=dr(t);return[parseFloat(e.width),parseFloat(e.height)]}(c),a.startWidth=n[0],a.startHeight=n[1];var d=[Math.max(0,f-a.startWidth),Math.max(0,p-a.startHeight)];if(a.minSize=d,a.maxSize=[1/0,1/0],!s){var h=dr(c),g=h.position,v=h.minWidth,m=h.minHeight,b=h.maxWidth,y=h.maxHeight,x="static"===g||"relative"===g,E=x?c.parentElement:c.offsetParent,S=f,C=p;if(E&&(S=E.clientWidth,C=E.clientHeight,x)){var w=dr(E);S-=parseFloat(w.paddingLeft)||0,C-=parseFloat(w.paddingTop)||0}a.minSize=ae([W(v,S)||0,W(m,C)||0],d),a.maxSize=ae([W(b,S)||1/0,W(y,C)||1/0],d)}var D=t.props.transformOrigin||"% %";function M(t){a.ratio=t&&isFinite(t)?t:0}function O(e){a.fixedDirection=e,a.fixedPosition=ti(t,e)}a.transformOrigin=D&&T(D)?D.split(" "):D,a.isWidth=!u[0]&&!u[1]||u[0]||!u[1],M(f/p),O([-u[0],-u[1]]);var P=cr(t,e,{direction:u,set:function(t){var e=t[0],n=t[1];a.startWidth=e,a.startHeight=n},setMin:function(t){a.minSize=t},setMax:function(t){a.maxSize=[t[0]||1/0,t[1]||1/0]},setRatio:M,setFixedDirection:O,setOrigin:function(t){a.transformOrigin=t},dragStart:to.dragStart(t,(new Rr).dragStart([0,0],e))});return!1!==pr(t,"onResizeStart",P)&&(a.isResize=!0,t.state.snapRenderInfo={request:e.isRequest,direction:u}),!!a.isResize&&P},dragControl:function(t,e){var n,r=e.datas,i=e.distX,o=e.distY,a=e.parentFlag,s=e.isPinch,u=e.parentDistance,l=e.parentScale,c=e.parentKeepRatio,f=e.dragClient,p=e.parentDist,d=e.isRequest,h=r.isResize,g=r.transformOrigin,v=r.fixedDirection,m=r.startWidth,b=r.startHeight,y=r.prevWidth,x=r.prevHeight,E=r.minSize,S=r.maxSize,C=r.ratio,w=r.isWidth,D=r.startOffsetWidth,M=r.startOffsetHeight;if(h){var O=t.props,P=O.throttleResize,R=void 0===P?0:P,T=O.parentMoveable,k=O.snapThreshold,B=void 0===k?5:k,z=r.direction,_=z,G=0,j=0;z[0]||z[1]||(_=[1,1]);var I=C&&(t.props.keepRatio||c),A=f;if(f||(A=!a&&s?ti(t,[0,0]):r.fixedPosition),p)G=p[0],j=p[1],I&&(G?j||(j=G/C):G=j*C);else if(l)G=(l[0]-1)*D,j=(l[1]-1)*M;else if(s)u&&(G=u,j=u*M/D);else{var N=Fr({datas:r,distX:i,distY:o});if(G=_[0]*N[0],j=_[1]*N[1],I&&D&&M){var F=U([0,0],N),Y=U([0,0],_),X=Jn([G,j]),L=Math.cos(F-Y)*X;if(_[0])if(_[1]){var q=2*_[0]*D,W=2*_[1]*M,H=Jn([q+N[0],W+N[1]])-Jn([q,W]),V=U([0,0],[C,1]);G=Math.cos(V)*H,j=Math.sin(V)*H}else j=(G=L)*C;else G=(j=L)/C}else if(!I){var K=vn(z);D||(N[0]<0?K[0]=-1:N[0]>0&&(K[0]=1)),M||(N[1]<0?K[1]=-1:N[1]>0&&(K[1]=1)),z=K,G=(_=K)[0]*N[0],j=_[1]*N[1]}}var Z=_[0]||I?Math.max(D+G,Mn):D,J=_[1]||I?Math.max(M+j,Mn):M;I&&D&&M&&(w?J=Z/C:Z=J*C);var tt=[0,0];if(s||(tt=function(t,e,n,r,i,o,a){if(!oi(t,"resizable"))return[0,0];var s=t.state,u=s.allMatrix,l=s.is3d;return $i(t,(function(t,o){return Hi(u,e+t,n+o,i,r,l)}),e,n,r,i,o,a)}(t,Z,J,z,A,d,r)),p&&(!p[0]&&(tt[0]=0),!p[1]&&(tt[1]=0)),I){_[0]&&_[1]&&tt[0]&&tt[1]&&(Math.abs(tt[0])>Math.abs(tt[1])?tt[1]=0:tt[0]=0);var et=!tt[0]&&!tt[1];et&&(w?Z=Q(Z,R):J=Q(J,R)),_[0]&&!_[1]||tt[0]&&!tt[1]||et&&w?J=(Z+=tt[0])/C:(!_[0]&&_[1]||!tt[0]&&tt[1]||et&&!w)&&(Z=(J+=tt[1])*C)}else D+G<-B&&(tt[0]=0),D+j<-B&&(tt[1]=0),Z+=tt[0],J+=tt[1],tt[0]||(Z=Q(Z,R)),tt[1]||(J=Q(J,R));Z=(n=$([Z,J],E,S,I))[0],J=n[1];var nt=[(G=(Z=Math.round(Z))-D)-y,(j=(J=Math.round(J))-M)-x];r.prevWidth=G,r.prevHeight=j;var rt=Qr(t,Z,J,v,A,g);if(T||!nt.every((function(t){return!t}))||!rt.every((function(t){return!t}))){var it=cr(t,e,{width:m+G,height:b+j,offsetWidth:Z,offsetHeight:J,direction:z,dist:[G,j],delta:nt,isPinch:!!s,drag:to.drag(t,Pr(e,t.state,rt,!!s,!1))});return pr(t,"onResize",it),it}}},dragControlAfter:function(t,e){var n=e.datas,r=n.isResize,i=n.startOffsetWidth,o=n.startOffsetHeight,a=n.prevWidth,s=n.prevHeight;if(r){var u=t.state,l=u.width-(i+a),c=u.height-(o+s),f=Math.abs(l)>3,p=Math.abs(c)>3;return f&&(n.startWidth+=l,n.startOffsetWidth+=l,n.prevWidth+=l),p&&(n.startHeight+=c,n.startOffsetHeight+=c,n.prevHeight+=c),f||p?(this.dragControl(t,e),!0):void 0}},dragControlEnd:function(t,e){var n=e.datas,r=e.isDrag;return!!n.isResize&&(n.isResize=!1,pr(t,"onResizeEnd",fr(t,e,{})),r)},dragGroupControlCondition:Sr,dragGroupControlStart:function(t,e){var n=e.datas,r=this.dragControlStart(t,e);if(!r)return!1;var i=Tr(t,"resizable",e);function o(e,r){var i=n.fixedDirection,o=n.fixedPosition,a=ti(e,i),s=le(me(-t.rotation/180*Math.PI,3),[a[0]-o[0],a[1]-o[1],1],3),u=s[0],l=s[1];return r.datas.originalX=u,r.datas.originalY=l,r}var a=Br(t,this,"dragControlStart",e,(function(t,e){return o(t,e)})),s=gn(gn({},r),{targets:t.props.targets,events:a,setFixedDirection:function(e){r.setFixedDirection(e),a.forEach((function(n,r){n.setFixedDirection(e),o(t.moveables[r],i[r])}))}}),u=pr(t,"onResizeGroupStart",s);return n.isResize=!1!==u,!!n.isResize&&r},dragGroupControl:function(t,e){var n=e.datas;if(n.isResize){var r=this.dragControl(t,e);if(r){var i=r.offsetWidth,o=r.offsetHeight,a=r.dist,s=t.props.keepRatio,u=[i/(i-a[0]),o/(o-a[1])],l=n.fixedPosition,c=Br(t,this,"dragControl",e,(function(e,n){var r=le(me(t.rotation/180*Math.PI,3),[n.datas.originalX*u[0],n.datas.originalY*u[1],1],3),i=r[0],o=r[1];return gn(gn({},n),{parentDist:null,parentScale:u,dragClient:ae(l,[i,o]),parentKeepRatio:s})})),f=gn({targets:t.props.targets,events:c},r);return pr(t,"onResizeGroup",f),f}}},dragGroupControlEnd:function(t,e){var n=e.isDrag;if(e.datas.isResize)return this.dragControlEnd(t,e),Br(t,this,"dragControlEnd",e),pr(t,"onResizeGroupEnd",fr(t,e,{targets:t.props.targets})),n},request:function(t){var e={},n=0,r=0,i=t.getRect();return{isControl:!0,requestStart:function(t){return{datas:e,parentDirection:t.direction||[1,1]}},request:function(t){return"offsetWidth"in t?n=t.offsetWidth-i.offsetWidth:"deltaWidth"in t&&(n+=t.deltaWidth),"offsetHeight"in t?r=t.offsetHeight-i.offsetHeight:"deltaHeight"in t&&(r+=t.deltaHeight),{datas:e,parentDist:[n,r]}},requestEnd:function(){return{datas:e,isDrag:!0}}}}},po={name:"scalable",ableGroup:"size",canPinch:!0,props:{scalable:Boolean,throttleScale:Number,renderDirections:String,keepRatio:Boolean},events:{onScaleStart:"scaleStart",onScale:"scale",onScaleEnd:"scaleEnd",onScaleGroupStart:"scaleGroupStart",onScaleGroup:"scaleGroup",onScaleGroupEnd:"scaleGroupEnd"},render:function(t,e){var n=t.props,r=n.resizable,i=n.scalable,o=n.edge;if(!r&&i)return o?io(t,e):ro(t,e)},dragControlCondition:Sr,dragControlStart:function(t,e){var n=e.datas,r=e.isPinch,i=e.inputEvent,o=e.parentDirection||(r?[0,0]:ar(i.target)),a=t.state,s=a.width,u=a.height,l=a.targetTransform,c=a.target,f=a.pos1,p=a.pos2,d=a.pos4;if(!o||!c)return!1;r||_r(t,e),n.datas={},n.transform=l,n.prevDist=[1,1],n.direction=o,n.width=s,n.height=u,n.startValue=[1,1];var h=J(f,p),g=J(p,d),v=!o[0]&&!o[1]||o[0]||!o[1];function m(t){n.ratio=t&&isFinite(t)?t:0}function b(e){n.fixedDirection=e,n.fixedPosition=ti(t,e)}n.scaleWidth=h,n.scaleHeight=g,n.scaleXRatio=h/s,n.scaleYRatio=g/u,Hr(e,"scale"),n.isWidth=v,m(J(f,p)/J(p,d)),b([-o[0],-o[1]]);var y=cr(t,e,gn(gn({direction:o,set:function(t){n.startValue=t},setRatio:m,setFixedDirection:b},Wr(e)),{dragStart:to.dragStart(t,(new Rr).dragStart([0,0],e))}));return!1!==pr(t,"onScaleStart",y)&&(n.isScale=!0,t.state.snapRenderInfo={request:e.isRequest,direction:o}),!!n.isScale&&y},dragControl:function(t,e){Gr(e,"scale");var n=e.datas,r=e.distX,i=e.distY,o=e.parentScale,a=e.parentDistance,s=e.parentKeepRatio,u=e.parentFlag,l=e.isPinch,c=e.dragClient,f=e.parentDist,p=e.isRequest,d=n.prevDist,h=n.direction,g=n.width,v=n.height,m=n.isScale,b=n.startValue,y=n.isWidth,x=n.ratio,E=n.fixedDirection,S=n.scaleXRatio,C=n.scaleYRatio;if(!m)return!1;var w=t.props,D=w.throttleScale,M=w.parentMoveable,O=h;h[0]||h[1]||(O=[1,1]);var P=x&&(t.props.keepRatio||s),T=t.state,k=1,B=1,z=c;if(c||(z=!u&&l?ti(t,[0,0]):n.fixedPosition),f)k=(g+f[0])/g,B=(v+f[1])/v;else if(o)k=o[0],B=o[1];else if(l)a&&(k=(g+a)/g,B=(v+a*v/g)/v);else{var _=Fr({datas:n,distX:r,distY:i}),G=O[0]*_[0]*S,j=O[1]*_[1]*C;if(P&&g&&v)if(O[0])if(O[1]){var I=Jn([G,j]),A=U([0,0],_),N=U([0,0],O),F=Math.cos(A-N)*I,Y=U([0,0],[x,1]);G=Math.cos(Y)*F,j=Math.sin(Y)*F}else j=G/x;else G=j*x;k=(g+G/S)/g,B=(v+j/C)/v}k=O[0]||P?k*b[0]:b[0],B=O[1]||P?B*b[1]:b[1],0===k&&(k=(d[0]>0?1:-1)*On),0===B&&(B=(d[1]>0?1:-1)*On);var X=[k/b[0],B/b[1]],L=[k,B];if(!l&&t.props.groupable){var q=(T.snapRenderInfo||{}).direction;R(q)&&(q[0]||q[1])&&(T.snapRenderInfo={direction:h,request:e.isRequest})}var W=[0,0];if(l||(W=Ui(t,X,h,p,n)),P){O[0]&&O[1]&&W[0]&&W[1]&&(Math.abs(W[0]*g)>Math.abs(W[1]*v)?W[1]=0:W[0]=0);var H=!W[0]&&!W[1];if(H&&(y?X[0]=Q(X[0]*b[0],D)/b[0]:X[1]=Q(X[1]*b[1],D)/b[1]),O[0]&&!O[1]||W[0]&&!W[1]||H&&y){X[0]+=W[0];var V=g*X[0]*b[0]/x;X[1]=V/v/b[1]}else if(!O[0]&&O[1]||!W[0]&&W[1]||H&&!y){X[1]+=W[1];var $=v*X[1]*b[1]*x;X[0]=$/g/b[0]}}else X[0]+=W[0],X[1]+=W[1],W[0]||(X[0]=Q(X[0]*b[0],D)/b[0]),W[1]||(X[1]=Q(X[1]*b[1],D)/b[1]);0===X[0]&&(X[0]=(d[0]>0?1:-1)*On),0===X[1]&&(X[1]=(d[1]>0?1:-1)*On);var K,Z,J=[X[0]/d[0],X[1]/d[1]];Z=b,L=[(K=X)[0]*Z[0],K[1]*Z[1]];var tt=function(t,e,n,r,i){return Ur(t,"scale("+e.join(", ")+")",n,r,i)}(t,X,E,z,n),et=se(tt,n.prevInverseDist||[0,0]);if(n.prevDist=X,n.prevInverseDist=tt,k===d[0]&&B===d[1]&&et.every((function(t){return!t}))&&!M)return!1;var nt=jr(n,"scale("+L.join(", ")+")","scale("+X.join(", ")+")"),rt=cr(t,e,gn({offsetWidth:g,offsetHeight:v,direction:h,scale:L,dist:X,delta:J,isPinch:!!l},Kr(t,nt,et,l,e)));return pr(t,"onScale",rt),rt},dragControlEnd:function(t,e){var n=e.datas,r=e.isDrag;return!!n.isScale&&(n.isScale=!1,pr(t,"onScaleEnd",fr(t,e,{})),r)},dragGroupControlCondition:Sr,dragGroupControlStart:function(t,e){var n=e.datas,r=this.dragControlStart(t,e);if(!r)return!1;var i=Tr(t,"resizable",e);function o(e,r){var i=n.fixedDirection,o=n.fixedPosition,a=ti(e,i),s=le(me(-t.rotation/180*Math.PI,3),[a[0]-o[0],a[1]-o[1],1],3),u=s[0],l=s[1];return r.datas.originalX=u,r.datas.originalY=l,r}n.moveableScale=t.scale;var a=Br(t,this,"dragControlStart",e,(function(t,e){return o(t,e)})),s=gn(gn({},r),{targets:t.props.targets,events:a,setFixedDirection:function(e){r.setFixedDirection(e),a.forEach((function(n,r){n.setFixedDirection(e),o(t.moveables[r],i[r])}))}}),u=pr(t,"onScaleGroupStart",s);return n.isScale=!1!==u,!!n.isScale&&s},dragGroupControl:function(t,e){var n=e.datas;if(n.isScale){var r=this.dragControl(t,e);if(r){var i=n.moveableScale;t.scale=[r.scale[0]*i[0],r.scale[1]*i[1]];var o=t.props.keepRatio,a=r.dist,s=r.scale,u=n.fixedPosition,l=Br(t,this,"dragControl",e,(function(e,n){var r=le(me(t.rotation/180*Math.PI,3),[n.datas.originalX*a[0],n.datas.originalY*a[1],1],3),i=r[0],l=r[1];return gn(gn({},n),{parentDist:null,parentScale:s,parentKeepRatio:o,dragClient:ae(u,[i,l])})})),c=gn({targets:t.props.targets,events:l},r);return pr(t,"onScaleGroup",c),c}}},dragGroupControlEnd:function(t,e){var n=e.isDrag;if(e.datas.isScale)return this.dragControlEnd(t,e),Br(t,this,"dragControlEnd",e),pr(t,"onScaleGroupEnd",fr(t,e,{targets:t.props.targets})),n},request:function(){var t={},e=0,n=0;return{isControl:!0,requestStart:function(e){return{datas:t,parentDirection:e.direction||[1,1]}},request:function(r){return e+=r.deltaWidth,n+=r.deltaHeight,{datas:t,parentDist:[e,n]}},requestEnd:function(){return{datas:t,isDrag:!0}}}}};function ho(t,e){return t.map((function(t,n){return r=t,i=e[n],(r*(a=2)+i*(o=1))/(o+a);var r,i,o,a}))}function go(t,e,n){var r=U(t,e),i=U(t,n)-r;return i>=0?i:i+2*Math.PI}var vo={name:"warpable",ableGroup:"size",props:{warpable:Boolean,renderDirections:Array},events:{onWarpStart:"warpStart",onWarp:"warp",onWarpEnd:"warpEnd"},render:function(t,e){var n=t.props,r=n.resizable,i=n.scalable,o=n.warpable,a=n.zoom;if(r||i||!o)return[];var s=t.state,u=s.pos1,l=s.pos2,c=s.pos3,f=s.pos4,p=ho(u,l),d=ho(l,u),h=ho(u,c),g=ho(c,u),v=ho(c,f),m=ho(f,c),b=ho(l,f),y=ho(f,l);return vn([e.createElement("div",{className:_n("line"),key:"middeLine1",style:tr(p,v,a)}),e.createElement("div",{className:_n("line"),key:"middeLine2",style:tr(d,m,a)}),e.createElement("div",{className:_n("line"),key:"middeLine3",style:tr(h,b,a)}),e.createElement("div",{className:_n("line"),key:"middeLine4",style:tr(g,y,a)})],ro(t,e))},dragControlCondition:function(t,e){return!e.isRequest&&et(e.inputEvent.target,_n("direction"))},dragControlStart:function(t,e){var n=e.datas,r=e.inputEvent,i=t.props.target,o=ar(r.target);if(!o||!i)return!1;var a=t.state,s=a.transformOrigin,u=a.is3d,l=a.targetTransform,c=a.targetMatrix,f=a.width,p=a.height,d=a.left,h=a.top;return n.datas={},n.targetTransform=l,n.warpTargetMatrix=u?c:re(c,3,4),n.targetInverseMatrix=te(ee(n.warpTargetMatrix,4),3,4),n.direction=o,n.left=d,n.top=h,n.poses=[[0,0],[f,0],[0,p],[f,p]].map((function(t){return se(t,s)})),n.nextPoses=n.poses.map((function(t){var e=t[0],r=t[1];return le(n.warpTargetMatrix,[e,r,0,1],4)})),n.startValue=be(4),n.prevMatrix=be(4),n.absolutePoses=ur(a),n.posIndexes=Yr(o),_r(t,e),Hr(e,"matrix3d"),a.snapRenderInfo={request:e.isRequest,direction:o},!1!==pr(t,"onWarpStart",cr(t,e,gn({set:function(t){n.startValue=t}},Wr(e))))&&(n.isWarp=!0),n.isWarp},dragControl:function(t,e){var n=e.datas,r=e.isRequest,i=e.distX,o=e.distY,a=n.targetInverseMatrix,s=n.prevMatrix,u=n.isWarp,l=n.startValue,c=n.poses,f=n.posIndexes,p=n.absolutePoses;if(!u)return!1;if(Gr(e,"matrix3d"),oi(t,"warpable")){var d=f.map((function(t){return p[t]}));d.length>1&&d.push([(d[0][0]+d[1][0])/2,(d[0][1]+d[1][1])/2]);var h=Yi(t,r,{horizontal:d.map((function(t){return t[1]+o})),vertical:d.map((function(t){return t[0]+i}))}),g=h.horizontal,v=h.vertical;o-=g.offset,i-=v.offset}var m=Fr({datas:n,distX:i,distY:o},!0),b=n.nextPoses.slice();if(f.forEach((function(t){b[t]=ae(b[t],m)})),!Dn.every((function(t){return e=t.map((function(t){return c[t]})),n=t.map((function(t){return b[t]})),r=go(e[0],e[1],e[2]),i=go(n[0],n[1],n[2]),o=Math.PI,!(r>=o&&i<=o||r<=o&&i>=o);var e,n,r,i,o})))return!1;var y=Ee(c[0],c[2],c[1],c[3],b[0],b[2],b[1],b[3]);if(!y.length)return!1;var x=Ar(n,oe(a,y,4),!0),E=oe(ee(s,4),x,4);n.prevMatrix=x;var S=oe(l,x,4),C=jr(n,"matrix3d("+S.join(", ")+")","matrix3d("+x.join(", ")+")");return $r(e,C),pr(t,"onWarp",cr(t,e,{delta:E,matrix:S,dist:x,multiply:oe,transform:C})),!0},dragControlEnd:function(t,e){var n=e.datas,r=e.isDrag;return!!n.isWarp&&(n.isWarp=!1,pr(t,"onWarpEnd",fr(t,e,{})),r)}},mo=_n("area-pieces"),bo=_n("area-piece"),yo=_n("avoid");function xo(t){var e=t.areaElement,n=t.state,r=n.width,i=n.height;!function(t,e){if(t.classList)t.classList.remove(e);else{var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")}}(e,yo),e.style.cssText+="left: 0px; top: 0px; width: "+r+"px; height: "+i+"px"}function Eo(t){return t.createElement("div",{key:"area_pieces",className:mo},t.createElement("div",{className:bo}),t.createElement("div",{className:bo}),t.createElement("div",{className:bo}),t.createElement("div",{className:bo}))}var So={name:"dragArea",props:{dragArea:Boolean,passDragArea:Boolean},events:{onClick:"click",onClickGroup:"clickGroup"},render:function(t,e){var n=t.props,r=n.target,i=n.dragArea,o=n.groupable,a=n.passDragArea,s=t.state,u=s.width,l=s.height,c=s.renderPoses,f=a?_n("area","pass"):_n("area");if(o)return[e.createElement("div",{key:"area",ref:p(t,"areaElement"),className:f}),Eo(e)];if(!r||!i)return[];var d=Ee([0,0],[u,0],[0,l],[u,l],c[0],c[1],c[2],c[3]),h=d.length?qn(d,!0):"none";return[e.createElement("div",{key:"area",ref:p(t,"areaElement"),className:f,style:{top:"0px",left:"0px",width:u+"px",height:l+"px",transformOrigin:"0 0",transform:h}}),Eo(e)]},dragStart:function(t,e){var n=e.datas,r=e.clientX,i=e.clientY;if(!e.inputEvent)return!1;n.isDragArea=!1;var o=t.areaElement,a=t.state,s=a.moveableClientRect,u=a.renderPoses,l=a.rootMatrix,c=a.is3d,f=s.left,p=s.top,d=Kn(u),h=d.left,g=d.top,v=d.width,m=d.height,b=mr(l,[r-f,i-p],c?4:3),y=b[0],x=b[1],E=[{left:h,top:g,width:v,height:(x-=g)-10},{left:h,top:g,width:(y-=h)-10,height:m},{left:h,top:g+x+10,width:v,height:m-x-10},{left:h+y+10,top:g,width:v-y-10,height:m}],S=[].slice.call(o.nextElementSibling.children);E.forEach((function(t,e){S[e].style.cssText="left: "+t.left+"px;top: "+t.top+"px; width: "+t.width+"px; height: "+t.height+"px;"})),nt(o,yo),a.disableNativeEvent=!0},drag:function(t,e){var n=e.datas,r=e.inputEvent;if(this.enableNativeEvent(t),!r)return!1;n.isDragArea||(n.isDragArea=!0,xo(t))},dragEnd:function(t,e){this.enableNativeEvent(t);var n=e.inputEvent,r=e.datas;if(!n)return!1;r.isDragArea||xo(t)},dragGroupStart:function(t,e){return this.dragStart(t,e)},dragGroup:function(t,e){return this.drag(t,e)},dragGroupEnd:function(t,e){return this.dragEnd(t,e)},unset:function(t){xo(t),t.state.disableNativeEvent=!1},enableNativeEvent:function(t){var e=t.state;e.disableNativeEvent&&requestAnimationFrame((function(){e.disableNativeEvent=!1}))}},Co=mn("origin",{render:function(t,e){var n=t.props.zoom,r=t.state,i=r.beforeOrigin,o=r.rotation;return[e.createElement("div",{className:_n("control","origin"),style:er(o,n,i),key:"beforeOrigin"})]}});function wo(t){var e=t.scrollContainer;return[e.scrollLeft,e.scrollTop]}var Do={name:"scrollable",canPinch:!0,props:{scrollable:Boolean,scrollContainer:Object,scrollThreshold:Number,getScrollPosition:Function},events:{onScroll:"scroll",onScrollGroup:"scrollGroup"},dragStart:function(t,e){var n=t.props.scrollContainer,r=void 0===n?t.getContainer():n,i=new We,o=wr(r,!0);e.datas.dragScroll=i;var a=e.isControl?"controlGesto":"targetGesto",s=e.targets;i.on("scroll",(function(n){var r=n.container,i=n.direction,o=cr(t,e,{scrollContainer:r,direction:i}),a=s?"onScrollGroup":"onScroll";s&&(o.targets=s),pr(t,a,o)})).on("move",(function(n){var r=n.offsetX,i=n.offsetY;t[a].scrollBy(r,i,e.inputEvent,!1)})),i.dragStart(e,{container:o})},checkScroll:function(t,e){var n=e.datas.dragScroll;if(n){var r=t.props,i=r.scrollContainer,o=void 0===i?t.getContainer():i,a=r.scrollThreshold,s=void 0===a?0:a,u=r.getScrollPosition,l=void 0===u?wo:u;return n.drag(e,{container:o,threshold:s,getScrollPosition:function(t){return l({scrollContainer:t.container,direction:t.direction})}}),!0}},drag:function(t,e){return this.checkScroll(t,e)},dragEnd:function(t,e){e.datas.dragScroll.dragEnd(),e.datas.dragScroll=null},dragControlStart:function(t,e){return this.dragStart(t,gn(gn({},e),{isControl:!0}))},dragControl:function(t,e){return this.drag(t,e)},dragControlEnd:function(t,e){return this.dragEnd(t,e)},dragGroupStart:function(t,e){return this.dragStart(t,gn(gn({},e),{targets:t.props.targets}))},dragGroup:function(t,e){return this.drag(t,gn(gn({},e),{targets:t.props.targets}))},dragGroupEnd:function(t,e){return this.dragEnd(t,gn(gn({},e),{targets:t.props.targets}))},dragGroupControlStart:function(t,e){return this.dragStart(t,gn(gn({},e),{targets:t.props.targets,isControl:!0}))},dragGroupContro:function(t,e){return this.drag(t,gn(gn({},e),{targets:t.props.targets}))},dragGroupControEnd:function(t,e){return this.dragEnd(t,gn(gn({},e),{targets:t.props.targets}))}},Mo={name:"",props:{target:Object,dragTarget:Object,container:Object,portalContainer:Object,rootContainer:Object,zoom:Number,transformOrigin:Array,edge:Boolean,ables:Array,className:String,pinchThreshold:Number,pinchOutside:Boolean,triggerAblesSimultaneously:Boolean,checkInput:Boolean,cspNonce:String,translateZ:Number,hideDefaultLines:Boolean,props:Object},events:{}},Oo=mn("padding",{render:function(t,e){var n=t.props;if(n.dragArea)return[];var r=n.padding||{},i=r.left,o=void 0===i?0:i,a=r.top,s=void 0===a?0:a,u=r.right,l=void 0===u?0:u,c=r.bottom,f=void 0===c?0:c,p=t.state,d=p.renderPoses,h=[p.pos1,p.pos2,p.pos3,p.pos4],g=[];return o>0&&g.push([0,2]),s>0&&g.push([0,1]),l>0&&g.push([1,3]),f>0&&g.push([2,3]),g.map((function(t,n){var r=t[0],i=t[1],o=Ee([0,0],[100,0],[0,100],[100,100],h[r],h[i],d[r],d[i]);if(o.length)return e.createElement("div",{key:"padding"+n,className:_n("padding"),style:{transform:qn(o,!0)}})}))}}),Po=["nw","ne","se","sw"];function Ro(t,e){var n=t[0]+t[1],r=n>e?e/n:1;return t[0]*=r,t[1]=e-t[1]*r,t}var To=[1,2,5,6],ko=[0,3,4,7],Bo=[1,-1,-1,1],zo=[1,1,-1,-1];function _o(t,e,n,r,i,o,a,s,u){void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=r),void 0===u&&(u=i);var l=[],c=!1,f=t.map((function(t,f){var p=e[f],d=p.horizontal,h=p.vertical;if(h&&!c&&(c=!0,l.push("/")),c){var g=Math.max(0,1===h?t[1]-a:u-t[1]);return l.push(xr(g,i,n)),g}g=Math.max(0,1===d?t[0]-o:s-t[0]);return l.push(xr(g,r,n)),g}));return{styles:l,raws:f}}function Go(t){for(var e=[0,0],n=[0,0],r=t.length,i=0;i<r;++i){var o=t[i];o.sub&&(o.horizontal&&(0===e[1]&&(e[0]=i),e[1]=i-e[0]+1,n[0]=i+1),o.vertical&&(0===n[1]&&(n[0]=i),n[1]=i-n[0]+1))}return{horizontalRange:e,verticalRange:n}}function jo(t,e,n,r,i,o){var a,s,u,l;void 0===o&&(o=[0,0]);var c=t.indexOf("/"),f=(c>-1?t.slice(0,c):t).length,p=t.slice(0,f),d=t.slice(f+1),h=p[0],g=void 0===h?"0px":h,v=p[1],m=void 0===v?g:v,b=p[2],y=void 0===b?g:b,x=p[3],E=void 0===x?m:x,S=d[0],C=void 0===S?g:S,w=d[1],D=void 0===w?C:w,M=d[2],O=void 0===M?C:M,P=d[3],R=void 0===P?D:P,T=[g,m,y,E].map((function(t){return W(t,e)})),k=[C,D,O,R].map((function(t){return W(t,n)})),B=T.slice(),z=k.slice();a=Ro([B[0],B[1]],e),B[0]=a[0],B[1]=a[1],s=Ro([B[3],B[2]],e),B[3]=s[0],B[2]=s[1],u=Ro([z[0],z[3]],n),z[0]=u[0],z[3]=u[1],l=Ro([z[1],z[2]],n),z[1]=l[0],z[2]=l[1];var _=B.slice(0,Math.max(o[0],p.length)),G=z.slice(0,Math.max(o[1],d.length));return vn(_.map((function(t,e){var o=Po[e];return{horizontal:Bo[e],vertical:0,pos:[r+t,i+(-1===zo[e]?n:0)],sub:!0,raw:T[e],direction:o}})),G.map((function(t,n){var o=Po[n];return{horizontal:0,vertical:zo[n],pos:[r+(-1===Bo[n]?e:0),i+t],sub:!0,raw:k[n],direction:o}})))}function Io(t,e,n,r,i){void 0===i&&(i=e.length);var o=Go(t.slice(r)),a=o.horizontalRange,s=o.verticalRange,u=n-r,l=0;if(0===u)l=i;else if(u>0&&u<a[1])l=a[1]-u;else{if(!(u>=s[0]))return;l=s[0]+s[1]-u}t.splice(n,l),e.splice(n,l)}function Ao(t,e,n,r,i,o,a,s,u,l,c){void 0===l&&(l=0),void 0===c&&(c=0);var f=Go(t.slice(n)),p=f.horizontalRange,d=f.verticalRange;if(r>-1)for(var h=1===Bo[r]?o-l:s-o,g=p[1];g<=r;++g){var v=1===zo[g]?c:u,m=0;if(r===g?m=o:0===g?m=l+h:-1===Bo[g]&&(m=s-(e[n][0]-l)),t.splice(n+g,0,{horizontal:Bo[g],vertical:0,pos:[m,v]}),e.splice(n+g,0,[m,v]),0===g)break}else if(i>-1){var b=1===zo[i]?a-c:u-a;if(0===p[1]&&0===d[1]){var y=[l+b,c];t.push({horizontal:Bo[0],vertical:0,pos:y}),e.push(y)}var x=d[0];for(g=d[1];g<=i;++g){m=1===Bo[g]?l:s,v=0;if(i===g?v=a:0===g?v=c+b:1===zo[g]?v=e[n+x][1]:-1===zo[g]&&(v=u-(e[n+x][1]-c)),t.push({horizontal:0,vertical:zo[g],pos:[m,v]}),e.push([m,v]),0===g)break}}}function No(t,e){return void 0===e&&(e=t.map((function(t){return t.raw}))),{horizontals:t.map((function(t,n){return t.horizontal?e[n]:null})).filter((function(t){return null!=t})),verticals:t.map((function(t,n){return t.vertical?e[n]:null})).filter((function(t){return null!=t}))}}var Fo=[[0,-1,"n"],[1,0,"e"]],Yo=[[-1,-1,"nw"],[0,-1,"n"],[1,-1,"ne"],[1,0,"e"],[1,1,"se"],[0,1,"s"],[-1,1,"sw"],[-1,0,"w"]];function Xo(t,e,n){var r=t.props.clipRelative,i=t.state,o=i.width,a=i.height,s=e,u=s.type,l=s.poses,c="rect"===u,f="circle"===u;if("polygon"===u)return n.map((function(t){return xr(t[0],o,r)+" "+xr(t[1],a,r)}));if(c||"inset"===u){var p=n[1][1],d=n[3][0],h=n[7][0],g=n[5][1];if(c)return[p,d,g,h].map((function(t){return t+"px"}));var v=[p,o-d,a-g,h].map((function(t,e){return xr(t,e%2?o:a,r)}));if(n.length>8){var m=se(n[4],n[0]),b=m[0],y=m[1];v.push.apply(v,vn(["round"],_o(n.slice(8),l.slice(8),r,b,y,h,p,d,g).styles))}return v}if(f||"ellipse"===u){var x=n[0],E=xr(Math.abs(n[1][1]-x[1]),f?Math.sqrt((o*o+a*a)/2):a,r);return(v=f?[E]:[xr(Math.abs(n[2][0]-x[0]),o,r),E]).push("at",xr(x[0],o,r),xr(x[1],a,r)),v}}function Lo(t,e,n,r){var i=[r,(r+e)/2,e],o=[t,(t+n)/2,n];return Yo.map((function(t){var e=t[0],n=t[1],r=t[2],a=i[e+1],s=o[n+1];return{vertical:Math.abs(n),horizontal:Math.abs(e),direction:r,pos:[a,s]}}))}function qo(t,e,n,r,i){var o,a,s,u,l,c,f,p=i;if(!p){var d=dr(t),h=d.clipPath;p="none"!==h?h:d.clip}if(p&&"none"!==p&&"auto"!==p||(p=r)){var g=I(p),v=g.prefix,m=void 0===v?p:v,b=g.value,y=void 0===b?"":b,x="circle"===m,E=" ";if("polygon"===m){E=",";var S=(O=j(y||"0% 0%, 100% 0%, 100% 100%, 0% 100%")).map((function(t){var r=t.split(" "),i=r[0],o=r[1];return{vertical:1,horizontal:1,pos:[W(i,e),W(o,n)]}}));return{type:m,clipText:p,poses:S,splitter:E}}if(x||"ellipse"===m){var C="",w="",D=0,M=0,O=G(y);if(x){var P;P=void 0===(o=O[0])?"50%":o,C=void 0===(a=O[2])?"50%":a,w=void 0===(s=O[3])?"50%":s,D=W(P,Math.sqrt((e*e+n*n)/2)),M=D}else{var R,T;R=void 0===(u=O[0])?"50%":u,T=void 0===(l=O[1])?"50%":l,C=void 0===(c=O[3])?"50%":c,w=void 0===(f=O[4])?"50%":f,D=W(R,e),M=W(T,n)}var k=[W(C,e),W(w,n)];S=vn([{vertical:1,horizontal:1,pos:k,direction:"nesw"}],Fo.slice(0,x?1:2).map((function(t){return{vertical:Math.abs(t[1]),horizontal:t[0],direction:t[2],sub:!0,pos:[k[0]+t[0]*D,k[1]+t[1]*M]}})));return{type:m,clipText:p,radiusX:D,radiusY:M,left:k[0]-D,top:k[1]-M,poses:S,splitter:E}}if("inset"===m){var B=(O=G(y||"0 0 0 0")).indexOf("round"),z=(B>-1?O.slice(0,B):O).length,_=O.slice(z+1),N=O.slice(0,z),F=N[0],Y=N[1],X=void 0===Y?F:Y,L=N[2],q=void 0===L?F:L,H=N[3],V=void 0===H?X:H,$=[F,q].map((function(t){return W(t,n)})),K=$[0],U=$[1],Z=[V,X].map((function(t){return W(t,e)})),J=Z[0],Q=Z[1],tt=e-Q,et=n-U,nt=jo(_,tt-J,et-K,J,K);return{type:"inset",clipText:p,poses:S=vn(Lo(K,tt,et,J),nt),top:K,left:J,right:tt,bottom:et,radius:_,splitter:E}}if("rect"===m){E=",";var rt=(O=j(y||"0px, "+e+"px, "+n+"px, 0px")).map((function(t){return A(t).value}));return{type:"rect",clipText:p,poses:S=Lo(K=rt[0],Q=rt[1],U=rt[2],J=rt[3]),top:K,right:Q,bottom:U,left:J,values:O,splitter:E}}}}var Wo={name:"clippable",props:{clippable:Boolean,defaultClipPath:String,customClipPath:String,clipRelative:Boolean,clipArea:Boolean,dragWithClip:Boolean,clipTargetBounds:Boolean,clipVerticalGuidelines:Array,clipHorizontalGuidelines:Array,clipSnapThreshold:Boolean},events:{onClipStart:"clipStart",onClip:"clip",onClipEnd:"clipEnd"},css:[".control.clip-control {\n    background: #6d6;\n    cursor: pointer;\n}\n.control.clip-control.clip-radius {\n    background: #d66;\n}\n.line.clip-line {\n    background: #6e6;\n    cursor: move;\n    z-index: 1;\n}\n.clip-area {\n    position: absolute;\n    top: 0;\n    left: 0;\n}\n.clip-ellipse {\n    position: absolute;\n    cursor: move;\n    border: 1px solid #6d6;\n    border: var(--zoompx) solid #6d6;\n    border-radius: 50%;\n    transform-origin: 0px 0px;\n}",":host {\n    --bounds-color: #d66;\n}",".guideline {\n    pointer-events: none;\n    z-index: 2;\n}",".line.guideline.bounds {\n    background: #d66;\n    background: var(--bounds-color);\n}"],render:function(t,e){var n=t.props,r=n.customClipPath,i=n.defaultClipPath,o=n.clipArea,a=n.zoom,s=t.state,u=s.target,l=s.width,c=s.height,f=s.allMatrix,p=s.is3d,d=s.left,h=s.top,g=s.pos1,v=s.pos2,m=s.pos3,b=s.pos4,y=s.clipPathState,x=s.snapBoundInfos;if(!u)return[];var E=qo(u,l,c,i||"inset",y||r);if(!E)return[];var S=p?4:3,C=E.type,w=E.poses.map((function(t){var e=Vn(f,t.pos,S);return[e[0]-d,e[1]-h]})),D=[],M=[],O="rect"===C,P="inset"===C,R="polygon"===C;if(O||P||R){var T=P?w.slice(0,8):w;M=T.map((function(t,n){var r=0===n?T[T.length-1]:T[n-1],i=U(r,t),o=Qn(r,t);return e.createElement("div",{key:"clipLine"+n,className:_n("line","clip-line","snap-control"),"data-clip-index":n,style:{width:o+"px",transform:"translate("+r[0]+"px, "+r[1]+"px) rotate("+i+"rad) scaleY("+a+")"}})}))}if(D=w.map((function(t,n){return e.createElement("div",{key:"clipControl"+n,className:_n("control","clip-control","snap-control"),"data-clip-index":n,style:{transform:"translate("+t[0]+"px, "+t[1]+"px) scale("+a+")"}})})),P&&D.push.apply(D,w.slice(8).map((function(t,n){return e.createElement("div",{key:"clipRadiusControl"+n,className:_n("control","clip-control","clip-radius","snap-control"),"data-clip-index":8+n,style:{transform:"translate("+t[0]+"px, "+t[1]+"px) scale("+a+")"}})}))),"circle"===C||"ellipse"===C){var k=E.left,B=E.top,z=E.radiusX,_=E.radiusY,G=se(Vn(f,[k,B],S),Vn(f,[0,0],S)),j=G[0],I=G[1],A="none";if(!o){for(var N=Math.max(10,z/5,_/5),F=[],Y=0;Y<=N;++Y){var X=2*Math.PI/N*Y;F.push([z+(z-a)*Math.cos(X),_+(_-a)*Math.sin(X)])}F.push([z,-2]),F.push([-2,-2]),F.push([-2,2*_+2]),F.push([2*z+2,2*_+2]),F.push([2*z+2,-2]),F.push([z,-2]),A="polygon("+F.map((function(t){return t[0]+"px "+t[1]+"px"})).join(", ")+")"}D.push(e.createElement("div",{key:"clipEllipse",className:_n("clip-ellipse","snap-control"),style:{width:2*z+"px",height:2*_+"px",clipPath:A,transform:"translate("+(-d+j)+"px, "+(-h+I)+"px) "+qn(f)}}))}if(o){var L=Kn(vn([g,v,m,b],w)),q=L.width,W=L.height,H=L.left,V=L.top;if(R||O||P){F=P?w.slice(0,8):w;D.push(e.createElement("div",{key:"clipArea",className:_n("clip-area","snap-control"),style:{width:q+"px",height:W+"px",transform:"translate("+H+"px, "+V+"px)",clipPath:"polygon("+F.map((function(t){return t[0]-H+"px "+(t[1]-V)+"px"})).join(", ")+")"}}))}}return x&&["vertical","horizontal"].forEach((function(t){var n=x[t],r="horizontal"===t;n.isSnap&&M.push.apply(M,n.snap.posInfos.map((function(n,i){var o=n.pos,s=se(Vn(f,r?[0,o]:[o,0],S),[d,h]),u=se(Vn(f,r?[l,o]:[o,c],S),[d,h]);return no(e,"",s,u,a,"clip"+t+"snap"+i,"guideline")}))),n.isBound&&M.push.apply(M,n.bounds.map((function(n,i){var o=n.pos,s=se(Vn(f,r?[0,o]:[o,0],S),[d,h]),u=se(Vn(f,r?[l,o]:[o,c],S),[d,h]);return no(e,"",s,u,a,"clip"+t+"bounds"+i,"guideline","bounds","bold")})))})),vn(D,M)},dragControlCondition:function(t,e){return e.inputEvent&&(e.inputEvent.target.getAttribute("class")||"").indexOf("clip")>-1},dragStart:function(t,e){var n=t.props.dragWithClip;return!(void 0===n||n)&&this.dragControlStart(t,e)},drag:function(t,e){return this.dragControl(t,e)},dragEnd:function(t,e){return this.dragControlEnd(t,e)},dragControlStart:function(t,e){var n=t.state,r=t.props,i=r.defaultClipPath,o=r.customClipPath,a=n.target,s=n.width,u=n.height,l=e.inputEvent?e.inputEvent.target:null,c=l?l.getAttribute("class"):"",f=e.datas,p=qo(a,s,u,i||"inset",o);if(!p)return!1;var d=p.clipText;return!1===pr(t,"onClipStart",cr(t,e,{clipType:p.type,clipStyle:d,poses:p.poses.map((function(t){return t.pos}))}))?(f.isClipStart=!1,!1):(f.isControl=c.indexOf("clip-control")>-1,f.isLine=c.indexOf("clip-line")>-1,f.isArea=c.indexOf("clip-area")>-1||c.indexOf("clip-ellipse")>-1,f.index=l?parseInt(l.getAttribute("data-clip-index"),10):-1,f.clipPath=p,f.isClipStart=!0,n.clipPathState=d,_r(t,e),!0)},dragControl:function(t,e){var n=e.datas,r=e.originalDatas;if(!n.isClipStart)return!1;var i=r&&r.draggable||{},o=n,a=o.isControl,s=o.isLine,u=o.isArea,l=o.index,c=o.clipPath;if(!c)return!1;var f=i.isDrag?i.prevDist:Fr(e),p=f[0],d=f[1],h=t.props,g=t.state,v=g.width,m=g.height,b=!u&&!a&&!s,y=c.type,x=c.poses,E=c.splitter,S=x.map((function(t){return t.pos}));b&&(p=-p,d=-d);var C=!a||"nesw"===x[l].direction,w="inset"===y||"rect"===y,D=x.map((function(){return[0,0]}));if(a&&!C){var M=x[l],O=M.horizontal,P=M.vertical,R=[p*Math.abs(O),d*Math.abs(P)];D=function(t,e,n,r){var i=t[e],o=i.direction,a=i.sub,s=t.map((function(){return[0,0]})),u=o?o.split(""):[];if(r&&e<8){var l=u.filter((function(t){return"w"===t||"e"===t}))[0],c=u.filter((function(t){return"n"===t||"s"===t}))[0];s[e]=n,t.forEach((function(t,e){var r=t.direction;r&&(r.indexOf(l)>-1&&(s[e][0]=n[0]),r.indexOf(c)>-1&&(s[e][1]=n[1]))})),l&&(s[1][0]=n[0]/2,s[5][0]=n[0]/2),c&&(s[3][1]=n[1]/2,s[7][1]=n[1]/2)}else o&&!a?u.forEach((function(e){var r="n"===e||"s"===e;t.forEach((function(t,i){var o=t.direction,a=t.horizontal,u=t.vertical;o&&-1!==o.indexOf(e)&&(s[i]=[r||!a?0:n[0],r&&u?n[1]:0])}))})):s[e]=n;return s}(x,l,R,w)}else C&&(D=S.map((function(){return[p,d]})));var T=S.map((function(t,e){return ae(t,D[e])})),k=vn(T);g.snapBoundInfos=null;var B="circle"===c.type,z="ellipse"===c.type;if(B||z){var _=Kn(T),G=Math.abs(_.bottom-_.top),j=Math.abs(z?_.right-_.left:G),I=T[0][1]+G,A=T[0][0]-j,N=T[0][0]+j;B&&(k.push([N,_.bottom]),D.push([1,0])),k.push([_.left,I]),D.push([0,1]),k.push([A,_.bottom]),D.push([1,0])}var F=ui((h.clipHorizontalGuidelines||[]).map((function(t){return W(""+t,m)})),(h.clipVerticalGuidelines||[]).map((function(t){return W(""+t,v)})),v,m),Y=[],X=[];if(B||z)Y=[k[4][0],k[2][0]],X=[k[1][1],k[3][1]];else if(w){var L=[k[0],k[2],k[4],k[6]],q=[D[0],D[2],D[4],D[6]];Y=L.filter((function(t,e){return q[e][0]})).map((function(t){return t[0]})),X=L.filter((function(t,e){return q[e][1]})).map((function(t){return t[1]}))}else Y=k.filter((function(t,e){return D[e][0]})).map((function(t){return t[0]})),X=k.filter((function(t,e){return D[e][1]})).map((function(t){return t[1]}));for(var H=[0,0],V=function(t){var e=Xi(F,h.clipTargetBounds&&{left:0,top:0,right:v,bottom:m},Y,X,5),n=e.horizontal,r=e.vertical,i=n.offset,o=r.offset;if(n.isBound&&(H[1]+=i),r.isBound&&(H[0]+=o),!z&&!B||0!==D[0][0]||0!==D[0][1])return k.forEach((function(t,e){var n=D[e];n[0]&&(t[0]-=o),n[1]&&(t[1]-=i)})),"break";var a=Kn(T),s=a.bottom-a.top,u=z?a.right-a.left:s;u-=r.isBound?Math.abs(o):0===r.snapIndex?-o:o,s-=n.isBound?Math.abs(i):0===n.snapIndex?-i:i,B&&(u=s=vi(r,n)>0?s:u);var l=k[0];k[1][1]=l[1]-s,k[2][0]=l[0]+u,k[3][1]=l[1]+s,k[4][0]=l[0]-u},$=0;$<2;++$){if("break"===V())break}var K=Xo(t,c,T),U=y+"("+K.join(E)+")";if(g.clipPathState=U,B||z)Y=[k[4][0],k[2][0]],X=[k[1][1],k[3][1]];else if(w){L=[k[0],k[2],k[4],k[6]];Y=L.map((function(t){return t[0]})),X=L.map((function(t){return t[1]}))}else Y=k.map((function(t){return t[0]})),X=k.map((function(t){return t[1]}));return g.snapBoundInfos=Xi(F,h.clipTargetBounds&&{left:0,top:0,right:v,bottom:m},Y,X,1),r.draggable&&(r.draggable.deltaOffset=H),pr(t,"onClip",cr(t,e,{clipEventType:"changed",clipType:y,poses:T,clipStyle:U,clipStyles:K,distX:p,distY:d})),!0},dragControlEnd:function(t,e){this.unset(t);var n=e.isDrag,r=e.datas,i=e.isDouble,o=r.isLine,a=r.isClipStart,s=r.isControl;return!!a&&(pr(t,"onClipEnd",fr(t,e,{})),i&&(s?function(t,e){var n=e.datas,r=n.clipPath,i=n.index,o=r,a=o.type,s=o.poses,u=o.splitter,l=s.map((function(t){return t.pos})),c=l.length;if("polygon"===a)s.splice(i,1),l.splice(i,1);else{if("inset"!==a)return;if(i<8)return;if(Io(s,l,i,8,c),c===s.length)return}var f=Xo(t,r,l);pr(t,"onClip",cr(t,e,{clipEventType:"removed",clipType:a,poses:l,clipStyles:f,clipStyle:a+"("+f.join(u)+")",distX:0,distY:0}))}(t,e):o&&function(t,e){var n=zr(t,e),r=n[0],i=n[1],o=e.datas,a=o.clipPath,s=o.index,u=a,l=u.type,c=u.poses,f=u.splitter,p=c.map((function(t){return t.pos}));if("polygon"===l)p.splice(s,0,[r,i]);else{if("inset"!==l)return;var d=To.indexOf(s),h=ko.indexOf(s),g=c.length;if(Ao(c,p,8,d,h,r,i,p[4][0],p[4][1],p[0][0],p[0][1]),g===c.length)return}var v=Xo(t,a,p);pr(t,"onClip",cr(t,e,{clipEventType:"added",clipType:l,poses:p,clipStyles:v,clipStyle:l+"("+v.join(f)+")",distX:0,distY:0}))}(t,e)),i||n)},unset:function(t){t.state.clipPathState="",t.state.snapBoundInfos=null}},Ho={name:"originDraggable",props:{originDraggable:Boolean,originRelative:Boolean},events:{onDragOriginStart:"dragOriginStart",onDragOrigin:"dragOrigin",onDragOriginEnd:"dragOriginEnd"},css:[":host[data-able-origindraggable] .control.origin {\n    pointer-events: auto;\n}"],dragControlCondition:function(t,e){return e.isRequest?"originDraggable"===e.requestAble:et(e.inputEvent.target,_n("origin"))},dragControlStart:function(t,e){var n=e.datas;_r(t,e);var r=cr(t,e,{dragStart:to.dragStart(t,(new Rr).dragStart([0,0],e))}),i=pr(t,"onDragOriginStart",r);return n.startOrigin=t.state.transformOrigin,n.startTargetOrigin=t.state.targetOrigin,n.prevOrigin=[0,0],n.isDragOrigin=!0,!1===i?(n.isDragOrigin=!1,!1):r},dragControl:function(t,e){var n=e.datas,r=e.isPinch,i=e.isRequest;if(!n.isDragOrigin)return!1;var o=Fr(e),a=o[0],s=o[1],u=t.state,l=u.width,c=u.height,f=u.offsetMatrix,p=u.targetMatrix,d=u.is3d,h=t.props.originRelative,g=void 0===h||h,v=d?4:3,m=[a,s];if(i){var b=e.distOrigin;(b[0]||b[1])&&(m=b)}var y=ae(n.startOrigin,m),x=ae(n.startTargetOrigin,m),E=se(m,n.prevOrigin),S=qr(f,p,y,v),C=t.getRect(),w=Kn($n(S,l,c,v)),D=[C.left-w.left,C.top-w.top];n.prevOrigin=m;var M=cr(t,e,{width:l,height:c,origin:y,dist:m,delta:E,transformOrigin:[xr(x[0],l,g),xr(x[1],c,g)].join(" "),drag:to.drag(t,Pr(e,t.state,D,!!r,!1))});return pr(t,"onDragOrigin",M),M},dragControlEnd:function(t,e){return!!e.datas.isDragOrigin&&(pr(t,"onDragOriginEnd",fr(t,e,{})),!0)},dragGroupControlCondition:function(t,e){return this.dragControlCondition(t,e)},dragGroupControlStart:function(t,e){return!!this.dragControlStart(t,e)},dragGroupControl:function(t,e){var n=this.dragControl(t,e);return!!n&&(t.transformOrigin=n.transformOrigin,!0)},request:function(t){var e={},n=t.getRect(),r=0,i=0,o=n.transformOrigin,a=[0,0];return{isControl:!0,requestStart:function(){return{datas:e}},request:function(t){return"deltaOrigin"in t?(a[0]+=t.deltaOrigin[0],a[1]+=t.deltaOrigin[1]):"origin"in t?(a[0]=t.origin[0]-o[0],a[1]=t.origin[1]-o[1]):("x"in t?r=t.x-n.left:"deltaX"in t&&(r+=t.deltaX),"y"in t?i=t.y-n.top:"deltaY"in t&&(i+=t.deltaY)),{datas:e,distX:r,distY:i,distOrigin:a}},requestEnd:function(){return{datas:e,isDrag:!0}}}}};function Vo(t,e,n,r,i){var o;void 0===r&&(r=[0,0]);if(i)o=i;else{var a=dr(t);o=a&&a.borderRadius||""}return jo(!o||!i&&"0px"===o?[]:G(o),e,n,0,0,r)}function $o(t,e,n,r,i,o){var a=t.state,s=a.width,u=a.height,l=_o(o,i,t.props.roundRelative,s,u),c=l.raws,f=l.styles,p=No(i,c),d=p.horizontals,h=p.verticals,g=f.join(" ");a.borderRadiusState=g,pr(t,"onRound",cr(t,e,{horizontals:d,verticals:h,borderRadius:g,width:s,height:u,delta:r,dist:n}))}var Ko={name:"roundable",props:{roundable:Boolean,roundRelative:Boolean,minRoundControls:Array,maxRoundControls:Array,roundClickable:Boolean},events:{onRoundStart:"roundStart",onRound:"round",onRoundEnd:"roundEnd"},css:[".control.border-radius {\n    background: #d66;\n    cursor: pointer;\n}",":host[data-able-roundable] .line.direction {\n    cursor: pointer;\n}"],render:function(t,e){var n=t.state,r=n.target,i=n.width,o=n.height,a=n.allMatrix,s=n.is3d,u=n.left,l=n.top,c=n.borderRadiusState,f=t.props,p=f.minRoundControls,d=void 0===p?[0,0]:p,h=f.maxRoundControls,g=void 0===h?[4,4]:h,v=f.zoom;if(!r)return null;var m=s?4:3,b=Vo(r,i,o,d,c);if(!b)return null;var y=0,x=0;return b.map((function(t,n){x+=Math.abs(t.horizontal),y+=Math.abs(t.vertical);var r=se(Vn(a,t.pos,m),[u,l]),i=t.vertical?y<=g[1]:x<=g[0];return e.createElement("div",{key:"borderRadiusControl"+n,className:_n("control","border-radius"),"data-radius-index":n,style:{display:i?"block":"none",transform:"translate("+r[0]+"px, "+r[1]+"px) scale("+v+")"}})}))},dragControlCondition:function(t,e){if(!e.inputEvent||e.isRequest)return!1;var n=e.inputEvent.target.getAttribute("class")||"";return n.indexOf("border-radius")>-1||n.indexOf("moveable-line")>-1&&n.indexOf("moveable-direction")>-1},dragControlStart:function(t,e){var n=e.inputEvent,r=e.datas,i=n.target,o=i.getAttribute("class")||"",a=o.indexOf("border-radius")>-1,s=o.indexOf("moveable-line")>-1&&o.indexOf("moveable-direction")>-1,u=a?parseInt(i.getAttribute("data-radius-index"),10):-1,l=s?parseInt(i.getAttribute("data-line-index"),10):-1;if(!a&&!s)return!1;if(!1===pr(t,"onRoundStart",cr(t,e,{})))return!1;r.lineIndex=l,r.controlIndex=u,r.isControl=a,r.isLine=s,_r(t,e);var c=t.props,f=c.roundRelative,p=c.minRoundControls,d=void 0===p?[0,0]:p,h=t.state,g=h.target,v=h.width,m=h.height;r.isRound=!0,r.prevDist=[0,0];var b=Vo(g,v,m,d)||[];return r.controlPoses=b,h.borderRadiusState=_o(b.map((function(t){return t.pos})),b,f,v,m).styles.join(" "),!0},dragControl:function(t,e){var n=e.datas;if(!n.isRound||!n.isControl||!n.controlPoses.length)return!1;var r=n.controlIndex,i=n.controlPoses,o=Fr(e),a=o[0],s=o[1],u=[a,s],l=se(u,n.prevDist),c=t.props.maxRoundControls,f=void 0===c?[4,4]:c,p=t.state,d=p.width,h=p.height,g=i[r],v=g.vertical,m=g.horizontal,b=i.map((function(t){var e=t.horizontal,n=t.vertical,r=[e*m*u[0],n*v*u[1]];if(e){if(1===f[0])return r;if(f[0]<4&&e!==m)return r}else{if(0===f[1])return r[1]=n*m*u[0]/d*h,r;if(v){if(1===f[1])return r;if(f[1]<4&&n!==v)return r}}return[0,0]}));b[r]=u;var y=i.map((function(t,e){return ae(t.pos,b[e])}));return n.prevDist=[a,s],$o(t,e,u,l,i,y),!0},dragControlEnd:function(t,e){var n=t.state;n.borderRadiusState="";var r=e.datas,i=e.isDouble;if(!r.isRound)return!1;var o=n.width,a=n.height,s=r.isControl,u=r.controlIndex,l=r.isLine,c=r.lineIndex,f=r.controlPoses,p=f.map((function(t){return t.pos})),d=p.length,h=t.props.roundClickable;if(i&&(void 0===h||h)){if(s)Io(f,p,u,0);else if(l){var g=zr(t,e);!function(t,e,n,r,i,o,a){var s=No(t),u=s.horizontals,l=s.verticals,c=u.length,f=l.length,p=-1,d=-1;0===n?0===c?p=0:1===c&&(p=1):3===n&&(c<=2?p=2:c<=3&&(p=3)),2===n?0===f?d=0:f<4&&(d=3):1===n&&(f<=1?d=1:f<=2&&(d=2)),Ao(t,e,0,p,d,r,i,o,a)}(f,p,c,g[0],g[1],o,a)}d!==f.length&&$o(t,e,[0,0],[0,0],f,p)}return pr(t,"onRoundEnd",fr(t,e,{})),n.borderRadiusState="",!0},unset:function(t){t.state.borderRadiusState=""}},Uo={isPinch:!0,name:"beforeRenderable",props:{},events:{onBeforeRenderStart:"beforeRenderStart",onBeforeRender:"beforeRender",onBeforeRenderEnd:"beforeRenderEnd",onBeforeRenderGroupStart:"beforeRenderGroupStart",onBeforeRenderGroup:"beforeRenderGroup",onBeforeRenderGroupEnd:"beforeRenderGroupEnd"},setTransform:function(t,e){var n=t.state,r=n.is3d,i=n.target,o=n.targetMatrix,a=null==i?void 0:i.style.transform,s=r?"matrix3d("+o.join(",")+")":"matrix("+ue(o,!0)+")";e.datas.startTransforms=a&&"none"!==a?G(a):[s]},resetTransform:function(t,e){e.datas.nextTransforms=e.datas.startTransforms,e.datas.nextTransformAppendedIndexes=[]},fillDragStartParams:function(t,e){return cr(t,e,{setTransform:function(t){e.datas.startTransforms=R(t)?t:G(t)},isPinch:!!e.isPinch})},fillDragParams:function(t,e){return cr(t,e,{isPinch:!!e.isPinch})},dragStart:function(t,e){this.setTransform(t,e),pr(t,"onBeforeRenderStart",this.fillDragStartParams(t,e))},drag:function(t,e){this.resetTransform(t,e),pr(t,"onBeforeRender",cr(t,e,{isPinch:!!e.isPinch}))},dragEnd:function(t,e){pr(t,"onBeforeRenderEnd",cr(t,e,{isPinch:!!e.isPinch,isDrag:e.isDrag}))},dragGroupStart:function(t,e){var n=this;this.dragStart(t,e);var r=Tr(t,"beforeRenderable",e),i=t.moveables,o=r.map((function(t,e){var r=i[e];return n.setTransform(r,t),n.fillDragStartParams(r,t)}));pr(t,"onBeforeRenderGroupStart",cr(t,e,{isPinch:!!e.isPinch,targets:t.props.targets,setTransform:function(){},events:o}))},dragGroup:function(t,e){var n=this;this.drag(t,e);var r=Tr(t,"beforeRenderable",e),i=t.moveables,o=r.map((function(t,e){var r=i[e];return n.resetTransform(r,t),n.fillDragParams(r,t)}));pr(t,"onBeforeRenderGroup",cr(t,e,{isPinch:!!e.isPinch,targets:t.props.targets,events:o}))},dragGroupEnd:function(t,e){this.dragEnd(t,e),pr(t,"onBeforeRenderGroupEnd",cr(t,e,{isPinch:!!e.isPinch,isDrag:e.isDrag,targets:t.props.targets}))},dragControlStart:function(t,e){return this.dragStart(t,e)},dragControl:function(t,e){return this.drag(t,e)},dragControlEnd:function(t,e){return this.dragEnd(t,e)},dragGroupControlStart:function(t,e){return this.dragGroupStart(t,e)},dragGroupControl:function(t,e){return this.dragGroup(t,e)},dragGroupControlEnd:function(t,e){return this.dragGroupEnd(t,e)}},Zo={name:"renderable",props:{},events:{onRenderStart:"renderStart",onRender:"render",onRenderEnd:"renderEnd",onRenderGroupStart:"renderGroupStart",onRenderGroup:"renderGroup",onRenderGroupEnd:"renderGroupEnd"},dragStart:function(t,e){pr(t,"onRenderStart",cr(t,e,{isPinch:!!e.isPinch}))},drag:function(t,e){pr(t,"onRender",cr(t,e,{isPinch:!!e.isPinch}))},dragEnd:function(t,e){pr(t,"onRenderEnd",cr(t,e,{isPinch:!!e.isPinch,isDrag:e.isDrag}))},dragGroupStart:function(t,e){pr(t,"onRenderGroupStart",cr(t,e,{isPinch:!!e.isPinch,targets:t.props.targets}))},dragGroup:function(t,e){pr(t,"onRenderGroup",cr(t,e,{isPinch:!!e.isPinch,targets:t.props.targets}))},dragGroupEnd:function(t,e){pr(t,"onRenderGroupEnd",cr(t,e,{isPinch:!!e.isPinch,isDrag:e.isDrag,targets:t.props.targets}))},dragControlStart:function(t,e){return this.dragStart(t,e)},dragControl:function(t,e){return this.drag(t,e)},dragControlEnd:function(t,e){return this.dragEnd(t,e)},dragGroupControlStart:function(t,e){return this.dragGroupStart(t,e)},dragGroupControl:function(t,e){return this.dragGroup(t,e)},dragGroupControlEnd:function(t,e){return this.dragGroupEnd(t,e)}};function Jo(t,e,n,r,i,o,a){var s="Start"===i,u=t.state.target,l=o.isRequest;if(!u||s&&r.indexOf("Control")>-1&&!l&&t.areaElement===o.inputEvent.target)return!1;var c=""+n+r+i,f=""+n+r+"Condition",p="End"===i,d=i.indexOf("After")>-1,h=s&&(!t.targetGesto||!t.controlGesto||!t.targetGesto.isFlag()||!t.controlGesto.isFlag());h&&t.updateRect(i,!0,!1),""!==i||d||l||br(t.state,o);var g=vn([Uo],t[e],[Zo]);if(l){var v=o.requestAble;g.some((function(t){return t.name===v}))||g.push.apply(g,t.props.ables.filter((function(t){return t.name===v})))}if(!g.length)return!1;var m=g.filter((function(t){return t[c]})),b=o.datas;h&&m.forEach((function(e){e.unset&&e.unset(t)}));var y,x=o.inputEvent;p&&x&&(y=document.elementFromPoint(o.clientX,o.clientY)||x.target);var E=m.filter((function(e){var n=e.name,r=b[n]||(b[n]={});return s&&(r.isEventStart=!e[f]||e[f](t,o)),!!r.isEventStart&&e[c](t,gn(gn({},o),{datas:r,originalDatas:b,inputTarget:y}))})).length,S=s&&m.length&&!E;return(p||S)&&(t.state.gesto=null,t.moveables&&t.moveables.forEach((function(t){t.state.gesto=null}))),h&&S&&m.forEach((function(e){e.unset&&e.unset(t)})),!t.isUnmounted&&!S&&((!s&&E&&!a||p)&&(t.updateRect(i,!0,!1),t.forceUpdate()),s||p||d||!E||a||Jo(t,e,n,r,i+"After",o),!0)}function Qo(t,e,n){var r=t.controlBox.getElement(),i=[];i.push(r),t.props.dragArea&&!t.props.dragTarget||i.push(e);var o=function(e){var n=e.inputEvent.target;return n===t.areaElement||!t.isMoveableElement(n)||et(n,"moveable-area")||et(n,"moveable-padding")};return ta(t,i,"targetAbles",n,{dragStart:o,pinchStart:o})}function ta(t,e,n,r,i){void 0===i&&(i={});var o=t.props,a=o.pinchOutside,s=o.pinchThreshold,u={container:window,pinchThreshold:s,pinchOutside:a},l=new rn(e,u);return["drag","pinch"].forEach((function(e){["Start","","End"].forEach((function(o){l.on(""+e+o,(function(a){var s=a.eventType;!i[s]||i[s](a)?Jo(t,n,e,r,o,a)||a.stop():a.stop()}))}))})),l}var ea=function(){function t(t,e,n){var r=this;this.target=t,this.moveable=e,this.eventName=n,this.ables=[],this.onEvent=function(t){var e=r.eventName,n=r.moveable;n.state.disableNativeEvent||r.ables.forEach((function(r){r[e](n,{inputEvent:t})}))},this.target.addEventListener(this.eventName.toLowerCase(),this.onEvent)}var e=t.prototype;return e.setAbles=function(t){this.ables=t},e.destroy=function(){this.target.removeEventListener(this.eventName.toLowerCase(),this.onEvent),this.target=null,this.moveable=null},t}(),na=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.state=gn({container:null,gesto:null,renderPoses:[[0,0],[0,0],[0,0],[0,0]],disableNativeEvent:!1},ir(null)),e.enabledAbles=[],e.targetAbles=[],e.controlAbles=[],e.rotation=0,e.scale=[1,1],e.isUnmounted=!1,e.events={mouseEnter:null,mouseLeave:null},e.onPreventClick=function(t){t.stopPropagation(),it(window,"click",e.onPreventClick,!0)},e}hn(e,t);var n=e.prototype;return n.render=function(){var t=this.props,e=this.state,n=t.parentPosition,r=t.className,i=t.target,o=t.zoom,a=t.cspNonce,s=t.translateZ,u=t.cssStyled,l=t.portalContainer;this.checkUpdate(),this.updateRenderPoses();var c=n||{left:0,top:0},f=c.left,d=c.top,h=e.left,g=e.top,v=e.target,m=e.direction,b=t.targets,y=(b&&b.length||i)&&v,x=this.isDragging(),E={};return this.getEnabledAbles().forEach((function(t){E["data-able-"+t.name.toLowerCase()]=!0})),mt(u,gn({cspNonce:a,ref:p(this,"controlBox"),className:_n("control-box",-1===m?"reverse":"",x?"dragging":"")+" "+r},E,{onClick:this.onPreventClick,portalContainer:l,style:{position:"absolute",display:y?"block":"none",transform:"translate3d("+(h-f)+"px, "+(g-d)+"px, "+s+")","--zoom":o,"--zoompx":o+"px"}}),this.renderAbles(),this._renderLines())},n.componentDidMount=function(){this.controlBox.getElement();var t=this.props,e=t.parentMoveable,n=t.container,r=t.wrapperMoveable;this.updateEvent(t),this.updateNativeEvents(t),n||e||r||this.updateRect("",!1,!0),this.updateCheckInput()},n.componentDidUpdate=function(t){this.updateNativeEvents(t),this.updateEvent(t),this.updateCheckInput()},n.componentWillUnmount=function(){this.isUnmounted=!0,lr(this,"targetGesto"),lr(this,"controlGesto");var t=this.events;for(var e in t){var n=t[e];n&&n.destroy()}},n.getContainer=function(){var t=this.props,e=t.parentMoveable,n=t.wrapperMoveable;return t.container||n&&n.getContainer()||e&&e.getContainer()||this.controlBox.getElement().parentElement},n.isMoveableElement=function(t){return t&&(t.getAttribute("class")||"").indexOf(Cn)>-1},n.dragStart=function(t){return this.targetGesto&&this.targetGesto.triggerDragStart(t),this},n.hitTest=function(t){var e,n=this.state,r=n.target,i=n.pos1,o=n.pos2,a=n.pos3,s=n.pos4,u=n.targetClientRect;if(!r)return 0;if(t instanceof Element){var l=t.getBoundingClientRect();e={left:l.left,top:l.top,width:l.width,height:l.height}}else e=gn({width:0,height:0},t);var c=e.left,f=e.top,p=e.width,d=e.height,h=Be([i,o,s,a],u),g=ke(Ne(h,[[c,f],[c+p,f],[c+p,f+d],[c,f+d]])),v=ke(h);return g&&v?Math.min(100,g/v*100):0},n.isInside=function(t,e){var n=this.state,r=n.target,i=n.pos1,o=n.pos2,a=n.pos3,s=n.pos4,u=n.targetClientRect;return!!r&&_e([t,e],Be([i,o,s,a],u))},n.updateRect=function(t,e,n){void 0===n&&(n=!0);var r=this.props,i=r.parentMoveable,o=this.state.target||this.props.target,a=this.getContainer(),s=i?i.props.rootContainer:r.rootContainer;this.updateState(ir(this.controlBox&&this.controlBox.getElement(),o,a,a,s||a),!i&&n)},n.isTargetChanged=function(t,e){var n=this.props,r=n.dragTarget||n.target,i=t.dragTarget||t.target,o=n.dragArea,a=t.dragArea;return!o&&i!==r||(e||o)&&a!==o},n.updateNativeEvents=function(t){var e=this,n=this.props.dragArea?this.areaElement:this.state.target,r=this.events,i=q(r);if(this.isTargetChanged(t))for(var o in r){var a=r[o];a&&a.destroy(),r[o]=null}if(n){var s=this.enabledAbles;i.forEach((function(t){var i=hr(s,[t]),o=i.length>0,a=r[t];o?(a||(a=new ea(n,e,t),r[t]=a),a.setAbles(i)):a&&(a.destroy(),r[t]=null)}))}},n.updateEvent=function(t){var e=this.controlBox.getElement(),n=this.targetAbles.length,r=this.controlAbles.length,i=this.props,o=i.dragTarget||i.target,a=this.isTargetChanged(t,!0),s=!n&&this.targetGesto||a;s&&(lr(this,"targetGesto"),this.updateState({gesto:null})),r||lr(this,"controlGesto"),o&&n&&!this.targetGesto&&(this.targetGesto=Qo(this,o,"")),!this.controlGesto&&r&&(this.controlGesto=ta(this,e,"controlAbles","Control")),s&&this.unsetAbles()},n.isDragging=function(){return!!this.targetGesto&&this.targetGesto.isFlag()||!!this.controlGesto&&this.controlGesto.isFlag()},n.updateTarget=function(t){this.updateRect(t,!0)},n.getRect=function(){var t=this.state,e=ur(this.state),n=e[0],r=e[1],i=e[2],o=e[3],a=Kn(e),s=t.width,u=t.height,l=a.width,c=a.height,f=a.left,p=a.top,d=[t.left,t.top],h=ae(d,t.origin);return{width:l,height:c,left:f,top:p,pos1:n,pos2:r,pos3:i,pos4:o,offsetWidth:s,offsetHeight:u,beforeOrigin:ae(d,t.beforeOrigin),origin:h,transformOrigin:t.transformOrigin,rotation:this.getRotation()}},n.getManager=function(){return this},n.getRotation=function(){var t=this.state;return function(t,e,n){var r=U(t,e)/Math.PI*180;return(r=n>=0?r:180-r)>=0?r:360+r}(t.pos1,t.pos2,t.direction)},n.request=function(t,e,n){void 0===e&&(e={});var r=this.props,i=r.ables,o=r.groupable,a=i.filter((function(e){return e.name===t}))[0];if(this.isDragging()||!a||!a.request)return{request:function(){return this},requestEnd:function(){return this}};var s=this,u=a.request(this),l=n||e.isInstant,c=u.isControl?"controlAbles":"targetAbles",f=(o?"Group":"")+(u.isControl?"Control":""),p={request:function(e){return Jo(s,c,"drag",f,"",gn(gn({},u.request(e)),{requestAble:t,isRequest:!0}),l),this},requestEnd:function(){return Jo(s,c,"drag",f,"End",gn(gn({},u.requestEnd()),{requestAble:t,isRequest:!0}),l),this}};return Jo(s,c,"drag",f,"Start",gn(gn({},u.requestStart(e)),{requestAble:t,isRequest:!0}),l),l?p.request(e).requestEnd():p},n.destroy=function(){this.componentWillUnmount()},n.updateRenderPoses=function(){var t=this.state,e=this.props,n=t.originalBeforeOrigin,r=t.transformOrigin,i=t.allMatrix,o=t.is3d,a=t.pos1,s=t.pos2,u=t.pos3,l=t.pos4,c=t.left,f=t.top,p=e.padding||{},d=p.left,h=void 0===d?0:d,g=p.top,v=void 0===g?0:g,m=p.bottom,b=void 0===m?0:m,y=p.right,x=void 0===y?0:y,E=o?4:3,S=e.groupable?n:ae(n,[c,f]);t.renderPoses=[ae(a,yr(i,[-h,-v],r,S,E)),ae(s,yr(i,[x,-v],r,S,E)),ae(u,yr(i,[-h,b],r,S,E)),ae(l,yr(i,[x,b],r,S,E))]},n.checkUpdate=function(){var t=this.props,e=t.target,n=t.container,r=t.parentMoveable,i=this.state,o=i.target,a=i.container;(o||e)&&(this.updateAbles(),(!gr(o,e)||!gr(a,n))&&(this.updateState({target:e,container:n}),r||!n&&!this.controlBox||this.updateRect("End",!1,!1)))},n.triggerEvent=function(t,e){var n=this.props[t];return n&&n(e)},n.useCSS=function(t,e){var n=this.props.customStyledMap,r=t+e;return n[r]||(n[r]=pn(t,e)),n[r]},n.unsetAbles=function(){var t=this;this.targetAbles.filter((function(e){return!!e.unset&&(e.unset(t),!0)})).length&&this.forceUpdate()},n.updateAbles=function(t,e){void 0===t&&(t=this.props.ables),void 0===e&&(e="");var n=this.props,r=n.triggerAblesSimultaneously,i=t.filter((function(t){return t&&(t.always||n[t.name])})),o="drag"+e+"ControlStart",a=hr(i,["drag"+e+"Start","pinch"+e+"Start"],r),s=hr(i,[o],r);this.enabledAbles=i,this.targetAbles=a,this.controlAbles=s},n.updateState=function(t,e){if(e)this.setState(t);else{var n=this.state;for(var r in t)n[r]=t[r]}},n.getEnabledAbles=function(){var t=this.props;return t.ables.filter((function(e){return e&&t[e.name]}))},n.renderAbles=function(){var t,e=this,n=this.props.triggerAblesSimultaneously,r={createElement:mt};return function(t,e){var n=[],r={};return t.forEach((function(i,o){var a=e(i,o,t),s=r[a];s||(s=[],r[a]=s,n.push(s)),s.push(i)})),n}((t=hr(this.getEnabledAbles(),["render"],n).map((function(t){return(0,t.render)(e,r)||[]})),t.reduce((function(t,e){return t.concat(e)}),[])).filter((function(t){return t})),(function(t){return t.key})).map((function(t){return t[0]}))},n.updateCheckInput=function(){this.targetGesto&&(this.targetGesto.options.checkInput=this.props.checkInput)},n._renderLines=function(){var t=this.props,e=t.edge,n=t.zoom;if(t.hideDefaultLines)return[];var r=this.state.renderPoses,i={createElement:mt};return[no(i,e?"n":"",r[0],r[1],n,0),no(i,e?"e":"",r[1],r[3],n,1),no(i,e?"w":"",r[0],r[2],n,2),no(i,e?"s":"",r[2],r[3],n,3)]},e.defaultProps={target:null,dragTarget:null,container:null,rootContainer:null,origin:!0,edge:!1,parentMoveable:null,wrapperMoveable:null,parentPosition:null,portalContainer:null,ables:[],pinchThreshold:20,dragArea:!1,passDragArea:!1,transformOrigin:"",className:"",zoom:1,triggerAblesSimultaneously:!1,padding:{},pinchOutside:!0,checkInput:!1,groupable:!1,hideDefaultLines:!1,cspNonce:"",translateZ:0,cssStyled:null,customStyledMap:{},props:{}},e}(Pt),ra={name:"groupable",props:{defaultGroupRotate:Number,defaultGroupOrigin:String,groupable:Boolean},events:{},render:function(t,e){var n=t.props.targets||[];t.moveables=[];var r=t.state,i={left:r.left,top:r.top};return n.map((function(n,r){return e.createElement(na,{key:"moveable"+r,ref:d(t,"moveables",r),target:n,origin:!1,cssStyled:t.props.cssStyled,customStyledMap:t.props.customStyledMap,parentMoveable:t,parentPosition:i})}))}},ia=mn("clickable",{props:{},events:{onClick:"click",onClickGroup:"clickGroup"},always:!0,dragStart:function(t,e){e.isRequest||rt(window,"click",t.onPreventClick,!0)},dragControlStart:function(t,e){this.dragStart(t,e)},dragGroupStart:function(t,e){this.dragStart(t,e),e.datas.inputTarget=e.inputEvent&&e.inputEvent.target},dragEnd:function(t,e){this.endEvent(t);var n=t.state.target,r=e.inputEvent,i=e.inputTarget;if(e.isDrag||this.unset(t),r&&i&&!e.isDrag&&!t.isMoveableElement(i)){var o=n.contains(i);pr(t,"onClick",cr(t,e,{isDouble:e.isDouble,inputTarget:i,isTarget:n===i,containsTarget:o}))}},dragGroupEnd:function(t,e){this.endEvent(t);var n=e.inputEvent,r=e.inputTarget;if(n&&r&&!e.isDrag&&!t.isMoveableElement(r)&&e.datas.inputTarget!==r){var i=t.props.targets,o=i.indexOf(r),a=o>-1,s=!1;-1===o&&(s=(o=X(i,(function(t){return t.contains(r)})))>-1),pr(t,"onClickGroup",cr(t,e,{isDouble:e.isDouble,targets:i,inputTarget:r,targetIndex:o,isTarget:a,containsTarget:s}))}},dragControlEnd:function(t){this.endEvent(t)},dragGroupControlEnd:function(t){this.endEvent(t)},endEvent:function(t){var e=this;requestAnimationFrame((function(){e.unset(t)}))},unset:function(t){it(window,"click",t.onPreventClick,!0)}});function oa(t){var e=t.originalDatas.draggable;return e||(t.originalDatas.draggable={},e=t.originalDatas.draggable),gn(gn({},t),{datas:e})}var aa=mn("edgeDraggable",{dragControlCondition:function(t,e){if(!t.props.edgeDraggable||!e.inputEvent)return!1;var n=e.inputEvent.target;return et(n,_n("direction"))&&et(n,_n("line"))},dragControlStart:function(t,e){return to.dragStart(t,oa(e))},dragControl:function(t,e){return to.drag(t,oa(e))},dragControlEnd:function(t,e){return to.dragEnd(t,oa(e))},dragGroupControlCondition:function(t,e){if(!t.props.edgeDraggable||!e.inputEvent)return!1;var n=e.inputEvent.target;return et(n,_n("direction"))&&et(n,_n("line"))},dragGroupControlStart:function(t,e){return to.dragGroupStart(t,oa(e))},dragGroupControl:function(t,e){return to.dragGroup(t,oa(e))},dragGroupControlEnd:function(t,e){return to.dragGroupEnd(t,oa(e))},unset:function(t){t.state.dragInfo=null}}),sa={name:"individualGroupable",props:{individualGroupable:Boolean},events:{}},ua=[Uo,Mo,Qi,Or,to,aa,co,fo,po,vo,Do,Oo,Co,Ho,Wo,Ko,ra,sa,ia,So,Zo],la=ua.reduce((function(t,e){return gn(gn({},t),"events"in e?e.events:{})}),{}),ca=ua.reduce((function(t,e){return gn(gn({},t),e.props)}),{}),fa=Cr(la),pa=Object.keys(fa),da=Object.keys(ca);function ha(t,e){return Math.max.apply(Math,t.map((function(t){var n=t[0],r=t[1],i=t[2],o=t[3];return Math.max(n[e],r[e],i[e],o[e])})))}function ga(t,e){return Math.min.apply(Math,t.map((function(t){var n=t[0],r=t[1],i=t[2],o=t[3];return Math.min(n[e],r[e],i[e],o[e])})))}var va=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.differ=new Te,e.moveables=[],e.transformOrigin="50% 50%",e}hn(e,t);var n=e.prototype;return n.updateEvent=function(t){var e=this.state,n=this.props,r=t.dragTarget||e.target,i=n.dragTarget||this.areaElement;r!==i&&(lr(this,"targetGesto"),lr(this,"controlGesto"),e.target=null),e.target||(e.target=this.areaElement,this.controlBox.getElement().style.display="block",this.targetGesto=Qo(this,i,"Group"),this.controlGesto=ta(this,this.controlBox.getElement(),"controlAbles","GroupControl"));var o=!gr(t.container,n.container);o&&(e.container=n.container);var a=this.differ.update(n.targets),s=a.added,u=a.changed,l=a.removed;(o||s.length||u.length||l.length)&&this.updateRect()},n.checkUpdate=function(){this.updateAbles()},n.updateRect=function(t,e,n){if(void 0===n&&(n=!0),this.controlBox){this.moveables.forEach((function(e){e.updateRect(t,!1,!1)}));var r=this.state,i=this.props,o=r.target||i.target;(!e||""!==t&&i.updateGroup)&&(this.rotation=i.defaultGroupRotate,this.transformOrigin=i.defaultGroupOrigin||"50% 50%",this.scale=[1,1]);var a=this.rotation,s=this.scale,u=function(t,e){if(!t.length)return[0,0,0,0];var n=t.map((function(t){return ur(t.state)})),r=Pn,i=Pn,o=0,a=0,s=Q(e,Mn);if(s%90){var u=s/180*Math.PI,l=Math.tan(u),c=-1/l,f=[Rn,Pn],p=[Rn,Pn];n.forEach((function(t){t.forEach((function(t){var e=t[1]-l*t[0],n=t[1]-c*t[0];f[0]=Math.max(f[0],e),f[1]=Math.min(f[1],e),p[0]=Math.max(p[0],n),p[1]=Math.min(p[1],n)}))})),f.forEach((function(t){p.forEach((function(e){var n=(e-t)/(l-c),o=l*n+t;r=Math.min(r,n),i=Math.min(i,o)}))}));var d=n.map((function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return[he(e,-u),he(n,-u),he(r,-u),he(i,-u)]}));o=ha(d,0)-ga(d,0),a=ha(d,1)-ga(d,1)}else if(r=ga(n,0),i=ga(n,1),o=ha(n,0)-r,a=ha(n,1)-i,s%180){var h=o;o=a,a=h}return[r,i,o,a]}(this.moveables,a),l=u[0],c=u[1],f=u[2],p=u[3],d="rotate("+a+"deg) scale("+(s[0]>=0?1:-1)+", "+(s[1]>=0?1:-1)+")";o.style.cssText+="left:0px;top:0px; transform-origin: "+this.transformOrigin+"; width:"+f+"px; height:"+p+"px;transform:"+d,r.width=f,r.height=p;var h=this.getContainer(),g=ir(this.controlBox.getElement(),o,this.controlBox.getElement(),this.getContainer(),this.props.rootContainer||h),v=[g.left,g.top],m=ur(g),b=m[0],y=m[1],x=m[2],E=m[3],S=ze([b,y,x,E]),C=[S.minX,S.minY];g.pos1=se(b,C),g.pos2=se(y,C),g.pos3=se(x,C),g.pos4=se(E,C),g.left=l-g.left+C[0],g.top=c-g.top+C[1],g.origin=se(ae(v,g.origin),C),g.beforeOrigin=se(ae(v,g.beforeOrigin),C),g.originalBeforeOrigin=ae(v,g.originalBeforeOrigin);var w=g.targetClientRect,D=s[0]*s[1]>0?1:-1;w.top+=g.top-r.top,w.left+=g.left-r.left,o.style.transform="translate("+-C[0]+"px, "+-C[1]+"px) "+d,this.updateState(gn(gn({},g),{direction:D,beforeDirection:D}),n)}},n.getRect=function(){return gn(gn({},t.prototype.getRect.call(this)),{children:this.moveables.map((function(t){return t.getRect()}))})},n.triggerEvent=function(e,n,r){if(r||e.indexOf("Group")>-1)return t.prototype.triggerEvent.call(this,e,n)},n.updateAbles=function(){t.prototype.updateAbles.call(this,vn(this.props.ables,[ra]),"Group")},e.defaultProps=gn(gn({},na.defaultProps),{transformOrigin:["50%","50%"],groupable:!0,dragArea:!0,keepRatio:!0,targets:[],defaultGroupRotate:0,defaultGroupOrigin:"50% 50%"}),e}(na),ma=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.moveables=[],e}hn(e,t);var n=e.prototype;return n.render=function(){var t=this,e=this.props,n=e.cspNonce,r=e.cssStyled,i=e.targets;return mt(r,{cspNonce:n,ref:p(this,"controlBox"),className:_n("control-box")},i.map((function(e,n){return mt(na,gn({key:"moveable"+n,ref:d(t,"moveables",n)},t.props,{target:e,wrapperMoveable:t}))})))},n.componentDidUpdate=function(){},n.updateRect=function(t,e,n){void 0===n&&(n=!0),this.moveables.forEach((function(r){r.updateRect(t,e,n)}))},n.getRect=function(){return gn(gn({},t.prototype.getRect.call(this)),{children:this.moveables.map((function(t){return t.getRect()}))})},n.request=function(){return{request:function(){return this},requestEnd:function(){return this}}},n.dragStart=function(){return this},n.hitTest=function(){return 0},n.isInside=function(){return!1},n.isDragging=function(){return!1},n.updateRenderPoses=function(){},n.updateEvent=function(){},n.checkUpdate=function(){},n.triggerEvent=function(){},n.updateAbles=function(){},e}(na),ba=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.refTargets=[],e.selectorMap={},e}hn(e,t);var n,r,i=e.prototype;return e.makeStyled=function(){var t={};this.getTotalAbles().forEach((function(e){var n=e.css;n&&n.forEach((function(e){t[e]=!0}))}));var e=q(t).join("\n");this.defaultStyled=pn("div",function(t,e){return e.replace(/([^}{]*){/gm,(function(e,n){return n.replace(/\.([^{,\s\d.]+)/g,"."+t+"$1")+"{"}))}(Cn,wn+e))},e.getTotalAbles=function(){return vn([Mo,ra,sa,So],this.defaultAbles)},i.render=function(){var t=this.constructor;t.defaultStyled||t.makeStyled();var e=this.props,n=e.ables,r=e.props,i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(e,["ables","props"]),o=Dr(i.target||i.targets),a=function(t,e){var n=[];return t.forEach((function(t){t&&(T(t)?e[t]&&n.push.apply(n,e[t]):n.push(t))})),n}(o,this.selectorMap);this.refTargets=o;var s=a.length>1,u=vn(t.getTotalAbles(),n||[]),l=gn(gn(gn({},i),r||{}),{ables:u,cssStyled:t.defaultStyled,customStyledMap:t.customStyledMap});return s?i.individualGroupable?mt(ma,gn({key:"individual-group",ref:p(this,"moveable")},l,{target:null,targets:a})):mt(va,gn({key:"group",ref:p(this,"moveable")},l,{target:null,targets:a})):mt(na,gn({key:"single",ref:p(this,"moveable")},l,{target:a[0]}))},i.componentDidMount=function(){this.updateRefs()},i.componentDidUpdate=function(){this.updateRefs()},i.updateRefs=function(t){var e=Dr(this.props.target||this.props.targets),n=this.refTargets.some((function(t,n){var r=e[n];return!(!t&&!r)&&t!==r})),r=t?{}:this.selectorMap,i={};this.refTargets.forEach((function(t){T(t)&&(r[t]?i[t]=r[t]:(n=!0,i[t]=[].slice.call(document.querySelectorAll(t))))})),this.selectorMap=i,n&&this.forceUpdate()},i.getManager=function(){return this.moveable},e.defaultAbles=[],e.customStyledMap={},e.defaultStyled=null,function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);o>3&&a&&Object.defineProperty(e,n,a)}([(n=zn,void 0===r&&(r={}),function(t,e){n.forEach((function(n){var i=r[n]||n;i in t||(t[i]=function(){for(var t,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=(t=this[e])[n].apply(t,r);return o===this[e]?this:o})}))})],e.prototype,"moveable",void 0),e}(Pt);const ya=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return hn(e,t),e.defaultAbles=ua,e}(ba);var xa=function(t,e){return xa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},xa(t,e)};function Ea(t,e){function n(){this.constructor=t}xa(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Sa=function(){return Sa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Sa.apply(this,arguments)};var Ca=function(t){function e(e){var n=t.call(this,e)||this;return n.state={},n.state=n.props,n}return Ea(e,t),e.prototype.render=function(){return t=mt(ya,Sa({ref:p(this,"moveable")},this.state)),e=this.state.parentElement,mt(Rt,{element:t,container:e});var t,e},e}(Ot),wa=da,Da=zn,Ma=pa,Oa=function(){return Oa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Oa.apply(this,arguments)};var Pa=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(P(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(P(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=X(r,(function(t){return t.listener===e}));i>-1&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(t,e){var n=this;return e&&this._addEvent(t,e,{once:!0}),new Promise((function(e){n._addEvent(t,e,{once:!0})}))},e.emit=function(t,e){var n=this;void 0===e&&(e={});var r=this._events[t];if(!t||!r)return!0;var i=!1;return e.eventType=t,e.stop=function(){i=!0},e.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(r).forEach((function(r){r.listener(e),r.once&&n.off(t,r.listener)})),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(Oa({listener:e},n))},t}(),Ra=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;r.tempElement=document.createElement("div");var i=Sa({},n),o={};Ma.forEach((function(t){o[N("on "+t)]=function(e){return r.trigger(t,e)}})),zt(mt(Ca,Sa({ref:p(r,"innerMoveable"),parentElement:e},i,o)),r.tempElement);var a=i.target;return R(a)&&a.length>1&&r.updateRect(),r}Ea(e,t);var n=e.prototype;return n.setState=function(t,e){this.innerMoveable.setState(t,e)},n.destroy=function(){zt(null,this.tempElement),this.off(),this.tempElement=null,this.innerMoveable=null},n.getMoveable=function(){return this.innerMoveable.moveable},e=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}([h(Da,(function(t,e){t[e]||(t[e]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=this.getMoveable();if(r&&r[e])return r[e].apply(r,t)})})),h(wa,(function(t,e){Object.defineProperty(t,e,{get:function(){return this.getMoveable().props[e]},set:function(t){var n;this.setState(((n={})[e]=t,n))},enumerable:!0,configurable:!0})}))],e),e}(Pa),Ta=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ea(e,t),e}(Ra);const ka=Ta;var Ba=function(t,e){return Ba=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Ba(t,e)};var za=function(){return za=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},za.apply(this,arguments)};function _a(t){return 180*(e=[t[0].clientX,t[0].clientY],n=[t[1].clientX,t[1].clientY],r=n[0]-e[0],i=n[1]-e[1],((o=Math.atan2(i,r))>=0?o:o+2*Math.PI)/Math.PI);var e,n,r,i,o}function Ga(t){return t.touches?function(t){for(var e=Math.min(t.length,2),n=[],r=0;r<e;++r)n.push(Aa(t[r]));return n}(t.touches):[Aa(t)]}function ja(t,e,n){var r=n.length,i=Na(t,r),o=i.clientX,a=i.clientY,s=i.originalClientX,u=i.originalClientY,l=Na(e,r),c=l.clientX,f=l.clientY,p=Na(n,r);return{clientX:s,clientY:u,deltaX:o-c,deltaY:a-f,distX:o-p.clientX,distY:a-p.clientY}}function Ia(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function Aa(t){return{clientX:t.clientX,clientY:t.clientY}}function Na(t,e){void 0===e&&(e=t.length);for(var n={clientX:0,clientY:0,originalClientX:0,originalClientY:0},r=0;r<e;++r){var i=t[r];n.originalClientX+="originalClientX"in i?i.originalClientX:i.clientX,n.originalClientY+="originalClientY"in i?i.originalClientY:i.clientY,n.clientX+=i.clientX,n.clientY+=i.clientY}return e?{clientX:n.clientX/e,clientY:n.clientY/e,originalClientX:n.originalClientX/e,originalClientY:n.originalClientY/e}:n}var Fa=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}var e=t.prototype;return e.addClients=function(t){void 0===t&&(t=this.prevClients);var e=this.getPosition(t),n=e.deltaX,r=e.deltaY;return this.movement+=Math.sqrt(n*n+r*r),this.prevClients=t,e},e.getAngle=function(t){return void 0===t&&(t=this.prevClients),_a(t)},e.getRotation=function(t){return void 0===t&&(t=this.prevClients),_a(t)-_a(this.startClients)},e.getPosition=function(t){return ja(t||this.prevClients,this.prevClients,this.startClients)},e.getPositions=function(t){void 0===t&&(t=this.prevClients);var e=this.prevClients;return this.startClients.map((function(n,r){return ja([t[r]],[e[r]],[n])}))},e.getMovement=function(t){var e=this.movement;if(!t)return e;var n=Na(t,this.length),r=Na(this.prevClients,this.length),i=n.clientX-r.clientX,o=n.clientY-r.clientY;return Math.sqrt(i*i+o*o)+e},e.getDistance=function(t){return void 0===t&&(t=this.prevClients),Ia(t)},e.getScale=function(t){return void 0===t&&(t=this.prevClients),Ia(t)/Ia(this.startClients)},e.move=function(t,e){this.startClients.forEach((function(n){n.clientX-=t,n.clientY-=e})),this.prevClients.forEach((function(n){n.clientX-=t,n.clientY-=e}))},t}(),Ya=["textarea","input"],Xa=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;r.options={},r.flag=!1,r.pinchFlag=!1,r.datas={},r.isDrag=!1,r.isPinch=!1,r.isMouse=!1,r.isTouch=!1,r.clientStores=[],r.targets=[],r.prevTime=0,r.doubleFlag=!1,r.onDragStart=function(t,e){if(void 0===e&&(e=!0),r.flag||!1!==t.cancelable){var n=r.options,i=n.container,o=n.pinchOutside,a=n.preventRightClick,s=n.preventDefault,u=n.checkInput,l=r.isTouch,c=!r.flag;if(c){var f=document.activeElement,p=t.target,d=p.tagName.toLowerCase(),h=Ya.indexOf(d)>-1,g=p.isContentEditable;if(h||g){if(u||f===p)return!1;if(f&&g&&f.isContentEditable&&f.contains(p))return!1}else if((s||"touchstart"===t.type)&&f){var v=f.tagName;(f.isContentEditable||Ya.indexOf(v)>-1)&&f.blur()}if(r.clientStores=[new Fa(Ga(t))],r.flag=!0,r.isDrag=!1,r.datas={},a&&(3===t.which||2===t.button))return r.initDrag(),!1;r.doubleFlag=Y()-r.prevTime<200,!1===r.emit("dragStart",za({datas:r.datas,inputEvent:t,isTrusted:e,isDouble:r.doubleFlag},r.getCurrentStore().getPosition()))&&r.initDrag(),r.flag&&s&&t.preventDefault()}if(!r.flag)return!1;var m=0;if(c&&l&&o&&(m=setTimeout((function(){rt(i,"touchstart",r.onDragStart,{passive:!1})}))),!c&&l&&o&&it(i,"touchstart",r.onDragStart),r.flag&&function(t){return t.touches&&t.touches.length>=2}(t)){if(clearTimeout(m),c&&t.touches.length!==t.changedTouches.length)return;r.pinchFlag||r.onPinchStart(t)}}},r.onDrag=function(t,e){if(r.flag){var n=Ga(t),i=r.moveClients(n,t,!1);if(r.pinchFlag||i.deltaX||i.deltaY)if(!1===r.emit("drag",za({},i,{isScroll:!!e,inputEvent:t})))return void r.stop();r.pinchFlag&&r.onPinch(t,n),r.getCurrentStore().addClients(n)}},r.onDragEnd=function(t){if(r.flag){var e=r.options,n=e.pinchOutside,i=e.container;r.isTouch&&n&&it(i,"touchstart",r.onDragStart),r.flag=!1;var o=r.getCurrentStore().getPosition(),a=Y(),s=!r.isDrag&&r.doubleFlag;r.prevTime=r.isDrag||s?0:a,r.emit("dragEnd",za({datas:r.datas,isDouble:s,isDrag:r.isDrag,isClick:!r.isDrag,inputEvent:t},o)),r.pinchFlag&&r.onPinchEnd(t),r.clientStores=[]}},r.onBlur=function(){r.onDragEnd()};var i=[].concat(e);r.options=za({checkInput:!1,container:i.length>1?window:i[0],preventRightClick:!0,preventDefault:!0,checkWindowBlur:!1,pinchThreshold:0,events:["touch","mouse"]},n);var o=r.options,a=o.container,s=o.events,u=o.checkWindowBlur;if(r.isTouch=s.indexOf("touch")>-1,r.isMouse=s.indexOf("mouse")>-1,r.targets=i,r.isMouse&&(i.forEach((function(t){rt(t,"mousedown",r.onDragStart)})),rt(a,"mousemove",r.onDrag),rt(a,"mouseup",r.onDragEnd),rt(a,"contextmenu",r.onDragEnd)),u&&rt(window,"blur",r.onBlur),r.isTouch){var l={passive:!1};i.forEach((function(t){rt(t,"touchstart",r.onDragStart,l)})),rt(a,"touchmove",r.onDrag,l),rt(a,"touchend",r.onDragEnd,l),rt(a,"touchcancel",r.onDragEnd,l)}return r}!function(t,e){function n(){this.constructor=t}Ba(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t);var n=e.prototype;return n.stop=function(){this.isDrag=!1,this.flag=!1,this.clientStores=[],this.datas={}},n.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce((function(t,e){return t+e.movement}),0)},n.isDragging=function(){return this.isDrag},n.isFlag=function(){return this.flag},n.isPinchFlag=function(){return this.pinchFlag},n.isDoubleFlag=function(){return this.doubleFlag},n.isPinching=function(){return this.isPinch},n.scrollBy=function(t,e,n,r){void 0===r&&(r=!0),this.flag&&(this.clientStores[0].move(t,e),r&&this.onDrag(n,!0))},n.move=function(t,e){var n=t[0],r=t[1],i=this.getCurrentStore().prevClients;return this.moveClients(i.map((function(t){var e=t.clientX,i=t.clientY;return{clientX:e+n,clientY:i+r,originalClientX:e,originalClientY:i}})),e,!0)},n.triggerDragStart=function(t){this.onDragStart(t,!1)},n.setEventDatas=function(t){var e=this.datas;for(var n in t)e[n]=t[n];return this},n.getEventDatas=function(){return this.datas},n.unset=function(){var t=this,e=this.targets,n=this.options.container;this.off(),it(window,"blur",this.onBlur),this.isMouse&&(e.forEach((function(e){it(e,"mousedown",t.onDragStart)})),it(n,"mousemove",this.onDrag),it(n,"mouseup",this.onDragEnd),it(n,"contextmenu",this.onDragEnd)),this.isTouch&&(e.forEach((function(e){it(e,"touchstart",t.onDragStart)})),it(n,"touchstart",this.onDragStart),it(n,"touchmove",this.onDrag),it(n,"touchend",this.onDragEnd),it(n,"touchcancel",this.onDragEnd))},n.onPinchStart=function(t){var e=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>e)){var n=new Fa(Ga(t));this.pinchFlag=!0,this.clientStores.splice(0,0,n),!1===this.emit("pinchStart",za({datas:this.datas,angle:n.getAngle(),touches:this.getCurrentStore().getPositions()},n.getPosition(),{inputEvent:t}))&&(this.pinchFlag=!1)}},n.onPinch=function(t,e){if(this.flag&&this.pinchFlag&&!(e.length<2)){var n=this.getCurrentStore();this.isPinch=!0,this.emit("pinch",za({datas:this.datas,movement:this.getMovement(e),angle:n.getAngle(e),rotation:n.getRotation(e),touches:n.getPositions(e),scale:n.getScale(e),distance:n.getDistance(e)},n.getPosition(e),{inputEvent:t}))}},n.onPinchEnd=function(t){if(this.pinchFlag){var e=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.getCurrentStore();this.emit("pinchEnd",za({datas:this.datas,isPinch:e,touches:n.getPositions()},n.getPosition(),{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}},n.initDrag=function(){this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1},n.getCurrentStore=function(){return this.clientStores[0]},n.moveClients=function(t,e,n){var r=this.getCurrentStore()[n?"addClients":"getPosition"](t);return this.isDrag=!0,za({datas:this.datas},r,{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:e})},e}(Xe);const La=Xa;var qa=function(t,e){return qa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},qa(t,e)};function Wa(t){return t&&"object"==typeof t}function Ha(t){return Array.isArray(t)}function Va(t){return"string"==typeof t}function $a(t,e,n,r){t.addEventListener(e,n,r)}function Ka(t,e,n){t.removeEventListener(e,n)}var Ua=function(){return Ua=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ua.apply(this,arguments)};var Za=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(Wa(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(Wa(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=function(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}(r,(function(t){return t.listener===e}));i>-1&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(t,e){var n=this;return e&&this._addEvent(t,e,{once:!0}),new Promise((function(e){n._addEvent(t,e,{once:!0})}))},e.emit=function(t,e){var n=this;void 0===e&&(e={});var r=this._events[t];if(!t||!r)return!0;var i=!1;return e.eventType=t,e.stop=function(){i=!0},e.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(r).forEach((function(r){r.listener(e),r.once&&n.off(t,r.listener)})),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(Ua({listener:e},n))},t}();var Ja,Qa,ts,es=(Ja=function(t,e){function n(t){if(t&&"object"==typeof t){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"==typeof t)return a[t];var n,o=String(t);return(n=r[o.toLowerCase()])?n:(n=i[o.toLowerCase()])||(1===o.length?o.charCodeAt(0):void 0)}n.isEventKey=function(t,e){if(t&&"object"==typeof t){var n=t.which||t.keyCode||t.charCode;if(null==n)return!1;if("string"==typeof e){var o;if(o=r[e.toLowerCase()])return o===n;if(o=i[e.toLowerCase()])return o===n}else if("number"==typeof e)return e===n;return!1}};var r=(e=t.exports=n).code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},i=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(o=97;o<123;o++)r[String.fromCharCode(o)]=o-32;for(var o=48;o<58;o++)r[o-48]=o;for(o=1;o<13;o++)r["f"+o]=o+111;for(o=0;o<10;o++)r["numpad "+o]=o+96;var a=e.names=e.title={};for(o in r)a[r[o]]=o;for(var s in i)r[s]=i[s]},Ja(Qa={exports:{}},Qa.exports),Qa.exports),ns=(es.code,es.codes,es.aliases,es.names),rs=(es.title,{"+":"plus","left command":"meta","right command":"meta"}),is={shift:1,ctrl:2,alt:3,meta:4};function os(t){var e=ns[t]||"";for(var n in rs)e=e.replace(n,rs[n]);return e.replace(/\s/g,"")}function as(t,e){void 0===e&&(e=os(t.keyCode));var n=function(t){return[t.shiftKey&&"shift",t.ctrlKey&&"ctrl",t.altKey&&"alt",t.metaKey&&"meta"].filter(Boolean)}(t);return-1===n.indexOf(e)&&n.push(e),n.filter(Boolean)}function ss(t){var e=t.slice();return e.sort((function(t,e){return(is[t]||5)-(is[e]||5)})),e}const us=function(t){function e(e){void 0===e&&(e=window);var n=t.call(this)||this;return n.container=e,n.ctrlKey=!1,n.altKey=!1,n.shiftKey=!1,n.metaKey=!1,n.clear=function(){return n.ctrlKey=!1,n.altKey=!1,n.shiftKey=!1,n.metaKey=!1,n},n.keydownEvent=function(t){n.triggerEvent("keydown",t)},n.keyupEvent=function(t){n.triggerEvent("keyup",t)},n.blur=function(){n.clear(),n.trigger("blur")},$a(e,"blur",n.blur),$a(e,"keydown",n.keydownEvent),$a(e,"keyup",n.keyupEvent),n}!function(t,e){function n(){this.constructor=t}qa(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t);var n=e.prototype;return Object.defineProperty(e,"global",{get:function(){return ts||(ts=new e)},enumerable:!1,configurable:!0}),e.setGlobal=function(){return this.global},n.destroy=function(){var t=this.container;this.clear(),this.off(),Ka(t,"blur",this.blur),Ka(t,"keydown",this.keydownEvent),Ka(t,"keyup",this.keyupEvent)},n.keydown=function(t,e){return this.addEvent("keydown",t,e)},n.offKeydown=function(t,e){return this.removeEvent("keydown",t,e)},n.offKeyup=function(t,e){return this.removeEvent("keyup",t,e)},n.keyup=function(t,e){return this.addEvent("keyup",t,e)},n.addEvent=function(t,e,n){return Ha(e)?this.on(t+"."+ss(e).join("."),n):Va(e)?this.on(t+"."+e,n):this.on(t,e),this},n.removeEvent=function(t,e,n){return Ha(e)?this.off(t+"."+ss(e).join("."),n):Va(e)?this.off(t+"."+e,n):this.off(t,e),this},n.triggerEvent=function(t,e){this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey;var n=os(e.keyCode),r={key:n,isToggle:"ctrl"===n||"shift"===n||"meta"===n||"alt"===n,inputEvent:e,keyCode:e.keyCode,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey};this.trigger(t,r),this.trigger(t+"."+n,r);var i=as(e,n);i.length>1&&this.trigger(t+"."+i.join("."),r)},e}(Za);var ls=function(t,e){return ls=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},ls(t,e)};function cs(t,e){function n(){this.constructor=t}ls(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var fs=function(){return fs=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},fs.apply(this,arguments)};function ps(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function ds(t,e,n){var r=t.tag,i=t.children,o=t.attributes,a=t.className,s=t.style,u=e||document.createElement(r);for(var l in o)u.setAttribute(l,o[l]);var c=u.children;if(i.forEach((function(t,e){ds(t,c[e],u)})),a&&a.split(" ").forEach((function(t){et(u,t)||nt(u,t)})),s){var f=u.style;for(var l in s)f[l]=s[l]}return!e&&n&&n.appendChild(u),u}function hs(t,e,n){t!==e&&n(t,e)}function gs(t,e,n){var r;void 0===n&&(n=t.datas.boundArea);var i=t.distX,o=void 0===i?0:i,a=t.distY,s=void 0===a?0:a,u=t.datas,l=u.startX,c=u.startY;if(e>0){var f=Math.sqrt((o*o+s*s)/(1+e*e));o=(o>=0?1:-1)*(e*f),s=(s>=0?1:-1)*f}var p=Math.abs(o),d=Math.abs(s);o=(o>=0?1:-1)*(p=(r=$([p,d],[0,0],[o<0?l-n.left:n.right-l,s<0?c-n.top:n.bottom-c],!!e))[0]),s=(s>=0?1:-1)*(d=r[1]);var h=l+Math.min(0,o),g=c+Math.min(0,s);return{left:h,top:g,right:h+p,bottom:g+d,width:p,height:d}}function vs(t){var e=t.getBoundingClientRect(),n=e.left,r=e.top,i=e.width,o=e.height;return{pos1:[n,r],pos2:[n+i,r],pos3:[n,r+o],pos4:[n+i,r+o]}}function ms(t,e){var n=Re(t,e),r=n.list,i=n.prevList,o=n.added,a=n.removed;return o.map((function(t){return r[t]})).concat(a.map((function(t){return i[t]})))}var bs=sn("\n:host {\n    position: fixed;\n    display: none;\n    border: 1px solid #4af;\n    background: rgba(68, 170, 255, 0.5);\n    z-index: 100;\n}\n:host {\n    position: absolute;\n}\n"),ys="selecto-selection "+bs.className,xs=["boundContainer","selectableTargets","selectByClick","selectFromInside","continueSelect","toggleContinueSelect","keyContainer","hitRate","scrollOptions","checkInput","preventDefault","ratio","getElementRect","preventDragFromInside","rootContainer","dragCondition"],Es=(function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a]}(["dragContainer","cspNonce"],xs),Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.selectedTargets=[],n.dragScroll=new We,n.onDragStart=function(t,e){var r=t.datas,i=t.clientX,o=t.clientY,a=t.inputEvent,s=n.options,u=s.continueSelect,l=s.selectFromInside,c=s.selectByClick,f=s.rootContainer,p=s.boundContainer,d=s.preventDragFromInside,h=void 0===d||d,g=s.dragCondition;if(!g||g(t)){n.findSelectableTargets(r),r.startSelectedTargets=n.selectedTargets,r.scaleMatrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.containerX=0,r.containerY=0;var v={left:-1/0,top:-1/0,right:1/0,bottom:1/0};if(f){var m=n.container.getBoundingClientRect();r.containerX=m.left,r.containerY=m.top,r.scaleMatrix=function(t,e){void 0===e&&(e=document.body);for(var n=t,r=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];n&&(r=ve(Se(getComputedStyle(n).transform),r),n!==e);)n=n.parentElement;return(r=ee(r,4))[12]=0,r[13]=0,r[14]=0,r}(n.container,f)}if(p){var b=P(p)&&"element"in p?fs({left:!0,top:!0,bottom:!0,right:!0},p):{element:p,left:!0,top:!0,bottom:!0,right:!0},y=b.element;if(y){var x=(T(y)?document.querySelector(y):!0===y?n.container:y).getBoundingClientRect();b.left&&(v.left=x.left),b.top&&(v.top=x.top),b.right&&(v.right=x.right),b.bottom&&(v.bottom=x.bottom)}}r.boundArea=v;var E={left:i,top:o,right:i,bottom:o,width:0,height:0},S=[];if(!l||c){for(var C=e||document.elementFromPoint(i,o);C&&!(r.selectableTargets.indexOf(C)>-1);)C=C.parentElement;S=C?[C]:[]}var w=S.length>0,D=!l&&w;if(D&&!c)return t.stop(),!1;var M=a.type,O="mousedown"===M||"touchstart"===M;if(!(!(!t.isClick&&O)||n.emit("dragStart",fs({},t))))return t.stop(),!1;u?(S=ms(n.selectedTargets,S),r.startPassedTargets=n.selectedTargets):r.startPassedTargets=[],n.select(n.selectedTargets,S,E,a,!0),r.startX=i,r.startY=o,r.selectFlag=!1,r.preventDragFromInside=!1;var R=Ce(r.scaleMatrix,[i-r.containerX,o-r.containerY]);if(r.boundsArea=n.target.style.cssText+="position: "+(f?"absolute":"fixed")+";left:0px;top:0px;transform: translate("+R[0]+"px, "+R[1]+"px)",D&&c)a.preventDefault(),h&&(n.selectEnd(r.startSelectedTargets,r.startPassedTargets,E,t),r.preventDragFromInside=!0);else{r.selectFlag=!0,"touchstart"===M&&a.preventDefault();var k=n.options.scrollOptions;k&&k.container&&n.dragScroll.dragStart(t,k)}return!0}t.stop()},n.onDrag=function(t){if(t.datas.selectFlag){var e=n.options.scrollOptions;if(e&&e.container&&n.dragScroll.drag(t,e))return}n.check(t)},n.onDragEnd=function(t){var e=t.datas,r=t.inputEvent,i=gs(t,n.options.ratio),o=e.selectFlag;r&&!t.isClick&&n.emit("dragEnd",fs(fs({isDouble:!!t.isDouble,isDrag:!1,isSelect:o},t),{isClick:!!t.isClick,rect:i})),n.target.style.cssText+="display: none;",o&&(e.selectFlag=!1,n.dragScroll.dragEnd()),e.preventDragFromInside||n.selectEnd(e.startSelectedTargets,e.startPassedTargets,i,t)},n.onKeyDown=function(t){n.sameCombiKey(t)&&(n.continueSelect=!0,n.emit("keydown",{}))},n.onKeyUp=function(t){n.sameCombiKey(t,!0)&&(n.continueSelect=!1,n.emit("keyup",{}))},n.onBlur=function(){n.toggleContinueSelect&&n.continueSelect&&(n.continueSelect=!1,n.emit("keyup",{}))},n.onDocumentSelectStart=function(t){if(n.gesto.isFlag()){var e=n.dragContainer;e===window&&(e=document.documentElement);var r=e instanceof Element?[e]:[].slice.call(e),i=t.target;r.some((function(e){if(e===i||e.contains(i))return t.preventDefault(),!0}))}},n.target=e.target,n.container=e.container||document.body,n.options=fs({target:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,hitRate:100,continueSelect:!1,toggleContinueSelect:null,keyContainer:null,scrollOptions:void 0,checkInput:!1,preventDefault:!1,boundContainer:!1,preventDragFromInside:!0,dragCondition:null,rootContainer:null,getElementRect:vs,cspNonce:"",ratio:0},e),n.initElement(),n.initDragScroll(),n.setKeyController(),n}cs(e,t);var n=e.prototype;return n.setSelectedTargets=function(t){return this.selectedTargets=t,this},n.getSelectedTargets=function(){return this.selectedTargets},n.setKeyContainer=function(t){var e=this,n=this.options;hs(n.keyContainer,t,(function(){n.keyContainer=t,e.setKeyController()}))},n.setToggleContinueSelect=function(t){var e=this,n=this.options;hs(n.toggleContinueSelect,t,(function(){n.toggleContinueSelect=t,e.setKeyEvent()}))},n.setPreventDefault=function(t){this.gesto.options.preventDefault=t},n.setCheckInput=function(t){this.gesto.options.checkInput=t},n.triggerDragStart=function(t){return this.gesto.triggerDragStart(t),this},n.destroy=function(){this.off(),this.keycon&&this.keycon.destroy(),this.gesto.unset(),this.injectResult.destroy(),it(document,"selectstart",this.onDocumentSelectStart),this.keycon=null,this.gesto=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},n.getElementPoints=function(t){var e=this.getElementRect||vs,n=e(t),r=[n.pos1,n.pos2,n.pos4,n.pos3];return e!==vs?Be(r,t.getBoundingClientRect()):r},n.getSelectableElements=function(){var t=[];return this.options.selectableTargets.forEach((function(e){P(e)?t.push(e):[].slice.call(document.querySelectorAll(e)).forEach((function(e){t.push(e)}))})),t},n.findSelectableTargets=function(t){var e=this;void 0===t&&(t=this.gesto.getEventDatas());var n=this.getSelectableElements(),r=n.map((function(t){return e.getElementPoints(t)}));t.selectableTargets=n,t.selectablePoints=r},n.clickTarget=function(t,e){var n=function(t){if("touches"in t){var e=t.touches[0]||t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}}return{clientX:t.clientX,clientY:t.clientY}}(t),r={datas:{selectFlag:!1},clientX:n.clientX,clientY:n.clientY,inputEvent:t,isClick:!0,stop:function(){return!1}};return this.onDragStart(r,e)&&this.onDragEnd(r),this},n.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect;this.keycon&&(this.keycon.destroy(),this.keycon=null),n&&(this.keycon=new us(e||window),this.keycon.keydown(this.onKeyDown).keyup(this.onKeyUp).on("blur",this.onBlur))},n.setKeyEvent=function(){this.options.toggleContinueSelect&&!this.keycon&&this.setKeyController()},n.initElement=function(){this.target=ds(function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e||{},o=i.className,a=void 0===o?"":o,s=i.style,u=void 0===s?{}:s,l=ps(i,["className","style"]);return{tag:t,className:a,style:u,attributes:l,children:n}}("div",{className:ys}),this.target,this.container);var t=this.target,e=this.options,n=e.dragContainer,r=e.checkInput,i=e.preventDefault;this.dragContainer="string"==typeof n?[].slice.call(document.querySelectorAll(n)):this.options.dragContainer||this.target.parentNode,this.gesto=new La(this.dragContainer,{checkWindowBlur:!0,container:window,checkInput:r,preventDefault:i}).on({dragStart:this.onDragStart,drag:this.onDrag,dragEnd:this.onDragEnd}),rt(document,"selectstart",this.onDocumentSelectStart),this.injectResult=bs.inject(t,{nonce:this.options.cspNonce})},n.hitTest=function(t,e,n,r,i){var o=this.options,a=o.hitRate,s=o.selectByClick,u=t.left,l=t.top,c=t.right,f=t.bottom,p=[[u,l],[c,l],[c,f],[u,f]];return r.filter((function(t,r){var o=i[r],u=_e([e,n],o);if(s&&u)return!0;var l=Ne(p,o);if(!l.length)return!1;var c=ke(l),f=ke(o);return H(Math.round(c/f*100),0,100)>=Math.min(100,a)}))},n.initDragScroll=function(){var t=this;this.dragScroll.on("scroll",(function(e){var n=e.container,r=e.direction;t.emit("scroll",{container:n,direction:r})})).on("move",(function(e){var n=e.offsetX,r=e.offsetY,i=e.inputEvent,o=i.datas,a=o.boundArea;o.startX-=n,o.startY-=r,o.selectablePoints.forEach((function(t){t.forEach((function(t){t[0]-=n,t[1]-=r}))})),a.left-=n,a.right-=n,a.top-=r,a.bottom-=r,t.gesto.scrollBy(n,r,i.inputEvent,!1),i.distX+=n,i.distY+=r,t.check(i)}))},n.select=function(t,e,n,r,i){var o=Re(t,e),a=o.added,s=o.removed,u=o.prevList,l=o.list;this.selectedTargets=e,i&&this.emit("selectStart",{selected:e,added:a.map((function(t){return l[t]})),removed:s.map((function(t){return u[t]})),rect:n,inputEvent:r}),(a.length||s.length)&&this.emit("select",{selected:e,added:a.map((function(t){return l[t]})),removed:s.map((function(t){return u[t]})),rect:n,inputEvent:r})},n.selectEnd=function(t,e,n,r){var i=r.inputEvent,o=r.isDouble,a=Re(t,this.selectedTargets),s=a.added,u=a.removed,l=a.prevList,c=a.list,f=Re(e,this.selectedTargets),p=f.added,d=f.removed,h=f.prevList,g=f.list,v=i&&i.type,m="mousedown"===v||"touchstart"===v;this.emit("selectEnd",{selected:this.selectedTargets,added:s.map((function(t){return c[t]})),removed:u.map((function(t){return l[t]})),afterAdded:p.map((function(t){return g[t]})),afterRemoved:d.map((function(t){return h[t]})),isDragStart:m,isClick:!!r.isClick,isDouble:!!o,rect:n,inputEvent:i})},n.check=function(t,e){void 0===e&&(e=gs(t,this.options.ratio));var n=t.datas,r=t.inputEvent,i=e.top,o=e.left,a=e.width,s=e.height,u=n.selectFlag,l=n.containerX,c=n.containerY,f=n.scaleMatrix,p=Ce(f,[o-l,i-c]),d=Ce(f,[a,s]),h=[],g=[];if(u){this.target.style.cssText+="display: block;left:0px;top:0px;transform: translate("+p[0]+"px, "+p[1]+"px);width:"+d[0]+"px;height:"+d[1]+"px;";var v=this.hitTest(e,n.startX,n.startY,n.selectableTargets,n.selectablePoints);h=this.selectedTargets,g=ms(n.startPassedTargets,v),this.selectedTargets=g}if(!1===this.emit("drag",fs(fs({},t),{isSelect:u,rect:e})))return this.target.style.cssText+="display: none;",void t.stop();u&&this.select(h,g,e,r)},n.sameCombiKey=function(t,e){var n=[].concat(this.options.toggleContinueSelect),r=as(t.inputEvent,t.key),i=R(n[0])?n:[n];if(e){var o=t.key;return i.some((function(t){return t.some((function(t){return t===o}))}))}return i.some((function(t){return t.every((function(t){return r.indexOf(t)>-1}))}))},e=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}([h(xs,(function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},r=N("set "+e);t[r]?n.set=function(t){this[r](t)}:n.set=function(t){this.options[e]=t},Object.defineProperty(t,e,n)}))],e),e}(Xe)),Ss=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return cs(e,t),e}(Es);const Cs=Ss;var ws=n("./public/app/core/config.ts"),Ds=n("./packages/grafana-ui/src/index.ts"),Ms=n("./public/app/features/canvas/index.ts"),Os=n("./public/app/features/dimensions/utils.ts"),Ps=n("./public/app/features/canvas/elements/notFound.tsx"),Rs=n("./public/app/features/canvas/runtime/element.tsx");let Ts;!function(t){t.Delete="delete",t.Duplicate="duplicate",t.MoveTop="move-top",t.MoveBottom="move-bottom"}(Ts||(Ts={}));var ks,Bs=n("../../opt/drone/yarncache/lodash-npm-4.17.21-6382451519-eb835a2e51.zip/node_modules/lodash/lodash.js"),zs=n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");function _s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const Gs={id:"group",name:"Group",description:"Group",getNewOptions:()=>({config:{}}),display:()=>ks||(ks=(0,zs.jsx)("div",{children:"GROUP!"}))};class js extends Rs.f{constructor(t,e,n){var r;super(Gs,t,n),r=this,_s(this,"elements",[]),_s(this,"scene",void 0),_s(this,"doAction",(function(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];switch(t){case Ts.Delete:r.elements=r.elements.filter((t=>t!==e)),r.scene.byName.delete(e.options.name),r.scene.save(),r.reinitializeMoveable();break;case Ts.Duplicate:if("group"===e.item.id)return void console.log("Can not duplicate groups (yet)",t,e);const i=(0,Bs.cloneDeep)(e.options);e.anchor.top&&(i.placement.top+=10),e.anchor.left&&(i.placement.left+=10),e.anchor.bottom&&(i.placement.bottom+=10),e.anchor.right&&(i.placement.right+=10);const o=new Rs.f(e.item,i,r);o.updateSize(e.width,e.height),o.updateData(r.scene.context),n&&(o.options.name=r.scene.getNextElementName()),r.elements.push(o),r.scene.byName.set(o.options.name,o),r.scene.save(),r.reinitializeMoveable();break;default:return void console.log("DO action",t,e)}})),this.options=t,this.parent=n,this.scene=e;let{elements:i}=this.options;i||(this.options.elements=i=[]);for(const t of i)if("group"===t.type)this.elements.push(new js(t,e,this));else{var o;const e=null!==(o=Ms.Jk.getIfExists(t.type))&&void 0!==o?o:Ps.C;this.elements.push(new Rs.f(e,t,this))}}isRoot(){return!1}updateSize(t,e){super.updateSize(t,e),this.parent||(this.width=t,this.height=e,this.sizeStyle.width=t,this.sizeStyle.height=e);for(const t of this.elements)t.updateSize(this.width,this.height);this.sizeStyle.width=t,this.sizeStyle.height=e,this.sizeStyle.position="absolute"}updateData(t){super.updateData(t);for(const e of this.elements)e.updateData(t)}reorder(t,e){const n=Array.from(this.elements),[r]=n.splice(t,1);n.splice(e,0,r),this.elements=n,this.reinitializeMoveable()}reinitializeMoveable(){this.scene.clearCurrentSelection(),setTimeout((()=>this.scene.initMoveable(!0)),100)}render(){return(0,zs.jsx)("div",{style:Object.assign({},this.sizeStyle,this.dataStyle),children:this.elements.map((t=>t.render()))},`${this.UID}/${this.revId}`)}visit(t){super.visit(t);for(const e of this.elements)t(e)}getSaveModel(){return Object.assign({},this.options,{elements:this.elements.map((t=>t.getSaveModel()))})}}const Is=["placement","anchor"];class As extends js{constructor(t,e,n){super(t,e),this.options=t,this.scene=e,this.changeCallback=n}isRoot(){return!0}updateSize(t,e){super.updateSize(t,e),this.width=t,this.height=e,this.sizeStyle.width=t,this.sizeStyle.height=e}onChange(t){this.revId++,this.options=Object.assign({},t),this.changeCallback()}getSaveModel(){const t=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(this.options,Is);return Object.assign({},t,{elements:this.elements.map((t=>t.getSaveModel()))})}}function Ns(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Fs{constructor(t,e,n){var r=this;Ns(this,"styles",Ys(ws.vc.theme2)),Ns(this,"selection",new u.t(1)),Ns(this,"moved",new l.x),Ns(this,"byName",new Map),Ns(this,"root",void 0),Ns(this,"revId",0),Ns(this,"width",0),Ns(this,"height",0),Ns(this,"style",{}),Ns(this,"data",void 0),Ns(this,"selecto",void 0),Ns(this,"moveable",void 0),Ns(this,"div",void 0),Ns(this,"currentLayer",void 0),Ns(this,"getNextElementName",(function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=t?"Group":"Element";let n=r.byName.size+1;const i=n+100;for(;n<i;){const t=`${e} ${n++}`;if(!r.byName.has(t))return t}return`${e} ${Date.now()}`})),Ns(this,"canRename",(t=>!this.byName.has(t))),Ns(this,"context",{getColor:t=>(0,Os.FP)(this.data,t),getScale:t=>(0,Os.pb)(this.data,t),getScalar:t=>(0,Os.z2)(this.data,t),getText:t=>(0,Os.WO)(this.data,t),getResource:t=>(0,Os.Qz)(this.data,t)}),Ns(this,"save",(()=>{this.onSave(this.root.getSaveModel())})),Ns(this,"findElementByTarget",(t=>{const e=[...this.root.elements];for(;e.length>0;){const n=e.shift();if(n&&n.div&&n.div===t)return n;const r=n instanceof js?n.elements:[];for(const t of r)e.unshift(t)}})),Ns(this,"setRef",(t=>{this.div=t})),Ns(this,"select",(t=>{this.selecto&&(this.selecto.setSelectedTargets(t.targets),this.updateSelection(t))})),Ns(this,"updateSelection",(t=>{if(this.moveable.target=t.targets,t.group)this.selection.next([t.group]);else{const e=t.targets.map((t=>this.findElementByTarget(t)));this.selection.next(e)}})),Ns(this,"generateTargetElements",(t=>{let e=[];const n=[...t];for(;n.length>0;){const t=n.shift();t&&t.div&&e.push(t.div);const r=t instanceof js?t.elements:[];for(const t of r)n.unshift(t)}return e})),Ns(this,"initMoveable",(function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=r.generateTargetElements(r.root.elements);var i;t&&(null===(i=r.selecto)||void 0===i||i.destroy());r.selecto=new Cs({container:r.div,selectableTargets:n,selectByClick:!0}),r.moveable=new ka(r.div,{draggable:e,resizable:e,origin:!1}).on("clickGroup",(t=>{r.selecto.clickTarget(t.inputEvent,t.inputTarget)})).on("drag",(t=>{r.findElementByTarget(t.target).applyDrag(t),r.moved.next(Date.now())})).on("dragGroup",(t=>{t.events.forEach((t=>{r.findElementByTarget(t.target).applyDrag(t)})),r.moved.next(Date.now())})).on("dragEnd",(t=>{const e=r.findElementByTarget(t.target);if(e&&e.parent){const t=e.parent;e.updateSize(t.width,t.height)}})).on("resize",(t=>{r.findElementByTarget(t.target).applyResize(t),r.moved.next(Date.now())})).on("resizeGroup",(t=>{t.events.forEach((t=>{r.findElementByTarget(t.target).applyResize(t)})),r.moved.next(Date.now())}));let o=[];r.selecto.on("dragStart",(t=>{const e=t.inputEvent.target;(r.moveable.isMoveableElement(e)||o.some((t=>t===e||t.contains(e))))&&t.stop()})).on("selectEnd",(t=>{o=t.selected,r.updateSelection({targets:o}),t.isDragStart&&(t.inputEvent.preventDefault(),setTimeout((()=>{r.moveable.dragStart(t.inputEvent)})))}))})),this.onSave=n,this.root=this.load(t,e)}load(t,e){return this.root=new As(null!=t?t:{type:"group",elements:[Ms.Nm]},this,this.save),setTimeout((()=>{if(this.div){const t=e;this.initMoveable(t,e)}}),100),this.root}updateData(t){this.data=t,this.root.updateData(this.context)}updateSize(t,e){var n;this.width=t,this.height=e,this.style={width:t,height:e},this.root.updateSize(t,e),null!==(n=this.selecto)&&void 0!==n&&n.getSelectedTargets().length&&this.clearCurrentSelection()}groupSelection(){this.selection.pipe((0,c.P)()).subscribe((t=>{const e=t[0].parent,n=new js({type:"group",name:this.getNextElementName(!0),elements:[]},this,t[0].parent);t.forEach((t=>{e.doAction(Ts.Delete,t),n.doAction(Ts.Duplicate,t,!1)})),e.elements.push(n),this.byName.set(n.getName(),n),this.save()}))}clearCurrentSelection(){var t;let e=new MouseEvent("click");null===(t=this.selecto)||void 0===t||t.clickTarget(e,this.div)}updateCurrentLayer(t){this.currentLayer=t,this.clearCurrentSelection(),this.save()}toggleAnchor(t,e){var n,r,i,o;const{div:a}=t;if(!a)return void console.log("Not ready");const s=null!==(n=null===(r=t.parent)||void 0===r?void 0:r.width)&&void 0!==n?n:100,u=null!==(i=null===(o=t.parent)||void 0===o?void 0:o.height)&&void 0!==i?i:100,l=a.getBoundingClientRect();console.log("DIV info",a);const c={top:l.top,left:l.left,width:l.width,height:l.height,bottom:u-l.bottom,right:s-l.right};console.log("PPP",c),this.moved.next(Date.now())}render(){return(0,zs.jsx)("div",{className:this.styles.wrap,style:this.style,ref:this.setRef,children:this.root.render()},this.revId)}}const Ys=(0,Ds.stylesFactory)((t=>({wrap:s.css`
    overflow: hidden;
    position: relative;
  `,toolbar:s.css`
    position: absolute;
    bottom: 0;
    margin: 10px;
  `})));function Xs(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Ls extends i.Component{constructor(t){super(t),Xs(this,"panelContext",{}),Xs(this,"scene",void 0),Xs(this,"subs",new o.w0),Xs(this,"needsReload",!1),Xs(this,"onUpdateScene",(t=>{const{onOptionsChange:e,options:n}=this.props;e(Object.assign({},n,{root:t})),this.setState({refresh:this.state.refresh+1})})),this.state={refresh:0},this.scene=new Fs(this.props.options.root,this.props.options.inlineEditing,this.onUpdateScene),this.scene.updateSize(t.width,t.height),this.scene.updateData(t.data),this.subs.add(this.props.eventBus.subscribe(a.xF,(t=>{this.scene.clearCurrentSelection()}))),this.subs.add(this.props.eventBus.subscribe(a.Yr,(t=>{this.props.id===t.payload&&(this.needsReload=!0)})))}componentDidMount(){this.panelContext=this.context,this.panelContext.onInstanceStateChange&&(this.panelContext.onInstanceStateChange({scene:this.scene,layer:this.scene.root}),this.subs.add(this.scene.selection.subscribe({next:t=>{this.panelContext.onInstanceStateChange({scene:this.scene,selected:t,layer:this.scene.root})}})))}componentWillUnmount(){this.subs.unsubscribe()}shouldComponentUpdate(t,e){const{width:n,height:r,data:i}=this.props;let o=!1;n===t.width&&r===t.height||(this.scene.updateSize(t.width,t.height),o=!0),i!==t.data&&(this.scene.updateData(t.data),o=!0),this.state.refresh!==e.refresh&&(o=!0);var a;(this.needsReload&&this.props.options!==t.options||this.props.options.inlineEditing!==t.options.inlineEditing)&&(this.needsReload=!1,this.scene.load(t.options.root,t.options.inlineEditing),this.scene.updateSize(t.width,t.height),this.scene.updateData(t.data),o=!0,this.props.options.inlineEditing&&(null===(a=this.scene.selecto)||void 0===a||a.destroy()));return o}render(){return this.scene.render()}}Xs(Ls,"contextType",Ds.PanelContextRoot);var qs,Ws,Hs,Vs=n("./public/app/plugins/panel/canvas/editor/options.ts"),$s=n("./public/app/features/dashboard/components/PanelEditor/utils.ts"),Ks=n("./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useObservable.js"),Us=n("./public/app/features/dimensions/editors/NumberInput.tsx");const Zs=["top","left","bottom","right"],Js=["top","left","bottom","right","width","height"],Qs=t=>{let{item:e}=t;const n=e.settings;if((0,Ks.Z)(null!=n&&n.scene?n.scene.moved:new l.x),!n)return qs||(qs=(0,zs.jsx)("div",{children:"Loading..."}));const r=n.element;if(!r)return Ws||(Ws=(0,zs.jsx)("div",{children:"???"}));const{placement:i}=r;return(0,zs.jsxs)("div",{children:[(0,zs.jsx)(Ds.HorizontalGroup,{children:Zs.map((t=>(0,zs.jsx)(Ds.Button,{size:"sm",variant:r.anchor[t]?"primary":"secondary",onClick:()=>n.scene.toggleAnchor(r,t),children:t},t)))}),Hs||(Hs=(0,zs.jsx)("br",{})),(0,zs.jsx)(Ds.Field,{label:"Position",children:(0,zs.jsx)(zs.Fragment,{children:Js.map((t=>{const e=i[t];return null==e?null:(0,zs.jsx)(Ds.InlineFieldRow,{children:(0,zs.jsx)(Ds.InlineField,{label:t,labelWidth:8,grow:!0,children:(0,zs.jsx)(Us.Y,{value:e,onChange:e=>console.log("TODO, edit!!!",t,e)})})},t)}))})})]})};var tu,eu,nu,ru=n("./public/app/core/app_events.ts"),iu=n("./public/app/core/components/Layers/LayerDragDropList.tsx"),ou=n("./public/app/core/components/Layers/AddLayerButton.tsx");function au(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class su extends i.PureComponent{constructor(){super(...arguments),au(this,"getScene",(()=>{const{settings:t}=this.props.item;if(null!=t&&t.layer)return t.layer.scene})),au(this,"onAddItem",(t=>{var e;const{settings:n}=this.props.item;if(null==n||!n.layer)return;const{layer:r}=n,i=null!==(e=Ms.Jk.getIfExists(t.value))&&void 0!==e?e:Ps.C,o=i.getNewOptions();o.type=i.id;const a=new Rs.f(i,o,r);a.updateSize(a.width,a.height),a.updateData(r.scene.context),r.elements.push(a),r.scene.save(),r.reinitializeMoveable()})),au(this,"onSelect",(t=>{const{settings:e}=this.props.item;if(null!=e&&e.scene)try{let n={targets:[]};if(t instanceof js){const r=[];t.elements.forEach((t=>{r.push(t.div)})),n.targets=r,n.group=t,e.scene.select(n)}else if(t instanceof Rs.f){const r=[null==t?void 0:t.div];n.targets=r,e.scene.select(n)}}catch(t){ru.Z.emit(r.AppEvents.alertError,["Unable to select element, try selecting element in panel instead"])}})),au(this,"onClearSelection",(()=>{const{settings:t}=this.props.item;if(null==t||!t.layer)return;const{layer:e}=t;e.scene.clearCurrentSelection()})),au(this,"onDragEnd",(t=>{if(!t.destination)return;const{settings:e}=this.props.item;if(null==e||!e.layer)return;const{layer:n}=e,r=n.elements.length-1,i=-1*(t.source.index-r),o=-1*(t.destination.index-r);n.reorder(i,o)})),au(this,"goUpLayer",(()=>{const t=this.props.item.settings;if(null==t||!t.layer||null==t||!t.scene)return;const{scene:e,layer:n}=t;n.parent&&e.updateCurrentLayer(n.parent)})),au(this,"decoupleGroup",(()=>{const t=this.props.item.settings;if(null==t||!t.layer)return;const{layer:e}=t;this.deleteGroup(),e.elements.forEach((t=>{var n;null===(n=e.parent)||void 0===n||n.doAction(Ts.Duplicate,t,!1)}))})),au(this,"onDecoupleGroup",(()=>{ru.Z.publish(new a.VJ({title:"Decouple group",text:"Are you sure you want to decouple this group?",text2:"This will remove the group and push nested elements in the next level up.",confirmText:"Yes",yesText:"Decouple",onConfirm:async()=>{this.decoupleGroup()}}))})),au(this,"deleteGroup",(()=>{var t;const e=this.props.item.settings;if(null==e||!e.layer)return;const{layer:n}=e,r=this.getScene();null==r||r.byName.delete(n.getName()),n.elements.forEach((t=>null==r?void 0:r.byName.delete(t.getName()))),null===(t=n.parent)||void 0===t||t.doAction(Ts.Delete,n),this.goUpLayer()})),au(this,"onGroupSelection",(()=>{const t=this.getScene();t?t.groupSelection():console.warn("no scene!")})),au(this,"onDeleteGroup",(()=>{ru.Z.publish(new a.VJ({title:"Delete group",text:"Are you sure you want to delete this group?",text2:"This will delete the group and all nested elements.",icon:"trash-alt",confirmText:"Delete",yesText:"Delete",onConfirm:async()=>{this.deleteGroup()}}))}))}render(){const t=this.props.item.settings;if(!t)return tu||(tu=(0,zs.jsx)("div",{children:"No settings"}));const e=t.layer;if(!e)return eu||(eu=(0,zs.jsx)("div",{children:"Missing layer?"}));const n=t.selected?t.selected.map((t=>t.getName())):[];return(0,zs.jsxs)(zs.Fragment,{children:[!e.isRoot()&&(0,zs.jsxs)(zs.Fragment,{children:[(0,zs.jsx)(Ds.Button,{icon:"angle-up",size:"sm",variant:"secondary",onClick:this.goUpLayer,children:"Go Up Level"}),(0,zs.jsx)(Ds.Button,{size:"sm",variant:"secondary",onClick:()=>this.onSelect(e),children:"Select Group"}),(0,zs.jsx)(Ds.Button,{size:"sm",variant:"secondary",onClick:()=>this.onDecoupleGroup(),children:"Decouple Group"}),(0,zs.jsx)(Ds.Button,{size:"sm",variant:"secondary",onClick:()=>this.onDeleteGroup(),children:"Delete Group"})]}),(0,zs.jsx)(iu.E,{onDragEnd:this.onDragEnd,onSelect:this.onSelect,onDelete:t=>{e.doAction(Ts.Delete,t)},onDuplicate:t=>{e.doAction(Ts.Duplicate,t)},getLayerInfo:t=>t.options.type,onNameChange:(t,e)=>{t.onChange(Object.assign({},t.options,{name:e}))},verifyLayerNameUniqueness:t=>{const e=this.getScene();return Boolean(null==e?void 0:e.canRename(t))},isGroup:t=>t instanceof js,layers:e.elements,selection:n}),nu||(nu=(0,zs.jsx)("br",{})),(0,zs.jsxs)(Ds.HorizontalGroup,{children:[(0,zs.jsx)(ou.f,{onChange:this.onAddItem,options:Ms.Jk.selectOptions().options,label:"Add item"}),n.length>0&&(0,zs.jsx)(Ds.Button,{size:"sm",variant:"secondary",onClick:this.onClearSelection,children:"Clear Selection"}),n.length>1&&(0,zs.jsx)(Ds.Button,{size:"sm",variant:"secondary",onClick:this.onGroupSelection,children:"Group items"})]})]})}}const uu=new r.PanelPlugin(Ls).setNoPadding().useFieldConfig().setPanelOptions(((t,e)=>{const n=e.instanceState;if(t.addBooleanSwitch({path:"inlineEditing",name:"Inline editing",description:"Enable editing the panel directly",defaultValue:!0}),n){t.addNestedOptions(function(t){const{selected:e,scene:n}=t;if(n.currentLayer||(n.currentLayer=n.root),e)for(const t of e){if(t instanceof js){n.currentLayer=t;break}if(t.parent){n.currentLayer=t.parent;break}}const r=n.currentLayer.options||{elements:[]};return{category:["Layer"],path:"--",values:t=>({getValue:t=>(0,Bs.get)(r,t),onChange:(t,e)=>{var i;if("type"===t&&e)return void console.warn("unable to change layer type");const o=(0,$s.hs)(r,t,e);null===(i=n.currentLayer)||void 0===i||i.onChange(o)}}),build:(i,o)=>{const a=n.currentLayer;a&&a.isRoot(),i.addCustomEditor({id:"content",path:"root",name:"Elements",editor:su,settings:{scene:n,layer:n.currentLayer,selected:e}});const s=Object.assign({},o,{options:r});Vs.I.addBackground(i,s),Vs.I.addBorder(i,s),a&&!a.isRoot()&&i.addCustomEditor({category:["Layout"],id:"content",path:"__",name:"Anchor",editor:Qs,settings:{scene:t.scene,element:a}})}}}(n));const e=n.selected;if(1===(null==e?void 0:e.length)){const i=e[0];i instanceof js||t.addNestedOptions({category:(r={category:[`Selected element (${i.options.name})`],element:i,scene:n.scene}).category,path:"--",values:t=>({getValue:t=>(0,Bs.get)(r.element.options,t),onChange:(t,e)=>{let n=r.element.options;if("type"===t&&e){const t=Ms.Jk.getIfExists(e);if(!t)return void console.warn("layer does not exist",e);n=Object.assign({},n,t.getNewOptions(n),{type:t.id})}else n=(0,$s.hs)(n,t,e);r.element.onChange(n),r.element.updateData(r.scene.context)}}),build:(t,e)=>{var n;const{options:i}=r.element,o=Ms.Jk.selectOptions(null!=i&&i.type?[i.type]:[Ms.Nm.type]);t.addSelect({path:"type",name:void 0,settings:{options:o.options}});const a=Ms.Jk.getIfExists(null!==(n=null==i?void 0:i.type)&&void 0!==n?n:Ms.Nm.type);let s=i;s||(s=Object.assign({},a.getNewOptions(i),{type:a.id,name:`Element ${Date.now()}.${Math.floor(100*Math.random())}`}));const u=Object.assign({},e,{options:s});null!=a&&a.registerOptionsUI&&a.registerOptionsUI(t,u),Vs.I.addBackground(t,u),Vs.I.addBorder(t,u),t.addCustomEditor({category:["Layout"],id:"content",path:"__",name:"Anchor",editor:Qs,settings:r})}})}}var r}))},"./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useObservable.js":(t,e,n)=>{n.d(e,{Z:()=>o});var r=n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),i=n("./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useIsomorphicLayoutEffect.js");const o=function(t,e){var n=(0,r.useState)(e),o=n[0],a=n[1];return(0,i.Z)((function(){var e=t.subscribe(a);return function(){return e.unsubscribe()}}),[t]),o}}}]);
//# sourceMappingURL=canvasPanel.cd4ada1146b53ad3284f.js.map