'},_getCacheCanvasDimensions:function(){var t=this.callSuper("_getCacheCanvasDimensions"),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t},_render:function(t){this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")},_renderText:function(t){"stroke"===this.paintFirst?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))},_setTextStyles:function(t,e,i){t.textBaseline="alphabetic",t.font=this._getFontDeclaration(e,i)},calcTextWidth:function(){for(var t=this.getLineWidth(0),e=1,i=this._textLines.length;et&&(t=n)}return t},_renderTextLine:function(t,e,i,n,r,o){this._renderChars(t,e,i,n,r,o)},_renderTextLinesBackground:function(t){if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){for(var e,i,n,r,o,s,a=0,l=t.fillStyle,c=this._getLeftOffset(),h=this._getTopOffset(),u=0,f=0,d=0,p=this._textLines.length;d0&&!r){var f=this.__charBounds[e][i-1];u.left=f.left+f.width+l.kernedWidth-l.width}return u},getHeightOfLine:function(t){if(this.__lineHeights[t])return this.__lineHeights[t];for(var e=this._textLines[t],i=this.getHeightOfChar(t,0),n=1,r=e.length;n0?(t.fillStyle=v,c&&v&&t.fillRect(y+o+u,h+this.offsets[e]*n+s,f,this.fontSize/15),u=d.left,f=d.width,c=p,v=m,n=r,s=a):f+=d.kernedWidth;t.fillStyle=m,p&&m&&t.fillRect(y+o+u,h+this.offsets[e]*n+s,f-_,this.fontSize/15),b+=i}else b+=i;this._removeShadow(t)}},_getFontDeclaration:function(t,i){var n=t||this,r=this.fontFamily,o=e.Text.genericFonts.indexOf(r.toLowerCase())>-1,s=void 0===r||r.indexOf("'")>-1||r.indexOf(",")>-1||r.indexOf('"')>-1||o?n.fontFamily:'"'+n.fontFamily+'"';return[e.isLikelyNode?n.fontWeight:n.fontStyle,e.isLikelyNode?n.fontStyle:n.fontWeight,i?this.CACHE_FONT_SIZE+"px":n.fontSize+"px",s].join(" ")},render:function(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",t)))},_splitTextIntoLines:function(t){for(var i=t.split(this._reNewline),n=new Array(i.length),r=["\n"],o=[],s=0;s-1&&(t.underline=!0),t.textDecoration.indexOf("line-through")>-1&&(t.linethrough=!0),t.textDecoration.indexOf("overline")>-1&&(t.overline=!0),delete t.textDecoration)}fabric.IText=fabric.util.createClass(fabric.Text,fabric.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(t,e){this.callSuper("initialize",t,e),this.initBehavior()},setSelectionStart:function(t){t=Math.max(t,0),this._updateAndFire("selectionStart",t)},setSelectionEnd:function(t){t=Math.min(t,this.text.length),this._updateAndFire("selectionEnd",t)},_updateAndFire:function(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(t){this.clearContextTop(),this.callSuper("render",t),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(t){this.callSuper("_render",t)},clearContextTop:function(t){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var e=this.canvas.contextTop,i=this.canvas.viewportTransform;e.save(),e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this.transform(e),this._clearTextArea(e),t||e.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this._getCursorBoundaries(),e=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(t,e):this.renderSelection(t,e),e.restore()}},_clearTextArea:function(t){var e=this.width+4,i=this.height+4;t.clearRect(-e/2,-i/2,e,i)},_getCursorBoundaries:function(t){void 0===t&&(t=this.selectionStart);var e=this._getLeftOffset(),i=this._getTopOffset(),n=this._getCursorBoundariesOffsets(t);return{left:e,top:i,leftOffset:n.left,topOffset:n.top}},_getCursorBoundariesOffsets:function(t){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var e,i,n,r,o=0,s=0,a=this.get2DCursorLocation(t);n=a.charIndex,i=a.lineIndex;for(var l=0;l0?s:0)},this.cursorOffsetCache=r,this.cursorOffsetCache},renderCursor:function(t,e){var i=this.get2DCursorLocation(),n=i.lineIndex,r=i.charIndex>0?i.charIndex-1:0,o=this.getValueOfPropertyAt(n,r,"fontSize"),s=this.scaleX*this.canvas.getZoom(),a=this.cursorWidth/s,l=t.topOffset,c=this.getValueOfPropertyAt(n,r,"deltaY");l+=(1-this._fontSizeFraction)*this.getHeightOfLine(n)/this.lineHeight-o*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(t,e),e.fillStyle=this.cursorColor||this.getValueOfPropertyAt(n,r,"fill"),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+t.leftOffset-a/2,l+t.top+c,a,o)},renderSelection:function(t,e){for(var i=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,n=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,r=-1!==this.textAlign.indexOf("justify"),o=this.get2DCursorLocation(i),s=this.get2DCursorLocation(n),a=o.lineIndex,l=s.lineIndex,c=o.charIndex<0?0:o.charIndex,h=s.charIndex<0?0:s.charIndex,u=a;u<=l;u++){var f=this._getLineLeftOffset(u)||0,d=this.getHeightOfLine(u),p=0,g=0,m=0;if(u===a&&(g=this.__charBounds[a][c].left),u>=a&&u1)&&(d/=this.lineHeight),this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",e.fillRect(t.left+f+g,t.top+t.topOffset+d,m-g,1)):(e.fillStyle=this.selectionColor,e.fillRect(t.left+f+g,t.top+t.topOffset,m-g,d)),t.topOffset+=p}},getCurrentCharFontSize:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fontSize")},getCurrentCharColor:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fill")},_getCurrentCharIndex:function(){var t=this.get2DCursorLocation(this.selectionStart,!0),e=t.charIndex>0?t.charIndex-1:0;return{l:t.lineIndex,c:e}}}),fabric.IText.fromObject=function(e,i){if(t(e),e.styles)for(var n in e.styles)for(var r in e.styles[n])t(e.styles[n][r]);fabric.Object._fromObject("IText",e,i,"text")}}(),function(){var t=fabric.util.object.clone;fabric.util.object.extend(fabric.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var t=this;this.on("added",function(){var e=t.canvas;e&&(e._hasITextHandlers||(e._hasITextHandlers=!0,t._initCanvasHandlers(e)),e._iTextInstances=e._iTextInstances||[],e._iTextInstances.push(t))})},initRemovedHandler:function(){var t=this;this.on("removed",function(){var e=t.canvas;e&&(e._iTextInstances=e._iTextInstances||[],fabric.util.removeFromArray(e._iTextInstances,t),0===e._iTextInstances.length&&(e._hasITextHandlers=!1,t._removeCanvasHandlers(e)))})},_initCanvasHandlers:function(t){t._mouseUpITextHandler=function(){t._iTextInstances&&t._iTextInstances.forEach(function(t){t.__isMousedown=!1})},t.on("mouse:up",t._mouseUpITextHandler)},_removeCanvasHandlers:function(t){t.off("mouse:up",t._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(t,e,i,n){var r;return r={isAborted:!1,abort:function(){this.isAborted=!0}},t.animate("_currentCursorOpacity",e,{duration:i,onComplete:function(){r.isAborted||t[n]()},onChange:function(){t.canvas&&t.selectionStart===t.selectionEnd&&t.renderCursorOrSelection()},abort:function(){return r.isAborted}}),r},_onTickComplete:function(){var t=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){t._currentTickCompleteState=t._animateCursor(t,0,this.cursorDuration/2,"_tick")},100)},initDelayedCursor:function(t){var e=this,i=t?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout(function(){e._tick()},i)},abortCursorAnimation:function(){var t=this._currentTickState||this._currentTickCompleteState,e=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,t&&e&&e.clearContext(e.contextTop||e.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(t){var e=0,i=t-1;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i--;for(;/\S/.test(this._text[i])&&i>-1;)e++,i--;return t-e},findWordBoundaryRight:function(t){var e=0,i=t;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i++;for(;/\S/.test(this._text[i])&&i-1;)e++,i--;return t-e},findLineBoundaryRight:function(t){for(var e=0,i=t;!/\n/.test(this._text[i])&&i0&&nthis.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=e):(this.selectionStart=e,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===i&&this.selectionEnd===n||(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(t,e,i){var n=i.slice(0,t),r=fabric.util.string.graphemeSplit(n).length;if(t===e)return{selectionStart:r,selectionEnd:r};var o=i.slice(t,e);return{selectionStart:r,selectionEnd:r+fabric.util.string.graphemeSplit(o).length}},fromGraphemeToStringSelection:function(t,e,i){var n=i.slice(0,t).join("").length;if(t===e)return{selectionStart:n,selectionEnd:n};return{selectionStart:n,selectionEnd:n+i.slice(t,e).join("").length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var t=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=t.selectionEnd,this.inCompositionMode||(this.selectionStart=t.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),i=this.get2DCursorLocation(t),n=i.lineIndex,r=i.charIndex,o=this.getValueOfPropertyAt(n,r,"fontSize")*this.lineHeight,s=e.leftOffset,a=this.calcTransformMatrix(),l={x:e.left+s,y:e.top+e.topOffset+o},c=this.canvas.getRetinaScaling(),h=this.canvas.upperCanvasEl,u=h.width/c,f=h.height/c,d=u-o,p=f-o,g=h.clientWidth/u,m=h.clientHeight/f;return l=fabric.util.transformPoint(l,a),l=fabric.util.transformPoint(l,this.canvas.viewportTransform),l.x*=g,l.y*=m,l.x<0&&(l.x=0),l.x>d&&(l.x=d),l.y<0&&(l.y=0),l.y>p&&(l.y=p),l.x+=this.canvas._offset.left,l.y+=this.canvas._offset.top,{left:l.x+"px",top:l.y+"px",fontSize:o+"px",charHeight:o}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var t=this._textBeforeEdit!==this.text,e=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,e&&(e.blur&&e.blur(),e.parentNode&&e.parentNode.removeChild(e)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),t&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var t in this.styles)this._textLines[t]||delete this.styles[t]},removeStyleFromTo:function(t,e){var i,n,r=this.get2DCursorLocation(t,!0),o=this.get2DCursorLocation(e,!0),s=r.lineIndex,a=r.charIndex,l=o.lineIndex,c=o.charIndex;if(s!==l){if(this.styles[s])for(i=a;i=c&&(n[h-f]=n[u],delete n[u])}},shiftLineStyles:function(e,i){var n=t(this.styles);for(var r in this.styles){var o=parseInt(r,10);o>e&&(this.styles[o+i]=n[o],n[o-i]||delete this.styles[o])}},restartCursorIfNeeded:function(){this._currentTickState&&!this._currentTickState.isAborted&&this._currentTickCompleteState&&!this._currentTickCompleteState.isAborted||this.initDelayedCursor()},insertNewlineStyleObject:function(e,i,n,r){var o,s={},a=!1,l=this._unwrappedTextLines[e].length===i;n||(n=1),this.shiftLineStyles(e,n),this.styles[e]&&(o=this.styles[e][0===i?i:i-1]);for(var c in this.styles[e]){var h=parseInt(c,10);h>=i&&(a=!0,s[h-i]=this.styles[e][c],l&&0===i||delete this.styles[e][c])}var u=!1;for(a&&!l&&(this.styles[e+n]=s,u=!0),u&&n--;n>0;)r&&r[n-1]?this.styles[e+n]={0:t(r[n-1])}:o?this.styles[e+n]={0:t(o)}:delete this.styles[e+n],n--;this._forceClearCache=!0},insertCharStyleObject:function(e,i,n,r){this.styles||(this.styles={});var o=this.styles[e],s=o?t(o):{};n||(n=1);for(var a in s){var l=parseInt(a,10);l>=i&&(o[l+n]=s[l],s[l-n]||delete o[l])}if(this._forceClearCache=!0,r)for(;n--;)Object.keys(r[n]).length&&(this.styles[e]||(this.styles[e]={}),this.styles[e][i+n]=t(r[n]));else if(o)for(var c=o[i?i-1:1];c&&n--;)this.styles[e][i+n]=t(c)},insertNewStyleBlock:function(t,e,i){for(var n=this.get2DCursorLocation(e,!0),r=[0],o=0,s=0;s0&&(this.insertCharStyleObject(n.lineIndex,n.charIndex,r[0],i),i=i&&i.slice(r[0]+1)),o&&this.insertNewlineStyleObject(n.lineIndex,n.charIndex+r[0],o);for(s=1;s0?this.insertCharStyleObject(n.lineIndex+s,0,r[s],i):i&&(this.styles[n.lineIndex+s][0]=i[0]),i=i&&i.slice(r[s]+1);r[s]>0&&this.insertCharStyleObject(n.lineIndex+s,0,r[s],i)},setSelectionStartEndWithShift:function(t,e,i){i<=t?(e===t?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=t),this.selectionStart=i):i>t&&it?this.selectionStart=t:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>t?this.selectionEnd=t:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),fabric.util.object.extend(fabric.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(t){if(this.canvas){this.__newClickTime=+new Date;var e=t.pointer;this.isTripleClick(e)&&(this.fire("tripleclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(t){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(t.e))},tripleClickHandler:function(t){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(t.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(t.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(t){if(this.__isMousedown=!1,!(!this.editable||this.group||t.transform&&t.transform.actionPerformed||t.e.button&&1!==t.e.button)){if(this.canvas){var e=this.canvas._activeObject;if(e&&e!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(t.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t),i=this.selectionStart,n=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(i,n,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(t){for(var e,i=this.getLocalPointer(t),n=0,r=0,o=0,s=0,a=0,l=0,c=this._textLines.length;l0&&(s+=this._textLines[l-1].length+this.missingNewlineOffset(l-1));r=this._getLineLeftOffset(a)*this.scaleX;for(var h=0,u=(e=this._textLines[a]).length;ho||s<0?0:1);return this.flipX&&(a=r-a),a>this._text.length&&(a=this._text.length),a}}),fabric.util.object.extend(fabric.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=fabric.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var t=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+t.top+"; left: "+t.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; paddingーtop: "+t.fontSize+";",fabric.document.body.appendChild(this.hiddenTextarea),fabric.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),fabric.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),fabric.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),fabric.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),fabric.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),fabric.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),fabric.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),fabric.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),fabric.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(fabric.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(t){if(this.isEditing){if(t.keyCode in this.keysMap)this[this.keysMap[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown&&(t.ctrlKey||t.metaKey)))return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),t.keyCode>=33&&t.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(t){var e=this.fromPaste;if(this.fromPaste=!1,t&&t.stopPropagation(),this.isEditing){var i,n,r,o,s,a=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,l=this._text.length,c=a.length,h=c-l,u=this.selectionStart,f=this.selectionEnd,d=u!==f;if(""===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire("changed"),void(this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll()));var p=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),g=u>p.selectionStart;d?(i=this._text.slice(u,f),h+=f-u):c0&&(n+=(i=this.__charBounds[t][e-1]).left+i.width),n},getDownCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),n=this.get2DCursorLocation(i),r=n.lineIndex;if(r===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-i;var o=n.charIndex,s=this._getWidthBeforeCursor(r,o),a=this._getIndexOnLine(r+1,s);return this._textLines[r].slice(o).length+a+1+this.missingNewlineOffset(r)},_getSelectionForOffset:function(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),n=this.get2DCursorLocation(i),r=n.lineIndex;if(0===r||t.metaKey||33===t.keyCode)return-i;var o=n.charIndex,s=this._getWidthBeforeCursor(r,o),a=this._getIndexOnLine(r-1,s),l=this._textLines[r].slice(0,o),c=this.missingNewlineOffset(r-1);return-this._textLines[r-1].length+a-l.length+(1-c)},_getIndexOnLine:function(t,e){for(var i,n,r=this._textLines[t],o=this._getLineLeftOffset(t),s=0,a=0,l=r.length;ae){n=!0;var c=o-i,h=o,u=Math.abs(c-e);s=Math.abs(h-e)=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",t)},moveCursorUp:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",t)},_moveCursorUpOrDown:function(t,e){var i=this["get"+t+"CursorOffset"](e,"right"===this._selectionDirection);e.shiftKey?this.moveCursorWithShift(i):this.moveCursorWithoutShift(i),0!==i&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(t){var e="left"===this._selectionDirection?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t},moveCursorWithoutShift:function(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t},moveCursorLeft:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",t)},_move:function(t,e,i){var n;if(t.altKey)n=this["findWordBoundary"+i](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+="Left"===i?-1:1,!0;n=this["findLineBoundary"+i](this[e])}if(void 0!==typeof n&&this[e]!==n)return this[e]=n,!0},_moveLeft:function(t,e){return this._move(t,e,"Left")},_moveRight:function(t,e){return this._move(t,e,"Right")},moveCursorLeftWithoutShift:function(t){var e=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,"selectionStart")),this.selectionEnd=this.selectionStart,e},moveCursorLeftWithShift:function(t){return"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection="left",this._moveLeft(t,"selectionStart")):void 0},moveCursorRight:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",t)},_moveCursorLeftOrRight:function(t,e){var i="moveCursor"+t+"With";this._currentCursorOpacity=1,e.shiftKey?i+="Shift":i+="outShift",this[i](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(t){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(t,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(t){var e=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(e=this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e},removeChars:function(t,e){void 0===e&&(e=t+1),this.removeStyleFromTo(t,e),this._text.splice(t,e-t),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(t,e,i,n){void 0===n&&(n=i),n>i&&this.removeStyleFromTo(i,n);var r=fabric.util.string.graphemeSplit(t);this.insertNewStyleBlock(r,i,e),this._text=[].concat(this._text.slice(0,i),r,this._text.slice(n)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var t=fabric.util.toFixed,e=/ +/g;fabric.util.object.extend(fabric.Text.prototype,{_toSVG:function(){var t=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(e)},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(t){var e=this.getSvgTextDecoration(this);return[t.textBgRects.join(""),'\t\t",t.textSpans.join(""),"\n"]},_getSVGTextAndBg:function(t,e){var i,n=[],r=[],o=t;this._setSVGBg(r);for(var s=0,a=this._textLines.length;s",fabric.util.string.escapeXml(i),""].join("")},_setSVGTextLineText:function(t,e,i,n){var r,o,s,a,l,c=this.getHeightOfLine(e),h=-1!==this.textAlign.indexOf("justify"),u="",f=0,d=this._textLines[e];n+=c*(1-this._fontSizeFraction)/this.lineHeight;for(var p=0,g=d.length-1;p<=g;p++)l=p===g||this.charSpacing,u+=d[p],s=this.__charBounds[e][p],0===f?(i+=s.kernedWidth-s.width,f+=s.width):f+=s.kernedWidth,h&&!l&&this._reSpaceAndTab.test(d[p])&&(l=!0),l||(r=r||this.getCompleteStyleDeclaration(e,p),o=this.getCompleteStyleDeclaration(e,p+1),l=this._hasStyleChangedForSvg(r,o)),l&&(a=this._getStyleDeclaration(e,p)||{},t.push(this._createTextCharSpan(u,a,i,n)),u="",r=o,i+=f,f=0)},_pushTextBgRect:function(e,i,n,r,o,s){var a=fabric.Object.NUM_FRACTION_DIGITS;e.push("\t\t\n')},_setSVGTextLineBg:function(t,e,i,n){for(var r,o,s=this._textLines[e],a=this.getHeightOfLine(e)/this.lineHeight,l=0,c=0,h=this.getValueOfPropertyAt(e,0,"textBackgroundColor"),u=0,f=s.length;uthis.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(t){for(var e=0,i=0,n=0,r={},o=0;o0?(i=0,n++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[n])&&o>0&&(i++,n++),r[o]={line:e,offset:i},n+=t.graphemeLines[o].length,i+=t.graphemeLines[o].length;return r},styleHas:function(t,i){if(this._styleMap&&!this.isWrapping){var n=this._styleMap[i];n&&(i=n.line)}return e.Text.prototype.styleHas.call(this,t,i)},isEmptyStyles:function(t){if(!this.styles)return!0;var e,i,n=0,r=!1,o=this._styleMap[t],s=this._styleMap[t+1];o&&(t=o.line,n=o.offset),s&&(r=s.line===t,e=s.offset),i=void 0===t?this.styles:{line:this.styles[t]};for(var a in i)for(var l in i[a])if(l>=n&&(!r||l=n&&!m?(a.push(l),l=[],o=d,m=!0):o+=v,m||s||l.push(f),l=l.concat(h),p=s?0:this._measureWord([f],i,u),u++,m=!1,d>g&&(g=d);return y&&a.push(l),g+r>this.dynamicMinWidth&&(this.dynamicMinWidth=g-v+r),a},isEndOfWrapping:function(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line},missingNewlineOffset:function(t){return this.splitByGrapheme?this.isEndOfWrapping(t)?1:0:1},_splitTextIntoLines:function(t){for(var i=e.Text.prototype._splitTextIntoLines.call(this,t),n=this._wrapText(i.lines,this.width),r=new Array(n.length),o=0;o1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.colorpicker=e,this.options=i,!this.colorpicker.element||!this.colorpicker.element.length)throw new Error("Extension: this.colorpicker.element is not valid");this.colorpicker.element.on("colorpickerCreate.colorpicker-ext",r.default.proxy(this.onCreate,this)),this.colorpicker.element.on("colorpickerDestroy.colorpicker-ext",r.default.proxy(this.onDestroy,this)),this.colorpicker.element.on("colorpickerUpdate.colorpicker-ext",r.default.proxy(this.onUpdate,this)),this.colorpicker.element.on("colorpickerChange.colorpicker-ext",r.default.proxy(this.onChange,this)),this.colorpicker.element.on("colorpickerInvalid.colorpicker-ext",r.default.proxy(this.onInvalid,this)),this.colorpicker.element.on("colorpickerShow.colorpicker-ext",r.default.proxy(this.onShow,this)),this.colorpicker.element.on("colorpickerHide.colorpicker-ext",r.default.proxy(this.onHide,this)),this.colorpicker.element.on("colorpickerEnable.colorpicker-ext",r.default.proxy(this.onEnable,this)),this.colorpicker.element.on("colorpickerDisable.colorpicker-ext",r.default.proxy(this.onDisable,this))}return n(t,[{key:"resolveColor",value:function(t){!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!1}},{key:"onCreate",value:function(t){}},{key:"onDestroy",value:function(t){this.colorpicker.element.off(".colorpicker-ext")}},{key:"onUpdate",value:function(t){}},{key:"onChange",value:function(t){}},{key:"onInvalid",value:function(t){}},{key:"onHide",value:function(t){}},{key:"onShow",value:function(t){}},{key:"onDisable",value:function(t){}},{key:"onEnable",value:function(t){}}]),t}();e.default=o,t.exports=e.default},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.ColorItem=e.HSVAColor=void 0;var r=function(){function t(t,e){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n(this,t),this.replace(e,i)}return r(t,[{key:"api",value:function(e){for(var i=arguments.length,n=Array(i>1?i-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:null;if(i=t.sanitizeFormat(i),this._original={color:e,format:i,valid:!0},this._color=t.parse(e),null===this._color)return this._color=(0,o.default)(),void(this._original.valid=!1);this._format=i||(t.isHex(e)?"hex":this._color.model)}},{key:"isValid",value:function(){return!0===this._original.valid}},{key:"setHueRatio",value:function(t){this.hue=360*(1-t)}},{key:"setSaturationRatio",value:function(t){this.saturation=100*t}},{key:"setValueRatio",value:function(t){this.value=100*(1-t)}},{key:"setAlphaRatio",value:function(t){this.alpha=1-t}},{key:"isDesaturated",value:function(){return 0===this.saturation}},{key:"isTransparent",value:function(){return 0===this.alpha}},{key:"hasTransparency",value:function(){return this.hasAlpha()&&this.alpha<1}},{key:"hasAlpha",value:function(){return!isNaN(this.alpha)}},{key:"toObject",value:function(){return new s(this.hue,this.saturation,this.value,this.alpha)}},{key:"toHsva",value:function(){return this.toObject()}},{key:"toHsvaRatio",value:function(){return new s(this.hue/360,this.saturation/100,this.value/100,this.alpha)}},{key:"toString",value:function(){return this.string()}},{key:"string",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!(e=t.sanitizeFormat(e||this.format)))return this._color.round().string();if(void 0===this._color[e])throw new Error("Unsupported color format: '"+e+"'");var i=this._color[e]();return i.round?i.round().string():i}},{key:"equals",value:function(e){return!(!(e=e instanceof t?e:new t(e)).isValid()||!this.isValid())&&this.hue===e.hue&&this.saturation===e.saturation&&this.value===e.value&&this.alpha===e.alpha}},{key:"getClone",value:function(){return new t(this._color,this.format)}},{key:"getCloneHueOnly",value:function(){return new t([this.hue,100,100,1],this.format)}},{key:"getCloneOpaque",value:function(){return new t(this._color.alpha(1),this.format)}},{key:"toRgbString",value:function(){return this.string("rgb")}},{key:"toHexString",value:function(){return this.string("hex")}},{key:"toHslString",value:function(){return this.string("hsl")}},{key:"isDark",value:function(){return this._color.isDark()}},{key:"isLight",value:function(){return this._color.isLight()}},{key:"generate",value:function(e){var i=[];if(Array.isArray(e))i=e;else{if(!t.colorFormulas.hasOwnProperty(e))throw new Error("No color formula found with the name '"+e+"'.");i=t.colorFormulas[e]}var n=[],r=this._color,o=this.format;return i.forEach(function(e){var i=[e?(r.hue()+e)%360:r.hue(),r.saturationv(),r.value(),r.alpha()];n.push(new t(i,o))}),n}},{key:"hue",get:function(){return this._color.hue()},set:function(t){this._color=this._color.hue(t)}},{key:"saturation",get:function(){return this._color.saturationv()},set:function(t){this._color=this._color.saturationv(t)}},{key:"value",get:function(){return this._color.value()},set:function(t){this._color=this._color.value(t)}},{key:"alpha",get:function(){var t=this._color.alpha();return isNaN(t)?1:t},set:function(t){this._color=this._color.alpha(Math.round(100*t)/100)}},{key:"format",get:function(){return this._format?this._format:this._color.model},set:function(e){this._format=t.sanitizeFormat(e)}}],[{key:"parse",value:function(e){if(e instanceof o.default)return e;if(e instanceof t)return e._color;var i=null;if(null===(e=e instanceof s?[e.h,e.s,e.v,isNaN(e.a)?1:e.a]:t.sanitizeString(e)))return null;Array.isArray(e)&&(i="hsv");try{return(0,o.default)(e,i)}catch(t){return null}}},{key:"sanitizeString",value:function(t){return"string"==typeof t||t instanceof String?t.match(/^[0-9a-f]{2,}$/i)?"#"+t:"transparent"===t.toLowerCase()?"#FFFFFF00":t:t}},{key:"isHex",value:function(t){return("string"==typeof t||t instanceof String)&&!!t.match(/^#?[0-9a-f]{2,}$/i)}},{key:"sanitizeFormat",value:function(t){switch(t){case"hex":case"hex3":case"hex4":case"hex6":case"hex8":return"hex";case"rgb":case"rgba":case"keyword":case"name":return"rgb";case"hsl":case"hsla":case"hsv":case"hsva":case"hwb":case"hwba":return"hsl";default:return""}}}]),t}();a.colorFormulas={complementary:[180],triad:[0,120,240],tetrad:[0,90,180,270],splitcomplement:[0,72,216]},e.default=a,e.HSVAColor=s,e.ColorItem=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={bar_size_short:16,base_margin:6,columns:6},r=n.bar_size_short*n.columns+n.base_margin*(n.columns-1);e.default={customClass:null,color:!1,fallbackColor:!1,format:"auto",horizontal:!1,inline:!1,container:"true",popover:{animation:!0,placement:"top",fallbackPlacement:"flip"},debug:!1,input:"input",addon:".colorpicker-input-addon",autoInputFallback:!0,useHashPrefix:!0,useAlpha:!0,template:'',extensions:[{name:"preview",options:{showText:!0}}],sliders:{saturation:{selector:".colorpicker-saturation",maxLeft:r,maxTop:r,callLeft:"setSaturationRatio",callTop:"setValueRatio"},hue:{selector:".colorpicker-hue",maxLeft:0,maxTop:r,callLeft:!1,callTop:"setHueRatio"},alpha:{selector:".colorpicker-alpha",childSelector:".colorpicker-alpha-color",maxLeft:0,maxTop:r,callLeft:!1,callTop:"setAlphaRatio"}},slidersHorz:{saturation:{selector:".colorpicker-saturation",maxLeft:r,maxTop:r,callLeft:"setSaturationRatio",callTop:"setValueRatio"},hue:{selector:".colorpicker-hue",maxLeft:r,maxTop:0,callLeft:"setHueRatio",callTop:!1},alpha:{selector:".colorpicker-alpha",childSelector:".colorpicker-alpha-color",maxLeft:r,maxTop:0,callLeft:"setAlphaRatio",callTop:!1}}},t.exports=e.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,a.default.extend(!0,{},l,i)));return Array.isArray(n.options.colors)||"object"===r(n.options.colors)||(n.options.colors=null),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,s.default),o(e,[{key:"colors",get:function(){return this.options.colors}}]),o(e,[{key:"getLength",value:function(){return this.options.colors?Array.isArray(this.options.colors)?this.options.colors.length:"object"===r(this.options.colors)?Object.keys(this.options.colors).length:0:0}},{key:"resolveColor",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!(this.getLength()<=0)&&(Array.isArray(this.options.colors)?this.options.colors.indexOf(t)>=0?t:this.options.colors.indexOf(t.toUpperCase())>=0?t.toUpperCase():this.options.colors.indexOf(t.toLowerCase())>=0&&t.toLowerCase():"object"===r(this.options.colors)&&(!this.options.namesAsValues||e?this.getValue(t,!1):this.getName(t,this.getName("#"+t))))}},{key:"getName",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("string"!=typeof t||!this.options.colors)return e;for(var i in this.options.colors)if(this.options.colors.hasOwnProperty(i)&&this.options.colors[i].toLowerCase()===t.toLowerCase())return i;return e}},{key:"getValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"string"==typeof t&&this.options.colors&&this.options.colors.hasOwnProperty(t)?this.options.colors[t]:e}}]),e}();e.default=c,t.exports=e.default},function(t,e,i){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(t,e,i){function n(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}var r=i(5),o={};for(var s in r)r.hasOwnProperty(s)&&(o[r[s]]=s);var a=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var l in a)if(a.hasOwnProperty(l)){if(!("channels"in a[l]))throw new Error("missing channels property: "+l);if(!("labels"in a[l]))throw new Error("missing channel labels property: "+l);if(a[l].labels.length!==a[l].channels)throw new Error("channel and label counts mismatch: "+l);var c=a[l].channels,h=a[l].labels;delete a[l].channels,delete a[l].labels,Object.defineProperty(a[l],"channels",{value:c}),Object.defineProperty(a[l],"labels",{value:h})}a.rgb.hsl=function(t){var e,i,n,r=t[0]/255,o=t[1]/255,s=t[2]/255,a=Math.min(r,o,s),l=Math.max(r,o,s),c=l-a;return l===a?e=0:r===l?e=(o-s)/c:o===l?e=2+(s-r)/c:s===l&&(e=4+(r-o)/c),(e=Math.min(60*e,360))<0&&(e+=360),n=(a+l)/2,i=l===a?0:n<=.5?c/(l+a):c/(2-l-a),[e,100*i,100*n]},a.rgb.hsv=function(t){var e,i,n,r,o,s=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(s,a,l),h=c-Math.min(s,a,l),u=function(t){return(c-t)/6/h+.5};return 0===h?r=o=0:(o=h/c,e=u(s),i=u(a),n=u(l),s===c?r=n-i:a===c?r=1/3+e-n:l===c&&(r=2/3+i-e),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},a.rgb.hwb=function(t){var e=t[0],i=t[1],n=t[2],r=a.rgb.hsl(t)[0],o=1/255*Math.min(e,Math.min(i,n));return n=1-1/255*Math.max(e,Math.max(i,n)),[r,100*o,100*n]},a.rgb.cmyk=function(t){var e,i,n,r,o=t[0]/255,s=t[1]/255,a=t[2]/255;return r=Math.min(1-o,1-s,1-a),e=(1-o-r)/(1-r)||0,i=(1-s-r)/(1-r)||0,n=(1-a-r)/(1-r)||0,[100*e,100*i,100*n,100*r]},a.rgb.keyword=function(t){var e=o[t];if(e)return e;var i,s=1/0;for(var a in r)if(r.hasOwnProperty(a)){var l=n(t,r[a]);l.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*i+.0722*n),100*(.0193*e+.1192*i+.9505*n)]},a.rgb.lab=function(t){var e,i,n,r=a.rgb.xyz(t),o=r[0],s=r[1],l=r[2];return o/=95.047,s/=100,l/=108.883,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,e=116*s-16,i=500*(o-s),n=200*(s-l),[e,i,n]},a.hsl.rgb=function(t){var e,i,n,r,o,s=t[0]/360,a=t[1]/100,l=t[2]/100;if(0===a)return o=255*l,[o,o,o];e=2*l-(i=l<.5?l*(1+a):l+a-l*a),r=[0,0,0];for(var c=0;c<3;c++)(n=s+1/3*-(c-1))<0&&n++,n>1&&n--,o=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,r[c]=255*o;return r},a.hsl.hsv=function(t){var e,i,n=t[0],r=t[1]/100,o=t[2]/100,s=r,a=Math.max(o,.01);return o*=2,r*=o<=1?o:2-o,s*=a<=1?a:2-a,i=(o+r)/2,e=0===o?2*s/(a+s):2*r/(o+r),[n,100*e,100*i]},a.hsv.rgb=function(t){var e=t[0]/60,i=t[1]/100,n=t[2]/100,r=Math.floor(e)%6,o=e-Math.floor(e),s=255*n*(1-i),a=255*n*(1-i*o),l=255*n*(1-i*(1-o));switch(n*=255,r){case 0:return[n,l,s];case 1:return[a,n,s];case 2:return[s,n,l];case 3:return[s,a,n];case 4:return[l,s,n];case 5:return[n,s,a]}},a.hsv.hsl=function(t){var e,i,n,r=t[0],o=t[1]/100,s=t[2]/100,a=Math.max(s,.01);return n=(2-o)*s,e=(2-o)*a,i=o*a,i/=e<=1?e:2-e,i=i||0,n/=2,[r,100*i,100*n]},a.hwb.rgb=function(t){var e,i,n,r,o=t[0]/360,s=t[1]/100,a=t[2]/100,l=s+a;l>1&&(s/=l,a/=l),i=1-a,n=6*o-(e=Math.floor(6*o)),0!=(1&e)&&(n=1-n),r=s+n*(i-s);var c,h,u;switch(e){default:case 6:case 0:c=i,h=r,u=s;break;case 1:c=r,h=i,u=s;break;case 2:c=s,h=i,u=r;break;case 3:c=s,h=r,u=i;break;case 4:c=r,h=s,u=i;break;case 5:c=i,h=s,u=r}return[255*c,255*h,255*u]},a.cmyk.rgb=function(t){var e,i,n,r=t[0]/100,o=t[1]/100,s=t[2]/100,a=t[3]/100;return e=1-Math.min(1,r*(1-a)+a),i=1-Math.min(1,o*(1-a)+a),n=1-Math.min(1,s*(1-a)+a),[255*e,255*i,255*n]},a.xyz.rgb=function(t){var e,i,n,r=t[0]/100,o=t[1]/100,s=t[2]/100;return e=3.2406*r+-1.5372*o+-.4986*s,i=-.9689*r+1.8758*o+.0415*s,n=.0557*r+-.204*o+1.057*s,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,e=Math.min(Math.max(0,e),1),i=Math.min(Math.max(0,i),1),n=Math.min(Math.max(0,n),1),[255*e,255*i,255*n]},a.xyz.lab=function(t){var e,i,n,r=t[0],o=t[1],s=t[2];return r/=95.047,o/=100,s/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,e=116*o-16,i=500*(r-o),n=200*(o-s),[e,i,n]},a.lab.xyz=function(t){var e,i,n,r=t[0];e=t[1]/500+(i=(r+16)/116),n=i-t[2]/200;var o=Math.pow(i,3),s=Math.pow(e,3),a=Math.pow(n,3);return i=o>.008856?o:(i-16/116)/7.787,e=s>.008856?s:(e-16/116)/7.787,n=a>.008856?a:(n-16/116)/7.787,e*=95.047,i*=100,n*=108.883,[e,i,n]},a.lab.lch=function(t){var e,i,n,r=t[0],o=t[1],s=t[2];return e=Math.atan2(s,o),(i=360*e/2/Math.PI)<0&&(i+=360),n=Math.sqrt(o*o+s*s),[r,n,i]},a.lch.lab=function(t){var e,i,n,r=t[0],o=t[1];return n=t[2]/360*2*Math.PI,e=o*Math.cos(n),i=o*Math.sin(n),[r,e,i]},a.rgb.ansi16=function(t){var e=t[0],i=t[1],n=t[2],r=1 in arguments?arguments[1]:a.rgb.hsv(t)[2];if(0===(r=Math.round(r/50)))return 30;var o=30+(Math.round(n/255)<<2|Math.round(i/255)<<1|Math.round(e/255));return 2===r&&(o+=60),o},a.hsv.ansi16=function(t){return a.rgb.ansi16(a.hsv.rgb(t),t[2])},a.rgb.ansi256=function(t){var e=t[0],i=t[1],n=t[2];if(e===i&&i===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)},a.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var i=.5*(1+~~(t>50));return[(1&e)*i*255,(e>>1&1)*i*255,(e>>2&1)*i*255]},a.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}t-=16;var i;return[Math.floor(t/36)/5*255,Math.floor((i=t%36)/6)/5*255,i%6/5*255]},a.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},a.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var i=e[0];3===e[0].length&&(i=i.split("").map(function(t){return t+t}).join(""));var n=parseInt(i,16);return[n>>16&255,n>>8&255,255&n]},a.rgb.hcg=function(t){var e,i,n=t[0]/255,r=t[1]/255,o=t[2]/255,s=Math.max(Math.max(n,r),o),a=Math.min(Math.min(n,r),o),l=s-a;return e=l<1?a/(1-l):0,i=l<=0?0:s===n?(r-o)/l%6:s===r?2+(o-n)/l:4+(n-r)/l+4,i/=6,i%=1,[360*i,100*l,100*e]},a.hsl.hcg=function(t){var e=t[1]/100,i=t[2]/100,n=1,r=0;return(n=i<.5?2*e*i:2*e*(1-i))<1&&(r=(i-.5*n)/(1-n)),[t[0],100*n,100*r]},a.hsv.hcg=function(t){var e=t[1]/100,i=t[2]/100,n=e*i,r=0;return n<1&&(r=(i-n)/(1-n)),[t[0],100*n,100*r]},a.hcg.rgb=function(t){var e=t[0]/360,i=t[1]/100,n=t[2]/100;if(0===i)return[255*n,255*n,255*n];var r=[0,0,0],o=e%1*6,s=o%1,a=1-s,l=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return l=(1-i)*n,[255*(i*r[0]+l),255*(i*r[1]+l),255*(i*r[2]+l)]},a.hcg.hsv=function(t){var e=t[1]/100,i=e+t[2]/100*(1-e),n=0;return i>0&&(n=e/i),[t[0],100*n,100*i]},a.hcg.hsl=function(t){var e=t[1]/100,i=t[2]/100*(1-e)+.5*e,n=0;return i>0&&i<.5?n=e/(2*i):i>=.5&&i<1&&(n=e/(2*(1-i))),[t[0],100*n,100*i]},a.hcg.hwb=function(t){var e=t[1]/100,i=e+t[2]/100*(1-e);return[t[0],100*(i-e),100*(1-i)]},a.hwb.hcg=function(t){var e=t[1]/100,i=1-t[2]/100,n=i-e,r=0;return n<1&&(r=(i-n)/(1-n)),[t[0],100*n,100*r]},a.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},a.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},a.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},a.gray.hsl=a.gray.hsv=function(t){return[0,0,t[0]]},a.gray.hwb=function(t){return[0,100,t[0]]},a.gray.cmyk=function(t){return[0,0,0,t[0]]},a.gray.lab=function(t){return[t[0],0,0]},a.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i},a.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n(i(8)),s=n(i(0)),a="colorpicker";s.default[a]=o.default,s.default.fn[a]=function(t){var e=Array.prototype.slice.call(arguments,1),i=1===this.length,n=null,l=this.each(function(){var l=(0,s.default)(this),c=l.data(a),h="object"===(void 0===t?"undefined":r(t))?t:{};c||(c=new o.default(this,h),l.data(a,c)),i&&(n=l,"string"==typeof t&&(n="colorpicker"===t?c:s.default.isFunction(c[t])?c[t].apply(c,e):c[t]))});return i?n:l},s.default.fn[a].constructor=o.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{});return this.extensions.push(e),e}},{key:"destroy",value:function(){var t=this.color;this.sliderHandler.unbind(),this.inputHandler.unbind(),this.popupHandler.unbind(),this.colorHandler.unbind(),this.addonHandler.unbind(),this.pickerHandler.unbind(),this.element.removeClass("colorpicker-element").removeData("colorpicker","color").off(".colorpicker"),this.trigger("colorpickerDestroy",t)}},{key:"show",value:function(t){this.popupHandler.show(t)}},{key:"hide",value:function(t){this.popupHandler.hide(t)}},{key:"toggle",value:function(t){this.popupHandler.toggle(t)}},{key:"getValue",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.colorHandler.color;return(e=e instanceof g.default?e:t)instanceof g.default?e.string(this.format):e}},{key:"setValue",value:function(t){if(!this.isDisabled()){var e=this.colorHandler;e.hasColor()&&t&&e.color.equals(t)||!e.hasColor()&&!t||(e.color=t?e.createColor(t,this.options.autoInputFallback):null,this.trigger("colorpickerChange",e.color,t),this.update())}}},{key:"update",value:function(){this.colorHandler.hasColor()?this.inputHandler.update():this.colorHandler.assureColor(),this.addonHandler.update(),this.pickerHandler.update(),this.trigger("colorpickerUpdate")}},{key:"enable",value:function(){return this.inputHandler.enable(),this.disabled=!1,this.picker.removeClass("colorpicker-disabled"),this.trigger("colorpickerEnable"),!0}},{key:"disable",value:function(){return this.inputHandler.disable(),this.disabled=!0,this.picker.addClass("colorpicker-disabled"),this.trigger("colorpickerDisable"),!0}},{key:"isEnabled",value:function(){return!this.isDisabled()}},{key:"isDisabled",value:function(){return!0===this.disabled}},{key:"trigger",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.element.trigger({type:t,colorpicker:this,color:e||this.color,value:i||this.getValue()})}}]),t}();y.extensions=a.default,e.default=y,t.exports=e.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.Palette=e.Swatches=e.Preview=e.Debugger=void 0;var r=n(i(10)),o=n(i(11)),s=n(i(12)),a=n(i(4));e.Debugger=r.default,e.Preview=o.default,e.Swatches=s.default,e.Palette=a.default,e.default={debugger:r.default,preview:o.default,swatches:s.default,palette:a.default}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));return n.eventCounter=0,n.colorpicker.inputHandler.hasInput()&&n.colorpicker.inputHandler.input.on("change.colorpicker-ext",a.default.proxy(n.onChangeInput,n)),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,s.default),r(e,[{key:"log",value:function(t){for(var e,i=arguments.length,n=Array(i>1?i-1:0),r=1;r1&&void 0!==arguments[1])||arguments[1];return this.log("resolveColor()",t,e),!1}},{key:"onCreate",value:function(t){return this.log("colorpickerCreate"),o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"onCreate",this).call(this,t)}},{key:"onDestroy",value:function(t){return this.log("colorpickerDestroy"),this.eventCounter=0,this.colorpicker.inputHandler.hasInput()&&this.colorpicker.inputHandler.input.off(".colorpicker-ext"),o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"onDestroy",this).call(this,t)}},{key:"onUpdate",value:function(t){this.log("colorpickerUpdate")}},{key:"onChangeInput",value:function(t){this.log("input:change.colorpicker",t.value,t.color)}},{key:"onChange",value:function(t){this.log("colorpickerChange",t.value,t.color)}},{key:"onInvalid",value:function(t){this.log("colorpickerInvalid",t.value,t.color)}},{key:"onHide",value:function(t){this.log("colorpickerHide"),this.eventCounter=0}},{key:"onShow",value:function(t){this.log("colorpickerShow")}},{key:"onDisable",value:function(t){this.log("colorpickerDisable")}},{key:"onEnable",value:function(t){this.log("colorpickerEnable")}}]),e}();e.default=l,t.exports=e.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,a.default.extend(!0,{},{template:'',showText:!0,format:t.format},i)));return n.element=(0,a.default)(n.options.template),n.elementInner=n.element.find("div"),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,s.default),r(e,[{key:"onCreate",value:function(t){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"onCreate",this).call(this,t),this.colorpicker.picker.append(this.element)}},{key:"onUpdate",value:function(t){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"onUpdate",this).call(this,t),t.color?(this.elementInner.css("backgroundColor",t.color.toRgbString()),this.options.showText&&(this.elementInner.html(t.color.string(this.options.format||this.colorpicker.format)),t.color.isDark()&&t.color.alpha>.5?this.elementInner.css("color","white"):this.elementInner.css("color","black"))):this.elementInner.css("backgroundColor",null).css("color",null).html("")}}]),e}();e.default=l,t.exports=e.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var i=0;i\n \n ',swatchTemplate:''},l=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,s.default.extend(!0,{},a,i)));return n.element=null,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o.default),r(e,[{key:"isEnabled",value:function(){return this.getLength()>0}},{key:"onCreate",value:function(t){(function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,i,n)}if("value"in r)return r.value;var s=r.get;if(void 0!==s)return s.call(n)})(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"onCreate",this).call(this,t),this.isEnabled()&&(this.element=(0,s.default)(this.options.barTemplate),this.load(),this.colorpicker.picker.append(this.element))}},{key:"load",value:function(){var t=this,e=this.colorpicker,i=this.element.find(".colorpicker-swatches--inner"),n=!0===this.options.namesAsValues&&!Array.isArray(this.colors);i.empty(),s.default.each(this.colors,function(r,o){var a=(0,s.default)(t.options.swatchTemplate).attr("data-name",r).attr("data-value",o).attr("title",n?r+": "+o:o).on("mousedown.colorpicker touchstart.colorpicker",function(t){var i=(0,s.default)(this);e.setValue(n?i.attr("data-name"):i.attr("data-value"))});a.find(".colorpicker-swatch--inner").css("background-color",o),i.append(a)}),i.append((0,s.default)(''))}}]),e}();e.default=l,t.exports=e.default},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var i=0;i0)}},{key:"onClickingInside",value:function(t){this.clicking=this.isClickingInside(t)}},{key:"createPopover",value:function(){var t=this.colorpicker;this.popoverTarget=this.hasAddon?this.addon:this.input,t.picker.addClass("colorpicker-bs-popover-content"),this.popoverTarget.popover(o.default.extend(!0,{},s.default.popover,t.options.popover,{trigger:"manual",content:t.picker,html:!0})),this.popoverTip=(0,o.default)(this.popoverTarget.popover("getTipElement").data("bs.popover").tip),this.popoverTip.addClass("colorpicker-bs-popover"),this.popoverTarget.on("shown.bs.popover",o.default.proxy(this.fireShow,this)),this.popoverTarget.on("hidden.bs.popover",o.default.proxy(this.fireHide,this))}},{key:"reposition",value:function(t){this.popoverTarget&&this.isVisible()&&this.popoverTarget.popover("update")}},{key:"toggle",value:function(t){this.isVisible()?this.hide(t):this.show(t)}},{key:"show",value:function(t){if(!(this.isVisible()||this.showing||this.hidding)){this.showing=!0,this.hidding=!1,this.clicking=!1;var e=this.colorpicker;e.lastEvent.alias="show",e.lastEvent.e=t,t&&(!this.hasInput||"color"===this.input.attr("type"))&&t&&t.preventDefault&&(t.stopPropagation(),t.preventDefault()),this.isPopover&&(0,o.default)(this.root).on("resize.colorpicker",o.default.proxy(this.reposition,this)),e.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,o.default)(this.root.document).on("mousedown.colorpicker touchstart.colorpicker",o.default.proxy(this.hide,this)),(0,o.default)(this.root.document).on("mousedown.colorpicker touchstart.colorpicker",o.default.proxy(this.onClickingInside,this))),this.colorpicker.trigger("colorpickerShow")}},{key:"hide",value:function(t){if(!(this.isHidden()||this.showing||this.hidding)){var e=this.colorpicker,i=this.clicking||this.isClickingInside(t);this.hidding=!0,this.showing=!1,this.clicking=!1,e.lastEvent.alias="hide",e.lastEvent.e=t,i?this.hidding=!1:this.popoverTarget?this.popoverTarget.popover("hide"):this.fireHide()}}},{key:"fireHide",value:function(){this.hidding=!1,this.showing=!1;var t=this.colorpicker;t.picker.addClass("colorpicker-hidden").removeClass("colorpicker-visible"),(0,o.default)(this.root).off("resize.colorpicker",o.default.proxy(this.reposition,this)),(0,o.default)(this.root.document).off("mousedown.colorpicker touchstart.colorpicker",o.default.proxy(this.hide,this)),(0,o.default)(this.root.document).off("mousedown.colorpicker touchstart.colorpicker",o.default.proxy(this.onClickingInside,this)),t.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}}]),t}();e.default=a,t.exports=e.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:null;return(t=t||this.colorpicker.colorHandler.getColorString())?(t=this.colorpicker.colorHandler.resolveColorDelegate(t,!1),!1===this.colorpicker.options.useHashPrefix&&(t=t.replace(/^#/g,"")),t):""}},{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(t){this.colorpicker.lastEvent.alias="input.change",this.colorpicker.lastEvent.e=t;var e=this.getValue();e!==t.value&&this.colorpicker.setValue(e)}},{key:"onkeyup",value:function(t){this.colorpicker.lastEvent.alias="input.keyup",this.colorpicker.lastEvent.e=t;var e=this.getValue();e!==t.value&&this.colorpicker.setValue(e)}}]),t}();e.default=a,t.exports=e.default},function(t,e,i){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(e&&e in u&&(e=null),e&&!(e in c))throw new Error("Unknown model: "+e);var i,r;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof n)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var o=l.get(t);if(null===o)throw new Error("Unable to parse color from string: "+t);this.model=o.model,r=c[this.model].channels,this.color=o.value.slice(0,r),this.valpha="number"==typeof o.value[r]?o.value[r]:1}else if(t.length){this.model=e||"rgb",r=c[this.model].channels;var s=h.call(t,0,r);this.color=a(s,r),this.valpha="number"==typeof t[r]?t[r]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var p=Object.keys(t);"alpha"in t&&(p.splice(p.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var g=p.sort().join("");if(!(g in f))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=f[g];var m=c[this.model].labels,v=[];for(i=0;ii?(e+.05)/(i+.05):(i+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return n.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),i=e.color[0];return i=(i+t)%360,i=i<0?360+i:i,e.color[0]=i,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);var i=t.rgb(),r=this.rgb(),o=void 0===e?.5:e,s=2*o-1,a=i.alpha()-r.alpha(),l=((s*a==-1?s:(s+a)/(1+s*a))+1)/2,c=1-l;return n.rgb(l*i.red()+c*r.red(),l*i.green()+c*r.green(),l*i.blue()+c*r.blue(),i.alpha()*o+r.alpha()*(1-o))}},Object.keys(c).forEach(function(t){if(-1===u.indexOf(t)){var e=c[t].channels;n.prototype[t]=function(){if(this.model===t)return new n(this);if(arguments.length)return new n(arguments,t);var i="number"==typeof arguments[e]?e:this.valpha;return new n(function(t){return Array.isArray(t)?t:[t]}(c[this.model][t].raw(this.color)).concat(i),t)},n[t]=function(i){return"number"==typeof i&&(i=a(h.call(arguments),e)),new n(i,t)}}}),t.exports=n},function(t,e,i){function n(t,e,i){return Math.min(Math.max(e,t),i)}function r(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var o=i(5),s=i(18),a={};for(var l in o)o.hasOwnProperty(l)&&(a[o[l]]=l);var c=t.exports={to:{},get:{}};c.get=function(t){var e,i;switch(t.substring(0,3).toLowerCase()){case"hsl":e=c.get.hsl(t),i="hsl";break;case"hwb":e=c.get.hwb(t),i="hwb";break;default:e=c.get.rgb(t),i="rgb"}return e?{model:i,value:e}:null},c.get.rgb=function(t){if(!t)return null;var e,i,r,s=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],i=0;i<3;i++){var a=2*i;s[i]=parseInt(e.slice(a,a+2),16)}r&&(s[3]=Math.round(parseInt(r,16)/255*100)/100)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],i=0;i<3;i++)s[i]=parseInt(e[i]+e[i],16);r&&(s[3]=Math.round(parseInt(r+r,16)/255*100)/100)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/)){for(i=0;i<3;i++)s[i]=parseInt(e[i+1],0);e[4]&&(s[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/)))return(e=t.match(/(\D+)/))?"transparent"===e[1]?[0,0,0,0]:(s=o[e[1]])?(s[3]=1,s):null:null;for(i=0;i<3;i++)s[i]=Math.round(2.55*parseFloat(e[i+1]));e[4]&&(s[3]=parseFloat(e[4]))}for(i=0;i<3;i++)s[i]=n(s[i],0,255);return s[3]=n(s[3],0,1),s},c.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/);if(e){var i=parseFloat(e[4]);return[(parseFloat(e[1])+360)%360,n(parseFloat(e[2]),0,100),n(parseFloat(e[3]),0,100),n(isNaN(i)?1:i,0,1)]}return null},c.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/);if(e){var i=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,n(parseFloat(e[2]),0,100),n(parseFloat(e[3]),0,100),n(isNaN(i)?1:i,0,1)]}return null},c.to.hex=function(){var t=s(arguments);return"#"+r(t[0])+r(t[1])+r(t[2])+(t[3]<1?r(Math.round(255*t[3])):"")},c.to.rgb=function(){var t=s(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},c.to.rgb.percent=function(){var t=s(arguments),e=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+i+"%, "+n+"%)":"rgba("+e+"%, "+i+"%, "+n+"%, "+t[3]+")"},c.to.hsl=function(){var t=s(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},c.to.hwb=function(){var t=s(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},c.to.keyword=function(t){return a[t.slice(0,3)]}},function(t,e,i){"use strict";var n=i(19),r=Array.prototype.concat,o=Array.prototype.slice,s=t.exports=function(t){for(var e=[],i=0,s=t.length;i=0&&t.splice instanceof Function)}},function(t,e,i){var n=i(6),r=i(21),o={};Object.keys(n).forEach(function(t){o[t]={},Object.defineProperty(o[t],"channels",{value:n[t].channels}),Object.defineProperty(o[t],"labels",{value:n[t].labels});var e=r(t);Object.keys(e).forEach(function(i){var n=e[i];o[t][i]=function(t){var e=function(e){if(void 0===e||null===e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var i=t(e);if("object"==typeof i)for(var n=i.length,r=0;r1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(n)})}),t.exports=o},function(t,e,i){function n(t){var e=function(){for(var t={},e=Object.keys(s),i=e.length,n=0;n1&&void 0!==arguments[1])||arguments[1],i=new s.default(this.resolveColorDelegate(t),this.format);return i.isValid()||(e&&(i=this.getFallbackColor()),this.colorpicker.trigger("colorpickerInvalid",i,t)),this.isAlphaEnabled()||(i.alpha=1),i}},{key:"getFallbackColor",value:function(){if(this.fallback&&this.fallback===this.color)return this.color;var t=this.resolveColorDelegate(this.fallback),e=new s.default(t,this.format);return e.isValid()?e:(console.warn("The fallback color is invalid. Falling back to the previous color or black if any."),this.color?this.color:new s.default("#000000",this.format))}},{key:"assureColor",value:function(){return this.hasColor()||(this.color=this.getFallbackColor()),this.color}},{key:"resolveColorDelegate",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!1;return o.default.each(this.colorpicker.extensions,function(n,r){!1===i&&(i=r.resolveColor(t,e))}),i||t}},{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 s.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(t){this.colorpicker.element.data("color",t),t instanceof s.default&&"auto"===this.colorpicker.options.format&&(this.colorpicker.options.format=this.color.format)}}]),t}();e.default=a,t.exports=e.default},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var i=0;i0?e.css(t):this.addon.css(t)}}}]),t}();e.default=r,t.exports=e.default}])}),function(t,e){void 0===t&&void 0!==window&&(t=window),"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(t.jQuery)}(this,function(t){!function(t){"use strict";function e(e,i){var n=e.nodeName.toLowerCase();if(-1!==t.inArray(n,i))return-1===t.inArray(n,d)||Boolean(e.nodeValue.match(p)||e.nodeValue.match(g));for(var r=t(i).filter(function(t,e){return e instanceof RegExp}),o=0,s=r.length;o]+>/g,"")),n&&(l=c(l)),l=l.toUpperCase(),o="contains"===i?0<=l.indexOf(e):l.startsWith(e)))break}return o}function a(t){return parseInt(t,10)||0}function l(t){return D[t]}function c(t){return(t=t.toString())&&t.replace(A,l).replace(I,"")}function h(t){return k[t]}function u(e){var i,n=arguments,r=e;if([].shift.apply(n),!M.success){try{M.full=(t.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split(".")}catch(e){$.BootstrapVersion?M.full=$.BootstrapVersion.split(" ")[0].split("."):(M.full=[M.major,"0","0"],console.warn("There was an issue retrieving Bootstrap's version. Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.",e))}M.major=M.full[0],M.success=!0}if("4"===M.major){var o=[];$.DEFAULTS.style===R.BUTTONCLASS&&o.push({name:"style",className:"BUTTONCLASS"}),$.DEFAULTS.iconBase===R.ICONBASE&&o.push({name:"iconBase",className:"ICONBASE"}),$.DEFAULTS.tickIcon===R.TICKICON&&o.push({name:"tickIcon",className:"TICKICON"}),R.DIVIDER="dropdown-divider",R.SHOW="show",R.BUTTONCLASS="btn-light",R.POPOVERHEADER="popover-header",R.ICONBASE="",R.TICKICON="bs-ok-default";for(var s=0;s":">",'"':""","'":"'","`":"`"},T="(?:"+Object.keys(k).join("|")+")",E=RegExp(T),O=RegExp(T,"g"),function(t){return t=null==t?"":""+t,E.test(t)?t.replace(O,h):t}),P={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},M={success:!1,major:"3"};try{M.full=(t.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),M.major=M.full[0],M.success=!0}catch(t){}var L=0,F=".bs.select",R={DISABLED:"disabled",DIVIDER:"divider",SHOW:"open",DROPUP:"dropup",MENU:"dropdown-menu",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCLASS:"btn-default",POPOVERHEADER:"popover-title",ICONBASE:"glyphicon",TICKICON:"glyphicon-ok"},N={MENU:"."+R.MENU},B={span:document.createElement("span"),i:document.createElement("i"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode(" "),fragment:document.createDocumentFragment()};B.a.setAttribute("role","option"),"4"===M.major&&(B.a.className="dropdown-item"),B.subtext.className="text-muted",B.text=B.span.cloneNode(!1),B.text.className="text",B.checkMark=B.span.cloneNode(!1);var H=new RegExp("38|40"),z=new RegExp("^9$|27"),W={li:function(t,e,i){var n=B.li.cloneNode(!1);return t&&(1===t.nodeType||11===t.nodeType?n.appendChild(t):n.innerHTML=t),void 0!==e&&""!==e&&(n.className=e),null!=i&&n.classList.add("optgroup-"+i),n},a:function(t,e,i){var n=B.a.cloneNode(!0);return t&&(11===t.nodeType?n.appendChild(t):n.insertAdjacentHTML("beforeend",t)),void 0!==e&&""!==e&&n.classList.add.apply(n.classList,e.split(" ")),i&&n.setAttribute("style",i),n},text:function(t,e){var i,n,r=B.text.cloneNode(!1);if(t.content)r.innerHTML=t.content;else{if(r.textContent=t.text,t.icon){var o=B.whitespace.cloneNode(!1);(n=(!0===e?B.i:B.span).cloneNode(!1)).className=this.options.iconBase+" "+t.icon,B.fragment.appendChild(n),B.fragment.appendChild(o)}t.subtext&&((i=B.subtext.cloneNode(!1)).textContent=t.subtext,r.appendChild(i))}if(!0===e)for(;0'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1,sanitize:!0,sanitizeFn:null,whiteList:{"*":["class","dir","id","lang","role","tabindex","style",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]}},$.prototype={constructor:$,init:function(){var t=this,e=this.$element.attr("id");L++,this.selectId="bs-select-"+L,this.$element[0].classList.add("bs-select-hidden"),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),this.$element[0].classList.contains("show-tick")&&(this.options.showTick=!0),this.$newElement=this.createDropdown(),this.buildData(),this.$element.after(this.$newElement).prependTo(this.$newElement),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(N.MENU),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),this.$element[0].classList.remove("bs-select-hidden"),!0===this.options.dropdownAlignRight&&this.$menu[0].classList.add(R.MENURIGHT),void 0!==e&&this.$button.attr("data-id",e),this.checkDisabled(),this.clickListener(),this.options.liveSearch?(this.liveSearchListener(),this.focusedParent=this.$searchbox[0]):this.focusedParent=this.$menuInner[0],this.setStyle(),this.render(),this.setWidth(),this.options.container?this.selectPosition():this.$element.on("hide"+F,function(){if(t.isVirtual()){var e=t.$menuInner[0],i=e.firstChild.cloneNode(!1);e.replaceChild(i,e.firstChild),e.scrollTop=0}}),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile(),this.$newElement.on({"hide.bs.dropdown":function(e){t.$element.trigger("hide"+F,e)},"hidden.bs.dropdown":function(e){t.$element.trigger("hidden"+F,e)},"show.bs.dropdown":function(e){t.$element.trigger("show"+F,e)},"shown.bs.dropdown":function(e){t.$element.trigger("shown"+F,e)}}),t.$element[0].hasAttribute("required")&&this.$element.on("invalid"+F,function(){t.$button[0].classList.add("bs-invalid"),t.$element.on("shown"+F+".invalid",function(){t.$element.val(t.$element.val()).off("shown"+F+".invalid")}).on("rendered"+F,function(){this.validity.valid&&t.$button[0].classList.remove("bs-invalid"),t.$element.off("rendered"+F)}),t.$button.on("blur"+F,function(){t.$element.trigger("focus").trigger("blur"),t.$button.off("blur"+F)})}),setTimeout(function(){t.buildList(),t.$element.trigger("loaded"+F)})},createDropdown:function(){var e=this.multiple||this.options.showTick?" show-tick":"",i=this.multiple?' aria-multiselectable="true"':"",n="",r=this.autofocus?" autofocus":"";M.major<4&&this.$element.parent().hasClass("input-group")&&(n=" input-group-btn");var o,s="",a="",l="",c="";return this.options.header&&(s='"),this.options.liveSearch&&(a=''),this.multiple&&this.options.actionsBox&&(l=' "),this.multiple&&this.options.doneButton&&(c='"),o='",t(o)},setPositionData:function(){this.selectpicker.view.canHighlight=[];for(var t=this.selectpicker.view.size=0;t=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(e,n,r){function o(t,n){var r,o,c,u,f,d,p,g,m=l.selectpicker.current.elements.length,v=[],y=!0,b=l.isVirtual();l.selectpicker.view.scrollTop=t,r=Math.ceil(l.sizeInfo.menuInnerHeight/l.sizeInfo.liHeight*1.5),o=Math.round(m/r)||1;for(var _=0;_m-1?0:l.selectpicker.current.data[m-1].position-l.selectpicker.current.data[l.selectpicker.view.position1-1].position,S.firstChild.style.marginTop=w+"px",S.firstChild.style.marginBottom=C+"px"):(S.firstChild.style.marginTop=0,S.firstChild.style.marginBottom=0),S.firstChild.appendChild(k),!0===b&&l.sizeInfo.hasScrollBar){var P=S.firstChild.offsetWidth;if(n&&Pl.sizeInfo.selectWidth)S.firstChild.style.minWidth=l.sizeInfo.menuInnerInnerWidth+"px";else if(P>l.sizeInfo.menuInnerInnerWidth){l.$menu[0].style.minWidth=0;var M=S.firstChild.offsetWidth;M>l.sizeInfo.menuInnerInnerWidth&&(l.sizeInfo.menuInnerInnerWidth=M,S.firstChild.style.minWidth=l.sizeInfo.menuInnerInnerWidth+"px"),l.$menu[0].style.minWidth=""}}}if(l.prevActiveIndex=l.activeIndex,l.options.liveSearch){if(e&&n){var L,F=0;l.selectpicker.view.canHighlight[F]||(F=1+l.selectpicker.view.canHighlight.slice(1).indexOf(!0)),L=l.selectpicker.view.visibleElements[F],l.defocusItem(l.selectpicker.view.currentActive),l.activeIndex=(l.selectpicker.current.data[F]||{}).index,l.focusItem(L)}}else l.$menuInner.trigger("focus")}var s,a,l=this,c=0,h=[];if(this.selectpicker.isSearching=e,this.selectpicker.current=e?this.selectpicker.search:this.selectpicker.main,this.setPositionData(),n)if(r)c=this.$menuInner[0].scrollTop;else if(!l.multiple){var u=l.$element[0],f=(u.options[u.selectedIndex]||{}).liIndex;if("number"==typeof f&&!1!==l.options.size){var d=l.selectpicker.main.data[f],p=d&&d.position;p&&(c=p-(l.sizeInfo.menuInnerHeight+l.sizeInfo.liHeight)/2)}}o(c,!0),this.$menuInner.off("scroll.createView").on("scroll.createView",function(t,e){l.noScroll||o(this.scrollTop,e),l.noScroll=!1}),t(window).off("resize"+F+"."+this.selectId+".createView").on("resize"+F+"."+this.selectId+".createView",function(){l.$newElement.hasClass(R.SHOW)&&o(l.$menuInner[0].scrollTop)})},focusItem:function(t,e,i){if(t){e=e||this.selectpicker.main.data[this.activeIndex];var n=t.firstChild;n&&(n.setAttribute("aria-setsize",this.selectpicker.view.size),n.setAttribute("aria-posinset",e.posinset),!0!==i&&(this.focusedParent.setAttribute("aria-activedescendant",n.id),t.classList.add("active"),n.classList.add("active")))}},defocusItem:function(t){t&&(t.classList.remove("active"),t.firstChild&&t.firstChild.classList.remove("active"))},setPlaceholder:function(){var e=!1;if(this.options.title&&!this.multiple){this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option")),e=!0;var i=this.$element[0],n=!1,r=!this.selectpicker.view.titleOption.parentNode;r&&(this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",n=void 0===t(i.options[i.selectedIndex]).attr("selected")&&void 0===this.$element.data("selected")),!r&&0===this.selectpicker.view.titleOption.index||i.insertBefore(this.selectpicker.view.titleOption,i.firstChild),n&&(i.selectedIndex=0)}return e},buildData:function(){function t(t){var e=r[r.length-1];e&&"divider"===e.type&&(e.optID||t.optID)||((t=t||{}).type="divider",r.push(t))}function e(e,i){if((i=i||{}).divider="true"===e.getAttribute("data-divider"),i.divider)t({optID:i.optID});else{var n=r.length,o=e.style.cssText,s=o?j(o):"",a=(e.className||"")+(i.optgroupClass||"");i.optID&&(a="opt "+a),i.optionClass=a.trim(),i.inlineStyle=s,i.text=e.textContent,i.content=e.getAttribute("data-content"),i.tokens=e.getAttribute("data-tokens"),i.subtext=e.getAttribute("data-subtext"),i.icon=e.getAttribute("data-icon"),e.liIndex=n,i.display=i.content||i.text,i.type="option",i.index=n,i.option=e,i.selected=!!e.selected,i.disabled=i.disabled||!!e.disabled,r.push(i)}}function i(i,s){var a=s[i],l=s[i-1],c=s[i+1],h=a.querySelectorAll("option"+n);if(h.length){var u,f,d={display:j(a.label),subtext:a.getAttribute("data-subtext"),icon:a.getAttribute("data-icon"),type:"optgroup-label",optgroupClass:" "+(a.className||"")};o++,l&&t({optID:o}),d.optID=o,r.push(d);for(var p=0,g=h.length;p *"+n),l=a.length;s li")},render:function(){var t,e=this,n=this.$element[0],s=this.setPlaceholder()&&0===n.selectedIndex,a=r(n,this.options.hideDisabled),l=a.length,c=this.$button[0],h=c.querySelector(".filter-option-inner-inner"),u=document.createTextNode(this.options.multipleSeparator),f=B.fragment.cloneNode(!1),d=!1;if(c.classList.toggle("bs-placeholder",e.multiple?!l:!o(n,a)),this.tabIndex(),"static"===this.options.selectedTextFormat)f=W.text.call(this,{text:this.options.title},!0);else if(!1===(this.multiple&&-1!==this.options.selectedTextFormat.indexOf("count")&&1")).length&&l>t[1]||1===t.length&&2<=l))){if(!s){for(var p=0;p option"+y+", optgroup"+y+" option"+y).length,_="function"==typeof this.options.countSelectedText?this.options.countSelectedText(l,b):this.options.countSelectedText;f=W.text.call(this,{text:_.replace("{0}",l.toString()).replace("{1}",b.toString())},!0)}if(null==this.options.title&&(this.options.title=this.$element.attr("title")),f.childNodes.length||(f=W.text.call(this,{text:void 0!==this.options.title?this.options.title:this.options.noneSelectedText},!0)),c.title=f.textContent.replace(/<[^>]*>?/g,"").trim(),this.options.sanitize&&d&&i([f],e.options.whiteList,e.options.sanitizeFn),h.innerHTML="",h.appendChild(f),M.major<4&&this.$newElement[0].classList.contains("bs3-has-addon")){var x=c.querySelector(".filter-expand"),w=h.cloneNode(!0);w.className="filter-expand",x?c.replaceChild(w,x):c.appendChild(w)}this.$element.trigger("rendered"+F)},setStyle:function(t,e){var i,n=this.$button[0],r=this.$newElement[0],o=this.options.style.trim();this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,"")),M.major<4&&(r.classList.add("bs3"),r.parentNode.classList.contains("input-group")&&(r.previousElementSibling||r.nextElementSibling)&&(r.previousElementSibling||r.nextElementSibling).classList.contains("input-group-addon")&&r.classList.add("bs3-has-addon")),i=t?t.trim():o,"add"==e?i&&n.classList.add.apply(n.classList,i.split(" ")):"remove"==e?i&&n.classList.remove.apply(n.classList,i.split(" ")):(o&&n.classList.remove.apply(n.classList,o.split(" ")),i&&n.classList.add.apply(n.classList,i.split(" ")))},liHeight:function(e){if(e||!1!==this.options.size&&!Object.keys(this.sizeInfo).length){var i=document.createElement("div"),n=document.createElement("div"),r=document.createElement("div"),o=document.createElement("ul"),s=document.createElement("li"),l=document.createElement("li"),c=document.createElement("li"),h=document.createElement("a"),u=document.createElement("span"),f=this.options.header&&0this.sizeInfo.menuExtras.vert&&a+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot,!0===this.selectpicker.isSearching&&(l=this.selectpicker.dropup),this.$newElement.toggleClass(R.DROPUP,l),this.selectpicker.dropup=l),"auto"===this.options.size)r=3this.options.size){for(var y=0;ythis.sizeInfo.menuInnerHeight&&(this.sizeInfo.hasScrollBar=!0,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth+this.sizeInfo.scrollBarWidth),"auto"===this.options.dropdownAlignRight&&this.$menu.toggleClass(R.MENURIGHT,this.sizeInfo.selectOffsetLeft>this.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRightthis.options.size&&n.off("resize"+F+"."+this.selectId+".setMenuSize scroll"+F+"."+this.selectId+".setMenuSize")}this.createView(!1,!0,e)},setWidth:function(){var t=this;"auto"===this.options.width?requestAnimationFrame(function(){t.$menu.css("min-width","0"),t.$element.on("loaded"+F,function(){t.liHeight(),t.setMenuSize();var e=t.$newElement.clone().appendTo("body"),i=e.css("width","auto").children("button").outerWidth();e.remove(),t.sizeInfo.selectWidth=Math.max(t.sizeInfo.totalMenuWidth,i),t.$newElement.css("width",t.sizeInfo.selectWidth+"px")})}):"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width","")),this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement[0].classList.remove("fit-width")},selectPosition:function(){function e(e){var a={},l=o.options.display||!!t.fn.dropdown.Constructor.Default&&t.fn.dropdown.Constructor.Default.display;o.$bsContainer.addClass(e.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(R.DROPUP,e.hasClass(R.DROPUP)),i=e.offset(),s.is("body")?n={top:0,left:0}:((n=s.offset()).top+=parseInt(s.css("borderTopWidth"))-s.scrollTop(),n.left+=parseInt(s.css("borderLeftWidth"))-s.scrollLeft()),r=e.hasClass(R.DROPUP)?0:e[0].offsetHeight,(M.major<4||"static"===l)&&(a.top=i.top-n.top+r,a.left=i.left-n.left),a.width=e[0].offsetWidth,o.$bsContainer.css(a)}this.$bsContainer=t('');var i,n,r,o=this,s=t(this.options.container);this.$button.on("click.bs.dropdown.data-api",function(){o.isDisabled()||(e(o.$newElement),o.$bsContainer.appendTo(o.options.container).toggleClass(R.SHOW,!o.$button.hasClass(R.SHOW)).append(o.$menu))}),t(window).off("resize"+F+"."+this.selectId+" scroll"+F+"."+this.selectId).on("resize"+F+"."+this.selectId+" scroll"+F+"."+this.selectId,function(){o.$newElement.hasClass(R.SHOW)&&e(o.$newElement)}),this.$element.on("hide"+F,function(){o.$menu.data("height",o.$menu.height()),o.$bsContainer.detach()})},setOptionStatus:function(t){var e=this;if(e.noScroll=!1,e.selectpicker.view.visibleElements&&e.selectpicker.view.visibleElements.length)for(var i=0;i');O[2]&&(D=D.replace("{var}",O[2][1<_?0:1]),A=A.replace("{var}",O[2][1"+D+"")),p=!1,n.$element.trigger("maxReached"+F)),x&&S&&(I.append(t(""+A+"
")),p=!1,n.$element.trigger("maxReachedGrp"+F)),setTimeout(function(){n.setSelected(h,!1)},10),I[0].classList.add("fadeOut"),setTimeout(function(){I.remove()},1050)}}}else d&&(d.selected=!1),g.selected=!0,n.setSelected(h,!0);!n.multiple||n.multiple&&1===n.options.maxOptions?n.$button.trigger("focus"):n.options.liveSearch&&n.$searchbox.trigger("focus"),p&&(!n.multiple&&f===a.selectedIndex||(C=[g.index,m.prop("selected"),u],n.$element.triggerNative("change")))}}),this.$menu.on("click","li."+R.DISABLED+" a, ."+R.POPOVERHEADER+", ."+R.POPOVERHEADER+" :not(.close)",function(e){e.currentTarget==this&&(e.preventDefault(),e.stopPropagation(),n.options.liveSearch&&!t(e.target).hasClass("close")?n.$searchbox.trigger("focus"):n.$button.trigger("focus"))}),this.$menuInner.on("click",".divider, .dropdown-header",function(t){t.preventDefault(),t.stopPropagation(),n.options.liveSearch?n.$searchbox.trigger("focus"):n.$button.trigger("focus")}),this.$menu.on("click","."+R.POPOVERHEADER+" .close",function(){n.$button.trigger("click")}),this.$searchbox.on("click",function(t){t.stopPropagation()}),this.$menu.on("click",".actions-btn",function(e){n.options.liveSearch?n.$searchbox.trigger("focus"):n.$button.trigger("focus"),e.preventDefault(),e.stopPropagation(),t(this).hasClass("bs-select-all")?n.selectAll():n.deselectAll()}),this.$element.on("change"+F,function(){n.render(),n.$element.trigger("changed"+F,C),C=null}).on("focus"+F,function(){n.options.mobile||n.$button.trigger("focus")})},liveSearchListener:function(){var t=this,e=document.createElement("li");this.$button.on("click.bs.dropdown.data-api",function(){t.$searchbox.val()&&t.$searchbox.val("")}),this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",function(t){t.stopPropagation()}),this.$searchbox.on("input propertychange",function(){var i=t.$searchbox.val();if(t.selectpicker.search.elements=[],t.selectpicker.search.data=[],i){var n=[],r=i.toUpperCase(),o={},a=[],l=t._searchStyle(),h=t.options.liveSearchNormalize;h&&(r=c(r));for(var u=0;u=h.selectpicker.view.canHighlight.length&&(i=0),h.selectpicker.view.canHighlight[i+m]||(i=i+1+h.selectpicker.view.canHighlight.slice(i+m+1).indexOf(!0))),e.preventDefault();var v=m+i;38===e.which?0===m&&i===u.length-1?(h.$menuInner[0].scrollTop=h.$menuInner[0].scrollHeight,v=h.selectpicker.current.elements.length-1):f=(a=(o=h.selectpicker.current.data[v]).position-o.height)g+h.sizeInfo.menuInnerHeight),r=h.selectpicker.main.elements[y],h.activeIndex=_[C],h.focusItem(r),r&&r.firstChild.focus(),f&&(h.$menuInner[0].scrollTop=a),l.trigger("focus")}}n&&(32===e.which&&!h.selectpicker.keydown.keyHistory||13===e.which||9===e.which&&h.options.selectOnTab)&&(32!==e.which&&e.preventDefault(),h.options.liveSearch&&32===e.which||(h.$menuInner.find(".active a").trigger("click",!0),l.trigger("focus"),h.options.liveSearch||(e.preventDefault(),t(document).data("spaceSelect",!0))))}},mobile:function(){this.$element[0].classList.add("mobile-device")},refresh:function(){var e=t.extend({},this.options,this.$element.data());this.options=e,this.checkDisabled(),this.setStyle(),this.render(),this.buildData(),this.buildList(),this.setWidth(),this.setSize(!0),this.$element.trigger("refreshed"+F)},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove(),this.$bsContainer?this.$bsContainer.remove():this.$menu.remove(),this.$element.off(F).removeData("selectpicker").removeClass("bs-select-hidden selectpicker"),t(window).off(F+"."+this.selectId)}};var U=t.fn.selectpicker;t.fn.selectpicker=u,t.fn.selectpicker.Constructor=$,t.fn.selectpicker.noConflict=function(){return t.fn.selectpicker=U,this};var V=t.fn.dropdown.Constructor._dataApiKeydownHandler||t.fn.dropdown.Constructor.prototype.keydown;t(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api",':not(.bootstrap-select) > [data-toggle="dropdown"]',V).on("keydown.bs.dropdown.data-api",":not(.bootstrap-select) > .dropdown-menu",V).on("keydown"+F,'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',$.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',function(t){t.stopPropagation()}),t(window).on("load"+F+".data-api",function(){t(".selectpicker").each(function(){var e=t(this);u.call(e,e.data())})})}(t)}),function(){function t(t,e){document.addEventListener?t.addEventListener("scroll",e,!1):t.attachEvent("scroll",e)}function e(t){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(t)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function i(t,e){t.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+e+";"}function n(t){var e=t.a.offsetWidth,i=e+100;return t.f.style.width=i+"px",t.c.scrollLeft=i,t.b.scrollLeft=t.b.scrollWidth+100,t.g!==e&&(t.g=e,!0)}function r(e,i){function r(){var t=o;n(t)&&t.a.parentNode&&i(t.g)}var o=e;t(e.b,r),t(e.c,r),n(e)}function o(t,e){var i=e||{};this.family=t,this.style=i.style||"normal",this.weight=i.weight||"normal",this.stretch=i.stretch||"normal"}function s(){return null===u&&(u=!!document.fonts),u}function a(t,e){return[t.style,t.weight,function(){if(null===h){var t=document.createElement("div");try{t.style.font="condensed 100px sans-serif"}catch(t){}h=""!==t.style.font}return h}()?t.stretch:"","100px",e].join(" ")}var l=null,c=null,h=null,u=null;o.prototype.load=function(t,n){var o=this,h=t||"BESbswy",u=0,f=n||3e3,d=(new Date).getTime();return new Promise(function(t,n){if(s()&&!function(){if(null===c)if(s()&&/Apple/.test(window.navigator.vendor)){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent);c=!!t&&603>parseInt(t[1],10)}else c=!1;return c}()){var p=new Promise(function(t,e){function i(){(new Date).getTime()-d>=f?e(Error(f+"ms timeout exceeded")):document.fonts.load(a(o,'"'+o.family+'"'),h).then(function(e){1<=e.length?t():setTimeout(i,25)},e)}i()}),g=new Promise(function(t,e){u=setTimeout(function(){e(Error(f+"ms timeout exceeded"))},f)});Promise.race([g,p]).then(function(){clearTimeout(u),t(o)},n)}else!function(t){document.body?t():document.addEventListener?document.addEventListener("DOMContentLoaded",function e(){document.removeEventListener("DOMContentLoaded",e),t()}):document.attachEvent("onreadystatechange",function e(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",e),t())})}(function(){function s(){var e;(e=-1!=v&&-1!=y||-1!=v&&-1!=b||-1!=y&&-1!=b)&&((e=v!=y&&v!=b&&y!=b)||(null===l&&(e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!e&&(536>parseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))),e=l&&(v==_&&y==_&&b==_||v==x&&y==x&&b==x||v==w&&y==w&&b==w)),e=!e),e&&(C.parentNode&&C.parentNode.removeChild(C),clearTimeout(u),t(o))}function c(){if((new Date).getTime()-d>=f)C.parentNode&&C.parentNode.removeChild(C),n(Error(f+"ms timeout exceeded"));else{var t=document.hidden;!0!==t&&void 0!==t||(v=p.a.offsetWidth,y=g.a.offsetWidth,b=m.a.offsetWidth,s()),u=setTimeout(c,50)}}var p=new e(h),g=new e(h),m=new e(h),v=-1,y=-1,b=-1,_=-1,x=-1,w=-1,C=document.createElement("div");C.dir="ltr",i(p,a(o,"sans-serif")),i(g,a(o,"serif")),i(m,a(o,"monospace")),C.appendChild(p.a),C.appendChild(g.a),C.appendChild(m.a),document.body.appendChild(C),_=p.a.offsetWidth,x=g.a.offsetWidth,w=m.a.offsetWidth,c(),r(p,function(t){v=t,s()}),i(p,a(o,'"'+o.family+'",sans-serif')),r(g,function(t){y=t,s()}),i(g,a(o,'"'+o.family+'",serif')),r(m,function(t){b=t,s()}),i(m,a(o,'"'+o.family+'",monospace'))})})},"object"==typeof module?module.exports=o:(window.FontFaceObserver=o,window.FontFaceObserver.prototype.load=o.prototype.load)}(),$(function(){$(".memes-container").delegate("img","click",function(){var t=$(this),e={url:t.attr("full-img-src"),height:t.attr("img-height"),width:t.attr("img-width")};$(".choice-section").trigger("choice-done",e)}),$("#meme-input").on("change",function(){const t=this.files[0],e=t.type;if($("#meme-input").val(""),!isImage(e))return void showAlert("Error! Invalid Image");const i=new FileReader;i.onload=function(){var t=new Image;t.src=i.result,t.onload=function(){var e={url:i.result,height:t.height,width:t.width};$(".choice-section").trigger("choice-done",e)}},i.readAsDataURL(t)}),$(".choice-section").on("choice-done",function(t,e){$(".discription").fadeOut(),$(".choice-section").fadeOut("normal",function(){$(".edit-section").removeClass("d-none").hide().fadeIn(),$(".fabric-canvas-wrapper").append(''),processMeme(e)})}),$(".back-to-memes").on("click",function(){$(".edit-section").fadeOut("normal",function(){$(".canvas-container").remove(),$(".choice-section").fadeIn(),$(".discription").fadeIn(),enableTextMethods()})});var t=$(".grid").masonry({itemSelector:".grid-item",percentPosition:!0,columnWidth:".grid-sizer",transitionDuration:0,gutter:0});t.imagesLoaded().progress(function(){t.masonry("layout")})}),$(".edit-btn").on("update-status",function(){""==$(this).attr("data")?$(this).removeClass("active"):$(this).addClass("active")}),$("#font-style .btn").on("click",function(){""==$(this).attr("data")?($(this).addClass("active"),$(this).attr("data",$(this).attr("value"))):($(this).removeClass("active"),$(this).attr("data","")),$(this).trigger("change-value")}),$(".align").on("update-status",function(){$(".align").removeClass("active"),$(this).addClass("active")});var canvas;function serialize(e){if(e&&"FORM"===e.nodeName){var t,n,o=[];for(t=e.elements.length-1;t>=0;t-=1)if(""!==e.elements[t].name)switch(e.elements[t].nodeName){case"INPUT":switch(e.elements[t].type){case"text":case"tel":case"email":case"hidden":case"password":case"button":case"reset":case"submit":o.push(e.elements[t].name+"="+encodeURIComponent(e.elements[t].value));break;case"checkbox":case"radio":e.elements[t].checked&&o.push(e.elements[t].name+"="+encodeURIComponent(e.elements[t].value))}break;case"file":break;case"TEXTAREA":o.push(e.elements[t].name+"="+encodeURIComponent(e.elements[t].value));break;case"SELECT":switch(e.elements[t].type){case"select-one":o.push(e.elements[t].name+"="+encodeURIComponent(e.elements[t].value));break;case"select-multiple":for(n=e.elements[t].options.length-1;n>=0;n-=1)e.elements[t].options[n].selected&&o.push(e.elements[t].name+"="+encodeURIComponent(e.elements[t].options[n].value))}break;case"BUTTON":switch(e.elements[t].type){case"reset":case"submit":case"button":o.push(e.elements[t].name+"="+encodeURIComponent(e.elements[t].value))}}return o.join("&")}}let slideUp=(e,t=500)=>{e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.boxSizing="border-box",e.style.height=e.offsetHeight+"px",e.offsetHeight,e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,window.setTimeout(()=>{e.style.display="none",e.style.removeProperty("height"),e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)},slideDown=(e,t=500)=>{e.style.removeProperty("display");let n=window.getComputedStyle(e).display;"none"===n&&(n="block"),e.style.display=n;let o=e.offsetHeight;e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,e.offsetHeight,e.style.boxSizing="border-box",e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.height=o+"px",e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),window.setTimeout(()=>{e.style.removeProperty("height"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},t)};var slideToggle=(e,t=500)=>"none"===window.getComputedStyle(e).display?slideDown(e,t):slideUp(e,t);document.addEventListener("DOMContentLoaded",function(){if(document.body.contains(document.getElementById("login-container"))){var e=document.querySelector(".login-loading"),t=document.querySelector(".signup-message"),n=document.getElementById("signup");document.querySelector(".remember-me").addEventListener("click",function(e){this.classList.contains("active")?(this.classList.remove("active"),document.getElementById("remember_me").value=0):(this.classList.add("active"),document.getElementById("remember_me").value=1)});var o=document.querySelector(".sign-up-select"),s=document.querySelector(".log-in-select"),i=document.querySelector(".log-in-select2"),r=document.querySelector(".lost-password-select");o.addEventListener("click",function(e){slideUp(document.getElementById("login-container"),350),slideDown(document.getElementById("signup-container"),350),slideUp(document.getElementById("lost-pw-container"),350)}),s.addEventListener("click",function(e){slideDown(document.getElementById("login-container"),350),slideUp(document.getElementById("signup-container"),350),slideUp(document.getElementById("lost-pw-container"),350)}),i.addEventListener("click",function(e){slideDown(document.getElementById("login-container"),350),slideUp(document.getElementById("signup-container"),350),slideUp(document.getElementById("lost-pw-container"),350)}),r.addEventListener("click",function(e){slideUp(document.getElementById("login-container"),350),slideUp(document.getElementById("signup-container"),350),slideDown(document.getElementById("lost-pw-container"),350)});const y=document.getElementById("signup");function a(o){o.preventDefault&&o.preventDefault(),e.classList.add("active");var s=document.getElementById("base-data").dataset.token,i=n.action+s+"/";serialized=serialize(n);var r=new XMLHttpRequest;r.addEventListener("load",function(){var n=JSON.parse(this.response),o=n.response_code,s=n.response_message;1==o&&(t.innerHTML=s,e.classList.remove("active"),y.remove()),0==o&&(t.innerHTML=s,e.classList.remove("active"))}),r.open("POST",i),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var a=serialized;return r.send(a),!1}n.attachEvent?n.attachEvent("submit",a):n.addEventListener("submit",a);var l=document.querySelector(".lost-pw-message"),d=document.getElementById("lostpw");const v=document.getElementById("lostpw");function c(t){t.preventDefault&&t.preventDefault(),e.classList.add("active");var n=d.action;serialized=serialize(d);var o=new XMLHttpRequest;o.addEventListener("load",function(){var t=JSON.parse(this.response),n=t.response_code,o=t.response_message;1==n&&(l.innerHTML=o,e.classList.remove("active"),v.remove()),0==n&&(l.innerHTML=o,e.classList.remove("active"))}),o.open("POST",n),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var s=serialized;return o.send(s),!1}d.attachEvent?d.attachEvent("submit",c):d.addEventListener("submit",c);var m=document.querySelector(".log-in-message"),u=document.getElementById("login");document.getElementById("login");function p(t){t.preventDefault&&t.preventDefault(),e.classList.add("active");var n=u.action;serialized=serialize(u);var o=new XMLHttpRequest;o.addEventListener("load",function(){var t=JSON.parse(this.response),n=t.response_code,o=t.response_message;3==n&&(m.innerHTML=o,e.classList.remove("active")),2==n&&(m.innerHTML=o,e.classList.remove("active")),1==n&&location.reload()}),o.open("POST",n),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var s=serialized;return o.send(s),!1}u.attachEvent?u.attachEvent("submit",p):u.addEventListener("submit",p)}}),document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".login-prompt");var t=document.querySelector(".login-form-holder");for(const n of e)n.addEventListener("click",function(e){if($(window).width()<950){var n=document.querySelector(".hamburger"),o=document.querySelector(".sidebar"),s=document.querySelector(".body");n.classList.add("is-active"),o.classList.add("active"),s.classList.add("mobile-menu-open")}else t.classList.add("bounce"),setTimeout(function(){t.classList.remove("bounce")},750)})});
The Bro Code Meme Maker