color-gradient-picker-vue3
Advanced tools
Comparing version 2.0.5 to 2.0.6
@@ -1,1 +0,1 @@ | ||
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["color-gradient-picker-vue3"]=t(e.Vue)}(this,(function(e){"use strict";function t(e){return"number"==typeof e&&!1===Number.isNaN(e)&&e>=0&&e<=255}function r(e,r,n,o){if(t(e)&&t(r)&&t(n)){const a={red:0|e,green:0|r,blue:0|n,alpha:0|o};return!0===t(o)&&(a.alpha=0|o),a}}function n(e,t,n,o){let a=t/100*(n/=100);const i=e/60;let l=a*(1-Math.abs(i%2-1)),c=n-a;return a=255*(a+c)|0,l=255*(l+c)|0,c=255*c|0,i>=1&&i<2?r(l,a,c,o):i>=2&&i<3?r(c,a,l,o):i>=3&&i<4?r(c,l,a,o):i>=4&&i<5?r(l,c,a,o):i>=5&&i<=6?r(a,c,l,o):r(a,l,c,o)}function o(e,t,r,o,a,i){e>o&&(e=o),t>r&&(t=r),e<0&&(e=0),t<0&&(t=0);const l=100-100*t/r|0,c=100*e/o|0;return __spreadProps(__spreadValues({},n(a,c,l,i)),{saturation:c,value:l})}function a(e,t,r,o,a){let i=360*e/t|0;return i=i<0?0:i>360?360:i,__spreadProps(__spreadValues({},n(i,r,o,a)),{saturation:r,hue:i})}function i(e,t){return(e=Number((e/t).toFixed(2)))>1?1:e<0?0:e}function l(e,t,r){let n=e.toString(16),o=t.toString(16),a=r.toString(16);return e<16&&(n=`0${n}`),t<16&&(o=`0${o}`),r<16&&(a=`0${a}`),n+o+a}const c=/(^#{0,1}[0-9A-F]{6}$)|(^#{0,1}[0-9A-F]{3}$)|(^#{0,1}[0-9A-F]{8}$)/i;function s(e){if(c.test(e)){if("#"===e[0]&&(e=e.slice(1,e.length)),e.length<6)return!1;const t=r(parseInt(e.substring(0,2),16)||0,parseInt(e.substring(2,4),16)||0,parseInt(e.substring(4,6),16)||0,parseInt(e.substring(6,8),16)/255||0),n=t&&function({red:e,green:t,blue:r}){let n,o,a,i,l=0;const c=e/255,s=t/255,u=r/255,p=Math.max(c,s,u),d=p-Math.min(c,s,u),f=e=>(p-e)/6/d+.5;return 0===d?(l=0,i=0):(i=d/p,n=f(c),o=f(s),a=f(u),c===p?l=a-o:s===p?l=1/3+n-a:u===p&&(l=2/3+o-n),l<0?l+=1:l>1&&(l-=1)),{hue:Math.round(360*l),saturation:Math.round(100*i),value:Math.round(100*p)}}(__spreadValues({},t));return __spreadValues(__spreadValues({},t),n)}return!1}function u(e,t){const r=100*e/t;return r<0?0:r>100?100:r}function p(e,t,r,n){return`rgba(${e}, ${t}, ${r}, ${n})`}function d(e,t,r){let n="";const o=e.slice();return o.sort(((e,t)=>e.left-t.left)),n="linear"===t?`linear-gradient(${r}deg,`:"radial-gradient(",o.forEach(((e,t)=>{n+=`rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha}) ${e.left}%`,t!==o.length-1&&(n+=",")})),n+=")",n}function f(e,t,r){return function(n){let o=e(n);function a(e){o=t(e,o)||o}window.addEventListener("mousemove",a),window.addEventListener("mouseup",(e=>{window.removeEventListener("mousemove",a),r&&r(e,o)}),{once:!0})}}const v={class:"picker-area-overlay1 wh-full"},b={class:"picker-area-overlay2 wh-full rounded-8px"},y=e.defineComponent({name:"AreaPicker"}),h=(e,t)=>{const r=e.__vccOpts||e;for(const[n,o]of t)r[n]=o;return r},m=h(e.defineComponent(__spreadProps(__spreadValues({},y),{setup(t){const r=e.ref(null),n=e.ref(null),a=e.inject("colorPickerState"),i=e.inject("updateColor"),l=e.computed((()=>{const{width:e=0,height:t=0}=n.value||{},{saturation:r=100,value:o=100,isGradient:i,activePointIndex:l}=a,c=(r*e/100|0)-6,s=(t-o*t/100|0)-6,u=a.points[l||0];return{backgroundColor:`rgb(${i?null==u?void 0:u.red:a.red}, ${i?null==u?void 0:u.green:a.green}, ${i?null==u?void 0:u.blue:a.blue})`,left:`${c}px`,top:`${s}px`}})),c=e.computed((()=>{const{isGradient:e,red:t,green:r,blue:n,activePointIndex:o=0,points:i=[]}=a;if(e){const e=i[o];return{backgroundColor:`rgb(${e.red}, ${e.green}, ${e.blue})`}}return{backgroundColor:`rgb(${t}, ${r}, ${n})`}})),s=(e,{startX:t,startY:r,positionX:i,positionY:l})=>{const c=e.pageX-t,s=e.pageY-r,{width:u=0,height:p=0}=n.value||{},d=o(i+=c,l+=s,p,u,a.hue,a.alpha);return{positions:{positionX:i,positionY:l,startX:e.pageX,startY:e.pageY},color:d}},u=f((e=>{if(!n.value)return;const{x:t,y:r}=n.value,{width:l=0,height:c=0}=n.value||{},s=e.pageX,u=e.pageY,p=s-t,d=u-r,f=o(p,d,c,l,a.hue,a.alpha);return i(f),{startX:s,startY:u,positionX:p,positionY:d}}),((e,{startX:t,startY:r,positionX:n,positionY:o})=>{const{positions:a,color:l}=s(e,{startX:t,startY:r,positionX:n,positionY:o});return i(l),a}),((e,{startX:t,startY:r,positionX:n,positionY:o})=>{const{positions:a,color:l}=s(e,{startX:t,startY:r,positionX:n,positionY:o});return i(l),a}));return e.watchEffect((()=>{var e;const t=r.value;t&&!(null==(e=n.value)?void 0:e.width)&&(n.value=t.getBoundingClientRect()||null)})),(t,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"pickerAreaRef",ref:r,class:"picker-area w-full mb-16px relative rounded-8px",style:e.normalizeStyle(e.unref(c)),onMousedown:n[0]||(n[0]=(...t)=>e.unref(u)&&e.unref(u)(...t))},[e.createElementVNode("div",v,[e.createElementVNode("div",b,[e.createElementVNode("div",{class:"picker-pointer",style:e.normalizeStyle(e.unref(l))},null,4)])])],36))}})),[["__scopeId","data-v-2e8391c9"]]),g={class:"preview-area mr-8px"},_=e.defineComponent({name:"AreaPreview"}),j=e.defineComponent(__spreadProps(__spreadValues({},_),{setup(t){const r=e.inject("colorPickerState"),n=e.computed((()=>{let e="";return e=r.isGradient?d(r.points,r.type,r.degree):p(r.red,r.green,r.blue,r.alpha),{background:e}}));return(t,r)=>(e.openBlock(),e.createElementBlock("div",g,[e.createElementVNode("div",{class:"border-box w-36px h-36px rounded-8px border-width-1px border-solid border-[#ebedf5]",style:e.normalizeStyle(e.unref(n))},null,4)]))}})),x=e.defineComponent({name:"AreaHue"}),w=h(e.defineComponent(__spreadProps(__spreadValues({},x),{setup(t){const r=e.ref(null),n=e.ref(null),o=e.inject("colorPickerState"),i=e.inject("updateColor"),l=e.computed((()=>{var e;const t=(null==(e=n.value)?void 0:e.width)||0;return(o.hue||0)*(t-14)/360|0})),c=e.computed((()=>({left:`${l.value}px`}))),s=(e,{startX:t,positionX:r})=>{var i;const l=e.pageX-t,c=(null==(i=n.value)?void 0:i.width)||0,s=a((r+=l)>c?c:r<=0?0:r,c,o.saturation,o.value,o.alpha);return{positions:{positionX:r,startX:e.pageX},color:s}},u=f((e=>{var t,r;const l=(null==(t=n.value)?void 0:t.x)||0,c=e.pageX,s=c-l,u=a(s,(null==(r=n.value)?void 0:r.width)||0,o.saturation,o.value,o.alpha);return i(u),{startX:c,positionX:s}}),((e,{startX:t,positionX:r})=>{const{positions:n,color:o}=s(e,{startX:t,positionX:r});return i(o),n}),((e,{startX:t,positionX:r})=>{const{positions:n,color:o}=s(e,{startX:t,positionX:r});return i(o),n}));return e.watchEffect((()=>{var e,t;r.value&&!(null==(e=n.value)?void 0:e.width)&&(n.value=(null==(t=r.value)?void 0:t.getBoundingClientRect())||null)})),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:"relative w-full overflow-hidden rounded-10px mb-8px bg-[red] cursor-pointer",onMousedown:n[0]||(n[0]=(...t)=>e.unref(u)&&e.unref(u)(...t))},[e.createElementVNode("div",{ref_key:"hueRef",ref:r,class:"hue-area relative"},[e.createElementVNode("div",{class:"picker-pointer",style:e.normalizeStyle(e.unref(c))},null,4)],512)],32))}})),[["__scopeId","data-v-7cd4331a"]]),k={class:"alpha-area wh-full rounded-10px"},P=e.defineComponent({name:"AreaAlpha"}),C=h(e.defineComponent(__spreadProps(__spreadValues({},P),{setup(t){const r=e.inject("colorPickerState"),n=e.inject("updateColor"),o=e.ref(null),a=e.ref(null),l=e.computed((()=>{var e;const{isGradient:t,alpha:n,activePointIndex:o=0,points:i=[]}=r,l=(null==(e=a.value)?void 0:e.width)||0;if(t){return i[o].alpha*(l-14)|0}return n*(l-14)|0})),c=e.computed((()=>{const{isGradient:e,red:t,green:n,blue:o,activePointIndex:a=0,points:i=[]}=r;if(e){const e=i[a];return{background:`linear-gradient(to right, rgba(0, 0, 0, 0), rgb(${e.red}, ${e.green}, ${e.blue}))`}}return{background:`linear-gradient(to right, rgba(0, 0, 0, 0), rgb(${t}, ${n}, ${o}))`}})),s=e.computed((()=>({left:`${l.value}px`}))),u=(e,{startX:t,positionX:r})=>{var n;const o=i(r+=e.pageX-t,(null==(n=a.value)?void 0:n.width)||0);return{positions:{positionX:r,startX:e.pageX},alpha:o}},p=f((e=>{var t,r;const o=(null==(t=a.value)?void 0:t.x)||0,l=e.pageX,c=(null==(r=a.value)?void 0:r.width)||0;let s=l-o;return n({alpha:i(s,c)},"alpha"),{startX:l,positionX:s}}),((e,{startX:t,positionX:r})=>{const{positions:o,alpha:a}=u(e,{startX:t,positionX:r});return n({alpha:a},"alpha"),o}),((e,{startX:t,positionX:r})=>{const{positions:o,alpha:a}=u(e,{startX:t,positionX:r});return n({alpha:a},"alpha"),o}));return e.watchEffect((()=>{var e,t;o.value&&!(null==(e=a.value)?void 0:e.width)&&(a.value=(null==(t=o.value)?void 0:t.getBoundingClientRect())||null)})),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"relative w-full overflow-hidden rounded-10px h-14px cursor-pointer",onMousedown:r[0]||(r[0]=(...t)=>e.unref(p)&&e.unref(p)(...t))},[e.createElementVNode("div",{class:"absolute left-0 right-0 top-0 bottom-0",style:e.normalizeStyle(e.unref(c))},null,4),e.createElementVNode("div",k,[e.createElementVNode("div",{ref_key:"alphaMaskRef",ref:o,class:"wh-full relative"},[e.createElementVNode("div",{class:"picker-pointer",style:e.normalizeStyle(e.unref(s))},null,4)],512)])],32))}})),[["__scopeId","data-v-256c0c24"]]);const V="object"==typeof global&&global&&global.Object===Object&&global;var B="object"==typeof self&&self&&self.Object===Object&&self;const O=V||B||Function("return this")();const E=O.Symbol;var X=Object.prototype,S=X.hasOwnProperty,A=X.toString,N=E?E.toStringTag:void 0;var I=Object.prototype.toString;var $="[object Null]",z="[object Undefined]",G=E?E.toStringTag:void 0;function M(e){return null==e?void 0===e?z:$:G&&G in Object(e)?function(e){var t=S.call(e,N),r=e[N];try{e[N]=void 0;var n=!0}catch(a){}var o=A.call(e);return n&&(t?e[N]=r:delete e[N]),o}(e):function(e){return I.call(e)}(e)}function U(e){return null!=e&&"object"==typeof e}var D="[object Symbol]";const F=Array.isArray;var T=/\s/;var R=/^\s+/;function Y(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&T.test(e.charAt(t)););return t}(e)+1).replace(R,""):e}function L(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var W=NaN,q=/^[-+]0x[0-9a-f]+$/i,H=/^0b[01]+$/i,J=/^0o[0-7]+$/i,K=parseInt;function Q(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||U(e)&&M(e)==D}(e))return W;if(L(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=L(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Y(e);var r=H.test(e);return r||J.test(e)?K(e.slice(2),r?2:8):q.test(e)?W:+e}var Z="[object AsyncFunction]",ee="[object Function]",te="[object GeneratorFunction]",re="[object Proxy]";function ne(e){if(!L(e))return!1;var t=M(e);return t==ee||t==te||t==Z||t==re}const oe=O["__core-js_shared__"];var ae,ie=(ae=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||""))?"Symbol(src)_1."+ae:"";var le=Function.prototype.toString;function ce(e){if(null!=e){try{return le.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var se=/^\[object .+?Constructor\]$/,ue=Function.prototype,pe=Object.prototype,de=ue.toString,fe=pe.hasOwnProperty,ve=RegExp("^"+de.call(fe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function be(e){return!(!L(e)||(t=e,ie&&ie in t))&&(ne(e)?ve:se).test(ce(e));var t}function ye(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return be(r)?r:void 0}const he=ye(O,"WeakMap");var me=Object.create;const ge=function(){function e(){}return function(t){if(!L(t))return{};if(me)return me(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const _e=function(){try{var e=ye(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();var je=9007199254740991,xe=/^(?:0|[1-9]\d*)$/;function we(e,t){var r=typeof e;return!!(t=null==t?je:t)&&("number"==r||"symbol"!=r&&xe.test(e))&&e>-1&&e%1==0&&e<t}function ke(e,t,r){"__proto__"==t&&_e?_e(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Pe(e,t){return e===t||e!=e&&t!=t}var Ce=Object.prototype.hasOwnProperty;function Ve(e,t,r){var n=e[t];Ce.call(e,t)&&Pe(n,r)&&(void 0!==r||t in e)||ke(e,t,r)}function Be(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var l=t[a],c=n?n(r[l],e[l],l,r,e):void 0;void 0===c&&(c=e[l]),o?ke(r,l,c):Ve(r,l,c)}return r}var Oe=9007199254740991;function Ee(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Oe}function Xe(e){return null!=e&&Ee(e.length)&&!ne(e)}var Se=Object.prototype;function Ae(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Se)}function Ne(e){return U(e)&&"[object Arguments]"==M(e)}var Ie=Object.prototype,$e=Ie.hasOwnProperty,ze=Ie.propertyIsEnumerable,Ge=Ne(function(){return arguments}())?Ne:function(e){return U(e)&&$e.call(e,"callee")&&!ze.call(e,"callee")};const Me=Ge;var Ue="object"==typeof exports&&exports&&!exports.nodeType&&exports,De=Ue&&"object"==typeof module&&module&&!module.nodeType&&module,Fe=De&&De.exports===Ue?O.Buffer:void 0;const Te=(Fe?Fe.isBuffer:void 0)||function(){return!1};var Re={};function Ye(e){return function(t){return e(t)}}Re["[object Float32Array]"]=Re["[object Float64Array]"]=Re["[object Int8Array]"]=Re["[object Int16Array]"]=Re["[object Int32Array]"]=Re["[object Uint8Array]"]=Re["[object Uint8ClampedArray]"]=Re["[object Uint16Array]"]=Re["[object Uint32Array]"]=!0,Re["[object Arguments]"]=Re["[object Array]"]=Re["[object ArrayBuffer]"]=Re["[object Boolean]"]=Re["[object DataView]"]=Re["[object Date]"]=Re["[object Error]"]=Re["[object Function]"]=Re["[object Map]"]=Re["[object Number]"]=Re["[object Object]"]=Re["[object RegExp]"]=Re["[object Set]"]=Re["[object String]"]=Re["[object WeakMap]"]=!1;var Le="object"==typeof exports&&exports&&!exports.nodeType&&exports,We=Le&&"object"==typeof module&&module&&!module.nodeType&&module,qe=We&&We.exports===Le&&V.process;const He=function(){try{var e=We&&We.require&&We.require("util").types;return e||qe&&qe.binding&&qe.binding("util")}catch(t){}}();var Je=He&&He.isTypedArray;const Ke=Je?Ye(Je):function(e){return U(e)&&Ee(e.length)&&!!Re[M(e)]};var Qe=Object.prototype.hasOwnProperty;function Ze(e,t){var r=F(e),n=!r&&Me(e),o=!r&&!n&&Te(e),a=!r&&!n&&!o&&Ke(e),i=r||n||o||a,l=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=l.length;for(var s in e)!t&&!Qe.call(e,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||we(s,c))||l.push(s);return l}function et(e,t){return function(r){return e(t(r))}}const tt=et(Object.keys,Object);var rt=Object.prototype.hasOwnProperty;function nt(e){return Xe(e)?Ze(e):function(e){if(!Ae(e))return tt(e);var t=[];for(var r in Object(e))rt.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var ot=Object.prototype.hasOwnProperty;function at(e){if(!L(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Ae(e),r=[];for(var n in e)("constructor"!=n||!t&&ot.call(e,n))&&r.push(n);return r}function it(e){return Xe(e)?Ze(e,!0):at(e)}const lt=ye(Object,"create");var ct=Object.prototype.hasOwnProperty;var st=Object.prototype.hasOwnProperty;function ut(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function pt(e,t){for(var r=e.length;r--;)if(Pe(e[r][0],t))return r;return-1}ut.prototype.clear=function(){this.__data__=lt?lt(null):{},this.size=0},ut.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ut.prototype.get=function(e){var t=this.__data__;if(lt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ct.call(t,e)?t[e]:void 0},ut.prototype.has=function(e){var t=this.__data__;return lt?void 0!==t[e]:st.call(t,e)},ut.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=lt&&void 0===t?"__lodash_hash_undefined__":t,this};var dt=Array.prototype.splice;function ft(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ft.prototype.clear=function(){this.__data__=[],this.size=0},ft.prototype.delete=function(e){var t=this.__data__,r=pt(t,e);return!(r<0)&&(r==t.length-1?t.pop():dt.call(t,r,1),--this.size,!0)},ft.prototype.get=function(e){var t=this.__data__,r=pt(t,e);return r<0?void 0:t[r][1]},ft.prototype.has=function(e){return pt(this.__data__,e)>-1},ft.prototype.set=function(e,t){var r=this.__data__,n=pt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};const vt=ye(O,"Map");function bt(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function yt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ht(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}yt.prototype.clear=function(){this.size=0,this.__data__={hash:new ut,map:new(vt||ft),string:new ut}},yt.prototype.delete=function(e){var t=bt(this,e).delete(e);return this.size-=t?1:0,t},yt.prototype.get=function(e){return bt(this,e).get(e)},yt.prototype.has=function(e){return bt(this,e).has(e)},yt.prototype.set=function(e,t){var r=bt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};const mt=et(Object.getPrototypeOf,Object);function gt(e){var t=this.__data__=new ft(e);this.size=t.size}gt.prototype.clear=function(){this.__data__=new ft,this.size=0},gt.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},gt.prototype.get=function(e){return this.__data__.get(e)},gt.prototype.has=function(e){return this.__data__.has(e)},gt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ft){var n=r.__data__;if(!vt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new yt(n)}return r.set(e,t),this.size=r.size,this};var _t="object"==typeof exports&&exports&&!exports.nodeType&&exports,jt=_t&&"object"==typeof module&&module&&!module.nodeType&&module,xt=jt&&jt.exports===_t?O.Buffer:void 0,wt=xt?xt.allocUnsafe:void 0;function kt(){return[]}var Pt=Object.prototype.propertyIsEnumerable,Ct=Object.getOwnPropertySymbols;const Vt=Ct?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}(Ct(e),(function(t){return Pt.call(e,t)})))}:kt;const Bt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ht(t,Vt(e)),e=mt(e);return t}:kt;function Ot(e,t,r){var n=t(e);return F(e)?n:ht(n,r(e))}function Et(e){return Ot(e,nt,Vt)}function Xt(e){return Ot(e,it,Bt)}const St=ye(O,"DataView");const At=ye(O,"Promise");const Nt=ye(O,"Set");var It="[object Map]",$t="[object Promise]",zt="[object Set]",Gt="[object WeakMap]",Mt="[object DataView]",Ut=ce(St),Dt=ce(vt),Ft=ce(At),Tt=ce(Nt),Rt=ce(he),Yt=M;(St&&Yt(new St(new ArrayBuffer(1)))!=Mt||vt&&Yt(new vt)!=It||At&&Yt(At.resolve())!=$t||Nt&&Yt(new Nt)!=zt||he&&Yt(new he)!=Gt)&&(Yt=function(e){var t=M(e),r="[object Object]"==t?e.constructor:void 0,n=r?ce(r):"";if(n)switch(n){case Ut:return Mt;case Dt:return It;case Ft:return $t;case Tt:return zt;case Rt:return Gt}return t});const Lt=Yt;var Wt=Object.prototype.hasOwnProperty;const qt=O.Uint8Array;function Ht(e){var t=new e.constructor(e.byteLength);return new qt(t).set(new qt(e)),t}var Jt=/\w*$/;var Kt=E?E.prototype:void 0,Qt=Kt?Kt.valueOf:void 0;var Zt="[object Boolean]",er="[object Date]",tr="[object Map]",rr="[object Number]",nr="[object RegExp]",or="[object Set]",ar="[object String]",ir="[object Symbol]",lr="[object ArrayBuffer]",cr="[object DataView]",sr="[object Float32Array]",ur="[object Float64Array]",pr="[object Int8Array]",dr="[object Int16Array]",fr="[object Int32Array]",vr="[object Uint8Array]",br="[object Uint8ClampedArray]",yr="[object Uint16Array]",hr="[object Uint32Array]";function mr(e,t,r){var n,o,a,i=e.constructor;switch(t){case lr:return Ht(e);case Zt:case er:return new i(+e);case cr:return function(e,t){var r=t?Ht(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case sr:case ur:case pr:case dr:case fr:case vr:case br:case yr:case hr:return function(e,t){var r=t?Ht(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,r);case tr:return new i;case rr:case ar:return new i(e);case nr:return(a=new(o=e).constructor(o.source,Jt.exec(o))).lastIndex=o.lastIndex,a;case or:return new i;case ir:return n=e,Qt?Object(Qt.call(n)):{}}}var gr=He&&He.isMap;const _r=gr?Ye(gr):function(e){return U(e)&&"[object Map]"==Lt(e)};var jr=He&&He.isSet;const xr=jr?Ye(jr):function(e){return U(e)&&"[object Set]"==Lt(e)};var wr=1,kr=2,Pr=4,Cr="[object Arguments]",Vr="[object Function]",Br="[object GeneratorFunction]",Or="[object Object]",Er={};function Xr(e,t,r,n,o,a){var i,l=t&wr,c=t&kr,s=t⪻if(r&&(i=o?r(e,n,o,a):r(e)),void 0!==i)return i;if(!L(e))return e;var u=F(e);if(u){if(i=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Wt.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!l)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(e,i)}else{var p=Lt(e),d=p==Vr||p==Br;if(Te(e))return function(e,t){if(t)return e.slice();var r=e.length,n=wt?wt(r):new e.constructor(r);return e.copy(n),n}(e,l);if(p==Or||p==Cr||d&&!o){if(i=c||d?{}:function(e){return"function"!=typeof e.constructor||Ae(e)?{}:ge(mt(e))}(e),!l)return c?function(e,t){return Be(e,Bt(e),t)}(e,function(e,t){return e&&Be(t,it(t),e)}(i,e)):function(e,t){return Be(e,Vt(e),t)}(e,function(e,t){return e&&Be(t,nt(t),e)}(i,e))}else{if(!Er[p])return o?e:{};i=mr(e,p,l)}}a||(a=new gt);var f=a.get(e);if(f)return f;a.set(e,i),xr(e)?e.forEach((function(n){i.add(Xr(n,t,r,n,e,a))})):_r(e)&&e.forEach((function(n,o){i.set(o,Xr(n,t,r,o,e,a))}));var v=u?void 0:(s?c?Xt:Et:c?it:nt)(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(v||e,(function(n,o){v&&(n=e[o=n]),Ve(i,o,Xr(n,t,r,o,e,a))})),i}Er[Cr]=Er["[object Array]"]=Er["[object ArrayBuffer]"]=Er["[object DataView]"]=Er["[object Boolean]"]=Er["[object Date]"]=Er["[object Float32Array]"]=Er["[object Float64Array]"]=Er["[object Int8Array]"]=Er["[object Int16Array]"]=Er["[object Int32Array]"]=Er["[object Map]"]=Er["[object Number]"]=Er[Or]=Er["[object RegExp]"]=Er["[object Set]"]=Er["[object String]"]=Er["[object Symbol]"]=Er["[object Uint8Array]"]=Er["[object Uint8ClampedArray]"]=Er["[object Uint16Array]"]=Er["[object Uint32Array]"]=!0,Er["[object Error]"]=Er[Vr]=Er["[object WeakMap]"]=!1;function Sr(e){return Xr(e,5)}const Ar=function(){return O.Date.now()};var Nr="Expected a function",Ir=Math.max,$r=Math.min;function zr(e,t,r){var n,o,a,i,l,c,s=0,u=!1,p=!1,d=!0;if("function"!=typeof e)throw new TypeError(Nr);function f(t){var r=n,a=o;return n=o=void 0,s=t,i=e.apply(a,r)}function v(e){var r=e-c;return void 0===c||r>=t||r<0||p&&e-s>=a}function b(){var e=Ar();if(v(e))return y(e);l=setTimeout(b,function(e){var r=t-(e-c);return p?$r(r,a-(e-s)):r}(e))}function y(e){return l=void 0,d&&n?f(e):(n=o=void 0,i)}function h(){var e=Ar(),r=v(e);if(n=arguments,o=this,c=e,r){if(void 0===l)return function(e){return s=e,l=setTimeout(b,t),u?f(e):i}(c);if(p)return clearTimeout(l),l=setTimeout(b,t),f(c)}return void 0===l&&(l=setTimeout(b,t)),i}return t=Q(t)||0,L(r)&&(u=!!r.leading,a=(p="maxWait"in r)?Ir(Q(r.maxWait)||0,t):a,d="trailing"in r?!!r.trailing:d),h.cancel=function(){void 0!==l&&clearTimeout(l),s=0,n=c=o=l=void 0},h.flush=function(){return void 0===l?i:y(Ar())},h}const Gr=["onDblclick"],Mr=e.defineComponent({name:"AreaGradientPoint"}),Ur=e.defineComponent(__spreadProps(__spreadValues({},Mr),{props:{index:{type:Number,required:!0},point:{type:Object,required:!0},width:{type:Number,default:0},positions:{type:Object}},setup(t){const r=t,n=e.inject("colorPickerState"),o=e.inject("updateColor"),a=e.computed((()=>n.activePointIndex===r.index?" active":"")),i=e.computed((()=>({left:r.point.left*((r.width-14)/100)+"px"}))),l=e=>{n.points[r.index].left=e,o({type:n.type},"type")},c=(e,{startX:t,offsetX:n})=>{const o=u(n+=e.pageX-t,r.width);return{positions:{offsetX:n,startX:e.pageX},left:o}},s=f((e=>{const t=e.pageX,o=e.pageY,a=t-(r.positions.x||0);return n.activePointIndex=r.index,{startX:t,startY:o,offsetX:a}}),((e,{startX:t,offsetX:r})=>{const{positions:n,left:o}=c(e,{startX:t,offsetX:r});return l(o),n}),((e,{startX:t,offsetX:r})=>{const{positions:n,left:o}=c(e,{startX:t,offsetX:r});return l(o),n})),p=()=>{let e=Sr(n.points);if(e.length<=2)return;const t=r.index,a=0===t?1:t-1;e=null==e?void 0:e.filter((e=>e.id!==r.point.id)),n.activePointIndex=a,o({points:e},"points")};return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(`picker-pointer${e.unref(a)}`),style:e.normalizeStyle(e.unref(i)),onMousedown:o[0]||(o[0]=e.withModifiers(((...t)=>e.unref(s)&&e.unref(s)(...t)),["stop"])),onDblclick:e.withModifiers(p,["stop"]),onClick:o[1]||(o[1]=e.withModifiers((()=>e.unref(n).activePointIndex=r.index),["stop"]))},[e.createElementVNode("span",{class:e.normalizeClass(`child-point${e.unref(a)}`)},null,2)],46,Gr))}}));let Dr;const Fr=new Uint8Array(16);function Tr(){if(!Dr&&(Dr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dr(Fr)}const Rr=[];for(let En=0;En<256;++En)Rr.push((En+256).toString(16).slice(1));const Yr={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Lr(e,t,r){if(Yr.randomUUID&&!t&&!e)return Yr.randomUUID();const n=(e=e||{}).random||(e.rng||Tr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return Rr[e[t+0]]+Rr[e[t+1]]+Rr[e[t+2]]+Rr[e[t+3]]+"-"+Rr[e[t+4]]+Rr[e[t+5]]+"-"+Rr[e[t+6]]+Rr[e[t+7]]+"-"+Rr[e[t+8]]+Rr[e[t+9]]+"-"+Rr[e[t+10]]+Rr[e[t+11]]+Rr[e[t+12]]+Rr[e[t+13]]+Rr[e[t+14]]+Rr[e[t+15]]}(n)}const Wr=e.defineComponent({name:"AreaGradientPoints"}),qr=e.defineComponent(__spreadProps(__spreadValues({},Wr),{setup(t){const r=e.inject("colorPickerState"),o=e.inject("updateColor"),a=e.ref(null),i=e.ref(null),l=e.computed((()=>({background:d(r.points,"linear",90)}))),c=e=>{const{x:t=0,width:a=0}=i.value||{},l=u(e.pageX-t,a),{hue:c,saturation:s,value:p}=r,d=Sr(r.points),f=n(c,s,p,1),v=__spreadProps(__spreadValues({id:Lr()},f),{left:l});null==d||d.push(v),r.activePointIndex=d.findIndex((e=>e.id===v.id)),o({points:d},"points")};return e.watchEffect((()=>{var e,t;a.value&&!(null==(e=i.value)?void 0:e.width)&&(i.value=(null==(t=a.value)?void 0:t.getBoundingClientRect())||null)})),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:"gradient border-box w-full h-14px relative cursor-pointer rounded-10px mb-8px",style:e.normalizeStyle(e.unref(l)),onClick:c},[e.createElementVNode("div",{ref_key:"pointsContainerRef",ref:a,class:"wh-full relative"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r).points,((t,r)=>{var n;return e.openBlock(),e.createBlock(Ur,{key:t.id,index:r,point:t,positions:e.unref(i),width:null==(n=e.unref(i))?void 0:n.width},null,8,["index","point","positions","width"])})),128))],512)],4))}})),Hr={class:"flex flex-col px-16px"},Jr={class:"flex pb-16px"},Kr={class:"flex flex-col flex-1"},Qr=e.defineComponent({name:"Area"}),Zr=e.defineComponent(__spreadProps(__spreadValues({},Qr),{setup(t){const r=e.inject("colorPickerState");return(t,n)=>(e.openBlock(),e.createElementBlock("div",Hr,[e.createVNode(m),e.unref(r).isGradient?(e.openBlock(),e.createBlock(qr,{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",Jr,[e.createVNode(j),e.createElementVNode("div",Kr,[e.createVNode(w),e.createVNode(C)])])]))}})),en={class:"flex items-center relative w-full rounded-6px text-[#28314d]"},tn=["maxlength","type"],rn={class:"text-12px lining-15px font-bold mt-6px mb-0 text-[#1f2667]"},nn=e.defineComponent({name:"Input"}),on=h(e.defineComponent(__spreadProps(__spreadValues({},nn),{props:{value:{default:""},label:{default:""},classes:{default:""},maxLen:{default:"3"},type:{default:"text"}},emits:["input","blur","focus","update:value"],setup(t,{emit:r}){const n=t,o=e.computed({get:()=>n.value,set:e=>{r("update:value",e)}}),a=e=>{r("input",e)},i=()=>{r("blur")},l=()=>{r("focus")};return(r,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-shrink-0 items-center flex-col",n.classes])},[e.createElementVNode("div",en,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[0]||(c[0]=t=>e.isRef(o)?o.value=t:null),class:"w-full outline-0 text-[#1f2667] text-center font-bold text-12px",maxlength:t.maxLen,type:n.type,onFocus:l,onBlur:i,onInput:a},null,40,tn),[[e.vModelDynamic,e.unref(o),void 0,{trim:!0}]])]),e.createElementVNode("div",rn,e.toDisplayString(t.label),1)],2))}})),[["__scopeId","data-v-034b5687"]]),an=e.defineComponent({name:"PreviewHex"}),ln=e.defineComponent(__spreadProps(__spreadValues({},an),{setup(t){const r=e.inject("colorPickerState"),n=e.inject("updateColor"),o=e.computed((()=>{const{isGradient:e,activePointIndex:t}=r,n=r.points[t];return e?l(n.red,n.green,n.blue):l(r.red,r.green,r.blue)})),a=e=>{let t=e.target.value;if(!t&&0!==t)return;const r=s(t);r&&n(r)};return(t,r)=>(e.openBlock(),e.createBlock(on,{value:e.unref(o),label:"Hex","max-len":"7",classes:"hex mr-8px",onInput:a},null,8,["value"]))}})),cn=e.defineComponent({name:"PreviewRGBItem"}),sn=e.defineComponent(__spreadProps(__spreadValues({},cn),{props:{type:{default:"text"},label:{default:""}},setup(t){const r=t,n=e.inject("colorPickerState"),o=e.inject("updateColor"),a=e.computed((()=>{const{isGradient:e,red:t,green:o,blue:a,alpha:i,points:l=[],activePointIndex:c=0}=n,s=l[c];let u=0;switch(r.label){case"R":u=e?s.red:t;break;case"G":u=e?s.green:o;break;case"B":u=e?s.blue:a;break;case"A":u=~~(100*(e?s.alpha:i))}return u})),i=e=>{let t=+e.target.value;const{isGradient:a,points:i=[],activePointIndex:l=0}=n;switch(i[l],"A"===r.label&&t>100?t=100:t<=0?t=0:t>255&&(t=255),r.label){case"R":o({red:t},"red");break;case"G":o({green:t},"green");break;case"B":o({blue:t},"blue");break;case"A":o({alpha:t/100},"alpha")}};return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(on,{value:e.unref(a),label:r.label,type:r.type,classes:"A"!==r.label?"mr-8px":"",onInput:i},null,8,["value","label","type","classes"])]))}})),un=e.defineComponent({name:"PreviewRGB"}),pn=e.defineComponent(__spreadProps(__spreadValues({},un),{setup:t=>(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(sn,{type:"number",label:"R"}),e.createVNode(sn,{type:"number",label:"G"}),e.createVNode(sn,{type:"number",label:"B"}),e.createVNode(sn,{type:"number",label:"A"})],64))})),dn={class:"color-preview-area mb-8px px-16px"},fn={class:"w-full flex justify-between"},vn=e.defineComponent({name:"Preview"}),bn=e.defineComponent(__spreadProps(__spreadValues({},vn),{setup:t=>(t,r)=>(e.openBlock(),e.createElementBlock("div",dn,[e.createElementVNode("div",fn,[e.createVNode(ln),e.createVNode(pn)])]))})),yn=e.defineComponent({name:"Solid"}),hn=e.defineComponent(__spreadProps(__spreadValues({},yn),{setup:t=>(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Zr),e.createVNode(bn)],64))})),mn={class:"gradient-controls border-box flex justify-between items-center w-full mb-8px px-16px"},gn={class:"flex flex-1"},_n={key:0,class:"relative mr-24px"},jn=[(t=>(e.pushScopeId("data-v-4e21238c"),t=t(),e.popScopeId(),t))((()=>e.createElementVNode("div",{class:"gradient-degree-pointer"},null,-1)))],xn={class:"gradient-degree-value flex justify-center items-center"},wn=e.defineComponent({name:"GradientControls"}),kn=h(e.defineComponent(__spreadProps(__spreadValues({},wn),{setup(t){const r=e.inject("colorPickerState"),n=e.inject("updateColor"),o=e.computed((()=>r.type)),a=e.computed((()=>r.degree)),i=e=>{n({type:e},"type")},l=e.ref(!0),c=()=>{if(l.value)return void(l.value=!1);let e=(r.degree||0)+45;e>=360&&(e=0),n({degree:~~e},"degree")},s=e.computed((()=>({transform:`rotate(${r.degree}deg)`}))),u=f((e=>{const t=e.target.getBoundingClientRect();return{centerY:~~(8-window.pageYOffset)+t.top,centerX:~~(8-window.pageXOffset)+t.left}}),((e,{centerX:t,centerY:r})=>{l.value=!0;const o=function(e,t,r,n){return Math.atan2(e-r,t-n)*(180/Math.PI)*-1+180}(e.clientX,e.clientY,t,r);n({degree:~~o},"degree")}),(e=>{const t=e.target.classList;l.value=!1,!t.contains("gradient-degrees")&&t.contains("icon-rotate")}));return(t,r)=>(e.openBlock(),e.createElementBlock("div",mn,[e.createElementVNode("div",gn,[e.createElementVNode("div",{class:e.normalizeClass("gradient-type-item liner-gradient "+("linear"===e.unref(o)?"active":"")),onClick:r[0]||(r[0]=e=>i("linear"))},null,2),e.createElementVNode("div",{class:e.normalizeClass("gradient-type-item radial-gradient "+("radial"===e.unref(o)?"active":"")),onClick:r[1]||(r[1]=e=>i("radial"))},null,2)]),"linear"===e.unref(o)?(e.openBlock(),e.createElementBlock("div",_n,[e.createElementVNode("div",{class:"gradient-degrees cursor-pointer flex justify-center items-center",onMousedown:r[2]||(r[2]=(...t)=>e.unref(u)&&e.unref(u)(...t)),onClick:c},[e.createElementVNode("div",{class:"gradient-degree-center",style:e.normalizeStyle(e.unref(s))},jn,4)],32),e.createElementVNode("div",xn,[e.createElementVNode("p",null,e.toDisplayString(e.unref(a))+"°",1)])])):e.createCommentVNode("",!0)]))}})),[["__scopeId","data-v-4e21238c"]]),Pn=e.defineComponent({name:"Gradient"}),Cn=e.defineComponent(__spreadProps(__spreadValues({},Pn),{setup:t=>(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(kn),e.createVNode(Zr),e.createVNode(bn)],64))})),Vn={class:"picker-color-ui border-box m-8px bg-[#fff] flex flex-col slelect-none"},Bn={key:2,class:"btns flex justify-end items-center select-none"},On=e.defineComponent({name:"ColorPicker"});return e.defineComponent(__spreadProps(__spreadValues({},On),{props:{isGradient:{type:Boolean,default:!1},showBtn:{type:Boolean,default:!1},color:{type:Object,default:e=>e.isGradient?{type:"linear",degree:0,points:[{id:Lr(),left:0,red:0,green:0,blue:0,alpha:1},{id:Lr(),left:100,red:255,green:0,blue:0,alpha:1}]}:{red:255,green:0,blue:0,alpha:1}},cancelText:{type:String,default:"Cancel"},cancelColor:{type:String,default:"#333"},cancelBg:{type:String,default:"#fff"},confirmText:{type:String,default:"Confirm"},confirmColor:{type:String,defualt:"#333"},confirmBg:{type:String,defualt:"#fff"}},emits:["change"],setup(t,{expose:r,emit:n}){var o,a;const i=t,l=i.isGradient&&(null==(a=null==(o=i.color)?void 0:o.points)?void 0:a.length)||0,c=l?l-1:0,s=e.reactive({isGradient:i.isGradient,red:i.isGradient?i.color.points[c].red:i.color.red,green:i.isGradient?i.color.points[c].green:i.color.green,blue:i.isGradient?i.color.points[c].blue:i.color.blue,alpha:i.isGradient?i.color.points[c].alpha:i.color.alpha,hue:0,saturation:100,value:100,style:"",type:i.isGradient?i.color.type:"linear",degree:i.isGradient?i.color.degree:0,activePointIndex:c,points:i.isGradient?Sr(i.color.points):[]}),u=function(e,t,r){var n=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return L(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),zr(e,t,{leading:n,maxWait:t,trailing:o})}((function({red:e,green:t,blue:r,alpha:o,hue:a,saturation:l,value:c,points:u,type:f,degree:v},b){const y={red:e,green:t,blue:r,alpha:o,hue:a,saturation:l,value:c,points:u,type:f,degree:v};i.isGradient?function(e,t){const{red:r=0,green:o=0,blue:a=0,alpha:l=0,hue:c,saturation:u,value:p,points:f,type:v,degree:b}=e,y=s.points[s.activePointIndex];t?"points"===t||"type"===t||"degree"===t?s[t]=e[t]:y[t]=e[t]:(y.red=r,y.green=o,y.blue=a,s.alpha=l,f&&(s.points=f),v&&(s.type=v),b&&(s.degree=b),u&&(s.saturation=u),p&&(s.value=p),c&&(s.hue=c));const h=d(s.points,s.type,s.degree);s.style=h,!i.showBtn&&n("change",{style:s.style,gradient:{type:s.type,degree:s.degree,points:s.points}})}(y,b):function(e,t){const{red:r=0,green:o=0,blue:a=0,alpha:l,hue:c,saturation:u,value:d}=e;t?s[t]=e[t]:(s.red=r,s.green=o,s.blue=a,l&&(s.alpha=l),u&&(s.saturation=u),d&&(s.value=d),c&&(s.hue=c));const f=p(s.red,s.green,s.blue,s.alpha);s.style=f,!i.showBtn&&n("change",{style:f,color:{red:s.red,green:s.green,blue:s.blue,hue:s.hue,alpha:s.alpha}})}(y,b)}),i.showBtn?100:150);const f=e=>{e&&"function"==typeof e&&e()},v=e=>{const{isGradient:t,style:r,type:o,degree:a,points:i,red:l,green:c,blue:u,alpha:p,hue:d}=s;n("change",t?{style:r,gradient:{type:o,degree:a,points:i}}:{style:r,color:{red:l,green:c,blue:u,hue:d,alpha:p}}),e&&"function"==typeof e&&e()};return e.provide("colorPickerState",s),e.provide("updateColor",u),r({onClose:f,onConfirm:v}),(r,n)=>(e.openBlock(),e.createElementBlock("div",Vn,[i.isGradient?(e.openBlock(),e.createBlock(Cn,{key:0})):(e.openBlock(),e.createBlock(hn,{key:1})),t.showBtn?(e.openBlock(),e.createElementBlock("div",Bn,[e.createElementVNode("div",{class:"btn",style:e.normalizeStyle({color:i.cancelColor,backgroundColor:i.cancelBg}),onClick:f},e.toDisplayString(i.cancelText),5),e.createElementVNode("div",{class:"btn",style:e.normalizeStyle({color:i.confirmColor,backgroundColor:i.confirmBg}),onClick:v},e.toDisplayString(i.confirmText),5)])):e.createCommentVNode("",!0)]))}}))})); | ||
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["color-gradient-picker-vue3"]=t(e.Vue)}(this,(function(e){"use strict";const t="object"==typeof global&&global&&global.Object===Object&&global;var r="object"==typeof self&&self&&self.Object===Object&&self;const n=t||r||Function("return this")();const o=n.Symbol;var a=Object.prototype,i=a.hasOwnProperty,l=a.toString,c=o?o.toStringTag:void 0;var s=Object.prototype.toString;var u="[object Null]",p="[object Undefined]",d=o?o.toStringTag:void 0;function f(e){return null==e?void 0===e?p:u:d&&d in Object(e)?function(e){var t=i.call(e,c),r=e[c];try{e[c]=void 0;var n=!0}catch(a){}var o=l.call(e);return n&&(t?e[c]=r:delete e[c]),o}(e):function(e){return s.call(e)}(e)}function v(e){return null!=e&&"object"==typeof e}var b="[object Symbol]";const y=Array.isArray;var h=/\s/;var m=/^\s+/;function g(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&h.test(e.charAt(t)););return t}(e)+1).replace(m,""):e}function _(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var j=NaN,x=/^[-+]0x[0-9a-f]+$/i,w=/^0b[01]+$/i,k=/^0o[0-7]+$/i,P=parseInt;function C(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||v(e)&&f(e)==b}(e))return j;if(_(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=_(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=g(e);var r=w.test(e);return r||k.test(e)?P(e.slice(2),r?2:8):x.test(e)?j:+e}var O="[object AsyncFunction]",V="[object Function]",B="[object GeneratorFunction]",E="[object Proxy]";function S(e){if(!_(e))return!1;var t=f(e);return t==V||t==B||t==O||t==E}const X=n["__core-js_shared__"];var A,N=(A=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+A:"";var I=Function.prototype.toString;function $(e){if(null!=e){try{return I.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var z=/^\[object .+?Constructor\]$/,G=Function.prototype,M=Object.prototype,U=G.toString,T=M.hasOwnProperty,D=RegExp("^"+U.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function F(e){return!(!_(e)||(t=e,N&&N in t))&&(S(e)?D:z).test($(e));var t}function R(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return F(r)?r:void 0}const Y=R(n,"WeakMap");var L=Object.create;const W=function(){function e(){}return function(t){if(!_(t))return{};if(L)return L(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const q=function(){try{var e=R(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();var H=9007199254740991,J=/^(?:0|[1-9]\d*)$/;function K(e,t){var r=typeof e;return!!(t=null==t?H:t)&&("number"==r||"symbol"!=r&&J.test(e))&&e>-1&&e%1==0&&e<t}function Q(e,t,r){"__proto__"==t&&q?q(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Z(e,t){return e===t||e!=e&&t!=t}var ee=Object.prototype.hasOwnProperty;function te(e,t,r){var n=e[t];ee.call(e,t)&&Z(n,r)&&(void 0!==r||t in e)||Q(e,t,r)}function re(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var l=t[a],c=n?n(r[l],e[l],l,r,e):void 0;void 0===c&&(c=e[l]),o?Q(r,l,c):te(r,l,c)}return r}var ne=9007199254740991;function oe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ne}function ae(e){return null!=e&&oe(e.length)&&!S(e)}var ie=Object.prototype;function le(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ie)}function ce(e){return v(e)&&"[object Arguments]"==f(e)}var se=Object.prototype,ue=se.hasOwnProperty,pe=se.propertyIsEnumerable,de=ce(function(){return arguments}())?ce:function(e){return v(e)&&ue.call(e,"callee")&&!pe.call(e,"callee")};const fe=de;var ve="object"==typeof exports&&exports&&!exports.nodeType&&exports,be=ve&&"object"==typeof module&&module&&!module.nodeType&&module,ye=be&&be.exports===ve?n.Buffer:void 0;const he=(ye?ye.isBuffer:void 0)||function(){return!1};var me={};function ge(e){return function(t){return e(t)}}me["[object Float32Array]"]=me["[object Float64Array]"]=me["[object Int8Array]"]=me["[object Int16Array]"]=me["[object Int32Array]"]=me["[object Uint8Array]"]=me["[object Uint8ClampedArray]"]=me["[object Uint16Array]"]=me["[object Uint32Array]"]=!0,me["[object Arguments]"]=me["[object Array]"]=me["[object ArrayBuffer]"]=me["[object Boolean]"]=me["[object DataView]"]=me["[object Date]"]=me["[object Error]"]=me["[object Function]"]=me["[object Map]"]=me["[object Number]"]=me["[object Object]"]=me["[object RegExp]"]=me["[object Set]"]=me["[object String]"]=me["[object WeakMap]"]=!1;var _e="object"==typeof exports&&exports&&!exports.nodeType&&exports,je=_e&&"object"==typeof module&&module&&!module.nodeType&&module,xe=je&&je.exports===_e&&t.process;const we=function(){try{var e=je&&je.require&&je.require("util").types;return e||xe&&xe.binding&&xe.binding("util")}catch(t){}}();var ke=we&&we.isTypedArray;const Pe=ke?ge(ke):function(e){return v(e)&&oe(e.length)&&!!me[f(e)]};var Ce=Object.prototype.hasOwnProperty;function Oe(e,t){var r=y(e),n=!r&&fe(e),o=!r&&!n&&he(e),a=!r&&!n&&!o&&Pe(e),i=r||n||o||a,l=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=l.length;for(var s in e)!t&&!Ce.call(e,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||K(s,c))||l.push(s);return l}function Ve(e,t){return function(r){return e(t(r))}}const Be=Ve(Object.keys,Object);var Ee=Object.prototype.hasOwnProperty;function Se(e){return ae(e)?Oe(e):function(e){if(!le(e))return Be(e);var t=[];for(var r in Object(e))Ee.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var Xe=Object.prototype.hasOwnProperty;function Ae(e){if(!_(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=le(e),r=[];for(var n in e)("constructor"!=n||!t&&Xe.call(e,n))&&r.push(n);return r}function Ne(e){return ae(e)?Oe(e,!0):Ae(e)}const Ie=R(Object,"create");var $e=Object.prototype.hasOwnProperty;var ze=Object.prototype.hasOwnProperty;function Ge(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Me(e,t){for(var r=e.length;r--;)if(Z(e[r][0],t))return r;return-1}Ge.prototype.clear=function(){this.__data__=Ie?Ie(null):{},this.size=0},Ge.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ge.prototype.get=function(e){var t=this.__data__;if(Ie){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return $e.call(t,e)?t[e]:void 0},Ge.prototype.has=function(e){var t=this.__data__;return Ie?void 0!==t[e]:ze.call(t,e)},Ge.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ie&&void 0===t?"__lodash_hash_undefined__":t,this};var Ue=Array.prototype.splice;function Te(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Te.prototype.clear=function(){this.__data__=[],this.size=0},Te.prototype.delete=function(e){var t=this.__data__,r=Me(t,e);return!(r<0)&&(r==t.length-1?t.pop():Ue.call(t,r,1),--this.size,!0)},Te.prototype.get=function(e){var t=this.__data__,r=Me(t,e);return r<0?void 0:t[r][1]},Te.prototype.has=function(e){return Me(this.__data__,e)>-1},Te.prototype.set=function(e,t){var r=this.__data__,n=Me(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};const De=R(n,"Map");function Fe(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function Re(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ye(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}Re.prototype.clear=function(){this.size=0,this.__data__={hash:new Ge,map:new(De||Te),string:new Ge}},Re.prototype.delete=function(e){var t=Fe(this,e).delete(e);return this.size-=t?1:0,t},Re.prototype.get=function(e){return Fe(this,e).get(e)},Re.prototype.has=function(e){return Fe(this,e).has(e)},Re.prototype.set=function(e,t){var r=Fe(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};const Le=Ve(Object.getPrototypeOf,Object);function We(e){var t=this.__data__=new Te(e);this.size=t.size}We.prototype.clear=function(){this.__data__=new Te,this.size=0},We.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},We.prototype.get=function(e){return this.__data__.get(e)},We.prototype.has=function(e){return this.__data__.has(e)},We.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Te){var n=r.__data__;if(!De||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Re(n)}return r.set(e,t),this.size=r.size,this};var qe="object"==typeof exports&&exports&&!exports.nodeType&&exports,He=qe&&"object"==typeof module&&module&&!module.nodeType&&module,Je=He&&He.exports===qe?n.Buffer:void 0,Ke=Je?Je.allocUnsafe:void 0;function Qe(){return[]}var Ze=Object.prototype.propertyIsEnumerable,et=Object.getOwnPropertySymbols;const tt=et?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}(et(e),(function(t){return Ze.call(e,t)})))}:Qe;const rt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ye(t,tt(e)),e=Le(e);return t}:Qe;function nt(e,t,r){var n=t(e);return y(e)?n:Ye(n,r(e))}function ot(e){return nt(e,Se,tt)}function at(e){return nt(e,Ne,rt)}const it=R(n,"DataView");const lt=R(n,"Promise");const ct=R(n,"Set");var st="[object Map]",ut="[object Promise]",pt="[object Set]",dt="[object WeakMap]",ft="[object DataView]",vt=$(it),bt=$(De),yt=$(lt),ht=$(ct),mt=$(Y),gt=f;(it&>(new it(new ArrayBuffer(1)))!=ft||De&>(new De)!=st||lt&>(lt.resolve())!=ut||ct&>(new ct)!=pt||Y&>(new Y)!=dt)&&(gt=function(e){var t=f(e),r="[object Object]"==t?e.constructor:void 0,n=r?$(r):"";if(n)switch(n){case vt:return ft;case bt:return st;case yt:return ut;case ht:return pt;case mt:return dt}return t});const _t=gt;var jt=Object.prototype.hasOwnProperty;const xt=n.Uint8Array;function wt(e){var t=new e.constructor(e.byteLength);return new xt(t).set(new xt(e)),t}var kt=/\w*$/;var Pt=o?o.prototype:void 0,Ct=Pt?Pt.valueOf:void 0;var Ot="[object Boolean]",Vt="[object Date]",Bt="[object Map]",Et="[object Number]",St="[object RegExp]",Xt="[object Set]",At="[object String]",Nt="[object Symbol]",It="[object ArrayBuffer]",$t="[object DataView]",zt="[object Float32Array]",Gt="[object Float64Array]",Mt="[object Int8Array]",Ut="[object Int16Array]",Tt="[object Int32Array]",Dt="[object Uint8Array]",Ft="[object Uint8ClampedArray]",Rt="[object Uint16Array]",Yt="[object Uint32Array]";function Lt(e,t,r){var n,o,a,i=e.constructor;switch(t){case It:return wt(e);case Ot:case Vt:return new i(+e);case $t:return function(e,t){var r=t?wt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case zt:case Gt:case Mt:case Ut:case Tt:case Dt:case Ft:case Rt:case Yt:return function(e,t){var r=t?wt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,r);case Bt:return new i;case Et:case At:return new i(e);case St:return(a=new(o=e).constructor(o.source,kt.exec(o))).lastIndex=o.lastIndex,a;case Xt:return new i;case Nt:return n=e,Ct?Object(Ct.call(n)):{}}}var Wt=we&&we.isMap;const qt=Wt?ge(Wt):function(e){return v(e)&&"[object Map]"==_t(e)};var Ht=we&&we.isSet;const Jt=Ht?ge(Ht):function(e){return v(e)&&"[object Set]"==_t(e)};var Kt=1,Qt=2,Zt=4,er="[object Arguments]",tr="[object Function]",rr="[object GeneratorFunction]",nr="[object Object]",or={};function ar(e,t,r,n,o,a){var i,l=t&Kt,c=t&Qt,s=t&Zt;if(r&&(i=o?r(e,n,o,a):r(e)),void 0!==i)return i;if(!_(e))return e;var u=y(e);if(u){if(i=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&jt.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!l)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(e,i)}else{var p=_t(e),d=p==tr||p==rr;if(he(e))return function(e,t){if(t)return e.slice();var r=e.length,n=Ke?Ke(r):new e.constructor(r);return e.copy(n),n}(e,l);if(p==nr||p==er||d&&!o){if(i=c||d?{}:function(e){return"function"!=typeof e.constructor||le(e)?{}:W(Le(e))}(e),!l)return c?function(e,t){return re(e,rt(e),t)}(e,function(e,t){return e&&re(t,Ne(t),e)}(i,e)):function(e,t){return re(e,tt(e),t)}(e,function(e,t){return e&&re(t,Se(t),e)}(i,e))}else{if(!or[p])return o?e:{};i=Lt(e,p,l)}}a||(a=new We);var f=a.get(e);if(f)return f;a.set(e,i),Jt(e)?e.forEach((function(n){i.add(ar(n,t,r,n,e,a))})):qt(e)&&e.forEach((function(n,o){i.set(o,ar(n,t,r,o,e,a))}));var v=u?void 0:(s?c?at:ot:c?Ne:Se)(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(v||e,(function(n,o){v&&(n=e[o=n]),te(i,o,ar(n,t,r,o,e,a))})),i}or[er]=or["[object Array]"]=or["[object ArrayBuffer]"]=or["[object DataView]"]=or["[object Boolean]"]=or["[object Date]"]=or["[object Float32Array]"]=or["[object Float64Array]"]=or["[object Int8Array]"]=or["[object Int16Array]"]=or["[object Int32Array]"]=or["[object Map]"]=or["[object Number]"]=or[nr]=or["[object RegExp]"]=or["[object Set]"]=or["[object String]"]=or["[object Symbol]"]=or["[object Uint8Array]"]=or["[object Uint8ClampedArray]"]=or["[object Uint16Array]"]=or["[object Uint32Array]"]=!0,or["[object Error]"]=or[tr]=or["[object WeakMap]"]=!1;function ir(e){return ar(e,5)}const lr=function(){return n.Date.now()};var cr="Expected a function",sr=Math.max,ur=Math.min;function pr(e,t,r){var n,o,a,i,l,c,s=0,u=!1,p=!1,d=!0;if("function"!=typeof e)throw new TypeError(cr);function f(t){var r=n,a=o;return n=o=void 0,s=t,i=e.apply(a,r)}function v(e){var r=e-c;return void 0===c||r>=t||r<0||p&&e-s>=a}function b(){var e=lr();if(v(e))return y(e);l=setTimeout(b,function(e){var r=t-(e-c);return p?ur(r,a-(e-s)):r}(e))}function y(e){return l=void 0,d&&n?f(e):(n=o=void 0,i)}function h(){var e=lr(),r=v(e);if(n=arguments,o=this,c=e,r){if(void 0===l)return function(e){return s=e,l=setTimeout(b,t),u?f(e):i}(c);if(p)return clearTimeout(l),l=setTimeout(b,t),f(c)}return void 0===l&&(l=setTimeout(b,t)),i}return t=C(t)||0,_(r)&&(u=!!r.leading,a=(p="maxWait"in r)?sr(C(r.maxWait)||0,t):a,d="trailing"in r?!!r.trailing:d),h.cancel=function(){void 0!==l&&clearTimeout(l),s=0,n=c=o=l=void 0},h.flush=function(){return void 0===l?i:y(lr())},h}function dr(e){return"number"==typeof e&&!1===Number.isNaN(e)&&e>=0&&e<=255}function fr(e,t,r,n){if(dr(e)&&dr(t)&&dr(r)){const o={red:0|e,green:0|t,blue:0|r,alpha:0|n};return!0===dr(n)&&(o.alpha=0|n),o}}function vr(e,t,r,n){let o=t/100*(r/=100);const a=e/60;let i=o*(1-Math.abs(a%2-1)),l=r-o;return o=255*(o+l)|0,i=255*(i+l)|0,l=255*l|0,a>=1&&a<2?fr(i,o,l,n):a>=2&&a<3?fr(l,o,i,n):a>=3&&a<4?fr(l,i,o,n):a>=4&&a<5?fr(i,l,o,n):a>=5&&a<=6?fr(o,l,i,n):fr(o,i,l,n)}function br(e,t,r,n,o,a){e>n&&(e=n),t>r&&(t=r),e<0&&(e=0),t<0&&(t=0);const i=100-100*t/r|0,l=100*e/n|0;return __spreadProps(__spreadValues({},vr(o,l,i,a)),{saturation:l,value:i})}function yr(e,t,r,n,o){let a=360*e/t|0;return a=a<0?0:a>360?360:a,__spreadProps(__spreadValues({},vr(a,r,n,o)),{saturation:r,hue:a})}function hr(e,t){return(e=Number((e/t).toFixed(2)))>1?1:e<0?0:e}function mr(e,t,r){let n=e.toString(16),o=t.toString(16),a=r.toString(16);return e<16&&(n=`0${n}`),t<16&&(o=`0${o}`),r<16&&(a=`0${a}`),n+o+a}const gr=/(^#{0,1}[0-9A-F]{6}$)|(^#{0,1}[0-9A-F]{3}$)|(^#{0,1}[0-9A-F]{8}$)/i;function _r(e){if(gr.test(e)){if("#"===e[0]&&(e=e.slice(1,e.length)),e.length<6)return!1;const t=fr(parseInt(e.substring(0,2),16)||0,parseInt(e.substring(2,4),16)||0,parseInt(e.substring(4,6),16)||0,parseInt(e.substring(6,8),16)/255||0),r=t&&function({red:e,green:t,blue:r}){let n,o,a,i,l=0;const c=e/255,s=t/255,u=r/255,p=Math.max(c,s,u),d=p-Math.min(c,s,u),f=e=>(p-e)/6/d+.5;return 0===d?(l=0,i=0):(i=d/p,n=f(c),o=f(s),a=f(u),c===p?l=a-o:s===p?l=1/3+n-a:u===p&&(l=2/3+o-n),l<0?l+=1:l>1&&(l-=1)),{hue:Math.round(360*l),saturation:Math.round(100*i),value:Math.round(100*p)}}(__spreadValues({},t));return __spreadValues(__spreadValues({},t),r)}return!1}function jr(e,t){const r=100*e/t;return r<0?0:r>100?100:r}function xr(e,t,r,n){return`rgba(${e}, ${t}, ${r}, ${n})`}function wr(e,t,r){let n="";const o=e.slice();return o.sort(((e,t)=>e.left-t.left)),n="linear"===t?`linear-gradient(${r}deg,`:"radial-gradient(",o.forEach(((e,t)=>{n+=`rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha}) ${e.left}%`,t!==o.length-1&&(n+=",")})),n+=")",n}let kr;const Pr=new Uint8Array(16);function Cr(){if(!kr&&(kr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!kr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return kr(Pr)}const Or=[];for(let Nn=0;Nn<256;++Nn)Or.push((Nn+256).toString(16).slice(1));const Vr={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Br(e,t,r){if(Vr.randomUUID&&!t&&!e)return Vr.randomUUID();const n=(e=e||{}).random||(e.rng||Cr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return Or[e[t+0]]+Or[e[t+1]]+Or[e[t+2]]+Or[e[t+3]]+"-"+Or[e[t+4]]+Or[e[t+5]]+"-"+Or[e[t+6]]+Or[e[t+7]]+"-"+Or[e[t+8]]+Or[e[t+9]]+"-"+Or[e[t+10]]+Or[e[t+11]]+Or[e[t+12]]+Or[e[t+13]]+Or[e[t+14]]+Or[e[t+15]]}(n)}const Er={class:"picker-color-ui border-box m-8px bg-[#fff] flex flex-col slelect-none"},Sr=e.createElementVNode("p",null,"Loading...",-1),Xr={key:0,class:"btns flex justify-end items-center select-none"},Ar=e.defineComponent({name:"ColorPicker"}),Nr=e.defineComponent(__spreadProps(__spreadValues({},Ar),{props:{isGradient:{type:Boolean,default:!1},showBtn:{type:Boolean,default:!1},color:{type:Object,default:e=>e.isGradient?{type:"linear",degree:0,points:[{id:Br(),left:0,red:0,green:0,blue:0,alpha:1},{id:Br(),left:100,red:255,green:0,blue:0,alpha:1}]}:{red:255,green:0,blue:0,alpha:1}},cancelText:{type:String,default:"Cancel"},cancelColor:{type:String,default:"#333"},cancelBg:{type:String,default:"#fff"},confirmText:{type:String,default:"Confirm"},confirmColor:{type:String,defualt:"#333"},confirmBg:{type:String,defualt:"#fff"}},emits:["change"],setup(t,{expose:r,emit:n}){var o,a;const i=t,l=e.defineAsyncComponent((()=>Promise.resolve().then((()=>En)))),c=e.defineAsyncComponent((()=>Promise.resolve().then((()=>An)))),s=i.isGradient&&(null==(a=null==(o=i.color)?void 0:o.points)?void 0:a.length)||0,u=s?s-1:0,p=e.reactive({isGradient:i.isGradient,red:i.isGradient?i.color.points[u].red:i.color.red,green:i.isGradient?i.color.points[u].green:i.color.green,blue:i.isGradient?i.color.points[u].blue:i.color.blue,alpha:i.isGradient?i.color.points[u].alpha:i.color.alpha,hue:0,saturation:100,value:100,style:"",type:i.isGradient?i.color.type:"linear",degree:i.isGradient?i.color.degree:0,activePointIndex:u,points:i.isGradient?ir(i.color.points):[]}),d=function(e,t,r){var n=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return _(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),pr(e,t,{leading:n,maxWait:t,trailing:o})}((function({red:e,green:t,blue:r,alpha:o,hue:a,saturation:l,value:c,points:s,type:u,degree:d},f){const v={red:e,green:t,blue:r,alpha:o,hue:a,saturation:l,value:c,points:s,type:u,degree:d};i.isGradient?function(e,t){const{red:r=0,green:o=0,blue:a=0,alpha:l=0,hue:c,saturation:s,value:u,points:d,type:f,degree:v}=e,b=p.points[p.activePointIndex];t?"points"===t||"type"===t||"degree"===t?p[t]=e[t]:b[t]=e[t]:(b.red=r,b.green=o,b.blue=a,p.alpha=l,d&&(p.points=d),f&&(p.type=f),v&&(p.degree=v),s&&(p.saturation=s),u&&(p.value=u),c&&(p.hue=c));const y=wr(p.points,p.type,p.degree);p.style=y,!i.showBtn&&n("change",{style:p.style,gradient:{type:p.type,degree:p.degree,points:p.points}})}(v,f):function(e,t){const{red:r=0,green:o=0,blue:a=0,alpha:l,hue:c,saturation:s,value:u}=e;t?p[t]=e[t]:(p.red=r,p.green=o,p.blue=a,l&&(p.alpha=l),s&&(p.saturation=s),u&&(p.value=u),c&&(p.hue=c));const d=xr(p.red,p.green,p.blue,p.alpha);p.style=d,!i.showBtn&&n("change",{style:d,color:{red:p.red,green:p.green,blue:p.blue,hue:p.hue,alpha:p.alpha}})}(v,f)}),i.showBtn?100:150);const f=e=>{e&&"function"==typeof e&&e()},v=e=>{const{isGradient:t,style:r,type:o,degree:a,points:i,red:l,green:c,blue:s,alpha:u,hue:d}=p;n("change",t?{style:r,gradient:{type:o,degree:a,points:i}}:{style:r,color:{red:l,green:c,blue:s,hue:d,alpha:u}}),e&&"function"==typeof e&&e()};return e.provide("colorPickerState",p),e.provide("updateColor",d),r({onClose:f,onConfirm:v}),(r,n)=>(e.openBlock(),e.createElementBlock("div",Er,[(e.openBlock(),e.createBlock(e.Suspense,null,{default:e.withCtx((()=>[i.isGradient?(e.openBlock(),e.createBlock(e.unref(l),{key:0})):(e.openBlock(),e.createBlock(e.unref(c),{key:1}))])),fallback:e.withCtx((()=>[Sr])),_:1})),t.showBtn?(e.openBlock(),e.createElementBlock("div",Xr,[e.createElementVNode("div",{class:"btn",style:e.normalizeStyle({color:i.cancelColor,backgroundColor:i.cancelBg}),onClick:f},e.toDisplayString(i.cancelText),5),e.createElementVNode("div",{class:"btn",style:e.normalizeStyle({color:i.confirmColor,backgroundColor:i.confirmBg}),onClick:v},e.toDisplayString(i.confirmText),5)])):e.createCommentVNode("",!0)]))}}));function Ir(e,t,r){return function(n){let o=e(n);function a(e){o=t(e,o)||o}window.addEventListener("mousemove",a),window.addEventListener("mouseup",(e=>{window.removeEventListener("mousemove",a),r&&r(e,o)}),{once:!0})}}const $r={class:"picker-area-overlay1 wh-full"},zr={class:"picker-area-overlay2 wh-full rounded-8px"},Gr=e.defineComponent({name:"AreaPicker"}),Mr=(e,t)=>{const r=e.__vccOpts||e;for(const[n,o]of t)r[n]=o;return r},Ur=Mr(e.defineComponent(__spreadProps(__spreadValues({},Gr),{setup(t){const r=e.ref(null),n=e.ref(null),o=e.inject("colorPickerState"),a=e.inject("updateColor"),i=e.computed((()=>{const{width:e=0,height:t=0}=n.value||{},{saturation:r=100,value:a=100,isGradient:i,activePointIndex:l}=o,c=(r*e/100|0)-6,s=(t-a*t/100|0)-6,u=o.points[l||0];return{backgroundColor:`rgb(${i?null==u?void 0:u.red:o.red}, ${i?null==u?void 0:u.green:o.green}, ${i?null==u?void 0:u.blue:o.blue})`,left:`${c}px`,top:`${s}px`}})),l=e.computed((()=>{const{isGradient:e,red:t,green:r,blue:n,activePointIndex:a=0,points:i=[]}=o;if(e){const e=i[a];return{backgroundColor:`rgb(${e.red}, ${e.green}, ${e.blue})`}}return{backgroundColor:`rgb(${t}, ${r}, ${n})`}})),c=(e,{startX:t,startY:r,positionX:a,positionY:i})=>{const l=e.pageX-t,c=e.pageY-r,{width:s=0,height:u=0}=n.value||{},p=br(a+=l,i+=c,u,s,o.hue,o.alpha);return{positions:{positionX:a,positionY:i,startX:e.pageX,startY:e.pageY},color:p}},s=Ir((e=>{if(!n.value)return;const{x:t,y:r}=n.value,{width:i=0,height:l=0}=n.value||{},c=e.pageX,s=e.pageY,u=c-t,p=s-r,d=br(u,p,l,i,o.hue,o.alpha);return a(d),{startX:c,startY:s,positionX:u,positionY:p}}),((e,{startX:t,startY:r,positionX:n,positionY:o})=>{const{positions:i,color:l}=c(e,{startX:t,startY:r,positionX:n,positionY:o});return a(l),i}),((e,{startX:t,startY:r,positionX:n,positionY:o})=>{const{positions:i,color:l}=c(e,{startX:t,startY:r,positionX:n,positionY:o});return a(l),i}));return e.watchEffect((()=>{var e;const t=r.value;t&&!(null==(e=n.value)?void 0:e.width)&&(n.value=t.getBoundingClientRect()||null)})),(t,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"pickerAreaRef",ref:r,class:"picker-area w-full mb-16px relative rounded-8px",style:e.normalizeStyle(e.unref(l)),onMousedown:n[0]||(n[0]=(...t)=>e.unref(s)&&e.unref(s)(...t))},[e.createElementVNode("div",$r,[e.createElementVNode("div",zr,[e.createElementVNode("div",{class:"picker-pointer",style:e.normalizeStyle(e.unref(i))},null,4)])])],36))}})),[["__scopeId","data-v-2e8391c9"]]),Tr={class:"preview-area mr-8px"},Dr=e.defineComponent({name:"AreaPreview"}),Fr=e.defineComponent(__spreadProps(__spreadValues({},Dr),{setup(t){const r=e.inject("colorPickerState"),n=e.computed((()=>{let e="";return e=r.isGradient?wr(r.points,r.type,r.degree):xr(r.red,r.green,r.blue,r.alpha),{background:e}}));return(t,r)=>(e.openBlock(),e.createElementBlock("div",Tr,[e.createElementVNode("div",{class:"border-box w-36px h-36px rounded-8px border-width-1px border-solid border-[#ebedf5]",style:e.normalizeStyle(e.unref(n))},null,4)]))}})),Rr=e.defineComponent({name:"AreaHue"}),Yr=Mr(e.defineComponent(__spreadProps(__spreadValues({},Rr),{setup(t){const r=e.ref(null),n=e.ref(null),o=e.inject("colorPickerState"),a=e.inject("updateColor"),i=e.computed((()=>{var e;const t=(null==(e=n.value)?void 0:e.width)||0;return(o.hue||0)*(t-14)/360|0})),l=e.computed((()=>({left:`${i.value}px`}))),c=(e,{startX:t,positionX:r})=>{var a;const i=e.pageX-t,l=(null==(a=n.value)?void 0:a.width)||0,c=yr((r+=i)>l?l:r<=0?0:r,l,o.saturation,o.value,o.alpha);return{positions:{positionX:r,startX:e.pageX},color:c}},s=Ir((e=>{var t,r;const i=(null==(t=n.value)?void 0:t.x)||0,l=e.pageX,c=l-i,s=yr(c,(null==(r=n.value)?void 0:r.width)||0,o.saturation,o.value,o.alpha);return a(s),{startX:l,positionX:c}}),((e,{startX:t,positionX:r})=>{const{positions:n,color:o}=c(e,{startX:t,positionX:r});return a(o),n}),((e,{startX:t,positionX:r})=>{const{positions:n,color:o}=c(e,{startX:t,positionX:r});return a(o),n}));return e.watchEffect((()=>{var e,t;r.value&&!(null==(e=n.value)?void 0:e.width)&&(n.value=(null==(t=r.value)?void 0:t.getBoundingClientRect())||null)})),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:"relative w-full overflow-hidden rounded-10px mb-8px bg-[red] cursor-pointer",onMousedown:n[0]||(n[0]=(...t)=>e.unref(s)&&e.unref(s)(...t))},[e.createElementVNode("div",{ref_key:"hueRef",ref:r,class:"hue-area relative"},[e.createElementVNode("div",{class:"picker-pointer",style:e.normalizeStyle(e.unref(l))},null,4)],512)],32))}})),[["__scopeId","data-v-7cd4331a"]]),Lr={class:"alpha-area wh-full rounded-10px"},Wr=e.defineComponent({name:"AreaAlpha"}),qr=Mr(e.defineComponent(__spreadProps(__spreadValues({},Wr),{setup(t){const r=e.inject("colorPickerState"),n=e.inject("updateColor"),o=e.ref(null),a=e.ref(null),i=e.computed((()=>{var e;const{isGradient:t,alpha:n,activePointIndex:o=0,points:i=[]}=r,l=(null==(e=a.value)?void 0:e.width)||0;if(t){return i[o].alpha*(l-14)|0}return n*(l-14)|0})),l=e.computed((()=>{const{isGradient:e,red:t,green:n,blue:o,activePointIndex:a=0,points:i=[]}=r;if(e){const e=i[a];return{background:`linear-gradient(to right, rgba(0, 0, 0, 0), rgb(${e.red}, ${e.green}, ${e.blue}))`}}return{background:`linear-gradient(to right, rgba(0, 0, 0, 0), rgb(${t}, ${n}, ${o}))`}})),c=e.computed((()=>({left:`${i.value}px`}))),s=(e,{startX:t,positionX:r})=>{var n;const o=hr(r+=e.pageX-t,(null==(n=a.value)?void 0:n.width)||0);return{positions:{positionX:r,startX:e.pageX},alpha:o}},u=Ir((e=>{var t,r;const o=(null==(t=a.value)?void 0:t.x)||0,i=e.pageX,l=(null==(r=a.value)?void 0:r.width)||0;let c=i-o;return n({alpha:hr(c,l)},"alpha"),{startX:i,positionX:c}}),((e,{startX:t,positionX:r})=>{const{positions:o,alpha:a}=s(e,{startX:t,positionX:r});return n({alpha:a},"alpha"),o}),((e,{startX:t,positionX:r})=>{const{positions:o,alpha:a}=s(e,{startX:t,positionX:r});return n({alpha:a},"alpha"),o}));return e.watchEffect((()=>{var e,t;o.value&&!(null==(e=a.value)?void 0:e.width)&&(a.value=(null==(t=o.value)?void 0:t.getBoundingClientRect())||null)})),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"relative w-full overflow-hidden rounded-10px h-14px cursor-pointer",onMousedown:r[0]||(r[0]=(...t)=>e.unref(u)&&e.unref(u)(...t))},[e.createElementVNode("div",{class:"absolute left-0 right-0 top-0 bottom-0",style:e.normalizeStyle(e.unref(l))},null,4),e.createElementVNode("div",Lr,[e.createElementVNode("div",{ref_key:"alphaMaskRef",ref:o,class:"wh-full relative"},[e.createElementVNode("div",{class:"picker-pointer",style:e.normalizeStyle(e.unref(c))},null,4)],512)])],32))}})),[["__scopeId","data-v-256c0c24"]]),Hr=["onDblclick"],Jr=e.defineComponent({name:"AreaGradientPoint"}),Kr=e.defineComponent(__spreadProps(__spreadValues({},Jr),{props:{index:{type:Number,required:!0},point:{type:Object,required:!0},width:{type:Number,default:0},positions:{type:Object}},setup(t){const r=t,n=e.inject("colorPickerState"),o=e.inject("updateColor"),a=e.computed((()=>n.activePointIndex===r.index?" active":"")),i=e.computed((()=>({left:r.point.left*((r.width-14)/100)+"px"}))),l=e=>{n.points[r.index].left=e,o({type:n.type},"type")},c=(e,{startX:t,offsetX:n})=>{const o=jr(n+=e.pageX-t,r.width);return{positions:{offsetX:n,startX:e.pageX},left:o}},s=Ir((e=>{const t=e.pageX,o=e.pageY,a=t-(r.positions.x||0);return n.activePointIndex=r.index,{startX:t,startY:o,offsetX:a}}),((e,{startX:t,offsetX:r})=>{const{positions:n,left:o}=c(e,{startX:t,offsetX:r});return l(o),n}),((e,{startX:t,offsetX:r})=>{const{positions:n,left:o}=c(e,{startX:t,offsetX:r});return l(o),n})),u=()=>{let e=ir(n.points);if(e.length<=2)return;const t=r.index,a=0===t?1:t-1;e=null==e?void 0:e.filter((e=>e.id!==r.point.id)),n.activePointIndex=a,o({points:e},"points")};return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(`picker-pointer${e.unref(a)}`),style:e.normalizeStyle(e.unref(i)),onMousedown:o[0]||(o[0]=e.withModifiers(((...t)=>e.unref(s)&&e.unref(s)(...t)),["stop"])),onDblclick:e.withModifiers(u,["stop"]),onClick:o[1]||(o[1]=e.withModifiers((()=>e.unref(n).activePointIndex=r.index),["stop"]))},[e.createElementVNode("span",{class:e.normalizeClass(`child-point${e.unref(a)}`)},null,2)],46,Hr))}})),Qr=e.defineComponent({name:"AreaGradientPoints"}),Zr=e.defineComponent(__spreadProps(__spreadValues({},Qr),{setup(t){const r=e.inject("colorPickerState"),n=e.inject("updateColor"),o=e.ref(null),a=e.ref(null),i=e.computed((()=>({background:wr(r.points,"linear",90)}))),l=e=>{const{x:t=0,width:o=0}=a.value||{},i=jr(e.pageX-t,o),{hue:l,saturation:c,value:s}=r,u=ir(r.points),p=vr(l,c,s,1),d=__spreadProps(__spreadValues({id:Br()},p),{left:i});null==u||u.push(d),r.activePointIndex=u.findIndex((e=>e.id===d.id)),n({points:u},"points")};return e.watchEffect((()=>{var e,t;o.value&&!(null==(e=a.value)?void 0:e.width)&&(a.value=(null==(t=o.value)?void 0:t.getBoundingClientRect())||null)})),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:"gradient border-box w-full h-14px relative cursor-pointer rounded-10px mb-8px",style:e.normalizeStyle(e.unref(i)),onClick:l},[e.createElementVNode("div",{ref_key:"pointsContainerRef",ref:o,class:"wh-full relative"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r).points,((t,r)=>{var n;return e.openBlock(),e.createBlock(Kr,{key:t.id,index:r,point:t,positions:e.unref(a),width:null==(n=e.unref(a))?void 0:n.width},null,8,["index","point","positions","width"])})),128))],512)],4))}})),en={class:"flex flex-col px-16px"},tn={class:"flex pb-16px"},rn={class:"flex flex-col flex-1"},nn=e.defineComponent({name:"Area"}),on=e.defineComponent(__spreadProps(__spreadValues({},nn),{setup(t){const r=e.inject("colorPickerState");return(t,n)=>(e.openBlock(),e.createElementBlock("div",en,[e.createVNode(Ur),e.unref(r).isGradient?(e.openBlock(),e.createBlock(Zr,{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",tn,[e.createVNode(Fr),e.createElementVNode("div",rn,[e.createVNode(Yr),e.createVNode(qr)])])]))}})),an={class:"flex items-center relative w-full rounded-6px text-[#28314d]"},ln=["maxlength","type"],cn={class:"text-12px lining-15px font-bold mt-6px mb-0 text-[#1f2667]"},sn=e.defineComponent({name:"Input"}),un=Mr(e.defineComponent(__spreadProps(__spreadValues({},sn),{props:{value:{default:""},label:{default:""},classes:{default:""},maxLen:{default:"3"},type:{default:"text"}},emits:["input","blur","focus","update:value"],setup(t,{emit:r}){const n=t,o=e.computed({get:()=>n.value,set:e=>{r("update:value",e)}}),a=e=>{r("input",e)},i=()=>{r("blur")},l=()=>{r("focus")};return(r,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-shrink-0 items-center flex-col",n.classes])},[e.createElementVNode("div",an,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[0]||(c[0]=t=>e.isRef(o)?o.value=t:null),class:"w-full outline-0 text-[#1f2667] text-center font-bold text-12px",maxlength:t.maxLen,type:n.type,onFocus:l,onBlur:i,onInput:a},null,40,ln),[[e.vModelDynamic,e.unref(o),void 0,{trim:!0}]])]),e.createElementVNode("div",cn,e.toDisplayString(t.label),1)],2))}})),[["__scopeId","data-v-034b5687"]]),pn=e.defineComponent({name:"PreviewHex"}),dn=e.defineComponent(__spreadProps(__spreadValues({},pn),{setup(t){const r=e.inject("colorPickerState"),n=e.inject("updateColor"),o=e.computed((()=>{const{isGradient:e,activePointIndex:t}=r,n=r.points[t];return e?mr(n.red,n.green,n.blue):mr(r.red,r.green,r.blue)})),a=e=>{let t=e.target.value;if(!t&&0!==t)return;const r=_r(t);r&&n(r)};return(t,r)=>(e.openBlock(),e.createBlock(un,{value:e.unref(o),label:"Hex","max-len":"7",classes:"hex mr-8px",onInput:a},null,8,["value"]))}})),fn=e.defineComponent({name:"PreviewRGBItem"}),vn=e.defineComponent(__spreadProps(__spreadValues({},fn),{props:{type:{default:"text"},label:{default:""}},setup(t){const r=t,n=e.inject("colorPickerState"),o=e.inject("updateColor"),a=e.computed((()=>{const{isGradient:e,red:t,green:o,blue:a,alpha:i,points:l=[],activePointIndex:c=0}=n,s=l[c];let u=0;switch(r.label){case"R":u=e?s.red:t;break;case"G":u=e?s.green:o;break;case"B":u=e?s.blue:a;break;case"A":u=~~(100*(e?s.alpha:i))}return u})),i=e=>{let t=+e.target.value;const{isGradient:a,points:i=[],activePointIndex:l=0}=n;switch(i[l],"A"===r.label&&t>100?t=100:t<=0?t=0:t>255&&(t=255),r.label){case"R":o({red:t},"red");break;case"G":o({green:t},"green");break;case"B":o({blue:t},"blue");break;case"A":o({alpha:t/100},"alpha")}};return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(un,{value:e.unref(a),label:r.label,type:r.type,classes:"A"!==r.label?"mr-8px":"",onInput:i},null,8,["value","label","type","classes"])]))}})),bn=e.defineComponent({name:"PreviewRGB"}),yn=e.defineComponent(__spreadProps(__spreadValues({},bn),{setup:t=>(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(vn,{type:"number",label:"R"}),e.createVNode(vn,{type:"number",label:"G"}),e.createVNode(vn,{type:"number",label:"B"}),e.createVNode(vn,{type:"number",label:"A"})],64))})),hn={class:"color-preview-area mb-8px px-16px"},mn={class:"w-full flex justify-between"},gn=e.defineComponent({name:"Preview"}),_n=e.defineComponent(__spreadProps(__spreadValues({},gn),{setup:t=>(t,r)=>(e.openBlock(),e.createElementBlock("div",hn,[e.createElementVNode("div",mn,[e.createVNode(dn),e.createVNode(yn)])]))})),jn={class:"gradient-controls border-box flex justify-between items-center w-full mb-8px px-16px"},xn={class:"flex flex-1"},wn={key:0,class:"relative mr-24px"},kn=[(t=>(e.pushScopeId("data-v-4e21238c"),t=t(),e.popScopeId(),t))((()=>e.createElementVNode("div",{class:"gradient-degree-pointer"},null,-1)))],Pn={class:"gradient-degree-value flex justify-center items-center"},Cn=e.defineComponent({name:"GradientControls"}),On=Mr(e.defineComponent(__spreadProps(__spreadValues({},Cn),{setup(t){const r=e.inject("colorPickerState"),n=e.inject("updateColor"),o=e.computed((()=>r.type)),a=e.computed((()=>r.degree)),i=e=>{n({type:e},"type")},l=e.ref(!0),c=()=>{if(l.value)return void(l.value=!1);let e=(r.degree||0)+45;e>=360&&(e=0),n({degree:~~e},"degree")},s=e.computed((()=>({transform:`rotate(${r.degree}deg)`}))),u=Ir((e=>{const t=e.target.getBoundingClientRect();return{centerY:~~(8-window.pageYOffset)+t.top,centerX:~~(8-window.pageXOffset)+t.left}}),((e,{centerX:t,centerY:r})=>{l.value=!0;const o=function(e,t,r,n){return Math.atan2(e-r,t-n)*(180/Math.PI)*-1+180}(e.clientX,e.clientY,t,r);n({degree:~~o},"degree")}),(e=>{const t=e.target.classList;l.value=!1,!t.contains("gradient-degrees")&&t.contains("icon-rotate")}));return(t,r)=>(e.openBlock(),e.createElementBlock("div",jn,[e.createElementVNode("div",xn,[e.createElementVNode("div",{class:e.normalizeClass("gradient-type-item liner-gradient "+("linear"===e.unref(o)?"active":"")),onClick:r[0]||(r[0]=e=>i("linear"))},null,2),e.createElementVNode("div",{class:e.normalizeClass("gradient-type-item radial-gradient "+("radial"===e.unref(o)?"active":"")),onClick:r[1]||(r[1]=e=>i("radial"))},null,2)]),"linear"===e.unref(o)?(e.openBlock(),e.createElementBlock("div",wn,[e.createElementVNode("div",{class:"gradient-degrees cursor-pointer flex justify-center items-center",onMousedown:r[2]||(r[2]=(...t)=>e.unref(u)&&e.unref(u)(...t)),onClick:c},[e.createElementVNode("div",{class:"gradient-degree-center",style:e.normalizeStyle(e.unref(s))},kn,4)],32),e.createElementVNode("div",Pn,[e.createElementVNode("p",null,e.toDisplayString(e.unref(a))+"°",1)])])):e.createCommentVNode("",!0)]))}})),[["__scopeId","data-v-4e21238c"]]),Vn=e.defineComponent({name:"Gradient"}),Bn=e.defineComponent(__spreadProps(__spreadValues({},Vn),{setup:t=>(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(On),e.createVNode(on),e.createVNode(_n)],64))})),En=Object.freeze(Object.defineProperty({__proto__:null,default:Bn},Symbol.toStringTag,{value:"Module"})),Sn=e.defineComponent({name:"Solid"}),Xn=e.defineComponent(__spreadProps(__spreadValues({},Sn),{setup:t=>(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(on),e.createVNode(_n)],64))})),An=Object.freeze(Object.defineProperty({__proto__:null,default:Xn},Symbol.toStringTag,{value:"Module"}));return Nr})); |
{ | ||
"name": "color-gradient-picker-vue3", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "author": "June", |
@@ -7,3 +7,3 @@ <!-- | ||
* @LastEditors: June | ||
* @LastEditTime: 2023-10-06 19:37:41 | ||
* @LastEditTime: 2023-10-06 20:06:57 | ||
--> | ||
@@ -24,14 +24,14 @@ | ||
| | introduct | Default | | ||
| ------------ | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| isGradient | isGradient(是否渐变) | false | | ||
| showBtn | show footer buttons(是否显示地步的确认按钮) | false | | ||
| color | solid color(纯色 color) | `{ red: 255, green: 0, blue: 0, alpha: 1 } ` or `'{"type":"linear","degree":0,"points":[{"id":0,"left":0,"red":0,"green":0,"blue":0,"alpha":1},{"id":1,"left":100,"red":255,"green":0,"blue":0,"alpha":1}]}'` | | ||
| cancelText | cancel button text(取消文本) | 'cancel' | | ||
| cancelColor | cancel button font-color(取消文本颜色) | '#333' | | ||
| cancelBg | cancel button background color (取消背景颜色) | '#fff' | | ||
| confirmText | confirm button text(取消文本) | 'confirm' | | ||
| confirmColor | confirm button font-color(确认文本颜色) | '#333' | | ||
| confirmBg | confirm button background color (确认背景颜色) | '#fff' | | ||
| change | Event | | | ||
| | introduct | Default | | ||
| ------------ | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| isGradient | isGradient(是否渐变) | false | | ||
| showBtn | show footer buttons(是否显示地步的确认按钮) | false | | ||
| color | solid color(纯色 color) | `{ red: 255, green: 0, blue: 0, alpha: 1 } ` or `'{"type":"linear","degree":0,"points":[{"id":0,"left":0,"red":0,"green":0,"blue":0,"alpha":1},{"id":1,"left":100,"red":255,"green":0,"blue":0,"alpha":1}]}'` | | ||
| cancelText | cancel button text(取消文本) | 'cancel' | | ||
| cancelColor | cancel button font-color(取消文本颜色) | '#333' | | ||
| cancelBg | cancel button background color (取消背景颜色) | '#fff' | | ||
| confirmText | confirm button text(取消文本) | 'confirm' | | ||
| confirmColor | confirm button font-color(确认文本颜色) | '#333' | | ||
| confirmBg | confirm button background color (确认背景颜色) | '#fff' | | ||
| change | Event | | | ||
@@ -56,3 +56,3 @@ #### waring | ||
<div> | ||
<ColorPicker :is-gradient="true" @change="onChange" /> | ||
<ColorPicker is-gradient :color="gradientColort" @change="onChange" /> | ||
</div> | ||
@@ -74,2 +74,42 @@ </div> | ||
const gradientColort = { | ||
type: 'linear', | ||
degree: 0, | ||
points: [ | ||
{ | ||
id: '81bcb3a0-00b9-4a26-bfc7-2b261722de02', | ||
left: 0, | ||
red: 0, | ||
green: 0, | ||
blue: 0, | ||
alpha: 1, | ||
}, | ||
{ | ||
id: 'a5d144fb-9ab5-40b3-9beb-e79161c5f546', | ||
red: 0, | ||
green: 153, | ||
blue: 255, | ||
alpha: 1, | ||
left: 32.25806451612903, | ||
}, | ||
{ | ||
id: 'b1bc25ad-7273-4bd8-ad22-d5d11cab0f55', | ||
red: 0, | ||
green: 153, | ||
blue: 255, | ||
alpha: 1, | ||
left: 68.95161290322581, | ||
}, | ||
{ | ||
id: 'd6c7ccb8-b1c4-4470-8b73-ee0b56739421', | ||
left: 97.1774193548387, | ||
red: 255, | ||
green: 0, | ||
blue: 63, | ||
alpha: 1, | ||
}, | ||
], | ||
} | ||
const onChange = (color) => { | ||
@@ -76,0 +116,0 @@ // The results of solid and gradient are different |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146259
12
2819
179
3