ace-colorpicker-rpk 0.0.12 → 0.0.13

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.
@@ -9603,7 +9603,7 @@ var ColorView = function () {
9603
9603
  }
9604
9604
  // force recreation of tokenizer
9605
9605
  session.$mode.$tokenizer = null;
9606
- session.bgTokenizer.setTokenizer(editor.session.$mode.getTokenizer());
9606
+ session.bgTokenizer.setTokenizer(session.$mode.getTokenizer());
9607
9607
  // force re-highlight whole document
9608
9608
  session.bgTokenizer.start(0);
9609
9609
 
@@ -1 +1 @@
1
- var AceColorPicker=function(){"use strict";function h(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgba(0, 0, 0, 0)";return Array.isArray(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]}),"hex"==e?r(t):"rgb"==e?i(t,n):"hsl"==e?o(t):t}function r(t){var e=(t=Array.isArray(t)?{r:t[0],g:t[1],b:t[2],a:t[3]}:t).r.toString(16);t.r<16&&(e="0"+e);var n=t.g.toString(16);t.g<16&&(n="0"+n);var r=t.b.toString(16);t.b<16&&(r="0"+r);var i="";return t.a<1&&(i=(t=Math.floor(255*t.a)).toString(16),t<16&&(i="0"+i)),"#"+e+n+r+i}function i(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"rgba(0, 0, 0, 0)";if(void 0!==(t=Array.isArray(t)?{r:t[0],g:t[1],b:t[2],a:t[3]}:t))return 1==t.a||void 0===t.a?isNaN(t.r)?e:"rgb("+t.r+","+t.g+","+t.b+")":"rgba("+t.r+","+t.g+","+t.b+","+t.a+")"}function o(t){return 1==(t=Array.isArray(t)?{r:t[0],g:t[1],b:t[2],a:t[3]}:t).a||void 0===t.a?"hsl("+t.h+","+t.s+"%,"+t.l+"%)":"hsla("+t.h+","+t.s+"%,"+t.l+"%,"+t.a+")"}var t={format:h,rgb:i,hsl:o,hex:r};function u(t,e){return e=void 0===e?1:e,Math.round(t*e)/e}function n(t){return t*Math.PI/180}function a(t){t=180*t/Math.PI;return t=t<0?360+t:t}function l(t,e){return(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)+e*Math.cos(n(t))}function s(t,e){return(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)+e*Math.sin(n(t))}function p(t,e){return a(Math.atan2(e,t))}var e={round:u,radianToDegree:a,degreeToRadian:n,getXInCircle:l,getYInCircle:s,caculateAngle:p},c={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",aqua:"rgb(0, 255, 255)",aquamarine:"rgb(127, 255, 212)",azure:"rgb(240, 255, 255)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",black:"rgb(0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb(0, 0, 255)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",burlywood:"rgb(222, 184, 135)",cadetblue:"rgb(95, 158, 160)",chartreuse:"rgb(127, 255, 0)",chocolate:"rgb(210, 105, 30)",coral:"rgb(255, 127, 80)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",crimson:"rgb(237, 20, 61)",cyan:"rgb(0, 255, 255)",darkblue:"rgb(0, 0, 139)",darkcyan:"rgb(0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgray:"rgb(169, 169, 169)",darkgrey:"rgb(169, 169, 169)",darkgreen:"rgb(0, 100, 0)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb(85, 107, 47)",darkorange:"rgb(255, 140, 0)",darkorchid:"rgb(153, 50, 204)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkslateblue:"rgb(72, 61, 139)",darkslategray:"rgb(47, 79, 79)",darkslategrey:"rgb(47, 79, 79)",darkturquoise:"rgb(0, 206, 209)",darkviolet:"rgb(148, 0, 211)",deeppink:"rgb(255, 20, 147)",deepskyblue:"rgb(0, 191, 255)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb(30, 144, 255)",firebrick:"rgb(178, 34, 34)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb(34, 139, 34)",fuchsia:"rgb(255, 0, 255)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",goldenrod:"rgb(218, 165, 32)",gray:"rgb(128, 128, 128)",grey:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",greenyellow:"rgb(173, 255, 47)",honeydew:"rgb(240, 255, 240)",hotpink:"rgb(255, 105, 180)",indianred:"rgb(205, 92, 92)",indigo:"rgb(75, 0, 130)",ivory:"rgb(255, 255, 240)",khaki:"rgb(240, 230, 140)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lightblue:"rgb(173, 216, 230)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgreen:"rgb(144, 238, 144)",lightgray:"rgb(211, 211, 211)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightsalmon:"rgb(255, 160, 122)",lightseagreen:"rgb(32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightyellow:"rgb(255, 255, 224)",lime:"rgb(0, 255, 0)",limegreen:"rgb(50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",maroon:"rgb(128, 0, 0)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb(0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumpurple:"rgb(147, 112, 219)",mediumseagreen:"rgb(60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb(0, 250, 154)",mediumturquoise:"rgb(72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb(25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navy:"rgb(0, 0, 128)",oldlace:"rgb(253, 245, 230)",olive:"rgb(128, 128, 0)",olivedrab:"rgb(107, 142, 35)",orange:"rgb(255, 165, 0)",orangered:"rgb(255, 69, 0)",orchid:"rgb(218, 112, 214)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",paleturquoise:"rgb(175, 238, 238)",palevioletred:"rgb(219, 112, 147)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",plum:"rgb(221, 160, 221)",powderblue:"rgb(176, 224, 230)",purple:"rgb(128, 0, 128)",rebeccapurple:"rgb(102, 51, 153)",red:"rgb(255, 0, 0)",rosybrown:"rgb(188, 143, 143)",royalblue:"rgb(65, 105, 225)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb(46, 139, 87)",seashell:"rgb(255, 245, 238)",sienna:"rgb(160, 82, 45)",silver:"rgb(192, 192, 192)",skyblue:"rgb(135, 206, 235)",slateblue:"rgb(106, 90, 205)",slategray:"rgb(112, 128, 144)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",springgreen:"rgb(0, 255, 127)",steelblue:"rgb(70, 130, 180)",tan:"rgb(210, 180, 140)",teal:"rgb(0, 128, 128)",thistle:"rgb(216, 191, 216)",tomato:"rgb(255, 99, 71)",turquoise:"rgb(64, 224, 208)",violet:"rgb(238, 130, 238)",wheat:"rgb(245, 222, 179)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellowgreen:"rgb(154, 205, 50)",transparent:"rgba(0, 0, 0, 0)"};var f={isColorName:function(t){return!!c[t]},getColorByName:function(t){return c[t]}};function v(t,e,n){return n<0&&(n+=1),1<n&&--n,n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function g(t,e,n){var r,i,o,a;return 1==arguments.length&&(t=(r=arguments[0]).h,e=r.s,n=r.l),t/=360,n/=100,0==(e/=100)?i=o=a=n:(i=v(e=2*n-(n=n<.5?n*(1+e):n+e-n*e),n,t+1/3),o=v(e,n,t),a=v(e,n,t-1/3)),{r:u(255*i),g:u(255*o),b:u(255*a)}}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var m={HUEtoRGB:v,HSLtoHSV:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).h,e=r.s,n=r.l),R((n=g(t,e,n)).r,n.g,n.b)},HSLtoRGB:g},y=function(t,e,n){return e&&b(t.prototype,e),n&&b(t,n),t};function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $(t,e,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,e);if(void 0!==r){if("value"in r)return r.value;r=r.get;return void 0!==r?r.call(n):void 0}if(null!==(t=Object.getPrototypeOf(t)))return $(t,e,n)}function k(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function C(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var x=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},w=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,l=t[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&l.return&&l.return()}finally{if(i)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},O=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},M=/(#(?:[\da-f]{8})|#(?:[\da-f]{3}){1,2}|rgb\((?:\s*\d{1,3},\s*){2}\d{1,3}\s*\)|rgba\((?:\s*\d{1,3},\s*){3}\d*\.?\d+\s*\)|hsl\(\s*\d{1,3}(?:,\s*\d{1,3}%){2}\s*\)|hsla\(\s*\d{1,3}(?:,\s*\d{1,3}%){2},\s*\d*\.?\d+\s*\)|([\w_\-]+))/gi;function S(n){var t=n.match(M),e=[];if(!t)return e;for(var r,i=0,o=t.length;i<o;i++)-1<t[i].indexOf("#")||-1<t[i].indexOf("rgb")||-1<t[i].indexOf("hsl")?e.push({color:t[i]}):(r=f.getColorByName(t[i]))&&e.push({color:t[i],nameColor:r});var a={next:0};return e.forEach(function(t){var e=n.indexOf(t.color,a.next);t.startIndex=e,t.endIndex=e+t.color.length,a.next=t.endIndex}),e}function T(n){var t=S(n);return t.forEach(function(t,e){n=n.replace(t.color,"@"+e)}),{str:n,matches:t}}function E(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:",",n=T(t);return n.str.split(e).map(function(t,e){return t=I(t),t=n.matches[e]?t.replace("@"+e,n.matches[e].color):t})}function A(n,t){return t.forEach(function(t,e){n=n.replace("@"+e,t.color)}),n}function I(t){return t.replace(/^\s+|\s+$/g,"")}function P(t){if("string"==typeof t){if(-1<(t=f.isColorName(t)?f.getColorByName(t):t).indexOf("rgb(")){for(var e=0,n=(i=t.replace("rgb(","").replace(")","").split(",")).length;e<n;e++)i[e]=parseInt(I(i[e]),10);var r={type:"rgb",r:i[0],g:i[1],b:i[2],a:1};return r=Object.assign(r,U(r))}if(-1<t.indexOf("rgba(")){for(e=0,n=(i=t.replace("rgba(","").replace(")","").split(",")).length;e<n;e++)i[e]=n-1==e?parseFloat(I(i[e])):parseInt(I(i[e]),10);r={type:"rgb",r:i[0],g:i[1],b:i[2],a:i[3]};return r=Object.assign(r,U(r))}if(-1<t.indexOf("hsl(")){for(e=0,n=(i=t.replace("hsl(","").replace(")","").split(",")).length;e<n;e++)i[e]=parseFloat(I(i[e]));r={type:"hsl",h:i[0],s:i[1],l:i[2],a:1};return r=Object.assign(r,g(r))}if(-1<t.indexOf("hsla(")){for(e=0,n=(i=t.replace("hsla(","").replace(")","").split(",")).length;e<n;e++)i[e]=n-1==e?parseFloat(I(i[e])):parseInt(I(i[e]),10);r={type:"hsl",h:i[0],s:i[1],l:i[2],a:i[3]};return r=Object.assign(r,g(r))}if(0==t.indexOf("#")){var i=[],o=1;if(3==(t=t.replace("#","")).length)for(e=0,n=t.length;e<n;e++){var a=t.substr(e,1);i.push(parseInt(a+a,16))}else if(8===t.length){for(e=0,n=t.length;e<n;e+=2)i.push(parseInt(t.substr(e,2),16));o=i.pop()/255}else for(e=0,n=t.length;e<n;e+=2)i.push(parseInt(t.substr(e,2),16));r={type:"hex",r:i[0],g:i[1],b:i[2],a:o};return r=Object.assign(r,U(r))}}else if("number"==typeof t){if(0<=t&&t<=16777215){r={type:"hex",r:(16711680&t)>>16,g:(65280&t)>>8,b:(255&t)>>0,a:1};return r=Object.assign(r,U(r))}if(0<=t&&t<=4294967295){r={type:"hex",r:(4278190080&t)>>24,g:(16711680&t)>>16,b:(65280&t)>>8,a:(255&t)/255};return r=Object.assign(r,U(r))}}return t}function D(n){var r,t=(n=(n="string"==typeof n?E(n):n).map(function(t){if("string"==typeof t){var e=T(t),n=I(e.str).split(" ");return n[1]?n[1].includes("%")?n[1]=parseFloat(n[1].replace(/%/,""))/100:n[1]=parseFloat(n[1]):n[1]="*",n[0]=A(n[0],e.matches),n}if(Array.isArray(t))return t[1]?"string"==typeof t[1]&&(t[1].includes("%")?t[1]=parseFloat(t[1].replace(/%/,""))/100:t[1]=+t[1]):t[1]="*",[].concat(O(t))})).filter(function(t){return"*"===t[1]}).length;return 0<t&&(r=(1-n.filter(function(t){return"*"!=t[1]&&1!=t[1]}).map(function(t){return t[1]}).reduce(function(t,e){return t+e},0))/t,n.forEach(function(t,e){"*"==t[1]&&0<e&&(n.length-1==e||(t[1]=r))})),n}var B={matches:S,convertMatches:T,convertMatchesArray:E,reverseMatches:A,parse:P,parseGradient:D,trim:I,color_regexp:M,color_split:","};function R(t,e,n){1==arguments.length&&(t=(o=arguments[0]).r,e=o.g,n=o.b);var r=t/255,i=e/255,o=n/255,t=Math.max(r,i,o),e=t-Math.min(r,i,o),n=0;0==e?n=0:t==r?n=(i-o)/e%6*60:t==i?n=60*((o-r)/e+2):t==o&&(n=60*((r-i)/e+4));return{h:n=n<0?360+n:n,s:0==t?0:e/t,v:t}}function U(t,e,n){1==arguments.length&&(t=(a=arguments[0]).r,e=a.g,n=a.b),t/=255,e/=255,n/=255;var r,i=Math.max(t,e,n),o=Math.min(t,e,n),a=(i+o)/2;if(i==o)r=s=0;else{var l=i-o,s=.5<a?l/(2-i-o):l/(i+o);switch(i){case t:r=(e-n)/l+(e<n?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return{h:u(360*r),s:u(100*s),l:u(100*a)}}function F(t){return{r:t,g:t,b:t}}function j(t,e,n){return Math.ceil(.2126*t+.7152*e+.0722*n)}function H(t,e,n){var r;1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b);e=j(t,e,n);return{y:e,cr:.713*(t-e),cb:.564*(n-e)}}function L(t,e){return 100*((1<arguments.length&&void 0!==e?e:.04045)<t?Math.pow((t+.055)/1.055,2.4):t/12.92)}function V(t,e,n){var r;1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b);e/=255,n/=255;return{x:.4124*(t=L(t=t/255))+.3576*(e=L(e))+.1805*(n=L(n)),y:.2126*t+.7152*e+.0722*n,z:.0193*t+.1192*e+.9505*n}}var z={RGBtoCMYK:function(t,e,n){1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b);var r=t/255,t=e/255,e=n/255,n=1-Math.max(r,t,e);return{c:(1-r-n)/(1-n),m:(1-t-n)/(1-n),y:(1-e-n)/(1-n),k:n}},RGBtoGray:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b),F(H(t,e,n).y)},RGBtoHSL:U,RGBtoHSV:R,RGBtoLAB:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b),XYZtoLAB(V(t,e,n))},RGBtoSimpleGray:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b),F(Math.ceil((t+e+n)/3))},RGBtoXYZ:V,RGBtoYCrCb:H,c:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b),F(90<(t+e+n)/3?0:255)},brightness:j,gray:F};var N={CMYKtoRGB:function(t,e,n,r){var i;return 1==arguments.length&&(t=(i=arguments[0]).c,e=i.m,n=i.y,r=i.k),{r:255*(1-t)*(1-r),g:255*(1-e)*(1-r),b:255*(1-n)*(1-r)}}};function G(t){return.008856<Math.pow(t,3)?Math.pow(t,3):(t-16/116)/7.787}function X(t){return.0031308<t?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function Y(t,e,n){1==arguments.length&&(t=(i=arguments[0]).x,e=i.y,n=i.z);var r=t/100,i=e/100,t=n/100,e=-.9689*r+1.8758*i+.0415*t,n=.0557*r+-.204*i+1.057*t,t=X(t=3.2406*r+-1.5372*i+-.4986*t),e=X(e),n=X(n);return{r:u(255*t),g:u(255*e),b:u(255*n)}}function W(t,e,n){var r;1==arguments.length&&(t=(r=arguments[0]).l,e=r.a,n=r.b);t=e/500+(e=(t+16)/116),n=e-n/200,e=G(e);return{x:95.047*(t=G(t)),y:100*e,z:108.883*(n=G(n))}}var q={XYZtoRGB:Y,LABtoRGB:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).l,e=r.a,n=r.b),Y(W(t,e,n))},LABtoXYZ:W};function K(t,e,n){1==arguments.length&&(t=(i=arguments[0]).h,e=i.s,n=i.v);var r=t,i=n;360<=r&&(r=0);t=e*i,n=t*(1-Math.abs(r/60%2-1)),e=i-t,i=[];return 0<=r&&r<60?i=[t,n,0]:60<=r&&r<120?i=[n,t,0]:120<=r&&r<180?i=[0,t,n]:180<=r&&r<240?i=[0,n,t]:240<=r&&r<300?i=[n,0,t]:300<=r&&r<360&&(i=[t,0,n]),{r:u(255*(i[0]+e)),g:u(255*(i[1]+e)),b:u(255*(i[2]+e))}}var Z={HSVtoHSL:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).h,e=r.s,n=r.v),U((n=K(t,e,n)).r,n.g,n.b)},HSVtoRGB:K};var J={YCrCbtoRGB:function(t,e,n,r){1==arguments.length&&(t=(i=arguments[0]).y,e=i.cr,n=i.cb,r=(r=i.bit)||0);var i=t-.344*(n-r)-.714*(e-r),n=t+1.772*(n-r);return{r:Math.ceil(t+1.402*(e-r)),g:Math.ceil(i),b:Math.ceil(n)}}};function Q(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.5,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"hex",n={r:u(t.r+(e.r-t.r)*n),g:u(t.g+(e.g-t.g)*n),b:u(t.b+(e.b-t.b)*n),a:u(t.a+(e.a-t.a)*n,100)};return h(n,n.a<1?"rgb":r)}function tt(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:5;if(!t)return[];for(var n=(t=(t="string"==typeof t?E(t):t)||[]).length,r=[],i=0;i<n-1;i++)for(var o=0;o<e;o++)r.push(et(t[i],t[i+1],o/e));return r}function et(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.5,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"hex";return Q(P(t),P(e),n,r)}function nt(t){return t=P(t),(Math.round(299*t.r)+Math.round(587*t.g)+Math.round(114*t.b))/1e3}function rt(t){for(var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"h",n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:9,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"rgb",i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1,a=6<arguments.length&&void 0!==arguments[6]?arguments[6]:100,l=R(P(t)),s=(o-i)*a/n,u=[],c=1;c<=n;c++)l[e]=Math.abs((a-s*c)/a),u.push(h(K(l),r));return u}tt.parula=function(t){return tt(["#352a87","#0f5cdd","#00b5a6","#ffc337","#fdff00"],t)},tt.jet=function(t){return tt(["#00008f","#0020ff","#00ffff","#51ff77","#fdff00","#ff0000","#800000"],t)},tt.hsv=function(t){return tt(["#ff0000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000"],t)},tt.hot=function(t){return tt(["#0b0000","#ff0000","#ffff00","#ffffff"],t)},tt.pink=function(t){return tt(["#1e0000","#bd7b7b","#e7e5b2","#ffffff"],t)},tt.bone=function(t){return tt(["#000000","#4a4a68","#a6c6c6","#ffffff"],t)},tt.copper=function(t){return tt(["#000000","#3d2618","#9d623e","#ffa167","#ffc77f"],t)};var it={interpolateRGB:Q,blend:et,mix:function(t,e){return et(t,e,2<arguments.length&&void 0!==arguments[2]?arguments[2]:.5,3<arguments.length&&void 0!==arguments[3]?arguments[3]:"hex")},scale:tt,contrast:nt,contrastColor:function(t){return 128<=nt(t)?"black":"white"},gradient:function(t){for(var e=[],n=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:10)-((t=D(t)).length-1),r=n,i=1,o=t.length;i<o;i++){var a=t[i-1][0],l=t[i][0],s=1==i?t[i][1]:t[i][1]-t[i-1][1],s=i==t.length-1?r:Math.floor(s*n),e=e.concat(tt([a,l],s),[l]);r-=s}return e},scaleHSV:rt,scaleH:function(t){return rt(t,"h",1<arguments.length&&void 0!==arguments[1]?arguments[1]:9,2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgb",3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:360,1)},scaleS:function(t){return rt(t,"s",1<arguments.length&&void 0!==arguments[1]?arguments[1]:9,2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgb",3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,100)},scaleV:function(t){return rt(t,"v",1<arguments.length&&void 0!==arguments[1]?arguments[1]:9,2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgb",3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,100)}};var ot={euclidean:function(t,e){for(var n=0,r=0,i=t.length;r<i;r++)n+=Math.pow(e[r]-t[r],2);return Math.sqrt(n)},manhattan:function(t,e){for(var n=0,r=0,i=t.length;r<i;r++)n+=Math.abs(e[r]-t[r]);return n},max:function(t,e){for(var n=0,r=0,i=t.length;r<i;r++)n=Math.max(n,Math.abs(e[r]-t[r]));return n}},at={linear:function(t,e){for(var n=[],r=Math.round(Math.random()*t),i=Math.floor(t/e);n.push(r),r=(r+i)%t,n.length<e;);return n},shuffle:function(t,e){for(var n=[];n.length<e;){var r=Math.round(Math.random()*t);-1==n.indexOf(r)&&n.push(r)}return n}};function lt(t,e,n,r){for(var i=new Array(t),o=0;o<t;o++)i[o]=[];for(var a=0,l=e.length;a<l;a++){var s=e[a];i[function(n,t,r){var i=1/0,o=0;return t.forEach(function(t,e){t=r(n,t);t<i&&(i=t,o=e)}),o}(s,n,r)].push(s)}return i}function st(t,e,n,r,i,o){for(var a=0;a<t;a++){var l=n[a],s=r[a],u=new Array(s.length);i=!function(t,e){if(t.length===e.length){for(var n=0,r=t.length;n<r;++n)if(t[n]!==e[n])return;return 1}}(u=0<l.length?function(t){if(!t.length)return[];for(var e=new Array(t[0].length),n=0,r=e.length;n<r;n++)e[n]=0;for(var i=0,r=t.length;i<r;i++)for(var o=t[i],a=i+1,l=0,s=o.length;l<s;l++)e[l]+=(o[l]-e[l])/a;return e=e.map(function(t){return Math.floor(t)})}(l):e[Math.floor(o()*e.length)],s),r[a]=u}return i}function ut(t,e,n,r,i){var o=3<arguments.length&&void 0!==r?r:10,i=4<arguments.length&&void 0!==i?i:"linear";t=t,e=e||Math.max(2,Math.ceil(Math.sqrt(t.length/2)));var a=n||"euclidean";"string"==typeof a&&(a=ot[a]);for(var l=0,s=function(){return(l=(9301*l+49297)%233280)/233280},u=function(e,t,n){return at[2<arguments.length&&void 0!==n?n:"linear"](e.length,t).map(function(t){return e[t]})}(t,e,i),c=!0,h=0;c;){c=st(e,t,lt(e,t,u,a),u,!1,s);if(++h%o==0)break}return u}function ct(e,n){!function(t,e){for(var n=0;n<t;n+=4)e(n)}(e.pixels.length,function(t){n(e.pixels,t)})}var ht={create:function(t,e){var n=document.createElement("canvas");return n.width=t||0,n.height=e||0,n},drawPixels:function(t){var e=this.create(t.width,t.height),n=e.getContext("2d"),r=n.getImageData(0,0,e.width,e.height);return r.data.set(t.pixels),n.putImageData(r,0,0),e},createHistogram:function(i,o,a,t){var e=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{black:!0,red:!1,green:!1,blue:!1},n=this.create(i,o),l=n.getContext("2d");l.clearRect(0,0,i,o),l.fillStyle="white",l.fillRect(0,0,i,o);var s={black:!(l.globalAlpha=.7)};e.black?s.black=!1:s.black=!0,e.red?s.red=!1:s.red=!0,e.green?s.green=!1:s.green=!0,e.blue?s.blue=!1:s.blue=!0,Object.keys(a).forEach(function(t){var e,n,r;s[t]||(e=a[t],n=Math.max.apply(Math,e),r=i/e.length,l.fillStyle=t,e.forEach(function(t,e){t=o*(t/n);l.fillRect(e*r,o-t,r,t)}))}),"function"==typeof t&&t(n)},getHistogram:function(t){for(var r=new Array(256),i=new Array(256),o=new Array(256),a=new Array(256),e=0;e<256;e++)r[e]=0,i[e]=0,o[e]=0,a[e]=0;return ct(t,function(t,e){var n=Math.round(He.brightness(t[e],t[e+1],t[e+2]));r[n]++,i[t[e]]++,o[t[e+1]]++,a[t[e+2]]++}),{black:r,red:i,green:o,blue:a}},getBitmap:function(t,e){t=this.drawPixels(t);return{pixels:t.getContext("2d").getImageData(e.x||0,e.y||0,e.width||t.width,e.height||t.height).data,width:e.width,height:e.height}},putBitmap:function(t,e,n){var r=this.drawPixels(t),e=this.drawPixels(e),r=r.getContext("2d");return r.drawImage(e,n.x,n.y),t.pixels=r.getImageData(0,0,t.width,t.height).data,t}},ft=(y(vt,[{key:"initialize",value:function(){this.canvas=this.createCanvas(),this.context=this.canvas.getContext("2d")}},{key:"createCanvas",value:function(){return document.createElement("canvas")}},{key:"load",value:function(t){this.loadImage(t)}},{key:"loadImage",value:function(e){var n=this,r=this.context;this.newImage=new Image;var i=this.newImage;i.onload=function(){var t=i.height/i.width;n.opt.canvasWidth&&n.opt.canvasHeight?(n.canvas.width=n.opt.canvasWidth,n.canvas.height=n.opt.canvasHeight):(n.canvas.width=n.opt.maxWidth||i.width,n.canvas.height=n.canvas.width*t),r.drawImage(i,0,0,i.width,i.height,0,0,n.canvas.width,n.canvas.height),n.isLoaded=!0,e&&e()},this.getImageUrl(function(t){i.src=t})}},{key:"load",value:function(t){var e=this;this.newImage=new Image;var n=this.newImage;n.onload=function(){e.isLoaded=!0,t&&t()},this.getImageUrl(function(t){n.src=t})}},{key:"getImageUrl",value:function(e){if("string"==typeof this.imageUrl)return e(this.imageUrl);var t;this.imageUrl instanceof Blob&&((t=new FileReader).onload=function(t){e(t.target.result)},t.readAsDataURL(this.imageUrl))}},{key:"getRGBA",value:function(t,e,n,r){return[t,e,n,r]}},{key:"toArray",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=this.context.getImageData(0,0,this.canvas.width,this.canvas.height),i=r.width,o=r.height;(t=t||function(t,e){e(t)})({pixels:new Uint8ClampedArray(r.data),width:i,height:o},function(t){t=ht.drawPixels(t);"canvas"==n.returnTo?e(t):e(t.toDataURL(n.outputFormat||"image/png"))},n)}},{key:"toHistogram",value:function(t){var e=this.context.getImageData(0,0,this.canvas.width,this.canvas.height),n=e.width,r=e.height,e=new Uint8ClampedArray(e.data);return ht.getHistogram({pixels:e,width:n,height:r})}},{key:"toRGB",value:function(){for(var t=this.context.getImageData(0,0,this.canvas.width,this.canvas.height).data,e=[],n=0,r=t.length;n<r;n+=4)e[e.length]=[t[n+0],t[n+1],t[n+2],t[n+3]];return e}}]),vt);function vt(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};d(this,vt),this.isLoaded=!1,this.imageUrl=t,this.opt=e,this.initialize()}var gt={identity:function(){return[1,0,0,0,1,0,0,0,1]},stretching:function(t){return[t,0,0,0,1,0,0,0,1]},squeezing:function(t){return[t,0,0,0,1/t,0,0,0,1]},scale:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return[t=t||0===t?t:1,0,0,0,e=e||0===e?e:1,0,0,0,1]},scaleX:function(t){return this.scale(t)},scaleY:function(t){return this.scale(1,t)},translate:function(t,e){return[1,0,t,0,1,e,0,0,1]},rotate:function(t){t=this.radian(t);return[Math.cos(t),-Math.sin(t),0,Math.sin(t),Math.cos(t),0,0,0,1]},rotate90:function(){return[0,-1,0,1,0,0,0,0,1]},rotate180:function(){return[-1,0,0,0,-1,0,0,0,1]},rotate270:function(){return[0,1,0,-1,0,0,0,0,1]},radian:function(t){return t*Math.PI/180},skew:function(t,e){t=this.radian(t),e=this.radian(e);return[1,Math.tan(t),0,Math.tan(e),1,0,0,0,1]},skewX:function(t){t=this.radian(t);return[1,Math.tan(t),0,0,1,0,0,0,1]},skewY:function(t){t=this.radian(t);return[1,0,0,Math.tan(t),1,0,0,0,1]},shear1:function(t){return[1,-Math.tan(this.radian(t)/2),0,0,1,0,0,0,1]},shear2:function(t){return[1,0,0,Math.sin(this.radian(t)),1,0,0,0,1]}},dt={CONSTANT:gt,radian:function(t){return gt.radian(t)},multiply:function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},identity:function(t){return this.multiply(gt.identity(),t)},translate:function(t,e,n){return this.multiply(gt.translate(t,e),n)},rotate:function(t,e){return this.multiply(gt.rotate(t),e)},shear1:function(t,e){return this.multiply(gt.shear1(t),e)},shear2:function(t,e){return this.multiply(gt.shear2(t),e)},rotateShear:function(t,e){var n=this.shear1(t,e);return n=this.shear2(t,n),this.shear1(t,n)}};function pt(r){var h=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"center",f=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"center";return function(i,t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=Vt(i.pixels.length,i.width,i.height),o=i.width,a=i.height;"center"==h&&(h=Math.floor(o/2)),"center"==f&&(f=Math.floor(a/2));var l=dt.CONSTANT.translate(-h,-f),s=dt.CONSTANT.translate(h,f),u=dt.CONSTANT.shear1(r),c=dt.CONSTANT.shear2(r);Zt(function(t,e,n,r){n=dt.multiply(l,[n,r,1]),n=dt.multiply(u,n).map(Math.round);n=dt.multiply(c,n).map(Math.round),n=dt.multiply(u,n).map(Math.round),n=dt.multiply(s,n);r=w(n,2),n=r[0],r=r[1];n<0||r<0||o-1<n||a-1<r||te(t,r*o+n<<2,i.pixels,e)})(n,function(){t(n)},e)}}function mt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:200,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],t=Gt(t);return Wt("\n // refer to Color.brightness \n const v = ($C * Math.ceil($r * 0.2126 + $g * 0.7152 + $b * 0.0722) ) >= $scale ? 255 : 0;\n\n if ($hasColor) {\n\n if (v == 0) {\n $r = 0 \n $g = 0 \n $b = 0\n }\n \n } else {\n const value = Math.round(v)\n $r = value \n $g = value \n $b = value \n }\n \n ",{$C:(e=Gt(e))/100,$scale:t,$hasColor:n})}function yt(){return ee(Ut([1,2,1,2,4,2,1,2,1],1/16*(Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100)))}function bt(){return ee(Ut([1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1],1/256*(Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100)))}function $t(){Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return ee([5,5,5,-3,0,-3,-3,-3,-3])}function kt(){Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return ee([5,-3,-3,5,0,-3,5,-3,-3])}function Ct(){return ee(Ut([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))}function xt(){return ee(Ut([1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1],1/9))}function _t(){return ee(Ut([1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1],1/9))}function wt(){return ee(Ut([1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1],1/9))}function Ot(){return ee([-1,-2,-1,0,0,0,1,2,1])}function Mt(){return ee([-1,0,1,-2,0,2,-1,0,1])}var St=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Tt=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Et(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}function At(t,e,n){return n?function(t,e){if(isNaN(e)||e<1)return t;e|=0;var n,r,i,o,a,l,s,u,c,h,f,v,g,d,p,m,y,b,$,k,C=t.pixels,x=t.width,_=t.height,w=e+e+1,O=x-1,M=_-1,S=e+1,T=S*(S+1)/2,E=new Et,A=E;for(i=1;i<w;i++){var I;A=A.next=new Et,i==S&&(I=A)}A.next=E;var P=null,D=null;s=l=0;var B=St[e],R=Tt[e];for(r=0;r<_;r++){for(d=p=m=u=c=h=0,f=S*(y=C[l]),v=S*(b=C[l+1]),g=S*($=C[l+2]),u+=T*y,c+=T*b,h+=T*$,A=E,i=0;i<S;i++)A.r=y,A.g=b,A.b=$,A=A.next;for(i=1;i<S;i++)o=l+((O<i?O:i)<<2),u+=(A.r=y=C[o])*(k=S-i),c+=(A.g=b=C[o+1])*k,h+=(A.b=$=C[o+2])*k,d+=y,p+=b,m+=$,A=A.next;for(P=E,D=I,n=0;n<x;n++)C[l]=u*B>>R,C[l+1]=c*B>>R,C[l+2]=h*B>>R,u-=f,c-=v,h-=g,f-=P.r,v-=P.g,g-=P.b,o=s+((o=n+e+1)<O?o:O)<<2,d+=P.r=C[o],p+=P.g=C[o+1],m+=P.b=C[o+2],u+=d,c+=p,h+=m,P=P.next,f+=y=D.r,v+=b=D.g,g+=$=D.b,d-=y,p-=b,m-=$,D=D.next,l+=4;s+=x}for(n=0;n<x;n++){for(p=m=d=c=h=u=0,f=S*(y=C[l=n<<2]),v=S*(b=C[l+1]),g=S*($=C[l+2]),u+=T*y,c+=T*b,h+=T*$,A=E,i=0;i<S;i++)A.r=y,A.g=b,A.b=$,A=A.next;for(a=x,i=1;i<=e;i++)l=a+n<<2,u+=(A.r=y=C[l])*(k=S-i),c+=(A.g=b=C[l+1])*k,h+=(A.b=$=C[l+2])*k,d+=y,p+=b,m+=$,A=A.next,i<M&&(a+=x);for(l=n,P=E,D=I,r=0;r<_;r++)C[o=l<<2]=u*B>>R,C[o+1]=c*B>>R,C[o+2]=h*B>>R,u-=f,c-=v,h-=g,f-=P.r,v-=P.g,g-=P.b,o=n+((o=r+S)<M?o:M)*x<<2,u+=d+=P.r=C[o],c+=p+=P.g=C[o+1],h+=m+=P.b=C[o+2],P=P.next,f+=y=D.r,v+=b=D.g,g+=$=D.b,d-=y,p-=b,m-=$,D=D.next,l+=x}return t}(t,e):stackBlurCanvasRGB(t,0,0,e)}function It(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10,r=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=Gt(n);return function(t,e){e(At(t,n,r))}}function Pt(){return ee(Ut([1,4,6,4,1,4,16,24,16,4,6,24,-476,24,6,4,16,24,16,4,1,4,6,4,1],-1/Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:256)))}var Dt=_({},{crop:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,s=arguments[2],u=arguments[3],c=Vt(s*u*4,s,u);return function(t,e){for(var n=l,r=0;n<u;n++,r++)for(var i=a,o=0;i<s;i++,o++)c.pixels[r*s*o]=t.pixels[n*s*i];e(c)}},resize:function(r,i){return function(t,e){var n=ht.drawPixels(t),t=n.getContext("2d");n.width=r,n.height=i,e({pixels:new Uint8ClampedArray(t.getImageData(0,0,r,i).data),width:r,height:i})}},flipH:function(){return function(t,e){for(var n=t.width,r=t.height,i=(n%2==1?1:0)?Math.floor(n/2):n/2,o=0;o<r;o++)for(var a=0;a<i;a++)Kt(t.pixels,o*n+a<<2,o*n+(n-1-a)<<2);e(t)}},flipV:function(){return function(t,e){for(var n=t.width,r=t.height,i=(r%2==1?1:0)?Math.floor(r/2):r/2,o=0;o<i;o++)for(var a=0;a<n;a++)Kt(t.pixels,o*n+a<<2,(r-1-o)*n+a<<2);e(t)}},rotate:function(){var l=Gt(l=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0);return l%=360,function(o,t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(0==l)return o;if(90==l||270==l)var a=Vt(o.pixels.length,o.height,o.width);else{if(180!=l)return pt(l)(o,t,e);a=Vt(o.pixels.length,o.width,o.height)}Zt(function(t,e,n,r){var i;90==l?i=n*a.width+(a.width-1-r)<<2:270==l?i=(a.height-1-n)*a.width+r<<2:180==l&&(i=(a.height-1-r)*a.width+(a.width-1-n)<<2),te(a.pixels,i,o.pixels,e)})(o,function(){t(a)},e)}},rotateDegree:pt,histogram:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"gray",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0;r<e.length-1;r++)for(var i=e[r],o=e[r+1],a=o[0]-i[0],l=(o[1]-i[1])/a,s=0,u=i[0];s<a;s++,u++)n[u]=i[1]+s*l;return n[255]=255,Wt("red"===t?function(){$r=n[$r]}:"green"===t?function(){$g=n[$g]}:"blue"===t?function(){$b=n[$b]}:function(){var t=Color.RGBtoYCrCb($r,$g,$b),t=Color.YCrCbtoRGB(clamp(n[clamp(t.y)]),t.cr,t.cb,0);$r=t.r,$g=t.g,$b=t.b},{},{$realPoints:n})},"rotate-degree":pt},{bitonal:function(t,e){return Wt("\n const thresholdColor = ( $r + $g + $b ) <= $threshold ? $darkColor : $lightColor\n\n $r = thresholdColor.r\n $g = thresholdColor.g \n $b = thresholdColor.b \n ",{$threshold:2<arguments.length&&void 0!==arguments[2]?arguments[2]:100},{$darkColor:He.parse(t),$lightColor:He.parse(e)})},brightness:function(){var t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return Wt("\n $r += $C \n $g += $C \n $b += $C \n ",{$C:Math.floor(t/100*255)})},brownie:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[.5997023498159715,.34553243048391263,-.2708298674538042,0,-.037703249837783157,.8609577587992641,.15059552388459913,0,.24113635128153335,-.07441037908422492,.44972182064877153,0,0,0,0,1]})},clip:function(){var t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0);return Wt("\n\n $r = ($r > 255 - $C) ? 255 : 0\n $g = ($g > 255 - $C) ? 255 : 0\n $b = ($b > 255 - $C) ? 255 : 0\n\n ",{$C:2.55*Math.abs(t)})},contrast:function(){var t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0);return Wt("\n $r *= $C\n $g *= $C\n $b *= $C\n ",{$C:Math.max((128+t)/128,0)})},gamma:function(){return Wt("\n $r = Math.pow($r / 255, $C) * 255\n $g = Math.pow($g / 255, $C) * 255\n $b = Math.pow($b / 255, $C) * 255\n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)})},gradient:function(){var t=[].concat(Array.prototype.slice.call(arguments)),e=(e=(t=(t=1===t.length&&"string"==typeof t[0]?He.convertMatchesArray(t[0]):t).map(function(t){return He.matches(t).length?{type:"param",value:t}:{type:"scale",value:t}})).filter(function(t){return"scale"==t.type})[0])?+e.value:256;return t=t.filter(function(t){return"param"==t.type}).map(function(t){return t.value}).join(","),Wt("\n const colorIndex = clamp(Math.ceil($r * 0.2126 + $g * 0.7152 + $b * 0.0722))\n const newColorIndex = clamp(Math.floor(colorIndex * ($scale / 256)))\n const color = $colors[newColorIndex]\n\n $r = color.r \n $g = color.g \n $b = color.b \n $a = clamp(Math.floor(color.a * 256))\n ",{},{$colors:He.gradient(t,e).map(function(t){t=He.parse(t);return{r:t.r,g:t.g,b:t.b,a:t.a}}),$scale:e})},grayscale:function(t){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a\n ",{$matrix:[.2126+.7874*(1-(t=1<(t=(t=Gt(t))/100)?1:t)),.7152-.7152*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152+.2848*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152-.7152*(1-t),.0722+.9278*(1-t),0,0,0,0,1]})},hue:function(){return Wt("\n var hsv = Color.RGBtoHSV($r, $g, $b);\n\n // 0 ~ 360 \n var h = hsv.h;\n h += Math.abs($C)\n h = h % 360\n hsv.h = h\n\n var rgb = Color.HSVtoRGB(hsv);\n\n $r = rgb.r\n $g = rgb.g\n $b = rgb.b\n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:360)})},invert:function(){return Wt("\n $r = (255 - $r) * $C\n $g = (255 - $g) * $C\n $b = (255 - $b) * $C\n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100})},kodachrome:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,0,0,0,1]})},matrix:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,6<arguments.length&&void 0!==arguments[6]?arguments[6]:0,7<arguments.length&&void 0!==arguments[7]?arguments[7]:0,8<arguments.length&&void 0!==arguments[8]?arguments[8]:0,9<arguments.length&&void 0!==arguments[9]?arguments[9]:0,10<arguments.length&&void 0!==arguments[10]?arguments[10]:0,11<arguments.length&&void 0!==arguments[11]?arguments[11]:0,12<arguments.length&&void 0!==arguments[12]?arguments[12]:0,13<arguments.length&&void 0!==arguments[13]?arguments[13]:0,14<arguments.length&&void 0!==arguments[14]?arguments[14]:0,15<arguments.length&&void 0!==arguments[15]?arguments[15]:0]})},noise:function(){return Wt("\n const C = Math.abs($C) * 5\n const min = -C\n const max = C \n const noiseValue = Math.round(min + (Math.random() * (max - min)))\n\n $r += noiseValue\n $g += noiseValue\n $b += noiseValue\n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)})},opacity:function(){return Wt("\n $a *= $C \n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100})},polaroid:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1]})},saturation:function(){var t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:100);return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[t=1-Math.abs(t/100),0,0,0,0,t,0,0,0,0,t,0,0,0,0,t]})},sepia:function(){var t=Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[.393+.607*(1-(t=1<t?1:t)),.769-.769*(1-t),.189-.189*(1-t),0,.349-.349*(1-t),.686+.314*(1-t),.168-.168*(1-t),0,.272-.272*(1-t),.534-.534*(1-t),.131+.869*(1-t),0,0,0,0,1]})},shade:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return Wt("\n $r *= $redValue\n $g *= $greenValue\n $b *= $blueValue\n ",{$redValue:Gt(t),$greenValue:Gt(e),$blueValue:Gt(n)})},shift:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1]})},solarize:function(t,e,n){return Wt("\n $r = ($r < $redValue) ? 255 - $r: $r\n $g = ($g < $greenValue) ? 255 - $g: $g\n $b = ($b < $blueValue) ? 255 - $b: $b\n ",{$redValue:Gt(t),$greenValue:Gt(e),$blueValue:Gt(n)})},technicolor:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-.231103377548616,-.7501899197440212,1.847597816108189,0,0,0,0,1]})},threshold:function(){return mt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:200,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,!1)},"threshold-color":mt,tint:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return Wt("\n\n $r += (255 - $r) * $redTint\n $g += (255 - $g) * $greenTint\n $b += (255 - $b) * $blueTint\n\n ",{$redTint:Gt(t),$greenTint:Gt(e),$blueTint:Gt(n)})}},{blur:function(){return ee(Jt(Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:3)))},emboss:function(){var t;return ee([-2*(t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:4)),-t,0,-t,1,t,0,t,2*t])},gaussianBlur:yt,"gaussian-blur":yt,gaussianBlur5x:bt,"gaussian-blur-5x":bt,grayscale2:function(){return ee(Ut([.3,.3,.3,0,0,.59,.59,.59,0,0,.11,.11,.11,0,0,0,0,0,0,0,0,0,0,0,0],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},normal:function(){return ee([0,0,0,0,1,0,0,0,0])},kirschHorizontal:$t,"kirsch-horizontal":$t,kirschVertical:kt,"kirsch-vertical":kt,laplacian:function(){return ee(Ut([-1,-1,-1,-1,8,-1,-1,-1,-1],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},laplacian5x:Ct,"laplacian-5x":Ct,motionBlur:xt,"motion-blur":xt,motionBlur2:_t,"motion-blur-2":_t,motionBlur3:wt,"motion-blur-3":wt,negative:function(){return ee(Ut([-1,0,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,1,1,1,1],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},sepia2:function(){return ee(Ut([.393,.349,.272,0,0,.769,.686,.534,0,0,.189,.168,.131,0,0,0,0,0,0,0,0,0,0,0,0],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},sharpen:function(){return ee(Ut([0,-1,0,-1,5,-1,0,-1,0],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},sobelHorizontal:Ot,"sobel-horizontal":Ot,sobelVertical:Mt,"sobel-vertical":Mt,stackBlur:It,"stack-blur":It,transparency:function(){return ee(Ut([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,.3,0,0,0,0,0,1],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},unsharpMasking:Pt,"unsharp-masking":Pt},{kirsch:function(){return oe("kirsch-horizontal kirsch-vertical")},sobel:function(){return oe("sobel-horizontal sobel-vertical")},vintage:function(){return oe("brightness(15) saturation(-20) gamma(1.8)")}}),Bt=0,x=(x(Re={partial:ue,multi:le,merge:se,weight:Ut,repeat:Ft,colorMatrix:function(t,e,n){var r=t[e],i=t[e+1],o=t[e+2],a=t[e+3];Qt(t,e,n[0]*r+n[1]*i+n[2]*o+n[3]*a,n[4]*r+n[5]*i+n[6]*o+n[7]*a,n[8]*r+n[9]*i+n[10]*o+n[11]*a,n[12]*r+n[13]*i+n[14]*o+n[15]*a)},each:Ht,eachXY:Lt,createRandomCount:function(){return[9,16,25,36,49,64,81,100].sort(function(t,e){return.5-Math.random()})[0]},createRandRange:function(t,e,n){for(var r=[],i=1;i<=n;i++){var o=Math.random()*(e-t)+t,a=Math.floor(10*Math.random())%2==0?-1:1;r.push(a*o)}r.sort();var l=Math.floor(n>>1),s=r[l];return r[l]=r[0],r[0]=s,r},createBitmap:Vt,createBlurMatrix:Jt,pack:function(r){return function(n,t){Ht(n.pixels.length,function(t,e){r(n.pixels,t,e,n.pixels[t],n.pixels[t+1],n.pixels[t+2],n.pixels[t+3])},function(){t(n)})}},packXY:Zt,pixel:Wt,getBitmap:zt,putBitmap:Nt,radian:function(t){return dt.CONSTANT.radian(t)},convolution:ee,parseParamNumber:Gt,filter:oe,clamp:ie,fillColor:Qt,fillPixelColor:te},"multi",le),x(Re,"merge",se),x(Re,"matches",ne),x(Re,"parseFilter",re),x(Re,"partial",ue),Re),Rt=x;function Ut(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return t.map(function(t){return t*e})}function Ft(t,e){for(var n=new Array(e),r=0;r<e;r++)n[r]=t;return n}function jt(i,t,e,n,r,o,a,l){var t=1<arguments.length&&void 0!==t?t:0,s=2<arguments.length&&void 0!==e?e:1,u=n,c=r,h=5<arguments.length&&void 0!==o?o:1e4,a=6<arguments.length&&void 0!==a?a:"full",f=7<arguments.length&&void 0!==l?l:50,v=t,g=function(t){setTimeout(t,0)};function d(){for(var t,e=function(t){return t=[].concat(O(Array(0<arguments.length&&void 0!==t?t:50))).map(function(t){return"cri = ri + i * s; if (cri >= mx) return {currentRunIndex: cri, i: null}; c(cri); i++;"}).join("\n"),new Function("ri","i","s","mx","c","\n let cri = ri;\n \n "+t+"\n \n return {currentRunIndex: cri, i: i} \n ")}(f),n=v,r=0;r<h;){if(null==(t=e(v,r,s,i,u)).i){n=t.currentRunIndex;break}r=t.i,n=t.currentRunIndex}!function(t){t?v=t:v+=s;i<=v?c():g?g(d):d()}(n)}"requestAnimationFrame"==a&&(g=requestAnimationFrame,h=1e3),"full"==a&&(g=null,h=i),d()}function Ht(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};jt(t,0,4,function(t){e(t,t>>2)},function(){n()},r.functionDumpCount,r.frameTimer,r.loopCount)}function Lt(t,n,r,e){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{};jt(t,0,4,function(t){var e=t>>2;r(t,e%n,Math.floor(e/n))},function(){e()},i.functionDumpCount,i.frameTimer,i.loopCount)}function Vt(t,e,n){return{pixels:new Uint8ClampedArray(t),width:e,height:n}}function zt(t,e){return ht.getBitmap(t,e)}function Nt(t,e,n){return ht.putBitmap(t,e,n)}function Gt(t){return+(t="string"==typeof t?(t=t.replace(/deg/,"")).replace(/px/,""):t)}var Xt=/(([\w_\-]+)(\(([^\)]*)\))?)+/gi;function Yt(t,e,n){var a;return a={},e=(t=[{callback:t,context:1<arguments.length&&void 0!==e?e:{},rootContext:2<arguments.length&&void 0!==n?n:{}}]).map(function(r){var i=[];Object.keys(r.context).forEach(function(t,e){i[t]="n$"+Bt+++t+"$"}),Object.keys(r.rootContext).forEach(function(t,e){i[t]="r$"+Bt+++t+"$",a[i[t]]=r.rootContext[t]});var t=Object.keys(r.context).filter(function(t){return"number"!=typeof r.context[t]&&"string"!=typeof r.context[t]&&(!Array.isArray(r.context[t])||"number"!=typeof r.context[t][0]&&"string"!=typeof r.context[t][0])}).map(function(t,e){return[i[t],JSON.stringify(r.context[t])].join(" = ")}),o=r.callback;return"function"==typeof r.callback&&((o=r.callback.toString().split("{")).shift(),(o=(o=o.join("{")).split("}")).pop(),o=o.join("}")),Object.keys(i).forEach(function(n){var t=i[n];"number"==typeof r.context[n]||"string"==typeof r.context[n]?o=o.replace(new RegExp("\\"+n,"g"),r.context[n]):Array.isArray(r.context[n])&&("number"==typeof r.context[n][0]||"string"==typeof r.context[n][0])?r.context[n].forEach(function(t,e){o=o.replace(new RegExp("\\"+n+"\\["+e+"\\]","g"),t)}):o=o.replace(new RegExp("\\"+n,"g"),t)}),{preCallbackString:o,preContext:t}}),n=e.map(function(t,e){return t.preContext.length?"const "+t.preContext+";":""}).join("\n\n"),t=e.map(function(t){return t.preCallbackString}).join("\n\n"),(e=new Function("$pixels","$pixelIndex","$clamp","$Color"," \n let $r = $pixels[$pixelIndex], $g = $pixels[$pixelIndex+1], $b = $pixels[$pixelIndex+2], $a = $pixels[$pixelIndex+3];\n\n "+n+"\n\n "+t+"\n \n $pixels[$pixelIndex] = $r\n $pixels[$pixelIndex+1] = $g \n $pixels[$pixelIndex+2] = $b \n $pixels[$pixelIndex+3] = $a \n ")).$preCallbackString=t,e.$preContext=n,e.rootContextObject=a,e}function Wt(t){var e=Yt(t,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}),t=function(t,e){};return t.userFunction=e,t}var qt=[0,1,2,3];function Kt(n,r,i){qt.forEach(function(t){var e=n[r+t];n[r+t]=n[i+t],n[i+t]=e})}function Zt(i){return function(r,t){Lt(r.pixels.length,r.width,function(t,e,n){i(r.pixels,t,e,n)},function(){t(r)},2<arguments.length&&void 0!==arguments[2]?arguments[2]:{})}}function Jt(){var t=Math.pow(0<arguments.length&&void 0!==arguments[0]?arguments[0]:3,2);return Ft(1/t,t)}function Qt(t,e,n,r,i,o){var a;3==arguments.length&&(n=(a=arguments[2]).r,r=a.g,i=a.b,o=a.a),"number"==typeof n&&(t[e]=n),"number"==typeof r&&(t[e+1]=r),"number"==typeof i&&(t[e+2]=i),"number"==typeof o&&(t[e+3]=o)}function te(t,e,n,r){Qt(t,e,n[r],n[r+1],n[r+2],n[r+3])}function ee(h){var f=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],v=function(t,e,n){var r=1<arguments.length&&void 0!==e?e:0,i=2<arguments.length&&void 0!==n?n:255,o=t.map(function(t,e){return[]});return t.forEach(function(t,e){if(0!=t)for(var n=o[e],e=r;e<=i;e++)n[e]=t*e}),o}(h);return function(t,e){var n=Math.round(Math.sqrt(h.length)),r=function(t,e){var n=1<arguments.length&&void 0!==e?e:0,e=t.width+n,n=t.height+n;return{pixels:new Uint8ClampedArray(e*n*4),width:e,height:n}}(t,2*n);!function(t,e,n,r){for(var i,o,a,l,s=e.pixels.length/4,u=0;u<s;u++)a=u%e.width,i=r+(o=Math.floor(u/e.width)),(l=n+a)>t.width||i>t.height||(a=o*e.width+a<<2,l=i*t.width+l<<2,t.pixels[l]=e.pixels[a],t.pixels[1+l]=e.pixels[1+a],t.pixels[2+l]=e.pixels[2+a],t.pixels[3+l]=e.pixels[3+a])}(r,t,n,n);for(var i=Vt(r.pixels.length,r.width,r.height),o=Vt(t.pixels.length,t.width,t.height),a=function(t,o,i,e){var a=Math.round(Math.sqrt(t.length)),l=Math.floor(a/2),n=e?1:0,e="let r = 0, g = 0, b = 0, a = 0, scy = 0, scx =0, si = 0; ",s=[],u=[],c=[],h=[];t.forEach(function(t,e){var n=Math.floor(e/a)-l,r=e%a-l;0!=t&&(s.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+i+" + ($sx + ("+r+"))) * 4]]"),u.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+i+" + ($sx + ("+r+"))) * 4 + 1]]"),c.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+i+" + ($sx + ("+r+"))) * 4 + 2]]"),h.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+i+" + ($sx + ("+r+"))) * 4 + 3]]"))}),e+="r = "+s.join(" + ")+"; g = "+u.join(" + ")+"; b = "+c.join(" + ")+"; a = "+h.join(" + ")+";",e+="$dp[$di] = r; $dp[$di+1] = g;$dp[$di+2] = b;$dp[$di+3] = a + ("+n+")*(255-a); ";var f=new Function("$dp","$sp","$di","$sx","$sy","$t",e);return function(t,e,n,r,i){f(t,e,n,r,i,o)}}(h,v,r.width,(r.height,f)),l=t.pixels.length/4,s=0;s<l;s++){var u=s,c=u%t.width+n,u=Math.floor(u/t.width)+n;a(i.pixels,r.pixels,4*(u*r.width+c),c,u)}!function(t,e,n,r){for(var i=e.pixels.length>>2,o=0,a=0,l=0;l<i;l++){var s=l%e.width,u=r+(a=Math.floor(l/e.width));(o=n+s)>t.width||u>t.height||(u=u*t.width+o<<2,s=a*e.width+s<<2,e.pixels[s]=t.pixels[u],e.pixels[1+s]=t.pixels[1+u],e.pixels[2+s]=t.pixels[2+u],e.pixels[3+s]=t.pixels[3+u])}}(i,o,n,n),e(o)}}function ne(n){var e=He.convertMatches(n),t=e.str.match(Xt),r=[];if(!t)return r;var r=t.map(function(t){return{filter:t,origin:He.reverseMatches(t,e.matches)}}),i={next:0};return r=r.map(function(t){var e=n.indexOf(t.origin,i.next);return t.startIndex=e,t.endIndex=e+t.origin.length,t.arr=re(t.origin),i.next=t.endIndex,t}).filter(function(t){return!!t.arr.length})}function re(t){var e=He.convertMatches(t),n=e.str.match(Xt);if(!n[0])return[];var r=n[0].split("("),t=r.shift(),n=[];return r.length&&(n=r.shift().split(")")[0].split(",").map(function(t){return He.reverseMatches(t,e.matches)})),[t].concat(O(n)).map(He.trim)}function ie(t){return Math.min(255,t)}function oe(t){return se(ne(t).map(function(t){return t.arr}))}function ae(t){for(var e=0<arguments.length&&void 0!==t?t:[],n=[],r=[],i=0,o=e.length;i<o;i++){var a=e[i];a.userFunction?r.push(a):(r.length&&n.push([].concat(O(r))),n.push(a),r=[])}return r.length&&n.push([].concat(O(r))),n.forEach(function(t,e){var i;Array.isArray(t)&&(n[e]=(i=function(t){var e=t.map(function(t){return" \n "+t.userFunction.$preContext+"\n\n "+t.userFunction.$preCallbackString+"\n\n $r = clamp($r); $g = clamp($g); $b = clamp($b); $a = clamp($a);\n "}).join("\n\n"),n={clamp:ie,Color:He};t.forEach(function(t){Object.assign(n,t.userFunction.rootContextObject)});var t="const "+Object.keys(n).map(function(t){return" "+t+" = $rc."+t+" "}).join(","),r=new Function("$p","$pi","$rc"," \n let $r = $p[$pi], $g = $p[$pi+1], $b = $p[$pi+2], $a = $p[$pi+3];\n \n "+t+"\n\n "+e+"\n \n $p[$pi] = $r; $p[$pi+1] = $g; $p[$pi+2] = $b; $p[$pi+3] = $a;\n ");return function(t,e){r(t,e,n)}}(t),function(t,e){for(var n=0,r=t.pixels.length;n<r;n+=4)i(t.pixels,n);e(t)}))}),n}function le(){for(var t=arguments.length,a=Array(t),e=0;e<t;e++)a[e]=arguments[e];var l=(a=ae(a=a.map(function(t){if("function"==typeof t)return t;var e=(t=(t="string"==typeof t?[t]:t).slice(0)).shift();if("function"==typeof e)return e;var n=t;if(!(t=Dt[e]||Rt[e]))throw new Error(e+" is not filter. please check filter name.");return t.apply(t,n)}).filter(function(t){return t}))).length;return function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=t,i=0;function o(){a[i].call(null,r,function(t){r=t,l<=++i?e(r):o()},n)}o()}}function se(t){return le.apply(void 0,O(t))}function ue(r){for(var i=null,t=arguments.length,e=Array(1<t?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return i=1==e.length&&"string"==typeof e[0]?oe(e[0]):se(e),function(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};i(zt(e,r),function(t){n(Nt(e,t,r))},t)}}function ce(t){return+(t="string"==typeof t?(t=t.replace(/deg/,"")).replace(/px/,""):t)}function he(t,e){var n=1<arguments.length&&void 0!==e?e:1;return t.map(function(t){return t*n})}var fe=0;function ve(){return[].concat(Array.prototype.slice.call(arguments))}function ge(t){return{type:"convolution",length:t.length,content:t}}function de(t,e){return{type:"shader",index:fe,options:e,content:"\n if (u_filterIndex == "+fe+++".0) {\n "+t+"\n }\n "}}function pe(t){return"\n \n if (u_kernelSelect == "+t+".0) {\n vec4 colorSum = "+(r=t,i=Math.sqrt(r),o=Math.floor(i/2),[].concat(O(Array(r))).map(function(t,e){var n=Math.floor(e/i)-o;return"texture(u_image, v_texCoord + onePixel * vec2("+(e%i-o)+", "+n+")) * u_kernel"+r+"["+e+"]"}).join(" + \n"))+"; \n\n outColor = vec4((colorSum / u_kernel"+t+"Weight).rgb, 1);\n \n }\n ";var r,i,o}function me(t){return"vec4("+(t=[t.r/255,t.g/255,t.b/255,t.a||0].map(ye))+")"}function ye(t){return t==Math.floor(t)?t+".0":t}function be(){return ge(he([1,2,1,2,4,2,1,2,1],ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)*(1/16)))}function $e(){return ge([1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1])}function ke(){return ge([5,5,5,-3,0,-3,-3,-3,-3])}function Ce(){return ge([5,-3,-3,5,0,-3,5,-3,-3])}function xe(){return ge([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}function _e(){return ge([1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1])}function we(){return ge([1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1])}function Oe(){return ge([1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1])}function Me(){return ge([-1,-2,-1,0,0,0,1,2,1])}function Se(){return ge([-1,0,1,-2,0,2,-1,0,1])}function Te(){return ge(he([1,4,6,4,1,4,16,24,16,4,6,24,-476,24,6,4,16,24,16,4,1,4,6,4,1],-1/256))}function Ee(){var t=[0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,6<arguments.length&&void 0!==arguments[6]?arguments[6]:0,7<arguments.length&&void 0!==arguments[7]?arguments[7]:0,8<arguments.length&&void 0!==arguments[8]?arguments[8]:0,9<arguments.length&&void 0!==arguments[9]?arguments[9]:0,10<arguments.length&&void 0!==arguments[10]?arguments[10]:0,11<arguments.length&&void 0!==arguments[11]?arguments[11]:0,12<arguments.length&&void 0!==arguments[12]?arguments[12]:0,13<arguments.length&&void 0!==arguments[13]?arguments[13]:0,14<arguments.length&&void 0!==arguments[14]?arguments[14]:0,15<arguments.length&&void 0!==arguments[15]?arguments[15]:0].map(ye);return de("\n\n outColor = vec4(\n "+t[0]+" * pixelColor.r + "+t[1]+" * pixelColor.g + "+t[2]+" * pixelColor.b + "+t[3]+" * pixelColor.a,\n "+t[4]+" * pixelColor.r + "+t[5]+" * pixelColor.g + "+t[6]+" * pixelColor.b + "+t[7]+" * pixelColor.a,\n "+t[8]+" * pixelColor.r + "+t[9]+" * pixelColor.g + "+t[10]+" * pixelColor.b + "+t[11]+" * pixelColor.a,\n "+t[12]+" * pixelColor.r + "+t[13]+" * pixelColor.g + "+t[14]+" * pixelColor.b + "+t[15]+" * pixelColor.a\n ); \n ")}function Ae(){return de("\n float c = ( (pixelColor.r * 0.2126 + pixelColor.g * 0.7152 + pixelColor.b * 0.0722) ) >= "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+" ? 1.0 : 0.0;\n\n outColor = vec4(c, c, c, pixelColor.a);\n ")}var Ie=_({},{blur:function(){return ge([1,1,1,1,1,1,1,1,1])},normal:function(){return ge([0,0,0,0,1,0,0,0,0])},emboss:function(){var t;return ge([-2*(t=ce(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:4)),-t,0,-t,1,t,0,t,2*t])},gaussianBlur:be,"gaussian-blur":be,gaussianBlur5x:$e,"gaussian-blur-5x":$e,grayscale2:function(){return ge([.3,.3,.3,0,0,.59,.59,.59,0,0,.11,.11,.11,0,0,0,0,0,0,0,0,0,0,0,0])},kirschHorizontal:ke,"kirsch-horizontal":ke,kirschVertical:Ce,"kirsch-vertical":Ce,laplacian:function(){return ge([-1,-1,-1,-1,8,-1,-1,-1,-1])},laplacian5x:xe,"laplacian-5x":xe,motionBlur:_e,"motion-blur":_e,motionBlur2:we,"motion-blur-2":we,motionBlur3:Oe,"motion-blur-3":Oe,negative:function(){return ge([-1,0,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,1,1,1,1])},sepia2:function(){return ge([.393,.349,.272,0,0,.769,.686,.534,0,0,.189,.168,.131,0,0,0,0,0,0,0,0,0,0,0,0])},sharpen:function(){return ge([0,-1,0,-1,5,-1,0,-1,0])},sobelHorizontal:Me,"sobel-horizontal":Me,sobelVertical:Se,"sobel-vertical":Se,transparency:function(){return ge([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,.3,0,0,0,0,0,1])},unsharpMasking:Te,"unsharp-masking":Te},{bitonal:function(t,e){var n=ye(2<arguments.length&&void 0!==arguments[2]?arguments[2]:.5),t=me(He.parse(t));return de("\n if ((pixelColor.r + pixelColor.g + pixelColor.b) > "+n+") {\n outColor = vec4("+me(He.parse(e))+".rgb, pixelColor.a);\n } else {\n outColor = vec4("+t+".rgb, pixelColor.a);\n }\n ")},brightness:function(){return de("\n outColor = pixelColor + ("+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+");\n ")},brownie:function(){return Ee(.5997023498159715,.34553243048391263,-.2708298674538042,0,-.037703249837783157,.8609577587992641,.15059552388459913,0,.24113635128153335,-.07441037908422492,.44972182064877153,0,0,0,0,1)},clip:function(){var t=ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0));return de("\n outColor = vec4(\n (pixelColor.r > 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.g > 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.b > 1.0 - "+t+") ? 1.0 : 0.0,\n pixelColor.a \n );\n ")},chaos:function(){return de("\n vec2 st = pixelColor.st;\n st *= "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:10))+";\n \n vec2 ipos = floor(st); // get the integer coords\n\n vec3 color = vec3(random( ipos ));\n\n outColor = vec4(color, pixelColor.a);\n ")},contrast:function(){return de("\n outColor = pixelColor * "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+";\n ")},gamma:function(){var t=ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1));return de("\n outColor = vec4(pow(pixelColor.r, "+t+"), pow(pixelColor.g, "+t+"), pow(pixelColor.b, "+t+"), pixelColor.a );\n ")},gradient:function(){var t=(t=1===(t=[].concat(Array.prototype.slice.call(arguments))).length&&"string"==typeof t[0]?He.convertMatchesArray(t[0]):t).map(function(t){return t}).join(", "),e=He.parseGradient(t);e[0][1]=0,e[e.length-1][1]=1;for(var n=[],r=0,i=(e=e.map(function(t){var e=He.parse(t[0]);return[{r:e.r,g:e.g,b:e.b,a:e.a},t[1]]})).length;r<i-1;r++){var o=e[r],a=e[r+1],l=me(o[0]),s=me(a[0]),o=ye(o[1]),a=ye(a[1]);n.push("\n if ("+o+" <= rate && rate < "+a+") {\n outColor = mix("+l+", "+s+", (rate - "+o+")/("+a+" - "+o+"));\n }\n ")}return de("\n float rate = (pixelColor.r * 0.2126 + pixelColor.g * 0.7152 + pixelColor.b * 0.0722); \n\n "+n.join("\n")+" \n ")},grayscale:function(){var t=ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return Ee(.2126+.7874*(1-(t=1<t?1:t)),.7152-.7152*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152+.2848*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152-.7152*(1-t),.0722+.9278*(1-t),0,0,0,0,1)},hue:function(){return de("\n vec3 hsv = rgb2hsv(pixelColor.rgb);\n hsv.x += "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+";\n outColor = vec4(hsv2rgb(hsv).rgb, pixelColor.a);\n ")},invert:function(){var t=ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1));return de("\n outColor = vec4(\n (1.0 - pixelColor.r) * "+t+",\n (1.0 - pixelColor.g) * "+t+",\n (1.0 - pixelColor.b) * "+t+",\n pixelColor.a\n );\n ")},kodachrome:function(){return Ee(1.1285582396593525,-.3967382283601348,-.03992559172921793,0,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,0,0,0,1)},matrix:Ee,noise:function(){var t=Math.abs(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)),e=ye(-t);return de("\n float rnd = "+e+" + random( pixelColor.st ) * ("+ye(t)+" - "+e+");\n\n outColor = vec4(pixelColor.rgb + rnd, 1.0);\n ")},opacity:function(){return de("\n outColor = vec4(pixelColor.rgb, pixelColor.a * "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+");\n ")},polaroid:function(){return Ee(1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1)},saturation:function(){var t=1-Math.abs(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0));return Ee(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,t)},sepia:function(){var t=ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return Ee(.393+.607*(1-(t=1<t?1:t)),.769-.769*(1-t),.189-.189*(1-t),0,.349-.349*(1-t),.686+.314*(1-t),.168-.168*(1-t),0,.272-.272*(1-t),.534-.534*(1-t),.131+.869*(1-t),0,0,0,0,1)},shade:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return de("\n outColor = vec4(\n pixelColor.r * "+ye(ce(t)/255)+",\n pixelColor.g * "+ye(ce(e)/255)+",\n pixelColor.b * "+ye(ce(n)/255)+",\n pixelColor.a\n );\n ")},shift:function(){return Ee(1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1)},solarize:function(t,e,n){return de("\n outColor = vec4(\n (pixelColor.r < "+ye(ce(t))+") ? 1.0 - pixelColor.r: pixelColor.r,\n (pixelColor.g < "+ye(ce(e))+") ? 1.0 - pixelColor.g: pixelColor.g,\n (pixelColor.b < "+ye(ce(n))+") ? 1.0 - pixelColor.b: pixelColor.b,\n pixelColor.a\n );\n ")},technicolor:function(){return Ee(1.9125277891456083,-.8545344976951645,-.09155508482755585,0,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-.231103377548616,-.7501899197440212,1.847597816108189,0,0,0,0,1)},threshold:function(){return Ae(0<arguments.length&&void 0!==arguments[0]?arguments[0]:200,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,!1)},"threshold-color":Ae,tint:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return de("\n outColor = vec4(\n pixelColor.r += (1 - pixelColor.r) * "+ce(t)+",\n pixelColor.g += (1 - pixelColor.g) * "+ce(e)+",\n pixelColor.b += (1 - pixelColor.b) * "+ce(n)+",\n pixelColor.a\n );\n ")}},{kirsch:function(){return ve("kirsch-horizontal kirsch-vertical")},sobel:function(){return ve("sobel-horizontal sobel-vertical")},vintage:function(){return ve("brightness(0.15) saturation(-0.2) gamma(1.8)")}}),Pe=0;function De(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{width:"400px",height:"300px"};d(this,De),this.img=t.img,this.width=parseFloat(this.img.width||t.width||"400px"),this.height=parseFloat(this.img.height||t.height||"300px"),this.init()}var Be={GLCanvas:(y(De,[{key:"resize",value:function(){this.canvas.width=this.width,this.canvas.height=this.height,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.viewport()}},{key:"clear",value:function(){var t=this.gl;t.clearColor(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,3<arguments.length&&void 0!==arguments[3]?arguments[3]:0),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}},{key:"viewport",value:function(t,e,n,r){var i=this.gl;i.viewport(t||0,e||0,n||i.canvas.width,r||i.canvas.height)}},{key:"initCanvas",value:function(t,e){if(this.canvas=document.createElement("canvas"),this.gl=this.canvas.getContext("webgl2"),!this.gl)throw new Error("you need webgl2 support");this.program=this.createProgram(t,e),this.resize(),this.initBuffer()}},{key:"draw",value:function(){var t=this.gl;t.drawArrays(t[0<arguments.length&&void 0!==arguments[0]?arguments[0]:"TRIANGLES"],1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:6)}},{key:"triangles",value:function(){this.draw("TRIANGLES",0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:6)}},{key:"uniform2f",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.shift();(t=this.gl).uniform2f.apply(t,[this.locations[i]].concat(n))}},{key:"uniform1f",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.shift();(t=this.gl).uniform1f.apply(t,[this.locations[i]].concat(n))}},{key:"uniform1fv",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.shift();(t=this.gl).uniform1fv.apply(t,[this.locations[i]].concat(n))}},{key:"uniform1i",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.shift();(t=this.gl).uniform1i.apply(t,[this.locations[i]].concat(n))}},{key:"useProgram",value:function(){this.gl.useProgram(this.program)}},{key:"bindBuffer",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"STATIC_DRAW",r=this.gl;this.buffers[t]||(this.buffers[t]=r.createBuffer()),r.bindBuffer(r.ARRAY_BUFFER,this.buffers[t]),e&&r.bufferData(r.ARRAY_BUFFER,new Float32Array(e),r[n])}},{key:"enable",value:function(t){this.gl.enableVertexAttribArray(this.locations[t])}},{key:"location",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"attribute";"attribute"===e?this.locations[t]=this.gl.getAttribLocation(this.program,t):"uniform"===e&&(this.locations[t]=this.gl.getUniformLocation(this.program,t))}},{key:"a",value:function(t){return this.location(t)}},{key:"u",value:function(t){return this.location(t,"uniform")}},{key:"pointer",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"FLOAT",n=this.gl;n.vertexAttribPointer(this.locations[t],2<arguments.length&&void 0!==arguments[2]?arguments[2]:2,n[e],3<arguments.length&&void 0!==arguments[3]&&arguments[3],4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,5<arguments.length&&void 0!==arguments[5]?arguments[5]:0)}},{key:"bufferData",value:function(){var t=this.gl;t.bufferData(t.ARRAY_BUFFER,new Float32Array(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]),t.STATIC_DRAW)}},{key:"isPowerOf2",value:function(t){return 0==(t&t-1)}},{key:"bindTexture",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"RGBA",i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"RGBA",o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:"UNSIGNED_BYTE",a=this.gl;1!=arguments.length?(this.textures[t]||(this.textures[t]=a.createTexture()),this.textureIndex[t]=Pe++,a.bindTexture(a.TEXTURE_2D,this.textures[t]),this.setTextureParameter(),a.texImage2D(a.TEXTURE_2D,n,a[r],a[i],a[o],e.newImage||e)):a.bindTexture(a.TEXTURE_2D,this.textures[t])}},{key:"bindColorTexture",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:256,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:"RGBA",a=6<arguments.length&&void 0!==arguments[6]?arguments[6]:"RGBA",l=7<arguments.length&&void 0!==arguments[7]?arguments[7]:"UNSIGNED_BYTE",s=this.gl;this.textures[t]||(this.textures[t]=s.createTexture()),this.textureIndex[t]=Pe++,s.bindTexture(s.TEXTURE_2D,this.textures[t]),this.setTextureParameter(),s.texImage2D(s.TEXTURE_2D,i,s[o],n,r,0,s[a],s[l],new Uint8Array(e))}},{key:"bindEmptyTexture",value:function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"RGBA",o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:"RGBA",a=6<arguments.length&&void 0!==arguments[6]?arguments[6]:"UNSIGNED_BYTE",l=this.gl;this.textures[t]||(this.textures[t]=l.createTexture()),this.textureIndex[t]=Pe++,l.bindTexture(l.TEXTURE_2D,this.textures[t]),this.setTextureParameter();l.texImage2D(l.TEXTURE_2D,r,l[i],e,n,0,l[o],l[a],null)}},{key:"setTextureParameter",value:function(){var t=this.gl;t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)}},{key:"bindFrameBufferWithTexture",value:function(t,e,n,r){this.bindEmptyTexture(e,n,r),this.bindFrameBuffer(t,e)}},{key:"enumToString",value:function(t){var e,n=this.gl;if(0===t)return"NONE";for(e in n)if(n[e]===t)return e;return"0x"+t.toString(16)}},{key:"bindFrameBuffer",value:function(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=this.gl;1!==arguments.length?(this.framebuffers[t]||(this.framebuffers[t]=r.createFramebuffer()),r.bindFramebuffer(r.FRAMEBUFFER,this.framebuffers[t]),e=r.COLOR_ATTACHMENT0,r.framebufferTexture2D(r.FRAMEBUFFER,e,r.TEXTURE_2D,this.textures[n],0),r.checkFramebufferStatus(r.FRAMEBUFFER),r.FRAMEBUFFER_COMPLETE):r.bindFramebuffer(r.FRAMEBUFFER,null==t?null:this.framebuffers[t])}},{key:"bindVA",value:function(){var t=this.gl;this.vao||(this.vao=t.createVertexArray()),t.bindVertexArray(this.vao)}},{key:"bindAttr",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"STATIC_DRAW",r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2;this.bindBuffer(t,e,n),this.enable(t),this.pointer(t,"FLOAT",r)}},{key:"initBuffer",value:function(){var t=this.canvas,e=t.width,t=t.height;this.a("a_position"),this.a("a_texCoord"),this.u("u_resolution"),this.u("u_image"),this.u("u_flipY"),this.u("u_kernelSelect"),this.u("u_filterIndex"),this.u("u_kernel9[0]"),this.u("u_kernel9Weight"),this.u("u_kernel25[0]"),this.u("u_kernel25Weight"),this.u("u_kernel49[0]"),this.u("u_kernel49Weight"),this.u("u_kernel81[0]"),this.u("u_kernel81Weight"),this.bindVA(),this.bindAttr("a_position",[0,0,e,0,0,t,0,t,e,0,e,t],"STATIC_DRAW",2),this.bindAttr("a_texCoord",[0,0,1,0,0,1,0,1,1,0,1,1],"STATIC_DRAW",2),this.bindTexture("u_image",this.img),this.bindFrameBufferWithTexture("frame_buffer_0","img_texture_0",e,t),this.bindFrameBufferWithTexture("frame_buffer_1","img_texture_1",e,t)}},{key:"activeTexture",value:function(){var t=this.gl;t.activeTexture(t.TEXTURE0+(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0))}},{key:"drawFilter",value:function(){var n=this,t=this.gl;this.resize(),this.clear(),this.useProgram(),this.bindVA(),this.activeTexture(0),this.bindTexture("u_image"),this.uniform1i("u_image",0),this.uniform1f("u_flipY",1);var t=t.canvas,r=t.width,i=t.height;this.eachFilter(function(t,e){n.bindFrameBuffer("frame_buffer_"+e%2),n.uniform2f("u_resolution",r,i),n.viewport(0,0,r,i),n.effectFilter(t),n.bindTexture("img_texture_"+e%2)}),this.uniform1f("u_flipY",-1),this.bindFrameBuffer(null),this.uniform2f("u_resolution",r,i),this.viewport(0,0,r,i),this.clear(),this.effectFilter("normal")}},{key:"effectFilter",value:function(t){"convolution"==(t="string"==typeof t?(Ie[t]||Ie.normal).call(Ie):t).type?(this.uniform1f("u_kernelSelect",t.length),this.uniform1f("u_filterIndex",-1),this.uniform1fv("u_kernel"+t.length+"[0]",t.content),this.uniform1f("u_kernel"+t.length+"Weight",this.computeKernelWeight(t.content))):(this.uniform1f("u_kernelSelect",-1),this.uniform1f("u_filterIndex",t.index)),this.triangles(0,6)}},{key:"computeKernelWeight",value:function(t){t=t.reduce(function(t,e){return t+e});return t<=0?1:t}},{key:"createProgram",value:function(t,e){var n=this.gl,r=n.createProgram();if(this.vertexShader=this.createVertexShader(t),this.fragmentShader=this.createFragmentShader(e),n.attachShader(r,this.vertexShader),n.attachShader(r,this.fragmentShader),n.linkProgram(r),n.getProgramParameter(r,n.LINK_STATUS))return r;console.error(n.getProgramInfoLog(r)),n.deleteProgram(r)}},{key:"createShader",value:function(t,e){var n=this.gl,t=n.createShader(t);if(n.shaderSource(t,e),n.compileShader(t),n.getShaderParameter(t,n.COMPILE_STATUS))return t;console.error(n.getShaderInfoLog(t)),n.deleteShader(t)}},{key:"createVertexShader",value:function(t){var e=this.gl;return this.createShader(e.VERTEX_SHADER,t)}},{key:"createFragmentShader",value:function(t){var e=this.gl;return this.createShader(e.FRAGMENT_SHADER,t)}},{key:"eachFilter",value:function(t){this.filterList.forEach(t)}},{key:"init",value:function(){this.locations={},this.buffers={},this.framebuffers={},this.textures={},this.textureIndex={},this.hasTexParameter={}}},{key:"destroy",value:function(){var t=this.gl;this.init(),t.deleteProgram(this.program)}},{key:"filter",value:function(t,e){var n,r;this.filterList=t,this.initCanvas("#version 300 es \n\n in vec2 a_position;\n in vec2 a_texCoord; \n\n uniform vec2 u_resolution;\n uniform float u_flipY;\n\n out vec2 v_texCoord; \n\n void main() {\n vec2 zeroToOne = a_position / u_resolution;\n\n vec2 zeroToTwo = zeroToOne * 2.0;\n\n vec2 clipSpace = zeroToTwo - 1.0;\n\n gl_Position = vec4(clipSpace * vec2(1, u_flipY), 0, 1);\n\n v_texCoord = a_texCoord;\n\n }\n ",(n=this.filterList,t=n.filter(function(t){return"shader"==t.type}).map(function(t){return t.content}).join("\n\n"),r={9:!0},n.filter(function(t){return"convolution"==t.type}).forEach(function(t){r[t.length]=!0}),"#version 300 es\n\n precision highp int;\n precision mediump float;\n \n uniform sampler2D u_image;\n\n // 3 is 3x3 matrix kernel \n uniform float u_kernelSelect;\n uniform float u_filterIndex;\n\n uniform float u_kernel9[9];\n uniform float u_kernel9Weight;\n uniform float u_kernel25[25];\n uniform float u_kernel25Weight;\n uniform float u_kernel49[49];\n uniform float u_kernel49Weight;\n uniform float u_kernel81[81];\n uniform float u_kernel81Weight; \n\n in vec2 v_texCoord;\n \n out vec4 outColor;\n\n float random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n } \n\n // \n vec3 rgb2hsv(vec3 c)\n {\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\n vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\n\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n }\n\n vec3 hsv2rgb(vec3 c)\n {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n }\n \n void main() {\n vec4 pixelColor = texture(u_image, v_texCoord);\n vec2 onePixel = vec2(1) / vec2(textureSize(u_image, 0)); \n\n "+t+"\n\n "+Object.keys(r).map(function(t){return pe(+t)}).join("\n")+"\n\n }")),this.drawFilter(),"function"==typeof e&&e(this)}}]),De)},Re={filter:function(t,e,n,r){var i=new Be.GLCanvas({width:r.width||t.width,height:r.height||t.height,img:t});i.filter(function n(t){var e=[];"string"==typeof t?e=ne(t):Array.isArray(t)&&(e=t);var r=[];e.forEach(function(t){var e=t.arr[0];Ie[e]&&("convolution"==(t=Ue(t)).type||"shader"==t.type?r.push(t):t.forEach(function(t){r=r.concat(n(t))}))});return r}(e),function(){"function"==typeof n&&n(i)})}};function Ue(t){var e=t.arr[0],e=Ie[e],t=t.arr;return t.shift(),e.apply(this,t)}var Fe=_({},Be,Re);function je(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{frameTimer:"full"},i=new ft(t);i.loadImage(function(){i.toArray(e,function(t){"function"==typeof n&&n(t)},r)})}var He=_({},t,e,it,B,J,z,N,Z,m,q,{palette:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:6,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"hex";return(t=t.length>e?ut(t,e):t).map(function(t){return h(t,n)})},ImageToCanvas:function(t,e,n){je(t,e,n,Object.assign({returnTo:"canvas"},3<arguments.length&&void 0!==arguments[3]?arguments[3]:{frameTimer:"full"}))},ImageToHistogram:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{width:200,height:100},r=new ft(t);r.loadImage(function(){ht.createHistogram(n.width||200,n.height||100,r.toHistogram(n),function(t){"function"==typeof e&&e(t.toDataURL("image/png"))},n)})},ImageToRGB:function(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];r?(e=new ft(t,n)).loadImage(function(){"function"==typeof r&&r(e.toRGB())}):(e=new ft(t)).loadImage(function(){"function"==typeof n&&n(e.toRGB())})},ImageToURL:je,GLToCanvas:function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},i=new ft(t);i.load(function(){Fe.filter(i.newImage,e,function(t){"function"==typeof n&&n(t)},r)})},histogram:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=new ft(t);r.loadImage(function(){"function"==typeof e&&e(r.toHistogram(n))})},histogramToPoints:function(t){for(var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.2,n=[],r=0;r<t.length;r++){var i,o,a,l=t[r];0!=r?r!=t.length-1?(a=t[r-1],(o=t[r+1])[1],a[1],o[0],a[0],i=[a[0]+(o[0]-a[0])*e,a[1]+(o[1]-a[1])*e],i=[[].concat(O(a)),[].concat(i)],a=Math.sqrt(Math.pow(l[0]-a[0],2)+Math.pow(l[1]-a[1],2))/Math.sqrt(Math.pow(o[0]-l[0],2)+Math.pow(o[1]-l[1],2)),o=i[0][0]+(i[1][0]-i[0][0])*a,a=i[0][1]+(i[1][1]-i[0][1])*a,i[0][0]+=l[0]-o,i[0][1]+=l[1]-a,i[1][0]+=l[0]-o,i[1][1]+=l[1]-a,n[r]=i):n[r]=[]:n[r]=[]}return n}}),Le=[{rgb:"#ff0000",start:0},{rgb:"#ffff00",start:.17},{rgb:"#00ff00",start:.33},{rgb:"#00ffff",start:.5},{rgb:"#0000ff",start:.67},{rgb:"#ff00ff",start:.83},{rgb:"#ff0000",start:1}];!function(){for(var t=0,e=Le.length;t<e;t++){var n=Le[t],r=He.parse(n.rgb);n.r=r.r,n.g=r.g,n.b=r.b}}();var Ve={colors:Le,checkHueColor:function(t){for(var e,n,r=0;r<Le.length;r++)if(Le[r].start>=t){e=Le[r-1],n=Le[r];break}return e&&n?He.interpolateRGB(e,n,(t-e.start)/(n.start-e.start)):Le[0].rgb}},Z=_({},Dt,x),m={Color:He,HueColor:Ve,ColorNames:f,ImageFilter:Z,GL:Fe,Canvas:ht,ImageLoader:ft},ze=(He.color,0),Ne=[],Ge=(y(Xe,[{key:"attr",value:function(t,e){return 1==arguments.length?this.el.getAttribute(t):(this.el.setAttribute(t,e),this)}},{key:"closest",value:function(t){for(var e=this,n=!1;!(n=e.hasClass(t));){if(!e.el.parentNode)return null;e=new Xe(e.el.parentNode)}return n?e:null}},{key:"checked",value:function(){return this.el.checked}},{key:"removeClass",value:function(t){return this.el.className=(" "+this.el.className+" ").replace(" "+t+" "," ").trim(),this}},{key:"hasClass",value:function(t){return!!this.el.className&&-1<(" "+this.el.className+" ").indexOf(" "+t+" ")}},{key:"addClass",value:function(t){return this.hasClass(t)||(this.el.className=this.el.className+" "+t),this}},{key:"toggleClass",value:function(t){this.hasClass(t)?this.removeClass(t):this.addClass(t)}},{key:"html",value:function(e){try{"string"==typeof e?this.el.innerHTML=e:this.empty().append(e)}catch(t){console.log(e)}return this}},{key:"find",value:function(t){return this.el.querySelector(t)}},{key:"$",value:function(t){return new Xe(this.find(t))}},{key:"findAll",value:function(t){return this.el.querySelectorAll(t)}},{key:"$$",value:function(t){return[].concat(O(this.findAll(t))).map(function(t){return new Xe(t)})}},{key:"empty",value:function(){return this.html("")}},{key:"append",value:function(t){return"string"==typeof t?this.el.appendChild(document.createTextNode(t)):this.el.appendChild(t.el||t),this}},{key:"appendTo",value:function(t){return(t.el||t).appendChild(this.el),this}},{key:"remove",value:function(){return this.el.parentNode&&this.el.parentNode.removeChild(this.el),this}},{key:"text",value:function(){return this.el.textContent}},{key:"css",value:function(t,e){var n=this;if(2==arguments.length)this.el.style[t]=e;else if(1==arguments.length){if("string"==typeof t)return getComputedStyle(this.el)[t];var r=t||{};Object.keys(r).forEach(function(t){n.el.style[t]=r[t]})}return this}},{key:"cssFloat",value:function(t){return parseFloat(this.css(t))}},{key:"cssInt",value:function(t){return parseInt(this.css(t))}},{key:"offset",value:function(){var t=this.el.getBoundingClientRect();return{top:t.top+Xe.getScrollTop(),left:t.left+Xe.getScrollLeft()}}},{key:"rect",value:function(){return this.el.getBoundingClientRect()}},{key:"position",value:function(){return this.el.style.top?{top:parseFloat(this.css("top")),left:parseFloat(this.css("left"))}:this.el.getBoundingClientRect()}},{key:"size",value:function(){return[this.width(),this.height()]}},{key:"width",value:function(){return this.el.offsetWidth||this.el.getBoundingClientRect().width}},{key:"contentWidth",value:function(){return this.width()-this.cssFloat("padding-left")-this.cssFloat("padding-right")}},{key:"height",value:function(){return this.el.offsetHeight||this.el.getBoundingClientRect().height}},{key:"contentHeight",value:function(){return this.height()-this.cssFloat("padding-top")-this.cssFloat("padding-bottom")}},{key:"dataKey",value:function(t){return this.uniqId+"."+t}},{key:"data",value:function(t,e){if(2==arguments.length)return Ne[this.dataKey(t)]=e,this;if(1==arguments.length)return Ne[this.dataKey(t)];var t=Object.keys(Ne),n=this.uniqId+".";return t.filter(function(t){return 0==t.indexOf(n)}).map(function(t){return Ne[t]})}},{key:"val",value:function(t){return 0==arguments.length?this.el.value:(1==arguments.length&&(this.el.value=t),this)}},{key:"int",value:function(){return parseInt(this.val(),10)}},{key:"float",value:function(){return parseFloat(this.val())}},{key:"show",value:function(){return this.css("display","block")}},{key:"hide",value:function(){return this.css("display","none")}},{key:"toggle",value:function(){return"none"==this.css("display")?this.show():this.hide()}},{key:"scrollTop",value:function(){return this.el===document.body?Xe.getScrollTop():this.el.scrollTop}},{key:"scrollLeft",value:function(){return this.el===document.body?Xe.getScrollLeft():this.el.scrollLeft}},{key:"on",value:function(t,e,n,r){return this.el.addEventListener(t,e,n,r),this}},{key:"off",value:function(t,e){return this.el.removeEventListener(t,e),this}},{key:"getElement",value:function(){return this.el}},{key:"createChild",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},n=new Xe(t,e,n);return n.css(r),this.append(n),n}},{key:"firstChild",value:function(){return new Xe(this.el.firstElementChild)}},{key:"replace",value:function(t,e){return this.el.replaceChild(e,t),this}}],[{key:"getScrollTop",value:function(){return Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop)}},{key:"getScrollLeft",value:function(){return Math.max(window.pageXOffset,document.documentElement.scrollLeft,document.body.scrollLeft)}}]),Xe);function Xe(t,e,n){if(d(this,Xe),"string"!=typeof t)this.el=t;else{var r,i=document.createElement(t);for(r in this.uniqId=ze++,e&&(i.className=e),n=n||{})i.setAttribute(r,n[r]);this.el=i}}y(Ye,[{key:"initialize",value:function(){var e=this;this.filterProps().forEach(function(t){e.$store.action(t,e)})}},{key:"filterProps",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"/";return Object.getOwnPropertyNames(this.__proto__).filter(function(t){return t.startsWith(e)})}}]),q=Ye;function Ye(t){d(this,Ye),this.$store=t,this.initialize()}var We=(k(qe,q),y(qe,[{key:"initialize",value:function(){$(qe.prototype.__proto__||Object.getPrototypeOf(qe.prototype),"initialize",this).call(this),this.$store.colorSetsList=[{name:"Material",colors:["#F44336","#E91E63","#9C27B0","#673AB7","#3F51B5","#2196F3","#03A9F4","#00BCD4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548","#9E9E9E","#607D8B"]},{name:"Custom",edit:!0,colors:[]},{name:"Color Scale",scale:["red","yellow","black"],count:5}],this.$store.currentColorSets={}}},{key:"/list",value:function(t){return Array.isArray(t.userList)&&t.userList.length?t.userList:t.colorSetsList}},{key:"/setUserPalette",value:function(t,e){t.userList=e,t.dispatch("/resetUserPalette"),t.dispatch("/setCurrentColorSets")}},{key:"/resetUserPalette",value:function(r){r.userList&&r.userList.length&&(r.userList=r.userList.map(function(t,e){var n;return"function"==typeof t.colors&&(n=t.colors,t.colors=n(r),t._colors=n),Object.assign({name:"color-"+e,colors:[]},t)}),r.emit("changeUserList"))}},{key:"/setCurrentColorSets",value:function(t,e){var n=t.dispatch("/list");t.currentColorSets=void 0===e?n[0]:"number"==typeof e?n[e]:n.filter(function(t){return t.name==e})[0],t.emit("changeCurrentColorSets")}},{key:"/getCurrentColorSets",value:function(t){return t.currentColorSets}},{key:"/addCurrentColor",value:function(t,e){Array.isArray(t.currentColorSets.colors)&&(t.currentColorSets.colors.push(e),t.emit("changeCurrentColorSets"))}},{key:"/setCurrentColorAll",value:function(t){t.currentColorSets.colors=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],t.emit("changeCurrentColorSets")}},{key:"/removeCurrentColor",value:function(t,e){t.currentColorSets.colors[e]&&(t.currentColorSets.colors.splice(e,1),t.emit("changeCurrentColorSets"))}},{key:"/removeCurrentColorToTheRight",value:function(t,e){t.currentColorSets.colors[e]&&(t.currentColorSets.colors.splice(e,Number.MAX_VALUE),t.emit("changeCurrentColorSets"))}},{key:"/clearPalette",value:function(t){t.currentColorSets.colors&&(t.currentColorSets.colors=[],t.emit("changeCurrentColorSets"))}},{key:"/getCurrentColors",value:function(t){return t.dispatch("/getColors",t.currentColorSets)}},{key:"/getColors",value:function(t,e){return e.scale?He.scale(e.scale,e.count):e.colors||[]}},{key:"/getColorSetsList",value:function(e){return e.dispatch("/list").map(function(t){return{name:t.name,edit:t.edit,colors:e.dispatch("/getColors",t)}})}}]),qe);function qe(){return d(this,qe),C(this,(qe.__proto__||Object.getPrototypeOf(qe)).apply(this,arguments))}var Ke={addEvent:function(t,e,n,r){t&&t.addEventListener(e,n,r)},removeEvent:function(t,e,n){t&&t.removeEventListener(e,n)},pos:function(t){return t.touches&&t.touches[0]?t.touches[0]:t},posXY:function(t){t=this.pos(t);return{x:t.pageX,y:t.pageY}}},Ze=(y(Je,[{key:"set",value:function(t,e){this.settingObj[t]=e||(2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0)}},{key:"init",value:function(t){if(!this.has(t)){var e=t.split("."),n=this.masterObj.refs[e[0]]||this.masterObj[e[0]]||this.masterObj,e=e.pop();if(n[e]){for(var r=arguments.length,i=Array(1<r?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n=n[e].apply(n,i);this.set(t,n)}}}},{key:"get",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";return this.init(t,e),this.settingObj[t]||e}},{key:"has",value:function(t){return!!this.settingObj[t]}}]),Je);function Je(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};d(this,Je),this.masterObj=t,this.settingObj=e}var Qe=/^(click|mouse(down|up|move|enter|leave)|touch(start|move|end)|key(down|up|press)|contextmenu|change|input)/gi,tn=/^load (.*)/gi,en=["Control","Shift","Alt","Meta"],x=(y(nn,[{key:"newChildComponents",value:function(){var n=this;Object.keys(this.childComponents).forEach(function(t){var e=n.childComponents[t];n[t]=new e(n)})}},{key:"render",value:function(){this.$el=this.parseTemplate(this.template()),this.refs.$el=this.$el,this.parseTarget(),this.load(),this.afterRender()}},{key:"afterRender",value:function(){}},{key:"components",value:function(){return{}}},{key:"parseTemplate",value:function(t){var n=this,e=new Ge("div").html(t).firstChild(),t=e.findAll("[ref]");return[].concat(O(t)).forEach(function(t){var e=t.getAttribute("ref");n.refs[e]=new Ge(t)}),e}},{key:"parseTarget",value:function(){var r=this,t=this.$el.findAll("[target]");[].concat(O(t)).forEach(function(t){var e=t.getAttribute("target"),n=t.getAttribute("ref")||e,e=new r.childComponents[e](r);r[n]=e,r.refs[n]=e.$el,e&&(e.render(),new Ge(t.parentNode).replace(t,e.$el.el))})}},{key:"load",value:function(){var n=this;this.filterProps(tn).forEach(function(t){var e=t.split("load ")[1];n.refs[e]&&n.refs[e].html(n.parseTemplate(n[t].call(n)))})}},{key:"template",value:function(){return"<div></div>"}},{key:"initialize",value:function(){}},{key:"initializeEvent",value:function(){var e=this;this.initializeEventMachin(),Object.keys(this.childComponents).forEach(function(t){e[t]&&e[t].initializeEvent()})}},{key:"destroy",value:function(){var e=this;this.destroyEventMachin(),Object.keys(this.childComponents).forEach(function(t){e[t]&&e[t].destroy()})}},{key:"destroyEventMachin",value:function(){this.removeEventAll()}},{key:"initializeEventMachin",value:function(){this.filterProps(Qe).forEach(this.parseEvent.bind(this))}},{key:"collectProps",value:function(){if(!this.collapsedProps){for(var t=this.__proto__,e=[];e.push.apply(e,O(Object.getOwnPropertyNames(t))),t=t.__proto__;);this.collapsedProps=e}return this.collapsedProps}},{key:"filterProps",value:function(e){return this.collectProps().filter(function(t){return t.match(e)})}},{key:"parseEvent",value:function(t){var e=t.split(" ");this.bindingEvent(e,this[t].bind(this))}},{key:"getDefaultDomElement",value:function(t){var e=void 0;return(e=t?this.refs[t]||this[t]||window[t]:this.el||this.$el||this.$root)instanceof Ge?e.getElement():e}},{key:"getDefaultEventObject",value:function(t){var e=this,n=t.split("."),r=n.shift(),i=n.includes("Control"),o=n.includes("Shift"),a=n.includes("Alt"),t=n.includes("Meta"),l=(n=n.filter(function(t){return!1===en.includes(t)})).filter(function(t){return!!e[t]});return{eventName:r,isControl:i,isShift:o,isAlt:a,isMeta:t,codes:n=n.filter(function(t){return!1===l.includes(t)}).map(function(t){return t.toLowerCase()}),checkMethodList:l}}},{key:"bindingEvent",value:function(t,e){var n=(r=t,Array.isArray(r)?r:Array.from(r)),t=n[0],r=n[1],n=n.slice(2),r=this.getDefaultDomElement(r),t=this.getDefaultEventObject(t);t.dom=r,t.delegate=n.join(" "),this.addEvent(t,e)}},{key:"matchPath",value:function(t,e){return t?t.matches(e)?t:this.matchPath(t.parentElement,e):null}},{key:"getBindings",value:function(){return this._bindings||this.initBindings(),this._bindings}},{key:"addBinding",value:function(t){this.getBindings().push(t)}},{key:"initBindings",value:function(){this._bindings=[]}},{key:"checkEventType",value:function(e,t){var n=this,r=!t.isControl||e.ctrlKey,i=!t.isShift||e.shiftKey,o=!t.isAlt||e.altKey,a=!t.isMeta||e.metaKey,l=!0;t.codes.length&&(l=t.codes.includes(e.code.toLowerCase())||t.codes.includes(e.key.toLowerCase()));var s=!0;return t.checkMethodList.length&&(s=t.checkMethodList.every(function(t){return n[t].call(n,e)})),r&&o&&i&&a&&l&&s}},{key:"makeCallback",value:function(n,r){var i=this;return n.delegate?function(t){if(t.xy=Ke.posXY(t),i.checkEventType(t,n)){var e=i.matchPath(t.target||t.srcElement,n.delegate);if(e)return t.delegateTarget=e,t.$delegateTarget=new Ge(e),r(t)}}:function(t){if(t.xy=Ke.posXY(t),i.checkEventType(t,n))return r(t)}}},{key:"addEvent",value:function(t,e){t.callback=this.makeCallback(t,e),this.addBinding(t);e=!0;"touchstart"===t.eventName&&(e={passive:!0}),Ke.addEvent(t.dom,t.eventName,t.callback,e)}},{key:"removeEventAll",value:function(){var e=this;this.getBindings().forEach(function(t){e.removeEvent(t)}),this.initBindings()}},{key:"removeEvent",value:function(t){var e=t.eventName,n=t.dom,t=t.callback;Ke.removeEvent(n,e,t)}}]),nn);function nn(){d(this,nn),this.state=new Ze(this),this.refs={},this.childComponents=this.components()}var rn=/^@/,Z=(k(on,x),y(on,[{key:"initializeStoreEvent",value:function(){var n=this;this.storeEvents={},this.filterProps(rn).forEach(function(t){var e=t.split("@");e.shift();e=e.join("@");n.storeEvents[e]=n[t].bind(n),n.$store.on(e,n.storeEvents[e])})}},{key:"destoryStoreEvent",value:function(){var e=this;Object.keys(this.storeEvents).forEach(function(t){e.$store.off(t,e.storeEvents[t])})}}]),on);function on(t){d(this,on);var e=C(this,(on.__proto__||Object.getPrototypeOf(on)).call(this,t));return e.opt=t||{},t&&t.$store&&(e.$store=t.$store),e.initialize(),e.initializeStoreEvent(),e}var an=(k(ln,q),y(ln,[{key:"initialize",value:function(){$(ln.prototype.__proto__||Object.getPrototypeOf(ln.prototype),"initialize",this).call(this),this.$store.rgb={},this.$store.hsl={},this.$store.hsv={},this.$store.alpha=1,this.$store.format="hex"}},{key:"/changeFormat",value:function(t,e){t.format=e,t.emit("changeFormat")}},{key:"/initColor",value:function(t,e,n){t.dispatch("/changeColor",e,n,!0),t.emit("initColor")}},{key:"/changeColor",value:function(t,e,n,r){(e="string"==typeof(e=e||"#FF0000")?He.parse(e):e).source=e.source||n,t.alpha=void 0===(n=e.a)||null==n?t.alpha:e.a,t.format="hsv"!=e.type&&e.type||t.format,"hsl"==e.type?(t.hsl=Object.assign(t.hsl,e),t.rgb=He.HSLtoRGB(t.hsl),t.hsv=He.HSLtoHSV(e)):"hex"==e.type||"rgb"==e.type?(t.rgb=Object.assign(t.rgb,e),t.hsl=He.RGBtoHSL(t.rgb),t.hsv=He.RGBtoHSV(e)):"hsv"==e.type&&(t.hsv=Object.assign(t.hsv,e),t.rgb=He.HSVtoRGB(t.hsv),t.hsl=He.HSVtoHSL(t.hsv)),r||t.emit("changeColor",e.source)}},{key:"/getHueColor",value:function(t){return Ve.checkHueColor(t.hsv.h/360)}},{key:"/toString",value:function(t,e){var n=t[e=e||t.format]||t.rgb;return He.format(_({},n,{a:t.alpha}),e)}},{key:"/toColor",value:function(t,e){return"rgb"==(e=e||t.format)?t.dispatch("/toRGB"):"hsl"==e?t.dispatch("/toHSL"):"hex"==e?t.dispatch("/toHEX"):t.dispatch("/toString",e)}},{key:"/toRGB",value:function(t){return t.dispatch("/toString","rgb")}},{key:"/toHSL",value:function(t){return t.dispatch("/toString","hsl")}},{key:"/toHEX",value:function(t){return t.dispatch("/toString","hex").toUpperCase()}}]),ln);function ln(){return d(this,ln),C(this,(ln.__proto__||Object.getPrototypeOf(ln)).apply(this,arguments))}var sn=(y(un,[{key:"initialize",value:function(){this.initializeModule()}},{key:"initializeModule",value:function(){var e=this;this.modules.forEach(function(t){new t(e)})}},{key:"action",value:function(t,e){this.actions[t]={context:e,callback:e[t]}}},{key:"dispatch",value:function(t){var e=[].concat(Array.prototype.slice.call(arguments)),t=e.shift(),t=this.actions[t];if(t)return t.callback.apply(t.context,[this].concat(O(e)))}},{key:"module",value:function(t){}},{key:"on",value:function(t,e){this.callbacks.push({event:t,callback:e})}},{key:"off",value:function(e,n){0==arguments.length?this.callbacks=[]:1==arguments.length?this.callbacks=this.callbacks.filter(function(t){return t.event!=e}):2==arguments.length&&(this.callbacks=this.callbacks.filter(function(t){return t.event!=e&&t.callback!=n}))}},{key:"emit",value:function(){var e=[].concat(Array.prototype.slice.call(arguments)),n=e.shift();this.callbacks.filter(function(t){return t.event==n}).forEach(function(t){t&&"function"==typeof t.callback&&t.callback.apply(t,O(e))})}}]),un);function un(t){d(this,un),this.callbacks=[],this.actions=[],this.modules=t.modules||[],this.initialize()}k(cn,Z),y(cn,[{key:"initialize",value:function(){var t=this;this.$body=null,this.$root=null,this.$store=new sn({modules:[an,We]}),this.callbackChange=function(){t.callbackColorValue()},this.callbackLastUpdate=function(){t.callbackLastUpdateColorValue()},this.colorpickerShowCallback=function(){},this.colorpickerHideCallback=function(){},this.colorpickerLastUpdateCallback=function(){},this.$body=new Ge(this.getContainer()),this.$root=new Ge("div",this.opt.containerClass),"inline"==this.opt.position&&this.$body.append(this.$root),this.opt.type&&this.$root.addClass(this.opt.type),this.opt.hideInformation&&this.$root.addClass("hide-information"),this.opt.hideColorsets&&this.$root.addClass("hide-colorsets"),this.$arrow=new Ge("div","arrow"),this.$root.append(this.$arrow),this.$store.dispatch("/setUserPalette",this.opt.colorSets),this.render(),this.$root.append(this.$el),this.initColorWithoutChangeEvent(this.opt.color),this.initializeEvent()}},{key:"initColorWithoutChangeEvent",value:function(t){this.$store.dispatch("/initColor",t)}},{key:"show",value:function(t,e,n,r,i){this.colorpickerShowCallback=n,this.colorpickerHideCallback=r,this.colorpickerLastUpdateCallback=i,this.$root.css(this.getInitalizePosition()).show(),this.isColorPickerShow=!0,this.isShortCut=t.isShortCut||!1,this.outputFormat=t.outputFormat,this.hideDelay=+(void 0===t.hideDelay?2e3:t.hideDelay),0<this.hideDelay&&this.setHideDelay(this.hideDelay),this.$root.appendTo(this.$body),this.definePosition(t),this.initColorWithoutChangeEvent(e)}},{key:"initColor",value:function(t,e){this.$store.dispatch("/changeColor",t,e)}},{key:"hide",value:function(){this.isColorPickerShow&&(this.$root.hide(),this.$root.remove(),this.isColorPickerShow=!1,this.callbackHideColorValue())}},{key:"setColorsInPalette",value:function(){this.$store.dispatch("/setCurrentColorAll",0<arguments.length&&void 0!==arguments[0]?arguments[0]:[])}},{key:"setUserPalette",value:function(){this.$store.dispatch("/setUserPalette",0<arguments.length&&void 0!==arguments[0]?arguments[0]:[])}},{key:"getOption",value:function(t){return this.opt[t]}},{key:"setOption",value:function(t,e){this.opt[t]=e}},{key:"isType",value:function(t){return this.getOption("type")==t}},{key:"isPaletteType",value:function(){return this.isType("palette")}},{key:"isSketchType",value:function(){return this.isType("sketch")}},{key:"getContainer",value:function(){return this.opt.container||document.body}},{key:"getColor",value:function(t){return this.$store.dispatch("/toColor",t)}},{key:"definePositionForArrow",value:function(t,e,n){}},{key:"definePosition",value:function(t){var e=this.$root.width(),n=this.$root.height(),r=t.left-this.$body.scrollLeft();e+r>window.innerWidth&&(r-=e+r-window.innerWidth),r<0&&(r=0);e=t.top-this.$body.scrollTop(),t=t.bottom-this.$body.scrollTop(),e=n/2+t>window.innerHeight?e-n+this.$body.scrollTop():t+this.$body.scrollTop()+1;this.$root.css({left:r+"px",top:(e=e<0?0:e)+"px"})}},{key:"getInitalizePosition",value:function(){return"inline"==this.opt.position?{position:"relative",left:"auto",top:"auto",display:"inline-block"}:{position:"absolute",left:"-10000px",top:"-10000px"}}},{key:"isAbsolute",value:function(){return"inline"!==this.opt.position}},{key:"mouseup.isAbsolute document",value:function(t){this.__isMouseDown=!1,this.checkInHtml(t.target)||(0==this.checkColorPickerClass(t.target)?this.hide():this.__isMouseIn||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay)))}},{key:"keyup.isAbsolute.escape $root",value:function(t){this.hide()}},{key:"mouseover.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mousemove.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mouseenter.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker),this.__isMouseIn=!0}},{key:"mouseleave.isAbsolute $root",value:function(t){this.__isMouseIn=!1,this.__isMouseDown||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay))}},{key:"mousedown.isAbsolute $root",value:function(t){this.__isMouseDown=!0}},{key:"setHideDelay",value:function(t){this.delayTime=t||0}},{key:"runHideDelay",value:function(){this.isColorPickerShow&&this.setHideDelay()}},{key:"callbackColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onChange&&this.opt.onChange.call(this,t),"function"==typeof this.colorpickerShowCallback&&this.colorpickerShowCallback(t)}},{key:"callbackLastUpdateColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onLastUpdate&&this.opt.onLastUpdate.call(this,t),"function"==typeof this.colorpickerLastUpdateCallback&&this.colorpickerLastUpdateCallback(t)}},{key:"callbackHideColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onHide&&this.opt.onHide.call(this,t),"function"==typeof this.colorpickerHideCallback&&this.colorpickerHideCallback(t)}},{key:"getCurrentColor",value:function(){return this.$store.dispatch("/toColor",this.outputFormat)}},{key:"checkColorPickerClass",value:function(t){var e=new Ge(t).closest("ace-colorview");return!(!new Ge(t).closest("ace-colorpicker")&&!e)}},{key:"checkInHtml",value:function(t){return"HTML"==t.nodeName}},{key:"initializeStoreEvent",value:function(){$(cn.prototype.__proto__||Object.getPrototypeOf(cn.prototype),"initializeStoreEvent",this).call(this),this.$store.on("changeColor",this.callbackChange),this.$store.on("lastUpdateColor",this.callbackLastUpdate),this.$store.on("changeFormat",this.callbackChange)}},{key:"destroy",value:function(){$(cn.prototype.__proto__||Object.getPrototypeOf(cn.prototype),"destroy",this).call(this),this.$store.off("changeColor",this.callbackChange),this.$store.off("lastUpdateColor",this.callbackLastUpdate),this.$store.off("changeFormat",this.callbackChange),this.callbackChange=void 0,this.callbackLastUpdate=void 0,this.colorpickerShowCallback=void 0,this.colorpickerHideCallback=void 0}}]),x=cn;function cn(t){d(this,cn);t=C(this,(cn.__proto__||Object.getPrototypeOf(cn)).call(this,t));return t.isColorPickerShow=!1,t.isShortCut=!1,t.hideDelay=+(void 0===t.opt.hideDeplay?2e3:t.opt.hideDelay),t.timerCloseColorPicker,t.autoHide=t.opt.autoHide||!0,t.outputFormat=t.opt.outputFormat,t.$checkColorPickerClass=t.checkColorPickerClass.bind(t),t}k(hn,Z),y(hn,[{key:"refresh",value:function(){}},{key:"refreshColorUI",value:function(t){}},{key:"changeColor",value:function(t){this.$store.dispatch("/changeColor",Object.assign({source:this.source},t||{}))}},{key:"mouseup document",value:function(t){this.onDragEnd(t)}},{key:"mousemove document",value:function(t){this.onDragMove(t)}},{key:"mousedown $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"mousedown $container",value:function(t){this.isDown=!0,this.onDragStart(t)}},{key:"touchend document",value:function(t){this.onDragEnd(t)}},{key:"touchmove document",value:function(t){this.onDragMove(t)}},{key:"touchstart $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"touchstart $container",value:function(t){this.onDragStart(t)}},{key:"onDragStart",value:function(t){this.isDown=!0,this.refreshColorUI(t)}},{key:"onDragMove",value:function(t){this.isDown&&this.refreshColorUI(t)}},{key:"onDragEnd",value:function(t){this.isDown&&(this.$store.emit("lastUpdateColor"),this.isDown=!1)}},{key:"@changeColor",value:function(t){this.source!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),q=hn;function hn(t){d(this,hn);t=C(this,(hn.__proto__||Object.getPrototypeOf(hn)).call(this,t));return t.source="base-box",t}k(fn,q),y(fn,[{key:"getMinMaxPosition",value:function(){var t=this.getMinPosition(),e=this.getMaxDist();return{min:t,max:t+e,width:e}}},{key:"getCurrent",value:function(t){return min+this.getMaxDist()*t}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().left}},{key:"getMaxDist",value:function(){return this.state.get("$container.width")}},{key:"getDist",value:function(t){var e=this.getMinMaxPosition(),n=e.min,e=e.max,n=t<n?0:e<t?100:(t-n)/(e-n)*100;return n}},{key:"getCaculatedDist",value:function(t){t=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.maxValue);return this.getDist(t)}},{key:"getDefaultValue",value:function(){return 0}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({left:t+"px"})}},{key:"getMousePosition",value:function(t){return Ke.pos(t).pageX}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.minValue?this.refs.$bar.addClass("first").removeClass("last"):(t>=this.maxValue?this.refs.$bar.addClass("last"):this.refs.$bar.removeClass("last")).removeClass("first"),this.setMousePosition(this.getMaxDist()*((t||0)/this.maxValue))}}]),q=fn;function fn(t){d(this,fn);t=C(this,(fn.__proto__||Object.getPrototypeOf(fn)).call(this,t));return t.minValue=0,t.maxValue=1,t.source="base-slider",t}var vn=(k(gn,q),y(gn,[{key:"template",value:function(){return'\n <div class="value">\n <div ref="$container" class="value-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$container.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){$(gn.prototype.__proto__||Object.getPrototypeOf(gn.prototype),"refresh",this).call(this),this.setBackgroundColor()}},{key:"getDefaultValue",value:function(){return this.$store.hsv.v}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({type:"hsv",v:t/100*this.maxValue})}}]),gn);function gn(t){d(this,gn);t=C(this,(gn.__proto__||Object.getPrototypeOf(gn)).call(this,t));return t.minValue=0,t.maxValue=1,t.source="value-control",t}var dn=(k(pn,q),y(pn,[{key:"template",value:function(){return'\n <div class="opacity">\n <div ref="$container" class="opacity-container">\n <div ref="$colorbar" class="color-bar"></div>\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){$(pn.prototype.__proto__||Object.getPrototypeOf(pn.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=He.format(t,"rgb");t.a=1;t=He.format(t,"rgb");this.setOpacityColorBarBackground(e,t)}},{key:"setOpacityColorBarBackground",value:function(t,e){this.refs.$colorbar.css("background","linear-gradient(to right, "+t+", "+e+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({a:Math.floor(t)/100*this.maxValue})}}]),pn);function pn(t){d(this,pn);t=C(this,(pn.__proto__||Object.getPrototypeOf(pn)).call(this,t));return t.minValue=0,t.maxValue=1,t.source="opacity-control",t}var mn=(k(yn,Z),y(yn,[{key:"components",value:function(){return{Value:vn,Opacity:dn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Value" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),yn);function yn(){return d(this,yn),C(this,(yn.__proto__||Object.getPrototypeOf(yn)).apply(this,arguments))}var bn=(k($n,Z),y($n,[{key:"template",value:function(){return'\n <div class="wheel">\n <canvas class="wheel-canvas" ref="$colorwheel" ></canvas>\n <div class="wheel-canvas" ref="$valuewheel" ></div>\n <div class="drag-pointer" ref="$drag_pointer"></div>\n </div>\n '}},{key:"refresh",value:function(t){this.setColorUI(t)}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.renderValue(),this.setHueColor(null,t)}},{key:"renderValue",value:function(){var t=1-this.$store.hsv.v;this.refs.$valuewheel.css({"background-color":"rgba(0, 0, 0, "+t+")"})}},{key:"renderWheel",value:function(t,e){this.width&&!t&&(t=this.width),this.height&&!e&&(e=this.height);var n=new Ge("canvas"),r=n.el.getContext("2d");n.el.width=t,n.el.height=e,n.css({width:t+"px",height:e+"px"});for(var i=r.getImageData(0,0,t,e),o=i.data,a=Math.floor(t/2),l=Math.floor(e/2),s=e<t?l:a,u=a,c=l,h=0;h<e;h++)for(var f=0;f<t;f++){var v=f-u+1,g=h-c+1,d=v*v+g*g,g=p(v,g),g=He.HSVtoRGB(g,Math.min(Math.sqrt(d)/s,1),1),d=4*(h*t+f);o[d]=g.r,o[1+d]=g.g,o[2+d]=g.b,o[3+d]=255}return r.putImageData(i,0,0),0<this.thinkness&&(r.globalCompositeOperation="destination-out",r.fillStyle="black",r.beginPath(),r.arc(u,c,s-this.thinkness,0,2*Math.PI),r.closePath(),r.fill()),n}},{key:"renderCanvas",value:function(){var t,e,n,r;this.$store.createdWheelCanvas||(e=(t=this.refs.$colorwheel).el.getContext("2d"),n=t.size(),n=(r=w(n,2))[0],r=r[1],this.width&&!n&&(n=this.width),this.height&&!r&&(r=this.height),t.el.width=n,t.el.height=r,t.css({width:n+"px",height:r+"px"}),r=this.renderWheel(n,r),e.drawImage(r.el,0,0),this.$store.createdWheelCanvas=!0)}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"getDefaultSaturation",value:function(){return this.$store.hsv.s}},{key:"getCurrentXY",value:function(t,e,n,r,i){return t?Ke.posXY(t):function(t,e,n,r){return n=2<arguments.length&&void 0!==n?n:0,r=3<arguments.length&&void 0!==r?r:0,{x:l(t,e,n),y:s(t,e,r)}}(e,n,r,i)}},{key:"getRectangle",value:function(){var t=this.state.get("$el.width"),e=this.state.get("$el.height"),n=this.state.get("$colorwheel.width")/2,r=this.refs.$el.offset().left,i=r+t/2,o=this.refs.$el.offset().top;return{minX:r,minY:o,width:t,height:e,radius:n,centerX:i,centerY:o+e/2}}},{key:"setHueColor",value:function(t,e){var n,r,i,o,a,l,s,u,c;this.state.get("$el.width")&&(n=(u=this.getRectangle()).minX,r=u.minY,c=u.radius,i=u.centerX,l=u.centerY,a=(o=(s=(a=this.getCurrentXY(t,this.getDefaultValue(),this.getDefaultSaturation()*c,i,l)).x)-i)*o+(t=(u=a.y)-l)*t,t=p(o,t),c*c<a&&(s=(l=this.getCurrentXY(null,t,c,i,l)).x,u=l.y),c=Math.min(Math.sqrt(a)/c,1),this.refs.$drag_pointer.css({left:s-n+"px",top:u-r+"px"}),e||this.changeColor({type:"hsv",h:t,s:c}))}},{key:"changeColor",value:function(t){this.$store.dispatch("/changeColor",Object.assign({source:this.source},t||{}))}},{key:"@changeColor",value:function(t){this.source!=t&&this.refresh(!0)}},{key:"@initColor",value:function(){this.refresh(!0)}},{key:"mouseup document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"mousemove document",value:function(t){this.isDown&&this.setHueColor(t)}},{key:"mousedown $drag_pointer",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"mousedown $el",value:function(t){this.isDown=!0,this.setHueColor(t)}},{key:"touchend document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"touchmove document",value:function(t){this.isDown&&this.setHueColor(t)}},{key:"touchstart $drag_pointer",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"touchstart $el",value:function(t){t.preventDefault(),this.isDown=!0,this.setHueColor(t)}}]),$n);function $n(t){d(this,$n);t=C(this,($n.__proto__||Object.getPrototypeOf($n)).call(this,t));return t.width=214,t.height=214,t.thinkness=0,t.half_thinkness=0,t.source="colorwheel",t}var kn="chromedevtool-information",Cn=(k(xn,Z),y(xn,[{key:"template",value:function(){return'\n <div class="information hex">\n <div ref="$informationChange" class="information-change">\n <button ref="$formatChangeButton" type="button" class="format-change-button arrow-button"></button>\n </div>\n <div class="information-item hex">\n <div class="input-field hex">\n <input ref="$hexCode" class="input" type="text" />\n <div class="title">HEX</div>\n </div>\n </div>\n <div class="information-item rgb">\n <div class="input-field rgb-r">\n <input ref="$rgb_r" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">R</div>\n </div>\n <div class="input-field rgb-g">\n <input ref="$rgb_g" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">G</div>\n </div>\n <div class="input-field rgb-b">\n <input ref="$rgb_b" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">B</div>\n </div> \n <div class="input-field rgb-a">\n <input ref="$rgb_a" class="input" type="number" step="0.01" min="0" max="1" />\n <div class="title">A</div>\n </div> \n </div>\n <div class="information-item hsl">\n <div class="input-field hsl-h">\n <input ref="$hsl_h" class="input" type="number" step="1" min="0" max="360" />\n <div class="title">H</div>\n </div>\n <div class="input-field hsl-s">\n <input ref="$hsl_s" class="input" type="number" step="1" min="0" max="100" />\n <div class="postfix">%</div>\n <div class="title">S</div>\n </div>\n <div class="input-field hsl-l">\n <input ref="$hsl_l" class="input" type="number" step="1" min="0" max="100" />\n <div class="postfix">%</div> \n <div class="title">L</div>\n </div>\n <div class="input-field hsl-a">\n <input ref="$hsl_a" class="input" type="number" step="0.01" min="0" max="1" />\n <div class="title">A</div>\n </div>\n </div>\n </div>\n '}},{key:"setCurrentFormat",value:function(t){this.format=t,this.initFormat()}},{key:"initFormat",value:function(){var e=this,n=this.format||"hex";["hex","rgb","hsl"].filter(function(t){return t!==n}).forEach(function(t){e.$el.removeClass(t)}),this.$el.addClass(n)}},{key:"nextFormat",value:function(){var t=this.$store.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e="hex"),this.format=e,this.$store.dispatch("/changeFormat",e),this.$store.emit("lastUpdateColor"),this.initFormat()}},{key:"goToFormat",value:function(t){this.format=t,this.$store.dispatch("/changeFormat",this.format),this.$store.emit("lastUpdateColor"),this.initFormat()}},{key:"getFormat",value:function(){return this.format||"hex"}},{key:"checkNumberKey",value:function(t){t=t.which;return 37==t||39==t||8==t||46==t||9==t||!(t<48||57<t)}},{key:"checkNotNumberKey",value:function(t){return!this.checkNumberKey(t)}},{key:"changeRgbColor",value:function(){this.$store.dispatch("/changeColor",{type:"rgb",r:this.refs.$rgb_r.int(),g:this.refs.$rgb_g.int(),b:this.refs.$rgb_b.int(),a:this.refs.$rgb_a.float(),source:kn}),this.$store.emit("lastUpdateColor")}},{key:"changeHslColor",value:function(){this.$store.dispatch("/changeColor",{type:"hsl",h:this.refs.$hsl_h.int(),s:this.refs.$hsl_s.int(),l:this.refs.$hsl_l.int(),a:this.refs.$hsl_a.float(),source:kn}),this.$store.emit("lastUpdateColor")}},{key:"@changeColor",value:function(t){kn!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}},{key:"input $rgb_r",value:function(t){this.changeRgbColor()}},{key:"input $rgb_g",value:function(t){this.changeRgbColor()}},{key:"input $rgb_b",value:function(t){this.changeRgbColor()}},{key:"input $rgb_a",value:function(t){this.changeRgbColor()}},{key:"input $hsl_h",value:function(t){this.changeHslColor()}},{key:"input $hsl_s",value:function(t){this.changeHslColor()}},{key:"input $hsl_l",value:function(t){this.changeHslColor()}},{key:"input $hsl_a",value:function(t){this.changeHslColor()}},{key:"keyup $hexCode",value:function(t){var e=this.refs.$hexCode.val();"#"!=e.charAt(0)||7!=e.length&&9!==e.length||(this.$store.dispatch("/changeColor",e,kn),this.$store.emit("lastUpdateColor"))}},{key:"click $formatChangeButton",value:function(t){this.nextFormat()}},{key:"click $el .information-item.hex .input-field .title",value:function(t){this.goToFormat("rgb")}},{key:"click $el .information-item.rgb .input-field .title",value:function(t){this.goToFormat("hsl")}},{key:"click $el .information-item.hsl .input-field .title",value:function(t){this.goToFormat("hex")}},{key:"setRGBInput",value:function(){this.refs.$rgb_r.val(this.$store.rgb.r),this.refs.$rgb_g.val(this.$store.rgb.g),this.refs.$rgb_b.val(this.$store.rgb.b),this.refs.$rgb_a.val(this.$store.alpha)}},{key:"setHSLInput",value:function(){this.refs.$hsl_h.val(this.$store.hsl.h),this.refs.$hsl_s.val(this.$store.hsl.s),this.refs.$hsl_l.val(this.$store.hsl.l),this.refs.$hsl_a.val(this.$store.alpha)}},{key:"setHexInput",value:function(){this.refs.$hexCode.val(this.$store.dispatch("/toHEX"))}},{key:"refresh",value:function(){this.setCurrentFormat(this.$store.format),this.setRGBInput(),this.setHSLInput(),this.setHexInput()}}]),xn);function xn(){return d(this,xn),C(this,(xn.__proto__||Object.getPrototypeOf(xn)).apply(this,arguments))}var _n=(k(wn,Z),y(wn,[{key:"template",value:function(){return'\n <div class="color-chooser">\n <div class="color-chooser-container">\n <div class="colorsets-item colorsets-item-header">\n <h1 class="title">Color Palettes</h1>\n <span ref="$toggleButton" class="items">&times;</span>\n </div>\n <div ref="$colorsetsList" class="colorsets-list"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){this.load()}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"@toggleColorChooser",value:function(){this.toggle()}},{key:"load $colorsetsList",value:function(){return"\n <div>\n "+this.$store.dispatch("/getColorSetsList").map(function(t,e){return'\n <div class="colorsets-item" data-colorsets-index="'+e+'" >\n <h1 class="title">'+t.name+'</h1>\n <div class="items">\n <div>\n '+t.colors.filter(function(t,e){return e<5}).map(function(t){return'<div class="color-item" title="'+(t=t||"rgba(255, 255, 255, 1)")+'">\n <div class="color-view" style="background-color: '+t+'"></div>\n </div>'}).join("")+"\n </div>\n </div>\n </div>"}).join("")+"\n </div>\n "}},{key:"show",value:function(){this.$el.addClass("open")}},{key:"hide",value:function(){this.$el.removeClass("open")}},{key:"toggle",value:function(){this.$el.toggleClass("open")}},{key:"click $toggleButton",value:function(t){this.toggle()}},{key:"click $colorsetsList .colorsets-item",value:function(t){t=t.$delegateTarget;t&&(t=parseInt(t.attr("data-colorsets-index")),this.$store.dispatch("/setCurrentColorSets",t),this.hide())}},{key:"destroy",value:function(){$(wn.prototype.__proto__||Object.getPrototypeOf(wn.prototype),"destroy",this).call(this),this.hide()}}]),wn);function wn(){return d(this,wn),C(this,(wn.__proto__||Object.getPrototypeOf(wn)).apply(this,arguments))}var On=(k(Mn,Z),y(Mn,[{key:"template",value:function(){return'\n <div class="colorsets">\n <div class="menu" title="Open Color Palettes">\n <button ref="$colorSetsChooseButton" type="button" class="color-sets-choose-btn arrow-button"></button>\n </div>\n <div ref="$colorSetsColorList" class="color-list"></div>\n </div>\n '}},{key:"load $colorSetsColorList",value:function(){var t=this.$store.dispatch("/getCurrentColorSets");return'\n <div class="current-color-sets">\n '+this.$store.dispatch("/getCurrentColors").map(function(t,e){return'<div class="color-item" title="'+t+'" data-index="'+e+'" data-color="'+t+'">\n <div class="empty"></div>\n <div class="color-view" style="background-color: '+t+'"></div>\n </div>'}).join("")+" \n "+(t.edit?'<div class="add-color-item">+</div>':"")+" \n </div>\n "}},{key:"refresh",value:function(){this.load()}},{key:"addColor",value:function(t){this.$store.dispatch("/addCurrentColor",t)}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"click $colorSetsChooseButton",value:function(t){this.$store.emit("toggleColorChooser")}},{key:"contextmenu $colorSetsColorList",value:function(t){var e;t.preventDefault(),this.$store.dispatch("/getCurrentColorSets").edit&&((e=new Ge(t.target).closest("color-item"))?(e=parseInt(e.attr("data-index")),this.$store.emit("showContextMenu",t,e)):this.$store.emit("showContextMenu",t))}},{key:"click $colorSetsColorList .add-color-item",value:function(t){this.addColor(this.$store.dispatch("/toColor"))}},{key:"click $colorSetsColorList .color-item",value:function(t){this.$store.dispatch("/changeColor",t.$delegateTarget.attr("data-color")),this.$store.emit("lastUpdateColor")}}]),Mn);function Mn(){return d(this,Mn),C(this,(Mn.__proto__||Object.getPrototypeOf(Mn)).apply(this,arguments))}var Sn=(k(Tn,Z),y(Tn,[{key:"template",value:function(){return'\n <ul class="colorsets-contextmenu">\n <li class="menu-item small-hide" data-type="remove-color">Remove color</li>\n <li class="menu-item small-hide" data-type="remove-all-to-the-right">Remove all to the right</li>\n <li class="menu-item" data-type="clear-palette">Clear palette</li>\n </ul>\n '}},{key:"show",value:function(t,e){t=Ke.pos(t);this.$el.css({top:t.clientY-10+"px",left:t.clientX+"px"}),this.$el.addClass("show"),this.selectedColorIndex=e,void 0===this.selectedColorIndex?this.$el.addClass("small"):this.$el.removeClass("small")}},{key:"hide",value:function(){this.$el.removeClass("show")}},{key:"runCommand",value:function(t){switch(t){case"remove-color":this.$store.dispatch("/removeCurrentColor",this.selectedColorIndex);break;case"remove-all-to-the-right":this.$store.dispatch("/removeCurrentColorToTheRight",this.selectedColorIndex);break;case"clear-palette":this.$store.dispatch("/clearPalette")}}},{key:"@showContextMenu",value:function(t,e){this.show(t,e)}},{key:"click $el .menu-item",value:function(t){t.preventDefault(),this.runCommand(t.$delegateTarget.attr("data-type")),this.hide()}}]),Tn);function Tn(){return d(this,Tn),C(this,(Tn.__proto__||Object.getPrototypeOf(Tn)).apply(this,arguments))}var En=(k(An,x),y(An,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="colorwheel"></div>\n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div> \n </div>\n '}},{key:"components",value:function(){return{colorwheel:bn,control:mn,information:Cn,currentColorSets:On,colorSetsChooser:_n,contextMenu:Sn}}}]),An);function An(){return d(this,An),C(this,(An.__proto__||Object.getPrototypeOf(An)).apply(this,arguments))}var In=(k(Pn,q),y(Pn,[{key:"template",value:function(){return'\n <div class="hue">\n <div ref="$container" class="hue-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({h:t/100*this.maxValue,type:"hsv"})}}]),Pn);function Pn(t){d(this,Pn);t=C(this,(Pn.__proto__||Object.getPrototypeOf(Pn)).call(this,t));return t.minValue=0,t.maxValue=360,t.source="hue-control",t}var Dn=(k(Bn,Z),y(Bn,[{key:"components",value:function(){return{Hue:In,Opacity:dn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"chromedevtool-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Bn);function Bn(){return d(this,Bn),C(this,(Bn.__proto__||Object.getPrototypeOf(Bn)).apply(this,arguments))}var Rn="chromedevtool-palette",Un=(k(Fn,Z),y(Fn,[{key:"template",value:function(){return'\n <div class="color">\n <div ref="$saturation" class="saturation">\n <div ref="$value" class="value">\n <div ref="$drag_pointer" class="drag-pointer"></div>\n </div>\n </div> \n </div> \n '}},{key:"setBackgroundColor",value:function(t){this.$el.css("background-color",t)}},{key:"refresh",value:function(){this.setColorUI()}},{key:"caculateSV",value:function(){var t=this.drag_pointer_pos||{x:0,y:0},e=this.state.get("$el.width"),n=this.state.get("$el.height"),e=t.x/e,n=(n-t.y)/n;this.$store.dispatch("/changeColor",{type:"hsv",s:e,v:n,source:Rn})}},{key:"setColorUI",value:function(){var t=this.state.get("$el.width")*this.$store.hsv.s,e=this.state.get("$el.height")*(1-this.$store.hsv.v);this.refs.$drag_pointer.css({left:t+"px",top:e+"px"}),this.drag_pointer_pos={x:t,y:e},this.setBackgroundColor(this.$store.dispatch("/getHueColor"))}},{key:"setMainColor",value:function(t){var e=this.$el.offset(),n=this.state.get("$el.contentWidth"),r=this.state.get("$el.contentHeight"),i=Ke.pos(t).pageX-e.left,e=Ke.pos(t).pageY-e.top;i<0?i=0:n<i&&(i=n),e<0?e=0:r<e&&(e=r),this.refs.$drag_pointer.css({left:i+"px",top:e+"px"}),this.drag_pointer_pos={x:i,y:e},this.caculateSV()}},{key:"@changeColor",value:function(t){Rn!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}},{key:"mouseup document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"mousemove document",value:function(t){this.isDown&&this.setMainColor(t)}},{key:"mousedown",value:function(t){this.isDown=!0,this.setMainColor(t)}},{key:"touchend document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"touchmove document",value:function(t){this.isDown&&this.setMainColor(t)}},{key:"touchstart",value:function(t){t.preventDefault(),this.isDown=!0,this.setMainColor(t)}}]),Fn);function Fn(){return d(this,Fn),C(this,(Fn.__proto__||Object.getPrototypeOf(Fn)).apply(this,arguments))}var jn=(k(Hn,x),y(Hn,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Un,control:Dn,information:Cn,currentColorSets:On,colorSetsChooser:_n,contextMenu:Sn}}}]),Hn);function Hn(){return d(this,Hn),C(this,(Hn.__proto__||Object.getPrototypeOf(Hn)).apply(this,arguments))}var Ln=(k(Vn,Z),y(Vn,[{key:"components",value:function(){return{Hue:In,Opacity:dn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Vn);function Vn(){return d(this,Vn),C(this,(Vn.__proto__||Object.getPrototypeOf(Vn)).apply(this,arguments))}var zn=(k(Nn,x),y(Nn,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div>\n <div target="control"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Un,control:Ln}}}]),Nn);function Nn(){return d(this,Nn),C(this,(Nn.__proto__||Object.getPrototypeOf(Nn)).apply(this,arguments))}k(Gn,q),y(Gn,[{key:"getMaxDist",value:function(){return this.state.get("$container.height")}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({top:t+"px"})}},{key:"getMousePosition",value:function(t){return Ke.pos(t).pageY}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().top}},{key:"getCaculatedDist",value:function(t){t=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.maxValue);return 100-this.getDist(t)}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.minValue?this.refs.$bar.addClass("first").removeClass("last"):(t>=this.maxValue?this.refs.$bar.addClass("last"):this.refs.$bar.removeClass("last")).removeClass("first");t=1-(t||0)/this.maxValue;this.setMousePosition(this.getMaxDist()*t)}}]),q=Gn;function Gn(t){d(this,Gn);t=C(this,(Gn.__proto__||Object.getPrototypeOf(Gn)).call(this,t));return t.source="vertical-slider",t}var Xn=(k(Yn,q),y(Yn,[{key:"template",value:function(){return'\n <div class="hue">\n <div ref="$container" class="hue-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({h:t/100*this.maxValue,type:"hsv"})}}]),Yn);function Yn(t){d(this,Yn);t=C(this,(Yn.__proto__||Object.getPrototypeOf(Yn)).call(this,t));return t.minValue=0,t.maxValue=360,t.source="vertical-hue-control",t}var Wn=(k(qn,q),y(qn,[{key:"template",value:function(){return'\n <div class="opacity">\n <div ref="$container" class="opacity-container">\n <div ref="$colorbar" class="color-bar"></div>\n <div ref="$bar" class="drag-bar2"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){$(qn.prototype.__proto__||Object.getPrototypeOf(qn.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=He.format(t,"rgb");t.a=1;t=He.format(t,"rgb");this.refs.$colorbar.css("background","linear-gradient(to top, "+e+", "+t+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({a:Math.floor(t)/100*this.maxValue})}}]),qn);function qn(t){d(this,qn);t=C(this,(qn.__proto__||Object.getPrototypeOf(qn)).call(this,t));return t.source="vertical-opacity-control",t}var Kn=(k(Zn,Z),y(Zn,[{key:"components",value:function(){return{Hue:Xn,Opacity:Wn}}},{key:"template",value:function(){return'<div class="control"><div target="Hue" ></div><div target="Opacity" ></div></div>'}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Zn);function Zn(){return d(this,Zn),C(this,(Zn.__proto__||Object.getPrototypeOf(Zn)).apply(this,arguments))}var Jn=(k(Qn,x),y(Qn,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div><div target="control"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Un,control:Kn}}}]),Qn);function Qn(){return d(this,Qn),C(this,(Qn.__proto__||Object.getPrototypeOf(Qn)).apply(this,arguments))}var tr=(k(er,Z),y(er,[{key:"components",value:function(){return{Value:vn,Opacity:dn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Value" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),er);function er(){return d(this,er),C(this,(er.__proto__||Object.getPrototypeOf(er)).apply(this,arguments))}var nr=(k(rr,bn),y(rr,[{key:"template",value:function(){return'\n <div class="wheel" data-type="ring">\n <canvas class="wheel-canvas" ref="$colorwheel" ></canvas>\n <div class="drag-pointer" ref="$drag_pointer"></div>\n </div>\n '}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.setHueColor(null,t)}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"setHueColor",value:function(t,e){var n,r,i,o,a,l,s;this.state.get("$el.width")&&(n=(s=this.getRectangle()).minX,r=s.minY,i=s.radius,o=s.centerX,l=s.centerY,a=p((s=(a=this.getCurrentXY(t,this.getDefaultValue(),i,o,l)).x)-o,(t=a.y)-l),s=(l=this.getCurrentXY(null,a,i-this.half_thinkness,o,l)).x,t=l.y,this.refs.$drag_pointer.css({left:s-n+"px",top:t-r+"px"}),e||this.changeColor({type:"hsv",h:a}))}}]),rr);function rr(t){d(this,rr);t=C(this,(rr.__proto__||Object.getPrototypeOf(rr)).call(this,t));return t.width=214,t.height=214,t.thinkness=16,t.half_thinkness=t.thinkness/2,t.source="colorring",t}var ir=(k(or,x),y(or,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="colorring"></div>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{colorring:nr,palette:Un,control:tr,information:Cn,currentColorSets:On,colorSetsChooser:_n,contextMenu:Sn}}}]),or);function or(){return d(this,or),C(this,(or.__proto__||Object.getPrototypeOf(or)).apply(this,arguments))}var ar=(k(lr,Z),y(lr,[{key:"components",value:function(){return{Hue:Xn,Opacity:Wn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(){this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),lr);function lr(){return d(this,lr),C(this,(lr.__proto__||Object.getPrototypeOf(lr)).apply(this,arguments))}var sr=(k(ur,x),y(ur,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Un,control:ar,information:Cn,currentColorSets:On,colorSetsChooser:_n,contextMenu:Sn}}}]),ur);function ur(){return d(this,ur),C(this,(ur.__proto__||Object.getPrototypeOf(ur)).apply(this,arguments))}var cr=(k(hr,Z),y(hr,[{key:"components",value:function(){return{Hue:Xn,Opacity:Wn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Opacity" ></div> \n <div target="Hue" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),hr);function hr(){return d(this,hr),C(this,(hr.__proto__||Object.getPrototypeOf(hr)).apply(this,arguments))}var fr=(k(vr,x),y(vr,[{key:"template",value:function(){return"\n <div class='colorpicker-body'>\n <div class='color-view'>\n <div class='color-view-container' ref=\"$colorview\"></div>\n </div>\n <div class='color-tool'>\n <div target=\"palette\"></div>\n <div target=\"control\"></div>\n </div>\n </div>\n "}},{key:"components",value:function(){return{palette:Un,control:cr}}},{key:"initColorWithoutChangeEvent",value:function(t){this.$store.dispatch("/initColor",t),this.refresh()}},{key:"setBackgroundColor",value:function(){var t=this.$store.dispatch("/toColor"),e=this.$store.rgb,e=He.brightness(e.r,e.g,e.b);this.refs.$colorview.css({"background-color":t,color:127<e?"black":"white"}),this.refs.$colorview.html(t)}},{key:"click $colorview",value:function(t){this.nextFormat()}},{key:"nextFormat",value:function(){var t=this.$store.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e="hex"),this.$store.dispatch("/changeFormat",e),this.$store.emit("lastUpdateColor"),this.refresh()}},{key:"refresh",value:function(){this.setBackgroundColor()}},{key:"@changeColor",value:function(){this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),vr);function vr(){return d(this,vr),C(this,(vr.__proto__||Object.getPrototypeOf(vr)).apply(this,arguments))}var gr={create:function(t){switch(t.type){case"macos":return new En(t);case"xd":return new sr(t);case"ring":return new ir(t);case"mini":return new zn(t);case"vscode":return new fr(t);case"mini-vertical":return new Jn(t);default:return new jn(t)}},ColorPicker:jn,ChromeDevToolColorPicker:jn,MacOSColorPicker:En,RingColorPicker:ir,MiniColorPicker:zn,VSCodePicker:fr,MiniVerticalColorPicker:Jn};var dr="ace_color",pr=(y(mr,[{key:"get_brightness",value:function(t){t=He.parse(t);return 127<j(t.r,t.g,t.b)?"#000":"#fff"}},{key:"mouse_over",value:function(t){var e=new Ge(t.target);this.__colorview_check_target=t.target,e.hasClass(dr)&&this.openDebouncedColorPicker(t)}},{key:"init_mouse_event",value:function(){var o,a,l,t=this.editor.renderer.content;this.openDebouncedColorPicker=(o=this.open_color_picker.bind(this),a=this.opt.showDelay,l=void 0,function(t,e,n,r,i){l&&clearTimeout(l),l=setTimeout(function(){o(t,e,n,r,i)},a||300)}),this.onMouseOver=this.mouse_over.bind(this),t.addEventListener("mousemove",this.onMouseOver)}},{key:"init_event",value:function(){var o=this,t=this.editor,e=t.renderer,t=t.session,a=e.content;this.init_mouse_event();var n,r=t.$mode.$highlightRules.getRules();for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(r[n].unshift({token:"color",regex:"#(?:[\\da-f]{8})|#(?:[\\da-f]{3}){1,2}|rgb\\((?:\\s*\\d{1,3},\\s*){2}\\d{1,3}\\s*\\)|rgba\\((?:\\s*\\d{1,3},\\s*){3}\\d*\\.?\\d+\\s*\\)|hsl\\(\\s*\\d{1,3}(?:,\\s*\\d{1,3}%){2}\\s*\\)|hsla\\(\\s*\\d{1,3}(?:,\\s*\\d{1,3}%){2},\\s*\\d*\\.?\\d+\\s*\\)"}),r[n].unshift({token:"color",regex:"blue|green|red"}));t.$mode.$tokenizer=null,t.bgTokenizer.setTokenizer(editor.session.$mode.getTokenizer()),t.bgTokenizer.start(0),e.on("afterRender",function(){for(var t=a.getElementsByClassName(dr),e=0,n=t.length;e<n;e++){var r,i=t[e].textContent;t[e].getAttribute("data-color")!==i&&(r=o.get_brightness(i),t[e].setAttribute("data-color",i),t[e].style.cssText="\n background-color: "+i+";\n color: "+r+";\n pointer-events: all;\n ")}})}},{key:"destroy",value:function(){this.editor.renderer.content.removeEventListener("mousemove",this.onMouseOver)}},{key:"open_color_picker",value:function(t){var e,n,r,i,o,a,l,s=this;t.target===this.__colorview_check_target?(e=this.ace.Range,l=(n=this.editor).renderer,a=n.session,n=l.layerConfig,t=l.screenToTextCoordinates(t.clientX-n.padding,t.clientY),(a=a.getTokenAt(t.row,t.column))&&!1!==a.type.includes("color")&&(r=t.row,i=a.start,t=a.value,o=t,a=l.textToScreenCoordinates(r,i),l=Ge.getScrollTop(),this.colorpicker.show({left:a.pageX,top:a.pageY+l,bottom:a.pageY+l+n.lineHeight,hideDelay:this.opt.hideDelay||10},t,function(t){s.editor.session.replace(new e(r,i,r,i+o.length),t),o=t}))):this.close_color_picker()}},{key:"close_color_picker",value:function(){this.colorpicker&&this.colorpicker.hide()}},{key:"hide_delay_color_picker",value:function(){this.colorpicker&&this.colorpicker.runHideDelay()}},{key:"key",value:function(t,e){return[t,e].join(":")}},{key:"keyup",value:function(t){!this.colorpicker||"Escape"!=t.key&&0!=this.colorpicker.isShortCut||this.colorpicker.hide()}}]),mr);function mr(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{type:"vscode",showDelay:300,containerClass:"ace-colorpicker"};d(this,mr),this.opt=n,this.ace=t,this.editor=e,this.colorpicker=gr.create(this.opt),this.init_event()}return _({},m,gr,{load:function(t,e,n){return new pr(t,e,n)}})}();
1
+ var AceColorPicker=function(){"use strict";function h(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgba(0, 0, 0, 0)";return Array.isArray(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]}),"hex"==e?r(t):"rgb"==e?i(t,n):"hsl"==e?o(t):t}function r(t){var e=(t=Array.isArray(t)?{r:t[0],g:t[1],b:t[2],a:t[3]}:t).r.toString(16);t.r<16&&(e="0"+e);var n=t.g.toString(16);t.g<16&&(n="0"+n);var r=t.b.toString(16);t.b<16&&(r="0"+r);var i="";return t.a<1&&(i=(t=Math.floor(255*t.a)).toString(16),t<16&&(i="0"+i)),"#"+e+n+r+i}function i(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"rgba(0, 0, 0, 0)";if(void 0!==(t=Array.isArray(t)?{r:t[0],g:t[1],b:t[2],a:t[3]}:t))return 1==t.a||void 0===t.a?isNaN(t.r)?e:"rgb("+t.r+","+t.g+","+t.b+")":"rgba("+t.r+","+t.g+","+t.b+","+t.a+")"}function o(t){return 1==(t=Array.isArray(t)?{r:t[0],g:t[1],b:t[2],a:t[3]}:t).a||void 0===t.a?"hsl("+t.h+","+t.s+"%,"+t.l+"%)":"hsla("+t.h+","+t.s+"%,"+t.l+"%,"+t.a+")"}var t={format:h,rgb:i,hsl:o,hex:r};function u(t,e){return e=void 0===e?1:e,Math.round(t*e)/e}function n(t){return t*Math.PI/180}function a(t){t=180*t/Math.PI;return t=t<0?360+t:t}function l(t,e){return(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)+e*Math.cos(n(t))}function s(t,e){return(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)+e*Math.sin(n(t))}function p(t,e){return a(Math.atan2(e,t))}var e={round:u,radianToDegree:a,degreeToRadian:n,getXInCircle:l,getYInCircle:s,caculateAngle:p},c={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",aqua:"rgb(0, 255, 255)",aquamarine:"rgb(127, 255, 212)",azure:"rgb(240, 255, 255)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",black:"rgb(0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb(0, 0, 255)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",burlywood:"rgb(222, 184, 135)",cadetblue:"rgb(95, 158, 160)",chartreuse:"rgb(127, 255, 0)",chocolate:"rgb(210, 105, 30)",coral:"rgb(255, 127, 80)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",crimson:"rgb(237, 20, 61)",cyan:"rgb(0, 255, 255)",darkblue:"rgb(0, 0, 139)",darkcyan:"rgb(0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgray:"rgb(169, 169, 169)",darkgrey:"rgb(169, 169, 169)",darkgreen:"rgb(0, 100, 0)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb(85, 107, 47)",darkorange:"rgb(255, 140, 0)",darkorchid:"rgb(153, 50, 204)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkslateblue:"rgb(72, 61, 139)",darkslategray:"rgb(47, 79, 79)",darkslategrey:"rgb(47, 79, 79)",darkturquoise:"rgb(0, 206, 209)",darkviolet:"rgb(148, 0, 211)",deeppink:"rgb(255, 20, 147)",deepskyblue:"rgb(0, 191, 255)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb(30, 144, 255)",firebrick:"rgb(178, 34, 34)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb(34, 139, 34)",fuchsia:"rgb(255, 0, 255)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",goldenrod:"rgb(218, 165, 32)",gray:"rgb(128, 128, 128)",grey:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",greenyellow:"rgb(173, 255, 47)",honeydew:"rgb(240, 255, 240)",hotpink:"rgb(255, 105, 180)",indianred:"rgb(205, 92, 92)",indigo:"rgb(75, 0, 130)",ivory:"rgb(255, 255, 240)",khaki:"rgb(240, 230, 140)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lightblue:"rgb(173, 216, 230)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgreen:"rgb(144, 238, 144)",lightgray:"rgb(211, 211, 211)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightsalmon:"rgb(255, 160, 122)",lightseagreen:"rgb(32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightyellow:"rgb(255, 255, 224)",lime:"rgb(0, 255, 0)",limegreen:"rgb(50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",maroon:"rgb(128, 0, 0)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb(0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumpurple:"rgb(147, 112, 219)",mediumseagreen:"rgb(60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb(0, 250, 154)",mediumturquoise:"rgb(72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb(25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navy:"rgb(0, 0, 128)",oldlace:"rgb(253, 245, 230)",olive:"rgb(128, 128, 0)",olivedrab:"rgb(107, 142, 35)",orange:"rgb(255, 165, 0)",orangered:"rgb(255, 69, 0)",orchid:"rgb(218, 112, 214)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",paleturquoise:"rgb(175, 238, 238)",palevioletred:"rgb(219, 112, 147)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",plum:"rgb(221, 160, 221)",powderblue:"rgb(176, 224, 230)",purple:"rgb(128, 0, 128)",rebeccapurple:"rgb(102, 51, 153)",red:"rgb(255, 0, 0)",rosybrown:"rgb(188, 143, 143)",royalblue:"rgb(65, 105, 225)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb(46, 139, 87)",seashell:"rgb(255, 245, 238)",sienna:"rgb(160, 82, 45)",silver:"rgb(192, 192, 192)",skyblue:"rgb(135, 206, 235)",slateblue:"rgb(106, 90, 205)",slategray:"rgb(112, 128, 144)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",springgreen:"rgb(0, 255, 127)",steelblue:"rgb(70, 130, 180)",tan:"rgb(210, 180, 140)",teal:"rgb(0, 128, 128)",thistle:"rgb(216, 191, 216)",tomato:"rgb(255, 99, 71)",turquoise:"rgb(64, 224, 208)",violet:"rgb(238, 130, 238)",wheat:"rgb(245, 222, 179)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellowgreen:"rgb(154, 205, 50)",transparent:"rgba(0, 0, 0, 0)"};var f={isColorName:function(t){return!!c[t]},getColorByName:function(t){return c[t]}};function v(t,e,n){return n<0&&(n+=1),1<n&&--n,n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function g(t,e,n){var r,i,o,a;return 1==arguments.length&&(t=(r=arguments[0]).h,e=r.s,n=r.l),t/=360,n/=100,0==(e/=100)?i=o=a=n:(i=v(e=2*n-(n=n<.5?n*(1+e):n+e-n*e),n,t+1/3),o=v(e,n,t),a=v(e,n,t-1/3)),{r:u(255*i),g:u(255*o),b:u(255*a)}}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var m={HUEtoRGB:v,HSLtoHSV:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).h,e=r.s,n=r.l),R((n=g(t,e,n)).r,n.g,n.b)},HSLtoRGB:g},y=function(t,e,n){return e&&b(t.prototype,e),n&&b(t,n),t};function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $(t,e,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,e);if(void 0!==r){if("value"in r)return r.value;r=r.get;return void 0!==r?r.call(n):void 0}if(null!==(t=Object.getPrototypeOf(t)))return $(t,e,n)}function k(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function C(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var x=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},w=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,l=t[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&l.return&&l.return()}finally{if(i)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},O=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},M=/(#(?:[\da-f]{8})|#(?:[\da-f]{3}){1,2}|rgb\((?:\s*\d{1,3},\s*){2}\d{1,3}\s*\)|rgba\((?:\s*\d{1,3},\s*){3}\d*\.?\d+\s*\)|hsl\(\s*\d{1,3}(?:,\s*\d{1,3}%){2}\s*\)|hsla\(\s*\d{1,3}(?:,\s*\d{1,3}%){2},\s*\d*\.?\d+\s*\)|([\w_\-]+))/gi;function S(n){var t=n.match(M),e=[];if(!t)return e;for(var r,i=0,o=t.length;i<o;i++)-1<t[i].indexOf("#")||-1<t[i].indexOf("rgb")||-1<t[i].indexOf("hsl")?e.push({color:t[i]}):(r=f.getColorByName(t[i]))&&e.push({color:t[i],nameColor:r});var a={next:0};return e.forEach(function(t){var e=n.indexOf(t.color,a.next);t.startIndex=e,t.endIndex=e+t.color.length,a.next=t.endIndex}),e}function T(n){var t=S(n);return t.forEach(function(t,e){n=n.replace(t.color,"@"+e)}),{str:n,matches:t}}function E(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:",",n=T(t);return n.str.split(e).map(function(t,e){return t=I(t),t=n.matches[e]?t.replace("@"+e,n.matches[e].color):t})}function A(n,t){return t.forEach(function(t,e){n=n.replace("@"+e,t.color)}),n}function I(t){return t.replace(/^\s+|\s+$/g,"")}function P(t){if("string"==typeof t){if(-1<(t=f.isColorName(t)?f.getColorByName(t):t).indexOf("rgb(")){for(var e=0,n=(i=t.replace("rgb(","").replace(")","").split(",")).length;e<n;e++)i[e]=parseInt(I(i[e]),10);var r={type:"rgb",r:i[0],g:i[1],b:i[2],a:1};return r=Object.assign(r,U(r))}if(-1<t.indexOf("rgba(")){for(e=0,n=(i=t.replace("rgba(","").replace(")","").split(",")).length;e<n;e++)i[e]=n-1==e?parseFloat(I(i[e])):parseInt(I(i[e]),10);r={type:"rgb",r:i[0],g:i[1],b:i[2],a:i[3]};return r=Object.assign(r,U(r))}if(-1<t.indexOf("hsl(")){for(e=0,n=(i=t.replace("hsl(","").replace(")","").split(",")).length;e<n;e++)i[e]=parseFloat(I(i[e]));r={type:"hsl",h:i[0],s:i[1],l:i[2],a:1};return r=Object.assign(r,g(r))}if(-1<t.indexOf("hsla(")){for(e=0,n=(i=t.replace("hsla(","").replace(")","").split(",")).length;e<n;e++)i[e]=n-1==e?parseFloat(I(i[e])):parseInt(I(i[e]),10);r={type:"hsl",h:i[0],s:i[1],l:i[2],a:i[3]};return r=Object.assign(r,g(r))}if(0==t.indexOf("#")){var i=[],o=1;if(3==(t=t.replace("#","")).length)for(e=0,n=t.length;e<n;e++){var a=t.substr(e,1);i.push(parseInt(a+a,16))}else if(8===t.length){for(e=0,n=t.length;e<n;e+=2)i.push(parseInt(t.substr(e,2),16));o=i.pop()/255}else for(e=0,n=t.length;e<n;e+=2)i.push(parseInt(t.substr(e,2),16));r={type:"hex",r:i[0],g:i[1],b:i[2],a:o};return r=Object.assign(r,U(r))}}else if("number"==typeof t){if(0<=t&&t<=16777215){r={type:"hex",r:(16711680&t)>>16,g:(65280&t)>>8,b:(255&t)>>0,a:1};return r=Object.assign(r,U(r))}if(0<=t&&t<=4294967295){r={type:"hex",r:(4278190080&t)>>24,g:(16711680&t)>>16,b:(65280&t)>>8,a:(255&t)/255};return r=Object.assign(r,U(r))}}return t}function D(n){var r,t=(n=(n="string"==typeof n?E(n):n).map(function(t){if("string"==typeof t){var e=T(t),n=I(e.str).split(" ");return n[1]?n[1].includes("%")?n[1]=parseFloat(n[1].replace(/%/,""))/100:n[1]=parseFloat(n[1]):n[1]="*",n[0]=A(n[0],e.matches),n}if(Array.isArray(t))return t[1]?"string"==typeof t[1]&&(t[1].includes("%")?t[1]=parseFloat(t[1].replace(/%/,""))/100:t[1]=+t[1]):t[1]="*",[].concat(O(t))})).filter(function(t){return"*"===t[1]}).length;return 0<t&&(r=(1-n.filter(function(t){return"*"!=t[1]&&1!=t[1]}).map(function(t){return t[1]}).reduce(function(t,e){return t+e},0))/t,n.forEach(function(t,e){"*"==t[1]&&0<e&&(n.length-1==e||(t[1]=r))})),n}var B={matches:S,convertMatches:T,convertMatchesArray:E,reverseMatches:A,parse:P,parseGradient:D,trim:I,color_regexp:M,color_split:","};function R(t,e,n){1==arguments.length&&(t=(o=arguments[0]).r,e=o.g,n=o.b);var r=t/255,i=e/255,o=n/255,t=Math.max(r,i,o),e=t-Math.min(r,i,o),n=0;0==e?n=0:t==r?n=(i-o)/e%6*60:t==i?n=60*((o-r)/e+2):t==o&&(n=60*((r-i)/e+4));return{h:n=n<0?360+n:n,s:0==t?0:e/t,v:t}}function U(t,e,n){1==arguments.length&&(t=(a=arguments[0]).r,e=a.g,n=a.b),t/=255,e/=255,n/=255;var r,i=Math.max(t,e,n),o=Math.min(t,e,n),a=(i+o)/2;if(i==o)r=s=0;else{var l=i-o,s=.5<a?l/(2-i-o):l/(i+o);switch(i){case t:r=(e-n)/l+(e<n?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return{h:u(360*r),s:u(100*s),l:u(100*a)}}function F(t){return{r:t,g:t,b:t}}function j(t,e,n){return Math.ceil(.2126*t+.7152*e+.0722*n)}function H(t,e,n){var r;1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b);e=j(t,e,n);return{y:e,cr:.713*(t-e),cb:.564*(n-e)}}function L(t,e){return 100*((1<arguments.length&&void 0!==e?e:.04045)<t?Math.pow((t+.055)/1.055,2.4):t/12.92)}function V(t,e,n){var r;1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b);e/=255,n/=255;return{x:.4124*(t=L(t=t/255))+.3576*(e=L(e))+.1805*(n=L(n)),y:.2126*t+.7152*e+.0722*n,z:.0193*t+.1192*e+.9505*n}}var z={RGBtoCMYK:function(t,e,n){1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b);var r=t/255,t=e/255,e=n/255,n=1-Math.max(r,t,e);return{c:(1-r-n)/(1-n),m:(1-t-n)/(1-n),y:(1-e-n)/(1-n),k:n}},RGBtoGray:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b),F(H(t,e,n).y)},RGBtoHSL:U,RGBtoHSV:R,RGBtoLAB:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b),XYZtoLAB(V(t,e,n))},RGBtoSimpleGray:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b),F(Math.ceil((t+e+n)/3))},RGBtoXYZ:V,RGBtoYCrCb:H,c:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).r,e=r.g,n=r.b),F(90<(t+e+n)/3?0:255)},brightness:j,gray:F};var N={CMYKtoRGB:function(t,e,n,r){var i;return 1==arguments.length&&(t=(i=arguments[0]).c,e=i.m,n=i.y,r=i.k),{r:255*(1-t)*(1-r),g:255*(1-e)*(1-r),b:255*(1-n)*(1-r)}}};function G(t){return.008856<Math.pow(t,3)?Math.pow(t,3):(t-16/116)/7.787}function X(t){return.0031308<t?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function Y(t,e,n){1==arguments.length&&(t=(i=arguments[0]).x,e=i.y,n=i.z);var r=t/100,i=e/100,t=n/100,e=-.9689*r+1.8758*i+.0415*t,n=.0557*r+-.204*i+1.057*t,t=X(t=3.2406*r+-1.5372*i+-.4986*t),e=X(e),n=X(n);return{r:u(255*t),g:u(255*e),b:u(255*n)}}function W(t,e,n){var r;1==arguments.length&&(t=(r=arguments[0]).l,e=r.a,n=r.b);t=e/500+(e=(t+16)/116),n=e-n/200,e=G(e);return{x:95.047*(t=G(t)),y:100*e,z:108.883*(n=G(n))}}var q={XYZtoRGB:Y,LABtoRGB:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).l,e=r.a,n=r.b),Y(W(t,e,n))},LABtoXYZ:W};function K(t,e,n){1==arguments.length&&(t=(i=arguments[0]).h,e=i.s,n=i.v);var r=t,i=n;360<=r&&(r=0);t=e*i,n=t*(1-Math.abs(r/60%2-1)),e=i-t,i=[];return 0<=r&&r<60?i=[t,n,0]:60<=r&&r<120?i=[n,t,0]:120<=r&&r<180?i=[0,t,n]:180<=r&&r<240?i=[0,n,t]:240<=r&&r<300?i=[n,0,t]:300<=r&&r<360&&(i=[t,0,n]),{r:u(255*(i[0]+e)),g:u(255*(i[1]+e)),b:u(255*(i[2]+e))}}var Z={HSVtoHSL:function(t,e,n){var r;return 1==arguments.length&&(t=(r=arguments[0]).h,e=r.s,n=r.v),U((n=K(t,e,n)).r,n.g,n.b)},HSVtoRGB:K};var J={YCrCbtoRGB:function(t,e,n,r){1==arguments.length&&(t=(i=arguments[0]).y,e=i.cr,n=i.cb,r=(r=i.bit)||0);var i=t-.344*(n-r)-.714*(e-r),n=t+1.772*(n-r);return{r:Math.ceil(t+1.402*(e-r)),g:Math.ceil(i),b:Math.ceil(n)}}};function Q(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.5,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"hex",n={r:u(t.r+(e.r-t.r)*n),g:u(t.g+(e.g-t.g)*n),b:u(t.b+(e.b-t.b)*n),a:u(t.a+(e.a-t.a)*n,100)};return h(n,n.a<1?"rgb":r)}function tt(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:5;if(!t)return[];for(var n=(t=(t="string"==typeof t?E(t):t)||[]).length,r=[],i=0;i<n-1;i++)for(var o=0;o<e;o++)r.push(et(t[i],t[i+1],o/e));return r}function et(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.5,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"hex";return Q(P(t),P(e),n,r)}function nt(t){return t=P(t),(Math.round(299*t.r)+Math.round(587*t.g)+Math.round(114*t.b))/1e3}function rt(t){for(var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"h",n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:9,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"rgb",i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1,a=6<arguments.length&&void 0!==arguments[6]?arguments[6]:100,l=R(P(t)),s=(o-i)*a/n,u=[],c=1;c<=n;c++)l[e]=Math.abs((a-s*c)/a),u.push(h(K(l),r));return u}tt.parula=function(t){return tt(["#352a87","#0f5cdd","#00b5a6","#ffc337","#fdff00"],t)},tt.jet=function(t){return tt(["#00008f","#0020ff","#00ffff","#51ff77","#fdff00","#ff0000","#800000"],t)},tt.hsv=function(t){return tt(["#ff0000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000"],t)},tt.hot=function(t){return tt(["#0b0000","#ff0000","#ffff00","#ffffff"],t)},tt.pink=function(t){return tt(["#1e0000","#bd7b7b","#e7e5b2","#ffffff"],t)},tt.bone=function(t){return tt(["#000000","#4a4a68","#a6c6c6","#ffffff"],t)},tt.copper=function(t){return tt(["#000000","#3d2618","#9d623e","#ffa167","#ffc77f"],t)};var it={interpolateRGB:Q,blend:et,mix:function(t,e){return et(t,e,2<arguments.length&&void 0!==arguments[2]?arguments[2]:.5,3<arguments.length&&void 0!==arguments[3]?arguments[3]:"hex")},scale:tt,contrast:nt,contrastColor:function(t){return 128<=nt(t)?"black":"white"},gradient:function(t){for(var e=[],n=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:10)-((t=D(t)).length-1),r=n,i=1,o=t.length;i<o;i++){var a=t[i-1][0],l=t[i][0],s=1==i?t[i][1]:t[i][1]-t[i-1][1],s=i==t.length-1?r:Math.floor(s*n),e=e.concat(tt([a,l],s),[l]);r-=s}return e},scaleHSV:rt,scaleH:function(t){return rt(t,"h",1<arguments.length&&void 0!==arguments[1]?arguments[1]:9,2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgb",3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:360,1)},scaleS:function(t){return rt(t,"s",1<arguments.length&&void 0!==arguments[1]?arguments[1]:9,2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgb",3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,100)},scaleV:function(t){return rt(t,"v",1<arguments.length&&void 0!==arguments[1]?arguments[1]:9,2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgb",3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,100)}};var ot={euclidean:function(t,e){for(var n=0,r=0,i=t.length;r<i;r++)n+=Math.pow(e[r]-t[r],2);return Math.sqrt(n)},manhattan:function(t,e){for(var n=0,r=0,i=t.length;r<i;r++)n+=Math.abs(e[r]-t[r]);return n},max:function(t,e){for(var n=0,r=0,i=t.length;r<i;r++)n=Math.max(n,Math.abs(e[r]-t[r]));return n}},at={linear:function(t,e){for(var n=[],r=Math.round(Math.random()*t),i=Math.floor(t/e);n.push(r),r=(r+i)%t,n.length<e;);return n},shuffle:function(t,e){for(var n=[];n.length<e;){var r=Math.round(Math.random()*t);-1==n.indexOf(r)&&n.push(r)}return n}};function lt(t,e,n,r){for(var i=new Array(t),o=0;o<t;o++)i[o]=[];for(var a=0,l=e.length;a<l;a++){var s=e[a];i[function(n,t,r){var i=1/0,o=0;return t.forEach(function(t,e){t=r(n,t);t<i&&(i=t,o=e)}),o}(s,n,r)].push(s)}return i}function st(t,e,n,r,i,o){for(var a=0;a<t;a++){var l=n[a],s=r[a],u=new Array(s.length);i=!function(t,e){if(t.length===e.length){for(var n=0,r=t.length;n<r;++n)if(t[n]!==e[n])return;return 1}}(u=0<l.length?function(t){if(!t.length)return[];for(var e=new Array(t[0].length),n=0,r=e.length;n<r;n++)e[n]=0;for(var i=0,r=t.length;i<r;i++)for(var o=t[i],a=i+1,l=0,s=o.length;l<s;l++)e[l]+=(o[l]-e[l])/a;return e=e.map(function(t){return Math.floor(t)})}(l):e[Math.floor(o()*e.length)],s),r[a]=u}return i}function ut(t,e,n,r,i){var o=3<arguments.length&&void 0!==r?r:10,i=4<arguments.length&&void 0!==i?i:"linear";t=t,e=e||Math.max(2,Math.ceil(Math.sqrt(t.length/2)));var a=n||"euclidean";"string"==typeof a&&(a=ot[a]);for(var l=0,s=function(){return(l=(9301*l+49297)%233280)/233280},u=function(e,t,n){return at[2<arguments.length&&void 0!==n?n:"linear"](e.length,t).map(function(t){return e[t]})}(t,e,i),c=!0,h=0;c;){c=st(e,t,lt(e,t,u,a),u,!1,s);if(++h%o==0)break}return u}function ct(e,n){!function(t,e){for(var n=0;n<t;n+=4)e(n)}(e.pixels.length,function(t){n(e.pixels,t)})}var ht={create:function(t,e){var n=document.createElement("canvas");return n.width=t||0,n.height=e||0,n},drawPixels:function(t){var e=this.create(t.width,t.height),n=e.getContext("2d"),r=n.getImageData(0,0,e.width,e.height);return r.data.set(t.pixels),n.putImageData(r,0,0),e},createHistogram:function(i,o,a,t){var e=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{black:!0,red:!1,green:!1,blue:!1},n=this.create(i,o),l=n.getContext("2d");l.clearRect(0,0,i,o),l.fillStyle="white",l.fillRect(0,0,i,o);var s={black:!(l.globalAlpha=.7)};e.black?s.black=!1:s.black=!0,e.red?s.red=!1:s.red=!0,e.green?s.green=!1:s.green=!0,e.blue?s.blue=!1:s.blue=!0,Object.keys(a).forEach(function(t){var e,n,r;s[t]||(e=a[t],n=Math.max.apply(Math,e),r=i/e.length,l.fillStyle=t,e.forEach(function(t,e){t=o*(t/n);l.fillRect(e*r,o-t,r,t)}))}),"function"==typeof t&&t(n)},getHistogram:function(t){for(var r=new Array(256),i=new Array(256),o=new Array(256),a=new Array(256),e=0;e<256;e++)r[e]=0,i[e]=0,o[e]=0,a[e]=0;return ct(t,function(t,e){var n=Math.round(He.brightness(t[e],t[e+1],t[e+2]));r[n]++,i[t[e]]++,o[t[e+1]]++,a[t[e+2]]++}),{black:r,red:i,green:o,blue:a}},getBitmap:function(t,e){t=this.drawPixels(t);return{pixels:t.getContext("2d").getImageData(e.x||0,e.y||0,e.width||t.width,e.height||t.height).data,width:e.width,height:e.height}},putBitmap:function(t,e,n){var r=this.drawPixels(t),e=this.drawPixels(e),r=r.getContext("2d");return r.drawImage(e,n.x,n.y),t.pixels=r.getImageData(0,0,t.width,t.height).data,t}},ft=(y(vt,[{key:"initialize",value:function(){this.canvas=this.createCanvas(),this.context=this.canvas.getContext("2d")}},{key:"createCanvas",value:function(){return document.createElement("canvas")}},{key:"load",value:function(t){this.loadImage(t)}},{key:"loadImage",value:function(e){var n=this,r=this.context;this.newImage=new Image;var i=this.newImage;i.onload=function(){var t=i.height/i.width;n.opt.canvasWidth&&n.opt.canvasHeight?(n.canvas.width=n.opt.canvasWidth,n.canvas.height=n.opt.canvasHeight):(n.canvas.width=n.opt.maxWidth||i.width,n.canvas.height=n.canvas.width*t),r.drawImage(i,0,0,i.width,i.height,0,0,n.canvas.width,n.canvas.height),n.isLoaded=!0,e&&e()},this.getImageUrl(function(t){i.src=t})}},{key:"load",value:function(t){var e=this;this.newImage=new Image;var n=this.newImage;n.onload=function(){e.isLoaded=!0,t&&t()},this.getImageUrl(function(t){n.src=t})}},{key:"getImageUrl",value:function(e){if("string"==typeof this.imageUrl)return e(this.imageUrl);var t;this.imageUrl instanceof Blob&&((t=new FileReader).onload=function(t){e(t.target.result)},t.readAsDataURL(this.imageUrl))}},{key:"getRGBA",value:function(t,e,n,r){return[t,e,n,r]}},{key:"toArray",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=this.context.getImageData(0,0,this.canvas.width,this.canvas.height),i=r.width,o=r.height;(t=t||function(t,e){e(t)})({pixels:new Uint8ClampedArray(r.data),width:i,height:o},function(t){t=ht.drawPixels(t);"canvas"==n.returnTo?e(t):e(t.toDataURL(n.outputFormat||"image/png"))},n)}},{key:"toHistogram",value:function(t){var e=this.context.getImageData(0,0,this.canvas.width,this.canvas.height),n=e.width,r=e.height,e=new Uint8ClampedArray(e.data);return ht.getHistogram({pixels:e,width:n,height:r})}},{key:"toRGB",value:function(){for(var t=this.context.getImageData(0,0,this.canvas.width,this.canvas.height).data,e=[],n=0,r=t.length;n<r;n+=4)e[e.length]=[t[n+0],t[n+1],t[n+2],t[n+3]];return e}}]),vt);function vt(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};d(this,vt),this.isLoaded=!1,this.imageUrl=t,this.opt=e,this.initialize()}var gt={identity:function(){return[1,0,0,0,1,0,0,0,1]},stretching:function(t){return[t,0,0,0,1,0,0,0,1]},squeezing:function(t){return[t,0,0,0,1/t,0,0,0,1]},scale:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return[t=t||0===t?t:1,0,0,0,e=e||0===e?e:1,0,0,0,1]},scaleX:function(t){return this.scale(t)},scaleY:function(t){return this.scale(1,t)},translate:function(t,e){return[1,0,t,0,1,e,0,0,1]},rotate:function(t){t=this.radian(t);return[Math.cos(t),-Math.sin(t),0,Math.sin(t),Math.cos(t),0,0,0,1]},rotate90:function(){return[0,-1,0,1,0,0,0,0,1]},rotate180:function(){return[-1,0,0,0,-1,0,0,0,1]},rotate270:function(){return[0,1,0,-1,0,0,0,0,1]},radian:function(t){return t*Math.PI/180},skew:function(t,e){t=this.radian(t),e=this.radian(e);return[1,Math.tan(t),0,Math.tan(e),1,0,0,0,1]},skewX:function(t){t=this.radian(t);return[1,Math.tan(t),0,0,1,0,0,0,1]},skewY:function(t){t=this.radian(t);return[1,0,0,Math.tan(t),1,0,0,0,1]},shear1:function(t){return[1,-Math.tan(this.radian(t)/2),0,0,1,0,0,0,1]},shear2:function(t){return[1,0,0,Math.sin(this.radian(t)),1,0,0,0,1]}},dt={CONSTANT:gt,radian:function(t){return gt.radian(t)},multiply:function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},identity:function(t){return this.multiply(gt.identity(),t)},translate:function(t,e,n){return this.multiply(gt.translate(t,e),n)},rotate:function(t,e){return this.multiply(gt.rotate(t),e)},shear1:function(t,e){return this.multiply(gt.shear1(t),e)},shear2:function(t,e){return this.multiply(gt.shear2(t),e)},rotateShear:function(t,e){var n=this.shear1(t,e);return n=this.shear2(t,n),this.shear1(t,n)}};function pt(r){var h=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"center",f=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"center";return function(i,t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=Vt(i.pixels.length,i.width,i.height),o=i.width,a=i.height;"center"==h&&(h=Math.floor(o/2)),"center"==f&&(f=Math.floor(a/2));var l=dt.CONSTANT.translate(-h,-f),s=dt.CONSTANT.translate(h,f),u=dt.CONSTANT.shear1(r),c=dt.CONSTANT.shear2(r);Zt(function(t,e,n,r){n=dt.multiply(l,[n,r,1]),n=dt.multiply(u,n).map(Math.round);n=dt.multiply(c,n).map(Math.round),n=dt.multiply(u,n).map(Math.round),n=dt.multiply(s,n);r=w(n,2),n=r[0],r=r[1];n<0||r<0||o-1<n||a-1<r||te(t,r*o+n<<2,i.pixels,e)})(n,function(){t(n)},e)}}function mt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:200,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],t=Gt(t);return Wt("\n // refer to Color.brightness \n const v = ($C * Math.ceil($r * 0.2126 + $g * 0.7152 + $b * 0.0722) ) >= $scale ? 255 : 0;\n\n if ($hasColor) {\n\n if (v == 0) {\n $r = 0 \n $g = 0 \n $b = 0\n }\n \n } else {\n const value = Math.round(v)\n $r = value \n $g = value \n $b = value \n }\n \n ",{$C:(e=Gt(e))/100,$scale:t,$hasColor:n})}function yt(){return ee(Ut([1,2,1,2,4,2,1,2,1],1/16*(Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100)))}function bt(){return ee(Ut([1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1],1/256*(Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100)))}function $t(){Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return ee([5,5,5,-3,0,-3,-3,-3,-3])}function kt(){Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return ee([5,-3,-3,5,0,-3,5,-3,-3])}function Ct(){return ee(Ut([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))}function xt(){return ee(Ut([1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1],1/9))}function _t(){return ee(Ut([1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1],1/9))}function wt(){return ee(Ut([1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1],1/9))}function Ot(){return ee([-1,-2,-1,0,0,0,1,2,1])}function Mt(){return ee([-1,0,1,-2,0,2,-1,0,1])}var St=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Tt=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Et(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}function At(t,e,n){return n?function(t,e){if(isNaN(e)||e<1)return t;e|=0;var n,r,i,o,a,l,s,u,c,h,f,v,g,d,p,m,y,b,$,k,C=t.pixels,x=t.width,_=t.height,w=e+e+1,O=x-1,M=_-1,S=e+1,T=S*(S+1)/2,E=new Et,A=E;for(i=1;i<w;i++){var I;A=A.next=new Et,i==S&&(I=A)}A.next=E;var P=null,D=null;s=l=0;var B=St[e],R=Tt[e];for(r=0;r<_;r++){for(d=p=m=u=c=h=0,f=S*(y=C[l]),v=S*(b=C[l+1]),g=S*($=C[l+2]),u+=T*y,c+=T*b,h+=T*$,A=E,i=0;i<S;i++)A.r=y,A.g=b,A.b=$,A=A.next;for(i=1;i<S;i++)o=l+((O<i?O:i)<<2),u+=(A.r=y=C[o])*(k=S-i),c+=(A.g=b=C[o+1])*k,h+=(A.b=$=C[o+2])*k,d+=y,p+=b,m+=$,A=A.next;for(P=E,D=I,n=0;n<x;n++)C[l]=u*B>>R,C[l+1]=c*B>>R,C[l+2]=h*B>>R,u-=f,c-=v,h-=g,f-=P.r,v-=P.g,g-=P.b,o=s+((o=n+e+1)<O?o:O)<<2,d+=P.r=C[o],p+=P.g=C[o+1],m+=P.b=C[o+2],u+=d,c+=p,h+=m,P=P.next,f+=y=D.r,v+=b=D.g,g+=$=D.b,d-=y,p-=b,m-=$,D=D.next,l+=4;s+=x}for(n=0;n<x;n++){for(p=m=d=c=h=u=0,f=S*(y=C[l=n<<2]),v=S*(b=C[l+1]),g=S*($=C[l+2]),u+=T*y,c+=T*b,h+=T*$,A=E,i=0;i<S;i++)A.r=y,A.g=b,A.b=$,A=A.next;for(a=x,i=1;i<=e;i++)l=a+n<<2,u+=(A.r=y=C[l])*(k=S-i),c+=(A.g=b=C[l+1])*k,h+=(A.b=$=C[l+2])*k,d+=y,p+=b,m+=$,A=A.next,i<M&&(a+=x);for(l=n,P=E,D=I,r=0;r<_;r++)C[o=l<<2]=u*B>>R,C[o+1]=c*B>>R,C[o+2]=h*B>>R,u-=f,c-=v,h-=g,f-=P.r,v-=P.g,g-=P.b,o=n+((o=r+S)<M?o:M)*x<<2,u+=d+=P.r=C[o],c+=p+=P.g=C[o+1],h+=m+=P.b=C[o+2],P=P.next,f+=y=D.r,v+=b=D.g,g+=$=D.b,d-=y,p-=b,m-=$,D=D.next,l+=x}return t}(t,e):stackBlurCanvasRGB(t,0,0,e)}function It(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10,r=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=Gt(n);return function(t,e){e(At(t,n,r))}}function Pt(){return ee(Ut([1,4,6,4,1,4,16,24,16,4,6,24,-476,24,6,4,16,24,16,4,1,4,6,4,1],-1/Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:256)))}var Dt=_({},{crop:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,s=arguments[2],u=arguments[3],c=Vt(s*u*4,s,u);return function(t,e){for(var n=l,r=0;n<u;n++,r++)for(var i=a,o=0;i<s;i++,o++)c.pixels[r*s*o]=t.pixels[n*s*i];e(c)}},resize:function(r,i){return function(t,e){var n=ht.drawPixels(t),t=n.getContext("2d");n.width=r,n.height=i,e({pixels:new Uint8ClampedArray(t.getImageData(0,0,r,i).data),width:r,height:i})}},flipH:function(){return function(t,e){for(var n=t.width,r=t.height,i=(n%2==1?1:0)?Math.floor(n/2):n/2,o=0;o<r;o++)for(var a=0;a<i;a++)Kt(t.pixels,o*n+a<<2,o*n+(n-1-a)<<2);e(t)}},flipV:function(){return function(t,e){for(var n=t.width,r=t.height,i=(r%2==1?1:0)?Math.floor(r/2):r/2,o=0;o<i;o++)for(var a=0;a<n;a++)Kt(t.pixels,o*n+a<<2,(r-1-o)*n+a<<2);e(t)}},rotate:function(){var l=Gt(l=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0);return l%=360,function(o,t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(0==l)return o;if(90==l||270==l)var a=Vt(o.pixels.length,o.height,o.width);else{if(180!=l)return pt(l)(o,t,e);a=Vt(o.pixels.length,o.width,o.height)}Zt(function(t,e,n,r){var i;90==l?i=n*a.width+(a.width-1-r)<<2:270==l?i=(a.height-1-n)*a.width+r<<2:180==l&&(i=(a.height-1-r)*a.width+(a.width-1-n)<<2),te(a.pixels,i,o.pixels,e)})(o,function(){t(a)},e)}},rotateDegree:pt,histogram:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"gray",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0;r<e.length-1;r++)for(var i=e[r],o=e[r+1],a=o[0]-i[0],l=(o[1]-i[1])/a,s=0,u=i[0];s<a;s++,u++)n[u]=i[1]+s*l;return n[255]=255,Wt("red"===t?function(){$r=n[$r]}:"green"===t?function(){$g=n[$g]}:"blue"===t?function(){$b=n[$b]}:function(){var t=Color.RGBtoYCrCb($r,$g,$b),t=Color.YCrCbtoRGB(clamp(n[clamp(t.y)]),t.cr,t.cb,0);$r=t.r,$g=t.g,$b=t.b},{},{$realPoints:n})},"rotate-degree":pt},{bitonal:function(t,e){return Wt("\n const thresholdColor = ( $r + $g + $b ) <= $threshold ? $darkColor : $lightColor\n\n $r = thresholdColor.r\n $g = thresholdColor.g \n $b = thresholdColor.b \n ",{$threshold:2<arguments.length&&void 0!==arguments[2]?arguments[2]:100},{$darkColor:He.parse(t),$lightColor:He.parse(e)})},brightness:function(){var t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return Wt("\n $r += $C \n $g += $C \n $b += $C \n ",{$C:Math.floor(t/100*255)})},brownie:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[.5997023498159715,.34553243048391263,-.2708298674538042,0,-.037703249837783157,.8609577587992641,.15059552388459913,0,.24113635128153335,-.07441037908422492,.44972182064877153,0,0,0,0,1]})},clip:function(){var t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0);return Wt("\n\n $r = ($r > 255 - $C) ? 255 : 0\n $g = ($g > 255 - $C) ? 255 : 0\n $b = ($b > 255 - $C) ? 255 : 0\n\n ",{$C:2.55*Math.abs(t)})},contrast:function(){var t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0);return Wt("\n $r *= $C\n $g *= $C\n $b *= $C\n ",{$C:Math.max((128+t)/128,0)})},gamma:function(){return Wt("\n $r = Math.pow($r / 255, $C) * 255\n $g = Math.pow($g / 255, $C) * 255\n $b = Math.pow($b / 255, $C) * 255\n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)})},gradient:function(){var t=[].concat(Array.prototype.slice.call(arguments)),e=(e=(t=(t=1===t.length&&"string"==typeof t[0]?He.convertMatchesArray(t[0]):t).map(function(t){return He.matches(t).length?{type:"param",value:t}:{type:"scale",value:t}})).filter(function(t){return"scale"==t.type})[0])?+e.value:256;return t=t.filter(function(t){return"param"==t.type}).map(function(t){return t.value}).join(","),Wt("\n const colorIndex = clamp(Math.ceil($r * 0.2126 + $g * 0.7152 + $b * 0.0722))\n const newColorIndex = clamp(Math.floor(colorIndex * ($scale / 256)))\n const color = $colors[newColorIndex]\n\n $r = color.r \n $g = color.g \n $b = color.b \n $a = clamp(Math.floor(color.a * 256))\n ",{},{$colors:He.gradient(t,e).map(function(t){t=He.parse(t);return{r:t.r,g:t.g,b:t.b,a:t.a}}),$scale:e})},grayscale:function(t){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a\n ",{$matrix:[.2126+.7874*(1-(t=1<(t=(t=Gt(t))/100)?1:t)),.7152-.7152*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152+.2848*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152-.7152*(1-t),.0722+.9278*(1-t),0,0,0,0,1]})},hue:function(){return Wt("\n var hsv = Color.RGBtoHSV($r, $g, $b);\n\n // 0 ~ 360 \n var h = hsv.h;\n h += Math.abs($C)\n h = h % 360\n hsv.h = h\n\n var rgb = Color.HSVtoRGB(hsv);\n\n $r = rgb.r\n $g = rgb.g\n $b = rgb.b\n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:360)})},invert:function(){return Wt("\n $r = (255 - $r) * $C\n $g = (255 - $g) * $C\n $b = (255 - $b) * $C\n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100})},kodachrome:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,0,0,0,1]})},matrix:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,6<arguments.length&&void 0!==arguments[6]?arguments[6]:0,7<arguments.length&&void 0!==arguments[7]?arguments[7]:0,8<arguments.length&&void 0!==arguments[8]?arguments[8]:0,9<arguments.length&&void 0!==arguments[9]?arguments[9]:0,10<arguments.length&&void 0!==arguments[10]?arguments[10]:0,11<arguments.length&&void 0!==arguments[11]?arguments[11]:0,12<arguments.length&&void 0!==arguments[12]?arguments[12]:0,13<arguments.length&&void 0!==arguments[13]?arguments[13]:0,14<arguments.length&&void 0!==arguments[14]?arguments[14]:0,15<arguments.length&&void 0!==arguments[15]?arguments[15]:0]})},noise:function(){return Wt("\n const C = Math.abs($C) * 5\n const min = -C\n const max = C \n const noiseValue = Math.round(min + (Math.random() * (max - min)))\n\n $r += noiseValue\n $g += noiseValue\n $b += noiseValue\n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)})},opacity:function(){return Wt("\n $a *= $C \n ",{$C:Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100})},polaroid:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1]})},saturation:function(){var t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:100);return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[t=1-Math.abs(t/100),0,0,0,0,t,0,0,0,0,t,0,0,0,0,t]})},sepia:function(){var t=Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[.393+.607*(1-(t=1<t?1:t)),.769-.769*(1-t),.189-.189*(1-t),0,.349-.349*(1-t),.686+.314*(1-t),.168-.168*(1-t),0,.272-.272*(1-t),.534-.534*(1-t),.131+.869*(1-t),0,0,0,0,1]})},shade:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return Wt("\n $r *= $redValue\n $g *= $greenValue\n $b *= $blueValue\n ",{$redValue:Gt(t),$greenValue:Gt(e),$blueValue:Gt(n)})},shift:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1]})},solarize:function(t,e,n){return Wt("\n $r = ($r < $redValue) ? 255 - $r: $r\n $g = ($g < $greenValue) ? 255 - $g: $g\n $b = ($b < $blueValue) ? 255 - $b: $b\n ",{$redValue:Gt(t),$greenValue:Gt(e),$blueValue:Gt(n)})},technicolor:function(){return Wt("\n $r = $matrix[0] * $r + $matrix[1] * $g + $matrix[2] * $b + $matrix[3] * $a\n $g = $matrix[4] * $r + $matrix[5] * $g + $matrix[6] * $b + $matrix[7] * $a\n $b = $matrix[8] * $r + $matrix[9] * $g + $matrix[10] * $b + $matrix[11] * $a\n $a = $matrix[12] * $r + $matrix[13] * $g + $matrix[14] * $b + $matrix[15] * $a \n ",{$matrix:[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-.231103377548616,-.7501899197440212,1.847597816108189,0,0,0,0,1]})},threshold:function(){return mt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:200,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,!1)},"threshold-color":mt,tint:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return Wt("\n\n $r += (255 - $r) * $redTint\n $g += (255 - $g) * $greenTint\n $b += (255 - $b) * $blueTint\n\n ",{$redTint:Gt(t),$greenTint:Gt(e),$blueTint:Gt(n)})}},{blur:function(){return ee(Jt(Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:3)))},emboss:function(){var t;return ee([-2*(t=Gt(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:4)),-t,0,-t,1,t,0,t,2*t])},gaussianBlur:yt,"gaussian-blur":yt,gaussianBlur5x:bt,"gaussian-blur-5x":bt,grayscale2:function(){return ee(Ut([.3,.3,.3,0,0,.59,.59,.59,0,0,.11,.11,.11,0,0,0,0,0,0,0,0,0,0,0,0],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},normal:function(){return ee([0,0,0,0,1,0,0,0,0])},kirschHorizontal:$t,"kirsch-horizontal":$t,kirschVertical:kt,"kirsch-vertical":kt,laplacian:function(){return ee(Ut([-1,-1,-1,-1,8,-1,-1,-1,-1],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},laplacian5x:Ct,"laplacian-5x":Ct,motionBlur:xt,"motion-blur":xt,motionBlur2:_t,"motion-blur-2":_t,motionBlur3:wt,"motion-blur-3":wt,negative:function(){return ee(Ut([-1,0,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,1,1,1,1],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},sepia2:function(){return ee(Ut([.393,.349,.272,0,0,.769,.686,.534,0,0,.189,.168,.131,0,0,0,0,0,0,0,0,0,0,0,0],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},sharpen:function(){return ee(Ut([0,-1,0,-1,5,-1,0,-1,0],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},sobelHorizontal:Ot,"sobel-horizontal":Ot,sobelVertical:Mt,"sobel-vertical":Mt,stackBlur:It,"stack-blur":It,transparency:function(){return ee(Ut([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,.3,0,0,0,0,0,1],Gt(0<arguments.length&&void 0!==arguments[0]?arguments[0]:100)/100))},unsharpMasking:Pt,"unsharp-masking":Pt},{kirsch:function(){return oe("kirsch-horizontal kirsch-vertical")},sobel:function(){return oe("sobel-horizontal sobel-vertical")},vintage:function(){return oe("brightness(15) saturation(-20) gamma(1.8)")}}),Bt=0,x=(x(Re={partial:ue,multi:le,merge:se,weight:Ut,repeat:Ft,colorMatrix:function(t,e,n){var r=t[e],i=t[e+1],o=t[e+2],a=t[e+3];Qt(t,e,n[0]*r+n[1]*i+n[2]*o+n[3]*a,n[4]*r+n[5]*i+n[6]*o+n[7]*a,n[8]*r+n[9]*i+n[10]*o+n[11]*a,n[12]*r+n[13]*i+n[14]*o+n[15]*a)},each:Ht,eachXY:Lt,createRandomCount:function(){return[9,16,25,36,49,64,81,100].sort(function(t,e){return.5-Math.random()})[0]},createRandRange:function(t,e,n){for(var r=[],i=1;i<=n;i++){var o=Math.random()*(e-t)+t,a=Math.floor(10*Math.random())%2==0?-1:1;r.push(a*o)}r.sort();var l=Math.floor(n>>1),s=r[l];return r[l]=r[0],r[0]=s,r},createBitmap:Vt,createBlurMatrix:Jt,pack:function(r){return function(n,t){Ht(n.pixels.length,function(t,e){r(n.pixels,t,e,n.pixels[t],n.pixels[t+1],n.pixels[t+2],n.pixels[t+3])},function(){t(n)})}},packXY:Zt,pixel:Wt,getBitmap:zt,putBitmap:Nt,radian:function(t){return dt.CONSTANT.radian(t)},convolution:ee,parseParamNumber:Gt,filter:oe,clamp:ie,fillColor:Qt,fillPixelColor:te},"multi",le),x(Re,"merge",se),x(Re,"matches",ne),x(Re,"parseFilter",re),x(Re,"partial",ue),Re),Rt=x;function Ut(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return t.map(function(t){return t*e})}function Ft(t,e){for(var n=new Array(e),r=0;r<e;r++)n[r]=t;return n}function jt(i,t,e,n,r,o,a,l){var t=1<arguments.length&&void 0!==t?t:0,s=2<arguments.length&&void 0!==e?e:1,u=n,c=r,h=5<arguments.length&&void 0!==o?o:1e4,a=6<arguments.length&&void 0!==a?a:"full",f=7<arguments.length&&void 0!==l?l:50,v=t,g=function(t){setTimeout(t,0)};function d(){for(var t,e=function(t){return t=[].concat(O(Array(0<arguments.length&&void 0!==t?t:50))).map(function(t){return"cri = ri + i * s; if (cri >= mx) return {currentRunIndex: cri, i: null}; c(cri); i++;"}).join("\n"),new Function("ri","i","s","mx","c","\n let cri = ri;\n \n "+t+"\n \n return {currentRunIndex: cri, i: i} \n ")}(f),n=v,r=0;r<h;){if(null==(t=e(v,r,s,i,u)).i){n=t.currentRunIndex;break}r=t.i,n=t.currentRunIndex}!function(t){t?v=t:v+=s;i<=v?c():g?g(d):d()}(n)}"requestAnimationFrame"==a&&(g=requestAnimationFrame,h=1e3),"full"==a&&(g=null,h=i),d()}function Ht(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};jt(t,0,4,function(t){e(t,t>>2)},function(){n()},r.functionDumpCount,r.frameTimer,r.loopCount)}function Lt(t,n,r,e){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{};jt(t,0,4,function(t){var e=t>>2;r(t,e%n,Math.floor(e/n))},function(){e()},i.functionDumpCount,i.frameTimer,i.loopCount)}function Vt(t,e,n){return{pixels:new Uint8ClampedArray(t),width:e,height:n}}function zt(t,e){return ht.getBitmap(t,e)}function Nt(t,e,n){return ht.putBitmap(t,e,n)}function Gt(t){return+(t="string"==typeof t?(t=t.replace(/deg/,"")).replace(/px/,""):t)}var Xt=/(([\w_\-]+)(\(([^\)]*)\))?)+/gi;function Yt(t,e,n){var a;return a={},e=(t=[{callback:t,context:1<arguments.length&&void 0!==e?e:{},rootContext:2<arguments.length&&void 0!==n?n:{}}]).map(function(r){var i=[];Object.keys(r.context).forEach(function(t,e){i[t]="n$"+Bt+++t+"$"}),Object.keys(r.rootContext).forEach(function(t,e){i[t]="r$"+Bt+++t+"$",a[i[t]]=r.rootContext[t]});var t=Object.keys(r.context).filter(function(t){return"number"!=typeof r.context[t]&&"string"!=typeof r.context[t]&&(!Array.isArray(r.context[t])||"number"!=typeof r.context[t][0]&&"string"!=typeof r.context[t][0])}).map(function(t,e){return[i[t],JSON.stringify(r.context[t])].join(" = ")}),o=r.callback;return"function"==typeof r.callback&&((o=r.callback.toString().split("{")).shift(),(o=(o=o.join("{")).split("}")).pop(),o=o.join("}")),Object.keys(i).forEach(function(n){var t=i[n];"number"==typeof r.context[n]||"string"==typeof r.context[n]?o=o.replace(new RegExp("\\"+n,"g"),r.context[n]):Array.isArray(r.context[n])&&("number"==typeof r.context[n][0]||"string"==typeof r.context[n][0])?r.context[n].forEach(function(t,e){o=o.replace(new RegExp("\\"+n+"\\["+e+"\\]","g"),t)}):o=o.replace(new RegExp("\\"+n,"g"),t)}),{preCallbackString:o,preContext:t}}),n=e.map(function(t,e){return t.preContext.length?"const "+t.preContext+";":""}).join("\n\n"),t=e.map(function(t){return t.preCallbackString}).join("\n\n"),(e=new Function("$pixels","$pixelIndex","$clamp","$Color"," \n let $r = $pixels[$pixelIndex], $g = $pixels[$pixelIndex+1], $b = $pixels[$pixelIndex+2], $a = $pixels[$pixelIndex+3];\n\n "+n+"\n\n "+t+"\n \n $pixels[$pixelIndex] = $r\n $pixels[$pixelIndex+1] = $g \n $pixels[$pixelIndex+2] = $b \n $pixels[$pixelIndex+3] = $a \n ")).$preCallbackString=t,e.$preContext=n,e.rootContextObject=a,e}function Wt(t){var e=Yt(t,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}),t=function(t,e){};return t.userFunction=e,t}var qt=[0,1,2,3];function Kt(n,r,i){qt.forEach(function(t){var e=n[r+t];n[r+t]=n[i+t],n[i+t]=e})}function Zt(i){return function(r,t){Lt(r.pixels.length,r.width,function(t,e,n){i(r.pixels,t,e,n)},function(){t(r)},2<arguments.length&&void 0!==arguments[2]?arguments[2]:{})}}function Jt(){var t=Math.pow(0<arguments.length&&void 0!==arguments[0]?arguments[0]:3,2);return Ft(1/t,t)}function Qt(t,e,n,r,i,o){var a;3==arguments.length&&(n=(a=arguments[2]).r,r=a.g,i=a.b,o=a.a),"number"==typeof n&&(t[e]=n),"number"==typeof r&&(t[e+1]=r),"number"==typeof i&&(t[e+2]=i),"number"==typeof o&&(t[e+3]=o)}function te(t,e,n,r){Qt(t,e,n[r],n[r+1],n[r+2],n[r+3])}function ee(h){var f=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],v=function(t,e,n){var r=1<arguments.length&&void 0!==e?e:0,i=2<arguments.length&&void 0!==n?n:255,o=t.map(function(t,e){return[]});return t.forEach(function(t,e){if(0!=t)for(var n=o[e],e=r;e<=i;e++)n[e]=t*e}),o}(h);return function(t,e){var n=Math.round(Math.sqrt(h.length)),r=function(t,e){var n=1<arguments.length&&void 0!==e?e:0,e=t.width+n,n=t.height+n;return{pixels:new Uint8ClampedArray(e*n*4),width:e,height:n}}(t,2*n);!function(t,e,n,r){for(var i,o,a,l,s=e.pixels.length/4,u=0;u<s;u++)a=u%e.width,i=r+(o=Math.floor(u/e.width)),(l=n+a)>t.width||i>t.height||(a=o*e.width+a<<2,l=i*t.width+l<<2,t.pixels[l]=e.pixels[a],t.pixels[1+l]=e.pixels[1+a],t.pixels[2+l]=e.pixels[2+a],t.pixels[3+l]=e.pixels[3+a])}(r,t,n,n);for(var i=Vt(r.pixels.length,r.width,r.height),o=Vt(t.pixels.length,t.width,t.height),a=function(t,o,i,e){var a=Math.round(Math.sqrt(t.length)),l=Math.floor(a/2),n=e?1:0,e="let r = 0, g = 0, b = 0, a = 0, scy = 0, scx =0, si = 0; ",s=[],u=[],c=[],h=[];t.forEach(function(t,e){var n=Math.floor(e/a)-l,r=e%a-l;0!=t&&(s.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+i+" + ($sx + ("+r+"))) * 4]]"),u.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+i+" + ($sx + ("+r+"))) * 4 + 1]]"),c.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+i+" + ($sx + ("+r+"))) * 4 + 2]]"),h.push("$t["+e+"][$sp[(($sy + ("+n+")) * "+i+" + ($sx + ("+r+"))) * 4 + 3]]"))}),e+="r = "+s.join(" + ")+"; g = "+u.join(" + ")+"; b = "+c.join(" + ")+"; a = "+h.join(" + ")+";",e+="$dp[$di] = r; $dp[$di+1] = g;$dp[$di+2] = b;$dp[$di+3] = a + ("+n+")*(255-a); ";var f=new Function("$dp","$sp","$di","$sx","$sy","$t",e);return function(t,e,n,r,i){f(t,e,n,r,i,o)}}(h,v,r.width,(r.height,f)),l=t.pixels.length/4,s=0;s<l;s++){var u=s,c=u%t.width+n,u=Math.floor(u/t.width)+n;a(i.pixels,r.pixels,4*(u*r.width+c),c,u)}!function(t,e,n,r){for(var i=e.pixels.length>>2,o=0,a=0,l=0;l<i;l++){var s=l%e.width,u=r+(a=Math.floor(l/e.width));(o=n+s)>t.width||u>t.height||(u=u*t.width+o<<2,s=a*e.width+s<<2,e.pixels[s]=t.pixels[u],e.pixels[1+s]=t.pixels[1+u],e.pixels[2+s]=t.pixels[2+u],e.pixels[3+s]=t.pixels[3+u])}}(i,o,n,n),e(o)}}function ne(n){var e=He.convertMatches(n),t=e.str.match(Xt),r=[];if(!t)return r;var r=t.map(function(t){return{filter:t,origin:He.reverseMatches(t,e.matches)}}),i={next:0};return r=r.map(function(t){var e=n.indexOf(t.origin,i.next);return t.startIndex=e,t.endIndex=e+t.origin.length,t.arr=re(t.origin),i.next=t.endIndex,t}).filter(function(t){return!!t.arr.length})}function re(t){var e=He.convertMatches(t),n=e.str.match(Xt);if(!n[0])return[];var r=n[0].split("("),t=r.shift(),n=[];return r.length&&(n=r.shift().split(")")[0].split(",").map(function(t){return He.reverseMatches(t,e.matches)})),[t].concat(O(n)).map(He.trim)}function ie(t){return Math.min(255,t)}function oe(t){return se(ne(t).map(function(t){return t.arr}))}function ae(t){for(var e=0<arguments.length&&void 0!==t?t:[],n=[],r=[],i=0,o=e.length;i<o;i++){var a=e[i];a.userFunction?r.push(a):(r.length&&n.push([].concat(O(r))),n.push(a),r=[])}return r.length&&n.push([].concat(O(r))),n.forEach(function(t,e){var i;Array.isArray(t)&&(n[e]=(i=function(t){var e=t.map(function(t){return" \n "+t.userFunction.$preContext+"\n\n "+t.userFunction.$preCallbackString+"\n\n $r = clamp($r); $g = clamp($g); $b = clamp($b); $a = clamp($a);\n "}).join("\n\n"),n={clamp:ie,Color:He};t.forEach(function(t){Object.assign(n,t.userFunction.rootContextObject)});var t="const "+Object.keys(n).map(function(t){return" "+t+" = $rc."+t+" "}).join(","),r=new Function("$p","$pi","$rc"," \n let $r = $p[$pi], $g = $p[$pi+1], $b = $p[$pi+2], $a = $p[$pi+3];\n \n "+t+"\n\n "+e+"\n \n $p[$pi] = $r; $p[$pi+1] = $g; $p[$pi+2] = $b; $p[$pi+3] = $a;\n ");return function(t,e){r(t,e,n)}}(t),function(t,e){for(var n=0,r=t.pixels.length;n<r;n+=4)i(t.pixels,n);e(t)}))}),n}function le(){for(var t=arguments.length,a=Array(t),e=0;e<t;e++)a[e]=arguments[e];var l=(a=ae(a=a.map(function(t){if("function"==typeof t)return t;var e=(t=(t="string"==typeof t?[t]:t).slice(0)).shift();if("function"==typeof e)return e;var n=t;if(!(t=Dt[e]||Rt[e]))throw new Error(e+" is not filter. please check filter name.");return t.apply(t,n)}).filter(function(t){return t}))).length;return function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=t,i=0;function o(){a[i].call(null,r,function(t){r=t,l<=++i?e(r):o()},n)}o()}}function se(t){return le.apply(void 0,O(t))}function ue(r){for(var i=null,t=arguments.length,e=Array(1<t?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return i=1==e.length&&"string"==typeof e[0]?oe(e[0]):se(e),function(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};i(zt(e,r),function(t){n(Nt(e,t,r))},t)}}function ce(t){return+(t="string"==typeof t?(t=t.replace(/deg/,"")).replace(/px/,""):t)}function he(t,e){var n=1<arguments.length&&void 0!==e?e:1;return t.map(function(t){return t*n})}var fe=0;function ve(){return[].concat(Array.prototype.slice.call(arguments))}function ge(t){return{type:"convolution",length:t.length,content:t}}function de(t,e){return{type:"shader",index:fe,options:e,content:"\n if (u_filterIndex == "+fe+++".0) {\n "+t+"\n }\n "}}function pe(t){return"\n \n if (u_kernelSelect == "+t+".0) {\n vec4 colorSum = "+(r=t,i=Math.sqrt(r),o=Math.floor(i/2),[].concat(O(Array(r))).map(function(t,e){var n=Math.floor(e/i)-o;return"texture(u_image, v_texCoord + onePixel * vec2("+(e%i-o)+", "+n+")) * u_kernel"+r+"["+e+"]"}).join(" + \n"))+"; \n\n outColor = vec4((colorSum / u_kernel"+t+"Weight).rgb, 1);\n \n }\n ";var r,i,o}function me(t){return"vec4("+(t=[t.r/255,t.g/255,t.b/255,t.a||0].map(ye))+")"}function ye(t){return t==Math.floor(t)?t+".0":t}function be(){return ge(he([1,2,1,2,4,2,1,2,1],ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)*(1/16)))}function $e(){return ge([1,4,6,4,1,4,16,24,16,4,6,24,36,24,6,4,16,24,16,4,1,4,6,4,1])}function ke(){return ge([5,5,5,-3,0,-3,-3,-3,-3])}function Ce(){return ge([5,-3,-3,5,0,-3,5,-3,-3])}function xe(){return ge([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}function _e(){return ge([1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1])}function we(){return ge([1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1])}function Oe(){return ge([1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1])}function Me(){return ge([-1,-2,-1,0,0,0,1,2,1])}function Se(){return ge([-1,0,1,-2,0,2,-1,0,1])}function Te(){return ge(he([1,4,6,4,1,4,16,24,16,4,6,24,-476,24,6,4,16,24,16,4,1,4,6,4,1],-1/256))}function Ee(){var t=[0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,6<arguments.length&&void 0!==arguments[6]?arguments[6]:0,7<arguments.length&&void 0!==arguments[7]?arguments[7]:0,8<arguments.length&&void 0!==arguments[8]?arguments[8]:0,9<arguments.length&&void 0!==arguments[9]?arguments[9]:0,10<arguments.length&&void 0!==arguments[10]?arguments[10]:0,11<arguments.length&&void 0!==arguments[11]?arguments[11]:0,12<arguments.length&&void 0!==arguments[12]?arguments[12]:0,13<arguments.length&&void 0!==arguments[13]?arguments[13]:0,14<arguments.length&&void 0!==arguments[14]?arguments[14]:0,15<arguments.length&&void 0!==arguments[15]?arguments[15]:0].map(ye);return de("\n\n outColor = vec4(\n "+t[0]+" * pixelColor.r + "+t[1]+" * pixelColor.g + "+t[2]+" * pixelColor.b + "+t[3]+" * pixelColor.a,\n "+t[4]+" * pixelColor.r + "+t[5]+" * pixelColor.g + "+t[6]+" * pixelColor.b + "+t[7]+" * pixelColor.a,\n "+t[8]+" * pixelColor.r + "+t[9]+" * pixelColor.g + "+t[10]+" * pixelColor.b + "+t[11]+" * pixelColor.a,\n "+t[12]+" * pixelColor.r + "+t[13]+" * pixelColor.g + "+t[14]+" * pixelColor.b + "+t[15]+" * pixelColor.a\n ); \n ")}function Ae(){return de("\n float c = ( (pixelColor.r * 0.2126 + pixelColor.g * 0.7152 + pixelColor.b * 0.0722) ) >= "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+" ? 1.0 : 0.0;\n\n outColor = vec4(c, c, c, pixelColor.a);\n ")}var Ie=_({},{blur:function(){return ge([1,1,1,1,1,1,1,1,1])},normal:function(){return ge([0,0,0,0,1,0,0,0,0])},emboss:function(){var t;return ge([-2*(t=ce(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:4)),-t,0,-t,1,t,0,t,2*t])},gaussianBlur:be,"gaussian-blur":be,gaussianBlur5x:$e,"gaussian-blur-5x":$e,grayscale2:function(){return ge([.3,.3,.3,0,0,.59,.59,.59,0,0,.11,.11,.11,0,0,0,0,0,0,0,0,0,0,0,0])},kirschHorizontal:ke,"kirsch-horizontal":ke,kirschVertical:Ce,"kirsch-vertical":Ce,laplacian:function(){return ge([-1,-1,-1,-1,8,-1,-1,-1,-1])},laplacian5x:xe,"laplacian-5x":xe,motionBlur:_e,"motion-blur":_e,motionBlur2:we,"motion-blur-2":we,motionBlur3:Oe,"motion-blur-3":Oe,negative:function(){return ge([-1,0,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,1,1,1,1])},sepia2:function(){return ge([.393,.349,.272,0,0,.769,.686,.534,0,0,.189,.168,.131,0,0,0,0,0,0,0,0,0,0,0,0])},sharpen:function(){return ge([0,-1,0,-1,5,-1,0,-1,0])},sobelHorizontal:Me,"sobel-horizontal":Me,sobelVertical:Se,"sobel-vertical":Se,transparency:function(){return ge([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,.3,0,0,0,0,0,1])},unsharpMasking:Te,"unsharp-masking":Te},{bitonal:function(t,e){var n=ye(2<arguments.length&&void 0!==arguments[2]?arguments[2]:.5),t=me(He.parse(t));return de("\n if ((pixelColor.r + pixelColor.g + pixelColor.b) > "+n+") {\n outColor = vec4("+me(He.parse(e))+".rgb, pixelColor.a);\n } else {\n outColor = vec4("+t+".rgb, pixelColor.a);\n }\n ")},brightness:function(){return de("\n outColor = pixelColor + ("+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+");\n ")},brownie:function(){return Ee(.5997023498159715,.34553243048391263,-.2708298674538042,0,-.037703249837783157,.8609577587992641,.15059552388459913,0,.24113635128153335,-.07441037908422492,.44972182064877153,0,0,0,0,1)},clip:function(){var t=ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0));return de("\n outColor = vec4(\n (pixelColor.r > 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.g > 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.b > 1.0 - "+t+") ? 1.0 : 0.0,\n pixelColor.a \n );\n ")},chaos:function(){return de("\n vec2 st = pixelColor.st;\n st *= "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:10))+";\n \n vec2 ipos = floor(st); // get the integer coords\n\n vec3 color = vec3(random( ipos ));\n\n outColor = vec4(color, pixelColor.a);\n ")},contrast:function(){return de("\n outColor = pixelColor * "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+";\n ")},gamma:function(){var t=ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1));return de("\n outColor = vec4(pow(pixelColor.r, "+t+"), pow(pixelColor.g, "+t+"), pow(pixelColor.b, "+t+"), pixelColor.a );\n ")},gradient:function(){var t=(t=1===(t=[].concat(Array.prototype.slice.call(arguments))).length&&"string"==typeof t[0]?He.convertMatchesArray(t[0]):t).map(function(t){return t}).join(", "),e=He.parseGradient(t);e[0][1]=0,e[e.length-1][1]=1;for(var n=[],r=0,i=(e=e.map(function(t){var e=He.parse(t[0]);return[{r:e.r,g:e.g,b:e.b,a:e.a},t[1]]})).length;r<i-1;r++){var o=e[r],a=e[r+1],l=me(o[0]),s=me(a[0]),o=ye(o[1]),a=ye(a[1]);n.push("\n if ("+o+" <= rate && rate < "+a+") {\n outColor = mix("+l+", "+s+", (rate - "+o+")/("+a+" - "+o+"));\n }\n ")}return de("\n float rate = (pixelColor.r * 0.2126 + pixelColor.g * 0.7152 + pixelColor.b * 0.0722); \n\n "+n.join("\n")+" \n ")},grayscale:function(){var t=ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return Ee(.2126+.7874*(1-(t=1<t?1:t)),.7152-.7152*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152+.2848*(1-t),.0722-.0722*(1-t),0,.2126-.2126*(1-t),.7152-.7152*(1-t),.0722+.9278*(1-t),0,0,0,0,1)},hue:function(){return de("\n vec3 hsv = rgb2hsv(pixelColor.rgb);\n hsv.x += "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+";\n outColor = vec4(hsv2rgb(hsv).rgb, pixelColor.a);\n ")},invert:function(){var t=ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1));return de("\n outColor = vec4(\n (1.0 - pixelColor.r) * "+t+",\n (1.0 - pixelColor.g) * "+t+",\n (1.0 - pixelColor.b) * "+t+",\n pixelColor.a\n );\n ")},kodachrome:function(){return Ee(1.1285582396593525,-.3967382283601348,-.03992559172921793,0,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,0,0,0,1)},matrix:Ee,noise:function(){var t=Math.abs(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)),e=ye(-t);return de("\n float rnd = "+e+" + random( pixelColor.st ) * ("+ye(t)+" - "+e+");\n\n outColor = vec4(pixelColor.rgb + rnd, 1.0);\n ")},opacity:function(){return de("\n outColor = vec4(pixelColor.rgb, pixelColor.a * "+ye(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1))+");\n ")},polaroid:function(){return Ee(1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1)},saturation:function(){var t=1-Math.abs(ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0));return Ee(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,t)},sepia:function(){var t=ce(0<arguments.length&&void 0!==arguments[0]?arguments[0]:1);return Ee(.393+.607*(1-(t=1<t?1:t)),.769-.769*(1-t),.189-.189*(1-t),0,.349-.349*(1-t),.686+.314*(1-t),.168-.168*(1-t),0,.272-.272*(1-t),.534-.534*(1-t),.131+.869*(1-t),0,0,0,0,1)},shade:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return de("\n outColor = vec4(\n pixelColor.r * "+ye(ce(t)/255)+",\n pixelColor.g * "+ye(ce(e)/255)+",\n pixelColor.b * "+ye(ce(n)/255)+",\n pixelColor.a\n );\n ")},shift:function(){return Ee(1.438,-.062,-.062,0,-.122,1.378,-.122,0,-.016,-.016,1.483,0,0,0,0,1)},solarize:function(t,e,n){return de("\n outColor = vec4(\n (pixelColor.r < "+ye(ce(t))+") ? 1.0 - pixelColor.r: pixelColor.r,\n (pixelColor.g < "+ye(ce(e))+") ? 1.0 - pixelColor.g: pixelColor.g,\n (pixelColor.b < "+ye(ce(n))+") ? 1.0 - pixelColor.b: pixelColor.b,\n pixelColor.a\n );\n ")},technicolor:function(){return Ee(1.9125277891456083,-.8545344976951645,-.09155508482755585,0,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-.231103377548616,-.7501899197440212,1.847597816108189,0,0,0,0,1)},threshold:function(){return Ae(0<arguments.length&&void 0!==arguments[0]?arguments[0]:200,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,!1)},"threshold-color":Ae,tint:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return de("\n outColor = vec4(\n pixelColor.r += (1 - pixelColor.r) * "+ce(t)+",\n pixelColor.g += (1 - pixelColor.g) * "+ce(e)+",\n pixelColor.b += (1 - pixelColor.b) * "+ce(n)+",\n pixelColor.a\n );\n ")}},{kirsch:function(){return ve("kirsch-horizontal kirsch-vertical")},sobel:function(){return ve("sobel-horizontal sobel-vertical")},vintage:function(){return ve("brightness(0.15) saturation(-0.2) gamma(1.8)")}}),Pe=0;function De(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{width:"400px",height:"300px"};d(this,De),this.img=t.img,this.width=parseFloat(this.img.width||t.width||"400px"),this.height=parseFloat(this.img.height||t.height||"300px"),this.init()}var Be={GLCanvas:(y(De,[{key:"resize",value:function(){this.canvas.width=this.width,this.canvas.height=this.height,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.viewport()}},{key:"clear",value:function(){var t=this.gl;t.clearColor(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,3<arguments.length&&void 0!==arguments[3]?arguments[3]:0),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}},{key:"viewport",value:function(t,e,n,r){var i=this.gl;i.viewport(t||0,e||0,n||i.canvas.width,r||i.canvas.height)}},{key:"initCanvas",value:function(t,e){if(this.canvas=document.createElement("canvas"),this.gl=this.canvas.getContext("webgl2"),!this.gl)throw new Error("you need webgl2 support");this.program=this.createProgram(t,e),this.resize(),this.initBuffer()}},{key:"draw",value:function(){var t=this.gl;t.drawArrays(t[0<arguments.length&&void 0!==arguments[0]?arguments[0]:"TRIANGLES"],1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:6)}},{key:"triangles",value:function(){this.draw("TRIANGLES",0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:6)}},{key:"uniform2f",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.shift();(t=this.gl).uniform2f.apply(t,[this.locations[i]].concat(n))}},{key:"uniform1f",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.shift();(t=this.gl).uniform1f.apply(t,[this.locations[i]].concat(n))}},{key:"uniform1fv",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.shift();(t=this.gl).uniform1fv.apply(t,[this.locations[i]].concat(n))}},{key:"uniform1i",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.shift();(t=this.gl).uniform1i.apply(t,[this.locations[i]].concat(n))}},{key:"useProgram",value:function(){this.gl.useProgram(this.program)}},{key:"bindBuffer",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"STATIC_DRAW",r=this.gl;this.buffers[t]||(this.buffers[t]=r.createBuffer()),r.bindBuffer(r.ARRAY_BUFFER,this.buffers[t]),e&&r.bufferData(r.ARRAY_BUFFER,new Float32Array(e),r[n])}},{key:"enable",value:function(t){this.gl.enableVertexAttribArray(this.locations[t])}},{key:"location",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"attribute";"attribute"===e?this.locations[t]=this.gl.getAttribLocation(this.program,t):"uniform"===e&&(this.locations[t]=this.gl.getUniformLocation(this.program,t))}},{key:"a",value:function(t){return this.location(t)}},{key:"u",value:function(t){return this.location(t,"uniform")}},{key:"pointer",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"FLOAT",n=this.gl;n.vertexAttribPointer(this.locations[t],2<arguments.length&&void 0!==arguments[2]?arguments[2]:2,n[e],3<arguments.length&&void 0!==arguments[3]&&arguments[3],4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,5<arguments.length&&void 0!==arguments[5]?arguments[5]:0)}},{key:"bufferData",value:function(){var t=this.gl;t.bufferData(t.ARRAY_BUFFER,new Float32Array(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]),t.STATIC_DRAW)}},{key:"isPowerOf2",value:function(t){return 0==(t&t-1)}},{key:"bindTexture",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"RGBA",i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"RGBA",o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:"UNSIGNED_BYTE",a=this.gl;1!=arguments.length?(this.textures[t]||(this.textures[t]=a.createTexture()),this.textureIndex[t]=Pe++,a.bindTexture(a.TEXTURE_2D,this.textures[t]),this.setTextureParameter(),a.texImage2D(a.TEXTURE_2D,n,a[r],a[i],a[o],e.newImage||e)):a.bindTexture(a.TEXTURE_2D,this.textures[t])}},{key:"bindColorTexture",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:256,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:"RGBA",a=6<arguments.length&&void 0!==arguments[6]?arguments[6]:"RGBA",l=7<arguments.length&&void 0!==arguments[7]?arguments[7]:"UNSIGNED_BYTE",s=this.gl;this.textures[t]||(this.textures[t]=s.createTexture()),this.textureIndex[t]=Pe++,s.bindTexture(s.TEXTURE_2D,this.textures[t]),this.setTextureParameter(),s.texImage2D(s.TEXTURE_2D,i,s[o],n,r,0,s[a],s[l],new Uint8Array(e))}},{key:"bindEmptyTexture",value:function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"RGBA",o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:"RGBA",a=6<arguments.length&&void 0!==arguments[6]?arguments[6]:"UNSIGNED_BYTE",l=this.gl;this.textures[t]||(this.textures[t]=l.createTexture()),this.textureIndex[t]=Pe++,l.bindTexture(l.TEXTURE_2D,this.textures[t]),this.setTextureParameter();l.texImage2D(l.TEXTURE_2D,r,l[i],e,n,0,l[o],l[a],null)}},{key:"setTextureParameter",value:function(){var t=this.gl;t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)}},{key:"bindFrameBufferWithTexture",value:function(t,e,n,r){this.bindEmptyTexture(e,n,r),this.bindFrameBuffer(t,e)}},{key:"enumToString",value:function(t){var e,n=this.gl;if(0===t)return"NONE";for(e in n)if(n[e]===t)return e;return"0x"+t.toString(16)}},{key:"bindFrameBuffer",value:function(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=this.gl;1!==arguments.length?(this.framebuffers[t]||(this.framebuffers[t]=r.createFramebuffer()),r.bindFramebuffer(r.FRAMEBUFFER,this.framebuffers[t]),e=r.COLOR_ATTACHMENT0,r.framebufferTexture2D(r.FRAMEBUFFER,e,r.TEXTURE_2D,this.textures[n],0),r.checkFramebufferStatus(r.FRAMEBUFFER),r.FRAMEBUFFER_COMPLETE):r.bindFramebuffer(r.FRAMEBUFFER,null==t?null:this.framebuffers[t])}},{key:"bindVA",value:function(){var t=this.gl;this.vao||(this.vao=t.createVertexArray()),t.bindVertexArray(this.vao)}},{key:"bindAttr",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"STATIC_DRAW",r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2;this.bindBuffer(t,e,n),this.enable(t),this.pointer(t,"FLOAT",r)}},{key:"initBuffer",value:function(){var t=this.canvas,e=t.width,t=t.height;this.a("a_position"),this.a("a_texCoord"),this.u("u_resolution"),this.u("u_image"),this.u("u_flipY"),this.u("u_kernelSelect"),this.u("u_filterIndex"),this.u("u_kernel9[0]"),this.u("u_kernel9Weight"),this.u("u_kernel25[0]"),this.u("u_kernel25Weight"),this.u("u_kernel49[0]"),this.u("u_kernel49Weight"),this.u("u_kernel81[0]"),this.u("u_kernel81Weight"),this.bindVA(),this.bindAttr("a_position",[0,0,e,0,0,t,0,t,e,0,e,t],"STATIC_DRAW",2),this.bindAttr("a_texCoord",[0,0,1,0,0,1,0,1,1,0,1,1],"STATIC_DRAW",2),this.bindTexture("u_image",this.img),this.bindFrameBufferWithTexture("frame_buffer_0","img_texture_0",e,t),this.bindFrameBufferWithTexture("frame_buffer_1","img_texture_1",e,t)}},{key:"activeTexture",value:function(){var t=this.gl;t.activeTexture(t.TEXTURE0+(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0))}},{key:"drawFilter",value:function(){var n=this,t=this.gl;this.resize(),this.clear(),this.useProgram(),this.bindVA(),this.activeTexture(0),this.bindTexture("u_image"),this.uniform1i("u_image",0),this.uniform1f("u_flipY",1);var t=t.canvas,r=t.width,i=t.height;this.eachFilter(function(t,e){n.bindFrameBuffer("frame_buffer_"+e%2),n.uniform2f("u_resolution",r,i),n.viewport(0,0,r,i),n.effectFilter(t),n.bindTexture("img_texture_"+e%2)}),this.uniform1f("u_flipY",-1),this.bindFrameBuffer(null),this.uniform2f("u_resolution",r,i),this.viewport(0,0,r,i),this.clear(),this.effectFilter("normal")}},{key:"effectFilter",value:function(t){"convolution"==(t="string"==typeof t?(Ie[t]||Ie.normal).call(Ie):t).type?(this.uniform1f("u_kernelSelect",t.length),this.uniform1f("u_filterIndex",-1),this.uniform1fv("u_kernel"+t.length+"[0]",t.content),this.uniform1f("u_kernel"+t.length+"Weight",this.computeKernelWeight(t.content))):(this.uniform1f("u_kernelSelect",-1),this.uniform1f("u_filterIndex",t.index)),this.triangles(0,6)}},{key:"computeKernelWeight",value:function(t){t=t.reduce(function(t,e){return t+e});return t<=0?1:t}},{key:"createProgram",value:function(t,e){var n=this.gl,r=n.createProgram();if(this.vertexShader=this.createVertexShader(t),this.fragmentShader=this.createFragmentShader(e),n.attachShader(r,this.vertexShader),n.attachShader(r,this.fragmentShader),n.linkProgram(r),n.getProgramParameter(r,n.LINK_STATUS))return r;console.error(n.getProgramInfoLog(r)),n.deleteProgram(r)}},{key:"createShader",value:function(t,e){var n=this.gl,t=n.createShader(t);if(n.shaderSource(t,e),n.compileShader(t),n.getShaderParameter(t,n.COMPILE_STATUS))return t;console.error(n.getShaderInfoLog(t)),n.deleteShader(t)}},{key:"createVertexShader",value:function(t){var e=this.gl;return this.createShader(e.VERTEX_SHADER,t)}},{key:"createFragmentShader",value:function(t){var e=this.gl;return this.createShader(e.FRAGMENT_SHADER,t)}},{key:"eachFilter",value:function(t){this.filterList.forEach(t)}},{key:"init",value:function(){this.locations={},this.buffers={},this.framebuffers={},this.textures={},this.textureIndex={},this.hasTexParameter={}}},{key:"destroy",value:function(){var t=this.gl;this.init(),t.deleteProgram(this.program)}},{key:"filter",value:function(t,e){var n,r;this.filterList=t,this.initCanvas("#version 300 es \n\n in vec2 a_position;\n in vec2 a_texCoord; \n\n uniform vec2 u_resolution;\n uniform float u_flipY;\n\n out vec2 v_texCoord; \n\n void main() {\n vec2 zeroToOne = a_position / u_resolution;\n\n vec2 zeroToTwo = zeroToOne * 2.0;\n\n vec2 clipSpace = zeroToTwo - 1.0;\n\n gl_Position = vec4(clipSpace * vec2(1, u_flipY), 0, 1);\n\n v_texCoord = a_texCoord;\n\n }\n ",(n=this.filterList,t=n.filter(function(t){return"shader"==t.type}).map(function(t){return t.content}).join("\n\n"),r={9:!0},n.filter(function(t){return"convolution"==t.type}).forEach(function(t){r[t.length]=!0}),"#version 300 es\n\n precision highp int;\n precision mediump float;\n \n uniform sampler2D u_image;\n\n // 3 is 3x3 matrix kernel \n uniform float u_kernelSelect;\n uniform float u_filterIndex;\n\n uniform float u_kernel9[9];\n uniform float u_kernel9Weight;\n uniform float u_kernel25[25];\n uniform float u_kernel25Weight;\n uniform float u_kernel49[49];\n uniform float u_kernel49Weight;\n uniform float u_kernel81[81];\n uniform float u_kernel81Weight; \n\n in vec2 v_texCoord;\n \n out vec4 outColor;\n\n float random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n } \n\n // \n vec3 rgb2hsv(vec3 c)\n {\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\n vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\n\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n }\n\n vec3 hsv2rgb(vec3 c)\n {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n }\n \n void main() {\n vec4 pixelColor = texture(u_image, v_texCoord);\n vec2 onePixel = vec2(1) / vec2(textureSize(u_image, 0)); \n\n "+t+"\n\n "+Object.keys(r).map(function(t){return pe(+t)}).join("\n")+"\n\n }")),this.drawFilter(),"function"==typeof e&&e(this)}}]),De)},Re={filter:function(t,e,n,r){var i=new Be.GLCanvas({width:r.width||t.width,height:r.height||t.height,img:t});i.filter(function n(t){var e=[];"string"==typeof t?e=ne(t):Array.isArray(t)&&(e=t);var r=[];e.forEach(function(t){var e=t.arr[0];Ie[e]&&("convolution"==(t=Ue(t)).type||"shader"==t.type?r.push(t):t.forEach(function(t){r=r.concat(n(t))}))});return r}(e),function(){"function"==typeof n&&n(i)})}};function Ue(t){var e=t.arr[0],e=Ie[e],t=t.arr;return t.shift(),e.apply(this,t)}var Fe=_({},Be,Re);function je(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{frameTimer:"full"},i=new ft(t);i.loadImage(function(){i.toArray(e,function(t){"function"==typeof n&&n(t)},r)})}var He=_({},t,e,it,B,J,z,N,Z,m,q,{palette:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:6,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"hex";return(t=t.length>e?ut(t,e):t).map(function(t){return h(t,n)})},ImageToCanvas:function(t,e,n){je(t,e,n,Object.assign({returnTo:"canvas"},3<arguments.length&&void 0!==arguments[3]?arguments[3]:{frameTimer:"full"}))},ImageToHistogram:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{width:200,height:100},r=new ft(t);r.loadImage(function(){ht.createHistogram(n.width||200,n.height||100,r.toHistogram(n),function(t){"function"==typeof e&&e(t.toDataURL("image/png"))},n)})},ImageToRGB:function(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];r?(e=new ft(t,n)).loadImage(function(){"function"==typeof r&&r(e.toRGB())}):(e=new ft(t)).loadImage(function(){"function"==typeof n&&n(e.toRGB())})},ImageToURL:je,GLToCanvas:function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},i=new ft(t);i.load(function(){Fe.filter(i.newImage,e,function(t){"function"==typeof n&&n(t)},r)})},histogram:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=new ft(t);r.loadImage(function(){"function"==typeof e&&e(r.toHistogram(n))})},histogramToPoints:function(t){for(var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.2,n=[],r=0;r<t.length;r++){var i,o,a,l=t[r];0!=r?r!=t.length-1?(a=t[r-1],(o=t[r+1])[1],a[1],o[0],a[0],i=[a[0]+(o[0]-a[0])*e,a[1]+(o[1]-a[1])*e],i=[[].concat(O(a)),[].concat(i)],a=Math.sqrt(Math.pow(l[0]-a[0],2)+Math.pow(l[1]-a[1],2))/Math.sqrt(Math.pow(o[0]-l[0],2)+Math.pow(o[1]-l[1],2)),o=i[0][0]+(i[1][0]-i[0][0])*a,a=i[0][1]+(i[1][1]-i[0][1])*a,i[0][0]+=l[0]-o,i[0][1]+=l[1]-a,i[1][0]+=l[0]-o,i[1][1]+=l[1]-a,n[r]=i):n[r]=[]:n[r]=[]}return n}}),Le=[{rgb:"#ff0000",start:0},{rgb:"#ffff00",start:.17},{rgb:"#00ff00",start:.33},{rgb:"#00ffff",start:.5},{rgb:"#0000ff",start:.67},{rgb:"#ff00ff",start:.83},{rgb:"#ff0000",start:1}];!function(){for(var t=0,e=Le.length;t<e;t++){var n=Le[t],r=He.parse(n.rgb);n.r=r.r,n.g=r.g,n.b=r.b}}();var Ve={colors:Le,checkHueColor:function(t){for(var e,n,r=0;r<Le.length;r++)if(Le[r].start>=t){e=Le[r-1],n=Le[r];break}return e&&n?He.interpolateRGB(e,n,(t-e.start)/(n.start-e.start)):Le[0].rgb}},Z=_({},Dt,x),m={Color:He,HueColor:Ve,ColorNames:f,ImageFilter:Z,GL:Fe,Canvas:ht,ImageLoader:ft},ze=(He.color,0),Ne=[],Ge=(y(Xe,[{key:"attr",value:function(t,e){return 1==arguments.length?this.el.getAttribute(t):(this.el.setAttribute(t,e),this)}},{key:"closest",value:function(t){for(var e=this,n=!1;!(n=e.hasClass(t));){if(!e.el.parentNode)return null;e=new Xe(e.el.parentNode)}return n?e:null}},{key:"checked",value:function(){return this.el.checked}},{key:"removeClass",value:function(t){return this.el.className=(" "+this.el.className+" ").replace(" "+t+" "," ").trim(),this}},{key:"hasClass",value:function(t){return!!this.el.className&&-1<(" "+this.el.className+" ").indexOf(" "+t+" ")}},{key:"addClass",value:function(t){return this.hasClass(t)||(this.el.className=this.el.className+" "+t),this}},{key:"toggleClass",value:function(t){this.hasClass(t)?this.removeClass(t):this.addClass(t)}},{key:"html",value:function(e){try{"string"==typeof e?this.el.innerHTML=e:this.empty().append(e)}catch(t){console.log(e)}return this}},{key:"find",value:function(t){return this.el.querySelector(t)}},{key:"$",value:function(t){return new Xe(this.find(t))}},{key:"findAll",value:function(t){return this.el.querySelectorAll(t)}},{key:"$$",value:function(t){return[].concat(O(this.findAll(t))).map(function(t){return new Xe(t)})}},{key:"empty",value:function(){return this.html("")}},{key:"append",value:function(t){return"string"==typeof t?this.el.appendChild(document.createTextNode(t)):this.el.appendChild(t.el||t),this}},{key:"appendTo",value:function(t){return(t.el||t).appendChild(this.el),this}},{key:"remove",value:function(){return this.el.parentNode&&this.el.parentNode.removeChild(this.el),this}},{key:"text",value:function(){return this.el.textContent}},{key:"css",value:function(t,e){var n=this;if(2==arguments.length)this.el.style[t]=e;else if(1==arguments.length){if("string"==typeof t)return getComputedStyle(this.el)[t];var r=t||{};Object.keys(r).forEach(function(t){n.el.style[t]=r[t]})}return this}},{key:"cssFloat",value:function(t){return parseFloat(this.css(t))}},{key:"cssInt",value:function(t){return parseInt(this.css(t))}},{key:"offset",value:function(){var t=this.el.getBoundingClientRect();return{top:t.top+Xe.getScrollTop(),left:t.left+Xe.getScrollLeft()}}},{key:"rect",value:function(){return this.el.getBoundingClientRect()}},{key:"position",value:function(){return this.el.style.top?{top:parseFloat(this.css("top")),left:parseFloat(this.css("left"))}:this.el.getBoundingClientRect()}},{key:"size",value:function(){return[this.width(),this.height()]}},{key:"width",value:function(){return this.el.offsetWidth||this.el.getBoundingClientRect().width}},{key:"contentWidth",value:function(){return this.width()-this.cssFloat("padding-left")-this.cssFloat("padding-right")}},{key:"height",value:function(){return this.el.offsetHeight||this.el.getBoundingClientRect().height}},{key:"contentHeight",value:function(){return this.height()-this.cssFloat("padding-top")-this.cssFloat("padding-bottom")}},{key:"dataKey",value:function(t){return this.uniqId+"."+t}},{key:"data",value:function(t,e){if(2==arguments.length)return Ne[this.dataKey(t)]=e,this;if(1==arguments.length)return Ne[this.dataKey(t)];var t=Object.keys(Ne),n=this.uniqId+".";return t.filter(function(t){return 0==t.indexOf(n)}).map(function(t){return Ne[t]})}},{key:"val",value:function(t){return 0==arguments.length?this.el.value:(1==arguments.length&&(this.el.value=t),this)}},{key:"int",value:function(){return parseInt(this.val(),10)}},{key:"float",value:function(){return parseFloat(this.val())}},{key:"show",value:function(){return this.css("display","block")}},{key:"hide",value:function(){return this.css("display","none")}},{key:"toggle",value:function(){return"none"==this.css("display")?this.show():this.hide()}},{key:"scrollTop",value:function(){return this.el===document.body?Xe.getScrollTop():this.el.scrollTop}},{key:"scrollLeft",value:function(){return this.el===document.body?Xe.getScrollLeft():this.el.scrollLeft}},{key:"on",value:function(t,e,n,r){return this.el.addEventListener(t,e,n,r),this}},{key:"off",value:function(t,e){return this.el.removeEventListener(t,e),this}},{key:"getElement",value:function(){return this.el}},{key:"createChild",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},n=new Xe(t,e,n);return n.css(r),this.append(n),n}},{key:"firstChild",value:function(){return new Xe(this.el.firstElementChild)}},{key:"replace",value:function(t,e){return this.el.replaceChild(e,t),this}}],[{key:"getScrollTop",value:function(){return Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop)}},{key:"getScrollLeft",value:function(){return Math.max(window.pageXOffset,document.documentElement.scrollLeft,document.body.scrollLeft)}}]),Xe);function Xe(t,e,n){if(d(this,Xe),"string"!=typeof t)this.el=t;else{var r,i=document.createElement(t);for(r in this.uniqId=ze++,e&&(i.className=e),n=n||{})i.setAttribute(r,n[r]);this.el=i}}y(Ye,[{key:"initialize",value:function(){var e=this;this.filterProps().forEach(function(t){e.$store.action(t,e)})}},{key:"filterProps",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"/";return Object.getOwnPropertyNames(this.__proto__).filter(function(t){return t.startsWith(e)})}}]),q=Ye;function Ye(t){d(this,Ye),this.$store=t,this.initialize()}var We=(k(qe,q),y(qe,[{key:"initialize",value:function(){$(qe.prototype.__proto__||Object.getPrototypeOf(qe.prototype),"initialize",this).call(this),this.$store.colorSetsList=[{name:"Material",colors:["#F44336","#E91E63","#9C27B0","#673AB7","#3F51B5","#2196F3","#03A9F4","#00BCD4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548","#9E9E9E","#607D8B"]},{name:"Custom",edit:!0,colors:[]},{name:"Color Scale",scale:["red","yellow","black"],count:5}],this.$store.currentColorSets={}}},{key:"/list",value:function(t){return Array.isArray(t.userList)&&t.userList.length?t.userList:t.colorSetsList}},{key:"/setUserPalette",value:function(t,e){t.userList=e,t.dispatch("/resetUserPalette"),t.dispatch("/setCurrentColorSets")}},{key:"/resetUserPalette",value:function(r){r.userList&&r.userList.length&&(r.userList=r.userList.map(function(t,e){var n;return"function"==typeof t.colors&&(n=t.colors,t.colors=n(r),t._colors=n),Object.assign({name:"color-"+e,colors:[]},t)}),r.emit("changeUserList"))}},{key:"/setCurrentColorSets",value:function(t,e){var n=t.dispatch("/list");t.currentColorSets=void 0===e?n[0]:"number"==typeof e?n[e]:n.filter(function(t){return t.name==e})[0],t.emit("changeCurrentColorSets")}},{key:"/getCurrentColorSets",value:function(t){return t.currentColorSets}},{key:"/addCurrentColor",value:function(t,e){Array.isArray(t.currentColorSets.colors)&&(t.currentColorSets.colors.push(e),t.emit("changeCurrentColorSets"))}},{key:"/setCurrentColorAll",value:function(t){t.currentColorSets.colors=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],t.emit("changeCurrentColorSets")}},{key:"/removeCurrentColor",value:function(t,e){t.currentColorSets.colors[e]&&(t.currentColorSets.colors.splice(e,1),t.emit("changeCurrentColorSets"))}},{key:"/removeCurrentColorToTheRight",value:function(t,e){t.currentColorSets.colors[e]&&(t.currentColorSets.colors.splice(e,Number.MAX_VALUE),t.emit("changeCurrentColorSets"))}},{key:"/clearPalette",value:function(t){t.currentColorSets.colors&&(t.currentColorSets.colors=[],t.emit("changeCurrentColorSets"))}},{key:"/getCurrentColors",value:function(t){return t.dispatch("/getColors",t.currentColorSets)}},{key:"/getColors",value:function(t,e){return e.scale?He.scale(e.scale,e.count):e.colors||[]}},{key:"/getColorSetsList",value:function(e){return e.dispatch("/list").map(function(t){return{name:t.name,edit:t.edit,colors:e.dispatch("/getColors",t)}})}}]),qe);function qe(){return d(this,qe),C(this,(qe.__proto__||Object.getPrototypeOf(qe)).apply(this,arguments))}var Ke={addEvent:function(t,e,n,r){t&&t.addEventListener(e,n,r)},removeEvent:function(t,e,n){t&&t.removeEventListener(e,n)},pos:function(t){return t.touches&&t.touches[0]?t.touches[0]:t},posXY:function(t){t=this.pos(t);return{x:t.pageX,y:t.pageY}}},Ze=(y(Je,[{key:"set",value:function(t,e){this.settingObj[t]=e||(2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0)}},{key:"init",value:function(t){if(!this.has(t)){var e=t.split("."),n=this.masterObj.refs[e[0]]||this.masterObj[e[0]]||this.masterObj,e=e.pop();if(n[e]){for(var r=arguments.length,i=Array(1<r?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n=n[e].apply(n,i);this.set(t,n)}}}},{key:"get",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";return this.init(t,e),this.settingObj[t]||e}},{key:"has",value:function(t){return!!this.settingObj[t]}}]),Je);function Je(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};d(this,Je),this.masterObj=t,this.settingObj=e}var Qe=/^(click|mouse(down|up|move|enter|leave)|touch(start|move|end)|key(down|up|press)|contextmenu|change|input)/gi,tn=/^load (.*)/gi,en=["Control","Shift","Alt","Meta"],x=(y(nn,[{key:"newChildComponents",value:function(){var n=this;Object.keys(this.childComponents).forEach(function(t){var e=n.childComponents[t];n[t]=new e(n)})}},{key:"render",value:function(){this.$el=this.parseTemplate(this.template()),this.refs.$el=this.$el,this.parseTarget(),this.load(),this.afterRender()}},{key:"afterRender",value:function(){}},{key:"components",value:function(){return{}}},{key:"parseTemplate",value:function(t){var n=this,e=new Ge("div").html(t).firstChild(),t=e.findAll("[ref]");return[].concat(O(t)).forEach(function(t){var e=t.getAttribute("ref");n.refs[e]=new Ge(t)}),e}},{key:"parseTarget",value:function(){var r=this,t=this.$el.findAll("[target]");[].concat(O(t)).forEach(function(t){var e=t.getAttribute("target"),n=t.getAttribute("ref")||e,e=new r.childComponents[e](r);r[n]=e,r.refs[n]=e.$el,e&&(e.render(),new Ge(t.parentNode).replace(t,e.$el.el))})}},{key:"load",value:function(){var n=this;this.filterProps(tn).forEach(function(t){var e=t.split("load ")[1];n.refs[e]&&n.refs[e].html(n.parseTemplate(n[t].call(n)))})}},{key:"template",value:function(){return"<div></div>"}},{key:"initialize",value:function(){}},{key:"initializeEvent",value:function(){var e=this;this.initializeEventMachin(),Object.keys(this.childComponents).forEach(function(t){e[t]&&e[t].initializeEvent()})}},{key:"destroy",value:function(){var e=this;this.destroyEventMachin(),Object.keys(this.childComponents).forEach(function(t){e[t]&&e[t].destroy()})}},{key:"destroyEventMachin",value:function(){this.removeEventAll()}},{key:"initializeEventMachin",value:function(){this.filterProps(Qe).forEach(this.parseEvent.bind(this))}},{key:"collectProps",value:function(){if(!this.collapsedProps){for(var t=this.__proto__,e=[];e.push.apply(e,O(Object.getOwnPropertyNames(t))),t=t.__proto__;);this.collapsedProps=e}return this.collapsedProps}},{key:"filterProps",value:function(e){return this.collectProps().filter(function(t){return t.match(e)})}},{key:"parseEvent",value:function(t){var e=t.split(" ");this.bindingEvent(e,this[t].bind(this))}},{key:"getDefaultDomElement",value:function(t){var e=void 0;return(e=t?this.refs[t]||this[t]||window[t]:this.el||this.$el||this.$root)instanceof Ge?e.getElement():e}},{key:"getDefaultEventObject",value:function(t){var e=this,n=t.split("."),r=n.shift(),i=n.includes("Control"),o=n.includes("Shift"),a=n.includes("Alt"),t=n.includes("Meta"),l=(n=n.filter(function(t){return!1===en.includes(t)})).filter(function(t){return!!e[t]});return{eventName:r,isControl:i,isShift:o,isAlt:a,isMeta:t,codes:n=n.filter(function(t){return!1===l.includes(t)}).map(function(t){return t.toLowerCase()}),checkMethodList:l}}},{key:"bindingEvent",value:function(t,e){var n=(r=t,Array.isArray(r)?r:Array.from(r)),t=n[0],r=n[1],n=n.slice(2),r=this.getDefaultDomElement(r),t=this.getDefaultEventObject(t);t.dom=r,t.delegate=n.join(" "),this.addEvent(t,e)}},{key:"matchPath",value:function(t,e){return t?t.matches(e)?t:this.matchPath(t.parentElement,e):null}},{key:"getBindings",value:function(){return this._bindings||this.initBindings(),this._bindings}},{key:"addBinding",value:function(t){this.getBindings().push(t)}},{key:"initBindings",value:function(){this._bindings=[]}},{key:"checkEventType",value:function(e,t){var n=this,r=!t.isControl||e.ctrlKey,i=!t.isShift||e.shiftKey,o=!t.isAlt||e.altKey,a=!t.isMeta||e.metaKey,l=!0;t.codes.length&&(l=t.codes.includes(e.code.toLowerCase())||t.codes.includes(e.key.toLowerCase()));var s=!0;return t.checkMethodList.length&&(s=t.checkMethodList.every(function(t){return n[t].call(n,e)})),r&&o&&i&&a&&l&&s}},{key:"makeCallback",value:function(n,r){var i=this;return n.delegate?function(t){if(t.xy=Ke.posXY(t),i.checkEventType(t,n)){var e=i.matchPath(t.target||t.srcElement,n.delegate);if(e)return t.delegateTarget=e,t.$delegateTarget=new Ge(e),r(t)}}:function(t){if(t.xy=Ke.posXY(t),i.checkEventType(t,n))return r(t)}}},{key:"addEvent",value:function(t,e){t.callback=this.makeCallback(t,e),this.addBinding(t);e=!0;"touchstart"===t.eventName&&(e={passive:!0}),Ke.addEvent(t.dom,t.eventName,t.callback,e)}},{key:"removeEventAll",value:function(){var e=this;this.getBindings().forEach(function(t){e.removeEvent(t)}),this.initBindings()}},{key:"removeEvent",value:function(t){var e=t.eventName,n=t.dom,t=t.callback;Ke.removeEvent(n,e,t)}}]),nn);function nn(){d(this,nn),this.state=new Ze(this),this.refs={},this.childComponents=this.components()}var rn=/^@/,Z=(k(on,x),y(on,[{key:"initializeStoreEvent",value:function(){var n=this;this.storeEvents={},this.filterProps(rn).forEach(function(t){var e=t.split("@");e.shift();e=e.join("@");n.storeEvents[e]=n[t].bind(n),n.$store.on(e,n.storeEvents[e])})}},{key:"destoryStoreEvent",value:function(){var e=this;Object.keys(this.storeEvents).forEach(function(t){e.$store.off(t,e.storeEvents[t])})}}]),on);function on(t){d(this,on);var e=C(this,(on.__proto__||Object.getPrototypeOf(on)).call(this,t));return e.opt=t||{},t&&t.$store&&(e.$store=t.$store),e.initialize(),e.initializeStoreEvent(),e}var an=(k(ln,q),y(ln,[{key:"initialize",value:function(){$(ln.prototype.__proto__||Object.getPrototypeOf(ln.prototype),"initialize",this).call(this),this.$store.rgb={},this.$store.hsl={},this.$store.hsv={},this.$store.alpha=1,this.$store.format="hex"}},{key:"/changeFormat",value:function(t,e){t.format=e,t.emit("changeFormat")}},{key:"/initColor",value:function(t,e,n){t.dispatch("/changeColor",e,n,!0),t.emit("initColor")}},{key:"/changeColor",value:function(t,e,n,r){(e="string"==typeof(e=e||"#FF0000")?He.parse(e):e).source=e.source||n,t.alpha=void 0===(n=e.a)||null==n?t.alpha:e.a,t.format="hsv"!=e.type&&e.type||t.format,"hsl"==e.type?(t.hsl=Object.assign(t.hsl,e),t.rgb=He.HSLtoRGB(t.hsl),t.hsv=He.HSLtoHSV(e)):"hex"==e.type||"rgb"==e.type?(t.rgb=Object.assign(t.rgb,e),t.hsl=He.RGBtoHSL(t.rgb),t.hsv=He.RGBtoHSV(e)):"hsv"==e.type&&(t.hsv=Object.assign(t.hsv,e),t.rgb=He.HSVtoRGB(t.hsv),t.hsl=He.HSVtoHSL(t.hsv)),r||t.emit("changeColor",e.source)}},{key:"/getHueColor",value:function(t){return Ve.checkHueColor(t.hsv.h/360)}},{key:"/toString",value:function(t,e){var n=t[e=e||t.format]||t.rgb;return He.format(_({},n,{a:t.alpha}),e)}},{key:"/toColor",value:function(t,e){return"rgb"==(e=e||t.format)?t.dispatch("/toRGB"):"hsl"==e?t.dispatch("/toHSL"):"hex"==e?t.dispatch("/toHEX"):t.dispatch("/toString",e)}},{key:"/toRGB",value:function(t){return t.dispatch("/toString","rgb")}},{key:"/toHSL",value:function(t){return t.dispatch("/toString","hsl")}},{key:"/toHEX",value:function(t){return t.dispatch("/toString","hex").toUpperCase()}}]),ln);function ln(){return d(this,ln),C(this,(ln.__proto__||Object.getPrototypeOf(ln)).apply(this,arguments))}var sn=(y(un,[{key:"initialize",value:function(){this.initializeModule()}},{key:"initializeModule",value:function(){var e=this;this.modules.forEach(function(t){new t(e)})}},{key:"action",value:function(t,e){this.actions[t]={context:e,callback:e[t]}}},{key:"dispatch",value:function(t){var e=[].concat(Array.prototype.slice.call(arguments)),t=e.shift(),t=this.actions[t];if(t)return t.callback.apply(t.context,[this].concat(O(e)))}},{key:"module",value:function(t){}},{key:"on",value:function(t,e){this.callbacks.push({event:t,callback:e})}},{key:"off",value:function(e,n){0==arguments.length?this.callbacks=[]:1==arguments.length?this.callbacks=this.callbacks.filter(function(t){return t.event!=e}):2==arguments.length&&(this.callbacks=this.callbacks.filter(function(t){return t.event!=e&&t.callback!=n}))}},{key:"emit",value:function(){var e=[].concat(Array.prototype.slice.call(arguments)),n=e.shift();this.callbacks.filter(function(t){return t.event==n}).forEach(function(t){t&&"function"==typeof t.callback&&t.callback.apply(t,O(e))})}}]),un);function un(t){d(this,un),this.callbacks=[],this.actions=[],this.modules=t.modules||[],this.initialize()}k(cn,Z),y(cn,[{key:"initialize",value:function(){var t=this;this.$body=null,this.$root=null,this.$store=new sn({modules:[an,We]}),this.callbackChange=function(){t.callbackColorValue()},this.callbackLastUpdate=function(){t.callbackLastUpdateColorValue()},this.colorpickerShowCallback=function(){},this.colorpickerHideCallback=function(){},this.colorpickerLastUpdateCallback=function(){},this.$body=new Ge(this.getContainer()),this.$root=new Ge("div",this.opt.containerClass),"inline"==this.opt.position&&this.$body.append(this.$root),this.opt.type&&this.$root.addClass(this.opt.type),this.opt.hideInformation&&this.$root.addClass("hide-information"),this.opt.hideColorsets&&this.$root.addClass("hide-colorsets"),this.$arrow=new Ge("div","arrow"),this.$root.append(this.$arrow),this.$store.dispatch("/setUserPalette",this.opt.colorSets),this.render(),this.$root.append(this.$el),this.initColorWithoutChangeEvent(this.opt.color),this.initializeEvent()}},{key:"initColorWithoutChangeEvent",value:function(t){this.$store.dispatch("/initColor",t)}},{key:"show",value:function(t,e,n,r,i){this.colorpickerShowCallback=n,this.colorpickerHideCallback=r,this.colorpickerLastUpdateCallback=i,this.$root.css(this.getInitalizePosition()).show(),this.isColorPickerShow=!0,this.isShortCut=t.isShortCut||!1,this.outputFormat=t.outputFormat,this.hideDelay=+(void 0===t.hideDelay?2e3:t.hideDelay),0<this.hideDelay&&this.setHideDelay(this.hideDelay),this.$root.appendTo(this.$body),this.definePosition(t),this.initColorWithoutChangeEvent(e)}},{key:"initColor",value:function(t,e){this.$store.dispatch("/changeColor",t,e)}},{key:"hide",value:function(){this.isColorPickerShow&&(this.$root.hide(),this.$root.remove(),this.isColorPickerShow=!1,this.callbackHideColorValue())}},{key:"setColorsInPalette",value:function(){this.$store.dispatch("/setCurrentColorAll",0<arguments.length&&void 0!==arguments[0]?arguments[0]:[])}},{key:"setUserPalette",value:function(){this.$store.dispatch("/setUserPalette",0<arguments.length&&void 0!==arguments[0]?arguments[0]:[])}},{key:"getOption",value:function(t){return this.opt[t]}},{key:"setOption",value:function(t,e){this.opt[t]=e}},{key:"isType",value:function(t){return this.getOption("type")==t}},{key:"isPaletteType",value:function(){return this.isType("palette")}},{key:"isSketchType",value:function(){return this.isType("sketch")}},{key:"getContainer",value:function(){return this.opt.container||document.body}},{key:"getColor",value:function(t){return this.$store.dispatch("/toColor",t)}},{key:"definePositionForArrow",value:function(t,e,n){}},{key:"definePosition",value:function(t){var e=this.$root.width(),n=this.$root.height(),r=t.left-this.$body.scrollLeft();e+r>window.innerWidth&&(r-=e+r-window.innerWidth),r<0&&(r=0);e=t.top-this.$body.scrollTop(),t=t.bottom-this.$body.scrollTop(),e=n/2+t>window.innerHeight?e-n+this.$body.scrollTop():t+this.$body.scrollTop()+1;this.$root.css({left:r+"px",top:(e=e<0?0:e)+"px"})}},{key:"getInitalizePosition",value:function(){return"inline"==this.opt.position?{position:"relative",left:"auto",top:"auto",display:"inline-block"}:{position:"absolute",left:"-10000px",top:"-10000px"}}},{key:"isAbsolute",value:function(){return"inline"!==this.opt.position}},{key:"mouseup.isAbsolute document",value:function(t){this.__isMouseDown=!1,this.checkInHtml(t.target)||(0==this.checkColorPickerClass(t.target)?this.hide():this.__isMouseIn||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay)))}},{key:"keyup.isAbsolute.escape $root",value:function(t){this.hide()}},{key:"mouseover.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mousemove.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mouseenter.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker),this.__isMouseIn=!0}},{key:"mouseleave.isAbsolute $root",value:function(t){this.__isMouseIn=!1,this.__isMouseDown||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay))}},{key:"mousedown.isAbsolute $root",value:function(t){this.__isMouseDown=!0}},{key:"setHideDelay",value:function(t){this.delayTime=t||0}},{key:"runHideDelay",value:function(){this.isColorPickerShow&&this.setHideDelay()}},{key:"callbackColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onChange&&this.opt.onChange.call(this,t),"function"==typeof this.colorpickerShowCallback&&this.colorpickerShowCallback(t)}},{key:"callbackLastUpdateColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onLastUpdate&&this.opt.onLastUpdate.call(this,t),"function"==typeof this.colorpickerLastUpdateCallback&&this.colorpickerLastUpdateCallback(t)}},{key:"callbackHideColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onHide&&this.opt.onHide.call(this,t),"function"==typeof this.colorpickerHideCallback&&this.colorpickerHideCallback(t)}},{key:"getCurrentColor",value:function(){return this.$store.dispatch("/toColor",this.outputFormat)}},{key:"checkColorPickerClass",value:function(t){var e=new Ge(t).closest("ace-colorview");return!(!new Ge(t).closest("ace-colorpicker")&&!e)}},{key:"checkInHtml",value:function(t){return"HTML"==t.nodeName}},{key:"initializeStoreEvent",value:function(){$(cn.prototype.__proto__||Object.getPrototypeOf(cn.prototype),"initializeStoreEvent",this).call(this),this.$store.on("changeColor",this.callbackChange),this.$store.on("lastUpdateColor",this.callbackLastUpdate),this.$store.on("changeFormat",this.callbackChange)}},{key:"destroy",value:function(){$(cn.prototype.__proto__||Object.getPrototypeOf(cn.prototype),"destroy",this).call(this),this.$store.off("changeColor",this.callbackChange),this.$store.off("lastUpdateColor",this.callbackLastUpdate),this.$store.off("changeFormat",this.callbackChange),this.callbackChange=void 0,this.callbackLastUpdate=void 0,this.colorpickerShowCallback=void 0,this.colorpickerHideCallback=void 0}}]),x=cn;function cn(t){d(this,cn);t=C(this,(cn.__proto__||Object.getPrototypeOf(cn)).call(this,t));return t.isColorPickerShow=!1,t.isShortCut=!1,t.hideDelay=+(void 0===t.opt.hideDeplay?2e3:t.opt.hideDelay),t.timerCloseColorPicker,t.autoHide=t.opt.autoHide||!0,t.outputFormat=t.opt.outputFormat,t.$checkColorPickerClass=t.checkColorPickerClass.bind(t),t}k(hn,Z),y(hn,[{key:"refresh",value:function(){}},{key:"refreshColorUI",value:function(t){}},{key:"changeColor",value:function(t){this.$store.dispatch("/changeColor",Object.assign({source:this.source},t||{}))}},{key:"mouseup document",value:function(t){this.onDragEnd(t)}},{key:"mousemove document",value:function(t){this.onDragMove(t)}},{key:"mousedown $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"mousedown $container",value:function(t){this.isDown=!0,this.onDragStart(t)}},{key:"touchend document",value:function(t){this.onDragEnd(t)}},{key:"touchmove document",value:function(t){this.onDragMove(t)}},{key:"touchstart $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"touchstart $container",value:function(t){this.onDragStart(t)}},{key:"onDragStart",value:function(t){this.isDown=!0,this.refreshColorUI(t)}},{key:"onDragMove",value:function(t){this.isDown&&this.refreshColorUI(t)}},{key:"onDragEnd",value:function(t){this.isDown&&(this.$store.emit("lastUpdateColor"),this.isDown=!1)}},{key:"@changeColor",value:function(t){this.source!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),q=hn;function hn(t){d(this,hn);t=C(this,(hn.__proto__||Object.getPrototypeOf(hn)).call(this,t));return t.source="base-box",t}k(fn,q),y(fn,[{key:"getMinMaxPosition",value:function(){var t=this.getMinPosition(),e=this.getMaxDist();return{min:t,max:t+e,width:e}}},{key:"getCurrent",value:function(t){return min+this.getMaxDist()*t}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().left}},{key:"getMaxDist",value:function(){return this.state.get("$container.width")}},{key:"getDist",value:function(t){var e=this.getMinMaxPosition(),n=e.min,e=e.max,n=t<n?0:e<t?100:(t-n)/(e-n)*100;return n}},{key:"getCaculatedDist",value:function(t){t=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.maxValue);return this.getDist(t)}},{key:"getDefaultValue",value:function(){return 0}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({left:t+"px"})}},{key:"getMousePosition",value:function(t){return Ke.pos(t).pageX}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.minValue?this.refs.$bar.addClass("first").removeClass("last"):(t>=this.maxValue?this.refs.$bar.addClass("last"):this.refs.$bar.removeClass("last")).removeClass("first"),this.setMousePosition(this.getMaxDist()*((t||0)/this.maxValue))}}]),q=fn;function fn(t){d(this,fn);t=C(this,(fn.__proto__||Object.getPrototypeOf(fn)).call(this,t));return t.minValue=0,t.maxValue=1,t.source="base-slider",t}var vn=(k(gn,q),y(gn,[{key:"template",value:function(){return'\n <div class="value">\n <div ref="$container" class="value-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$container.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){$(gn.prototype.__proto__||Object.getPrototypeOf(gn.prototype),"refresh",this).call(this),this.setBackgroundColor()}},{key:"getDefaultValue",value:function(){return this.$store.hsv.v}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({type:"hsv",v:t/100*this.maxValue})}}]),gn);function gn(t){d(this,gn);t=C(this,(gn.__proto__||Object.getPrototypeOf(gn)).call(this,t));return t.minValue=0,t.maxValue=1,t.source="value-control",t}var dn=(k(pn,q),y(pn,[{key:"template",value:function(){return'\n <div class="opacity">\n <div ref="$container" class="opacity-container">\n <div ref="$colorbar" class="color-bar"></div>\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){$(pn.prototype.__proto__||Object.getPrototypeOf(pn.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=He.format(t,"rgb");t.a=1;t=He.format(t,"rgb");this.setOpacityColorBarBackground(e,t)}},{key:"setOpacityColorBarBackground",value:function(t,e){this.refs.$colorbar.css("background","linear-gradient(to right, "+t+", "+e+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({a:Math.floor(t)/100*this.maxValue})}}]),pn);function pn(t){d(this,pn);t=C(this,(pn.__proto__||Object.getPrototypeOf(pn)).call(this,t));return t.minValue=0,t.maxValue=1,t.source="opacity-control",t}var mn=(k(yn,Z),y(yn,[{key:"components",value:function(){return{Value:vn,Opacity:dn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Value" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),yn);function yn(){return d(this,yn),C(this,(yn.__proto__||Object.getPrototypeOf(yn)).apply(this,arguments))}var bn=(k($n,Z),y($n,[{key:"template",value:function(){return'\n <div class="wheel">\n <canvas class="wheel-canvas" ref="$colorwheel" ></canvas>\n <div class="wheel-canvas" ref="$valuewheel" ></div>\n <div class="drag-pointer" ref="$drag_pointer"></div>\n </div>\n '}},{key:"refresh",value:function(t){this.setColorUI(t)}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.renderValue(),this.setHueColor(null,t)}},{key:"renderValue",value:function(){var t=1-this.$store.hsv.v;this.refs.$valuewheel.css({"background-color":"rgba(0, 0, 0, "+t+")"})}},{key:"renderWheel",value:function(t,e){this.width&&!t&&(t=this.width),this.height&&!e&&(e=this.height);var n=new Ge("canvas"),r=n.el.getContext("2d");n.el.width=t,n.el.height=e,n.css({width:t+"px",height:e+"px"});for(var i=r.getImageData(0,0,t,e),o=i.data,a=Math.floor(t/2),l=Math.floor(e/2),s=e<t?l:a,u=a,c=l,h=0;h<e;h++)for(var f=0;f<t;f++){var v=f-u+1,g=h-c+1,d=v*v+g*g,g=p(v,g),g=He.HSVtoRGB(g,Math.min(Math.sqrt(d)/s,1),1),d=4*(h*t+f);o[d]=g.r,o[1+d]=g.g,o[2+d]=g.b,o[3+d]=255}return r.putImageData(i,0,0),0<this.thinkness&&(r.globalCompositeOperation="destination-out",r.fillStyle="black",r.beginPath(),r.arc(u,c,s-this.thinkness,0,2*Math.PI),r.closePath(),r.fill()),n}},{key:"renderCanvas",value:function(){var t,e,n,r;this.$store.createdWheelCanvas||(e=(t=this.refs.$colorwheel).el.getContext("2d"),n=t.size(),n=(r=w(n,2))[0],r=r[1],this.width&&!n&&(n=this.width),this.height&&!r&&(r=this.height),t.el.width=n,t.el.height=r,t.css({width:n+"px",height:r+"px"}),r=this.renderWheel(n,r),e.drawImage(r.el,0,0),this.$store.createdWheelCanvas=!0)}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"getDefaultSaturation",value:function(){return this.$store.hsv.s}},{key:"getCurrentXY",value:function(t,e,n,r,i){return t?Ke.posXY(t):function(t,e,n,r){return n=2<arguments.length&&void 0!==n?n:0,r=3<arguments.length&&void 0!==r?r:0,{x:l(t,e,n),y:s(t,e,r)}}(e,n,r,i)}},{key:"getRectangle",value:function(){var t=this.state.get("$el.width"),e=this.state.get("$el.height"),n=this.state.get("$colorwheel.width")/2,r=this.refs.$el.offset().left,i=r+t/2,o=this.refs.$el.offset().top;return{minX:r,minY:o,width:t,height:e,radius:n,centerX:i,centerY:o+e/2}}},{key:"setHueColor",value:function(t,e){var n,r,i,o,a,l,s,u,c;this.state.get("$el.width")&&(n=(u=this.getRectangle()).minX,r=u.minY,c=u.radius,i=u.centerX,l=u.centerY,a=(o=(s=(a=this.getCurrentXY(t,this.getDefaultValue(),this.getDefaultSaturation()*c,i,l)).x)-i)*o+(t=(u=a.y)-l)*t,t=p(o,t),c*c<a&&(s=(l=this.getCurrentXY(null,t,c,i,l)).x,u=l.y),c=Math.min(Math.sqrt(a)/c,1),this.refs.$drag_pointer.css({left:s-n+"px",top:u-r+"px"}),e||this.changeColor({type:"hsv",h:t,s:c}))}},{key:"changeColor",value:function(t){this.$store.dispatch("/changeColor",Object.assign({source:this.source},t||{}))}},{key:"@changeColor",value:function(t){this.source!=t&&this.refresh(!0)}},{key:"@initColor",value:function(){this.refresh(!0)}},{key:"mouseup document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"mousemove document",value:function(t){this.isDown&&this.setHueColor(t)}},{key:"mousedown $drag_pointer",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"mousedown $el",value:function(t){this.isDown=!0,this.setHueColor(t)}},{key:"touchend document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"touchmove document",value:function(t){this.isDown&&this.setHueColor(t)}},{key:"touchstart $drag_pointer",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"touchstart $el",value:function(t){t.preventDefault(),this.isDown=!0,this.setHueColor(t)}}]),$n);function $n(t){d(this,$n);t=C(this,($n.__proto__||Object.getPrototypeOf($n)).call(this,t));return t.width=214,t.height=214,t.thinkness=0,t.half_thinkness=0,t.source="colorwheel",t}var kn="chromedevtool-information",Cn=(k(xn,Z),y(xn,[{key:"template",value:function(){return'\n <div class="information hex">\n <div ref="$informationChange" class="information-change">\n <button ref="$formatChangeButton" type="button" class="format-change-button arrow-button"></button>\n </div>\n <div class="information-item hex">\n <div class="input-field hex">\n <input ref="$hexCode" class="input" type="text" />\n <div class="title">HEX</div>\n </div>\n </div>\n <div class="information-item rgb">\n <div class="input-field rgb-r">\n <input ref="$rgb_r" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">R</div>\n </div>\n <div class="input-field rgb-g">\n <input ref="$rgb_g" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">G</div>\n </div>\n <div class="input-field rgb-b">\n <input ref="$rgb_b" class="input" type="number" step="1" min="0" max="255" />\n <div class="title">B</div>\n </div> \n <div class="input-field rgb-a">\n <input ref="$rgb_a" class="input" type="number" step="0.01" min="0" max="1" />\n <div class="title">A</div>\n </div> \n </div>\n <div class="information-item hsl">\n <div class="input-field hsl-h">\n <input ref="$hsl_h" class="input" type="number" step="1" min="0" max="360" />\n <div class="title">H</div>\n </div>\n <div class="input-field hsl-s">\n <input ref="$hsl_s" class="input" type="number" step="1" min="0" max="100" />\n <div class="postfix">%</div>\n <div class="title">S</div>\n </div>\n <div class="input-field hsl-l">\n <input ref="$hsl_l" class="input" type="number" step="1" min="0" max="100" />\n <div class="postfix">%</div> \n <div class="title">L</div>\n </div>\n <div class="input-field hsl-a">\n <input ref="$hsl_a" class="input" type="number" step="0.01" min="0" max="1" />\n <div class="title">A</div>\n </div>\n </div>\n </div>\n '}},{key:"setCurrentFormat",value:function(t){this.format=t,this.initFormat()}},{key:"initFormat",value:function(){var e=this,n=this.format||"hex";["hex","rgb","hsl"].filter(function(t){return t!==n}).forEach(function(t){e.$el.removeClass(t)}),this.$el.addClass(n)}},{key:"nextFormat",value:function(){var t=this.$store.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e="hex"),this.format=e,this.$store.dispatch("/changeFormat",e),this.$store.emit("lastUpdateColor"),this.initFormat()}},{key:"goToFormat",value:function(t){this.format=t,this.$store.dispatch("/changeFormat",this.format),this.$store.emit("lastUpdateColor"),this.initFormat()}},{key:"getFormat",value:function(){return this.format||"hex"}},{key:"checkNumberKey",value:function(t){t=t.which;return 37==t||39==t||8==t||46==t||9==t||!(t<48||57<t)}},{key:"checkNotNumberKey",value:function(t){return!this.checkNumberKey(t)}},{key:"changeRgbColor",value:function(){this.$store.dispatch("/changeColor",{type:"rgb",r:this.refs.$rgb_r.int(),g:this.refs.$rgb_g.int(),b:this.refs.$rgb_b.int(),a:this.refs.$rgb_a.float(),source:kn}),this.$store.emit("lastUpdateColor")}},{key:"changeHslColor",value:function(){this.$store.dispatch("/changeColor",{type:"hsl",h:this.refs.$hsl_h.int(),s:this.refs.$hsl_s.int(),l:this.refs.$hsl_l.int(),a:this.refs.$hsl_a.float(),source:kn}),this.$store.emit("lastUpdateColor")}},{key:"@changeColor",value:function(t){kn!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}},{key:"input $rgb_r",value:function(t){this.changeRgbColor()}},{key:"input $rgb_g",value:function(t){this.changeRgbColor()}},{key:"input $rgb_b",value:function(t){this.changeRgbColor()}},{key:"input $rgb_a",value:function(t){this.changeRgbColor()}},{key:"input $hsl_h",value:function(t){this.changeHslColor()}},{key:"input $hsl_s",value:function(t){this.changeHslColor()}},{key:"input $hsl_l",value:function(t){this.changeHslColor()}},{key:"input $hsl_a",value:function(t){this.changeHslColor()}},{key:"keyup $hexCode",value:function(t){var e=this.refs.$hexCode.val();"#"!=e.charAt(0)||7!=e.length&&9!==e.length||(this.$store.dispatch("/changeColor",e,kn),this.$store.emit("lastUpdateColor"))}},{key:"click $formatChangeButton",value:function(t){this.nextFormat()}},{key:"click $el .information-item.hex .input-field .title",value:function(t){this.goToFormat("rgb")}},{key:"click $el .information-item.rgb .input-field .title",value:function(t){this.goToFormat("hsl")}},{key:"click $el .information-item.hsl .input-field .title",value:function(t){this.goToFormat("hex")}},{key:"setRGBInput",value:function(){this.refs.$rgb_r.val(this.$store.rgb.r),this.refs.$rgb_g.val(this.$store.rgb.g),this.refs.$rgb_b.val(this.$store.rgb.b),this.refs.$rgb_a.val(this.$store.alpha)}},{key:"setHSLInput",value:function(){this.refs.$hsl_h.val(this.$store.hsl.h),this.refs.$hsl_s.val(this.$store.hsl.s),this.refs.$hsl_l.val(this.$store.hsl.l),this.refs.$hsl_a.val(this.$store.alpha)}},{key:"setHexInput",value:function(){this.refs.$hexCode.val(this.$store.dispatch("/toHEX"))}},{key:"refresh",value:function(){this.setCurrentFormat(this.$store.format),this.setRGBInput(),this.setHSLInput(),this.setHexInput()}}]),xn);function xn(){return d(this,xn),C(this,(xn.__proto__||Object.getPrototypeOf(xn)).apply(this,arguments))}var _n=(k(wn,Z),y(wn,[{key:"template",value:function(){return'\n <div class="color-chooser">\n <div class="color-chooser-container">\n <div class="colorsets-item colorsets-item-header">\n <h1 class="title">Color Palettes</h1>\n <span ref="$toggleButton" class="items">&times;</span>\n </div>\n <div ref="$colorsetsList" class="colorsets-list"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){this.load()}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"@toggleColorChooser",value:function(){this.toggle()}},{key:"load $colorsetsList",value:function(){return"\n <div>\n "+this.$store.dispatch("/getColorSetsList").map(function(t,e){return'\n <div class="colorsets-item" data-colorsets-index="'+e+'" >\n <h1 class="title">'+t.name+'</h1>\n <div class="items">\n <div>\n '+t.colors.filter(function(t,e){return e<5}).map(function(t){return'<div class="color-item" title="'+(t=t||"rgba(255, 255, 255, 1)")+'">\n <div class="color-view" style="background-color: '+t+'"></div>\n </div>'}).join("")+"\n </div>\n </div>\n </div>"}).join("")+"\n </div>\n "}},{key:"show",value:function(){this.$el.addClass("open")}},{key:"hide",value:function(){this.$el.removeClass("open")}},{key:"toggle",value:function(){this.$el.toggleClass("open")}},{key:"click $toggleButton",value:function(t){this.toggle()}},{key:"click $colorsetsList .colorsets-item",value:function(t){t=t.$delegateTarget;t&&(t=parseInt(t.attr("data-colorsets-index")),this.$store.dispatch("/setCurrentColorSets",t),this.hide())}},{key:"destroy",value:function(){$(wn.prototype.__proto__||Object.getPrototypeOf(wn.prototype),"destroy",this).call(this),this.hide()}}]),wn);function wn(){return d(this,wn),C(this,(wn.__proto__||Object.getPrototypeOf(wn)).apply(this,arguments))}var On=(k(Mn,Z),y(Mn,[{key:"template",value:function(){return'\n <div class="colorsets">\n <div class="menu" title="Open Color Palettes">\n <button ref="$colorSetsChooseButton" type="button" class="color-sets-choose-btn arrow-button"></button>\n </div>\n <div ref="$colorSetsColorList" class="color-list"></div>\n </div>\n '}},{key:"load $colorSetsColorList",value:function(){var t=this.$store.dispatch("/getCurrentColorSets");return'\n <div class="current-color-sets">\n '+this.$store.dispatch("/getCurrentColors").map(function(t,e){return'<div class="color-item" title="'+t+'" data-index="'+e+'" data-color="'+t+'">\n <div class="empty"></div>\n <div class="color-view" style="background-color: '+t+'"></div>\n </div>'}).join("")+" \n "+(t.edit?'<div class="add-color-item">+</div>':"")+" \n </div>\n "}},{key:"refresh",value:function(){this.load()}},{key:"addColor",value:function(t){this.$store.dispatch("/addCurrentColor",t)}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"click $colorSetsChooseButton",value:function(t){this.$store.emit("toggleColorChooser")}},{key:"contextmenu $colorSetsColorList",value:function(t){var e;t.preventDefault(),this.$store.dispatch("/getCurrentColorSets").edit&&((e=new Ge(t.target).closest("color-item"))?(e=parseInt(e.attr("data-index")),this.$store.emit("showContextMenu",t,e)):this.$store.emit("showContextMenu",t))}},{key:"click $colorSetsColorList .add-color-item",value:function(t){this.addColor(this.$store.dispatch("/toColor"))}},{key:"click $colorSetsColorList .color-item",value:function(t){this.$store.dispatch("/changeColor",t.$delegateTarget.attr("data-color")),this.$store.emit("lastUpdateColor")}}]),Mn);function Mn(){return d(this,Mn),C(this,(Mn.__proto__||Object.getPrototypeOf(Mn)).apply(this,arguments))}var Sn=(k(Tn,Z),y(Tn,[{key:"template",value:function(){return'\n <ul class="colorsets-contextmenu">\n <li class="menu-item small-hide" data-type="remove-color">Remove color</li>\n <li class="menu-item small-hide" data-type="remove-all-to-the-right">Remove all to the right</li>\n <li class="menu-item" data-type="clear-palette">Clear palette</li>\n </ul>\n '}},{key:"show",value:function(t,e){t=Ke.pos(t);this.$el.css({top:t.clientY-10+"px",left:t.clientX+"px"}),this.$el.addClass("show"),this.selectedColorIndex=e,void 0===this.selectedColorIndex?this.$el.addClass("small"):this.$el.removeClass("small")}},{key:"hide",value:function(){this.$el.removeClass("show")}},{key:"runCommand",value:function(t){switch(t){case"remove-color":this.$store.dispatch("/removeCurrentColor",this.selectedColorIndex);break;case"remove-all-to-the-right":this.$store.dispatch("/removeCurrentColorToTheRight",this.selectedColorIndex);break;case"clear-palette":this.$store.dispatch("/clearPalette")}}},{key:"@showContextMenu",value:function(t,e){this.show(t,e)}},{key:"click $el .menu-item",value:function(t){t.preventDefault(),this.runCommand(t.$delegateTarget.attr("data-type")),this.hide()}}]),Tn);function Tn(){return d(this,Tn),C(this,(Tn.__proto__||Object.getPrototypeOf(Tn)).apply(this,arguments))}var En=(k(An,x),y(An,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="colorwheel"></div>\n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div> \n </div>\n '}},{key:"components",value:function(){return{colorwheel:bn,control:mn,information:Cn,currentColorSets:On,colorSetsChooser:_n,contextMenu:Sn}}}]),An);function An(){return d(this,An),C(this,(An.__proto__||Object.getPrototypeOf(An)).apply(this,arguments))}var In=(k(Pn,q),y(Pn,[{key:"template",value:function(){return'\n <div class="hue">\n <div ref="$container" class="hue-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({h:t/100*this.maxValue,type:"hsv"})}}]),Pn);function Pn(t){d(this,Pn);t=C(this,(Pn.__proto__||Object.getPrototypeOf(Pn)).call(this,t));return t.minValue=0,t.maxValue=360,t.source="hue-control",t}var Dn=(k(Bn,Z),y(Bn,[{key:"components",value:function(){return{Hue:In,Opacity:dn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"chromedevtool-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Bn);function Bn(){return d(this,Bn),C(this,(Bn.__proto__||Object.getPrototypeOf(Bn)).apply(this,arguments))}var Rn="chromedevtool-palette",Un=(k(Fn,Z),y(Fn,[{key:"template",value:function(){return'\n <div class="color">\n <div ref="$saturation" class="saturation">\n <div ref="$value" class="value">\n <div ref="$drag_pointer" class="drag-pointer"></div>\n </div>\n </div> \n </div> \n '}},{key:"setBackgroundColor",value:function(t){this.$el.css("background-color",t)}},{key:"refresh",value:function(){this.setColorUI()}},{key:"caculateSV",value:function(){var t=this.drag_pointer_pos||{x:0,y:0},e=this.state.get("$el.width"),n=this.state.get("$el.height"),e=t.x/e,n=(n-t.y)/n;this.$store.dispatch("/changeColor",{type:"hsv",s:e,v:n,source:Rn})}},{key:"setColorUI",value:function(){var t=this.state.get("$el.width")*this.$store.hsv.s,e=this.state.get("$el.height")*(1-this.$store.hsv.v);this.refs.$drag_pointer.css({left:t+"px",top:e+"px"}),this.drag_pointer_pos={x:t,y:e},this.setBackgroundColor(this.$store.dispatch("/getHueColor"))}},{key:"setMainColor",value:function(t){var e=this.$el.offset(),n=this.state.get("$el.contentWidth"),r=this.state.get("$el.contentHeight"),i=Ke.pos(t).pageX-e.left,e=Ke.pos(t).pageY-e.top;i<0?i=0:n<i&&(i=n),e<0?e=0:r<e&&(e=r),this.refs.$drag_pointer.css({left:i+"px",top:e+"px"}),this.drag_pointer_pos={x:i,y:e},this.caculateSV()}},{key:"@changeColor",value:function(t){Rn!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}},{key:"mouseup document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"mousemove document",value:function(t){this.isDown&&this.setMainColor(t)}},{key:"mousedown",value:function(t){this.isDown=!0,this.setMainColor(t)}},{key:"touchend document",value:function(t){this.isDown&&(this.isDown=!1,this.$store.emit("lastUpdateColor"))}},{key:"touchmove document",value:function(t){this.isDown&&this.setMainColor(t)}},{key:"touchstart",value:function(t){t.preventDefault(),this.isDown=!0,this.setMainColor(t)}}]),Fn);function Fn(){return d(this,Fn),C(this,(Fn.__proto__||Object.getPrototypeOf(Fn)).apply(this,arguments))}var jn=(k(Hn,x),y(Hn,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Un,control:Dn,information:Cn,currentColorSets:On,colorSetsChooser:_n,contextMenu:Sn}}}]),Hn);function Hn(){return d(this,Hn),C(this,(Hn.__proto__||Object.getPrototypeOf(Hn)).apply(this,arguments))}var Ln=(k(Vn,Z),y(Vn,[{key:"components",value:function(){return{Hue:In,Opacity:dn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Vn);function Vn(){return d(this,Vn),C(this,(Vn.__proto__||Object.getPrototypeOf(Vn)).apply(this,arguments))}var zn=(k(Nn,x),y(Nn,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div>\n <div target="control"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Un,control:Ln}}}]),Nn);function Nn(){return d(this,Nn),C(this,(Nn.__proto__||Object.getPrototypeOf(Nn)).apply(this,arguments))}k(Gn,q),y(Gn,[{key:"getMaxDist",value:function(){return this.state.get("$container.height")}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({top:t+"px"})}},{key:"getMousePosition",value:function(t){return Ke.pos(t).pageY}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().top}},{key:"getCaculatedDist",value:function(t){t=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.maxValue);return 100-this.getDist(t)}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.minValue?this.refs.$bar.addClass("first").removeClass("last"):(t>=this.maxValue?this.refs.$bar.addClass("last"):this.refs.$bar.removeClass("last")).removeClass("first");t=1-(t||0)/this.maxValue;this.setMousePosition(this.getMaxDist()*t)}}]),q=Gn;function Gn(t){d(this,Gn);t=C(this,(Gn.__proto__||Object.getPrototypeOf(Gn)).call(this,t));return t.source="vertical-slider",t}var Xn=(k(Yn,q),y(Yn,[{key:"template",value:function(){return'\n <div class="hue">\n <div ref="$container" class="hue-container">\n <div ref="$bar" class="drag-bar"></div>\n </div>\n </div>\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({h:t/100*this.maxValue,type:"hsv"})}}]),Yn);function Yn(t){d(this,Yn);t=C(this,(Yn.__proto__||Object.getPrototypeOf(Yn)).call(this,t));return t.minValue=0,t.maxValue=360,t.source="vertical-hue-control",t}var Wn=(k(qn,q),y(qn,[{key:"template",value:function(){return'\n <div class="opacity">\n <div ref="$container" class="opacity-container">\n <div ref="$colorbar" class="color-bar"></div>\n <div ref="$bar" class="drag-bar2"></div>\n </div>\n </div>\n '}},{key:"refresh",value:function(){$(qn.prototype.__proto__||Object.getPrototypeOf(qn.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=He.format(t,"rgb");t.a=1;t=He.format(t,"rgb");this.refs.$colorbar.css("background","linear-gradient(to top, "+e+", "+t+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){t=this.getCaculatedDist(t);this.setColorUI(t/100*this.maxValue),this.changeColor({a:Math.floor(t)/100*this.maxValue})}}]),qn);function qn(t){d(this,qn);t=C(this,(qn.__proto__||Object.getPrototypeOf(qn)).call(this,t));return t.source="vertical-opacity-control",t}var Kn=(k(Zn,Z),y(Zn,[{key:"components",value:function(){return{Hue:Xn,Opacity:Wn}}},{key:"template",value:function(){return'<div class="control"><div target="Hue" ></div><div target="Opacity" ></div></div>'}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Zn);function Zn(){return d(this,Zn),C(this,(Zn.__proto__||Object.getPrototypeOf(Zn)).apply(this,arguments))}var Jn=(k(Qn,x),y(Qn,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div><div target="control"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Un,control:Kn}}}]),Qn);function Qn(){return d(this,Qn),C(this,(Qn.__proto__||Object.getPrototypeOf(Qn)).apply(this,arguments))}var tr=(k(er,Z),y(er,[{key:"components",value:function(){return{Value:vn,Opacity:dn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Value" ></div>\n <div target="Opacity" ></div>\n <div ref="$controlPattern" class="empty"></div>\n <div ref="$controlColor" class="color"></div>\n </div>\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),er);function er(){return d(this,er),C(this,(er.__proto__||Object.getPrototypeOf(er)).apply(this,arguments))}var nr=(k(rr,bn),y(rr,[{key:"template",value:function(){return'\n <div class="wheel" data-type="ring">\n <canvas class="wheel-canvas" ref="$colorwheel" ></canvas>\n <div class="drag-pointer" ref="$drag_pointer"></div>\n </div>\n '}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.setHueColor(null,t)}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"setHueColor",value:function(t,e){var n,r,i,o,a,l,s;this.state.get("$el.width")&&(n=(s=this.getRectangle()).minX,r=s.minY,i=s.radius,o=s.centerX,l=s.centerY,a=p((s=(a=this.getCurrentXY(t,this.getDefaultValue(),i,o,l)).x)-o,(t=a.y)-l),s=(l=this.getCurrentXY(null,a,i-this.half_thinkness,o,l)).x,t=l.y,this.refs.$drag_pointer.css({left:s-n+"px",top:t-r+"px"}),e||this.changeColor({type:"hsv",h:a}))}}]),rr);function rr(t){d(this,rr);t=C(this,(rr.__proto__||Object.getPrototypeOf(rr)).call(this,t));return t.width=214,t.height=214,t.thinkness=16,t.half_thinkness=t.thinkness/2,t.source="colorring",t}var ir=(k(or,x),y(or,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="colorring"></div>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{colorring:nr,palette:Un,control:tr,information:Cn,currentColorSets:On,colorSetsChooser:_n,contextMenu:Sn}}}]),or);function or(){return d(this,or),C(this,(or.__proto__||Object.getPrototypeOf(or)).apply(this,arguments))}var ar=(k(lr,Z),y(lr,[{key:"components",value:function(){return{Hue:Xn,Opacity:Wn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Hue" ></div>\n <div target="Opacity" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(){this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),lr);function lr(){return d(this,lr),C(this,(lr.__proto__||Object.getPrototypeOf(lr)).apply(this,arguments))}var sr=(k(ur,x),y(ur,[{key:"template",value:function(){return'\n <div class=\'colorpicker-body\'>\n <div target="palette"></div> \n <div target="control"></div>\n <div target="information"></div>\n <div target="currentColorSets"></div>\n <div target="colorSetsChooser"></div>\n <div target="contextMenu"></div>\n </div>\n '}},{key:"components",value:function(){return{palette:Un,control:ar,information:Cn,currentColorSets:On,colorSetsChooser:_n,contextMenu:Sn}}}]),ur);function ur(){return d(this,ur),C(this,(ur.__proto__||Object.getPrototypeOf(ur)).apply(this,arguments))}var cr=(k(hr,Z),y(hr,[{key:"components",value:function(){return{Hue:Xn,Opacity:Wn}}},{key:"template",value:function(){return'\n <div class="control">\n <div target="Opacity" ></div> \n <div target="Hue" ></div>\n </div>\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),hr);function hr(){return d(this,hr),C(this,(hr.__proto__||Object.getPrototypeOf(hr)).apply(this,arguments))}var fr=(k(vr,x),y(vr,[{key:"template",value:function(){return"\n <div class='colorpicker-body'>\n <div class='color-view'>\n <div class='color-view-container' ref=\"$colorview\"></div>\n </div>\n <div class='color-tool'>\n <div target=\"palette\"></div>\n <div target=\"control\"></div>\n </div>\n </div>\n "}},{key:"components",value:function(){return{palette:Un,control:cr}}},{key:"initColorWithoutChangeEvent",value:function(t){this.$store.dispatch("/initColor",t),this.refresh()}},{key:"setBackgroundColor",value:function(){var t=this.$store.dispatch("/toColor"),e=this.$store.rgb,e=He.brightness(e.r,e.g,e.b);this.refs.$colorview.css({"background-color":t,color:127<e?"black":"white"}),this.refs.$colorview.html(t)}},{key:"click $colorview",value:function(t){this.nextFormat()}},{key:"nextFormat",value:function(){var t=this.$store.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e="hex"),this.$store.dispatch("/changeFormat",e),this.$store.emit("lastUpdateColor"),this.refresh()}},{key:"refresh",value:function(){this.setBackgroundColor()}},{key:"@changeColor",value:function(){this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),vr);function vr(){return d(this,vr),C(this,(vr.__proto__||Object.getPrototypeOf(vr)).apply(this,arguments))}var gr={create:function(t){switch(t.type){case"macos":return new En(t);case"xd":return new sr(t);case"ring":return new ir(t);case"mini":return new zn(t);case"vscode":return new fr(t);case"mini-vertical":return new Jn(t);default:return new jn(t)}},ColorPicker:jn,ChromeDevToolColorPicker:jn,MacOSColorPicker:En,RingColorPicker:ir,MiniColorPicker:zn,VSCodePicker:fr,MiniVerticalColorPicker:Jn};var dr="ace_color",pr=(y(mr,[{key:"get_brightness",value:function(t){t=He.parse(t);return 127<j(t.r,t.g,t.b)?"#000":"#fff"}},{key:"mouse_over",value:function(t){var e=new Ge(t.target);this.__colorview_check_target=t.target,e.hasClass(dr)&&this.openDebouncedColorPicker(t)}},{key:"init_mouse_event",value:function(){var o,a,l,t=this.editor.renderer.content;this.openDebouncedColorPicker=(o=this.open_color_picker.bind(this),a=this.opt.showDelay,l=void 0,function(t,e,n,r,i){l&&clearTimeout(l),l=setTimeout(function(){o(t,e,n,r,i)},a||300)}),this.onMouseOver=this.mouse_over.bind(this),t.addEventListener("mousemove",this.onMouseOver)}},{key:"init_event",value:function(){var o=this,t=this.editor,e=t.renderer,t=t.session,a=e.content;this.init_mouse_event();var n,r=t.$mode.$highlightRules.getRules();for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(r[n].unshift({token:"color",regex:"#(?:[\\da-f]{8})|#(?:[\\da-f]{3}){1,2}|rgb\\((?:\\s*\\d{1,3},\\s*){2}\\d{1,3}\\s*\\)|rgba\\((?:\\s*\\d{1,3},\\s*){3}\\d*\\.?\\d+\\s*\\)|hsl\\(\\s*\\d{1,3}(?:,\\s*\\d{1,3}%){2}\\s*\\)|hsla\\(\\s*\\d{1,3}(?:,\\s*\\d{1,3}%){2},\\s*\\d*\\.?\\d+\\s*\\)"}),r[n].unshift({token:"color",regex:"blue|green|red"}));t.$mode.$tokenizer=null,t.bgTokenizer.setTokenizer(session.$mode.getTokenizer()),t.bgTokenizer.start(0),e.on("afterRender",function(){for(var t=a.getElementsByClassName(dr),e=0,n=t.length;e<n;e++){var r,i=t[e].textContent;t[e].getAttribute("data-color")!==i&&(r=o.get_brightness(i),t[e].setAttribute("data-color",i),t[e].style.cssText="\n background-color: "+i+";\n color: "+r+";\n pointer-events: all;\n ")}})}},{key:"destroy",value:function(){this.editor.renderer.content.removeEventListener("mousemove",this.onMouseOver)}},{key:"open_color_picker",value:function(t){var e,n,r,i,o,a,l,s=this;t.target===this.__colorview_check_target?(e=this.ace.Range,l=(n=this.editor).renderer,a=n.session,n=l.layerConfig,t=l.screenToTextCoordinates(t.clientX-n.padding,t.clientY),(a=a.getTokenAt(t.row,t.column))&&!1!==a.type.includes("color")&&(r=t.row,i=a.start,t=a.value,o=t,a=l.textToScreenCoordinates(r,i),l=Ge.getScrollTop(),this.colorpicker.show({left:a.pageX,top:a.pageY+l,bottom:a.pageY+l+n.lineHeight,hideDelay:this.opt.hideDelay||10},t,function(t){s.editor.session.replace(new e(r,i,r,i+o.length),t),o=t}))):this.close_color_picker()}},{key:"close_color_picker",value:function(){this.colorpicker&&this.colorpicker.hide()}},{key:"hide_delay_color_picker",value:function(){this.colorpicker&&this.colorpicker.runHideDelay()}},{key:"key",value:function(t,e){return[t,e].join(":")}},{key:"keyup",value:function(t){!this.colorpicker||"Escape"!=t.key&&0!=this.colorpicker.isShortCut||this.colorpicker.hide()}}]),mr);function mr(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{type:"vscode",showDelay:300,containerClass:"ace-colorpicker"};d(this,mr),this.opt=n,this.ace=t,this.editor=e,this.colorpicker=gr.create(this.opt),this.init_event()}return _({},m,gr,{load:function(t,e,n){return new pr(t,e,n)}})}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ace-colorpicker-rpk",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "simple colorpicker for ACE Editor",
5
5
  "main": "./dist/ace-colorpicker.js",
6
6
  "scripts": {