yunkong2.flot/www/js/edit.js
2018-09-15 23:51:00 +08:00

3 lines
104 KiB
JavaScript

!function(a){if("function"==typeof require&&"object"==typeof exports&&"object"==typeof module){var b=require("jquery");module.exports=a(b)}else if("function"==typeof define&&define.amd)define(["jquery"],function(e){return a(e)});else{var c;try{c=eval("this")}catch(e){c=window}c.deparam=a(jQuery)}}(function(e){var t=function(e,l){var c={},p={true:!0,false:!1,null:null};return e.replace(/\+/g," ").split("&").forEach(function(e){var t,n=e.split("="),o=decodeURIComponent(n[0]),i=c,a=0,s=o.split("]["),r=s.length-1;if(r=/\[/.test(s[0])&&/\]$/.test(s[r])?(s[r]=s[r].replace(/\]$/,""),(s=s.shift().split("[").concat(s)).length-1):0,2===n.length)if(t=decodeURIComponent(n[1]),l&&(t=t&&!isNaN(t)&&+t+""===t?+t:"undefined"===t?void 0:void 0!==p[t]?p[t]:t),r)for(;a<=r;a++)i=i[o=""===s[a]?i.length:s[a]]=a<r?i[o]||(s[a+1]&&isNaN(s[a+1])?{}:[]):t;else"[object Array]"===Object.prototype.toString.call(c[o])?c[o].push(t):!{}.hasOwnProperty.call(c,o)?c[o]=t:c[o]=[c[o],t];else o&&(c[o]=l?void 0:"")}),c};return e.prototype.deparam=e.deparam=t,t}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(x){"use strict";var n=0,r=function(e){var t=Math.round(e).toString(16);return 1===t.length&&(t="0"+t),t.toLowerCase()},a=function(e){return 32==e||48<=e&&e<=57||65<=e&&e<=90||96<=e&&e<=111||186<=e&&e<192||219<=e&&e<222},s=function(e){return 48<=e&&e<=57||65<=e&&e<=70};return x.colorpicker=new function(){this.regional={"":{ok:"OK",cancel:"Cancel",none:"None",button:"Color",title:"Pick a color",transparent:"Transparent",hsvH:"H",hsvS:"S",hsvV:"V",rgbR:"R",rgbG:"G",rgbB:"B",labL:"L",labA:"a",labB:"b",hslH:"H",hslS:"S",hslL:"L",cmykC:"C",cmykM:"M",cmykY:"Y",cmykK:"K",alphaA:"A"}},this.swatchesNames={html:"HTML"},this.swatches={html:[{name:"black",r:0,g:0,b:0},{name:"dimgray",r:.4117647058823529,g:.4117647058823529,b:.4117647058823529},{name:"gray",r:.5019607843137255,g:.5019607843137255,b:.5019607843137255},{name:"darkgray",r:.6627450980392157,g:.6627450980392157,b:.6627450980392157},{name:"silver",r:.7529411764705882,g:.7529411764705882,b:.7529411764705882},{name:"lightgrey",r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},{name:"gainsboro",r:.8627450980392157,g:.8627450980392157,b:.8627450980392157},{name:"whitesmoke",r:.9607843137254902,g:.9607843137254902,b:.9607843137254902},{name:"white",r:1,g:1,b:1},{name:"rosybrown",r:.7372549019607844,g:.5607843137254902,b:.5607843137254902},{name:"indianred",r:.803921568627451,g:.3607843137254902,b:.3607843137254902},{name:"brown",r:.6470588235294118,g:.16470588235294117,b:.16470588235294117},{name:"firebrick",r:.6980392156862745,g:.13333333333333333,b:.13333333333333333},{name:"lightcoral",r:.9411764705882353,g:.5019607843137255,b:.5019607843137255},{name:"maroon",r:.5019607843137255,g:0,b:0},{name:"darkred",r:.5450980392156862,g:0,b:0},{name:"red",r:1,g:0,b:0},{name:"snow",r:1,g:.9803921568627451,b:.9803921568627451},{name:"salmon",r:.9803921568627451,g:.5019607843137255,b:.4470588235294118},{name:"mistyrose",r:1,g:.8941176470588236,b:.8823529411764706},{name:"tomato",r:1,g:.38823529411764707,b:.2784313725490196},{name:"darksalmon",r:.9137254901960784,g:.5882352941176471,b:.47843137254901963},{name:"orangered",r:1,g:.27058823529411763,b:0},{name:"coral",r:1,g:.4980392156862745,b:.3137254901960784},{name:"lightsalmon",r:1,g:.6274509803921569,b:.47843137254901963},{name:"sienna",r:.6274509803921569,g:.3215686274509804,b:.17647058823529413},{name:"seashell",r:1,g:.9607843137254902,b:.9333333333333333},{name:"chocolate",r:.8235294117647058,g:.4117647058823529,b:.11764705882352941},{name:"saddlebrown",r:.5450980392156862,g:.27058823529411763,b:.07450980392156863},{name:"sandybrown",r:.9568627450980393,g:.6431372549019608,b:.3764705882352941},{name:"peachpuff",r:1,g:.8549019607843137,b:.7254901960784313},{name:"peru",r:.803921568627451,g:.5215686274509804,b:.24705882352941178},{name:"linen",r:.9803921568627451,g:.9411764705882353,b:.9019607843137255},{name:"darkorange",r:1,g:.5490196078431373,b:0},{name:"bisque",r:1,g:.8941176470588236,b:.7686274509803922},{name:"burlywood",r:.8705882352941177,g:.7215686274509804,b:.5294117647058824},{name:"tan",r:.8235294117647058,g:.7058823529411765,b:.5490196078431373},{name:"antiquewhite",r:.9803921568627451,g:.9215686274509803,b:.8431372549019608},{name:"navajowhite",r:1,g:.8705882352941177,b:.6784313725490196},{name:"blanchedalmond",r:1,g:.9215686274509803,b:.803921568627451},{name:"papayawhip",r:1,g:.9372549019607843,b:.8352941176470589},{name:"orange",r:1,g:.6470588235294118,b:0},{name:"moccasin",r:1,g:.8941176470588236,b:.7098039215686275},{name:"wheat",r:.9607843137254902,g:.8705882352941177,b:.7019607843137254},{name:"oldlace",r:.9921568627450981,g:.9607843137254902,b:.9019607843137255},{name:"floralwhite",r:1,g:.9803921568627451,b:.9411764705882353},{name:"goldenrod",r:.8549019607843137,g:.6470588235294118,b:.12549019607843137},{name:"darkgoldenrod",r:.7215686274509804,g:.5254901960784314,b:.043137254901960784},{name:"cornsilk",r:1,g:.9725490196078431,b:.8627450980392157},{name:"gold",r:1,g:.8431372549019608,b:0},{name:"palegoldenrod",r:.9333333333333333,g:.9098039215686274,b:.6666666666666666},{name:"khaki",r:.9411764705882353,g:.9019607843137255,b:.5490196078431373},{name:"lemonchiffon",r:1,g:.9803921568627451,b:.803921568627451},{name:"darkkhaki",r:.7411764705882353,g:.7176470588235294,b:.4196078431372549},{name:"beige",r:.9607843137254902,g:.9607843137254902,b:.8627450980392157},{name:"lightgoldenrodyellow",r:.9803921568627451,g:.9803921568627451,b:.8235294117647058},{name:"olive",r:.5019607843137255,g:.5019607843137255,b:0},{name:"yellow",r:1,g:1,b:0},{name:"lightyellow",r:1,g:1,b:.8784313725490196},{name:"ivory",r:1,g:1,b:.9411764705882353},{name:"olivedrab",r:.4196078431372549,g:.5568627450980392,b:.13725490196078433},{name:"yellowgreen",r:.6039215686274509,g:.803921568627451,b:.19607843137254902},{name:"darkolivegreen",r:.3333333333333333,g:.4196078431372549,b:.1843137254901961},{name:"greenyellow",r:.6784313725490196,g:1,b:.1843137254901961},{name:"lawngreen",r:.48627450980392156,g:.9882352941176471,b:0},{name:"chartreuse",r:.4980392156862745,g:1,b:0},{name:"darkseagreen",r:.5607843137254902,g:.7372549019607844,b:.5607843137254902},{name:"forestgreen",r:.13333333333333333,g:.5450980392156862,b:.13333333333333333},{name:"limegreen",r:.19607843137254902,g:.803921568627451,b:.19607843137254902},{name:"lightgreen",r:.5647058823529412,g:.9333333333333333,b:.5647058823529412},{name:"palegreen",r:.596078431372549,g:.984313725490196,b:.596078431372549},{name:"darkgreen",r:0,g:.39215686274509803,b:0},{name:"green",r:0,g:.5019607843137255,b:0},{name:"lime",r:0,g:1,b:0},{name:"honeydew",r:.9411764705882353,g:1,b:.9411764705882353},{name:"mediumseagreen",r:.23529411764705882,g:.7019607843137254,b:.44313725490196076},{name:"seagreen",r:.1803921568627451,g:.5450980392156862,b:.3411764705882353},{name:"springgreen",r:0,g:1,b:.4980392156862745},{name:"mintcream",r:.9607843137254902,g:1,b:.9803921568627451},{name:"mediumspringgreen",r:0,g:.9803921568627451,b:.6039215686274509},{name:"mediumaquamarine",r:.4,g:.803921568627451,b:.6666666666666666},{name:"aquamarine",r:.4980392156862745,g:1,b:.8313725490196079},{name:"turquoise",r:.25098039215686274,g:.8784313725490196,b:.8156862745098039},{name:"lightseagreen",r:.12549019607843137,g:.6980392156862745,b:.6666666666666666},{name:"mediumturquoise",r:.2823529411764706,g:.8196078431372549,b:.8},{name:"darkslategray",r:.1843137254901961,g:.30980392156862746,b:.30980392156862746},{name:"paleturquoise",r:.6862745098039216,g:.9333333333333333,b:.9333333333333333},{name:"teal",r:0,g:.5019607843137255,b:.5019607843137255},{name:"darkcyan",r:0,g:.5450980392156862,b:.5450980392156862},{name:"darkturquoise",r:0,g:.807843137254902,b:.8196078431372549},{name:"aqua",r:0,g:1,b:1},{name:"cyan",r:0,g:1,b:1},{name:"lightcyan",r:.8784313725490196,g:1,b:1},{name:"azure",r:.9411764705882353,g:1,b:1},{name:"cadetblue",r:.37254901960784315,g:.6196078431372549,b:.6274509803921569},{name:"powderblue",r:.6901960784313725,g:.8784313725490196,b:.9019607843137255},{name:"lightblue",r:.6784313725490196,g:.8470588235294118,b:.9019607843137255},{name:"deepskyblue",r:0,g:.7490196078431373,b:1},{name:"skyblue",r:.5294117647058824,g:.807843137254902,b:.9215686274509803},{name:"lightskyblue",r:.5294117647058824,g:.807843137254902,b:.9803921568627451},{name:"steelblue",r:.27450980392156865,g:.5098039215686274,b:.7058823529411765},{name:"aliceblue",r:.9411764705882353,g:.9725490196078431,b:1},{name:"dodgerblue",r:.11764705882352941,g:.5647058823529412,b:1},{name:"slategray",r:.4392156862745098,g:.5019607843137255,b:.5647058823529412},{name:"lightslategray",r:.4666666666666667,g:.5333333333333333,b:.6},{name:"lightsteelblue",r:.6901960784313725,g:.7686274509803922,b:.8705882352941177},{name:"cornflowerblue",r:.39215686274509803,g:.5843137254901961,b:.9294117647058824},{name:"royalblue",r:.2549019607843137,g:.4117647058823529,b:.8823529411764706},{name:"midnightblue",r:.09803921568627451,g:.09803921568627451,b:.4392156862745098},{name:"lavender",r:.9019607843137255,g:.9019607843137255,b:.9803921568627451},{name:"navy",r:0,g:0,b:.5019607843137255},{name:"darkblue",r:0,g:0,b:.5450980392156862},{name:"mediumblue",r:0,g:0,b:.803921568627451},{name:"blue",r:0,g:0,b:1},{name:"ghostwhite",r:.9725490196078431,g:.9725490196078431,b:1},{name:"darkslateblue",r:.2823529411764706,g:.23921568627450981,b:.5450980392156862},{name:"slateblue",r:.41568627450980394,g:.35294117647058826,b:.803921568627451},{name:"mediumslateblue",r:.4823529411764706,g:.40784313725490196,b:.9333333333333333},{name:"mediumpurple",r:.5764705882352941,g:.4392156862745098,b:.8588235294117647},{name:"blueviolet",r:.5411764705882353,g:.16862745098039217,b:.8862745098039215},{name:"indigo",r:.29411764705882354,g:0,b:.5098039215686274},{name:"darkorchid",r:.6,g:.19607843137254902,b:.8},{name:"darkviolet",r:.5803921568627451,g:0,b:.8274509803921568},{name:"mediumorchid",r:.7294117647058823,g:.3333333333333333,b:.8274509803921568},{name:"thistle",r:.8470588235294118,g:.7490196078431373,b:.8470588235294118},{name:"plum",r:.8666666666666667,g:.6274509803921569,b:.8666666666666667},{name:"violet",r:.9333333333333333,g:.5098039215686274,b:.9333333333333333},{name:"purple",r:.5019607843137255,g:0,b:.5019607843137255},{name:"darkmagenta",r:.5450980392156862,g:0,b:.5450980392156862},{name:"magenta",r:1,g:0,b:1},{name:"fuchsia",r:1,g:0,b:1},{name:"orchid",r:.8549019607843137,g:.4392156862745098,b:.8392156862745098},{name:"mediumvioletred",r:.7803921568627451,g:.08235294117647059,b:.5215686274509804},{name:"deeppink",r:1,g:.0784313725490196,b:.5764705882352941},{name:"hotpink",r:1,g:.4117647058823529,b:.7058823529411765},{name:"palevioletred",r:.8588235294117647,g:.4392156862745098,b:.5764705882352941},{name:"lavenderblush",r:1,g:.9411764705882353,b:.9607843137254902},{name:"crimson",r:.8627450980392157,g:.0784313725490196,b:.23529411764705882},{name:"pink",r:1,g:.7529411764705882,b:.796078431372549},{name:"lightpink",r:1,g:.7137254901960784,b:.7568627450980392}]},this.writers={"#HEX":function(e,t){return t._formatColor("#rxgxbx",e)},"#HEX3":function(e,t){var n=x.colorpicker.writers.HEX3(e);return!1!==n&&"#"+n},HEX:function(e,t){return t._formatColor("rxgxbx",e)},HEX3:function(e,t){var n=e.getRGB(),o=Math.round(255*n.r),i=Math.round(255*n.g),a=Math.round(255*n.b);return o>>>4==(o&=15)&&i>>>4==(i&=15)&&a>>>4==(a&=15)&&o.toString(16)+i.toString(16)+a.toString(16)},"#HEXA":function(e,t){return t._formatColor("#rxgxbxax",e)},"#HEXA4":function(e,t){var n=x.colorpicker.writers.HEXA4(e,t);return!1!==n&&"#"+n},HEXA:function(e,t){return t._formatColor("rxgxbxax",e)},HEXA4:function(e,t){var n=Math.round(255*e.getAlpha());return n>>>4==(n&=15)&&x.colorpicker.writers.HEX3(e,t)+n.toString(16)},RGB:function(e,t){return 1<=e.getAlpha()&&t._formatColor("rgb(rd,gd,bd)",e)},RGBA:function(e,t){return t._formatColor("rgba(rd,gd,bd,af)",e)},"RGB%":function(e,t){return 1<=e.getAlpha()&&t._formatColor("rgb(rp%,gp%,bp%)",e)},"RGBA%":function(e,t){return t._formatColor("rgba(rp%,gp%,bp%,af)",e)},HSL:function(e,t){return 1<=e.getAlpha()&&t._formatColor("hsl(hd,sd,vd)",e)},HSLA:function(e,t){return t._formatColor("hsla(hd,sd,vd,af)",e)},"HSL%":function(e,t){return 1<=e.getAlpha()&&t._formatColor("hsl(hp%,sp%,vp%)",e)},"HSLA%":function(e,t){return t._formatColor("hsla(hp%,sp%,vp%,af)",e)},NAME:function(e,t){return t._closestName(e)},EXACT:function(e,t){return t._exactName(e)}},this.parsers={"":function(e){if(""===e)return new x.colorpicker.Color},NAME:function(e,t){var n=t._getSwatch(x.trim(e));if(n)return new x.colorpicker.Color(n.r,n.g,n.b)},RGBA:function(e){var t=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)$/.exec(e);if(t)return new x.colorpicker.Color(t[1]/255,t[2]/255,t[3]/255,parseFloat(t[4]))},"RGBA%":function(e){var t=/^rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)$/.exec(e);if(t)return new x.colorpicker.Color(t[1]/100,t[2]/100,t[3]/100,t[4]/100)},HSLA:function(e){var t=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)$/.exec(e);if(t)return(new x.colorpicker.Color).setHSL(t[1]/255,t[2]/255,t[3]/255).setAlpha(parseFloat(t[4]))},"HSLA%":function(e){var t=/^hsla?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)$/.exec(e);if(t)return(new x.colorpicker.Color).setHSL(t[1]/100,t[2]/100,t[3]/100).setAlpha(t[4]/100)},"#HEX":function(e){var t=/^#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/.exec(e);if(t)return new x.colorpicker.Color(parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255)},"#HEX3":function(e){var t=/^#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])$/.exec(e);if(t)return new x.colorpicker.Color(parseInt(String(t[1])+t[1],16)/255,parseInt(String(t[2])+t[2],16)/255,parseInt(String(t[3])+t[3],16)/255)},HEX:function(e){var t=/^([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/.exec(e);if(t)return new x.colorpicker.Color(parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255)},HEX3:function(e){var t=/^([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])$/.exec(e);if(t)return new x.colorpicker.Color(parseInt(String(t[1])+t[1],16)/255,parseInt(String(t[2])+t[2],16)/255,parseInt(String(t[3])+t[3],16)/255)},"#HEXA":function(e){var t=/^#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/.exec(e);if(t)return new x.colorpicker.Color(parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255,parseInt(t[4],16)/255)},"#HEXA4":function(e){var t=/^#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])$/.exec(e);if(t)return new x.colorpicker.Color(parseInt(String(t[1])+t[1],16)/255,parseInt(String(t[2])+t[2],16)/255,parseInt(String(t[3])+t[3],16)/255,parseInt(String(t[4])+t[4],16)/255)},HEXA:function(e){var t=/^([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/.exec(e);if(t)return new x.colorpicker.Color(parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255,parseInt(t[4],16)/255)},HEXA4:function(e){var t=/^([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])$/.exec(e);if(t)return new x.colorpicker.Color(parseInt(String(t[1])+t[1],16)/255,parseInt(String(t[2])+t[2],16)/255,parseInt(String(t[3])+t[3],16)/255,parseInt(String(t[4])+t[4],16)/255)}},this.partslists={full:["header","map","bar","hex","hsv","rgb","alpha","lab","cmyk","preview","swatches","footer"],popup:["map","bar","hex","hsv","rgb","alpha","preview","footer"],draggable:["header","map","bar","hex","hsv","rgb","alpha","preview","footer"],inline:["map","bar","hex","hsv","rgb","alpha","preview"]},this.limits={websafe:function(e){e.limit(6)},nibble:function(e){e.limit(16)},binary:function(e){e.limit(2)},name:function(e,t){var n=t._getSwatch(t._closestName(e));e.setRGB(n.r,n.g,n.b)}},this.parts={header:function(o){var i=null,a=function(e){e.preventDefault(),o.close(o.options.revert)};this.init=function(){var e;i=x((e='<span class="ui-dialog-title">'+(o.options.title||o._getRegional("title"))+"</span>",!o.inline&&o.options.showCloseButton&&(e+='<a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button"><span class="ui-icon ui-icon-closethick">close</span></a>'),'<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">'+e+"</div>")).prependTo(o.dialog);var t=x(".ui-dialog-titlebar-close",i);if(o._hoverable(t),o._focusable(t),t.on("click",a),!o.inline&&o.options.draggable){var n={handle:i};o.options.containment&&(n.containment=o.options.containment),o.dialog.draggable(n)}},this.disable=function(e){x(".ui-dialog-titlebar-close",i)[e?"off":"on"]("click",a)}},map:function(l){var i,c,p,a,s,r,t,e,u=this,d=null,h={};a=function(e){if(l.opened){var t=h.p.offset(),n=e.pageX-t.left,o=e.pageY-t.top;0<=n&&n<c&&0<=o&&o<p&&(e.stopImmediatePropagation(),e.preventDefault(),d.off("mousedown",a).focus(),x(document).on("mouseup",s),x(document).on("mousemove",r),r(e))}},s=function(e){e.stopImmediatePropagation(),e.preventDefault(),x(document).off("mouseup",s),x(document).off("mousemove",r),d.on("mousedown",a),l._callback("stop")},r=function(e){if(e.stopImmediatePropagation(),e.preventDefault(),e.pageX!==u.x||e.pageY!==u.y){u.x=e.pageX,u.y=e.pageY;var t=h.p.offset(),n=e.pageX-t.left,o=e.pageY-t.top;switch(n=Math.max(0,Math.min(n/c,1)),o=Math.max(0,Math.min(o/p,1)),l.mode){case"h":l.color.setHSV(null,n,1-o);break;case"s":case"a":l.color.setHSV(n,null,1-o);break;case"v":l.color.setHSV(n,1-o,null);break;case"r":l.color.setRGB(null,1-o,n);break;case"g":l.color.setRGB(1-o,null,n);break;case"b":l.color.setRGB(n,1-o,null)}l._change(!1)}},t=function(e){var t,n,o={h:"s",s:"h",v:"h",r:"b",g:"b",b:"r",a:"h"},i={37:-1,39:1},a={h:"v",s:"v",v:"s",r:"g",g:"r",b:"g",a:"v"},s={38:1,40:-1},r={35:0,36:1};void 0!==i[e.which]?(n=l.color.getChannel(o[l.mode])*c,t=i[e.which],e.shiftKey?t*=10:e.ctrlKey&&(t*=c),l.color.setChannel(o[l.mode],(n+t)/c),l._change(!1)):void 0!==s[e.which]?(n=l.color.getChannel(a[l.mode])*p,t=s[e.which],e.shiftKey?t*=10:e.ctrlKey&&(t*=p),l.color.setChannel(a[l.mode],(n+t)/p),l._change(!1)):void 0!==r[e.which]&&(l.color.setChannel(o[l.mode],1-r[e.which]),l.color.setChannel(a[l.mode],r[e.which]),l._change(!1))},e=function(){return'<div class="ui-colorpicker-map ui-colorpicker-map-'+(l.options.part.map.size||256)+' ui-colorpicker-border" taonex="0"><span class="ui-colorpicker-map-layer-1">&nbsp;</span><span class="ui-colorpicker-map-layer-2">&nbsp;</span>'+(l.options.alpha?'<span class="ui-colorpicker-map-layer-alpha">&nbsp;</span>':"")+'<span class="ui-colorpicker-map-layer-pointer"><span class="ui-colorpicker-map-pointer"></span></span></div>'},this.init=function(){(d=x(e()).appendTo(x(".ui-colorpicker-map-container",l.dialog))).on("mousedown",a),d.on("keydown",t),h[1]=x(".ui-colorpicker-map-layer-1",d),h[2]=x(".ui-colorpicker-map-layer-2",d),h.a=x(".ui-colorpicker-map-layer-alpha",d),h.p=x(".ui-colorpicker-map-layer-pointer",d),c=h.p.width(),p=h.p.height(),i=x(".ui-colorpicker-map-pointer",d)},this.update=function(){var e=65*(l.options.part.map.size||256)/64;switch(l.mode){case"h":h[1].css({"background-position":"0 0",opacity:""}).show(),h[2].hide();break;case"s":case"a":h[1].css({"background-position":"0 "+-e+"px",opacity:""}).show(),h[2].css({"background-position":"0 "+2*-e+"px",opacity:""}).show();break;case"v":d.css("background-color","black"),h[1].css({"background-position":"0 "+3*-e+"px",opacity:""}).show(),h[2].hide();break;case"r":h[1].css({"background-position":"0 "+4*-e+"px",opacity:""}).show(),h[2].css({"background-position":"0 "+5*-e+"px",opacity:""}).show();break;case"g":h[1].css({"background-position":"0 "+6*-e+"px",opacity:""}).show(),h[2].css({"background-position":"0 "+7*-e+"px",opacity:""}).show();break;case"b":h[1].css({"background-position":"0 "+8*-e+"px",opacity:""}).show(),h[2].css({"background-position":"0 "+9*-e+"px",opacity:""}).show()}u.repaint()},this.repaint=function(){var e=0,t=0;switch(l.mode){case"h":e=(n=l.color.getHSV()).s*c,t=(1-n.v)*c,d.css("background-color",l.color.copy().setHSV(null,1,1).toCSS());break;case"s":case"a":e=(n=l.color.getHSV()).h*c,t=(1-n.v)*c,h[2].css("opacity",1-n.s);break;case"v":var n;e=(n=l.color.getHSV()).h*c,t=(1-n.s)*c,h[1].css("opacity",n.v);break;case"r":e=(o=l.color.getRGB()).b*c,t=(1-o.g)*c,h[2].css("opacity",o.r);break;case"g":e=(o=l.color.getRGB()).b*c,t=(1-o.r)*c,h[2].css("opacity",o.g);break;case"b":var o;e=(o=l.color.getRGB()).r*c,t=(1-o.g)*c,h[2].css("opacity",o.b)}l.options.alpha&&h.a.css("opacity",1-l.color.getAlpha()),i.css({left:e-7,top:t-7})},this.disable=function(e){d[e?"off":"on"]("mousedown",a),d[e?"off":"on"]("keydown",t)}},bar:function(i){var o,a,s,r,l,c,t,e,p=this,u=null,d={};r=function(e){if(i.opened){var t=d.p.offset(),n=e.pageX-t.left,o=e.pageY-t.top;0<=n&&n<a&&0<=o&&o<s&&(e.stopImmediatePropagation(),e.preventDefault(),u.off("mousedown",r).focus(),x(document).on("mouseup",l),x(document).on("mousemove",c),c(e))}},l=function(e){e.stopImmediatePropagation(),e.preventDefault(),x(document).off("mouseup",l),x(document).off("mousemove",c),u.on("mousedown",r),i._callback("stop")},c=function(e){if(e.stopImmediatePropagation(),e.preventDefault(),e.pageY!==p.y){p.y=e.pageY;var t=d.p.offset(),n=e.pageY-t.top;switch(n=Math.max(0,Math.min(n/s,1)),i.mode){case"h":i.color.setHSV(1-n,null,null);break;case"s":i.color.setHSV(null,1-n,null);break;case"v":i.color.setHSV(null,null,1-n);break;case"r":i.color.setRGB(1-n,null,null);break;case"g":i.color.setRGB(null,1-n,null);break;case"b":i.color.setRGB(null,null,1-n);break;case"a":i.color.setAlpha(1-n)}i._change(!1)}},t=function(e){var t,n,o={35:0,36:1};void 0!==(t={38:1,40:-1,33:10,34:-10})[e.which]?(n=i.color.getChannel(i.mode)*s,t=t[e.which],e.shiftKey?t*=10:e.ctrlKey&&(t*=s),i.color.setChannel(i.mode,(n+t)/s),i._change(!1)):void 0!==o[e.which]&&(i.color.setChannel(i.mode,o[e.which]),i._change(!1))},e=function(){var e='<div class="ui-colorpicker-bar ui-colorpicker-bar-'+(i.options.part.bar.size||256)+' ui-colorpicker-border" taonex="0"><span class="ui-colorpicker-bar-layer-1">&nbsp;</span><span class="ui-colorpicker-bar-layer-2">&nbsp;</span><span class="ui-colorpicker-bar-layer-3">&nbsp;</span><span class="ui-colorpicker-bar-layer-4">&nbsp;</span>';return i.options.alpha&&(e+='<span class="ui-colorpicker-bar-layer-alpha">&nbsp;</span><span class="ui-colorpicker-bar-layer-alphabar">&nbsp;</span>'),e+='<span class="ui-colorpicker-bar-layer-pointer"><span class="ui-colorpicker-bar-pointer"></span></span></div>'},this.init=function(){(u=x(e()).appendTo(x(".ui-colorpicker-bar-container",i.dialog))).on("mousedown",r),u.on("keydown",t),d[1]=x(".ui-colorpicker-bar-layer-1",u),d[2]=x(".ui-colorpicker-bar-layer-2",u),d[3]=x(".ui-colorpicker-bar-layer-3",u),d[4]=x(".ui-colorpicker-bar-layer-4",u),d.a=x(".ui-colorpicker-bar-layer-alpha",u),d.ab=x(".ui-colorpicker-bar-layer-alphabar",u),d.p=x(".ui-colorpicker-bar-layer-pointer",u),a=d.p.width(),s=d.p.height(),o=x(".ui-colorpicker-bar-pointer",u)},this.update=function(){var e=65*(i.options.part.bar.size||256)/64;switch(i.mode){case"h":case"s":case"v":case"r":case"g":case"b":d.a.show(),d.ab.hide();break;case"a":d.a.hide(),d.ab.show()}switch(i.mode){case"h":d[1].css({"background-position":"0 0",opacity:""}).show(),d[2].hide(),d[3].hide(),d[4].hide();break;case"s":d[1].css({"background-position":"0 "+-e+"px",opacity:""}).show(),d[2].css({"background-position":"0 "+2*-e+"px",opacity:""}).show(),d[3].hide(),d[4].hide();break;case"v":d[1].css({"background-position":"0 "+2*-e+"px",opacity:""}).show(),d[2].hide(),d[3].hide(),d[4].hide();break;case"r":d[1].css({"background-position":"0 "+6*-e+"px",opacity:""}).show(),d[2].css({"background-position":"0 "+5*-e+"px",opacity:""}).show(),d[3].css({"background-position":"0 "+3*-e+"px",opacity:""}).show(),d[4].css({"background-position":"0 "+4*-e+"px",opacity:""}).show();break;case"g":d[1].css({"background-position":"0 "+10*-e+"px",opacity:""}).show(),d[2].css({"background-position":"0 "+9*-e+"px",opacity:""}).show(),d[3].css({"background-position":"0 "+7*-e+"px",opacity:""}).show(),d[4].css({"background-position":"0 "+8*-e+"px",opacity:""}).show();break;case"b":d[1].css({"background-position":"0 "+14*-e+"px",opacity:""}).show(),d[2].css({"background-position":"0 "+13*-e+"px",opacity:""}).show(),d[3].css({"background-position":"0 "+11*-e+"px",opacity:""}).show(),d[4].css({"background-position":"0 "+12*-e+"px",opacity:""}).show();break;case"a":d[1].hide(),d[2].hide(),d[3].hide(),d[4].hide()}p.repaint()},this.repaint=function(){var e=0;switch(i.mode){case"h":e=(1-i.color.getHSV().h)*s;break;case"s":var t=i.color.getHSV();e=(1-t.s)*s,d[2].css("opacity",1-t.v),u.css("background-color",i.color.copy().setHSV(null,1,null).toCSS());break;case"v":e=(1-i.color.getHSV().v)*s,u.css("background-color",i.color.copy().setHSV(null,null,1).toCSS());break;case"r":e=(1-(n=i.color.getRGB()).r)*s,d[2].css("opacity",Math.max(0,n.b-n.g)),d[3].css("opacity",Math.max(0,n.g-n.b)),d[4].css("opacity",Math.min(n.b,n.g));break;case"g":e=(1-(n=i.color.getRGB()).g)*s,d[2].css("opacity",Math.max(0,n.b-n.r)),d[3].css("opacity",Math.max(0,n.r-n.b)),d[4].css("opacity",Math.min(n.r,n.b));break;case"b":var n;e=(1-(n=i.color.getRGB()).b)*s,d[2].css("opacity",Math.max(0,n.r-n.g)),d[3].css("opacity",Math.max(0,n.g-n.r)),d[4].css("opacity",Math.min(n.r,n.g));break;case"a":e=(1-i.color.getAlpha())*s,u.css("background-color",i.color.copy().toCSS())}"a"!==i.mode&&d.a.css("opacity",1-i.color.getAlpha()),o.css("top",e-3)},this.disable=function(e){u[e?"off":"on"]("mousedown",r),u[e?"off":"on"]("keydown",t)}},preview:function(e){var t,n,o,i,a,s=null,r=function(){e.color=e.currentColor.copy(),e._change()};this.init=function(){s=x('<div class="ui-colorpicker-preview ui-colorpicker-border"><div class="ui-colorpicker-preview-initial"><div class="ui-colorpicker-preview-initial-alpha"></div></div><div class="ui-colorpicker-preview-current"><div class="ui-colorpicker-preview-current-alpha"></div></div></div>').appendTo(x(".ui-colorpicker-preview-container",e.dialog)),x(".ui-colorpicker-preview-initial",s).on("click",r),n=x(".ui-colorpicker-preview-initial",s),o=x(".ui-colorpicker-preview-initial-alpha",s),i=x(".ui-colorpicker-preview-current",s),a=x(".ui-colorpicker-preview-current-alpha",s),t=x(".ui-colorpicker-preview-initial-alpha, .ui-colorpicker-preview-current-alpha",s)},this.update=function(){t[e.options.alpha?"show":"hide"](),this.repaint()},this.repaint=function(){n.css("background-color",e.currentColor.set?e.currentColor.toCSS():"").attr("title",e.currentColor.set?e.currentColor.toCSS():""),o.css("opacity",1-e.currentColor.getAlpha()),i.css("background-color",e.color.set?e.color.toCSS():"").attr("title",e.color.set?e.color.toCSS():""),a.css("opacity",1-e.color.getAlpha())},this.disable=function(e){x(".ui-colorpicker-preview-initial",s)[e?"off":"on"]("click",r)}},hsv:function(t){var e,n=null,o={};e=function(){var e="";return t.options.hsv&&(e+='<div class="ui-colorpicker-hsv-h"><input class="ui-colorpicker-mode" type="radio" value="h"/><label>'+t._getRegional("hsvH")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="360" size="10"/><span class="ui-colorpicker-unit">&deg;</span></div><div class="ui-colorpicker-hsv-s"><input class="ui-colorpicker-mode" type="radio" value="s"/><label>'+t._getRegional("hsvS")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="100" size="10"/><span class="ui-colorpicker-unit">%</span></div><div class="ui-colorpicker-hsv-v"><input class="ui-colorpicker-mode" type="radio" value="v"/><label>'+t._getRegional("hsvV")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="100" size="10"/><span class="ui-colorpicker-unit">%</span></div>'),'<div class="ui-colorpicker-hsv">'+e+"</div>"},this.init=function(){n=x(e()).appendTo(x(".ui-colorpicker-hsv-container",t.dialog)),x(".ui-colorpicker-mode",n).click(function(){t.mode=x(this).val(),t._updateAllParts()}),o.h=x(".ui-colorpicker-hsv-h .ui-colorpicker-number",n),o.s=x(".ui-colorpicker-hsv-s .ui-colorpicker-number",n),o.v=x(".ui-colorpicker-hsv-v .ui-colorpicker-number",n),x(".ui-colorpicker-number",n).on("change keyup",function(){t.color.setHSV(o.h.val()/360,o.s.val()/100,o.v.val()/100),t._change()})},this.repaint=function(){var e=t.color.getHSV();o.h.val(Math.round(360*e.h)),o.s.val(Math.round(100*e.s)),o.v.val(Math.round(100*e.v))},this.update=function(){x(".ui-colorpicker-mode",n).each(function(){var e=x(this);e.prop("checked",e.val()===t.mode)}),this.repaint()},this.disable=function(e){x(":input",n).prop("disabled",e)}},rgb:function(t){var e,n=null,o={};e=function(){var e="";return t.options.rgb&&(e+='<div class="ui-colorpicker-rgb-r"><input class="ui-colorpicker-mode" type="radio" value="r"/><label>'+t._getRegional("rgbR")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="255"/></div><div class="ui-colorpicker-rgb-g"><input class="ui-colorpicker-mode" type="radio" value="g"/><label>'+t._getRegional("rgbG")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="255"/></div><div class="ui-colorpicker-rgb-b"><input class="ui-colorpicker-mode" type="radio" value="b"/><label>'+t._getRegional("rgbB")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="255"/></div>'),'<div class="ui-colorpicker-rgb">'+e+"</div>"},this.init=function(){n=x(e()).appendTo(x(".ui-colorpicker-rgb-container",t.dialog)),x(".ui-colorpicker-mode",n).click(function(){t.mode=x(this).val(),t._updateAllParts()}),o.r=x(".ui-colorpicker-rgb-r .ui-colorpicker-number",n),o.g=x(".ui-colorpicker-rgb-g .ui-colorpicker-number",n),o.b=x(".ui-colorpicker-rgb-b .ui-colorpicker-number",n),x(".ui-colorpicker-number",n).on("change keyup",function(){x(".ui-colorpicker-rgb-r .ui-colorpicker-number",n).val();t.color.setRGB(o.r.val()/255,o.g.val()/255,o.b.val()/255),t._change()})},this.repaint=function(){var e=t.color.getRGB();o.r.val(Math.round(255*e.r)),o.g.val(Math.round(255*e.g)),o.b.val(Math.round(255*e.b))},this.update=function(){x(".ui-colorpicker-mode",n).each(function(){var e=x(this);e.prop("checked",e.val()===t.mode)}),this.repaint()},this.disable=function(e){x(":input",n).prop("disabled",e)}},lab:function(t){var n=null,o={};this.init=function(){var e;n=x((e="",t.options.hsv&&(e+='<div class="ui-colorpicker-lab-l"><label>'+t._getRegional("labL")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/></div><div class="ui-colorpicker-lab-a"><label>'+t._getRegional("labA")+'</label><input class="ui-colorpicker-number" type="number" min="-128" max="127"/></div><div class="ui-colorpicker-lab-b"><label>'+t._getRegional("labB")+'</label><input class="ui-colorpicker-number" type="number" min="-128" max="127"/></div>'),'<div class="ui-colorpicker-lab">'+e+"</div>")).appendTo(x(".ui-colorpicker-lab-container",t.dialog)),o.l=x(".ui-colorpicker-lab-l .ui-colorpicker-number",n),o.a=x(".ui-colorpicker-lab-a .ui-colorpicker-number",n),o.b=x(".ui-colorpicker-lab-b .ui-colorpicker-number",n),x(".ui-colorpicker-number",n).on("change keyup",function(e){t.color.setLAB(parseInt(o.l.val(),10)/100,(parseInt(o.a.val(),10)+128)/255,(parseInt(o.b.val(),10)+128)/255),t._change()})},this.repaint=function(){var e=t.color.getLAB();o.l.val(Math.round(100*e.l)),o.a.val(Math.round(255*e.a)-128),o.b.val(Math.round(255*e.b)-128)},this.update=this.repaint,this.disable=function(e){x(":input",n).prop("disabled",e)}},cmyk:function(t){var n=null,o={};this.init=function(){var e;n=x((e="",t.options.hsv&&(e+='<div class="ui-colorpicker-cmyk-c"><label>'+t._getRegional("cmykC")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div><div class="ui-colorpicker-cmyk-m"><label>'+t._getRegional("cmykM")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div><div class="ui-colorpicker-cmyk-y"><label>'+t._getRegional("cmykY")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div><div class="ui-colorpicker-cmyk-k"><label>'+t._getRegional("cmykK")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div>'),'<div class="ui-colorpicker-cmyk">'+e+"</div>")).appendTo(x(".ui-colorpicker-cmyk-container",t.dialog)),o.c=x(".ui-colorpicker-cmyk-c .ui-colorpicker-number",n),o.m=x(".ui-colorpicker-cmyk-m .ui-colorpicker-number",n),o.y=x(".ui-colorpicker-cmyk-y .ui-colorpicker-number",n),o.k=x(".ui-colorpicker-cmyk-k .ui-colorpicker-number",n),x(".ui-colorpicker-number",n).on("change keyup",function(e){t.color.setCMYK(parseInt(o.c.val(),10)/100,parseInt(o.m.val(),10)/100,parseInt(o.y.val(),10)/100,parseInt(o.k.val(),10)/100),t._change()})},this.repaint=function(){var e=t.color.getCMYK();o.c.val(Math.round(100*e.c)),o.m.val(Math.round(100*e.m)),o.y.val(Math.round(100*e.y)),o.k.val(Math.round(100*e.k))},this.update=this.repaint,this.disable=function(e){x(":input",n).prop("disabled",e)}},alpha:function(t){var n,o=null;this.init=function(){var e;o=x((e="",t.options.alpha&&(e+='<div class="ui-colorpicker-a"><input class="ui-colorpicker-mode" name="mode" type="radio" value="a"/><label>'+t._getRegional("alphaA")+'</label><input class="ui-colorpicker-number" type="number" min="0" max="100"/><span class="ui-colorpicker-unit">%</span></div>'),'<div class="ui-colorpicker-alpha">'+e+"</div>")).appendTo(x(".ui-colorpicker-alpha-container",t.dialog)),x(".ui-colorpicker-mode",o).click(function(){t.mode=x(this).val(),t._updateAllParts()}),n=x(".ui-colorpicker-a .ui-colorpicker-number",o),x(".ui-colorpicker-number",o).on("change keyup",function(){t.color.setAlpha(n.val()/100),t._change()})},this.update=function(){x(".ui-colorpicker-mode",o).each(function(){x(this).prop("checked",x(this).val()===t.mode)}),this.repaint()},this.repaint=function(){n.val(Math.round(100*t.color.getAlpha()))},this.disable=function(e){x(":input",o).prop("disabled",e)}},hex:function(o){var t=null,i={};this.init=function(){var e;t=x((e="",o.options.alpha&&(e+='<input class="ui-colorpicker-hex-alpha" type="text" maxlength="2" size="2"/>'),'<div class="ui-colorpicker-hex"><label>#</label>'+(e+='<input class="ui-colorpicker-hex-input" type="text" maxlength="6" size="6"/>')+"</div>")).appendTo(x(".ui-colorpicker-hex-container",o.dialog)),i.color=x(".ui-colorpicker-hex-input",t),i.alpha=x(".ui-colorpicker-hex-alpha",t),i.color.on("keydown keyup",function(e){return e.ctrlKey||s(e.which)||!a(e.which)}),i.color.on("change",function(){/[^a-fA-F0-9]/.test(i.color.val())&&i.color.val(i.color.val().replace(/[^a-fA-F0-9]/,""))}),i.color.on("change keyup",function(){var e,t,n;o.color=(e=i.color.val(),(n=/^#?([a-fA-F0-9]{1,3})$/.exec(e))?(t=parseInt(n[1],16),new x.colorpicker.Color((t>>8&15)/15,(t>>4&15)/15,(15&t)/15)):(n=/^#?([a-fA-F0-9]{1,6})$/.exec(e))?(t=parseInt(n[1],16),new x.colorpicker.Color((t>>16&255)/255,(t>>8&255)/255,(255&t)/255)):new x.colorpicker.Color).setAlpha(o.color.getAlpha()),o._change()}),i.alpha.on("keydown keyup",function(e){return e.ctrlKey||s(e.which)||!a(e.which)}),i.alpha.on("change",function(){/[^a-fA-F0-9]/.test(i.alpha)&&i.alpha.val(i.alpha.val().replace(/[^a-fA-F0-9]/,""))}),i.alpha.on("change keyup",function(){o.color.setAlpha(parseInt(i.alpha.val(),16)/255),o._change()})},this.repaint=function(){i.color.is(":focus")||i.color.val(o.color.toHex(!0)),i.alpha.is(":focus")||i.alpha.val(r(255*o.color.getAlpha()))},this.update=this.repaint,this.disable=function(e){x(":input",t).prop("disabled",e)}},swatches:function(e){var t=null,n=function(){e.color=e._parseColor(x(this).css("background-color"))||new x.colorpicker.Color,e._change()};this.init=function(){var o;t=x((o="",e._eachSwatch(function(e,t){var n=new x.colorpicker.Color(t.r,t.g,t.b).toCSS();o+='<div class="ui-colorpicker-swatch" style="background-color:'+n+'" title="'+e+'"></div>'}),'<div class="ui-colorpicker-swatches ui-colorpicker-border" style="width:'+e.options.swatchesWidth+'px">'+o+"</div>")),x(".ui-colorpicker-swatches-container",e.dialog).html(t),x(".ui-colorpicker-swatch",t).on("click",n)},this.disable=function(e){x(".ui-colorpicker-swatch",t)[e?"off":"on"]("click",n)}},footer:function(t){var n=null,o="ui-colorpicker-special-transparent-"+t.colorpicker_index,i="ui-colorpicker-special-none-"+t.colorpicker_index;this.init=function(){var e;n=x((e="",(t.options.alpha||!t.inline&&t.options.showNoneButton)&&(e+='<div class="ui-colorpicker-buttonset">',t.options.alpha&&(e+='<input type="radio" name="ui-colorpicker-special" id="'+o+'" class="ui-colorpicker-special-transparent"/><label for="'+o+'">'+t._getRegional("transparent")+"</label>"),!t.inline&&t.options.showNoneButton&&(e+='<input type="radio" name="ui-colorpicker-special" id="'+i+'" class="ui-colorpicker-special-none"><label for="'+i+'">'+t._getRegional("none")+"</label>"),e+="</div>"),t.inline||(e+='<div class="ui-dialog-buttonset">',t.options.showCancelButton&&(e+='<button class="ui-colorpicker-cancel">'+t._getRegional("cancel")+"</button>"),e+='<button class="ui-colorpicker-ok">'+t._getRegional("ok")+"</button>",e+="</div>"),'<div class="ui-dialog-buttonpane ui-widget-content">'+e+"</div>")).appendTo(t.dialog),x(".ui-colorpicker-ok",n).button().click(function(){t.close()}),x(".ui-colorpicker-cancel",n).button().click(function(){t.close(!0)}),x(".ui-colorpicker-buttonset",n)[x.fn.controlgroup?"controlgroup":"buttonset"](),x(".ui-colorpicker-special-color",n).click(function(){t._change()}),x("#"+i,n).click(function(){t.color.set=!1,t._change()}),x("#"+o,n).click(function(){t.color.setAlpha(0),t._change()})},this.repaint=function(){x(".ui-colorpicker-special-none",n).prop("checked",!t.color.set).button("refresh"),x(".ui-colorpicker-special-transparent",n).prop("checked",t.color.set&&0===t.color.getAlpha()).button("refresh"),x(".ui-colorpicker-ok",n).button(t.changed?"enable":"disable")},this.update=function(){},this.disable=function(e){x(":input, :button",n).button(e?"disable":"enable"),e||x(".ui-colorpicker-ok",n).button(t.changed?"enable":"disable")}}},this.Color=function(){var y={rgb:{r:0,g:0,b:0},hsv:{h:0,s:0,v:0},hsl:{h:0,s:0,l:0},lab:{l:0,a:0,b:0},cmyk:{c:0,m:0,y:0,k:1}},t=1,w=[.9504285,1,1.0889],e=arguments,_=function(e){return isNaN(e)||null===e?0:("string"==typeof e&&(e=parseInt(e,10)),Math.max(0,Math.min(e,1)))},n=function(e){var t="0123456789abcdef",n=(e=Math.round(e))%16;return t.charAt((e-n)/16)+t.charAt(n)},o=function(e){var t=.04045<e.r?Math.pow((e.r+.055)/1.055,2.4):e.r/12.92,n=.04045<e.g?Math.pow((e.g+.055)/1.055,2.4):e.g/12.92,o=.04045<e.b?Math.pow((e.b+.055)/1.055,2.4):e.b/12.92;return{x:.4124*t+.3576*n+.1805*o,y:.2126*t+.7152*n+.0722*o,z:.0193*t+.1192*n+.9505*o}},i=function(e){var t,n,o,i=Math.min(e.r,e.g,e.b),a=Math.max(e.r,e.g,e.b),s=a-i,r={h:0,s:0,v:a};return 0===s?(r.h=0,r.s=0):(r.s=s/a,t=((a-e.r)/6+s/2)/s,n=((a-e.g)/6+s/2)/s,o=((a-e.b)/6+s/2)/s,e.r===a?r.h=o-n:e.g===a?r.h=1/3+t-o:e.b===a&&(r.h=2/3+n-t),r.h<0?r.h+=1:1<r.h&&(r.h-=1)),r},a=function(e){var t,n,o,i=Math.min(e.r,e.g,e.b),a=Math.max(e.r,e.g,e.b),s=a-i,r={h:0,s:0,l:(a+i)/2};return 0===s?(r.h=0,r.s=0):(r.s=r.l<.5?s/(a+i):s/(2-a-i),t=((a-e.r)/6+s/2)/s,n=((a-e.g)/6+s/2)/s,o=((a-e.b)/6+s/2)/s,e.r===a?r.h=o-n:e.g===a?r.h=1/3+t-o:e.b===a&&(r.h=2/3+n-t),r.h<0?r.h+=1:1<r.h&&(r.h-=1)),r},s=function(e){var t=e.x/w[0],n=e.y/w[1],o=e.z/w[2];return t=.008856<t?Math.pow(t,1/3):7.787*t+16/116,{l:(116*(n=.008856<n?Math.pow(n,1/3):7.787*n+16/116)-16)/100,a:(500*(t-n)+128)/255,b:(200*(n-(o=.008856<o?Math.pow(o,1/3):7.787*o+16/116))+128)/255}},r=function(e){return{c:1-e.r,m:1-e.g,y:1-e.b}},l=function(e){var t=1;return e.c<t&&(t=e.c),e.m<t&&(t=e.m),e.y<t&&(t=e.y),1===t?{c:0,m:0,y:0,k:1}:{c:(e.c-t)/(1-t),m:(e.m-t)/(1-t),y:(e.y-t)/(1-t),k:t}};this.set=!1,this.setAlpha=function(e){return null!==e&&(t=_(e)),this.set=!0,this},this.getAlpha=function(){return t},this.setRGB=function(e,t,n){return y={rgb:this.getRGB()},null!==e&&(y.rgb.r=_(e)),null!==t&&(y.rgb.g=_(t)),null!==n&&(y.rgb.b=_(n)),this.set=!0,this},this.getChannel=function(e){switch(e){case"h":case"s":case"v":return this.getHSV()[e];case"r":case"g":case"b":return this.getRGB()[e];case"a":return this.getAlpha()}return null},this.setChannel=function(e,t){switch(e){case"h":return this.setHSV(t,null,null);case"s":return this.setHSV(null,t,null);case"v":return this.setHSV(null,null,t);case"r":return this.setRGB(t,null,null);case"g":return this.setRGB(null,t,null);case"b":return this.setRGB(null,null,t);case"a":return this.setAlpha(t)}return this},this.setHSV=function(e,t,n){return y={hsv:this.getHSV()},null!==e&&(y.hsv.h=_(e)),null!==t&&(y.hsv.s=_(t)),null!==n&&(y.hsv.v=_(n)),this.set=!0,this},this.setHSL=function(e,t,n){return y={hsl:this.getHSL()},null!==e&&(y.hsl.h=_(e)),null!==t&&(y.hsl.s=_(t)),null!==n&&(y.hsl.l=_(n)),this.set=!0,this},this.setLAB=function(e,t,n){return y={lab:this.getLAB()},null!==e&&(y.lab.l=_(e)),null!==t&&(y.lab.a=_(t)),null!==n&&(y.lab.b=_(n)),this.set=!0,this},this.setCMYK=function(e,t,n,o){return y={cmyk:this.getCMYK()},null!==e&&(y.cmyk.c=_(e)),null!==t&&(y.cmyk.m=_(t)),null!==n&&(y.cmyk.y=_(n)),null!==o&&(y.cmyk.k=_(o)),this.set=!0,this},this.getRGB=function(){var e,t,n,o,i,a,s,r,l,c,p,u,d,h,g,m,b,f,v,k;return y.rgb||(y.rgb=y.lab?(m=y.lab,b=100*m.l,f=255*m.a-128,v=255*m.b-128,(k={x:0,y:(b+16)/116,z:0}).x=f/500+k.y,k.z=k.y-v/200,k.x=.008856<Math.pow(k.x,3)?Math.pow(k.x,3):(k.x-16/116)/7.787,k.y=.008856<Math.pow(k.y,3)?Math.pow(k.y,3):(k.y-16/116)/7.787,k.z=.008856<Math.pow(k.z,3)?Math.pow(k.z,3):(k.z-16/116)/7.787,k.x*=w[0],k.y*=w[1],k.z*=w[2],(g={r:3.2406*(h=k).x+-1.5372*h.y+-.4986*h.z,g:-.9689*h.x+1.8758*h.y+.0415*h.z,b:.0557*h.x+-.204*h.y+1.057*h.z}).r=.0031308<g.r?1.055*Math.pow(g.r,1/2.4)-.055:12.92*g.r,g.g=.0031308<g.g?1.055*Math.pow(g.g,1/2.4)-.055:12.92*g.g,g.b=.0031308<g.b?1.055*Math.pow(g.b,1/2.4)-.055:12.92*g.b,g):y.hsv?(s=y.hsv,d={r:0,g:0,b:0},0===s.s?d.r=d.g=d.b=s.v:(r=1===s.h?0:6*s.h,l=Math.floor(r),c=s.v*(1-s.s),p=s.v*(1-s.s*(r-l)),u=s.v*(1-s.s*(1-(r-l))),d.b=0===l?(d.r=s.v,d.g=u,c):1===l?(d.r=p,d.g=s.v,c):2===l?(d.r=c,d.g=s.v,u):3===l?(d.r=c,d.g=p,s.v):4===l?(d.r=u,d.g=c,s.v):(d.r=s.v,d.g=c,p)),d):y.hsl?(n=y.hsl,a=function(e,t,n){return n<0&&(n+=1),1<n&&(n-=1),6*n<1?e+6*(t-e)*n:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e},0===n.s?{r:n.l,g:n.l,b:n.l}:(i=n.l<.5?n.l*(1+n.s):n.l+n.s-n.s*n.l,{r:a(o=2*n.l-i,i,n.h+1/3),g:a(o,i,n.h),b:a(o,i,n.h-1/3)})):y.cmyk?(t=y.cmyk,{r:1-(e={c:t.c*(1-t.k)+t.k,m:t.m*(1-t.k)+t.k,y:t.y*(1-t.k)+t.k}).c,g:1-e.m,b:1-e.y}):{r:0,g:0,b:0},y.rgb.r=_(y.rgb.r),y.rgb.g=_(y.rgb.g),y.rgb.b=_(y.rgb.b)),x.extend({},y.rgb)},this.getHSV=function(){return y.hsv||(y.hsv=y.lab?i(this.getRGB()):y.rgb?i(y.rgb):y.hsl?i(this.getRGB()):y.cmyk?i(this.getRGB()):{h:0,s:0,v:0},y.hsv.h=_(y.hsv.h),y.hsv.s=_(y.hsv.s),y.hsv.v=_(y.hsv.v)),x.extend({},y.hsv)},this.getHSL=function(){return y.hsl||(y.hsl=y.rgb?a(y.rgb):y.hsv?a(this.getRGB()):y.cmyk?a(this.getRGB()):y.hsv?a(this.getRGB()):{h:0,s:0,l:0},y.hsl.h=_(y.hsl.h),y.hsl.s=_(y.hsl.s),y.hsl.l=_(y.hsl.l)),x.extend({},y.hsl)},this.getCMYK=function(){return y.cmyk||(y.cmyk=y.rgb?l(r(y.rgb)):y.hsv?l(r(this.getRGB())):y.hsl?l(r(this.getRGB())):y.lab?l(r(this.getRGB())):{c:0,m:0,y:0,k:1},y.cmyk.c=_(y.cmyk.c),y.cmyk.m=_(y.cmyk.m),y.cmyk.y=_(y.cmyk.y),y.cmyk.k=_(y.cmyk.k)),x.extend({},y.cmyk)},this.getLAB=function(){return y.lab||(y.lab=y.rgb?s(o(y.rgb)):y.hsv?s(o(this.getRGB())):y.hsl?s(o(this.getRGB())):y.cmyk?s(o(this.getRGB())):{l:0,a:0,b:0},y.lab.l=_(y.lab.l),y.lab.a=_(y.lab.a),y.lab.b=_(y.lab.b)),x.extend({},y.lab)},this.getChannels=function(){return{r:this.getRGB().r,g:this.getRGB().g,b:this.getRGB().b,a:this.getAlpha(),h:this.getHSV().h,s:this.getHSV().s,v:this.getHSV().v,c:this.getCMYK().c,m:this.getCMYK().m,y:this.getCMYK().y,k:this.getCMYK().k,L:this.getLAB().l,A:this.getLAB().a,B:this.getLAB().b}},this.getSpaces=function(){return x.extend(!0,{},y)},this.distance=function(e){var t,n="get"+"lab".toUpperCase(),o=this[n](),i=e[n](),a=0;for(t in o)a+=Math.pow(o[t]-i[t],2);return a},this.equals=function(e){if(e){var t=this.getRGB(),n=e.getRGB();return this.set===e.set&&this.getAlpha()===e.getAlpha()&&t.r===n.r&&t.g===n.g&&t.b===n.b}return!1},this.limit=function(e){e-=1;var t=this.getRGB();this.setRGB(Math.round(t.r*e)/e,Math.round(t.g*e)/e,Math.round(t.b*e)/e)},this.toHex=function(){var e=this.getRGB();return n(255*e.r)+n(255*e.g)+n(255*e.b)},this.toCSS=function(){return"#"+this.toHex()},this.copy=function(){var e=new x.colorpicker.Color(this.getSpaces(),this.getAlpha());return e.set=this.set,e},2===e.length&&(y=e[0],this.setAlpha(0===e[1]?0:e[1]||1),this.set=!0),2<e.length&&(this.setRGB(e[0],e[1],e[2]),this.setAlpha(0===e[3]?0:e[3]||1),this.set=!0)}},x.widget("vanderlee.colorpicker",{options:{alpha:!1,altAlpha:!0,altField:"",altOnChange:!0,altProperties:"background-color",autoOpen:!1,buttonClass:null,buttonColorize:!1,buttonImage:"images/ui-colorpicker.png",buttonImageOnly:!1,buttonText:null,closeOnEscape:!0,closeOnOutside:!0,color:"#00FF00",colorFormat:"HEX",disabled:!1,draggable:!0,containment:null,duration:"fast",hideOn:"button",hsv:!0,inline:!0,inlineFrame:!0,layout:{map:[0,0,1,5],bar:[1,0,1,5],preview:[2,0,1,1],hsv:[2,1,1,1],rgb:[2,2,1,1],alpha:[2,3,1,1],hex:[2,4,1,1],lab:[3,1,1,1],cmyk:[3,2,1,2],swatches:[4,0,1,5]},limit:"",modal:!1,mode:"h",okOnEnter:!1,parts:"",part:{map:{size:256},bar:{size:256}},position:null,regional:"",revert:!1,rgb:!0,showAnim:"fadeIn",showCancelButton:!0,showNoneButton:!1,showCloseButton:!0,showOn:"focus click alt",showOptions:{},swatches:null,swatchesWidth:84,title:null,cancel:null,close:null,init:null,ok:null,open:null,select:null,stop:null},_create:function(){var e,t=this;return t.colorpicker_index=n++,t.widgetEventPrefix="colorpicker",t.opened=!1,t.generated=!1,t.inline=!1,t.changed=!1,t.dialog=null,t.button=null,t.image=null,t.overlay=null,t.events={window_resize:null,document_keydown:null,document_click_html:null},t.mode=t.options.mode,t.element.is("input")||!1===t.options.inline?(t._setColor(t.element.is("input")?t.element.val():t.options.color),t._callback("init"),/\bfocus|all|both\b/.test(t.options.showOn)&&t.element.on("focus",function(){t.open()}),/\bfocus|all|both\b/.test(t.options.hideOn)&&t.element.on("focusout",function(e){t.close()}),/\bclick|all|both\b/.test(t.options.showOn)&&t.element.on("click",function(e){t.opened&&/\bclick|all|both\b/.test(t.options.hideOn)?t.close():t.open()}),/\bbutton|all|both\b/.test(t.options.showOn)&&(""!==t.options.buttonImage&&(e=t.options.buttonText||t._getRegional("button"),t.image=x("<img/>").attr({src:t.options.buttonImage,alt:e,title:e}),t.options.buttonClass&&t.image.attr("class",t.options.buttonClass),t._setImageBackground()),t.options.buttonImageOnly&&t.image?t.button=t.image:(t.button=x('<button type="button"></button>').html(t.image||t.options.buttonText).button(),t.image=t.image?x("img",t.button).first():null),t.button.insertAfter(t.element).click(function(){t.opened&&/\bbutton|all|both\b/.test(t.options.hideOn)?t.close():t.open()})),/\balt|all|both\b/.test(t.options.showOn)&&x(t.options.altField).on("click",function(){t.opened&&/\balt|all|both\b/.test(t.options.hideOn)?t.close():t.open()}),t.options.autoOpen&&t.open()):(t.inline=!0,t._generate(),t.opened=!0),(t.element.is(":disabled")||t.options.disabled)&&t.disable(),this},_setOption:function(e,t){switch(e){case"disabled":this[t?"disable":"enable"]();break;case"swatches":this.options.swatches=t,this.parts.swatches.init()}x.Widget.prototype._setOption.apply(this,arguments)},enable:function(){this.element&&this.element.prop("disabled",!1),this.button&&this.button.prop("disabled",!1),this.dialog&&this.dialog.removeClass("ui-colorpicker-disabled"),this.options.disabled=!1,this.parts&&x.each(this.parts,function(e,t){t.disable&&t.disable(!1)})},disable:function(){this.element&&this.element.prop("disabled",!0),this.button&&this.button.prop("disabled",!0),this.dialog&&this.dialog.addClass("ui-colorpicker-disabled"),this.options.disabled=!0,this.parts&&x.each(this.parts,function(e,t){t.disable&&t.disable(!0)})},_setImageBackground:function(){this.image&&this.options.buttonColorize&&this.image.css("background-color",this.color.set?this._formatColor("RGBA",this.color):"")},_setAltField:function(){if(this.options.altOnChange&&this.options.altField&&this.options.altProperties){var e,t,n=this.options.altProperties.split(",");for(e=0;e<=n.length;++e)switch(t=x.trim(n[e])){case"color":case"fill":case"stroke":case"background-color":case"backgroundColor":case"outline-color":case"border-color":x(this.options.altField).css(t,this.color.set?this.color.toCSS():"")}this.options.altAlpha&&x(this.options.altField).css("opacity",this.color.set?this.color.getAlpha():"")}},_setColor:function(e){this.color=this._parseColor(e)||new x.colorpicker.Color,this.currentColor=this.color.copy(),this._setImageBackground(),this._setAltField()},setColor:function(e){this._setColor(e),this._change()},getColor:function(e){return this._formatColor(e||this.options.colorFormat,this.color)},_generateInline:function(){x(this.element).html(this.options.inlineFrame?'<div class="ui-colorpicker ui-colorpicker-inline ui-dialog ui-widget ui-widget-content ui-corner-all"></div>':'<div class="ui-colorpicker ui-colorpicker-inline"></div>'),this.dialog=x(".ui-colorpicker",this.element)},_generatePopup:function(){var o=this;o.dialog=x('<div class="ui-colorpicker ui-colorpicker-dialog ui-dialog ui-widget ui-widget-content ui-corner-all" style="display: none;"></div>').appendTo("body"),null===o.events.document_click_html&&x(document).on("touchstart click","html",o.events.document_click_html=function(e){if(o.opened&&e.target!==o.element[0]&&!o.overlay)if(o.dialog.is(e.target)||0<o.dialog.has(e.target).length)o.element.blur();else{var t,n=x(e.target).parents();for(n.push(e.target),t=0;t<=n.length;++t){if(null!==o.button&&n[t]===o.button[0])return;if(/\balt|all|both\b/.test(o.options.showOn)&&x(o.options.altField).is(n[t]))return}o.options.closeOnOutside&&o.close(o.options.revert)}}),null===o.events.document_keydown&&x(document).on("keydown",o.events.document_keydown=function(e){o.opened&&27===e.keyCode&&o.options.closeOnEscape&&o.close(o.options.revert),o.opened&&13===e.keyCode&&o.options.okOnEnter&&o.close()}),o.element.keydown(function(e){9===e.keyCode&&o.close()}).keyup(function(e){var t=o._parseColor(o.element.val());t&&!o.color.equals(t)&&(o.color=t,o._change())})},_generate:function(){var e,n,t,o,i=this;i._setColor(i.inline||!i.element.is("input")?i.options.color:i.element.val()),i[i.inline?"_generateInline":"_generatePopup"](),e="string"==typeof i.options.parts?x.colorpicker.partslists[i.options.parts]?x.colorpicker.partslists[i.options.parts]:x.colorpicker.partslists[i.inline?"inline":"popup"]:i.options.parts,i.parts={},x.each(e,function(e,t){x.colorpicker.parts[t]&&(i.parts[t]=new x.colorpicker.parts[t](i))}),i.generated||(n=[],x.each(i.options.layout,function(e,t){i.parts[e]&&n.push({part:e,pos:t})}),t=x(function(e,t){var n,o,i,a,s,r,l,c,p,u,d,h,g,m;for(e.sort(function(e,t){return e.pos[1]===t.pos[1]?e.pos[0]-t.pos[0]:e.pos[1]-t.pos[1]}),s=a=0,x.each(e,function(e,t){a=Math.max(a,t.pos[0]+t.pos[2]),s=Math.max(s,t.pos[1]+t.pos[3])}),n=[],o=0;o<a;++o)n.push([]);for(l=[],r=[],x.each(e,function(e,t){for(o=0;o<t.pos[2];o+=1)r[t.pos[0]+o]=!0;for(i=0;i<t.pos[3];i+=1)l[t.pos[1]+i]=!0}),u="",p=e[c=0],i=0;i<s;++i){for(u+="<tr>",o=0;o<a;)if(void 0!==p&&o===p.pos[0]&&i===p.pos[1]){for(u+=t(p,o,i),h=0;h<p.pos[3];h+=1)for(d=0;d<p.pos[2];d+=1)n[o+d][i+h]=!0;o+=p.pos[2],p=e[++c]}else{for(g=0,m=!1;o<a&&void 0===n[o][i]&&(void 0===p||i<p.pos[1]||i===p.pos[1]&&o<p.pos[0]);)!0===r[o]&&(g+=1),m=!0,o+=1;0<g?u+='<td colspan="'+g+'"></td>':m||(o+=1)}u+="</tr>"}return'<table cellspacing="0" cellpadding="0" border="0"><tbody>'+u+"</tbody></table>"}(n,function(e,t,n){return o=["ui-colorpicker-"+e.part+"-container"],0<t&&o.push("ui-colorpicker-padding-left"),0<n&&o.push("ui-colorpicker-padding-top"),'<td class="'+o.join(" ")+'"'+(1<e.pos[2]?' colspan="'+e.pos[2]+'"':"")+(1<e.pos[3]?' rowspan="'+e.pos[3]+'"':"")+' valign="top"></td>'})).appendTo(i.dialog),i.options.inlineFrame&&t.addClass("ui-dialog-content ui-widget-content"),i._initAllParts(),i._updateAllParts(),i.generated=!0)},_effectGeneric:function(e,t,n,o,i){var a=this;x.effects&&x.effects[a.options.showAnim]?e[t](a.options.showAnim,a.options.showOptions,a.options.duration,i):(e["slideDown"===a.options.showAnim?n:"fadeIn"===a.options.showAnim?o:t](a.options.showAnim?a.options.duration:null,i),a.options.showAnim&&a.options.duration||i())},_effectShow:function(e,t){this._effectGeneric(e,"show","slideDown","fadeIn",t)},_effectHide:function(e,t){this._effectGeneric(e,"hide","slideUp","fadeOut",t)},open:function(){var t,e,n,o=this;o.opened||(o._generate(),e=o.element.is(":hidden")?x("<div/>").insertBefore(o.element):o.element,o.element.is(":hidden")&&e.remove(),t=0,x(o.element[0]).parents().each(function(){var e=x(this).css("z-index");if("number"!=typeof e&&"string"!=typeof e||""===e||isNaN(e))x(this).siblings().each(function(){var e=x(this).css("z-index");"number"!=typeof e&&"string"!=typeof e||""===e||isNaN(e)||t<e&&(t=parseInt(e,10))});else if(t<e)return t=parseInt(e,10),!1}),t+=2,o.dialog.css("z-index",t),o.options.modal&&(o.overlay=x('<div class="ui-widget-overlay"></div>').appendTo("body").css("z-index",t-1),null!==o.events.window_resize&&x(window).off("resize",o.events.window_resize),o.events.window_resize=function(){o.overlay&&(o.overlay.width(x(document).width()),o.overlay.height(x(document).height()))},x(window).on("resize",o.events.window_resize),o.events.window_resize()),o._effectShow(this.dialog),o.options.position?"element"===(n=x.extend({},o.options.position)).of&&(n.of=e):n={my:"left top",at:"left bottom",of:e,collision:"flip"},o.dialog.position(n),o.opened=!0,o._callback("open",!0),x(function(){o._repaintAllParts()}))},close:function(e){var t=this;t.opened&&(e?(t.color=t.currentColor.copy(),t._change(),t._callback("cancel",!0)):(t.currentColor=t.color.copy(),t._callback("ok",!0)),t.changed=!1,t.overlay&&(x(window).off("resize",t.events.window_resize),t.overlay.remove()),t._effectHide(t.dialog,function(){t.dialog.remove(),t.dialog=null,t.generated=!1,t.opened=!1,t._callback("close",!0)}))},destroy:function(){var e=this;null!==e.events.document_click_html&&x(document).off("touchstart click","html",e.events.document_click_html),null!==e.events.document_keydown&&x(document).off("keydown",e.events.document_keydown),null!==e.events.resizeOverlay&&x(window).off("resize",e.events.resizeOverlay),this.element.off(),this.overlay&&this.overlay.remove(),null!==this.dialog&&this.dialog.remove(),null!==this.image&&this.image.remove(),null!==this.button&&this.button.remove()},_callback:function(e,t){var n,o,i=this;return i.color.set?(n={formatted:i._formatColor(i.options.colorFormat,i.color),colorPicker:i},(o=i.color.getLAB()).a=2*o.a-1,o.b=2*o.b-1,!0===t&&(n.a=i.color.getAlpha(),n.rgb=i.color.getRGB(),n.hsv=i.color.getHSV(),n.cmyk=i.color.getCMYK(),n.hsl=i.color.getHSL(),n.lab=o),i._trigger(e,null,n)):i._trigger(e,null,{formatted:"",colorPicker:i})},_initAllParts:function(){x.each(this.parts,function(e,t){t.init&&t.init()})},_updateAllParts:function(){x.each(this.parts,function(e,t){t.update&&t.update()})},_repaintAllParts:function(){x.each(this.parts,function(e,t){t.repaint&&t.repaint()})},_change:function(e){this.color.set&&this.options.limit&&x.colorpicker.limits[this.options.limit]&&x.colorpicker.limits[this.options.limit](this.color,this),this.changed=!this.color.equals(this.currentColor),this.inline||(this.color.set?this.color.equals(this._parseColor(this.element.val()))||this.element.val(this._formatColor(this.options.colorFormat,this.color)).change():""!==this.element.val()&&this.element.val("").change(),this._setImageBackground()),this._setAltField(),this.options.color=this.color.set?this.color.toCSS():"",this.opened&&this._repaintAllParts(),this._callback("select"),(void 0===e||e)&&this._callback("stop")},_hoverable:function(e){e.hover(function(){e.addClass("ui-state-hover")},function(){e.removeClass("ui-state-hover")})},_focusable:function(e){e.focus(function(){e.addClass("ui-state-focus")}).blur(function(){e.removeClass("ui-state-focus")})},_getRegional:function(e){return void 0!==x.colorpicker.regional[this.options.regional][e]?x.colorpicker.regional[this.options.regional][e]:x.colorpicker.regional[""][e]},_getSwatches:function(){return"string"==typeof this.options.swatches?x.colorpicker.swatches[this.options.swatches]:x.isPlainObject(this.options.swatches)?this.options.swatches:x.colorpicker.swatches.html},_eachSwatch:function(n){var o,i=this._getSwatches();x.each(i,function(e,t){return o=x.isArray(i)?t.name:e,n(o,t)})},_getSwatch:function(n){var o=!1;return this._eachSwatch(function(e,t){if(e.toLowerCase()==n.toLowerCase())return o=t,!1}),o},_parseFormat:function(e,t){var n,o,i={x:function(){return"([0-9a-fA-F]{2})"},d:function(){return"([12]?[0-9]{1,2})"},f:function(){return"([0-9]*\\.?[0-9]*)"},p:function(){return"([0-9]*\\.?[0-9]*)"}},a={x:function(e){return parseInt(e,16)/255},d:function(e){return e/255},f:function(e){return e},p:function(e){return.01*e}},s={r:"setRGB",g:"setRGB",b:"setRGB",h:"setHSV",s:"setHSV",v:"setHSV",c:"setCMYK",m:"setCMYK",y:"setCMYK",k:"setCMYK",L:"setLAB",A:"setLAB",B:"setLAB"},r=[],l=[],c=null;if(o=(o=e.replace(/[()\\^$.|?*+[\]]/g,function(e){return"\\"+e})).replace(/\\?[argbhsvcmykLAB][xdfp]/g,function(e){if(e.match(/^\\/))return e.slice(1);var t=e.charAt(0),n=e.charAt(1);return r.push(t),l.push(a[n]),s[t]&&(c=s[t]),i[n]()}),c){var p=t.match(new RegExp(o));if(p){var u,d=[];p.shift(),x.each({setRGB:["r","g","b"],setHSV:["h","s","v"],setCMYK:["c","m","y","k"],setLAB:["L","A","B"]}[c],function(e,t){u=x.inArray(t,r),d[e]=l[u](p[u])}),(n=new x.colorpicker.Color)[c].apply(n,d)}}return n},_parseColor:function(n){var o,i=this,e=x.isArray(i.options.colorFormat)?i.options.colorFormat:[i.options.colorFormat];return x.each(e,function(e,t){if(o=x.colorpicker.parsers[t]?x.colorpicker.parsers[t](n,i):i._parseFormat(t,n))return!1}),o||x.each(x.colorpicker.parsers,function(e,t){if(o=t(n,i))return!1}),o||!1},_exactName:function(n){var o=!1;return this._eachSwatch(function(e,t){if(n.equals(new x.colorpicker.Color(t.r,t.g,t.b)))return o=e,!1}),o},_closestName:function(n){n.getRGB();var o,i=null,a=!1;return this._eachSwatch(function(e,t){if((o=n.distance(new x.colorpicker.Color(t.r,t.g,t.b)))<i||null===i){if(a=e,o<=1e-20)return!1;i=o}}),a},_formatColor:function(e,n){var o=this,i=null,a={x:function(e){return r(255*e)},d:function(e){return Math.round(255*e)},f:function(e){return e},p:function(e){return 100*e}},s=n.getChannels();return x.isArray(e)||(e=[e]),x.each(e,function(e,t){return x.colorpicker.writers[t]?!1===(i=x.colorpicker.writers[t](n,o)):(i=t.replace(/\\?[argbhsvcmykLAB][xdfp]/g,function(e){return e.match(/^\\/)?e.slice(1):a[e.charAt(1)](s[e.charAt(0)])}),!1)}),i}}),x.vanderlee.colorpicker});var settings={maxLines:20,button_arrange_bools:{enabled:!0},line:{number:{enabled:!0,name:""},instance:{enabled:!0,name:"Instance"},id:{enabled:!0,name:"ID",width:"200px",style:"padding-left: 4px",_class:"ids",inputStyle:""},idSelect:{enabled:!0,name:"",style:"padding-left: 4px"},aggregate:{enabled:!0,name:"Aggregation",width:"70px",style:"padding-left: 5px",values:["minmax","average","min","max","total","onchange"]},chartType:{enabled:!0,name:"Chart Type",width:"90px",values:["line","bar","scatterplot","steps","spline"]},fill:{enabled:!0,name:"Fill(0to1)",width:"70px",style:"width: 70px; text-align: right"},points:{enabled:!0,name:"Points",width:"50px",type:"checkbox"},color:{enabled:!0,name:"Color",width:"120px",style:"padding-left: 5px",_class:"input-color"},min:{enabled:!0,name:"Min",width:"50px",style:"padding-left: 5px"},max:{enabled:!0,name:"Max",width:"50px",style:"padding-left: 5px"},unit:{enabled:!0,name:"Unit",width:"70px",style:"padding-left: 5px"},yaxe:{enabled:!0,name:"Y Axis",width:"140px",style:"padding-left: 5px",values:["","off","left","right","leftColor","rightColor"],defaultValueName:"default"},xaxe:{enabled:!0,name:"X Axis",width:"140px",style:"padding-left: 5px",values:["","off","top","bottom","topColor","bottomColor"],defaultValueName:"default"},name:{enabled:!0,name:"Name",width:"200px",style:"padding-left: 5px"},extraOptions:{enabled:!0,name:"More",width:"90px",style:"text-align: center"},removeButton:{enabled:!0,name:"",width:"",style:"padding-left: 5px"}},extraOptions:{offset:{enabled:!0,name:"Offset",width:"130px",style:"",type:"number"},yOffset:{enabled:!0,name:"Y-Offset",width:"70px",style:"",type:"number"},xticks:{enabled:!0,name:"X-Axis ticks",width:"70px",style:"",type:"number"},yticks:{enabled:!0,name:"Y-Axis ticks",width:"70px",style:"",type:"number"},thickness:{enabled:!0,name:"&#216L",width:"70px",style:"",type:"number",title:"Line Width",default:1},shadowsize:{enabled:!0,name:"&#216S",width:"70px",style:"",type:"number",title:"Shadow Size",default:0},commonYAxis:{enabled:!0,name:"Common Y Axis",width:"",style:"",values:["","1","2","3","4","5"],default:"",names:["default"]},ignoreNull:{enabled:!0,name:"NULL as",width:"",style:"",values:["false","true","0"],default:"false",names:["default","ignore null values","use 0 instead of null values"]},smoothing:{enabled:!(systemDictionary={0:{cn:"0",en:"0"},1:{cn:"1",en:"1"},2:{cn:"2",en:"2"},3:{cn:"3",en:"3"},4:{cn:"4",en:"4"},5:{cn:"5",en:"5"},Ok:{cn:"OK",en:"Ok"},role:{cn:"role",en:"role"},"Update objects":{cn:"更新对象",en:"Update objects"},All:{cn:"全部",en:"All"},With:{cn:"包含",en:"With"},Without:{cn:"不包含",en:"Without"},"Update states":{cn:"更新数据",en:"Update states"},"edit file":{cn:"编辑",en:"edit file"},"restart script":{cn:"重启脚本",en:"restart script"},Select:{cn:"确定",en:"Select"},"Select ID":{cn:"选择 ID",en:"Select ID"},"add children":{cn:"添加子项",en:"add children"},"edit enum":{cn:"edit enum",en:"edit enum"},"System settings":{cn:"设置",en:"System settings"},reload:{cn:"重新加载",en:"reload"},"Delete object":{cn:"删除",en:"Delete object"},"no null":{cn:"&nbsp;no null",en:"&nbsp;no null"},"%s ago":{cn:"%s 前",en:"%s ago"},"Y-Offset":{cn:"Y-偏移",en:"Y-Offset"},ID:{cn:"ID",en:"ID"},Role:{cn:"Role",en:"Role"},Room:{cn:"Room",en:"Room"},Value:{cn:"Value",en:"Value"},none:{cn:"none",en:"none"},"Save into:":{cn:"保存为:",en:"Save into:"},"Name:":{cn:"名称:",en:"Name:"},save:{cn:"保存",en:"save"},load:{cn:"打开",en:"load"},Presets:{cn:"项目",en:"Presets"},IDs:{cn:"IDs",en:"IDs"},new:{cn:"新建",en:"new"},"Enter chart name":{cn:"曲线名称",en:"Enter chart name"},"save %s":{cn:"保存 %s",en:"save %s"},"Input data":{cn:"数据",en:"Input data"},Options:{cn:"选项",en:"Options"},"Range:":{cn:"间隔:",en:"Range:"},"5 seconds":{cn:"5 秒",en:"5 seconds"},"10 seconds":{cn:"10 秒",en:"10 seconds"},"15 seconds":{cn:"15 秒",en:"15 seconds"},"20 seconds":{cn:"20 秒",en:"20 seconds"},"30 seconds":{cn:"30 秒",en:"30 seconds"},"1 minute":{cn:"1 分",en:"1 minute"},"2 minutes":{cn:"2 分",en:"2 minutes"},"5 minutes":{cn:"5 分",en:"5 minutes"},"10 minutes":{cn:"10 分",en:"10 minutes"},"15 minutes":{cn:"15 分",en:"15 minutes"},"20 minutes":{cn:"20 分",en:"20 minutes"},"30 minutes":{cn:"30 分",en:"30 minutes"},"1 hour":{cn:"1 小时",en:"1 hour"},"2 hours":{cn:"2 小时",en:"2 hours"},"3 hours":{cn:"3 小时",en:"3 hours"},"6 hours":{cn:"6 小时",en:"6 hours"},"12 hours":{cn:"12 小时",en:"12 hours"},"1 day":{cn:"1 天",en:"1 day"},"2 days":{cn:"2 天",en:"2 days"},"3 days":{cn:"3 天",en:"3 days"},"7 days":{cn:"7 天",en:"7 days"},"14 days":{cn:"14 天",en:"14 days"},"1 month":{cn:"1 月",en:"1 month"},"2 months":{cn:"2 月",en:"2 months"},"3 months":{cn:"3 月",en:"3 months"},"6 months":{cn:"6 月",en:"6 months"},"1 year":{cn:"1 年",en:"1 year"},"2 years":{cn:"2 年",en:"2 years"},"Width:":{cn:"宽度:",en:"Width:"},"Height:":{cn:"高度:",en:"Height:"},line:{cn:"线",en:"Line"},area:{cn:"面",en:"Area"},bar:{cn:"条形图",en:"Bar"},lineplot:{cn:"Line plot",en:"Line plot"},scatterplot:{cn:"Scatter plot",en:"Scatter plot"},steps:{cn:"Steps",en:"Steps"},spline:{cn:"Spline",en:"Spline"},Stack:{cn:"Stack",en:"Stack"},"Window background:":{cn:"窗口背景:",en:"Window background:"},"Custom chart background:":{cn:"自定义曲线背景:",en:"Custom chart background:"},"Chart background:":{cn:"曲线背景:",en:"Chart background:"},"X axis labels color:":{cn:"X labels color:",en:"X labels color:"},"Y axis labels color:":{cn:"Y labels color:",en:"Y labels color:"},"Show legend:":{cn:"显示图例:",en:"Show legend:"},"Title:":{cn:"标题:",en:"Title:"},"Title position:":{cn:"标题位置:",en:"Title position:"},"Top, left, inside":{cn:"Top, left, inside",en:"Top, left, inside"},"Top, right, inside":{cn:"Top, right, inside",en:"Top, right, inside"},"Top, center, inside":{cn:"Top, center, inside",en:"Top, center, inside"},"Middle, left, inside":{cn:"Middle, left, inside",en:"Middle, left, inside"},"Middle, right, inside":{cn:"Middle, right, inside",en:"Middle, right, inside"},"Bottom, left, inside":{cn:"Bottom, left, inside",en:"Bottom, left, inside"},"Bottom, right, inside":{cn:"Bottom, right, inside",en:"Bottom, right, inside"},"Bottom, center, inside":{cn:"Bottom, center, inside",en:"Bottom, center, inside"},"Top, right, outside":{cn:"Top, right, outside",en:"Top, right, outside"},"Middle, right, outside":{cn:"Middle, right, outside",en:"Middle, right, outside"},"Bottom, right, outside":{cn:"Bottom, right, outside",en:"Bottom, right, outside"},"Bottom, center, outside":{cn:"Bottom, center, outside",en:"Bottom, center, outside"},"Min:":{cn:"最小:",en:"Minimum:"},"Max:":{cn:"最大:",en:"Maximum:"},"User defined names:":{cn:"用户定义名称:",en:"User defined names:"},"Predefined background:":{cn:"Predefined background:",en:"Predefined background:"},"User defined":{cn:"用户定义",en:"User defined"},"Background:":{cn:"背景:",en:"Background:"},"Hover details:":{cn:"Hover details:",en:"Hover details:"},"Time format:":{cn:"时间格式:",en:"Time format:"},Default:{cn:"Default",en:"Default"},Smoothing:{cn:"Smoothing",en:"Smoothing"},"After comma":{cn:"After comma",en:"After comma"},Open:{cn:"打开",en:"Open"},Update:{cn:"更新",en:"Update"},"Reset settings":{cn:"复位",en:"Reset settings"},From:{cn:"From: ",en:"From: "},"Last changed":{cn:"Last changed",en:"Last changed"},"Time stamp":{cn:"Time stamp",en:"Time stamp"},Acknowledged:{cn:"Acknowledged",en:"Acknowledged"},Edit:{cn:"编辑",en:"Edit"},Members:{cn:"Members",en:"Members"},"Loading...":{cn:"正在加载...",en:"Loading..."},"Processing...":{cn:"正在处理...",en:"Processing..."},"With lines":{cn:"With lines",en:"With lines"},"Without lines":{cn:"Without lines",en:"Without lines"},"Inside / With lines":{cn:"Inside / With lines",en:"Inside / With lines"},"Outside/ With lines":{cn:"Outside/ With lines",en:"Outside/ With lines"},"Inside / No lines":{cn:"Inside / No lines",en:"Inside / No lines"},"Outside / No lines":{cn:"Outside / No lines",en:"Outside / No lines"},"Interpolate:":{cn:"Interpolate:",en:"Interpolate:"},Steps:{cn:"Steps",en:"Steps"},Pie:{cn:"Pie",en:"Pie"},"Top, left":{cn:"Top, left",en:"Top, left"},"Top, right":{cn:"Top, right",en:"Top, right"},"Bottom, left":{cn:"Bottom, left",en:"Bottom, left"},"Bottom, right":{cn:"Bottom, right",en:"Bottom, right"},"Title color:":{cn:"Title color:",en:"Title color:"},"Title size:":{cn:"Title size:",en:"Title size:"},"Fill range:":{cn:"Fill range:",en:"Fill range:"},"Units:":{cn:"单位:",en:"Units:"},yes:{cn:"确定",en:"yes"},bottom:{cn:"bottom",en:"bottom"},top:{cn:"top",en:"top"},left:{cn:"left",en:"left"},right:{cn:"right",en:"right"},"No border:":{cn:"No border:",en:"No border:"},Time:{cn:"时间",en:"Time"},day:{cn:"日",en:"day"},month:{cn:"月",en:"month"},year:{cn:"年",en:"year"},Individual:{cn:"Individual",en:"Individual"},"Aggregation:":{cn:"Type:",en:"Type:"},relative:{cn:"relative",en:"relative"},static:{cn:"static",en:"static"},now:{cn:"now",en:"now"},today:{cn:"今日",en:"today"},"this month":{cn:"本月",en:"this month"},"this year":{cn:"今年",en:"this year"},"Start:":{cn:"开始:",en:"Start:"},"End:":{cn:"结束:",en:"End:"},Aggregate:{cn:"聚合",en:"Aggregate"},"Step type:":{cn:"Step type:",en:"Step type:"},seconds:{cn:"秒",en:"seconds"},Seconds:{cn:"秒",en:"Seconds"},"Step span:":{cn:"Step span:",en:"Step span:"},Link:{cn:"Link",en:"Link"},Counts:{cn:"Counts",en:"Counts"},"ignore 'null'":{cn:"ignore 'null'",en:"ignore 'null'"},"Time Span":{cn:"时间跨度",en:"Time Span"},Appearance:{cn:"外观式样",en:"Appearance"},Title:{cn:"标题",en:"Title"},Offset:{cn:"X-Offset",en:"X-Offset"},Aggregation:{cn:"Type",en:"Type"},"Chart Type":{cn:"Chart Type",en:"Chart Type"},Color:{cn:"颜色",en:"Color"},Min:{cn:"最小",en:"Min"},Max:{cn:"最大",en:"Max"},Unit:{cn:"单位",en:"Unit"},"Y Axis":{cn:"Y Axis",en:"Y Axis"},"X Axis":{cn:"X Axis",en:"X Axis"},"update Preview":{cn:"更新预览",en:"update Preview"},Cancel:{cn:"取消",en:"Cancel"},Name:{cn:"名称",en:"Name"},"Live update every:":{cn:"实时更新:",en:"Live update every:"},counts:{cn:"counts",en:"counts"},"Add new line":{cn:"添加曲线",en:"Add new line"},"Animation:":{cn:"动画:",en:"Animation:"},no:{cn:"取消",en:"no"},"0s":{cn:"0 秒",en:"0 seconds"},"300ms":{cn:"300毫秒",en:"300ms"},"500ms":{cn:"500毫秒",en:"500ms"},"1s":{cn:"1 秒",en:"1 second"},"2s":{cn:"2 秒",en:"2 seconds"},"3s":{cn:"3 秒",en:"3 seconds"},"5s":{cn:"5 秒",en:"5 seconds"},"10s":{cn:"10 秒",en:"10 seconds"},"30s":{cn:"30 秒",en:"30 seconds"},"60s":{cn:"60 秒",en:"60 seconds"},"2m":{cn:"2 分",en:"2 minutes"},"3m":{cn:"3 分",en:"3 minutes"},"4m":{cn:"4 分",en:"4 minutes"},"5m":{cn:"5 分",en:"5 minutes"},"10m":{cn:"10 分",en:"10 minutes"},"15m":{cn:"15 分",en:"15 minutes"},"30m":{cn:"30 分",en:"30 minutes"},"45m":{cn:"45 分",en:"45 minutes"},"1H":{cn:"1 小时",en:"1 hour"},"2H":{cn:"2 小时",en:"2 hours"},"6H":{cn:"6 小时",en:"6 hours"},"12H":{cn:"12 小时",en:"12 hours"},"1D":{cn:"1 天",en:"1 day"},"2D":{cn:"2 天",en:"2 days"},"3D":{cn:"3 天",en:"3 days"},"4D":{cn:"4 天",en:"4 days"},"1W":{cn:"1 周",en:"1 week"},"2W":{cn:"2 周",en:"2 weeks"},"4W":{cn:"4 周",en:"4 weeks"},"8W":{cn:"8 周",en:"8 weeks"},"12W":{cn:"12 周",en:"12 weeks"},"26W":{cn:"26 周",en:"26 weeks"},"1M":{cn:"1 月",en:"1 month"},"2M":{cn:"2 月",en:"2 months"},"3M":{cn:"3 月",en:"3 months"},"6M":{cn:"6 月",en:"6 months"},"1Y":{cn:"1 年",en:"1 year"},"2Y":{cn:"2 年",en:"2 years"},average:{cn:"average",en:"average"},max:{cn:"max",en:"max"},min:{cn:"min",en:"min"},total:{cn:"total",en:"total"},off:{cn:"off",en:"off"},leftColor:{cn:"left colored",en:"left colored"},rightColor:{cn:"right colored",en:"right colored"},topColor:{cn:"top colored",en:"top colored"},bottomColor:{cn:"bottom colored",en:"bottom colored"},default:{cn:"default",en:"default"},"Auto-update:":{cn:"自动更新:",en:"Auto-update:"},"Use comma:":{cn:"Use comma:",en:"Use comma:"},"Common Y Axis":{cn:"Common Y Axis",en:"Common Y Axis"},Instance:{cn:"实例",en:"Instance"},"Line Width":{cn:"线宽",en:"Line Width"},"Shadow Size":{cn:"阴影大小",en:"Shadow Size"},"ignore 'null':":{cn:"ignore 'null':",en:"ignore 'null':"},onchange:{cn:"on change",en:"on change"},"Border color:":{cn:"边框颜色:",en:"Border color:"},"Grid color:":{cn:"表格颜色:",en:"Grid color:"},"Border width:":{cn:"边框宽度:",en:"Border width:"},"Enable zoom and pan:":{cn:"Enable zoom and pan:",en:"Enable zoom and pan:"},"Arrange bools":{cn:"排列",en:"Arrange booleans"},"NULL as":{cn:"NULL as",en:"NULL as"},MinMax:{cn:"MinMax",en:"MinMax"},null:{cn:"null",en:"null"},true:{cn:"last value",en:"last value"},"last value":{cn:"last value",en:"last value"},"Hide edit button:":{cn:"隐藏编辑按钮:",en:"Hide edit button:"},minmax:{cn:"minmax",en:"minmax"},"&#216L":{cn:"&#216L",en:"&#216L"},"&#216S":{cn:"&#216S",en:"&#216S"},Line:{cn:"线",en:"Line"},false:{cn:"null",en:"null"},"end of minute":{cn:"end of minute",en:"end of minute"},"end of 5 minutes":{cn:"end of 5 minutes",en:"end of 5 minutes"},"end of 10 minutes":{cn:"end of 10 minutes",en:"end of 10 minutes"},"end of 30 minutes":{cn:"end of 30 minutes",en:"end of 30 minutes"},"end of hour":{cn:"end of hour",en:"end of hour"},"end of 2 hours":{cn:"end of 2 hours",en:"end of 2 hours"},"end of 3 hours":{cn:"end of 3 hours",en:"end of 3 hours"},"end of 4 hours":{cn:"end of 4 hours",en:"end of 4 hours"},"end of 6 hours":{cn:"end of 6 hours",en:"end of 6 hours"},"end of 8 hours":{cn:"end of 8 hours",en:"end of 8 hours"},"end of 12 hours":{cn:"end of 12 hours",en:"end of 12 hours"},"end of day":{cn:"end of day",en:"end of day"},"end of sunday":{cn:"end of sunday",en:"end of sunday"},"end of saturday":{cn:"end of saturday",en:"end of saturday"},"1minute":{cn:"end of minute",en:"end of minute"},"5minutes":{cn:"end of 5 minutes",en:"end of 5 minutes"},"10minutes":{cn:"end of 10 minutes",en:"end of 10 minutes"},"30minutes":{cn:"end of 30 minutes",en:"end of 30 minutes"},"1hour":{cn:"end of hour",en:"end of hour"},"2hours":{cn:"end of 2 hours",en:"end of 2 hours"},"3hours":{cn:"end of 3 hours",en:"end of 3 hours"},"4hours":{cn:"end of 4 hours",en:"end of 4 hours"},"6hours":{cn:"end of 6 hours",en:"end of 6 hours"},"8hours":{cn:"end of 8 hours",en:"end of 8 hours"},"12hours":{cn:"end of 12 hours",en:"end of 12 hours"},weekEurope:{cn:"end of day",en:"end of day"},weekUsa:{cn:"end of sunday",en:"end of sunday"},"Bar settings":{cn:"条形图设置",en:"Bar settings"},"Fill color:":{cn:"颜色:",en:"Fill color:"},"Show labels:":{cn:"标签:",en:"Show labels:"},"top over":{cn:"top over",en:"top over"},"top under":{cn:"top under",en:"top under"},middle:{cn:"middle",en:"middle"},"Bars width:":{cn:"宽度:",en:"Bars width:"},"Label font size:":{cn:"字体大小:",en:"Label font size:"},"Label color:":{cn:"字体颜色:",en:"Label color:"},Markings:{cn:"标记",en:"Markings"},"Line ID":{cn:"Line ID",en:"Line ID"},Fill:{cn:"Fill",en:"Fill"},"ØL":{cn:"ØL",en:"ØL"},"ØS":{cn:"ØS",en:"ØS"},Text:{cn:"文本",en:"Text"},"Text position":{cn:"文本位置",en:"Text position"},"Text offset":{cn:"文本 offset",en:"Text offset"},"Text size":{cn:"文本大小",en:"Text size"},"Text color":{cn:"文本颜色",en:"Text color"},"Add new markings":{cn:"添加新标记",en:"Add new markings"},Left:{cn:"Left",en:"Left"},Right:{cn:"Right",en:"Right"},"Upper value or ID":{cn:"Upper value or ID",en:"Upper value or ID"},"Lower value or ID":{cn:"Lower value or ID",en:"Lower value or ID"},"X-Axis ticks":{cn:"X-Axis ticks",en:"X-Axis ticks"},"Y-Axis ticks":{cn:"Y-Axis ticks",en:"Y-Axis ticks"},"ignore null values":{cn:"ignore null values",en:"ignore null values"},"Ticks from:":{cn:"Use X-ticks from:",en:"Use X-ticks from:"},"use 0 instead of null values":{cn:"use 0 instead of null values",en:"use 0 instead of null values"},More:{cn:"更多",en:"more"},"Edit options for line %s":{cn:"Edit options for line %s",en:"Edit options for line %s"},"Legend columns:":{cn:"图例栏:",en:"Legend columns:"},"Legend opacity (from 0 to 1):":{cn:"图例透明度 ( 0 到 1):",en:"Legend opacity (from 0 to 1):"},"Legend background:":{cn:"图例背景:",en:"Legend background:"},"Fill(0to1)":{cn:"Fill(0to1)",en:"Fill(0to1)"},Points:{cn:"Points",en:"Points"}}),name:"Smoothing",width:"70px",style:"",type:"number"},afterComma:{enabled:!0,name:"After comma",width:"70px",style:"",type:"number",default:2},dashes:{enabled:!0,name:"Dashes",width:"",style:"",type:"checkbox",default:!1},dashLength:{enabled:!0,name:"Dashes length",width:"70px",style:"",type:"number",default:10},spaceLength:{enabled:!0,name:"Space length",width:"70px",style:"",type:"number",default:10}},chapter_time:{enabled:!0},time_timeType:{enabled:!0},time_relativeEnd:{enabled:!0},time_range:{enabled:!0},time_live:{enabled:!0},time_start:{enabled:!0},time_end:{enabled:!0},time_aggregateType:{enabled:!0},time_aggregateSpan:{enabled:!0},time_ticks:{enabled:!0},chapter_options:{enabled:!0},options_width:{enabled:!0},options_height:{enabled:!0},options_noborder:{enabled:!0},options_window_bg:{enabled:!0},options_bg_custom:{enabled:!0},options_bg:{enabled:!0},options_x_labels_color:{enabled:!0},options_y_labels_color:{enabled:!0},options_title:{enabled:!0},options_titlePos:{enabled:!0},options_titleColor:{enabled:!0},options_titleSize:{enabled:!0},options_legend:{enabled:!0},options_legColumns:{enabled:!0},options_legBg:{enabled:!0},options_legBgOpacity:{enabled:!0},options_barColor:{enabled:!0},options_barLabels:{enabled:!0},options_barWidth:{enabled:!0},options_barFontSize:{enabled:!0},options_barFontColor:{enabled:!0},options_smoothing:{enabled:!1},options_afterComma:{enabled:!1},options_useComma:{enabled:!0},options_zoom:{enabled:!0},options_noedit:{enabled:!0},options_animation:{enabled:!0},options_border_color:{enabled:!0},options_grid_color:{enabled:!0},options_border_width:{enabled:!0},option_markline:{enabled:!0}};$(document).ready(function(){"use strict";var s,r=["#FF0000","#00FF00","#0000FF","#FFFF00","#FF00FF","#00FFFF","#800000","#008000","#000080","#808000","#800080","#008080"],p=[],n=null,e=null,u="",l={},c=null,d=!1,h=!1,g=0,m={options:{l:[]}};function b(e){if(e){if(m.options=deparam(e||""),m.options._ids){var t=m.options._ids?m.options._ids.split(";"):[],n=m.options._colors?m.options._colors.split(";"):[],o=m.options._names?m.options._names.split(";"):[],i=m.options._units?m.options._units.split(";"):[];m.options.l=[];for(var a=0;a<t.length;a++)m.options.l.push({id:t[a],offset:0,name:o[a]||"",aggregate:"minmax",color:n[a]||"blue",thickness:m.options.strokeWidth||1,shadowsize:m.options.strokeWidth||1,smoothing:m.options.smoothing||0,afterComma:m.options.afterComma||0,min:m.options.min||"",max:m.options.max||"",unit:i[a]||""});m.options.aggregateType="step",m.options.aggregateSpan=300,m.options.relativeEnd="now",m.options._colors&&delete m.options._colors,m.options._names&&delete m.options._names,m.options._ids&&delete m.options._ids}m.options.l=m.options.l||[]}for(var s=0;s<m.options.l.length;s++)m.options.l[s].art&&(m.options.l[s].aggregate=m.options.l[s].art,delete m.options.l[s].art);m.options.timeArt&&(m.options.timeType=m.options.timeArt,delete m.options.timeArt);var r=$("#presets_table");r.find("tr").removeClass("presets-selected"),r.find('tr[data-name="'+c+'"]').addClass("presets-selected"),m.options.lines&&(m.options.l=JSON.parse(JSON.stringify(m.options.lines)),delete m.options.lines),m.options.ignoreNull=void 0,m.options.afterComma=void 0,m.options.smoothing=void 0,m.options.l&&m.options.l.length||f()}function f(){m.options.l||(m.options.l=[]);var e=m.options.l.length;return m.options.l.push({id:"",instance:"",offset:0,aggregate:"minmax",color:r[e]||"#00FFFF",min:"",max:"",thickness:3,shadowsize:3,unit:"",name:""}),e}function v(e){setTimeout(function(){if(settings.option_markline){for(var e="",t="",n=0;n<m.options.l.length;n++)t+='<option value="'+n+'">'+n+" - "+m.options.l[n].id+"</option>\n";var o='<option value="l">'+_("Left")+"</option>";if(o+='<option value="r">'+_("Right")+"</option>",m.options.m)for(var i=0;i<m.options.m.length;i++)e+="<tr>",e+='<td><select class="markline-value" data-index="'+i+'" data-option="l" style="width: 95%">'+t+"</select></td>",e+='<td><input class="markline-value" data-index="'+i+'" data-option="v" style="width: 200px;display: inline"/></td>',e+='<td><button style="display: inline; margin-right: 15px;" class="markline-select-dialog" data-index="'+i+'" data-option="v">...</button></td>',e+='<td><input class="markline-value" data-index="'+i+'" data-option="vl" style="width: 200px;display: inline"/></td>',e+='<td><button style="display: inline; margin-right: 15px;" class="markline-select-dialog" data-index="'+i+'" data-option="vl">...</button></td>',e+='<td><input class="markline-value markline-color" data-index="'+i+'" data-option="c"/ style="width: 100px"></td>',e+='<td><input class="markline-value" data-index="'+i+'" data-option="f" type="checkbox"/></td>',e+='<td><input class="markline-value" data-index="'+i+'" data-option="t" type="number" min="1" style="width: 60px"/></td>',e+='<td><input class="markline-value" data-index="'+i+'" data-option="s" type="number" min="0" style="width: 60px"/></td>',e+='<td><input class="markline-value" data-index="'+i+'" data-option="d" style="width: 95%"/></td>',e+='<td><select class="markline-value" data-index="'+i+'" data-option="p">'+o+"</select></td>",e+='<td><input class="markline-value" data-index="'+i+'" data-option="py" type="number" style="width: 60px"/></td>',e+='<td><input class="markline-value" data-index="'+i+'" data-option="fs" type="number" min="0" style="width: 60px"/></td>',e+='<td><input class="markline-value markline-color" data-index="'+i+'" data-option="fc" style="width: 100px"/></td>',e+='<td><button class="markline-remove" data-index="'+i+'"></button></td>\n',e+="</tr>";$("#markline_list").html(e),$(".markline-value").each(function(){var e=$(this).data("index"),t=$(this).data("option");"checkbox"===$(this).attr("type")?("true"===m.options.m[e][t]&&(m.options.m[e][t]=!0),"false"===m.options.m[e][t]&&(m.options.m[e][t]=!1),$(this).prop("checked",!!m.options.m[e][t])):$(this).val(m.options.m[e][t])}),$(".markline-color").colorpicker({colorFormat:"#HEX"}).on("change",function(){$(this).css({"background-color":$(this).val(),color:M($(this).val())})}).trigger("change"),$(".markline-remove").button({icons:{primary:"ui-icon-trash"},text:!1}).click(function(){if(m.options.m.length){var e=$(this).data("index");m.options.m.splice(e,1),v(),S(),w()}}).css({width:22,height:22}),$(".markline-select-dialog").button({text:!1,icons:{primary:"ui-icon-folder-open"}}).css({width:25,height:22}).click(function(){var o=$(this).data("index"),i=$(this).data("option");$("#dialog-select-member").selectId("show",m.options.m[o][i],{common:{custom:!1}},function(e,t,n){m.options.l[o][i]=e,$('.markline-value[data-index="'+o+'"][data-option="'+i+'"]').val(e).trigger("change")})})}else $(".markline-option").hide()},100)}function k(c){setTimeout(function(){for(var e="",t='<tr style="text-align: center" class="header">\n',n='<option value="">'+_("default")+"</option>\n",o=0;o<p.length;o++)n+='<option value="'+p[o]+'">'+p[o]+"</option>\n";var i=0;for(var a in settings.line)settings.line.hasOwnProperty(a)&&settings.line[a].enabled&&('<col data-index="'+i+'" '+(settings.line[a].width?'width="'+settings.line[a].width+'"':"")+" />\n",t+='<th class="toggleable" data-index="'+i+'" title="'+_(settings.line[a].title)+'" '+(settings.line[a].width?'width="'+settings.line[a].width+'"':"")+">"+_(settings.line[a].name)+"</th>\n",i++);t+="</tr>";for(var s=0;s<m.options.l.length&&s<settings.maxLines;s++){var r=m.options.l[s];for(var a in e+='<tr data-index="'+s+'" class="inputData">\n',settings.line)if(settings.line.hasOwnProperty(a)&&settings.line[a]&&settings.line[a].enabled)if(settings.line[a].style=settings.line[a].style||"",settings.line[a]._class=settings.line[a]._class||"","min"===a?r.min=void 0===r.min?"":r.min:"max"===a&&(r.max=void 0===r.max?"":r.max),"number"===a)e+='<td title="'+_("Line")+" "+(s+1)+'">'+(s+1)+"</td>\n";else if("idSelect"===a)e+='<td><button style="display: inline" class="select-dialog" data-index="'+s+'" data-ids="'+s+'">...</button></td>\n';else if("instance"===a)e+='<td style="'+settings.line[a].style+'"><select data-option="'+a+'" data-index="'+s+'" class="input options-lines'+settings.line[a]._class+'" style="display: inline;" value="'+(r[a]||"")+'">'+n+"</select></td>\n";else if("offset"===a)e+='<td style="'+settings.line[a].style+'">\n',e+='<select class="input options-lines '+settings.line[a]._class+'" data-index="'+s+'" data-option="'+a+'">\n',e+='<option value="0">'+_("0s")+'</option> <option value="10">'+_("10s")+'</option><option value="30">'+_("30s")+'</option><option value="60">'+_("60s")+'</option><option value="120">'+_("2m")+'</option><option value="180">'+_("3m")+'</option><option value="240">'+_("4m")+'</option><option value="300">'+_("5m")+'</option><option value="600">'+_("10m")+'</option><option value="900">'+_("15m")+'</option><option value="1800">'+_("30m")+'</option><option value="2700">'+_("45m")+'</option><option value="3600">'+_("1H")+'</option><option value="7200">'+_("2H")+'</option><option value="21600">'+_("6H")+'</option><option value="43200">'+_("12H")+'</option><option value="86400">'+_("1D")+'</option><option value="172800">'+_("2D")+'</option><option value="259200">'+_("3D")+'</option><option value="345600">'+_("4D")+'</option><option value="604800">'+_("1W")+'</option><option value="1209600">'+_("2W")+'</option><option value="1m">'+_("1M")+'</option><option value="2m">'+_("2M")+'</option><option value="3m">'+_("3M")+'</option><option value="6m">'+_("6M")+'</option><option value="1y">'+_("1Y")+'</option><option value="2y">'+_("2Y")+"</option>",e+="</select></td>\n";else if("removeButton"===a)e+='<td style="'+settings.line[a].style+'"><button class="id-remove" data-index="'+s+'"></button></td>\n';else if("extraOptions"===a)e+='<td style="'+settings.line[a].style+'"><button class="id-options" data-index="'+s+'"></button></td>\n';else{if(e+='<td style="'+settings.line[a].style+'">\n',settings.line[a].values){e+='<select data-option="'+a+'" class="input options-lines '+settings.line[a]._class+'" data-index="'+s+'" value="'+(r[a]||settings.line[a].default||"")+'">\n';for(var l=0;l<settings.line[a].values.length;l++)e+='<option value="'+settings.line[a].values[l]+'">'+_(settings.line[a].values[l])+"</option>\n";e+="</select>\n"}else e+='<input data-option="'+a+'" type="'+(settings.line[a].type||"text")+'" style="width: 100%; '+(settings.line[a].inputStyle||"")+'" data-index="'+s+'" class="options-lines '+settings.line[a]._class+'" value="'+(r[a]||settings.line[a].default||"")+'">\n';e+="</td>\n"}e+="</tr>"}$("#idslist").html(t+e),"de"===systemLang?$.colorpicker.regional={"":{ok:"OK",cancel:"Abbrechen",none:"Nichts",button:"Farbe",title:"Farbe wählen",transparent:"Transparent",hsvH:"H",hsvS:"S",hsvV:"V",rgbR:"R",rgbG:"G",rgbB:"B",labL:"L",labA:"a",labB:"b",hslH:"H",hslS:"S",hslL:"L",cmykC:"C",cmykM:"M",cmykY:"Y",cmykK:"K",alphaA:"A"}}:"ru"===systemLang&&($.colorpicker.regional={"":{ok:"OK",cancel:"Отмена",none:"Нет",button:"Цвет",title:"Выбрать цвет",transparent:"Прозрачность",hsvH:"H",hsvS:"S",hsvV:"V",rgbR:"R",rgbG:"G",rgbB:"B",labL:"L",labA:"a",labB:"b",hslH:"H",hslS:"S",hslL:"L",cmykC:"C",cmykM:"M",cmykY:"Y",cmykK:"K",alphaA:"A"}}),$(".input-color").colorpicker({colorFormat:"#HEX"}).on("change",function(){$(this).css({"background-color":$(this).val(),color:M($(this).val())})}).trigger("change"),$(".id-remove").button({icons:{primary:"ui-icon-trash"},text:!1}).click(function(){if(m.options.l.length){var e=$(this).data("index");m.options.l.splice(e,1),m.options.l.length||f(),k(),S(),w()}}).css({width:22,height:22}),$(".id-options").button({icons:{primary:"ui-icon-gear"},text:!1}).click(function(){!function(e){var t=m.options.l[e],n=$("#dialog-line-options");if(n.data("index",e),!n.data("inited")){n.data("inited",!0);var o=0,i="";for(var a in settings.extraOptions)if(settings.extraOptions.hasOwnProperty(a)){if(o++,i+="<tr "+(settings.extraOptions[a].title?'title="'+settings.extraOptions[a].title+'" ':"")+">",i+='<td><label for="option_'+a+'">'+_(settings.extraOptions[a].name||a)+"</label></td>","offset"===a)i+='<td><select id="option_'+a+'" style="'+(settings.extraOptions[a].width?"width: "+settings.extraOptions[a].width+";":"")+(settings.extraOptions[a].style||"")+'" class="dialog-line-option '+(settings.extraOptions[a]._class||"")+'" data-option="'+a+'">\n',i+='<option value="0">'+_("0s")+'</option><option value="10">'+_("10s")+'</option><option value="30">'+_("30s")+'</option><option value="60">'+_("60s")+'</option><option value="120">'+_("2m")+'</option><option value="180">'+_("3m")+'</option><option value="240">'+_("4m")+'</option><option value="300">'+_("5m")+'</option><option value="600">'+_("10m")+'</option><option value="900">'+_("15m")+'</option><option value="1800">'+_("30m")+'</option><option value="2700">'+_("45m")+'</option><option value="3600">'+_("1H")+'</option><option value="7200">'+_("2H")+'</option><option value="21600">'+_("6H")+'</option><option value="43200">'+_("12H")+'</option><option value="86400">'+_("1D")+'</option><option value="172800">'+_("2D")+'</option><option value="259200">'+_("3D")+'</option><option value="345600">'+_("4D")+'</option><option value="604800">'+_("1W")+'</option><option value="1209600">'+_("2W")+'</option><option value="1m">'+_("1M")+'</option><option value="2m">'+_("2M")+'</option><option value="3m">'+_("3M")+'</option><option value="6m">'+_("6M")+'</option><option value="1y">'+_("1Y")+'</option><option value="2y">'+_("2Y")+"</option>",i+="</select></td>\n";else if(settings.extraOptions[a].values){i+='<td><select id="option_'+a+'" class="dialog-line-option" data-option="'+a+'" '+(settings.extraOptions[a].type?'type="'+settings.extraOptions[a].type+'" ':"")+' style="'+(settings.extraOptions[a].width?"width: "+settings.extraOptions[a].width+";":"")+(settings.extraOptions[a].style||"")+'" '+(void 0!==settings.extraOptions[a].default?'data-default="'+settings.extraOptions[a].default+'"':"")+">";for(var s=0;s<settings.extraOptions[a].values.length;s++)i+='<option value="'+settings.extraOptions[a].values[s]+'">'+(settings.extraOptions[a].names&&void 0!==settings.extraOptions[a].names[s]?_(settings.extraOptions[a].names[s]):settings.extraOptions[a].values[s])+"</option>";i+="</select></td>"}else i+='<td><input id="option_'+a+'" class="dialog-line-option" data-option="'+a+'" '+(settings.extraOptions[a].type?'type="'+settings.extraOptions[a].type+'" ':"")+' style="'+(settings.extraOptions[a].width?"width: "+settings.extraOptions[a].width+";":"")+(settings.extraOptions[a].style||"")+'" '+(void 0!==settings.extraOptions[a].default?'data-default="'+settings.extraOptions[a].default+'"':"")+"/></td>";i+="</tr>"}n.find("table").html(i),n.dialog({autoOpen:!1,modal:!0,width:430,resizable:!1,height:32*o+120,buttons:[{text:_("Ok"),click:function(){var e=$("#dialog-line-options"),t=e.data("index"),n=!1,o=m.options.l[t];e.find(".dialog-line-option").each(function(){var e=$(this).data("option");"checkbox"===$(this).attr("type")?$(this).prop("checked")!==o[e]&&(n=!0,o[e]=$(this).prop("checked")):$(this).val()!=o[e]&&(n=!0,o[e]=$(this).val())}),n&&x(),e.dialog("close")}},{text:_("Cancel"),click:function(){$("#dialog-line-options").dialog("close")}}]})}n.find(".dialog-line-option").each(function(){var e=$(this).data("option");"checkbox"===$(this).attr("type")?("true"===t[e]&&(t[e]=!0),"false"===t[e]&&(t[e]=!1),null===$(this).data("default")||void 0===$(this).data("default")||void 0!==t[e]&&""!==t[e]&&null!==t[e]||(t[e]="true"===$(this).data("default")),$(this).prop("checked",!0===t[e])):(null===$(this).data("default")||void 0===$(this).data("default")||void 0!==t[e]&&""!==t[e]&&null!==t[e]||(t[e]=$(this).data("default")),$(this).val(void 0===t[e]?"":t[e]))}),n.dialog("option","title",_("Edit options for line %s",e+1)),n.dialog("open")}($(this).data("index"))}).css({width:22,height:22}),$(".select-dialog").button({text:!1,icons:{primary:"ui-icon-folder-open"}}).css({width:25,height:22}).click(function(){var o=$(this).data("index"),e=$('[data-option="instance"][data-index="'+o+'"]').val();e||(e=u),$("#dialog-select-member").selectId("show",m.options.l[o].id,{common:{custom:e}},function(e,t,n){m.options.l[o].id=e,$('.ids[data-index="'+o+'"]').val(e).trigger("change"),n&&"boolean"===n.common.type&&($('select[data-option="aggregate"][data-index="'+o+'"]').val("onchange").trigger("change"),$('select[data-option="chartType"][data-index="'+o+'"]').val("steps").trigger("change"),$('input[data-option="min"][data-index="'+o+'"]').val(0).trigger("change"),$('input[data-option="max"][data-index="'+o+'"]').val(10).trigger("change")),k()})}),$(".options-lines").each(function(){var e=$(this),t=$(this).data("index"),n=$(this).data("option");void 0!==m.options.l[t][n]&&("checkbox"===e.attr("type")?("true"===m.options.l[t][n]&&(m.options.l[t][n]=!0),"false"===m.options.l[t][n]&&(m.options.l[t][n]=!1),e.prop("checked",!!m.options.l[t][n])):e.val(m.options.l[t][n]))}),$(".spinner-lines").attr("type","number"),"function"==typeof c&&c(),$(".toggleable").click(function(){var e=$(this).data("index"),t=$('col[data-index="'+e+'"]');t.data("width")||t.data("width",t.attr("width")),t.data("hidden")?(t.data("hidden",!1),t.attr("width",t.data("width")),$(this).css("width",t.data("width"))):(t.data("hidden",!0),t.attr("width","10px"),$(this).css("width","10px"))}),$('select[data-option="chartType"]').on("change",function(){"spline"===$(this).val()&&alert("Experimental")}),v()},100)}function y(){var e=JSON.parse(JSON.stringify(m.options));for(var t in e)e.hasOwnProperty(t)&&""===e[t]&&delete e[t];for(var n=0;n<e.l.length;n++)if(""===e.l[n].id)e.l.splice(n,1),n--;else for(var o in e.l[n])e.l[n].hasOwnProperty(o)&&""===e.l[n][o]&&delete e.l[n][o];return $.param(e)}function w(){n&&clearTimeout(n),n=setTimeout(x,500)}function x(){if(h){clearTimeout(n),n=null,"undefined"!=typeof Storage&&($(".value").each(function(){"checkbox"===$(this).attr("type")?m.options[$(this).attr("id")]=$(this).prop("checked"):m.options[$(this).attr("id")]=$(this).val()}),S());var e=y();c?e!==l[c].native.url?$(".save").button("enable"):$(".save").button("disable"):$(".save").button("enable"),$("#link").val(location.href.split("?")[0].replace("edit.html","index.html")+"?"+e),$("#updatePreview").button("option","disabled",!1),"step"===$("#aggregateType").val()?$("#spanName").text(_("Seconds")+":"):$("#spanName").text(_("Counts")+":"),$(".relative, .static").hide(),$("."+$("#timeType").val()).show(),$("#autoUpdate").prop("checked")&&(A(),$("#updatePreview").hide());var t="";t="relative"===m.options.timeType?_("%s ago",$("#range").find("option:selected").text())+" - "+_(m.options.relativeEnd):new Date(m.options.start).toLocaleDateString()+" "+new Date(m.options.start+" "+m.options.start_time).toLocaleTimeString()+" - "+new Date(m.options.end).toLocaleDateString()+" "+new Date(m.options.end+" "+m.options.end_time).toLocaleTimeString(),$("#time_span").html("["+t+"]")}}function S(){"undefined"!=typeof Storage&&localStorage.setItem("yunkong2.Flot",JSON.stringify(m))}function A(){e&&clearTimeout(e),e=setTimeout(C,500)}function C(){var e=$("#chart"),t=parseInt($("#height").val(),10);t?e.css({height:(t||500)+90}):e.css({height:"calc(100% - 350px)"});var n=y();e.attr("src",""),setTimeout(function(){e.attr("src","index.html?"+n+"&"+(new Date).getTime())},0),$("#updatePreview").button("option","disabled",!0)}function M(e){return e=e.replace("#",""),128<=(299*parseInt(e.substr(0,2),16)+587*parseInt(e.substr(2,2),16)+114*parseInt(e.substr(4,2),16))/1e3?"black":"white"}function B(e,t,n){e&&l[e]?l[e].native.url=y():(e=O(t),l[e]={common:{name:t},type:"chart",native:{url:y()}}),c=e,s.emit("setObject",e,l[e],function(e){$(".save").button("disable"),n&&n(e)})}function F(e,n){s.emit("getObject",e,function(e,t){t?(c=t._id,b((l[t._id]=t).native.url),$("#accordion").tabs({active:1}),k(),I(),x(),A()):alert(_("Not found")),n&&n()})}function O(e){return"flot."+g+"."+e.replace(/[.,\s]+/,"_")}function a(e){var t=deparam(e||"");if(t.l){for(var n=[],o=0;o<t.l.length;o++)n.push(t.l[o].id);return n.join(", ")}return""}function L(){var e="",t=y();for(var n in l)if(l.hasOwnProperty(n)){var o=l[n];c||o.native.url!==t||(c=n),e+='<tr data-name="'+n+'" class="'+(n===c?"presets-selected":"")+'">',e+='<td class="presets_table_th_load" style="text-align: center"><button class="presets-btn-load" data-name="'+n+'">'+_("load")+"</button></td>",e+='<td class="presets_table_th_name">'+o.common.name+"</td>",e+='<td class="presets_table_th_ids">'+a(o.native.url)+"</td>",e+='<td class="presets_table_th_buttons" style="text-align: center"></button><button data-name="'+n+'" class="presets-btn-delete"></button><button data-name="'+n+'" class="presets-btn-rename"></button></td>',e+="</tr>"}var i=$("#presets_table");i.html(e),$(".presets-btn-load").button().click(function(){var e=$(this).data("name");F(e,function(){i.find("tr").removeClass("presets-selected"),i.find('tr[data-name="'+e+'"]').addClass("presets-selected")})}),$(".presets-btn-delete").button({icons:{secondary:"ui-icon-trash"},text:!1}).click(function(){var t=$(this).data("name");window.confirm(_("Are you sure?"))&&s.emit("delObject",t,function(e){delete l[t],L()})}).css({width:32,height:32}),$(".presets-btn-rename").button({icons:{secondary:"ui-icon-pencil"},text:!1}).click(function(){var a=$(this).data("name");$("#dialog-new-preset-name").val(l[a].common.name),$("#dialog-new-preset-info-tr").hide(),$("#dialog-new-preset").dialog({autoOpen:!0,modal:!0,title:_("Enter chart name"),width:430,resizable:!1,buttons:[{id:"dialog-new-preset-ok",text:_("Ok"),click:function(){var e,n,o,t=$("#dialog-new-preset-name").val(),i=O(t);l[i]&&!window.confirm(_("Overwrite existing?"))||(e=a,n=t,o=function(){$("#dialog-new-preset").dialog("close")},s.emit("getObject",e,function(e,t){s.emit("delObject",t._id,function(e){delete l[t._id],t.common.name=n,t._id=O(name),s.emit("setObject",t._id,t,function(e){l[t._id]=t,c=t._id,L(),o&&o()})})}))}},{text:_("Cancel"),click:function(){$("#dialog-new-preset").dialog("close")}}]})}).css({width:32,height:32})}function I(){$(".value").each(function(){var e=$(this),t=e.attr("id");void 0!==m.options[t]&&("checkbox"===e.attr("type")?("true"===m.options[t]&&(m.options[t]=!0),"false"===m.options[t]&&(m.options[t]=!1),e.prop("checked",!!m.options[t])):e.val(m.options[t]))}),(m.options.bg||0===m.options.bg)&&(m.options.bg&&m.options.bg.length<3&&parseInt(m.options.bg,10).toString()===m.options.bg.toString()?($("#bg").hide(),$("#bg_predefined").show().val(m.options.bg)):($("#bg_custom").prop("checked",!0),$("#bg").show(),$("#bg_predefined").hide()))}!function(){for(var e in console.log("Initialize..."),settings.maxLines<2&&$("#ids_add").hide(),settings)settings.hasOwnProperty(e)&&"object"==typeof settings[e]&&!1===settings[e].enabled&&$("."+e).remove();f();var t=location.href.split("?")[1];if(t&&t.match(/^preset=/)?(c=t.replace(/^preset=/,""),d=!0):b(location.href.split("?")[1]),"undefined"!=typeof sysLang&&(systemLang=sysLang||"en"),$("#dialog-select-member").selectId("init",{filter:{common:{custom:!0}},imgPath:"../lib/css/fancytree/",noMultiselect:!0,connCfg:{socketUrl:socketUrl,socketSession:socketSession,socketName:"flotEditDialog",upgrade:"undefined"!=typeof socketForceWebSockets?!socketForceWebSockets:void 0,rememberUpgrade:"undefined"!=typeof socketForceWebSockets?socketForceWebSockets:void 0,transports:"undefined"!=typeof socketForceWebSockets&&socketForceWebSockets?["websocket"]:void 0},columns:["name","role","room","value"],texts:{select:_("Select"),cancel:_("Cancel"),all:_("All"),id:_("ID"),name:_("Name"),role:_("Role"),room:_("Room"),value:_("Value"),selectid:_("Select ID"),from:_("From"),lc:_("Last changed"),ts:_("Time stamp"),wait:_("Processing..."),ack:_("Acknowledged")}}),"undefined"!=typeof Storage&&!c){var n=localStorage.getItem("yunkong2.Flot");if(n)try{n=JSON.parse(n);var o=document.location.href.split("?");o[1]?(n.options=m.options,m=n,S(),document.location.href=o[0]):n.options&&(m=n)}catch(e){console.log("Cannot parse stored settings")}}$("#autoUpdate").change(function(){m["auto-update"]=$(this).prop("checked")?"true":"false",x(),"true"===m["auto-update"]?$("#updatePreview").hide():$("#updatePreview").show()}).prop("checked","true"===m["auto-update"]),$("#arrangeBools").button().click(function(){for(var e=0,t=null,n=0;n<m.options.l.length;n++)"steps"===m.options.l[n].chartType&&(null===t&&(t=n),e++);for(var o=0,i=0;i<m.options.l.length;i++)"steps"===m.options.l[i].chartType&&(m.options.l[i].max=Math.round(2*e*1.2*10)/10,m.options.l[i].commonYAxis=t+1,m.options.l[i].yOffset=Math.round(1.2*-(o+1)*10)/10,m.options.l[i].min=Math.round(10*(1.2*-e-.1))/10,m.options.l[i].yaxe="off",o++),m.options.l[i].min=Math.round(10*(1.2*-e-.1))/10;k(),S(),w()});var i=$("#accordion");i.on("change",".options-lines",function(){var e=$(this).data("index");"checkbox"===$(this).attr("type")?m.options.l[e][$(this).data("option")]=$(this).prop("checked"):m.options.l[e][$(this).data("option")]=$(this).val(),$(this).hasClass("spinner-lines")?w():x()}).on("keyup",".options-lines",function(){$(this).trigger("change")}),i.on("change",".markline-value",function(){var e=$(this).data("index");"checkbox"===$(this).attr("type")?m.options.m[e][$(this).data("option")]=$(this).prop("checked")?1:0:m.options.m[e][$(this).data("option")]=$(this).val(),x()}).on("keyup",".markline-value",function(){$(this).trigger("change")}),d&&($(i.find("li")[0]).hide(),$("#chapter_presets").hide()),$("#ids_add").button({icons:{secondary:"ui-icon-plus"},text:!0}).click(function(){f(),k()}).css({height:30}),$("#markline_add").button({icons:{secondary:"ui-icon-plus"},text:!0}).click(function(){!function(){m.options.m||(m.options.m=[]);var e=m.options.m.length;m.options.m.push({l:0,v:0,f:!1,c:r[e]||"#00FFFF",t:3,s:3,d:"",p:"l",py:0,fc:r[e]||"#00FFFF",fs:""})}(),v()}).css({height:30}),$("#clear").button({icons:{primary:"ui-icon-trash"},text:!1}).click(function(){localStorage.setItem("yunkong2.Flot",JSON.stringify({reset:!0})),location.reload()}).css({width:30,height:30}),$(".value").change(function(){$(this).hasClass("spinner")||$(this).hasClass("input-static-color")?w():x()}).keyup(function(){$(this).trigger("change")}),$(".input-static-color").colorpicker({colorFormat:"#HEX"}).on("change",function(){$(this).css({"background-color":$(this).val(),color:M($(this).val())})}).trigger("change"),$(".clear-button").hide(),$("#timeType").change(function(){$(".relative, .static").hide(),$("."+$(this).val()).show()}),$(".spinner").attr("type","number"),$("#bg_custom").change(function(){$(this).prop("checked")?($("#bg").show(),$("#bg_predefined").hide()):($("#bg").hide(),$("#bg_predefined").show().val(0).trigger("change"))}),$("#bg_predefined").change(function(){$("#bg").val($(this).val()).trigger("change")}),$("#ticks_select").button({text:!1,icons:{primary:"ui-icon-folder-open"}}).css({width:25,height:22}).click(function(){$("#dialog-select-member").selectId("show",$("#ticks").val(),{common:{custom:!0}},function(e,t,n){e&&$("#ticks").val(e).trigger("change")})}),$("#aggregateType").change(function(){"step"===$("#aggregateType").val()?$("#spanName").text(_("Seconds")):$("#spanName").text(_("Counts"))}),$("#updatePreview").button({icons:{primary:"ui-icon-refresh"}}).click(C).button("option","disabled",!0).css({"font-size":14,"white-space":"nowrap"}),$("#open").button({icons:{primary:"ui-icon-play"}}).click(function(){window.open($("#link").val(),"flot")}).css({"font-size":14,"white-space":"nowrap"}),translateAll(),i.tabs({active:parseInt(m.acc)||0,animate:{easing:"linear",duration:200},activate:function(e,t){m.acc=$(t.newHeader).attr("id"),S()}});var a=$("#chart").height();$("#resizable1").resizable({autoHide:!0,handles:"s",resize:function(e,t){$("#chart").height(a-(t.element.outerHeight()-t.originalSize.height))},stop:function(e,t){a=$("#chart").height(),$("#temp_div").remove()},start:function(){var e=$("#chart"),t=$("<div></div>");$("body").append(t[0]),t[0].id="temp_div",t.css({position:"absolute"}),t.css({top:e.position().top,left:0}),t.height(e.height()),t.width("100%")}}),window.onbeforeunload=function(e){return console.log("onbeforeunload"),d&&c&&y()!==l[c].native.url?(e.returnValue=_("You have unsaved settings. Discard?"),e.returnValue):null},I(),setTimeout(function(){console.log("Init connection..."),(s=io.connect(socketUrl,{query:{key:socketSession},reconnectionDelay:1e4,reconnectionAttempts:1/0,upgrade:"undefined"!=typeof socketForceWebSockets?!socketForceWebSockets:void 0,rememberUpgrade:"undefined"!=typeof socketForceWebSockets?socketForceWebSockets:void 0,transports:"undefined"!=typeof socketForceWebSockets&&socketForceWebSockets?["websocket"]:void 0})).on("connect",function(){console.log("Connected"),setTimeout(function(){s.emit("name","flotEdit")},50),setTimeout(function(){var a;a=function(){s.emit("getObject","system.config",function(e,t){t&&t.common&&(u=t.common.defaultHistory||"history.0"),s.emit("getObjectView","system","instance",{startkey:"system.adapter.",endkey:"system.adapter.香"},function(e,t){if(!e&&t&&t.rows&&0!==t.rows.length)for(var n=0;n<t.rows.length;n++){var o=t.rows[n].value;o&&"instance"===o.type&&o.common&&"storage"===o.common.type&&-1===p.indexOf(o._id.substring("system.adapter.".length))&&p.push(o._id.substring("system.adapter.".length))}k(),x(),A(),setTimeout(function(){$("iframe").attr("src","index.html")},500)})})},s.emit("getObjectView","chart","chart",{startkey:"flot."+g+".",endkey:"flot."+g+".香"},function(e,t){if(l={},h=!0,t&&t.rows)for(var n=0;n<t.rows.length;n++)l[t.rows[n].value._id]=t.rows[n].value;if(c&&!l[c]&&(alert(_("Chart ID %s not found",c)),c="",d=!1,$($("#accordion").find("li")[0]).show(),$("#chapter_presets").show()),c){var o=a;a=null,setTimeout(function(){F(c,o)},200)}L();var i=$(".save");i.button({icons:{primary:"ui-icon-arrowthickstop-1-s"},label:d?_("save %s",l[c].common.name):_("save"),showLabel:!0}).click(function(){if(d&&c)B(c);else{var e='<option value="">'+_("new")+"</option>";for(var t in l)e+='<option value="'+t+'">'+l[t].common.name+"</option>";$("#dialog-new-preset-info-tr").show(),$("#dialog-new-preset-into").html(e).val(c).unbind("change").bind("change",function(){var e=$(this).val();e?$("#dialog-new-preset-name-tr").hide():$("#dialog-new-preset-name-tr").show()}).trigger("change"),$("#dialog-new-preset").dialog({autoOpen:!0,modal:!0,title:_("Enter chart name"),width:430,resizable:!1,buttons:[{id:"dialog-new-preset-ok",text:_("Ok"),click:function(){var e=$("#dialog-new-preset-into").val(),t=e;(e||(e=$("#dialog-new-preset-name").val(),t=O(e),!l[t]||window.confirm(_("Overwrite existing?"))))&&B(t,e,function(){L(),$("#dialog-new-preset").dialog("close")})}},{text:_("Cancel"),click:function(){$("#dialog-new-preset").dialog("close")}}]})}}).css({"font-size":14,"white-space":"nowrap"}),t&&t.rows&&t.rows.length?c&&i.button("disable"):($("#accordion").tabs({active:1}),i.button("enable")),$("#dialog-new-preset-name").keyup(function(e){13===e.keyCode&&$("#dialog-new-preset-ok").trigger("click")}),a&&a()})},100)}),s.on("disconnect",function(){console.log("Lost connection")}),s.on("error",function(e){console.error("Socket error: "+e)}),s.on("connect_error",function(e){console.error("Socket error: "+e)})},200)}()});
//# sourceMappingURL=edit.js.map