@ew-color-picker/utils 2.0.4 → 2.0.6

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.
@@ -1,4 +1,5 @@
1
1
  export declare const _toString: () => string;
2
2
  export declare const _arrSlice: (start?: number | undefined, end?: number | undefined) => any[];
3
3
  export declare const _hasOwn: (v: PropertyKey) => boolean;
4
- export declare const eventType: string[];
4
+ export declare const DEFAULT_PANEL_WIDTH = 285;
5
+ export declare const DEFAULT_PANEL_HEIGHT = 180;
@@ -0,0 +1,3 @@
1
+ export declare const getRatio: (current: number, start: number, size: number, invert?: boolean) => number;
2
+ export declare const bindMouseDrag: (move: (event: MouseEvent) => void, end?: () => void) => (() => void);
3
+ export declare const bindTouchDrag: (move: (event: TouchEvent) => void, end?: () => void) => (() => void);
@@ -1,6 +1,8 @@
1
1
  export * from "./assert";
2
2
  export * from "./type";
3
3
  export * from "./dom";
4
+ export * from "./drag";
5
+ export { DEFAULT_PANEL_WIDTH, DEFAULT_PANEL_HEIGHT } from "./const";
4
6
  export * from "./env";
5
7
  export * from "./base";
6
8
  export * from "./enum";
@@ -1,2 +1,3 @@
1
+ import type ewColorPicker from "@ew-color-picker/core";
1
2
  export declare const DEFAULT_PREFIX = "ew-";
2
- export declare const getPrefix: (instance?: any) => string;
3
+ export declare const getPrefix: (instance?: ewColorPicker) => string;
package/dist/utils.esm.js CHANGED
@@ -121,29 +121,12 @@ var assert = function (condition, message) {
121
121
  }
122
122
  };
123
123
 
124
- var isBrowser = typeof window !== 'undefined';
125
- var ua = isBrowser && navigator.userAgent.toLowerCase();
126
- var isMobile = ua && ua.match(/(iPhone|iPod|Android|ios)/i);
127
- var supportsPassive = false;
128
- if (isBrowser) {
129
- var EventName = 'test-passive';
130
- try {
131
- var opts = {};
132
- Object.defineProperty(opts, 'passive', {
133
- get: function () {
134
- supportsPassive = true;
135
- },
136
- }); // https://github.com/facebook/flow/issues/285
137
- window.addEventListener(EventName, function () { }, opts);
138
- }
139
- catch (error) {
140
- // 忽略错误,supportsPassive 保持为 false
141
- }
142
- }
143
-
144
124
  var _toString = Object.prototype.toString;
145
125
  var _arrSlice = Array.prototype.slice;
146
126
  var _hasOwn = Object.prototype.hasOwnProperty;
127
+ // 面板默认尺寸,用于取不到实际渲染尺寸时兜底
128
+ var DEFAULT_PANEL_WIDTH = 285;
129
+ var DEFAULT_PANEL_HEIGHT = 180;
147
130
 
148
131
  // 基础类型守卫函数
149
132
  var isNull = function (v) { return v === null; };
@@ -191,6 +174,26 @@ var basicDataTypeList = ["Number", "String", "Function", "Undefined", "Boolean"]
191
174
  var objDataTypeList = ["Object", "Array", "RegExp"];
192
175
  var isNotEmptyObject = function (obj) { return isObject(obj) && Object.keys(obj).length > 0; };
193
176
 
