!function(){var t=function(t,e){for(var i in e)t.style[i]=e[i]};function e(t){if(this===window)throw"Colorpicker: Can't call a function directly";this.init(t)}e.prototype={init(e){let{el:i,initColor:n="rgb(255,0,0)",allMode:o=["hex","rgb"],color:r=""}=e;if(!(p=document.getElementById(i))||!p.nodeType||1!==p.nodeType)throw`Colorpicker: not found ID:${i} HTMLElement,not ${{}.toString.call(i)}`;this.Opt={...e,el:i,initColor:n,allMode:o,color:r},this.bindElem=p,this.elem_wrap=null,this.fixedBg=null,this.elem_colorPancel=null,this.elem_picker=null,this.elem_barPicker1=null,this.elem_hexInput=null,this.elem_showColor=null,this.elem_showModeBtn=null,this.elem_inputWrap=null,this.pancelLeft=0,this.pancelTop=0,this.downX=0,this.downY=0,this.moveX=0,this.moveY=0,this.pointLeft=0,this.pointTop=0,this.current_mode="hex",this.rgba={r:0,g:0,b:0,a:1},this.hsb={h:0,s:100,b:100};var s=this,l=n.slice(4,-1).split(",");this.rgba.r=parseInt(l[0]),this.rgba.g=parseInt(l[1]),this.rgba.b=parseInt(l[2]);var a=document.getElementsByTagName("body")[0],h=document.createElement("div");h.innerHTML=this.render(),a.appendChild(h),this.elem_wrap=h,this.fixedBg=h.children[0],this.elem_colorPancel=h.getElementsByClassName("color-pancel")[0],this.pancel_width=this.elem_colorPancel.offsetWidth,this.pancel_height=this.elem_colorPancel.offsetHeight,this.elem_picker=h.getElementsByClassName("pickerBtn")[0],this.elem_colorPalette=h.getElementsByClassName("color-palette")[0],this.elem_showColor=h.getElementsByClassName("colorpicker-showColor")[0],this.elem_barPicker1=h.getElementsByClassName("colorBar-color-picker")[0],this.elem_hexInput=h.getElementsByClassName("colorpicker-hexInput")[0],this.elem_showModeBtn=h.getElementsByClassName("colorpicker-showModeBtn")[0],this.elem_inputWrap=h.getElementsByClassName("colorpicker-inputWrap")[0];for(var p,d=(p=this.bindElem).offsetTop,g=p.offsetLeft;p.offsetParent;)d+=p.offsetParent.offsetTop,g+=p.offsetParent.offsetLeft,p=p.offsetParent;this.pancelLeft=g+this.elem_colorPalette.clientWidth,this.pancelTop=d+this.bindElem.offsetHeight,t(h,{position:"absolute","z-index":2,display:"none",left:g+"px",top:d+this.bindElem.offsetHeight+"px"}),this.bindMove(this.elem_colorPancel,this.setPosition,!0),this.bindMove(this.elem_barPicker1.parentNode,this.setBar,!1),this.bindElem.addEventListener("click",function(){s.show()},!1),this.fixedBg.addEventListener("click",function(t){s.hide()},!1),this.elem_showModeBtn.addEventListener("click",function(){s.switch_current_mode()},!1),this.elem_wrap.addEventListener("input",function(t){var e=t.target.value;s.setColorByInput(e)},!1),this.elem_colorPalette.addEventListener("click",function(t){if("p"==t.target.tagName.toLocaleLowerCase()){let e=t.target.style.background,i=e.slice(4,-1).split(","),n={r:parseInt(i[0]),g:parseInt(i[1]),b:parseInt(i[2])};switch(s.current_mode){case"hex":s.setColorByInput("#"+s.rgbToHex(n));break;case"rgb":let t=s.elem_wrap.getElementsByTagName("input");t[0].value=n.r,t[1].value=n.g,t[2].value=n.b,s.setColorByInput(e)}}},!1),""!=r&&this.setColorByInput(r)},render:function(){return`