@havue/components 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1619,7 +1619,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1619
1619
  const secondColor = colorItems[1];
1620
1620
  const curColorType = maxColor.type + secondColor.type;
1621
1621
  let coordinateX = 0;
1622
- let coordinateY = colorItems[2].value;
1622
+ const coordinateY = colorItems[2].value;
1623
1623
  if (curColorType === "rg" || curColorType === "gr") {
1624
1624
  coordinateX = 255;
1625
1625
  if (secondColor.type === "r") {
@@ -1656,8 +1656,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1656
1656
  }
1657
1657
  const scaleX = canvasWidth / width;
1658
1658
  const scaleY = canvasHeight / height;
1659
- x = Math.min(x * scaleX, canvasWidth - 1);
1660
- y = Math.min(y * scaleY, canvasHeight - 1);
1659
+ x = Math.round(Math.min(x * scaleX, canvasWidth - 1));
1660
+ y = Math.round(Math.min(y * scaleY, canvasHeight - 1));
1661
1661
  const color2 = getBaseColorFromCoodinage(x, y);
1662
1662
  return color2;
1663
1663
  }
@@ -1729,39 +1729,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1729
1729
  }
1730
1730
  };
1731
1731
  }
1732
- class EventBus {
1733
- constructor() {
1734
- __publicField(this, "_eventMap");
1735
- this._eventMap = /* @__PURE__ */ new Map();
1736
- }
1737
- on(key, handler) {
1738
- const handlers = this._eventMap.get(key);
1739
- if (handlers) {
1740
- handlers.add(handler);
1741
- } else {
1742
- const set = /* @__PURE__ */ new Set();
1743
- set.add(handler);
1744
- this._eventMap.set(key, set);
1745
- }
1746
- }
1747
- off(key, handler) {
1748
- const handlers = this._eventMap.get(key);
1749
- if (!handlers) return;
1750
- if (handler) {
1751
- handlers.delete(handler);
1752
- } else {
1753
- handlers.clear();
1754
- }
1755
- }
1756
- emit(key, ...payload) {
1757
- const handlers = this._eventMap.get(key);
1758
- if (!handlers) return;
1759
- for (const callback of handlers.values()) {
1760
- callback(...payload);
1761
- }
1762
- }
1763
- }
1764
- const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
1765
1732
  function useOperateEvent() {
1766
1733
  const colorAreaRef = vue.ref();
1767
1734
  const circlePickerCoordinate = vue.reactive({
@@ -1834,8 +1801,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1834
1801
  } else {
1835
1802
  y = clientY - top;
1836
1803
  }
1837
- circlePickerCoordinate.x = Math.round(x);
1838
- circlePickerCoordinate.y = Math.round(y);
1804
+ circlePickerCoordinate.x = x;
1805
+ circlePickerCoordinate.y = y;
1839
1806
  }
1840
1807
  function handleMouseUp() {
1841
1808
  document.body.removeEventListener("mousemove", handleMouseMove);
@@ -1855,23 +1822,17 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1855
1822
  }
1856
1823
  vue.onMounted(() => {
1857
1824
  var _a, _b;
1858
- if (isMobile) {
1859
- (_a = colorAreaRef.value) == null ? void 0 : _a.addEventListener("touchstart", handleTouchStart);
1860
- } else {
1861
- (_b = colorAreaRef.value) == null ? void 0 : _b.addEventListener("mousedown", handleMounseDown);
1862
- }
1825
+ (_a = colorAreaRef.value) == null ? void 0 : _a.addEventListener("touchstart", handleTouchStart);
1826
+ (_b = colorAreaRef.value) == null ? void 0 : _b.addEventListener("mousedown", handleMounseDown);
1863
1827
  });
1864
1828
  vue.onBeforeUnmount(() => {
1865
1829
  var _a, _b;
1866
- if (isMobile) {
1867
- (_a = colorAreaRef.value) == null ? void 0 : _a.removeEventListener("touchstart", handleTouchStart);
1868
- document.body.removeEventListener("touchmove", handleTouchMove);
1869
- document.body.removeEventListener("touchend", handleTouchEnd);
1870
- } else {
1871
- (_b = colorAreaRef.value) == null ? void 0 : _b.removeEventListener("mousedown", handleMounseDown);
1872
- document.body.removeEventListener("mousemove", handleMouseMove);
1873
- document.body.removeEventListener("mouseup", handleMouseUp);
1874
- }
1830
+ (_a = colorAreaRef.value) == null ? void 0 : _a.removeEventListener("touchstart", handleTouchStart);
1831
+ document.body.removeEventListener("touchmove", handleTouchMove);
1832
+ document.body.removeEventListener("touchend", handleTouchEnd);
1833
+ (_b = colorAreaRef.value) == null ? void 0 : _b.removeEventListener("mousedown", handleMounseDown);
1834
+ document.body.removeEventListener("mousemove", handleMouseMove);
1835
+ document.body.removeEventListener("mouseup", handleMouseUp);
1875
1836
  });
1876
1837
  return {
1877
1838
  colorAreaRef,
@@ -2083,7 +2044,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2083
2044
  const _hoisted_2 = { class: "hv-color-picker__title" };
2084
2045
  const _hoisted_3 = { class: "hv-color-picker__area-outer" };
2085
2046
  const _hoisted_4 = { class: "hv-color-picker__slider" };
2086
- const DEFAULT_COLOR = "#ffffff";
2047
+ const DEFAULT_COLOR = "#FFFFFF";
2087
2048
  const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2088
2049
  ...{
2089
2050
  name: "HvColorPicker"
@@ -2227,6 +2188,38 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2227
2188
  }
2228
2189
  });
2229
2190
  const HvColorPicker = withInstall(_sfc_main$3);
2191
+ class EventBus {
2192
+ constructor() {
2193
+ __publicField(this, "_eventMap");
2194
+ this._eventMap = /* @__PURE__ */ new Map();
2195
+ }
2196
+ on(key, handler) {
2197
+ const handlers = this._eventMap.get(key);
2198
+ if (handlers) {
2199
+ handlers.add(handler);
2200
+ } else {
2201
+ const set = /* @__PURE__ */ new Set();
2202
+ set.add(handler);
2203
+ this._eventMap.set(key, set);
2204
+ }
2205
+ }
2206
+ off(key, handler) {
2207
+ const handlers = this._eventMap.get(key);
2208
+ if (!handlers) return;
2209
+ if (handler) {
2210
+ handlers.delete(handler);
2211
+ } else {
2212
+ handlers.clear();
2213
+ }
2214
+ }
2215
+ emit(key, ...payload) {
2216
+ const handlers = this._eventMap.get(key);
2217
+ if (!handlers) return;
2218
+ for (const callback of handlers.values()) {
2219
+ callback(...payload);
2220
+ }
2221
+ }
2222
+ }
2230
2223
  class DnDManager extends EventBus {
2231
2224
  constructor() {
2232
2225
  super();
@@ -2432,15 +2425,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2432
2425
  const onMouseDown = this.onMouseDown.bind(this);
2433
2426
  const onMouseMove = this.onMouseMove.bind(this);
2434
2427
  const onMouseUp = this.onMouseUp.bind(this);
2435
- if (isMobile) {
2436
- document.body.addEventListener("touchstart", onTouchStart, { passive: false });
2437
- document.body.addEventListener("touchmove", onTouchMove, { passive: false });
2438
- document.body.addEventListener("touchend", onTouchEnd, { passive: false });
2439
- } else {
2440
- document.body.addEventListener("mousedown", onMouseDown);
2441
- document.body.addEventListener("mousemove", onMouseMove);
2442
- document.body.addEventListener("mouseup", onMouseUp);
2443
- }
2428
+ document.body.addEventListener("touchstart", onTouchStart, { passive: false });
2429
+ document.body.addEventListener("touchmove", onTouchMove, { passive: false });
2430
+ document.body.addEventListener("touchend", onTouchEnd, { passive: false });
2431
+ document.body.addEventListener("mousedown", onMouseDown);
2432
+ document.body.addEventListener("mousemove", onMouseMove);
2433
+ document.body.addEventListener("mouseup", onMouseUp);
2444
2434
  this.destroy = () => {
2445
2435
  document.body.removeEventListener("touchstart", onTouchStart);
2446
2436
  document.body.removeEventListener("touchmove", onTouchMove);
@@ -2506,7 +2496,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2506
2496
  transform: `translate(${cloneNodePosition.x}px, ${cloneNodePosition.y}px) translate(-50%, -50%)`
2507
2497
  };
2508
2498
  });
2509
- DnDManagerInstance.on("down", (params) => {
2499
+ const onDown = (params) => {
2510
2500
  const { x, y } = params;
2511
2501
  const startEl = document.elementFromPoint(x, y);
2512
2502
  if (!props.disabled && dragItemRef.value && dragItemRef.value.contains(startEl)) {
@@ -2518,8 +2508,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2518
2508
  downPosition.x = x;
2519
2509
  downPosition.y = y;
2520
2510
  }
2521
- });
2522
- DnDManagerInstance.on("first-move", (params, event) => {
2511
+ };
2512
+ const onFirstMove = (params, event) => {
2523
2513
  const { x, y } = params;
2524
2514
  const directions = immediateDirections.value.filter((item) => item !== ImmediateEnumType.ALL);
2525
2515
  if (isDownThis.value && !props.disabled && directions.length) {
@@ -2545,21 +2535,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2545
2535
  return;
2546
2536
  }
2547
2537
  }
2548
- });
2549
- DnDManagerInstance.on("start", (params) => {
2538
+ };
2539
+ const onStart = (params) => {
2550
2540
  const { x, y } = params;
2551
2541
  const startEl = document.elementFromPoint(x, y);
2552
2542
  if (!props.disabled && dragItemRef.value && dragItemRef.value.contains(startEl)) {
2553
2543
  handleStart(params);
2554
2544
  }
2555
- });
2556
- DnDManagerInstance.on("move", (params) => {
2545
+ };
2546
+ const onMove = (params) => {
2557
2547
  const { point } = params;
2558
2548
  if (isDragThis.value) {
2559
2549
  handleMove(point);
2560
2550
  }
2561
- });
2562
- DnDManagerInstance.on("end", () => {
2551
+ };
2552
+ const onEnd = () => {
2563
2553
  isDownThis.value = false;
2564
2554
  isDragThis.value = false;
2565
2555
  Object.assign(downPosition, {
@@ -2570,7 +2560,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2570
2560
  x: 0,
2571
2561
  y: 0
2572
2562
  });
2573
- });
2563
+ };
2574
2564
  function handleStart(point) {
2575
2565
  isDragThis.value = true;
2576
2566
  cloneNodePosition.x = point.x;
@@ -2581,6 +2571,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2581
2571
  cloneNodePosition.x = point.x;
2582
2572
  cloneNodePosition.y = point.y;
2583
2573
  }
2574
+ vue.onMounted(() => {
2575
+ DnDManagerInstance.on("down", onDown);
2576
+ DnDManagerInstance.on("first-move", onFirstMove);
2577
+ DnDManagerInstance.on("start", onStart);
2578
+ DnDManagerInstance.on("move", onMove);
2579
+ DnDManagerInstance.on("end", onEnd);
2580
+ });
2581
+ vue.onBeforeUnmount(() => {
2582
+ DnDManagerInstance.off("down", onDown);
2583
+ DnDManagerInstance.off("first-move", onFirstMove);
2584
+ DnDManagerInstance.off("start", onStart);
2585
+ DnDManagerInstance.off("move", onMove);
2586
+ DnDManagerInstance.off("end", onEnd);
2587
+ });
2584
2588
  return (_ctx, _cache) => {
2585
2589
  return vue.openBlock(), vue.createElementBlock("div", {
2586
2590
  ref_key: "dragItemRef",
@@ -2608,7 +2612,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2608
2612
  }
2609
2613
  return target;
2610
2614
  };
2611
- const Draggable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-1d116395"]]);
2615
+ const Draggable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-e9c66d0f"]]);
2612
2616
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2613
2617
  ...{
2614
2618
  name: "HvDroppable"
@@ -2648,7 +2652,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2648
2652
  }
2649
2653
  };
2650
2654
  }
