halleyx-ui-framework 11.7.81-beta.2 → 11.7.81-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./index-CPcEfAJ0.js";function l(e){"@babel/helpers - typeof";return l=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},l(e)}var u=/^\s+/,d=/\s+$/;function f(e,t){if(e||=``,t||={},e instanceof f)return e;if(!(this instanceof f))return new f(e,t);var n=p(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}f.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4;return .2126*i+.7152*a+.0722*o},setAlpha:function(e){return this._a=L(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=_(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=_(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?`hsv(`+t+`, `+n+`%, `+r+`%)`:`hsva(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHsl:function(){var e=h(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=h(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?`hsl(`+t+`, `+n+`%, `+r+`%)`:`hsla(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHex:function(e){return y(this._r,this._g,this._b,e)},toHexString:function(e){return`#`+this.toHex(e)},toHex8:function(e){return b(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return`#`+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?`rgb(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`)`:`rgba(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`, `+this._roundA+`)`},toPercentageRgb:function(){return{r:Math.round(R(this._r,255)*100)+`%`,g:Math.round(R(this._g,255)*100)+`%`,b:Math.round(R(this._b,255)*100)+`%`,a:this._a}},toPercentageRgbString:function(){return this._a==1?`rgb(`+Math.round(R(this._r,255)*100)+`%, `+Math.round(R(this._g,255)*100)+`%, `+Math.round(R(this._b,255)*100)+`%)`:`rgba(`+Math.round(R(this._r,255)*100)+`%, `+Math.round(R(this._g,255)*100)+`%, `+Math.round(R(this._b,255)*100)+`%, `+this._roundA+`)`},toName:function(){return this._a===0?`transparent`:this._a<1?!1:F[y(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t=`#`+x(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?`GradientType = 1, `:``;if(e){var i=f(e);n=`#`+x(i._r,i._g,i._b,i._a)}return`progid:DXImageTransform.Microsoft.gradient(`+r+`startColorstr=`+t+`,endColorstr=`+n+`)`},toString:function(e){var t=!!e;e||=this._format;var n=!1,r=this._a<1&&this._a>=0;return!t&&r&&(e===`hex`||e===`hex6`||e===`hex3`||e===`hex4`||e===`hex8`||e===`name`)?e===`name`&&this._a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return f(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(E,arguments)},darken:function(){return this._applyModification(D,arguments)},desaturate:function(){return this._applyModification(S,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(w,arguments)},spin:function(){return this._applyModification(O,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(k,arguments)},monochromatic:function(){return this._applyCombination(N,arguments)},splitcomplement:function(){return this._applyCombination(j,arguments)},triad:function(){return this._applyCombination(A,[3])},tetrad:function(){return this._applyCombination(A,[4])}},f.fromRatio=function(e,t){if(l(e)==`object`){var n={};for(var r in e)e.hasOwnProperty(r)&&(r===`a`?n[r]=e[r]:n[r]=W(e[r]));e=n}return f(e,t)};function p(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,a=null,o=!1,s=!1;return typeof e==`string`&&(e=Y(e)),l(e)==`object`&&(J(e.r)&&J(e.g)&&J(e.b)?(t=m(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):J(e.h)&&J(e.s)&&J(e.v)?(r=W(e.s),i=W(e.v),t=v(e.h,r,i),o=!0,s=`hsv`):J(e.h)&&J(e.s)&&J(e.l)&&(r=W(e.s),a=W(e.l),t=g(e.h,r,a),o=!0,s=`hsl`),e.hasOwnProperty(`a`)&&(n=e.a)),n=L(n),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function m(e,t,n){return{r:R(e,255)*255,g:R(t,255)*255,b:R(n,255)*255}}function h(e,t,n){e=R(e,255),t=R(t,255),n=R(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=(r+i)/2;if(r==i)a=o=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4;break}a/=6}return{h:a,s:o,l:s}}function g(e,t,n){var r,i,a;e=R(e,360),t=R(t,100),n=R(n,100);function o(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(t===0)r=i=a=n;else{var s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function _(e,t,n){e=R(e,255),t=R(t,255),n=R(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=r,c=r-i;if(o=r===0?0:c/r,r==i)a=0;else{switch(r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4;break}a/=6}return{h:a,s:o,v:s}}function v(e,t,n){e=R(e,360)*6,t=R(t,100),n=R(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function y(e,t,n,r){var i=[U(Math.round(e).toString(16)),U(Math.round(t).toString(16)),U(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function b(e,t,n,r,i){var a=[U(Math.round(e).toString(16)),U(Math.round(t).toString(16)),U(Math.round(n).toString(16)),U(G(r))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function x(e,t,n,r){return[U(G(r)),U(Math.round(e).toString(16)),U(Math.round(t).toString(16)),U(Math.round(n).toString(16))].join(``)}f.equals=function(e,t){return!e||!t?!1:f(e).toRgbString()==f(t).toRgbString()},f.random=function(){return f.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function S(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.s-=t/100,n.s=z(n.s),f(n)}function C(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.s+=t/100,n.s=z(n.s),f(n)}function w(e){return f(e).desaturate(100)}function T(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.l+=t/100,n.l=z(n.l),f(n)}function E(e,t){t=t===0?0:t||10;var n=f(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),f(n)}function D(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.l-=t/100,n.l=z(n.l),f(n)}function O(e,t){var n=f(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,f(n)}function k(e){var t=f(e).toHsl();return t.h=(t.h+180)%360,f(t)}function A(e,t){if(isNaN(t)||t<=0)throw Error(`Argument to polyad must be a positive number`);for(var n=f(e).toHsl(),r=[f(e)],i=360/t,a=1;a<t;a++)r.push(f({h:(n.h+a*i)%360,s:n.s,l:n.l}));return r}function j(e){var t=f(e).toHsl(),n=t.h;return[f(e),f({h:(n+72)%360,s:t.s,l:t.l}),f({h:(n+216)%360,s:t.s,l:t.l})]}function M(e,t,n){t||=6,n||=30;var r=f(e).toHsl(),i=360/n,a=[f(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(f(r));return a}function N(e,t){t||=6;for(var n=f(e).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(f({h:r,s:i,v:a})),a=(a+s)%1;return o}f.mix=function(e,t,n){n=n===0?0:n||50;var r=f(e).toRgb(),i=f(t).toRgb(),a=n/100;return f({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},f.readability=function(e,t){var n=f(e),r=f(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},f.isReadable=function(e,t,n){var r=f.readability(e,t),i,a=!1;switch(i=X(n),i.level+i.size){case`AAsmall`:case`AAAlarge`:a=r>=4.5;break;case`AAlarge`:a=r>=3;break;case`AAAsmall`:a=r>=7;break}return a},f.mostReadable=function(e,t,n){var r=null,i=0,a,o,s,c;n||={},o=n.includeFallbackColors,s=n.level,c=n.size;for(var l=0;l<t.length;l++)a=f.readability(e,t[l]),a>i&&(i=a,r=f(t[l]));return f.isReadable(e,r,{level:s,size:c})||!o?r:(n.includeFallbackColors=!1,f.mostReadable(e,[`#fff`,`#000`],n))};var P=f.names={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`0ff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000`,blanchedalmond:`ffebcd`,blue:`00f`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,burntsienna:`ea7e5d`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`0ff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkgrey:`a9a9a9`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkslategrey:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dimgrey:`696969`,dodgerblue:`1e90ff`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`f0f`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,grey:`808080`,honeydew:`f0fff0`,hotpink:`ff69b4`,indianred:`cd5c5c`,indigo:`4b0082`,ivory:`fffff0`,khaki:`f0e68c`,lavender:`e6e6fa`,lavenderblush:`fff0f5`,lawngreen:`7cfc00`,lemonchiffon:`fffacd`,lightblue:`add8e6`,lightcoral:`f08080`,lightcyan:`e0ffff`,lightgoldenrodyellow:`fafad2`,lightgray:`d3d3d3`,lightgreen:`90ee90`,lightgrey:`d3d3d3`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslategray:`789`,lightslategrey:`789`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`0f0`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`f0f`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370db`,mediumseagreen:`3cb371`,mediumslateblue:`7b68ee`,mediumspringgreen:`00fa9a`,mediumturquoise:`48d1cc`,mediumvioletred:`c71585`,midnightblue:`191970`,mintcream:`f5fffa`,mistyrose:`ffe4e1`,moccasin:`ffe4b5`,navajowhite:`ffdead`,navy:`000080`,oldlace:`fdf5e6`,olive:`808000`,olivedrab:`6b8e23`,orange:`ffa500`,orangered:`ff4500`,orchid:`da70d6`,palegoldenrod:`eee8aa`,palegreen:`98fb98`,paleturquoise:`afeeee`,palevioletred:`db7093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,rebeccapurple:`663399`,red:`f00`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,slategrey:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,wheat:`f5deb3`,white:`fff`,whitesmoke:`f5f5f5`,yellow:`ff0`,yellowgreen:`9acd32`},F=f.hexNames=I(P);function I(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function L(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function R(e,t){V(e)&&(e=`100%`);var n=H(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function z(e){return Math.min(1,Math.max(0,e))}function B(e){return parseInt(e,16)}function V(e){return typeof e==`string`&&e.indexOf(`.`)!=-1&&parseFloat(e)===1}function H(e){return typeof e==`string`&&e.indexOf(`%`)!=-1}function U(e){return e.length==1?`0`+e:``+e}function W(e){return e<=1&&(e=e*100+`%`),e}function G(e){return Math.round(parseFloat(e)*255).toString(16)}function K(e){return B(e)/255}var q=function(){var e=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,t=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`,n=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`;return{CSS_UNIT:new RegExp(e),rgb:RegExp(`rgb`+t),rgba:RegExp(`rgba`+n),hsl:RegExp(`hsl`+t),hsla:RegExp(`hsla`+n),hsv:RegExp(`hsv`+t),hsva:RegExp(`hsva`+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function J(e){return!!q.CSS_UNIT.exec(e)}function Y(e){e=e.replace(u,``).replace(d,``).toLowerCase();var t=!1;if(P[e])e=P[e],t=!0;else if(e==`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n;return(n=q.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=q.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=q.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=q.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=q.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=q.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=q.hex8.exec(e))?{r:B(n[1]),g:B(n[2]),b:B(n[3]),a:K(n[4]),format:t?`name`:`hex8`}:(n=q.hex6.exec(e))?{r:B(n[1]),g:B(n[2]),b:B(n[3]),format:t?`name`:`hex`}:(n=q.hex4.exec(e))?{r:B(n[1]+``+n[1]),g:B(n[2]+``+n[2]),b:B(n[3]+``+n[3]),a:K(n[4]+``+n[4]),format:t?`name`:`hex8`}:(n=q.hex3.exec(e))?{r:B(n[1]+``+n[1]),g:B(n[2]+``+n[2]),b:B(n[3]+``+n[3]),format:t?`name`:`hex`}:!1}function X(e){var t,n;return e||={level:`AA`,size:`small`},t=(e.level||`AA`).toUpperCase(),n=(e.size||`small`).toLowerCase(),t!==`AA`&&t!==`AAA`&&(t=`AA`),n!==`small`&&n!==`large`&&(n=`small`),{level:t,size:n}}var Z={components:{CodeEditor:c},data(){return{editor_theme:`light`,color_picker:`<template>
1
+ import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./index-DzHWx4h0.js";function l(e){"@babel/helpers - typeof";return l=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},l(e)}var u=/^\s+/,d=/\s+$/;function f(e,t){if(e||=``,t||={},e instanceof f)return e;if(!(this instanceof f))return new f(e,t);var n=p(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}f.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4;return .2126*i+.7152*a+.0722*o},setAlpha:function(e){return this._a=L(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=_(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=_(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?`hsv(`+t+`, `+n+`%, `+r+`%)`:`hsva(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHsl:function(){var e=h(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=h(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?`hsl(`+t+`, `+n+`%, `+r+`%)`:`hsla(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHex:function(e){return y(this._r,this._g,this._b,e)},toHexString:function(e){return`#`+this.toHex(e)},toHex8:function(e){return b(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return`#`+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?`rgb(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`)`:`rgba(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`, `+this._roundA+`)`},toPercentageRgb:function(){return{r:Math.round(R(this._r,255)*100)+`%`,g:Math.round(R(this._g,255)*100)+`%`,b:Math.round(R(this._b,255)*100)+`%`,a:this._a}},toPercentageRgbString:function(){return this._a==1?`rgb(`+Math.round(R(this._r,255)*100)+`%, `+Math.round(R(this._g,255)*100)+`%, `+Math.round(R(this._b,255)*100)+`%)`:`rgba(`+Math.round(R(this._r,255)*100)+`%, `+Math.round(R(this._g,255)*100)+`%, `+Math.round(R(this._b,255)*100)+`%, `+this._roundA+`)`},toName:function(){return this._a===0?`transparent`:this._a<1?!1:F[y(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t=`#`+x(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?`GradientType = 1, `:``;if(e){var i=f(e);n=`#`+x(i._r,i._g,i._b,i._a)}return`progid:DXImageTransform.Microsoft.gradient(`+r+`startColorstr=`+t+`,endColorstr=`+n+`)`},toString:function(e){var t=!!e;e||=this._format;var n=!1,r=this._a<1&&this._a>=0;return!t&&r&&(e===`hex`||e===`hex6`||e===`hex3`||e===`hex4`||e===`hex8`||e===`name`)?e===`name`&&this._a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return f(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(E,arguments)},darken:function(){return this._applyModification(D,arguments)},desaturate:function(){return this._applyModification(S,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(w,arguments)},spin:function(){return this._applyModification(O,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(k,arguments)},monochromatic:function(){return this._applyCombination(N,arguments)},splitcomplement:function(){return this._applyCombination(j,arguments)},triad:function(){return this._applyCombination(A,[3])},tetrad:function(){return this._applyCombination(A,[4])}},f.fromRatio=function(e,t){if(l(e)==`object`){var n={};for(var r in e)e.hasOwnProperty(r)&&(r===`a`?n[r]=e[r]:n[r]=W(e[r]));e=n}return f(e,t)};function p(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,a=null,o=!1,s=!1;return typeof e==`string`&&(e=Y(e)),l(e)==`object`&&(J(e.r)&&J(e.g)&&J(e.b)?(t=m(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):J(e.h)&&J(e.s)&&J(e.v)?(r=W(e.s),i=W(e.v),t=v(e.h,r,i),o=!0,s=`hsv`):J(e.h)&&J(e.s)&&J(e.l)&&(r=W(e.s),a=W(e.l),t=g(e.h,r,a),o=!0,s=`hsl`),e.hasOwnProperty(`a`)&&(n=e.a)),n=L(n),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function m(e,t,n){return{r:R(e,255)*255,g:R(t,255)*255,b:R(n,255)*255}}function h(e,t,n){e=R(e,255),t=R(t,255),n=R(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=(r+i)/2;if(r==i)a=o=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4;break}a/=6}return{h:a,s:o,l:s}}function g(e,t,n){var r,i,a;e=R(e,360),t=R(t,100),n=R(n,100);function o(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(t===0)r=i=a=n;else{var s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function _(e,t,n){e=R(e,255),t=R(t,255),n=R(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=r,c=r-i;if(o=r===0?0:c/r,r==i)a=0;else{switch(r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4;break}a/=6}return{h:a,s:o,v:s}}function v(e,t,n){e=R(e,360)*6,t=R(t,100),n=R(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function y(e,t,n,r){var i=[U(Math.round(e).toString(16)),U(Math.round(t).toString(16)),U(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function b(e,t,n,r,i){var a=[U(Math.round(e).toString(16)),U(Math.round(t).toString(16)),U(Math.round(n).toString(16)),U(G(r))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function x(e,t,n,r){return[U(G(r)),U(Math.round(e).toString(16)),U(Math.round(t).toString(16)),U(Math.round(n).toString(16))].join(``)}f.equals=function(e,t){return!e||!t?!1:f(e).toRgbString()==f(t).toRgbString()},f.random=function(){return f.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function S(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.s-=t/100,n.s=z(n.s),f(n)}function C(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.s+=t/100,n.s=z(n.s),f(n)}function w(e){return f(e).desaturate(100)}function T(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.l+=t/100,n.l=z(n.l),f(n)}function E(e,t){t=t===0?0:t||10;var n=f(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),f(n)}function D(e,t){t=t===0?0:t||10;var n=f(e).toHsl();return n.l-=t/100,n.l=z(n.l),f(n)}function O(e,t){var n=f(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,f(n)}function k(e){var t=f(e).toHsl();return t.h=(t.h+180)%360,f(t)}function A(e,t){if(isNaN(t)||t<=0)throw Error(`Argument to polyad must be a positive number`);for(var n=f(e).toHsl(),r=[f(e)],i=360/t,a=1;a<t;a++)r.push(f({h:(n.h+a*i)%360,s:n.s,l:n.l}));return r}function j(e){var t=f(e).toHsl(),n=t.h;return[f(e),f({h:(n+72)%360,s:t.s,l:t.l}),f({h:(n+216)%360,s:t.s,l:t.l})]}function M(e,t,n){t||=6,n||=30;var r=f(e).toHsl(),i=360/n,a=[f(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(f(r));return a}function N(e,t){t||=6;for(var n=f(e).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(f({h:r,s:i,v:a})),a=(a+s)%1;return o}f.mix=function(e,t,n){n=n===0?0:n||50;var r=f(e).toRgb(),i=f(t).toRgb(),a=n/100;return f({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},f.readability=function(e,t){var n=f(e),r=f(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},f.isReadable=function(e,t,n){var r=f.readability(e,t),i,a=!1;switch(i=X(n),i.level+i.size){case`AAsmall`:case`AAAlarge`:a=r>=4.5;break;case`AAlarge`:a=r>=3;break;case`AAAsmall`:a=r>=7;break}return a},f.mostReadable=function(e,t,n){var r=null,i=0,a,o,s,c;n||={},o=n.includeFallbackColors,s=n.level,c=n.size;for(var l=0;l<t.length;l++)a=f.readability(e,t[l]),a>i&&(i=a,r=f(t[l]));return f.isReadable(e,r,{level:s,size:c})||!o?r:(n.includeFallbackColors=!1,f.mostReadable(e,[`#fff`,`#000`],n))};var P=f.names={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`0ff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000`,blanchedalmond:`ffebcd`,blue:`00f`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,burntsienna:`ea7e5d`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`0ff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkgrey:`a9a9a9`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkslategrey:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dimgrey:`696969`,dodgerblue:`1e90ff`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`f0f`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,grey:`808080`,honeydew:`f0fff0`,hotpink:`ff69b4`,indianred:`cd5c5c`,indigo:`4b0082`,ivory:`fffff0`,khaki:`f0e68c`,lavender:`e6e6fa`,lavenderblush:`fff0f5`,lawngreen:`7cfc00`,lemonchiffon:`fffacd`,lightblue:`add8e6`,lightcoral:`f08080`,lightcyan:`e0ffff`,lightgoldenrodyellow:`fafad2`,lightgray:`d3d3d3`,lightgreen:`90ee90`,lightgrey:`d3d3d3`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslategray:`789`,lightslategrey:`789`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`0f0`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`f0f`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370db`,mediumseagreen:`3cb371`,mediumslateblue:`7b68ee`,mediumspringgreen:`00fa9a`,mediumturquoise:`48d1cc`,mediumvioletred:`c71585`,midnightblue:`191970`,mintcream:`f5fffa`,mistyrose:`ffe4e1`,moccasin:`ffe4b5`,navajowhite:`ffdead`,navy:`000080`,oldlace:`fdf5e6`,olive:`808000`,olivedrab:`6b8e23`,orange:`ffa500`,orangered:`ff4500`,orchid:`da70d6`,palegoldenrod:`eee8aa`,palegreen:`98fb98`,paleturquoise:`afeeee`,palevioletred:`db7093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,rebeccapurple:`663399`,red:`f00`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,slategrey:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,wheat:`f5deb3`,white:`fff`,whitesmoke:`f5f5f5`,yellow:`ff0`,yellowgreen:`9acd32`},F=f.hexNames=I(P);function I(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function L(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function R(e,t){V(e)&&(e=`100%`);var n=H(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function z(e){return Math.min(1,Math.max(0,e))}function B(e){return parseInt(e,16)}function V(e){return typeof e==`string`&&e.indexOf(`.`)!=-1&&parseFloat(e)===1}function H(e){return typeof e==`string`&&e.indexOf(`%`)!=-1}function U(e){return e.length==1?`0`+e:``+e}function W(e){return e<=1&&(e=e*100+`%`),e}function G(e){return Math.round(parseFloat(e)*255).toString(16)}function K(e){return B(e)/255}var q=function(){var e=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,t=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`,n=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`;return{CSS_UNIT:new RegExp(e),rgb:RegExp(`rgb`+t),rgba:RegExp(`rgba`+n),hsl:RegExp(`hsl`+t),hsla:RegExp(`hsla`+n),hsv:RegExp(`hsv`+t),hsva:RegExp(`hsva`+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function J(e){return!!q.CSS_UNIT.exec(e)}function Y(e){e=e.replace(u,``).replace(d,``).toLowerCase();var t=!1;if(P[e])e=P[e],t=!0;else if(e==`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n;return(n=q.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=q.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=q.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=q.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=q.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=q.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=q.hex8.exec(e))?{r:B(n[1]),g:B(n[2]),b:B(n[3]),a:K(n[4]),format:t?`name`:`hex8`}:(n=q.hex6.exec(e))?{r:B(n[1]),g:B(n[2]),b:B(n[3]),format:t?`name`:`hex`}:(n=q.hex4.exec(e))?{r:B(n[1]+``+n[1]),g:B(n[2]+``+n[2]),b:B(n[3]+``+n[3]),a:K(n[4]+``+n[4]),format:t?`name`:`hex8`}:(n=q.hex3.exec(e))?{r:B(n[1]+``+n[1]),g:B(n[2]+``+n[2]),b:B(n[3]+``+n[3]),format:t?`name`:`hex`}:!1}function X(e){var t,n;return e||={level:`AA`,size:`small`},t=(e.level||`AA`).toUpperCase(),n=(e.size||`small`).toLowerCase(),t!==`AA`&&t!==`AAA`&&(t=`AA`),n!==`small`&&n!==`large`&&(n=`small`),{level:t,size:n}}var Z={components:{CodeEditor:c},data(){return{editor_theme:`light`,color_picker:`<template>
2
2
  <color-picker/>
