@ew-color-picker/ew-color-picker 2.0.1 → 2.0.3

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.
package/dist/index.esm.js CHANGED
@@ -15,6 +15,8 @@ import Button from '@ew-color-picker/button';
15
15
  import Predefine from '@ew-color-picker/predefine';
16
16
  import { Console } from '@ew-color-picker/utils';
17
17
  import ColorMode from '@ew-color-picker/color-mode';
18
+ import Eyedropper from '@ew-color-picker/eyedropper';
19
+ import CopyColor from '@ew-color-picker/copy-color';
18
20
 
19
21
  // 注册插件
20
22
  Core.use(Console);
@@ -27,6 +29,8 @@ Core.use(ewColorPickerInputNumberPlugin); // 注册 InputNumber 插件
27
29
  Core.use(Button);
28
30
  Core.use(Predefine);
29
31
  Core.use(ColorMode);
32
+ Core.use(Eyedropper);
33
+ Core.use(CopyColor);
30
34
  // 为UMD构建添加全局变量
31
35
  if (typeof window !== 'undefined') {
32
36
  window.ewColorPicker = Core;
package/dist/index.min.js CHANGED
@@ -1 +1 @@
1
- ((t,o)=>{"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((t="undefined"!=typeof globalThis?globalThis:t||self).ewColorPicker={})})(this,function(_){var z=function(t,o){return(z=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,o){t.__proto__=o}:function(t,o){for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])}))(t,o)};function j(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}z(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}var n=function(){return(n=Object.assign||function(t){for(var o,e=1,i=arguments.length;e<i;e++)for(var n in o=arguments[e])Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);return t}).apply(this,arguments)};function F(t,o){var e={};for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&o.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)o.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(e[n[i]]=t[n[i]]);return e}function W(t,o,e){if(e||2===arguments.length)for(var i,n=0,r=o.length;n<r;n++)!i&&n in o||((i=i||Array.prototype.slice.call(o,0,n))[n]=o[n]);return t.concat(i||Array.prototype.slice.call(o))}function V(){}var L={log:V,warn:V,error:V},h=(["warn","error","log"].forEach(function(t){L[t]=function(){}}),L.warn),U=L.error,$=L.log,R="undefined"!=typeof window,t=R&&navigator.userAgent.toLowerCase(),q=(t&&t.match(/(iPhone|iPod|Android|ios)/i),!1);if(R)try{var G={};Object.defineProperty(G,"passive",{get:function(){q=!0}}),window.addEventListener("test-passive",function(){},G)}catch(U){}function X(t){return void 0===t}function Y(t){return"string"==typeof t}function K(t){return"object"===et.call(t).slice(8,-1).toLowerCase()}function Q(t,o){try{t()}catch(t){C(o)?o(t):U("[ewColorPicker error]: ".concat(t))}}function i(t){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];if(nt(t))return{};if(Object.assign)return Object.assign.apply(Object,W([t],o,!1));for(var i=Object(t),n=0,r=o.length;n<r;n++){var s=o[n];if(s)for(var a in s)it.call(s,a)&&(i[a]=s[a])}return i}function l(t){return document.createElement(t)}function s(t,o){return new RegExp("(^|\\s)"+o+"(\\s|$)").test(t.className)}function c(t,o){for(var e=0,i=o.trim().split(/\s+/);e<i.length;e++){var n,r=i[e];r&&!s(t,r)&&((n=t.className.split(" ").filter(Boolean)).push(r),t.className=n.join(" "))}}function a(t,o){s(t,o)&&(o=new RegExp("(^|\\s)"+o+"(\\s|$)","g"),t.className=t.className.replace(o," "))}function Z(t){return t instanceof HTMLElement}function J(t,o,e){o=o.startsWith("--")?o:o.replace(/([A-Z])/g,"-$1").toLowerCase(),t.style.setProperty(o,e)}function u(e,t,o){if(Y(t=void 0===t?{}:t)&&!X(o)){o=rt(o)?"".concat(o,"px"):o;J(e,t,o)}else if(Array.isArray(t))t.forEach(function(t){var o=t.prop;J(e,o,t.value)});else for(var i=0,n=Object.entries(t);i<n.length;i++){var r=n[i],s=r[0];J(e,s,r[1])}}function tt(t,o){for(var e=0,i=o=void 0===o?[]:o;e<i.length;e++){var n=i[e];t.style.removeProperty(n)}}function p(o,e,i){var n;return o&&e?("float"===(e=e.replace(/([\:\_\-]+(.))/g,function(t,o,e,i){return i?e.toUpperCase():e}).replace(/^moz([A-Z])/,"Moz$1"))&&(e="cssFloat"),n=null,Q(function(){var t=(document.defaultView||window).getComputedStyle(o,i);n=o.style[e]||t?t[e]:null}),n||o.style[e]):null}function d(t,o){if(st(o))for(var e=0,i=Object.entries(o);e<i.length;e++){var n=i[e],r=n[0];t.setAttribute(r,"".concat(n[1]))}}function f(t,o){return(o=void 0===o?document:o).querySelector(t)}function r(t){var o;null!=t&&t.parentElement?null!=(o=null==t?void 0:t.parentElement)&&o.removeChild(t):null!=t&&t.remove()}function g(t,o,e,i){i&&null!=t&&t.contains(i)?t.insertBefore(o,i):e&&null!=t&&t.contains(e)?t.replaceChild(o,e):null!=t&&t.appendChild(o)}function ot(t){return Y(t)?f(t)||(h("[ewColorPicker warning]: Cannot find element with selector: ".concat(t)),document.body):Z(t)?t:document.body}var et=Object.prototype.toString,it=Object.prototype.hasOwnProperty,nt=function(t){return null===t},rt=function(t){return"number"==typeof t},C=function(t){return"function"==typeof t},st=function(t){return"object"==typeof t&&!nt(t)},at=function(t){return t.replace(/\s+/g,"")},lt=function(t){return t?" ".concat(t):""};function ht(t){return{clientWidth:t.clientWidth,clientHeight:t.clientHeight,offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}}function b(t){return t.getBoundingClientRect()}function v(t,o,e,i){i=q?{passive:!1,capture:!!i}:!!i,t.addEventListener(o,e,i)}function P(t,o,e,i){t.removeEventListener(o,e,{capture:!!i})}(t=Lt=Lt||{}).Pre="pre",t.Post="post",o.prototype.on=function(t,o,e){return void 0===e&&(e=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([o,e]),this},o.prototype.once=function(i,n,r){var s=this,a=(void 0===r&&(r=this),this.hasType(i),function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];s.off(i,a);var e=n.apply(r,t);if(!0===e)return e});return a.fn=n,this.on(i,a),this},o.prototype.off=function(t,o){if(!t&&!o)return this.events={},this;if(t){if(this.hasType(t),o){var e=this.events[t];if(e)for(var i=e.length;i--;)(e[i][0]===o||e[i][0]&&e[i][0].fn===o)&&e.splice(i,1)}else this.events[t]=[];return this}},o.prototype.trigger=function(t){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];this.hasType(t);t=this.events[t];if(t)for(var i=t.length,n=W([],t,!0),r=0;r<i;r++){var s=n[r],a=s[0],s=s[1];if(a&&!0===(a=a.apply(s,o)))return a}},o.prototype.registerType=function(t){var o=this;t.forEach(function(t){o.eventTypes[t]=t})},o.prototype.destroy=function(){this.events={},this.eventTypes={}},o.prototype.hasType=function(t){var o=this.eventTypes;o[t]!==t&&h('[ewColorPicker warning]: EventEmitter has used unknown event type: "'.concat(t,'", should be oneof [')+"".concat(Object.keys(o).map(function(t){return JSON.stringify(t)}))+"]")};R=o;function o(t){this.events={},this.eventTypes={},this.registerType(t)}var ct=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,ut=/[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,pt=/^[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}$/,dt=/^[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]*)[\)]$/,ft=/^[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 gt(t){var o,e,i={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};return/rgba?/.test(t)?(o=t.replace(/rgba?\(/,"").replace(/\)/,"").replace(/[\s+]/g,"").split(","),e="",o.map(function(t,o){o<=2&&(e+=(o=+t,o=Math.min(Math.round(o),255),t=Math.floor(o/16),""+(i[t]||t)+(i[o%=16]||o)))}),at("#"+e)):t}function Ct(t){var o,e,i,n,r=t.a,s=t.h,a=255*t.s/100,t=255*t.v/100;return 0==a?o=e=i=t:(t=s%60*((n=t)-(a=(255-a)*t/255))/60,360===s?(o=n,e=i=0):s<60?(o=n,e=a+t,i=a):s<120?(o=n-t,e=n,i=a):s<180?(e=n,i=(o=a)+t):s<240?(o=a,e=n-t,i=n):s<300?(o=a+t,e=a,i=n):s<360?(e=a,i=(o=n)-t):o=e=i=0),r=Math.round(10*r)/10,"rgba(".concat(Math.round(o),", ").concat(Math.round(e),", ").concat(Math.round(i),", ").concat(r,")")}function w(t){var o,e,i,n,r,s,a,l;return t&&"string"==typeof t&&(t=t.replace(/\s+/g," ").trim().match(/rgba?\(([^)]+)\)/i))?(t=t[1].split(",").map(function(t){return t.trim()}),o=parseFloat(t[0])||0,e=parseFloat(t[1])||0,i=parseFloat(t[2])||0,t=4<=t.length&&parseFloat(t[3])||1,o=o/255,e=e/255,i=i/255,n=(l=Math.max(o,e,i))-Math.min(o,e,i),(s=r=0)!==(a=l)&&(s=n/l),0!=n?(l===o?r=(e-i)/n*60:l===e?r=60*((i-o)/n+2):l===i&&(r=60*((o-e)/n+4)),r<0&&(r+=360)):r=0,l=Math.round(10*t)/10,{h:Math.round(r),s:Math.round(100*s),v:Math.round(100*a),a:l}):{h:0,s:100,v:100,a:1}}var bt={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 m(t){if(t&&"string"==typeof t){var o=t.trim().toLowerCase();if(bt[o])return bt[o];if(ct.test(o))return((t,o)=>{var o=(o=void 0===o?1:o)||1,o=Math.round(10*o)/10,e=t.toLowerCase(),i=t.length,n=[];if(t&&ct.test(e)){if(4===i){for(var r="#",s=1;s<i;s++){var a=e.slice(s,s+1);r+=a.concat(a)}e=r}for(var l=1,h=e.length;l<h;l+=2)n.push(parseInt("0X"+e.slice(l,l+2),16));return"rgba(".concat(n.join(", "),", ").concat(o,")")}return at(e)})(o).replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)");var e=o.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(e)return i=e[1],n=e[2],r=e[3],"rgba(".concat(i,", ").concat(n,", ").concat(r,", 1)");var i,n,r,e=o.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(e)return i=e[1],n=e[2],r=e[3],o=e[4],"rgba(".concat(i,", ").concat(n,", ").concat(r,", ").concat(o,")");try{var s=l("div"),a=(u(s,{"background-color":t}),p(s,"backgroundColor"));if(a&&"rgba(0, 0, 0, 0)"!==a)return a.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)")}catch(t){}}return""}function vt(t){var o="transparent"===t;if(ct.test(t))return 1;if(ut.test(t)&&!t.includes("rgba"))return 1;if(pt.test(t))return 1;if(dt.test(t)&&!t.includes("hsla"))return 1;if(ft.test(t))return 1;if(o)return 1;if("#invalid"!==t&&"invalid"!==t&&(!t.includes("rgb(")||!t.includes(", 0.5)"))&&(!t.includes("rgba(")||t.includes(", 0.5)")||t.includes(", 1)")))try{var e=document.createElement("div");return u(e,{"background-color":t}),"rgba(0, 0, 0, 0)"!==p(e,"backgroundColor")||o}catch(t){}}function Pt(t){function o(t){return Math.round(t).toString(16).padStart(2,"0")}return"#".concat(o(t.r)).concat(o(t.g)).concat(o(t.b))}function wt(t){try{var o=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return o.length<3?null:{r:parseInt(o[0]),g:parseInt(o[1]),b:parseInt(o[2]),a:o.length<4?1:parseFloat(o[3])}}catch(t){return null}}kt.prototype.show=function(){var o=this;return new Promise(function(t){u(o.element,{display:"block"}),t()})},kt.prototype.hide=function(){var o=this;return new Promise(function(t){u(o.element,{display:"none"}),t()})},kt.prototype.slideDown=function(){var n=this;return new Promise(function(t){u(n.element,{display:"block",visibility:"hidden"});var o=p(n.element,"marginTop"),e=p(n.element,"marginBottom"),i=n.element.offsetHeight+parseInt(o)+parseInt(e);u(n.element,{height:"0px",overflow:"hidden",visibility:"visible"}),n.element.offsetHeight,setTimeout(function(){u(n.element,{transition:"height ".concat(n.options.duration,"ms ").concat(n.options.easing),height:"".concat(i,"px")}),setTimeout(function(){u(n.element,{height:"",overflow:"",transition:""}),t()},n.options.duration)},n.options.delay)})},kt.prototype.slideUp=function(){var i=this;return new Promise(function(t){var o=p(i.element,"marginTop"),e=p(i.element,"marginBottom"),o=i.element.offsetHeight+parseInt(o)+parseInt(e);u(i.element,{height:"".concat(o,"px"),overflow:"hidden"}),i.element.offsetHeight,setTimeout(function(){u(i.element,{height:"0px",transition:"height ".concat(i.options.duration,"ms ").concat(i.options.easing)}),setTimeout(function(){u(i.element,{height:"",overflow:"",transition:"",display:"none"}),t()},i.options.duration)},i.options.delay)})},kt.prototype.fadeIn=function(){var t=this;return new Promise(function(e){function i(t){var t=Math.min((t-s)/r,1),o=1-Math.pow(1-t,3);u(n,{opacity:o.toString()}),t<1?requestAnimationFrame(i):(u(n,{opacity:"1"}),e())}var n=t.element,r=t.options.duration,s=(u(n,{display:"block",opacity:"0"}),n.offsetHeight,performance.now());requestAnimationFrame(i)})},kt.prototype.fadeOut=function(){var t=this;return new Promise(function(e){function i(t){var t=Math.min((t-s)/r,1),o=Math.pow(t,3);u(n,{opacity:(1-o).toString()}),t<1?requestAnimationFrame(i):(u(n,{display:"none",opacity:"0"}),e())}var n=t.element,r=t.options.duration,s=(u(n,{display:"block",opacity:"1"}),n.offsetHeight,performance.now());requestAnimationFrame(i)})};var mt=kt;function kt(t,o){void 0===o&&(o={}),this.element=t,this.options=n({duration:300,easing:"ease-out",delay:0},o)}var yt={show:function(t,o){return new mt(t,{duration:o=void 0===o?300:o}).show()},hide:function(t,o){return new mt(t,{duration:o=void 0===o?300:o}).hide()},slideDown:function(t,o){return new mt(t,{duration:o=void 0===o?300:o}).slideDown()},slideUp:function(t,o){return new mt(t,{duration:o=void 0===o?300:o}).slideUp()},fadeIn:function(t,o){return new mt(t,{duration:o=void 0===o?300:o}).fadeIn()},fadeOut:function(t,o){return new mt(t,{duration:o=void 0===o?300:o}).fadeOut()}};function xt(t){return(null==(t=t.options)?void 0:t.togglePickerAnimation)||"default"}function e(i,n,r){void 0===r&&(r=!1);var s=null;return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];var e=r&&!s;s&&clearTimeout(s),s=setTimeout(function(){s=null,r||i.apply(void 0,t)},n),e&&i.apply(void 0,t)}}function Bt(e,i){var n;return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];n||(e.apply(void 0,t),n=!0,setTimeout(function(){return n=!1},i))}}function k(t){return"string"==typeof(t=null==(t=null==t?void 0:t.options)?void 0:t.prefix)?t:y}function Mt(t,o,e){return void 0===e&&(e=y),o=o&&0<o?' width="'.concat(o,'" height="').concat(o,'"'):"",'<svg t="1717384498631" class="'.concat(e,"color-picker-icon").concat(lt(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4235"').concat(o,'><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>')}function Ht(t,o,e){return void 0===e&&(e=y),o=o&&0<o?' width="'.concat(o,'" height="').concat(o,'"'):"",'<svg t="1717384498632" class="'.concat(e,"color-picker-icon").concat(lt(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4236"').concat(o,'><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>')}var y="ew-",Ot=["%c ew-color-picker@2.0.1%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"],Tt=!1,G=(At.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i(this.options,this.ewColorPicker.options))},At.prototype.run=function(){Tt||(Tt=!0,$.apply(void 0,Ot))},At.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),t.on&&C(t.on)&&t.on("change",function(t){}),null!=(t=this.run)&&t.call(this)},At.pluginName="ewColorPickerConsole",At);function At(t){this.ewColorPicker=t,this.options={},this.handleOptions(),this.run()}var Dt,It={disabled:!1,predefineColor:[],size:"normal",defaultColor:"",isClickOutside:!0,hueDirection:"vertical",alphaDirection:"vertical",clearText:"清空",sureText:"确定",togglePickerAnimation:"default",pickerAnimationTime:200,autoPanelPosition:!1,panelPlacement:"bottom",prefix:y,sure:function(){},clear:function(){},togglePicker:function(){},changeColor:function(){}},Et=(j(St,Dt=function(){}),St.prototype.merge=function(t,o){var t=t||{},e=t.el,t=F(t,["el"]);return i({},It,null!=o?o:{},n(n({},t),{el:ot(e)}))},St.prototype.bindOptions=function(t,o){var e,i=this.merge(t,o=void 0===o?{}:o);for(e in i){var n=i[e];this[e]=n}return this},St);function St(){var t=Dt.call(this)||this;return t.el=document.body,t}(t={})[Lt.Pre]=-1,t[Lt.Post]=1;var Nt,_t=t,zt=["destroy","change","sure","clear","toggle","options-update","mode-change"],x=(j(B,Nt=R),B.use=function(o){var e=o.pluginName;return X(e)||nt(e)?h("[ewColorPicker warning]: Plugin Class must specify plugin's name in static property by 'pluginName' field."):B.plugins.some(function(t){return t.name===e||o===t.ctor})||(B.pluginsMap[e]=!0,B.plugins.push({name:e,applyOrder:o.applyOrder,ctor:o})),B},B.prototype.normalizeOptions=function(t,o){var e,i;return Z(t)||Y(t)?(e=o?(o.el,o=F(o,["el"]),n({el:t},o)):{el:t},this.shouldAutoMount=!0):K(e=t)&&e.el&&(this.shouldAutoMount=!0),(new Et).bindOptions(e,(i={},x.plugins.forEach(function(t){i[t.name]=!0}),i))},B.prototype.init=function(){var t=this;Q(function(){t.plugins={},t._color_picker_uid=t.generateUID(),t.initCoreProperties()})},B.prototype.initCoreProperties=function(){var t,o,e=this.options,i=e.defaultColor,n=e.alphaDirection,e=e.hueDirection;i?(t=i,(null==(o=this.plugins)?void 0:o.ewColorPickerAlpha)?i.startsWith("#")&&(t=m(i)):i.startsWith("rgba")&&(t=gt(i)),o=w(m(this.currentColor=t)||"rgba(255, 0, 0, 1)"),isNaN(o.h)?this.hsvaColor={h:0,s:100,v:100,a:1}:this.hsvaColor=o):(this.currentColor="",this.hsvaColor={h:0,s:0,v:0,a:0}),this.panelWidth=0,this.panelHeight=0,this.panelLeft=0,this.panelTop=0,this.isHueHorizontal="horizontal"===e,this.isAlphaHorizontal="horizontal"===n,this.colorMode=["Hex","RGB","HSV"],this.currentMode="Hex",this.pickerFlag=!1},B.prototype.createMountPoints=function(){var t=this.options.prefix||y,o=l("div"),e=(d(o,{class:"".concat(t,"color-picker"),"data-uid":this._color_picker_uid}),g(this.getContainer(),o),this.wrapper=o,this.wrapper.isEwColorPickerContainer=!0,l("div"));d(e,{class:"".concat(t,"color-picker-panel-container")}),c(e,"".concat(t,"color-picker-panel-container-hidden")),g(o,e),this.mountPoints.set("root",o),this.mountPoints.set("panelContainer",e)},B.prototype.getMountPoint=function(t){if(!this.isDestroyed)return this.mountPoints.get(t)},B.prototype.getContainer=function(){return this.options.el},B.prototype.mount=function(t){return this.isDestroyed||(t=t?ot(t):this.options.el||document.body,this.options.el=t,this.createMountPoints(),this.applyPlugins(),this.notifyHuePluginUpdate(this.hsvaColor.h)),this},B.prototype.reapplyPlugins=function(){Object.values(this.plugins).forEach(function(t){C(t.run)&&t.run()})},B.prototype.showPanel=function(t,o){var e,i,n,r,s=this;this.isDestroyed||(e=this.mountPoints.get("panelContainer"))&&(i=(r=this.options||{}).pickerAnimationTime,n=r.togglePicker,this.currentColor||(r=w(m(this.currentColor=r.defaultColor||"#ff0000")||"rgba(255, 0, 0, 1)"),this.hsvaColor=r,isNaN(r.h))||this.notifyHuePluginUpdate(r.h),((t,o,e)=>{e=1e4<(e=void 0===e?300:e)?1e4:e;var i="";switch(t){case"height":i="slideDown";break;case"opacity":i="fadeIn";break;default:i="show"}return yt[i](o,e)})(t||xt(this),e,o||i||200).then(function(){s.pickerFlag=!0,s.trigger("toggle",!0),C(n)&&n(!0),s.syncAllPlugins(s.currentColor),setTimeout(function(){var t=s.plugins.ewColorPickerPanel;t&&C(t.handleAutoPosition)&&t.handleAutoPosition.call(t),v(document,"mousedown",s._onDocumentClick,{capture:!0})},0)}).catch(function(t){h("[ewColorPicker error]: Failed to show panel: ".concat(t))}))},B.prototype.hidePanel=function(t,o){var e,i,n,r,s,a,l=this;this.isDestroyed||(e=this.mountPoints.get("panelContainer"))&&(n=(i=this.options||{}).pickerAnimationTime,r=i.togglePicker,s=i.autoPanelPosition,a=this.plugins.ewColorPickerBox||!1,((t,o,e)=>{e=1e4<(e=void 0===e?300:e)?1e4:e;var i="";switch(t){case"height":i="slideUp";break;case"opacity":i="fadeOut";break;default:i="hide"}return yt[i](o,e)})(t||xt(this),e,o||n||200).then(function(){l.isDestroyed||(s&&a&&!l.options.appendTo&&u(e,{position:"absolute",left:"0",top:"100%",visibility:"visible"}),l.pickerFlag=!1,l.trigger("toggle",!1),C(r)&&r(!1),P(document,"mousedown",l._onDocumentClick,{capture:!0}))}).catch(function(t){h("[ewColorPicker error]: Failed to hide panel: ".concat(t))}))},B.prototype.generateUID=function(){return"ew-color-picker-".concat(Date.now(),"-").concat(Math.random().toString(36).substring(2,11))},B.prototype.applyPlugins=function(){var i=this,t=W([],B.plugins,!0).sort(function(t,o){var e,i,n=t.applyOrder?_t[t.applyOrder]:0,r=o.applyOrder?_t[o.applyOrder]:0;return n!==r?n-r:(e={},i=0,x.plugins.forEach(function(t){e[t.name]=i++}),((n=e)[t.name]||999)-(n[o.name]||999))});this.checkPluginDependencies(),t.forEach(function(t){var o=t.ctor,e=t.name;Q(function(){C(o)&&(i.plugins[e]=new o(i))},function(t){console.warn("[ewColorPicker warning]: Failed to apply plugin '".concat(e,"': ").concat(t))})})},B.prototype.checkPluginDependencies=function(){var e=this;Object.entries({hue:["ewColorPickerHue"],alpha:["ewColorPickerAlpha"],panel:["ewColorPickerPanel"],input:["ewColorPickerInput"],inputNumber:["ewColorPickerInputNumber"],button:["ewColorPickerButton"],predefine:["ewColorPickerPredefine"],colorMode:["ewColorPickerColorMode"],box:["ewColorPickerBox"],console:["ewColorPickerConsole"]}).forEach(function(t){var o=t[0],t=t[1];e.options[o]&&t.forEach(function(t){B.pluginsMap[t]||h("[ewColorPicker warning]: Plugin '".concat(t,"' is required but not injected. Please use ewColorPicker.use(").concat(t,") to register the plugin."))})}),this.checkSpecificFeatureDependencies()},B.prototype.checkSpecificFeatureDependencies=function(){this.options.hueDirection&&!B.pluginsMap.ewColorPickerHue&&h("[ewColorPicker warning]: hueDirection is configured but ewColorPickerHue plugin is not injected. Please use ewColorPicker.use(HuePlugin) to register the plugin."),this.options.alphaDirection&&!B.pluginsMap.ewColorPickerAlpha&&h("[ewColorPicker warning]: alphaDirection is configured but ewColorPickerAlpha plugin is not injected. Please use ewColorPicker.use(AlphaPlugin) to register the plugin."),this.options.predefineColor&&0<this.options.predefineColor.length&&!B.pluginsMap.ewColorPickerPredefine&&h("[ewColorPicker warning]: predefineColor is configured but ewColorPickerPredefine plugin is not injected. Please use ewColorPicker.use(PredefinePlugin) to register the plugin."),B.pluginsMap.ewColorPickerColorMode&&!B.pluginsMap.ewColorPickerInputNumber&&h("[ewColorPicker warning]: Color mode plugin requires InputNumber plugin. color-mode plugin requires InputNumber plugin. Please use ewColorPicker.use(InputNumberPlugin) to register the plugin."),B.pluginsMap.ewColorPickerPanel||h("[ewColorPicker warning]: Panel plugin is required as core plugin but not injected. Please use ewColorPicker.use(PanelPlugin) to register the plugin.")},B.prototype.syncAllPlugins=function(o){Object.values(this.plugins).forEach(function(t){C(t.syncColor)&&t.syncColor(o)})},B.prototype.updateOptions=function(t){this.isDestroyed||(this.options=i({},this.options,t),t=(this.options||{}).defaultColor,X(t)||(m(t)?this.setColor(t):h("[ewColorPicker warning]: Invalid defaultColor '".concat(t,"', keep current color unchanged."))),this.reapplyPlugins(),this.trigger("options-update",this.options))},B.prototype.openPicker=function(){this.showPanel()},B.prototype.closePicker=function(){this.hidePanel()},B.prototype.destroy=function(){var t=this;this.isDestroyed||(this.isDestroyed=!0,P(document,"mousedown",this._onDocumentClick,{capture:!0}),this.plugins&&Object.values(this.plugins).forEach(function(t){Q(function(){C(null==t?void 0:t.destroy)&&t.destroy()})}),this.mountPoints.forEach(function(t){Q(function(){r(t)})}),this.mountPoints.clear(),Q(function(){r(t.wrapper)}),this.plugins={},this.trigger("destroy"))},B.prototype.setColor=function(t){var o;(this.currentColor=t)&&(o=m(t),this.hsvaColor=o?w(o):{h:0,s:100,v:100,a:1}),this.trigger("change",t),C(null==(o=this.options)?void 0:o.changeColor)&&this.options.changeColor(t)},B.prototype.getColor=function(){return this.currentColor},B.prototype.getHsvaColor=function(){return n({},this.hsvaColor)},B.prototype.setHsvaColor=function(t){this.hsvaColor=n({},t)},B.prototype.getDestroyedStatus=function(){return this.isDestroyed},B.prototype.use=function(t){return C(t.install)&&t.install(this),this},B.prototype.emit=function(t){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];this.trigger.apply(this,W([t],o,!1));var i=this.options||{},n=i.clear,r=i.sure,s=i.togglePicker;switch(t){case"clear":C(n)&&n();break;case"sure":C(r)&&r();break;case"toggle":C(s)&&s.apply(void 0,o)}},B.prototype.on=function(t,o,e){return Nt.prototype.on.call(this,t,o,e),this},B.prototype.off=function(t,o){return Nt.prototype.off.call(this,t,o),this},B.prototype.getOptions=function(){return this.options},B.prototype.notifyHuePluginUpdate=function(t){var o=null==(o=this.plugins)?void 0:o.ewColorPickerHue;C(null==o?void 0:o.updateHueThumbPosition)&&o.updateHueThumbPosition(t)},B.plugins=[],B.pluginsMap={},B);function B(t,o){var i=Nt.call(this,zt)||this;return i.mountPoints=new Map,i.isDestroyed=!1,i.shouldAutoMount=!1,i._onDocumentClick=function(t){var o,e;i.isDestroyed||!i.options.isClickOutside||(o=i.mountPoints.get("panelContainer"),e=i.mountPoints.get("root"),t=t.target,o&&o.contains(t))||(o=i.options.prefix||y,(e=null==e?void 0:e.querySelector(".".concat(o,"color-picker-box")))&&e.contains(t))||(e=(o=i.options).togglePickerAnimation,i.hidePanel(e,o.pickerAnimationTime))},i.options=i.normalizeOptions(t,o),i.init(),i.shouldAutoMount&&i.options.el&&Q(function(){i.mount(i.options.el)},function(t){h("[ewColorPicker warning]: Auto mount failed: ".concat(t))}),i}function jt(t,o){var e=void 0===(e=o.boxNoColorIcon)?"":e,i=void 0===(i=o.boxHasColorIcon)?"":i,n=void 0===(n=o.prefix)?y:n,o=(t=>{var o,e;if(t){if(st(t))return o=Vt(null!=(o=t.width)?o:32),e=Vt(null!=(e=t.height)?e:32),.5*Math.min(o,e);if(rt(t))return.5*t;if("string"==typeof t)return Wt[t]||16}return 16})(o.size);return t?i||((t,o,e)=>(void 0===e&&(e=y),o=o&&0<o?' width="'.concat(o,'" height="').concat(o,'"'):"",'<svg t="1717384498630" class="'.concat(e,"color-picker-icon").concat(lt(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4234"').concat(o,'><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>')))("".concat(n,"color-picker-box-arrow-icon"),o,n):e||((t,o,e)=>(void 0===e&&(e=y),o=o&&0<o?' width="'.concat(o,'" height="').concat(o,'"'):"",'<svg t="1690189203554" class="'.concat(e,"color-picker-icon").concat(lt(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2272" fill="currentColor"').concat(o,'><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>')))("".concat(n,"color-picker-box-close-icon"),o,n)}var Ft={mini:"20px",small:"24px",normal:"32px",medium:"36px",large:"40px"},Wt={mini:12,small:14,normal:16,medium:18,large:20},Vt=function(t){return!rt(t)&&(t=parseInt("".concat(t)),isNaN(t))?32:t},Lt=(Object.defineProperty(M.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"hasBox",{get:function(){return this._hasBox},set:function(t){this._hasBox!==t&&((this._hasBox=t)?this.render():this.box&&this.box.parentNode&&(r(this.box),this.box=null))},enumerable:!1,configurable:!0}),M.prototype.enableBox=function(t){this.hasBox=t=void 0===t?!0:t},M.prototype.handleOptions=function(){this.options=i(this.options,this.ewColorPicker.options)},M.prototype.run=function(){this.render()},M.prototype.updateChildren=function(){var t;this.box&&(t=this.ewColorPicker.currentColor,this.hasColor=!!t,this.box.replaceChildren((t=jt(this.hasColor,this.options),document.createRange().createContextualFragment(t))))},M.prototype.destroy=function(){this.box&&(this.unbindHandler(),r(this.box),this.box=null)},M.prototype.update=function(t){void 0===t&&(t=["defaultColor","size","disabled","readonly","className","style"]),this.box?(t.includes("defaultColor")&&(this.updateChildren(),this.setBoxBgColor(this.ewColorPicker.currentColor)),t.includes("size")&&this.setBoxSize(),(t.includes("disabled")||t.includes("readonly")||t.includes("className")||t.includes("style"))&&this.setBoxState()):this.render()},M.prototype.render=function(){var t,o=this.options,e=o.className,o=o.style;this.hasBox&&((t=this.ewColorPicker.getMountPoint("root"))?(this.box=f(".".concat(this.prefix,"color-picker-box"),t),this.box||(this.box=l("div"),c(this.box,"".concat(this.prefix,"color-picker-box")),e&&c(this.box,e),o&&u(this.box,o),g(t,this.box)),this.updateChildren(),this.setBoxSize(),this.setBoxBgColor(this.ewColorPicker.currentColor),this.setBoxState(),this.bindHandler()):h("[ewColorPicker] Root mount point not found"))},M.prototype.setBoxSize=function(){var t,o;this.box&&(t=this.options.size,t=(t=t)?st(t)?{width:t.width?rt(t.width)?"".concat(t.width,"px"):t.width:void 0,height:o=t.height?rt(t.height)?"".concat(t.height,"px"):t.height:void 0,lineHeight:o}:t?(o=void 0,{width:o=rt(t)?"".concat(t,"px"):"string"==typeof t?Ft[t]||t:"32px",height:o,lineHeight:o}):{}:{},0<Object.keys(t).length?u(this.box,t):tt(this.box,["width","height"]))},M.prototype.setBoxBgColor=function(t){var o,e;this.box&&(t&&""!==t.trim()?(o=(o=(o=t)&&m(o))&&(e=wt(o))?.5<.2126*(o=function(t){t=(t*e.a+255*(1-e.a))/255;return t<=.03928?t/12.92:Math.pow((.055+t)/1.055,2.4)})(e.r)+.7152*o(e.g)+.0722*o(e.b)?"#333333":"#ffffff":null,u(this.box,n({backgroundColor:t,transition:"background-color 0.3s"},o?{color:o}:{}))):this.clearBoxBgColor())},M.prototype.clearBoxBgColor=function(){this.box&&tt(this.box,["background-color","transition","color"])},M.prototype.setBoxState=function(){var t,o,e;this.box&&(t=(e=this.options).disabled,o=e.readonly,e=e.className,(t?c:a)(this.box,"is-disabled"),(o?c:a)(this.box,"is-readonly"),e)&&c(this.box,e)},M.prototype.bindHandler=function(){var t,o,e,i,n,r,s,a,l,h=this;this.box&&(t=this.options,o=t.onClick,e=t.onMouseEnter,i=t.onMouseLeave,n=t.disabled,r=t.readonly,s=t.togglePickerAnimation,a=t.pickerAnimationTime,v(this.box,"click",l=function(t){n||r?(t.preventDefault(),t.stopPropagation()):(h.ewColorPicker.pickerFlag?h.ewColorPicker.hidePanel(s,a):h.ewColorPicker.showPanel(s,a),null!=o&&o(h))}),this._handlers.push(function(){return P(h.box,"click",l)}),this.bindMouseEvents(e,i))},M.prototype.setDisabled=function(t){this.box&&(t?c:a)(this.box,"is-disabled")},M.prototype.bindMouseEvents=function(t,o){var e,i,n=this;this.box&&(t&&(v(this.box,"mouseenter",e=function(){return t(n)}),this._handlers.push(function(){return P(n.box,"mouseenter",e)})),o)&&(v(this.box,"mouseleave",i=function(){return o(n)}),this._handlers.push(function(){return P(n.box,"mouseleave",i)}))},M.prototype.unbindHandler=function(){this._handlers.forEach(function(t){return t()}),this._handlers=[]},M.pluginName="ewColorPickerBox",M);function M(t){var o=this;this.ewColorPicker=t,this.options={},this._handlers=[],this._hasBox=!0,this.box=null,this.hasColor=!1,this.handleOptions(),!1===this.options.hasBox&&(this._hasBox=!1),this.ewColorPicker.on&&"function"==typeof this.ewColorPicker.on&&this.ewColorPicker.on("change",function(t){o.setBoxBgColor(t)}),this.run()}Object.defineProperty(H.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),H.prototype.handleOptions=function(){var t;K(null==(t=this.ewColorPicker)?void 0:t.options)&&(this.options=i(this.options,this.ewColorPicker.options),this.isHueHorizontal="horizontal"===this.options.hueDirection,this.isAlphaHorizontal="horizontal"===this.options.alphaDirection)},H.prototype.run=function(){var t=this;!1!==this.options.ewColorPickerPanel&&!1!==this.options.hasPanel&&(this.render(),this.movePanelContainer(),setTimeout(function(){t.bindEvents()},10))},H.prototype.render=function(){var t,o,e,i=this;this.ewColorPicker&&(o=this.ewColorPicker.getMountPoint("panelContainer"))&&(t=f(".".concat(this.prefix,"color-picker-panel"),o),e=285,this.isAlphaHorizontal&&this.isHueHorizontal?e=320:(this.isAlphaHorizontal&&!this.isHueHorizontal||!this.isAlphaHorizontal&&this.isHueHorizontal)&&(e=302),this.panel=l("div"),c(this.panel,"".concat(this.prefix,"color-picker-panel")),c(this.panel,"".concat(this.prefix,"color-picker-panel-dynamic-size")),this.panelWidth=e,this.panelHeight=180,u(this.panel,{"--panel-width":e+"px","--panel-height":this.panelHeight+"px"}),g(o,this.panel,t),this.whitePanel=l("div"),c(this.whitePanel,"".concat(this.prefix,"color-picker-white-panel")),g(this.panel,this.whitePanel),this.blackPanel=l("div"),c(this.blackPanel,"".concat(this.prefix,"color-picker-black-panel")),g(this.panel,this.blackPanel),this.cursor=l("div"),c(this.cursor,"".concat(this.prefix,"color-picker-panel-cursor")),g(this.panel,this.cursor),e=l("div"),c(e,"".concat(this.prefix,"color-picker-bottom-row")),g(o,e),setTimeout(function(){var t;i.calculateContainerSize(),C(null==(t=i.ewColorPicker)?void 0:t.getMountPoint)&&i.handleAutoPosition()},0),this.updateHueBg(),C(null==(t=this.ewColorPicker)?void 0:t.getColor)&&(o=this.ewColorPicker.getColor())?(e=w(o),this.updateCursorPosition(e.s,e.v)):this.updateCursorPosition(100,100))},H.prototype.bindEvents=function(){var o=this;this.panel&&(v(this.panel,"click",function(t){return o.handlePanelClick(t)}),v(this.panel,"mousedown",function(){return o.handlePanelMouseDown()}),v(this.panel,"touchstart",function(t){return o.handlePanelTouchStart(t)}))},H.prototype.handlePanelTouchStart=function(t){var o,e,i=this;this.panel&&!this.options.disabled&&(t.preventDefault(),this.isDragging=!0,o=function(t){i.isDragging&&0<t.touches.length&&i.handlePanelTouchMove(t)},e=function(){i.isDragging=!1,P(document,"touchmove",o),P(document,"touchend",e)},v(document,"touchmove",o),v(document,"touchend",e))},H.prototype.handlePanelTouchMove=function(t){var o,e;this.panel&&this.cursor&&(this.options.disabled||(t.preventDefault(),0<t.touches.length&&(this.panelWidth=this.panel.offsetWidth,this.panelHeight=this.panel.offsetHeight,t=t.touches[0],o=b(this.panel),e=t.clientX-o.left,t=t.clientY-o.top,o=Math.max(0,Math.min(100,e/this.panelWidth*100)),e=Math.max(0,Math.min(100,100*(1-t/this.panelHeight))),this.throttledUpdate(o,e))))},H.prototype.handlePanelClick=function(t){var o,e;this.panel&&this.cursor&&(this.options.disabled?(t.preventDefault(),t.stopPropagation()):(this.panelWidth=this.panel.offsetWidth,this.panelHeight=this.panel.offsetHeight,o=b(this.panel),e=t.clientX-o.left,t=t.clientY-o.top,o=Math.max(0,Math.min(100,e/this.panelWidth*100)),e=Math.max(0,Math.min(100,100*(1-t/this.panelHeight))),this.updateCursorPosition(o,e),this.updateColor(o,e)))},H.prototype.handlePanelMouseDown=function(){var t,o,e=this;this.panel&&!this.options.disabled&&(this.isDragging=!0,t=function(t){e.isDragging&&e.handlePanelDrag(t)},o=function(){e.isDragging=!1,P(document,"mousemove",t),P(document,"mouseup",o)},v(document,"mousemove",t),v(document,"mouseup",o))},H.prototype.handlePanelDrag=function(t){var o,e;this.panel&&this.cursor&&(this.options.disabled||(t.preventDefault(),this.panelWidth=this.panel.offsetWidth,this.panelHeight=this.panel.offsetHeight,o=b(this.panel),e=t.clientX-o.left,t=t.clientY-o.top,o=Math.max(0,Math.min(100,e/this.panelWidth*100)),e=Math.max(0,Math.min(100,100*(1-t/this.panelHeight))),this.throttledUpdate(o,e)))},H.prototype.updateCursorPosition=function(t,o){var e,i,n;this.cursor&&this.panel&&(e=p(this.panel,"display"),i=p(this.panel,"visibility"),"none"!==e)&&"hidden"!==i&&(e=this.panel.offsetWidth,i=this.panel.offsetHeight,0!==e&&0!==i||(e=(n=b(this.panel)).width||this.panelWidth||285,i=n.height||this.panelHeight||180,0!==e&&0!==i)||(e=285,i=180),this.panelWidth=e,this.panelHeight=i,e={x:(n=ht(this.cursor)).offsetWidth/2,y:n.offsetHeight/2},0!==n.offsetWidth&&0!==n.offsetHeight||(e.x=2,e.y=2),i=t/100*this.panelWidth,n=(1-o/100)*this.panelHeight,i=Math.max(e.x,Math.min(i,this.panelWidth-e.x)),n=Math.max(e.y,Math.min(n,this.panelHeight-e.y)),u(this.cursor,{left:"".concat(i,"px"),top:"".concat(n,"px")}))},H.prototype.updateColor=function(t,o){var e=this.options.alpha?"rgba(255,0,0,1)":"#ff0000",i=this.ewColorPicker.getColor(),e=(i&&-1===i.indexOf("NaN")||this.ewColorPicker.setColor(i=e),w(i)),i=(e.s=t,e.v=o,Ct(e));this.ewColorPicker.setColor(i),C(this.ewColorPicker.options.changeColor)&&this.ewColorPicker.options.changeColor(i),this.ewColorPicker.trigger("change",i)},H.prototype.updateHueBg=function(t){if(this.panel){if(void 0===(t=t)){var o=this.ewColorPicker.getColor();if(!o)return;t=w(o).h}o=Ct({h:t,s:100,v:100,a:1});u(this.panel,{background:o})}},H.prototype.calculateContainerSize=function(){var t,o,e,i,n,r,s=this.ewColorPicker.getMountPoint("panelContainer");s&&(n=s.offsetWidth,r=s.offsetHeight,0!==n&&0!==r||(t=s.style.display,o=s.style.visibility,e=s.style.position,u(s,{display:"block",visibility:"hidden",position:"absolute",left:"-9999px",top:"-9999px"}),s.offsetHeight,i=b(s),n=s.offsetWidth||i.width,r=s.offsetHeight||i.height,u(s,{display:t,visibility:o,position:e,left:"",top:""})),this.containerWidth=n||320,this.containerHeight=r||200)},H.prototype.handleAutoPosition=function(){var t,o,e,i,n;this.isPanelAppended?this.updateAppendedPanelPosition():(t=(n=(null==(n=this.ewColorPicker)?void 0:n.options)||{}).autoPanelPosition,o=n.panelPlacement,t&&n.ewColorPickerBox&&(t=this.ewColorPicker.getMountPoint("root"),n=f(".".concat(this.prefix,"color-picker-box"),t),t)&&n&&(this.calculateContainerSize(),i=(n=ht(n)).offsetWidth,n=n.offsetHeight,e=(o=(o||"bottom").split("-"))[0],e=(o=this.calculatePosition(void 0===e?"bottom":e,void 0===(e=o[1])?"center":e,i,n)).left,i=this.adjustForViewport(t,e,o.top),n=this.ewColorPicker.getMountPoint("panelContainer"))&&u(n,{position:"absolute",left:"".concat(i.left,"px"),top:"".concat(i.top,"px")}))},H.prototype.movePanelContainer=function(){var t,o=this.options.appendTo;o&&(t=this.ewColorPicker.getMountPoint("panelContainer"))&&(g(ot(o),t),this.isPanelAppended=!0,this.calculateContainerSize(),v(window,"scroll",this.handleReposition,{capture:!0}),v(window,"resize",this.handleReposition),this.updateAppendedPanelPosition())},H.prototype.updateAppendedPanelPosition=function(){var t,o,e,i,n,r;this.isPanelAppended&&(t=this.ewColorPicker.getMountPoint("panelContainer"),o=this.ewColorPicker.getMountPoint("root"),t)&&o&&(n=(r=ht(f(".".concat(this.prefix,"color-picker-box"),o)||o)).offsetWidth,r=r.offsetHeight,i=(e=(this.options.panelPlacement||"bottom").split("-"))[0],i=(e=this.calculatePosition(void 0===i?"bottom":i,void 0===(i=e[1])?"center":i,n,r)).left,n=this.adjustForViewport(o,i,e.top),r=b(o),u(t,{position:"fixed",left:"".concat(r.left+n.left,"px"),top:"".concat(r.top+n.top,"px")}))},H.prototype.calculatePosition=function(t,o,e,i){e={top:{left:"start"===o?-this.containerWidth:"end"===o?e:(e-this.containerWidth)/2,top:-this.containerHeight-i/2},bottom:{left:"start"===o?-this.containerWidth:"end"===o?e:(e-this.containerWidth)/2,top:i},left:{left:-this.containerWidth-5,top:"start"===o?-this.containerHeight-i/2:"end"===o?i:(i-this.containerHeight)/2},right:{left:e+5,top:"start"===o?-this.containerHeight-i/2:"end"===o?i:(i-this.containerHeight)/2}};return e[t]||e.bottom},H.prototype.adjustForViewport=function(t,o,e){var t=b(t),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,r=8-(t.left+o),s=8-(t.top+e),i=t.left+o+this.containerWidth-(i-8),t=t.top+e+this.containerHeight-(n-8);return 0<r&&(o+=r),0<i&&(o-=i),0<s&&(e+=s),0<t&&(e-=t),{left:o,top:e}},H.prototype.destroy=function(){var t;this.panel&&(P(this.panel,"click",this.handlePanelClick),P(this.panel,"mousedown",this.handlePanelMouseDown)),P(window,"scroll",this.handleReposition,{capture:!0}),P(window,"resize",this.handleReposition),C(null==(t=this.ewColorPicker)?void 0:t.off)&&this.ewColorPicker.off("toggle",this.handleToggle),this.panel=null,this.cursor=null,this.whitePanel=null,this.blackPanel=null,this.hueBar=null,this.hueThumb=null,this.alphaBar=null,this.alphaThumb=null,this.hueBg=null},H.prototype.install=function(t){var o=this;this.ewColorPicker=t,this.handleOptions(),C(null==t?void 0:t.on)&&t.on("change",function(t){t=w(t);o.updateCursorPosition(t.s,t.v)}),null!=(t=this.run)&&t.call(this)},H.pluginName="ewColorPickerPanel",H.applyOrder="post";t=H;function H(t){var i=this;this.ewColorPicker=t,this.options={},this.panel=null,this.cursor=null,this.whitePanel=null,this.blackPanel=null,this.hueBar=null,this.hueThumb=null,this.alphaBar=null,this.alphaThumb=null,this.hueBg=null,this.isHueHorizontal=!1,this.isAlphaHorizontal=!1,this.isDragging=!1,this.isPanelAppended=!1,this.handleToggle=function(t){i.isPanelAppended&&t&&i.updateAppendedPanelPosition()},this.handleReposition=function(){i.isPanelAppended&&i.updateAppendedPanelPosition()},this.lastUpdateTime=0,this.throttleDelay=16,this.throttledUpdate=function(t,o){var e=Date.now();e-i.lastUpdateTime>=i.throttleDelay&&(i.lastUpdateTime=e,isNaN(t)||isNaN(o)||t<0||100<t||o<0||100<o||(i.updateCursorPosition(t,o),i.updateColor(t,o)))},this.handleOptions(),C(null==(t=this.ewColorPicker)?void 0:t.on)&&(this.ewColorPicker.on("change",function(t){t&&i.panel&&(t=w(t),i.updateHueBg(t.h),i.updateCursorPosition(t.s,t.v))}),this.ewColorPicker.on("toggle",this.handleToggle)),this.run()}Object.defineProperty(O.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"hasHue",{get:function(){return this._hasHue},set:function(t){this._hasHue!==t&&((this._hasHue=t)?this.render():this.hueBar&&this.hueBar.parentNode&&(this.hueBar.parentNode.removeChild(this.hueBar),this.hueBar=null))},enumerable:!1,configurable:!0}),O.prototype.enableHue=function(t){this.hasHue=t=void 0===t?!0:t},O.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i(this.options,this.ewColorPicker.options),this.isHorizontal="horizontal"===this.options.hueDirection)},O.prototype.run=function(){var t=this;this.hasHue&&this.render(),setTimeout(function(){t.bindEvents()},10)},O.prototype.render=function(){var t,o,e,i=this.ewColorPicker.getMountPoint("panelContainer");i?(o=this.prefix,(t=f(".".concat(o,"color-picker-slider.").concat(o,"color-picker-is-vertical, .").concat(o,"color-picker-slider.").concat(o,"color-picker-is-horizontal"),i))&&r(t),t=l("div"),c(t,"".concat(o,"color-picker-slider ")+(this.isHorizontal?"".concat(o,"color-picker-is-horizontal"):"".concat(o,"color-picker-is-vertical"))),this.hueBar=l("div"),c(this.hueBar,"".concat(o,"color-picker-slider-bar")),this.hueThumb=l("div"),c(this.hueThumb,"".concat(o,"color-picker-slider-thumb")),g(this.hueBar,this.hueThumb),g(t,this.hueBar),this.isHorizontal?(e=f(".".concat(o,"color-picker-bottom-row"),i))&&e.parentNode?e.parentNode.insertBefore(t,e):g(i,t):(e=f(".".concat(o,"color-picker-panel"),i))&&e.parentNode?e.parentNode.insertBefore(t,e.nextSibling):g(i,t),(o=this.ewColorPicker.getColor())&&(e=w(o),this.updateHueThumbPosition(e.h))):h("[ewColorPicker] Panel container not found")},O.prototype.bindEvents=function(){this.hueBar&&(v(this.hueBar,"click",this.handleHueSliderClick.bind(this)),v(this.hueBar,"mousedown",this.handleHueSliderMouseDown.bind(this)))},O.prototype.handleHueSliderClick=function(t){var o,e;this.hueBar&&(this.options.disabled?(t.preventDefault(),t.stopPropagation()):(o=b(this.hueBar),t=this.isHorizontal?(e=t.clientX-o.left,Math.max(0,Math.min(360,e/o.width*360))):(e=t.clientY-o.top,Math.max(0,Math.min(360,360*(1-e/o.height)))),this.updateHue(t)))},O.prototype.handleHueSliderMouseDown=function(t){var i,n,o,e,r=this;this.hueBar&&!this.options.disabled&&(i=this.hueBar,n=this.isHorizontal,o=function(t){var o,e=b(i);t=n?(o=t.clientX-e.left,Math.max(0,Math.min(360,o/e.width*360))):(o=t.clientY-e.top,Math.max(0,Math.min(360,360*(1-o/e.height)))),r.throttledUpdateHue(t)},e=function(){P(document,"mousemove",o),P(document,"mouseup",e)},v(document,"mousemove",o),v(document,"mouseup",e))},O.prototype.updateHue=function(t){var o=this.ewColorPicker.getColor(),t=Math.max(0,Math.min(360,t)),o=o?w(o):{h:t,s:100,v:100,a:1},o=(isNaN(o.h)||isNaN(o.s)||isNaN(o.v)||isNaN(o.a)?(o.h=t,o.s=100,o.v=100,o.a=1):o.h=t,Ct(o)),o=(o&&!o.includes("NaN")?this.ewColorPicker.setColor(o):(o=this.ewColorPicker.options.alpha?"rgba(255, 0, 0, 1)":"#ff0000",this.ewColorPicker.setColor(o)),this.updateHueThumbPosition(t),null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerPanel);o&&C(o.updateHueBg)&&o.updateHueBg(t)},O.prototype.updateHueThumbPosition=function(t){var o,e;this.hueThumb&&this.hueBar&&(e=this.isHorizontal,o=b(this.hueBar),e?(e=Math.max(0,Math.min(o.width,t/360*o.width)),u(this.hueThumb,"left","".concat(e,"px")),u(this.hueThumb,"top","0px")):(e=Math.max(0,Math.min(o.height,(1-t/360)*o.height)),u(this.hueThumb,"top","".concat(e,"px")),u(this.hueThumb,"left","0px")))},O.prototype.destroy=function(){this.hueBar&&(P(this.hueBar,"click",this.handleHueSliderClick.bind(this)),P(this.hueBar,"mousedown",this.handleHueSliderMouseDown.bind(this))),this.hueBar=null,this.hueThumb=null},O.prototype.install=function(t){var o=this;this.ewColorPicker=t,this.handleOptions(),t.on&&"function"==typeof t.on&&t.on("change",function(t){t=w(t);o.updateHueThumbPosition(t.h)}),null!=(t=this.run)&&t.call(this)},O.pluginName="ewColorPickerHue",O.applyOrder="post";R=O;function O(t){var o=this;this.ewColorPicker=t,this.options={},this.hueBar=null,this.hueThumb=null,this.isHorizontal=!1,this._hasHue=!0,this.handleOptions(),!1===this.options.hue&&(this._hasHue=!1),this.throttledUpdateHue=Bt(this.updateHue.bind(this),16),this.ewColorPicker.on&&"function"==typeof this.ewColorPicker.on&&this.ewColorPicker.on("change",function(t){t&&o.hueThumb&&(t=w(t),o.updateHueThumbPosition(t.h))}),this.run()}Object.defineProperty(T.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(t){this._hasAlpha!==t&&((this._hasAlpha=t)?this.render():this.alphaBar&&this.alphaBar.parentNode&&(this.alphaBar.parentNode.removeChild(this.alphaBar),this.alphaBar=null))},enumerable:!1,configurable:!0}),T.prototype.enableAlpha=function(t){this.hasAlpha=t=void 0===t?!0:t},T.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i({},this.options,this.ewColorPicker.options),this.isHorizontal="horizontal"===this.options.alphaDirection)},T.prototype.run=function(){var t=this;this.hasAlpha&&this.render(),setTimeout(function(){t.bindEvents()},10)},T.prototype.render=function(){var t,o,e=this.ewColorPicker.getMountPoint("panelContainer");e?((t=f(".".concat(this.prefix,"color-picker-slider.ew-alpha"),e))&&r(t),t=l("div"),c(t,"".concat(this.prefix,"color-picker-slider ew-alpha ")+(this.isHorizontal?"".concat(this.prefix,"color-picker-is-horizontal"):"".concat(this.prefix,"color-picker-is-vertical"))),this.alphaBar=l("div"),c(this.alphaBar,"".concat(this.prefix,"color-picker-alpha-slider-bar")),o=l("div"),c(o,"".concat(this.prefix,"color-picker-alpha-slider-wrapper")),g(this.alphaBar,o),o=l("div"),c(o,"".concat(this.prefix,"color-picker-alpha-slider-bg")),g(this.alphaBar,o),this.alphaThumb=l("div"),c(this.alphaThumb,"".concat(this.prefix,"color-picker-alpha-slider-thumb")),g(this.alphaBar,this.alphaThumb),g(t,this.alphaBar),this.isHorizontal?(o=f(".".concat(this.prefix,"color-picker-bottom-row"),e))&&o.parentNode?o.parentNode.insertBefore(t,o):g(e,t):(o=f(".".concat(this.prefix,"color-picker-panel"),e))&&o.parentNode?o.parentNode.insertBefore(t,o.nextSibling):g(e,t),(o=this.ewColorPicker.getColor())&&(e=w(o),this.updateAlphaThumbPosition(e.a))):h("[ewColorPicker] Panel container not found, please check the ewColorPicker instance!")},T.prototype.bindEvents=function(){var o=this;this.alphaBar&&(v(this.alphaBar,"click",function(t){o.handleAlphaSliderClick(t)}),v(this.alphaBar,"mousedown",function(t){o.handleAlphaSliderMouseDown(t)}))},T.prototype.handleAlphaSliderClick=function(t){var o,e;this.alphaBar&&(this.options.disabled?(t.preventDefault(),t.stopPropagation()):(o=b(this.alphaBar),t=this.isHorizontal?(e=t.clientX-o.left,Math.max(0,Math.min(1,1-e/o.width))):(e=t.clientY-o.top,Math.max(0,Math.min(1,1-e/o.height))),this.updateAlpha(t)))},T.prototype.handleAlphaSliderMouseDown=function(t){var i,n,o,e,r=this;this.alphaBar&&!this.options.disabled&&(i=this.alphaBar,n=this.isHorizontal,o=function(t){var o,e=b(i);t=n?(o=t.clientX-e.left,Math.max(0,Math.min(1,1-o/e.width))):(o=t.clientY-e.top,Math.max(0,Math.min(1,1-o/e.height))),r.throttledUpdateAlpha(t)},e=function(){P(document,"mousemove",o),P(document,"mouseup",e)},v(document,"mousemove",o),v(document,"mouseup",e))},T.prototype.updateAlpha=function(t){var o=this.ewColorPicker.getColor();o&&((o=w(o)).a=t,o=Ct(o),this.ewColorPicker.setColor(o),this.updateAlphaThumbPosition(t),t=null==(t=this.ewColorPicker.plugins)?void 0:t.ewColorPickerColorMode)&&"hex"!==t.currentMode&&t.updateInputValues(o)},T.prototype.updateAlphaThumbPosition=function(t){var o,e;this.alphaThumb&&this.alphaBar&&(e=this.isHorizontal,o=b(this.alphaBar),e?(e=Math.max(0,Math.min(o.width,(1-t)*o.width)),u(this.alphaThumb,"left","".concat(e,"px")),u(this.alphaThumb,"top","0px")):(e=Math.max(0,Math.min(o.height,(1-t)*o.height)),u(this.alphaThumb,"top","".concat(e,"px")),u(this.alphaThumb,"left","0px")))},T.prototype.destroy=function(){this.alphaBar&&(P(this.alphaBar,"click",this.handleAlphaSliderClick.bind(this)),P(this.alphaBar,"mousedown",this.handleAlphaSliderMouseDown.bind(this)),r(this.alphaBar)),this.alphaBar=null,this.alphaThumb=null},T.prototype.install=function(t){var o=this;this.ewColorPicker=t,this.handleOptions(),C(t.on)&&t.on("change",function(t){t=w(t);o.updateAlphaThumbPosition(t.a)}),null!=(t=this.run)&&t.call(this)},T.pluginName="ewColorPickerAlpha",T.applyOrder="post";var Ut=T;function T(t){var o=this;this.ewColorPicker=t,this.options={},this.alphaBar=null,this.alphaThumb=null,this.isHorizontal=!1,this._hasAlpha=!0,this.handleOptions(),!1===this.options.alpha&&(this._hasAlpha=!1),this.throttledUpdateAlpha=Bt(this.updateAlpha.bind(this),16),C(this.ewColorPicker.on)&&this.ewColorPicker.on("change",function(t){t=w(t);o.updateAlphaThumbPosition(t.a)}),this.run()}Object.defineProperty(A.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasInput",{get:function(){return this._hasInput},set:function(t){this._hasInput!==t&&((this._hasInput=t)?(this.render(),this.bindEvents()):this.input&&this.input.parentNode&&(r(this.input),this.input=null))},enumerable:!1,configurable:!0}),A.prototype.enableInput=function(t){this.hasInput=t=void 0===t?!0:t},A.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i(this.options,this.ewColorPicker.options))},A.prototype.updateOptions=function(){this.handleOptions(),this.hasInput?this.render():this.input&&this.input.parentNode&&(r(this.input),this.input=null)},A.prototype.run=function(){this.hasInput&&(this.render(),this.bindEvents())},A.prototype.render=function(){var t,o,e=this.ewColorPicker.getMountPoint("panelContainer");e?(e=f(".".concat(this.prefix,"color-picker-bottom-row"),e))?(o=f(".".concat(this.prefix,"color-picker-drop-btn-group"),e),(t=f(".".concat(this.prefix,"color-picker-input-container"),e))||(t=l("div"),c(t,"".concat(this.prefix,"color-picker-input-container")),c(t,"".concat(this.prefix,"color-picker-input-container-flex")),o&&o.parentNode?o.parentNode.insertBefore(t,o):g(e,t)),this.input=f("input.".concat(this.prefix,"color-picker-input"),t),this.input||(this.input=l("input"),this.input&&(c(this.input,"".concat(this.prefix,"color-picker-input")),d(this.input,{type:"text",name:"".concat(this.prefix,"color-picker-input"),placeholder:"请输入颜色值"}),g(t,this.input))),(o=this.ewColorPicker.getColor())&&-1===o.indexOf("NaN")||(o=this.getDefaultColor(),""===this.ewColorPicker.currentColor?o="":this.ewColorPicker.setColor(o)),e=this.formatColorForDisplay(o),this.input&&(this.input.value=e),this.options.disabled&&this.setDisabled(!0)):h("[ewColorPicker] Bottom row container not found"):h("[ewColorPicker] Panel container not found")},A.prototype.bindEvents=function(){var o=this;this.input&&(v(this.input,"blur",function(t){o.debouncedOnInputColor(t.target.value)}),v(this.input,"keydown",function(t){"Enter"===t.key&&o.debouncedOnInputColor(t.target.value)}),this.ewColorPicker.on("change",function(t){o.update(t)}))},A.prototype.onInputColor=function(t){var o,e,i;t.trim()&&(vt(t)?(i=m(t),this.ewColorPicker.hsvaColor=w(i),this.ewColorPicker.setColor(i),this.syncOtherPlugins(i),C(this.options.changeColor)&&null!=(e=(o=this.options).changeColor)&&e.call(o,i)):h("[ewColorPicker warning]: Invalid color format: ".concat(t)))},A.prototype.syncOtherPlugins=function(t){var o=this.ewColorPicker.hsvaColor,e=null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerColorMode,e=(e&&"hex"!==e.currentMode&&e.updateInputValues(t),null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerHue),e=(e&&e.updateHueThumbPosition&&e.updateHueThumbPosition(o.h),null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerAlpha),o=(e&&e.updateAlphaThumbPosition&&e.updateAlphaThumbPosition(o.a),null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerPanel),o=(o&&o.updatePanelColor&&o.updatePanelColor(t),null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerBox);o&&o.setBoxBgColor&&o.setBoxBgColor(t)},A.prototype.setValue=function(t){this.input&&(this.input.value=t)},A.prototype.getValue=function(){return this.input?this.input.value:""},A.prototype.setDisabled=function(t){this.input&&(t?(this.input.disabled=!0,s(this.input,"".concat(this.prefix,"input-disabled"))||c(this.input,"".concat(this.prefix,"input-disabled"))):(this.input.disabled=!1,s(this.input,"".concat(this.prefix,"input-disabled"))&&a(this.input,"".concat(this.prefix,"input-disabled"))))},A.prototype.update=function(t){t&&-1===t.indexOf("NaN")||(t=""===this.ewColorPicker.currentColor?"":this.getDefaultColor());t=this.formatColorForDisplay(t);this.setValue(t)},A.prototype.getDefaultColor=function(){var t;return this.hasAlpha?"rgba(255,0,0,1)":null!=(t=this.ewColorPicker.plugins)&&t.ewColorPickerColorMode?"HSL"===(t=this.ewColorPicker.currentMode||"HSV")?"hsl(0, 100%, 50%)":"RGB"===t?"rgba(255,0,0,1)":"#ff0000":"#ff0000"},A.prototype.formatColorForDisplay=function(t){var o,e;return t?(e=t,!(null==(o=this.ewColorPicker.plugins)||!o.ewColorPickerColorMode)&&(o=this.ewColorPicker.plugins.ewColorPickerColorMode)&&"hex"===o.getCurrentMode()?e&&!e.startsWith("#")&&(o=m(e))&&(o=wt(o))&&(e=Pt(o)):this.hasAlpha&&!t.startsWith("rgba")?e=Ct(w(t)):!this.hasAlpha&&t.startsWith("rgba")&&(e=gt(t)),e):""},A.prototype.destroy=function(){this.input&&(P(this.input,"blur",this.debouncedOnInputColor),P(this.input,"keydown",this.debouncedOnInputColor)),this.input=null},A.prototype.install=function(t){var o=this;this.ewColorPicker=t,this.handleOptions(),C(null==t?void 0:t.on)&&t.on("change",function(t){o.update(t)}),null!=(t=this.run)&&t.call(this)},A.pluginName="ewColorPickerInput",A.applyOrder="post";var $t=A;function A(t){this.ewColorPicker=t,this.options={},this.input=null,this._hasInput=!0,this.handleOptions(),!1===this.options.hasInput&&(this._hasInput=!1),this.debouncedOnInputColor=e(this.onInputColor.bind(this),300),this.run(),this.hasAlpha=!!this.ewColorPicker.plugins.ewColorPickerAlpha}Object.defineProperty(D.prototype,"prefix",{get:function(){return this.options.prefix||y},enumerable:!1,configurable:!0}),D.prototype.createElements=function(){var t=this.prefix,o=(this.container=l("div"),c(this.container,"".concat(t,"input-number")),c(this.container,"".concat(t,"input-number--").concat(this.options.size)),this.input=l("input"),c(this.input,"".concat(t,"input-number__input")),d(this.input,{type:"text",inputmode:"decimal",placeholder:this.options.placeholder}),l("div"));c(o,"".concat(t,"input-number__buttons")),this.upButton=l("button"),c(this.upButton,"".concat(t,"input-number__button")),c(this.upButton,"".concat(t,"input-number__button--up")),d(this.upButton,{type:"button"}),this.upButton.innerHTML=Mt(void 0,void 0,t),this.downButton=l("button"),c(this.downButton,"".concat(t,"input-number__button")),c(this.downButton,"".concat(t,"input-number__button--down")),d(this.downButton,{type:"button"}),this.downButton.innerHTML=Ht(void 0,void 0,t),g(o,this.upButton),g(o,this.downButton),g(this.container,this.input),g(this.container,o),this.setStyles()},D.prototype.setStyles=function(){this.options.disabled&&this.setDisabled(!0)},D.prototype.bindEvents=function(){v(this.input,"input",this.handleInput.bind(this)),v(this.input,"blur",this.handleBlur.bind(this)),v(this.input,"focus",this.handleFocus.bind(this)),v(this.input,"keydown",this.handleKeydown.bind(this)),v(this.upButton,"click",this.handleUpClick.bind(this)),v(this.downButton,"click",this.handleDownClick.bind(this)),v(this.container,"wheel",this.handleWheel.bind(this))},D.prototype.handleInput=function(t){var t=t.target.value;""!==t&&"-"!==t&&"."!==t&&(t=parseFloat(t),isNaN(t)?this.input.value=this.currentValue.toString():this.currentValue=t)},D.prototype.handleBlur=function(t){this.isFocused=!1,this.removeClass(this.container,"".concat(this.prefix,"input-number--focused")),this.updateValue(this.currentValue,!1),this.options.onBlur(this.currentValue)},D.prototype.handleFocus=function(t){this.isFocused=!0,this.addClass(this.container,"".concat(this.prefix,"input-number--focused")),this.options.onFocus(t)},D.prototype.handleKeydown=function(t){switch(t.key){case"ArrowUp":t.preventDefault(),this.increment();break;case"ArrowDown":t.preventDefault(),this.decrement();break;case"Enter":t.preventDefault(),this.input.blur()}},D.prototype.handleUpClick=function(){this.options.disabled||this.increment()},D.prototype.handleDownClick=function(){this.options.disabled||this.decrement()},D.prototype.handleWheel=function(t){this.isFocused&&!this.options.disabled&&(t.preventDefault(),t.deltaY<0?this.increment():this.decrement())},D.prototype.increment=function(){var t=this.currentValue+this.options.step;this.updateValue(t)},D.prototype.decrement=function(){var t=this.currentValue-this.options.step;this.updateValue(t)},D.prototype.updateValue=function(t,o){void 0===o&&(o=!0);var e=this.options.min,i=this.options.max,e=(t<e?t=e:i<t&&(t=i),this.options.precision);t=Math.round(t*Math.pow(10,e))/Math.pow(10,e),this.currentValue=t,this.formatDisplayValue(),o&&this.debouncedOnChange(t)},D.prototype.formatDisplayValue=function(){var t=this.options.precision;this.input.value=this.currentValue.toFixed(t)},D.prototype.addClass=function(t,o){s(t,o)||c(t,o)},D.prototype.removeClass=function(t,o){s(t,o)&&a(t,o)},D.prototype.getValue=function(){return this.currentValue},D.prototype.setValue=function(t){this.updateValue(t)},D.prototype.setDisabled=function(t){(this.options.disabled=t)?(this.addClass(this.container,"".concat(this.prefix,"input-number--disabled")),d(this.input,{disabled:"true"}),d(this.upButton,{disabled:"true"}),d(this.downButton,{disabled:"true"})):(this.removeClass(this.container,"".concat(this.prefix,"input-number--disabled")),d(this.input,{disabled:"false"}),d(this.upButton,{disabled:"false"}),d(this.downButton,{disabled:"false"}))},D.prototype.getElement=function(){return this.container},D.prototype.destroy=function(){var t;P(this.input,"input",this.handleInput.bind(this)),P(this.input,"blur",this.handleBlur.bind(this)),P(this.input,"focus",this.handleFocus.bind(this)),P(this.input,"keydown",this.handleKeydown.bind(this)),P(this.upButton,"click",this.handleUpClick.bind(this)),P(this.downButton,"click",this.handleDownClick.bind(this)),P(this.container,"wheel",this.handleWheel.bind(this)),null!=(t=this.container)&&t.parentNode&&r(this.container),this.container=null,this.input=null,this.upButton=null,this.downButton=null},D.prototype.install=function(t){var o;this.ewColorPicker=t,null!=(o=this.handleOptions)&&o.call(this),!1!==(null==(o=this.ewColorPicker.options)?void 0:o.showInputNumber)&&(C(t.on)&&t.on("change",function(){}),null!=(o=this.run))&&o.call(this)};var Rt=D;function D(t){void 0===t&&(t={});var o={value:0,min:-1/0,max:1/0,step:1,precision:0,disabled:this.isFocused=!1,placeholder:"",size:"default",prefix:y,onChange:function(){},onBlur:function(){},onFocus:function(){}};this.options=i(o,t),this.currentValue=null!=(o=this.options.value)?o:0,this.debouncedOnChange=e(this.options.onChange,300),this.createElements(),this.bindEvents(),this.updateValue(this.currentValue,!1)}I.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),this.run()},I.prototype.updateOptions=function(){var o=this;this.handleOptions(),this.instances.forEach(function(t){X(o.options.disabled)||t.setDisabled(o.options.disabled)})},I.prototype.run=function(){var t,o,e;this.ewColorPicker&&(t=k(this.ewColorPicker),o=this.createInputNumber({value:0,disabled:this.options.disabled||!1,prefix:t}),this.instances.set("default",o),e=this.ewColorPicker.getMountPoint("panelContainer"))&&(e=e.querySelector(".".concat(t,"color-picker-bottom-row")))&&e.appendChild(o.getElement())},I.prototype.handleOptions=function(){var t=null==(t=this.ewColorPicker)?void 0:t.options;t&&(this.options=n(n(n({},this.options),t),{disabled:X(t.disabled)?this.options.disabled||!1:t.disabled}))},I.prototype.createInputNumber=function(t){return new Rt(t)},I.prototype.destroy=function(){this.instances.forEach(function(t){t.destroy()}),this.instances.clear(),this.ewColorPicker=null},I.pluginName="ewColorPickerInputNumber",I.applyOrder="post";var qt=I;function I(t){this.options={},this.instances=new Map,this.ewColorPicker=t,this.handleOptions()}Object.defineProperty(E.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"hasClear",{get:function(){return this._hasClear},set:function(t){this._hasClear!==t&&(this._hasClear=t,this.render())},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"hasSure",{get:function(){return this._hasSure},set:function(t){this._hasSure!==t&&(this._hasSure=t,this.render())},enumerable:!1,configurable:!0}),E.prototype.enableClear=function(t){this.hasClear=t=void 0===t?!0:t},E.prototype.enableSure=function(t){this.hasSure=t=void 0===t?!0:t},E.prototype.enableButtons=function(t){this.hasClear=t=void 0===t?!0:t,this.hasSure=t},E.prototype.handleOptions=function(){this.options=i({},this.options,this.ewColorPicker.options)},E.prototype.updateOptions=function(){var t=this;this.handleOptions(),setTimeout(function(){t.render()},0)},E.prototype.run=function(){var t=this;!1!==this.options.showButton&&(this.render(),this.bindEvents(),setTimeout(function(){t.adjustButtonGroupStyle()},0))},E.prototype.render=function(){var t,o=this.ewColorPicker.getMountPoint("panelContainer");o?(o=f(".".concat(this.prefix,"color-picker-bottom-row"),o))?((t=f(".".concat(this.prefix,"color-picker-drop-btn-group"),o))||(t=l("div"),c(t,"".concat(this.prefix,"color-picker-drop-btn-group")),g(o,t)),t.textContent="",this.hasClear&&(this.clearButton=l("button"),c(this.clearButton,"".concat(this.prefix,"color-picker-clear-btn ").concat(this.prefix,"color-picker-drop-btn")),this.setClearText(this.options.clearText||"清空"),g(t,this.clearButton)),this.hasSure&&(this.sureButton=l("button"),c(this.sureButton,"".concat(this.prefix,"color-picker-sure-btn ").concat(this.prefix,"color-picker-drop-btn")),this.setSureText(this.options.sureText||"确认"),g(t,this.sureButton)),this.adjustButtonGroupStyle()):h("[ewColorPicker warning]: Bottom row container not found"):h("[ewColorPicker warning]: Panel container not found")},E.prototype.bindEvents=function(){var t=this;this.clearButton&&v(this.clearButton,"click",function(){t.debouncedOnClearColor()}),this.sureButton&&v(this.sureButton,"click",function(){t.debouncedOnSureColor()}),this.ewColorPicker.on("mode-change",function(){t.adjustButtonGroupStyle()})},E.prototype.onClearColor=function(){var t,o,e;this.ewColorPicker.options.defaultColor?(e=m(o=this.ewColorPicker.options.defaultColor))&&(t=w(e)):(o="",t=void 0),this.ewColorPicker.hsvaColor=t||{h:0,s:100,v:100,a:1},this.ewColorPicker.setColor(o),this.ewColorPicker.syncAllPlugins(o),this.ewColorPicker.hidePanel(),C(this.options.clear)&&null!=(t=(e=this.options).clear)&&t.call(e,this.ewColorPicker),this.ewColorPicker.trigger("clear")},E.prototype.onSureColor=function(){var t,o;C(this.options.sure)&&null!=(o=(t=this.options).sure)&&o.call(t,this.ewColorPicker.currentColor,this.ewColorPicker),this.ewColorPicker.trigger("sure",this.ewColorPicker.currentColor,this.ewColorPicker),this.ewColorPicker.hidePanel()},E.prototype.setClearText=function(t){this.clearButton&&(this.clearButton.textContent=t)},E.prototype.setSureText=function(t){this.sureButton&&(this.sureButton.textContent=t)},E.prototype.setDisabled=function(t){this.clearButton&&d(this.clearButton,{disabled:t.toString()}),this.sureButton&&d(this.sureButton,{disabled:t.toString()})},E.prototype.destroy=function(){this.clearButton&&P(this.clearButton,"click",this.debouncedOnClearColor),this.sureButton&&P(this.sureButton,"click",this.debouncedOnSureColor),this.clearButton=null,this.sureButton=null},E.prototype.adjustButtonGroupStyle=function(){var t,o,e=this.prefix,i=this.ewColorPicker.getMountPoint("panelContainer");i&&(t=f(".".concat(e,"color-picker-bottom-row"),i))&&(o=f(".".concat(e,"color-picker-drop-btn-group"),t))&&(null!==f(".".concat(e,"color-picker-inputs-group"),i)?(c(o,"".concat(e,"color-picker-drop-btn-group-multi")),a(o,"".concat(e,"color-picker-drop-btn-group-single")),c(t,"".concat(e,"color-picker-bottom-row-multi")),a(t,"".concat(e,"color-picker-bottom-row-single"))):(c(o,"".concat(e,"color-picker-drop-btn-group-single")),a(o,"".concat(e,"color-picker-drop-btn-group-multi")),c(t,"".concat(e,"color-picker-bottom-row-single")),a(t,"".concat(e,"color-picker-bottom-row-multi"))))},E.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),null!=(t=this.run)&&t.call(this)},E.pluginName="ewColorPickerButton",E.applyOrder="post";var Gt=E;function E(t){this.ewColorPicker=t,this.options={},this.clearButton=null,this.sureButton=null,this._hasClear=!0,this._hasSure=!0,this.handleOptions(),!1===this.options.hasClear&&(this._hasClear=!1),!1===this.options.hasSure&&(this._hasSure=!1),this.debouncedOnClearColor=e(this.onClearColor.bind(this),100),this.debouncedOnSureColor=e(this.onSureColor.bind(this),100),this.run()}Object.defineProperty(S.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),S.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i(this.options,this.ewColorPicker.options),this.ewColorPicker.options.ewColorPickerPredefine)&&(this.options=i(this.options,this.ewColorPicker.options.ewColorPickerPredefine))},S.prototype.run=function(){0<this.getValidPredefineColors().length&&(this.render(),this.bindEvents(),this.bindColorChangeEvent())},S.prototype.getValidPredefineColors=function(){var o=this;return this.options.predefineColor&&Array.isArray(this.options.predefineColor)?this.options.predefineColor.filter(function(t){var t=o.parseColorData(t).color;return!(!(t=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))}):[]},S.prototype.render=function(){var i=this,t=this.ewColorPicker.getMountPoint("panelContainer");t?(this.container=f(".".concat(this.prefix,"color-picker-predefine-container"),t),this.container||(this.container=l("div"),c(this.container,"".concat(this.prefix,"color-picker-predefine-container"))),this.container&&(this.container.textContent="",this.predefineItems=[],this.getValidPredefineColors().forEach(function(t){var t=i.parseColorData(t).color,o=l("div"),e=(c(o,"".concat(i.prefix,"color-picker-predefine-color")),l("div"));c(e,"".concat(i.prefix,"color-picker-predefine-color-item")),u(e,"backgroundColor",t),g(o,e),g(i.container,o),i.predefineItems.push(o)})),this.ensureContainerAtCorrectPosition(t),this.bindToggleEvent(t)):h("[ewColorPicker warning]: Panel container not found")},S.prototype.parseColorData=function(t){return{color:Y(t)?t:t.color,disabled:!!K(t)&&t.disabled}},S.prototype.bindToggleEvent=function(o){var e=this;this.isEventBound&&this.toggleHandler&&(this.ewColorPicker.off("toggle",this.toggleHandler),this.isEventBound=!1),this.toggleHandler=function(t){t&&e.ensureContainerAtCorrectPosition(o)},this.ewColorPicker.on("toggle",this.toggleHandler),this.isEventBound=!0},S.prototype.bindColorChangeEvent=function(){var o=this;this.changeHandler&&this.ewColorPicker.off("change",this.changeHandler),this.changeHandler=function(t){o.updateActivePredefineColor(t)},this.ewColorPicker.on("change",this.changeHandler)},S.prototype.ensureContainerAtCorrectPosition=function(t){var o,e;this.container&&(o=this.prefix,(e=f(".".concat(o,"color-picker-mode-container"),t))?t.insertBefore(this.container,e):(e=f(".".concat(o,"color-picker-bottom-row"),t))?t.insertBefore(this.container,e):(e=f(".".concat(o,"color-picker-panel"),t))&&e.nextSibling?t.insertBefore(this.container,e.nextSibling):t.appendChild(this.container))},S.prototype.bindEvents=function(){var i=this;this.predefineItems.forEach(function(t,o){var o=i.getValidPredefineColors()[o],o=i.parseColorData(o),e=o.color;o.disabled?c(t,"".concat(i.prefix,"color-picker-predefine-color-disabled")):(v(t,"click",function(t){i.debouncedOnPredefineColorClick(t,e)}),v(t,"blur",function(t){a(t.target,"".concat(i.prefix,"color-picker-predefine-color-active"))}))})},S.prototype.onPredefineColorClick=function(t,o){var e,i,n=this.prefix,r=t.target;s(r,"".concat(n,"color-picker-predefine-color"))||(r=r.closest(".".concat(n,"color-picker-predefine-color"))||r),s(r,"".concat(n,"color-picker-predefine-color-disabled"))||(this.options.disabled?(t.preventDefault(),t.stopPropagation()):(c(r,"".concat(n,"color-picker-predefine-color-active")),this.predefineItems.forEach(function(t){t!==r&&a(t,"".concat(n,"color-picker-predefine-color-active"))}),vt(o)?(t=m(o),this.ewColorPicker.hsvaColor=w(t),this.ewColorPicker.setColor(t),C(this.options.changeColor)&&null!=(i=(e=this.options).changeColor)&&i.call(e,t)):h("[ewColorPicker warning]: Invalid predefine color: ".concat(o))))},S.prototype.updatePredefineColors=function(t){this.options.predefineColor=t,this.predefineItems=[],this.render(),this.bindEvents()},S.prototype.setDisabled=function(t,o){this.predefineItems[t]&&(o?c:a)(this.predefineItems[t],"".concat(this.prefix,"color-picker-predefine-color-disabled"))},S.prototype.destroy=function(){var o=this;this.predefineItems.forEach(function(t){P(t,"click",o.debouncedOnPredefineColorClick),P(t,"blur",function(){})}),this.isEventBound&&this.toggleHandler&&(this.ewColorPicker.off("toggle",this.toggleHandler),this.toggleHandler=null,this.isEventBound=!1),this.changeHandler&&(this.ewColorPicker.off("change",this.changeHandler),this.changeHandler=null),this.predefineItems=[],this.container=null},S.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),null!=(t=this.run)&&t.call(this)},S.prototype.updateActivePredefineColor=function(t){var e,i,n=this;t&&(e=m(t),i=this.prefix,this.predefineItems.forEach(function(t,o){o=n.getValidPredefineColors()[o],o=m(n.parseColorData(o).color);(e===o?c:a)(t,"".concat(i,"color-picker-predefine-color-active"))}))},S.pluginName="ewColorPickerPredefine";var Xt=S;function S(t){this.ewColorPicker=t,this.options={},this.predefineItems=[],this.container=null,this.toggleHandler=null,this.changeHandler=null,this.isEventBound=!1,this.handleOptions(),this.debouncedOnPredefineColorClick=e(this.onPredefineColorClick.bind(this),100),this.run()}Object.defineProperty(N.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"hasAlphaPlugin",{get:function(){var t;return!(null==(t=this.ewColorPicker.plugins)||!t.ewColorPickerAlpha)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"inputPlugin",{get:function(){var t;return null==(t=this.ewColorPicker.plugins)?void 0:t.ewColorPickerInput},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"alphaPlugin",{get:function(){var t;return null==(t=this.ewColorPicker.plugins)?void 0:t.ewColorPickerAlpha},enumerable:!1,configurable:!0}),N.prototype.initializePlugin=function(){function t(){o.handleOptions(),o.run()}var o=this;this.ewColorPicker.plugins?t():setTimeout(t,0)},N.prototype.install=function(o){function t(){var t;e.handleOptions(),o.on&&C(o.on)&&o.on("change",function(t){"hex"!==e.currentMode&&e.updateInputValues(t)}),null!=(t=e.run)&&t.call(e),e.hasAlphaPlugin&&"rgb"===e.currentMode&&e.updateInputStructure()}var e=this;this.ewColorPicker=o;this.ewColorPicker.plugins?t():setTimeout(t,0)},N.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i({},this.options,this.ewColorPicker.options),void 0!==this.ewColorPicker.options.ewColorPickerColorMode&&(!1===this.ewColorPicker.options.ewColorPickerColorMode?this.options.showColorMode=!1:"object"==typeof this.ewColorPicker.options.ewColorPickerColorMode&&(this.options=i({},this.options,this.ewColorPicker.options.ewColorPickerColorMode))),this.hasAlphaPlugin?this.currentMode=this.options.defaultMode||"rgb":this.currentMode=this.options.defaultMode||"hex")},N.prototype.updateOptions=function(){this.handleOptions(),this.render()},N.prototype.run=function(){this.handleOptions(),!1!==this.options.showColorMode&&(this.render(),this.bindEvents(),this.hasAlphaPlugin&&"rgb"===this.currentMode&&this.updateInputStructure(),this.setupInputPluginListener())},N.prototype.render=function(){var t=this.ewColorPicker.getMountPoint("panelContainer");t?(this.modeContainer=f(".".concat(this.prefix,"color-picker-mode-container"),t),this.modeContainer||this.createModeContainer(t),this.updateModeDisplay()):h("[ewColorPicker] Panel container not found")},N.prototype.createModeContainer=function(t){var o=this.prefix,o=(this.modeContainer=l("div"),c(this.modeContainer,"".concat(o,"color-picker-mode-container")),this.upButton=l("button"),c(this.upButton,"".concat(o,"color-picker-mode-up-btn")),d(this.upButton,{type:"button",title:"上一个模式"}),this.upButton.innerHTML=Mt("",16,o),this.modeText=l("div"),c(this.modeText,"".concat(o,"color-picker-mode-text")),this.downButton=l("button"),c(this.downButton,"".concat(o,"color-picker-mode-down-btn")),d(this.downButton,{type:"button",title:"下一个模式"}),this.downButton.innerHTML=Ht("",16,o),g(this.modeContainer,this.upButton),g(this.modeContainer,this.modeText),g(this.modeContainer,this.downButton),f(".".concat(o,"color-picker-bottom-row"),t));o?g(t,this.modeContainer,void 0,o):g(t,this.modeContainer)},N.prototype.updateModeDisplay=function(){this.modeText&&(this.modeText.textContent=this.getModeDisplayName(this.currentMode))},N.prototype.bindEvents=function(){var t,o=this;this.upButton&&this.downButton&&(v(this.upButton,"click",t=function(){o.options.disabled||o.switchToPreviousMode()}),this.boundEventHandlers.push({element:this.upButton,event:"click",handler:t}),v(this.downButton,"click",t=function(){o.options.disabled||o.switchToNextMode()}),this.boundEventHandlers.push({element:this.downButton,event:"click",handler:t}),this.upButton&&(v(this.upButton,"mouseenter",this.handleUpButtonHover),v(this.upButton,"mouseleave",this.handleUpButtonLeave),this.boundEventHandlers.push({element:this.upButton,event:"mouseenter",handler:this.handleUpButtonHover}),this.boundEventHandlers.push({element:this.upButton,event:"mouseleave",handler:this.handleUpButtonLeave})),this.downButton&&(v(this.downButton,"mouseenter",this.handleDownButtonHover),v(this.downButton,"mouseleave",this.handleDownButtonLeave),this.boundEventHandlers.push({element:this.downButton,event:"mouseenter",handler:this.handleDownButtonHover}),this.boundEventHandlers.push({element:this.downButton,event:"mouseleave",handler:this.handleDownButtonLeave})),this.ewColorPicker.on("change",function(t){"hex"!==o.currentMode&&o.updateInputValues(t)}))},N.prototype.switchToPreviousMode=function(){var t=["hex","rgb","hsl"],o=t.indexOf(this.currentMode);this.debouncedOnModeChange(t[0<o?o-1:t.length-1])},N.prototype.switchToNextMode=function(){var t=["hex","rgb","hsl"],o=t.indexOf(this.currentMode);this.debouncedOnModeChange(t[(o+1)%t.length])},N.prototype.onModeChange=function(t){this.currentMode=t,this.updateModeDisplay(),this.updateInputStructure();var o,e=this.ewColorPicker.getColor();e&&"hex"!==t&&this.updateInputValues(e),C(this.options.changeMode)&&null!=(o=(e=this.options).changeMode)&&o.call(e,t,this.ewColorPicker),this.ewColorPicker.trigger("mode-change",t)},N.prototype.updateInputStructure=function(){var t=this.prefix,o=this.ewColorPicker.getMountPoint("panelContainer");o&&(o=f(".".concat(t,"color-picker-bottom-row"),o))&&(t=f(".".concat(t,"color-picker-input-container"),o))&&(this.inputPlugin&&!this.inputPlugin.hasInput?t.innerHTML="":"hex"===this.currentMode?this.restoreDefaultInput():(t.innerHTML="",this.createInputsForMode(t)))},N.prototype.setupInputPluginListener=function(){},N.prototype.createInputsForMode=function(t){var r,o,s=this,a=this.prefix;(!this.inputPlugin||this.inputPlugin.hasInput)&&(t.innerHTML="",o=[],"rgb"===this.currentMode?o=this.hasAlphaPlugin?["R","G","B","A"]:["R","G","B"]:"hsl"===this.currentMode&&(o=this.hasAlphaPlugin?["H","S","L","A"]:["H","S","L"]),r=l("div"),c(r,"".concat(a,"color-picker-inputs-group")),o.forEach(function(t,o){var e,i=l("div"),n=(c(i,"".concat(a,"color-picker-inputs-col")),l("div"));c(n,"".concat(a,"color-picker-input-label")),n.textContent=t,g(i,n),"rgb"===s.currentMode?(e=new Rt({value:0,min:0,max:3===o?1:255,step:3===o?.01:1,precision:3===o?2:0,placeholder:t,size:"small",prefix:a,onChange:function(){s.debouncedUpdateColorFromRgb()}}).getElement(),c(e,"".concat(a,"color-picker-rgb-").concat(t.toLowerCase(),"-input"))):"hsl"===s.currentMode&&(0===o?e=new Rt({value:0,min:0,max:360,step:1,precision:0,placeholder:t,size:"small",prefix:a,onChange:function(){s.debouncedUpdateColorFromHsl()}}).getElement():3===o&&s.hasAlphaPlugin?e=new Rt({value:0,min:0,max:1,step:.01,precision:2,placeholder:t,size:"small",prefix:a,onChange:function(){s.debouncedUpdateColorFromHsl()}}).getElement():(e=l("input"),d(e,{type:"text",placeholder:t,class:"".concat(a,"color-picker-hsl-").concat(t.toLowerCase(),"-input ").concat(a,"color-picker-input")})),e)&&c(e,"".concat(a,"color-picker-hsl-").concat(t.toLowerCase(),"-input")),e||(e=l("input"),d(e,{type:"text",placeholder:t,class:"".concat(a,"color-picker-default-input")})),g(i,e),g(r,i)}),g(t,r),o=this.ewColorPicker.getColor())&&this.updateInputValues(o)},N.prototype.getInputContainer=function(){var t=this.prefix,o=this.ewColorPicker.getMountPoint("panelContainer");return(o=o&&f(".".concat(t,"color-picker-bottom-row"),o))&&f(".".concat(t,"color-picker-input-container"),o)||document},N.prototype.updateInputValues=function(t){var o,e,i,n,r,s,a;t&&(t=m(t))&&(t=wt(t))&&(o=this.getInputContainer(),e=this.prefix,"rgb"===this.currentMode?(i=f(".".concat(e,"color-picker-rgb-r-input input"),o),n=f(".".concat(e,"color-picker-rgb-g-input input"),o),r=f(".".concat(e,"color-picker-rgb-b-input input"),o),a=f(".".concat(e,"color-picker-rgb-a-input input"),o),i&&(i.value=Math.round(t.r).toString()),n&&(n.value=Math.round(t.g).toString()),r&&(r.value=Math.round(t.b).toString()),a&&(a.value=t.a.toFixed(2))):"hsl"===this.currentMode&&(i=((t,o,e)=>{t/=255,o/=255,e/=255;var i=Math.max(t,o,e),n=Math.min(t,o,e),r=0,s=0,a=(i+n)/2;if(i!==n){var l=i-n,s=.5<a?l/(2-i-n):l/(i+n);switch(i){case t:r=(o-e)/l+(o<e?6:0);break;case o:r=(e-t)/l+2;break;case e:r=(t-o)/l+4}r/=6}return{h:360*r,s:100*s,l:100*a}})(t.r,t.g,t.b),n=f(".".concat(e,"color-picker-hsl-h-input input"),o),r=f(".".concat(e,"color-picker-hsl-s-input"),o),s=f(".".concat(e,"color-picker-hsl-l-input"),o),a=f(".".concat(e,"color-picker-hsl-a-input input"),o),n&&(n.value=Math.round(i.h).toString()),r&&(r.value=Math.round(i.s).toString()+"%"),s&&(s.value=Math.round(i.l).toString()+"%"),a)&&(a.value=t.a.toFixed(2)))},N.prototype.updateColorFromRgbInputs=function(){var t=this.getInputContainer(),o=this.prefix,e=f(".".concat(o,"color-picker-rgb-r-input input"),t),i=f(".".concat(o,"color-picker-rgb-g-input input"),t),n=f(".".concat(o,"color-picker-rgb-b-input input"),t),o=f(".".concat(o,"color-picker-rgb-a-input input"),t);e&&i&&n&&(t=parseInt(e.value)||0,e=parseInt(i.value)||0,i=parseInt(n.value)||0,n=o&&parseFloat(o.value)||1,o="rgba(".concat(t,", ").concat(e,", ").concat(i,", ").concat(n,")"),this.ewColorPicker.setColor(o),this.ewColorPicker.syncAllPlugins(o),this.alphaPlugin)&&this.alphaPlugin.updateAlphaThumbPosition&&this.alphaPlugin.updateAlphaThumbPosition(n)},N.prototype.updateColorFromHslInputs=function(){var t=this.getInputContainer(),o=this.prefix,e=f(".".concat(o,"color-picker-hsl-h-input input"),t),i=f(".".concat(o,"color-picker-hsl-s-input"),t),n=f(".".concat(o,"color-picker-hsl-l-input"),t),o=f(".".concat(o,"color-picker-hsl-a-input input"),t);e&&i&&n&&(t=parseInt(e.value)||0,e=parseInt(i.value.replace("%",""))||0,i=parseInt(n.value.replace("%",""))||0,n=o&&parseFloat(o.value)||1,o="hsla(".concat(t,", ").concat(e,"%, ").concat(i,"%, ").concat(n,")"),this.ewColorPicker.setColor(o),this.ewColorPicker.syncAllPlugins(o),this.alphaPlugin)&&this.alphaPlugin.updateAlphaThumbPosition&&this.alphaPlugin.updateAlphaThumbPosition(n)},N.prototype.getModeDisplayName=function(t){return{hex:"HEX",rgb:"RGB",hsl:"HSL"}[t]||t.toUpperCase()},N.prototype.getCurrentMode=function(){return this.currentMode},N.prototype.setMode=function(t){this.debouncedOnModeChange(t)},N.prototype.restoreDefaultInput=function(){var t,o=this.prefix,e=this.ewColorPicker.getMountPoint("panelContainer");e&&(e=f(".".concat(o,"color-picker-bottom-row"),e))&&(e=f(".".concat(o,"color-picker-input-container"),e))&&(this.inputPlugin&&!this.inputPlugin.hasInput?e.innerHTML="":(e.innerHTML="",c(e,"".concat(o,"color-picker-input-container-flex")),t=l("input"),c(t,"".concat(o,"color-picker-input")),c(t,"".concat(o,"color-picker-input-default")),d(t,{type:"text",name:"".concat(o,"color-picker-input"),placeholder:"请输入颜色值"}),g(e,t),(o=this.ewColorPicker.getColor())&&-1===o.indexOf("NaN")||(o=""),"hex"===this.currentMode&&(e=m(o))&&(e=wt(e))?(e=Pt(e),t.value=e):t.value=o,this.bindDefaultInputEvents(t)))},N.prototype.bindDefaultInputEvents=function(t){this.bindInputEvents(t)},N.prototype.rebindDefaultInputEvents=function(){var t=this.prefix,o=this.ewColorPicker.getMountPoint("panelContainer");o&&(o=f(".".concat(t,"color-picker-bottom-row"),o))&&(o=f(".".concat(t,"color-picker-input-container"),o))&&(t=f(".".concat(t,"color-picker-hex-input"),o))&&this.bindInputEvents(t)},N.prototype.bindInputEvents=function(o){function t(t){vt(t=t.target.value)&&(i.ewColorPicker.setColor(t),i.syncOtherPlugins(t))}function e(t){"Enter"===t.key&&vt(t=t.target.value)&&(i.ewColorPicker.setColor(t),i.syncOtherPlugins(t))}var i=this;v(o,"blur",t),this.boundEventHandlers.push({element:o,event:"blur",handler:t}),v(o,"keydown",e),this.boundEventHandlers.push({element:o,event:"keydown",handler:e});this.ewColorPicker.on("change",function(t){o.value="hex"===i.currentMode?i.toHexDisplay(t):t})},N.prototype.toHexDisplay=function(t){var o;return t?!t.startsWith("#")&&(o=m(t))&&(o=wt(o))?Pt(o):t:""},N.prototype.syncOtherPlugins=function(t){var o=this.ewColorPicker.hsvaColor,e=(this.inputPlugin&&this.inputPlugin.update&&this.inputPlugin.update(t),null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerHue),o=(e&&e.updateHueThumbPosition&&e.updateHueThumbPosition(o.h),this.alphaPlugin&&this.alphaPlugin.updateAlphaThumbPosition&&this.alphaPlugin.updateAlphaThumbPosition(o.a),null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerPanel),o=(o&&o.updatePanelColor&&o.updatePanelColor(t),null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerBox);o&&o.setBoxBgColor&&o.setBoxBgColor(t)},N.prototype.destroy=function(){this.boundEventHandlers.forEach(function(t){var o=t.element;P(o,t.event,t.handler)}),this.boundEventHandlers=[],this.modeContainer&&this.modeContainer.parentNode&&r(this.modeContainer),this.modeContainer=null,this.modeText=null,this.upButton=null,this.downButton=null},N.pluginName="ewColorPickerColorMode",N.applyOrder="post";var Yt=N;function N(t){var o=this;this.ewColorPicker=t,this.options={},this.currentMode="hex",this.modeContainer=null,this.modeText=null,this.upButton=null,this.downButton=null,this.boundEventHandlers=[],this.handleUpButtonHover=function(){o.upButton&&u(o.upButton,{borderColor:"#4096ef",backgroundColor:"#f0f8ff"})},this.handleUpButtonLeave=function(){o.upButton&&u(o.upButton,{borderColor:"#ddd",backgroundColor:"#fff"})},this.handleDownButtonHover=function(){o.downButton&&u(o.downButton,{borderColor:"#4096ef",backgroundColor:"#f0f8ff"})},this.handleDownButtonLeave=function(){o.downButton&&u(o.downButton,{borderColor:"#ddd",backgroundColor:"#fff"})},this.debouncedOnModeChange=e(this.onModeChange.bind(this),100),this.debouncedUpdateColorFromRgb=e(this.updateColorFromRgbInputs.bind(this),100),this.debouncedUpdateColorFromHsl=e(this.updateColorFromHslInputs.bind(this),100),this.initializePlugin()}x.use(G),x.use(Lt),x.use(t),x.use(R),x.use(Ut),x.use($t),x.use(qt),x.use(Gt),x.use(Xt),x.use(Yt),"undefined"!=typeof window&&(window.ewColorPicker=x),_.default=x,_.ewColorPicker=x,Object.defineProperty(_,"__esModule",{value:!0})});
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).ewColorPicker={})})(this,function(_){var z=function(t,e){return(z=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}))(t,e)};function j(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}z(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var n=function(){return(n=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++)for(var n in e=arguments[o])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};function F(t,e){var o={};for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(o[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(o[n[i]]=t[n[i]]);return o}function V(t,s,a,l){return new(a=a||Promise)(function(o,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function n(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?o(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(i,n)}r((l=l.apply(t,s||[])).next())})}function W(i,n){var r,s,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},h=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return h.next=t(0),h.throw=t(1),h.return=t(2),"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function t(o){return function(t){var e=[o,t];if(r)throw new TypeError("Generator is already executing.");for(;l=h&&e[h=0]?0:l;)try{if(r=1,s&&(a=2&e[0]?s.return:e[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,e[1])).done)return a;switch(s=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return l.label++,{value:e[1],done:!1};case 5:l.label++,s=e[1],e=[0];continue;case 7:e=l.ops.pop(),l.trys.pop();continue;default:if(!(a=0<(a=l.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){l=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3]))l.label=e[1];else if(6===e[0]&&l.label<a[1])l.label=a[1],a=e;else{if(!(a&&l.label<a[2])){a[2]&&l.ops.pop(),l.trys.pop();continue}l.label=a[2],l.ops.push(e)}}e=n.call(i,l)}catch(t){e=[6,t],s=0}finally{r=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}}function L(t,e,o){if(o||2===arguments.length)for(var i,n=0,r=e.length;n<r;n++)!i&&n in e||((i=i||Array.prototype.slice.call(e,0,n))[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function U(){}var R={log:U,warn:U,error:U},h=(["warn","error","log"].forEach(function(t){R[t]=function(){}}),R.warn),$=R.error,G=R.log,q="undefined"!=typeof window,t=q&&navigator.userAgent.toLowerCase(),X=(t&&t.match(/(iPhone|iPod|Android|ios)/i),!1);if(q)try{var Y={};Object.defineProperty(Y,"passive",{get:function(){X=!0}}),window.addEventListener("test-passive",function(){},Y)}catch($){}function K(t){return void 0===t}function Q(t){return"string"==typeof t}function Z(t){return"object"===nt.call(t).slice(8,-1).toLowerCase()}function J(t,e){try{t()}catch(t){C(e)?e(t):$("[ewColorPicker error]: ".concat(t))}}function i(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];if(st(t))return{};if(Object.assign)return Object.assign.apply(Object,L([t],e,!1));for(var i=Object(t),n=0,r=e.length;n<r;n++){var s=e[n];if(s)for(var a in s)rt.call(s,a)&&(i[a]=s[a])}return i}function c(t){return document.createElement(t)}function s(t,e){return new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className)}function u(t,e){for(var o=0,i=e.trim().split(/\s+/);o<i.length;o++){var n,r=i[o];r&&!s(t,r)&&((n=t.className.split(" ").filter(Boolean)).push(r),t.className=n.join(" "))}}function a(t,e){s(t,e)&&(e=new RegExp("(^|\\s)"+e+"(\\s|$)","g"),t.className=t.className.replace(e," "))}function tt(t){return t instanceof HTMLElement}function et(t,e,o){e=e.startsWith("--")?e:e.replace(/([A-Z])/g,"-$1").toLowerCase(),t.style.setProperty(e,o)}function p(o,t,e){if(Q(t=void 0===t?{}:t)&&!K(e)){e=at(e)?"".concat(e,"px"):e;et(o,t,e)}else if(Array.isArray(t))t.forEach(function(t){var e=t.prop;et(o,e,t.value)});else for(var i=0,n=Object.entries(t);i<n.length;i++){var r=n[i],s=r[0];et(o,s,r[1])}}function ot(t,e){for(var o=0,i=e=void 0===e?[]:e;o<i.length;o++){var n=i[o];t.style.removeProperty(n)}}function l(e,o,i){var n;return e&&o?("float"===(o=o.replace(/([\:\_\-]+(.))/g,function(t,e,o,i){return i?o.toUpperCase():o}).replace(/^moz([A-Z])/,"Moz$1"))&&(o="cssFloat"),n=null,J(function(){var t=(document.defaultView||window).getComputedStyle(e,i);n=e.style[o]||t?t[o]:null}),n||e.style[o]):null}function d(t,e){if(lt(e))for(var o=0,i=Object.entries(e);o<i.length;o++){var n=i[o],r=n[0];t.setAttribute(r,"".concat(n[1]))}}function f(t,e){return(e=void 0===e?document:e).querySelector(t)}function r(t){var e;null!=t&&t.parentElement?null!=(e=null==t?void 0:t.parentElement)&&e.removeChild(t):null!=t&&t.remove()}function g(t,e,o,i){i&&null!=t&&t.contains(i)?t.insertBefore(e,i):o&&null!=t&&t.contains(o)?t.replaceChild(e,o):null!=t&&t.appendChild(e)}function it(t){return Q(t)?f(t)||(h("[ewColorPicker warning]: Cannot find element with selector: ".concat(t)),document.body):tt(t)?t:document.body}var nt=Object.prototype.toString,rt=Object.prototype.hasOwnProperty,st=function(t){return null===t},at=function(t){return"number"==typeof t},C=function(t){return"function"==typeof t},lt=function(t){return"object"==typeof t&&!st(t)},ht=function(t){return t.replace(/\s+/g,"")},ct=function(t){return t?" ".concat(t):""};function ut(t){return{clientWidth:t.clientWidth,clientHeight:t.clientHeight,offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}}function b(t){return t.getBoundingClientRect()}function v(t,e,o,i){i=X?{passive:!1,capture:!!i}:!!i,t.addEventListener(e,o,i)}function w(t,e,o,i){t.removeEventListener(e,o,{capture:!!i})}(t=oe=oe||{}).Pre="pre",t.Post="post",pt.prototype.on=function(t,e,o){return void 0===o&&(o=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,o]),this},pt.prototype.once=function(i,n,r){var s=this,a=(void 0===r&&(r=this),this.hasType(i),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];s.off(i,a);var o=n.apply(r,t);if(!0===o)return o});return a.fn=n,this.on(i,a),this},pt.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),e){var o=this.events[t];if(o)for(var i=o.length;i--;)(o[i][0]===e||o[i][0]&&o[i][0].fn===e)&&o.splice(i,1)}else this.events[t]=[];return this}},pt.prototype.trigger=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];this.hasType(t);t=this.events[t];if(t)for(var i=t.length,n=L([],t,!0),r=0;r<i;r++){var s=n[r],a=s[0],s=s[1];if(a&&!0===(a=a.apply(s,e)))return a}},pt.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},pt.prototype.destroy=function(){this.events={},this.eventTypes={}},pt.prototype.hasType=function(t){var e=this.eventTypes;e[t]!==t&&h('[ewColorPicker warning]: EventEmitter has used unknown event type: "'.concat(t,'", should be oneof [')+"".concat(Object.keys(e).map(function(t){return JSON.stringify(t)}))+"]")};q=pt;function pt(t){this.events={},this.eventTypes={},this.registerType(t)}var dt=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,ft=/[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,gt=/^[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}$/,Ct=/^[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]*)[\)]$/,bt=/^[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 vt(t){var e,o,i={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(","),o="",e.map(function(t,e){e<=2&&(o+=(e=+t,e=Math.min(Math.round(e),255),t=Math.floor(e/16),""+(i[t]||t)+(i[e%=16]||e)))}),ht("#"+o)):t}function wt(t){var e,o,i,n,r=t.a,s=t.h,a=255*t.s/100,t=255*t.v/100;return 0==a?e=o=i=t:(t=s%60*((n=t)-(a=(255-a)*t/255))/60,360===s?(e=n,o=i=0):s<60?(e=n,o=a+t,i=a):s<120?(e=n-t,o=n,i=a):s<180?(o=n,i=(e=a)+t):s<240?(e=a,o=n-t,i=n):s<300?(e=a+t,o=a,i=n):s<360?(o=a,i=(e=n)-t):e=o=i=0),r=Math.round(10*r)/10,"rgba(".concat(Math.round(e),", ").concat(Math.round(o),", ").concat(Math.round(i),", ").concat(r,")")}function P(t){var e,o,i,n,r,s,a,l;return t&&"string"==typeof t&&(t=t.replace(/\s+/g," ").trim().match(/rgba?\(([^)]+)\)/i))?(t=t[1].split(",").map(function(t){return t.trim()}),e=parseFloat(t[0])||0,o=parseFloat(t[1])||0,i=parseFloat(t[2])||0,t=4<=t.length&&parseFloat(t[3])||1,e=e/255,o=o/255,i=i/255,n=(l=Math.max(e,o,i))-Math.min(e,o,i),(s=r=0)!==(a=l)&&(s=n/l),0!=n?(l===e?r=(o-i)/n*60:l===o?r=60*((i-e)/n+2):l===i&&(r=60*((e-o)/n+4)),r<0&&(r+=360)):r=0,l=Math.round(10*t)/10,{h:Math.round(r),s:Math.round(100*s),v:Math.round(100*a),a:l}):{h:0,s:100,v:100,a:1}}var Pt={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 y(t){if(t&&"string"==typeof t){var e=t.trim().toLowerCase();if(Pt[e])return Pt[e];if(dt.test(e))return((t,e)=>{var e=(e=void 0===e?1:e)||1,e=Math.round(10*e)/10,o=t.toLowerCase(),i=t.length,n=[];if(t&&dt.test(o)){if(4===i){for(var r="#",s=1;s<i;s++){var a=o.slice(s,s+1);r+=a.concat(a)}o=r}for(var l=1,h=o.length;l<h;l+=2)n.push(parseInt("0X"+o.slice(l,l+2),16));return"rgba(".concat(n.join(", "),", ").concat(e,")")}return ht(o)})(e).replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)");var o=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(o)return i=o[1],n=o[2],r=o[3],"rgba(".concat(i,", ").concat(n,", ").concat(r,", 1)");var i,n,r,o=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(o)return i=o[1],n=o[2],r=o[3],e=o[4],"rgba(".concat(i,", ").concat(n,", ").concat(r,", ").concat(e,")");try{var s=c("div"),a=(p(s,{"background-color":t}),l(s,"backgroundColor"));if(a&&"rgba(0, 0, 0, 0)"!==a)return a.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)")}catch(t){}}return""}function yt(t){var e="transparent"===t;if(dt.test(t))return 1;if(ft.test(t)&&!t.includes("rgba"))return 1;if(gt.test(t))return 1;if(Ct.test(t)&&!t.includes("hsla"))return 1;if(bt.test(t))return 1;if(e)return 1;if("#invalid"!==t&&"invalid"!==t&&(!t.includes("rgb(")||!t.includes(", 0.5)"))&&(!t.includes("rgba(")||t.includes(", 0.5)")||t.includes(", 1)")))try{var o=document.createElement("div");return p(o,{"background-color":t}),"rgba(0, 0, 0, 0)"!==l(o,"backgroundColor")||e}catch(t){}}function kt(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))}function mt(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}}Bt.prototype.show=function(){var e=this;return new Promise(function(t){p(e.element,{display:"block"}),t()})},Bt.prototype.hide=function(){var e=this;return new Promise(function(t){p(e.element,{display:"none"}),t()})},Bt.prototype.slideDown=function(){var n=this;return new Promise(function(t){p(n.element,{display:"block",visibility:"hidden"});var e=l(n.element,"marginTop"),o=l(n.element,"marginBottom"),i=n.element.offsetHeight+parseInt(e)+parseInt(o);p(n.element,{height:"0px",overflow:"hidden",visibility:"visible"}),n.element.offsetHeight,setTimeout(function(){p(n.element,{transition:"height ".concat(n.options.duration,"ms ").concat(n.options.easing),height:"".concat(i,"px")}),setTimeout(function(){p(n.element,{height:"",overflow:"",transition:""}),t()},n.options.duration)},n.options.delay)})},Bt.prototype.slideUp=function(){var i=this;return new Promise(function(t){var e=l(i.element,"marginTop"),o=l(i.element,"marginBottom"),e=i.element.offsetHeight+parseInt(e)+parseInt(o);p(i.element,{height:"".concat(e,"px"),overflow:"hidden"}),i.element.offsetHeight,setTimeout(function(){p(i.element,{height:"0px",transition:"height ".concat(i.options.duration,"ms ").concat(i.options.easing)}),setTimeout(function(){p(i.element,{height:"",overflow:"",transition:"",display:"none"}),t()},i.options.duration)},i.options.delay)})},Bt.prototype.fadeIn=function(){var t=this;return new Promise(function(o){function i(t){var t=Math.min((t-s)/r,1),e=1-Math.pow(1-t,3);p(n,{opacity:e.toString()}),t<1?requestAnimationFrame(i):(p(n,{opacity:"1"}),o())}var n=t.element,r=t.options.duration,s=(p(n,{display:"block",opacity:"0"}),n.offsetHeight,performance.now());requestAnimationFrame(i)})},Bt.prototype.fadeOut=function(){var t=this;return new Promise(function(o){function i(t){var t=Math.min((t-s)/r,1),e=Math.pow(t,3);p(n,{opacity:(1-e).toString()}),t<1?requestAnimationFrame(i):(p(n,{display:"none",opacity:"0"}),o())}var n=t.element,r=t.options.duration,s=(p(n,{display:"block",opacity:"1"}),n.offsetHeight,performance.now());requestAnimationFrame(i)})};var xt=Bt;function Bt(t,e){void 0===e&&(e={}),this.element=t,this.options=n({duration:300,easing:"ease-out",delay:0},e)}var Mt={show:function(t,e){return new xt(t,{duration:e=void 0===e?300:e}).show()},hide:function(t,e){return new xt(t,{duration:e=void 0===e?300:e}).hide()},slideDown:function(t,e){return new xt(t,{duration:e=void 0===e?300:e}).slideDown()},slideUp:function(t,e){return new xt(t,{duration:e=void 0===e?300:e}).slideUp()},fadeIn:function(t,e){return new xt(t,{duration:e=void 0===e?300:e}).fadeIn()},fadeOut:function(t,e){return new xt(t,{duration:e=void 0===e?300:e}).fadeOut()}};function Ht(t){return(null==(t=t.options)?void 0:t.togglePickerAnimation)||"default"}function Tt(i,n,r){void 0===r&&(r=!1);var s=null;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var o=r&&!s;s&&clearTimeout(s),s=setTimeout(function(){s=null,r||i.apply(void 0,t)},n),o&&i.apply(void 0,t)}}function Ot(o,i){var n;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];n||(o.apply(void 0,t),n=!0,setTimeout(function(){return n=!1},i))}}function k(t){return"string"==typeof(t=null==(t=null==t?void 0:t.options)?void 0:t.prefix)?t:m}function At(t,e,o){return void 0===o&&(o=m),e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"",'<svg t="1717384498631" class="'.concat(o,"color-picker-icon").concat(ct(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>')}function It(t,e,o){return void 0===o&&(o=m),e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"",'<svg t="1717384498632" class="'.concat(o,"color-picker-icon").concat(ct(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>')}var m="ew-",Et=["%c ew-color-picker@2.0.3%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"],Dt=!1,Y=(Nt.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i(this.options,this.ewColorPicker.options))},Nt.prototype.run=function(){Dt||(Dt=!0,G.apply(void 0,Et))},Nt.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),t.on&&C(t.on)&&t.on("change",function(t){}),null!=(t=this.run)&&t.call(this)},Nt.pluginName="ewColorPickerConsole",Nt);function Nt(t){this.ewColorPicker=t,this.options={},this.handleOptions(),this.run()}var St,_t={disabled:!1,predefineColor:[],size:"normal",defaultColor:"",isClickOutside:!0,hueDirection:"vertical",alphaDirection:"vertical",clearText:"清空",sureText:"确定",togglePickerAnimation:"default",pickerAnimationTime:200,autoPanelPosition:!1,panelPlacement:"bottom",prefix:m,sure:function(){},clear:function(){},togglePicker:function(){},changeColor:function(){}},zt=(j(jt,St=function(){}),jt.prototype.merge=function(t,e){var t=t||{},o=t.el,t=F(t,["el"]);return i({},_t,null!=e?e:{},n(n({},t),{el:it(o)}))},jt.prototype.bindOptions=function(t,e){var o,i=this.merge(t,e=void 0===e?{}:e);for(o in i){var n=i[o];this[o]=n}return this},jt);function jt(){var t=St.call(this)||this;return t.el=document.body,t}(t={})[oe.Pre]=-1,t[oe.Post]=1;var Ft,Vt=t,Wt=["destroy","change","sure","clear","toggle","options-update","mode-change"],x=(j(B,Ft=q),B.use=function(e){var o=e.pluginName;return K(o)||st(o)?h("[ewColorPicker warning]: Plugin Class must specify plugin's name in static property by 'pluginName' field."):B.plugins.some(function(t){return t.name===o||e===t.ctor})||(B.pluginsMap[o]=!0,B.plugins.push({name:o,applyOrder:e.applyOrder,ctor:e})),B},B.prototype.normalizeOptions=function(t,e){var o,i;return tt(t)||Q(t)?(o=e?(e.el,e=F(e,["el"]),n({el:t},e)):{el:t},this.shouldAutoMount=!0):Z(o=t)&&o.el&&(this.shouldAutoMount=!0),(new zt).bindOptions(o,(i={},x.plugins.forEach(function(t){i[t.name]=!0}),i))},B.prototype.init=function(){var t=this;J(function(){t.plugins={},t._color_picker_uid=t.generateUID(),t.initCoreProperties()})},B.prototype.initCoreProperties=function(){var t,e,o=this.options,i=o.defaultColor,n=o.alphaDirection,o=o.hueDirection;i?(t=i,(null==(e=this.plugins)?void 0:e.ewColorPickerAlpha)?i.startsWith("#")&&(t=y(i)):i.startsWith("rgba")&&(t=vt(i)),e=P(y(this.currentColor=t)||"rgba(255, 0, 0, 1)"),isNaN(e.h)?this.hsvaColor={h:0,s:100,v:100,a:1}:this.hsvaColor=e):(this.currentColor="",this.hsvaColor={h:0,s:0,v:0,a:0}),this.panelWidth=0,this.panelHeight=0,this.panelLeft=0,this.panelTop=0,this.isHueHorizontal="horizontal"===o,this.isAlphaHorizontal="horizontal"===n,this.colorMode=["Hex","RGB","HSV"],this.currentMode="Hex",this.pickerFlag=!1},B.prototype.createMountPoints=function(){var t=this.options.prefix||m,e=c("div"),o=(d(e,{class:"".concat(t,"color-picker"),"data-uid":this._color_picker_uid}),g(this.getContainer(),e),this.wrapper=e,this.wrapper.isEwColorPickerContainer=!0,c("div"));d(o,{class:"".concat(t,"color-picker-panel-container")}),u(o,"".concat(t,"color-picker-panel-container-hidden")),g(e,o),this.mountPoints.set("root",e),this.mountPoints.set("panelContainer",o)},B.prototype.getMountPoint=function(t){if(!this.isDestroyed)return this.mountPoints.get(t)},B.prototype.getContainer=function(){return this.options.el},B.prototype.mount=function(t){return this.isDestroyed||(t=t?it(t):this.options.el||document.body,this.options.el=t,this.createMountPoints(),this.applyPlugins(),this.notifyHuePluginUpdate(this.hsvaColor.h)),this},B.prototype.reapplyPlugins=function(){Object.values(this.plugins).forEach(function(t){C(t.run)&&t.run()})},B.prototype.showPanel=function(t,e){var o,i,n,r,s=this;this.isDestroyed||(o=this.mountPoints.get("panelContainer"))&&(i=(r=this.options||{}).pickerAnimationTime,n=r.togglePicker,this.currentColor||(r=P(y(this.currentColor=r.defaultColor||"#ff0000")||"rgba(255, 0, 0, 1)"),this.hsvaColor=r,isNaN(r.h))||this.notifyHuePluginUpdate(r.h),((t,e,o)=>{o=1e4<(o=void 0===o?300:o)?1e4:o;var i="";switch(t){case"height":i="slideDown";break;case"opacity":i="fadeIn";break;default:i="show"}return Mt[i](e,o)})(t||Ht(this),o,e||i||200).then(function(){s.pickerFlag=!0,s.trigger("toggle",!0),C(n)&&n(!0),s.syncAllPlugins(s.currentColor),setTimeout(function(){var t=s.plugins.ewColorPickerPanel;t&&C(t.handleAutoPosition)&&t.handleAutoPosition.call(t),v(document,"mousedown",s._onDocumentClick,{capture:!0})},0)}).catch(function(t){h("[ewColorPicker error]: Failed to show panel: ".concat(t))}))},B.prototype.hidePanel=function(t,e){var o,i,n,r,s,a,l=this;this.isDestroyed||(o=this.mountPoints.get("panelContainer"))&&(n=(i=this.options||{}).pickerAnimationTime,r=i.togglePicker,s=i.autoPanelPosition,a=this.plugins.ewColorPickerBox||!1,((t,e,o)=>{o=1e4<(o=void 0===o?300:o)?1e4:o;var i="";switch(t){case"height":i="slideUp";break;case"opacity":i="fadeOut";break;default:i="hide"}return Mt[i](e,o)})(t||Ht(this),o,e||n||200).then(function(){l.isDestroyed||(s&&a&&!l.options.appendTo&&p(o,{position:"absolute",left:"0",top:"100%",visibility:"visible"}),l.pickerFlag=!1,l.trigger("toggle",!1),C(r)&&r(!1),w(document,"mousedown",l._onDocumentClick,{capture:!0}))}).catch(function(t){h("[ewColorPicker error]: Failed to hide panel: ".concat(t))}))},B.prototype.generateUID=function(){return"ew-color-picker-".concat(Date.now(),"-").concat(Math.random().toString(36).substring(2,11))},B.prototype.applyPlugins=function(){var i=this,t=L([],B.plugins,!0).sort(function(t,e){var o,i,n=t.applyOrder?Vt[t.applyOrder]:0,r=e.applyOrder?Vt[e.applyOrder]:0;return n!==r?n-r:(o={},i=0,x.plugins.forEach(function(t){o[t.name]=i++}),((n=o)[t.name]||999)-(n[e.name]||999))});this.checkPluginDependencies(),t.forEach(function(t){var e=t.ctor,o=t.name;J(function(){C(e)&&(i.plugins[o]=new e(i))},function(t){console.warn("[ewColorPicker warning]: Failed to apply plugin '".concat(o,"': ").concat(t))})})},B.prototype.checkPluginDependencies=function(){var o=this;Object.entries({hue:["ewColorPickerHue"],alpha:["ewColorPickerAlpha"],panel:["ewColorPickerPanel"],input:["ewColorPickerInput"],inputNumber:["ewColorPickerInputNumber"],button:["ewColorPickerButton"],predefine:["ewColorPickerPredefine"],colorMode:["ewColorPickerColorMode"],box:["ewColorPickerBox"],console:["ewColorPickerConsole"]}).forEach(function(t){var e=t[0],t=t[1];o.options[e]&&t.forEach(function(t){B.pluginsMap[t]||h("[ewColorPicker warning]: Plugin '".concat(t,"' is required but not injected. Please use ewColorPicker.use(").concat(t,") to register the plugin."))})}),this.checkSpecificFeatureDependencies()},B.prototype.checkSpecificFeatureDependencies=function(){this.options.hueDirection&&!B.pluginsMap.ewColorPickerHue&&h("[ewColorPicker warning]: hueDirection is configured but ewColorPickerHue plugin is not injected. Please use ewColorPicker.use(HuePlugin) to register the plugin."),this.options.alphaDirection&&!B.pluginsMap.ewColorPickerAlpha&&h("[ewColorPicker warning]: alphaDirection is configured but ewColorPickerAlpha plugin is not injected. Please use ewColorPicker.use(AlphaPlugin) to register the plugin."),this.options.predefineColor&&0<this.options.predefineColor.length&&!B.pluginsMap.ewColorPickerPredefine&&h("[ewColorPicker warning]: predefineColor is configured but ewColorPickerPredefine plugin is not injected. Please use ewColorPicker.use(PredefinePlugin) to register the plugin."),B.pluginsMap.ewColorPickerColorMode&&!B.pluginsMap.ewColorPickerInputNumber&&h("[ewColorPicker warning]: Color mode plugin requires InputNumber plugin. color-mode plugin requires InputNumber plugin. Please use ewColorPicker.use(InputNumberPlugin) to register the plugin."),B.pluginsMap.ewColorPickerPanel||h("[ewColorPicker warning]: Panel plugin is required as core plugin but not injected. Please use ewColorPicker.use(PanelPlugin) to register the plugin.")},B.prototype.syncAllPlugins=function(e){Object.values(this.plugins).forEach(function(t){C(t.syncColor)&&t.syncColor(e)})},B.prototype.updateOptions=function(t){this.isDestroyed||(this.options=i({},this.options,t),t=(this.options||{}).defaultColor,K(t)||(y(t)?this.setColor(t):h("[ewColorPicker warning]: Invalid defaultColor '".concat(t,"', keep current color unchanged."))),this.reapplyPlugins(),this.trigger("options-update",this.options))},B.prototype.openPicker=function(){this.showPanel()},B.prototype.closePicker=function(){this.hidePanel()},B.prototype.destroy=function(){var t=this;this.isDestroyed||(this.isDestroyed=!0,w(document,"mousedown",this._onDocumentClick,{capture:!0}),this.plugins&&Object.values(this.plugins).forEach(function(t){J(function(){C(null==t?void 0:t.destroy)&&t.destroy()})}),this.mountPoints.forEach(function(t){J(function(){r(t)})}),this.mountPoints.clear(),J(function(){r(t.wrapper)}),this.plugins={},this.trigger("destroy"))},B.prototype.setColor=function(t){var e;(this.currentColor=t)&&(e=y(t),this.hsvaColor=e?P(e):{h:0,s:100,v:100,a:1}),this.trigger("change",t),C(null==(e=this.options)?void 0:e.changeColor)&&this.options.changeColor(t)},B.prototype.getColor=function(){return this.currentColor},B.prototype.getHsvaColor=function(){return n({},this.hsvaColor)},B.prototype.setHsvaColor=function(t){this.hsvaColor=n({},t)},B.prototype.getDestroyedStatus=function(){return this.isDestroyed},B.prototype.use=function(t){return C(t.install)&&t.install(this),this},B.prototype.emit=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];this.trigger.apply(this,L([t],e,!1));var i=this.options||{},n=i.clear,r=i.sure,s=i.togglePicker;switch(t){case"clear":C(n)&&n();break;case"sure":C(r)&&r();break;case"toggle":C(s)&&s.apply(void 0,e)}},B.prototype.on=function(t,e,o){return Ft.prototype.on.call(this,t,e,o),this},B.prototype.off=function(t,e){return Ft.prototype.off.call(this,t,e),this},B.prototype.getOptions=function(){return this.options},B.prototype.notifyHuePluginUpdate=function(t){var e=null==(e=this.plugins)?void 0:e.ewColorPickerHue;C(null==e?void 0:e.updateHueThumbPosition)&&e.updateHueThumbPosition(t)},B.plugins=[],B.pluginsMap={},B);function B(t,e){var i=Ft.call(this,Wt)||this;return i.mountPoints=new Map,i.isDestroyed=!1,i.shouldAutoMount=!1,i._onDocumentClick=function(t){var e,o;i.isDestroyed||!i.options.isClickOutside||(e=i.mountPoints.get("panelContainer"),o=i.mountPoints.get("root"),t=t.target,e&&e.contains(t))||(e=i.options.prefix||m,(o=null==o?void 0:o.querySelector(".".concat(e,"color-picker-box")))&&o.contains(t))||(o=(e=i.options).togglePickerAnimation,i.hidePanel(o,e.pickerAnimationTime))},i.options=i.normalizeOptions(t,e),i.init(),i.shouldAutoMount&&i.options.el&&J(function(){i.mount(i.options.el)},function(t){h("[ewColorPicker warning]: Auto mount failed: ".concat(t))}),i}function Lt(t,e){var o=void 0===(o=e.boxNoColorIcon)?"":o,i=void 0===(i=e.boxHasColorIcon)?"":i,n=void 0===(n=e.prefix)?m:n,e=(t=>{var e,o;if(t){if(lt(t))return e=$t(null!=(e=t.width)?e:32),o=$t(null!=(o=t.height)?o:32),.5*Math.min(e,o);if(at(t))return.5*t;if("string"==typeof t)return Rt[t]||16}return 16})(e.size);return t?i||((t,e,o)=>(void 0===o&&(o=m),e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"",'<svg t="1717384498630" class="'.concat(o,"color-picker-icon").concat(ct(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>')))("".concat(n,"color-picker-box-arrow-icon"),e,n):o||((t,e,o)=>(void 0===o&&(o=m),e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"",'<svg t="1690189203554" class="'.concat(o,"color-picker-icon").concat(ct(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>')))("".concat(n,"color-picker-box-close-icon"),e,n)}var Ut={mini:"20px",small:"24px",normal:"32px",medium:"36px",large:"40px"},Rt={mini:12,small:14,normal:16,medium:18,large:20},$t=function(t){return!at(t)&&(t=parseInt("".concat(t)),isNaN(t))?32:t},t=(Object.defineProperty(e.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasBox",{get:function(){return this._hasBox},set:function(t){this._hasBox!==t&&((this._hasBox=t)?this.render():this.box&&this.box.parentNode&&(r(this.box),this.box=null))},enumerable:!1,configurable:!0}),e.prototype.enableBox=function(t){this.hasBox=t=void 0===t?!0:t},e.prototype.handleOptions=function(){this.options=i(this.options,this.ewColorPicker.options)},e.prototype.run=function(){this.render()},e.prototype.updateChildren=function(){var t;this.box&&(t=this.ewColorPicker.currentColor,this.hasColor=!!t,this.box.replaceChildren((t=Lt(this.hasColor,this.options),document.createRange().createContextualFragment(t))))},e.prototype.destroy=function(){this.box&&(this.unbindHandler(),r(this.box),this.box=null)},e.prototype.update=function(t){void 0===t&&(t=["defaultColor","size","disabled","readonly","className","style"]),this.box?(t.includes("defaultColor")&&(this.updateChildren(),this.setBoxBgColor(this.ewColorPicker.currentColor)),t.includes("size")&&this.setBoxSize(),(t.includes("disabled")||t.includes("readonly")||t.includes("className")||t.includes("style"))&&this.setBoxState()):this.render()},e.prototype.render=function(){var t,e=this.options,o=e.className,e=e.style;this.hasBox&&((t=this.ewColorPicker.getMountPoint("root"))?(this.box=f(".".concat(this.prefix,"color-picker-box"),t),this.box||(this.box=c("div"),u(this.box,"".concat(this.prefix,"color-picker-box")),o&&u(this.box,o),e&&p(this.box,e),g(t,this.box)),this.updateChildren(),this.setBoxSize(),this.setBoxBgColor(this.ewColorPicker.currentColor),this.setBoxState(),this.bindHandler()):h("[ewColorPicker] Root mount point not found"))},e.prototype.setBoxSize=function(){var t,e;this.box&&(t=this.options.size,t=(t=t)?lt(t)?{width:t.width?at(t.width)?"".concat(t.width,"px"):t.width:void 0,height:e=t.height?at(t.height)?"".concat(t.height,"px"):t.height:void 0,lineHeight:e}:t?(e=void 0,{width:e=at(t)?"".concat(t,"px"):"string"==typeof t?Ut[t]||t:"32px",height:e,lineHeight:e}):{}:{},0<Object.keys(t).length?p(this.box,t):ot(this.box,["width","height"]))},e.prototype.setBoxBgColor=function(t){var e,o;this.box&&(t&&""!==t.trim()?(e=(e=(e=t)&&y(e))&&(o=mt(e))?.5<.2126*(e=function(t){t=(t*o.a+255*(1-o.a))/255;return t<=.03928?t/12.92:Math.pow((.055+t)/1.055,2.4)})(o.r)+.7152*e(o.g)+.0722*e(o.b)?"#333333":"#ffffff":null,p(this.box,n({backgroundColor:t,transition:"background-color 0.3s"},e?{color:e}:{}))):this.clearBoxBgColor())},e.prototype.clearBoxBgColor=function(){this.box&&ot(this.box,["background-color","transition","color"])},e.prototype.setBoxState=function(){var t,e,o;this.box&&(t=(o=this.options).disabled,e=o.readonly,o=o.className,(t?u:a)(this.box,"is-disabled"),(e?u:a)(this.box,"is-readonly"),o)&&u(this.box,o)},e.prototype.bindHandler=function(){var t,e,o,i,n,r,s,a,l,h=this;this.box&&(t=this.options,e=t.onClick,o=t.onMouseEnter,i=t.onMouseLeave,n=t.disabled,r=t.readonly,s=t.togglePickerAnimation,a=t.pickerAnimationTime,v(this.box,"click",l=function(t){n||r?(t.preventDefault(),t.stopPropagation()):(h.ewColorPicker.pickerFlag?h.ewColorPicker.hidePanel(s,a):h.ewColorPicker.showPanel(s,a),null!=e&&e(h))}),this._handlers.push(function(){return w(h.box,"click",l)}),this.bindMouseEvents(o,i))},e.prototype.setDisabled=function(t){this.box&&(t?u:a)(this.box,"is-disabled")},e.prototype.bindMouseEvents=function(t,e){var o,i,n=this;this.box&&(t&&(v(this.box,"mouseenter",o=function(){return t(n)}),this._handlers.push(function(){return w(n.box,"mouseenter",o)})),e)&&(v(this.box,"mouseleave",i=function(){return e(n)}),this._handlers.push(function(){return w(n.box,"mouseleave",i)}))},e.prototype.unbindHandler=function(){this._handlers.forEach(function(t){return t()}),this._handlers=[]},e.pluginName="ewColorPickerBox",e);function e(t){var e=this;this.ewColorPicker=t,this.options={},this._handlers=[],this._hasBox=!0,this.box=null,this.hasColor=!1,this.handleOptions(),!1===this.options.hasBox&&(this._hasBox=!1),this.ewColorPicker.on&&"function"==typeof this.ewColorPicker.on&&this.ewColorPicker.on("change",function(t){e.setBoxBgColor(t)}),this.run()}Object.defineProperty(o.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),o.prototype.handleOptions=function(){var t;Z(null==(t=this.ewColorPicker)?void 0:t.options)&&(this.options=i(this.options,this.ewColorPicker.options),this.isHueHorizontal="horizontal"===this.options.hueDirection,this.isAlphaHorizontal="horizontal"===this.options.alphaDirection)},o.prototype.run=function(){var t=this;!1!==this.options.ewColorPickerPanel&&!1!==this.options.hasPanel&&(this.render(),this.movePanelContainer(),setTimeout(function(){t.bindEvents()},10))},o.prototype.render=function(){var t,e,o,i=this;this.ewColorPicker&&(e=this.ewColorPicker.getMountPoint("panelContainer"))&&(t=f(".".concat(this.prefix,"color-picker-panel"),e),o=285,this.isAlphaHorizontal&&this.isHueHorizontal?o=320:(this.isAlphaHorizontal&&!this.isHueHorizontal||!this.isAlphaHorizontal&&this.isHueHorizontal)&&(o=302),this.panel=c("div"),u(this.panel,"".concat(this.prefix,"color-picker-panel")),u(this.panel,"".concat(this.prefix,"color-picker-panel-dynamic-size")),this.panelWidth=o,this.panelHeight=180,p(this.panel,{"--panel-width":o+"px","--panel-height":this.panelHeight+"px"}),g(e,this.panel,t),this.whitePanel=c("div"),u(this.whitePanel,"".concat(this.prefix,"color-picker-white-panel")),g(this.panel,this.whitePanel),this.blackPanel=c("div"),u(this.blackPanel,"".concat(this.prefix,"color-picker-black-panel")),g(this.panel,this.blackPanel),this.cursor=c("div"),u(this.cursor,"".concat(this.prefix,"color-picker-panel-cursor")),g(this.panel,this.cursor),o=c("div"),u(o,"".concat(this.prefix,"color-picker-bottom-row")),g(e,o),setTimeout(function(){var t;i.calculateContainerSize(),C(null==(t=i.ewColorPicker)?void 0:t.getMountPoint)&&i.handleAutoPosition()},0),this.updateHueBg(),C(null==(t=this.ewColorPicker)?void 0:t.getColor)&&(e=this.ewColorPicker.getColor())?(o=P(e),this.updateCursorPosition(o.s,o.v)):this.updateCursorPosition(100,100))},o.prototype.bindEvents=function(){var e=this;this.panel&&(v(this.panel,"click",function(t){return e.handlePanelClick(t)}),v(this.panel,"mousedown",function(){return e.handlePanelMouseDown()}),v(this.panel,"touchstart",function(t){return e.handlePanelTouchStart(t)}))},o.prototype.handlePanelTouchStart=function(t){var e,o,i=this;this.panel&&!this.options.disabled&&(t.preventDefault(),this.isDragging=!0,e=function(t){i.isDragging&&0<t.touches.length&&i.handlePanelTouchMove(t)},o=function(){i.isDragging=!1,w(document,"touchmove",e),w(document,"touchend",o)},v(document,"touchmove",e),v(document,"touchend",o))},o.prototype.handlePanelTouchMove=function(t){var e,o;this.panel&&this.cursor&&(this.options.disabled||(t.preventDefault(),0<t.touches.length&&(this.panelWidth=this.panel.offsetWidth,this.panelHeight=this.panel.offsetHeight,t=t.touches[0],e=b(this.panel),o=t.clientX-e.left,t=t.clientY-e.top,e=Math.max(0,Math.min(100,o/this.panelWidth*100)),o=Math.max(0,Math.min(100,100*(1-t/this.panelHeight))),this.throttledUpdate(e,o))))},o.prototype.handlePanelClick=function(t){var e,o;this.panel&&this.cursor&&(this.options.disabled?(t.preventDefault(),t.stopPropagation()):(this.panelWidth=this.panel.offsetWidth,this.panelHeight=this.panel.offsetHeight,e=b(this.panel),o=t.clientX-e.left,t=t.clientY-e.top,e=Math.max(0,Math.min(100,o/this.panelWidth*100)),o=Math.max(0,Math.min(100,100*(1-t/this.panelHeight))),this.updateCursorPosition(e,o),this.updateColor(e,o)))},o.prototype.handlePanelMouseDown=function(){var t,e,o=this;this.panel&&!this.options.disabled&&(this.isDragging=!0,t=function(t){o.isDragging&&o.handlePanelDrag(t)},e=function(){o.isDragging=!1,w(document,"mousemove",t),w(document,"mouseup",e)},v(document,"mousemove",t),v(document,"mouseup",e))},o.prototype.handlePanelDrag=function(t){var e,o;this.panel&&this.cursor&&(this.options.disabled||(t.preventDefault(),this.panelWidth=this.panel.offsetWidth,this.panelHeight=this.panel.offsetHeight,e=b(this.panel),o=t.clientX-e.left,t=t.clientY-e.top,e=Math.max(0,Math.min(100,o/this.panelWidth*100)),o=Math.max(0,Math.min(100,100*(1-t/this.panelHeight))),this.throttledUpdate(e,o)))},o.prototype.updateCursorPosition=function(t,e){var o,i,n;this.cursor&&this.panel&&(o=l(this.panel,"display"),i=l(this.panel,"visibility"),"none"!==o)&&"hidden"!==i&&(o=this.panel.offsetWidth,i=this.panel.offsetHeight,0!==o&&0!==i||(o=(n=b(this.panel)).width||this.panelWidth||285,i=n.height||this.panelHeight||180,0!==o&&0!==i)||(o=285,i=180),this.panelWidth=o,this.panelHeight=i,o={x:(n=ut(this.cursor)).offsetWidth/2,y:n.offsetHeight/2},0!==n.offsetWidth&&0!==n.offsetHeight||(o.x=2,o.y=2),i=t/100*this.panelWidth,n=(1-e/100)*this.panelHeight,i=Math.max(o.x,Math.min(i,this.panelWidth-o.x)),n=Math.max(o.y,Math.min(n,this.panelHeight-o.y)),p(this.cursor,{left:"".concat(i,"px"),top:"".concat(n,"px")}))},o.prototype.updateColor=function(t,e){var o=this.options.alpha?"rgba(255,0,0,1)":"#ff0000",i=this.ewColorPicker.getColor(),o=(i&&-1===i.indexOf("NaN")||this.ewColorPicker.setColor(i=o),P(i)),i=(o.s=t,o.v=e,wt(o));this.ewColorPicker.setColor(i),C(this.ewColorPicker.options.changeColor)&&this.ewColorPicker.options.changeColor(i),this.ewColorPicker.trigger("change",i)},o.prototype.updateHueBg=function(t){if(this.panel){if(void 0===(t=t)){var e=this.ewColorPicker.getColor();if(!e)return;t=P(e).h}e=wt({h:t,s:100,v:100,a:1});p(this.panel,{background:e})}},o.prototype.calculateContainerSize=function(){var t,e,o,i,n,r,s=this.ewColorPicker.getMountPoint("panelContainer");s&&(n=s.offsetWidth,r=s.offsetHeight,0!==n&&0!==r||(t=s.style.display,e=s.style.visibility,o=s.style.position,p(s,{display:"block",visibility:"hidden",position:"absolute",left:"-9999px",top:"-9999px"}),s.offsetHeight,i=b(s),n=s.offsetWidth||i.width,r=s.offsetHeight||i.height,p(s,{display:t,visibility:e,position:o,left:"",top:""})),this.containerWidth=n||320,this.containerHeight=r||200)},o.prototype.handleAutoPosition=function(){var t,e,o,i,n;this.isPanelAppended?this.updateAppendedPanelPosition():(t=(n=(null==(n=this.ewColorPicker)?void 0:n.options)||{}).autoPanelPosition,e=n.panelPlacement,t&&n.ewColorPickerBox&&(t=this.ewColorPicker.getMountPoint("root"),n=f(".".concat(this.prefix,"color-picker-box"),t),t)&&n&&(this.calculateContainerSize(),i=(n=ut(n)).offsetWidth,n=n.offsetHeight,o=(e=(e||"bottom").split("-"))[0],o=(e=this.calculatePosition(void 0===o?"bottom":o,void 0===(o=e[1])?"center":o,i,n)).left,i=this.adjustForViewport(t,o,e.top),n=this.ewColorPicker.getMountPoint("panelContainer"))&&p(n,{position:"absolute",left:"".concat(i.left,"px"),top:"".concat(i.top,"px")}))},o.prototype.movePanelContainer=function(){var t,e=this.options.appendTo;e&&(t=this.ewColorPicker.getMountPoint("panelContainer"))&&(g(it(e),t),this.isPanelAppended=!0,this.calculateContainerSize(),v(window,"scroll",this.handleReposition,{capture:!0}),v(window,"resize",this.handleReposition),this.updateAppendedPanelPosition())},o.prototype.updateAppendedPanelPosition=function(){var t,e,o,i,n,r;this.isPanelAppended&&(t=this.ewColorPicker.getMountPoint("panelContainer"),e=this.ewColorPicker.getMountPoint("root"),t)&&e&&(n=(r=ut(f(".".concat(this.prefix,"color-picker-box"),e)||e)).offsetWidth,r=r.offsetHeight,i=(o=(this.options.panelPlacement||"bottom").split("-"))[0],i=(o=this.calculatePosition(void 0===i?"bottom":i,void 0===(i=o[1])?"center":i,n,r)).left,n=this.adjustForViewport(e,i,o.top),r=b(e),p(t,{position:"fixed",left:"".concat(r.left+n.left,"px"),top:"".concat(r.top+n.top,"px")}))},o.prototype.calculatePosition=function(t,e,o,i){o={top:{left:"start"===e?-this.containerWidth:"end"===e?o:(o-this.containerWidth)/2,top:-this.containerHeight-i/2},bottom:{left:"start"===e?-this.containerWidth:"end"===e?o:(o-this.containerWidth)/2,top:i},left:{left:-this.containerWidth-5,top:"start"===e?-this.containerHeight-i/2:"end"===e?i:(i-this.containerHeight)/2},right:{left:o+5,top:"start"===e?-this.containerHeight-i/2:"end"===e?i:(i-this.containerHeight)/2}};return o[t]||o.bottom},o.prototype.adjustForViewport=function(t,e,o){var t=b(t),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,r=8-(t.left+e),s=8-(t.top+o),i=t.left+e+this.containerWidth-(i-8),t=t.top+o+this.containerHeight-(n-8);return 0<r&&(e+=r),0<i&&(e-=i),0<s&&(o+=s),0<t&&(o-=t),{left:e,top:o}},o.prototype.destroy=function(){var t;this.panel&&(w(this.panel,"click",this.handlePanelClick),w(this.panel,"mousedown",this.handlePanelMouseDown)),w(window,"scroll",this.handleReposition,{capture:!0}),w(window,"resize",this.handleReposition),C(null==(t=this.ewColorPicker)?void 0:t.off)&&this.ewColorPicker.off("toggle",this.handleToggle),this.panel=null,this.cursor=null,this.whitePanel=null,this.blackPanel=null,this.hueBar=null,this.hueThumb=null,this.alphaBar=null,this.alphaThumb=null,this.hueBg=null},o.prototype.install=function(t){var e=this;this.ewColorPicker=t,this.handleOptions(),C(null==t?void 0:t.on)&&t.on("change",function(t){t=P(t);e.updateCursorPosition(t.s,t.v)}),null!=(t=this.run)&&t.call(this)},o.pluginName="ewColorPickerPanel",o.applyOrder="post";q=o;function o(t){var i=this;this.ewColorPicker=t,this.options={},this.panel=null,this.cursor=null,this.whitePanel=null,this.blackPanel=null,this.hueBar=null,this.hueThumb=null,this.alphaBar=null,this.alphaThumb=null,this.hueBg=null,this.isHueHorizontal=!1,this.isAlphaHorizontal=!1,this.isDragging=!1,this.isPanelAppended=!1,this.handleToggle=function(t){i.isPanelAppended&&t&&i.updateAppendedPanelPosition()},this.handleReposition=function(){i.isPanelAppended&&i.updateAppendedPanelPosition()},this.lastUpdateTime=0,this.throttleDelay=16,this.throttledUpdate=function(t,e){var o=Date.now();o-i.lastUpdateTime>=i.throttleDelay&&(i.lastUpdateTime=o,isNaN(t)||isNaN(e)||t<0||100<t||e<0||100<e||(i.updateCursorPosition(t,e),i.updateColor(t,e)))},this.handleOptions(),C(null==(t=this.ewColorPicker)?void 0:t.on)&&(this.ewColorPicker.on("change",function(t){t&&i.panel&&(t=P(t),i.updateHueBg(t.h),i.updateCursorPosition(t.s,t.v))}),this.ewColorPicker.on("toggle",this.handleToggle)),this.run()}Object.defineProperty(M.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"hasHue",{get:function(){return this._hasHue},set:function(t){this._hasHue!==t&&((this._hasHue=t)?this.render():this.hueBar&&this.hueBar.parentNode&&(this.hueBar.parentNode.removeChild(this.hueBar),this.hueBar=null))},enumerable:!1,configurable:!0}),M.prototype.enableHue=function(t){this.hasHue=t=void 0===t?!0:t},M.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i(this.options,this.ewColorPicker.options),this.isHorizontal="horizontal"===this.options.hueDirection)},M.prototype.run=function(){var t=this;this.hasHue&&this.render(),setTimeout(function(){t.bindEvents()},10)},M.prototype.render=function(){var t,e,o,i=this.ewColorPicker.getMountPoint("panelContainer");i?(e=this.prefix,(t=f(".".concat(e,"color-picker-slider.").concat(e,"color-picker-is-vertical, .").concat(e,"color-picker-slider.").concat(e,"color-picker-is-horizontal"),i))&&r(t),t=c("div"),u(t,"".concat(e,"color-picker-slider ")+(this.isHorizontal?"".concat(e,"color-picker-is-horizontal"):"".concat(e,"color-picker-is-vertical"))),this.hueBar=c("div"),u(this.hueBar,"".concat(e,"color-picker-slider-bar")),this.hueThumb=c("div"),u(this.hueThumb,"".concat(e,"color-picker-slider-thumb")),g(this.hueBar,this.hueThumb),g(t,this.hueBar),this.isHorizontal?(o=f(".".concat(e,"color-picker-bottom-row"),i))&&o.parentNode?o.parentNode.insertBefore(t,o):g(i,t):(o=f(".".concat(e,"color-picker-panel"),i))&&o.parentNode?o.parentNode.insertBefore(t,o.nextSibling):g(i,t),(e=this.ewColorPicker.getColor())&&(o=P(e),this.updateHueThumbPosition(o.h))):h("[ewColorPicker] Panel container not found")},M.prototype.bindEvents=function(){this.hueBar&&(v(this.hueBar,"click",this.handleHueSliderClick.bind(this)),v(this.hueBar,"mousedown",this.handleHueSliderMouseDown.bind(this)))},M.prototype.handleHueSliderClick=function(t){var e,o;this.hueBar&&(this.options.disabled?(t.preventDefault(),t.stopPropagation()):(e=b(this.hueBar),t=this.isHorizontal?(o=t.clientX-e.left,Math.max(0,Math.min(360,o/e.width*360))):(o=t.clientY-e.top,Math.max(0,Math.min(360,360*(1-o/e.height)))),this.updateHue(t)))},M.prototype.handleHueSliderMouseDown=function(t){var i,n,e,o,r=this;this.hueBar&&!this.options.disabled&&(i=this.hueBar,n=this.isHorizontal,e=function(t){var e,o=b(i);t=n?(e=t.clientX-o.left,Math.max(0,Math.min(360,e/o.width*360))):(e=t.clientY-o.top,Math.max(0,Math.min(360,360*(1-e/o.height)))),r.throttledUpdateHue(t)},o=function(){w(document,"mousemove",e),w(document,"mouseup",o)},v(document,"mousemove",e),v(document,"mouseup",o))},M.prototype.updateHue=function(t){var e=this.ewColorPicker.getColor(),t=Math.max(0,Math.min(360,t)),e=e?P(e):{h:t,s:100,v:100,a:1},e=(isNaN(e.h)||isNaN(e.s)||isNaN(e.v)||isNaN(e.a)?(e.h=t,e.s=100,e.v=100,e.a=1):e.h=t,wt(e)),e=(e&&!e.includes("NaN")?this.ewColorPicker.setColor(e):(e=this.ewColorPicker.options.alpha?"rgba(255, 0, 0, 1)":"#ff0000",this.ewColorPicker.setColor(e)),this.updateHueThumbPosition(t),null==(e=this.ewColorPicker.plugins)?void 0:e.ewColorPickerPanel);e&&C(e.updateHueBg)&&e.updateHueBg(t)},M.prototype.updateHueThumbPosition=function(t){var e,o;this.hueThumb&&this.hueBar&&(o=this.isHorizontal,e=b(this.hueBar),o?(o=Math.max(0,Math.min(e.width,t/360*e.width)),p(this.hueThumb,"left","".concat(o,"px")),p(this.hueThumb,"top","0px")):(o=Math.max(0,Math.min(e.height,(1-t/360)*e.height)),p(this.hueThumb,"top","".concat(o,"px")),p(this.hueThumb,"left","0px")))},M.prototype.destroy=function(){this.hueBar&&(w(this.hueBar,"click",this.handleHueSliderClick.bind(this)),w(this.hueBar,"mousedown",this.handleHueSliderMouseDown.bind(this))),this.hueBar=null,this.hueThumb=null},M.prototype.install=function(t){var e=this;this.ewColorPicker=t,this.handleOptions(),t.on&&"function"==typeof t.on&&t.on("change",function(t){t=P(t);e.updateHueThumbPosition(t.h)}),null!=(t=this.run)&&t.call(this)},M.pluginName="ewColorPickerHue",M.applyOrder="post";var Gt=M;function M(t){var e=this;this.ewColorPicker=t,this.options={},this.hueBar=null,this.hueThumb=null,this.isHorizontal=!1,this._hasHue=!0,this.handleOptions(),!1===this.options.hue&&(this._hasHue=!1),this.throttledUpdateHue=Ot(this.updateHue.bind(this),16),this.ewColorPicker.on&&"function"==typeof this.ewColorPicker.on&&this.ewColorPicker.on("change",function(t){t&&e.hueThumb&&(t=P(t),e.updateHueThumbPosition(t.h))}),this.run()}Object.defineProperty(H.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(t){this._hasAlpha!==t&&((this._hasAlpha=t)?this.render():this.alphaBar&&this.alphaBar.parentNode&&(this.alphaBar.parentNode.removeChild(this.alphaBar),this.alphaBar=null))},enumerable:!1,configurable:!0}),H.prototype.enableAlpha=function(t){this.hasAlpha=t=void 0===t?!0:t},H.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i({},this.options,this.ewColorPicker.options),this.isHorizontal="horizontal"===this.options.alphaDirection)},H.prototype.run=function(){var t=this;this.hasAlpha&&this.render(),setTimeout(function(){t.bindEvents()},10)},H.prototype.render=function(){var t,e,o=this.ewColorPicker.getMountPoint("panelContainer");o?((t=f(".".concat(this.prefix,"color-picker-slider.ew-alpha"),o))&&r(t),t=c("div"),u(t,"".concat(this.prefix,"color-picker-slider ew-alpha ")+(this.isHorizontal?"".concat(this.prefix,"color-picker-is-horizontal"):"".concat(this.prefix,"color-picker-is-vertical"))),this.alphaBar=c("div"),u(this.alphaBar,"".concat(this.prefix,"color-picker-alpha-slider-bar")),e=c("div"),u(e,"".concat(this.prefix,"color-picker-alpha-slider-wrapper")),g(this.alphaBar,e),e=c("div"),u(e,"".concat(this.prefix,"color-picker-alpha-slider-bg")),g(this.alphaBar,e),this.alphaThumb=c("div"),u(this.alphaThumb,"".concat(this.prefix,"color-picker-alpha-slider-thumb")),g(this.alphaBar,this.alphaThumb),g(t,this.alphaBar),this.isHorizontal?(e=f(".".concat(this.prefix,"color-picker-bottom-row"),o))&&e.parentNode?e.parentNode.insertBefore(t,e):g(o,t):(e=f(".".concat(this.prefix,"color-picker-panel"),o))&&e.parentNode?e.parentNode.insertBefore(t,e.nextSibling):g(o,t),(e=this.ewColorPicker.getColor())&&(o=P(e),this.updateAlphaThumbPosition(o.a))):h("[ewColorPicker] Panel container not found, please check the ewColorPicker instance!")},H.prototype.bindEvents=function(){var e=this;this.alphaBar&&(v(this.alphaBar,"click",function(t){e.handleAlphaSliderClick(t)}),v(this.alphaBar,"mousedown",function(t){e.handleAlphaSliderMouseDown(t)}))},H.prototype.handleAlphaSliderClick=function(t){var e,o;this.alphaBar&&(this.options.disabled?(t.preventDefault(),t.stopPropagation()):(e=b(this.alphaBar),t=this.isHorizontal?(o=t.clientX-e.left,Math.max(0,Math.min(1,1-o/e.width))):(o=t.clientY-e.top,Math.max(0,Math.min(1,1-o/e.height))),this.updateAlpha(t)))},H.prototype.handleAlphaSliderMouseDown=function(t){var i,n,e,o,r=this;this.alphaBar&&!this.options.disabled&&(i=this.alphaBar,n=this.isHorizontal,e=function(t){var e,o=b(i);t=n?(e=t.clientX-o.left,Math.max(0,Math.min(1,1-e/o.width))):(e=t.clientY-o.top,Math.max(0,Math.min(1,1-e/o.height))),r.throttledUpdateAlpha(t)},o=function(){w(document,"mousemove",e),w(document,"mouseup",o)},v(document,"mousemove",e),v(document,"mouseup",o))},H.prototype.updateAlpha=function(t){var e=this.ewColorPicker.getColor();e&&((e=P(e)).a=t,e=wt(e),this.ewColorPicker.setColor(e),this.updateAlphaThumbPosition(t),t=null==(t=this.ewColorPicker.plugins)?void 0:t.ewColorPickerColorMode)&&"hex"!==t.currentMode&&t.updateInputValues(e)},H.prototype.updateAlphaThumbPosition=function(t){var e,o;this.alphaThumb&&this.alphaBar&&(o=this.isHorizontal,e=b(this.alphaBar),o?(o=Math.max(0,Math.min(e.width,(1-t)*e.width)),p(this.alphaThumb,"left","".concat(o,"px")),p(this.alphaThumb,"top","0px")):(o=Math.max(0,Math.min(e.height,(1-t)*e.height)),p(this.alphaThumb,"top","".concat(o,"px")),p(this.alphaThumb,"left","0px")))},H.prototype.destroy=function(){this.alphaBar&&(w(this.alphaBar,"click",this.handleAlphaSliderClick.bind(this)),w(this.alphaBar,"mousedown",this.handleAlphaSliderMouseDown.bind(this)),r(this.alphaBar)),this.alphaBar=null,this.alphaThumb=null},H.prototype.install=function(t){var e=this;this.ewColorPicker=t,this.handleOptions(),C(t.on)&&t.on("change",function(t){t=P(t);e.updateAlphaThumbPosition(t.a)}),null!=(t=this.run)&&t.call(this)},H.pluginName="ewColorPickerAlpha",H.applyOrder="post";var qt=H;function H(t){var e=this;this.ewColorPicker=t,this.options={},this.alphaBar=null,this.alphaThumb=null,this.isHorizontal=!1,this._hasAlpha=!0,this.handleOptions(),!1===this.options.alpha&&(this._hasAlpha=!1),this.throttledUpdateAlpha=Ot(this.updateAlpha.bind(this),16),C(this.ewColorPicker.on)&&this.ewColorPicker.on("change",function(t){t=P(t);e.updateAlphaThumbPosition(t.a)}),this.run()}Object.defineProperty(T.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"hasInput",{get:function(){return this._hasInput},set:function(t){this._hasInput!==t&&((this._hasInput=t)?(this.render(),this.bindEvents()):this.input&&this.input.parentNode&&(r(this.input),this.input=null))},enumerable:!1,configurable:!0}),T.prototype.enableInput=function(t){this.hasInput=t=void 0===t?!0:t},T.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i(this.options,this.ewColorPicker.options))},T.prototype.updateOptions=function(){this.handleOptions(),this.hasInput?this.render():this.input&&this.input.parentNode&&(r(this.input),this.input=null)},T.prototype.run=function(){this.hasInput&&(this.render(),this.bindEvents())},T.prototype.render=function(){var t,e,o=this.ewColorPicker.getMountPoint("panelContainer");o?(o=f(".".concat(this.prefix,"color-picker-bottom-row"),o))?(e=f(".".concat(this.prefix,"color-picker-drop-btn-group"),o),(t=f(".".concat(this.prefix,"color-picker-input-container"),o))||(t=c("div"),u(t,"".concat(this.prefix,"color-picker-input-container")),u(t,"".concat(this.prefix,"color-picker-input-container-flex")),e&&e.parentNode?e.parentNode.insertBefore(t,e):g(o,t)),this.input=f("input.".concat(this.prefix,"color-picker-input"),t),this.input||(this.input=c("input"),this.input&&(u(this.input,"".concat(this.prefix,"color-picker-input")),d(this.input,{type:"text",name:"".concat(this.prefix,"color-picker-input"),placeholder:"请输入颜色值"}),g(t,this.input))),(e=this.ewColorPicker.getColor())&&-1===e.indexOf("NaN")||(e=this.getDefaultColor(),""===this.ewColorPicker.currentColor?e="":this.ewColorPicker.setColor(e)),o=this.formatColorForDisplay(e),this.input&&(this.input.value=o),this.options.disabled&&this.setDisabled(!0)):h("[ewColorPicker] Bottom row container not found"):h("[ewColorPicker] Panel container not found")},T.prototype.bindEvents=function(){var e=this;this.input&&(v(this.input,"blur",function(t){e.debouncedOnInputColor(t.target.value)}),v(this.input,"keydown",function(t){"Enter"===t.key&&e.debouncedOnInputColor(t.target.value)}),this.ewColorPicker.on("change",function(t){e.update(t)}))},T.prototype.onInputColor=function(t){var e,o,i;t.trim()&&(yt(t)?(i=y(t),this.ewColorPicker.hsvaColor=P(i),this.ewColorPicker.setColor(i),this.syncOtherPlugins(i),C(this.options.changeColor)&&null!=(o=(e=this.options).changeColor)&&o.call(e,i)):h("[ewColorPicker warning]: Invalid color format: ".concat(t)))},T.prototype.syncOtherPlugins=function(t){var e=this.ewColorPicker.hsvaColor,o=null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerColorMode,o=(o&&"hex"!==o.currentMode&&o.updateInputValues(t),null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerHue),o=(o&&o.updateHueThumbPosition&&o.updateHueThumbPosition(e.h),null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerAlpha),e=(o&&o.updateAlphaThumbPosition&&o.updateAlphaThumbPosition(e.a),null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerPanel),e=(e&&e.updatePanelColor&&e.updatePanelColor(t),null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerBox);e&&e.setBoxBgColor&&e.setBoxBgColor(t)},T.prototype.setValue=function(t){this.input&&(this.input.value=t)},T.prototype.getValue=function(){return this.input?this.input.value:""},T.prototype.setDisabled=function(t){this.input&&(t?(this.input.disabled=!0,s(this.input,"".concat(this.prefix,"input-disabled"))||u(this.input,"".concat(this.prefix,"input-disabled"))):(this.input.disabled=!1,s(this.input,"".concat(this.prefix,"input-disabled"))&&a(this.input,"".concat(this.prefix,"input-disabled"))))},T.prototype.update=function(t){t&&-1===t.indexOf("NaN")||(t=""===this.ewColorPicker.currentColor?"":this.getDefaultColor());t=this.formatColorForDisplay(t);this.setValue(t)},T.prototype.getDefaultColor=function(){var t;return this.hasAlpha?"rgba(255,0,0,1)":null!=(t=this.ewColorPicker.plugins)&&t.ewColorPickerColorMode?"HSL"===(t=this.ewColorPicker.currentMode||"HSV")?"hsl(0, 100%, 50%)":"RGB"===t?"rgba(255,0,0,1)":"#ff0000":"#ff0000"},T.prototype.formatColorForDisplay=function(t){var e,o;return t?(o=t,!(null==(e=this.ewColorPicker.plugins)||!e.ewColorPickerColorMode)&&(e=this.ewColorPicker.plugins.ewColorPickerColorMode)&&"hex"===e.getCurrentMode()?o&&!o.startsWith("#")&&(e=y(o))&&(e=mt(e))&&(o=kt(e)):this.hasAlpha&&!t.startsWith("rgba")?o=wt(P(t)):!this.hasAlpha&&t.startsWith("rgba")&&(o=vt(t)),o):""},T.prototype.destroy=function(){this.input&&(w(this.input,"blur",this.debouncedOnInputColor),w(this.input,"keydown",this.debouncedOnInputColor)),this.input=null},T.prototype.install=function(t){var e=this;this.ewColorPicker=t,this.handleOptions(),C(null==t?void 0:t.on)&&t.on("change",function(t){e.update(t)}),null!=(t=this.run)&&t.call(this)},T.pluginName="ewColorPickerInput",T.applyOrder="post";var Xt=T;function T(t){this.ewColorPicker=t,this.options={},this.input=null,this._hasInput=!0,this.handleOptions(),!1===this.options.hasInput&&(this._hasInput=!1),this.debouncedOnInputColor=Tt(this.onInputColor.bind(this),300),this.run(),this.hasAlpha=!!this.ewColorPicker.plugins.ewColorPickerAlpha}Object.defineProperty(O.prototype,"prefix",{get:function(){return this.options.prefix||m},enumerable:!1,configurable:!0}),O.prototype.createElements=function(){var t=this.prefix,e=(this.container=c("div"),u(this.container,"".concat(t,"input-number")),u(this.container,"".concat(t,"input-number--").concat(this.options.size)),this.input=c("input"),u(this.input,"".concat(t,"input-number__input")),d(this.input,{type:"text",inputmode:"decimal",placeholder:this.options.placeholder}),c("div"));u(e,"".concat(t,"input-number__buttons")),this.upButton=c("button"),u(this.upButton,"".concat(t,"input-number__button")),u(this.upButton,"".concat(t,"input-number__button--up")),d(this.upButton,{type:"button"}),this.upButton.innerHTML=At("".concat(t,"input-number__icon"),void 0,t),this.downButton=c("button"),u(this.downButton,"".concat(t,"input-number__button")),u(this.downButton,"".concat(t,"input-number__button--down")),d(this.downButton,{type:"button"}),this.downButton.innerHTML=It("".concat(t,"input-number__icon"),void 0,t),g(e,this.upButton),g(e,this.downButton),g(this.container,this.input),g(this.container,e),this.setStyles()},O.prototype.setStyles=function(){this.options.disabled&&this.setDisabled(!0)},O.prototype.bindEvents=function(){v(this.input,"input",this.handleInput.bind(this)),v(this.input,"blur",this.handleBlur.bind(this)),v(this.input,"focus",this.handleFocus.bind(this)),v(this.input,"keydown",this.handleKeydown.bind(this)),v(this.upButton,"click",this.handleUpClick.bind(this)),v(this.downButton,"click",this.handleDownClick.bind(this)),v(this.container,"wheel",this.handleWheel.bind(this))},O.prototype.handleInput=function(t){var t=t.target.value;""!==t&&"-"!==t&&"."!==t&&(t=parseFloat(t),isNaN(t)?this.input.value=this.currentValue.toString():this.currentValue=t)},O.prototype.handleBlur=function(t){this.isFocused=!1,this.removeClass(this.container,"".concat(this.prefix,"input-number--focused")),this.updateValue(this.currentValue,!1),this.options.onBlur(this.currentValue)},O.prototype.handleFocus=function(t){this.isFocused=!0,this.addClass(this.container,"".concat(this.prefix,"input-number--focused")),this.options.onFocus(t)},O.prototype.handleKeydown=function(t){switch(t.key){case"ArrowUp":t.preventDefault(),this.increment();break;case"ArrowDown":t.preventDefault(),this.decrement();break;case"Enter":t.preventDefault(),this.input.blur()}},O.prototype.handleUpClick=function(){this.options.disabled||this.increment()},O.prototype.handleDownClick=function(){this.options.disabled||this.decrement()},O.prototype.handleWheel=function(t){this.isFocused&&!this.options.disabled&&(t.preventDefault(),t.deltaY<0?this.increment():this.decrement())},O.prototype.increment=function(){var t=this.currentValue+this.options.step;this.updateValue(t)},O.prototype.decrement=function(){var t=this.currentValue-this.options.step;this.updateValue(t)},O.prototype.updateValue=function(t,e){void 0===e&&(e=!0);var o=this.options.min,i=this.options.max,o=(t<o?t=o:i<t&&(t=i),this.options.precision);t=Math.round(t*Math.pow(10,o))/Math.pow(10,o),this.currentValue=t,this.formatDisplayValue(),e&&this.debouncedOnChange(t)},O.prototype.formatDisplayValue=function(){var t=this.options.precision;this.input.value=this.currentValue.toFixed(t)},O.prototype.addClass=function(t,e){s(t,e)||u(t,e)},O.prototype.removeClass=function(t,e){s(t,e)&&a(t,e)},O.prototype.getValue=function(){return this.currentValue},O.prototype.setValue=function(t,e){this.updateValue(t,e=void 0===e?!0:e)},O.prototype.setDisabled=function(t){(this.options.disabled=t)?(this.addClass(this.container,"".concat(this.prefix,"input-number--disabled")),d(this.input,{disabled:"true"}),d(this.upButton,{disabled:"true"}),d(this.downButton,{disabled:"true"})):(this.removeClass(this.container,"".concat(this.prefix,"input-number--disabled")),d(this.input,{disabled:"false"}),d(this.upButton,{disabled:"false"}),d(this.downButton,{disabled:"false"}))},O.prototype.getElement=function(){return this.container},O.prototype.destroy=function(){var t;w(this.input,"input",this.handleInput.bind(this)),w(this.input,"blur",this.handleBlur.bind(this)),w(this.input,"focus",this.handleFocus.bind(this)),w(this.input,"keydown",this.handleKeydown.bind(this)),w(this.upButton,"click",this.handleUpClick.bind(this)),w(this.downButton,"click",this.handleDownClick.bind(this)),w(this.container,"wheel",this.handleWheel.bind(this)),null!=(t=this.container)&&t.parentNode&&r(this.container),this.container=null,this.input=null,this.upButton=null,this.downButton=null},O.prototype.install=function(t){var e;this.ewColorPicker=t,null!=(e=this.handleOptions)&&e.call(this),!1!==(null==(e=this.ewColorPicker.options)?void 0:e.showInputNumber)&&(C(t.on)&&t.on("change",function(){}),null!=(e=this.run))&&e.call(this)};var Yt=O;function O(t){void 0===t&&(t={});var e={value:0,min:-1/0,max:1/0,step:1,precision:0,disabled:this.isFocused=!1,placeholder:"",size:"default",prefix:m,onChange:function(){},onBlur:function(){},onFocus:function(){}};this.options=i(e,t),this.currentValue=null!=(e=this.options.value)?e:0,this.debouncedOnChange=Tt(this.options.onChange,300),this.createElements(),this.bindEvents(),this.updateValue(this.currentValue,!1)}A.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),this.run()},A.prototype.updateOptions=function(){var e=this;this.handleOptions(),this.instances.forEach(function(t){K(e.options.disabled)||t.setDisabled(e.options.disabled)})},A.prototype.run=function(){var t,e,o;this.ewColorPicker&&(t=k(this.ewColorPicker),e=this.createInputNumber({value:0,disabled:this.options.disabled||!1,prefix:t}),this.instances.set("default",e),o=this.ewColorPicker.getMountPoint("panelContainer"))&&(o=o.querySelector(".".concat(t,"color-picker-bottom-row")))&&o.appendChild(e.getElement())},A.prototype.handleOptions=function(){var t=null==(t=this.ewColorPicker)?void 0:t.options;t&&(this.options=n(n(n({},this.options),t),{disabled:K(t.disabled)?this.options.disabled||!1:t.disabled}))},A.prototype.createInputNumber=function(t){return new Yt(t)},A.prototype.destroy=function(){this.instances.forEach(function(t){t.destroy()}),this.instances.clear(),this.ewColorPicker=null},A.pluginName="ewColorPickerInputNumber",A.applyOrder="post";var Kt=A;function A(t){this.options={},this.instances=new Map,this.ewColorPicker=t,this.handleOptions()}Object.defineProperty(I.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasClear",{get:function(){return this._hasClear},set:function(t){this._hasClear!==t&&(this._hasClear=t,this.render())},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasSure",{get:function(){return this._hasSure},set:function(t){this._hasSure!==t&&(this._hasSure=t,this.render())},enumerable:!1,configurable:!0}),I.prototype.enableClear=function(t){this.hasClear=t=void 0===t?!0:t},I.prototype.enableSure=function(t){this.hasSure=t=void 0===t?!0:t},I.prototype.enableButtons=function(t){this.hasClear=t=void 0===t?!0:t,this.hasSure=t},I.prototype.handleOptions=function(){this.options=i({},this.options,this.ewColorPicker.options)},I.prototype.updateOptions=function(){var t=this;this.handleOptions(),setTimeout(function(){t.render()},0)},I.prototype.run=function(){var t=this;!1!==this.options.showButton&&(this.render(),this.bindEvents(),setTimeout(function(){t.adjustButtonGroupStyle()},0))},I.prototype.render=function(){var t,e=this.ewColorPicker.getMountPoint("panelContainer");e?(e=f(".".concat(this.prefix,"color-picker-bottom-row"),e))?((t=f(".".concat(this.prefix,"color-picker-drop-btn-group"),e))||(t=c("div"),u(t,"".concat(this.prefix,"color-picker-drop-btn-group")),g(e,t)),t.textContent="",this.hasClear&&(this.clearButton=c("button"),u(this.clearButton,"".concat(this.prefix,"color-picker-clear-btn ").concat(this.prefix,"color-picker-drop-btn")),this.setClearText(this.options.clearText||"清空"),g(t,this.clearButton)),this.hasSure&&(this.sureButton=c("button"),u(this.sureButton,"".concat(this.prefix,"color-picker-sure-btn ").concat(this.prefix,"color-picker-drop-btn")),this.setSureText(this.options.sureText||"确认"),g(t,this.sureButton)),this.adjustButtonGroupStyle()):h("[ewColorPicker warning]: Bottom row container not found"):h("[ewColorPicker warning]: Panel container not found")},I.prototype.bindEvents=function(){var t=this;this.clearButton&&v(this.clearButton,"click",function(){t.debouncedOnClearColor()}),this.sureButton&&v(this.sureButton,"click",function(){t.debouncedOnSureColor()}),this.ewColorPicker.on("mode-change",function(){t.adjustButtonGroupStyle()})},I.prototype.onClearColor=function(){var t,e,o;this.ewColorPicker.options.defaultColor?(o=y(e=this.ewColorPicker.options.defaultColor))&&(t=P(o)):(e="",t=void 0),this.ewColorPicker.hsvaColor=t||{h:0,s:100,v:100,a:1},this.ewColorPicker.setColor(e),this.ewColorPicker.syncAllPlugins(e),this.ewColorPicker.hidePanel(),C(this.options.clear)&&null!=(t=(o=this.options).clear)&&t.call(o,this.ewColorPicker),this.ewColorPicker.trigger("clear")},I.prototype.onSureColor=function(){var t,e;C(this.options.sure)&&null!=(e=(t=this.options).sure)&&e.call(t,this.ewColorPicker.currentColor,this.ewColorPicker),this.ewColorPicker.trigger("sure",this.ewColorPicker.currentColor,this.ewColorPicker),this.ewColorPicker.hidePanel()},I.prototype.setClearText=function(t){this.clearButton&&(this.clearButton.textContent=t)},I.prototype.setSureText=function(t){this.sureButton&&(this.sureButton.textContent=t)},I.prototype.setDisabled=function(t){this.clearButton&&d(this.clearButton,{disabled:t.toString()}),this.sureButton&&d(this.sureButton,{disabled:t.toString()})},I.prototype.destroy=function(){this.clearButton&&w(this.clearButton,"click",this.debouncedOnClearColor),this.sureButton&&w(this.sureButton,"click",this.debouncedOnSureColor),this.clearButton=null,this.sureButton=null},I.prototype.adjustButtonGroupStyle=function(){var t,e,o=this.prefix,i=this.ewColorPicker.getMountPoint("panelContainer");i&&(t=f(".".concat(o,"color-picker-bottom-row"),i))&&(e=f(".".concat(o,"color-picker-drop-btn-group"),t))&&(null!==f(".".concat(o,"color-picker-inputs-group"),i)?(u(e,"".concat(o,"color-picker-drop-btn-group-multi")),a(e,"".concat(o,"color-picker-drop-btn-group-single")),u(t,"".concat(o,"color-picker-bottom-row-multi")),a(t,"".concat(o,"color-picker-bottom-row-single"))):(u(e,"".concat(o,"color-picker-drop-btn-group-single")),a(e,"".concat(o,"color-picker-drop-btn-group-multi")),u(t,"".concat(o,"color-picker-bottom-row-single")),a(t,"".concat(o,"color-picker-bottom-row-multi"))))},I.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),null!=(t=this.run)&&t.call(this)},I.pluginName="ewColorPickerButton",I.applyOrder="post";var Qt=I;function I(t){this.ewColorPicker=t,this.options={},this.clearButton=null,this.sureButton=null,this._hasClear=!0,this._hasSure=!0,this.handleOptions(),!1===this.options.hasClear&&(this._hasClear=!1),!1===this.options.hasSure&&(this._hasSure=!1),this.debouncedOnClearColor=Tt(this.onClearColor.bind(this),100),this.debouncedOnSureColor=Tt(this.onSureColor.bind(this),100),this.run()}Object.defineProperty(E.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),E.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i(this.options,this.ewColorPicker.options),this.ewColorPicker.options.ewColorPickerPredefine)&&(this.options=i(this.options,this.ewColorPicker.options.ewColorPickerPredefine))},E.prototype.run=function(){0<this.getValidPredefineColors().length&&(this.render(),this.bindEvents(),this.bindColorChangeEvent())},E.prototype.getValidPredefineColors=function(){var e=this;return this.options.predefineColor&&Array.isArray(this.options.predefineColor)?this.options.predefineColor.filter(function(t){var t=e.parseColorData(t).color;return!(!(t=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))}):[]},E.prototype.render=function(){var i=this,t=this.ewColorPicker.getMountPoint("panelContainer");t?(this.container=f(".".concat(this.prefix,"color-picker-predefine-container"),t),this.container||(this.container=c("div"),u(this.container,"".concat(this.prefix,"color-picker-predefine-container"))),this.container&&(this.container.textContent="",this.predefineItems=[],this.getValidPredefineColors().forEach(function(t){var t=i.parseColorData(t).color,e=c("div"),o=(u(e,"".concat(i.prefix,"color-picker-predefine-color")),c("div"));u(o,"".concat(i.prefix,"color-picker-predefine-color-item")),p(o,"backgroundColor",t),g(e,o),g(i.container,e),i.predefineItems.push(e)})),this.ensureContainerAtCorrectPosition(t),this.bindToggleEvent(t)):h("[ewColorPicker warning]: Panel container not found")},E.prototype.parseColorData=function(t){return{color:Q(t)?t:t.color,disabled:!!Z(t)&&t.disabled}},E.prototype.bindToggleEvent=function(e){var o=this;this.isEventBound&&this.toggleHandler&&(this.ewColorPicker.off("toggle",this.toggleHandler),this.isEventBound=!1),this.toggleHandler=function(t){t&&o.ensureContainerAtCorrectPosition(e)},this.ewColorPicker.on("toggle",this.toggleHandler),this.isEventBound=!0},E.prototype.bindColorChangeEvent=function(){var e=this;this.changeHandler&&this.ewColorPicker.off("change",this.changeHandler),this.changeHandler=function(t){e.updateActivePredefineColor(t)},this.ewColorPicker.on("change",this.changeHandler)},E.prototype.ensureContainerAtCorrectPosition=function(t){var e,o;this.container&&(e=this.prefix,(o=f(".".concat(e,"color-picker-mode-container"),t))?t.insertBefore(this.container,o):(o=f(".".concat(e,"color-picker-bottom-row"),t))?t.insertBefore(this.container,o):(o=f(".".concat(e,"color-picker-panel"),t))&&o.nextSibling?t.insertBefore(this.container,o.nextSibling):t.appendChild(this.container))},E.prototype.bindEvents=function(){var i=this;this.predefineItems.forEach(function(t,e){var e=i.getValidPredefineColors()[e],e=i.parseColorData(e),o=e.color;e.disabled?u(t,"".concat(i.prefix,"color-picker-predefine-color-disabled")):(v(t,"click",function(t){i.debouncedOnPredefineColorClick(t,o)}),v(t,"blur",function(t){a(t.target,"".concat(i.prefix,"color-picker-predefine-color-active"))}))})},E.prototype.onPredefineColorClick=function(t,e){var o,i,n=this.prefix,r=t.target;s(r,"".concat(n,"color-picker-predefine-color"))||(r=r.closest(".".concat(n,"color-picker-predefine-color"))||r),s(r,"".concat(n,"color-picker-predefine-color-disabled"))||(this.options.disabled?(t.preventDefault(),t.stopPropagation()):(u(r,"".concat(n,"color-picker-predefine-color-active")),this.predefineItems.forEach(function(t){t!==r&&a(t,"".concat(n,"color-picker-predefine-color-active"))}),yt(e)?(t=y(e),this.ewColorPicker.hsvaColor=P(t),this.ewColorPicker.setColor(t),C(this.options.changeColor)&&null!=(i=(o=this.options).changeColor)&&i.call(o,t)):h("[ewColorPicker warning]: Invalid predefine color: ".concat(e))))},E.prototype.updatePredefineColors=function(t){this.options.predefineColor=t,this.predefineItems=[],this.render(),this.bindEvents()},E.prototype.setDisabled=function(t,e){this.predefineItems[t]&&(e?u:a)(this.predefineItems[t],"".concat(this.prefix,"color-picker-predefine-color-disabled"))},E.prototype.destroy=function(){var e=this;this.predefineItems.forEach(function(t){w(t,"click",e.debouncedOnPredefineColorClick),w(t,"blur",function(){})}),this.isEventBound&&this.toggleHandler&&(this.ewColorPicker.off("toggle",this.toggleHandler),this.toggleHandler=null,this.isEventBound=!1),this.changeHandler&&(this.ewColorPicker.off("change",this.changeHandler),this.changeHandler=null),this.predefineItems=[],this.container=null},E.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),null!=(t=this.run)&&t.call(this)},E.prototype.updateActivePredefineColor=function(t){var o,i,n=this;t&&(o=y(t),i=this.prefix,this.predefineItems.forEach(function(t,e){e=n.getValidPredefineColors()[e],e=y(n.parseColorData(e).color);(o===e?u:a)(t,"".concat(i,"color-picker-predefine-color-active"))}))},E.pluginName="ewColorPickerPredefine";var Zt=E;function E(t){this.ewColorPicker=t,this.options={},this.predefineItems=[],this.container=null,this.toggleHandler=null,this.changeHandler=null,this.isEventBound=!1,this.handleOptions(),this.debouncedOnPredefineColorClick=Tt(this.onPredefineColorClick.bind(this),100),this.run()}Object.defineProperty(D.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"hasAlphaPlugin",{get:function(){var t;return!(null==(t=this.ewColorPicker.plugins)||!t.ewColorPickerAlpha)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"inputPlugin",{get:function(){var t;return null==(t=this.ewColorPicker.plugins)?void 0:t.ewColorPickerInput},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"alphaPlugin",{get:function(){var t;return null==(t=this.ewColorPicker.plugins)?void 0:t.ewColorPickerAlpha},enumerable:!1,configurable:!0}),D.prototype.initializePlugin=function(){function t(){e.handleOptions(),e.run()}var e=this;this.ewColorPicker.plugins?t():setTimeout(t,0)},D.prototype.install=function(e){function t(){var t;o.handleOptions(),e.on&&C(e.on)&&e.on("change",function(t){"hex"!==o.currentMode&&o.updateInputValues(t)}),null!=(t=o.run)&&t.call(o),o.hasAlphaPlugin&&"rgb"===o.currentMode&&o.updateInputStructure()}var o=this;this.ewColorPicker=e;this.ewColorPicker.plugins?t():setTimeout(t,0)},D.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=i({},this.options,this.ewColorPicker.options),void 0!==this.ewColorPicker.options.ewColorPickerColorMode&&(!1===this.ewColorPicker.options.ewColorPickerColorMode?this.options.showColorMode=!1:"object"==typeof this.ewColorPicker.options.ewColorPickerColorMode&&(this.options=i({},this.options,this.ewColorPicker.options.ewColorPickerColorMode))),this.hasAlphaPlugin?this.currentMode=this.options.defaultMode||"rgb":this.currentMode=this.options.defaultMode||"hex")},D.prototype.updateOptions=function(){this.handleOptions(),this.render()},D.prototype.run=function(){this.handleOptions(),!1!==this.options.showColorMode&&(this.render(),this.bindEvents(),this.hasAlphaPlugin&&"rgb"===this.currentMode&&this.updateInputStructure(),this.setupInputPluginListener())},D.prototype.render=function(){var t=this.ewColorPicker.getMountPoint("panelContainer");t?(this.modeContainer=f(".".concat(this.prefix,"color-picker-mode-container"),t),this.modeContainer||this.createModeContainer(t),this.updateModeDisplay()):h("[ewColorPicker] Panel container not found")},D.prototype.createModeContainer=function(t){var e=this.prefix,e=(this.modeContainer=c("div"),u(this.modeContainer,"".concat(e,"color-picker-mode-container")),this.upButton=c("button"),u(this.upButton,"".concat(e,"color-picker-mode-up-btn")),d(this.upButton,{type:"button",title:"上一个模式"}),this.upButton.innerHTML=At("",16,e),this.modeText=c("div"),u(this.modeText,"".concat(e,"color-picker-mode-text")),this.downButton=c("button"),u(this.downButton,"".concat(e,"color-picker-mode-down-btn")),d(this.downButton,{type:"button",title:"下一个模式"}),this.downButton.innerHTML=It("",16,e),g(this.modeContainer,this.upButton),g(this.modeContainer,this.modeText),g(this.modeContainer,this.downButton),f(".".concat(e,"color-picker-bottom-row"),t));e?g(t,this.modeContainer,void 0,e):g(t,this.modeContainer)},D.prototype.updateModeDisplay=function(){this.modeText&&(this.modeText.textContent=this.getModeDisplayName(this.currentMode))},D.prototype.bindEvents=function(){var t,e=this;this.upButton&&this.downButton&&(v(this.upButton,"click",t=function(){e.options.disabled||e.switchToPreviousMode()}),this.boundEventHandlers.push({element:this.upButton,event:"click",handler:t}),v(this.downButton,"click",t=function(){e.options.disabled||e.switchToNextMode()}),this.boundEventHandlers.push({element:this.downButton,event:"click",handler:t}),this.upButton&&(v(this.upButton,"mouseenter",this.handleUpButtonHover),v(this.upButton,"mouseleave",this.handleUpButtonLeave),this.boundEventHandlers.push({element:this.upButton,event:"mouseenter",handler:this.handleUpButtonHover}),this.boundEventHandlers.push({element:this.upButton,event:"mouseleave",handler:this.handleUpButtonLeave})),this.downButton&&(v(this.downButton,"mouseenter",this.handleDownButtonHover),v(this.downButton,"mouseleave",this.handleDownButtonLeave),this.boundEventHandlers.push({element:this.downButton,event:"mouseenter",handler:this.handleDownButtonHover}),this.boundEventHandlers.push({element:this.downButton,event:"mouseleave",handler:this.handleDownButtonLeave})),this.ewColorPicker.on("change",function(t){"hex"!==e.currentMode&&e.updateInputValues(t)}))},D.prototype.switchToPreviousMode=function(){var t=["hex","rgb","hsl"],e=t.indexOf(this.currentMode);this.debouncedOnModeChange(t[0<e?e-1:t.length-1])},D.prototype.switchToNextMode=function(){var t=["hex","rgb","hsl"],e=t.indexOf(this.currentMode);this.debouncedOnModeChange(t[(e+1)%t.length])},D.prototype.onModeChange=function(t){this.currentMode=t,this.updateModeDisplay(),this.updateInputStructure();var e,o=this.ewColorPicker.getColor();o&&"hex"!==t&&this.updateInputValues(o),C(this.options.changeMode)&&null!=(e=(o=this.options).changeMode)&&e.call(o,t,this.ewColorPicker),this.ewColorPicker.trigger("mode-change",t)},D.prototype.updateInputStructure=function(){var t=this.prefix,e=this.ewColorPicker.getMountPoint("panelContainer");e&&(e=f(".".concat(t,"color-picker-bottom-row"),e))&&(t=f(".".concat(t,"color-picker-input-container"),e))&&(this.inputPlugin&&!this.inputPlugin.hasInput?(this.clearInputNumberInstances(),t.innerHTML=""):(this.clearInputNumberInstances(),"hex"===this.currentMode?this.restoreDefaultInput():(t.innerHTML="",this.createInputsForMode(t))))},D.prototype.setupInputPluginListener=function(){},D.prototype.createInputsForMode=function(t){var s,e,a=this,l=this.prefix;(!this.inputPlugin||this.inputPlugin.hasInput)&&(t.innerHTML="",e=[],"rgb"===this.currentMode?e=this.hasAlphaPlugin?["R","G","B","A"]:["R","G","B"]:"hsl"===this.currentMode&&(e=this.hasAlphaPlugin?["H","S","L","A"]:["H","S","L"]),s=c("div"),u(s,"".concat(l,"color-picker-inputs-group")),e.forEach(function(t,e){var o,i,n=c("div"),r=(u(n,"".concat(l,"color-picker-inputs-col")),c("div"));u(r,"".concat(l,"color-picker-input-label")),r.textContent=t,g(n,r),"rgb"===a.currentMode?(o=(i=new Yt({value:0,min:0,max:3===e?1:255,step:3===e?.01:1,precision:3===e?2:0,placeholder:t,size:"small",prefix:l,onChange:function(){a.debouncedUpdateColorFromRgb()}})).getElement(),a.inputNumberInstances.set(t.toLowerCase(),i),u(o,"".concat(l,"color-picker-rgb-").concat(t.toLowerCase(),"-input"))):"hsl"===a.currentMode&&(0===e?(o=(i=new Yt({value:0,min:0,max:360,step:1,precision:0,placeholder:t,size:"small",prefix:l,onChange:function(){a.debouncedUpdateColorFromHsl()}})).getElement(),a.inputNumberInstances.set("h",i)):3===e&&a.hasAlphaPlugin?(o=(i=new Yt({value:0,min:0,max:1,step:.01,precision:2,placeholder:t,size:"small",prefix:l,onChange:function(){a.debouncedUpdateColorFromHsl()}})).getElement(),a.inputNumberInstances.set("a",i)):(o=c("input"),d(o,{type:"text",placeholder:t,class:"".concat(l,"color-picker-hsl-").concat(t.toLowerCase(),"-input ").concat(l,"color-picker-input")})),o)&&u(o,"".concat(l,"color-picker-hsl-").concat(t.toLowerCase(),"-input")),o||(o=c("input"),d(o,{type:"text",placeholder:t,class:"".concat(l,"color-picker-default-input")})),g(n,o),g(s,n)}),g(t,s),e=this.ewColorPicker.getColor())&&this.updateInputValues(e)},D.prototype.getInputContainer=function(){var t=this.prefix,e=this.ewColorPicker.getMountPoint("panelContainer");return(e=e&&f(".".concat(t,"color-picker-bottom-row"),e))&&f(".".concat(t,"color-picker-input-container"),e)||document},D.prototype.syncChannelValue=function(t,e,o){var i,t=this.inputNumberInstances.get(t);t?(i=parseFloat(o),isNaN(i)||t.setValue(i,!1)):e&&(e.value=o)},D.prototype.clearInputNumberInstances=function(){this.inputNumberInstances.forEach(function(t){return t.destroy()}),this.inputNumberInstances.clear()},D.prototype.updateInputValues=function(t){var e,o,i,n,r,s,a;t&&(t=y(t))&&(t=mt(t))&&(e=this.getInputContainer(),o=this.prefix,"rgb"===this.currentMode?(i=f(".".concat(o,"color-picker-rgb-r-input input"),e),n=f(".".concat(o,"color-picker-rgb-g-input input"),e),r=f(".".concat(o,"color-picker-rgb-b-input input"),e),a=f(".".concat(o,"color-picker-rgb-a-input input"),e),this.syncChannelValue("r",i,Math.round(t.r).toString()),this.syncChannelValue("g",n,Math.round(t.g).toString()),this.syncChannelValue("b",r,Math.round(t.b).toString()),this.syncChannelValue("a",a,t.a.toFixed(2))):"hsl"===this.currentMode&&(i=((t,e,o)=>{t/=255,e/=255,o/=255;var i=Math.max(t,e,o),n=Math.min(t,e,o),r=0,s=0,a=(i+n)/2;if(i!==n){var l=i-n,s=.5<a?l/(2-i-n):l/(i+n);switch(i){case t:r=(e-o)/l+(e<o?6:0);break;case e:r=(o-t)/l+2;break;case o:r=(t-e)/l+4}r/=6}return{h:360*r,s:100*s,l:100*a}})(t.r,t.g,t.b),n=f(".".concat(o,"color-picker-hsl-h-input input"),e),r=f(".".concat(o,"color-picker-hsl-s-input"),e),s=f(".".concat(o,"color-picker-hsl-l-input"),e),a=f(".".concat(o,"color-picker-hsl-a-input input"),e),this.syncChannelValue("h",n,Math.round(i.h).toString()),this.syncChannelValue("s",r,Math.round(i.s).toString()+"%"),this.syncChannelValue("l",s,Math.round(i.l).toString()+"%"),this.syncChannelValue("a",a,t.a.toFixed(2))))},D.prototype.updateColorFromRgbInputs=function(){var t=this.getInputContainer(),e=this.prefix,o=f(".".concat(e,"color-picker-rgb-r-input input"),t),i=f(".".concat(e,"color-picker-rgb-g-input input"),t),n=f(".".concat(e,"color-picker-rgb-b-input input"),t),e=f(".".concat(e,"color-picker-rgb-a-input input"),t);o&&i&&n&&(t=parseInt(o.value)||0,o=parseInt(i.value)||0,i=parseInt(n.value)||0,n=e&&parseFloat(e.value)||1,e="rgba(".concat(t,", ").concat(o,", ").concat(i,", ").concat(n,")"),this.ewColorPicker.setColor(e),this.ewColorPicker.syncAllPlugins(e),this.alphaPlugin)&&this.alphaPlugin.updateAlphaThumbPosition&&this.alphaPlugin.updateAlphaThumbPosition(n)},D.prototype.updateColorFromHslInputs=function(){var t=this.getInputContainer(),e=this.prefix,o=f(".".concat(e,"color-picker-hsl-h-input input"),t),i=f(".".concat(e,"color-picker-hsl-s-input"),t),n=f(".".concat(e,"color-picker-hsl-l-input"),t),e=f(".".concat(e,"color-picker-hsl-a-input input"),t);o&&i&&n&&(t=parseInt(o.value)||0,o=parseInt(i.value.replace("%",""))||0,i=parseInt(n.value.replace("%",""))||0,n=e&&parseFloat(e.value)||1,e="hsla(".concat(t,", ").concat(o,"%, ").concat(i,"%, ").concat(n,")"),this.ewColorPicker.setColor(e),this.ewColorPicker.syncAllPlugins(e),this.alphaPlugin)&&this.alphaPlugin.updateAlphaThumbPosition&&this.alphaPlugin.updateAlphaThumbPosition(n)},D.prototype.getModeDisplayName=function(t){return{hex:"HEX",rgb:"RGB",hsl:"HSL"}[t]||t.toUpperCase()},D.prototype.getCurrentMode=function(){return this.currentMode},D.prototype.setMode=function(t){this.debouncedOnModeChange(t)},D.prototype.restoreDefaultInput=function(){var t,e=this.prefix,o=this.ewColorPicker.getMountPoint("panelContainer");o&&(o=f(".".concat(e,"color-picker-bottom-row"),o))&&(o=f(".".concat(e,"color-picker-input-container"),o))&&(this.inputPlugin&&!this.inputPlugin.hasInput?o.innerHTML="":(o.innerHTML="",u(o,"".concat(e,"color-picker-input-container-flex")),t=c("input"),u(t,"".concat(e,"color-picker-input")),u(t,"".concat(e,"color-picker-input-default")),d(t,{type:"text",name:"".concat(e,"color-picker-input"),placeholder:"请输入颜色值"}),g(o,t),(e=this.ewColorPicker.getColor())&&-1===e.indexOf("NaN")||(e=""),"hex"===this.currentMode&&(o=y(e))&&(o=mt(o))?(o=kt(o),t.value=o):t.value=e,this.bindDefaultInputEvents(t)))},D.prototype.bindDefaultInputEvents=function(t){this.bindInputEvents(t)},D.prototype.rebindDefaultInputEvents=function(){var t=this.prefix,e=this.ewColorPicker.getMountPoint("panelContainer");e&&(e=f(".".concat(t,"color-picker-bottom-row"),e))&&(e=f(".".concat(t,"color-picker-input-container"),e))&&(t=f(".".concat(t,"color-picker-hex-input"),e))&&this.bindInputEvents(t)},D.prototype.bindInputEvents=function(e){function t(t){yt(t=t.target.value)&&(i.ewColorPicker.setColor(t),i.syncOtherPlugins(t))}function o(t){"Enter"===t.key&&yt(t=t.target.value)&&(i.ewColorPicker.setColor(t),i.syncOtherPlugins(t))}var i=this;v(e,"blur",t),this.boundEventHandlers.push({element:e,event:"blur",handler:t}),v(e,"keydown",o),this.boundEventHandlers.push({element:e,event:"keydown",handler:o});this.ewColorPicker.on("change",function(t){e.value="hex"===i.currentMode?i.toHexDisplay(t):t})},D.prototype.toHexDisplay=function(t){var e;return t?!t.startsWith("#")&&(e=y(t))&&(e=mt(e))?kt(e):t:""},D.prototype.syncOtherPlugins=function(t){var e=this.ewColorPicker.hsvaColor,o=(this.inputPlugin&&this.inputPlugin.update&&this.inputPlugin.update(t),null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerHue),e=(o&&o.updateHueThumbPosition&&o.updateHueThumbPosition(e.h),this.alphaPlugin&&this.alphaPlugin.updateAlphaThumbPosition&&this.alphaPlugin.updateAlphaThumbPosition(e.a),null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerPanel),e=(e&&e.updatePanelColor&&e.updatePanelColor(t),null==(o=this.ewColorPicker.plugins)?void 0:o.ewColorPickerBox);e&&e.setBoxBgColor&&e.setBoxBgColor(t)},D.prototype.destroy=function(){this.clearInputNumberInstances(),this.boundEventHandlers.forEach(function(t){var e=t.element;w(e,t.event,t.handler)}),this.boundEventHandlers=[],this.modeContainer&&this.modeContainer.parentNode&&r(this.modeContainer),this.modeContainer=null,this.modeText=null,this.upButton=null,this.downButton=null},D.pluginName="ewColorPickerColorMode",D.applyOrder=oe.Post;var Jt=D;function D(t){var e=this;this.ewColorPicker=t,this.options={},this.currentMode="hex",this.modeContainer=null,this.modeText=null,this.upButton=null,this.downButton=null,this.inputNumberInstances=new Map,this.boundEventHandlers=[],this.handleUpButtonHover=function(){e.upButton&&p(e.upButton,{borderColor:"#4096ef",backgroundColor:"#f0f8ff"})},this.handleUpButtonLeave=function(){e.upButton&&p(e.upButton,{borderColor:"#ddd",backgroundColor:"#fff"})},this.handleDownButtonHover=function(){e.downButton&&p(e.downButton,{borderColor:"#4096ef",backgroundColor:"#f0f8ff"})},this.handleDownButtonLeave=function(){e.downButton&&p(e.downButton,{borderColor:"#ddd",backgroundColor:"#fff"})},this.debouncedOnModeChange=Tt(this.onModeChange.bind(this),100),this.debouncedUpdateColorFromRgb=Tt(this.updateColorFromRgbInputs.bind(this),100),this.debouncedUpdateColorFromHsl=Tt(this.updateColorFromHslInputs.bind(this),100),this.initializePlugin()}Object.defineProperty(N.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),N.prototype.isSupported=function(){return"undefined"!=typeof window&&"EyeDropper"in window},N.prototype.handleOptions=function(){this.options=i({},this.options,this.ewColorPicker.options)},N.prototype.updateOptions=function(){this.handleOptions(),this.run()},N.prototype.run=function(){!1!==this.options.showEyedropper&&this.isSupported()?(this.removeContainer(),this.render(),this.bindEvents()):this.removeContainer()},N.prototype.render=function(){var t,e=this.ewColorPicker.getMountPoint("panelContainer");e?(e=this.getExtraRow(e),this.container=c("div"),u(this.container,"".concat(this.prefix,"color-picker-eyedropper-group")),this.button=c("button"),u(this.button,"".concat(this.prefix,"color-picker-eyedropper-btn")),d(this.button,{type:"button",title:this.options.eyedropperText||"取色","aria-label":this.options.eyedropperText||"取色"}),this.button.innerHTML=((t,e,o)=>(void 0===o&&(o=m),e=' width="'.concat(e,'" height="').concat(e,'"'),'<svg class="'.concat(o,"color-picker-icon").concat(ct(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>')))(void 0,16,this.prefix),this.options.eyedropperText&&(t=c("span"),u(t,"".concat(this.prefix,"color-picker-eyedropper-text")),t.textContent=this.options.eyedropperText,g(this.button,t)),g(this.container,this.button),g(e,this.container)):h("[ewColorPicker warning]: Panel container not found")},N.prototype.getExtraRow=function(t){var e,o=f(".".concat(this.prefix,"color-picker-extra-row"),t);return o||(o=c("div"),u(o,"".concat(this.prefix,"color-picker-extra-row")),(e=f(".".concat(this.prefix,"color-picker-bottom-row"),t))?g(t,o,null,e):g(t,o),o)},N.prototype.bindEvents=function(){this.button&&v(this.button,"click",this.handleClick)},N.prototype.removeContainer=function(){this.button&&w(this.button,"click",this.handleClick),this.container&&r(this.container),this.button=null;var t,e=(this.container=null)==(e=null==(t=this.ewColorPicker)?void 0:t.getMountPoint)?void 0:e.call(t,"panelContainer");e&&(t=f(".".concat(this.prefix,"color-picker-extra-row"),e))&&0===t.children.length&&r(t)},N.prototype.destroy=function(){this.destroyed=!0,this.removeContainer()},N.prototype.install=function(t){this.ewColorPicker=t,this.destroyed=!1,this.handleOptions(),null!=(t=this.run)&&t.call(this)},N.pluginName="ewColorPickerEyedropper",N.applyOrder=oe.Post;var te=N;function N(t){var e=this;this.ewColorPicker=t,this.options={},this.container=null,this.button=null,this.destroyed=!1,this.handleClick=function(){return V(e,void 0,void 0,function(){var e,o;return W(this,function(t){switch(t.label){case 0:if(this.destroyed)return[2];if(!(e=window.EyeDropper))return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(new e).open()];case 2:return(o=t.sent(),!this.destroyed&&o&&o.sRGBHex)?(this.ewColorPicker.setColor(o.sRGBHex),C(this.options.onEyedropperPick)&&this.options.onEyedropperPick(o.sRGBHex),[3,4]):[2];case 3:return(o=t.sent())&&"AbortError"===o.name?[2]:(h("[ewColorPicker warning]: Failed to pick color with EyeDropper",o),[3,4]);case 4:return[2]}})})},this.ewColorPicker=t,this.handleOptions(),this.run()}var ee="复制颜色到剪贴板",oe=(Object.defineProperty(S.prototype,"prefix",{get:function(){return k(this.ewColorPicker)},enumerable:!1,configurable:!0}),S.prototype.handleOptions=function(){this.options=i({},this.options,this.ewColorPicker.options)},S.prototype.updateOptions=function(){this.handleOptions(),this.run()},S.prototype.run=function(){!1===this.options.showCopyColor?this.removeContainer():(this.removeContainer(),this.render(),this.bindEvents())},S.prototype.render=function(){var t=this.ewColorPicker.getMountPoint("panelContainer");t?(t=this.getExtraRow(t),this.defaultTitle=this.options.copyColorText||ee,this.container=c("div"),u(this.container,"".concat(this.prefix,"color-picker-copy-group")),this.button=c("button"),u(this.button,"".concat(this.prefix,"color-picker-copy-btn")),d(this.button,{type:"button",title:this.defaultTitle,"aria-label":this.defaultTitle}),this.button.innerHTML=((t,e,o)=>(void 0===o&&(o=m),e=' width="'.concat(e,'" height="').concat(e,'"'),'<svg class="'.concat(o,"color-picker-icon").concat(ct(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>')))(void 0,14,this.prefix),this.syncColor(this.ewColorPicker.getColor()),this.tip=c("div"),u(this.tip,"".concat(this.prefix,"color-picker-copy-tip")),d(this.tip,{role:"status","aria-live":"polite"}),this.tip.textContent=this.options.copiedText||"已复制",g(this.container,this.button),g(this.container,this.tip),g(t,this.container)):h("[ewColorPicker warning]: Panel container not found")},S.prototype.getExtraRow=function(t){var e,o=f(".".concat(this.prefix,"color-picker-extra-row"),t);return o||(o=c("div"),u(o,"".concat(this.prefix,"color-picker-extra-row")),(e=f(".".concat(this.prefix,"color-picker-bottom-row"),t))?g(t,o,null,e):g(t,o),o)},S.prototype.bindEvents=function(){this.button&&v(this.button,"click",this.handleClick)},S.prototype.bindCoreEvents=function(){this.listening||(this.ewColorPicker.on("change",this.handleChange),this.listening=!0)},S.prototype.syncColor=function(t){var e,o,i;this.button&&p(this.button,{backgroundColor:t=t||"#ffffff",color:(void 0===e&&(e="#333333"),void 0===o&&(o="#ffffff"),(t=(t=t)&&y(t))&&(i=mt(t))&&.5<.2126*(t=function(t){t=(t*i.a+255*(1-i.a))/255;return t<=.03928?t/12.92:Math.pow((.055+t)/1.055,2.4)})(i.r)+.7152*t(i.g)+.0722*t(i.b)?e:o)})},S.prototype.copyToClipboard=function(i){return V(this,void 0,void 0,function(){var e,o;return W(this,function(t){switch(t.label){case 0:if("undefined"==typeof navigator||!navigator.clipboard||!C(navigator.clipboard.writeText))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(i)];case 2:return t.sent(),[2,!0];case 3:return t.sent(),[3,4];case 4:if("undefined"==typeof document||!C(document.execCommand))return[2,!1];(e=c("textarea")).value=i,p(e,{position:"fixed",top:"-9999px",left:"-9999px",opacity:"0"}),g(document.body,e),e.select(),o=!1;try{o=document.execCommand("copy")}catch(t){o=!1}return r(e),[2,o]}})})},S.prototype.showCopiedState=function(){var t,e=this;this.button&&(t=this.options.copiedText||"已复制",d(this.button,{title:t,"aria-label":t}),u(this.button,"".concat(this.prefix,"color-picker-copy-btn-copied")),this.tip&&(this.tip.textContent=t,u(this.tip,"".concat(this.prefix,"color-picker-copy-tip-show"))),this.resetTitleTimer&&clearTimeout(this.resetTitleTimer),this.resetTitleTimer=setTimeout(function(){e.resetTitleTimer=null,!e.destroyed&&e.button&&(d(e.button,{title:e.defaultTitle,"aria-label":e.defaultTitle}),a(e.button,"".concat(e.prefix,"color-picker-copy-btn-copied")),e.tip)&&a(e.tip,"".concat(e.prefix,"color-picker-copy-tip-show"))},1500))},S.prototype.removeContainer=function(){this.resetTitleTimer&&(clearTimeout(this.resetTitleTimer),this.resetTitleTimer=null),this.button&&w(this.button,"click",this.handleClick),this.container&&r(this.container),this.button=null,this.container=null;var t,e=(this.tip=null)==(e=null==(t=this.ewColorPicker)?void 0:t.getMountPoint)?void 0:e.call(t,"panelContainer");e&&(t=f(".".concat(this.prefix,"color-picker-extra-row"),e))&&0===t.children.length&&r(t)},S.prototype.destroy=function(){this.destroyed=!0,this.removeContainer(),this.ewColorPicker.off("change",this.handleChange),this.listening=!1},S.prototype.install=function(t){this.listening&&(this.ewColorPicker.off("change",this.handleChange),this.listening=!1),this.ewColorPicker=t,this.destroyed=!1,this.handleOptions(),this.run(),this.bindCoreEvents()},S.pluginName="ewColorPickerCopyColor",S.applyOrder=oe.Post,S);function S(t){var e=this;this.ewColorPicker=t,this.options={},this.container=null,this.button=null,this.tip=null,this.destroyed=!1,this.listening=!1,this.resetTitleTimer=null,this.defaultTitle=ee,this.handleChange=function(t){e.syncColor(t)},this.handleClick=function(){return V(e,void 0,void 0,function(){var e,o;return W(this,function(t){switch(t.label){case 0:return this.destroyed?[2]:(e=this.ewColorPicker.getColor())?[4,this.copyToClipboard(e)]:[2];case 1:return o=t.sent(),this.destroyed||(o?(this.showCopiedState(),C(this.options.onCopyColor)&&this.options.onCopyColor(e)):h("[ewColorPicker warning]: Failed to copy color to clipboard")),[2]}})})},this.ewColorPicker=t,this.handleOptions(),this.run(),this.bindCoreEvents()}x.use(Y),x.use(t),x.use(q),x.use(Gt),x.use(qt),x.use(Xt),x.use(Kt),x.use(Qt),x.use(Zt),x.use(Jt),x.use(te),x.use(oe),"undefined"!=typeof window&&(window.ewColorPicker=x),_.default=x,_.ewColorPicker=x,Object.defineProperty(_,"__esModule",{value:!0})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ew-color-picker/ew-color-picker",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "EW Color Picker - A modern color picker component with plugin architecture",
5
5
  "main": "dist/index.min.js",
6
6
  "module": "dist/index.esm.js",
@@ -10,34 +10,48 @@
10
10
  ],
11
11
  "keywords": [
12
12
  "color-picker",
13
+ "colorpicker",
14
+ "color",
13
15
  "typescript",
14
16
  "plugin",
15
17
  "modern",
16
18
  "ui",
17
- "component"
19
+ "component",
20
+ "ui-component",
21
+ "color-picker-component",
22
+ "hsl",
23
+ "hsv",
24
+ "rgba",
25
+ "hex",
26
+ "design-system",
27
+ "framework-agnostic",
28
+ "vanilla-js",
29
+ "plugin-system"
18
30
  ],
19
31
  "author": "eveningwater(854806732@qq.com)",
20
32
  "license": "MIT",
21
33
  "dependencies": {
22
- "@ew-color-picker/core": "^2.0.0",
23
- "@ew-color-picker/utils": "^2.0.0",
24
- "@ew-color-picker/box": "^2.0.0",
25
- "@ew-color-picker/panel": "^2.0.0",
26
- "@ew-color-picker/hue": "^2.0.0",
27
- "@ew-color-picker/alpha": "^2.0.0",
28
- "@ew-color-picker/input": "^2.0.0",
29
- "@ew-color-picker/input-number": "^2.0.0",
30
- "@ew-color-picker/button": "^2.0.0",
31
- "@ew-color-picker/predefine": "^2.0.0",
32
- "@ew-color-picker/style": "^2.0.0",
33
- "@ew-color-picker/color-mode": "^2.0.0"
34
+ "@ew-color-picker/core": "^2.0.3",
35
+ "@ew-color-picker/utils": "^2.0.3",
36
+ "@ew-color-picker/panel": "^2.0.3",
37
+ "@ew-color-picker/hue": "^2.0.3",
38
+ "@ew-color-picker/box": "^2.0.3",
39
+ "@ew-color-picker/alpha": "^2.0.3",
40
+ "@ew-color-picker/input": "^2.0.3",
41
+ "@ew-color-picker/button": "^2.0.3",
42
+ "@ew-color-picker/color-mode": "^2.0.3",
43
+ "@ew-color-picker/predefine": "^2.0.3",
44
+ "@ew-color-picker/copy-color": "^2.0.3",
45
+ "@ew-color-picker/input-number": "^2.0.3",
46
+ "@ew-color-picker/style": "^2.0.3",
47
+ "@ew-color-picker/eyedropper": "^2.0.3"
34
48
  },
35
49
  "devDependencies": {
36
50
  "rollup": "^3.0.0",
37
51
  "rollup-plugin-typescript2": "^0.34.0",
38
52
  "typescript": "^4.9.0",
39
53
  "rimraf": "^3.0.2",
40
- "@ew-color-picker/utils": "2.0.1"
54
+ "@ew-color-picker/utils": "2.0.3"
41
55
  },
42
56
  "publishConfig": {
43
57
  "access": "public"