2651
- DnDManagerInstance.on("move", (params) => {
2655
+ const onMove = (params) => {
2652
2656
  const { type, data, point } = params;
2653
2657
  if (dropAreaRef.value && acceptDragTypeList.value.includes(type)) {
2654
2658
  const { isInArea, position } = getPositionInArea(point);
@@ -2664,12 +2668,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2664
2668
  emits("leave", type, data);
2665
2669
  }
2666
2670
  }
2667
- });
2668
- DnDManagerInstance.on("end", ({ type, point, data }) => {
2671
+ };
2672
+ const onEnd = ({ type, point, data }) => {
2669
2673
  if (dropAreaRef.value && acceptDragTypeList.value.includes(type) && isEntered.value) {
2670
2674
  const { position } = getPositionInArea(point);
2671
2675
  emits("drop", type, position, data);
2672
2676
  }
2677
+ };
2678
+ vue.onMounted(() => {
2679
+ DnDManagerInstance.on("move", onMove);
2680
+ DnDManagerInstance.on("end", onEnd);
2681
+ });
2682
+ vue.onBeforeUnmount(() => {
2683
+ DnDManagerInstance.off("move", onMove);
2684
+ DnDManagerInstance.off("end", onEnd);
2673
2685
  });
2674
2686
  return (_ctx, _cache) => {
2675
2687
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -3123,23 +3135,17 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3123
3135
  }
3124
3136
  function bindEvent() {
3125
3137
  removeEvent();
3126
- if (isMobile) {
3127
- _operateEl.value.addEventListener("touchstart", onTouchStart, { capture: true });
3128
- } else {
3129
- _operateEl.value.addEventListener("mousedown", onMouseDown);
3130
- }
3138
+ _operateEl.value.addEventListener("touchstart", onTouchStart, { capture: true });
3139
+ _operateEl.value.addEventListener("mousedown", onMouseDown);
3131
3140
  }
3132
3141
  function removeEvent() {
3133
- if (isMobile) {
3134
- _operateEl.value.removeEventListener("touchstart", onTouchStart);
3135
- document.body.removeEventListener("touchmove", onTouchMove);
3136
- document.body.removeEventListener("touchend", onTouchEnd);
3137
- document.body.removeEventListener("touchcancel", onTouchEnd);
3138
- } else {
3139
- _operateEl.value.removeEventListener("mousedown", onMouseDown);
3140
- document.body.removeEventListener("mousemove", onMouseMove);
3141
- document.body.removeEventListener("mouseup", onMouseUp);
3142
- }
3142
+ _operateEl.value.removeEventListener("touchstart", onTouchStart);
3143
+ document.body.removeEventListener("touchmove", onTouchMove);
3144
+ document.body.removeEventListener("touchend", onTouchEnd);
3145
+ document.body.removeEventListener("touchcancel", onTouchEnd);
3146
+ _operateEl.value.removeEventListener("mousedown", onMouseDown);
3147
+ document.body.removeEventListener("mousemove", onMouseMove);
3148
+ document.body.removeEventListener("mouseup", onMouseUp);
3143
3149
  }
3144
3150
  vue.onBeforeUnmount(() => {
3145
3151
  isOperateStart = false;
@@ -1,2 +1,2 @@
1
- (function(B,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(B=typeof globalThis<"u"?globalThis:B||self,l(B.components={},B.Vue))})(this,function(B,l){"use strict";var rn=Object.defineProperty;var sn=(B,l,K)=>l in B?rn(B,l,{enumerable:!0,configurable:!0,writable:!0,value:K}):B[l]=K;var U=(B,l,K)=>sn(B,typeof l!="symbol"?l+"":l,K);const K=(e,n)=>(e.install=t=>{for(const o of[e,...Object.values({})])t.component(o.name,o)},e);function nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $e={exports:{}},ze={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ne={exports:{}},ot=function(n){return!n||typeof n=="string"?!1:n instanceof Array||Array.isArray(n)||n.length>=0&&(n.splice instanceof Function||Object.getOwnPropertyDescriptor(n,n.length-1)&&n.constructor.name!=="String")},rt=ot,st=Array.prototype.concat,at=Array.prototype.slice,Ie=Ne.exports=function(n){for(var t=[],o=0,r=n.length;o<r;o++){var s=n[o];rt(s)?t=st.call(t,at.call(s)):t.push(s)}return t};Ie.wrap=function(e){return function(){return e(Ie(arguments))}};var it=Ne.exports,ue=ze,de=it,Xe=Object.hasOwnProperty,Ye=Object.create(null);for(var Me in ue)Xe.call(ue,Me)&&(Ye[ue[Me]]=Me);var I=$e.exports={to:{},get:{}};I.get=function(e){var n=e.substring(0,3).toLowerCase(),t,o;switch(n){case"hsl":t=I.get.hsl(e),o="hsl";break;case"hwb":t=I.get.hwb(e),o="hwb";break;default:t=I.get.rgb(e),o="rgb";break}return t?{model:o,value:t}:null},I.get.rgb=function(e){if(!e)return null;var n=/^#([a-f0-9]{3,4})$/i,t=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,o=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,r=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,s=/^(\w+)$/,a=[0,0,0,1],i,u,f;if(i=e.match(t)){for(f=i[2],i=i[1],u=0;u<3;u++){var h=u*2;a[u]=parseInt(i.slice(h,h+2),16)}f&&(a[3]=parseInt(f,16)/255)}else if(i=e.match(n)){for(i=i[1],f=i[3],u=0;u<3;u++)a[u]=parseInt(i[u]+i[u],16);f&&(a[3]=parseInt(f+f,16)/255)}else if(i=e.match(o)){for(u=0;u<3;u++)a[u]=parseInt(i[u+1],0);i[4]&&(i[5]?a[3]=parseFloat(i[4])*.01:a[3]=parseFloat(i[4]))}else if(i=e.match(r)){for(u=0;u<3;u++)a[u]=Math.round(parseFloat(i[u+1])*2.55);i[4]&&(i[5]?a[3]=parseFloat(i[4])*.01:a[3]=parseFloat(i[4]))}else return(i=e.match(s))?i[1]==="transparent"?[0,0,0,0]:Xe.call(ue,i[1])?(a=ue[i[1]],a[3]=1,a):null:null;for(u=0;u<3;u++)a[u]=Z(a[u],0,255);return a[3]=Z(a[3],0,1),a},I.get.hsl=function(e){if(!e)return null;var n=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=e.match(n);if(t){var o=parseFloat(t[4]),r=(parseFloat(t[1])%360+360)%360,s=Z(parseFloat(t[2]),0,100),a=Z(parseFloat(t[3]),0,100),i=Z(isNaN(o)?1:o,0,1);return[r,s,a,i]}return null},I.get.hwb=function(e){if(!e)return null;var n=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=e.match(n);if(t){var o=parseFloat(t[4]),r=(parseFloat(t[1])%360+360)%360,s=Z(parseFloat(t[2]),0,100),a=Z(parseFloat(t[3]),0,100),i=Z(isNaN(o)?1:o,0,1);return[r,s,a,i]}return null},I.to.hex=function(){var e=de(arguments);return"#"+ve(e[0])+ve(e[1])+ve(e[2])+(e[3]<1?ve(Math.round(e[3]*255)):"")},I.to.rgb=function(){var e=de(arguments);return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},I.to.rgb.percent=function(){var e=de(arguments),n=Math.round(e[0]/255*100),t=Math.round(e[1]/255*100),o=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+n+"%, "+t+"%, "+o+"%)":"rgba("+n+"%, "+t+"%, "+o+"%, "+e[3]+")"},I.to.hsl=function(){var e=de(arguments);return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},I.to.hwb=function(){var e=de(arguments),n="";return e.length>=4&&e[3]!==1&&(n=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+n+")"},I.to.keyword=function(e){return Ye[e.slice(0,3)]};function Z(e,n,t){return Math.min(Math.max(n,e),t)}function ve(e){var n=Math.round(e).toString(16).toUpperCase();return n.length<2?"0"+n:n}var lt=$e.exports;const he=ze,We={};for(const e of Object.keys(he))We[he[e]]=e;const g={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Ue=g;for(const e of Object.keys(g)){if(!("channels"in g[e]))throw new Error("missing channels property: "+e);if(!("labels"in g[e]))throw new Error("missing channel labels property: "+e);if(g[e].labels.length!==g[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:n,labels:t}=g[e];delete g[e].channels,delete g[e].labels,Object.defineProperty(g[e],"channels",{value:n}),Object.defineProperty(g[e],"labels",{value:t})}g.rgb.hsl=function(e){const n=e[0]/255,t=e[1]/255,o=e[2]/255,r=Math.min(n,t,o),s=Math.max(n,t,o),a=s-r;let i,u;s===r?i=0:n===s?i=(t-o)/a:t===s?i=2+(o-n)/a:o===s&&(i=4+(n-t)/a),i=Math.min(i*60,360),i<0&&(i+=360);const f=(r+s)/2;return s===r?u=0:f<=.5?u=a/(s+r):u=a/(2-s-r),[i,u*100,f*100]},g.rgb.hsv=function(e){let n,t,o,r,s;const a=e[0]/255,i=e[1]/255,u=e[2]/255,f=Math.max(a,i,u),h=f-Math.min(a,i,u),d=function(c){return(f-c)/6/h+1/2};return h===0?(r=0,s=0):(s=h/f,n=d(a),t=d(i),o=d(u),a===f?r=o-t:i===f?r=1/3+n-o:u===f&&(r=2/3+t-n),r<0?r+=1:r>1&&(r-=1)),[r*360,s*100,f*100]},g.rgb.hwb=function(e){const n=e[0],t=e[1];let o=e[2];const r=g.rgb.hsl(e)[0],s=1/255*Math.min(n,Math.min(t,o));return o=1-1/255*Math.max(n,Math.max(t,o)),[r,s*100,o*100]},g.rgb.cmyk=function(e){const n=e[0]/255,t=e[1]/255,o=e[2]/255,r=Math.min(1-n,1-t,1-o),s=(1-n-r)/(1-r)||0,a=(1-t-r)/(1-r)||0,i=(1-o-r)/(1-r)||0;return[s*100,a*100,i*100,r*100]};function ct(e,n){return(e[0]-n[0])**2+(e[1]-n[1])**2+(e[2]-n[2])**2}g.rgb.keyword=function(e){const n=We[e];if(n)return n;let t=1/0,o;for(const r of Object.keys(he)){const s=he[r],a=ct(e,s);a<t&&(t=a,o=r)}return o},g.keyword.rgb=function(e){return he[e]},g.rgb.xyz=function(e){let n=e[0]/255,t=e[1]/255,o=e[2]/255;n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92;const r=n*.4124+t*.3576+o*.1805,s=n*.2126+t*.7152+o*.0722,a=n*.0193+t*.1192+o*.9505;return[r*100,s*100,a*100]},g.rgb.lab=function(e){const n=g.rgb.xyz(e);let t=n[0],o=n[1],r=n[2];t/=95.047,o/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;const s=116*o-16,a=500*(t-o),i=200*(o-r);return[s,a,i]},g.hsl.rgb=function(e){const n=e[0]/360,t=e[1]/100,o=e[2]/100;let r,s,a;if(t===0)return a=o*255,[a,a,a];o<.5?r=o*(1+t):r=o+t-o*t;const i=2*o-r,u=[0,0,0];for(let f=0;f<3;f++)s=n+1/3*-(f-1),s<0&&s++,s>1&&s--,6*s<1?a=i+(r-i)*6*s:2*s<1?a=r:3*s<2?a=i+(r-i)*(2/3-s)*6:a=i,u[f]=a*255;return u},g.hsl.hsv=function(e){const n=e[0];let t=e[1]/100,o=e[2]/100,r=t;const s=Math.max(o,.01);o*=2,t*=o<=1?o:2-o,r*=s<=1?s:2-s;const a=(o+t)/2,i=o===0?2*r/(s+r):2*t/(o+t);return[n,i*100,a*100]},g.hsv.rgb=function(e){const n=e[0]/60,t=e[1]/100;let o=e[2]/100;const r=Math.floor(n)%6,s=n-Math.floor(n),a=255*o*(1-t),i=255*o*(1-t*s),u=255*o*(1-t*(1-s));switch(o*=255,r){case 0:return[o,u,a];case 1:return[i,o,a];case 2:return[a,o,u];case 3:return[a,i,o];case 4:return[u,a,o];case 5:return[o,a,i]}},g.hsv.hsl=function(e){const n=e[0],t=e[1]/100,o=e[2]/100,r=Math.max(o,.01);let s,a;a=(2-t)*o;const i=(2-t)*r;return s=t*r,s/=i<=1?i:2-i,s=s||0,a/=2,[n,s*100,a*100]},g.hwb.rgb=function(e){const n=e[0]/360;let t=e[1]/100,o=e[2]/100;const r=t+o;let s;r>1&&(t/=r,o/=r);const a=Math.floor(6*n),i=1-o;s=6*n-a,a&1&&(s=1-s);const u=t+s*(i-t);let f,h,d;switch(a){default:case 6:case 0:f=i,h=u,d=t;break;case 1:f=u,h=i,d=t;break;case 2:f=t,h=i,d=u;break;case 3:f=t,h=u,d=i;break;case 4:f=u,h=t,d=i;break;case 5:f=i,h=t,d=u;break}return[f*255,h*255,d*255]},g.cmyk.rgb=function(e){const n=e[0]/100,t=e[1]/100,o=e[2]/100,r=e[3]/100,s=1-Math.min(1,n*(1-r)+r),a=1-Math.min(1,t*(1-r)+r),i=1-Math.min(1,o*(1-r)+r);return[s*255,a*255,i*255]},g.xyz.rgb=function(e){const n=e[0]/100,t=e[1]/100,o=e[2]/100;let r,s,a;return r=n*3.2406+t*-1.5372+o*-.4986,s=n*-.9689+t*1.8758+o*.0415,a=n*.0557+t*-.204+o*1.057,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,r=Math.min(Math.max(0,r),1),s=Math.min(Math.max(0,s),1),a=Math.min(Math.max(0,a),1),[r*255,s*255,a*255]},g.xyz.lab=function(e){let n=e[0],t=e[1],o=e[2];n/=95.047,t/=100,o/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;const r=116*t-16,s=500*(n-t),a=200*(t-o);return[r,s,a]},g.lab.xyz=function(e){const n=e[0],t=e[1],o=e[2];let r,s,a;s=(n+16)/116,r=t/500+s,a=s-o/200;const i=s**3,u=r**3,f=a**3;return s=i>.008856?i:(s-16/116)/7.787,r=u>.008856?u:(r-16/116)/7.787,a=f>.008856?f:(a-16/116)/7.787,r*=95.047,s*=100,a*=108.883,[r,s,a]},g.lab.lch=function(e){const n=e[0],t=e[1],o=e[2];let r;r=Math.atan2(o,t)*360/2/Math.PI,r<0&&(r+=360);const a=Math.sqrt(t*t+o*o);return[n,a,r]},g.lch.lab=function(e){const n=e[0],t=e[1],r=e[2]/360*2*Math.PI,s=t*Math.cos(r),a=t*Math.sin(r);return[n,s,a]},g.rgb.ansi16=function(e,n=null){const[t,o,r]=e;let s=n===null?g.rgb.hsv(e)[2]:n;if(s=Math.round(s/50),s===0)return 30;let a=30+(Math.round(r/255)<<2|Math.round(o/255)<<1|Math.round(t/255));return s===2&&(a+=60),a},g.hsv.ansi16=function(e){return g.rgb.ansi16(g.hsv.rgb(e),e[2])},g.rgb.ansi256=function(e){const n=e[0],t=e[1],o=e[2];return n===t&&t===o?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(t/255*5)+Math.round(o/255*5)},g.ansi16.rgb=function(e){let n=e%10;if(n===0||n===7)return e>50&&(n+=3.5),n=n/10.5*255,[n,n,n];const t=(~~(e>50)+1)*.5,o=(n&1)*t*255,r=(n>>1&1)*t*255,s=(n>>2&1)*t*255;return[o,r,s]},g.ansi256.rgb=function(e){if(e>=232){const s=(e-232)*10+8;return[s,s,s]}e-=16;let n;const t=Math.floor(e/36)/5*255,o=Math.floor((n=e%36)/6)/5*255,r=n%6/5*255;return[t,o,r]},g.rgb.hex=function(e){const t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t},g.hex.rgb=function(e){const n=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];let t=n[0];n[0].length===3&&(t=t.split("").map(i=>i+i).join(""));const o=parseInt(t,16),r=o>>16&255,s=o>>8&255,a=o&255;return[r,s,a]},g.rgb.hcg=function(e){const n=e[0]/255,t=e[1]/255,o=e[2]/255,r=Math.max(Math.max(n,t),o),s=Math.min(Math.min(n,t),o),a=r-s;let i,u;return a<1?i=s/(1-a):i=0,a<=0?u=0:r===n?u=(t-o)/a%6:r===t?u=2+(o-n)/a:u=4+(n-t)/a,u/=6,u%=1,[u*360,a*100,i*100]},g.hsl.hcg=function(e){const n=e[1]/100,t=e[2]/100,o=t<.5?2*n*t:2*n*(1-t);let r=0;return o<1&&(r=(t-.5*o)/(1-o)),[e[0],o*100,r*100]},g.hsv.hcg=function(e){const n=e[1]/100,t=e[2]/100,o=n*t;let r=0;return o<1&&(r=(t-o)/(1-o)),[e[0],o*100,r*100]},g.hcg.rgb=function(e){const n=e[0]/360,t=e[1]/100,o=e[2]/100;if(t===0)return[o*255,o*255,o*255];const r=[0,0,0],s=n%1*6,a=s%1,i=1-a;let u=0;switch(Math.floor(s)){case 0:r[0]=1,r[1]=a,r[2]=0;break;case 1:r[0]=i,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=a;break;case 3:r[0]=0,r[1]=i,r[2]=1;break;case 4:r[0]=a,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=i}return u=(1-t)*o,[(t*r[0]+u)*255,(t*r[1]+u)*255,(t*r[2]+u)*255]},g.hcg.hsv=function(e){const n=e[1]/100,t=e[2]/100,o=n+t*(1-n);let r=0;return o>0&&(r=n/o),[e[0],r*100,o*100]},g.hcg.hsl=function(e){const n=e[1]/100,o=e[2]/100*(1-n)+.5*n;let r=0;return o>0&&o<.5?r=n/(2*o):o>=.5&&o<1&&(r=n/(2*(1-o))),[e[0],r*100,o*100]},g.hcg.hwb=function(e){const n=e[1]/100,t=e[2]/100,o=n+t*(1-n);return[e[0],(o-n)*100,(1-o)*100]},g.hwb.hcg=function(e){const n=e[1]/100,o=1-e[2]/100,r=o-n;let s=0;return r<1&&(s=(o-r)/(1-r)),[e[0],r*100,s*100]},g.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},g.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},g.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},g.gray.hsl=function(e){return[0,0,e[0]]},g.gray.hsv=g.gray.hsl,g.gray.hwb=function(e){return[0,100,e[0]]},g.gray.cmyk=function(e){return[0,0,0,e[0]]},g.gray.lab=function(e){return[e[0],0,0]},g.gray.hex=function(e){const n=Math.round(e[0]/100*255)&255,o=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(o.length)+o},g.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const be=Ue;function ut(){const e={},n=Object.keys(be);for(let t=n.length,o=0;o<t;o++)e[n[o]]={distance:-1,parent:null};return e}function dt(e){const n=ut(),t=[e];for(n[e].distance=0;t.length;){const o=t.pop(),r=Object.keys(be[o]);for(let s=r.length,a=0;a<s;a++){const i=r[a],u=n[i];u.distance===-1&&(u.distance=n[o].distance+1,u.parent=o,t.unshift(i))}}return n}function ht(e,n){return function(t){return n(e(t))}}function ft(e,n){const t=[n[e].parent,e];let o=be[n[e].parent][e],r=n[e].parent;for(;n[r].parent;)t.unshift(n[r].parent),o=ht(be[n[r].parent][r],o),r=n[r].parent;return o.conversion=t,o}var mt=function(e){const n=dt(e),t={},o=Object.keys(n);for(let r=o.length,s=0;s<r;s++){const a=o[s];n[a].parent!==null&&(t[a]=ft(a,n))}return t};const Ee=Ue,pt=mt,oe={},gt=Object.keys(Ee);function vt(e){const n=function(...t){const o=t[0];return o==null?o:(o.length>1&&(t=o),e(t))};return"conversion"in e&&(n.conversion=e.conversion),n}function bt(e){const n=function(...t){const o=t[0];if(o==null)return o;o.length>1&&(t=o);const r=e(t);if(typeof r=="object")for(let s=r.length,a=0;a<s;a++)r[a]=Math.round(r[a]);return r};return"conversion"in e&&(n.conversion=e.conversion),n}gt.forEach(e=>{oe[e]={},Object.defineProperty(oe[e],"channels",{value:Ee[e].channels}),Object.defineProperty(oe[e],"labels",{value:Ee[e].labels});const n=pt(e);Object.keys(n).forEach(o=>{const r=n[o];oe[e][o]=bt(r),oe[e][o].raw=vt(r)})});var yt=oe;const re=lt,X=yt,je=["keyword","gray","hex"],Se={};for(const e of Object.keys(X))Se[[...X[e].labels].sort().join("")]=e;const ye={};function O(e,n){if(!(this instanceof O))return new O(e,n);if(n&&n in je&&(n=null),n&&!(n in X))throw new Error("Unknown model: "+n);let t,o;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof O)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const r=re.get(e);if(r===null)throw new Error("Unable to parse color from string: "+e);this.model=r.model,o=X[this.model].channels,this.color=r.value.slice(0,o),this.valpha=typeof r.value[o]=="number"?r.value[o]:1}else if(e.length>0){this.model=n||"rgb",o=X[this.model].channels;const r=Array.prototype.slice.call(e,0,o);this.color=Fe(r,o),this.valpha=typeof e[o]=="number"?e[o]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const r=Object.keys(e);"alpha"in e&&(r.splice(r.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const s=r.sort().join("");if(!(s in Se))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Se[s];const{labels:a}=X[this.model],i=[];for(t=0;t<a.length;t++)i.push(e[a[t]]);this.color=Fe(i)}if(ye[this.model])for(o=X[this.model].channels,t=0;t<o;t++){const r=ye[this.model][t];r&&(this.color[t]=r(this.color[t]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}O.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let n=this.model in re.to?this:this.rgb();n=n.round(typeof e=="number"?e:1);const t=n.valpha===1?n.color:[...n.color,this.valpha];return re.to[n.model](t)},percentString(e){const n=this.rgb().round(typeof e=="number"?e:1),t=n.valpha===1?n.color:[...n.color,this.valpha];return re.to.rgb.percent(t)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:n}=X[this.model],{labels:t}=X[this.model];for(let o=0;o<n;o++)e[t[o]]=this.color[o];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new O([...this.color.map(xt(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new O([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:T("rgb",0,D(255)),green:T("rgb",1,D(255)),blue:T("rgb",2,D(255)),hue:T(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:T("hsl",1,D(100)),lightness:T("hsl",2,D(100)),saturationv:T("hsv",1,D(100)),value:T("hsv",2,D(100)),chroma:T("hcg",1,D(100)),gray:T("hcg",2,D(100)),white:T("hwb",1,D(100)),wblack:T("hwb",2,D(100)),cyan:T("cmyk",0,D(100)),magenta:T("cmyk",1,D(100)),yellow:T("cmyk",2,D(100)),black:T("cmyk",3,D(100)),x:T("xyz",0,D(95.047)),y:T("xyz",1,D(100)),z:T("xyz",2,D(108.833)),l:T("lab",0,D(100)),a:T("lab",1),b:T("lab",2),keyword(e){return e!==void 0?new O(e):X[this.model].keyword(this.color)},hex(e){return e!==void 0?new O(e):re.to.hex(this.rgb().round().color)},hexa(e){if(e!==void 0)return new O(e);const n=this.rgb().round().color;let t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),re.to.hex(n)+t},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,n=[];for(const[t,o]of e.entries()){const r=o/255;n[t]=r<=.04045?r/12.92:((r+.055)/1.055)**2.4}return .2126*n[0]+.7152*n[1]+.0722*n[2]},contrast(e){const n=this.luminosity(),t=e.luminosity();return n>t?(n+.05)/(t+.05):(t+.05)/(n+.05)},level(e){const n=this.contrast(e);return n>=7?"AAA":n>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let n=0;n<3;n++)e.color[n]=255-e.color[n];return e},lighten(e){const n=this.hsl();return n.color[2]+=n.color[2]*e,n},darken(e){const n=this.hsl();return n.color[2]-=n.color[2]*e,n},saturate(e){const n=this.hsl();return n.color[1]+=n.color[1]*e,n},desaturate(e){const n=this.hsl();return n.color[1]-=n.color[1]*e,n},whiten(e){const n=this.hwb();return n.color[1]+=n.color[1]*e,n},blacken(e){const n=this.hwb();return n.color[2]+=n.color[2]*e,n},grayscale(){const e=this.rgb().color,n=e[0]*.3+e[1]*.59+e[2]*.11;return O.rgb(n,n,n)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const n=this.hsl();let t=n.color[0];return t=(t+e)%360,t=t<0?360+t:t,n.color[0]=t,n},mix(e,n){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const t=e.rgb(),o=this.rgb(),r=n===void 0?.5:n,s=2*r-1,a=t.alpha()-o.alpha(),i=((s*a===-1?s:(s+a)/(1+s*a))+1)/2,u=1-i;return O.rgb(i*t.red()+u*o.red(),i*t.green()+u*o.green(),i*t.blue()+u*o.blue(),t.alpha()*r+o.alpha()*(1-r))}};for(const e of Object.keys(X)){if(je.includes(e))continue;const{channels:n}=X[e];O.prototype[e]=function(...t){return this.model===e?new O(this):t.length>0?new O(t,e):new O([...kt(X[this.model][e].raw(this.color)),this.valpha],e)},O[e]=function(...t){let o=t[0];return typeof o=="number"&&(o=Fe(t,n)),new O(o,e)}}function wt(e,n){return Number(e.toFixed(n))}function xt(e){return function(n){return wt(n,e)}}function T(e,n,t){e=Array.isArray(e)?e:[e];for(const o of e)(ye[o]||(ye[o]=[]))[n]=t;return e=e[0],function(o){let r;return o!==void 0?(t&&(o=t(o)),r=this[e](),r.color[n]=o,r):(r=this[e]().color[n],t&&(r=t(r)),r)}}function D(e){return function(n){return Math.max(0,Math.min(e,n))}}function kt(e){return Array.isArray(e)?e:[e]}function Fe(e,n){for(let t=0;t<n;t++)typeof e[t]!="number"&&(e[t]=0);return e}var Ct=O;const W=nt(Ct);function qe(e){return W(e)}function Ge(e){return e.hex()}function _t(e){const{h:n,s:t,v:o}=e.hsv().object();return{color:W.hsv(n,t,100),value:o}}function Mt(e,n){const{h:t,s:o}=e.hsv().object();return W.hsv(t,o,n)}function Ke(e,n){const t=Mt(e,n);return Ge(t)}function Et(){const e=l.ref(),n=255*6+1,t=256;function o(){if(!e.value)return;const h=e.value;h.width=n,h.height=t;const d=h.getContext("2d");if(!d)return;d.clearRect(0,0,n,t);const c=d.createLinearGradient(0,0,n,0);c.addColorStop(0,"#FF0000"),c.addColorStop(1/6,"#FFFF00"),c.addColorStop(1/3,"#00FF00"),c.addColorStop(1/2,"#00FFFF"),c.addColorStop(2/3,"#0000FF"),c.addColorStop(5/6,"#FF00FF"),c.addColorStop(1,"#FF0000"),d.fillStyle=c,d.fillRect(0,0,n,t);const m=d.createLinearGradient(0,t,0,0);m.addColorStop(0,"rgb(255 255 255 / 100%)"),m.addColorStop(1,"rgb(255 255 255 / 0%)"),d.fillStyle=m,d.fillRect(0,0,n,t)}function r(h){const d=qe(h);return s(d)}function s(h){const{r:d,g:c,b:m}=h.rgb().object(),v=[{type:"r",value:d},{type:"g",value:c},{type:"b",value:m}];v.sort((C,L)=>L.value-C.value);const p=v[0],y=v[1],w=p.type+y.type;let k=0,b=v[2].value;return w==="rg"||w==="gr"?(k=255,y.type==="r"?k+=255-a(b,y.value):k-=255-a(b,y.value)):w==="gb"||w==="bg"?(k=255*3,y.type==="g"?k+=255-a(b,y.value):k-=255-a(b,y.value)):(w==="rb"||w==="br")&&(k=255*5,y.type==="b"?k+=255-a(b,y.value):k-=255-a(b,y.value)),{x:k,y:b}}function a(h,d){return h===255?255:(255*d-255*h)/(255-h)}function i(h,d,c,m){if(!e.value)return W();const v=n/c,p=t/m;return h=Math.min(h*v,n-1),d=Math.min(d*p,t-1),u(h,d)}function u(h,d){let c=0,m=0,v=0;const p=255,y=f(h,0,p)||f(h,p*5,p*6),w=f(h,p,p*3),k=f(h,p*3,p*5);y?c=255:h<=p*2?c=Math.max(2*p-h,0):h>=p*4&&(c=Math.max(h-p*4,0)),w?m=255:h<p?m=Math.max(h,0):m=Math.max(p*4-h,0),k?v=255:h<p*3?v=Math.max(h-p*2,0):v=Math.max(p*6-h,0);const b=p-c,C=p-m,L=p-v,$=d/p;return c+=b*$,m+=C*$,v+=L*$,W.rgb(c,m,v)}function f(h,d,c){return h>=d&&h<=c}return l.onMounted(()=>{o()}),{canvasWidth:n,canvasHeight:t,colorAreaCanvas:e,drawColorArea:o,getCoordinateByColor:s,getCoordinateByHex:r,getColorByCoordinate:i}}function St(e,n=200){let t=null;return function(...o){const r=this;t||(t=window.setTimeout(()=>{e.apply(r,o),t=null},n))}}class Ft{constructor(){U(this,"_eventMap");this._eventMap=new Map}on(n,t){const o=this._eventMap.get(n);if(o)o.add(t);else{const r=new Set;r.add(t),this._eventMap.set(n,r)}}off(n,t){const o=this._eventMap.get(n);o&&(t?o.delete(t):o.clear())}emit(n,...t){const o=this._eventMap.get(n);if(o)for(const r of o.values())r(...t)}}const fe=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);function Tt(){const e=l.ref(),n=l.reactive({x:0,y:0});function t(d){if(d.touches.length===0)return;d.preventDefault();const{clientX:c,clientY:m}=d.touches[0];i({x:c,y:m}),document.body.addEventListener("touchmove",o),document.body.addEventListener("touchend",r)}function o(d){if(d.touches.length>1)return;const{clientX:c,clientY:m}=d.touches[0];i({x:c,y:m})}function r(){document.body.removeEventListener("touchmove",o),document.body.removeEventListener("touchend",r)}function s(d){document.body.addEventListener("mousemove",a),document.body.addEventListener("mouseup",f),i({x:d.clientX,y:d.clientY})}function a(d){i({x:d.clientX,y:d.clientY})}const i=St(u,20);function u(d){var L;const{x:c,y:m}=d,v=(L=e.value)==null?void 0:L.getBoundingClientRect();if(!v)return;const{left:p,top:y,width:w,height:k}=v;let b=0,C=0;c<=p?b=0:c>=p+w?b=w:b=c-p,m<=y?C=0:m>=y+k?C=k:C=m-y,n.x=Math.round(b),n.y=Math.round(C)}function f(){document.body.removeEventListener("mousemove",a),document.body.removeEventListener("mouseup",f)}function h(d,c,m,v){var C;const p=(C=e.value)==null?void 0:C.getBoundingClientRect();if(!p)return;const{width:y,height:w}=p,k=y/m,b=w/v;n.x=d*k,n.y=c*b}return l.onMounted(()=>{var d,c;fe?(d=e.value)==null||d.addEventListener("touchstart",t):(c=e.value)==null||c.addEventListener("mousedown",s)}),l.onBeforeUnmount(()=>{var d,c;fe?((d=e.value)==null||d.removeEventListener("touchstart",t),document.body.removeEventListener("touchmove",o),document.body.removeEventListener("touchend",r)):((c=e.value)==null||c.removeEventListener("mousedown",s),document.body.removeEventListener("mousemove",a),document.body.removeEventListener("mouseup",f))}),{colorAreaRef:e,circlePickerCoordinate:n,setCirclePickerCoordinate:h}}const Dt={class:"hv-color-picker__color-form"},Lt={class:"mb-12"},At={class:"hv-color-picker__form-group mb-12"},Vt={class:"hv-color-picker__form-group mb-12"},Te="#ffffff",Ot=l.defineComponent({__name:"ColorForm",props:{modelValue:{}},emits:["change"],setup(e,{emit:n}){const t=e,o=n,r=l.ref(W(t.modelValue||Te).hex()),s=l.reactive(W(r.value||Te).rgb().object()),a=l.reactive(W(r.value||Te).hsv().object());function i(d){return`#${d.replace(/[^0-9A-F]/gi,"").slice(0,6).toUpperCase()}`}l.watch(()=>t.modelValue,d=>{const c=W(d);r.value=c.hex();const{r:m,g:v,b:p}=c.rgb().object(),{h:y,s:w,v:k}=c.hsv().object();Object.assign(s,{r:m,g:v,b:p}),Object.assign(a,{h:y,s:w,v:k})});function u(){(r.value||"").replace(/[^0-9A-F]/gi,"").length===6?o("change",r.value):r.value=t.modelValue}function f(){const{r:d,g:c,b:m}=s;o("change",W.rgb(d,c,m).hex().toString())}function h(){const{h:d,s:c,v:m}=a;o("change",W.hsv(d,c,m).hex().toString())}return(d,c)=>{const m=l.resolveComponent("el-input"),v=l.resolveComponent("el-input-number");return l.openBlock(),l.createElementBlock("div",Dt,[l.createElementVNode("div",Lt,[l.createVNode(m,{modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=p=>r.value=p),formatter:i,onChange:u},null,8,["modelValue"])]),l.createElementVNode("div",At,[c[7]||(c[7]=l.createElementVNode("div",{class:"hv-color-picker__form-label"},"RGB",-1)),l.createVNode(v,{modelValue:s.r,"onUpdate:modelValue":c[1]||(c[1]=p=>s.r=p),onChange:f,"step-strictly":"",min:0,max:255,step:1,controls:!1},null,8,["modelValue"]),l.createVNode(v,{modelValue:s.g,"onUpdate:modelValue":c[2]||(c[2]=p=>s.g=p),onChange:f,"step-strictly":"",min:0,max:255,step:1,controls:!1},null,8,["modelValue"]),l.createVNode(v,{modelValue:s.b,"onUpdate:modelValue":c[3]||(c[3]=p=>s.b=p),onChange:f,"step-strictly":"",min:0,max:255,step:1,controls:!1},null,8,["modelValue"])]),l.createElementVNode("div",Vt,[c[8]||(c[8]=l.createElementVNode("div",{class:"hv-color-picker__form-label"},"HSV",-1)),l.createVNode(v,{modelValue:a.h,"onUpdate:modelValue":c[4]||(c[4]=p=>a.h=p),onChange:h,min:0,max:360,"step-strictly":"",step:1,controls:!1},null,8,["modelValue"]),l.createVNode(v,{modelValue:a.s,"onUpdate:modelValue":c[5]||(c[5]=p=>a.s=p),onChange:h,min:0,max:100,"step-strictly":"",step:1,controls:!1},null,8,["modelValue"]),l.createVNode(v,{modelValue:a.v,"onUpdate:modelValue":c[6]||(c[6]=p=>a.v=p),onChange:h,"step-strictly":"",min:0,max:100,controls:!1},null,8,["modelValue"])])])}}}),Pt={class:"hv-color-picker__preset"},Rt={class:"hv-color-picker__preset-title"},Ht={class:"hv-color-picker__preset-list"},Bt=["onClick"],$t=l.defineComponent({__name:"PresetColors",props:{title:{},presetColors:{}},emits:["change"],setup(e,{emit:n}){const t=["#000000","#FFFFFF","#E3822D","#DCE24F","#1DCF69","#6DE5B9","#11A1F2","#AA43FF","#F0689C","#F8D28B","#606368","#E83C34","#EEBE29","#89F0AC","#2FBC9E","#56CCF2","#1C1DFA","#DC88F5","#D4C595","#C52F65"],o=e,r=l.computed(()=>o.presetColors?o.presetColors:t),s=n;function a(i){s("change",i)}return(i,u)=>(l.openBlock(),l.createElementBlock("div",Pt,[l.createElementVNode("div",Rt,l.toDisplayString(o.title||"系统预设色彩"),1),l.createElementVNode("div",Ht,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,f=>(l.openBlock(),l.createElementBlock("div",{class:"hv-color-picker__preset-list-item",onClick:h=>a(f),key:f,style:l.normalizeStyle({backgroundColor:f})},null,12,Bt))),128))])]))}}),zt={class:"hv-color-picker"},Nt={class:"hv-color-picker__title"},It={class:"hv-color-picker__area-outer"},Xt={class:"hv-color-picker__slider"},De="#ffffff",Yt=K(l.defineComponent({name:"HvColorPicker",__name:"ColorPicker",props:l.mergeModels({title:{},presetTitle:{},presetColors:{}},{modelValue:{type:String,default:De},modelModifiers:{}}),emits:l.mergeModels(["update:model-value"],["update:modelValue"]),setup(e,{emit:n}){const t=e,o=n,{colorAreaCanvas:r,getColorByCoordinate:s,getCoordinateByColor:a,canvasWidth:i,canvasHeight:u}=Et(),{colorAreaRef:f,circlePickerCoordinate:h,setCirclePickerCoordinate:d}=Tt(),c=l.useModel(e,"modelValue"),m=l.ref(W(De)),v=l.ref(100),p=l.computed(()=>m.value?Ke(m.value,v.value):De);l.watch(c,b=>{Ke(m.value,v.value)!==b&&k(b)}),l.watch(()=>h,b=>{var $;const C=($=f.value)==null?void 0:$.getBoundingClientRect();if(!C)return;const L=s(b.x,b.y,C.width,C.height);m.value=L},{deep:!0});const y=l.computed(()=>c.value?{top:h.y+"px",left:h.x+"px",backgroundColor:m.value.hex()}:{top:"100%",left:"0",backgroundColor:"#ffffff"}),w=l.computed(()=>{const b=Ge(m.value);return{"--el-slider-runway-bg-color":`linear-gradient(to right, #000000, ${b})`,"--el-slider-main-bg-color":b}});l.watch(()=>p.value,(b,C)=>{if(b!==C){o("update:model-value",b);return}});function k(b){const C=qe(b),{color:L,value:$}=_t(C);m.value=L,v.value=$;const J=a(L);d(J.x,J.y,i,u)}return l.onMounted(()=>{k(c.value)}),(b,C)=>{const L=l.resolveComponent("ElSlider");return l.openBlock(),l.createElementBlock("div",zt,[l.createElementVNode("div",Nt,l.toDisplayString(t.title||"颜色编辑器"),1),l.createElementVNode("div",It,[l.createElementVNode("div",{class:"hv-color-picker__area",ref_key:"colorAreaRef",ref:f},[l.createElementVNode("canvas",{ref_key:"colorAreaCanvas",ref:r},null,512),l.createElementVNode("div",{class:"hv-color-picker__circle",style:l.normalizeStyle(y.value)},null,4)],512)]),l.createElementVNode("div",Xt,[l.createVNode(L,{modelValue:v.value,"onUpdate:modelValue":C[0]||(C[0]=$=>v.value=$),min:0,max:100,"show-tooltip":!1,style:l.normalizeStyle(w.value)},null,8,["modelValue","style"]),l.createElementVNode("div",{class:"hv-color-picker__origin-color",style:l.normalizeStyle({backgroundColor:p.value})},null,4)]),l.createVNode(Ot,{"model-value":c.value,onChange:k},null,8,["model-value"]),l.createVNode($t,{onChange:k,title:t.presetTitle,presetColors:t.presetColors},null,8,["title","presetColors"])])}}}));class Wt extends Ft{constructor(){super();U(this,"isDragStart",!1);U(this,"dragType");U(this,"dragData");U(this,"isSendFirstMovePos",!1);U(this,"touchStartPressTime",300);U(this,"touchStartTime",0);U(this,"touchStartPosition",{x:0,y:0});U(this,"lastMovePoint",{x:0,y:0});U(this,"emitTouchStartTimer");U(this,"destroy",()=>{});this.bindEventListener()}updateDargInfo(t,o){if(t==null)throw new Error("请传入拖动元素 type");this.isDragStart=!0,this.dragType=t,this.dragData=o,this.emitTouchStartTimer&&clearTimeout(this.emitTouchStartTimer),this.emitTouchStartTimer=void 0}onDown(t){this.emit("down",t)}onFirstMove(t,o){this.isDragStart||(this.isSendFirstMovePos=!0,this.emit("first-move",t,o))}onStart(t){this.isDragStart||this.emit("start",t)}onMove(t){!this.isDragStart||!this.dragType||(this.lastMovePoint=t,this.emit("move",{type:this.dragType,data:this.dragData,point:t}))}onEnd(){this.emitTouchStartTimer&&clearTimeout(this.emitTouchStartTimer),this.emitTouchStartTimer=void 0,this.isSendFirstMovePos=!1,!(!this.isDragStart||!this.dragType)&&(this.isDragStart=!1,this.emit("end",{point:this.lastMovePoint,type:this.dragType,data:this.dragData}))}onMouseDown(t){if(t.buttons!==1){this.onEnd();return}const{clientX:o,clientY:r}=t,s={x:o,y:r};this.touchStartTime=Date.now(),this.touchStartPosition=s,this.emitTouchStartTimer&&clearTimeout(this.emitTouchStartTimer),this.onDown(s),this.emitTouchStartTimer=window.setTimeout(()=>{this.onStart(s)},this.touchStartPressTime)}onMouseMove(t){if(t.buttons!==1){this.onEnd();return}const{clientX:o,clientY:r}=t;if(this.isDragStart)t.preventDefault(),t.stopPropagation(),this.onMove({x:o,y:r});else{this.isSendFirstMovePos||this.onFirstMove({x:o,y:r},t);const{x:s,y:a}=this.touchStartPosition;Date.now()-this.touchStartTime<this.touchStartPressTime&&(Math.abs(s-o)>30||Math.abs(a-r)>30)&&(clearTimeout(this.emitTouchStartTimer),this.emitTouchStartTimer=void 0)}}onMouseUp(){this.onEnd()}onTouchStart(t){if(t.touches.length>1)return;const{clientX:o,clientY:r}=t.touches[0],s={x:o,y:r};this.touchStartTime=Date.now(),this.touchStartPosition=s,this.onDown(s),this.emitTouchStartTimer=window.setTimeout(()=>{this.onStart(s)},this.touchStartPressTime)}onTouchMove(t){if(t.touches.length>1)return;const{clientX:o,clientY:r}=t.touches[0];if(this.isDragStart)t.preventDefault(),t.stopPropagation(),this.onMove({x:o,y:r});else{this.isSendFirstMovePos||this.onFirstMove({x:o,y:r},t);const{x:s,y:a}=this.touchStartPosition;Date.now()-this.touchStartTime<this.touchStartPressTime&&(Math.abs(s-o)>30||Math.abs(a-r)>30)&&clearTimeout(this.emitTouchStartTimer)}}onTouchEnd(){this.onEnd()}bindEventListener(){if(document.body){const t=this.onTouchStart.bind(this),o=this.onTouchMove.bind(this),r=this.onTouchEnd.bind(this),s=this.onMouseDown.bind(this),a=this.onMouseMove.bind(this),i=this.onMouseUp.bind(this);fe?(document.body.addEventListener("touchstart",t,{passive:!1}),document.body.addEventListener("touchmove",o,{passive:!1}),document.body.addEventListener("touchend",r,{passive:!1})):(document.body.addEventListener("mousedown",s),document.body.addEventListener("mousemove",a),document.body.addEventListener("mouseup",i)),this.destroy=()=>{document.body.removeEventListener("touchstart",t),document.body.removeEventListener("touchmove",o),document.body.removeEventListener("touchend",r),document.body.removeEventListener("mousedown",s),document.body.removeEventListener("mousemove",a),document.body.removeEventListener("mouseup",i)}}else document.addEventListener("DOMContentLoaded",this.bindEventListener)}removeEventListener(){this.destroy()}destroyed(){this.isDragStart=!1,this.dragType=void 0,this.dragData=void 0,this.removeEventListener()}}const ee=new Wt,Ut=((e,n)=>{const t=e.__vccOpts||e;for(const[o,r]of n)t[o]=r;return t})(l.defineComponent({name:"HvDraggable",__name:"Draggable",props:{type:{},immediate:{},disabled:{type:Boolean,default:!1},data:{}},setup(e){const n={LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",ALL:"all"},t=e,o=l.ref(),r=l.ref(!1),s=l.reactive({x:0,y:0}),a=l.ref(!1),i=l.reactive({x:0,y:0}),u=l.computed(()=>Array.isArray(t.immediate)?t.immediate:t.immediate?[t.immediate]:[]),f=l.computed(()=>({transform:`translate(${i.x}px, ${i.y}px) translate(-50%, -50%)`}));ee.on("down",c=>{const{x:m,y:v}=c,p=document.elementFromPoint(m,v);if(!t.disabled&&o.value&&o.value.contains(p)){if(u.value.includes(n.ALL)){h(c);return}r.value=!0,s.x=m,s.y=v}}),ee.on("first-move",(c,m)=>{const{x:v,y:p}=c,y=u.value.filter(w=>w!==n.ALL);if(r.value&&!t.disabled&&y.length){const w=v-s.x,k=Math.abs(w),b=p-s.y,C=Math.abs(b),L=Math.max(k,C),$=k===L,J=C===L;let ne=!1;if($&&(ne=y.includes(n.LEFT)&&w<0||y.includes(n.RIGHT)&&w>0),J&&!ne&&(ne=y.includes(n.TOP)&&b<0||y.includes(n.BOTTOM)&&b>0),ne){m.preventDefault(),m.stopPropagation(),h(s),d(c);return}}}),ee.on("start",c=>{const{x:m,y:v}=c,p=document.elementFromPoint(m,v);!t.disabled&&o.value&&o.value.contains(p)&&h(c)}),ee.on("move",c=>{const{point:m}=c;a.value&&d(m)}),ee.on("end",()=>{r.value=!1,a.value=!1,Object.assign(s,{x:0,y:0}),Object.assign(i,{x:0,y:0})});function h(c){a.value=!0,i.x=c.x,i.y=c.y,ee.updateDargInfo(t.type,t.data)}function d(c){i.x=c.x,i.y=c.y}return(c,m)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"dragItemRef",ref:o,class:l.normalizeClass(["hv-draggable",c.disabled?"disabled":""])},[l.renderSlot(c.$slots,"default",{},void 0,!0),a.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"hv-draggable__clone-item",style:l.normalizeStyle(f.value)},[l.renderSlot(c.$slots,"hv-drag-item",{},()=>[l.renderSlot(c.$slots,"default",{},void 0,!0)],!0)],4)):l.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-1d116395"]]),jt=l.defineComponent({name:"HvDroppable",__name:"Droppable",props:{acceptDragType:{}},emits:["enter","move","drop","leave"],setup(e,{emit:n}){const t=n,o=e,r=l.ref(),s=l.ref(!1),a=l.computed(()=>Array.isArray(o.acceptDragType)?o.acceptDragType:[o.acceptDragType]);function i(u){if(!r.value)return{isInArea:!1,position:{x:0,y:0}};const{x:f,y:h}=u,{x:d,y:c,width:m,height:v}=r.value.getBoundingClientRect(),p=f-d,y=h-c;return{isInArea:p>=0&&p<=m&&y>=0&&y<=v,position:{x:p,y}}}return ee.on("move",u=>{const{type:f,data:h,point:d}=u;if(r.value&&a.value.includes(f)){const{isInArea:c,position:m}=i(d);c?s.value?t("move",f,m,h):(s.value=!0,t("enter",f,m,h)):s.value&&(s.value=!1,t("leave",f,h))}}),ee.on("end",({type:u,point:f,data:h})=>{if(r.value&&a.value.includes(u)&&s.value){const{position:d}=i(f);t("drop",u,d,h)}}),(u,f)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"dropAreaRef",ref:r,class:"hv-droppable"},[l.renderSlot(u.$slots,"default")],512))}}),qt=K(Ut),Gt=K(jt);function Kt(e,n,t){const o=l.computed(()=>l.isRef(t)?l.toValue(t):t),r=l.computed(()=>o.value.containerRealSize),s=l.computed(()=>{const x=typeof o.value.keepRatio=="boolean"?{enable:o.value.keepRatio,scaleCase:"min"}:o.value.keepRatio;return Object.assign({scaleCase:"min",enable:!1},x||{})}),a=l.computed(()=>{const x=Object.assign({inContainer:!0,minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},o.value.limit||{});return x.minWidth>x.maxWidth&&(x.maxWidth=x.minWidth),x.minHeight>x.maxHeight&&(x.maxHeight=x.minHeight),x}),i=l.computed(()=>o.value.disabled||!1),u=l.computed(()=>l.isRef(e)?l.toValue(e):e),f=l.computed(()=>o.value.container),h=l.computed(()=>l.isRef(n)?l.toValue(n):n);let d={x:0,y:0},c={x:0,y:0},m={x:0,y:0};const v={width:0,height:0},p={elX:0,elY:0,elWidth:0,elHeight:0},y={leftSide:!1,rightSide:!1,topSide:!1,bottomSide:!1,center:!1};let w=!1,k=!1,b=1,C=1;l.watch(()=>u.value&&f.value&&h.value,x=>{x?Zt():Oe()});function L(x){if(i.value||(d=x,m=x,!f.value||!u.value))return;const{x:A,y:V,width:z,height:N}=f.value.getBoundingClientRect();if(Object.assign(v,{width:z,height:N}),r.value){const{width:G,height:xe}=r.value;b=G/z,C=xe/N}else b=1,C=1;const{x:E,y:S,width:P,height:R}=u.value.getBoundingClientRect(),{x:_,y:M}=x;Object.assign(p,{elX:E-A,elY:S-V,elWidth:P,elHeight:R});const we=document.elementFromPoint(_,M);if(!we)return;const te=(we.dataset.scaleSide||"").split(",").filter(G=>!!G);if(!te.length)return;let me=te.includes("left"),pe=te.includes("top"),j=te.includes("right"),q=te.includes("bottom");const Q=te.includes("center");w=!0,s.value.enable&&!Q&&(_-E<=P/2&&M-S<=R/2&&(me=!0,pe=!0),_-E>P/2&&M-S<=R/2&&(j=!0,pe=!0),_-E<=P/2&&M-S>R/2&&(me=!0,q=!0),_-E>P/2&&M-S>R/2&&(j=!0,q=!0)),Object.assign(y,{leftSide:me,rightSide:j,topSide:pe,bottomSide:q,center:Q})}function $(x){if(i.value||w!==!0){w=!1;return}k=!0,c=m,m=x;const A=x.x-d.x,V=x.y-d.y;let z=0,N=0,E=0,S=0;const{elX:P,elY:R,elWidth:_,elHeight:M}=p,{minWidth:we,minHeight:te,maxWidth:me,maxHeight:pe}=a.value,j=we/b,q=te/C,Q=me/b,G=pe/C;if(y.center){const ke=v.width,Ce=v.height;if(a.value.inContainer){const Pe=P+A<0?-P:P+_+A>ke?ke-_-P:A,Re=R+V<0?-R:R+M+V>Ce?Ce-M-R:V;z=Pe,N=Re}else z=A,N=V}else{const{leftSide:ke,rightSide:Ce,topSide:Pe,bottomSide:Re}=y;if(ke){let F=a.value.inContainer&&P+A<0?-P:A;_-F<j&&(F=_-j),_-F>Q&&(F=_-Q),z=F,E=-F}if(Ce){const F=v.width;let H=a.value.inContainer&&P+_+A>F?F-_-P:A;_+H<j&&(H=j-_),_+H>Q&&(H=Q-_),E=H}if(Pe){let F=a.value.inContainer&&R+V<0?-R:V;M-F<q&&(F=M-q),M-F>G&&(F=M-G),N=F,S=-F}if(Re){const F=v.height;let H=a.value.inContainer&&R+M+V>F?F-M-R:V;M+H<q&&(H=q-M),M+H>G&&(H=G-M),S=H}if(s.value.enable){const F=E/_,H=S/M;if(F<H&&s.value.scaleCase==="min"||F>H&&s.value.scaleCase==="max"){if(S=F*M,M+S<q){const Y=E;S=q-M,E=S/M*_,z=z*(E/Y)}if(M+S>G){const Y=E;S=G-M,E=S/M*_,z=z*(E/Y)}y.topSide&&(N=-S)}else if(H<F&&s.value.scaleCase==="min"||H>F&&s.value.scaleCase==="max"){if(E=H*_,_+E<j){const Y=S;E=j-_,S=E/_*M,N=N*(S/Y)}if(_+E>Q){const Y=S;E=Q-_,S=E/_*M,N=N*(S/Y)}y.leftSide&&(z=-E)}const ae=P+z,ie=R+N,He=_+E,Be=M+S;if(a.value.inContainer&&(ae<0||ie<0||ae+He>v.width||ie+Be>v.height)){let Y=ae<0?0:ae,ge=ie<0?0:ie,le=ae+He>v.width?v.width-Y:ae+He-Y,ce=ie+Be>v.height?v.height-ge:ie+Be-ge;const en=Y+le,tn=ge+ce,tt=le/ce,_e=_/M;tt<_e?ce=le/_e:tt>_e&&(le=ce*_e);const{topSide:nn,leftSide:on}=y;on&&(Y=en-le),nn&&(ge=tn-ce),z=Y-P,N=ge-R,E=le-_,S=ce-M}}}const xe=P+z,Qe=R+N,Ze=_+E,et=M+S;o.value.onChange&&o.value.onChange({type:y.center?"move":"scale",deltaX:m.x-c.x,deltaY:m.y-c.y,elX:xe,elY:Qe,elWidth:Ze,elHeight:et,realX:xe*b,realY:Qe*C,realWidth:Ze*b,realHeight:et*C})}function J(){if(c={x:0,y:0},m={x:0,y:0},i.value||w!==!0||!k){w=!1,k=!1;return}w=!1,k=!1,o.value.onFinish&&o.value.onFinish()}function ne(x){if(x.preventDefault(),x.touches.length>1)return;const{clientX:A,clientY:V}=x.touches[0];L({x:A,y:V}),document.body.addEventListener("touchcancel",se,{capture:!0}),document.body.addEventListener("touchmove",Le,{capture:!0}),document.body.addEventListener("touchend",se,{capture:!0})}function Le(x){if(i.value||w!==!0){w=!1;return}if(x.preventDefault(),x.stopPropagation(),x.touches.length>1){J();return}const{clientX:A,clientY:V}=x.touches[0];A===d.x&&V===d.y||$({x:A,y:V})}function se(){if(document.body.removeEventListener("touchmove",Le),document.body.removeEventListener("touchend",se),document.body.removeEventListener("touchcancel",se),i.value||w!==!0){w=!1,k=!1;return}J()}function Je(x){if(x.preventDefault(),!(x.buttons&1))return;const{clientX:A,clientY:V}=x;L({x:A,y:V}),document.body.addEventListener("mousemove",Ae,{capture:!0}),document.body.addEventListener("mouseup",Ve,{capture:!0})}function Ae(x){if(i.value||w!==!0){w=!1;return}if(x.preventDefault(),!(x.buttons&1)){J();return}const{clientX:A,clientY:V}=x;$({x:A,y:V})}function Ve(){if(document.body.removeEventListener("mousemove",Ae),document.body.removeEventListener("mouseup",Ve),i.value||w!==!0){w=!1;return}J()}function Zt(){Oe(),fe?h.value.addEventListener("touchstart",ne,{capture:!0}):h.value.addEventListener("mousedown",Je)}function Oe(){fe?(h.value.removeEventListener("touchstart",ne),document.body.removeEventListener("touchmove",Le),document.body.removeEventListener("touchend",se),document.body.removeEventListener("touchcancel",se)):(h.value.removeEventListener("mousedown",Je),document.body.removeEventListener("mousemove",Ae),document.body.removeEventListener("mouseup",Ve))}l.onBeforeUnmount(()=>{w=!1,Oe()})}const Jt={class:"hv-drag-and-scale__zoom-mark"},Qt=K(l.defineComponent({name:"HvDragAndScale",__name:"DragAndScale",props:{container:{},containerRealSize:{},keepRatio:{type:[Boolean,Object]},limit:{},disabled:{type:Boolean}},emits:["change","finish"],setup(e,{emit:n}){const t=n,o=e,r=l.ref(),s=l.ref();function a(f){t("change",f)}function i(){t("finish")}const u=l.computed(()=>({container:o.container,containerRealSize:o.containerRealSize,keepRatio:o.keepRatio,limit:o.limit,disabled:o.disabled,onChange:a,onFinish:i}));return Kt(r,s,u),(f,h)=>(l.openBlock(),l.createElementBlock("div",{class:"hv-drag-and-scale",ref_key:"targetRef",ref:r},[l.renderSlot(f.$slots,"default"),l.createElementVNode("div",Jt,[l.createElementVNode("div",{class:l.normalizeClass(["hv-drag-and-scale__area-box",o.disabled?"disabled":""]),ref_key:"operateRef",ref:s},h[0]||(h[0]=[l.createStaticVNode('<div class="hv-drag-and-scale__area-top hv-drag-and-scale__area-block"><div class="hv-drag-and-scale__area-left" data-scale-side="left,top"></div><div class="hv-drag-and-scale__area-center" data-scale-side="top"></div><div class="hv-drag-and-scale__area-right" data-scale-side="right,top"></div></div><div class="hv-drag-and-scale__area-middle hv-drag-and-scale__area-block"><div class="hv-drag-and-scale__area-left" data-scale-side="left"></div><div class="hv-drag-and-scale__area-center" data-scale-side="center"></div><div class="hv-drag-and-scale__area-right" data-scale-side="right"></div></div><div class="hv-drag-and-scale__area-bottom hv-drag-and-scale__area-block"><div class="hv-drag-and-scale__area-left" data-scale-side="left,bottom"></div><div class="hv-drag-and-scale__area-center" data-scale-side="bottom"></div><div class="hv-drag-and-scale__area-right" data-scale-side="right,bottom"></div></div>',3)]),2)])],512))}}));B.HvColorPicker=Yt,B.HvDragAndScale=Qt,B.HvDraggable=qt,B.HvDroppable=Gt,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
1
+ (function($,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):($=typeof globalThis<"u"?globalThis:$||self,l($.components={},$.Vue))})(this,function($,l){"use strict";var on=Object.defineProperty;var rn=($,l,Q)=>l in $?on($,l,{enumerable:!0,configurable:!0,writable:!0,value:Q}):$[l]=Q;var j=($,l,Q)=>rn($,typeof l!="symbol"?l+"":l,Q);const Q=(e,n)=>(e.install=t=>{for(const o of[e,...Object.values({})])t.component(o.name,o)},e);function tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $e={exports:{}},ze={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ne={exports:{}},nt=function(n){return!n||typeof n=="string"?!1:n instanceof Array||Array.isArray(n)||n.length>=0&&(n.splice instanceof Function||Object.getOwnPropertyDescriptor(n,n.length-1)&&n.constructor.name!=="String")},ot=nt,rt=Array.prototype.concat,st=Array.prototype.slice,Ie=Ne.exports=function(n){for(var t=[],o=0,r=n.length;o<r;o++){var s=n[o];ot(s)?t=rt.call(t,st.call(s)):t.push(s)}return t};Ie.wrap=function(e){return function(){return e(Ie(arguments))}};var at=Ne.exports,he=ze,fe=at,Xe=Object.hasOwnProperty,Ye=Object.create(null);for(var Fe in he)Xe.call(he,Fe)&&(Ye[he[Fe]]=Fe);var X=$e.exports={to:{},get:{}};X.get=function(e){var n=e.substring(0,3).toLowerCase(),t,o;switch(n){case"hsl":t=X.get.hsl(e),o="hsl";break;case"hwb":t=X.get.hwb(e),o="hwb";break;default:t=X.get.rgb(e),o="rgb";break}return t?{model:o,value:t}:null},X.get.rgb=function(e){if(!e)return null;var n=/^#([a-f0-9]{3,4})$/i,t=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,o=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,r=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,s=/^(\w+)$/,a=[0,0,0,1],i,c,f;if(i=e.match(t)){for(f=i[2],i=i[1],c=0;c<3;c++){var h=c*2;a[c]=parseInt(i.slice(h,h+2),16)}f&&(a[3]=parseInt(f,16)/255)}else if(i=e.match(n)){for(i=i[1],f=i[3],c=0;c<3;c++)a[c]=parseInt(i[c]+i[c],16);f&&(a[3]=parseInt(f+f,16)/255)}else if(i=e.match(o)){for(c=0;c<3;c++)a[c]=parseInt(i[c+1],0);i[4]&&(i[5]?a[3]=parseFloat(i[4])*.01:a[3]=parseFloat(i[4]))}else if(i=e.match(r)){for(c=0;c<3;c++)a[c]=Math.round(parseFloat(i[c+1])*2.55);i[4]&&(i[5]?a[3]=parseFloat(i[4])*.01:a[3]=parseFloat(i[4]))}else return(i=e.match(s))?i[1]==="transparent"?[0,0,0,0]:Xe.call(he,i[1])?(a=he[i[1]],a[3]=1,a):null:null;for(c=0;c<3;c++)a[c]=te(a[c],0,255);return a[3]=te(a[3],0,1),a},X.get.hsl=function(e){if(!e)return null;var n=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=e.match(n);if(t){var o=parseFloat(t[4]),r=(parseFloat(t[1])%360+360)%360,s=te(parseFloat(t[2]),0,100),a=te(parseFloat(t[3]),0,100),i=te(isNaN(o)?1:o,0,1);return[r,s,a,i]}return null},X.get.hwb=function(e){if(!e)return null;var n=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=e.match(n);if(t){var o=parseFloat(t[4]),r=(parseFloat(t[1])%360+360)%360,s=te(parseFloat(t[2]),0,100),a=te(parseFloat(t[3]),0,100),i=te(isNaN(o)?1:o,0,1);return[r,s,a,i]}return null},X.to.hex=function(){var e=fe(arguments);return"#"+ye(e[0])+ye(e[1])+ye(e[2])+(e[3]<1?ye(Math.round(e[3]*255)):"")},X.to.rgb=function(){var e=fe(arguments);return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},X.to.rgb.percent=function(){var e=fe(arguments),n=Math.round(e[0]/255*100),t=Math.round(e[1]/255*100),o=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+n+"%, "+t+"%, "+o+"%)":"rgba("+n+"%, "+t+"%, "+o+"%, "+e[3]+")"},X.to.hsl=function(){var e=fe(arguments);return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},X.to.hwb=function(){var e=fe(arguments),n="";return e.length>=4&&e[3]!==1&&(n=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+n+")"},X.to.keyword=function(e){return Ye[e.slice(0,3)]};function te(e,n,t){return Math.min(Math.max(n,e),t)}function ye(e){var n=Math.round(e).toString(16).toUpperCase();return n.length<2?"0"+n:n}var it=$e.exports;const me=ze,Ue={};for(const e of Object.keys(me))Ue[me[e]]=e;const p={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var We=p;for(const e of Object.keys(p)){if(!("channels"in p[e]))throw new Error("missing channels property: "+e);if(!("labels"in p[e]))throw new Error("missing channel labels property: "+e);if(p[e].labels.length!==p[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:n,labels:t}=p[e];delete p[e].channels,delete p[e].labels,Object.defineProperty(p[e],"channels",{value:n}),Object.defineProperty(p[e],"labels",{value:t})}p.rgb.hsl=function(e){const n=e[0]/255,t=e[1]/255,o=e[2]/255,r=Math.min(n,t,o),s=Math.max(n,t,o),a=s-r;let i,c;s===r?i=0:n===s?i=(t-o)/a:t===s?i=2+(o-n)/a:o===s&&(i=4+(n-t)/a),i=Math.min(i*60,360),i<0&&(i+=360);const f=(r+s)/2;return s===r?c=0:f<=.5?c=a/(s+r):c=a/(2-s-r),[i,c*100,f*100]},p.rgb.hsv=function(e){let n,t,o,r,s;const a=e[0]/255,i=e[1]/255,c=e[2]/255,f=Math.max(a,i,c),h=f-Math.min(a,i,c),u=function(d){return(f-d)/6/h+1/2};return h===0?(r=0,s=0):(s=h/f,n=u(a),t=u(i),o=u(c),a===f?r=o-t:i===f?r=1/3+n-o:c===f&&(r=2/3+t-n),r<0?r+=1:r>1&&(r-=1)),[r*360,s*100,f*100]},p.rgb.hwb=function(e){const n=e[0],t=e[1];let o=e[2];const r=p.rgb.hsl(e)[0],s=1/255*Math.min(n,Math.min(t,o));return o=1-1/255*Math.max(n,Math.max(t,o)),[r,s*100,o*100]},p.rgb.cmyk=function(e){const n=e[0]/255,t=e[1]/255,o=e[2]/255,r=Math.min(1-n,1-t,1-o),s=(1-n-r)/(1-r)||0,a=(1-t-r)/(1-r)||0,i=(1-o-r)/(1-r)||0;return[s*100,a*100,i*100,r*100]};function lt(e,n){return(e[0]-n[0])**2+(e[1]-n[1])**2+(e[2]-n[2])**2}p.rgb.keyword=function(e){const n=Ue[e];if(n)return n;let t=1/0,o;for(const r of Object.keys(me)){const s=me[r],a=lt(e,s);a<t&&(t=a,o=r)}return o},p.keyword.rgb=function(e){return me[e]},p.rgb.xyz=function(e){let n=e[0]/255,t=e[1]/255,o=e[2]/255;n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92;const r=n*.4124+t*.3576+o*.1805,s=n*.2126+t*.7152+o*.0722,a=n*.0193+t*.1192+o*.9505;return[r*100,s*100,a*100]},p.rgb.lab=function(e){const n=p.rgb.xyz(e);let t=n[0],o=n[1],r=n[2];t/=95.047,o/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;const s=116*o-16,a=500*(t-o),i=200*(o-r);return[s,a,i]},p.hsl.rgb=function(e){const n=e[0]/360,t=e[1]/100,o=e[2]/100;let r,s,a;if(t===0)return a=o*255,[a,a,a];o<.5?r=o*(1+t):r=o+t-o*t;const i=2*o-r,c=[0,0,0];for(let f=0;f<3;f++)s=n+1/3*-(f-1),s<0&&s++,s>1&&s--,6*s<1?a=i+(r-i)*6*s:2*s<1?a=r:3*s<2?a=i+(r-i)*(2/3-s)*6:a=i,c[f]=a*255;return c},p.hsl.hsv=function(e){const n=e[0];let t=e[1]/100,o=e[2]/100,r=t;const s=Math.max(o,.01);o*=2,t*=o<=1?o:2-o,r*=s<=1?s:2-s;const a=(o+t)/2,i=o===0?2*r/(s+r):2*t/(o+t);return[n,i*100,a*100]},p.hsv.rgb=function(e){const n=e[0]/60,t=e[1]/100;let o=e[2]/100;const r=Math.floor(n)%6,s=n-Math.floor(n),a=255*o*(1-t),i=255*o*(1-t*s),c=255*o*(1-t*(1-s));switch(o*=255,r){case 0:return[o,c,a];case 1:return[i,o,a];case 2:return[a,o,c];case 3:return[a,i,o];case 4:return[c,a,o];case 5:return[o,a,i]}},p.hsv.hsl=function(e){const n=e[0],t=e[1]/100,o=e[2]/100,r=Math.max(o,.01);let s,a;a=(2-t)*o;const i=(2-t)*r;return s=t*r,s/=i<=1?i:2-i,s=s||0,a/=2,[n,s*100,a*100]},p.hwb.rgb=function(e){const n=e[0]/360;let t=e[1]/100,o=e[2]/100;const r=t+o;let s;r>1&&(t/=r,o/=r);const a=Math.floor(6*n),i=1-o;s=6*n-a,a&1&&(s=1-s);const c=t+s*(i-t);let f,h,u;switch(a){default:case 6:case 0:f=i,h=c,u=t;break;case 1:f=c,h=i,u=t;break;case 2:f=t,h=i,u=c;break;case 3:f=t,h=c,u=i;break;case 4:f=c,h=t,u=i;break;case 5:f=i,h=t,u=c;break}return[f*255,h*255,u*255]},p.cmyk.rgb=function(e){const n=e[0]/100,t=e[1]/100,o=e[2]/100,r=e[3]/100,s=1-Math.min(1,n*(1-r)+r),a=1-Math.min(1,t*(1-r)+r),i=1-Math.min(1,o*(1-r)+r);return[s*255,a*255,i*255]},p.xyz.rgb=function(e){const n=e[0]/100,t=e[1]/100,o=e[2]/100;let r,s,a;return r=n*3.2406+t*-1.5372+o*-.4986,s=n*-.9689+t*1.8758+o*.0415,a=n*.0557+t*-.204+o*1.057,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,r=Math.min(Math.max(0,r),1),s=Math.min(Math.max(0,s),1),a=Math.min(Math.max(0,a),1),[r*255,s*255,a*255]},p.xyz.lab=function(e){let n=e[0],t=e[1],o=e[2];n/=95.047,t/=100,o/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;const r=116*t-16,s=500*(n-t),a=200*(t-o);return[r,s,a]},p.lab.xyz=function(e){const n=e[0],t=e[1],o=e[2];let r,s,a;s=(n+16)/116,r=t/500+s,a=s-o/200;const i=s**3,c=r**3,f=a**3;return s=i>.008856?i:(s-16/116)/7.787,r=c>.008856?c:(r-16/116)/7.787,a=f>.008856?f:(a-16/116)/7.787,r*=95.047,s*=100,a*=108.883,[r,s,a]},p.lab.lch=function(e){const n=e[0],t=e[1],o=e[2];let r;r=Math.atan2(o,t)*360/2/Math.PI,r<0&&(r+=360);const a=Math.sqrt(t*t+o*o);return[n,a,r]},p.lch.lab=function(e){const n=e[0],t=e[1],r=e[2]/360*2*Math.PI,s=t*Math.cos(r),a=t*Math.sin(r);return[n,s,a]},p.rgb.ansi16=function(e,n=null){const[t,o,r]=e;let s=n===null?p.rgb.hsv(e)[2]:n;if(s=Math.round(s/50),s===0)return 30;let a=30+(Math.round(r/255)<<2|Math.round(o/255)<<1|Math.round(t/255));return s===2&&(a+=60),a},p.hsv.ansi16=function(e){return p.rgb.ansi16(p.hsv.rgb(e),e[2])},p.rgb.ansi256=function(e){const n=e[0],t=e[1],o=e[2];return n===t&&t===o?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(t/255*5)+Math.round(o/255*5)},p.ansi16.rgb=function(e){let n=e%10;if(n===0||n===7)return e>50&&(n+=3.5),n=n/10.5*255,[n,n,n];const t=(~~(e>50)+1)*.5,o=(n&1)*t*255,r=(n>>1&1)*t*255,s=(n>>2&1)*t*255;return[o,r,s]},p.ansi256.rgb=function(e){if(e>=232){const s=(e-232)*10+8;return[s,s,s]}e-=16;let n;const t=Math.floor(e/36)/5*255,o=Math.floor((n=e%36)/6)/5*255,r=n%6/5*255;return[t,o,r]},p.rgb.hex=function(e){const t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t},p.hex.rgb=function(e){const n=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];let t=n[0];n[0].length===3&&(t=t.split("").map(i=>i+i).join(""));const o=parseInt(t,16),r=o>>16&255,s=o>>8&255,a=o&255;return[r,s,a]},p.rgb.hcg=function(e){const n=e[0]/255,t=e[1]/255,o=e[2]/255,r=Math.max(Math.max(n,t),o),s=Math.min(Math.min(n,t),o),a=r-s;let i,c;return a<1?i=s/(1-a):i=0,a<=0?c=0:r===n?c=(t-o)/a%6:r===t?c=2+(o-n)/a:c=4+(n-t)/a,c/=6,c%=1,[c*360,a*100,i*100]},p.hsl.hcg=function(e){const n=e[1]/100,t=e[2]/100,o=t<.5?2*n*t:2*n*(1-t);let r=0;return o<1&&(r=(t-.5*o)/(1-o)),[e[0],o*100,r*100]},p.hsv.hcg=function(e){const n=e[1]/100,t=e[2]/100,o=n*t;let r=0;return o<1&&(r=(t-o)/(1-o)),[e[0],o*100,r*100]},p.hcg.rgb=function(e){const n=e[0]/360,t=e[1]/100,o=e[2]/100;if(t===0)return[o*255,o*255,o*255];const r=[0,0,0],s=n%1*6,a=s%1,i=1-a;let c=0;switch(Math.floor(s)){case 0:r[0]=1,r[1]=a,r[2]=0;break;case 1:r[0]=i,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=a;break;case 3:r[0]=0,r[1]=i,r[2]=1;break;case 4:r[0]=a,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=i}return c=(1-t)*o,[(t*r[0]+c)*255,(t*r[1]+c)*255,(t*r[2]+c)*255]},p.hcg.hsv=function(e){const n=e[1]/100,t=e[2]/100,o=n+t*(1-n);let r=0;return o>0&&(r=n/o),[e[0],r*100,o*100]},p.hcg.hsl=function(e){const n=e[1]/100,o=e[2]/100*(1-n)+.5*n;let r=0;return o>0&&o<.5?r=n/(2*o):o>=.5&&o<1&&(r=n/(2*(1-o))),[e[0],r*100,o*100]},p.hcg.hwb=function(e){const n=e[1]/100,t=e[2]/100,o=n+t*(1-n);return[e[0],(o-n)*100,(1-o)*100]},p.hwb.hcg=function(e){const n=e[1]/100,o=1-e[2]/100,r=o-n;let s=0;return r<1&&(s=(o-r)/(1-r)),[e[0],r*100,s*100]},p.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},p.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},p.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},p.gray.hsl=function(e){return[0,0,e[0]]},p.gray.hsv=p.gray.hsl,p.gray.hwb=function(e){return[0,100,e[0]]},p.gray.cmyk=function(e){return[0,0,0,e[0]]},p.gray.lab=function(e){return[e[0],0,0]},p.gray.hex=function(e){const n=Math.round(e[0]/100*255)&255,o=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(o.length)+o},p.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const we=We;function ct(){const e={},n=Object.keys(we);for(let t=n.length,o=0;o<t;o++)e[n[o]]={distance:-1,parent:null};return e}function ut(e){const n=ct(),t=[e];for(n[e].distance=0;t.length;){const o=t.pop(),r=Object.keys(we[o]);for(let s=r.length,a=0;a<s;a++){const i=r[a],c=n[i];c.distance===-1&&(c.distance=n[o].distance+1,c.parent=o,t.unshift(i))}}return n}function dt(e,n){return function(t){return n(e(t))}}function ht(e,n){const t=[n[e].parent,e];let o=we[n[e].parent][e],r=n[e].parent;for(;n[r].parent;)t.unshift(n[r].parent),o=dt(we[n[r].parent][r],o),r=n[r].parent;return o.conversion=t,o}var ft=function(e){const n=ut(e),t={},o=Object.keys(n);for(let r=o.length,s=0;s<r;s++){const a=o[s];n[a].parent!==null&&(t[a]=ht(a,n))}return t};const Te=We,mt=ft,re={},pt=Object.keys(Te);function gt(e){const n=function(...t){const o=t[0];return o==null?o:(o.length>1&&(t=o),e(t))};return"conversion"in e&&(n.conversion=e.conversion),n}function vt(e){const n=function(...t){const o=t[0];if(o==null)return o;o.length>1&&(t=o);const r=e(t);if(typeof r=="object")for(let s=r.length,a=0;a<s;a++)r[a]=Math.round(r[a]);return r};return"conversion"in e&&(n.conversion=e.conversion),n}pt.forEach(e=>{re[e]={},Object.defineProperty(re[e],"channels",{value:Te[e].channels}),Object.defineProperty(re[e],"labels",{value:Te[e].labels});const n=mt(e);Object.keys(n).forEach(o=>{const r=n[o];re[e][o]=vt(r),re[e][o].raw=gt(r)})});var bt=re;const se=it,Y=bt,je=["keyword","gray","hex"],De={};for(const e of Object.keys(Y))De[[...Y[e].labels].sort().join("")]=e;const xe={};function P(e,n){if(!(this instanceof P))return new P(e,n);if(n&&n in je&&(n=null),n&&!(n in Y))throw new Error("Unknown model: "+n);let t,o;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof P)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const r=se.get(e);if(r===null)throw new Error("Unable to parse color from string: "+e);this.model=r.model,o=Y[this.model].channels,this.color=r.value.slice(0,o),this.valpha=typeof r.value[o]=="number"?r.value[o]:1}else if(e.length>0){this.model=n||"rgb",o=Y[this.model].channels;const r=Array.prototype.slice.call(e,0,o);this.color=Le(r,o),this.valpha=typeof e[o]=="number"?e[o]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const r=Object.keys(e);"alpha"in e&&(r.splice(r.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const s=r.sort().join("");if(!(s in De))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=De[s];const{labels:a}=Y[this.model],i=[];for(t=0;t<a.length;t++)i.push(e[a[t]]);this.color=Le(i)}if(xe[this.model])for(o=Y[this.model].channels,t=0;t<o;t++){const r=xe[this.model][t];r&&(this.color[t]=r(this.color[t]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}P.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let n=this.model in se.to?this:this.rgb();n=n.round(typeof e=="number"?e:1);const t=n.valpha===1?n.color:[...n.color,this.valpha];return se.to[n.model](t)},percentString(e){const n=this.rgb().round(typeof e=="number"?e:1),t=n.valpha===1?n.color:[...n.color,this.valpha];return se.to.rgb.percent(t)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:n}=Y[this.model],{labels:t}=Y[this.model];for(let o=0;o<n;o++)e[t[o]]=this.color[o];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new P([...this.color.map(wt(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new P([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:T("rgb",0,L(255)),green:T("rgb",1,L(255)),blue:T("rgb",2,L(255)),hue:T(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:T("hsl",1,L(100)),lightness:T("hsl",2,L(100)),saturationv:T("hsv",1,L(100)),value:T("hsv",2,L(100)),chroma:T("hcg",1,L(100)),gray:T("hcg",2,L(100)),white:T("hwb",1,L(100)),wblack:T("hwb",2,L(100)),cyan:T("cmyk",0,L(100)),magenta:T("cmyk",1,L(100)),yellow:T("cmyk",2,L(100)),black:T("cmyk",3,L(100)),x:T("xyz",0,L(95.047)),y:T("xyz",1,L(100)),z:T("xyz",2,L(108.833)),l:T("lab",0,L(100)),a:T("lab",1),b:T("lab",2),keyword(e){return e!==void 0?new P(e):Y[this.model].keyword(this.color)},hex(e){return e!==void 0?new P(e):se.to.hex(this.rgb().round().color)},hexa(e){if(e!==void 0)return new P(e);const n=this.rgb().round().color;let t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),se.to.hex(n)+t},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,n=[];for(const[t,o]of e.entries()){const r=o/255;n[t]=r<=.04045?r/12.92:((r+.055)/1.055)**2.4}return .2126*n[0]+.7152*n[1]+.0722*n[2]},contrast(e){const n=this.luminosity(),t=e.luminosity();return n>t?(n+.05)/(t+.05):(t+.05)/(n+.05)},level(e){const n=this.contrast(e);return n>=7?"AAA":n>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let n=0;n<3;n++)e.color[n]=255-e.color[n];return e},lighten(e){const n=this.hsl();return n.color[2]+=n.color[2]*e,n},darken(e){const n=this.hsl();return n.color[2]-=n.color[2]*e,n},saturate(e){const n=this.hsl();return n.color[1]+=n.color[1]*e,n},desaturate(e){const n=this.hsl();return n.color[1]-=n.color[1]*e,n},whiten(e){const n=this.hwb();return n.color[1]+=n.color[1]*e,n},blacken(e){const n=this.hwb();return n.color[2]+=n.color[2]*e,n},grayscale(){const e=this.rgb().color,n=e[0]*.3+e[1]*.59+e[2]*.11;return P.rgb(n,n,n)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const n=this.hsl();let t=n.color[0];return t=(t+e)%360,t=t<0?360+t:t,n.color[0]=t,n},mix(e,n){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const t=e.rgb(),o=this.rgb(),r=n===void 0?.5:n,s=2*r-1,a=t.alpha()-o.alpha(),i=((s*a===-1?s:(s+a)/(1+s*a))+1)/2,c=1-i;return P.rgb(i*t.red()+c*o.red(),i*t.green()+c*o.green(),i*t.blue()+c*o.blue(),t.alpha()*r+o.alpha()*(1-r))}};for(const e of Object.keys(Y)){if(je.includes(e))continue;const{channels:n}=Y[e];P.prototype[e]=function(...t){return this.model===e?new P(this):t.length>0?new P(t,e):new P([...xt(Y[this.model][e].raw(this.color)),this.valpha],e)},P[e]=function(...t){let o=t[0];return typeof o=="number"&&(o=Le(t,n)),new P(o,e)}}function yt(e,n){return Number(e.toFixed(n))}function wt(e){return function(n){return yt(n,e)}}function T(e,n,t){e=Array.isArray(e)?e:[e];for(const o of e)(xe[o]||(xe[o]=[]))[n]=t;return e=e[0],function(o){let r;return o!==void 0?(t&&(o=t(o)),r=this[e](),r.color[n]=o,r):(r=this[e]().color[n],t&&(r=t(r)),r)}}function L(e){return function(n){return Math.max(0,Math.min(e,n))}}function xt(e){return Array.isArray(e)?e:[e]}function Le(e,n){for(let t=0;t<n;t++)typeof e[t]!="number"&&(e[t]=0);return e}var kt=P;const W=tt(kt);function qe(e){return W(e)}function Ge(e){return e.hex()}function Ct(e){const{h:n,s:t,v:o}=e.hsv().object();return{color:W.hsv(n,t,100),value:o}}function Mt(e,n){const{h:t,s:o}=e.hsv().object();return W.hsv(t,o,n)}function Ke(e,n){const t=Mt(e,n);return Ge(t)}function _t(){const e=l.ref(),n=255*6+1,t=256;function o(){if(!e.value)return;const h=e.value;h.width=n,h.height=t;const u=h.getContext("2d");if(!u)return;u.clearRect(0,0,n,t);const d=u.createLinearGradient(0,0,n,0);d.addColorStop(0,"#FF0000"),d.addColorStop(1/6,"#FFFF00"),d.addColorStop(1/3,"#00FF00"),d.addColorStop(1/2,"#00FFFF"),d.addColorStop(2/3,"#0000FF"),d.addColorStop(5/6,"#FF00FF"),d.addColorStop(1,"#FF0000"),u.fillStyle=d,u.fillRect(0,0,n,t);const v=u.createLinearGradient(0,t,0,0);v.addColorStop(0,"rgb(255 255 255 / 100%)"),v.addColorStop(1,"rgb(255 255 255 / 0%)"),u.fillStyle=v,u.fillRect(0,0,n,t)}function r(h){const u=qe(h);return s(u)}function s(h){const{r:u,g:d,b:v}=h.rgb().object(),b=[{type:"r",value:u},{type:"g",value:d},{type:"b",value:v}];b.sort((C,D)=>D.value-C.value);const m=b[0],k=b[1],g=m.type+k.type;let w=0;const y=b[2].value;return g==="rg"||g==="gr"?(w=255,k.type==="r"?w+=255-a(y,k.value):w-=255-a(y,k.value)):g==="gb"||g==="bg"?(w=255*3,k.type==="g"?w+=255-a(y,k.value):w-=255-a(y,k.value)):(g==="rb"||g==="br")&&(w=255*5,k.type==="b"?w+=255-a(y,k.value):w-=255-a(y,k.value)),{x:w,y}}function a(h,u){return h===255?255:(255*u-255*h)/(255-h)}function i(h,u,d,v){if(!e.value)return W();const b=n/d,m=t/v;return h=Math.round(Math.min(h*b,n-1)),u=Math.round(Math.min(u*m,t-1)),c(h,u)}function c(h,u){let d=0,v=0,b=0;const m=255,k=f(h,0,m)||f(h,m*5,m*6),g=f(h,m,m*3),w=f(h,m*3,m*5);k?d=255:h<=m*2?d=Math.max(2*m-h,0):h>=m*4&&(d=Math.max(h-m*4,0)),g?v=255:h<m?v=Math.max(h,0):v=Math.max(m*4-h,0),w?b=255:h<m*3?b=Math.max(h-m*2,0):b=Math.max(m*6-h,0);const y=m-d,C=m-v,D=m-b,A=u/m;return d+=y*A,v+=C*A,b+=D*A,W.rgb(d,v,b)}function f(h,u,d){return h>=u&&h<=d}return l.onMounted(()=>{o()}),{canvasWidth:n,canvasHeight:t,colorAreaCanvas:e,drawColorArea:o,getCoordinateByColor:s,getCoordinateByHex:r,getColorByCoordinate:i}}function Et(e,n=200){let t=null;return function(...o){const r=this;t||(t=window.setTimeout(()=>{e.apply(r,o),t=null},n))}}function St(){const e=l.ref(),n=l.reactive({x:0,y:0});function t(u){if(u.touches.length===0)return;u.preventDefault();const{clientX:d,clientY:v}=u.touches[0];i({x:d,y:v}),document.body.addEventListener("touchmove",o),document.body.addEventListener("touchend",r)}function o(u){if(u.touches.length>1)return;const{clientX:d,clientY:v}=u.touches[0];i({x:d,y:v})}function r(){document.body.removeEventListener("touchmove",o),document.body.removeEventListener("touchend",r)}function s(u){document.body.addEventListener("mousemove",a),document.body.addEventListener("mouseup",f),i({x:u.clientX,y:u.clientY})}function a(u){i({x:u.clientX,y:u.clientY})}const i=Et(c,20);function c(u){var D;const{x:d,y:v}=u,b=(D=e.value)==null?void 0:D.getBoundingClientRect();if(!b)return;const{left:m,top:k,width:g,height:w}=b;let y=0,C=0;d<=m?y=0:d>=m+g?y=g:y=d-m,v<=k?C=0:v>=k+w?C=w:C=v-k,n.x=y,n.y=C}function f(){document.body.removeEventListener("mousemove",a),document.body.removeEventListener("mouseup",f)}function h(u,d,v,b){var C;const m=(C=e.value)==null?void 0:C.getBoundingClientRect();if(!m)return;const{width:k,height:g}=m,w=k/v,y=g/b;n.x=u*w,n.y=d*y}return l.onMounted(()=>{var u,d;(u=e.value)==null||u.addEventListener("touchstart",t),(d=e.value)==null||d.addEventListener("mousedown",s)}),l.onBeforeUnmount(()=>{var u,d;(u=e.value)==null||u.removeEventListener("touchstart",t),document.body.removeEventListener("touchmove",o),document.body.removeEventListener("touchend",r),(d=e.value)==null||d.removeEventListener("mousedown",s),document.body.removeEventListener("mousemove",a),document.body.removeEventListener("mouseup",f)}),{colorAreaRef:e,circlePickerCoordinate:n,setCirclePickerCoordinate:h}}const Ft={class:"hv-color-picker__color-form"},Tt={class:"mb-12"},Dt={class:"hv-color-picker__form-group mb-12"},Lt={class:"hv-color-picker__form-group mb-12"},Ae="#ffffff",At=l.defineComponent({__name:"ColorForm",props:{modelValue:{}},emits:["change"],setup(e,{emit:n}){const t=e,o=n,r=l.ref(W(t.modelValue||Ae).hex()),s=l.reactive(W(r.value||Ae).rgb().object()),a=l.reactive(W(r.value||Ae).hsv().object());function i(u){return`#${u.replace(/[^0-9A-F]/gi,"").slice(0,6).toUpperCase()}`}l.watch(()=>t.modelValue,u=>{const d=W(u);r.value=d.hex();const{r:v,g:b,b:m}=d.rgb().object(),{h:k,s:g,v:w}=d.hsv().object();Object.assign(s,{r:v,g:b,b:m}),Object.assign(a,{h:k,s:g,v:w})});function c(){(r.value||"").replace(/[^0-9A-F]/gi,"").length===6?o("change",r.value):r.value=t.modelValue}function f(){const{r:u,g:d,b:v}=s;o("change",W.rgb(u,d,v).hex().toString())}function h(){const{h:u,s:d,v}=a;o("change",W.hsv(u,d,v).hex().toString())}return(u,d)=>{const v=l.resolveComponent("el-input"),b=l.resolveComponent("el-input-number");return l.openBlock(),l.createElementBlock("div",Ft,[l.createElementVNode("div",Tt,[l.createVNode(v,{modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=m=>r.value=m),formatter:i,onChange:c},null,8,["modelValue"])]),l.createElementVNode("div",Dt,[d[7]||(d[7]=l.createElementVNode("div",{class:"hv-color-picker__form-label"},"RGB",-1)),l.createVNode(b,{modelValue:s.r,"onUpdate:modelValue":d[1]||(d[1]=m=>s.r=m),onChange:f,"step-strictly":"",min:0,max:255,step:1,controls:!1},null,8,["modelValue"]),l.createVNode(b,{modelValue:s.g,"onUpdate:modelValue":d[2]||(d[2]=m=>s.g=m),onChange:f,"step-strictly":"",min:0,max:255,step:1,controls:!1},null,8,["modelValue"]),l.createVNode(b,{modelValue:s.b,"onUpdate:modelValue":d[3]||(d[3]=m=>s.b=m),onChange:f,"step-strictly":"",min:0,max:255,step:1,controls:!1},null,8,["modelValue"])]),l.createElementVNode("div",Lt,[d[8]||(d[8]=l.createElementVNode("div",{class:"hv-color-picker__form-label"},"HSV",-1)),l.createVNode(b,{modelValue:a.h,"onUpdate:modelValue":d[4]||(d[4]=m=>a.h=m),onChange:h,min:0,max:360,"step-strictly":"",step:1,controls:!1},null,8,["modelValue"]),l.createVNode(b,{modelValue:a.s,"onUpdate:modelValue":d[5]||(d[5]=m=>a.s=m),onChange:h,min:0,max:100,"step-strictly":"",step:1,controls:!1},null,8,["modelValue"]),l.createVNode(b,{modelValue:a.v,"onUpdate:modelValue":d[6]||(d[6]=m=>a.v=m),onChange:h,"step-strictly":"",min:0,max:100,controls:!1},null,8,["modelValue"])])])}}}),Vt={class:"hv-color-picker__preset"},Ot={class:"hv-color-picker__preset-title"},Pt={class:"hv-color-picker__preset-list"},Rt=["onClick"],Ht=l.defineComponent({__name:"PresetColors",props:{title:{},presetColors:{}},emits:["change"],setup(e,{emit:n}){const t=["#000000","#FFFFFF","#E3822D","#DCE24F","#1DCF69","#6DE5B9","#11A1F2","#AA43FF","#F0689C","#F8D28B","#606368","#E83C34","#EEBE29","#89F0AC","#2FBC9E","#56CCF2","#1C1DFA","#DC88F5","#D4C595","#C52F65"],o=e,r=l.computed(()=>o.presetColors?o.presetColors:t),s=n;function a(i){s("change",i)}return(i,c)=>(l.openBlock(),l.createElementBlock("div",Vt,[l.createElementVNode("div",Ot,l.toDisplayString(o.title||"系统预设色彩"),1),l.createElementVNode("div",Pt,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,f=>(l.openBlock(),l.createElementBlock("div",{class:"hv-color-picker__preset-list-item",onClick:h=>a(f),key:f,style:l.normalizeStyle({backgroundColor:f})},null,12,Rt))),128))])]))}}),Bt={class:"hv-color-picker"},$t={class:"hv-color-picker__title"},zt={class:"hv-color-picker__area-outer"},Nt={class:"hv-color-picker__slider"},Ve="#FFFFFF",It=Q(l.defineComponent({name:"HvColorPicker",__name:"ColorPicker",props:l.mergeModels({title:{},presetTitle:{},presetColors:{}},{modelValue:{type:String,default:Ve},modelModifiers:{}}),emits:l.mergeModels(["update:model-value"],["update:modelValue"]),setup(e,{emit:n}){const t=e,o=n,{colorAreaCanvas:r,getColorByCoordinate:s,getCoordinateByColor:a,canvasWidth:i,canvasHeight:c}=_t(),{colorAreaRef:f,circlePickerCoordinate:h,setCirclePickerCoordinate:u}=St(),d=l.useModel(e,"modelValue"),v=l.ref(W(Ve)),b=l.ref(100),m=l.computed(()=>v.value?Ke(v.value,b.value):Ve);l.watch(d,y=>{Ke(v.value,b.value)!==y&&w(y)}),l.watch(()=>h,y=>{var A;const C=(A=f.value)==null?void 0:A.getBoundingClientRect();if(!C)return;const D=s(y.x,y.y,C.width,C.height);v.value=D},{deep:!0});const k=l.computed(()=>d.value?{top:h.y+"px",left:h.x+"px",backgroundColor:v.value.hex()}:{top:"100%",left:"0",backgroundColor:"#ffffff"}),g=l.computed(()=>{const y=Ge(v.value);return{"--el-slider-runway-bg-color":`linear-gradient(to right, #000000, ${y})`,"--el-slider-main-bg-color":y}});l.watch(()=>m.value,(y,C)=>{if(y!==C){o("update:model-value",y);return}});function w(y){const C=qe(y),{color:D,value:A}=Ct(C);v.value=D,b.value=A;const q=a(D);u(q.x,q.y,i,c)}return l.onMounted(()=>{w(d.value)}),(y,C)=>{const D=l.resolveComponent("ElSlider");return l.openBlock(),l.createElementBlock("div",Bt,[l.createElementVNode("div",$t,l.toDisplayString(t.title||"颜色编辑器"),1),l.createElementVNode("div",zt,[l.createElementVNode("div",{class:"hv-color-picker__area",ref_key:"colorAreaRef",ref:f},[l.createElementVNode("canvas",{ref_key:"colorAreaCanvas",ref:r},null,512),l.createElementVNode("div",{class:"hv-color-picker__circle",style:l.normalizeStyle(k.value)},null,4)],512)]),l.createElementVNode("div",Nt,[l.createVNode(D,{modelValue:b.value,"onUpdate:modelValue":C[0]||(C[0]=A=>b.value=A),min:0,max:100,"show-tooltip":!1,style:l.normalizeStyle(g.value)},null,8,["modelValue","style"]),l.createElementVNode("div",{class:"hv-color-picker__origin-color",style:l.normalizeStyle({backgroundColor:m.value})},null,4)]),l.createVNode(At,{"model-value":d.value,onChange:w},null,8,["model-value"]),l.createVNode(Ht,{onChange:w,title:t.presetTitle,presetColors:t.presetColors},null,8,["title","presetColors"])])}}}));class Xt{constructor(){j(this,"_eventMap");this._eventMap=new Map}on(n,t){const o=this._eventMap.get(n);if(o)o.add(t);else{const r=new Set;r.add(t),this._eventMap.set(n,r)}}off(n,t){const o=this._eventMap.get(n);o&&(t?o.delete(t):o.clear())}emit(n,...t){const o=this._eventMap.get(n);if(o)for(const r of o.values())r(...t)}}class Yt extends Xt{constructor(){super();j(this,"isDragStart",!1);j(this,"dragType");j(this,"dragData");j(this,"isSendFirstMovePos",!1);j(this,"touchStartPressTime",300);j(this,"touchStartTime",0);j(this,"touchStartPosition",{x:0,y:0});j(this,"lastMovePoint",{x:0,y:0});j(this,"emitTouchStartTimer");j(this,"destroy",()=>{});this.bindEventListener()}updateDargInfo(t,o){if(t==null)throw new Error("请传入拖动元素 type");this.isDragStart=!0,this.dragType=t,this.dragData=o,this.emitTouchStartTimer&&clearTimeout(this.emitTouchStartTimer),this.emitTouchStartTimer=void 0}onDown(t){this.emit("down",t)}onFirstMove(t,o){this.isDragStart||(this.isSendFirstMovePos=!0,this.emit("first-move",t,o))}onStart(t){this.isDragStart||this.emit("start",t)}onMove(t){!this.isDragStart||!this.dragType||(this.lastMovePoint=t,this.emit("move",{type:this.dragType,data:this.dragData,point:t}))}onEnd(){this.emitTouchStartTimer&&clearTimeout(this.emitTouchStartTimer),this.emitTouchStartTimer=void 0,this.isSendFirstMovePos=!1,!(!this.isDragStart||!this.dragType)&&(this.isDragStart=!1,this.emit("end",{point:this.lastMovePoint,type:this.dragType,data:this.dragData}))}onMouseDown(t){if(t.buttons!==1){this.onEnd();return}const{clientX:o,clientY:r}=t,s={x:o,y:r};this.touchStartTime=Date.now(),this.touchStartPosition=s,this.emitTouchStartTimer&&clearTimeout(this.emitTouchStartTimer),this.onDown(s),this.emitTouchStartTimer=window.setTimeout(()=>{this.onStart(s)},this.touchStartPressTime)}onMouseMove(t){if(t.buttons!==1){this.onEnd();return}const{clientX:o,clientY:r}=t;if(this.isDragStart)t.preventDefault(),t.stopPropagation(),this.onMove({x:o,y:r});else{this.isSendFirstMovePos||this.onFirstMove({x:o,y:r},t);const{x:s,y:a}=this.touchStartPosition;Date.now()-this.touchStartTime<this.touchStartPressTime&&(Math.abs(s-o)>30||Math.abs(a-r)>30)&&(clearTimeout(this.emitTouchStartTimer),this.emitTouchStartTimer=void 0)}}onMouseUp(){this.onEnd()}onTouchStart(t){if(t.touches.length>1)return;const{clientX:o,clientY:r}=t.touches[0],s={x:o,y:r};this.touchStartTime=Date.now(),this.touchStartPosition=s,this.onDown(s),this.emitTouchStartTimer=window.setTimeout(()=>{this.onStart(s)},this.touchStartPressTime)}onTouchMove(t){if(t.touches.length>1)return;const{clientX:o,clientY:r}=t.touches[0];if(this.isDragStart)t.preventDefault(),t.stopPropagation(),this.onMove({x:o,y:r});else{this.isSendFirstMovePos||this.onFirstMove({x:o,y:r},t);const{x:s,y:a}=this.touchStartPosition;Date.now()-this.touchStartTime<this.touchStartPressTime&&(Math.abs(s-o)>30||Math.abs(a-r)>30)&&clearTimeout(this.emitTouchStartTimer)}}onTouchEnd(){this.onEnd()}bindEventListener(){if(document.body){const t=this.onTouchStart.bind(this),o=this.onTouchMove.bind(this),r=this.onTouchEnd.bind(this),s=this.onMouseDown.bind(this),a=this.onMouseMove.bind(this),i=this.onMouseUp.bind(this);document.body.addEventListener("touchstart",t,{passive:!1}),document.body.addEventListener("touchmove",o,{passive:!1}),document.body.addEventListener("touchend",r,{passive:!1}),document.body.addEventListener("mousedown",s),document.body.addEventListener("mousemove",a),document.body.addEventListener("mouseup",i),this.destroy=()=>{document.body.removeEventListener("touchstart",t),document.body.removeEventListener("touchmove",o),document.body.removeEventListener("touchend",r),document.body.removeEventListener("mousedown",s),document.body.removeEventListener("mousemove",a),document.body.removeEventListener("mouseup",i)}}else document.addEventListener("DOMContentLoaded",this.bindEventListener)}removeEventListener(){this.destroy()}destroyed(){this.isDragStart=!1,this.dragType=void 0,this.dragData=void 0,this.removeEventListener()}}const z=new Yt,Ut=((e,n)=>{const t=e.__vccOpts||e;for(const[o,r]of n)t[o]=r;return t})(l.defineComponent({name:"HvDraggable",__name:"Draggable",props:{type:{},immediate:{},disabled:{type:Boolean,default:!1},data:{}},setup(e){const n={LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",ALL:"all"},t=e,o=l.ref(),r=l.ref(!1),s=l.reactive({x:0,y:0}),a=l.ref(!1),i=l.reactive({x:0,y:0}),c=l.computed(()=>Array.isArray(t.immediate)?t.immediate:t.immediate?[t.immediate]:[]),f=l.computed(()=>({transform:`translate(${i.x}px, ${i.y}px) translate(-50%, -50%)`})),h=g=>{const{x:w,y}=g,C=document.elementFromPoint(w,y);if(!t.disabled&&o.value&&o.value.contains(C)){if(c.value.includes(n.ALL)){m(g);return}r.value=!0,s.x=w,s.y=y}},u=(g,w)=>{const{x:y,y:C}=g,D=c.value.filter(A=>A!==n.ALL);if(r.value&&!t.disabled&&D.length){const A=y-s.x,q=Math.abs(A),ae=C-s.y,ie=Math.abs(ae),Z=Math.max(q,ie),ke=q===Z,pe=ie===Z;let ne=!1;if(ke&&(ne=D.includes(n.LEFT)&&A<0||D.includes(n.RIGHT)&&A>0),pe&&!ne&&(ne=D.includes(n.TOP)&&ae<0||D.includes(n.BOTTOM)&&ae>0),ne){w.preventDefault(),w.stopPropagation(),m(s),k(g);return}}},d=g=>{const{x:w,y}=g,C=document.elementFromPoint(w,y);!t.disabled&&o.value&&o.value.contains(C)&&m(g)},v=g=>{const{point:w}=g;a.value&&k(w)},b=()=>{r.value=!1,a.value=!1,Object.assign(s,{x:0,y:0}),Object.assign(i,{x:0,y:0})};function m(g){a.value=!0,i.x=g.x,i.y=g.y,z.updateDargInfo(t.type,t.data)}function k(g){i.x=g.x,i.y=g.y}return l.onMounted(()=>{z.on("down",h),z.on("first-move",u),z.on("start",d),z.on("move",v),z.on("end",b)}),l.onBeforeUnmount(()=>{z.off("down",h),z.off("first-move",u),z.off("start",d),z.off("move",v),z.off("end",b)}),(g,w)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"dragItemRef",ref:o,class:l.normalizeClass(["hv-draggable",g.disabled?"disabled":""])},[l.renderSlot(g.$slots,"default",{},void 0,!0),a.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"hv-draggable__clone-item",style:l.normalizeStyle(f.value)},[l.renderSlot(g.$slots,"hv-drag-item",{},()=>[l.renderSlot(g.$slots,"default",{},void 0,!0)],!0)],4)):l.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-e9c66d0f"]]),Wt=l.defineComponent({name:"HvDroppable",__name:"Droppable",props:{acceptDragType:{}},emits:["enter","move","drop","leave"],setup(e,{emit:n}){const t=n,o=e,r=l.ref(),s=l.ref(!1),a=l.computed(()=>Array.isArray(o.acceptDragType)?o.acceptDragType:[o.acceptDragType]);function i(h){if(!r.value)return{isInArea:!1,position:{x:0,y:0}};const{x:u,y:d}=h,{x:v,y:b,width:m,height:k}=r.value.getBoundingClientRect(),g=u-v,w=d-b;return{isInArea:g>=0&&g<=m&&w>=0&&w<=k,position:{x:g,y:w}}}const c=h=>{const{type:u,data:d,point:v}=h;if(r.value&&a.value.includes(u)){const{isInArea:b,position:m}=i(v);b?s.value?t("move",u,m,d):(s.value=!0,t("enter",u,m,d)):s.value&&(s.value=!1,t("leave",u,d))}},f=({type:h,point:u,data:d})=>{if(r.value&&a.value.includes(h)&&s.value){const{position:v}=i(u);t("drop",h,v,d)}};return l.onMounted(()=>{z.on("move",c),z.on("end",f)}),l.onBeforeUnmount(()=>{z.off("move",c),z.off("end",f)}),(h,u)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"dropAreaRef",ref:r,class:"hv-droppable"},[l.renderSlot(h.$slots,"default")],512))}}),jt=Q(Ut),qt=Q(Wt);function Gt(e,n,t){const o=l.computed(()=>l.isRef(t)?l.toValue(t):t),r=l.computed(()=>o.value.containerRealSize),s=l.computed(()=>{const x=typeof o.value.keepRatio=="boolean"?{enable:o.value.keepRatio,scaleCase:"min"}:o.value.keepRatio;return Object.assign({scaleCase:"min",enable:!1},x||{})}),a=l.computed(()=>{const x=Object.assign({inContainer:!0,minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},o.value.limit||{});return x.minWidth>x.maxWidth&&(x.maxWidth=x.minWidth),x.minHeight>x.maxHeight&&(x.maxHeight=x.minHeight),x}),i=l.computed(()=>o.value.disabled||!1),c=l.computed(()=>l.isRef(e)?l.toValue(e):e),f=l.computed(()=>o.value.container),h=l.computed(()=>l.isRef(n)?l.toValue(n):n);let u={x:0,y:0},d={x:0,y:0},v={x:0,y:0};const b={width:0,height:0},m={elX:0,elY:0,elWidth:0,elHeight:0},k={leftSide:!1,rightSide:!1,topSide:!1,bottomSide:!1,center:!1};let g=!1,w=!1,y=1,C=1;l.watch(()=>c.value&&f.value&&h.value,x=>{x?Qt():Oe()});function D(x){if(i.value||(u=x,v=x,!f.value||!c.value))return;const{x:V,y:O,width:N,height:I}=f.value.getBoundingClientRect();if(Object.assign(b,{width:N,height:I}),r.value){const{width:J,height:Me}=r.value;y=J/N,C=Me/I}else y=1,C=1;const{x:E,y:S,width:R,height:H}=c.value.getBoundingClientRect(),{x:M,y:_}=x;Object.assign(m,{elX:E-V,elY:S-O,elWidth:R,elHeight:H});const Ce=document.elementFromPoint(M,_);if(!Ce)return;const oe=(Ce.dataset.scaleSide||"").split(",").filter(J=>!!J);if(!oe.length)return;let ge=oe.includes("left"),ve=oe.includes("top"),G=oe.includes("right"),K=oe.includes("bottom");const ee=oe.includes("center");g=!0,s.value.enable&&!ee&&(M-E<=R/2&&_-S<=H/2&&(ge=!0,ve=!0),M-E>R/2&&_-S<=H/2&&(G=!0,ve=!0),M-E<=R/2&&_-S>H/2&&(ge=!0,K=!0),M-E>R/2&&_-S>H/2&&(G=!0,K=!0)),Object.assign(k,{leftSide:ge,rightSide:G,topSide:ve,bottomSide:K,center:ee})}function A(x){if(i.value||g!==!0){g=!1;return}w=!0,d=v,v=x;const V=x.x-u.x,O=x.y-u.y;let N=0,I=0,E=0,S=0;const{elX:R,elY:H,elWidth:M,elHeight:_}=m,{minWidth:Ce,minHeight:oe,maxWidth:ge,maxHeight:ve}=a.value,G=Ce/y,K=oe/C,ee=ge/y,J=ve/C;if(k.center){const _e=b.width,Ee=b.height;if(a.value.inContainer){const Pe=R+V<0?-R:R+M+V>_e?_e-M-R:V,Re=H+O<0?-H:H+_+O>Ee?Ee-_-H:O;N=Pe,I=Re}else N=V,I=O}else{const{leftSide:_e,rightSide:Ee,topSide:Pe,bottomSide:Re}=k;if(_e){let F=a.value.inContainer&&R+V<0?-R:V;M-F<G&&(F=M-G),M-F>ee&&(F=M-ee),N=F,E=-F}if(Ee){const F=b.width;let B=a.value.inContainer&&R+M+V>F?F-M-R:V;M+B<G&&(B=G-M),M+B>ee&&(B=ee-M),E=B}if(Pe){let F=a.value.inContainer&&H+O<0?-H:O;_-F<K&&(F=_-K),_-F>J&&(F=_-J),I=F,S=-F}if(Re){const F=b.height;let B=a.value.inContainer&&H+_+O>F?F-_-H:O;_+B<K&&(B=K-_),_+B>J&&(B=J-_),S=B}if(s.value.enable){const F=E/M,B=S/_;if(F<B&&s.value.scaleCase==="min"||F>B&&s.value.scaleCase==="max"){if(S=F*_,_+S<K){const U=E;S=K-_,E=S/_*M,N=N*(E/U)}if(_+S>J){const U=E;S=J-_,E=S/_*M,N=N*(E/U)}k.topSide&&(I=-S)}else if(B<F&&s.value.scaleCase==="min"||B>F&&s.value.scaleCase==="max"){if(E=B*M,M+E<G){const U=S;E=G-M,S=E/M*_,I=I*(S/U)}if(M+E>ee){const U=S;E=ee-M,S=E/M*_,I=I*(S/U)}k.leftSide&&(N=-E)}const le=R+N,ce=H+I,He=M+E,Be=_+S;if(a.value.inContainer&&(le<0||ce<0||le+He>b.width||ce+Be>b.height)){let U=le<0?0:le,be=ce<0?0:ce,ue=le+He>b.width?b.width-U:le+He-U,de=ce+Be>b.height?b.height-be:ce+Be-be;const Zt=U+ue,en=be+de,et=ue/de,Se=M/_;et<Se?de=ue/Se:et>Se&&(ue=de*Se);const{topSide:tn,leftSide:nn}=k;nn&&(U=Zt-ue),tn&&(be=en-de),N=U-R,I=be-H,E=ue-M,S=de-_}}}const Me=R+N,Je=H+I,Qe=M+E,Ze=_+S;o.value.onChange&&o.value.onChange({type:k.center?"move":"scale",deltaX:v.x-d.x,deltaY:v.y-d.y,elX:Me,elY:Je,elWidth:Qe,elHeight:Ze,realX:Me*y,realY:Je*C,realWidth:Qe*y,realHeight:Ze*C})}function q(){if(d={x:0,y:0},v={x:0,y:0},i.value||g!==!0||!w){g=!1,w=!1;return}g=!1,w=!1,o.value.onFinish&&o.value.onFinish()}function ae(x){if(x.preventDefault(),x.touches.length>1)return;const{clientX:V,clientY:O}=x.touches[0];D({x:V,y:O}),document.body.addEventListener("touchcancel",Z,{capture:!0}),document.body.addEventListener("touchmove",ie,{capture:!0}),document.body.addEventListener("touchend",Z,{capture:!0})}function ie(x){if(i.value||g!==!0){g=!1;return}if(x.preventDefault(),x.stopPropagation(),x.touches.length>1){q();return}const{clientX:V,clientY:O}=x.touches[0];V===u.x&&O===u.y||A({x:V,y:O})}function Z(){if(document.body.removeEventListener("touchmove",ie),document.body.removeEventListener("touchend",Z),document.body.removeEventListener("touchcancel",Z),i.value||g!==!0){g=!1,w=!1;return}q()}function ke(x){if(x.preventDefault(),!(x.buttons&1))return;const{clientX:V,clientY:O}=x;D({x:V,y:O}),document.body.addEventListener("mousemove",pe,{capture:!0}),document.body.addEventListener("mouseup",ne,{capture:!0})}function pe(x){if(i.value||g!==!0){g=!1;return}if(x.preventDefault(),!(x.buttons&1)){q();return}const{clientX:V,clientY:O}=x;A({x:V,y:O})}function ne(){if(document.body.removeEventListener("mousemove",pe),document.body.removeEventListener("mouseup",ne),i.value||g!==!0){g=!1;return}q()}function Qt(){Oe(),h.value.addEventListener("touchstart",ae,{capture:!0}),h.value.addEventListener("mousedown",ke)}function Oe(){h.value.removeEventListener("touchstart",ae),document.body.removeEventListener("touchmove",ie),document.body.removeEventListener("touchend",Z),document.body.removeEventListener("touchcancel",Z),h.value.removeEventListener("mousedown",ke),document.body.removeEventListener("mousemove",pe),document.body.removeEventListener("mouseup",ne)}l.onBeforeUnmount(()=>{g=!1,Oe()})}const Kt={class:"hv-drag-and-scale__zoom-mark"},Jt=Q(l.defineComponent({name:"HvDragAndScale",__name:"DragAndScale",props:{container:{},containerRealSize:{},keepRatio:{type:[Boolean,Object]},limit:{},disabled:{type:Boolean}},emits:["change","finish"],setup(e,{emit:n}){const t=n,o=e,r=l.ref(),s=l.ref();function a(f){t("change",f)}function i(){t("finish")}const c=l.computed(()=>({container:o.container,containerRealSize:o.containerRealSize,keepRatio:o.keepRatio,limit:o.limit,disabled:o.disabled,onChange:a,onFinish:i}));return Gt(r,s,c),(f,h)=>(l.openBlock(),l.createElementBlock("div",{class:"hv-drag-and-scale",ref_key:"targetRef",ref:r},[l.renderSlot(f.$slots,"default"),l.createElementVNode("div",Kt,[l.createElementVNode("div",{class:l.normalizeClass(["hv-drag-and-scale__area-box",o.disabled?"disabled":""]),ref_key:"operateRef",ref:s},h[0]||(h[0]=[l.createStaticVNode('<div class="hv-drag-and-scale__area-top hv-drag-and-scale__area-block"><div class="hv-drag-and-scale__area-left" data-scale-side="left,top"></div><div class="hv-drag-and-scale__area-center" data-scale-side="top"></div><div class="hv-drag-and-scale__area-right" data-scale-side="right,top"></div></div><div class="hv-drag-and-scale__area-middle hv-drag-and-scale__area-block"><div class="hv-drag-and-scale__area-left" data-scale-side="left"></div><div class="hv-drag-and-scale__area-center" data-scale-side="center"></div><div class="hv-drag-and-scale__area-right" data-scale-side="right"></div></div><div class="hv-drag-and-scale__area-bottom hv-drag-and-scale__area-block"><div class="hv-drag-and-scale__area-left" data-scale-side="left,bottom"></div><div class="hv-drag-and-scale__area-center" data-scale-side="bottom"></div><div class="hv-drag-and-scale__area-right" data-scale-side="right,bottom"></div></div>',3)]),2)])],512))}}));$.HvColorPicker=It,$.HvDragAndScale=Jt,$.HvDraggable=jt,$.HvDroppable=qt,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=components.full.min.js.map