3
3
  </template>`}},mounted(){this.call()},methods:{showCode(e){document.getElementById(e+`-icon`).classList.toggle(`active-icon`),document.getElementById(e).style.display===`none`?document.getElementById(e).style.display=`block`:document.getElementById(e).style.display===`block`&&(document.getElementById(e).style.display=`none`)},call(){var e=document.getElementById(`add-swatch`),t=document.getElementById(`mode-toggle`),n=document.getElementsByClassName(`default-swatches`)[0],r=document.getElementById(`color-indicator`),i=document.getElementById(`user-swatches`),a=document.getElementById(`spectrum-canvas`),o=a.getContext(`2d`),s=document.getElementById(`spectrum-cursor`),c=a.getBoundingClientRect(),l=document.getElementById(`hue-canvas`),u=l.getContext(`2d`),d=document.getElementById(`hue-cursor`),p=l.getBoundingClientRect(),m=``,h=0,g=1,_=.5,v=document.getElementById(`rgb-fields`),y=document.getElementById(`hex-field`),b=document.getElementById(`red`),x=document.getElementById(`blue`),S=document.getElementById(`green`),C=document.getElementById(`hex`);function w(){this.addDefaultSwatches(),D(),O()}w.prototype.defaultSwatches=[`#FFFFFF`,`#FFFB0D`,`#0532FF`,`#FF9300`,`#00F91A`,`#FF2700`,`#000000`,`#686868`,`#EE5464`,`#D27AEE`,`#5BA8C4`,`#E64AA9`];function T(e,t){var n=document.createElement(`button`);n.classList.add(`swatch`),n.setAttribute(`title`,t),n.style.backgroundColor=t,n.addEventListener(`click`,function(){var e=f(this.style.backgroundColor);A(e),j(e)}),e.appendChild(n),E()}w.prototype.addDefaultSwatches=function(){for(var e=0;e<this.defaultSwatches.length;++e)T(n,this.defaultSwatches[e])};function E(){c=a.getBoundingClientRect(),p=l.getBoundingClientRect()}function D(e){let t=a,n=o;n.clearRect(0,0,t.width,t.height),e||=`#f00`,n.fillStyle=e,n.fillRect(0,0,t.width,t.height);var r=n.createLinearGradient(0,0,t.width,0);r.addColorStop(0,`#fff`),r.addColorStop(1,`transparent`),n.fillStyle=r,n.fillRect(0,0,t.width,t.height);var i=n.createLinearGradient(0,0,0,t.height);i.addColorStop(0,`transparent`),i.addColorStop(1,`#000`),n.fillStyle=i,n.fillRect(0,0,t.width,t.height),t.addEventListener(`mousedown`,function(e){F(e)})}function O(){var e=l,t=u,n=t.createLinearGradient(0,0,0,e.height);n.addColorStop(0,`hsl(0, 100%, 50%)`),n.addColorStop(.17,`hsl(298.8, 100%, 50%)`),n.addColorStop(.33,`hsl(241.2, 100%, 50%)`),n.addColorStop(.5,`hsl(180, 100%, 50%)`),n.addColorStop(.67,`hsl(118.8, 100%, 50%)`),n.addColorStop(.83,`hsl(61.2, 100%, 50%)`),n.addColorStop(1,`hsl(360, 100%, 50%)`),t.fillStyle=n,t.fillRect(0,0,e.width,e.height),e.addEventListener(`mousedown`,function(e){R(e)})}function k(e){return f(`hsl `+e.toHsl().h+` 1 .5`).toHslString()}function A(e){h=e.toHsl().h;var t=e.toHsv(),n=c.width*t.s,r=c.height*(1-t.v),i=p.height-h/360*p.height;P(n,r),N(i),M(e),D(k(e))}function j(e){var t=e.toRgb(),n=e.toHex();b.value=t.r,S.value=t.g,x.value=t.b,C.value=n}function M(e){e=f(e),m=e,r.style.backgroundColor=e;var t=document.querySelector(`.color-space`);t.style.backgroundColor=e,s.style.backgroundColor=e,d.style.backgroundColor=`hsl(`+e.toHsl().h+`,100%, 50%)`}function N(e){d.style.top=e+`px`}function P(e,t){s.style.left=e+`px`,s.style.top=t+`px`}var F=function(e){I(e),s.classList.add(`dragging`),window.addEventListener(`mousemove`,I),window.addEventListener(`mouseup`,L)};function I(e){e.preventDefault();var t=e.pageX-c.left,n=e.pageY-c.top;t>c.width&&(t=c.width),t<0&&(t=0),n>c.height&&(n=c.height),n<0&&(n=.1);var r=t/c.width*100,i=1-n/c.height*100/100,a=r/100;_=i/2*(2-a),g=i*a/(1-Math.abs(2*_-1));var o=f(`hsl `+h+` `+g+` `+_);M(o),j(o),P(t,n)}function L(){s.classList.remove(`dragging`),window.removeEventListener(`mousemove`,I)}function R(e){z(e),d.classList.add(`dragging`),window.addEventListener(`mousemove`,z),window.addEventListener(`mouseup`,B)}function z(e){e.preventDefault();var t=e.pageY-p.top;t>p.height&&(t=p.height),t<0&&(t=0),h=360-360*(t/p.height);var n=f(`hsl `+h+` 1 .5`).toHslString(),r=f(`hsl `+h+` `+g+` `+_).toHslString();D(n),N(t,n),M(r),j(r)}function B(){d.classList.remove(`dragging`),window.removeEventListener(`mousemove`,z)}b.addEventListener(`change`,function(){A(f(`rgb `+b.value+` `+S.value+` `+x.value))}),S.addEventListener(`change`,function(){A(f(`rgb `+b.value+` `+S.value+` `+x.value))}),x.addEventListener(`change`,function(){A(f(`rgb `+b.value+` `+S.value+` `+x.value))}),e.addEventListener(`click`,function(){T(i,m)}),t.addEventListener(`click`,function(){v.classList.contains(`active`)?v.classList.remove(`active`):v.classList.add(`active`),y.classList.contains(`active`)?y.classList.remove(`active`):y.classList.add(`active`)}),window.addEventListener(`resize`,function(){E()}),new w}}},Q={class:`component-example`},$={class:`example-footer`},ee={id:`color-picker`,class:`source-code`,style:{display:`none`}},te={class:`example-source-wrapper`},ne={class:`source`};function re(i,c,l,u,d,f){let p=r(`divider`),m=r(`CodeEditor`);return t(),e(o,null,[c[3]||=n(`h1`,{class:`component-heading`},`Color picker`,-1),c[4]||=n(`p`,{class:`component-description`},` This component allows for a fully accessible and configurable color picker, allowing the user to pick from a set of predefined colors (swatches). `,-1),s(p,{position:`horizontal`,space:`20px`}),c[5]||=n(`div`,{class:`notes`},null,-1),n(`div`,Q,[c[2]||=a(`<div class="example-body" data-v-504f9f93><div class="color-space" data-v-504f9f93></div><div class="color-picker-panel" data-v-504f9f93><div class="panel-row" data-v-504f9f93><div class="swatches default-swatches" data-v-504f9f93></div><button class="button eyedropper" data-v-504f9f93>Get Color</button></div><div class="panel-row" data-v-504f9f93><div class="spectrum-map" data-v-504f9f93><button id="spectrum-cursor" class="color-cursor" data-v-504f9f93></button><canvas id="spectrum-canvas" data-v-504f9f93></canvas></div><div class="hue-map" data-v-504f9f93><button id="hue-cursor" class="color-cursor" data-v-504f9f93></button><canvas id="hue-canvas" data-v-504f9f93></canvas></div></div><div class="panel-row" data-v-504f9f93><div id="rgb-fields" class="field-group value-fields rgb-fields active" data-v-504f9f93><div class="field-group" data-v-504f9f93><label for="" class="field-label" data-v-504f9f93>R:</label><input id="red" type="number" max="255" min="0" class="field-input rgb-input" data-v-504f9f93></div><div class="field-group" data-v-504f9f93><label for="" class="field-label" data-v-504f9f93>G:</label><input id="green" type="number" max="255" min="0" class="field-input rgb-input" data-v-504f9f93></div><div class="field-group" data-v-504f9f93><label for="" class="field-label" data-v-504f9f93>B:</label><input id="blue" type="number" max="255" min="0" class="field-input rgb-input" data-v-504f9f93></div></div><div id="hex-field" class="field-group value-fields hex-field" data-v-504f9f93><label for="" class="field-label" data-v-504f9f93>Hex:</label><input id="hex" type="text" class="field-input" data-v-504f9f93></div><button id="mode-toggle" class="button mode-toggle" data-v-504f9f93>Mode</button></div><div class="panel-row" data-v-504f9f93><h2 class="panel-header" data-v-504f9f93>User Colors</h2><div id="user-swatches" class="swatches custom-swatches" data-v-504f9f93></div><button id="add-swatch" class="button add-swatch" data-v-504f9f93><span id="color-indicator" class="color-indicator" data-v-504f9f93></span><span data-v-504f9f93>Add to Swatches</span></button></div></div></div>`,1),n(`div`,$,[n(`span`,{id:`color-picker-icon`,class:`icon`,onClick:c[0]||=e=>f.showCode(`color-picker`)},[...c[1]||=[n(`i`,{class:`icon-code-regular`},null,-1)]])])]),n(`div`,ee,[n(`section`,te,[n(`div`,ne,[s(m,{id:`editor`,display_language:!1,value:d.color_picker,read_only:!0,theme:d.editor_theme,languages:[[`Javascript`,`Vue`],[`javascript`,`JS`],[`python`,`Python`]]},null,8,[`value`,`theme`])])])]),s(p,{position:`horizontal`,space:`20px`})],64)}var ie=i(Z,[[`render`,re],[`__scopeId`,`data-v-504f9f93`]]);export{ie as default};