177
+ var isBrowser = typeof window !== 'undefined';
178
+ var ua = isBrowser && navigator.userAgent.toLowerCase();
179
+ var isMobile = ua && ua.match(/(iPhone|iPod|Android|ios)/i);
180
+ var supportsPassive = false;
181
+ if (isBrowser) {
182
+ var EventName = 'test-passive';
183
+ try {
184
+ var opts = {};
185
+ Object.defineProperty(opts, 'passive', {
186
+ get: function () {
187
+ supportsPassive = true;
188
+ },
189
+ }); // https://github.com/facebook/flow/issues/285
190
+ window.addEventListener(EventName, function () { }, opts);
191
+ }
192
+ catch (error) {
193
+ // 忽略错误,supportsPassive 保持为 false
194
+ }
195
+ }
196
+
194
197
  /**
195
198
  * 对象合并
196
199
  * @param t
@@ -550,6 +553,38 @@ var off = function (el, type, fn, capture) {
550
553
  });
551
554
  };
552
555
 
556
+ // 计算指针相对起点的进度(0~1),invert 为 true 时反向
557
+ var getRatio = function (current, start, size, invert) {
558
+ if (invert === void 0) { invert = false; }
559
+ var ratio = size > 0 ? (current - start) / size : 0;
560
+ var clamped = Math.max(0, Math.min(1, ratio));
561
+ return invert ? 1 - clamped : clamped;
562
+ };
563
+ // 在 document 上绑定 mousemove/mouseup,返回解绑函数
564
+ var bindMouseDrag = function (move, end) {
565
+ var handleMove = function (event) { return move(event); };
566
+ var handleUp = function () {
567
+ off(document, "mousemove", handleMove);
568
+ off(document, "mouseup", handleUp);
569
+ end === null || end === void 0 ? void 0 : end();
570
+ };
571
+ on(document, "mousemove", handleMove);
572
+ on(document, "mouseup", handleUp);
573
+ return handleUp;
574
+ };
575
+ // 在 document 上绑定 touchmove/touchend,返回解绑函数
576
+ var bindTouchDrag = function (move, end) {
577
+ var handleMove = function (event) { return move(event); };
578
+ var handleEnd = function () {
579
+ off(document, "touchmove", handleMove);
580
+ off(document, "touchend", handleEnd);
581
+ end === null || end === void 0 ? void 0 : end();
582
+ };
583
+ on(document, "touchmove", handleMove, { });
584
+ on(document, "touchend", handleEnd);
585
+ return handleEnd;
586
+ };
587
+
553
588
  var ApplyOrder;
554
589
  (function (ApplyOrder) {
555
590
  ApplyOrder["Pre"] = "pre";
@@ -906,7 +941,8 @@ function colorRgbaToHsla(rgba) {
906
941
  a +
907
942
  ")"),
908
943
  colorObj: {
909
- h: Math.round(h),
944
+ // h 此时是 0-6 的扇区值,需与 colorStr、colorHslaToRgba 保持一致,统一为 0-360 角度
945
+ h: Math.round(h * 60),
910
946
  s: Math.round(s * 100),
911
947
  l: Math.round(l * 100),
912
948
  a: a,
@@ -943,7 +979,9 @@ function colorRgbaToHsva(rgba) {
943
979
  var r = parseFloat(rgbaArr[0]) || 0;
944
980
  var g = parseFloat(rgbaArr[1]) || 0;
945
981
  var b = parseFloat(rgbaArr[2]) || 0;
946
- var a = rgbaArr.length >= 4 ? parseFloat(rgbaArr[3]) || 1 : 1;
982
+ var parsedAlpha = rgbaArr.length >= 4 ? parseFloat(rgbaArr[3]) : Number.NaN;
983
+ // 仅当透明度无法解析时才回退为 1,避免合法的 0 被当作假值吞掉
984
+ var a = Number.isNaN(parsedAlpha) ? 1 : parsedAlpha;
947
985
  // 将 RGB 值标准化到 0-1 范围
948
986
  var rNorm = r / 255;
949
987
  var gNorm = g / 255;
@@ -1578,7 +1616,7 @@ var DEFAULT_PREFIX = "ew-";
1578
1616
  var getPrefix = function (instance) {
1579
1617
  var _a;
1580
1618
  var prefix = (_a = instance === null || instance === void 0 ? void 0 : instance.options) === null || _a === void 0 ? void 0 : _a.prefix;
1581
- return typeof prefix === "string" ? prefix : DEFAULT_PREFIX;
1619
+ return isString(prefix) ? prefix : DEFAULT_PREFIX;
1582
1620
  };
1583
1621
 
1584
1622
  var closeIcon = function (className, size, prefix) {
@@ -1618,7 +1656,7 @@ var copyIcon = function (className, size, prefix) {
1618
1656
  };
1619
1657
 
1620
1658
  var tips = [
1621
- "%c ew-color-picker@2.0.4%c \u8054\u7CFBQQ\uFF1A854806732 %c \u8054\u7CFB\u5FAE\u4FE1\uFF1Aeveningwater %c github:https://github.com/eveningwater/ew-color-picker %c ",
1659
+ "%c ew-color-picker@2.0.6%c \u8054\u7CFBQQ\uFF1A854806732 %c \u8054\u7CFB\u5FAE\u4FE1\uFF1Aeveningwater %c github:https://github.com/eveningwater/ew-color-picker %c ",
1622
1660
  "background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
1623
1661
  "background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff",
1624
1662
  "background:#ff7878 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
@@ -1675,4 +1713,4 @@ function toStyleStr(style) {
1675
1713
  .join(';');
1676
1714
  }
1677
1715
 
1678
- export { $, $$, Animation, ApplyOrder, ewColorPickerConsolePlugin as Console, DEFAULT_PREFIX, EventEmitter, EventRegister, JSONClone, addClass, ani, arrowIcon, assert, baseSetStyle, basicDataTypeList, calculatePanelPosition, camelCase, checkContainer, checkIcon, clearColorCache, clone, cloneColor, close, closeIcon, colorHexToRgba, colorHslaToRgba, colorHsvaToRgba, colorRegExp, colorRegHSL, colorRegHSLA, colorRegRGB, colorRegRGBA, colorRgbaToHex, colorRgbaToHsla, colorRgbaToHsva, colorRgbaToHsvaWithCache, colorToRgba, copyIcon, create, createByTemplate, debounce, downArrowIcon, error, extend, eyedropperIcon, getAnimationType, getAttr, getColorBrightness, getContrastColor, getElementSize, getOffset, getPrefix, getRect, getStyle, handleClassName, hasClass, insertNode, isAlphaColor, isArray, isBoolean, isBrowser, isDarkColor, isDeepArray, isDeepObject, isDom, isFunction, isHTMLElement, isMobile, isNotEmptyObject, isNull, isNumber, isObject, isPromise, isRegExp, isShallowObject, isStrictColorFormat, isString, isUndefined, isValidColor, log, objDataTypeList, off, on, open, parseRgbaString, removeAllSpace, removeClass, removeElement, removeNode, removeStyle, rgbToHsl, rgbaToHex, setAttr, setStyle, supportsPassive, throttle, throwError, tips, toArray, toStyleStr, tryErrorHandler, ua, upArrowIcon, warn };
1716
+ export { $, $$, Animation, ApplyOrder, ewColorPickerConsolePlugin as Console, DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH, DEFAULT_PREFIX, EventEmitter, EventRegister, JSONClone, addClass, ani, arrowIcon, assert, baseSetStyle, basicDataTypeList, bindMouseDrag, bindTouchDrag, calculatePanelPosition, camelCase, checkContainer, checkIcon, clearColorCache, clone, cloneColor, close, closeIcon, colorHexToRgba, colorHslaToRgba, colorHsvaToRgba, colorRegExp, colorRegHSL, colorRegHSLA, colorRegRGB, colorRegRGBA, colorRgbaToHex, colorRgbaToHsla, colorRgbaToHsva, colorRgbaToHsvaWithCache, colorToRgba, copyIcon, create, createByTemplate, debounce, downArrowIcon, error, extend, eyedropperIcon, getAnimationType, getAttr, getColorBrightness, getContrastColor, getElementSize, getOffset, getPrefix, getRatio, getRect, getStyle, handleClassName, hasClass, insertNode, isAlphaColor, isArray, isBoolean, isBrowser, isDarkColor, isDeepArray, isDeepObject, isDom, isFunction, isHTMLElement, isMobile, isNotEmptyObject, isNull, isNumber, isObject, isPromise, isRegExp, isShallowObject, isStrictColorFormat, isString, isUndefined, isValidColor, log, objDataTypeList, off, on, open, parseRgbaString, removeAllSpace, removeClass, removeElement, removeNode, removeStyle, rgbToHsl, rgbaToHex, setAttr, setStyle, supportsPassive, throttle, throwError, tips, toArray, toStyleStr, tryErrorHandler, ua, upArrowIcon, warn };
package/dist/utils.min.js CHANGED
@@ -1 +1 @@
1
- ((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Utils={})})(this,function(o){var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function c(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function t(){}var e={log:t,warn:t,error:t},r=(["warn","error","log"].forEach(function(t){e[t]=function(){}}),e.warn),i=e.error,a=e.log,s="undefined"!=typeof window,l=s&&navigator.userAgent.toLowerCase(),R=l&&l.match(/(iPhone|iPod|Android|ios)/i);if(o.supportsPassive=!1,s)try{var u={};Object.defineProperty(u,"passive",{get:function(){o.supportsPassive=!0}}),window.addEventListener("test-passive",function(){},u)}catch(i){}function f(t){return void 0===t}function p(t){return"string"==typeof t}function B(t){return"number"==typeof t}function h(t){return"object"==typeof t&&!b(t)}function N(t){return"object"===y.call(t).slice(8,-1).toLowerCase()}function D(t){return"array"===y.call(t).slice(8,-1).toLowerCase()}function F(t,e){try{t()}catch(t){x(e)?e(t):i("[ewColorPicker error]: ".concat(t))}}function z(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(b(t))return{};if(Object.assign)return Object.assign.apply(Object,c([t],e,!1));for(var r=Object(t),o=0,i=e.length;o<i;o++){var a=e[o];if(a)for(var s in a)J.call(a,s)&&(r[s]=a[s])}return r}function U(t){if(!h(t))return t;var e,n=D(t)?[]:{};for(e in t)t.hasOwnProperty(e)&&(n[e]=h(t[e])?U(t[e]):t[e]);return n}function d(t){return t.replace(/\s+/g,"")}function g(t){return t?" ".concat(t):""}function v(t,e){return new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className)}function m(t){return t instanceof HTMLElement}function w(t,e,n){e=e.startsWith("--")?e:e.replace(/([A-Z])/g,"-$1").toLowerCase(),t.style.setProperty(e,n)}function W(t){return t.replace(/([\:\_\-]+(.))/g,function(t,e,n,r){return r?n.toUpperCase():n}).replace(/^moz([A-Z])/,"Moz$1")}function q(t,e){return(e=void 0===e?document:e).querySelector(t)}function V(t){var e;null!=t&&t.parentElement?null!=(e=null==t?void 0:t.parentElement)&&e.removeChild(t):null!=t&&t.remove()}var y=Object.prototype.toString,G=Array.prototype.slice,J=Object.prototype.hasOwnProperty,b=function(t){return null===t},x=function(t){return"function"==typeof t},Z=function(t){return document.createElement(t)},M=function(n,t,e){if(p(t=void 0===t?{}:t)&&!f(e)){e=B(e)?"".concat(e,"px"):e;w(n,t,e)}else if(Array.isArray(t))t.forEach(function(t){var e=t.prop;w(n,e,t.value)});else for(var r=0,o=Object.entries(t);r<o.length;r++){var i=o[r],a=i[0];w(n,a,i[1])}},C=function(e,n,r){if(!e||!n)return null;"float"===(n=W(n))&&(n="cssFloat");var o=null;return F(function(){var t=(document.defaultView||window).getComputedStyle(e,r);o=e.style[n]||t?t[n]:null}),o||e.style[n]},u=V;function k(t){return t.getBoundingClientRect()}function Q(t,e,n,r){r=o.supportsPassive?{passive:!1,capture:!!r}:!!r,t.addEventListener(e,n,r)}function X(t,e,n,r){t.removeEventListener(e,n,{capture:!!r})}o.ApplyOrder=void 0,(A=o.ApplyOrder||(o.ApplyOrder={})).Pre="pre",A.Post="post",O.prototype.on=function(t,e,n){return void 0===n&&(n=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,n]),this},O.prototype.once=function(r,o,i){var a=this,s=(void 0===i&&(i=this),this.hasType(r),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a.off(r,s);var n=o.apply(i,t);if(!0===n)return n});return s.fn=o,this.on(r,s),this},O.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),e){var n=this.events[t];if(n)for(var r=n.length;r--;)(n[r][0]===e||n[r][0]&&n[r][0].fn===e)&&n.splice(r,1)}else this.events[t]=[];return this}},O.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.hasType(t);t=this.events[t];if(t)for(var r=t.length,o=c([],t,!0),i=0;i<r;i++){var a=o[i],s=a[0],a=a[1];if(s&&!0===(s=s.apply(a,e)))return s}},O.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},O.prototype.destroy=function(){this.events={},this.eventTypes={}},O.prototype.hasType=function(t){var e=this.eventTypes;e[t]!==t&&r('[ewColorPicker warning]: EventEmitter has used unknown event type: "'.concat(t,'", should be oneof [')+"".concat(Object.keys(e).map(function(t){return JSON.stringify(t)}))+"]")};var A=O;function O(t){this.events={},this.eventTypes={},this.registerType(t)}T.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},T.prototype.addDOMEvents=function(){this.handleDOMEvents(Q)},T.prototype.removeDOMEvents=function(){this.handleDOMEvents(X)},T.prototype.handleDOMEvents=function(e){var n=this,r=this.wrapper;this.events.forEach(function(t){e(r,t.name,n,!!t.capture)})},T.prototype.handleEvent=function(e){var n=e.type;this.events.some(function(t){return t.name===n&&(t.handler(e),!0)})};var _=T;function T(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var E=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,K=/[rR][gG][Bb][Aa]?[\(]([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),){2}[\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),?[\s]*(0\.\d{1,2}|1|0)?[\)]{1}/g,Y=/^[rR][gG][Bb][Aa][\(]([\\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\\s]*,){3}[\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*[\)]{1}$/,tt=/^[hH][Ss][Ll][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*)[\)]$/,et=/^[hH][Ss][Ll][Aa][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,){2}([\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*)[\)]$/;function nt(t,e){var e=(e=void 0===e?1:e)||1,e=Math.round(10*e)/10,n=t.toLowerCase(),r=t.length,o=[];if(t&&E.test(n)){if(4===r){for(var i="#",a=1;a<r;a++){var s=n.slice(a,a+1);i+=s.concat(s)}n=i}for(var c=1,l=n.length;c<l;c+=2)o.push(parseInt("0X"+n.slice(c,c+2),16));return"rgba(".concat(o.join(", "),", ").concat(e,")")}return d(n)}function rt(t){if(!t||"string"!=typeof t)return{h:0,s:100,v:100,a:1};if(!/^rgba?\(/i.test(t.replace(/\s+/g," ").trim())){var e=P(t);if(!e)return{h:0,s:100,v:100,a:1};t=e}var n,r,o,i,a,s,c,e=t.replace(/\s+/g," ").trim().match(/rgba?\(([^)]+)\)/i);return e?(t=e[1].split(",").map(function(t){return t.trim()}),e=parseFloat(t[0])||0,n=parseFloat(t[1])||0,r=parseFloat(t[2])||0,t=4<=t.length&&parseFloat(t[3])||1,e=e/255,n=n/255,r=r/255,o=(c=Math.max(e,n,r))-Math.min(e,n,r),(a=i=0)!==(s=c)&&(a=o/c),0!=o?(c===e?i=(n-r)/o*60:c===n?i=60*((r-e)/o+2):c===r&&(i=60*((e-n)/o+4)),i<0&&(i+=360)):i=0,c=Math.round(10*t)/10,{h:Math.round(i),s:Math.round(100*a),v:Math.round(100*s),a:c}):{h:0,s:100,v:100,a:1}}var ot={black:"rgba(0, 0, 0, 1)",silver:"rgba(192, 192, 192, 1)",gray:"rgba(128, 128, 128, 1)",white:"rgba(255, 255, 255, 1)",maroon:"rgba(128, 0, 0, 1)",red:"rgba(255, 0, 0, 1)",purple:"rgba(128, 0, 128, 1)",fuchsia:"rgba(255, 0, 255, 1)",green:"rgba(0, 128, 0, 1)",lime:"rgba(0, 255, 0, 1)",olive:"rgba(128, 128, 0, 1)",yellow:"rgba(255, 255, 0, 1)",navy:"rgba(0, 0, 128, 1)",blue:"rgba(0, 0, 255, 1)",teal:"rgba(0, 128, 128, 1)",aqua:"rgba(0, 255, 255, 1)",orange:"rgba(255, 165, 0, 1)",pink:"rgba(255, 192, 203, 1)",brown:"rgba(165, 42, 42, 1)"};function P(t){if(t&&"string"==typeof t){var e=t.trim().toLowerCase();if(ot[e])return ot[e];if(E.test(e))return nt(e).replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)");var n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n)return r=n[1],o=n[2],i=n[3],"rgba(".concat(r,", ").concat(o,", ").concat(i,", 1)");var r,o,i,n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(n)return r=n[1],o=n[2],i=n[3],e=n[4],"rgba(".concat(r,", ").concat(o,", ").concat(i,", ").concat(e,")");try{var a=Z("div"),s=(M(a,{"background-color":t}),C(a,"backgroundColor"));if(s&&"rgba(0, 0, 0, 0)"!==s)return s.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)")}catch(t){}}return""}function it(t){t=P(t),t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return(299*parseInt(t[0])+587*parseInt(t[1])+114*parseInt(t[2]))/1e3}var H=new Map;function at(t){try{var e=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return e.length<3?null:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:e.length<4?1:parseFloat(e[3])}}catch(t){return null}}S.prototype.show=function(){var e=this;return new Promise(function(t){M(e.element,{display:"block"}),t()})},S.prototype.hide=function(){var e=this;return new Promise(function(t){M(e.element,{display:"none"}),t()})},S.prototype.slideDown=function(){var o=this;return new Promise(function(t){M(o.element,{display:"block",visibility:"hidden"});var e=C(o.element,"marginTop"),n=C(o.element,"marginBottom"),r=o.element.offsetHeight+parseInt(e)+parseInt(n);M(o.element,{height:"0px",overflow:"hidden",visibility:"visible"}),o.element.offsetHeight,setTimeout(function(){M(o.element,{transition:"height ".concat(o.options.duration,"ms ").concat(o.options.easing),height:"".concat(r,"px")}),setTimeout(function(){M(o.element,{height:"",overflow:"",transition:""}),t()},o.options.duration)},o.options.delay)})},S.prototype.slideUp=function(){var r=this;return new Promise(function(t){var e=C(r.element,"marginTop"),n=C(r.element,"marginBottom"),e=r.element.offsetHeight+parseInt(e)+parseInt(n);M(r.element,{height:"".concat(e,"px"),overflow:"hidden"}),r.element.offsetHeight,setTimeout(function(){M(r.element,{height:"0px",transition:"height ".concat(r.options.duration,"ms ").concat(r.options.easing)}),setTimeout(function(){M(r.element,{height:"",overflow:"",transition:"",display:"none"}),t()},r.options.duration)},r.options.delay)})},S.prototype.fadeIn=function(){var t=this;return new Promise(function(n){function r(t){var t=Math.min((t-a)/i,1),e=1-Math.pow(1-t,3);M(o,{opacity:e.toString()}),t<1?requestAnimationFrame(r):(M(o,{opacity:"1"}),n())}var o=t.element,i=t.options.duration,a=(M(o,{display:"block",opacity:"0"}),o.offsetHeight,performance.now());requestAnimationFrame(r)})},S.prototype.fadeOut=function(){var t=this;return new Promise(function(n){function r(t){var t=Math.min((t-a)/i,1),e=Math.pow(t,3);M(o,{opacity:(1-e).toString()}),t<1?requestAnimationFrame(r):(M(o,{display:"none",opacity:"0"}),n())}var o=t.element,i=t.options.duration,a=(M(o,{display:"block",opacity:"1"}),o.offsetHeight,performance.now());requestAnimationFrame(r)})};var L=S;function S(t,e){void 0===e&&(e={}),this.element=t,this.options=n({duration:300,easing:"ease-out",delay:0},e)}var I={show:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).show()},hide:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).hide()},slideDown:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).slideDown()},slideUp:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).slideUp()},fadeIn:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).fadeIn()},fadeOut:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).fadeOut()}};var $="ew-",st=["%c ew-color-picker@2.0.4%c 联系QQ:854806732 %c 联系微信:eveningwater %c github:https://github.com/eveningwater/ew-color-picker %c ","background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent"],ct=!1,lt=(j.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=z(this.options,this.ewColorPicker.options))},j.prototype.run=function(){ct||(ct=!0,a.apply(void 0,st))},j.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),t.on&&x(t.on)&&t.on("change",function(t){}),null!=(t=this.run)&&t.call(this)},j.pluginName="ewColorPickerConsole",j);function j(t){this.ewColorPicker=t,this.options={},this.handleOptions(),this.run()}o.$=q,o.$$=function(t,e){return(e=void 0===e?document:e).querySelectorAll(t)},o.Animation=L,o.Console=lt,o.DEFAULT_PREFIX=$,o.EventEmitter=A,o.EventRegister=_,o.JSONClone=function(t){return JSON.parse(JSON.stringify(t))},o.addClass=function(t,e){for(var n=0,r=e.trim().split(/\s+/);n<r.length;n++){var o,i=r[n];i&&!v(t,i)&&((o=t.className.split(" ").filter(Boolean)).push(i),t.className=o.join(" "))}},o.ani=I,o.arrowIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498630" class="'.concat(n,"color-picker-icon").concat(g(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4234"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="currentColor" p-id="4235"></path></svg>')},o.assert=function(t,e){if(!t)throw new Error(e||"Assertion failed")},o.baseSetStyle=w,o.basicDataTypeList=["Number","String","Function","Undefined","Boolean"],o.calculatePanelPosition=function(t,e,n,r){void 0===n&&(n="bottom"),void 0===r&&(r=8);var o=k(t),i=k(e),t=window.innerWidth,e=window.innerHeight,a=0,s=0,n=n.split("-"),c=n[0],l=n[1];switch(c){case"top":s=o.top-i.height-r,a="start"===l?o.left:"end"===l?o.right-i.width:o.left+(o.width-i.width)/2;break;case"bottom":s=o.bottom+r,a="start"===l?o.left:"end"===l?o.right-i.width:o.left+(o.width-i.width)/2;break;case"left":a=o.left-i.width-r,s="start"===l?o.top:"end"===l?o.bottom-i.height:o.top+(o.height-i.height)/2;break;case"right":a=o.right+r,s="start"===l?o.top:"end"===l?o.bottom-i.height:o.top+(o.height-i.height)/2}return s<0&&(s=r),{left:a=(a=a<0?r:a)+i.width>t?t-i.width-r:a,top:s=s+i.height>e?e-i.height-r:s}},o.camelCase=W,o.checkContainer=function(t){return p(t)?q(t)||(r("[ewColorPicker warning]: Cannot find element with selector: ".concat(t)),document.body):m(t)?t:document.body},o.checkIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(g(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path></svg>')},o.clearColorCache=function(){},o.clone=U,o.cloneColor=function(t){return n({},t)},o.close=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var r="";switch(t){case"height":r="slideUp";break;case"opacity":r="fadeOut";break;default:r="hide"}return I[r](e,n)},o.closeIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1690189203554" class="'.concat(n,"color-picker-icon").concat(g(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2272" fill="currentColor"').concat(e,'><path d="M504.224 470.288l207.84-207.84a16 16 0 0 1 22.608 0l11.328 11.328a16 16 0 0 1 0 22.624l-207.84 207.824 207.84 207.84a16 16 0 0 1 0 22.608l-11.328 11.328a16 16 0 0 1-22.624 0l-207.824-207.84-207.84 207.84a16 16 0 0 1-22.608 0l-11.328-11.328a16 16 0 0 1 0-22.624l207.84-207.824-207.84-207.84a16 16 0 0 1 0-22.608l11.328-11.328a16 16 0 0 1 22.624 0l207.824 207.84z" p-id="2273"></path></svg>')},o.colorHexToRgba=nt,o.colorHslaToRgba=function(t){var e,n,r,o,i=t.h,a=t.s/100,s=t.l/100,t=t.a;return 0==a?n=r=o=s:(n=(e=function(t,e,n){return 1<n&&(n-=1),n<0&&(n+=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t})(a=2*s-(s=.5<=s?s+a-s*a:s*(1+a)),s,(i=i/360)+1/3),r=e(a,s,i),o=e(a,s,i-1/3)),t=Math.round(10*t)/10,"rgba(".concat(Math.round(255*n),", ").concat(Math.round(255*r),", ").concat(Math.round(255*o),", ").concat(t,")")},o.colorHsvaToRgba=function(t,e){var n,r,o,i,a=t.a,s=t.h,c=255*t.s/100,t=255*t.v/100;return 0==c?n=r=o=t:(t=s%60*((i=t)-(c=(255-c)*t/255))/60,360===s?(n=i,r=o=0):s<60?(n=i,r=c+t,o=c):s<120?(n=i-t,r=i,o=c):s<180?(r=i,o=(n=c)+t):s<240?(n=c,r=i-t,o=i):s<300?(n=c+t,r=c,o=i):s<360?(r=c,o=(n=i)-t):n=r=o=0),void 0!==e&&0<=e&&e<=1&&(a=e),a=Math.round(10*a)/10,"rgba(".concat(Math.round(n),", ").concat(Math.round(r),", ").concat(Math.round(o),", ").concat(a,")")},o.colorRegExp=E,o.colorRegHSL=tt,o.colorRegHSLA=et,o.colorRegRGB=K,o.colorRegRGBA=Y,o.colorRgbaToHex=function(t){var e,n,r={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};return/rgba?/.test(t)?(e=t.replace(/rgba?\(/,"").replace(/\)/,"").replace(/[\s+]/g,"").split(","),n="",e.map(function(t,e){e<=2&&(n+=(e=+t,e=Math.min(Math.round(e),255),t=Math.floor(e/16),""+(r[t]||t)+(r[e%=16]||e)))}),d("#"+n)):t},o.colorRgbaToHsla=function(t){var e,n=(t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",")).length<4?1:Number(t[3]),n=Math.round(10*n)/10,r=parseInt(t[0])/255,o=parseInt(t[1])/255,i=parseInt(t[2])/255,t=Math.max(r,o,i),a=Math.min(r,o,i),s=(t+a)/2;if(t===a)e=l=0;else{var c=t-a,l=.5<s?c/(2-t-a):c/(t+a);switch(t){case r:e=(o-i)/c+(i<=o?0:6);break;case o:e=(i-r)/c+2;break;case i:e=(r-o)/c+4}}return{colorStr:d("hsla("+Math.ceil(60*e)+","+Math.ceil(100*l)+"%,"+Math.ceil(100*s)+"%,"+n+")"),colorObj:{h:Math.round(e),s:Math.round(100*l),l:Math.round(100*s),a:n}}},o.colorRgbaToHsva=rt,o.colorRgbaToHsvaWithCache=function(t){var e;return H.has(t)?H.get(t):(e=rt(t),H.set(t,e),1e3<H.size&&(t=H.keys().next().value)&&H.delete(t),e)},o.colorToRgba=P,o.copyIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(g(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></svg>')},o.create=Z,o.createByTemplate=function(t){return document.createRange().createContextualFragment(t)},o.debounce=function(r,o,i){void 0===i&&(i=!1);var a=null;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=i&&!a;a&&clearTimeout(a),a=setTimeout(function(){a=null,i||r.apply(void 0,t)},o),n&&r.apply(void 0,t)}},o.downArrowIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498632" class="'.concat(n,"color-picker-icon").concat(g(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4236"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="#666666" p-id="4237"></path></svg>')},o.error=i,o.extend=z,o.eyedropperIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(g(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M17.66 5.41l.92.92-2.69 2.69-.92-.92 2.69-2.69M17.67 3c-.26 0-.51.1-.71.29l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.29-.71.29-.71L17.67 3z"></path></svg>')},o.getAnimationType=function(t){return(null==(t=t.options)?void 0:t.togglePickerAnimation)||"default"},o.getAttr=function(t,e){return t.getAttribute(e)},o.getColorBrightness=it,o.getContrastColor=function(t,e,n){var r;return void 0===e&&(e="#333333"),void 0===n&&(n="#ffffff"),(t=t&&P(t))&&(r=at(t))&&.5<.2126*(t=function(t){t=(t*r.a+255*(1-r.a))/255;return t<=.03928?t/12.92:Math.pow((.055+t)/1.055,2.4)})(r.r)+.7152*t(r.g)+.0722*t(r.b)?e:n},o.getElementSize=function(t){return{clientWidth:t.clientWidth,clientHeight:t.clientHeight,offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}},o.getOffset=function(t){for(var e=0,n=0;t;)e-=t.offsetLeft,n-=t.offsetTop,t=t.offsetParent;return{left:e,top:n}},o.getPrefix=function(t){t=null==(t=null==t?void 0:t.options)?void 0:t.prefix;return"string"==typeof t?t:$},o.getRect=k,o.getStyle=C,o.handleClassName=g,o.hasClass=v,o.insertNode=function(t,e,n,r){r&&null!=t&&t.contains(r)?t.insertBefore(e,r):n&&null!=t&&t.contains(n)?t.replaceChild(e,n):null!=t&&t.appendChild(e)},o.isAlphaColor=function(t){return!!/^rgba\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!/^hsla\s*\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!t.includes("hsva(")||"transparent"===t},o.isArray=D,o.isBoolean=function(t){return"boolean"==typeof t},o.isBrowser=s,o.isDarkColor=function(t){return it(t)<128},o.isDeepArray=function(t){return Array.isArray(t)},o.isDeepObject=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},o.isDom=function(t){return h(HTMLElement)?m(t):t&&h(t)&&1===t.nodeType&&p(t.nodeName)||t instanceof HTMLCollection||t instanceof NodeList},o.isFunction=x,o.isHTMLElement=m,o.isMobile=R,o.isNotEmptyObject=function(t){return N(t)&&0<Object.keys(t).length},o.isNull=b,o.isNumber=B,o.isObject=N,o.isPromise=function(t){return!f(t)&&!b(t)&&x((t=t).then)&&x(t.catch)},o.isRegExp=function(t){return"regexp"===y.call(t).slice(8,-1).toLowerCase()},o.isShallowObject=h,o.isStrictColorFormat=function(t){return!(!t||"string"!=typeof t||!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)&&!(/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(t)||/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||/^hsl\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*\)$/.test(t)||/^hsla\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||"transparent"===t))},o.isString=p,o.isUndefined=f,o.isValidColor=function(t){var e="transparent"===t;if(E.test(t))return!0;if(K.test(t)&&!t.includes("rgba"))return!0;if(Y.test(t))return!0;if(tt.test(t)&&!t.includes("hsla"))return!0;if(et.test(t))return!0;if(e)return!0;if("#invalid"===t||"invalid"===t)return!1;if(t.includes("rgb(")&&t.includes(", 0.5)"))return!1;if(t.includes("rgba(")&&!t.includes(", 0.5)")&&!t.includes(", 1)"))return!1;try{var n=document.createElement("div");return M(n,{"background-color":t}),"rgba(0, 0, 0, 0)"!==C(n,"backgroundColor")||e}catch(t){return!1}},o.log=a,o.objDataTypeList=["Object","Array","RegExp"],o.off=X,o.on=Q,o.open=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var r="";switch(t){case"height":r="slideDown";break;case"opacity":r="fadeIn";break;default:r="show"}return I[r](e,n)},o.parseRgbaString=at,o.removeAllSpace=d,o.removeClass=function(t,e){v(t,e)&&(e=new RegExp("(^|\\s)"+e+"(\\s|$)","g"),t.className=t.className.replace(e," "))},o.removeElement=V,o.removeNode=u,o.removeStyle=function(t,e){for(var n=0,r=e=void 0===e?[]:e;n<r.length;n++){var o=r[n];t.style.removeProperty(o)}},o.rgbToHsl=function(t,e,n){t/=255,e/=255,n/=255;var r=Math.max(t,e,n),o=Math.min(t,e,n),i=0,a=0,s=(r+o)/2;if(r!==o){var c=r-o,a=.5<s?c/(2-r-o):c/(r+o);switch(r){case t:i=(e-n)/c+(e<n?6:0);break;case e:i=(n-t)/c+2;break;case n:i=(t-e)/c+4}i/=6}return{h:360*i,s:100*a,l:100*s}},o.rgbaToHex=function(t){function e(t){return Math.round(t).toString(16).padStart(2,"0")}return"#".concat(e(t.r)).concat(e(t.g)).concat(e(t.b))},o.setAttr=function(t,e){if(h(e))for(var n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],i=o[0];t.setAttribute(i,"".concat(o[1]))}},o.setStyle=M,o.throttle=function(n,r){var o;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o||(n.apply(void 0,t),o=!0,setTimeout(function(){return o=!1},r))}},o.throwError=function(t){throw new Error("[ewColorPicker error]: ".concat(t))},o.tips=st,o.toArray=function(t){return h(t)?Array.from?Array.from(t):G.call(t):t},o.toStyleStr=function(t){return t?p(t)?t:Object.entries(t).map(function(t){var e=t[0],t=t[1];return"".concat(e.replace(/([A-Z])/g,"-$1").toLowerCase(),":").concat(t)}).join(";"):""},o.tryErrorHandler=F,o.ua=l,o.upArrowIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498631" class="'.concat(n,"color-picker-icon").concat(g(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4235"').concat(e,'><path d="M512 309.333333c8.533333 0 17.066667 2.133333 23.466667 8.533334l341.333333 341.333333c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0L533.333333 374.4 215.466667 692.266667c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L488.533333 317.866667c4.266667-8.533333 12.8-10.666667 21.333334-10.666667z" fill="#666666" p-id="4236"></path></svg>')},o.warn=r});
1
+ ((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Utils={})})(this,function(o){var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function N(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function t(){}function s(t){return void 0===t}function c(t){return"string"==typeof t}function R(t){return"number"==typeof t}function a(t){return"object"==typeof t&&!l(t)}function D(t){return"object"===u.call(t).slice(8,-1).toLowerCase()}function B(t){return"array"===u.call(t).slice(8,-1).toLowerCase()}function F(t,e){try{t()}catch(t){f(e)?e(t):i("[ewColorPicker error]: ".concat(t))}}var e={log:t,warn:t,error:t},r=(["warn","error","log"].forEach(function(t){e[t]=function(){}}),e.warn),i=e.error,z=e.log,u=Object.prototype.toString,U=Array.prototype.slice,W=Object.prototype.hasOwnProperty,l=function(t){return null===t},f=function(t){return"function"==typeof t},p="undefined"!=typeof window,h=p&&navigator.userAgent.toLowerCase(),q=h&&h.match(/(iPhone|iPod|Android|ios)/i);if(o.supportsPassive=!1,p)try{var d={};Object.defineProperty(d,"passive",{get:function(){o.supportsPassive=!0}}),window.addEventListener("test-passive",function(){},d)}catch(i){}function V(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(l(t))return{};if(Object.assign)return Object.assign.apply(Object,N([t],e,!1));for(var r=Object(t),o=0,i=e.length;o<i;o++){var a=e[o];if(a)for(var s in a)W.call(a,s)&&(r[s]=a[s])}return r}function _(t){if(!a(t))return t;var e,n=B(t)?[]:{};for(e in t)t.hasOwnProperty(e)&&(n[e]=a(t[e])?_(t[e]):t[e]);return n}function g(t){return t.replace(/\s+/g,"")}function v(t){return t?" ".concat(t):""}function m(t,e){return new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className)}function w(t){return t instanceof HTMLElement}function y(t,e,n){e=e.startsWith("--")?e:e.replace(/([A-Z])/g,"-$1").toLowerCase(),t.style.setProperty(e,n)}function G(t){return t.replace(/([\:\_\-]+(.))/g,function(t,e,n,r){return r?n.toUpperCase():n}).replace(/^moz([A-Z])/,"Moz$1")}function J(t,e){return(e=void 0===e?document:e).querySelector(t)}function Z(t){var e;null!=t&&t.parentElement?null!=(e=null==t?void 0:t.parentElement)&&e.removeChild(t):null!=t&&t.remove()}var Q=function(t){return document.createElement(t)},b=function(n,t,e){if(c(t=void 0===t?{}:t)&&!s(e)){e=R(e)?"".concat(e,"px"):e;y(n,t,e)}else if(Array.isArray(t))t.forEach(function(t){var e=t.prop;y(n,e,t.value)});else for(var r=0,o=Object.entries(t);r<o.length;r++){var i=o[r],a=i[0];y(n,a,i[1])}},M=function(e,n,r){if(!e||!n)return null;"float"===(n=G(n))&&(n="cssFloat");var o=null;return F(function(){var t=(document.defaultView||window).getComputedStyle(e,r);o=e.style[n]||t?t[n]:null}),o||e.style[n]},d=Z;function x(t){return t.getBoundingClientRect()}function A(t,e,n,r){r=o.supportsPassive?{passive:!1,capture:!!r}:!!r,t.addEventListener(e,n,r)}function C(t,e,n,r){t.removeEventListener(e,n,{capture:!!r})}o.ApplyOrder=void 0,(k=o.ApplyOrder||(o.ApplyOrder={})).Pre="pre",k.Post="post",O.prototype.on=function(t,e,n){return void 0===n&&(n=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,n]),this},O.prototype.once=function(r,o,i){var a=this,s=(void 0===i&&(i=this),this.hasType(r),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a.off(r,s);var n=o.apply(i,t);if(!0===n)return n});return s.fn=o,this.on(r,s),this},O.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),e){var n=this.events[t];if(n)for(var r=n.length;r--;)(n[r][0]===e||n[r][0]&&n[r][0].fn===e)&&n.splice(r,1)}else this.events[t]=[];return this}},O.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.hasType(t);t=this.events[t];if(t)for(var r=t.length,o=N([],t,!0),i=0;i<r;i++){var a=o[i],s=a[0],a=a[1];if(s&&!0===(s=s.apply(a,e)))return s}},O.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},O.prototype.destroy=function(){this.events={},this.eventTypes={}},O.prototype.hasType=function(t){var e=this.eventTypes;e[t]!==t&&r('[ewColorPicker warning]: EventEmitter has used unknown event type: "'.concat(t,'", should be oneof [')+"".concat(Object.keys(e).map(function(t){return JSON.stringify(t)}))+"]")};var k=O;function O(t){this.events={},this.eventTypes={},this.registerType(t)}T.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},T.prototype.addDOMEvents=function(){this.handleDOMEvents(A)},T.prototype.removeDOMEvents=function(){this.handleDOMEvents(C)},T.prototype.handleDOMEvents=function(e){var n=this,r=this.wrapper;this.events.forEach(function(t){e(r,t.name,n,!!t.capture)})},T.prototype.handleEvent=function(e){var n=e.type;this.events.some(function(t){return t.name===n&&(t.handler(e),!0)})};var X=T;function T(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var E=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,K=/[rR][gG][Bb][Aa]?[\(]([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),){2}[\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),?[\s]*(0\.\d{1,2}|1|0)?[\)]{1}/g,Y=/^[rR][gG][Bb][Aa][\(]([\\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\\s]*,){3}[\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*[\)]{1}$/,tt=/^[hH][Ss][Ll][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*)[\)]$/,et=/^[hH][Ss][Ll][Aa][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,){2}([\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*)[\)]$/;function nt(t,e){var e=(e=void 0===e?1:e)||1,e=Math.round(10*e)/10,n=t.toLowerCase(),r=t.length,o=[];if(t&&E.test(n)){if(4===r){for(var i="#",a=1;a<r;a++){var s=n.slice(a,a+1);i+=s.concat(s)}n=i}for(var c=1,u=n.length;c<u;c+=2)o.push(parseInt("0X"+n.slice(c,c+2),16));return"rgba(".concat(o.join(", "),", ").concat(e,")")}return g(n)}function rt(t){if(!t||"string"!=typeof t)return{h:0,s:100,v:100,a:1};if(!/^rgba?\(/i.test(t.replace(/\s+/g," ").trim())){var e=P(t);if(!e)return{h:0,s:100,v:100,a:1};t=e}var n,r,o,i,a,s,c,e=t.replace(/\s+/g," ").trim().match(/rgba?\(([^)]+)\)/i);return e?(t=e[1].split(",").map(function(t){return t.trim()}),e=parseFloat(t[0])||0,n=parseFloat(t[1])||0,r=parseFloat(t[2])||0,t=4<=t.length?parseFloat(t[3]):Number.NaN,t=Number.isNaN(t)?1:t,e=e/255,n=n/255,r=r/255,o=(c=Math.max(e,n,r))-Math.min(e,n,r),(a=i=0)!==(s=c)&&(a=o/c),0!=o?(c===e?i=(n-r)/o*60:c===n?i=60*((r-e)/o+2):c===r&&(i=60*((e-n)/o+4)),i<0&&(i+=360)):i=0,c=Math.round(10*t)/10,{h:Math.round(i),s:Math.round(100*a),v:Math.round(100*s),a:c}):{h:0,s:100,v:100,a:1}}var ot={black:"rgba(0, 0, 0, 1)",silver:"rgba(192, 192, 192, 1)",gray:"rgba(128, 128, 128, 1)",white:"rgba(255, 255, 255, 1)",maroon:"rgba(128, 0, 0, 1)",red:"rgba(255, 0, 0, 1)",purple:"rgba(128, 0, 128, 1)",fuchsia:"rgba(255, 0, 255, 1)",green:"rgba(0, 128, 0, 1)",lime:"rgba(0, 255, 0, 1)",olive:"rgba(128, 128, 0, 1)",yellow:"rgba(255, 255, 0, 1)",navy:"rgba(0, 0, 128, 1)",blue:"rgba(0, 0, 255, 1)",teal:"rgba(0, 128, 128, 1)",aqua:"rgba(0, 255, 255, 1)",orange:"rgba(255, 165, 0, 1)",pink:"rgba(255, 192, 203, 1)",brown:"rgba(165, 42, 42, 1)"};function P(t){if(t&&"string"==typeof t){var e=t.trim().toLowerCase();if(ot[e])return ot[e];if(E.test(e))return nt(e).replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)");var n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n)return r=n[1],o=n[2],i=n[3],"rgba(".concat(r,", ").concat(o,", ").concat(i,", 1)");var r,o,i,n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(n)return r=n[1],o=n[2],i=n[3],e=n[4],"rgba(".concat(r,", ").concat(o,", ").concat(i,", ").concat(e,")");try{var a=Q("div"),s=(b(a,{"background-color":t}),M(a,"backgroundColor"));if(s&&"rgba(0, 0, 0, 0)"!==s)return s.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)")}catch(t){}}return""}function it(t){t=P(t),t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return(299*parseInt(t[0])+587*parseInt(t[1])+114*parseInt(t[2]))/1e3}var H=new Map;function at(t){try{var e=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return e.length<3?null:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:e.length<4?1:parseFloat(e[3])}}catch(t){return null}}I.prototype.show=function(){var e=this;return new Promise(function(t){b(e.element,{display:"block"}),t()})},I.prototype.hide=function(){var e=this;return new Promise(function(t){b(e.element,{display:"none"}),t()})},I.prototype.slideDown=function(){var o=this;return new Promise(function(t){b(o.element,{display:"block",visibility:"hidden"});var e=M(o.element,"marginTop"),n=M(o.element,"marginBottom"),r=o.element.offsetHeight+parseInt(e)+parseInt(n);b(o.element,{height:"0px",overflow:"hidden",visibility:"visible"}),o.element.offsetHeight,setTimeout(function(){b(o.element,{transition:"height ".concat(o.options.duration,"ms ").concat(o.options.easing),height:"".concat(r,"px")}),setTimeout(function(){b(o.element,{height:"",overflow:"",transition:""}),t()},o.options.duration)},o.options.delay)})},I.prototype.slideUp=function(){var r=this;return new Promise(function(t){var e=M(r.element,"marginTop"),n=M(r.element,"marginBottom"),e=r.element.offsetHeight+parseInt(e)+parseInt(n);b(r.element,{height:"".concat(e,"px"),overflow:"hidden"}),r.element.offsetHeight,setTimeout(function(){b(r.element,{height:"0px",transition:"height ".concat(r.options.duration,"ms ").concat(r.options.easing)}),setTimeout(function(){b(r.element,{height:"",overflow:"",transition:"",display:"none"}),t()},r.options.duration)},r.options.delay)})},I.prototype.fadeIn=function(){var t=this;return new Promise(function(n){function r(t){var t=Math.min((t-a)/i,1),e=1-Math.pow(1-t,3);b(o,{opacity:e.toString()}),t<1?requestAnimationFrame(r):(b(o,{opacity:"1"}),n())}var o=t.element,i=t.options.duration,a=(b(o,{display:"block",opacity:"0"}),o.offsetHeight,performance.now());requestAnimationFrame(r)})},I.prototype.fadeOut=function(){var t=this;return new Promise(function(n){function r(t){var t=Math.min((t-a)/i,1),e=Math.pow(t,3);b(o,{opacity:(1-e).toString()}),t<1?requestAnimationFrame(r):(b(o,{display:"none",opacity:"0"}),n())}var o=t.element,i=t.options.duration,a=(b(o,{display:"block",opacity:"1"}),o.offsetHeight,performance.now());requestAnimationFrame(r)})};var L=I;function I(t,e){void 0===e&&(e={}),this.element=t,this.options=n({duration:300,easing:"ease-out",delay:0},e)}var S={show:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).show()},hide:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).hide()},slideDown:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).slideDown()},slideUp:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).slideUp()},fadeIn:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).fadeIn()},fadeOut:function(t,e){return new L(t,{duration:e=void 0===e?300:e}).fadeOut()}};var $="ew-",st=["%c ew-color-picker@2.0.6%c 联系QQ:854806732 %c 联系微信:eveningwater %c github:https://github.com/eveningwater/ew-color-picker %c ","background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent"],ct=!1,ut=(j.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=V(this.options,this.ewColorPicker.options))},j.prototype.run=function(){ct||(ct=!0,z.apply(void 0,st))},j.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),t.on&&f(t.on)&&t.on("change",function(t){}),null!=(t=this.run)&&t.call(this)},j.pluginName="ewColorPickerConsole",j);function j(t){this.ewColorPicker=t,this.options={},this.handleOptions(),this.run()}o.$=J,o.$$=function(t,e){return(e=void 0===e?document:e).querySelectorAll(t)},o.Animation=L,o.Console=ut,o.DEFAULT_PANEL_HEIGHT=180,o.DEFAULT_PANEL_WIDTH=285,o.DEFAULT_PREFIX=$,o.EventEmitter=k,o.EventRegister=X,o.JSONClone=function(t){return JSON.parse(JSON.stringify(t))},o.addClass=function(t,e){for(var n=0,r=e.trim().split(/\s+/);n<r.length;n++){var o,i=r[n];i&&!m(t,i)&&((o=t.className.split(" ").filter(Boolean)).push(i),t.className=o.join(" "))}},o.ani=S,o.arrowIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498630" class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4234"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="currentColor" p-id="4235"></path></svg>')},o.assert=function(t,e){if(!t)throw new Error(e||"Assertion failed")},o.baseSetStyle=y,o.basicDataTypeList=["Number","String","Function","Undefined","Boolean"],o.bindMouseDrag=function(e,t){function n(t){return e(t)}function r(){C(document,"mousemove",n),C(document,"mouseup",r),null!=t&&t()}return A(document,"mousemove",n),A(document,"mouseup",r),r},o.bindTouchDrag=function(e,t){function n(t){return e(t)}function r(){C(document,"touchmove",n),C(document,"touchend",r),null!=t&&t()}return A(document,"touchmove",n,{}),A(document,"touchend",r),r},o.calculatePanelPosition=function(t,e,n,r){void 0===n&&(n="bottom"),void 0===r&&(r=8);var o=x(t),i=x(e),t=window.innerWidth,e=window.innerHeight,a=0,s=0,n=n.split("-"),c=n[0],u=n[1];switch(c){case"top":s=o.top-i.height-r,a="start"===u?o.left:"end"===u?o.right-i.width:o.left+(o.width-i.width)/2;break;case"bottom":s=o.bottom+r,a="start"===u?o.left:"end"===u?o.right-i.width:o.left+(o.width-i.width)/2;break;case"left":a=o.left-i.width-r,s="start"===u?o.top:"end"===u?o.bottom-i.height:o.top+(o.height-i.height)/2;break;case"right":a=o.right+r,s="start"===u?o.top:"end"===u?o.bottom-i.height:o.top+(o.height-i.height)/2}return s<0&&(s=r),{left:a=(a=a<0?r:a)+i.width>t?t-i.width-r:a,top:s=s+i.height>e?e-i.height-r:s}},o.camelCase=G,o.checkContainer=function(t){return c(t)?J(t)||(r("[ewColorPicker warning]: Cannot find element with selector: ".concat(t)),document.body):w(t)?t:document.body},o.checkIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path></svg>')},o.clearColorCache=function(){},o.clone=_,o.cloneColor=function(t){return n({},t)},o.close=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var r="";switch(t){case"height":r="slideUp";break;case"opacity":r="fadeOut";break;default:r="hide"}return S[r](e,n)},o.closeIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1690189203554" class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2272" fill="currentColor"').concat(e,'><path d="M504.224 470.288l207.84-207.84a16 16 0 0 1 22.608 0l11.328 11.328a16 16 0 0 1 0 22.624l-207.84 207.824 207.84 207.84a16 16 0 0 1 0 22.608l-11.328 11.328a16 16 0 0 1-22.624 0l-207.824-207.84-207.84 207.84a16 16 0 0 1-22.608 0l-11.328-11.328a16 16 0 0 1 0-22.624l207.84-207.824-207.84-207.84a16 16 0 0 1 0-22.608l11.328-11.328a16 16 0 0 1 22.624 0l207.824 207.84z" p-id="2273"></path></svg>')},o.colorHexToRgba=nt,o.colorHslaToRgba=function(t){var e,n,r,o,i=t.h,a=t.s/100,s=t.l/100,t=t.a;return 0==a?n=r=o=s:(n=(e=function(t,e,n){return 1<n&&(n-=1),n<0&&(n+=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t})(a=2*s-(s=.5<=s?s+a-s*a:s*(1+a)),s,(i=i/360)+1/3),r=e(a,s,i),o=e(a,s,i-1/3)),t=Math.round(10*t)/10,"rgba(".concat(Math.round(255*n),", ").concat(Math.round(255*r),", ").concat(Math.round(255*o),", ").concat(t,")")},o.colorHsvaToRgba=function(t,e){var n,r,o,i,a=t.a,s=t.h,c=255*t.s/100,t=255*t.v/100;return 0==c?n=r=o=t:(t=s%60*((i=t)-(c=(255-c)*t/255))/60,360===s?(n=i,r=o=0):s<60?(n=i,r=c+t,o=c):s<120?(n=i-t,r=i,o=c):s<180?(r=i,o=(n=c)+t):s<240?(n=c,r=i-t,o=i):s<300?(n=c+t,r=c,o=i):s<360?(r=c,o=(n=i)-t):n=r=o=0),void 0!==e&&0<=e&&e<=1&&(a=e),a=Math.round(10*a)/10,"rgba(".concat(Math.round(n),", ").concat(Math.round(r),", ").concat(Math.round(o),", ").concat(a,")")},o.colorRegExp=E,o.colorRegHSL=tt,o.colorRegHSLA=et,o.colorRegRGB=K,o.colorRegRGBA=Y,o.colorRgbaToHex=function(t){var e,n,r={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};return/rgba?/.test(t)?(e=t.replace(/rgba?\(/,"").replace(/\)/,"").replace(/[\s+]/g,"").split(","),n="",e.map(function(t,e){e<=2&&(n+=(e=+t,e=Math.min(Math.round(e),255),t=Math.floor(e/16),""+(r[t]||t)+(r[e%=16]||e)))}),g("#"+n)):t},o.colorRgbaToHsla=function(t){var e,n=(t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",")).length<4?1:Number(t[3]),n=Math.round(10*n)/10,r=parseInt(t[0])/255,o=parseInt(t[1])/255,i=parseInt(t[2])/255,t=Math.max(r,o,i),a=Math.min(r,o,i),s=(t+a)/2;if(t===a)e=u=0;else{var c=t-a,u=.5<s?c/(2-t-a):c/(t+a);switch(t){case r:e=(o-i)/c+(i<=o?0:6);break;case o:e=(i-r)/c+2;break;case i:e=(r-o)/c+4}}return{colorStr:g("hsla("+Math.ceil(60*e)+","+Math.ceil(100*u)+"%,"+Math.ceil(100*s)+"%,"+n+")"),colorObj:{h:Math.round(60*e),s:Math.round(100*u),l:Math.round(100*s),a:n}}},o.colorRgbaToHsva=rt,o.colorRgbaToHsvaWithCache=function(t){var e;return H.has(t)?H.get(t):(e=rt(t),H.set(t,e),1e3<H.size&&(t=H.keys().next().value)&&H.delete(t),e)},o.colorToRgba=P,o.copyIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></svg>')},o.create=Q,o.createByTemplate=function(t){return document.createRange().createContextualFragment(t)},o.debounce=function(r,o,i){void 0===i&&(i=!1);var a=null;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=i&&!a;a&&clearTimeout(a),a=setTimeout(function(){a=null,i||r.apply(void 0,t)},o),n&&r.apply(void 0,t)}},o.downArrowIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498632" class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4236"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="#666666" p-id="4237"></path></svg>')},o.error=i,o.extend=V,o.eyedropperIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"').concat(e,'><path d="M17.66 5.41l.92.92-2.69 2.69-.92-.92 2.69-2.69M17.67 3c-.26 0-.51.1-.71.29l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.29-.71.29-.71L17.67 3z"></path></svg>')},o.getAnimationType=function(t){return(null==(t=t.options)?void 0:t.togglePickerAnimation)||"default"},o.getAttr=function(t,e){return t.getAttribute(e)},o.getColorBrightness=it,o.getContrastColor=function(t,e,n){var r;return void 0===e&&(e="#333333"),void 0===n&&(n="#ffffff"),(t=t&&P(t))&&(r=at(t))&&.5<.2126*(t=function(t){t=(t*r.a+255*(1-r.a))/255;return t<=.03928?t/12.92:Math.pow((.055+t)/1.055,2.4)})(r.r)+.7152*t(r.g)+.0722*t(r.b)?e:n},o.getElementSize=function(t){return{clientWidth:t.clientWidth,clientHeight:t.clientHeight,offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}},o.getOffset=function(t){for(var e=0,n=0;t;)e-=t.offsetLeft,n-=t.offsetTop,t=t.offsetParent;return{left:e,top:n}},o.getPrefix=function(t){t=null==(t=null==t?void 0:t.options)?void 0:t.prefix;return c(t)?t:$},o.getRatio=function(t,e,n,r){void 0===r&&(r=!1);t=Math.max(0,Math.min(1,0<n?(t-e)/n:0));return r?1-t:t},o.getRect=x,o.getStyle=M,o.handleClassName=v,o.hasClass=m,o.insertNode=function(t,e,n,r){r&&null!=t&&t.contains(r)?t.insertBefore(e,r):n&&null!=t&&t.contains(n)?t.replaceChild(e,n):null!=t&&t.appendChild(e)},o.isAlphaColor=function(t){return!!/^rgba\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!/^hsla\s*\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!t.includes("hsva(")||"transparent"===t},o.isArray=B,o.isBoolean=function(t){return"boolean"==typeof t},o.isBrowser=p,o.isDarkColor=function(t){return it(t)<128},o.isDeepArray=function(t){return Array.isArray(t)},o.isDeepObject=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},o.isDom=function(t){return a(HTMLElement)?w(t):t&&a(t)&&1===t.nodeType&&c(t.nodeName)||t instanceof HTMLCollection||t instanceof NodeList},o.isFunction=f,o.isHTMLElement=w,o.isMobile=q,o.isNotEmptyObject=function(t){return D(t)&&0<Object.keys(t).length},o.isNull=l,o.isNumber=R,o.isObject=D,o.isPromise=function(t){return!s(t)&&!l(t)&&f((t=t).then)&&f(t.catch)},o.isRegExp=function(t){return"regexp"===u.call(t).slice(8,-1).toLowerCase()},o.isShallowObject=a,o.isStrictColorFormat=function(t){return!(!t||"string"!=typeof t||!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)&&!(/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(t)||/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||/^hsl\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*\)$/.test(t)||/^hsla\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||"transparent"===t))},o.isString=c,o.isUndefined=s,o.isValidColor=function(t){var e="transparent"===t;if(E.test(t))return!0;if(K.test(t)&&!t.includes("rgba"))return!0;if(Y.test(t))return!0;if(tt.test(t)&&!t.includes("hsla"))return!0;if(et.test(t))return!0;if(e)return!0;if("#invalid"===t||"invalid"===t)return!1;if(t.includes("rgb(")&&t.includes(", 0.5)"))return!1;if(t.includes("rgba(")&&!t.includes(", 0.5)")&&!t.includes(", 1)"))return!1;try{var n=document.createElement("div");return b(n,{"background-color":t}),"rgba(0, 0, 0, 0)"!==M(n,"backgroundColor")||e}catch(t){return!1}},o.log=z,o.objDataTypeList=["Object","Array","RegExp"],o.off=C,o.on=A,o.open=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var r="";switch(t){case"height":r="slideDown";break;case"opacity":r="fadeIn";break;default:r="show"}return S[r](e,n)},o.parseRgbaString=at,o.removeAllSpace=g,o.removeClass=function(t,e){m(t,e)&&(e=new RegExp("(^|\\s)"+e+"(\\s|$)","g"),t.className=t.className.replace(e," "))},o.removeElement=Z,o.removeNode=d,o.removeStyle=function(t,e){for(var n=0,r=e=void 0===e?[]:e;n<r.length;n++){var o=r[n];t.style.removeProperty(o)}},o.rgbToHsl=function(t,e,n){t/=255,e/=255,n/=255;var r=Math.max(t,e,n),o=Math.min(t,e,n),i=0,a=0,s=(r+o)/2;if(r!==o){var c=r-o,a=.5<s?c/(2-r-o):c/(r+o);switch(r){case t:i=(e-n)/c+(e<n?6:0);break;case e:i=(n-t)/c+2;break;case n:i=(t-e)/c+4}i/=6}return{h:360*i,s:100*a,l:100*s}},o.rgbaToHex=function(t){function e(t){return Math.round(t).toString(16).padStart(2,"0")}return"#".concat(e(t.r)).concat(e(t.g)).concat(e(t.b))},o.setAttr=function(t,e){if(a(e))for(var n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],i=o[0];t.setAttribute(i,"".concat(o[1]))}},o.setStyle=b,o.throttle=function(n,r){var o;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o||(n.apply(void 0,t),o=!0,setTimeout(function(){return o=!1},r))}},o.throwError=function(t){throw new Error("[ewColorPicker error]: ".concat(t))},o.tips=st,o.toArray=function(t){return a(t)?Array.from?Array.from(t):U.call(t):t},o.toStyleStr=function(t){return t?c(t)?t:Object.entries(t).map(function(t){var e=t[0],t=t[1];return"".concat(e.replace(/([A-Z])/g,"-$1").toLowerCase(),":").concat(t)}).join(";"):""},o.tryErrorHandler=F,o.ua=h,o.upArrowIcon=function(t,e,n){void 0===n&&(n=$);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498631" class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4235"').concat(e,'><path d="M512 309.333333c8.533333 0 17.066667 2.133333 23.466667 8.533334l341.333333 341.333333c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0L533.333333 374.4 215.466667 692.266667c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L488.533333 317.866667c4.266667-8.533333 12.8-10.666667 21.333334-10.666667z" fill="#666666" p-id="4236"></path></svg>')},o.warn=r});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ew-color-picker/utils",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "utils for ew-color-picker",
5
5
  "main": "dist/utils.min.js",
6
6
  "module": "dist/utils.esm.js",
@@ -33,8 +33,11 @@
33
33
  "directory": "packages/utils"
34
34
  },
35
35
  "types": "dist/packages/utils/src/index.d.ts",
36
+ "devDependencies": {
37
+ "rimraf": "^3.0.2"
38
+ },
36
39
  "peerDependencies": {
37
- "@ew-color-picker/core": "^2.0.4"
40
+ "@ew-color-picker/core": "^2.0.6"
38
41
  },
39
42
  "peerDependenciesMeta": {
40
43
  "@ew-color-picker/core": {