',swatchTemplate:''},d=function(e){function t(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,p.default.extend(!0,{},f,o)));return r.element=null,r}return a(t,e),l(t,[{key:"isEnabled",value:function(){return this.getLength()>0}},{key:"onCreate",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onCreate",this).call(this,e),this.isEnabled()&&(this.element=(0,p.default)(this.options.barTemplate),this.load(),this.colorpicker.picker.append(this.element))}},{key:"load",value:function(){var e=this,t=this.colorpicker,o=this.element.find(".colorpicker-swatches--inner"),r=!0===this.options.namesAsValues&&!Array.isArray(this.colors);o.empty(),p.default.each(this.colors,function(n,i){var a=(0,p.default)(e.options.swatchTemplate).attr("data-name",n).attr("data-value",i).attr("title",r?n+": "+i:i).on("mousedown.colorpicker touchstart.colorpicker",function(e){var o=(0,p.default)(this);t.setValue(r?o.attr("data-name"):o.attr("data-value"))});a.find(".colorpicker-swatch--inner").css("background-color",i),o.append(a)}),o.append((0,p.default)(''))}}]),t}(u.default);t.default=d},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;o0)}},{key:"onClickingInside",value:function(e){this.clicking=this.isClickingInside(e)}},{key:"createPopover",value:function(){var e=this.colorpicker;this.popoverTarget=this.hasAddon?this.addon:this.input,e.picker.addClass("colorpicker-bs-popover-content"),this.popoverTarget.popover(l.default.extend(!0,{},c.default.popover,e.options.popover,{trigger:"manual",content:e.picker,html:!0})),this.popoverTip=(0,l.default)(this.popoverTarget.popover("getTipElement").data("bs.popover").tip),this.popoverTip.addClass("colorpicker-bs-popover"),this.popoverTarget.on("shown.bs.popover",l.default.proxy(this.fireShow,this)),this.popoverTarget.on("hidden.bs.popover",l.default.proxy(this.fireHide,this))}},{key:"reposition",value:function(e){this.popoverTarget&&this.isVisible()&&this.popoverTarget.popover("update")}},{key:"toggle",value:function(e){this.isVisible()?this.hide(e):this.show(e)}},{key:"show",value:function(e){if(!(this.isVisible()||this.showing||this.hidding)){this.showing=!0,this.hidding=!1,this.clicking=!1;var t=this.colorpicker;t.lastEvent.alias="show",t.lastEvent.e=e,e&&(!this.hasInput||"color"===this.input.attr("type"))&&e&&e.preventDefault&&(e.stopPropagation(),e.preventDefault()),this.isPopover&&(0,l.default)(this.root).on("resize.colorpicker",l.default.proxy(this.reposition,this)),t.picker.addClass("colorpicker-visible").removeClass("colorpicker-hidden"),this.popoverTarget?this.popoverTarget.popover("show"):this.fireShow()}}},{key:"fireShow",value:function(){this.hidding=!1,this.showing=!1,this.isPopover&&((0,l.default)(this.root.document).on("mousedown.colorpicker touchstart.colorpicker",l.default.proxy(this.hide,this)),(0,l.default)(this.root.document).on("mousedown.colorpicker touchstart.colorpicker",l.default.proxy(this.onClickingInside,this))),this.colorpicker.trigger("colorpickerShow")}},{key:"hide",value:function(e){if(!(this.isHidden()||this.showing||this.hidding)){var t=this.colorpicker,o=this.clicking||this.isClickingInside(e);if(this.hidding=!0,this.showing=!1,this.clicking=!1,t.lastEvent.alias="hide",t.lastEvent.e=e,o)return void(this.hidding=!1);this.popoverTarget?this.popoverTarget.popover("hide"):this.fireHide()}}},{key:"fireHide",value:function(){this.hidding=!1,this.showing=!1;var e=this.colorpicker;e.picker.addClass("colorpicker-hidden").removeClass("colorpicker-visible"),(0,l.default)(this.root).off("resize.colorpicker",l.default.proxy(this.reposition,this)),(0,l.default)(this.root.document).off("mousedown.colorpicker touchstart.colorpicker",l.default.proxy(this.hide,this)),(0,l.default)(this.root.document).off("mousedown.colorpicker touchstart.colorpicker",l.default.proxy(this.onClickingInside,this)),e.trigger("colorpickerHide")}},{key:"focus",value:function(){return this.hasAddon?this.addon.focus():!!this.hasInput&&this.input.focus()}},{key:"isVisible",value:function(){return this.colorpicker.picker.hasClass("colorpicker-visible")&&!this.colorpicker.picker.hasClass("colorpicker-hidden")}},{key:"isHidden",value:function(){return this.colorpicker.picker.hasClass("colorpicker-hidden")&&!this.colorpicker.picker.hasClass("colorpicker-visible")}},{key:"input",get:function(){return this.colorpicker.inputHandler.input}},{key:"hasInput",get:function(){return this.colorpicker.inputHandler.hasInput()}},{key:"addon",get:function(){return this.colorpicker.addonHandler.addon}},{key:"hasAddon",get:function(){return this.colorpicker.addonHandler.hasAddon()}},{key:"isPopover",get:function(){return!this.colorpicker.options.inline&&!!this.popoverTip}}]),e}();t.default=u},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:null;return(e=e||this.colorpicker.colorHandler.getColorString())?(e=this.colorpicker.colorHandler.resolveColorDelegate(e,!1),!1===this.colorpicker.options.useHashPrefix&&(e=e.replace(/^#/g,"")),e):""}},{key:"hasInput",value:function(){return!1!==this.input}},{key:"isEnabled",value:function(){return this.hasInput()&&!this.isDisabled()}},{key:"isDisabled",value:function(){return this.hasInput()&&!0===this.input.prop("disabled")}},{key:"disable",value:function(){this.hasInput()&&this.input.prop("disabled",!0)}},{key:"enable",value:function(){this.hasInput()&&this.input.prop("disabled",!1)}},{key:"update",value:function(){this.hasInput()&&(!1===this.colorpicker.options.autoInputFallback&&this.colorpicker.colorHandler.isInvalidColor()||this.setValue(this.getFormattedColor()))}},{key:"onchange",value:function(e){this.colorpicker.lastEvent.alias="input.change",this.colorpicker.lastEvent.e=e;var t=this.getValue();t!==e.value&&this.colorpicker.setValue(t)}},{key:"onkeyup",value:function(e){this.colorpicker.lastEvent.alias="input.keyup",this.colorpicker.lastEvent.e=e;var t=this.getValue();t!==e.value&&this.colorpicker.setValue(t)}}]),e}();t.default=u},function(e,t,o){"use strict";function r(e,t){if(!(this instanceof r))return new r(e,t);if(t&&t in f&&(t=null),t&&!(t in h))throw new Error("Unknown model: "+t);var o,n;if(e)if(e instanceof r)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"==typeof e){var i=u.get(e);if(null===i)throw new Error("Unable to parse color from string: "+e);this.model=i.model,n=h[this.model].channels,this.color=i.value.slice(0,n),this.valpha="number"==typeof i.value[n]?i.value[n]:1}else if(e.length){this.model=t||"rgb",n=h[this.model].channels;var a=p.call(e,0,n);this.color=c(a,n),this.valpha="number"==typeof e[n]?e[n]:1}else if("number"==typeof e)e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;var l=Object.keys(e);"alpha"in e&&(l.splice(l.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);var s=l.sort().join("");if(!(s in d))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=d[s];var k=h[this.model].labels,g=[];for(o=0;oo?(t+.05)/(o+.05):(o+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return r.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),o=t.color[0];return o=(o+e)%360,o=o<0?360+o:o,t.color[0]=o,t},mix:function(e,t){var o=e.rgb(),n=this.rgb(),i=void 0===t?.5:t,a=2*i-1,l=o.alpha()-n.alpha(),s=((a*l==-1?a:(a+l)/(1+a*l))+1)/2,c=1-s;return r.rgb(s*o.red()+c*n.red(),s*o.green()+c*n.green(),s*o.blue()+c*n.blue(),o.alpha()*i+n.alpha()*(1-i))}},Object.keys(h).forEach(function(e){if(-1===f.indexOf(e)){var t=h[e].channels;r.prototype[e]=function(){if(this.model===e)return new r(this);if(arguments.length)return new r(arguments,e);var o="number"==typeof arguments[t]?t:this.valpha;return new r(s(h[this.model][e].raw(this.color)).concat(o),e)},r[e]=function(o){return"number"==typeof o&&(o=c(p.call(arguments),t)),new r(o,e)}}}),e.exports=r},function(e,t,o){function r(e,t,o){return Math.min(Math.max(t,e),o)}function n(e){var t=e.toString(16).toUpperCase();return t.length<2?"0"+t:t}var i=o(5),a=o(18),l={};for(var s in i)i.hasOwnProperty(s)&&(l[i[s]]=s);var c=e.exports={to:{}};c.get=function(e){var t,o,r=e.substring(0,3).toLowerCase();switch(r){case"hsl":t=c.get.hsl(e),o="hsl";break;case"hwb":t=c.get.hwb(e),o="hwb";break;default:t=c.get.rgb(e),o="rgb"}return t?{model:o,value:t}:null},c.get.rgb=function(e){if(!e)return null;var t,o,n,a=/^#([a-f0-9]{3,4})$/i,l=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,s=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,c=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,u=/(\D+)/,h=[0,0,0,1];if(t=e.match(l)){for(n=t[2],t=t[1],o=0;o<3;o++){var p=2*o;h[o]=parseInt(t.slice(p,p+2),16)}n&&(h[3]=Math.round(parseInt(n,16)/255*100)/100)}else if(t=e.match(a)){for(t=t[1],n=t[3],o=0;o<3;o++)h[o]=parseInt(t[o]+t[o],16);n&&(h[3]=Math.round(parseInt(n+n,16)/255*100)/100)}else if(t=e.match(s)){for(o=0;o<3;o++)h[o]=parseInt(t[o+1],0);t[4]&&(h[3]=parseFloat(t[4]))}else{if(!(t=e.match(c)))return(t=e.match(u))?"transparent"===t[1]?[0,0,0,0]:(h=i[t[1]])?(h[3]=1,h):null:null;for(o=0;o<3;o++)h[o]=Math.round(2.55*parseFloat(t[o+1]));t[4]&&(h[3]=parseFloat(t[4]))}for(o=0;o<3;o++)h[o]=r(h[o],0,255);return h[3]=r(h[3],0,1),h},c.get.hsl=function(e){if(!e)return null;var t=/^hsla?\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,o=e.match(t);if(o){var n=parseFloat(o[4]);return[(parseFloat(o[1])%360+360)%360,r(parseFloat(o[2]),0,100),r(parseFloat(o[3]),0,100),r(isNaN(n)?1:n,0,1)]}return null},c.get.hwb=function(e){if(!e)return null;var t=/^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,o=e.match(t);if(o){var n=parseFloat(o[4]);return[(parseFloat(o[1])%360+360)%360,r(parseFloat(o[2]),0,100),r(parseFloat(o[3]),0,100),r(isNaN(n)?1:n,0,1)]}return null},c.to.hex=function(){var e=a(arguments);return"#"+n(e[0])+n(e[1])+n(e[2])+(e[3]<1?n(Math.round(255*e[3])):"")},c.to.rgb=function(){var e=a(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},c.to.rgb.percent=function(){var e=a(arguments),t=Math.round(e[0]/255*100),o=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+o+"%, "+r+"%)":"rgba("+t+"%, "+o+"%, "+r+"%, "+e[3]+")"},c.to.hsl=function(){var e=a(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},c.to.hwb=function(){var e=a(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},c.to.keyword=function(e){return l[e.slice(0,3)]}},function(e,t,o){"use strict";var r=o(19),n=Array.prototype.concat,i=Array.prototype.slice,a=e.exports=function(e){for(var t=[],o=0,a=e.length;o=0&&e.splice instanceof Function)}},function(e,t,o){function r(e){var t=function(t){return void 0===t||null===t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}function n(e){var t=function(t){if(void 0===t||null===t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var o=e(t);if("object"==typeof o)for(var r=o.length,n=0;n1&&void 0!==arguments[1])||arguments[1],o=new c.default(this.resolveColorDelegate(e),this.format);return o.isValid()||(t&&(o=this.getFallbackColor()),this.colorpicker.trigger("colorpickerInvalid",o,e)),this.isAlphaEnabled()||(o.alpha=1),o}},{key:"getFallbackColor",value:function(){if(this.fallback&&this.fallback===this.color)return this.color;var e=this.resolveColorDelegate(this.fallback),t=new c.default(e,this.format);if(!t.isValid())throw new Error("The fallback color is invalid.");return t}},{key:"assureColor",value:function(){return this.hasColor()||(this.color=this.getFallbackColor()),this.color}},{key:"resolveColorDelegate",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!1;return l.default.each(this.colorpicker.extensions,function(r,n){!1===o&&(o=n.resolveColor(e,t))}),o||e}},{key:"isInvalidColor",value:function(){return!this.hasColor()||!this.color.isValid()}},{key:"isAlphaEnabled",value:function(){return!1!==this.colorpicker.options.useAlpha}},{key:"hasColor",value:function(){return this.color instanceof c.default}},{key:"fallback",get:function(){return this.colorpicker.options.fallbackColor?this.colorpicker.options.fallbackColor:this.hasColor()?this.color:null}},{key:"format",get:function(){return this.colorpicker.options.format?this.colorpicker.options.format:this.hasColor()&&this.color.hasTransparency()&&this.color.format.match(/^hex/)?this.isAlphaEnabled()?"rgba":"hex":this.hasColor()?this.color.format:"rgb"}},{key:"color",get:function(){return this.colorpicker.element.data("color")},set:function(e){this.colorpicker.element.data("color",e),e instanceof c.default&&"auto"===this.colorpicker.options.format&&(this.colorpicker.options.format=this.color.format)}}]),e}();t.default=u},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;o0?o.css(t):this.addon.css(t)}}}]),e}();t.default=i}])});
//# sourceMappingURL=bootstrap-colorpicker.min.js.map