UNPKG

tui-image-editor.upgrade

Version:
45 lines 631 kB
/*!
 * tui-image-editor.upgrade.min.js
 * @version 3.2.3-rc.35
 * @author lizhekang <lizhekang@hotmail.com>
 * @license MIT
 */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("tui-code-snippet")):"function"==typeof define&&define.amd?define(["tui-code-snippet"],e):"object"==typeof exports?exports.ImageEditor=e(require("tui-code-snippet")):(t.tui=t.tui||{},t.tui.ImageEditor=e(t.tui&&t.tui.util))}(this,function(__WEBPACK_EXTERNAL_MODULE_4__){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="dist",e(0)}([function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}i(114);var r=i(111),o=n(r);i(173),i(66),i(67),i(68),i(69),i(70),i(71),i(72),i(73),i(74),i(75),i(76),i(77),i(78),i(79),i(80),i(81),i(82),i(83),i(86),i(84),i(85),t.exports=o.default},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(5),o=n(r);t.exports={componentNames:o.default.keyMirror("IMAGE_LOADER","CROPPER","FLIP","ROTATION","FREE_DRAWING","LINE","TEXT","ICON","FILTER","SHAPE"),commandNames:{CLEAR_OBJECTS:"clearObjects",LOAD_IMAGE:"loadImage",FLIP_IMAGE:"flip",ROTATE_IMAGE:"rotate",ADD_OBJECT:"addObject",REMOVE_OBJECT:"removeObject",APPLY_FILTER:"applyFilter",REMOVE_FILTER:"removeFilter",ADD_ICON:"addIcon",CHANGE_ICON_COLOR:"changeIconColor",ADD_SHAPE:"addShape",CHANGE_SHAPE:"changeShape",ADD_TEXT:"addText",ADD_TEXTS:"addTexts",CHANGE_TEXT:"changeText",CHANGE_TEXT_STYLE:"changeTextStyle",ADD_IMAGE_OBJECT:"addImageObject",RESIZE_CANVAS_DIMENSION:"resizeCanvasDimension",SET_OBJECT_PROPERTIES:"setObjectProperties",SET_OBJECT_POSITION:"setObjectPosition",SET_OBJECT_POSITIONS:"setObjectPositions"},eventNames:{OBJECT_ACTIVATED:"objectActivated",OBJECT_MOVED:"objectMoved",OBJECT_SCALED:"objectScaled",OBJECT_CREATED:"objectCreated",OBJECT_ROTATE_FIX:"objectRotateFix",OBJECT_REMOVE:"objectRemove",TEXT_EDITING:"textEditing",TEXT_CHANGED:"textChanged",ICON_CREATE_RESIZE:"iconCreateResize",ICON_CREATE_END:"iconCreateEnd",ADD_TEXT:"addText",ADD_OBJECT:"addObject",ADD_OBJECT_AFTER:"addObjectAfter",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_MOVE:"mousemove",REDO_STACK_CHANGED:"redoStackChanged",UNDO_STACK_CHANGED:"undoStackChanged",SELECTION_CLEARED:"selectionCleared",SELECTION_CREATED:"selectionCreated"},drawingModes:o.default.keyMirror("NORMAL","CROPPER","FREE_DRAWING","LINE_DRAWING","TEXT","SHAPE"),keyCodes:{Z:90,Y:89,SHIFT:16,BACKSPACE:8,DEL:46},fObjectOptions:{SELECTION_STYLE:{borderColor:"#fff",cornerColor:"yellow",cornerStyle:"editor",hasRotatingPoint:!1,originX:"center",originY:"center",transparentCorners:!1}},rejectMessages:{flip:"The flipX and flipY setting values are not changed.",rotation:"The current angle is same the old angle.",loadImage:"The background image is empty.",isLock:"The executing command state is locked.",undo:"The promise of undo command is reject.",redo:"The promise of redo command is reject.",invalidDrawingMode:"This operation is not supported in the drawing mode",invalidParameters:"Invalid parameters",noActiveObject:"There is no active object.",unsupportedType:"Unsupported object type",noObject:"The object is not in canvas.",addedObject:"The object is already added."},defaultIconPath:{"icon-arrow":"M40 12V0l24 24-24 24V36H0V12h40z","icon-arrow-2":"M49,32 H3 V22 h46 l-18,-18 h12 l23,23 L43,50 h-12 l18,-18  z ","icon-arrow-3":"M43.349998,27 L17.354,53 H1.949999 l25.996,-26 L1.949999,1 h15.404 L43.349998,27  z ","icon-star":"M35,54.557999 l-19.912001,10.468 l3.804,-22.172001 l-16.108,-15.7 l22.26,-3.236 L35,3.746 l9.956,20.172001 l22.26,3.236 l-16.108,15.7 l3.804,22.172001  z ","icon-star-2":"M17,31.212 l-7.194,4.08 l-4.728,-6.83 l-8.234,0.524 l-1.328,-8.226 l-7.644,-3.14 l2.338,-7.992 l-5.54,-6.18 l5.54,-6.176 l-2.338,-7.994 l7.644,-3.138 l1.328,-8.226 l8.234,0.522 l4.728,-6.83 L17,-24.312 l7.194,-4.08 l4.728,6.83 l8.234,-0.522 l1.328,8.226 l7.644,3.14 l-2.338,7.992 l5.54,6.178 l-5.54,6.178 l2.338,7.992 l-7.644,3.14 l-1.328,8.226 l-8.234,-0.524 l-4.728,6.83  z ","icon-polygon":"M3,31 L19,3 h32 l16,28 l-16,28 H19  z ","icon-location":"M24 62C8 45.503 0 32.837 0 24 0 10.745 10.745 0 24 0s24 10.745 24 24c0 8.837-8 21.503-24 38zm0-28c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10z","icon-heart":"M49.994999,91.349998 l-6.96,-6.333 C18.324001,62.606995 2.01,47.829002 2.01,29.690998 C2.01,14.912998 13.619999,3.299999 28.401001,3.299999 c8.349,0 16.362,5.859 21.594,12 c5.229,-6.141 13.242001,-12 21.591,-12 c14.778,0 26.390999,11.61 26.390999,26.390999 c0,18.138 -16.314001,32.916 -41.025002,55.374001 l-6.96,6.285  z ","icon-bubble":"M44 48L34 58V48H12C5.373 48 0 42.627 0 36V12C0 5.373 5.373 0 12 0h40c6.627 0 12 5.373 12 12v24c0 6.627-5.373 12-12 12h-8z"},defaultRotateRangeValus:{realTimeEvent:!0,min:-360,max:360,value:0},defaultDrawRangeValus:{min:5,max:30,value:12},defaultShapeStrokeValus:{realTimeEvent:!1,min:2,max:300,value:3},defaultTextRangeValus:{realTimeEvent:!0,min:10,max:100,value:50},defaultFilterRangeValus:{tintOpacityRange:{min:0,max:1,value:.7},removewhiteThresholdRange:{min:0,max:255,value:60},removewhiteDistanceRange:{min:0,max:255,value:10},gradientTransparencyRange:{min:0,max:255,value:100},brightnessRange:{min:-255,max:255,value:100},noiseRange:{min:0,max:1e3,value:100},pixelateRange:{min:2,max:20,value:4},colorfilterThresholeRange:{min:0,max:255,value:45}}}},function(t,e,i){i(169),i(171),i(172),i(170),t.exports=i(20).Promise},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t){var e=c[t];if(e){for(var i=arguments.length,n=Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return new a.default(e,n)}return null}function o(t){c[t.name]=t}var s=i(112),a=n(s),c={};t.exports={create:r,register:o}},function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE_4__},function(t,e,i){"use strict";var n=i(4),r=Math.min,o=Math.max;t.exports={clamp:function(t,e,i){var n=void 0;return e>i&&(n=e,e=i,i=n),o(e,r(t,i))},keyMirror:function(){for(var t={},e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return(0,n.forEach)(i,function(e){t[e]=e}),t},makeStyleText:function(t){var e="";return(0,n.forEach)(t,function(t,i){e+=i+": "+t+";"}),e},getProperties:function(t,e){var i={},n=e.length,r=0,o=void 0;for(r=0;r<n;r+=1)o=e[r],i[o]=t[o];return i},toInteger:function(t){return parseInt(t,10)},toCamelCase:function(t){return t.replace(/-([a-z])/g,function(t,e){return e.toUpperCase()})},isSupportFileApi:function(){return!!(window.File&&window.FileList&&window.FileReader)},getRgb:function(t,e){4===t.length&&(t=""+t+t.slice(1,4));var i=parseInt(t.slice(1,3),16),n=parseInt(t.slice(3,5),16),r=parseInt(t.slice(5,7),16),o=e||1;return"rgba("+i+", "+n+", "+r+", "+o+")"},sendHostName:function(){return null},styleLoad:function(t,e){var i=document.getElementsByTagName("head"),n=i[0],r=document.createElement("link"),o=encodeURIComponent(t);e&&(r.id=e),r.setAttribute("rel","stylesheet"),r.setAttribute("type","text/css"),r.setAttribute("href","data:text/css;charset=UTF-8,"+o),n.appendChild(r)},getSelector:function(t){return function(e){return t.querySelector(e)}},base64ToBlob:function(t){var e=/data:(image\/.+);base64,/,i="",n=void 0,r=void 0,o=void 0;n=t.replace(e,function(t,e){return i=e,""}),n=atob(n);var s=n.length;for(r=new Uint8Array(s),o=0;o<s;o+=1)r[o]=n.charCodeAt(o);return new Blob([r],{type:i})}}},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;(function(Buffer,global,process){var fabric=fabric||{version:"1.6.7"};exports.fabric=fabric,"undefined"!=typeof document&&"undefined"!=typeof window?(fabric.document=document,fabric.window=window,window.fabric=fabric):(fabric.document=__webpack_require__(192).jsdom("<!DOCTYPE html><html><head></head><body></body></html>"),fabric.document.createWindow?fabric.window=fabric.document.createWindow():fabric.window=fabric.document.parentWindow),fabric.isTouchSupported="ontouchstart"in fabric.document.documentElement,fabric.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,fabric.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id"],fabric.DPI=96,fabric.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:e[-+]?\\d+)?)",fabric.fontPaths={},fabric.charWidthsCache={},fabric.devicePixelRatio=fabric.window.devicePixelRatio||fabric.window.webkitDevicePixelRatio||fabric.window.mozDevicePixelRatio||1,function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:fabric.util.array.fill(i,!1)}}function e(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this}function i(e,i){if(this.__eventListeners){if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&"object"==typeof arguments[0])for(var n in e)t.call(this,n,e[n]);else t.call(this,e,i);return this}}function n(t,e){if(this.__eventListeners){var i=this.__eventListeners[t];if(i){for(var n=0,r=i.length;n<r;n++)i[n]&&i[n].call(this,e||{});return this.__eventListeners[t]=i.filter(function(t){return t!==!1}),this}}}fabric.Observable={observe:e,stopObserving:i,fire:n,on:e,off:i,trigger:n}}(),fabric.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var t=0,e=arguments.length;t<e;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.renderAll(),this},insertAt:function(t,e,i){var n=this.getObjects();return i?n[e]=t:n.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.renderAll(),this},remove:function(){for(var t,e=this.getObjects(),i=!1,n=0,r=arguments.length;n<r;n++)t=e.indexOf(arguments[n]),t!==-1&&(i=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[n]));return this.renderOnAddRemove&&i&&this.renderAll(),this},forEachObject:function(t,e){for(var i=this.getObjects(),n=0,r=i.length;n<r;n++)t.call(e,i[n],n,i);return this},getObjects:function(t){return"undefined"==typeof t?this._objects:this._objects.filter(function(e){return e.type===t})},item:function(t){return this.getObjects()[t]},isEmpty:function(){return 0===this.getObjects().length},size:function(){return this.getObjects().length},contains:function(t){return this.getObjects().indexOf(t)>-1},complexity:function(){return this.getObjects().reduce(function(t,e){return t+=e.complexity?e.complexity():0},0)}},function(t){var e=Math.sqrt,i=Math.atan2,n=Math.pow,r=Math.abs,o=Math.PI/180;fabric.util={removeFromArray:function(t,e){var i=t.indexOf(e);return i!==-1&&t.splice(i,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*o},radiansToDegrees:function(t){return t/o},rotatePoint:function(t,e,i){t.subtractEquals(e);var n=fabric.util.rotateVector(t,i);return new fabric.Point(n.x,n.y).addEquals(e)},rotateVector:function(t,e){var i=Math.sin(e),n=Math.cos(e),r=t.x*n-t.y*i,o=t.x*i+t.y*n;return{x:r,y:o}},transformPoint:function(t,e,i){return i?new fabric.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new fabric.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t){var e=[t[0].x,t[1].x,t[2].x,t[3].x],i=fabric.util.array.min(e),n=fabric.util.array.max(e),r=Math.abs(i-n),o=[t[0].y,t[1].y,t[2].y,t[3].y],s=fabric.util.array.min(o),a=fabric.util.array.max(o),c=Math.abs(s-a);return{left:i,top:s,width:r,height:c}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),i=[e*t[3],-e*t[1],-e*t[2],e*t[0]],n=fabric.util.transformPoint({x:t[4],y:t[5]},i,!0);return i[4]=-n.x,i[5]=-n.y,i},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var i=/\D{0,2}$/.exec(t),n=parseFloat(t);switch(e||(e=fabric.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case"mm":return n*fabric.DPI/25.4;case"cm":return n*fabric.DPI/2.54;case"in":return n*fabric.DPI;case"pt":return n*fabric.DPI/72;case"pc":return n*fabric.DPI/72*12;case"em":return n*e;default:return n}},falseFunction:function(){return!1},getKlass:function(t,e){return t=fabric.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),fabric.util.resolveNamespace(e)[t]},resolveNamespace:function(e){if(!e)return fabric;var i,n=e.split("."),r=n.length,o=t||fabric.window;for(i=0;i<r;++i)o=o[n[i]];return o},loadImage:function(t,e,i,n){if(!t)return void(e&&e.call(i,t));var r=fabric.util.createImage();r.onload=function(){e&&e.call(i,r),r=r.onload=r.onerror=null},r.onerror=function(){fabric.log("Error loading "+r.src),e&&e.call(i,null,!0),r=r.onload=r.onerror=null},0!==t.indexOf("data")&&n&&(r.crossOrigin=n),r.src=t},enlivenObjects:function(t,e,i,n){function r(){++s===a&&e&&e(o)}t=t||[];var o=[],s=0,a=t.length;return a?void t.forEach(function(t,e){if(!t||!t.type)return void r();var s=fabric.util.getKlass(t.type,i);s.async?s.fromObject(t,function(i,s){s||(o[e]=i,n&&n(t,o[e])),r()}):(o[e]=s.fromObject(t),n&&n(t,o[e]),r())}):void(e&&e(o))},groupSVGElements:function(t,e,i){var n;return n=new fabric.PathGroup(t,e),"undefined"!=typeof i&&n.setSourcePath(i),n},populateWithProperties:function(t,e,i){if(i&&"[object Array]"===Object.prototype.toString.call(i))for(var n=0,r=i.length;n<r;n++)i[n]in t&&(e[i[n]]=t[i[n]])},drawDashedLine:function(t,n,r,o,s,a){var c=o-n,l=s-r,u=e(c*c+l*l),h=i(l,c),f=a.length,d=0,p=!0;for(t.save(),t.translate(n,r),t.moveTo(0,0),t.rotate(h),n=0;u>n;)n+=a[d++%f],n>u&&(n=u),t[p?"lineTo":"moveTo"](n,0),p=!p;t.restore()},createCanvasElement:function(t){return t||(t=fabric.document.createElement("canvas")),t.getContext||"undefined"==typeof G_vmlCanvasManager||G_vmlCanvasManager.initElement(t),t},createImage:function(){return fabric.isLikelyNode?new(__webpack_require__(38).Image):fabric.document.createElement("img")},createAccessors:function(t){var e,i,n,r,o,s=t.prototype;for(e=s.stateProperties.length;e--;)i=s.stateProperties[e],n=i.charAt(0).toUpperCase()+i.slice(1),r="set"+n,o="get"+n,s[o]||(s[o]=function(t){return new Function('return this.get("'+t+'")')}(i)),s[r]||(s[r]=function(t){return new Function("value",'return this.set("'+t+'", value)')}(i))},clipContext:function(t,e){e.save(),e.beginPath(),t.clipTo(e),e.clip()},multiplyTransformMatrices:function(t,e,i){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],i?0:t[0]*e[4]+t[2]*e[5]+t[4],i?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var r=i(t[1],t[0]),s=n(t[0],2)+n(t[1],2),a=e(s),c=(t[0]*t[3]-t[2]*t[1])/a,l=i(t[0]*t[2]+t[1]*t[3],s);return{angle:r/o,scaleX:a,scaleY:c,skewX:l/o,skewY:0,translateX:t[4],translateY:t[5]}},customTransformMatrix:function(t,e,i){var n=[1,0,r(Math.tan(i*o)),1],s=[r(t),0,0,r(e)];return fabric.util.multiplyTransformMatrices(s,n,!0)},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.setAngle(0)},getFunctionBody:function(t){return(String(t).match(/function[^{]*\{([\s\S]*)\}/)||{})[1]},isTransparent:function(t,e,i,n){n>0&&(e>n?e-=n:e=0,i>n?i-=n:i=0);var r,o,s=!0,a=t.getImageData(e,i,2*n||1,2*n||1),c=a.data.length;for(r=3;r<c&&(o=a.data[r],s=o<=0,s!==!1);r+=4);return a=null,s},parsePreserveAspectRatioAttribute:function(t){var e,i="meet",n="Mid",r="Mid",o=t.split(" ");return o&&o.length&&(i=o.pop(),"meet"!==i&&"slice"!==i?(e=i,i="meet"):o.length&&(e=o.pop())),n="none"!==e?e.slice(1,4):"none",r="none"!==e?e.slice(5,8):"none",{meetOrSlice:i,alignX:n,alignY:r}},clearFabricFontCache:function(t){t?fabric.charWidthsCache[t]&&delete fabric.charWidthsCache[t]:fabric.charWidthsCache={}}}}(exports),function(){function t(t,n,o,s,c,l,u){var h=a.call(arguments);if(r[h])return r[h];var f=Math.PI,d=u*f/180,p=Math.sin(d),g=Math.cos(d),v=0,m=0;o=Math.abs(o),s=Math.abs(s);var b=-g*t*.5-p*n*.5,y=-g*n*.5+p*t*.5,_=o*o,x=s*s,w=y*y,S=b*b,C=_*x-_*w-x*S,k=0;if(C<0){var O=Math.sqrt(1-C/(_*x));o*=O,s*=O}else k=(c===l?-1:1)*Math.sqrt(C/(_*w+x*S));var T=k*o*y/s,E=-k*s*b/o,j=g*T-p*E+.5*t,M=p*T+g*E+.5*n,A=i(1,0,(b-T)/o,(y-E)/s),P=i((b-T)/o,(y-E)/s,(-b-T)/o,(-y-E)/s);0===l&&P>0?P-=2*f:1===l&&P<0&&(P+=2*f);for(var I=Math.ceil(Math.abs(P/f*2)),D=[],L=P/I,R=8/3*Math.sin(L/4)*Math.sin(L/4)/Math.sin(L/2),B=A+L,N=0;N<I;N++)D[N]=e(A,B,g,p,o,s,j,M,R,v,m),v=D[N][4],m=D[N][5],A=B,B+=L;return r[h]=D,D}function e(t,e,i,n,r,s,c,l,u,h,f){var d=a.call(arguments);if(o[d])return o[d];var p=Math.cos(t),g=Math.sin(t),v=Math.cos(e),m=Math.sin(e),b=i*r*v-n*s*m+c,y=n*r*v+i*s*m+l,_=h+u*(-i*r*g-n*s*p),x=f+u*(-n*r*g+i*s*p),w=b+u*(i*r*m+n*s*v),S=y+u*(n*r*m-i*s*v);return o[d]=[_,x,w,S,b,y],o[d]}function i(t,e,i,n){var r=Math.atan2(e,t),o=Math.atan2(n,i);return o>=r?o-r:2*Math.PI-(r-o)}function n(t,e,i,n,r,o,c,l){var u=a.call(arguments);if(s[u])return s[u];var h,f,d,p,g,v,m,b,y=Math.sqrt,_=Math.min,x=Math.max,w=Math.abs,S=[],C=[[],[]];f=6*t-12*i+6*r,h=-3*t+9*i-9*r+3*c,d=3*i-3*t;for(var k=0;k<2;++k)if(k>0&&(f=6*e-12*n+6*o,h=-3*e+9*n-9*o+3*l,d=3*n-3*e),w(h)<1e-12){if(w(f)<1e-12)continue;p=-d/f,0<p&&p<1&&S.push(p)}else m=f*f-4*d*h,m<0||(b=y(m),g=(-f+b)/(2*h),0<g&&g<1&&S.push(g),v=(-f-b)/(2*h),0<v&&v<1&&S.push(v));for(var O,T,E,j=S.length,M=j;j--;)p=S[j],E=1-p,O=E*E*E*t+3*E*E*p*i+3*E*p*p*r+p*p*p*c,C[0][j]=O,T=E*E*E*e+3*E*E*p*n+3*E*p*p*o+p*p*p*l,C[1][j]=T;C[0][M]=t,C[1][M]=e,C[0][M+1]=c,C[1][M+1]=l;var A=[{x:_.apply(null,C[0]),y:_.apply(null,C[1])},{x:x.apply(null,C[0]),y:x.apply(null,C[1])}];return s[u]=A,A}var r={},o={},s={},a=Array.prototype.join;fabric.util.drawArc=function(e,i,n,r){for(var o=r[0],s=r[1],a=r[2],c=r[3],l=r[4],u=r[5],h=r[6],f=[[],[],[],[]],d=t(u-i,h-n,o,s,c,l,a),p=0,g=d.length;p<g;p++)f[p][0]=d[p][0]+i,f[p][1]=d[p][1]+n,f[p][2]=d[p][2]+i,f[p][3]=d[p][3]+n,f[p][4]=d[p][4]+i,f[p][5]=d[p][5]+n,e.bezierCurveTo.apply(e,f[p])},fabric.util.getBoundsOfArc=function(e,i,r,o,s,a,c,l,u){for(var h,f=0,d=0,p=[],g=t(l-e,u-i,r,o,a,c,s),v=0,m=g.length;v<m;v++)h=n(f,d,g[v][0],g[v][1],g[v][2],g[v][3],g[v][4],g[v][5]),p.push({x:h[0].x+e,y:h[0].y+i}),p.push({x:h[1].x+e,y:h[1].y+i}),f=g[v][4],d=g[v][5];return p},fabric.util.getBoundsOfCurve=n}(),function(){function t(t,e){for(var i=o.call(arguments,2),n=[],r=0,s=t.length;r<s;r++)n[r]=i.length?t[r][e].apply(t[r],i):t[r][e].call(t[r]);return n}function e(t,e){return r(t,e,function(t,e){return t>=e})}function i(t,e){return r(t,e,function(t,e){return t<e})}function n(t,e){for(var i=t.length;i--;)t[i]=e;return t}function r(t,e,i){if(t&&0!==t.length){var n=t.length-1,r=e?t[n][e]:t[n];if(e)for(;n--;)i(t[n][e],r)&&(r=t[n][e]);else for(;n--;)i(t[n],r)&&(r=t[n]);return r}}var o=Array.prototype.slice;Array.prototype.indexOf||(Array.prototype.indexOf=function(t){if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if(0===i)return-1;var n=0;if(arguments.length>0&&(n=Number(arguments[1]),n!==n?n=0:0!==n&&n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&(n=(n>0||-1)*Math.floor(Math.abs(n)))),n>=i)return-1;for(var r=n>=0?n:Math.max(i-Math.abs(n),0);r<i;r++)if(r in e&&e[r]===t)return r;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){for(var i=0,n=this.length>>>0;i<n;i++)i in this&&t.call(e,this[i],i,this)}),Array.prototype.map||(Array.prototype.map=function(t,e){for(var i=[],n=0,r=this.length>>>0;n<r;n++)n in this&&(i[n]=t.call(e,this[n],n,this));return i}),Array.prototype.every||(Array.prototype.every=function(t,e){for(var i=0,n=this.length>>>0;i<n;i++)if(i in this&&!t.call(e,this[i],i,this))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t,e){for(var i=0,n=this.length>>>0;i<n;i++)if(i in this&&t.call(e,this[i],i,this))return!0;return!1}),Array.prototype.filter||(Array.prototype.filter=function(t,e){for(var i,n=[],r=0,o=this.length>>>0;r<o;r++)r in this&&(i=this[r],t.call(e,i,r,this)&&n.push(i));return n}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var e,i=this.length>>>0,n=0;if(arguments.length>1)e=arguments[1];else for(;;){if(n in this){e=this[n++];break}if(++n>=i)throw new TypeError}for(;n<i;n++)n in this&&(e=t.call(null,e,this[n],n,this));return e}),fabric.util.array={fill:n,invoke:t,min:i,max:e}}(),function(){function t(t,i,n){if(n)if(!fabric.isLikelyNode&&i instanceof Element)t=i;else if(i instanceof Array)t=i.map(function(t){return e(t,n)});else if(i instanceof Object)for(var r in i)t[r]=e(i[r],n);else t=i;else for(var r in i)t[r]=i[r];return t}function e(e,i){return t({},e,i)}fabric.util.object={extend:t,clone:e}}(),function(){function t(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})}function e(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())}function i(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")}),fabric.util.string={camelize:t,capitalize:e,escapeXml:i}}(),function(){var t=Array.prototype.slice,e=Function.prototype.apply,i=function(){};Function.prototype.bind||(Function.prototype.bind=function(n){var r,o=this,s=t.call(arguments,1);return r=s.length?function(){return e.call(o,this instanceof i?this:n,s.concat(t.call(arguments)))}:function(){return e.call(o,this instanceof i?this:n,arguments)},i.prototype=this.prototype,r.prototype=new i,r})}(),function(){function t(){}function e(t){var e=this.constructor.superclass.prototype[t];return arguments.length>1?e.apply(this,n.call(arguments,1)):e.call(this)}function i(){function i(){this.initialize.apply(this,arguments)}var o=null,a=n.call(arguments,0);"function"==typeof a[0]&&(o=a.shift()),i.superclass=o,i.subclasses=[],o&&(t.prototype=o.prototype,i.prototype=new t,o.subclasses.push(i));for(var c=0,l=a.length;c<l;c++)s(i,a[c],o);return i.prototype.initialize||(i.prototype.initialize=r),i.prototype.constructor=i,i.prototype.callSuper=e,i}var n=Array.prototype.slice,r=function(){},o=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),s=function(t,e,i){for(var n in e)n in t.prototype&&"function"==typeof t.prototype[n]&&(e[n]+"").indexOf("callSuper")>-1?t.prototype[n]=function(t){return function(){var n=this.constructor.superclass;this.constructor.superclass=i;var r=e[t].apply(this,arguments);if(this.constructor.superclass=n,"initialize"!==t)return r}}(n):t.prototype[n]=e[n],o&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};fabric.util.createClass=i}(),function(){function t(t){var e,i,n=Array.prototype.slice.call(arguments,1),r=n.length;for(i=0;i<r;i++)if(e=typeof t[n[i]],!/^(?:function|object|unknown)$/.test(e))return!1;return!0}function e(t,e){return{handler:e,wrappedHandler:i(t,e)}}function i(t,e){return function(i){e.call(s(t),i||fabric.window.event)}}function n(t,e){return function(i){if(g[t]&&g[t][e])for(var n=g[t][e],r=0,o=n.length;r<o;r++)n[r].call(this,i||fabric.window.event)}}function r(t){t||(t=fabric.window.event);var e=t.target||(typeof t.srcElement!==c?t.srcElement:null),i=fabric.util.getScrollLeftTop(e);return{x:v(t)+i.left,y:m(t)+i.top}}function o(t,e,i){var n="touchend"===t.type?"changedTouches":"touches";return t[n]&&t[n][0]?t[n][0][e]-(t[n][0][e]-t[n][0][i])||t[i]:t[i]}var s,a,c="unknown",l=function(){var t=0;return function(e){return e.__uniqueID||(e.__uniqueID="uniqueID__"+t++)}}();!function(){var t={};s=function(e){return t[e]},a=function(e,i){t[e]=i}}();var u,h,f=t(fabric.document.documentElement,"addEventListener","removeEventListener")&&t(fabric.window,"addEventListener","removeEventListener"),d=t(fabric.document.documentElement,"attachEvent","detachEvent")&&t(fabric.window,"attachEvent","detachEvent"),p={},g={};f?(u=function(t,e,i){t.addEventListener(e,i,!1)},h=function(t,e,i){t.removeEventListener(e,i,!1)}):d?(u=function(t,i,n){var r=l(t);a(r,t),p[r]||(p[r]={}),p[r][i]||(p[r][i]=[]);var o=e(r,n);p[r][i].push(o),t.attachEvent("on"+i,o.wrappedHandler)},h=function(t,e,i){var n,r=l(t);if(p[r]&&p[r][e])for(var o=0,s=p[r][e].length;o<s;o++)n=p[r][e][o],n&&n.handler===i&&(t.detachEvent("on"+e,n.wrappedHandler),p[r][e][o]=null)}):(u=function(t,e,i){var r=l(t);if(g[r]||(g[r]={}),!g[r][e]){g[r][e]=[];var o=t["on"+e];o&&g[r][e].push(o),t["on"+e]=n(r,e)}g[r][e].push(i)},h=function(t,e,i){var n=l(t);if(g[n]&&g[n][e])for(var r=g[n][e],o=0,s=r.length;o<s;o++)r[o]===i&&r.splice(o,1)}),fabric.util.addListener=u,fabric.util.removeListener=h;var v=function(t){return typeof t.clientX!==c?t.clientX:0},m=function(t){return typeof t.clientY!==c?t.clientY:0};fabric.isTouchSupported&&(v=function(t){return o(t,"pageX","clientX")},m=function(t){return o(t,"pageY","clientY")}),fabric.util.getPointer=r,fabric.util.object.extend(fabric.util,fabric.Observable)}(),function(){function t(t,e){var i=t.style;if(!i)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?o(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var n in e)if("opacity"===n)o(t,e[n]);else{var r="float"===n||"cssFloat"===n?"undefined"==typeof i.styleFloat?"cssFloat":"styleFloat":n;i[r]=e[n]}return t}var e=fabric.document.createElement("div"),i="string"==typeof e.style.opacity,n="string"==typeof e.style.filter,r=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,o=function(t){return t};i?o=function(t,e){return t.style.opacity=e,t}:n&&(o=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),r.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(r,e)):i.filter+=" alpha(opacity="+100*e+")",t}),fabric.util.setStyle=t}(),function(){function t(t){return"string"==typeof t?fabric.document.getElementById(t):t}function e(t,e){var i=fabric.document.createElement(t);for(var n in e)"class"===n?i.className=e[n]:"for"===n?i.htmlFor=e[n]:i.setAttribute(n,e[n]);return i}function i(t,e){t&&(" "+t.className+" ").indexOf(" "+e+" ")===-1&&(t.className+=(t.className?" ":"")+e)}function n(t,i,n){return"string"==typeof i&&(i=e(i,n)),t.parentNode&&t.parentNode.replaceChild(i,t),i.appendChild(t),i}function r(t){for(var e=0,i=0,n=fabric.document.documentElement,r=fabric.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&(t=t.parentNode||t.host,t===fabric.document?(e=r.scrollLeft||n.scrollLeft||0,i=r.scrollTop||n.scrollTop||0):(e+=t.scrollLeft||0,i+=t.scrollTop||0),1!==t.nodeType||"fixed"!==fabric.util.getElementStyle(t,"position")););return{left:e,top:i}}function o(t){var e,i,n=t&&t.ownerDocument,o={left:0,top:0},s={left:0,top:0},a={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!n)return s;for(var c in a)s[a[c]]+=parseInt(l(t,c),10)||0;return e=n.documentElement,"undefined"!=typeof t.getBoundingClientRect&&(o=t.getBoundingClientRect()),i=r(t),{left:o.left+i.left-(e.clientLeft||0)+s.left,top:o.top+i.top-(e.clientTop||0)+s.top}}var s,a=Array.prototype.slice,c=function(t){return a.call(t,0)};try{s=c(fabric.document.childNodes)instanceof Array}catch(t){}s||(c=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e});var l;l=fabric.document.defaultView&&fabric.document.defaultView.getComputedStyle?function(t,e){var i=fabric.document.defaultView.getComputedStyle(t,null);return i?i[e]:void 0}:function(t,e){var i=t.style[e];return!i&&t.currentStyle&&(i=t.currentStyle[e]),i},function(){function t(t){return"undefined"!=typeof t.onselectstart&&(t.onselectstart=fabric.util.falseFunction),n?t.style[n]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t}function e(t){return"undefined"!=typeof t.onselectstart&&(t.onselectstart=null),n?t.style[n]="":"string"==typeof t.unselectable&&(t.unselectable=""),t}var i=fabric.document.documentElement.style,n="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"";fabric.util.makeElementUnselectable=t,fabric.util.makeElementSelectable=e}(),function(){function t(t,e){var i=fabric.document.getElementsByTagName("head")[0],n=fabric.document.createElement("script"),r=!0;n.onload=n.onreadystatechange=function(t){if(r){if("string"==typeof this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)return;r=!1,e(t||fabric.window.event),n=n.onload=n.onreadystatechange=null}},n.src=t,i.appendChild(n)}fabric.util.getScript=t}(),fabric.util.getById=t,fabric.util.toArray=c,fabric.util.makeElement=e,fabric.util.addClass=i,fabric.util.wrapElement=n,fabric.util.getScrollLeftTop=r,fabric.util.getElementOffset=o,fabric.util.getElementStyle=l}(),function(){function t(t,e){return t+(/\?/.test(t)?"&":"?")+e}function e(){}function i(i,r){r||(r={});var o=r.method?r.method.toUpperCase():"GET",s=r.onComplete||function(){},a=n(),c=r.body||r.parameters;return a.onreadystatechange=function(){4===a.readyState&&(s(a),a.onreadystatechange=e)},"GET"===o&&(c=null,"string"==typeof r.parameters&&(i=t(i,r.parameters))),a.open(o,i,!0),"POST"!==o&&"PUT"!==o||a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(c),a}var n=function(){for(var t=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")},function(){return new XMLHttpRequest}],e=t.length;e--;)try{var i=t[e]();if(i)return t[e]}catch(t){}}();fabric.util.request=i}(),function(){var t=t||{};t.scope={},t.owns=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},t.ASSUME_ES5=!1,t.ASSUME_NO_NATIVE_MAP=!1,t.ASSUME_NO_NATIVE_SET=!1,t.defineProperty=t.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,i){t!=Array.prototype&&t!=Object.prototype&&(t[e]=i.value)},t.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:"undefined"!=typeof global&&null!=global?global:t},t.global=t.getGlobal(this),t.polyfill=function(e,i,n,r){if(i){for(n=t.global,e=e.split("."),r=0;r<e.length-1;r++){var o=e[r];o in n||(n[o]={}),n=n[o]}e=e[e.length-1],r=n[e],i=i(r),i!=r&&null!=i&&t.defineProperty(n,e,{configurable:!0,writable:!0,value:i})}},t.polyfill("Object.assign",function(e){return e?e:function(e,i){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var o in r)t.owns(r,o)&&(e[o]=r[o])}return e}},"es6-impl","es3"),t.SYMBOL_PREFIX="jscomp_symbol_",t.initSymbol=function(){t.initSymbol=function(){},t.global.Symbol||(t.global.Symbol=t.Symbol)},t.symbolCounter_=0,t.Symbol=function(e){return t.SYMBOL_PREFIX+(e||"")+t.symbolCounter_++},t.initSymbolIterator=function(){t.initSymbol();var e=t.global.Symbol.iterator;e||(e=t.global.Symbol.iterator=t.global.Symbol("iterator")),"function"!=typeof Array.prototype[e]&&t.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return t.arrayIterator(this)}}),t.initSymbolIterator=function(){}},t.arrayIterator=function(e){var i=0;return t.iteratorPrototype(function(){return i<e.length?{done:!1,value:e[i++]}:{done:!0}})},t.iteratorPrototype=function(e){return t.initSymbolIterator(),e={next:e},e[t.global.Symbol.iterator]=function(){return this},e},t.polyfill("Array.from",function(e){return e?e:function(e,i,n){t.initSymbolIterator(),i=null!=i?i:function(t){return t};var r=[],o=e[Symbol.iterator];if("function"==typeof o)for(e=o.call(e);!(o=e.next()).done;)r.push(i.call(n,o.value));else for(var o=e.length,s=0;s<o;s++)r.push(i.call(n,e[s]));return r}},"es6-impl","es3"),t.iteratorFromArray=function(e,i){t.initSymbolIterator(),e instanceof String&&(e+="");var n=0,r={next:function(){if(n<e.length){var t=n++;return{value:i(t,e[t]),done:!1}}return r.next=function(){return{done:!0,value:void 0}},r.next()}};return r[Symbol.iterator]=function(){return r},r},t.polyfill("Array.prototype.keys",function(e){return e?e:function(){return t.iteratorFromArray(this,function(t){return t})}},"es6-impl","es3"),t.polyfill("Object.is",function(t){return t?t:function(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e;
}},"es6-impl","es3"),t.polyfill("Array.prototype.includes",function(t){return t?t:function(t,e){var i=this;i instanceof String&&(i=String(i));var n=i.length;for(e=e||0;e<n;e++)if(i[e]==t||Object.is(i[e],t))return!0;return!1}},"es7","es3"),t.checkStringArgs=function(t,e,i){if(null==t)throw new TypeError("The 'this' value for String.prototype."+i+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+i+" must not be a regular expression");return t+""},t.polyfill("String.prototype.includes",function(e){return e?e:function(e,i){return-1!==t.checkStringArgs(this,e,"includes").indexOf(e,i||0)}},"es6-impl","es3"),t.polyfill("Array.prototype.fill",function(t){return t?t:function(t,e,i){var n=this.length||0;for(0>e&&(e=Math.max(0,n+e)),(null==i||i>n)&&(i=n),i=Number(i),0>i&&(i=Math.max(0,n+i)),e=Number(e||0);e<i;e++)this[e]=t;return this}},"es6-impl","es3"),function(){function t(t,i){var n=[];for(t=t[i];t&&9!==t.nodeType;)1===t.nodeType&&n.push(e(t)),t=t[i];return n}function e(i){return{el:i,getClass:function(){return this.el.getAttribute("class")||""},getClasses:function(){return this.getClass().split(" ").map(function(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}).filter(function(t){return 0<t.length})},prevAll:function(){return t(this.el,"previousSibling")},nextAll:function(){return t(this.el,"nextSibling")},parent:function(){return this.el.parentNode&&11!==this.el.parentNode.nodeType?e(this.el.parentNode):null}}}function i(t){return"string"==typeof t&&null!==t.match(/^[a-zA-Z0-9]+$/gi)&&t}function n(t){return"string"==typeof t&&null!==t.match(/^\.?[a-zA-Z_\-:0-9]*$/gi)&&t}function r(t){var e="undefined"==typeof t?"undefined":D(t);return!!t&&("object"==e||"function"==e)}function o(t){if("number"==typeof t)return t;var e=t;return"symbol"==("undefined"==typeof e?"undefined":D(e))||e&&"object"==("undefined"==typeof e?"undefined":D(e))&&"[object Symbol]"==Y.call(e)?F:(r(t)&&(t="function"==typeof t.valueOf?t.valueOf():t,t=r(t)?t+"":t),"string"!=typeof t?0===t?t:+t:(t=t.replace(z,""),(e=X.test(t))||U.test(t)?H(t.slice(2),e?2:8):W.test(t)?F:+t))}function s(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function a(t,e){var i;if(i=!(!t||!t.length)){t:if(e!==e)e:{e=c,i=t.length;for(var n=-1;++n<i;)if(e(t[n],n,t)){t=n;break e}t=-1}else{for(i=-1,n=t.length;++i<n;)if(t[i]===e){t=i;break t}t=-1}i=-1<t}return i}function c(t){return t!==t}function l(t,e){return t.has(e)}function u(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function h(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function f(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function d(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function p(t){var e=-1,i=t?t.length:0;for(this.__data__=new d;++e<i;)this.add(t[e])}function g(t,e){for(var i=t.length;i--;){var n=t[i][0];if(n===e||n!==n&&e!==e)return i}return-1}function v(t,e,i,n,r){var o=-1,s=t.length;for(i||(i=y),r||(r=[]);++o<s;){var a=t[o];if(0<e&&i(a))if(1<e)v(a,e-1,i,n,r);else for(var c=r,l=-1,u=a.length,h=c.length;++l<u;)c[h+l]=a[l];else n||(r[r.length]=a)}return r}function m(t,e){t=t.__data__;var i="undefined"==typeof e?"undefined":D(e);return("string"==i||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==e:null===e)?t["string"==typeof e?"string":"hash"]:t.map}function b(t,e){return t=null==t?void 0:t[e],e=!(!S(t)||tt&&tt in t)&&(w(t)||u(t)?rt:q).test(_(t)),e?t:void 0}function y(t){var e;return(e=ht(t))||(e=x(t)&&it.call(t,"callee")&&(!ot.call(t,"callee")||"[object Arguments]"==nt.call(t))),e||!!(at&&t&&t[at])}function _(t){if(null!=t){try{return et.call(t)}catch(t){}return t+""}return""}function x(t){var e;return(e=!!t&&"object"==("undefined"==typeof t?"undefined":D(t)))&&((e=null!=t)&&(e=t.length,e="number"==typeof e&&-1<e&&0==e%1&&9007199254740991>=e),e=e&&!w(t)),e}function w(t){return t=S(t)?nt.call(t):"","[object Function]"==t||"[object GeneratorFunction]"==t}function S(t){var e="undefined"==typeof t?"undefined":D(t);return!!t&&("object"==e||"function"==e)}function C(t,e){return 0<ft(t.getClasses(),dt(e,function(t){return t.getClasses()})).length||!pt(e).includes(t.el.nodeName)}function k(t){var e="undefined"==typeof t?"undefined":D(t);return!!t&&("object"==e||"function"==e)}function O(t){if("number"==typeof t)return t;var e=t;return"symbol"==("undefined"==typeof e?"undefined":D(e))||e&&"object"==("undefined"==typeof e?"undefined":D(e))&&"[object Symbol]"==Ct.call(e)?bt:(k(t)&&(t="function"==typeof t.valueOf?t.valueOf():t,t=k(t)?t+"":t),"string"!=typeof t?0===t?t:+t:(t=t.replace(yt,""),(e=xt.test(t))||wt.test(t)?St(t.slice(2),e?2:8):_t.test(t)?bt:+t))}function T(t){var e=t.getMethods();return{finished:function(){return 0===e.length},next:function(){return!this.finished()&&e.shift().apply(void 0,arguments)}}}function E(t,e){if(0>=e)throw Error("Simmer: An invalid depth of "+e+" has been specified");return Array(e-1).fill().reduce(function(t,e){return t[t.length-1].parent()&&(e=t[t.length-1].parent(),t.push(e)),t},[t])}function j(){return L({},Et,0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}function M(){function t(t,e){if(!0===r.errorHandling)throw t;"function"==typeof r.errorHandling&&r.errorHandling(t,e)}var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:window,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=j(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}),o=n||I(i,r.queryEngine),n=function i(n){if(!n)return t.call(i,Error("Simmer: No element was specified for parsing."),n),!1;for(var s=new T(vt),a=E(e(n),r.depth),c={stack:Array(a.length).fill().map(function(){return[]}),specificity:0},l=Tt(n,r,o,t);!s.finished()&&!c.verified;)try{c=s.next(a,c,l,r,o),c.specificity>=r.specificityThreshold&&!c.verified&&(c.verified=l(c))}catch(e){t.call(i,e,n)}return(void 0===c.verified||c.specificity<r.specificityThreshold)&&(c.verified=l(c)),!!c.verified&&(c.verificationDepth?Ot(c,c.verificationDepth):Ot(c))};return n.configure=function(){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:i,e=j(L({},r,0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}));return M(t,e,I(t,e.queryEngine))},n}var A={querySelectorAll:function(){throw Error("An invalid context has been provided to Simmer, it doesnt know how to query it")}},P=function(t){var e="function"==typeof t.querySelectorAll?t:t.document?t.document:A;return function(t,i){try{return e.querySelectorAll(t)}catch(t){i(t)}}},I=function(t,e){var i="function"==typeof e?e:P(t);return function(e,n){return"string"!=typeof e?[]:i(e,n,t)}},D="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},L=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i,n=arguments[e];for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},R=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t)){var i=[],n=!0,r=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){r=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}return i}throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),B=function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)},N=1/0,F=NaN,z=/^\s+|\s+$/g,W=/^[-+]0x[0-9a-f]+$/i,X=/^0b[01]+$/i,U=/^0o[0-7]+$/i,H=parseInt,Y=Object.prototype.toString,G=function(t,e,i){if(!t||!t.length)return[];i||void 0===e?i=1:((i=e)?(i=o(i),i=i===N||i===-N?1.7976931348623157e308*(0>i?-1:1):i===i?i:0):i=0===i?i:0,e=i%1,i=i===i?e?i-e:i:0),e=i,i=0;var n=0>e?0:e;e=-1;var r=t.length;for(0>i&&(i=-i>r?0:r+i),n=n>r?r:n,0>n&&(n+=r),r=i>n?0:n-i>>>0,i>>>=0,n=Array(r);++e<r;)n[e]=t[e+i];return n},V="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},q=/^\[object .+?Constructor\]$/,Z="object"==D(V)&&V&&V.Object===Object&&V,K="object"==("undefined"==typeof self?"undefined":D(self))&&self&&self.Object===Object&&self,Z=Z||K||Function("return this")(),K=Array.prototype,J=Function.prototype,$=Object.prototype,Q=Z["__core-js_shared__"],tt=function(){var t=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),et=J.toString,it=$.hasOwnProperty,nt=$.toString,rt=RegExp("^"+et.call(it).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),J=Z.Symbol,ot=$.propertyIsEnumerable,st=K.splice,at=J?J.isConcatSpreadable:void 0,ct=Math.max,lt=b(Z,"Map"),ut=b(Object,"create");h.prototype.clear=function(){this.__data__=ut?ut(null):{}},h.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},h.prototype.get=function(t){var e=this.__data__;return ut?(t=e[t],"__lodash_hash_undefined__"===t?void 0:t):it.call(e,t)?e[t]:void 0},h.prototype.has=function(t){var e=this.__data__;return ut?void 0!==e[t]:it.call(e,t)},h.prototype.set=function(t,e){return this.__data__[t]=ut&&void 0===e?"__lodash_hash_undefined__":e,this},f.prototype.clear=function(){this.__data__=[]},f.prototype.delete=function(t){var e=this.__data__;return t=g(e,t),!(0>t)&&(t==e.length-1?e.pop():st.call(e,t,1),!0)},f.prototype.get=function(t){var e=this.__data__;return t=g(e,t),0>t?void 0:e[t][1]},f.prototype.has=function(t){return-1<g(this.__data__,t)},f.prototype.set=function(t,e){var i=this.__data__,n=g(i,t);return 0>n?i.push([t,e]):i[n][1]=e,this},d.prototype.clear=function(){this.__data__={hash:new h,map:new(lt||f),string:new h}},d.prototype.delete=function(t){return m(this,t).delete(t)},d.prototype.get=function(t){return m(this,t).get(t)},d.prototype.has=function(t){return m(this,t).has(t)},d.prototype.set=function(t,e){return m(this,t).set(t,e),this},p.prototype.add=p.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},p.prototype.has=function(t){return this.__data__.has(t)};var Z=function(t,e){return e=ct(void 0===e?t.length-1:e,0),function(){for(var i=arguments,n=-1,r=ct(i.length-e,0),o=Array(r);++n<r;)o[n]=i[e+n];for(n=-1,r=Array(e+1);++n<e;)r[n]=i[n];return r[e]=o,s(t,this,r)}}(function(t,e){if(x(t)){e=v(e,1,x,!0);var i=-1,n=a,r=!0,o=t.length,s=[],c=e.length;if(o)t:for(200<=e.length&&(n=l,r=!1,e=new p(e));++i<o;){var u=t[i],h=u,u=0!==u?u:0;if(r&&h===h){for(var f=c;f--;)if(e[f]===h)continue t;s.push(u)}else n(e,h,void 0)||s.push(u)}t=s}else t=[];return t}),ht=Array.isArray,ft=Z,dt=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){function i(t,e){for(var i=-1,n=t?t.length:0,r=Array(n);++i<n;)r[i]=e(t[i],i,t);return r}function n(t,e){for(var i=-1,n=t?t.length:0;++i<n;)if(e(t[i],i,t))return!0;return!1}function r(t){return function(e){return null==e?void 0:e[t]}}function o(t){return function(e){return t(e)}}function s(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function a(t){var e=-1,i=Array(t.size);return t.forEach(function(t,n){i[++e]=[n,t]}),i}function c(t){var e=-1,i=Array(t.size);return t.forEach(function(t){i[++e]=t}),i}function l(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function u(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function h(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function f(t){var e=-1,i=t?t.length:0;for(this.__data__=new h;++e<i;)this.add(t[e])}function d(t){this.__data__=new u(t)}function p(t,e){for(var i=t.length;i--;)if(F(t[i][0],e))return i;return-1}function g(t,e,i,n,r){var o=-1,s=t.length;for(i||(i=A),r||(r=[]);++o<s;){var a=t[o];if(0<e&&i(a))if(1<e)g(a,e-1,i,n,r);else for(var c=r,l=-1,u=a.length,h=c.length;++l<u;)c[h+l]=a[l];else n||(r[r.length]=a)}return r}function v(t,e){e=I(e,t)?[e]:k(e);for(var i=0,n=e.length;null!=t&&i<n;)t=t[R(e[i++])];return i&&i==n?t:void 0}function m(t,e,i,n,r){if(t===e)return!0;if(null==t||null==e||!H(t)&&!Y(e))return t!==t&&e!==e;t:{var o=Gt(t),a=Gt(e),c="[object Array]",l="[object Array]";o||(c=Ht(t),c="[object Arguments]"==c?"[object Object]":c),a||(l=Ht(e),l="[object Arguments]"==l?"[object Object]":l);var u="[object Object]"==c&&!s(t),a="[object Object]"==l&&!s(e);if((l=c==l)&&!u)r||(r=new d),e=o||Vt(t)?O(t,e,m,i,n,r):T(t,e,c,m,i,n,r);else{if(!(2&n)&&(o=u&&yt.call(t,"__wrapped__"),c=a&&yt.call(e,"__wrapped__"),o||c)){t=o?t.value():t,e=c?e.value():e,r||(r=new d),e=m(t,e,i,n,r);break t}if(l){r||(r=new d);e:{var h,o=2&n,c=q(t),a=c.length,l=q(e).length;if(a==l||o){for(u=a;u--;){var f=c[u];if(!(o?f in e:yt.call(e,f))){e=!1;break e}}if((l=r.get(t))&&r.get(e))e=l==e;else{l=!0,r.set(t,e),r.set(e,t);for(var p=o;++u<a;){f=c[u];var g=t[f],v=e[f];if(i&&(h=o?i(v,g,f,e,t,r):i(g,v,f,t,e,r)),void 0===h?g!==v&&!m(g,v,i,n,r):!h){l=!1;break}p||(p="constructor"==f)}l&&!p&&(i=t.constructor,n=e.constructor,i!=n&&"constructor"in t&&"constructor"in e&&!("function"==typeof i&&i instanceof i&&"function"==typeof n&&n instanceof n)&&(l=!1)),r.delete(t),r.delete(e),e=l}}else e=!1}}else e=!1}}return e}function b(t,e,i,n){var r,o=i.length,s=o,a=!n;if(null==t)return!s;for(t=Object(t);o--;){var c=i[o];if(a&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<s;){c=i[o];var l=c[0],u=t[l],h=c[1];if(a&&c[2]){if(void 0===u&&!(l in t))return!1}else if(c=new d,n&&(r=n(u,h,l,t,e,c)),void 0===r?!m(h,u,n,3,c):!r)return!1}return!0}function y(t){return Y(t)&&U(t.length)&&!!rt[_t.call(t)]}function _(t,e){var i=-1,n=W(t)?Array(t.length):[];return Xt(t,function(t,r,o){n[++i]=e(t,r,o)}),n}function x(t){var e=j(t);return 1==e.length&&e[0][2]?L(e[0][0],e[0][1]):function(i){return i===t||b(i,t,e)}}function w(t,e){return I(t)&&e===e&&!H(e)?L(R(t),e):function(i){var n=null==i?void 0:v(i,t);if(n=void 0===n?void 0:n,void 0===n&&n===e){if(n=null!=i){n=t,n=I(n,i)?[n]:k(n);for(var r,o=-1,s=n.length;++o<s;){var a=R(n[o]);if(!(r=null!=i&&null!=i&&a in Object(i)))break;i=i[a]}r?n=r:(s=i?i.length:0,n=!!s&&U(s)&&P(a,s)&&(Gt(i)||z(i)))}a=n}else a=m(e,n,void 0,3);return a}}function S(t){return function(e){return v(e,t)}}function C(t){if("string"==typeof t)return t;if(G(t))return Wt?Wt.call(t):"";var e=t+"";return"0"==e&&1/t==-K?"-0":e}function k(t){return Gt(t)?t:Yt(t)}function O(t,e,i,r,o,s){var a,c=2&o,l=t.length,u=e.length;if(l!=u&&!(c&&u>l))return!1;if((u=s.get(t))&&s.get(e))return u==e;var u=-1,h=!0,d=1&o?new f:void 0;for(s.set(t,e),s.set(e,t);++u<l;){var p=t[u],g=e[u];if(r&&(a=c?r(g,p,u,e,t,s):r(p,g,u,t,e,s)),void 0!==a){if(a)continue;h=!1;break}if(d){if(!n(e,function(t,e){if(!d.has(e)&&(p===t||i(p,t,r,o,s)))return d.add(e)})){h=!1;break}}else if(p!==g&&!i(p,g,r,o,s)){h=!1;break}}return s.delete(t),s.delete(e),h}function T(t,e,i,n,r,o,s){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!n(new St(t),new St(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return F(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var l=a;case"[object Set]":if(l||(l=c),t.size!=e.size&&!(2&o))break;return(i=s.get(t))?i==e:(o|=1,s.set(t,e),e=O(l(t),l(e),n,r,o,s),s.delete(t),e);case"[object Symbol]":if(zt)return zt.call(t)==zt.call(e)}return!1}function E(t,e){t=t.__data__;var i="undefined"==typeof e?"undefined":D(e);return("string"==i||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==e:null===e)?t["string"==typeof e?"string":"hash"]:t.map}function j(t){for(var e=q(t),i=e.length;i--;){var n=e[i],r=t[n];e[i]=[n,r,r===r&&!H(r)]}return e}function M(t,e){return t=null==t?void 0:t[e],e=!(!H(t)||mt&&mt in t)&&(X(t)||s(t)?xt:it).test(B(t)),e?t:void 0}function A(t){return Gt(t)||z(t)||!!(Ot&&t&&t[Ot])}function P(t,e){return e=null==e?9007199254740991:e,!!e&&("number"==typeof t||nt.test(t))&&-1<t&&0==t%1&&t<e}function I(t,e){if(Gt(t))return!1;var i="undefined"==typeof t?"undefined":D(t);return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!G(t))||($.test(t)||!J.test(t)||null!=e&&t in Object(e))}function L(t,e){return function(i){return null!=i&&(i[t]===e&&(void 0!==e||t in Object(i)))}}function R(t){if("string"==typeof t||G(t))return t;var e=t+"";return"0"==e&&1/t==-K?"-0":e}function B(t){if(null!=t){try{return bt.call(t)}catch(t){}return t+""}return""}function N(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var i=function i(){var n=arguments,r=e?e.apply(this,n):n[0],o=i.cache;return o.has(r)?o.get(r):(n=t.apply(this,n),i.cache=o.set(r,n),n)};return i.cache=new(N.Cache||h),i}function F(t,e){return t===e||t!==t&&e!==e}function z(t){return Y(t)&&W(t)&&yt.call(t,"callee")&&(!Ct.call(t,"callee")||"[object Arguments]"==_t.call(t))}function W(t){return null!=t&&U(t.length)&&!X(t)}function X(t){return t=H(t)?_t.call(t):"","[object Function]"==t||"[object GeneratorFunction]"==t}function U(t){return"number"==typeof t&&-1<t&&0==t%1&&9007199254740991>=t}function H(t){var e="undefined"==typeof t?"undefined":D(t);return!!t&&("object"==e||"function"==e)}function Y(t){return!!t&&"object"==("undefined"==typeof t?"undefined":D(t))}function G(t){return"symbol"==("undefined"==typeof t?"undefined":D(t))||Y(t)&&"[object Symbol]"==_t.call(t)}function q(t){if(W(t)){if(Gt(t)||z(t)){for(var e=t.length,i=String,n=-1,r=Array(e);++n<e;)r[n]=i(n);e=r}else e=[];var i=e.length,n=!!i;for(o in t)!yt.call(t,o)||n&&("length"==o||P(o,i))||e.push(o);t=e}else{var o=t&&t.constructor;if(t===("function"==typeof o&&o.prototype||gt)){o=[];for(e in Object(t))yt.call(t,e)&&"constructor"!=e&&o.push(e);t=o}else t=Tt(t)}return t}function Z(t){return t}var K=1/0,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$=/^\w*$/,Q=/^\./,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/\\(\\)?/g,it=/^\[object .+?Constructor\]$/,nt=/^(?:0|[1-9]\d*)$/,rt={};rt["[object Float32Array]"]=rt["[object Float64Array]"]=rt["[object Int8Array]"]=rt["[object Int16Array]"]=rt["[object Int32Array]"]=rt["[object Uint8Array]"]=rt["[object Uint8ClampedArray]"]=rt["[object Uint16Array]"]=rt["[object Uint32Array]"]=!0,rt["[object Arguments]"]=rt["[object Array]"]=rt["[object ArrayBuffer]"]=rt["[object Boolean]"]=rt["[object DataView]"]=rt["[object Date]"]=rt["[object Error]"]=rt["[object Function]"]=rt["[object Map]"]=rt["[object Number]"]=rt["[object Object]"]=rt["[object RegExp]"]=rt["[object Set]"]=rt["[object String]"]=rt["[object WeakMap]"]=!1;var ot="object"==D(V)&&V&&V.Object===Object&&V,st="object"==("undefined"==typeof self?"undefined":D(self))&&self&&self.Object===Object&&self,at=ot||st||Function("return this")(),ct=e&&!e.nodeType&&e,lt=ct&&!0&&t&&!t.nodeType&&t,ut=lt&&lt.exports===ct&&ot.process;t:{try{var ht=ut&&ut.binding("util");break t}catch(t){}ht=void 0}var ft=ht&&ht.isTypedArray,dt=Array.prototype,pt=Function.prototype,gt=Object.prototype,vt=at["__core-js_shared__"],mt=function(){var t=/[^.]+$/.exec(vt&&vt.keys&&vt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),bt=pt.toString,yt=gt.hasOwnProperty,_t=gt.toString,xt=RegExp("^"+bt.call(yt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wt=at.Symbol,St=at.Uint8Array,Ct=gt.propertyIsEnumerable,kt=dt.splice,Ot=wt?wt.isConcatSpreadable:void 0,Tt=function(t,e){return function(i){return t(e(i))}}(Object.keys,Object),Et=M(at,"DataView"),jt=M(at,"Map"),Mt=M(at,"Promise"),At=M(at,"Set"),Pt=M(at,"WeakMap"),It=M(Object,"create"),Dt=B(Et),Lt=B(jt),Rt=B(Mt),Bt=B(At),Nt=B(Pt),Ft=wt?wt.prototype:void 0,zt=Ft?Ft.valueOf:void 0,Wt=Ft?Ft.toString:void 0;l.prototype.clear=function(){this.__data__=It?It(null):{}},l.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},l.prototype.get=function(t){var e=this.__data__;return It?(t=e[t],"__lodash_hash_undefined__"===t?void 0:t):yt.call(e,t)?e[t]:void 0},l.prototype.has=function(t){var e=this.__data__;return It?void 0!==e[t]:yt.call(e,t)},l.prototype.set=function(t,e){return this.__data__[t]=It&&void 0===e?"__lodash_hash_undefined__":e,this},u.prototype.clear=function(){this.__data__=[]},u.prototype.delete=function(t){var e=this.__data__;return t=p(e,t),!(0>t)&&(t==e.length-1?e.pop():kt.call(e,t,1),!0)},u.prototype.get=function(t){var e=this.__data__;return t=p(e,t),0>t?void 0:e[t][1]},u.prototype.has=function(t){return-1<p(this.__data__,t)},u.prototype.set=function(t,e){var i=this.__data__,n=p(i,t);return 0>n?i.push([t,e]):i[n][1]=e,this},h.prototype.clear=function(){this.__data__={hash:new l,map:new(jt||u),string:new l}},h.prototype.delete=function(t){return E(this,t).delete(t)},h.prototype.get=function(t){return E(this,t).get(t)},h.prototype.has=function(t){return E(this,t).has(t)},h.prototype.set=function(t,e){return E(this,t).set(t,e),this},f.prototype.add=f.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},f.prototype.has=function(t){return this.__data__.has(t)},d.prototype.clear=function(){this.__data__=new u},d.prototype.delete=function(t){return this.__data__.delete(t)},d.prototype.get=function(t){return this.__data__.get(t)},d.prototype.has=function(t){return this.__data__.has(t)},d.prototype.set=function(t,e){var i=this.__data__;if(i instanceof u){if(i=i.__data__,!jt||199>i.length)return i.push([t,e]),this;i=this.__data__=new h(i)}return i.set(t,e),this};var Xt=function(t,e){return function(i,n){if(null==i)return i;if(!W(i))return t(i,n);for(var r=i.length,o=e?r:-1,s=Object(i);(e?o--:++o<r)&&!1!==n(s[o],o,s););return i}}(function(t,e){return t&&Ut(t,e,q)}),Ut=function(t){return function(e,i,n){var r=-1,o=Object(e);n=n(e);for(var s=n.length;s--;){var a=n[t?s:++r];if(!1===i(o[a],a,o))break}return e}}(),Ht=function(t){return _t.call(t)};(Et&&"[object DataView]"!=Ht(new Et(new ArrayBuffer(1)))||jt&&"[object Map]"!=Ht(new jt)||Mt&&"[object Promise]"!=Ht(Mt.resolve())||At&&"[object Set]"!=Ht(new At)||Pt&&"[object WeakMap]"!=Ht(new Pt))&&(Ht=function(t){var e=_t.call(t);if(t=(t="[object Object]"==e?t.constructor:void 0)?B(t):void 0)switch(t){case Dt:return"[object DataView]";case Lt:return"[object Map]";case Rt:return"[object Promise]";case Bt:return"[object Set]";case Nt:return"[object WeakMap]"}return e});var Yt=N(function(t){t=null==t?"":C(t);var e=[];return Q.test(t)&&e.push(""),t.replace(tt,function(t,i,n,r){e.push(n?r.replace(et,"$1"):i||t)}),e});N.Cache=h;var Gt=Array.isArray,Vt=ft?o(ft):y;t.exports=function(t,e){var n=Gt(t)?i:_;return e="function"==typeof e?e:null==e?Z:"object"==("undefined"==typeof e?"undefined":D(e))?Gt(e)?w(e[0],e[1]):x(e):I(e)?r(R(e)):S(e),t=n(t,e),g(t,1)}}),pt=function(t){return t.map(function(t){return t.el.nodeName})},gt={A:function(t,e){return(e=e.el.getAttribute("href"))&&(t.stack[0].push('A[href="'+e+'"]'),t.specificity+=10),t},IMG:function(t,e){return(e=e.el.getAttribute("src"))&&(t.stack[0].push('IMG[src="'+e+'"]'),t.specificity+=10),t}},vt={methods:[],getMethods:function(){return this.methods.slice(0)},addMethod:function(t){this.methods.push(t)}};vt.addMethod(function(t,e,i,n,r){return t.reduce(function(t,e,o){return t.verified?t:(e=[e.el.getAttribute("id")].filter(function(t){return t="string"==typeof t&&null!==t.match(/^[0-9a-zA-Z][a-zA-Z_\-:0-9.]*$/gi)&&t}).filter(function(t){return 1===(r('[id="'+t+'"]')||[]).length}).map(function(e){return t.stack[o].push("[id='"+e+"']"),t.specificity+=100,t.specificity>=n.specificityThreshold&&i(t)&&(t.verified=!0),t.verified||0!==o||(t.stack[o].pop(),t.specificity-=100),t}),R(e,1)[0]||t)},e)}),vt.addMethod(function(t,e){return t.reduce(function(t,e,n){return[e.el.nodeName].filter(i).forEach(function(e){t.stack[n].splice(0,0,e),t.specificity+=10}),t},e)}),vt.addMethod(function(t,e,i){t=t[0];var n=t.el.nodeName;return gt[n]&&(e=gt[n](e,t),i(e)?e.verified=!0:e.stack[0].pop()),e}),vt.addMethod(function(t,e){return t.reduce(function(t,e,i){return e=G(e.getClasses(),10).filter(n).map(function(t){return"."+t}),e.length&&(t.stack[i].push(e.join("")),t.specificity+=10*e.length),t},e)}),vt.addMethod(function(t,e,i){return t.reduce(function(t,e,n){if(!t.verified){var r=e.prevAll(),o=e.nextAll(),s=r.length+1;!r.length&&!o.length||C(e,[].concat(B(r),B(o)))||(t.stack[n].push(":nth-child("+s+")"),t.verified=i(t))}return t},e)});var mt=1/0,bt=NaN,yt=/^\s+|\s+$/g,_t=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,wt=/^0o[0-7]+$/i,St=parseInt,Ct=Object.prototype.toString,kt=function(t,e,i){var n=t?t.length:0;if(!n)return[];i||void 0===e?e=1:(e?(e=O(e),e=e===mt||e===-mt?1.7976931348623157e308*(0>e?-1:1):e===e?e:0):e=0===e?e:0,i=e%1,e=e===e?i?e-i:e:0),e=n-e,e=0>e?0:e;var r=n,n=-1;for(i=t.length,0>e&&(e=-e>i?0:i+e),r=r>i?i:r,0>r&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0,r=Array(i);++n<i;)r[n]=t[n+e];return r},Ot=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.stack.length;return kt(t.stack.reduceRight(function(t,e){return e.length?t.push(e.join("")):t.length&&t.push("*"),t},[]),e).join(" > ")||"*"},Tt=function(t,e,i,n){var r=e.selectorMaxLength;return function(e){for(var o=!1,s=1;s<=e.stack.length&&!o;s+=1){if(o=Ot(e,s).trim(),!o||!o.length||r&&o.length>r)return!1;o=i(o,n),(o=1===o.length&&(void 0!==t.el?o[0]===t.el:o[0]===t))&&(e.verificationDepth=s)}return o}},Et={queryEngine:null,specificityThreshold:100,depth:3,errorHandling:!1,selectorMaxLength:512};!function(t,e){var i=t.Simmer;t.Simmer=e,e.noConflict=function(){return t.Simmer=i,e}}(fabric.util,M(window))}()}(),fabric.log=function(){},fabric.warn=function(){},"undefined"!=typeof console&&["log","warn"].forEach(function(t){"undefined"!=typeof console[t]&&"function"==typeof console[t].apply&&(fabric[t]=function(){return console[t].apply(console,arguments)})}),function(){function t(t){e(function(i){t||(t={});var n,r=i||+new Date,o=t.duration||500,s=r+o,a=t.onChange||function(){},c=t.abort||function(){return!1},l=t.easing||function(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},u="startValue"in t?t.startValue:0,h="endValue"in t?t.endValue:100,f=t.byValue||h-u;t.onStart&&t.onStart(),function i(h){n=h||+new Date;var d=n>s?o:n-r;return c()?void(t.onComplete&&t.onComplete()):(a(l(d,u,f,o)),n>s?void(t.onComplete&&t.onComplete()):void e(i))}(r)})}function e(){return i.apply(fabric.window,arguments)}var i=fabric.window.requestAnimationFrame||fabric.window.webkitRequestAnimationFrame||fabric.window.mozRequestAnimationFrame||fabric.window.oRequestAnimationFrame||fabric.window.msRequestAnimationFrame||function(t){fabric.window.setTimeout(t,1e3/60)};fabric.util.animate=t,fabric.util.requestAnimFrame=e}(),function(){function t(t,e,i,n){return t<Math.abs(e)?(t=e,n=i/4):n=0===e&&0===t?i/(2*Math.PI)*Math.asin(1):i/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:i,s:n}}function e(t,e,i){return t.a*Math.pow(2,10*(e-=1))*Math.sin((e*i-t.s)*(2*Math.PI)/t.p)}function i(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e}function n(t,e,i,n){return t/=n/2,t<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e}function r(t,e,i,n){return i*(t/=n)*t*t*t+e}function o(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e}function s(t,e,i,n){return t/=n/2,t<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e}function a(t,e,i,n){return i*(t/=n)*t*t*t*t+e}function c(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e}function l(t,e,i,n){return t/=n/2,t<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e}function u(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e}function h(t,e,i,n){return i*Math.sin(t/n*(Math.PI/2))+e}function f(t,e,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+e}function d(t,e,i,n){return 0===t?e:i*Math.pow(2,10*(t/n-1))+e}function p(t,e,i,n){return t===n?e+i:i*(-Math.pow(2,-10*t/n)+1)+e}function g(t,e,i,n){return 0===t?e:t===n?e+i:(t/=n/2,t<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(-Math.pow(2,-10*--t)+2)+e)}function v(t,e,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e}function m(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e}function b(t,e,i,n){return t/=n/2,t<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e}function y(i,n,r,o){var s=1.70158,a=0,c=r;if(0===i)return n;if(i/=o,1===i)return n+r;a||(a=.3*o);var l=t(c,r,a,s);return-e(l,i,o)+n}function _(e,i,n,r){var o=1.70158,s=0,a=n;if(0===e)return i;if(e/=r,1===e)return i+n;s||(s=.3*r);var c=t(a,n,s,o);return c.a*Math.pow(2,-10*e)*Math.sin((e*r-c.s)*(2*Math.PI)/c.p)+c.c+i}function x(i,n,r,o){var s=1.70158,a=0,c=r;if(0===i)return n;if(i/=o/2,2===i)return n+r;a||(a=o*(.3*1.5));var l=t(c,r,a,s);return i<1?-.5*e(l,i,o)+n:l.a*Math.pow(2,-10*(i-=1))*Math.sin((i*o-l.s)*(2*Math.PI)/l.p)*.5+l.c+n}function w(t,e,i,n,r){return void 0===r&&(r=1.70158),i*(t/=n)*t*((r+1)*t-r)+e}function S(t,e,i,n,r){return void 0===r&&(r=1.70158),i*((t=t/n-1)*t*((r+1)*t+r)+1)+e}function C(t,e,i,n,r){return void 0===r&&(r=1.70158),t/=n/2,t<1?i/2*(t*t*(((r*=1.525)+1)*t-r))+e:i/2*((t-=2)*t*(((r*=1.525)+1)*t+r)+2)+e}function k(t,e,i,n){return i-O(n-t,0,i,n)+e}function O(t,e,i,n){return(t/=n)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e}function T(t,e,i,n){return t<n/2?.5*k(2*t,0,i,n)+e:.5*O(2*t-n,0,i,n)+.5*i+e}fabric.util.ease={easeInQuad:function(t,e,i,n){return i*(t/=n)*t+e},easeOutQuad:function(t,e,i,n){return-i*(t/=n)*(t-2)+e},easeInOutQuad:function(t,e,i,n){return t/=n/2,t<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,n){return i*(t/=n)*t*t+e},easeOutCubic:i,easeInOutCubic:n,easeInQuart:r,easeOutQuart:o,easeInOutQuart:s,easeInQuint:a,easeOutQuint:c,easeInOutQuint:l,easeInSine:u,easeOutSine:h,easeInOutSine:f,easeInExpo:d,easeOutExpo:p,easeInOutExpo:g,easeInCirc:v,easeOutCirc:m,easeInOutCirc:b,easeInElastic:y,easeOutElastic:_,easeInOutElastic:x,easeInBack:w,easeOutBack:S,easeInOutBack:C,easeInBounce:k,easeOutBounce:O,easeInOutBounce:T}}(),function(t){"use strict";function e(t){return t in T?T[t]:t}function i(t,e,i,n){var r,o="[object Array]"===Object.prototype.toString.call(e);return"fill"!==t&&"stroke"!==t||"none"!==e?"strokeDashArray"===t?e=e.replace(/,/g," ").split(/\s+/).map(function(t){return parseFloat(t)}):"transformMatrix"===t?e=i&&i.transformMatrix?w(i.transformMatrix,v.parseTransformAttribute(e)):v.parseTransformAttribute(e):"visible"===t?(e="none"!==e&&"hidden"!==e,i&&i.visible===!1&&(e=!1)):"originX"===t?e="start"===e?"left":"end"===e?"right":"center":r=o?e.map(x):x(e,n):e="",!o&&isNaN(r)?e:r}function n(t){for(var e in E)if("undefined"!=typeof t[E[e]]&&""!==t[e]){if("undefined"==typeof t[e]){if(!v.Object.prototype[e])continue;t[e]=v.Object.prototype[e]}if(0!==t[e].indexOf("url(")){var i=new v.Color(t[e]);t[e]=i.setAlpha(_(i.getAlpha()*t[E[e]],2)).toRgba()}}return t}function r(t,e){for(var i,n,r=[],o=0;o<e.length;o++)i=e[o],n=t.getElementsByTagName(i),r=r.concat(Array.prototype.slice.call(n));return r}function o(t,n){var r,o;t.replace(/;\s*$/,"").split(";").forEach(function(t){var s=t.split(":");r=e(s[0].trim().toLowerCase()),o=i(r,s[1].trim()),n[r]=o})}function s(t,n){var r,o;for(var s in t)"undefined"!=typeof t[s]&&(r=e(s.toLowerCase()),o=i(r,t[s]),n[r]=o)}function a(t,e){var i={};for(var n in v.cssRules[e])if(c(t,n.split(" ")))for(var r in v.cssRules[e][n])i[r]=v.cssRules[e][n][r];return i}function c(t,e){var i,n=!0;return i=u(t,e.pop()),i&&e.length&&(n=l(t,e)),i&&n&&0===e.length}function l(t,e){for(var i,n=!0;t.parentNode&&1===t.parentNode.nodeType&&e.length;)n&&(i=e.pop()),t=t.parentNode,n=u(t,i);return 0===e.length}function u(t,e){var i,n=t.nodeName,r=t.getAttribute("class"),o=t.getAttribute("id");if(i=new RegExp("^"+n,"i"),e=e.replace(i,""),o&&e.length&&(i=new RegExp("#"+o+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")),r&&e.length){r=r.split(" ");for(var s=r.length;s--;)i=new RegExp("\\."+r[s]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"");
}return 0===e.length}function h(t,e){var i;if(t.getElementById&&(i=t.getElementById(e)),i)return i;var n,r,o=t.getElementsByTagName("*");for(r=0;r<o.length;r++)if(n=o[r],e===n.getAttribute("id"))return n}function f(t){for(var e=r(t,["use","svg:use"]),i=0;e.length&&i<e.length;){var n,o,s,a,c,l=e[i],u=l.getAttribute("xlink:href").substr(1),f=l.getAttribute("x")||0,p=l.getAttribute("y")||0,g=h(t,u).cloneNode(!0),v=(g.getAttribute("transform")||"")+" translate("+f+", "+p+")",m=e.length;if(d(g),/^svg$/i.test(g.nodeName)){var b=g.ownerDocument.createElement("g");for(s=0,a=g.attributes,c=a.length;s<c;s++)o=a.item(s),b.setAttribute(o.nodeName,o.nodeValue);for(;g.firstChild;)b.appendChild(g.firstChild);g=b}for(s=0,a=l.attributes,c=a.length;s<c;s++)o=a.item(s),"x"!==o.nodeName&&"y"!==o.nodeName&&"xlink:href"!==o.nodeName&&("transform"===o.nodeName?v=o.nodeValue+" "+v:g.setAttribute(o.nodeName,o.nodeValue));g.setAttribute("transform",v),g.setAttribute("instantiated_by_use","1"),g.removeAttribute("id"),n=l.parentNode,n.replaceChild(g,l),e.length===m&&i++}}function d(t){var e,i,n,r,o=t.getAttribute("viewBox"),s=1,a=1,c=0,l=0,u=t.getAttribute("width"),h=t.getAttribute("height"),f=t.getAttribute("x")||0,d=t.getAttribute("y")||0,p=t.getAttribute("preserveAspectRatio")||"",g=!o||!C.test(t.nodeName)||!(o=o.match(j)),m=!u||!h||"100%"===u||"100%"===h,b=g&&m,y={},_="";if(y.width=0,y.height=0,y.toBeParsed=b,b)return y;if(g)return y.width=x(u),y.height=x(h),y;if(c=-parseFloat(o[1]),l=-parseFloat(o[2]),e=parseFloat(o[3]),i=parseFloat(o[4]),m?(y.width=e,y.height=i):(y.width=x(u),y.height=x(h),s=y.width/e,a=y.height/i),p=v.util.parsePreserveAspectRatioAttribute(p),"none"!==p.alignX&&(a=s=s>a?a:s),1===s&&1===a&&0===c&&0===l&&0===f&&0===d)return y;if((f||d)&&(_=" translate("+x(f)+" "+x(d)+") "),n=_+" matrix("+s+" 0 0 "+a+" "+c*s+" "+l*a+") ","svg"===t.nodeName){for(r=t.ownerDocument.createElement("g");t.firstChild;)r.appendChild(t.firstChild);t.appendChild(r)}else r=t,n=r.getAttribute("transform")+n;return r.setAttribute("transform",n),y}function p(t){var e=t.objects,i=t.options;return e=e.map(function(t){return v[b(t.type)].fromObject(t)}),{objects:e,options:i}}function g(t,e,i){e[i]&&e[i].toSVG&&t.push('\t<pattern x="0" y="0" id="',i,'Pattern" ','width="',e[i].source.width,'" height="',e[i].source.height,'" patternUnits="userSpaceOnUse">\n','\t\t<image x="0" y="0" ','width="',e[i].source.width,'" height="',e[i].source.height,'" xlink:href="',e[i].source.src,'"></image>\n\t</pattern>\n')}var v=t.fabric||(t.fabric={}),m=v.util.object.extend,b=v.util.string.capitalize,y=v.util.object.clone,_=v.util.toFixed,x=v.util.parseUnit,w=v.util.multiplyTransformMatrices,S=/^(path|circle|polygon|polyline|ellipse|rect|line|image|text)$/i,C=/^(symbol|image|marker|pattern|view|svg)$/i,k=/^(?:pattern|defs|symbol|metadata)$/i,O=/^(symbol|g|a|svg)$/i,T={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","stroke-dasharray":"strokeDashArray","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"originX"},E={stroke:"strokeOpacity",fill:"fillOpacity"};v.cssRules={},v.gradientDefs={},v.parseTransformAttribute=function(){function t(t,e){var i=e[0],n=3===e.length?e[1]:0,r=3===e.length?e[2]:0;t[0]=Math.cos(i),t[1]=Math.sin(i),t[2]=-Math.sin(i),t[3]=Math.cos(i),t[4]=n-(t[0]*n+t[2]*r),t[5]=r-(t[1]*n+t[3]*r)}function e(t,e){var i=e[0],n=2===e.length?e[1]:e[0];t[0]=i,t[3]=n}function i(t,e){t[2]=Math.tan(v.util.degreesToRadians(e[0]))}function n(t,e){t[1]=Math.tan(v.util.degreesToRadians(e[0]))}function r(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}var o=[1,0,0,1,0,0],s=v.reNum,a="(?:\\s+,?\\s*|,\\s*)",c="(?:(skewX)\\s*\\(\\s*("+s+")\\s*\\))",l="(?:(skewY)\\s*\\(\\s*("+s+")\\s*\\))",u="(?:(rotate)\\s*\\(\\s*("+s+")(?:"+a+"("+s+")"+a+"("+s+"))?\\s*\\))",h="(?:(scale)\\s*\\(\\s*("+s+")(?:"+a+"("+s+"))?\\s*\\))",f="(?:(translate)\\s*\\(\\s*("+s+")(?:"+a+"("+s+"))?\\s*\\))",d="(?:(matrix)\\s*\\(\\s*("+s+")"+a+"("+s+")"+a+"("+s+")"+a+"("+s+")"+a+"("+s+")"+a+"("+s+")\\s*\\))",p="(?:"+d+"|"+f+"|"+h+"|"+u+"|"+c+"|"+l+")",g="(?:"+p+"(?:"+a+"*"+p+")*)",m="^\\s*(?:"+g+"?)\\s*$",b=new RegExp(m),y=new RegExp(p,"g");return function(s){var a=o.concat(),c=[];if(!s||s&&!b.test(s))return a;s.replace(y,function(s){var l=new RegExp(p).exec(s).filter(function(t){return!!t}),u=l[1],h=l.slice(2).map(parseFloat);switch(u){case"translate":r(a,h);break;case"rotate":h[0]=v.util.degreesToRadians(h[0]),t(a,h);break;case"scale":e(a,h);break;case"skewX":i(a,h);break;case"skewY":n(a,h);break;case"matrix":a=h}c.push(a.concat()),a=o.concat()});for(var l=c[0];c.length>1;)c.shift(),l=v.util.multiplyTransformMatrices(l,c[0]);return l}}();var j=new RegExp("^\\s*("+v.reNum+"+)\\s*,?\\s*("+v.reNum+"+)\\s*,?\\s*("+v.reNum+"+)\\s*,?\\s*("+v.reNum+"+)\\s*$");v.parseSVGDocument=function(){function t(t,e){for(;t&&(t=t.parentNode);)if(t.nodeName&&e.test(t.nodeName.replace("svg:",""))&&!t.getAttribute("instantiated_by_use"))return!0;return!1}return function(e,i,n){if(e){f(e);var r=new Date,o=v.Object.__uid++,s=d(e),a=v.util.toArray(e.getElementsByTagName("*"));if(s.svgUid=o,0===a.length&&v.isLikelyNode){a=e.selectNodes('//*[name(.)!="svg"]');for(var c=[],l=0,u=a.length;l<u;l++)c[l]=a[l];a=c}var h=a.filter(function(e){return d(e),S.test(e.nodeName.replace("svg:",""))&&!t(e,k)});if(!h||h&&!h.length)return void(i&&i([],{}));v.gradientDefs[o]=v.getGradientDefs(e),v.cssRules[o]=v.getCSSRules(e),v.parseElements(h,function(t){v.documentParsingTime=new Date-r,i&&i(t,s)},y(s),n)}}}();var M={has:function(t,e){e(!1)},get:function(){},set:function(){}},A=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+v.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+v.reNum+"))?\\s+(.*)");m(v,{parseFontDeclaration:function(t,e){var i=t.match(A);if(i){var n=i[1],r=i[3],o=i[4],s=i[5],a=i[6];n&&(e.fontStyle=n),r&&(e.fontWeight=isNaN(parseFloat(r))?r:parseFloat(r)),o&&(e.fontSize=x(o)),a&&(e.fontFamily=a),s&&(e.lineHeight="normal"===s?1:s)}},getGradientDefs:function(t){var e,i,n,o=["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"],s=r(t,o),a=0,c={},l={};for(a=s.length;a--;)e=s[a],n=e.getAttribute("xlink:href"),i=e.getAttribute("id"),n&&(l[i]=n.substr(1)),c[i]=e;for(i in l){var u=c[l[i]].cloneNode(!0);for(e=c[i];u.firstChild;)e.appendChild(u.firstChild)}return c},parseAttributes:function(t,r,o){if(t){var s,c,l={};"undefined"==typeof o&&(o=t.getAttribute("svgUid")),t.parentNode&&O.test(t.parentNode.nodeName)&&(l=v.parseAttributes(t.parentNode,r,o)),c=l&&l.fontSize||t.getAttribute("font-size")||v.Text.DEFAULT_SVG_FONT_SIZE;var u=r.reduce(function(n,r){return s=t.getAttribute(r),s&&(r=e(r),s=i(r,s,l,c),n[r]=s),n},{});return u=m(u,m(a(t,o),v.parseStyleAttribute(t))),u.font&&v.parseFontDeclaration(u.font,u),n(m(l,u))}},parseElements:function(t,e,i,n){new v.ElementsParser(t,e,i,n).parse()},parseStyleAttribute:function(t){var e={},i=t.getAttribute("style");return i?("string"==typeof i?o(i,e):s(i,e),e):e},parsePointsAttribute:function(t){if(!t)return null;t=t.replace(/,/g," ").trim(),t=t.split(/\s+/);var e,i,n=[];for(e=0,i=t.length;e<i;e+=2)n.push({x:parseFloat(t[e]),y:parseFloat(t[e+1])});return n},getCSSRules:function(t){for(var n,r=t.getElementsByTagName("style"),o={},s=0,a=r.length;s<a;s++){var c=r[s].textContent||r[s].text;c=c.replace(/\/\*[\s\S]*?\*\//g,""),""!==c.trim()&&(n=c.match(/[^{]*\{[\s\S]*?\}/g),n=n.map(function(t){return t.trim()}),n.forEach(function(t){for(var n=t.match(/([\s\S]*?)\s*\{([^}]*)\}/),r={},s=n[2].trim(),a=s.replace(/;$/,"").split(/\s*;\s*/),c=0,l=a.length;c<l;c++){var u=a[c].split(/\s*:\s*/),h=e(u[0]),f=i(h,u[1],u[0]);r[h]=f}t=n[1],t.split(",").forEach(function(t){t=t.replace(/^svg/i,"").trim(),""!==t&&(o[t]?v.util.object.extend(o[t],r):o[t]=v.util.object.clone(r))})}))}return o},loadSVGFromURL:function(t,e,i){function n(n){var r=n.responseXML;r&&!r.documentElement&&v.window.ActiveXObject&&n.responseText&&(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n.responseText.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,""))),r&&r.documentElement||e&&e(null),v.parseSVGDocument(r.documentElement,function(i,n){M.set(t,{objects:v.util.array.invoke(i,"toObject"),options:n}),e&&e(i,n)},i)}t=t.replace(/^\n\s*/,"").trim(),M.has(t,function(i){i?M.get(t,function(t){var i=p(t);e(i.objects,i.options)}):new v.util.request(t,{method:"get",onComplete:n})})},loadSVGFromString:function(t,e,i){t=t.trim();var n;if("undefined"!=typeof DOMParser){var r=new DOMParser;r&&r.parseFromString&&(n=r.parseFromString(t,"text/xml"))}else v.window.ActiveXObject&&(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,"")));v.parseSVGDocument(n.documentElement,function(t,i){e(t,i)},i)},createSVGFontFacesMarkup:function(t){for(var e,i,n,r,o,s,a,c="",l={},u=v.fontPaths,h=0,f=t.length;h<f;h++)if(e=t[h],i=e.fontFamily,e.type.indexOf("text")!==-1&&!l[i]&&u[i]&&(l[i]=!0,e.styles)){n=e.styles;for(o in n){r=n[o];for(a in r)s=r[a],i=s.fontFamily,!l[i]&&u[i]&&(l[i]=!0)}}for(var d in l)c+=["\t\t@font-face {\n","\t\t\tfont-family: '",d,"';\n","\t\t\tsrc: url('",u[d],"');\n","\t\t}\n"].join("");return c&&(c=['\t<style type="text/css">',"<![CDATA[\n",c,"]]>","</style>\n"].join("")),c},createSVGRefElementsMarkup:function(t){var e=[];return g(e,t,"backgroundColor"),g(e,t,"overlayColor"),e.join("")}})}(exports),fabric.ElementsParser=function(t,e,i,n){this.elements=t,this.callback=e,this.options=i,this.reviver=n,this.svgUid=i&&i.svgUid||0},fabric.ElementsParser.prototype.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},fabric.ElementsParser.prototype.createObjects=function(){for(var t=0,e=this.elements.length;t<e;t++)this.elements[t].setAttribute("svgUid",this.svgUid),function(t,e){setTimeout(function(){t.createObject(t.elements[e],e)},0)}(this,t)},fabric.ElementsParser.prototype.createObject=function(t,e){var i=fabric[fabric.util.string.capitalize(t.tagName.replace("svg:",""))];if(i&&i.fromElement)try{this._createObject(i,t,e)}catch(t){fabric.log(t)}else this.checkIfDone()},fabric.ElementsParser.prototype._createObject=function(t,e,i){if(t.async)t.fromElement(e,this.createCallback(i,e),this.options);else{var n=t.fromElement(e,this.options);this.resolveGradient(n,"fill"),this.resolveGradient(n,"stroke"),this.reviver&&this.reviver(e,n),this.instances[i]=n,this.checkIfDone()}},fabric.ElementsParser.prototype.createCallback=function(t,e){var i=this;return function(n){i.resolveGradient(n,"fill"),i.resolveGradient(n,"stroke"),i.reviver&&i.reviver(e,n),i.instances[t]=n,i.checkIfDone()}},fabric.ElementsParser.prototype.resolveGradient=function(t,e){var i=t.get(e);if(/^url\(/.test(i)){var n=i.slice(5,i.length-1);fabric.gradientDefs[this.svgUid][n]&&t.set(e,fabric.Gradient.fromElement(fabric.gradientDefs[this.svgUid][n],t))}},fabric.ElementsParser.prototype.checkIfDone=function(){0===--this.numElements&&(this.instances=this.instances.filter(function(t){return null!=t}),this.callback(this.instances))},function(t){"use strict";function e(t,e){this.x=t,this.y=e}var i=t.fabric||(t.fabric={});return i.Point?void i.warn("fabric.Point is already defined"):(i.Point=e,void(e.prototype={type:"point",constructor:e,add:function(t){return new e(this.x+t.x,this.y+t.y)},addEquals:function(t){return this.x+=t.x,this.y+=t.y,this},scalarAdd:function(t){return new e(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new e(this.x-t.x,this.y-t.y)},subtractEquals:function(t){return this.x-=t.x,this.y-=t.y,this},scalarSubtract:function(t){return new e(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new e(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new e(this.x/t,this.y/t)},divideEquals:function(t){return this.x/=t,this.y/=t,this},eq:function(t){return this.x===t.x&&this.y===t.y},lt:function(t){return this.x<t.x&&this.y<t.y},lte:function(t){return this.x<=t.x&&this.y<=t.y},gt:function(t){return this.x>t.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,i){return"undefined"==typeof i&&(i=.5),i=Math.max(Math.min(1,i),0),new e(this.x+(t.x-this.x)*i,this.y+(t.y-this.y)*i)},distanceFrom:function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},midPointFrom:function(t){return this.lerp(t)},min:function(t){return new e(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new e(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setFromPoint:function(t){return this.x=t.x,this.y=t.y,this},swap:function(t){var e=this.x,i=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=i},clone:function(){return new e(this.x,this.y)}}))}(exports),function(t){"use strict";function e(t){this.status=t,this.points=[]}var i=t.fabric||(t.fabric={});return i.Intersection?void i.warn("fabric.Intersection is already defined"):(i.Intersection=e,i.Intersection.prototype={constructor:e,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},i.Intersection.intersectLineLine=function(t,n,r,o){var s,a=(o.x-r.x)*(t.y-r.y)-(o.y-r.y)*(t.x-r.x),c=(n.x-t.x)*(t.y-r.y)-(n.y-t.y)*(t.x-r.x),l=(o.y-r.y)*(n.x-t.x)-(o.x-r.x)*(n.y-t.y);if(0!==l){var u=a/l,h=c/l;0<=u&&u<=1&&0<=h&&h<=1?(s=new e("Intersection"),s.appendPoint(new i.Point(t.x+u*(n.x-t.x),t.y+u*(n.y-t.y)))):s=new e}else s=new e(0===a||0===c?"Coincident":"Parallel");return s},i.Intersection.intersectLinePolygon=function(t,i,n){for(var r,o,s,a=new e,c=n.length,l=0;l<c;l++)r=n[l],o=n[(l+1)%c],s=e.intersectLineLine(t,i,r,o),a.appendPoints(s.points);return a.points.length>0&&(a.status="Intersection"),a},i.Intersection.intersectPolygonPolygon=function(t,i){for(var n=new e,r=t.length,o=0;o<r;o++){var s=t[o],a=t[(o+1)%r],c=e.intersectLinePolygon(s,a,i);n.appendPoints(c.points)}return n.points.length>0&&(n.status="Intersection"),n},void(i.Intersection.intersectPolygonRectangle=function(t,n,r){var o=n.min(r),s=n.max(r),a=new i.Point(s.x,o.y),c=new i.Point(o.x,s.y),l=e.intersectLinePolygon(o,a,t),u=e.intersectLinePolygon(a,s,t),h=e.intersectLinePolygon(s,c,t),f=e.intersectLinePolygon(c,o,t),d=new e;return d.appendPoints(l.points),d.appendPoints(u.points),d.appendPoints(h.points),d.appendPoints(f.points),d.points.length>0&&(d.status="Intersection"),d}))}(exports),function(t){"use strict";function e(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function i(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}var n=t.fabric||(t.fabric={});return n.Color?void n.warn("fabric.Color is already defined."):(n.Color=e,n.Color.prototype={_tryParsingColor:function(t){var i;t in e.colorNameMap&&(t=e.colorNameMap[t]),"transparent"===t&&(i=[255,255,255,0]),i||(i=e.sourceFromHex(t)),i||(i=e.sourceFromRgb(t)),i||(i=e.sourceFromHsl(t)),i||(i=[0,0,0,1]),i&&this.setSource(i)},_rgbToHsl:function(t,e,i){t/=255,e/=255,i/=255;var r,o,s,a=n.util.array.max([t,e,i]),c=n.util.array.min([t,e,i]);if(s=(a+c)/2,a===c)r=o=0;else{var l=a-c;switch(o=s>.5?l/(2-a-c):l/(a+c),a){case t:r=(e-i)/l+(e<i?6:0);break;case e:r=(i-t)/l+2;break;case i:r=(t-e)/l+4}r/=6}return[Math.round(360*r),Math.round(100*o),Math.round(100*s)]},getSource:function(){return this._source},setSource:function(t){this._source=t},toRgb:function(){var t=this.getSource();return"rgb("+t[0]+","+t[1]+","+t[2]+")"},toRgba:function(){var t=this.getSource();return"rgba("+t[0]+","+t[1]+","+t[2]+","+t[3]+")"},toHsl:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsl("+e[0]+","+e[1]+"%,"+e[2]+"%)"},toHsla:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsla("+e[0]+","+e[1]+"%,"+e[2]+"%,"+t[3]+")"},toHex:function(){var t,e,i,n=this.getSource();return t=n[0].toString(16),t=1===t.length?"0"+t:t,e=n[1].toString(16),e=1===e.length?"0"+e:e,i=n[2].toString(16),i=1===i.length?"0"+i:i,t.toUpperCase()+e.toUpperCase()+i.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(t){var e=this.getSource();return e[3]=t,this.setSource(e),this},toGrayscale:function(){var t=this.getSource(),e=parseInt((.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),10),i=t[3];return this.setSource([e,e,e,i]),this},toBlackWhite:function(t){var e=this.getSource(),i=(.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),n=e[3];return t=t||127,i=Number(i)<Number(t)?0:255,this.setSource([i,i,i,n]),this},overlayWith:function(t){t instanceof e||(t=new e(t));for(var i=[],n=this.getAlpha(),r=.5,o=this.getSource(),s=t.getSource(),a=0;a<3;a++)i.push(Math.round(o[a]*(1-r)+s[a]*r));return i[3]=n,this.setSource(i),this}},n.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/,n.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/,n.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,n.Color.colorNameMap={aqua:"#00FFFF",black:"#000000",blue:"#0000FF",fuchsia:"#FF00FF",gray:"#808080",grey:"#808080",green:"#008000",lime:"#00FF00",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#FFA500",purple:"#800080",red:"#FF0000",silver:"#C0C0C0",teal:"#008080",white:"#FFFFFF",yellow:"#FFFF00"},n.Color.fromRgb=function(t){return e.fromSource(e.sourceFromRgb(t))},n.Color.sourceFromRgb=function(t){var i=t.match(e.reRGBa);if(i){var n=parseInt(i[1],10)/(/%$/.test(i[1])?100:1)*(/%$/.test(i[1])?255:1),r=parseInt(i[2],10)/(/%$/.test(i[2])?100:1)*(/%$/.test(i[2])?255:1),o=parseInt(i[3],10)/(/%$/.test(i[3])?100:1)*(/%$/.test(i[3])?255:1);return[parseInt(n,10),parseInt(r,10),parseInt(o,10),i[4]?parseFloat(i[4]):1]}},n.Color.fromRgba=e.fromRgb,n.Color.fromHsl=function(t){return e.fromSource(e.sourceFromHsl(t))},n.Color.sourceFromHsl=function(t){var n=t.match(e.reHSLa);if(n){var r,o,s,a=(parseFloat(n[1])%360+360)%360/360,c=parseFloat(n[2])/(/%$/.test(n[2])?100:1),l=parseFloat(n[3])/(/%$/.test(n[3])?100:1);if(0===c)r=o=s=l;else{var u=l<=.5?l*(c+1):l+c-l*c,h=2*l-u;r=i(h,u,a+1/3),o=i(h,u,a),s=i(h,u,a-1/3)}return[Math.round(255*r),Math.round(255*o),Math.round(255*s),n[4]?parseFloat(n[4]):1]}},n.Color.fromHsla=e.fromHsl,n.Color.fromHex=function(t){return e.fromSource(e.sourceFromHex(t))},n.Color.sourceFromHex=function(t){if(t.match(e.reHex)){var i=t.slice(t.indexOf("#")+1),n=3===i.length||4===i.length,r=8===i.length||4===i.length,o=n?i.charAt(0)+i.charAt(0):i.substring(0,2),s=n?i.charAt(1)+i.charAt(1):i.substring(2,4),a=n?i.charAt(2)+i.charAt(2):i.substring(4,6),c=r?n?i.charAt(3)+i.charAt(3):i.substring(6,8):"FF";return[parseInt(o,16),parseInt(s,16),parseInt(a,16),parseFloat((parseInt(c,16)/255).toFixed(2))]}},void(n.Color.fromSource=function(t){var i=new e;return i.setSource(t),i}))}(exports),function(){function t(t){var e,i,n,r=t.getAttribute("style"),o=t.getAttribute("offset")||0;if(o=parseFloat(o)/(/%$/.test(o)?100:1),o=o<0?0:o>1?1:o,r){var s=r.split(/\s*;\s*/);""===s[s.length-1]&&s.pop();for(var a=s.length;a--;){var c=s[a].split(/\s*:\s*/),l=c[0].trim(),u=c[1].trim();"stop-color"===l?e=u:"stop-opacity"===l&&(n=u)}}return e||(e=t.getAttribute("stop-color")||"rgb(0,0,0)"),n||(n=t.getAttribute("stop-opacity")),e=new fabric.Color(e),i=e.getAlpha(),n=isNaN(parseFloat(n))?1:parseFloat(n),n*=i,{offset:o,color:e.toRgb(),opacity:n}}function e(t){return{x1:t.getAttribute("x1")||0,y1:t.getAttribute("y1")||0,x2:t.getAttribute("x2")||"100%",y2:t.getAttribute("y2")||0}}function i(t){return{x1:t.getAttribute("fx")||t.getAttribute("cx")||"50%",y1:t.getAttribute("fy")||t.getAttribute("cy")||"50%",r1:0,x2:t.getAttribute("cx")||"50%",y2:t.getAttribute("cy")||"50%",r2:t.getAttribute("r")||"50%"}}function n(t,e,i){var n,r=0,o=1,s="";for(var a in e)"Infinity"===e[a]?e[a]=1:"-Infinity"===e[a]&&(e[a]=0),n=parseFloat(e[a],10),o="string"==typeof e[a]&&/^\d+%$/.test(e[a])?.01:1,"x1"===a||"x2"===a||"r2"===a?(o*="objectBoundingBox"===i?t.width:1,r="objectBoundingBox"===i?t.left||0:0):"y1"!==a&&"y2"!==a||(o*="objectBoundingBox"===i?t.height:1,r="objectBoundingBox"===i?t.top||0:0),e[a]=n*o+r;if("ellipse"===t.type&&null!==e.r2&&"objectBoundingBox"===i&&t.rx!==t.ry){var c=t.ry/t.rx;s=" scale(1, "+c+")",e.y1&&(e.y1/=c),e.y2&&(e.y2/=c)}return s}fabric.Gradient=fabric.util.createClass({offsetX:0,offsetY:0,initialize:function(t){t||(t={});var e={};this.id=fabric.Object.__uid++,this.type=t.type||"linear",e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},"radial"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.colorStops=t.colorStops.slice(),t.gradientTransform&&(this.gradientTransform=t.gradientTransform),this.offsetX=t.offsetX||this.offsetX,this.offsetY=t.offsetY||this.offsetY},addColorStop:function(t){for(var e in t){var i=new fabric.Color(t[e]);this.colorStops.push({offset:e,color:i.toRgb(),opacity:i.getAlpha()})}return this},toObject:function(){return{type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform}},toSVG:function(t){var e,i,n=fabric.util.object.clone(this.coords);if(this.colorStops.sort(function(t,e){return t.offset-e.offset}),!t.group||"path-group"!==t.group.type)for(var r in n)"x1"===r||"x2"===r||"r2"===r?n[r]+=this.offsetX-t.width/2:"y1"!==r&&"y2"!==r||(n[r]+=this.offsetY-t.height/2);i='id="SVGID_'+this.id+'" gradientUnits="userSpaceOnUse"',this.gradientTransform&&(i+=' gradientTransform="matrix('+this.gradientTransform.join(" ")+')" '),"linear"===this.type?e=["<linearGradient ",i,' x1="',n.x1,'" y1="',n.y1,'" x2="',n.x2,'" y2="',n.y2,'">\n']:"radial"===this.type&&(e=["<radialGradient ",i,' cx="',n.x2,'" cy="',n.y2,'" r="',n.r2,'" fx="',n.x1,'" fy="',n.y1,'">\n']);for(var o=0;o<this.colorStops.length;o++)e.push("<stop ",'offset="',100*this.colorStops[o].offset+"%",'" style="stop-color:',this.colorStops[o].color,null!==this.colorStops[o].opacity?";stop-opacity: "+this.colorStops[o].opacity:";",'"/>\n');return e.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),e.join("")},toLive:function(t,e){var i,n,r=fabric.util.object.clone(this.coords);if(this.type){if(e.group&&"path-group"===e.group.type)for(n in r)"x1"===n||"x2"===n?r[n]+=-this.offsetX+e.width/2:"y1"!==n&&"y2"!==n||(r[n]+=-this.offsetY+e.height/2);"linear"===this.type?i=t.createLinearGradient(r.x1,r.y1,r.x2,r.y2):"radial"===this.type&&(i=t.createRadialGradient(r.x1,r.y1,r.r1,r.x2,r.y2,r.r2));for(var o=0,s=this.colorStops.length;o<s;o++){var a=this.colorStops[o].color,c=this.colorStops[o].opacity,l=this.colorStops[o].offset;"undefined"!=typeof c&&(a=new fabric.Color(a).setAlpha(c).toRgba()),i.addColorStop(parseFloat(l),a)}return i}}}),fabric.util.object.extend(fabric.Gradient,{fromElement:function(r,o){var s,a,c,l=r.getElementsByTagName("stop"),u=r.getAttribute("gradientUnits")||"objectBoundingBox",h=r.getAttribute("gradientTransform"),f=[];s="linearGradient"===r.nodeName||"LINEARGRADIENT"===r.nodeName?"linear":"radial","linear"===s?a=e(r):"radial"===s&&(a=i(r));for(var d=l.length;d--;)f.push(t(l[d]));c=n(o,a,u);var p=new fabric.Gradient({type:s,coords:a,colorStops:f,offsetX:-o.left,offsetY:-o.top});return(h||""!==c)&&(p.gradientTransform=fabric.parseTransformAttribute((h||"")+c)),p},forObject:function(t,e){return e||(e={}),n(t,e.coords,"userSpaceOnUse"),new fabric.Gradient(e)}})}(),fabric.Pattern=fabric.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,initialize:function(t){if(t||(t={}),this.id=fabric.Object.__uid++,t.source)if("string"==typeof t.source)if("undefined"!=typeof fabric.util.getFunctionBody(t.source))this.source=new Function(fabric.util.getFunctionBody(t.source));else{var e=this;this.source=fabric.util.createImage(),fabric.util.loadImage(t.source,function(t){e.source=t})}else this.source=t.source;t.repeat&&(this.repeat=t.repeat),t.offsetX&&(this.offsetX=t.offsetX),t.offsetY&&(this.offsetY=t.offsetY)},toObject:function(){var t;return"function"==typeof this.source?t=String(this.source):"string"==typeof this.source.src?t=this.source.src:"object"==typeof this.source&&this.source.toDataURL&&(t=this.source.toDataURL()),{source:t,repeat:this.repeat,offsetX:this.offsetX,offsetY:this.offsetY}},toSVG:function(t){var e="function"==typeof this.source?this.source():this.source,i=e.width/t.getWidth(),n=e.height/t.getHeight(),r=this.offsetX/t.getWidth(),o=this.offsetY/t.getHeight(),s="";return"repeat-x"!==this.repeat&&"no-repeat"!==this.repeat||(n=1),"repeat-y"!==this.repeat&&"no-repeat"!==this.repeat||(i=1),e.src?s=e.src:e.toDataURL&&(s=e.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+r+'" y="'+o+'" width="'+i+'" height="'+n+'">\n<image x="0" y="0" width="'+e.width+'" height="'+e.height+'" xlink:href="'+s+'"></image>\n</pattern>\n'},toLive:function(t){var e="function"==typeof this.source?this.source():this.source;if(!e)return"";if("undefined"!=typeof e.src){if(!e.complete)return"";if(0===e.naturalWidth||0===e.naturalHeight)return""}return t.createPattern(e,this.repeat)}}),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.toFixed;return e.Shadow?void e.warn("fabric.Shadow is already defined."):(e.Shadow=e.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,initialize:function(t){"string"==typeof t&&(t=this._parseShadow(t));for(var i in t)this[i]=t[i];this.id=e.Object.__uid++},_parseShadow:function(t){var i=t.trim(),n=e.Shadow.reOffsetsAndBlur.exec(i)||[],r=i.replace(e.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)";return{color:r.trim(),offsetX:parseInt(n[1],10)||0,offsetY:parseInt(n[2],10)||0,blur:parseInt(n[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(t){var n=40,r=40,o=e.Object.NUM_FRACTION_DIGITS,s=e.util.rotateVector({x:this.offsetX,y:this.offsetY},e.util.degreesToRadians(-t.angle)),a=20;return t.width&&t.height&&(n=100*i((Math.abs(s.x)+this.blur)/t.width,o)+a,r=100*i((Math.abs(s.y)+this.blur)/t.height,o)+a),t.flipX&&(s.x*=-1),t.flipY&&(s.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+r+'%" height="'+(100+2*r)+'%" x="-'+n+'%" width="'+(100+2*n)+'%" >\n\t<feGaussianBlur in="SourceAlpha" stdDeviation="'+i(this.blur?this.blur/2:0,o)+'"></feGaussianBlur>\n\t<feOffset dx="'+i(s.x,o)+'" dy="'+i(s.y,o)+'" result="oBlur" ></feOffset>\n\t<feFlood flood-color="'+this.color+'"/>\n\t<feComposite in2="oBlur" operator="in" />\n\t<feMerge>\n\t\t<feMergeNode></feMergeNode>\n\t\t<feMergeNode in="SourceGraphic"></feMergeNode>\n\t</feMerge>\n</filter>\n'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke};var t={},i=e.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke"].forEach(function(e){this[e]!==i[e]&&(t[e]=this[e])},this),t}}),void(e.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:px)?(?:\s?|$))?(-?\d+(?:px)?(?:\s?|$))?(\d+(?:px)?)?(?:\s?|$)(?:$|\s)/))}(exports),function(){"use strict";if(fabric.StaticCanvas)return void fabric.warn("fabric.StaticCanvas is already defined.");var t=fabric.util.object.extend,e=fabric.util.getElementOffset,i=fabric.util.removeFromArray,n=fabric.util.toFixed,r=new Error("Could not initialize `canvas` element");fabric.StaticCanvas=fabric.util.createClass({initialize:function(t,e){e||(e={}),this._initStatic(t,e)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!0,renderOnAddRemove:!0,clipTo:null,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:[1,0,0,1,0,0],backgroundVpt:!0,overlayVpt:!0,onBeforeScaleRotate:function(){},enableRetinaScaling:!0,_initStatic:function(t,e){var i=fabric.StaticCanvas.prototype.renderAll.bind(this);this._objects=[],this._createLowerCanvas(t),this._initOptions(e),this._setImageSmoothing(),this.interactive||this._initRetinaScaling(),e.overlayImage&&this.setOverlayImage(e.overlayImage,i),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,i),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,i),e.overlayColor&&this.setOverlayColor(e.overlayColor,i),this.calcOffset()},_isRetinaScaling:function(){return 1!==fabric.devicePixelRatio&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?fabric.devicePixelRatio:1},_initRetinaScaling:function(){this._isRetinaScaling()&&(this.lowerCanvasEl.setAttribute("width",this.width*fabric.devicePixelRatio),this.lowerCanvasEl.setAttribute("height",this.height*fabric.devicePixelRatio),this.contextContainer.scale(fabric.devicePixelRatio,fabric.devicePixelRatio))},calcOffset:function(){return this._offset=e(this.lowerCanvasEl),this},setOverlayImage:function(t,e,i){return this.__setBgOverlayImage("overlayImage",t,e,i)},setBackgroundImage:function(t,e,i){return this.__setBgOverlayImage("backgroundImage",t,e,i)},setOverlayColor:function(t,e){return this.__setBgOverlayColor("overlayColor",t,e)},setBackgroundColor:function(t,e){return this.__setBgOverlayColor("backgroundColor",t,e)},_setImageSmoothing:function(){var t=this.getContext();t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=this.imageSmoothingEnabled},__setBgOverlayImage:function(t,e,i,n){return"string"==typeof e?fabric.util.loadImage(e,function(e){e&&(this[t]=new fabric.Image(e,n)),i&&i(e)},this,n&&n.crossOrigin):(n&&e.setOptions(n),this[t]=e,i&&i(e)),this},__setBgOverlayColor:function(t,e,i){if(e&&e.source){var n=this;fabric.util.loadImage(e.source,function(r){n[t]=new fabric.Pattern({source:r,repeat:e.repeat,offsetX:e.offsetX,offsetY:e.offsetY}),i&&i()})}else this[t]=e,i&&i();return this},_createCanvasElement:function(t){var e=fabric.util.createCanvasElement(t);if(e.style||(e.style={}),!e)throw r;if("undefined"==typeof e.getContext)throw r;return e},_initOptions:function(t){for(var e in t)this[e]=t[e];this.width=this.width||parseInt(this.lowerCanvasEl.width,10)||0,this.height=this.height||parseInt(this.lowerCanvasEl.height,10)||0,this.lowerCanvasEl.style&&(this.lowerCanvasEl.width=this.width,this.lowerCanvasEl.height=this.height,this.lowerCanvasEl.style.width=this.width+"px",this.lowerCanvasEl.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){this.lowerCanvasEl=fabric.util.getById(t)||this._createCanvasElement(t),fabric.util.addClass(this.lowerCanvasEl,"lower-canvas"),this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var i;e=e||{};for(var n in t)i=t[n],e.cssOnly||(this._setBackstoreDimension(n,t[n]),i+="px"),e.backstoreOnly||this._setCssDimension(n,i);return this._initRetinaScaling(),this._setImageSmoothing(),this.calcOffset(),e.cssOnly||this.renderAll(),this},_setBackstoreDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.upperCanvasEl&&(this.upperCanvasEl[t]=e),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this[t]=e,
this},_setCssDimension:function(t,e){return this.lowerCanvasEl.style[t]=e,this.upperCanvasEl&&(this.upperCanvasEl.style[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e),this},getZoom:function(){return Math.sqrt(this.viewportTransform[0]*this.viewportTransform[3])},setViewportTransform:function(t){var e,i=this._activeGroup;this.viewportTransform=t;for(var n=0,r=this._objects.length;n<r;n++)e=this._objects[n],e.group||e.setCoords();return i&&i.setCoords(),this.renderAll(),this},zoomToPoint:function(t,e){var i=t,n=this.viewportTransform.slice(0);t=fabric.util.transformPoint(t,fabric.util.invertTransform(this.viewportTransform)),n[0]=e,n[3]=e;var r=fabric.util.transformPoint(t,n);return n[4]+=i.x-r.x,n[5]+=i.y-r.y,this.setViewportTransform(n)},setZoom:function(t){return this.zoomToPoint(new fabric.Point(0,0),t),this},absolutePan:function(t){var e=this.viewportTransform.slice(0);return e[4]=-t.x,e[5]=-t.y,this.setViewportTransform(e)},relativePan:function(t){return this.absolutePan(new fabric.Point(-t.x-this.viewportTransform[4],-t.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(t){this.stateful&&t.setupState(),t._set("canvas",this),t.setCoords(),this.fire("object:added",{target:t}),t.fire("added")},_onObjectRemoved:function(t){this.fire("object:removed",{target:t}),t.fire("removed"),delete t.canvas},clearContext:function(t){return t.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this._objects.length=0,this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("selection:cleared",this._canvasITextSelectionClearedHanlder),this.off("object:selected",this._canvasITextSelectionClearedHanlder),this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderAll(),this},renderAll:function(){var t=this.contextContainer;return this.renderCanvas(t,this._objects),this},renderCanvas:function(t,e){this.clearContext(t),this.fire("before:render"),this.clipTo&&fabric.util.clipContext(this,t),this._renderBackground(t),t.save(),t.transform.apply(t,this.viewportTransform),this._renderObjects(t,e),t.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),this.clipTo&&t.restore(),this._renderOverlay(t),this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),this.fire("after:render")},_renderObjects:function(t,e){for(var i=0,n=e.length;i<n;++i)e[i]&&e[i].render(t)},_renderBackgroundOrOverlay:function(t,e){var i=this[e+"Color"];i&&(t.fillStyle=i.toLive?i.toLive(t):i,t.fillRect(i.offsetX||0,i.offsetY||0,this.width,this.height)),i=this[e+"Image"],i&&(this[e+"Vpt"]&&(t.save(),t.transform.apply(t,this.viewportTransform)),i.render(t),this[e+"Vpt"]&&t.restore())},_renderBackground:function(t){this._renderBackgroundOrOverlay(t,"background")},_renderOverlay:function(t){this._renderBackgroundOrOverlay(t,"overlay")},getCenter:function(){return{top:this.getHeight()/2,left:this.getWidth()/2}},centerObjectH:function(t){return this._centerObject(t,new fabric.Point(this.getCenter().left,t.getCenterPoint().y))},centerObjectV:function(t){return this._centerObject(t,new fabric.Point(t.getCenterPoint().x,this.getCenter().top))},centerObject:function(t){var e=this.getCenter();return this._centerObject(t,new fabric.Point(e.left,e.top))},viewportCenterObject:function(t){var e=this.getVpCenter();return this._centerObject(t,e)},viewportCenterObjectH:function(t){var e=this.getVpCenter();return this._centerObject(t,new fabric.Point(e.x,t.getCenterPoint().y)),this},viewportCenterObjectV:function(t){var e=this.getVpCenter();return this._centerObject(t,new fabric.Point(t.getCenterPoint().x,e.y))},getVpCenter:function(){var t=this.getCenter(),e=fabric.util.invertTransform(this.viewportTransform);return fabric.util.transformPoint({x:t.left,y:t.top},e)},_centerObject:function(t,e){return t.setPositionByOrigin(e,"center","center"),this.renderAll(),this},toDatalessJSON:function(t){return this.toDatalessObject(t)},toObject:function(t){return this._toObjectMethod("toObject",t)},toDatalessObject:function(t){return this._toObjectMethod("toDatalessObject",t)},_toObjectMethod:function(e,i){var n={objects:this._toObjects(e,i)};return t(n,this.__serializeBgOverlay(e,i)),fabric.util.populateWithProperties(this,n,i),n},_toObjects:function(t,e){return this.getObjects().filter(function(t){return!t.excludeFromExport}).map(function(i){return this._toObject(i,t,e)},this)},_toObject:function(t,e,i){var n;this.includeDefaultValues||(n=t.includeDefaultValues,t.includeDefaultValues=!1);var r=t[e](i);return this.includeDefaultValues||(t.includeDefaultValues=n),r},__serializeBgOverlay:function(t,e){var i={background:this.backgroundColor&&this.backgroundColor.toObject?this.backgroundColor.toObject(e):this.backgroundColor};return this.overlayColor&&(i.overlay=this.overlayColor.toObject?this.overlayColor.toObject(e):this.overlayColor),this.backgroundImage&&(i.backgroundImage=this._toObject(this.backgroundImage,t,e)),this.overlayImage&&(i.overlayImage=this._toObject(this.overlayImage,t,e)),i},svgViewportTransformation:!0,toSVG:function(t,e){t||(t={});var i=[];return this._setSVGPreamble(i,t),this._setSVGHeader(i,t),this._setSVGBgOverlayColor(i,"backgroundColor"),this._setSVGBgOverlayImage(i,"backgroundImage",e),this._setSVGObjects(i,e),this._setSVGBgOverlayColor(i,"overlayColor"),this._setSVGBgOverlayImage(i,"overlayImage",e),i.push("</svg>"),i.join("")},_setSVGPreamble:function(t,e){e.suppressPreamble||t.push('<?xml version="1.0" encoding="',e.encoding||"UTF-8",'" standalone="no" ?>\n','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ','"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')},_setSVGHeader:function(t,e){var i,r=e.width||this.width,o=e.height||this.height,s='viewBox="0 0 '+this.width+" "+this.height+'" ',a=fabric.Object.NUM_FRACTION_DIGITS;e.viewBox?s='viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':this.svgViewportTransformation&&(i=this.viewportTransform,s='viewBox="'+n(-i[4]/i[0],a)+" "+n(-i[5]/i[3],a)+" "+n(this.width/i[0],a)+" "+n(this.height/i[3],a)+'" '),t.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',r,'" ','height="',o,'" ',this.backgroundColor&&!this.backgroundColor.toLive?'style="background-color: '+this.backgroundColor+'" ':null,s,'xml:space="preserve">\n',"<desc>Created with Fabric.js ",fabric.version,"</desc>\n","<defs>",fabric.createSVGFontFacesMarkup(this.getObjects()),fabric.createSVGRefElementsMarkup(this),"</defs>\n")},_setSVGObjects:function(t,e){for(var i,n=0,r=this.getObjects(),o=r.length;n<o;n++)i=r[n],i.excludeFromExport||this._setSVGObject(t,i,e)},_setSVGObject:function(t,e,i){t.push(e.toSVG(i))},_setSVGBgOverlayImage:function(t,e,i){this[e]&&this[e].toSVG&&t.push(this[e].toSVG(i))},_setSVGBgOverlayColor:function(t,e){this[e]&&this[e].source?t.push('<rect x="',this[e].offsetX,'" y="',this[e].offsetY,'" ','width="',"repeat-y"===this[e].repeat||"no-repeat"===this[e].repeat?this[e].source.width:this.width,'" height="',"repeat-x"===this[e].repeat||"no-repeat"===this[e].repeat?this[e].source.height:this.height,'" fill="url(#'+e+'Pattern)"',"></rect>\n"):this[e]&&"overlayColor"===e&&t.push('<rect x="0" y="0" ','width="',this.width,'" height="',this.height,'" fill="',this[e],'"',"></rect>\n")},sendToBack:function(t){if(!t)return this;var e,n,r,o=this._activeGroup;if(t===o)for(r=o._objects,e=r.length;e--;)n=r[e],i(this._objects,n),this._objects.unshift(n);else i(this._objects,t),this._objects.unshift(t);return this.renderAll&&this.renderAll()},bringToFront:function(t){if(!t)return this;var e,n,r,o=this._activeGroup;if(t===o)for(r=o._objects,e=0;e<r.length;e++)n=r[e],i(this._objects,n),this._objects.push(n);else i(this._objects,t),this._objects.push(t);return this.renderAll&&this.renderAll()},sendBackwards:function(t,e){if(!t)return this;var n,r,o,s,a,c=this._activeGroup;if(t===c)for(a=c._objects,n=0;n<a.length;n++)r=a[n],o=this._objects.indexOf(r),0!==o&&(s=o-1,i(this._objects,r),this._objects.splice(s,0,r));else o=this._objects.indexOf(t),0!==o&&(s=this._findNewLowerIndex(t,o,e),i(this._objects,t),this._objects.splice(s,0,t));return this.renderAll&&this.renderAll(),this},_findNewLowerIndex:function(t,e,i){var n;if(i){n=e;for(var r=e-1;r>=0;--r){var o=t.intersectsWithObject(this._objects[r])||t.isContainedWithinObject(this._objects[r])||this._objects[r].isContainedWithinObject(t);if(o){n=r;break}}}else n=e-1;return n},bringForward:function(t,e){if(!t)return this;var n,r,o,s,a,c=this._activeGroup;if(t===c)for(a=c._objects,n=a.length;n--;)r=a[n],o=this._objects.indexOf(r),o!==this._objects.length-1&&(s=o+1,i(this._objects,r),this._objects.splice(s,0,r));else o=this._objects.indexOf(t),o!==this._objects.length-1&&(s=this._findNewUpperIndex(t,o,e),i(this._objects,t),this._objects.splice(s,0,t));return this.renderAll&&this.renderAll(),this},_findNewUpperIndex:function(t,e,i){var n;if(i){n=e;for(var r=e+1;r<this._objects.length;++r){var o=t.intersectsWithObject(this._objects[r])||t.isContainedWithinObject(this._objects[r])||this._objects[r].isContainedWithinObject(t);if(o){n=r;break}}}else n=e+1;return n},moveTo:function(t,e){return i(this._objects,t),this._objects.splice(e,0,t),this.renderAll&&this.renderAll()},dispose:function(){return this.clear(),this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this.getObjects().length+" }>"}}),t(fabric.StaticCanvas.prototype,fabric.Observable),t(fabric.StaticCanvas.prototype,fabric.Collection),t(fabric.StaticCanvas.prototype,fabric.DataURLExporter),t(fabric.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=fabric.util.createCanvasElement();if(!e||!e.getContext)return null;var i=e.getContext("2d");if(!i)return null;switch(t){case"getImageData":return"undefined"!=typeof i.getImageData;case"setLineDash":return"undefined"!=typeof i.setLineDash;case"toDataURL":return"undefined"!=typeof e.toDataURL;case"toDataURLWithQuality":try{return e.toDataURL("image/jpeg",0),!0}catch(t){}return!1;default:return null}}}),fabric.StaticCanvas.prototype.toJSON=fabric.StaticCanvas.prototype.toObject}(),fabric.BaseBrush=fabric.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeDashArray:null,setShadow:function(t){return this.shadow=new fabric.Shadow(t),this},_setBrushStyles:function(){var t=this.canvas.contextTop;t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.lineJoin=this.strokeLineJoin,this.strokeDashArray&&fabric.StaticCanvas.supports("setLineDash")&&t.setLineDash(this.strokeDashArray)},_setShadow:function(){if(this.shadow){var t=this.canvas.contextTop;t.shadowColor=this.shadow.color,t.shadowBlur=this.shadow.blur,t.shadowOffsetX=this.shadow.offsetX,t.shadowOffsetY=this.shadow.offsetY}},_resetShadow:function(){var t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0}}),function(){fabric.PencilBrush=fabric.util.createClass(fabric.BaseBrush,{initialize:function(t){this.canvas=t,this._points=[]},onMouseDown:function(t){this._prepareForDrawing(t),this._captureDrawingPath(t),this._render()},onMouseMove:function(t){this._captureDrawingPath(t),this.canvas.clearContext(this.canvas.contextTop),this._render()},onMouseUp:function(){this._finalizeAndAddPath()},_prepareForDrawing:function(t){var e=new fabric.Point(t.x,t.y);this._reset(),this._addPoint(e),this.canvas.contextTop.moveTo(e.x,e.y)},_addPoint:function(t){this._points.push(t)},_reset:function(){this._points.length=0,this._setBrushStyles(),this._setShadow()},_captureDrawingPath:function(t){var e=new fabric.Point(t.x,t.y);this._addPoint(e)},_render:function(){var t=this.canvas.contextTop,e=this.canvas.viewportTransform,i=this._points[0],n=this._points[1];t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t.beginPath(),2===this._points.length&&i.x===n.x&&i.y===n.y&&(i.x-=.5,n.x+=.5),t.moveTo(i.x,i.y);for(var r=1,o=this._points.length;r<o;r++){var s=i.midPointFrom(n);t.quadraticCurveTo(i.x,i.y,s.x,s.y),i=this._points[r],n=this._points[r+1]}t.lineTo(i.x,i.y),t.stroke(),t.restore()},convertPointsToSVGPath:function(t){var e=[],i=new fabric.Point(t[0].x,t[0].y),n=new fabric.Point(t[1].x,t[1].y);e.push("M ",t[0].x," ",t[0].y," ");for(var r=1,o=t.length;r<o;r++){var s=i.midPointFrom(n);e.push("Q ",i.x," ",i.y," ",s.x," ",s.y," "),i=new fabric.Point(t[r].x,t[r].y),r+1<t.length&&(n=new fabric.Point(t[r+1].x,t[r+1].y))}return e.push("L ",i.x," ",i.y," "),e},createPath:function(t){var e=new fabric.Path(t,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray,originX:"center",originY:"center"});return this.shadow&&(this.shadow.affectStroke=!0,e.setShadow(this.shadow)),e},_finalizeAndAddPath:function(){var t=this.canvas.contextTop;t.closePath();var e=this.convertPointsToSVGPath(this._points).join("");if("M 0 0 Q 0 0 0 0 L 0 0"===e)return void this.canvas.renderAll();var i=this.createPath(e);this.canvas.add(i),i.setCoords(),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderAll(),this.canvas.fire("path:created",{path:i})}})}(),fabric.CircleBrush=fabric.util.createClass(fabric.BaseBrush,{width:10,initialize:function(t){this.canvas=t,this.points=[]},drawDot:function(t){var e=this.addPoint(t),i=this.canvas.contextTop,n=this.canvas.viewportTransform;i.save(),i.transform(n[0],n[1],n[2],n[3],n[4],n[5]),i.fillStyle=e.fill,i.beginPath(),i.arc(e.x,e.y,e.radius,0,2*Math.PI,!1),i.closePath(),i.fill(),i.restore()},onMouseDown:function(t){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(t)},onMouseMove:function(t){this.drawDot(t)},onMouseUp:function(){var t=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var e=[],i=0,n=this.points.length;i<n;i++){var r=this.points[i],o=new fabric.Circle({radius:r.radius,left:r.x,top:r.y,originX:"center",originY:"center",fill:r.fill});this.shadow&&o.setShadow(this.shadow),e.push(o)}var s=new fabric.Group(e,{originX:"center",originY:"center"});s.canvas=this.canvas,this.canvas.add(s),this.canvas.fire("path:created",{path:s}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.renderAll()},addPoint:function(t){var e=new fabric.Point(t.x,t.y),i=fabric.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,n=new fabric.Color(this.color).setAlpha(fabric.util.getRandomInt(0,100)/100).toRgba();return e.radius=i,e.fill=n,this.points.push(e),e}}),fabric.SprayBrush=fabric.util.createClass(fabric.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(t){this.canvas=t,this.sprayChunks=[]},onMouseDown:function(t){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(t),this.render()},onMouseMove:function(t){this.addSprayChunk(t),this.render()},onMouseUp:function(){var t=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var e=[],i=0,n=this.sprayChunks.length;i<n;i++)for(var r=this.sprayChunks[i],o=0,s=r.length;o<s;o++){var a=new fabric.Rect({width:r[o].width,height:r[o].width,left:r[o].x+1,top:r[o].y+1,originX:"center",originY:"center",fill:this.color});this.shadow&&a.setShadow(this.shadow),e.push(a)}this.optimizeOverlapping&&(e=this._getOptimizedRects(e));var c=new fabric.Group(e,{originX:"center",originY:"center"});c.canvas=this.canvas,this.canvas.add(c),this.canvas.fire("path:created",{path:c}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.renderAll()},_getOptimizedRects:function(t){for(var e,i={},n=0,r=t.length;n<r;n++)e=t[n].left+""+t[n].top,i[e]||(i[e]=t[n]);var o=[];for(e in i)o.push(i[e]);return o},render:function(){var t=this.canvas.contextTop;t.fillStyle=this.color;var e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]);for(var i=0,n=this.sprayChunkPoints.length;i<n;i++){var r=this.sprayChunkPoints[i];"undefined"!=typeof r.opacity&&(t.globalAlpha=r.opacity),t.fillRect(r.x,r.y,r.width,r.width)}t.restore()},addSprayChunk:function(t){this.sprayChunkPoints=[];for(var e,i,n,r=this.width/2,o=0;o<this.density;o++){e=fabric.util.getRandomInt(t.x-r,t.x+r),i=fabric.util.getRandomInt(t.y-r,t.y+r),n=this.dotWidthVariance?fabric.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var s=new fabric.Point(e,i);s.width=n,this.randomOpacity&&(s.opacity=fabric.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(s)}this.sprayChunks.push(this.sprayChunkPoints)}}),fabric.PatternBrush=fabric.util.createClass(fabric.PencilBrush,{getPatternSrc:function(){var t=20,e=5,i=fabric.document.createElement("canvas"),n=i.getContext("2d");return i.width=i.height=t+e,n.fillStyle=this.color,n.beginPath(),n.arc(t/2,t/2,t/2,0,2*Math.PI,!1),n.closePath(),n.fill(),i},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(){return this.canvas.contextTop.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(){this.callSuper("_setBrushStyles"),this.canvas.contextTop.strokeStyle=this.getPattern()},createPath:function(t){var e=this.callSuper("createPath",t),i=e._getLeftTopCoords().scalarAdd(e.strokeWidth/2);return e.stroke=new fabric.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-i.x,offsetY:-i.y}),e}}),fabric.MosaicBrush=fabric.util.createClass(fabric.PencilBrush,{getPatternSrc:function(){function t(t,e){var i,n,r,o,s,a,c,l=t.data,u=t.height,h=t.width;for(n=0;n<u;n+=e)for(r=0;r<h;r+=e){i=4*n*h+4*r,o=l[i],s=l[i+1],a=l[i+2],c=l[i+3];for(var f=n,d=n+e;f<d;f++)for(var p=r,g=r+e;p<g;p++)i=4*f*h+4*p,l[i]=o,l[i+1]=s,l[i+2]=a,l[i+3]=c}return t}var e=fabric.document.createElement("canvas"),i=e.getContext("2d"),n=document.querySelector(this.lowerQuery),r=n.height,o=n.width,s=document.querySelector(this.upperQuery),a=s.height,c=s.width,l=n.getContext("2d"),u=this.blocksize||10;e.width=c,e.height=a,i.scale(c/o,a/r),i.drawImage(l.canvas,0,0);var h=i.getImageData(0,0,o,r),f=t(h,u);return i.putImageData(f,0,0),e},getDataUrlFromPatternSrc:function(){return{src:this.getPatternSrc().toDataURL()}},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.upperQuery",'"'+this.upperQuery+'"').replace("this.lowerQuery",'"'+this.lowerQuery+'"').replace("this.blocksize",this.blocksize)},getPattern:function(){var t=this.canvas;return this.upperQuery=fabric.util.Simmer(t.upperCanvasEl),this.lowerQuery=fabric.util.Simmer(t.lowerCanvasEl),this.blocksize=this.blocksize||10,this.canvas.contextTop.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(){this.callSuper("_setBrushStyles"),this.canvas.contextTop.strokeStyle=this.getPattern()},createPath:function(t){var e=this.callSuper("createPath",t),i=e._getLeftTopCoords().scalarAdd(e.strokeWidth/2),n="";return this._mosaic_cache&&this._mosaic_cache.mosaicSign===this.mosaicSign?n=this._mosaic_cache.source:(n=this.getPatternSrc(),this._mosaic_cache={mosaicSign:this.mosaicSign,source:n}),e.stroke=new fabric.Pattern({source:n,offsetX:-i.x,offsetY:-i.y}),e}}),function(){var t=fabric.util.getPointer,e=fabric.util.degreesToRadians,i=fabric.util.radiansToDegrees,n=Math.atan2,r=Math.abs,o=fabric.StaticCanvas.supports("setLineDash"),s=.5;fabric.Canvas=fabric.util.createClass(fabric.StaticCanvas,{initialize:function(t,e){e||(e={}),this._initStatic(t,e),this._initInteractive(),this._createCacheCanvas()},uniScaleTransform:!1,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",rotationCursor:"crosshair",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=fabric.PencilBrush&&new fabric.PencilBrush(this),this.MosaicDrawingBrush=fabric.MosaicBrush&&new fabric.MosaicBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var t,e=this.getActiveGroup(),i=this.getActiveObject(),n=[],r=[];if(!e&&!i||this.preserveObjectStacking)n=this._objects;else{for(var o=0,s=this._objects.length;o<s;o++)t=this._objects[o],e&&e.contains(t)||t===i?r.push(t):n.push(t);e&&(e._set("_objects",r),n.push(e)),i&&n.push(i)}return n},renderAll:function(){!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1);var t=this.contextContainer;return this.renderCanvas(t,this._chooseObjectsToRender()),this},renderTop:function(){var t=this.contextTop;return this.clearContext(t),this.selection&&this._groupSelector&&this._drawSelection(t),this.fire("after:render"),this.contextTopDirty=!0,this},_resetCurrentTransform:function(){var t=this._currentTransform;t.target.set({scaleX:t.original.scaleX,scaleY:t.original.scaleY,skewX:t.original.skewX,skewY:t.original.skewY,left:t.original.left,top:t.original.top}),this._shouldCenterTransform(t.target)?"rotate"===t.action||"scale&rotate"===t.action?this._setOriginToCenter(t.target):("center"!==t.originX&&("right"===t.originX?t.mouseXSign=-1:t.mouseXSign=1),"center"!==t.originY&&("bottom"===t.originY?t.mouseYSign=-1:t.mouseYSign=1),t.originX="center",t.originY="center"):(t.originX=t.original.originX,t.originY=t.original.originY)},containsPoint:function(t,e,i){var n,r=!0,o=i||this.getPointer(t,r);return n=e.group&&e.group===this.getActiveGroup()?this._normalizePointer(e.group,o):{x:o.x,y:o.y},e.containsPoint(n)||e._findTargetCorner(o)},_normalizePointer:function(t,e){var i=t.calcTransformMatrix(),n=fabric.util.invertTransform(i),r=this.viewportTransform,o=this.restorePointerVpt(e),s=fabric.util.transformPoint(o,n);return fabric.util.transformPoint(s,r)},isTargetTransparent:function(t,e,i){var n=t.hasBorders,r=t.transparentCorners,o=this.contextCache,s=t.selectionBackgroundColor;t.hasBorders=t.transparentCorners=!1,t.selectionBackgroundColor="",o.save(),o.transform.apply(o,this.viewportTransform),t.render(o),o.restore(),t.active&&t._renderControls(o),t.hasBorders=n,t.transparentCorners=r,t.selectionBackgroundColor=s;var a=fabric.util.isTransparent(o,e,i,this.targetFindTolerance);return this.clearContext(o),a},_shouldClearSelection:function(t,e){var i=this.getActiveGroup(),n=this.getActiveObject();return!e||e&&i&&!i.contains(e)&&i!==e&&!t[this.selectionKey]||e&&!e.evented||e&&!e.selectable&&n&&n!==e},_shouldCenterTransform:function(t){if(t){var e,i=this._currentTransform;return"scale"===i.action||"scaleX"===i.action||"scaleY"===i.action?e=this.centeredScaling||t.centeredScaling:"rotate"!==i.action&&"scale&rotate"!==i.action||(e=this.centeredRotation||t.centeredRotation),e?!i.altKey:i.altKey}},_getOriginFromCorner:function(t,e){var i={x:t.originX,y:t.originY};return"ml"===e||"tl"===e||"bl"===e?i.x="right":"mr"!==e&&"tr"!==e&&"br"!==e||(i.x="left"),"tl"===e||"mt"===e||"tr"===e?i.y="bottom":"bl"!==e&&"mb"!==e&&"br"!==e||(i.y="top"),i},_getActionFromCorner:function(t,e,i){if(!e)return"drag";switch(e){case"mtr":return"rotate";case"ml":case"mr":return i[this.altActionKey]?"skewY":"scaleX";case"mt":case"mb":return i[this.altActionKey]?"skewX":"scaleY";case"tr":if("editor"===t.cornerStyle)return"remove";case"br":if("editor"===t.cornerStyle)return"scale&rotate";default:return"scale"}},_setupCurrentTransform:function(t,i){if(i){var n=this.getPointer(t),r=i._findTargetCorner(this.getPointer(t,!0)),o=this._getActionFromCorner(i,r,t),s=this._getOriginFromCorner(i,r);this._currentTransform={target:i,action:o,corner:r,scaleX:i.scaleX,scaleY:i.scaleY,skewX:i.skewX,skewY:i.skewY,offsetX:n.x-i.left,offsetY:n.y-i.top,originX:s.x,originY:s.y,ex:n.x,ey:n.y,lastX:n.x,lastY:n.y,left:i.left,top:i.top,theta:e(i.angle),width:i.width*i.scaleX,mouseXSign:1,mouseYSign:1,shiftKey:t.shiftKey,altKey:t[this.centeredKey]},this._currentTransform.original={left:i.left,top:i.top,scaleX:i.scaleX,scaleY:i.scaleY,skewX:i.skewX,skewY:i.skewY,originX:s.x,originY:s.y},this._resetCurrentTransform()}},_translateObject:function(t,e){var i=this._currentTransform,n=i.target,r=t-i.offsetX,o=e-i.offsetY,s=!n.get("lockMovementX")&&n.left!==r,a=!n.get("lockMovementY")&&n.top!==o;return s&&n.set("left",r),a&&n.set("top",o),s||a},_changeSkewTransformOrigin:function(t,e,i){var n="originX",r={0:"center"},o=e.target.skewX,s="left",a="right",c="mt"===e.corner||"ml"===e.corner?1:-1,l=1;t=t>0?1:-1,"y"===i&&(o=e.target.skewY,s="top",a="bottom",n="originY"),r[-1]=s,r[1]=a,e.target.flipX&&(l*=-1),e.target.flipY&&(l*=-1),0===o?(e.skewSign=-c*t*l,e[n]=r[-t]):(o=o>0?1:-1,e.skewSign=o,e[n]=r[o*c*l])},_skewObject:function(t,e,i){var n=this._currentTransform,r=n.target,o=!1,s=r.get("lockSkewingX"),a=r.get("lockSkewingY");if(s&&"x"===i||a&&"y"===i)return!1;var c,l,u=r.getCenterPoint(),h=r.toLocalPoint(new fabric.Point(t,e),"center","center")[i],f=r.toLocalPoint(new fabric.Point(n.lastX,n.lastY),"center","center")[i],d=r._getTransformedDimensions();return this._changeSkewTransformOrigin(h-f,n,i),c=r.toLocalPoint(new fabric.Point(t,e),n.originX,n.originY)[i],l=r.translateToOriginPoint(u,n.originX,n.originY),o=this._setObjectSkew(c,n,i,d),n.lastX=t,n.lastY=e,r.setPositionByOrigin(l,n.originX,n.originY),o},_setObjectSkew:function(t,e,i,n){var r,o,s,a,c,l,u,h,f,d=e.target,p=!1,g=e.skewSign;return"x"===i?(a="y",c="Y",l="X",h=0,f=d.skewY):(a="x",c="X",l="Y",h=d.skewX,f=0),s=d._getTransformedDimensions(h,f),u=2*Math.abs(t)-s[i],u<=2?r=0:(r=g*Math.atan(u/d["scale"+l]/(s[a]/d["scale"+c])),r=fabric.util.radiansToDegrees(r)),p=d["skew"+l]!==r,d.set("skew"+l,r),0!==d["skew"+c]&&(o=d._getTransformedDimensions(),r=n[a]/o[a]*d["scale"+c],d.set("scale"+c,r)),p},_scaleObject:function(t,e,i){var n=this._currentTransform,r=n.target,o=r.get("lockScalingX"),s=r.get("lockScalingY"),a=r.get("lockScalingFlip");if(o&&s)return!1;var c=r.translateToOriginPoint(r.getCenterPoint(),n.originX,n.originY),l=r.toLocalPoint(new fabric.Point(t,e),n.originX,n.originY),u=r._getTransformedDimensions(),h=!1;return this._setLocalMouse(l,n),h=this._setObjectScale(l,n,o,s,i,a,u),r.setPositionByOrigin(c,n.originX,n.originY),h},_setObjectScale:function(t,e,i,n,r,o,s){var a,c,l,u,h=e.target,f=!1,d=!1,p=!1;return l=t.x*h.scaleX/s.x,u=t.y*h.scaleY/s.y,a=h.scaleX!==l,c=h.scaleY!==u,o&&l<=0&&l<h.scaleX&&(f=!0),o&&u<=0&&u<h.scaleY&&(d=!0),"equally"!==r||i||n?r?"x"!==r||h.get("lockUniScaling")?"y"!==r||h.get("lockUniScaling")||d||n||h.set("scaleY",u)&&(p=p||c):f||i||h.set("scaleX",l)&&(p=p||a):(f||i||h.set("scaleX",l)&&(p=p||a),d||n||h.set("scaleY",u)&&(p=p||c)):f||d||(p=this._scaleObjectEqually(t,h,e,s)),e.newScaleX=l,e.newScaleY=u,f||d||this._flipObject(e,r),p},_scaleObjectEqually:function(t,e,i,n){var r,o=t.y+t.x,s=n.y*i.original.scaleY/e.scaleY+n.x*i.original.scaleX/e.scaleX;return i.newScaleX=i.original.scaleX*o/s,i.newScaleY=i.original.scaleY*o/s,r=i.newScaleX!==e.scaleX||i.newScaleY!==e.scaleY,e.set("scaleX",i.newScaleX),e.set("scaleY",i.newScaleY),r},_flipObject:function(t,e){t.newScaleX<0&&"y"!==e&&("left"===t.originX?t.originX="right":"right"===t.originX&&(t.originX="left")),t.newScaleY<0&&"x"!==e&&("top"===t.originY?t.originY="bottom":"bottom"===t.originY&&(t.originY="top"))},_setLocalMouse:function(t,e){var i=e.target;"right"===e.originX?t.x*=-1:"center"===e.originX&&(t.x*=2*e.mouseXSign,t.x<0&&(e.mouseXSign=-e.mouseXSign)),"bottom"===e.originY?t.y*=-1:"center"===e.originY&&(t.y*=2*e.mouseYSign,t.y<0&&(e.mouseYSign=-e.mouseYSign)),r(t.x)>i.padding?t.x<0?t.x+=i.padding:t.x-=i.padding:t.x=0,r(t.y)>i.padding?t.y<0?t.y+=i.padding:t.y-=i.padding:t.y=0},_rotateObject:function(t,e){var r=this._currentTransform;if(r.target.get("lockRotation"))return!1;var o=n(r.ey-r.top,r.ex-r.left),s=n(e-r.top,t-r.left),a=i(s-o+r.theta),c=!0;if(a=this._checkRotateLock(a,0),a=this._checkRotateLock(a,90),a=this._checkRotateLock(a,180),a=this._checkRotateLock(a,270),a<0&&(a=360+a),a%=360,r.target.snapAngle>0){var l=r.target.snapAngle,u=r.target.snapThreshold||l,h=Math.ceil(a/l)*l,f=Math.floor(a/l)*l;Math.abs(a-f)<u?a=f:Math.abs(a-h)<u&&(a=h),r.target.angle===a&&(c=!1)}return r.target.angle=a,c},_checkRotateLock:function(t,e,i){return i=i?i:5,Math.abs(Math.abs(t)-e)<i?(this.fire("object:rotateFix",{angle:e}),t<0?e*-1:e):t},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.setAngle(0)},_drawSelection:function(t){var e=this._groupSelector,i=e.left,n=e.top,a=r(i),c=r(n);if(this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(e.ex-(i>0?0:-i),e.ey-(n>0?0:-n),a,c)),this.selectionLineWidth&&this.selectionBorderColor)if(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,this.selectionDashArray.length>1&&!o){var l=e.ex+s-(i>0?0:a),u=e.ey+s-(n>0?0:c);t.beginPath(),fabric.util.drawDashedLine(t,l,u,l+a,u,this.selectionDashArray),fabric.util.drawDashedLine(t,l,u+c-1,l+a,u+c-1,this.selectionDashArray),fabric.util.drawDashedLine(t,l,u,l,u+c,this.selectionDashArray),fabric.util.drawDashedLine(t,l+a-1,u,l+a-1,u+c,this.selectionDashArray),t.closePath(),t.stroke()}else fabric.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(e.ex+s-(i>0?0:a),e.ey+s-(n>0?0:c),a,c)},findTarget:function(t,e){if(!this.skipTargetFind){var i,n=!0,r=this.getPointer(t,n),o=this.getActiveGroup(),s=this.getActiveObject();if(o&&!e&&this._checkTarget(r,o))return this._fireOverOutEvents(o,t),o;if(s&&s._findTargetCorner(r))return this._fireOverOutEvents(s,t),s;if(s&&this._checkTarget(r,s)){if(!this.preserveObjectStacking)return this._fireOverOutEvents(s,t),s;i=s}this.targets=[];var a=this._searchPossibleTargets(this._objects,r);return t[this.altSelectionKey]&&a&&i&&a!==i&&(a=i),this._fireOverOutEvents(a,t),a}},_fireOverOutEvents:function(t,e){t?this._hoveredTarget!==t&&(this._hoveredTarget&&(this.fire("mouse:out",{target:this._hoveredTarget,e:e}),this._hoveredTarget.fire("mouseout")),this.fire("mouse:over",{target:t,e:e}),t.fire("mouseover"),this._hoveredTarget=t):this._hoveredTarget&&(this.fire("mouse:out",{target:this._hoveredTarget,e:e}),this._hoveredTarget.fire("mouseout"),this._hoveredTarget=null)},_checkTarget:function(t,e){if(e&&e.visible&&e.evented&&this.containsPoint(null,e,t)){if(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing)return!0;var i=this.isTargetTransparent(e,t.x,t.y);if(!i)return!0}},_searchPossibleTargets:function(t,e){for(var i,n,r,o=t.length;o--;)if(this._checkTarget(e,t[o])){i=t[o],"group"===i.type&&i.subTargetCheck&&(n=this._normalizePointer(i,e),r=this._searchPossibleTargets(i._objects,n),r&&this.targets.push(r));break}return i},restorePointerVpt:function(t){return fabric.util.transformPoint(t,fabric.util.invertTransform(this.viewportTransform))},getPointer:function(e,i,n){n||(n=this.upperCanvasEl);var r,o=t(e),s=n.getBoundingClientRect(),a=s.width||0,c=s.height||0;return a&&c||("top"in s&&"bottom"in s&&(c=Math.abs(s.top-s.bottom)),"right"in s&&"left"in s&&(a=Math.abs(s.right-s.left))),this.calcOffset(),o.x=o.x-this._offset.left,o.y=o.y-this._offset.top,
i||(o=this.restorePointerVpt(o)),r=0===a||0===c?{width:1,height:1}:{width:n.width/a,height:n.height/c},{x:o.x*r.width,y:o.y*r.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,"");this.upperCanvasEl=this._createCanvasElement(),fabric.util.addClass(this.upperCanvasEl,"upper-canvas "+t),this.wrapperEl.appendChild(this.upperCanvasEl),this._copyCanvasStyle(this.lowerCanvasEl,this.upperCanvasEl),this._applyCanvasStyle(this.upperCanvasEl),this.contextTop=this.upperCanvasEl.getContext("2d")},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=fabric.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),fabric.util.setStyle(this.wrapperEl,{width:this.getWidth()+"px",height:this.getHeight()+"px",position:"relative"}),fabric.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.getWidth()||t.width,i=this.getHeight()||t.height;fabric.util.setStyle(t,{position:"absolute",width:e+"px",height:i+"px",left:0,top:0}),t.width=e,t.height=i,fabric.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},_setActiveObject:function(t){this._activeObject&&this._activeObject.set("active",!1),this._activeObject=t,t.set("active",!0)},setActiveObject:function(t,e){return this._setActiveObject(t),this.renderAll(),this.fire("object:selected",{target:t,e:e}),t.fire("selected",{e:e}),this},getActiveObject:function(){return this._activeObject},_onObjectRemoved:function(t){this.getActiveObject()===t&&(this.fire("before:selection:cleared",{target:t}),this._discardActiveObject(),this.fire("selection:cleared",{target:t}),t.fire("deselected")),this.callSuper("_onObjectRemoved",t)},_discardActiveObject:function(){this._activeObject&&this._activeObject.set("active",!1),this._activeObject=null},discardActiveObject:function(t){var e=this._activeObject;return this.fire("before:selection:cleared",{target:e,e:t}),this._discardActiveObject(),this.fire("selection:cleared",{e:t}),e&&e.fire("deselected",{e:t}),this},_setActiveGroup:function(t){this._activeGroup=t,t&&t.set("active",!0)},setActiveGroup:function(t,e){return this._setActiveGroup(t),t&&(this.fire("object:selected",{target:t,e:e}),t.fire("selected",{e:e})),this},getActiveGroup:function(){return this._activeGroup},_discardActiveGroup:function(){var t=this.getActiveGroup();t&&t.destroy(),this.setActiveGroup(null)},discardActiveGroup:function(t){var e=this.getActiveGroup();return this.fire("before:selection:cleared",{e:t,target:e}),this._discardActiveGroup(),this.fire("selection:cleared",{e:t}),this},deactivateAll:function(){for(var t=this.getObjects(),e=0,i=t.length;e<i;e++)t[e].set("active",!1);return this._discardActiveGroup(),this._discardActiveObject(),this},deactivateAllWithDispatch:function(t){var e=this.getActiveGroup(),i=this.getActiveObject();return(i||e)&&this.fire("before:selection:cleared",{target:i||e,e:t}),this.deactivateAll(),(i||e)&&(this.fire("selection:cleared",{e:t,target:i}),i&&i.fire("deselected")),this},dispose:function(){this.callSuper("dispose");var t=this.wrapperEl;return this.removeListeners(),t.removeChild(this.upperCanvasEl),t.removeChild(this.lowerCanvasEl),delete this.upperCanvasEl,t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,this},clear:function(){return this.discardActiveGroup(),this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(t){var e=this.getActiveGroup();e?e._renderControls(t):this._drawObjectsControls(t)},_drawObjectsControls:function(t){for(var e=0,i=this._objects.length;e<i;++e)this._objects[e]&&this._objects[e].active&&this._objects[e]._renderControls(t)},_toObject:function(t,e,i){var n=this._realizeGroupTransformOnObject(t),r=this.callSuper("_toObject",t,e,i);return this._unwindGroupTransformOnObject(t,n),r},_realizeGroupTransformOnObject:function(t){var e=["angle","flipX","flipY","height","left","scaleX","scaleY","top","width"];if(t.group&&t.group===this.getActiveGroup()){var i={};return e.forEach(function(e){i[e]=t[e]}),this.getActiveGroup().realizeTransform(t),i}return null},_unwindGroupTransformOnObject:function(t,e){e&&t.set(e)},_setSVGObject:function(t,e,i){var n;n=this._realizeGroupTransformOnObject(e),this.callSuper("_setSVGObject",t,e,i),this._unwindGroupTransformOnObject(e,n)}});for(var a in fabric.StaticCanvas)"prototype"!==a&&(fabric.Canvas[a]=fabric.StaticCanvas[a]);fabric.isTouchSupported&&(fabric.Canvas.prototype._setCursorFromEvent=function(){}),fabric.Element=fabric.Canvas}(),function(){var t={mt:0,tr:1,mr:2,br:3,mb:4,bl:5,ml:6,tl:7},e=fabric.util.addListener,i=fabric.util.removeListener;fabric.util.object.extend(fabric.Canvas.prototype,{cursorMap:["n-resize","ne-resize","e-resize","se-resize","s-resize","sw-resize","w-resize","nw-resize"],_initEventListeners:function(){this._bindEvents(),e(fabric.window,"resize",this._onResize),e(this.upperCanvasEl,"mousedown",this._onMouseDown),e(this.upperCanvasEl,"mousemove",this._onMouseMove),e(this.upperCanvasEl,"mouseout",this._onMouseOut),e(this.upperCanvasEl,"mouseenter",this._onMouseEnter),e(this.upperCanvasEl,"wheel",this._onMouseWheel),e(this.upperCanvasEl,"contextmenu",this._onContextMenu),e(this.upperCanvasEl,"touchstart",this._onMouseDown),e(this.upperCanvasEl,"touchmove",this._onMouseMove),"undefined"!=typeof eventjs&&"add"in eventjs&&(eventjs.add(this.upperCanvasEl,"gesture",this._onGesture),eventjs.add(this.upperCanvasEl,"drag",this._onDrag),eventjs.add(this.upperCanvasEl,"orientation",this._onOrientationChange),eventjs.add(this.upperCanvasEl,"shake",this._onShake),eventjs.add(this.upperCanvasEl,"longpress",this._onLongPress))},_bindEvents:function(){this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this)},removeListeners:function(){i(fabric.window,"resize",this._onResize),i(this.upperCanvasEl,"mousedown",this._onMouseDown),i(this.upperCanvasEl,"mousemove",this._onMouseMove),i(this.upperCanvasEl,"mouseout",this._onMouseOut),i(this.upperCanvasEl,"mouseenter",this._onMouseEnter),i(this.upperCanvasEl,"wheel",this._onMouseWheel),i(this.upperCanvasEl,"contextmenu",this._onContextMenu),i(this.upperCanvasEl,"touchstart",this._onMouseDown),i(this.upperCanvasEl,"touchmove",this._onMouseMove),"undefined"!=typeof eventjs&&"remove"in eventjs&&(eventjs.remove(this.upperCanvasEl,"gesture",this._onGesture),eventjs.remove(this.upperCanvasEl,"drag",this._onDrag),eventjs.remove(this.upperCanvasEl,"orientation",this._onOrientationChange),eventjs.remove(this.upperCanvasEl,"shake",this._onShake),eventjs.remove(this.upperCanvasEl,"longpress",this._onLongPress))},_onGesture:function(t,e){this.__onTransformGesture&&this.__onTransformGesture(t,e)},_onDrag:function(t,e){this.__onDrag&&this.__onDrag(t,e)},_onMouseWheel:function(t){this.__onMouseWheel(t)},_onMouseOut:function(t){var e=this._hoveredTarget;this.fire("mouse:out",{target:e,e:t}),this._hoveredTarget=null,e&&e.fire("mouseout",{e:t})},_onMouseEnter:function(t){this.findTarget(t)||(this.fire("mouse:over",{target:null,e:t}),this._hoveredTarget=null)},_onOrientationChange:function(t,e){this.__onOrientationChange&&this.__onOrientationChange(t,e)},_onShake:function(t,e){this.__onShake&&this.__onShake(t,e)},_onLongPress:function(t,e){this.__onLongPress&&this.__onLongPress(t,e)},_onContextMenu:function(t){return this.stopContextMenu&&(t.stopPropagation(),t.preventDefault()),!1},_onMouseDown:function(t){this.__onMouseDown(t),e(fabric.document,"touchend",this._onMouseUp),e(fabric.document,"touchmove",this._onMouseMove),i(this.upperCanvasEl,"mousemove",this._onMouseMove),i(this.upperCanvasEl,"touchmove",this._onMouseMove),"touchstart"===t.type?i(this.upperCanvasEl,"mousedown",this._onMouseDown):(e(fabric.document,"mouseup",this._onMouseUp),e(fabric.document,"mousemove",this._onMouseMove))},_onMouseUp:function(t){if(this.__onMouseUp(t),i(fabric.document,"mouseup",this._onMouseUp),i(fabric.document,"touchend",this._onMouseUp),i(fabric.document,"mousemove",this._onMouseMove),i(fabric.document,"touchmove",this._onMouseMove),e(this.upperCanvasEl,"mousemove",this._onMouseMove),e(this.upperCanvasEl,"touchmove",this._onMouseMove),"touchend"===t.type){var n=this;setTimeout(function(){e(n.upperCanvasEl,"mousedown",n._onMouseDown)},400)}},_onMouseMove:function(t){this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t,e){var i=this.getActiveGroup()||this.getActiveObject();return!!(t&&(t.isMoving||t!==i)||!t&&i||!t&&!i&&!this._groupSelector||e&&this._previousPointer&&this.selection&&(e.x!==this._previousPointer.x||e.y!==this._previousPointer.y))},__onMouseUp:function(t){var e,i=!0,n=this._currentTransform,r=this._groupSelector,o=!r||0===r.left&&0===r.top;if(this.isDrawingMode&&this._isCurrentlyDrawing)return void this._onMouseUpInDrawingMode(t);n&&(this._finalizeCurrentTransform(),i=!n.actionPerformed),e=i?this.findTarget(t,!0):n.target;var s=this._shouldRender(e,this.getPointer(t));if(e||!o?this._maybeGroupObjects(t):(this._groupSelector=null,this._currentTransform=null),e&&(e.isMoving=!1,"editor"===e.cornerStyle)){var a=e._findTargetCorner(this.getPointer(t,!0));if("tr"===a)return void this.fire("object:remove",e)}this._handleCursorAndEvent(t,e,"up"),e&&(e.__corner=0),s&&this.renderAll()},_handleCursorAndEvent:function(t,e,i){this._setCursorFromEvent(t,e),this._handleEvent(t,i,e?e:null)},_handleEvent:function(t,e,i){var n=void 0===typeof i?this.findTarget(t):i,r=this.targets||[],o={e:t,target:n,subTargets:r};this.fire("mouse:"+e,o),n&&n.fire("mouse"+e,o);for(var s=0;s<r.length;s++)r[s].fire("mouse"+e,o)},_finalizeCurrentTransform:function(){var t=this._currentTransform,e=t.target;e._scaling&&(e._scaling=!1),e.setCoords(),this._restoreOriginXY(e),(t.actionPerformed||this.stateful&&e.hasStateChanged())&&(this.fire("object:modified",{target:e}),e.fire("modified"))},_restoreOriginXY:function(t){if(this._previousOriginX&&this._previousOriginY){var e=t.translateToOriginPoint(t.getCenterPoint(),this._previousOriginX,this._previousOriginY);t.originX=this._previousOriginX,t.originY=this._previousOriginY,t.left=e.x,t.top=e.y,this._previousOriginX=null,this._previousOriginY=null}},_onMouseDownInDrawingMode:function(t){this._isCurrentlyDrawing=!0,this.discardActiveObject(t).renderAll(),this.clipTo&&fabric.util.clipContext(this,this.contextTop);var e=this.getPointer(t);this.freeDrawingBrush.onMouseDown(e),this._handleEvent(t,"down")},_onMouseMoveInDrawingMode:function(t){if(this._isCurrentlyDrawing){var e=this.getPointer(t);this.freeDrawingBrush.onMouseMove(e)}this.setCursor(this.freeDrawingCursor),this._handleEvent(t,"move")},_onMouseUpInDrawingMode:function(t){this._isCurrentlyDrawing=!1,this.clipTo&&this.contextTop.restore(),this.freeDrawingBrush.onMouseUp(),this._handleEvent(t,"up")},__onMouseDown:function(t){var e=this.findTarget(t),i=this.getPointer(t,!0),n="which"in t?3===t.which:2===t.button;if(n)return void(this.fireRightClick&&this._handleEvent(t,"down",e?e:null));if(this.isDrawingMode)return void this._onMouseDownInDrawingMode(t);if(!this._currentTransform){this._previousPointer=i;var r=this._shouldRender(e,i),o=this._shouldGroup(t,e);this._shouldClearSelection(t,e)?this._clearSelection(t,e,i):o&&(this._handleGrouping(t,e),e=this.getActiveGroup()),e&&(!e.selectable||!e.__corner&&o||(this._beforeTransform(t,e),this._setupCurrentTransform(t,e)),e!==this.getActiveGroup()&&e!==this.getActiveObject()&&(this.deactivateAll(),e.selectable&&this.setActiveObject(e,t))),this._handleEvent(t,"down",e?e:null),r&&this.renderAll()}},_beforeTransform:function(t,e){this.stateful&&e.saveState(),e._findTargetCorner(this.getPointer(t))&&this.onBeforeScaleRotate(e)},_clearSelection:function(t,e,i){this.deactivateAllWithDispatch(t),e&&e.selectable?this.setActiveObject(e,t):this.selection&&(this._groupSelector={ex:i.x,ey:i.y,top:0,left:0})},_setOriginToCenter:function(t){this._previousOriginX=this._currentTransform.target.originX,this._previousOriginY=this._currentTransform.target.originY;var e=t.getCenterPoint();t.originX="center",t.originY="center",t.left=e.x,t.top=e.y,this._currentTransform.left=t.left,this._currentTransform.top=t.top},_setCenterToOrigin:function(t){var e=t.translateToOriginPoint(t.getCenterPoint(),this._previousOriginX,this._previousOriginY);t.originX=this._previousOriginX,t.originY=this._previousOriginY,t.left=e.x,t.top=e.y,this._previousOriginX=null,this._previousOriginY=null},__onMouseMove:function(t){var e,i;if(this.isDrawingMode)return void this._onMouseMoveInDrawingMode(t);if(!("undefined"!=typeof t.touches&&t.touches.length>1)){var n=this._groupSelector;n?this.noSelector||(i=this.getPointer(t,!0),n.left=i.x-n.ex,n.top=i.y-n.ey,this.renderTop()):this._currentTransform?this._transformObject(t):(e=this.findTarget(t),this._setCursorFromEvent(t,e)),this._handleEvent(t,"move",e?e:null)}},__onMouseWheel:function(t){this.fire("mouse:wheel",{e:t})},_transformObject:function(t){var e=this.getPointer(t),i=this._currentTransform;i.reset=!1,i.target.isMoving=!0,this._beforeScaleTransform(t,i),this._performTransformAction(t,i,e),i.actionPerformed&&this.renderAll()},_performTransformAction:function(t,e,i){var n=i.x,r=i.y,o=e.target,s=e.action,a=!1;"rotate"===s?(a=this._rotateObject(n,r))&&this._fire("rotating",o,t):"scale&rotate"===s?((a=this._rotateObject(n,r))&&this._fire("rotating",o,t),(a=this._onScale(t,e,n,r))&&this._fire("scaling",o,t)):"scale"===s?(a=this._onScale(t,e,n,r))&&this._fire("scaling",o,t):"remove"===s||("scaleX"===s?(a=this._scaleObject(n,r,"x"))&&this._fire("scaling",o,t):"scaleY"===s?(a=this._scaleObject(n,r,"y"))&&this._fire("scaling",o,t):"skewX"===s?(a=this._skewObject(n,r,"x"))&&this._fire("skewing",o,t):"skewY"===s?(a=this._skewObject(n,r,"y"))&&this._fire("skewing",o,t):(a=this._translateObject(n,r),a&&(this._fire("moving",o,t),this.setCursor(o.moveCursor||this.moveCursor)))),e.actionPerformed=a},_fire:function(t,e,i){this.fire("object:"+t,{target:e,e:i}),e.fire(t,{e:i})},_beforeScaleTransform:function(t,e){if("scale"===e.action||"scaleX"===e.action||"scaleY"===e.action){var i=this._shouldCenterTransform(e.target);(i&&("center"!==e.originX||"center"!==e.originY)||!i&&"center"===e.originX&&"center"===e.originY)&&(this._resetCurrentTransform(),e.reset=!0)}},_onScale:function(t,e,i,n){return!t[this.uniScaleKey]&&!this.uniScaleTransform||e.target.get("lockUniScaling")?(e.reset||"scale"!==e.currentAction||this._resetCurrentTransform(),e.currentAction="scaleEqually",this._scaleObject(i,n,"equally")):(e.currentAction="scale",this._scaleObject(i,n))},_setCursorFromEvent:function(t,e){if(!e)return this.setCursor(this.defaultCursor),!1;var i=e.hoverCursor||this.hoverCursor;if(e.selectable){var n=this.getActiveGroup(),r=e._findTargetCorner&&(!n||!n.contains(e))&&e._findTargetCorner(this.getPointer(t,!0));r?this._setCornerCursor(r,e,t):this.setCursor(i)}else this.setCursor(i);return!0},_setCornerCursor:function(e,i,n){if(e in t)this.setCursor(this._getRotatedCornerCursor(e,i,n));else{if("mtr"!==e||!i.hasRotatingPoint)return this.setCursor(this.defaultCursor),!1;this.setCursor(this.rotationCursor)}},_getRotatedCornerCursor:function(e,i,n){var r=Math.round(i.getAngle()%360/45);return r<0&&(r+=8),r+=t[e],n[this.altActionKey]&&t[e]%2===0&&(r+=2),r%=8,this.cursorMap[r]}})}(),function(){var t=Math.min,e=Math.max;fabric.util.object.extend(fabric.Canvas.prototype,{_shouldGroup:function(t,e){var i=this.getActiveObject();return t[this.selectionKey]&&e&&e.selectable&&(this.getActiveGroup()||i&&i!==e)&&this.selection},_handleGrouping:function(t,e){var i=this.getActiveGroup();(e!==i||(e=this.findTarget(t,!0)))&&(i?this._updateActiveGroup(e,t):this._createActiveGroup(e,t),this._activeGroup&&this._activeGroup.saveCoords())},_updateActiveGroup:function(t,e){var i=this.getActiveGroup();if(i.contains(t)){if(i.removeWithUpdate(t),t.set("active",!1),1===i.size())return this.discardActiveGroup(e),void this.setActiveObject(i.item(0))}else i.addWithUpdate(t);this.fire("selection:created",{target:i,e:e}),i.set("active",!0)},_createActiveGroup:function(t,e){if(this._activeObject&&t!==this._activeObject){var i=this._createGroup(t);i.addWithUpdate(),this.setActiveGroup(i),this._activeObject=null,this.fire("selection:created",{target:i,e:e})}t.set("active",!0)},_createGroup:function(t){var e=this.getObjects(),i=e.indexOf(this._activeObject)<e.indexOf(t),n=i?[this._activeObject,t]:[t,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new fabric.Group(n,{canvas:this})},_groupSelectedObjects:function(t){var e=this._collectObjects();1===e.length?this.setActiveObject(e[0],t):e.length>1&&(e=new fabric.Group(e.reverse(),{canvas:this}),e.addWithUpdate(),this.setActiveGroup(e,t),e.saveCoords(),this.fire("selection:created",{target:e}),this.renderAll())},_collectObjects:function(){for(var i,n=[],r=this._groupSelector.ex,o=this._groupSelector.ey,s=r+this._groupSelector.left,a=o+this._groupSelector.top,c=new fabric.Point(t(r,s),t(o,a)),l=new fabric.Point(e(r,s),e(o,a)),u=r===s&&o===a,h=this._objects.length;h--&&(i=this._objects[h],!(i&&i.selectable&&i.visible&&(i.intersectsWithRect(c,l)||i.isContainedWithinRect(c,l)||i.containsPoint(c)||i.containsPoint(l))&&(i.set("active",!0),n.push(i),u))););return n},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t);var e=this.getActiveGroup();e&&(e.setObjectsCoords().setCoords(),e.isMoving=!1,this.setCursor(this.defaultCursor)),this._groupSelector=null,this._currentTransform=null}})}(),function(){var t=fabric.StaticCanvas.supports("toDataURLWithQuality");fabric.util.object.extend(fabric.StaticCanvas.prototype,{toDataURL:function(t){t||(t={});var e=t.format||"png",i=t.quality||1,n=t.multiplier||1,r={left:t.left||0,top:t.top||0,width:t.width||0,height:t.height||0};return this.__toDataURLWithMultiplier(e,i,r,n)},__toDataURLWithMultiplier:function(t,e,i,n){var r=this.getWidth(),o=this.getHeight(),s=(i.width||this.getWidth())*n,a=(i.height||this.getHeight())*n,c=this.getZoom(),l=c*n,u=this.viewportTransform,h=(u[4]-i.left)*n,f=(u[5]-i.top)*n,d=[l,0,0,l,h,f],p=this.interactive;this.viewportTransform=d,this.interactive&&(this.interactive=!1),r!==s||o!==a?this.setDimensions({width:s,height:a}):this.renderAll();var g=this.__toDataURL(t,e,i);return p&&(this.interactive=p),this.viewportTransform=u,this.setDimensions({width:r,height:o}),g},__toDataURL:function(e,i){var n=this.contextContainer.canvas;"jpg"===e&&(e="jpeg");var r=t?n.toDataURL("image/"+e,i):n.toDataURL("image/"+e);return r},toDataURLWithMultiplier:function(t,e,i){return this.toDataURL({format:t,multiplier:e,quality:i})}})}(),fabric.util.object.extend(fabric.StaticCanvas.prototype,{loadFromDatalessJSON:function(t,e,i){return this.loadFromJSON(t,e,i)},loadFromJSON:function(t,e,i){if(t){var n="string"==typeof t?JSON.parse(t):fabric.util.object.clone(t);this.clear();var r=this;return this._enlivenObjects(n.objects,function(){r._setBgOverlay(n,function(){delete n.objects,delete n.backgroundImage,delete n.overlayImage,delete n.background,delete n.overlay;for(var t in n)r[t]=n[t];e&&e()})},i),this}},_setBgOverlay:function(t,e){var i=this,n={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(!(t.backgroundImage||t.overlayImage||t.background||t.overlay))return void(e&&e());var r=function(){n.backgroundImage&&n.overlayImage&&n.backgroundColor&&n.overlayColor&&(i.renderAll(),e&&e())};this.__setBgOverlay("backgroundImage",t.backgroundImage,n,r),this.__setBgOverlay("overlayImage",t.overlayImage,n,r),this.__setBgOverlay("backgroundColor",t.background,n,r),this.__setBgOverlay("overlayColor",t.overlay,n,r),r()},__setBgOverlay:function(t,e,i,n){var r=this;return e?void("backgroundImage"===t||"overlayImage"===t?fabric.Image.fromObject(e,function(e){r[t]=e,i[t]=!0,n&&n()}):this["set"+fabric.util.string.capitalize(t,!0)](e,function(){i[t]=!0,n&&n()})):void(i[t]=!0)},_enlivenObjects:function(t,e,i){var n=this;if(!t||0===t.length)return void(e&&e());var r=this.renderOnAddRemove;this.renderOnAddRemove=!1,fabric.util.enlivenObjects(t,function(t){t.forEach(function(t,e){n.insertAt(t,e)}),n.renderOnAddRemove=r,e&&e()},null,i)},_toDataURL:function(t,e){this.clone(function(i){e(i.toDataURL(t))})},_toDataURLWithMultiplier:function(t,e,i){this.clone(function(n){i(n.toDataURLWithMultiplier(t,e))})},clone:function(t,e){var i=JSON.stringify(this.toJSON(e));this.cloneWithoutData(function(e){e.loadFromJSON(i,function(){t&&t(e)})})},cloneWithoutData:function(t){var e=fabric.document.createElement("canvas");e.width=this.getWidth(),e.height=this.getHeight();var i=new fabric.Canvas(e);i.clipTo=this.clipTo,this.backgroundImage?(i.setBackgroundImage(this.backgroundImage.src,function(){i.renderAll(),t&&t(i)}),i.backgroundImageOpacity=this.backgroundImageOpacity,i.backgroundImageStretch=this.backgroundImageStretch):t&&t(i)}}),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.toFixed,r=e.util.string.capitalize,o=e.util.degreesToRadians,s=e.StaticCanvas.supports("setLineDash");e.Object||(e.Object=e.util.createClass({type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgba(102,153,255,0.75)",borderDashArray:null,cornerColor:"rgba(102,153,255,0.5)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:10,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,transformMatrix:null,minScaleLimit:.01,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,hasRotatingPoint:!0,rotatingPointOffset:40,perPixelTargetFind:!1,includeDefaultValues:!0,clipTo:null,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockUniScaling:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeLineJoin strokeMiterLimit angle opacity fill fillRule globalCompositeOperation shadow clipTo visible backgroundColor skewX skewY".split(" "),initialize:function(t){t&&this.setOptions(t)},_initGradient:function(t){!t.fill||!t.fill.colorStops||t.fill instanceof e.Gradient||this.set("fill",new e.Gradient(t.fill)),!t.stroke||!t.stroke.colorStops||t.stroke instanceof e.Gradient||this.set("stroke",new e.Gradient(t.stroke))},_initPattern:function(t){!t.fill||!t.fill.source||t.fill instanceof e.Pattern||this.set("fill",new e.Pattern(t.fill)),!t.stroke||!t.stroke.source||t.stroke instanceof e.Pattern||this.set("stroke",new e.Pattern(t.stroke))},_initClipping:function(t){if(t.clipTo&&"string"==typeof t.clipTo){var i=e.util.getFunctionBody(t.clipTo);"undefined"!=typeof i&&(this.clipTo=new Function("ctx",i))}},setOptions:function(t){for(var e in t)this.set(e,t[e]);this._initGradient(t),this._initPattern(t),this._initClipping(t)},transform:function(t,e){this.group&&!this.group._transformDone&&this.group===this.canvas._activeGroup&&this.group.transform(t);var i=e?this._getLeftTopCoords():this.getCenterPoint();t.translate(i.x,i.y),t.rotate(o(this.angle)),t.scale(this.scaleX*(this.flipX?-1:1),this.scaleY*(this.flipY?-1:1)),t.transform(1,0,Math.tan(o(this.skewX)),1,0,0),t.transform(1,Math.tan(o(this.skewY)),0,1,0,0)},toObject:function(t){var i=e.Object.NUM_FRACTION_DIGITS,r={type:this.type,originX:this.originX,originY:this.originY,left:n(this.left,i),top:n(this.top,i),width:n(this.width,i),height:n(this.height,i),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:n(this.strokeWidth,i),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeLineJoin:this.strokeLineJoin,strokeMiterLimit:n(this.strokeMiterLimit,i),scaleX:n(this.scaleX,i),scaleY:n(this.scaleY,i),angle:n(this.getAngle(),i),flipX:this.flipX,flipY:this.flipY,opacity:n(this.opacity,i),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,clipTo:this.clipTo&&String(this.clipTo),backgroundColor:this.backgroundColor,fillRule:this.fillRule,globalCompositeOperation:this.globalCompositeOperation,transformMatrix:this.transformMatrix?this.transformMatrix.concat():this.transformMatrix,skewX:n(this.skewX,i),skewY:n(this.skewY,i)};return e.util.populateWithProperties(this,r,t),this.includeDefaultValues||(r=this._removeDefaultValues(r)),r},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(t){var i=e.util.getKlass(t.type).prototype,n=i.stateProperties;return n.forEach(function(e){t[e]===i[e]&&delete t[e];var n="[object Array]"===Object.prototype.toString.call(t[e])&&"[object Array]"===Object.prototype.toString.call(i[e]);n&&0===t[e].length&&0===i[e].length&&delete t[e]}),t},toString:function(){return"#<fabric."+r(this.type)+">"},get:function(t){return this[t]},getObjectScaling:function(){var t=this.scaleX,e=this.scaleY;if(this.group){var i=this.group.getObjectScaling();t*=i.scaleX,e*=i.scaleY}return{scaleX:t,scaleY:e}},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):"function"==typeof e&&"clipTo"!==t?this._set(t,e(this.get(t))):this._set(t,e),this},_set:function(t,i){var n="scaleX"===t||"scaleY"===t;return n&&(i=this._constrainScale(i)),"scaleX"===t&&i<0?(this.flipX=!this.flipX,i*=-1):"scaleY"===t&&i<0?(this.flipY=!this.flipY,i*=-1):"shadow"!==t||!i||i instanceof e.Shadow||(i=new e.Shadow(i)),this[t]=i,"width"!==t&&"height"!==t||(this.minScaleLimit=Math.min(.1,1/Math.max(this.width,this.height))),this},setOnGroup:function(){},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},setSourcePath:function(t){return this.sourcePath=t,this},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:[1,0,0,1,0,0]},render:function(t,i){0===this.width&&0===this.height||!this.visible||(t.save(),this._setupCompositeOperation(t),this.drawSelectionBackground(t),i||this.transform(t),this._setOpacity(t),this._setShadow(t),this._renderBackground(t),this._setStrokeStyles(t),this._setFillStyles(t),this.transformMatrix&&t.transform.apply(t,this.transformMatrix),this.clipTo&&e.util.clipContext(this,t),this._render(t,i),this.clipTo&&t.restore(),t.restore())},_renderBackground:function(t){this.backgroundColor&&(t.fillStyle=this.backgroundColor,t.fillRect(-this.width/2,-this.height/2,this.width,this.height),this._removeShadow(t))},_setOpacity:function(t){this.group&&this.group._setOpacity(t),t.globalAlpha*=this.opacity},_setStrokeStyles:function(t){this.stroke&&(t.lineWidth=this.strokeWidth,t.lineCap=this.strokeLineCap,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,t.strokeStyle=this.stroke.toLive?this.stroke.toLive(t,this):this.stroke)},_setFillStyles:function(t){this.fill&&(t.fillStyle=this.fill.toLive?this.fill.toLive(t,this):this.fill)},_setLineDash:function(t,e,i){e&&(1&e.length&&e.push.apply(e,e),s?t.setLineDash(e):i&&i(t))},_renderControls:function(t,i){if(!(!this.active||i||this.group&&this.group!==this.canvas.getActiveGroup())){var n,r=this.getViewportTransform(),s=this.calcTransformMatrix();s=e.util.multiplyTransformMatrices(r,s),n=e.util.qrDecompose(s),t.save(),t.translate(n.translateX,n.translateY),t.lineWidth=1*this.borderScaleFactor,t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.group&&this.group===this.canvas.getActiveGroup()?(t.rotate(o(n.angle)),this.drawBordersInGroup(t,n)):(t.rotate(o(this.angle)),this.drawBorders(t)),this.drawControls(t),t.restore()}},_setShadow:function(t){if(this.shadow){var i=this.canvas&&this.canvas.viewportTransform[0]||1,n=this.canvas&&this.canvas.viewportTransform[3]||1,r=this.getObjectScaling();this.canvas&&this.canvas._isRetinaScaling()&&(i*=e.devicePixelRatio,n*=e.devicePixelRatio),t.shadowColor=this.shadow.color,t.shadowBlur=this.shadow.blur*(i+n)*(r.scaleX+r.scaleY)/4,t.shadowOffsetX=this.shadow.offsetX*i*r.scaleX,t.shadowOffsetY=this.shadow.offsetY*n*r.scaleY}},_removeShadow:function(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_renderFill:function(t){if(this.fill){if(t.save(),this.fill.gradientTransform){var e=this.fill.gradientTransform;t.transform.apply(t,e)}this.fill.toLive&&t.translate(-this.width/2+this.fill.offsetX||0,-this.height/2+this.fill.offsetY||0),"evenodd"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore()}},_renderStroke:function(t){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this._setLineDash(t,this.strokeDashArray,this._renderDashedStroke),this.stroke.gradientTransform){var e=this.stroke.gradientTransform;t.transform.apply(t,e)}this.stroke.toLive&&t.translate(-this.width/2+this.stroke.offsetX||0,-this.height/2+this.stroke.offsetY||0),t.stroke(),t.restore()}},clone:function(t,i){return this.constructor.fromObject?this.constructor.fromObject(this.toObject(i),t):new e.Object(this.toObject(i))},cloneAsImage:function(t,i){var n=this.toDataURL(i);return e.util.loadImage(n,function(i){t&&t(new e.Image(i))}),this},toDataURL:function(t){t||(t={});var i=e.util.createCanvasElement(),n=this.getBoundingRect();i.width=n.width,i.height=n.height,e.util.wrapElement(i,"div");var r=new e.StaticCanvas(i,{enableRetinaScaling:t.enableRetinaScaling});"jpg"===t.format&&(t.format="jpeg"),"jpeg"===t.format&&(r.backgroundColor="#fff");var o={active:this.get("active"),left:this.getLeft(),top:this.getTop()};this.set("active",!1),this.setPositionByOrigin(new e.Point(r.getWidth()/2,r.getHeight()/2),"center","center");var s=this.canvas;r.add(this);var a=r.toDataURL(t);return this.set(o).setCoords(),this.canvas=s,r.dispose(),r=null,a},isType:function(t){return this.type===t},complexity:function(){return 0},toJSON:function(t){return this.toObject(t)},setGradient:function(t,i){i||(i={});var n={colorStops:[]};n.type=i.type||(i.r1||i.r2?"radial":"linear"),n.coords={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},(i.r1||i.r2)&&(n.coords.r1=i.r1,n.coords.r2=i.r2),i.gradientTransform&&(n.gradientTransform=i.gradientTransform);for(var r in i.colorStops){var o=new e.Color(i.colorStops[r]);n.colorStops.push({offset:r,color:o.toRgb(),opacity:o.getAlpha()})}return this.set(t,e.Gradient.forObject(this,n))},setPatternFill:function(t){return this.set("fill",new e.Pattern(t))},setShadow:function(t){return this.set("shadow",t?new e.Shadow(t):null)},setColor:function(t){return this.set("fill",t),this},setAngle:function(t){var e=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return e&&this._setOriginToCenter(),this.set("angle",t),e&&this._resetOrigin(),
this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},remove:function(){return this.canvas&&this.canvas.remove(this),this},getLocalPointer:function(t,i){i=i||this.canvas.getPointer(t);var n=new e.Point(i.x,i.y),r=this._getLeftTopCoords();return this.angle&&(n=e.util.rotatePoint(n,r,e.util.degreesToRadians(-this.angle))),{x:n.x-r.x,y:n.y-r.y}},_setupCompositeOperation:function(t){this.globalCompositeOperation&&(t.globalCompositeOperation=this.globalCompositeOperation)}}),e.util.createAccessors(e.Object),e.Object.prototype.rotate=e.Object.prototype.setAngle,i(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object.__uid=0)}(exports),function(){var t=fabric.util.degreesToRadians,e={left:-.5,center:0,right:.5},i={top:-.5,center:0,bottom:.5};fabric.util.object.extend(fabric.Object.prototype,{translateToGivenOrigin:function(t,n,r,o,s){var a,c,l,u=t.x,h=t.y;return"string"==typeof n?n=e[n]:n-=.5,"string"==typeof o?o=e[o]:o-=.5,a=o-n,"string"==typeof r?r=i[r]:r-=.5,"string"==typeof s?s=i[s]:s-=.5,c=s-r,(a||c)&&(l=this._getTransformedDimensions(),u=t.x+a*l.x,h=t.y+c*l.y),new fabric.Point(u,h)},translateToCenterPoint:function(e,i,n){var r=this.translateToGivenOrigin(e,i,n,"center","center");return this.angle?fabric.util.rotatePoint(r,e,t(this.angle)):r},translateToOriginPoint:function(e,i,n){var r=this.translateToGivenOrigin(e,"center","center",i,n);return this.angle?fabric.util.rotatePoint(r,e,t(this.angle)):r},getCenterPoint:function(){var t=new fabric.Point(this.left,this.top);return this.translateToCenterPoint(t,this.originX,this.originY)},getPointByOrigin:function(t,e){var i=this.getCenterPoint();return this.translateToOriginPoint(i,t,e)},toLocalPoint:function(e,i,n){var r,o,s=this.getCenterPoint();return r="undefined"!=typeof i&&"undefined"!=typeof n?this.translateToGivenOrigin(s,"center","center",i,n):new fabric.Point(this.left,this.top),o=new fabric.Point(e.x,e.y),this.angle&&(o=fabric.util.rotatePoint(o,s,-t(this.angle))),o.subtractEquals(r)},setPositionByOrigin:function(t,e,i){var n=this.translateToCenterPoint(t,e,i),r=this.translateToOriginPoint(n,this.originX,this.originY);this.set("left",r.x),this.set("top",r.y)},adjustPosition:function(i){var n,r,o=t(this.angle),s=this.getWidth(),a=Math.cos(o)*s,c=Math.sin(o)*s;n="string"==typeof this.originX?e[this.originX]:this.originX-.5,r="string"==typeof i?e[i]:i-.5,this.left+=a*(r-n),this.top+=c*(r-n),this.setCoords(),this.originX=i},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var t=this.getCenterPoint();this.originX="center",this.originY="center",this.left=t.x,this.top=t.y},_resetOrigin:function(){var t=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=t.x,this.top=t.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")},_getRightTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"right","top")}})}(),function(){function t(t){return[new fabric.Point(t.tl.x,t.tl.y),new fabric.Point(t.tr.x,t.tr.y),new fabric.Point(t.br.x,t.br.y),new fabric.Point(t.bl.x,t.bl.y)]}var e=fabric.util.degreesToRadians,i=fabric.util.multiplyTransformMatrices;fabric.util.object.extend(fabric.Object.prototype,{oCoords:null,intersectsWithRect:function(e,i){var n=t(this.oCoords),r=fabric.Intersection.intersectPolygonRectangle(n,e,i);return"Intersection"===r.status},intersectsWithObject:function(e){var i=fabric.Intersection.intersectPolygonPolygon(t(this.oCoords),t(e.oCoords));return"Intersection"===i.status||e.isContainedWithinObject(this)||this.isContainedWithinObject(e)},isContainedWithinObject:function(e){for(var i=t(this.oCoords),n=0;n<4;n++)if(!e.containsPoint(i[n]))return!1;return!0},isContainedWithinRect:function(t,e){var i=this.getBoundingRect();return i.left>=t.x&&i.left+i.width<=e.x&&i.top>=t.y&&i.top+i.height<=e.y},containsPoint:function(t){this.oCoords||this.setCoords();var e=this._getImageLines(this.oCoords),i=this._findCrossPoints(t,e);return 0!==i&&i%2===1},_getImageLines:function(t){return{topline:{o:t.tl,d:t.tr},rightline:{o:t.tr,d:t.br},bottomline:{o:t.br,d:t.bl},leftline:{o:t.bl,d:t.tl}}},_findCrossPoints:function(t,e){var i,n,r,o,s,a,c=0;for(var l in e)if(a=e[l],!(a.o.y<t.y&&a.d.y<t.y||a.o.y>=t.y&&a.d.y>=t.y||(a.o.x===a.d.x&&a.o.x>=t.x?s=a.o.x:(i=0,n=(a.d.y-a.o.y)/(a.d.x-a.o.x),r=t.y-i*t.x,o=a.o.y-n*a.o.x,s=-(r-o)/(i-n)),s>=t.x&&(c+=1),2!==c)))break;return c},getBoundingRectWidth:function(){return this.getBoundingRect().width},getBoundingRectHeight:function(){return this.getBoundingRect().height},getBoundingRect:function(){return this.oCoords||this.setCoords(),fabric.util.makeBoundingBoxFromPoints([this.oCoords.tl,this.oCoords.tr,this.oCoords.br,this.oCoords.bl])},getWidth:function(){return this._getTransformedDimensions().x},getHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(t){return Math.abs(t)<this.minScaleLimit?t<0?-this.minScaleLimit:this.minScaleLimit:t},scale:function(t){return t=this._constrainScale(t),t<0&&(this.flipX=!this.flipX,this.flipY=!this.flipY,t*=-1),this.scaleX=t,this.scaleY=t,this.setCoords(),this},scaleToWidth:function(t){var e=this.getBoundingRect().width/this.getWidth();return this.scale(t/this.width/e)},scaleToHeight:function(t){var e=this.getBoundingRect().height/this.getHeight();return this.scale(t/this.height/e)},setCoords:function(){var t=e(this.angle),i=this.getViewportTransform(),n=this._calculateCurrentDimensions(),r=n.x,o=n.y;r<0&&(r=Math.abs(r));var s=Math.sin(t),a=Math.cos(t),c="editor"===this.cornerStyle?this.cornerSize/2:0;return _angle=r>0?Math.atan(o/r):0,_hypotenuse=r/Math.cos(_angle)/2,offsetX=Math.cos(_angle+t)*_hypotenuse,offsetY=Math.sin(_angle+t)*_hypotenuse,coords=fabric.util.transformPoint(this.getCenterPoint(),i),tl=new fabric.Point(coords.x-offsetX,coords.y-offsetY),tr=new fabric.Point(tl.x+c+r*a,tl.y+r*s),bl=new fabric.Point(tl.x-c-o*s,tl.y+o*a),br=new fabric.Point(coords.x+offsetX,coords.y+offsetY),ml=new fabric.Point((tl.x+bl.x)/2,(tl.y+bl.y)/2),mt=new fabric.Point((tr.x+tl.x)/2,(tr.y+tl.y)/2),mr=new fabric.Point((br.x+tr.x)/2,(br.y+tr.y)/2),mb=new fabric.Point((br.x+bl.x)/2,(br.y+bl.y)/2),mtr=new fabric.Point(mt.x+s*this.rotatingPointOffset,mt.y-a*this.rotatingPointOffset),this.oCoords={tl:tl,tr:tr,br:br,bl:bl,ml:ml,mt:mt,mr:mr,mb:mb,mtr:mtr},this._setCornerCoords&&this._setCornerCoords(),this},_calcRotateMatrix:function(){if(this.angle){var t=e(this.angle),i=Math.cos(t),n=Math.sin(t);return[i,n,-n,i,0,0]}return[1,0,0,1,0,0]},calcTransformMatrix:function(){var t=this.getCenterPoint(),e=[1,0,0,1,t.x,t.y],n=this._calcRotateMatrix(),r=this._calcDimensionsTransformMatrix(this.skewX,this.skewY,!0),o=this.group?this.group.calcTransformMatrix():[1,0,0,1,0,0];return o=i(o,e),o=i(o,n),o=i(o,r)},_calcDimensionsTransformMatrix:function(t,n,r){var o=[1,0,Math.tan(e(t)),1],s=[1,Math.tan(e(n)),0,1],a=this.scaleX*(r&&this.flipX?-1:1),c=this.scaleY*(r&&this.flipY?-1:1),l=[a,0,0,c],u=i(l,o,!0);return i(u,s,!0)}})}(),fabric.util.object.extend(fabric.Object.prototype,{sendToBack:function(){return this.group?fabric.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?fabric.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?fabric.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?fabric.StaticCanvas.prototype.bringForward.call(this.group,this,t):this.canvas.bringForward(this,t),this},moveTo:function(t){return this.group?fabric.StaticCanvas.prototype.moveTo.call(this.group,this,t):this.canvas.moveTo(this,t),this}}),function(){function t(t,e){if(e){if(e.toLive)return t+": url(#SVGID_"+e.id+"); ";var i=new fabric.Color(e),n=t+": "+i.toRgb()+"; ",r=i.getAlpha();return 1!==r&&(n+=t+"-opacity: "+r.toString()+"; "),n}return t+": none; "}fabric.util.object.extend(fabric.Object.prototype,{getSvgStyles:function(e){var i=this.fillRule,n=this.strokeWidth?this.strokeWidth:"0",r=this.strokeDashArray?this.strokeDashArray.join(" "):"none",o=this.strokeLineCap?this.strokeLineCap:"butt",s=this.strokeLineJoin?this.strokeLineJoin:"miter",a=this.strokeMiterLimit?this.strokeMiterLimit:"4",c="undefined"!=typeof this.opacity?this.opacity:"1",l=this.visible?"":" visibility: hidden;",u=e?"":this.getSvgFilter(),h=t("fill",this.fill),f=t("stroke",this.stroke);return[f,"stroke-width: ",n,"; ","stroke-dasharray: ",r,"; ","stroke-linecap: ",o,"; ","stroke-linejoin: ",s,"; ","stroke-miterlimit: ",a,"; ",h,"fill-rule: ",i,"; ","opacity: ",c,";",u,l].join("")},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""},getSvgId:function(){return this.id?'id="'+this.id+'" ':""},getSvgTransform:function(){if(this.group&&"path-group"===this.group.type)return"";var t=fabric.util.toFixed,e=this.getAngle(),i=this.getSkewX()%360,n=this.getSkewY()%360,r=this.getCenterPoint(),o=fabric.Object.NUM_FRACTION_DIGITS,s="path-group"===this.type?"":"translate("+t(r.x,o)+" "+t(r.y,o)+")",a=0!==e?" rotate("+t(e,o)+")":"",c=1===this.scaleX&&1===this.scaleY?"":" scale("+t(this.scaleX,o)+" "+t(this.scaleY,o)+")",l=0!==i?" skewX("+t(i,o)+")":"",u=0!==n?" skewY("+t(n,o)+")":"",h="path-group"===this.type?this.width:0,f=this.flipX?" matrix(-1 0 0 1 "+h+" 0) ":"",d="path-group"===this.type?this.height:0,p=this.flipY?" matrix(1 0 0 -1 0 "+d+")":"";return[s,a,c,f,p,l,u].join("")},getSvgTransformMatrix:function(){return this.transformMatrix?" matrix("+this.transformMatrix.join(" ")+") ":""},_createBaseSVGMarkup:function(){var t=[];return this.fill&&this.fill.toLive&&t.push(this.fill.toSVG(this,!1)),this.stroke&&this.stroke.toLive&&t.push(this.stroke.toSVG(this,!1)),this.shadow&&t.push(this.shadow.toSVG(this)),t}})}(),function(){function t(t,e,n){var r={},o=!0;n.forEach(function(e){r[e]=t[e]}),i(t[e],r,o)}function e(t,i){if(!fabric.isLikelyNode&&t instanceof Element)return t===i;if(t instanceof Array){if(t.length!==i.length)return!1;var n=i.concat().sort(),r=t.concat().sort();return!r.some(function(t,i){return!e(n[i],t)})}if(t instanceof Object){for(var o in t)if(!e(t[o],i[o]))return!1;return!0}return t===i}var i=fabric.util.object.extend;fabric.util.object.extend(fabric.Object.prototype,{hasStateChanged:function(){return!e(this.originalState,this)},saveState:function(e){return t(this,"originalState",this.stateProperties),e&&e.stateProperties&&t(this,"originalState",e.stateProperties),this},setupState:function(t){return this.originalState={},this.saveState(t),this}})}(),function(){var t="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjM2IiB2aWV3Qm94PSIwIDAgMzYgMzYiIHdpZHRoPSIzNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGNpcmNsZSBpZD0iYSIgY3g9IjE4IiBjeT0iMTgiIHI9IjEyIi8+PGZpbHRlciBpZD0iYiIgaGVpZ2h0PSIxNTguMyUiIHdpZHRoPSIxNTguMyUiIHg9Ii0yOS4yJSIgeT0iLTIwLjglIj48ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0iU291cmNlQWxwaGEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIyIi8+PGZlQ29sb3JNYXRyaXggaW49InNoYWRvd0JsdXJPdXRlcjEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuNSAwIi8+PC9maWx0ZXI+PC9kZWZzPjxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgdHJhbnNmb3JtPSIiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI2IpIiB4bGluazpocmVmPSIjYSIvPjx1c2UgZmlsbD0iI2ZmZTYyNiIgZmlsbC1ydWxlPSJldmVub2RkIiB4bGluazpocmVmPSIjYSIvPjxwYXRoIGQ9Im0xOSAxN2g0Yy41NTIyODQ3IDAgMSAuNDQ3NzE1MyAxIDFzLS40NDc3MTUzIDEtMSAxaC00djRjMCAuNTUyMjg0Ny0uNDQ3NzE1MyAxLTEgMXMtMS0uNDQ3NzE1My0xLTF2LTRoLTRjLS41NTIyODQ3IDAtMS0uNDQ3NzE1My0xLTFzLjQ0NzcxNTMtMSAxLTFoNHYtNGMwLS41NTIyODQ3LjQ0NzcxNTMtMSAxLTFzMSAuNDQ3NzE1MyAxIDF6IiBmaWxsPSIjMDAwIiB0cmFuc2Zvcm09Im1hdHJpeCguNzA3MTA2NzggLjcwNzEwNjc4IC0uNzA3MTA2NzggLjcwNzEwNjc4IDE4IC03LjQ1NTg0NCkiLz48L2c+PC9zdmc+",e="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjM2IiB2aWV3Qm94PSIwIDAgMzYgMzYiIHdpZHRoPSIzNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGNpcmNsZSBpZD0iYSIgY3g9IjE4IiBjeT0iMTgiIHI9IjEyIi8+PGZpbHRlciBpZD0iYiIgaGVpZ2h0PSIxNTguMyUiIHdpZHRoPSIxNTguMyUiIHg9Ii0yOS4yJSIgeT0iLTIwLjglIj48ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0iU291cmNlQWxwaGEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIyIi8+PGZlQ29sb3JNYXRyaXggaW49InNoYWRvd0JsdXJPdXRlcjEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuNSAwIi8+PC9maWx0ZXI+PC9kZWZzPjxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgdHJhbnNmb3JtPSIiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI2IpIiB4bGluazpocmVmPSIjYSIvPjx1c2UgZmlsbD0iI2ZmZTYyNiIgZmlsbC1ydWxlPSJldmVub2RkIiB4bGluazpocmVmPSIjYSIvPjxwYXRoIGQ9Im0xNSAyMWgzYy41NTIyODQ3IDAgMSAuNDQ3NzE1MyAxIDFzLS40NDc3MTUzIDEtMSAxaC00Yy0uNTUyMjg0NyAwLTEtLjQ0NzcxNTMtMS0xdi00YzAtLjU1MjI4NDcuNDQ3NzE1My0xIDEtMXMxIC40NDc3MTUzIDEgMXptOC03djRjMCAuNTUyMjg0Ny0uNDQ3NzE1MyAxLTEgMXMtMS0uNDQ3NzE1My0xLTF2LTNoLTNjLS41NTIyODQ3IDAtMS0uNDQ3NzE1My0xLTFzLjQ0NzcxNTMtMSAxLTFoNGMuNTUyMjg0NyAwIDEgLjQ0NzcxNTMgMSAxeiIgZmlsbD0iIzAwMCIvPjwvZz48L3N2Zz4=",i=new Image;i.src=t;var n=new Image;n.src=e;var r=fabric.util.degreesToRadians,o=function(){return"undefined"!=typeof G_vmlCanvasManager};fabric.util.object.extend(fabric.Object.prototype,{_controlsVisibility:null,_findTargetCorner:function(t){if(!this.hasControls||!this.active)return!1;var e,i,n=t.x,r=t.y;this.__corner=0;for(var o in this.oCoords)if(this.isControlVisible(o)&&("mtr"!==o||this.hasRotatingPoint)&&(!this.get("lockUniScaling")||"mt"!==o&&"mr"!==o&&"mb"!==o&&"ml"!==o)&&(i=this._getImageLines(this.oCoords[o].corner),e=this._findCrossPoints({x:n,y:r},i),0!==e&&e%2===1))return this.__corner=o,o;return!1},_setCornerCoords:function(){var t,e,i=this.oCoords,n="editor"===this.cornerStyle?this.cornerSize/2:0,o=r(45-this.angle),s=.707106*this.cornerSize,a=(s+n)*Math.cos(o),c=s*Math.sin(o);for(var l in i)t=i[l].x,e=i[l].y,i[l].corner={tl:{x:t-c,y:e-a},tr:{x:t+a,y:e-c},bl:{x:t-a,y:e+c},br:{x:t+c,y:e+a}}},_getNonTransformedDimensions:function(){var t=this.strokeWidth,e=this.width,i=this.height,n=!0,r=!0;return"line"===this.type&&"butt"===this.strokeLineCap&&(r=e,n=i),r&&(i+=i<0?-t:t),n&&(e+=e<0?-t:t),{x:e,y:i}},_getTransformedDimensions:function(t,e){"undefined"==typeof t&&(t=this.skewX),"undefined"==typeof e&&(e=this.skewY);var i,n,r=this._getNonTransformedDimensions(),o=r.x/2,s=r.y/2,a=[{x:-o,y:-s},{x:o,y:-s},{x:-o,y:s},{x:o,y:s}],c=this._calcDimensionsTransformMatrix(t,e,!1);for(i=0;i<a.length;i++)a[i]=fabric.util.transformPoint(a[i],c);return n=fabric.util.makeBoundingBoxFromPoints(a),{x:n.width,y:n.height}},_calculateCurrentDimensions:function(){var t=this.getViewportTransform(),e=this._getTransformedDimensions(),i=e.x,n=e.y,r=fabric.util.transformPoint(new fabric.Point(i,n),t,!0);return r.scalarAdd(2*this.padding)},drawSelectionBackground:function(t){if(!this.selectionBackgroundColor||this.group||!this.active)return this;t.save();var e=this.getCenterPoint(),i=this._calculateCurrentDimensions(),n=this.canvas.viewportTransform;return t.translate(e.x,e.y),t.scale(1/n[0],1/n[3]),t.rotate(r(this.angle)),t.fillStyle=this.selectionBackgroundColor,t.fillRect(-i.x/2,-i.y/2,i.x,i.y),t.restore(),this},drawBorders:function(t){if(!this.hasBorders)return this;var e=this._calculateCurrentDimensions(),i=1/this.borderScaleFactor,n=e.x+i,r=e.y+i;if(t.save(),t.lineWidth=this.borderLineWidth,t.strokeStyle=this.borderColor,this._setLineDash(t,this.borderDashArray,null),"editor"===this.cornerStyle){var o=this.cornerSize/2;t.strokeRect(-n/2-o,-r/2,n+2*o,r)}else t.strokeRect(-n/2,-r/2,n,r);if(this.hasRotatingPoint&&this.isControlVisible("mtr")&&!this.get("lockRotation")&&this.hasControls){var s=-r/2;t.beginPath(),t.moveTo(0,s),t.lineTo(0,s-this.rotatingPointOffset),t.closePath(),t.stroke()}return t.restore(),this},drawBordersInGroup:function(t,e){if(!this.hasBorders)return this;var i=this._getNonTransformedDimensions(),n=fabric.util.customTransformMatrix(e.scaleX,e.scaleY,e.skewX),r=fabric.util.transformPoint(i,n),o=1/this.borderScaleFactor,s=r.x+o+2*this.padding,a=r.y+o+2*this.padding;return t.save(),this._setLineDash(t,this.borderDashArray,null),t.strokeStyle=this.borderColor,t.strokeRect(-s/2,-a/2,s,a),t.restore(),this},drawControls:function(t){if(!this.hasControls)return this;var e=this._calculateCurrentDimensions(),r=e.x,o=e.y,s=this.cornerSize,a=-(r+s)/2,c=-(o+s)/2,l=this.transparentCorners?"stroke":"fill";if(t.save(),t.strokeStyle=t.fillStyle=this.cornerColor,this.transparentCorners||(t.strokeStyle=this.cornerStrokeColor),this._setLineDash(t,this.cornerDashArray,null),"editor"===this.cornerStyle){var u=this.cornerSize/2;t.drawImage(i,a+r+u,c,this.cornerSize,this.cornerSize),t.drawImage(n,a+r+u,c+o,this.cornerSize,this.cornerSize)}else if("cropper"===this.cornerStyle){var h=this.cornerSize||48,f=this.cornerWidth||4,d=a+h/2,p=c+h/2,g=h;t.strokeStyle=this.cornerColor,t.lineWidth=f,t.beginPath(),t.moveTo(d,p+g),t.lineTo(d,p),t.lineTo(d+g,p),t.stroke(),t.beginPath(),t.moveTo(d+r-g,p),t.lineTo(d+r,p),t.lineTo(d+r,p+g),t.stroke(),t.beginPath(),t.moveTo(d,p+o-g),t.lineTo(d,p+o),t.lineTo(d+g,p+o),t.stroke(),t.beginPath(),t.moveTo(d+r-g,p+o),t.lineTo(d+r,p+o),t.lineTo(d+r,p+o-g),t.stroke()}else if(this._drawControl("br",t,l,a+r,c+o),this._drawControl("tl",t,l,a,c),this._drawControl("tr",t,l,a+r,c),this._drawControl("bl",t,l,a,c+o),this.get("lockUniScaling")||(this._drawControl("mt",t,l,a+r/2,c),this._drawControl("mb",t,l,a+r/2,c+o),this._drawControl("mr",t,l,a+r,c+o/2),this._drawControl("ml",t,l,a,c+o/2)),this.hasRotatingPoint){var v=a+r/2,m=c-this.rotatingPointOffset;this._drawControl("mtr",t,l,v,m)}return t.restore(),this},_drawControl:function(t,e,i,n,r){if(this.isControlVisible(t)){var s=this.cornerSize,a=!this.transparentCorners&&this.cornerStrokeColor;switch(this.cornerStyle){case"circle":e.beginPath(),e.arc(n+s/2,r+s/2,s/2,0,2*Math.PI,!1),e[i](),a&&e.stroke();break;default:o()||this.transparentCorners||e.clearRect(n,r,s,s),e[i+"Rect"](n,r,s,s),a&&e.strokeRect(n,r,s,s)}}},isControlVisible:function(t){return this._getControlsVisibility()[t]},setControlVisible:function(t,e){return this._getControlsVisibility()[t]=e,this},setControlsVisibility:function(t){t||(t={});for(var e in t)this.setControlVisible(e,t[e]);return this},_getControlsVisibility:function(){return this._controlsVisibility||(this._controlsVisibility={tl:!0,tr:!0,br:!0,bl:!0,ml:!0,mt:!0,mr:!0,mb:!0,mtr:!0}),this._controlsVisibility}})}(),fabric.util.object.extend(fabric.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){e=e||{};var i=function(){},n=e.onComplete||i,r=e.onChange||i,o=this;return fabric.util.animate({startValue:t.get("left"),endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(e){t.set("left",e),o.renderAll(),r()},onComplete:function(){t.setCoords(),n()}}),this},fxCenterObjectV:function(t,e){e=e||{};var i=function(){},n=e.onComplete||i,r=e.onChange||i,o=this;return fabric.util.animate({startValue:t.get("top"),endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(e){t.set("top",e),o.renderAll(),r()},onComplete:function(){t.setCoords(),n()}}),this},fxRemove:function(t,e){e=e||{};var i=function(){},n=e.onComplete||i,r=e.onChange||i,o=this;return fabric.util.animate({startValue:t.get("opacity"),endValue:0,duration:this.FX_DURATION,onStart:function(){t.set("active",!1)},onChange:function(e){t.set("opacity",e),o.renderAll(),r()},onComplete:function(){o.remove(t),n()}}),this}}),fabric.util.object.extend(fabric.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var t,e,i=[];for(t in arguments[0])i.push(t);for(var n=0,r=i.length;n<r;n++)t=i[n],e=n!==r-1,this._animate(t,arguments[0][t],arguments[1],e)}else this._animate.apply(this,arguments);return this},_animate:function(t,e,i,n){var r,o=this;e=e.toString(),i=i?fabric.util.object.clone(i):{},~t.indexOf(".")&&(r=t.split("."));var s=r?this.get(r[0])[r[1]]:this.get(t);"from"in i||(i.from=s),e=~e.indexOf("=")?s+parseFloat(e.replace("=","")):parseFloat(e),fabric.util.animate({startValue:i.from,endValue:e,byValue:i.by,easing:i.easing,duration:i.duration,abort:i.abort&&function(){return i.abort.call(o)},onChange:function(e){r?o[r[0]][r[1]]=e:o.set(t,e),n||i.onChange&&i.onChange()},onComplete:function(){n||(o.setCoords(),i.onComplete&&i.onComplete())}})}}),function(t){"use strict";function e(t,e){var i=t.origin,n=t.axis1,r=t.axis2,o=t.dimension,s=e.nearest,a=e.center,c=e.farthest;return function(){switch(this.get(i)){case s:return Math.min(this.get(n),this.get(r));case a:return Math.min(this.get(n),this.get(r))+.5*this.get(o);case c:return Math.max(this.get(n),this.get(r))}}}var i=t.fabric||(t.fabric={}),n=i.util.object.extend,r={x1:1,x2:1,y1:1,y2:1},o=i.StaticCanvas.supports("setLineDash");return i.Line?void i.warn("fabric.Line is already defined"):(i.Line=i.util.createClass(i.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,initialize:function(t,e){e=e||{},t||(t=[0,0,0,0]),this.callSuper("initialize",e),this.set("x1",t[0]),this.set("y1",t[1]),this.set("x2",t[2]),this.set("y2",t[3]),this._setWidthHeight(e)},_setWidthHeight:function(t){t||(t={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in t?t.left:this._getLeftToOriginX(),this.top="top"in t?t.top:this._getTopToOriginY()},_set:function(t,e){return this.callSuper("_set",t,e),"undefined"!=typeof r[t]&&this._setWidthHeight(),this},_getLeftToOriginX:e({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:e({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(t,e){if(t.beginPath(),e){var i=this.getCenterPoint();t.translate(i.x-this.strokeWidth/2,i.y-this.strokeWidth/2)}if(!this.strokeDashArray||this.strokeDashArray&&o){var n=this.calcLinePoints();t.moveTo(n.x1,n.y1),t.lineTo(n.x2,n.y2)}t.lineWidth=this.strokeWidth;var r=t.strokeStyle;t.strokeStyle=this.stroke||t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=r},_renderDashedStroke:function(t){var e=this.calcLinePoints();t.beginPath(),i.util.drawDashedLine(t,e.x1,e.y1,e.x2,e.y2,this.strokeDashArray),t.closePath()},toObject:function(t){return n(this.callSuper("toObject",t),this.calcLinePoints())},calcLinePoints:function(){var t=this.x1<=this.x2?-1:1,e=this.y1<=this.y2?-1:1,i=t*this.width*.5,n=e*this.height*.5,r=t*this.width*-.5,o=e*this.height*-.5;return{x1:i,x2:r,y1:n,y2:o}},toSVG:function(t){var e=this._createBaseSVGMarkup(),i={x1:this.x1,x2:this.x2,y1:this.y1,y2:this.y2};return this.group&&"path-group"===this.group.type||(i=this.calcLinePoints()),e.push("<line ",this.getSvgId(),'x1="',i.x1,'" y1="',i.y1,'" x2="',i.x2,'" y2="',i.y2,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"/>\n'),t?t(e.join("")):e.join("")},complexity:function(){return 1}}),i.Line.ATTRIBUTE_NAMES=i.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),i.Line.fromElement=function(t,e){var r=i.parseAttributes(t,i.Line.ATTRIBUTE_NAMES),o=[r.x1||0,r.y1||0,r.x2||0,r.y2||0];return new i.Line(o,n(r,e))},void(i.Line.fromObject=function(t,e){var n=[t.x1,t.y1,t.x2,t.y2],r=new i.Line(n,t);return e&&e(r),r}))}(exports),function(t){"use strict";function e(t){return"radius"in t&&t.radius>=0}var i=t.fabric||(t.fabric={}),n=Math.PI,r=i.util.object.extend;return i.Circle?void i.warn("fabric.Circle is already defined."):(i.Circle=i.util.createClass(i.Object,{type:"circle",radius:0,startAngle:0,endAngle:2*n,initialize:function(t){t=t||{},this.callSuper("initialize",t),this.set("radius",t.radius||0),this.startAngle=t.startAngle||this.startAngle,this.endAngle=t.endAngle||this.endAngle},_set:function(t,e){return this.callSuper("_set",t,e),"radius"===t&&this.setRadius(e),this},toObject:function(t){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(t))},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=0,r=0,o=(this.endAngle-this.startAngle)%(2*n);if(0===o)this.group&&"path-group"===this.group.type&&(i=this.left+this.radius,r=this.top+this.radius),e.push("<circle ",this.getSvgId(),'cx="'+i+'" cy="'+r+'" ','r="',this.radius,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform()," ",this.getSvgTransformMatrix(),'"/>\n');else{var s=Math.cos(this.startAngle)*this.radius,a=Math.sin(this.startAngle)*this.radius,c=Math.cos(this.endAngle)*this.radius,l=Math.sin(this.endAngle)*this.radius,u=o>n?"1":"0";e.push('<path d="M '+s+" "+a," A "+this.radius+" "+this.radius," 0 ",+u+" 1"," "+c+" "+l,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform()," ",this.getSvgTransformMatrix(),'"/>\n')}return t?t(e.join("")):e.join("")},_render:function(t,e){t.beginPath(),t.arc(e?this.left+this.radius:0,e?this.top+this.radius:0,this.radius,this.startAngle,this.endAngle,!1),this._renderFill(t),this._renderStroke(t)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(t){return this.radius=t,this.set("width",2*t).set("height",2*t)},complexity:function(){return 1}}),i.Circle.ATTRIBUTE_NAMES=i.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),i.Circle.fromElement=function(t,n){n||(n={});var o=i.parseAttributes(t,i.Circle.ATTRIBUTE_NAMES);if(!e(o))throw new Error("value of `r` attribute is required and can not be negative");o.left=o.left||0,o.top=o.top||0;var s=new i.Circle(r(o,n));return s.left-=s.radius,s.top-=s.radius,s},void(i.Circle.fromObject=function(t,e){var n=new i.Circle(t);return e&&e(n),n}))}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={});return e.Triangle?void e.warn("fabric.Triangle is already defined"):(e.Triangle=e.util.createClass(e.Object,{type:"triangle",initialize:function(t){t=t||{},this.callSuper("initialize",t),this.set("width",t.width||100).set("height",t.height||100)},_render:function(t){var e=this.width/2,i=this.height/2;t.beginPath(),t.moveTo(-e,i),t.lineTo(0,-i),t.lineTo(e,i),t.closePath(),this._renderFill(t),this._renderStroke(t)},_renderDashedStroke:function(t){var i=this.width/2,n=this.height/2;t.beginPath(),e.util.drawDashedLine(t,-i,n,0,-n,this.strokeDashArray),e.util.drawDashedLine(t,0,-n,i,n,this.strokeDashArray),e.util.drawDashedLine(t,i,n,-i,n,this.strokeDashArray),t.closePath()},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=this.width/2,n=this.height/2,r=[-i+" "+n,"0 "+-n,i+" "+n].join(",");return e.push("<polygon ",this.getSvgId(),'points="',r,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),'"/>'),t?t(e.join("")):e.join("")},complexity:function(){return 1}}),void(e.Triangle.fromObject=function(t,i){var n=new e.Triangle(t);return i&&i(n),n}))}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=2*Math.PI,n=e.util.object.extend;return e.Ellipse?void e.warn("fabric.Ellipse is already defined."):(e.Ellipse=e.util.createClass(e.Object,{type:"ellipse",rx:0,ry:0,initialize:function(t){t=t||{},this.callSuper("initialize",t),this.set("rx",t.rx||0),this.set("ry",t.ry||0)},_set:function(t,e){switch(this.callSuper("_set",t,e),t){case"rx":this.rx=e,this.set("width",2*e);break;case"ry":this.ry=e,this.set("height",2*e)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=0,n=0;return this.group&&"path-group"===this.group.type&&(i=this.left+this.rx,n=this.top+this.ry),e.push("<ellipse ",this.getSvgId(),'cx="',i,'" cy="',n,'" ','rx="',this.rx,'" ry="',this.ry,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"/>\n'),t?t(e.join("")):e.join("")},_render:function(t,e){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(e?this.left+this.rx:0,e?(this.top+this.ry)*this.rx/this.ry:0,this.rx,0,i,!1),t.restore(),this._renderFill(t),this._renderStroke(t)},complexity:function(){return 1}}),e.Ellipse.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),e.Ellipse.fromElement=function(t,i){i||(i={});var r=e.parseAttributes(t,e.Ellipse.ATTRIBUTE_NAMES);r.left=r.left||0,r.top=r.top||0;var o=new e.Ellipse(n(r,i));return o.top-=o.ry,o.left-=o.rx,o},void(e.Ellipse.fromObject=function(t,i){var n=new e.Ellipse(t);return i&&i(n),n}))}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;if(e.Rect)return void e.warn("fabric.Rect is already defined");var n=e.Object.prototype.stateProperties.concat();n.push("rx","ry","x","y"),e.Rect=e.util.createClass(e.Object,{stateProperties:n,type:"rect",rx:0,ry:0,strokeDashArray:null,initialize:function(t){t=t||{},this.callSuper("initialize",t),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(t,e){if(1===this.width&&1===this.height)return void t.fillRect(-.5,-.5,1,1);var i=this.rx?Math.min(this.rx,this.width/2):0,n=this.ry?Math.min(this.ry,this.height/2):0,r=this.width,o=this.height,s=e?this.left:-this.width/2,a=e?this.top:-this.height/2,c=0!==i||0!==n,l=.4477152502;t.beginPath(),t.moveTo(s+i,a),t.lineTo(s+r-i,a),c&&t.bezierCurveTo(s+r-l*i,a,s+r,a+l*n,s+r,a+n),t.lineTo(s+r,a+o-n),c&&t.bezierCurveTo(s+r,a+o-l*n,s+r-l*i,a+o,s+r-i,a+o),t.lineTo(s+i,a+o),c&&t.bezierCurveTo(s+l*i,a+o,s,a+o-l*n,s,a+o-n),t.lineTo(s,a+n),c&&t.bezierCurveTo(s,a+l*n,s+l*i,a,s+i,a),t.closePath(),this._renderFill(t),this._renderStroke(t)},_renderDashedStroke:function(t){var i=-this.width/2,n=-this.height/2,r=this.width,o=this.height;t.beginPath(),e.util.drawDashedLine(t,i,n,i+r,n,this.strokeDashArray),e.util.drawDashedLine(t,i+r,n,i+r,n+o,this.strokeDashArray),e.util.drawDashedLine(t,i+r,n+o,i,n+o,this.strokeDashArray),e.util.drawDashedLine(t,i,n+o,i,n,this.strokeDashArray),t.closePath()},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=this.left,n=this.top;return this.group&&"path-group"===this.group.type||(i=-this.width/2,n=-this.height/2),e.push("<rect ",this.getSvgId(),'x="',i,'" y="',n,'" rx="',this.get("rx"),'" ry="',this.get("ry"),'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"/>\n'),t?t(e.join("")):e.join("")},complexity:function(){return 1}}),e.Rect.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),e.Rect.fromElement=function(t,n){if(!t)return null;n=n||{};var r=e.parseAttributes(t,e.Rect.ATTRIBUTE_NAMES);r.left=r.left||0,r.top=r.top||0;var o=new e.Rect(i(n?e.util.object.clone(n):{},r));return o.visible=o.visible&&o.width>0&&o.height>0,o},e.Rect.fromObject=function(t,i){var n=new e.Rect(t);return i&&i(n),n}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={});return e.Polyline?void e.warn("fabric.Polyline is already defined"):(e.Polyline=e.util.createClass(e.Object,{type:"polyline",points:null,minX:0,minY:0,initialize:function(t,i){
return e.Polygon.prototype.initialize.call(this,t,i)},_calcDimensions:function(){return e.Polygon.prototype._calcDimensions.call(this)},toObject:function(t){return e.Polygon.prototype.toObject.call(this,t)},toSVG:function(t){return e.Polygon.prototype.toSVG.call(this,t)},_render:function(t,i){e.Polygon.prototype.commonRender.call(this,t,i)&&(this._renderFill(t),this._renderStroke(t))},_renderDashedStroke:function(t){var i,n;t.beginPath();for(var r=0,o=this.points.length;r<o;r++)i=this.points[r],n=this.points[r+1]||i,e.util.drawDashedLine(t,i.x,i.y,n.x,n.y,this.strokeDashArray)},complexity:function(){return this.get("points").length}}),e.Polyline.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polyline.fromElement=function(t,i){if(!t)return null;i||(i={});var n=e.parsePointsAttribute(t.getAttribute("points")),r=e.parseAttributes(t,e.Polyline.ATTRIBUTE_NAMES);return new e.Polyline(n,e.util.object.extend(r,i))},void(e.Polyline.fromObject=function(t,i){var n=new e.Polyline(t.points,t);return i&&i(n),n}))}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.array.min,r=e.util.array.max,o=e.util.toFixed;return e.Polygon?void e.warn("fabric.Polygon is already defined"):(e.Polygon=e.util.createClass(e.Object,{type:"polygon",points:null,minX:0,minY:0,initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper("initialize",e),this._calcDimensions(),"top"in e||(this.top=this.minY),"left"in e||(this.left=this.minX),this.pathOffset={x:this.minX+this.width/2,y:this.minY+this.height/2}},_calcDimensions:function(){var t=this.points,e=n(t,"x"),i=n(t,"y"),o=r(t,"x"),s=r(t,"y");this.width=o-e||0,this.height=s-i||0,this.minX=e||0,this.minY=i||0},toObject:function(t){return i(this.callSuper("toObject",t),{points:this.points.concat()})},toSVG:function(t){for(var e,i=[],n=this._createBaseSVGMarkup(),r=0,s=this.points.length;r<s;r++)i.push(o(this.points[r].x,2),",",o(this.points[r].y,2)," ");return this.group&&"path-group"===this.group.type||(e=" translate("+-this.pathOffset.x+", "+-this.pathOffset.y+") "),n.push("<",this.type," ",this.getSvgId(),'points="',i.join(""),'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),e," ",this.getSvgTransformMatrix(),'"/>\n'),t?t(n.join("")):n.join("")},_render:function(t,e){this.commonRender(t,e)&&(this._renderFill(t),(this.stroke||this.strokeDashArray)&&(t.closePath(),this._renderStroke(t)))},commonRender:function(t,e){var i,n=this.points.length;if(!n||isNaN(this.points[n-1].y))return!1;e||t.translate(-this.pathOffset.x,-this.pathOffset.y),t.beginPath(),t.moveTo(this.points[0].x,this.points[0].y);for(var r=0;r<n;r++)i=this.points[r],t.lineTo(i.x,i.y);return!0},_renderDashedStroke:function(t){e.Polyline.prototype._renderDashedStroke.call(this,t),t.closePath()},complexity:function(){return this.points.length}}),e.Polygon.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polygon.fromElement=function(t,n){if(!t)return null;n||(n={});var r=e.parsePointsAttribute(t.getAttribute("points")),o=e.parseAttributes(t,e.Polygon.ATTRIBUTE_NAMES);return new e.Polygon(r,i(o,n))},void(e.Polygon.fromObject=function(t,i){var n=new e.Polygon(t.points,t);return i&&i(n),n}))}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.array.min,n=e.util.array.max,r=e.util.object.extend,o=Object.prototype.toString,s=e.util.drawArc,a={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},c={m:"l",M:"L"};return e.Path?void e.warn("fabric.Path is already defined"):(e.Path=e.util.createClass(e.Object,{type:"path",path:null,minX:0,minY:0,initialize:function(t,e){e=e||{},this.setOptions(e),t||(t=[]);var i="[object Array]"===o.call(t);this.path=i?t:t.match&&t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi),this.path&&(i||(this.path=this._parsePath()),this._setPositionDimensions(e),e.sourcePath&&this.setSourcePath(e.sourcePath))},_setPositionDimensions:function(t){var e=this._parseDimensions();this.minX=e.left,this.minY=e.top,this.width=e.width,this.height=e.height,"undefined"==typeof t.left&&(this.left=e.left+("center"===this.originX?this.width/2:"right"===this.originX?this.width:0)),"undefined"==typeof t.top&&(this.top=e.top+("center"===this.originY?this.height/2:"bottom"===this.originY?this.height:0)),this.pathOffset=this.pathOffset||{x:this.minX+this.width/2,y:this.minY+this.height/2}},_renderPathCommands:function(t){var e,i,n,r=null,o=0,a=0,c=0,l=0,u=0,h=0,f=-this.pathOffset.x,d=-this.pathOffset.y;this.group&&"path-group"===this.group.type&&(f=0,d=0),t.beginPath();for(var p=0,g=this.path.length;p<g;++p){switch(e=this.path[p],e[0]){case"l":c+=e[1],l+=e[2],t.lineTo(c+f,l+d);break;case"L":c=e[1],l=e[2],t.lineTo(c+f,l+d);break;case"h":c+=e[1],t.lineTo(c+f,l+d);break;case"H":c=e[1],t.lineTo(c+f,l+d);break;case"v":l+=e[1],t.lineTo(c+f,l+d);break;case"V":l=e[1],t.lineTo(c+f,l+d);break;case"m":c+=e[1],l+=e[2],o=c,a=l,t.moveTo(c+f,l+d);break;case"M":c=e[1],l=e[2],o=c,a=l,t.moveTo(c+f,l+d);break;case"c":i=c+e[5],n=l+e[6],u=c+e[3],h=l+e[4],t.bezierCurveTo(c+e[1]+f,l+e[2]+d,u+f,h+d,i+f,n+d),c=i,l=n;break;case"C":c=e[5],l=e[6],u=e[3],h=e[4],t.bezierCurveTo(e[1]+f,e[2]+d,u+f,h+d,c+f,l+d);break;case"s":i=c+e[3],n=l+e[4],null===r[0].match(/[CcSs]/)?(u=c,h=l):(u=2*c-u,h=2*l-h),t.bezierCurveTo(u+f,h+d,c+e[1]+f,l+e[2]+d,i+f,n+d),u=c+e[1],h=l+e[2],c=i,l=n;break;case"S":i=e[3],n=e[4],null===r[0].match(/[CcSs]/)?(u=c,h=l):(u=2*c-u,h=2*l-h),t.bezierCurveTo(u+f,h+d,e[1]+f,e[2]+d,i+f,n+d),c=i,l=n,u=e[1],h=e[2];break;case"q":i=c+e[3],n=l+e[4],u=c+e[1],h=l+e[2],t.quadraticCurveTo(u+f,h+d,i+f,n+d),c=i,l=n;break;case"Q":i=e[3],n=e[4],t.quadraticCurveTo(e[1]+f,e[2]+d,i+f,n+d),c=i,l=n,u=e[1],h=e[2];break;case"t":i=c+e[1],n=l+e[2],null===r[0].match(/[QqTt]/)?(u=c,h=l):(u=2*c-u,h=2*l-h),t.quadraticCurveTo(u+f,h+d,i+f,n+d),c=i,l=n;break;case"T":i=e[1],n=e[2],null===r[0].match(/[QqTt]/)?(u=c,h=l):(u=2*c-u,h=2*l-h),t.quadraticCurveTo(u+f,h+d,i+f,n+d),c=i,l=n;break;case"a":s(t,c+f,l+d,[e[1],e[2],e[3],e[4],e[5],e[6]+c+f,e[7]+l+d]),c+=e[6],l+=e[7];break;case"A":s(t,c+f,l+d,[e[1],e[2],e[3],e[4],e[5],e[6]+f,e[7]+d]),c=e[6],l=e[7];break;case"z":case"Z":c=o,l=a,t.closePath()}r=e}},_render:function(t){this._renderPathCommands(t),this._renderFill(t),this._renderStroke(t)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(t){var e=r(this.callSuper("toObject",["sourcePath","pathOffset"].concat(t)),{path:this.path.map(function(t){return t.slice()})});return e},toDatalessObject:function(t){var e=this.toObject(t);return this.sourcePath&&(e.path=this.sourcePath),delete e.sourcePath,e},toSVG:function(t){for(var e=[],i=this._createBaseSVGMarkup(),n="",r=0,o=this.path.length;r<o;r++)e.push(this.path[r].join(" "));var s=e.join(" ");return this.group&&"path-group"===this.group.type||(n=" translate("+-this.pathOffset.x+", "+-this.pathOffset.y+") "),i.push("<path ",this.getSvgId(),'d="',s,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),n,this.getSvgTransformMatrix(),'" stroke-linecap="round" ',"/>\n"),t?t(i.join("")):i.join("")},complexity:function(){return this.path.length},_parsePath:function(){for(var t,e,i,n,r,o=[],s=[],l=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,u=0,h=this.path.length;u<h;u++){for(t=this.path[u],n=t.slice(1).trim(),s.length=0;i=l.exec(n);)s.push(i[0]);r=[t.charAt(0)];for(var f=0,d=s.length;f<d;f++)e=parseFloat(s[f]),isNaN(e)||r.push(e);var p=r[0],g=a[p.toLowerCase()],v=c[p]||p;if(r.length-1>g)for(var m=1,b=r.length;m<b;m+=g)o.push([p].concat(r.slice(m,m+g))),p=v;else o.push(r)}return o},_parseDimensions:function(){for(var t,r,o,s,a=[],c=[],l=null,u=0,h=0,f=0,d=0,p=0,g=0,v=0,m=this.path.length;v<m;++v){switch(t=this.path[v],t[0]){case"l":f+=t[1],d+=t[2],s=[];break;case"L":f=t[1],d=t[2],s=[];break;case"h":f+=t[1],s=[];break;case"H":f=t[1],s=[];break;case"v":d+=t[1],s=[];break;case"V":d=t[1],s=[];break;case"m":f+=t[1],d+=t[2],u=f,h=d,s=[];break;case"M":f=t[1],d=t[2],u=f,h=d,s=[];break;case"c":r=f+t[5],o=d+t[6],p=f+t[3],g=d+t[4],s=e.util.getBoundsOfCurve(f,d,f+t[1],d+t[2],p,g,r,o),f=r,d=o;break;case"C":f=t[5],d=t[6],p=t[3],g=t[4],s=e.util.getBoundsOfCurve(f,d,t[1],t[2],p,g,f,d);break;case"s":r=f+t[3],o=d+t[4],null===l[0].match(/[CcSs]/)?(p=f,g=d):(p=2*f-p,g=2*d-g),s=e.util.getBoundsOfCurve(f,d,p,g,f+t[1],d+t[2],r,o),p=f+t[1],g=d+t[2],f=r,d=o;break;case"S":r=t[3],o=t[4],null===l[0].match(/[CcSs]/)?(p=f,g=d):(p=2*f-p,g=2*d-g),s=e.util.getBoundsOfCurve(f,d,p,g,t[1],t[2],r,o),f=r,d=o,p=t[1],g=t[2];break;case"q":r=f+t[3],o=d+t[4],p=f+t[1],g=d+t[2],s=e.util.getBoundsOfCurve(f,d,p,g,p,g,r,o),f=r,d=o;break;case"Q":p=t[1],g=t[2],s=e.util.getBoundsOfCurve(f,d,p,g,p,g,t[3],t[4]),f=t[3],d=t[4];break;case"t":r=f+t[1],o=d+t[2],null===l[0].match(/[QqTt]/)?(p=f,g=d):(p=2*f-p,g=2*d-g),s=e.util.getBoundsOfCurve(f,d,p,g,p,g,r,o),f=r,d=o;break;case"T":r=t[1],o=t[2],null===l[0].match(/[QqTt]/)?(p=f,g=d):(p=2*f-p,g=2*d-g),s=e.util.getBoundsOfCurve(f,d,p,g,p,g,r,o),f=r,d=o;break;case"a":s=e.util.getBoundsOfArc(f,d,t[1],t[2],t[3],t[4],t[5],t[6]+f,t[7]+d),f+=t[6],d+=t[7];break;case"A":s=e.util.getBoundsOfArc(f,d,t[1],t[2],t[3],t[4],t[5],t[6],t[7]),f=t[6],d=t[7];break;case"z":case"Z":f=u,d=h}l=t,s.forEach(function(t){a.push(t.x),c.push(t.y)}),a.push(f),c.push(d)}var b=i(a)||0,y=i(c)||0,_=n(a)||0,x=n(c)||0,w=_-b,S=x-y,C={left:b,top:y,width:w,height:S};return C}}),e.Path.fromObject=function(t,i){var n;return"string"!=typeof t.path?(n=new e.Path(t.path,t),i&&i(n),n):void e.loadSVGFromURL(t.path,function(r){var o=t.path;n=r[0],delete t.path,e.util.object.extend(n,t),n.setSourcePath(o),i&&i(n)})},e.Path.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(["d"]),e.Path.fromElement=function(t,i,n){var o=e.parseAttributes(t,e.Path.ATTRIBUTE_NAMES);i&&i(new e.Path(o.d,r(o,n)))},void(e.Path.async=!0))}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.array.invoke,r=e.Object.prototype.toObject;return e.PathGroup?void e.warn("fabric.PathGroup is already defined"):(e.PathGroup=e.util.createClass(e.Path,{type:"path-group",fill:"",initialize:function(t,e){e=e||{},this.paths=t||[];for(var i=this.paths.length;i--;)this.paths[i].group=this;e.toBeParsed&&(this.parseDimensionsFromPaths(e),delete e.toBeParsed),this.setOptions(e),this.setCoords(),e.sourcePath&&this.setSourcePath(e.sourcePath)},parseDimensionsFromPaths:function(t){for(var i,n,r,o,s,a,c=[],l=[],u=this.paths.length;u--;){r=this.paths[u],o=r.height+r.strokeWidth,s=r.width+r.strokeWidth,i=[{x:r.left,y:r.top},{x:r.left+s,y:r.top},{x:r.left,y:r.top+o},{x:r.left+s,y:r.top+o}],a=this.paths[u].transformMatrix;for(var h=0;h<i.length;h++)n=i[h],a&&(n=e.util.transformPoint(n,a,!1)),c.push(n.x),l.push(n.y)}t.width=Math.max.apply(null,c),t.height=Math.max.apply(null,l)},render:function(t){if(this.visible){t.save(),this.transformMatrix&&t.transform.apply(t,this.transformMatrix),this.transform(t),this._setShadow(t),this.clipTo&&e.util.clipContext(this,t),t.translate(-this.width/2,-this.height/2);for(var i=0,n=this.paths.length;i<n;++i)this.paths[i].render(t,!0);this.clipTo&&t.restore(),t.restore()}},_set:function(t,e){if("fill"===t&&e&&this.isSameColor())for(var i=this.paths.length;i--;)this.paths[i]._set(t,e);return this.callSuper("_set",t,e)},toObject:function(t){var e=i(r.call(this,["sourcePath"].concat(t)),{paths:n(this.getObjects(),"toObject",t)});return e},toDatalessObject:function(t){var e=this.toObject(t);return this.sourcePath&&(e.paths=this.sourcePath),e},toSVG:function(t){var e=this.getObjects(),i=this.getPointByOrigin("left","top"),n="translate("+i.x+" "+i.y+")",r=this._createBaseSVGMarkup();r.push("<g ",this.getSvgId(),'style="',this.getSvgStyles(),'" ','transform="',this.getSvgTransformMatrix(),n,this.getSvgTransform(),'" ',">\n");for(var o=0,s=e.length;o<s;o++)r.push("\t",e[o].toSVG(t));return r.push("</g>\n"),t?t(r.join("")):r.join("")},toString:function(){return"#<fabric.PathGroup ("+this.complexity()+"): { top: "+this.top+", left: "+this.left+" }>"},isSameColor:function(){var t=this.getObjects()[0].get("fill")||"";return"string"==typeof t&&(t=t.toLowerCase(),this.getObjects().every(function(e){var i=e.get("fill")||"";return"string"==typeof i&&i.toLowerCase()===t}))},complexity:function(){return this.paths.reduce(function(t,e){return t+(e&&e.complexity?e.complexity():0)},0)},getObjects:function(){return this.paths}}),e.PathGroup.fromObject=function(t,i){"string"==typeof t.paths?e.loadSVGFromURL(t.paths,function(n){var r=t.paths;delete t.paths;var o=e.util.groupSVGElements(n,t,r);i(o)}):e.util.enlivenObjects(t.paths,function(n){delete t.paths,i(new e.PathGroup(n,t))})},void(e.PathGroup.async=!0))}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.array.min,r=e.util.array.max,o=e.util.array.invoke;if(!e.Group){var s={lockMovementX:!0,lockMovementY:!0,lockRotation:!0,lockScalingX:!0,lockScalingY:!0,lockUniScaling:!0};e.Group=e.util.createClass(e.Object,e.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,initialize:function(t,e,i){e=e||{},this._objects=[],i&&this.callSuper("initialize",e),this._objects=t||[];for(var n=this._objects.length;n--;)this._objects[n].group=this;this.originalState={},e.originX&&(this.originX=e.originX),e.originY&&(this.originY=e.originY),i?this._updateObjectsCoords(!0):(this._calcBounds(),this._updateObjectsCoords(),this.callSuper("initialize",e)),this.setCoords(),this.saveCoords()},_updateObjectsCoords:function(t){for(var e=this._objects.length;e--;)this._updateObjectCoords(this._objects[e],t)},_updateObjectCoords:function(t,e){if(t.__origHasControls=t.hasControls,t.hasControls=!1,!e){var i=t.getLeft(),n=t.getTop(),r=this.getCenterPoint();t.set({originalLeft:i,originalTop:n,left:i-r.x,top:n-r.y}),t.setCoords()}},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(t){return this._restoreObjectsState(),e.util.resetObjectTransform(this),t&&(this._objects.push(t),t.group=this,t._set("canvas",this.canvas)),this.forEachObject(this._setObjectActive,this),this._calcBounds(),this._updateObjectsCoords(),this},_setObjectActive:function(t){t.set("active",!0),t.group=this},removeWithUpdate:function(t){return this._restoreObjectsState(),e.util.resetObjectTransform(this),this.forEachObject(this._setObjectActive,this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this},_onObjectAdded:function(t){t.group=this,t._set("canvas",this.canvas)},_onObjectRemoved:function(t){delete t.group,t.set("active",!1)},delegatedProperties:{fill:!0,stroke:!0,strokeWidth:!0,fontFamily:!0,fontWeight:!0,fontSize:!0,fontStyle:!0,lineHeight:!0,textDecoration:!0,textAlign:!0,backgroundColor:!0},_set:function(t,e){var i=this._objects.length;if(this.delegatedProperties[t]||"canvas"===t)for(;i--;)this._objects[i].set(t,e);else for(;i--;)this._objects[i].setOnGroup(t,e);this.callSuper("_set",t,e)},toObject:function(t){return i(this.callSuper("toObject",t),{objects:o(this._objects,"toObject",t)})},render:function(t){if(this.visible){t.save(),this.transformMatrix&&t.transform.apply(t,this.transformMatrix),this.transform(t),this._setShadow(t),this.clipTo&&e.util.clipContext(this,t),this._transformDone=!0;for(var i=0,n=this._objects.length;i<n;i++)this._renderObject(this._objects[i],t);this.clipTo&&t.restore(),t.restore(),this._transformDone=!1}},_renderControls:function(t,e){this.callSuper("_renderControls",t,e);for(var i=0,n=this._objects.length;i<n;i++)this._objects[i]._renderControls(t)},_renderObject:function(t,e){if(t.visible){var i=t.hasRotatingPoint;t.hasRotatingPoint=!1,t.render(e),t.hasRotatingPoint=i}},_restoreObjectsState:function(){return this._objects.forEach(this._restoreObjectState,this),this},realizeTransform:function(t){var i=t.calcTransformMatrix(),n=e.util.qrDecompose(i),r=new e.Point(n.translateX,n.translateY);return t.scaleX=n.scaleX,t.scaleY=n.scaleY,t.skewX=n.skewX,t.skewY=n.skewY,t.angle=n.angle,t.flipX=!1,t.flipY=!1,t.setPositionByOrigin(r,"center","center"),t},_restoreObjectState:function(t){return this.realizeTransform(t),t.setCoords(),t.hasControls=t.__origHasControls,delete t.__origHasControls,t.set("active",!1),delete t.group,this},destroy:function(){return this._restoreObjectsState()},saveCoords:function(){return this._originalLeft=this.get("left"),this._originalTop=this.get("top"),this},hasMoved:function(){return this._originalLeft!==this.get("left")||this._originalTop!==this.get("top")},setObjectsCoords:function(){return this.forEachObject(function(t){t.setCoords()}),this},_calcBounds:function(t){for(var e,i,n,r=[],o=[],s=["tr","br","bl","tl"],a=0,c=this._objects.length,l=s.length;a<c;++a)for(e=this._objects[a],e.setCoords(),n=0;n<l;n++)i=s[n],r.push(e.oCoords[i].x),o.push(e.oCoords[i].y);this.set(this._getBounds(r,o,t))},_getBounds:function(t,i,o){var s=e.util.invertTransform(this.getViewportTransform()),a=e.util.transformPoint(new e.Point(n(t),n(i)),s),c=e.util.transformPoint(new e.Point(r(t),r(i)),s),l={width:c.x-a.x||0,height:c.y-a.y||0};return o||(l.left=a.x||0,l.top=a.y||0,"center"===this.originX&&(l.left+=l.width/2),"right"===this.originX&&(l.left+=l.width),"center"===this.originY&&(l.top+=l.height/2),"bottom"===this.originY&&(l.top+=l.height)),l},toSVG:function(t){var e=this._createBaseSVGMarkup();e.push("<g ",this.getSvgId(),'transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'" style="',this.getSvgFilter(),'">\n');for(var i=0,n=this._objects.length;i<n;i++)e.push("\t",this._objects[i].toSVG(t));return e.push("</g>\n"),t?t(e.join("")):e.join("")},get:function(t){if(t in s){if(this[t])return this[t];for(var e=0,i=this._objects.length;e<i;e++)if(this._objects[e][t])return!0;return!1}return t in this.delegatedProperties?this._objects[0]&&this._objects[0].get(t):this[t]}}),e.Group.fromObject=function(t,i){e.util.enlivenObjects(t.objects,function(n){delete t.objects,i&&i(new e.Group(n,t,!0))})},e.Group.async=!0}}(exports),function(t){"use strict";var e=fabric.util.object.extend;if(t.fabric||(t.fabric={}),t.fabric.Image)return void fabric.warn("fabric.Image is already defined.");var i=fabric.Object.prototype.stateProperties.concat();i.push("alignX","alignY","meetOrSlice"),fabric.Image=fabric.util.createClass(fabric.Object,{type:"image",crossOrigin:"",alignX:"none",alignY:"none",meetOrSlice:"meet",strokeWidth:0,_lastScaleX:1,_lastScaleY:1,minimumScaleTrigger:.5,stateProperties:i,initialize:function(t,e,i){e||(e={}),this.filters=[],this.resizeFilters=[],this.callSuper("initialize",e),this._initElement(t,e,i)},getElement:function(){return this._element},setElement:function(t,e,i){var n,r;return this._element=t,this._originalElement=t,this._initConfig(i),0===this.resizeFilters.length?n=e:(r=this,n=function(){r.applyFilters(e,r.resizeFilters,r._filteredEl||r._originalElement,!0)}),0!==this.filters.length?this.applyFilters(n):n&&n(this),this},setCrossOrigin:function(t){return this.crossOrigin=t,this._element.crossOrigin=t,this},getOriginalSize:function(){var t=this.getElement();return{width:t.width,height:t.height}},_stroke:function(t){if(this.stroke&&0!==this.strokeWidth){var e=this.width/2,i=this.height/2;t.beginPath(),t.moveTo(-e,-i),t.lineTo(e,-i),t.lineTo(e,i),t.lineTo(-e,i),t.lineTo(-e,-i),t.closePath()}},_renderDashedStroke:function(t){var e=-this.width/2,i=-this.height/2,n=this.width,r=this.height;t.save(),this._setStrokeStyles(t),t.beginPath(),fabric.util.drawDashedLine(t,e,i,e+n,i,this.strokeDashArray),fabric.util.drawDashedLine(t,e+n,i,e+n,i+r,this.strokeDashArray),fabric.util.drawDashedLine(t,e+n,i+r,e,i+r,this.strokeDashArray),fabric.util.drawDashedLine(t,e,i+r,e,i,this.strokeDashArray),t.closePath(),t.restore()},toObject:function(t){var i=[],n=[],r=1,o=1;this.filters.forEach(function(t){t&&("Resize"===t.type&&(r*=t.scaleX,o*=t.scaleY),i.push(t.toObject()))}),this.resizeFilters.forEach(function(t){t&&n.push(t.toObject())});var s=e(this.callSuper("toObject",["crossOrigin","alignX","alignY","meetOrSlice"].concat(t)),{src:this.getSrc(),filters:i,resizeFilters:n});return s.width/=r,s.height/=o,s},toSVG:function(t){var e=this._createBaseSVGMarkup(),i=-this.width/2,n=-this.height/2,r="none",o=!0;if(this.group&&"path-group"===this.group.type&&(i=this.left,n=this.top),"none"!==this.alignX&&"none"!==this.alignY&&(r="x"+this.alignX+"Y"+this.alignY+" "+this.meetOrSlice),e.push('<g transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'">\n',"<image ",this.getSvgId(),'xlink:href="',this.getSvgSrc(o),'" x="',i,'" y="',n,'" style="',this.getSvgStyles(),'" width="',this.width,'" height="',this.height,'" preserveAspectRatio="',r,'"',"></image>\n"),this.stroke||this.strokeDashArray){var s=this.fill;this.fill=null,e.push("<rect ",'x="',i,'" y="',n,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'),this.fill=s}return e.push("</g>\n"),t?t(e.join("")):e.join("")},getSrc:function(t){var e=t?this._element:this._originalElement;return e?fabric.isLikelyNode?e._src:e.src:this.src||""},setSrc:function(t,e,i){fabric.util.loadImage(t,function(t){return this.setElement(t,e,i)},this,i&&i.crossOrigin)},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyFilters:function(t,e,i,n){if(e=e||this.filters,i=i||this._originalElement){var r,o,s=fabric.util.createImage(),a=this.canvas?this.canvas.getRetinaScaling():fabric.devicePixelRatio,c=this.minimumScaleTrigger/a,l=this;if(0===e.length)return this._element=i,t&&t(this),i;var u=fabric.util.createCanvasElement();return u.width=i.width,u.height=i.height,u.getContext("2d").drawImage(i,0,0,i.width,i.height),e.forEach(function(t){t&&(n?(r=l.scaleX<c?l.scaleX:1,o=l.scaleY<c?l.scaleY:1,r*a<1&&(r*=a),o*a<1&&(o*=a)):(r=t.scaleX,o=t.scaleY),t.applyTo(u,r,o),n||"Resize"!==t.type||(l.width*=t.scaleX,l.height*=t.scaleY))}),s.width=u.width,s.height=u.height,fabric.isLikelyNode?(s.src=u.toBuffer(void 0,fabric.Image.pngCompression),l._element=s,!n&&(l._filteredEl=s),t&&t(l)):(s.onload=function(){l._element=s,!n&&(l._filteredEl=s),t&&t(l),s.onload=u=null},s.src=u.toDataURL("image/png")),u}},_render:function(t,e){var i,n,r,o=this._findMargins();i=e?this.left:-this.width/2,n=e?this.top:-this.height/2,"slice"===this.meetOrSlice&&(t.beginPath(),t.rect(i,n,this.width,this.height),t.clip()),this.isMoving===!1&&this.resizeFilters.length&&this._needsResize()?(this._lastScaleX=this.scaleX,this._lastScaleY=this.scaleY,r=this.applyFilters(null,this.resizeFilters,this._filteredEl||this._originalElement,!0)):r=this._element,r&&t.drawImage(r,i+o.marginX,n+o.marginY,o.width,o.height),this._stroke(t),this._renderStroke(t)},_needsResize:function(){return this.scaleX!==this._lastScaleX||this.scaleY!==this._lastScaleY},_findMargins:function(){var t,e,i=this.width,n=this.height,r=0,o=0;return"none"===this.alignX&&"none"===this.alignY||(t=[this.width/this._element.width,this.height/this._element.height],e="meet"===this.meetOrSlice?Math.min.apply(null,t):Math.max.apply(null,t),i=this._element.width*e,n=this._element.height*e,"Mid"===this.alignX&&(r=(this.width-i)/2),"Max"===this.alignX&&(r=this.width-i),"Mid"===this.alignY&&(o=(this.height-n)/2),"Max"===this.alignY&&(o=this.height-n)),{width:i,height:n,marginX:r,marginY:o}},_resetWidthHeight:function(){var t=this.getElement();this.set("width",t.width),this.set("height",t.height)},_initElement:function(t,e,i){this.setElement(fabric.util.getById(t),i,e),fabric.util.addClass(this.getElement(),fabric.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t),this._element&&this.crossOrigin&&(this._element.crossOrigin=this.crossOrigin)},_initFilters:function(t,e){t&&t.length?fabric.util.enlivenObjects(t,function(t){e&&e(t)},"fabric.Image.filters"):e&&e()},_setWidthHeight:function(t){this.width="width"in t?t.width:this.getElement()?this.getElement().width||0:0,this.height="height"in t?t.height:this.getElement()?this.getElement().height||0:0},complexity:function(){return 1}}),fabric.Image.CSS_CANVAS="canvas-img",fabric.Image.prototype.getSvgSrc=fabric.Image.prototype.getSrc,fabric.Image.fromObject=function(t,e){fabric.util.loadImage(t.src,function(i){fabric.Image.prototype._initFilters.call(t,t.filters,function(n){t.filters=n||[],fabric.Image.prototype._initFilters.call(t,t.resizeFilters,function(n){return t.resizeFilters=n||[],new fabric.Image(i,t,e)})})},null,t.crossOrigin)},fabric.Image.fromURL=function(t,e,i){fabric.util.loadImage(t,function(t){e&&e(new fabric.Image(t,i))},null,i&&i.crossOrigin)},fabric.Image.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href".split(" ")),fabric.Image.fromElement=function(t,i,n){var r,o=fabric.parseAttributes(t,fabric.Image.ATTRIBUTE_NAMES);o.preserveAspectRatio&&(r=fabric.util.parsePreserveAspectRatioAttribute(o.preserveAspectRatio),e(o,r)),fabric.Image.fromURL(o["xlink:href"],i,e(n?fabric.util.object.clone(n):{},o))},fabric.Image.async=!0,fabric.Image.pngCompression=1}(exports),fabric.util.object.extend(fabric.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.getAngle()%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.setAngle(this._getAngleValueForStraighten()),this},fxStraighten:function(t){t=t||{};var e=function(){},i=t.onComplete||e,n=t.onChange||e,r=this;return fabric.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){r.setAngle(t),n()},onComplete:function(){r.setCoords(),i()},onStart:function(){r.set("active",!1)}}),this}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.renderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.renderAll.bind(this)}),this}}),fabric.Image.filters=fabric.Image.filters||{},fabric.Image.filters.BaseFilter=fabric.util.createClass({type:"BaseFilter",initialize:function(t){t&&this.setOptions(t)},setOptions:function(t){for(var e in t)this[e]=t[e]},toObject:function(){return{type:this.type}},toJSON:function(){return this.toObject()}}),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Brightness=r(n.BaseFilter,{type:"Brightness",initialize:function(t){t=t||{},this.brightness=t.brightness||0},applyTo:function(t){for(var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,r=this.brightness,o=0,s=n.length;o<s;o+=4)n[o]+=r,n[o+1]+=r,n[o+2]+=r;e.putImageData(i,0,0)},toObject:function(){return i(this.callSuper("toObject"),{brightness:this.brightness})}}),e.Image.filters.Brightness.fromObject=function(t){return new e.Image.filters.Brightness(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Convolute=r(n.BaseFilter,{type:"Convolute",initialize:function(t){t=t||{},this.opaque=t.opaque,this.matrix=t.matrix||[0,0,0,0,1,0,0,0,0]},applyTo:function(t){for(var e,i,n,r,o,s,a,c,l,u=this.matrix,h=t.getContext("2d"),f=h.getImageData(0,0,t.width,t.height),d=Math.round(Math.sqrt(u.length)),p=Math.floor(d/2),g=f.data,v=f.width,m=f.height,b=h.createImageData(v,m),y=b.data,_=this.opaque?1:0,x=0;x<m;x++)for(var w=0;w<v;w++){o=4*(x*v+w),e=0,i=0,n=0,r=0;for(var S=0;S<d;S++)for(var C=0;C<d;C++)a=x+S-p,s=w+C-p,a<0||a>m||s<0||s>v||(c=4*(a*v+s),l=u[S*d+C],e+=g[c]*l,i+=g[c+1]*l,n+=g[c+2]*l,r+=g[c+3]*l);y[o]=e,y[o+1]=i,y[o+2]=n,y[o+3]=r+_*(255-r)}h.putImageData(b,0,0)},toObject:function(){return i(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),e.Image.filters.Convolute.fromObject=function(t){return new e.Image.filters.Convolute(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.GradientTransparency=r(n.BaseFilter,{type:"GradientTransparency",initialize:function(t){t=t||{},this.threshold=t.threshold||100},applyTo:function(t){for(var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,r=this.threshold,o=n.length,s=0,a=n.length;s<a;s+=4)n[s+3]=r+255*(o-s)/o;e.putImageData(i,0,0)},toObject:function(){return i(this.callSuper("toObject"),{threshold:this.threshold})}}),e.Image.filters.GradientTransparency.fromObject=function(t){return new e.Image.filters.GradientTransparency(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Grayscale=n(i.BaseFilter,{type:"Grayscale",applyTo:function(t){for(var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,o=n.width*n.height*4,s=0;s<o;)e=(r[s]+r[s+1]+r[s+2])/3,r[s]=e,r[s+1]=e,r[s+2]=e,s+=4;i.putImageData(n,0,0)}}),e.Image.filters.Grayscale.fromObject=function(){return new e.Image.filters.Grayscale}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Invert=n(i.BaseFilter,{type:"Invert",applyTo:function(t){var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,o=r.length;for(e=0;e<o;e+=4)r[e]=255-r[e],r[e+1]=255-r[e+1],r[e+2]=255-r[e+2];i.putImageData(n,0,0)}}),e.Image.filters.Invert.fromObject=function(){return new e.Image.filters.Invert}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Mask=r(n.BaseFilter,{type:"Mask",initialize:function(t){t=t||{},this.mask=t.mask,this.channel=[0,1,2,3].indexOf(t.channel)>-1?t.channel:0},applyTo:function(t){if(this.mask){var i,n=t.getContext("2d"),r=n.getImageData(0,0,t.width,t.height),o=r.data,s=this.mask.getElement(),a=e.util.createCanvasElement(),c=this.channel,l=r.width*r.height*4;a.width=t.width,a.height=t.height,a.getContext("2d").drawImage(s,0,0,t.width,t.height);var u=a.getContext("2d").getImageData(0,0,t.width,t.height),h=u.data;for(i=0;i<l;i+=4)o[i+3]=h[i+c];n.putImageData(r,0,0)}},toObject:function(){return i(this.callSuper("toObject"),{mask:this.mask.toObject(),channel:this.channel})}}),e.Image.filters.Mask.fromObject=function(t,i){e.util.loadImage(t.mask.src,function(n){t.mask=new e.Image(n,t.mask),i&&i(new e.Image.filters.Mask(t))})},e.Image.filters.Mask.async=!0}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Noise=r(n.BaseFilter,{type:"Noise",initialize:function(t){t=t||{},this.noise=t.noise||0},applyTo:function(t){for(var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,o=this.noise,s=0,a=r.length;s<a;s+=4)e=(.5-Math.random())*o,r[s]+=e,r[s+1]+=e,r[s+2]+=e;i.putImageData(n,0,0)},toObject:function(){return i(this.callSuper("toObject"),{noise:this.noise})}}),e.Image.filters.Noise.fromObject=function(t){return new e.Image.filters.Noise(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Pixelate=r(n.BaseFilter,{type:"Pixelate",initialize:function(t){t=t||{},this.blocksize=t.blocksize||4},applyTo:function(t){var e,i,n,r,o,s,a,c=t.getContext("2d"),l=c.getImageData(0,0,t.width,t.height),u=l.data,h=l.height,f=l.width;for(i=0;i<h;i+=this.blocksize)for(n=0;n<f;n+=this.blocksize){e=4*i*f+4*n,r=u[e],o=u[e+1],s=u[e+2],a=u[e+3];for(var d=i,p=i+this.blocksize;d<p;d++)for(var g=n,v=n+this.blocksize;g<v;g++)e=4*d*f+4*g,u[e]=r,u[e+1]=o,u[e+2]=s,u[e+3]=a}c.putImageData(l,0,0)},toObject:function(){return i(this.callSuper("toObject"),{blocksize:this.blocksize})}}),e.Image.filters.Pixelate.fromObject=function(t){return new e.Image.filters.Pixelate(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.RemoveWhite=r(n.BaseFilter,{type:"RemoveWhite",initialize:function(t){t=t||{},this.threshold=t.threshold||30,this.distance=t.distance||20},applyTo:function(t){for(var e,i,n,r=t.getContext("2d"),o=r.getImageData(0,0,t.width,t.height),s=o.data,a=this.threshold,c=this.distance,l=255-a,u=Math.abs,h=0,f=s.length;h<f;h+=4)e=s[h],i=s[h+1],n=s[h+2],e>l&&i>l&&n>l&&u(e-i)<c&&u(e-n)<c&&u(i-n)<c&&(s[h+3]=0);
r.putImageData(o,0,0)},toObject:function(){return i(this.callSuper("toObject"),{threshold:this.threshold,distance:this.distance})}}),e.Image.filters.RemoveWhite.fromObject=function(t){return new e.Image.filters.RemoveWhite(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Sepia=n(i.BaseFilter,{type:"Sepia",applyTo:function(t){var e,i,n=t.getContext("2d"),r=n.getImageData(0,0,t.width,t.height),o=r.data,s=o.length;for(e=0;e<s;e+=4)i=.3*o[e]+.59*o[e+1]+.11*o[e+2],o[e]=i+100,o[e+1]=i+50,o[e+2]=i+255;n.putImageData(r,0,0)}}),e.Image.filters.Sepia.fromObject=function(){return new e.Image.filters.Sepia}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Sepia2=n(i.BaseFilter,{type:"Sepia2",applyTo:function(t){var e,i,n,r,o=t.getContext("2d"),s=o.getImageData(0,0,t.width,t.height),a=s.data,c=a.length;for(e=0;e<c;e+=4)i=a[e],n=a[e+1],r=a[e+2],a[e]=(.393*i+.769*n+.189*r)/1.351,a[e+1]=(.349*i+.686*n+.168*r)/1.203,a[e+2]=(.272*i+.534*n+.131*r)/2.14;o.putImageData(s,0,0)}}),e.Image.filters.Sepia2.fromObject=function(){return new e.Image.filters.Sepia2}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Tint=r(n.BaseFilter,{type:"Tint",initialize:function(t){t=t||{},this.color=t.color||"#000000",this.opacity="undefined"!=typeof t.opacity?t.opacity:new e.Color(this.color).getAlpha()},applyTo:function(t){var i,n,r,o,s,a,c,l,u,h=t.getContext("2d"),f=h.getImageData(0,0,t.width,t.height),d=f.data,p=d.length;for(u=new e.Color(this.color).getSource(),n=u[0]*this.opacity,r=u[1]*this.opacity,o=u[2]*this.opacity,l=1-this.opacity,i=0;i<p;i+=4)s=d[i],a=d[i+1],c=d[i+2],d[i]=n+s*l,d[i+1]=r+a*l,d[i+2]=o+c*l;h.putImageData(f,0,0)},toObject:function(){return i(this.callSuper("toObject"),{color:this.color,opacity:this.opacity})}}),e.Image.filters.Tint.fromObject=function(t){return new e.Image.filters.Tint(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Multiply=r(n.BaseFilter,{type:"Multiply",initialize:function(t){t=t||{},this.color=t.color||"#000000"},applyTo:function(t){var i,n,r=t.getContext("2d"),o=r.getImageData(0,0,t.width,t.height),s=o.data,a=s.length;for(n=new e.Color(this.color).getSource(),i=0;i<a;i+=4)s[i]*=n[0]/255,s[i+1]*=n[1]/255,s[i+2]*=n[2]/255;r.putImageData(o,0,0)},toObject:function(){return i(this.callSuper("toObject"),{color:this.color})}}),e.Image.filters.Multiply.fromObject=function(t){return new e.Image.filters.Multiply(t)}}(exports),function(t){"use strict";var e=t.fabric,i=e.Image.filters,n=e.util.createClass;i.Blend=n(i.BaseFilter,{type:"Blend",initialize:function(t){t=t||{},this.color=t.color||"#000",this.image=t.image||!1,this.mode=t.mode||"multiply",this.alpha=t.alpha||1},applyTo:function(t){var i,n,r,o,s,a,c,l,u,h,f=t.getContext("2d"),d=f.getImageData(0,0,t.width,t.height),p=d.data,g=!1;if(this.image){g=!0;var v=e.util.createCanvasElement();v.width=this.image.width,v.height=this.image.height;var m=new e.StaticCanvas(v);m.add(this.image);var b=m.getContext("2d");h=b.getImageData(0,0,m.width,m.height).data}else h=new e.Color(this.color).getSource(),i=h[0]*this.alpha,n=h[1]*this.alpha,r=h[2]*this.alpha;for(var y=0,_=p.length;y<_;y+=4)switch(o=p[y],s=p[y+1],a=p[y+2],g&&(i=h[y]*this.alpha,n=h[y+1]*this.alpha,r=h[y+2]*this.alpha),this.mode){case"multiply":p[y]=o*i/255,p[y+1]=s*n/255,p[y+2]=a*r/255;break;case"screen":p[y]=1-(1-o)*(1-i),p[y+1]=1-(1-s)*(1-n),p[y+2]=1-(1-a)*(1-r);break;case"add":p[y]=Math.min(255,o+i),p[y+1]=Math.min(255,s+n),p[y+2]=Math.min(255,a+r);break;case"diff":case"difference":p[y]=Math.abs(o-i),p[y+1]=Math.abs(s-n),p[y+2]=Math.abs(a-r);break;case"subtract":c=o-i,l=s-n,u=a-r,p[y]=c<0?0:c,p[y+1]=l<0?0:l,p[y+2]=u<0?0:u;break;case"darken":p[y]=Math.min(o,i),p[y+1]=Math.min(s,n),p[y+2]=Math.min(a,r);break;case"lighten":p[y]=Math.max(o,i),p[y+1]=Math.max(s,n),p[y+2]=Math.max(a,r)}f.putImageData(d,0,0)},toObject:function(){return{color:this.color,image:this.image,mode:this.mode,alpha:this.alpha}}}),e.Image.filters.Blend.fromObject=function(t){return new e.Image.filters.Blend(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=Math.pow,n=Math.floor,r=Math.sqrt,o=Math.abs,s=Math.max,a=Math.round,c=Math.sin,l=Math.ceil,u=e.Image.filters,h=e.util.createClass;u.Resize=h(u.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:0,scaleY:0,lanczosLobes:3,applyTo:function(t,e,i){if(1!==e||1!==i){this.rcpScaleX=1/e,this.rcpScaleY=1/i;var n,r=t.width,o=t.height,s=a(r*e),c=a(o*i);"sliceHack"===this.resizeType&&(n=this.sliceByTwo(t,r,o,s,c)),"hermite"===this.resizeType&&(n=this.hermiteFastResize(t,r,o,s,c)),"bilinear"===this.resizeType&&(n=this.bilinearFiltering(t,r,o,s,c)),"lanczos"===this.resizeType&&(n=this.lanczosResize(t,r,o,s,c)),t.width=s,t.height=c,t.getContext("2d").putImageData(n,0,0)}},sliceByTwo:function(t,i,r,o,a){var c,l=t.getContext("2d"),u=.5,h=.5,f=1,d=1,p=!1,g=!1,v=i,m=r,b=e.util.createCanvasElement(),y=b.getContext("2d");for(o=n(o),a=n(a),b.width=s(o,i),b.height=s(a,r),o>i&&(u=2,f=-1),a>r&&(h=2,d=-1),c=l.getImageData(0,0,i,r),t.width=s(o,i),t.height=s(a,r),l.putImageData(c,0,0);!p||!g;)i=v,r=m,o*f<n(v*u*f)?v=n(v*u):(v=o,p=!0),a*d<n(m*h*d)?m=n(m*h):(m=a,g=!0),c=l.getImageData(0,0,i,r),y.putImageData(c,0,0),l.clearRect(0,0,v,m),l.drawImage(b,0,0,i,r,0,0,v,m);return l.getImageData(0,0,o,a)},lanczosResize:function(t,e,s,a,u){function h(t){return function(e){if(e>t)return 0;if(e*=Math.PI,o(e)<1e-16)return 1;var i=e/t;return c(e)*c(i)/e/i}}function f(t){var c,l,h,d,p,E,j,M,A,P,I;for(O.x=(t+.5)*y,T.x=n(O.x),c=0;c<u;c++){for(O.y=(c+.5)*_,T.y=n(O.y),p=0,E=0,j=0,M=0,A=0,l=T.x-S;l<=T.x+S;l++)if(!(l<0||l>=e)){P=n(1e3*o(l-O.x)),k[P]||(k[P]={});for(var D=T.y-C;D<=T.y+C;D++)D<0||D>=s||(I=n(1e3*o(D-O.y)),k[P][I]||(k[P][I]=b(r(i(P*x,2)+i(I*w,2))/1e3)),h=k[P][I],h>0&&(d=4*(D*e+l),p+=h,E+=h*v[d],j+=h*v[d+1],M+=h*v[d+2],A+=h*v[d+3]))}d=4*(c*a+t),m[d]=E/p,m[d+1]=j/p,m[d+2]=M/p,m[d+3]=A/p}return++t<a?f(t):g}var d=t.getContext("2d"),p=d.getImageData(0,0,e,s),g=d.getImageData(0,0,a,u),v=p.data,m=g.data,b=h(this.lanczosLobes),y=this.rcpScaleX,_=this.rcpScaleY,x=2/this.rcpScaleX,w=2/this.rcpScaleY,S=l(y*this.lanczosLobes/2),C=l(_*this.lanczosLobes/2),k={},O={},T={};return f(0)},bilinearFiltering:function(t,e,i,r,o){var s,a,c,l,u,h,f,d,p,g,v,m,b,y=0,_=this.rcpScaleX,x=this.rcpScaleY,w=t.getContext("2d"),S=4*(e-1),C=w.getImageData(0,0,e,i),k=C.data,O=w.getImageData(0,0,r,o),T=O.data;for(f=0;f<o;f++)for(d=0;d<r;d++)for(u=n(_*d),h=n(x*f),p=_*d-u,g=x*f-h,b=4*(h*e+u),v=0;v<4;v++)s=k[b+v],a=k[b+4+v],c=k[b+S+v],l=k[b+S+4+v],m=s*(1-p)*(1-g)+a*p*(1-g)+c*g*(1-p)+l*p*g,T[y++]=m;return O},hermiteFastResize:function(t,e,i,s,a){for(var c=this.rcpScaleX,u=this.rcpScaleY,h=l(c/2),f=l(u/2),d=t.getContext("2d"),p=d.getImageData(0,0,e,i),g=p.data,v=d.getImageData(0,0,s,a),m=v.data,b=0;b<a;b++)for(var y=0;y<s;y++){for(var _=4*(y+b*s),x=0,w=0,S=0,C=0,k=0,O=0,T=0,E=(b+.5)*u,j=n(b*u);j<(b+1)*u;j++)for(var M=o(E-(j+.5))/f,A=(y+.5)*c,P=M*M,I=n(y*c);I<(y+1)*c;I++){var D=o(A-(I+.5))/h,L=r(P+D*D);L>1&&L<-1||(x=2*L*L*L-3*L*L+1,x>0&&(D=4*(I+j*e),T+=x*g[D+3],S+=x,g[D+3]<255&&(x=x*g[D+3]/250),C+=x*g[D],k+=x*g[D+1],O+=x*g[D+2],w+=x))}m[_]=C/w,m[_+1]=k/w,m[_+2]=O/w,m[_+3]=T/S}return v},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),e.Image.filters.Resize.fromObject=function(t){return new e.Image.filters.Resize(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.ColorMatrix=r(n.BaseFilter,{type:"ColorMatrix",initialize:function(t){t||(t={}),this.matrix=t.matrix||[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]},applyTo:function(t){var e,i,n,r,o,s=t.getContext("2d"),a=s.getImageData(0,0,t.width,t.height),c=a.data,l=c.length,u=this.matrix;for(e=0;e<l;e+=4)i=c[e],n=c[e+1],r=c[e+2],o=c[e+3],c[e]=i*u[0]+n*u[1]+r*u[2]+o*u[3]+u[4],c[e+1]=i*u[5]+n*u[6]+r*u[7]+o*u[8]+u[9],c[e+2]=i*u[10]+n*u[11]+r*u[12]+o*u[13]+u[14],c[e+3]=i*u[15]+n*u[16]+r*u[17]+o*u[18]+u[19];s.putImageData(a,0,0)},toObject:function(){return i(this.callSuper("toObject"),{type:this.type,matrix:this.matrix})}}),e.Image.filters.ColorMatrix.fromObject=function(t){return new e.Image.filters.ColorMatrix(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Contrast=r(n.BaseFilter,{type:"Contrast",initialize:function(t){t=t||{},this.contrast=t.contrast||0},applyTo:function(t){for(var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,r=259*(this.contrast+255)/(255*(259-this.contrast)),o=0,s=n.length;o<s;o+=4)n[o]=r*(n[o]-128)+128,n[o+1]=r*(n[o+1]-128)+128,n[o+2]=r*(n[o+2]-128)+128;e.putImageData(i,0,0)},toObject:function(){return i(this.callSuper("toObject"),{contrast:this.contrast})}}),e.Image.filters.Contrast.fromObject=function(t){return new e.Image.filters.Contrast(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.Saturate=r(n.BaseFilter,{type:"Saturate",initialize:function(t){t=t||{},this.saturate=t.saturate||0},applyTo:function(t){for(var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,o=.01*-this.saturate,s=0,a=r.length;s<a;s+=4)e=Math.max(r[s],r[s+1],r[s+2]),r[s]+=e!==r[s]?(e-r[s])*o:0,r[s+1]+=e!==r[s+1]?(e-r[s+1])*o:0,r[s+2]+=e!==r[s+2]?(e-r[s+2])*o:0;i.putImageData(n,0,0)},toObject:function(){return i(this.callSuper("toObject"),{saturate:this.saturate})}}),e.Image.filters.Saturate.fromObject=function(t){return new e.Image.filters.Saturate(t)}}(exports),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.clone,n=e.util.toFixed,r=e.Object.NUM_FRACTION_DIGITS,o=2,s={};if(e.Text)return void e.warn("fabric.Text is already defined");var a=e.Object.prototype.stateProperties.concat();a.push("fontFamily","fontWeight","fontSize","text","textDecoration","textAlign","fontStyle","lineHeight","textBackgroundColor"),e.Text=e.util.createClass(e.Object,{_dimensionAffectingProps:{fontSize:!0,fontWeight:!0,fontFamily:!0,fontStyle:!0,lineHeight:!0,text:!0,charSpacing:!0,textAlign:!0,strokeWidth:!1},_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",textDecoration:"",textAlign:"left",fontStyle:"",lineHeight:1.16,textBackgroundColor:"",stateProperties:a,stroke:null,shadow:null,_fontSizeFraction:.25,_fontSizeMult:1.13,charSpacing:0,initialize:function(t,e){e=e||{},this.text=t,this.__skipDimension=!0,this.setOptions(e),this.__skipDimension=!1,this._initDimensions()},_initDimensions:function(t){this.__skipDimension||(t||(t=e.util.createCanvasElement().getContext("2d"),this._setTextStyles(t)),this._textLines=this._splitTextIntoLines(),this._clearCache(),this.width=this._getTextWidth(t)||this.cursorWidth||o,this.height=this._getTextHeight(t))},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_render:function(t){this.clipTo&&e.util.clipContext(this,t),this._setOpacity(t),this._setShadow(t),this._setupCompositeOperation(t),this._renderTextBackground(t),this._renderTextOuterDecoration(t),this._setStrokeStyles(t),this._setFillStyles(t),this._setGradient(t),this._renderText(t),this._renderTextDecoration(t),this.clipTo&&t.restore()},_renderText:function(t){this._renderTextStroke(t),this._renderTextFill(t)},_setTextStyles:function(t){t.textBaseline="alphabetic",t.font=this._getFontDeclaration()},_getTextHeight:function(){return this._getHeightOfSingleLine()+(this._textLines.length-1)*this._getHeightOfLine()},_getTextWidth:function(t){for(var e=this._getLineWidth(t,0),i=1,n=this._textLines.length;i<n;i++){var r=this._getLineWidth(t,i);r>e&&(e=r)}return e},_getNonTransformedDimensions:function(){return{x:this.width,y:this.height}},_renderChars:function(t,e,i,n,r){var o,s,a=t.slice(0,-4);if(this[a].toLive){var c=-this.width/2+this[a].offsetX||0,l=-this.height/2+this[a].offsetY||0;e.save(),e.translate(c,l),n-=c,r-=l}if(0!==this.charSpacing){var u=this._getWidthOfCharSpacing();i=i.split("");for(var h=0,f=i.length;h<f;h++)o=i[h],s=e.measureText(o).width+u,e[t](o,n,r),n+=s>0?s:0}else e[t](i,n,r);this[a].toLive&&e.restore()},_renderTextLine:function(t,e,i,n,r,o){r-=this.fontSize*this._fontSizeFraction;var s=this._getLineWidth(e,o);if("justify"!==this.textAlign||this.width<s)return void this._renderChars(t,e,i,n,r,o);for(var a,c=i.split(/\s+/),l=0,u=this._getWidthOfWords(e,c.join(" "),o,0),h=this.width-u,f=c.length-1,d=f>0?h/f:0,p=0,g=0,v=c.length;g<v;g++){for(;" "===i[l]&&l<i.length;)l++;a=c[g],this._renderChars(t,e,a,n+p,r,o,l),p+=this._getWidthOfWords(e,a,o,l)+d,l+=a.length}},_getWidthOfWords:function(t,e){var i,n,r=t.measureText(e).width;return 0!==this.charSpacing&&(i=e.split("").length,n=i*this._getWidthOfCharSpacing(),r+=n),r>0?r:0},_getLeftOffset:function(){return-this.width/2},_getTopOffset:function(){return-this.height/2},isEmptyStyles:function(){return!0},_renderTextCommon:function(t,e){for(var i=0,n=this._getLeftOffset(),r=this._getTopOffset(),o=0,s=this._textLines.length;o<s;o++){var a=this._getHeightOfLine(t,o),c=a/this.lineHeight,l=this._getLineWidth(t,o),u=this._getLineLeftOffset(l);this._renderTextLine(e,t,this._textLines[o],n+u,r+i+c,o),i+=a}},_renderTextFill:function(t){!this.fill&&this.isEmptyStyles()||this._renderTextCommon(t,"fillText")},_setGradient:function(t){if(this.gradient){var e=this.fontSize,i=this.width,n=this.gradient.array,r=!!this.gradient.horizon,o=t.createLinearGradient(0,0,r?i/2:0,r?0:e/2);for(var s in n){var a=n[s];void 0!==a.point&&a.point<=1&&a.color&&o.addColorStop(a.point,a.color)}t.fillStyle=o}else t.fillStyle=this.fill},_renderTextStroke:function(t){(this.stroke&&0!==this.strokeWidth||!this.isEmptyStyles())&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this._setLineDash(t,this.strokedashArray),t.beginPath(),this._renderTextCommon(t,"strokeText"),t.closePath(),t.restore())},_getHeightOfLine:function(){return this._getHeightOfSingleLine()*this.lineHeight},_getHeightOfSingleLine:function(){return this.fontSize*this._fontSizeMult},_renderTextBackground:function(t){this._renderBackground(t),this._renderTextLinesBackground(t)},_renderTextLinesBackground:function(t){if(this.textBackgroundColor){var e,i,n,r=0;t.fillStyle=this.textBackgroundColor;for(var o=0,s=this._textLines.length;o<s;o++)e=this._getHeightOfLine(t,o),i=this._getLineWidth(t,o),i>0&&(n=this._getLineLeftOffset(i),t.fillRect(this._getLeftOffset()+n,this._getTopOffset()+r,i,e/this.lineHeight)),r+=e;this._removeShadow(t)}},_getLineLeftOffset:function(t){return"center"===this.textAlign?(this.width-t)/2:"right"===this.textAlign?this.width-t:0},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[]},_shouldClearCache:function(){var t=!1;if(this._forceClearCache)return this._forceClearCache=!1,!0;for(var e in this._dimensionAffectingProps)this["__"+e]!==this[e]&&(this["__"+e]=this[e],t=!0);return t},_getLineWidth:function(t,e){if(this.__lineWidths[e])return this.__lineWidths[e]===-1?this.width:this.__lineWidths[e];var i,n,r=this._textLines[e];return i=""===r?0:this._measureLine(t,e),this.__lineWidths[e]=i,i&&"justify"===this.textAlign&&(n=r.split(/\s+/),n.length>1&&(this.__lineWidths[e]=-1)),i},_getWidthOfCharSpacing:function(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0},_measureLine:function(t,e){var i,n,r=this._textLines[e],o=t.measureText(r).width,s=0;return 0!==this.charSpacing&&(i=r.split("").length,s=(i-1)*this._getWidthOfCharSpacing()),n=o+s,n>0?n:0},_renderTextDecoration:function(t){function e(e){var r,o,s,a,c,l,u,h=0;for(r=0,o=n._textLines.length;r<o;r++){for(c=n._getLineWidth(t,r),l=n._getLineLeftOffset(c),u=n._getHeightOfLine(t,r),s=0,a=e.length;s<a;s++)t.fillRect(n._getLeftOffset()+l,h+(n._fontSizeMult-1+e[s])*n.fontSize-i,c,n.fontSize/15);h+=u}}if(this.textDecoration){var i=this.height/2,n=this,r=[];this.textDecoration.indexOf("underline")>-1&&r.push(.85),this.textDecoration.indexOf("line-through")>-1&&r.push(.43),this.textDecoration.indexOf("overline")>-1&&r.push(-.12),r.length>0&&e(r)}},_renderTextOuterDecoration:function(t){if(this.outerDecoration){t.lineWidth=this.outerDecoration.borderLineWidth,t.strokeStyle=this.outerDecoration.borderColor;var e=this.outerDecoration.offsetX||0,i=this.outerDecoration.offsetY||0,n=-this.width/2-e,r=-this.height/2-i,o=this.width+2*e,a=this.height+2*i,c=this.outerDecoration.radius||4,l=this.outerDecoration.cornerSize||30,u=n-l/2,h=r-l/2,f=n-l/2+o,d=r-l/2+a,p=0,g=Math.min(o,a);c>g/2&&(c=g/2),t.beginPath(),t.moveTo(n+c,r),t.arcTo(n+o,r,n+o,r+a,c),t.arcTo(n+o,r+a,n,r+a,c),t.arcTo(n,r+a,n,r,c),t.arcTo(n,r,n+o,r,c),t.closePath(),t.fillStyle=this.outerDecoration.backgroundColor,t.fill(),t.stroke();var v=function(t,e){return function(i,n,r,o){(!s[i]||s[i]&&!s[i].loaded)&&p++,e._loadImage(i,function(e,i){i||p--,i&&t.drawImage(e,n,r,o,o)},t,!0,function(){0===p?e.render(t):null})}}(t,this);this.outerDecoration.tl&&v(this.outerDecoration.tl,u,h,l,l),this.outerDecoration.tr&&v(this.outerDecoration.tr,f,h,l,l),this.outerDecoration.bl&&v(this.outerDecoration.bl,u,d,l,l),this.outerDecoration.br&&v(this.outerDecoration.br,f,d,l,l),0===p?this.fire("render:success"):null}},_loadImage:function(t,i,n,r,o){if(!t)return void(i&&i.call(n,t));if(s[t]){if(!s[t].loaded)return;return void(i&&i.call(n,s[t].img,!0))}var a=e.util.createImage();s[t]={loaded:!1,img:a},a.onload=function(){i&&i.call(n,a),s[t].loaded=!0,a=a.onload=a.onerror=null,o&&o()},a.onerror=function(){e.log("Error loading "+a.src),i&&i.call(n,null,!0),a=a.onload=a.onerror=null,s[t]=null},0!==t.indexOf("data")&&r&&(a.crossOrigin=r),a.src=t},_getFontDeclaration:function(){return[e.isLikelyNode?this.fontWeight:this.fontStyle,e.isLikelyNode?this.fontStyle:this.fontWeight,this.fontSize+"px",e.isLikelyNode?'"'+this.fontFamily+'"':this.fontFamily].join(" ")},render:function(t,e){this.visible&&(t.save(),this._setTextStyles(t),this._shouldClearCache()&&this._initDimensions(t),this.drawSelectionBackground(t),e||this.transform(t),this.transformMatrix&&t.transform.apply(t,this.transformMatrix),this.group&&"path-group"===this.group.type&&t.translate(this.left,this.top),this._render(t),t.restore())},_splitTextIntoLines:function(){return this.text.split(this._reNewline)},toObject:function(t){var e=["text","fontSize","fontWeight","fontFamily","fontStyle","lineHeight","textDecoration","textAlign","textBackgroundColor","charSpacing"].concat(t);return this.callSuper("toObject",e)},toSVG:function(t){this.ctx||(this.ctx=e.util.createCanvasElement().getContext("2d"));var i=this._createBaseSVGMarkup(),n=this._getSVGLeftTopOffsets(this.ctx),r=this._getSVGTextAndBg(n.textTop,n.textLeft);return this._wrapSVGTextAndBg(i,r),t?t(i.join("")):i.join("")},_getSVGLeftTopOffsets:function(t){var e=this._getHeightOfLine(t,0),i=-this.width/2,n=0;return{textLeft:i+(this.group&&"path-group"===this.group.type?this.left:0),textTop:n+(this.group&&"path-group"===this.group.type?-this.top:0),lineTop:e}},_wrapSVGTextAndBg:function(t,e){var i=!0,n=this.getSvgFilter(),r=""===n?"":' style="'+n+'"';t.push("\t<g ",this.getSvgId(),'transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"',r,">\n",e.textBgRects.join(""),"\t\t<text ",this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",this.textDecoration?'text-decoration="'+this.textDecoration+'" ':"",'style="',this.getSvgStyles(i),'" >\n',e.textSpans.join(""),"\t\t</text>\n","\t</g>\n")},_getSVGTextAndBg:function(t,e){var i=[],n=[],r=0;this._setSVGBg(n);for(var o=0,s=this._textLines.length;o<s;o++)this.textBackgroundColor&&this._setSVGTextLineBg(n,o,e,t,r),this._setSVGTextLineText(o,i,r,e,t,n),r+=this._getHeightOfLine(this.ctx,o);return{textSpans:i,textBgRects:n}},_setSVGTextLineText:function(t,i,o,s,a){var c=this.fontSize*(this._fontSizeMult-this._fontSizeFraction)-a+o-this.height/2;return"justify"===this.textAlign?void this._setSVGTextLineJustifed(t,i,c,s):void i.push('\t\t\t<tspan x="',n(s+this._getLineLeftOffset(this._getLineWidth(this.ctx,t)),r),'" ','y="',n(c,r),'" ',this._getFillAttributes(this.fill),">",e.util.string.escapeXml(this._textLines[t]),"</tspan>\n")},_setSVGTextLineJustifed:function(t,i,o,s){var a=e.util.createCanvasElement().getContext("2d");this._setTextStyles(a);var c,l,u=this._textLines[t],h=u.split(/\s+/),f=this._getWidthOfWords(a,h.join("")),d=this.width-f,p=h.length-1,g=p>0?d/p:0,v=this._getFillAttributes(this.fill);for(s+=this._getLineLeftOffset(this._getLineWidth(a,t)),t=0,l=h.length;t<l;t++)c=h[t],i.push('\t\t\t<tspan x="',n(s,r),'" ','y="',n(o,r),'" ',v,">",e.util.string.escapeXml(c),"</tspan>\n"),s+=this._getWidthOfWords(a,c)+g},_setSVGTextLineBg:function(t,e,i,o,s){t.push("\t\t<rect ",this._getFillAttributes(this.textBackgroundColor),' x="',n(i+this._getLineLeftOffset(this._getLineWidth(this.ctx,e)),r),'" y="',n(s-this.height/2,r),'" width="',n(this._getLineWidth(this.ctx,e),r),'" height="',n(this._getHeightOfLine(this.ctx,e)/this.lineHeight,r),'"></rect>\n')},_setSVGBg:function(t){this.backgroundColor&&t.push("\t\t<rect ",this._getFillAttributes(this.backgroundColor),' x="',n(-this.width/2,r),'" y="',n(-this.height/2,r),'" width="',n(this.width,r),'" height="',n(this.height,r),'"></rect>\n')},_getFillAttributes:function(t){var i=t&&"string"==typeof t?new e.Color(t):"";return i&&i.getSource()&&1!==i.getAlpha()?'opacity="'+i.getAlpha()+'" fill="'+i.setAlpha(1).toRgb()+'"':'fill="'+t+'"'},_set:function(t,e){this.callSuper("_set",t,e),t in this._dimensionAffectingProps&&(this._initDimensions(),this.setCoords())},complexity:function(){return 1}}),e.Text.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size text-decoration text-anchor".split(" ")),e.Text.DEFAULT_SVG_FONT_SIZE=16,e.Text.fromElement=function(t,i){if(!t)return null;var n=e.parseAttributes(t,e.Text.ATTRIBUTE_NAMES);i=e.util.object.extend(i?e.util.object.clone(i):{},n),i.top=i.top||0,i.left=i.left||0,"dx"in n&&(i.left+=n.dx),"dy"in n&&(i.top+=n.dy),"fontSize"in i||(i.fontSize=e.Text.DEFAULT_SVG_FONT_SIZE),i.originX||(i.originX="left");var r="";"textContent"in t?r=t.textContent:"firstChild"in t&&null!==t.firstChild&&"data"in t.firstChild&&null!==t.firstChild.data&&(r=t.firstChild.data),r=r.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var o=new e.Text(r,i),s=o.getHeight()/o.height,a=(o.height+o.strokeWidth)*o.lineHeight-o.height,c=a*s,l=o.getHeight()+c,u=0;return"left"===o.originX&&(u=o.getWidth()/2),"right"===o.originX&&(u=-o.getWidth()/2),o.set({left:o.getLeft()+u,top:o.getTop()-l/2+o.fontSize*(.18+o._fontSizeFraction)/o.lineHeight}),o},e.Text.fromObject=function(t,n){var r=new e.Text(t.text,i(t));return n&&n(r),r},e.util.createAccessors(e.Text)}(exports),function(){var t=fabric.util.object.clone;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:"#333",cursorDelay:1e3,cursorDuration:600,styles:null,caching:!0,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],initialize:function(t,e){this.styles=e?e.styles||{}:{},this.callSuper("initialize",t,e),this.initBehavior()},_clearCache:function(){this.callSuper("_clearCache"),this.__widthOfSpace=[]},isEmptyStyles:function(){if(!this.styles)return!0;var t=this.styles;for(var e in t)for(var i in t[e])for(var n in t[e][i])return!1;return!0},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})},getSelectionStyles:function(t,e){if(2===arguments.length){for(var i=[],n=t;n<e;n++)i.push(this.getSelectionStyles(n));return i}var r=this.get2DCursorLocation(t),o=this._getStyleDeclaration(r.lineIndex,r.charIndex);return o||{}},setSelectionStyles:function(t){if(this.selectionStart===this.selectionEnd)this._extendStyles(this.selectionStart,t);else for(var e=this.selectionStart;e<this.selectionEnd;e++)this._extendStyles(e,t);return this._forceClearCache=!0,this},_extendStyles:function(t,e){var i=this.get2DCursorLocation(t);this._getLineStyle(i.lineIndex)||this._setLineStyle(i.lineIndex,{}),this._getStyleDeclaration(i.lineIndex,i.charIndex)||this._setStyleDeclaration(i.lineIndex,i.charIndex,{}),fabric.util.object.extend(this._getStyleDeclaration(i.lineIndex,i.charIndex),e)},render:function(t,e){this.clearContextTop(),this.callSuper("render",t,e)},_render:function(t){this.callSuper("_render",t),this.ctx=t,this.cursorOffsetCache={},this.renderCursorOrSelection()},clearContextTop:function(){if(this.active&&this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this.canvas.contextTop;t.save(),t.transform.apply(t,this.canvas.viewportTransform),this.transform(t),this.transformMatrix&&t.transform.apply(t,this.transformMatrix),this._clearTextArea(t),t.restore()}},renderCursorOrSelection:function(){if(this.active&&this.isEditing){var t,e,i=this.text.split("");this.canvas&&this.canvas.contextTop?(e=this.canvas.contextTop,e.save(),e.transform.apply(e,this.canvas.viewportTransform),this.transform(e),this.transformMatrix&&e.transform.apply(e,this.transformMatrix),this._clearTextArea(e)):(e=this.ctx,e.save()),this.selectionStart===this.selectionEnd?(t=this._getCursorBoundaries(i,"cursor"),this.renderCursor(t,e)):(t=this._getCursorBoundaries(i,"selection"),this.renderSelection(i,t,e)),e.restore()}},_clearTextArea:function(t){var e=this.width+4,i=this.height+4;t.clearRect(-e/2,-i/2,e,i)},get2DCursorLocation:function(t){"undefined"==typeof t&&(t=this.selectionStart);for(var e=this._textLines.length,i=0;i<e;i++){if(t<=this._textLines[i].length)return{lineIndex:i,charIndex:t};t-=this._textLines[i].length+1}return{lineIndex:i-1,charIndex:this._textLines[i-1].length<t?this._textLines[i-1].length:t}},getCurrentCharStyle:function(t,e){var i=this._getStyleDeclaration(t,0===e?0:e-1);return{fontSize:i&&i.fontSize||this.fontSize,fill:i&&i.fill||this.fill,textBackgroundColor:i&&i.textBackgroundColor||this.textBackgroundColor,textDecoration:i&&i.textDecoration||this.textDecoration,fontFamily:i&&i.fontFamily||this.fontFamily,fontWeight:i&&i.fontWeight||this.fontWeight,fontStyle:i&&i.fontStyle||this.fontStyle,stroke:i&&i.stroke||this.stroke,strokeWidth:i&&i.strokeWidth||this.strokeWidth}},getCurrentCharFontSize:function(t,e){var i=this._getStyleDeclaration(t,0===e?0:e-1);return i&&i.fontSize?i.fontSize:this.fontSize},getCurrentCharColor:function(t,e){var i=this._getStyleDeclaration(t,0===e?0:e-1);return i&&i.fill?i.fill:this.cursorColor},_getCursorBoundaries:function(t,e){var i=Math.round(this._getLeftOffset()),n=this._getTopOffset(),r=this._getCursorBoundariesOffsets(t,e);return{left:i,top:n,leftOffset:r.left+r.lineLeft,topOffset:r.top}},_getCursorBoundariesOffsets:function(t,e){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;for(var i,n=0,r=0,o=0,s=0,a=0,c=0;c<this.selectionStart;c++)"\n"===t[c]?(a=0,s+=this._getHeightOfLine(this.ctx,r),r++,o=0):(a+=this._getWidthOfChar(this.ctx,t[c],r,o),o++),n=this._getLineLeftOffset(this._getLineWidth(this.ctx,r));return"cursor"===e&&(s+=(1-this._fontSizeFraction)*this._getHeightOfLine(this.ctx,r)/this.lineHeight-this.getCurrentCharFontSize(r,o)*(1-this._fontSizeFraction)),0!==this.charSpacing&&o===this._textLines[r].length&&(a-=this._getWidthOfCharSpacing()),i={top:s,left:a>0?a:0,lineLeft:n},this.cursorOffsetCache=i,this.cursorOffsetCache},renderCursor:function(t,e){var i=this.get2DCursorLocation(),n=i.lineIndex,r=i.charIndex,o=this.getCurrentCharFontSize(n,r),s=0===n&&0===r?this._getLineLeftOffset(this._getLineWidth(e,n)):t.leftOffset,a=this.scaleX*this.canvas.getZoom(),c=this.cursorWidth/a;e.fillStyle=this.getCurrentCharColor(n,r),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+s-c/2,t.top+t.topOffset,c,o)},renderSelection:function(t,e,i){i.fillStyle=this.selectionColor;for(var n=this.get2DCursorLocation(this.selectionStart),r=this.get2DCursorLocation(this.selectionEnd),o=n.lineIndex,s=r.lineIndex,a=o;a<=s;a++){var c=this._getLineLeftOffset(this._getLineWidth(i,a))||0,l=this._getHeightOfLine(this.ctx,a),u=0,h=0,f=this._textLines[a];if(a===o){for(var d=0,p=f.length;d<p;d++)d>=n.charIndex&&(a!==s||d<r.charIndex)&&(h+=this._getWidthOfChar(i,f[d],a,d)),d<n.charIndex&&(c+=this._getWidthOfChar(i,f[d],a,d));d===f.length&&(h-=this._getWidthOfCharSpacing())}else if(a>o&&a<s)h+=this._getLineWidth(i,a)||5;else if(a===s){for(var g=0,v=r.charIndex;g<v;g++)h+=this._getWidthOfChar(i,f[g],a,g);r.charIndex===f.length&&(h-=this._getWidthOfCharSpacing())}u=l,(this.lineHeight<1||a===s&&this.lineHeight>1)&&(l/=this.lineHeight),i.fillRect(e.left+c,e.top+e.topOffset,h>0?h:0,l),e.topOffset+=u}},_renderChars:function(t,e,i,n,r,o,s){if(this.isEmptyStyles())return this._renderCharsFast(t,e,i,n,r);s=s||0;var a,c,l=this._getHeightOfLine(e,o),u="";e.save(),r-=l/this.lineHeight*this._fontSizeFraction;for(var h=s,f=i.length+s;h<=f;h++)a=a||this.getCurrentCharStyle(o,h),c=this.getCurrentCharStyle(o,h+1),(this._hasStyleChanged(a,c)||h===f)&&(this._renderChar(t,e,o,h-1,u,n,r,l),u="",a=c),u+=i[h-s];e.restore()},_renderCharsFast:function(t,e,i,n,r){"fillText"===t&&this.fill&&this.callSuper("_renderChars",t,e,i,n,r),"strokeText"===t&&(this.stroke&&this.strokeWidth>0||this.skipFillStrokeCheck)&&this.callSuper("_renderChars",t,e,i,n,r)},_renderChar:function(t,e,i,n,r,o,s,a){var c,l,u,h,f,d,p,g,v,m=this._getStyleDeclaration(i,n);if(m?(l=this._getHeightOfChar(e,r,i,n),h=m.stroke,u=m.fill,d=m.textDecoration):l=this.fontSize,h=(h||this.stroke)&&"strokeText"===t,u=(u||this.fill)&&"fillText"===t,m&&e.save(),c=this._applyCharStylesGetWidth(e,r,i,n,m||null),d=d||this.textDecoration,m&&m.textBackgroundColor&&this._removeShadow(e),0!==this.charSpacing){g=this._getWidthOfCharSpacing(),p=r.split(""),c=0;for(var b,y=0,_=p.length;y<_;y++)b=p[y],u&&e.fillText(b,o+c,s),h&&e.strokeText(b,o+c,s),v=e.measureText(b).width+g,c+=v>0?v:0}else u&&e.fillText(r,o,s),h&&e.strokeText(r,o,s);(d||""!==d)&&(f=this._fontSizeFraction*a/this.lineHeight,this._renderCharDecoration(e,d,o,s,f,c,l)),m&&e.restore(),e.translate(c,0)},_hasStyleChanged:function(t,e){return t.fill!==e.fill||t.fontSize!==e.fontSize||t.textBackgroundColor!==e.textBackgroundColor||t.textDecoration!==e.textDecoration||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth},_renderCharDecoration:function(t,e,i,n,r,o,s){if(e){var a,c,l=s/15,u={underline:n+s/10,"line-through":n-s*(this._fontSizeFraction+this._fontSizeMult-1)+l,overline:n-(this._fontSizeMult-this._fontSizeFraction)*s},h=["underline","line-through","overline"];for(a=0;a<h.length;a++)c=h[a],e.indexOf(c)>-1&&t.fillRect(i,u[c],o,l)}},_renderTextLine:function(t,e,i,n,r,o){this.isEmptyStyles()||(r+=this.fontSize*(this._fontSizeFraction+.03)),this.callSuper("_renderTextLine",t,e,i,n,r,o)},_renderTextDecoration:function(t){if(this.isEmptyStyles())return this.callSuper("_renderTextDecoration",t)},_renderTextLinesBackground:function(t){this.callSuper("_renderTextLinesBackground",t);for(var e,i,n,r,o,s,a=0,c=this._getLeftOffset(),l=this._getTopOffset(),u=0,h=this._textLines.length;u<h;u++)if(e=this._getHeightOfLine(t,u),
r=this._textLines[u],""!==r&&this.styles&&this._getLineStyle(u)){i=this._getLineWidth(t,u),n=this._getLineLeftOffset(i);for(var f=0,d=r.length;f<d;f++)s=this._getStyleDeclaration(u,f),s&&s.textBackgroundColor&&(o=r[f],t.fillStyle=s.textBackgroundColor,t.fillRect(c+n+this._getWidthOfCharsAt(t,u,f),l+a,this._getWidthOfChar(t,o,u,f),e/this.lineHeight));a+=e}else a+=e},_getCacheProp:function(t,e){return t+e.fontSize+e.fontWeight+e.fontStyle},_getFontCache:function(t){return fabric.charWidthsCache[t]||(fabric.charWidthsCache[t]={}),fabric.charWidthsCache[t]},_applyCharStylesGetWidth:function(e,i,n,r,o){var s,a,c,l=o||this._getStyleDeclaration(n,r),u=t(l);if(this._applyFontStyles(u),c=this._getFontCache(u.fontFamily),a=this._getCacheProp(i,u),!l&&c[a]&&this.caching)return c[a];"string"==typeof u.shadow&&(u.shadow=new fabric.Shadow(u.shadow));var h=u.fill||this.fill;return e.fillStyle=h.toLive?h.toLive(e,this):h,u.stroke&&(e.strokeStyle=u.stroke&&u.stroke.toLive?u.stroke.toLive(e,this):u.stroke),e.lineWidth=u.strokeWidth||this.strokeWidth,e.font=this._getFontDeclaration.call(u),u.shadow&&(u.scaleX=this.scaleX,u.scaleY=this.scaleY,u.canvas=this.canvas,u.getObjectScaling=this.getObjectScaling,this._setShadow.call(u,e)),this.caching&&c[a]?c[a]:(s=e.measureText(i).width,this.caching&&(c[a]=s),s)},_applyFontStyles:function(t){t.fontFamily||(t.fontFamily=this.fontFamily),t.fontSize||(t.fontSize=this.fontSize),t.fontWeight||(t.fontWeight=this.fontWeight),t.fontStyle||(t.fontStyle=this.fontStyle)},_getStyleDeclaration:function(e,i,n){return n?this.styles[e]&&this.styles[e][i]?t(this.styles[e][i]):{}:this.styles[e]&&this.styles[e][i]?this.styles[e][i]:null},_setStyleDeclaration:function(t,e,i){this.styles[t][e]=i},_deleteStyleDeclaration:function(t,e){delete this.styles[t][e]},_getLineStyle:function(t){return this.styles[t]},_setLineStyle:function(t,e){this.styles[t]=e},_deleteLineStyle:function(t){delete this.styles[t]},_getWidthOfChar:function(t,e,i,n){if(!this._isMeasuring&&"justify"===this.textAlign&&this._reSpacesAndTabs.test(e))return this._getWidthOfSpace(t,i);t.save();var r=this._applyCharStylesGetWidth(t,e,i,n);return 0!==this.charSpacing&&(r+=this._getWidthOfCharSpacing()),t.restore(),r>0?r:0},_getHeightOfChar:function(t,e,i){var n=this._getStyleDeclaration(e,i);return n&&n.fontSize?n.fontSize:this.fontSize},_getWidthOfCharsAt:function(t,e,i){var n,r,o=0;for(n=0;n<i;n++)r=this._textLines[e][n],o+=this._getWidthOfChar(t,r,e,n);return o},_measureLine:function(t,e){this._isMeasuring=!0;var i=this._getWidthOfCharsAt(t,e,this._textLines[e].length);return 0!==this.charSpacing&&(i-=this._getWidthOfCharSpacing()),this._isMeasuring=!1,i>0?i:0},_getWidthOfSpace:function(t,e){if(this.__widthOfSpace[e])return this.__widthOfSpace[e];var i=this._textLines[e],n=this._getWidthOfWords(t,i,e,0),r=this.width-n,o=i.length-i.replace(this._reSpacesAndTabs,"").length,s=Math.max(r/o,t.measureText(" ").width);return this.__widthOfSpace[e]=s,s},_getWidthOfWords:function(t,e,i,n){for(var r=0,o=0;o<e.length;o++){var s=e[o];s.match(/\s/)||(r+=this._getWidthOfChar(t,s,i,o+n))}return r},_getHeightOfLine:function(t,e){if(this.__lineHeights[e])return this.__lineHeights[e];for(var i=this._textLines[e],n=this._getHeightOfChar(t,e,0),r=1,o=i.length;r<o;r++){var s=this._getHeightOfChar(t,e,r);s>n&&(n=s)}return this.__lineHeights[e]=n*this.lineHeight*this._fontSizeMult,this.__lineHeights[e]},_getTextHeight:function(t){for(var e,i=0,n=0,r=this._textLines.length;n<r;n++)e=this._getHeightOfLine(t,n),i+=n===r-1?e/this.lineHeight:e;return i},toObject:function(e){return fabric.util.object.extend(this.callSuper("toObject",e),{styles:t(this.styles,!0)})}}),fabric.IText.fromObject=function(e,i){var n=new fabric.IText(e.text,t(e));return i&&i(n),n}}(),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)},initSelectedHandler:function(){this.on("selected",function(){var t=this;setTimeout(function(){t.selected=!0},100)})},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._canvasITextSelectionClearedHanlder=function(){fabric.IText.prototype.exitEditingOnOthers(t)}.bind(this),t._mouseUpITextHandler=function(){t._iTextInstances&&t._iTextInstances.forEach(function(t){t.__isMousedown=!1})}.bind(this),t.on("selection:cleared",t._canvasITextSelectionClearedHanlder),t.on("object:selected",t._canvasITextSelectionClearedHanlder),t.on("mouse:up",t._mouseUpITextHandler)},_removeCanvasHandlers:function(t){t.off("selection:cleared",t._canvasITextSelectionClearedHanlder),t.off("object:selected",t._canvasITextSelectionClearedHanlder),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;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,t&&this.canvas&&this.canvas.clearContext(this.canvas.contextTop||this.ctx)},selectAll:function(){this.selectionStart=0,this.selectionEnd=this.text.length,this._fireSelectionChanged(),this._updateTextarea()},getSelectedText:function(){return this.text.slice(this.selectionStart,this.selectionEnd)},findWordBoundaryLeft:function(t){var e=0,i=t-1;if(this._reSpace.test(this.text.charAt(i)))for(;this._reSpace.test(this.text.charAt(i));)e++,i--;for(;/\S/.test(this.text.charAt(i))&&i>-1;)e++,i--;return t-e},findWordBoundaryRight:function(t){var e=0,i=t;if(this._reSpace.test(this.text.charAt(i)))for(;this._reSpace.test(this.text.charAt(i));)e++,i++;for(;/\S/.test(this.text.charAt(i))&&i<this.text.length;)e++,i++;return t+e},findLineBoundaryLeft:function(t){for(var e=0,i=t-1;!/\n/.test(this.text.charAt(i))&&i>-1;)e++,i--;return t-e},findLineBoundaryRight:function(t){for(var e=0,i=t;!/\n/.test(this.text.charAt(i))&&i<this.text.length;)e++,i++;return t+e},getNumNewLinesInSelectedText:function(){for(var t=this.getSelectedText(),e=0,i=0,n=t.length;i<n;i++)"\n"===t[i]&&e++;return e},searchWordBoundary:function(t,e){for(var i=this._reSpace.test(this.text.charAt(t))?t-1:t,n=this.text.charAt(i),r=/[ \n\.,;!\?\-]/;!r.test(n)&&i>0&&i<this.text.length;)i+=e,n=this.text.charAt(i);return r.test(n)&&"\n"!==n&&(i+=1===e?0:1),i},selectWord:function(t){t=t||this.selectionStart;var e=this.searchWordBoundary(t,-1),i=this.searchWordBoundary(t,1);this.selectionStart=e,this.selectionEnd=i,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(t){t=t||this.selectionStart;var e=this.findLineBoundaryLeft(t),i=this.findLineBoundaryRight(t);this.selectionStart=e,this.selectionEnd=i,this._fireSelectionChanged(),this._updateTextarea()},enterEditing:function(t){if(!this.isEditing&&this.editable)return this.canvas&&this.exitEditingOnOthers(this.canvas),this.isEditing=!0,this.initHiddenTextarea(t),this.hiddenTextarea.focus(),this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this.canvas?(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.renderAll(),this):this},exitEditingOnOthers:function(t){t._iTextInstances&&t._iTextInstances.forEach(function(t){t.selected=!1,t.isEditing&&t.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(t){if(this.__isMousedown&&this.isEditing){var e=this.getSelectionStartFromPointer(t.e),i=this.selectionStart,n=this.selectionEnd;e!==this.__selectionStartOnMouseDown&&(e>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=e):(this.selectionStart=e,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===i&&this.selectionEnd===n||(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},_updateTextarea:function(){if(this.hiddenTextarea&&!this.inCompositionMode&&(this.cursorOffsetCache={},this.hiddenTextarea.value=this.text,this.hiddenTextarea.selectionStart=this.selectionStart,this.hiddenTextarea.selectionEnd=this.selectionEnd,this.selectionStart===this.selectionEnd)){var t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top,this.hiddenTextarea.style.fontSize=t.fontSize}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var t=this.text.split(""),e=this._getCursorBoundaries(t,"cursor"),i=this.get2DCursorLocation(),n=i.lineIndex,r=i.charIndex,o=this.getCurrentCharFontSize(n,r),s=0===n&&0===r?this._getLineLeftOffset(this._getLineWidth(this.ctx,n)):e.leftOffset,a=this.calcTransformMatrix(),c={x:e.left+s,y:e.top+e.topOffset+o},l=this.canvas.upperCanvasEl,u=l.width-o,h=l.height-o;return c=fabric.util.transformPoint(c,a),c=fabric.util.transformPoint(c,this.canvas.viewportTransform),c.x<0&&(c.x=0),c.x>u&&(c.x=u),c.y<0&&(c.y=0),c.y>h&&(c.y=h),c.x+=this.canvas._offset.left,c.y+=this.canvas._offset.top,{left:c.x+"px",top:c.y+"px",fontSize:o}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.overCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,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;return this.selected=!1,this.isEditing=!1,this.selectable=!0,this.selectionEnd=this.selectionStart,this.hiddenTextarea&&this.canvas&&this.hiddenTextarea.parentNode.removeChild(this.hiddenTextarea),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,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]},_removeCharsFromTo:function(t,e){for(;e!==t;)this._removeSingleCharAndStyle(t+1),e--;this.selectionStart=t,this.selectionEnd=t},_removeSingleCharAndStyle:function(t){var e="\n"===this.text[t-1],i=e?t:t-1;this.removeStyleObject(e,i),this.text=this.text.slice(0,t-1)+this.text.slice(t),this._textLines=this._splitTextIntoLines()},insertChars:function(t,e){var i;if(this.selectionEnd-this.selectionStart>1&&this._removeCharsFromTo(this.selectionStart,this.selectionEnd),!e&&this.isEmptyStyles())return void this.insertChar(t,!1);for(var n=0,r=t.length;n<r;n++)e&&(i=fabric.copiedTextStyle[n]),this.insertChar(t[n],n<r-1,i)},insertChar:function(t,e,i){var n="\n"===this.text[this.selectionStart];this.text=this.text.slice(0,this.selectionStart)+t+this.text.slice(this.selectionEnd),this._textLines=this._splitTextIntoLines(),this.insertStyleObjects(t,n,i),this.selectionStart+=t.length,this.selectionEnd=this.selectionStart,e||(this._updateTextarea(),this.setCoords(),this._fireSelectionChanged(),this.fire("changed"),this.canvas&&this.canvas.fire("text:changed",{target:this}),this.canvas&&this.canvas.renderAll())},insertNewlineStyleObject:function(e,i,n){this.shiftLineStyles(e,1),this.styles[e+1]||(this.styles[e+1]={});var r={},o={};if(this.styles[e]&&this.styles[e][i-1]&&(r=this.styles[e][i-1]),n)o[0]=t(r),this.styles[e+1]=o;else{for(var s in this.styles[e])parseInt(s,10)>=i&&(o[parseInt(s,10)-i]=this.styles[e][s],delete this.styles[e][s]);this.styles[e+1]=o}this._forceClearCache=!0},insertCharStyleObject:function(e,i,n){var r=this.styles[e],o=t(r);0!==i||n||(i=1);for(var s in o){var a=parseInt(s,10);a>=i&&(r[a+1]=o[a],o[a-1]||delete r[a])}this.styles[e][i]=n||t(r[i-1]),this._forceClearCache=!0},insertStyleObjects:function(t,e,i){var n=this.get2DCursorLocation(),r=n.lineIndex,o=n.charIndex;this._getLineStyle(r)||this._setLineStyle(r,{}),"\n"===t?this.insertNewlineStyleObject(r,o,e):this.insertCharStyleObject(r,o,i)},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])}},removeStyleObject:function(t,e){var i=this.get2DCursorLocation(e),n=i.lineIndex,r=i.charIndex;this._removeStyleObject(t,i,n,r)},_getTextOnPreviousLine:function(t){return this._textLines[t-1]},_removeStyleObject:function(e,i,n,r){if(e){var o=this._getTextOnPreviousLine(i.lineIndex),s=o?o.length:0;this.styles[n-1]||(this.styles[n-1]={});for(r in this.styles[n])this.styles[n-1][parseInt(r,10)+s]=this.styles[n][r];this.shiftLineStyles(i.lineIndex,-1)}else{var a=this.styles[n];a&&delete a[r];var c=t(a);for(var l in c){var u=parseInt(l,10);u>=r&&0!==u&&(a[u-1]=c[u],delete a[u])}}},insertNewline:function(){this.insertChars("\n")},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&&i<e?"right"===this._selectionDirection?this.selectionEnd=i:this.selectionStart=i:(e===t?this._selectionDirection="right":"left"===this._selectionDirection&&(this._selectionDirection="right",this.selectionStart=e),this.selectionEnd=i)},setSelectionInBoundaries:function(){var t=this.text.length;this.selectionStart>t?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.bind(this))},onMouseDown:function(t){this.__newClickTime=+new Date;var e=this.canvas.getPointer(t.e);this.isTripleClick(e)?(this.fire("tripleclick",t),this._stopEvent(t.e)):this.isDoubleClick(e)&&(this.fire("dblclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected},isDoubleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y&&this.__lastIsEditing},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.initSelectedHandler(),this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},initClicks:function(){this.on("dblclick",function(t){this.selectWord(this.getSelectionStartFromPointer(t.e))}),this.on("tripleclick",function(t){this.selectLine(this.getSelectionStartFromPointer(t.e))})},initMousedownHandler:function(){this.on("mousedown",function(t){if(this.editable){var e=this.canvas.getPointer(t.e);this.__mousedownX=e.x,this.__mousedownY=e.y,this.__isMousedown=!0,this.selected&&this.setCursorByClick(t.e),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection())}})},_isObjectMoved:function(t){var e=this.canvas.getPointer(t);return this.__mousedownX!==e.x||this.__mousedownY!==e.y},initMouseupHandler:function(){this.on("mouseup",function(t){this.__isMousedown=!1,this.editable&&!this._isObjectMoved(t.e)&&(this.__lastSelected&&!this.__corner&&(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._fireSelectionChanged(),this._updateTextarea()},getSelectionStartFromPointer:function(t){for(var e,i,n=this.getLocalPointer(t),r=0,o=0,s=0,a=0,c=0,l=this._textLines.length;c<l;c++){i=this._textLines[c],s+=this._getHeightOfLine(this.ctx,c)*this.scaleY;var u=this._getLineWidth(this.ctx,c),h=this._getLineLeftOffset(u);o=h*this.scaleX;for(var f=0,d=i.length;f<d;f++){if(r=o,o+=this._getWidthOfChar(this.ctx,i[f],c,this.flipX?d-f:f)*this.scaleX,!(s<=n.y||o<=n.x))return this._getNewSelectionStartFromOffset(n,r,o,a+c,d);a++}if(n.y<s)return this._getNewSelectionStartFromOffset(n,r,o,a+c-1,d)}if("undefined"==typeof e)return this.text.length},_getNewSelectionStartFromOffset:function(t,e,i,n,r){var o=t.x-e,s=i-t.x,a=s>o?0:1,c=n+a;return this.flipX&&(c=r-c),c>this.text.length&&(c=this.text.length),c}}),fabric.util.object.extend(fabric.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=fabric.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off");var t=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+t.top+"; left: "+t.left+"; opacity: 0; width: 0px; height: 0px; z-index: -999;",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.cut.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:{8:"removeChars",9:"exitEditing",27:"exitEditing",13:"insertNewline",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown",46:"forwardDelete"},_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(),this.canvas&&this.canvas.renderAll()}},onKeyUp:function(t){return!this.isEditing||this._copyDone?void(this._copyDone=!1):void(t.keyCode in this._ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this._ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.renderAll()))},onInput:function(t){if(this.isEditing&&!this.inCompositionMode){var e,i,n,r=this.selectionStart||0,o=this.selectionEnd||0,s=this.text.length,a=this.hiddenTextarea.value.length;a>s?(n="left"===this._selectionDirection?o:r,e=a-s,i=this.hiddenTextarea.value.slice(n,n+e)):(e=a-s+o-r,i=this.hiddenTextarea.value.slice(r,r+e)),this.insertChars(i),t.stopPropagation()}},onCompositionStart:function(){this.inCompositionMode=!0,this.prevCompositionLength=0,this.compositionStart=this.selectionStart},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(t){var e=t.data;this.selectionStart=this.compositionStart,this.selectionEnd=this.selectionEnd===this.selectionStart?this.compositionStart+this.prevCompositionLength:this.selectionEnd,this.insertChars(e,!1),this.prevCompositionLength=e.length},forwardDelete:function(t){if(this.selectionStart===this.selectionEnd){if(this.selectionStart===this.text.length)return;this.moveCursorRight(t)}this.removeChars(t)},copy:function(t){if(this.selectionStart!==this.selectionEnd){var e=this.getSelectedText(),i=this._getClipboardData(t);i&&i.setData("text",e),fabric.copiedText=e,fabric.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd),t.stopImmediatePropagation(),t.preventDefault(),this._copyDone=!0}},paste:function(t){var e=null,i=this._getClipboardData(t),n=!0;i?(e=i.getData("text").replace(/\r/g,""),fabric.copiedTextStyle&&fabric.copiedText===e||(n=!1)):e=fabric.copiedText,e&&this.insertChars(e,n),t.stopImmediatePropagation(),t.preventDefault()},cut:function(t){this.selectionStart!==this.selectionEnd&&(this.copy(t),this.removeChars(t))},_getClipboardData:function(t){return t&&t.clipboardData||fabric.window.clipboardData},_getWidthBeforeCursor:function(t,e){for(var i,n=this._textLines[t].slice(0,e),r=this._getLineWidth(this.ctx,t),o=this._getLineLeftOffset(r),s=0,a=n.length;s<a;s++)i=n[s],o+=this._getWidthOfChar(this.ctx,i,t,s);return o},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),c=this._textLines[r].slice(o);return c.length+a+2},_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),c=this._textLines[r].slice(0,o);return-this._textLines[r-1].length+a-c.length},_getIndexOnLine:function(t,e){for(var i,n=this._getLineWidth(this.ctx,t),r=this._textLines[t],o=this._getLineLeftOffset(n),s=o,a=0,c=0,l=r.length;c<l;c++){var u=r[c],h=this._getWidthOfChar(this.ctx,u,t,c);if(s+=h,s>e){i=!0;var f=s-h,d=s,p=Math.abs(f-e),g=Math.abs(d-e);a=g<p?c:c-1;break}}return i||(a=r.length-1),a},moveCursorDown:function(t){this.selectionStart>=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="get"+t+"CursorOffset",n=this[i](e,"right"===this._selectionDirection);e.shiftKey?this.moveCursorWithShift(n):this.moveCursorWithoutShift(n),0!==n&&(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,i+=e.shiftKey?"Shift":"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){this.selectionStart===this.selectionEnd?this._removeCharsNearCursor(t):this._removeCharsFromTo(this.selectionStart,this.selectionEnd),this.setSelectionEnd(this.selectionStart),this._removeExtraneousStyles(),this.canvas&&this.canvas.renderAll(),this.setCoords(),this.fire("changed"),this.canvas&&this.canvas.fire("text:changed",{target:this})},_removeCharsNearCursor:function(t){if(0!==this.selectionStart)if(t.metaKey){var e=this.findLineBoundaryLeft(this.selectionStart);this._removeCharsFromTo(e,this.selectionStart),this.setSelectionStart(e)}else if(t.altKey){var i=this.findWordBoundaryLeft(this.selectionStart);this._removeCharsFromTo(i,this.selectionStart),this.setSelectionStart(i)}else this._removeSingleCharAndStyle(this.selectionStart),this.setSelectionStart(this.selectionStart-1)}}),function(){var t=fabric.util.toFixed,e=fabric.Object.NUM_FRACTION_DIGITS;fabric.util.object.extend(fabric.IText.prototype,{_setSVGTextLineText:function(t,e,i,n,r,o){this._getLineStyle(t)?this._setSVGTextLineChars(t,e,i,n,o):fabric.Text.prototype._setSVGTextLineText.call(this,t,e,i,n,r)},_setSVGTextLineChars:function(t,e,i,n,r){for(var o=this._textLines[t],s=0,a=this._getLineLeftOffset(this._getLineWidth(this.ctx,t))-this.width/2,c=this._getSVGLineTopOffset(t),l=this._getHeightOfLine(this.ctx,t),u=0,h=o.length;u<h;u++){var f=this._getStyleDeclaration(t,u)||{};e.push(this._createTextCharSpan(o[u],f,a,c.lineTop+c.offset,s));var d=this._getWidthOfChar(this.ctx,o[u],t,u);f.textBackgroundColor&&r.push(this._createTextCharBg(f,a,c.lineTop,l,d,s)),s+=d}},_getSVGLineTopOffset:function(t){for(var e=0,i=0,n=0;n<t;n++)e+=this._getHeightOfLine(this.ctx,n);return i=this._getHeightOfLine(this.ctx,n),{lineTop:e,offset:(this._fontSizeMult-this._fontSizeFraction)*i/(this.lineHeight*this._fontSizeMult)}},_createTextCharBg:function(i,n,r,o,s,a){return['\t\t<rect fill="',i.textBackgroundColor,'" x="',t(n+a,e),'" y="',t(r-this.height/2,e),'" width="',t(s,e),'" height="',t(o/this.lineHeight,e),'"></rect>\n'].join("")},_createTextCharSpan:function(i,n,r,o,s){var a=this.getSvgStyles.call(fabric.util.object.extend({visible:!0,fill:this.fill,stroke:this.stroke,type:"text",getSvgFilter:fabric.Object.prototype.getSvgFilter},n));return['\t\t\t<tspan x="',t(r+s,e),'" y="',t(o-this.height/2,e),'" ',n.fontFamily?'font-family="'+n.fontFamily.replace(/"/g,"'")+'" ':"",n.fontSize?'font-size="'+n.fontSize+'" ':"",n.fontStyle?'font-style="'+n.fontStyle+'" ':"",n.fontWeight?'font-weight="'+n.fontWeight+'" ':"",n.textDecoration?'text-decoration="'+n.textDecoration+'" ':"",'style="',a,'">',fabric.util.string.escapeXml(i),"</tspan>\n"].join("")}})}(),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.clone;e.Textbox=e.util.createClass(e.IText,e.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingY:!0,lockScalingFlip:!0,initialize:function(t,i){this.ctx=e.util.createCanvasElement().getContext("2d"),this.callSuper("initialize",t,i),this.setControlsVisibility(e.Textbox.getTextboxControlVisibility()),this._dimensionAffectingProps.width=!0},_initDimensions:function(t){this.__skipDimension||(t||(t=e.util.createCanvasElement().getContext("2d"),this._setTextStyles(t)),this.dynamicMinWidth=0,this._textLines=this._splitTextIntoLines(),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),this._clearCache(),this.height=this._getTextHeight(t))},_generateStyleMap:function(){for(var t=0,e=0,i=0,n={},r=0;r<this._textLines.length;r++)"\n"===this.text[i]&&r>0?(e=0,i++,t++):" "===this.text[i]&&r>0&&(e++,i++),n[r]={line:t,offset:e},i+=this._textLines[r].length,e+=this._textLines[r].length;return n},_getStyleDeclaration:function(t,e,i){if(this._styleMap){var n=this._styleMap[t];if(!n)return i?{}:null;t=n.line,e=n.offset+e}return this.callSuper("_getStyleDeclaration",t,e,i)},_setStyleDeclaration:function(t,e,i){var n=this._styleMap[t];t=n.line,e=n.offset+e,this.styles[t][e]=i},_deleteStyleDeclaration:function(t,e){var i=this._styleMap[t];t=i.line,e=i.offset+e,delete this.styles[t][e]},_getLineStyle:function(t){var e=this._styleMap[t];return this.styles[e.line]},_setLineStyle:function(t,e){var i=this._styleMap[t];this.styles[i.line]=e},_deleteLineStyle:function(t){var e=this._styleMap[t];delete this.styles[e.line]},_wrapText:function(t,e){var i,n=e.split(this._reNewline),r=[];for(i=0;i<n.length;i++)r=r.concat(this._wrapLine(t,n[i],i));return r},_measureText:function(t,e,i,n){var r=0;n=n||0;for(var o=0,s=e.length;o<s;o++)r+=this._getWidthOfChar(t,e[o],i,o+n);return r},_wrapLine:function(t,e,i){for(var n=0,r=[],o="",s=e.split(" "),a="",c=0,l=" ",u=0,h=0,f=0,d=!0,p=this._getWidthOfCharSpacing(),g=0;g<s.length;g++)a=s[g],u=this._measureText(t,a,i,c),c+=a.length,n+=h+u-p,n>=this.width&&!d?(r.push(o),o="",n=u,d=!0):n+=p,d||(o+=l),o+=a,h=this._measureText(t,l,i,c),c++,d=!1,u>f&&(f=u);
return g&&r.push(o),f>this.dynamicMinWidth&&(this.dynamicMinWidth=f-p),r},_splitTextIntoLines:function(){var t=this.textAlign;this.ctx.save(),this._setTextStyles(this.ctx),this.textAlign="left";var e=this._wrapText(this.ctx,this.text);return this.textAlign=t,this.ctx.restore(),this._textLines=e,this._styleMap=this._generateStyleMap(),e},setOnGroup:function(t,e){"scaleX"===t&&(this.set("scaleX",Math.abs(1/e)),this.set("width",this.get("width")*e/("undefined"==typeof this.__oldScaleX?1:this.__oldScaleX)),this.__oldScaleX=e)},get2DCursorLocation:function(t){"undefined"==typeof t&&(t=this.selectionStart);for(var e=this._textLines.length,i=0,n=0;n<e;n++){var r=this._textLines[n],o=r.length;if(t<=i+o)return{lineIndex:n,charIndex:t-i};i+=o,"\n"!==this.text[i]&&" "!==this.text[i]||i++}return{lineIndex:e-1,charIndex:this._textLines[e-1].length}},_getCursorBoundariesOffsets:function(t,e){for(var i=0,n=0,r=this.get2DCursorLocation(),o=this._textLines[r.lineIndex].split(""),s=this._getLineLeftOffset(this._getLineWidth(this.ctx,r.lineIndex)),a=0;a<r.charIndex;a++)n+=this._getWidthOfChar(this.ctx,o[a],r.lineIndex,a);for(a=0;a<r.lineIndex;a++)i+=this._getHeightOfLine(this.ctx,a);return"cursor"===e&&(i+=(1-this._fontSizeFraction)*this._getHeightOfLine(this.ctx,r.lineIndex)/this.lineHeight-this.getCurrentCharFontSize(r.lineIndex,r.charIndex)*(1-this._fontSizeFraction)),{top:i,left:n,lineLeft:s}},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},toObject:function(t){return this.callSuper("toObject",["minWidth"].concat(t))}}),e.Textbox.fromObject=function(t,n){var r=new e.Textbox(t.text,i(t));return n&&n(r),r},e.Textbox.getTextboxControlVisibility=function(){return{tl:!1,tr:!1,br:!1,bl:!1,ml:!0,mt:!1,mr:!0,mb:!1,mtr:!0}}}(exports),function(){var t=fabric.Canvas.prototype._setObjectScale;fabric.Canvas.prototype._setObjectScale=function(e,i,n,r,o,s,a){var c=i.target;if(!(c instanceof fabric.Textbox))return t.call(fabric.Canvas.prototype,e,i,n,r,o,s,a);var l=c.width*(e.x/i.scaleX/(c.width+c.strokeWidth));return l>=c.getMinWidth()?(c.set("width",l),!0):void 0},fabric.Group.prototype._refreshControlsVisibility=function(){if("undefined"!=typeof fabric.Textbox)for(var t=this._objects.length;t--;)if(this._objects[t]instanceof fabric.Textbox)return void this.setControlsVisibility(fabric.Textbox.getTextboxControlVisibility())};var e=fabric.util.object.clone;fabric.util.object.extend(fabric.Textbox.prototype,{_removeExtraneousStyles:function(){for(var t in this._styleMap)this._textLines[t]||delete this.styles[this._styleMap[t].line]},insertCharStyleObject:function(t,e,i){var n=this._styleMap[t];t=n.line,e=n.offset+e,fabric.IText.prototype.insertCharStyleObject.apply(this,[t,e,i])},insertNewlineStyleObject:function(t,e,i){var n=this._styleMap[t];t=n.line,e=n.offset+e,fabric.IText.prototype.insertNewlineStyleObject.apply(this,[t,e,i])},shiftLineStyles:function(t,i){var n=e(this.styles),r=this._styleMap[t];t=r.line;for(var o in this.styles){var s=parseInt(o,10);s>t&&(this.styles[s+i]=n[s],n[s-i]||delete this.styles[s])}},_getTextOnPreviousLine:function(t){for(var e=this._textLines[t-1];this._styleMap[t-2]&&this._styleMap[t-2].line===this._styleMap[t-1].line;)e=this._textLines[t-2]+e,t--;return e},removeStyleObject:function(t,e){var i=this.get2DCursorLocation(e),n=this._styleMap[i.lineIndex],r=n.line,o=n.offset+i.charIndex;this._removeStyleObject(t,i,r,o)}})}(),function(){var t=fabric.IText.prototype._getNewSelectionStartFromOffset;fabric.IText.prototype._getNewSelectionStartFromOffset=function(e,i,n,r,o){r=t.call(this,e,i,n,r,o);for(var s=0,a=0,c=0;c<this._textLines.length&&(s+=this._textLines[c].length,!(s+a>=r));c++)"\n"!==this.text[s+a]&&" "!==this.text[s+a]||a++;return r-c+a}}(),function(){function request(t,e,i){var n=URL.parse(t);n.port||(n.port=0===n.protocol.indexOf("https:")?443:80);var r=0===n.protocol.indexOf("https:")?HTTPS:HTTP,o=r.request({hostname:n.hostname,port:n.port,path:n.path,method:"GET"},function(t){var n="";e&&t.setEncoding(e),t.on("end",function(){i(n)}),t.on("data",function(e){200===t.statusCode&&(n+=e)})});o.on("error",function(t){t.errno===process.ECONNREFUSED?fabric.log("ECONNREFUSED: connection refused to "+n.hostname+":"+n.port):fabric.log(t.message),i(null)}),o.end()}function requestFs(t,e){var i=__webpack_require__(191);i.readFile(t,function(t,i){if(t)throw fabric.log(t),t;e(i)})}if("undefined"==typeof document||"undefined"==typeof window){var DOMParser=__webpack_require__(193).DOMParser,URL=__webpack_require__(64),HTTP=__webpack_require__(60),HTTPS=__webpack_require__(174),Canvas=__webpack_require__(38),Image=__webpack_require__(38).Image;fabric.util.loadImage=function(t,e,i){function n(n){n?(r.src=new Buffer(n,"binary"),r._src=t,e&&e.call(i,r)):(r=null,e&&e.call(i,null,!0))}var r=new Image;t&&(t instanceof Buffer||0===t.indexOf("data"))?(r.src=r._src=t,e&&e.call(i,r)):t&&0!==t.indexOf("http")?requestFs(t,n):t?request(t,"binary",n):e&&e.call(i,t)},fabric.loadSVGFromURL=function(t,e,i){t=t.replace(/^\n\s*/,"").replace(/\?.*$/,"").trim(),0!==t.indexOf("http")?requestFs(t,function(t){fabric.loadSVGFromString(t.toString(),e,i)}):request(t,"",function(t){fabric.loadSVGFromString(t,e,i)})},fabric.loadSVGFromString=function(t,e,i){var n=(new DOMParser).parseFromString(t);fabric.parseSVGDocument(n.documentElement,function(t,i){e&&e(t,i)},i)},fabric.util.getScript=function(url,callback){request(url,"",function(body){eval(body),callback&&callback()})},fabric.createCanvasForNode=function(t,e,i,n){n=n||i;var r=fabric.document.createElement("canvas"),o=new Canvas(t||600,e||600,n),s=new Canvas(t||600,e||600,n);r.style={},r.width=o.width,r.height=o.height,i=i||{},i.nodeCanvas=o,i.nodeCacheCanvas=s;var a=fabric.Canvas||fabric.StaticCanvas,c=new a(r,i);return c.nodeCanvas=o,c.nodeCacheCanvas=s,c.contextContainer=o.getContext("2d"),c.contextCache=s.getContext("2d"),c.Font=Canvas.Font,c};var originaInitStatic=fabric.StaticCanvas.prototype._initStatic;fabric.StaticCanvas.prototype._initStatic=function(t,e){t=t||fabric.document.createElement("canvas"),this.nodeCanvas=new Canvas(t.width,t.height),this.nodeCacheCanvas=new Canvas(t.width,t.height),originaInitStatic.call(this,t,e),this.contextContainer=this.nodeCanvas.getContext("2d"),this.contextCache=this.nodeCacheCanvas.getContext("2d"),this.Font=Canvas.Font},fabric.StaticCanvas.prototype.createPNGStream=function(){return this.nodeCanvas.createPNGStream()},fabric.StaticCanvas.prototype.createJPEGStream=function(t){return this.nodeCanvas.createJPEGStream(t)},fabric.StaticCanvas.prototype._initRetinaScaling=function(){if(this._isRetinaScaling())return this.lowerCanvasEl.setAttribute("width",this.width*fabric.devicePixelRatio),this.lowerCanvasEl.setAttribute("height",this.height*fabric.devicePixelRatio),this.nodeCanvas.width=this.width*fabric.devicePixelRatio,this.nodeCanvas.height=this.height*fabric.devicePixelRatio,this.contextContainer.scale(fabric.devicePixelRatio,fabric.devicePixelRatio),this},fabric.Canvas&&(fabric.Canvas.prototype._initRetinaScaling=fabric.StaticCanvas.prototype._initRetinaScaling);var origSetBackstoreDimension=fabric.StaticCanvas.prototype._setBackstoreDimension;fabric.StaticCanvas.prototype._setBackstoreDimension=function(t,e){return origSetBackstoreDimension.call(this,t,e),this.nodeCanvas[t]=e,this},fabric.Canvas&&(fabric.Canvas.prototype._setBackstoreDimension=fabric.StaticCanvas.prototype._setBackstoreDimension)}}(),window.fabric=fabric,__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=function(){return fabric}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}).call(exports,__webpack_require__(13).Buffer,function(){return this}(),__webpack_require__(12))},function(t,e,i){var n=i(48)("wks"),r=i(51),o=i(8).Symbol,s="function"==typeof o,a=t.exports=function(t){return n[t]||(n[t]=s&&o[t]||(s?o:r)("Symbol."+t))};a.store=n},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(e,n){i(this,t),this.name=e,this.graphics=n}return n(t,[{key:"fire",value:function(){for(var t=this.graphics,e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];return this.graphics.fire.apply(t,i)}},{key:"setCanvasImage",value:function(t,e){this.graphics.setCanvasImage(t,e)}},{key:"getCanvasElement",value:function(){return this.graphics.getCanvasElement()}},{key:"getCanvas",value:function(){return this.graphics.getCanvas()}},{key:"getCanvasImage",value:function(){return this.graphics.getCanvasImage()}},{key:"getImageName",value:function(){return this.graphics.getImageName()}},{key:"getEditor",value:function(){return this.graphics.getEditor()}},{key:"getName",value:function(){return this.name}},{key:"setImageProperties",value:function(t,e){this.graphics.setImageProperties(t,e)}},{key:"setCanvasCssDimension",value:function(t){this.graphics.setCanvasCssDimension(t)}},{key:"setCanvasBackstoreDimension",value:function(t){this.graphics.setCanvasBackstoreDimension(t)}},{key:"adjustCanvasDimension",value:function(){this.graphics.adjustCanvasDimension()}}]),t}();t.exports=r},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(e,n){var r=n.name,o=n.iconStyle,s=n.menuBarPosition,a=n.templateHtml;i(this,t),this.selector=function(t){return e.querySelector(t)},this.menuBarPosition=s,this.toggleDirection="top"===s?"down":"up",this.colorPickerControls=[],this._makeSubMenuElement(e,{name:r,iconStyle:o,templateHtml:a})}return n(t,[{key:"colorPickerChangeShow",value:function(t){this.colorPickerControls.forEach(function(e){t!==e&&e.hide()})}},{key:"getButtonType",value:function(t,e){return t.className.match(RegExp("("+e.join("|")+")"))[0]}},{key:"changeClass",value:function(t,e,i){t.classList.remove(e),t.classList.add(i)}},{key:"changeStandbyMode",value:function(){}},{key:"changeStartMode",value:function(){}},{key:"_makeSubMenuElement",value:function(t,e){var i=e.name,n=e.iconStyle,r=e.templateHtml,o=document.createElement("div");o.className="tui-image-editor-menu-"+i,o.innerHTML=r({iconStyle:n}),t.appendChild(o)}}]),t}();e.default=r},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}},function(t,e){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(t){if(u===setTimeout)return setTimeout(t,0);if((u===i||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function o(t){if(h===clearTimeout)return clearTimeout(t);if((h===n||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){g&&d&&(g=!1,d.length?p=d.concat(p):v=-1,p.length&&a())}function a(){if(!g){var t=r(s);g=!0;for(var e=p.length;e;){for(d=p,p=[];++v<e;)d&&d[v].run();v=-1,e=p.length}d=null,g=!1,o(t)}}function c(t,e){this.fun=t,this.array=e}function l(){}var u,h,f=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:i}catch(t){u=i}try{h="function"==typeof clearTimeout?clearTimeout:n}catch(t){h=n}}();var d,p=[],g=!1,v=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];p.push(new c(t,e)),1!==p.length||g||r(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=l,f.addListener=l,f.once=l,f.off=l,f.removeListener=l,f.removeAllListeners=l,f.emit=l,f.prependListener=l,f.prependOnceListener=l,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e,i){(function(t){/*!
	 * The buffer module from node.js, for the browser.
	 *
	 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
	 * @license  MIT
	 */
"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function r(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(r()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=s.prototype):(null===t&&(t=new s(e)),t.length=e),t}function s(t,e,i){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,e,i);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(this,t)}return a(this,t,e,i)}function a(t,e,i,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?d(t,e,i,n):"string"==typeof e?h(t,e,i):p(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e,i,n){return c(e),e<=0?o(t,e):void 0!==i?"string"==typeof n?o(t,e).fill(i,n):o(t,e).fill(i):o(t,e)}function u(t,e){if(c(e),t=o(t,e<0?0:0|g(e)),!s.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function h(t,e,i){if("string"==typeof i&&""!==i||(i="utf8"),!s.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(e,i);t=o(t,n);var r=t.write(e,i);return r!==n&&(t=t.slice(0,r)),t}function f(t,e){var i=e.length<0?0:0|g(e.length);t=o(t,i);for(var n=0;n<i;n+=1)t[n]=255&e[n];return t}function d(t,e,i,n){if(e.byteLength,i<0||e.byteLength<i)throw new RangeError("'offset' is out of bounds");if(e.byteLength<i+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===i&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,i):new Uint8Array(e,i,n),s.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=s.prototype):t=f(t,e),t}function p(t,e){if(s.isBuffer(e)){var i=0|g(e.length);return t=o(t,i),0===t.length?t:(e.copy(t,0,0,i),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||K(e.length)?o(t,0):f(t,e);if("Buffer"===e.type&&Q(e.data))return f(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function g(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function v(t){return+t!=t&&(t=0),s.alloc(+t)}function m(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return q(t).length;default:if(n)return Y(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,i){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,e>>>=0,i<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,i);case"utf8":case"utf-8":return j(this,e,i);case"ascii":return A(this,e,i);case"latin1":case"binary":return P(this,e,i);case"base64":return E(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,i);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function _(t,e,i,n,r){if(0===t.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=r?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(r)return-1;i=t.length-1}else if(i<0){if(!r)return-1;i=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:x(t,e,i,n,r);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):x(t,[e],i,n,r);throw new TypeError("val must be string, number or Buffer")}function x(t,e,i,n,r){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,i/=2}var l;if(r){var u=-1;for(l=i;l<a;l++)if(o(t,l)===o(e,u===-1?0:l-u)){if(u===-1&&(u=l),l-u+1===c)return u*s}else u!==-1&&(l-=l-u),u=-1}else for(i+c>a&&(i=a-c),l=i;l>=0;l--){for(var h=!0,f=0;f<c;f++)if(o(t,l+f)!==o(e,f)){h=!1;break}if(h)return l}return-1}function w(t,e,i,n){i=Number(i)||0;var r=t.length-i;n?(n=Number(n),n>r&&(n=r)):n=r;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[i+s]=a}return s}function S(t,e,i,n){return Z(Y(e,t.length-i),t,i,n)}function C(t,e,i,n){return Z(G(e),t,i,n)}function k(t,e,i,n){return C(t,e,i,n)}function O(t,e,i,n){return Z(q(e),t,i,n)}function T(t,e,i,n){return Z(V(e,t.length-i),t,i,n)}function E(t,e,i){return 0===e&&i===t.length?J.fromByteArray(t):J.fromByteArray(t.slice(e,i))}function j(t,e,i){i=Math.min(t.length,i);for(var n=[],r=e;r<i;){var o=t[r],s=null,a=o>239?4:o>223?3:o>191?2:1;if(r+a<=i){var c,l,u,h;switch(a){case 1:o<128&&(s=o);break;case 2:c=t[r+1],128===(192&c)&&(h=(31&o)<<6|63&c,h>127&&(s=h));break;case 3:c=t[r+1],l=t[r+2],128===(192&c)&&128===(192&l)&&(h=(15&o)<<12|(63&c)<<6|63&l,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:c=t[r+1],l=t[r+2],u=t[r+3],128===(192&c)&&128===(192&l)&&128===(192&u)&&(h=(15&o)<<18|(63&c)<<12|(63&l)<<6|63&u,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),r+=a}return M(n)}function M(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var i="",n=0;n<e;)i+=String.fromCharCode.apply(String,t.slice(n,n+=tt));return i}function A(t,e,i){var n="";i=Math.min(t.length,i);for(var r=e;r<i;++r)n+=String.fromCharCode(127&t[r]);return n}function P(t,e,i){var n="";i=Math.min(t.length,i);for(var r=e;r<i;++r)n+=String.fromCharCode(t[r]);return n}function I(t,e,i){var n=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>n)&&(i=n);for(var r="",o=e;o<i;++o)r+=H(t[o]);return r}function D(t,e,i){for(var n=t.slice(e,i),r="",o=0;o<n.length;o+=2)r+=String.fromCharCode(n[o]+256*n[o+1]);return r}function L(t,e,i){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,i,n,r,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<o)throw new RangeError('"value" argument is out of bounds');if(i+n>t.length)throw new RangeError("Index out of range")}function B(t,e,i,n){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-i,2);r<o;++r)t[i+r]=(e&255<<8*(n?r:1-r))>>>8*(n?r:1-r)}function N(t,e,i,n){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-i,4);r<o;++r)t[i+r]=e>>>8*(n?r:3-r)&255}function F(t,e,i,n,r,o){if(i+n>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function z(t,e,i,n,r){return r||F(t,e,i,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(t,e,i,n,23,4),i+4}function W(t,e,i,n,r){return r||F(t,e,i,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(t,e,i,n,52,8),i+8}function X(t){if(t=U(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){e=e||1/0;for(var i,n=t.length,r=null,o=[],s=0;s<n;++s){if(i=t.charCodeAt(s),i>55295&&i<57344){if(!r){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}r=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),r=i;continue}i=(r-55296<<10|i-56320)+65536}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function G(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}function V(t,e){for(var i,n,r,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=t.charCodeAt(s),n=i>>8,r=i%256,o.push(r),o.push(n);return o}function q(t){return J.toByteArray(X(t))}function Z(t,e,i,n){for(var r=0;r<n&&!(r+i>=e.length||r>=t.length);++r)e[r+i]=t[r];return r}function K(t){return t!==t}var J=i(139),$=i(175),Q=i(53);e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),e.kMaxLength=r(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,i){return a(null,t,e,i)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,i){return l(null,t,e,i)},s.allocUnsafe=function(t){return u(null,t)},s.allocUnsafeSlow=function(t){return u(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,n=e.length,r=0,o=Math.min(i,n);r<o;++r)if(t[r]!==e[r]){i=t[r],n=e[r];break}return i<n?-1:n<i?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var n=s.allocUnsafe(e),r=0;for(i=0;i<t.length;++i){var o=t[i];if(!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,r),r+=o.length}return n},s.byteLength=m,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?j(this,0,t):b.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",i=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,e,i,n,r){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===n&&(n=0),void 0===r&&(r=this.length),e<0||i>t.length||n<0||r>this.length)throw new RangeError("out of range index");if(n>=r&&e>=i)return 0;if(n>=r)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,n>>>=0,r>>>=0,this===t)return 0;for(var o=r-n,a=i-e,c=Math.min(o,a),l=this.slice(n,r),u=t.slice(e,i),h=0;h<c;++h)if(l[h]!==u[h]){o=l[h],a=u[h];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,i){return this.indexOf(t,e,i)!==-1},s.prototype.indexOf=function(t,e,i){return _(this,t,e,i,!0)},s.prototype.lastIndexOf=function(t,e,i){return _(this,t,e,i,!1)},s.prototype.write=function(t,e,i,n){if(void 0===e)n="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)n=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===n&&(n="utf8")):(n=i,i=void 0)}var r=this.length-e;if((void 0===i||i>r)&&(i=r),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,i);case"utf8":case"utf-8":return S(this,t,e,i);case"ascii":return C(this,t,e,i);case"latin1":case"binary":return k(this,t,e,i);case"base64":return O(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;s.prototype.slice=function(t,e){var i=this.length;t=~~t,e=void 0===e?i:~~e,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),e<t&&(e=t);var n;if(s.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=s.prototype;else{var r=e-t;n=new s(r,void 0);for(var o=0;o<r;++o)n[o]=this[o+t]}return n},s.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||L(t,e,this.length);for(var n=this[t],r=1,o=0;++o<e&&(r*=256);)n+=this[t+o]*r;return n},s.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||L(t,e,this.length);for(var n=this[t+--e],r=1;e>0&&(r*=256);)n+=this[t+--e]*r;return n},s.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||L(t,e,this.length);for(var n=this[t],r=1,o=0;++o<e&&(r*=256);)n+=this[t+o]*r;return r*=128,n>=r&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||L(t,e,this.length);for(var n=e,r=1,o=this[t+--n];n>0&&(r*=256);)o+=this[t+--n]*r;return r*=128,o>=r&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},s.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},s.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},s.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),$.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),$.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),$.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),$.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,i,n){if(t=+t,e|=0,i|=0,!n){var r=Math.pow(2,8*i)-1;R(this,t,e,i,r,0)}var o=1,s=0;for(this[e]=255&t;++s<i&&(o*=256);)this[e+s]=t/o&255;return e+i},s.prototype.writeUIntBE=function(t,e,i,n){if(t=+t,e|=0,i|=0,!n){var r=Math.pow(2,8*i)-1;R(this,t,e,i,r,0)}var o=i-1,s=1;for(this[e+o]=255&t;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+i},s.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e|=0,!n){var r=Math.pow(2,8*i-1);R(this,t,e,i,r-1,-r)}var o=0,s=1,a=0;for(this[e]=255&t;++o<i&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},s.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e|=0,!n){var r=Math.pow(2,8*i-1);R(this,t,e,i,r-1,-r)}var o=i-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},s.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,i){return z(this,t,e,!0,i)},s.prototype.writeFloatBE=function(t,e,i){return z(this,t,e,!1,i)},s.prototype.writeDoubleLE=function(t,e,i){return W(this,t,e,!0,i)},s.prototype.writeDoubleBE=function(t,e,i){return W(this,t,e,!1,i)},s.prototype.copy=function(t,e,i,n){if(i||(i=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<i&&(n=i),n===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-i&&(n=t.length-e+i);var r,o=n-i;if(this===t&&i<e&&e<n)for(r=o-1;r>=0;--r)t[r+e]=this[r+i];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(r=0;r<o;++r)t[r+e]=this[r+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+o),e);return o},s.prototype.fill=function(t,e,i,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o<i;++o)this[o]=t;else{var a=s.isBuffer(t)?t:Y(new s(t,n).toString()),c=a.length;for(o=0;o<i-e;++o)this[o+e]=a[o%c]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(e,function(){return this}())},function(t,e,i){var n=i(27);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e,i){var n=i(28),r=i(47);t.exports=i(21)?function(t,e,i){return n.f(t,e,r(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){"use strict";function n(t){return this instanceof n?(l.call(this,t),u.call(this,t),t&&t.readable===!1&&(this.readable=!1),t&&t.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,t&&t.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",r)):new n(t)}function r(){this.allowHalfOpen||this._writableState.ended||s.nextTick(o,this)}function o(t){t.end()}var s=i(29),a=Object.keys||function(t){var e=[];for(var i in t)e.push(i);return e};t.exports=n;var c=i(23);c.inherits=i(11);var l=i(54),u=i(56);c.inherits(n,l);for(var h=a(u.prototype),f=0;f<h.length;f++){var d=h[f];n.prototype[d]||(n.prototype[d]=u.prototype[d])}Object.defineProperty(n.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(n.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),n.prototype._destroy=function(t,e){this.push(null),this.end(),s.nextTick(e,t)}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(39),a=n(s),c=a.default.create,l=a.default.types,u=function(){function t(e){r(this,t),this.name=e}return o(t,[{key:"getName",value:function(){return this.name}},{key:"start",value:function(){throw new Error(c(l.UN_IMPLEMENTATION,"start"))}},{key:"stop",value:function(){throw new Error(c(l.UN_IMPLEMENTATION,"stop"))}}]),t}();t.exports=u},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(4),a=n(s),c=i(185),l=n(c),u=["#000000","#2a2a2a","#545454","#7e7e7e","#a8a8a8","#d2d2d2","#ffffff","","#ff4040","#ff6518","#ffbb3b","#03bd9e","#00a9ff","#515ce6","#9e5fff","#ff5583"],h=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#7e7e7e",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";r(this,t);var o=e.getAttribute("title");this._show=!1,this._colorpickerElement=e,this._toggleDirection=n,this._makePickerButtonElement(e,i),this._makePickerLayerElement(e,o),this._color=i,this.picker=l.default.create({container:this.pickerElement,preset:u,color:i}),this._addEvent(e)}return o(t,[{key:"_changeColorElement",value:function(t){t?(this.colorElement.classList.remove("transparent"),this.colorElement.style.backgroundColor=t):(this.colorElement.style.backgroundColor="#fff",this.colorElement.classList.add("transparent"))}},{key:"_makePickerButtonElement",value:function(t,e){t.classList.add("tui-image-editor-button"),this.colorElement=document.createElement("div"),this.colorElement.className="color-picker-value",e?this.colorElement.style.backgroundColor=e:this.colorElement.classList.add("transparent")}},{key:"_makePickerLayerElement",value:function(t,e){var i=document.createElement("label"),n=document.createElement("div");this.pickerControl=document.createElement("div"),this.pickerControl.className="color-picker-control",this.pickerElement=document.createElement("div"),this.pickerElement.className="color-picker",i.innerHTML=e,n.className="triangle",this.pickerControl.appendChild(this.pickerElement),this.pickerControl.appendChild(n),t.appendChild(this.pickerControl),t.appendChild(this.colorElement),t.appendChild(i)}},{key:"_addEvent",value:function(t){var e=this;this.picker.on("selectColor",function(t){e._changeColorElement(t.color),e._color=t.color,e.fire("change",t.color)}),t.addEventListener("click",function(t){e._show=!e._show,e.pickerControl.style.display=e._show?"block":"none",e._setPickerControlPosition(),e.fire("changeShow",e),t.stopPropagation()}),document.body.addEventListener("click",function(){e.hide()})}},{key:"hide",value:function(){this._show=!1,this.pickerControl.style.display="none"}},{key:"_setPickerControlPosition",value:function(){var t=this.pickerControl.style,e=this._colorpickerElement.clientWidth/2+2,i=this.pickerControl.offsetWidth/2-e,n=(this.pickerControl.offsetHeight+10)*-1;"down"===this._toggleDirection&&(n=30),t.top=n+"px",t.left="-"+i+"px"}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._changeColorElement(t)}}]),t}();a.default.CustomEvents.mixin(h),e.default=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(4),a=n(s),c=i(5),l=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,t),this._value=i.value||0,this.rangeElement=e,this._drawRangeElement(),this.rangeWidth=(0,c.toInteger)(window.getComputedStyle(e,null).width)-12,this._min=i.min||0,this._max=i.max||100,this._absMax=this._min*-1+this._max,this.realTimeEvent=i.realTimeEvent||!1,this._addClickEvent(),this._addDragEvent(),this.value=i.value,this.trigger("change")}return o(t,[{key:"trigger",value:function(t){this.fire(t,this._value)}},{key:"_drawRangeElement",value:function(){this.rangeElement.classList.add("tui-image-editor-range"),this.bar=document.createElement("div"),this.bar.className="tui-image-editor-virtual-range-bar",this.subbar=document.createElement("div"),this.subbar.className="tui-image-editor-virtual-range-subbar",this.pointer=document.createElement("div"),this.pointer.className="tui-image-editor-virtual-range-pointer",this.bar.appendChild(this.subbar),this.bar.appendChild(this.pointer),this.rangeElement.appendChild(this.bar)}},{key:"_addClickEvent",value:function(){var t=this;this.rangeElement.addEventListener("click",function(e){if(e.stopPropagation(),"tui-image-editor-range"===e.target.className){var i=e.offsetX,n=i/t.rangeWidth,r=t._absMax*n+t._min;t.pointer.style.left=n*t.rangeWidth+"px",t.subbar.style.right=(1-n)*t.rangeWidth+"px",t._value=r,t.fire("change",r)}})}},{key:"_addDragEvent",value:function(){var t=this;this.pointer.addEventListener("mousedown",function(e){t.firstPosition=e.screenX,t.firstLeft=(0,c.toInteger)(t.pointer.style.left)||0,t.dragEventHandler={changeAngle:t._changeAngle.bind(t),stopChangingAngle:t._stopChangingAngle.bind(t)},document.addEventListener("mousemove",t.dragEventHandler.changeAngle),document.addEventListener("mouseup",t.dragEventHandler.stopChangingAngle)})}},{key:"_changeAngle",value:function(t){var e=t.screenX,i=e-this.firstPosition,n=this.firstLeft+i;n=n>this.rangeWidth?this.rangeWidth:n,n=n<0?0:n,this.pointer.style.left=n+"px",this.subbar.style.right=this.rangeWidth-n+"px";var r=n/this.rangeWidth,o=this._absMax*r+this._min;this._value=o,this.realTimeEvent&&this.fire("change",o)}},{key:"_stopChangingAngle",value:function(){this.fire("change",this._value),document.removeEventListener("mousemove",this.dragEventHandler.changeAngle),document.removeEventListener("mouseup",this.dragEventHandler.stopChangingAngle)}},{key:"max",set:function(t){this._max=t,this._absMax=this._min*-1+this._max,this.value=this._value},get:function(){return this._max}},{key:"value",get:function(){return this._value},set:function(t){var e=t-this._min,i=e*this.rangeWidth/this._absMax;this.rangeWidth<i&&(i=this.rangeWidth),this.pointer.style.left=i+"px",this.subbar.style.right=this.rangeWidth-i+"px",this._value=t}}]),t}();a.default.CustomEvents.mixin(l),e.default=l},function(t,e){var i=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=i)},function(t,e,i){t.exports=!i(43)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports={}},function(t,e,i){(function(t){function i(t){return Array.isArray?Array.isArray(t):"[object Array]"===v(t)}function n(t){return"boolean"==typeof t}function r(t){return null===t}function o(t){return null==t}function s(t){return"number"==typeof t}function a(t){return"string"==typeof t}function c(t){return"symbol"==typeof t}function l(t){return void 0===t}function u(t){return"[object RegExp]"===v(t)}function h(t){return"object"==typeof t&&null!==t}function f(t){return"[object Date]"===v(t)}function d(t){return"[object Error]"===v(t)||t instanceof Error}function p(t){return"function"==typeof t}function g(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function v(t){return Object.prototype.toString.call(t)}e.isArray=i,e.isBoolean=n,e.isNull=r,e.isNullOrUndefined=o,e.isNumber=s,e.isString=a,e.isSymbol=c,e.isUndefined=l,e.isRegExp=u,e.isObject=h,e.isDate=f,e.isError=d,e.isFunction=p,e.isPrimitive=g,e.isBuffer=t.isBuffer}).call(e,i(13).Buffer)},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e,i){var n=i(31);t.exports=function(t,e,i){if(n(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,r){return t.call(e,i,n,r)}}return function(){return t.apply(e,arguments)}}},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){var n=i(14),r=i(145),o=i(166),s=Object.defineProperty;e.f=i(21)?Object.defineProperty:function(t,e,i){if(n(t),e=o(e,!0),n(i),r)try{return s(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){(function(e){"use strict";function i(t,i,n,r){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,i)});case 3:return e.nextTick(function(){t.call(null,i,n)});case 4:return e.nextTick(function(){t.call(null,i,n,r)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick(function(){t.apply(null,o)})}}!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:i}:t.exports=e}).call(e,i(12))},function(t,e,i){function n(t,e){for(var i in t)e[i]=t[i]}function r(t,e,i){return s(t,e,i)}var o=i(13),s=o.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?t.exports=o:(n(o,e),e.Buffer=r),n(s,r),r.from=function(t,e,i){if("number"==typeof t)throw new TypeError("Argument must not be a number");return s(t,e,i)},r.alloc=function(t,e,i){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=s(t);return void 0!==e?"string"==typeof i?n.fill(e,i):n.fill(e):n.fill(0),n},r.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return s(t)},r.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o.SlowBuffer(t)}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");
return t}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on  "+t);return t}},function(t,e,i){var n=i(27),r=i(8).document,o=n(r)&&n(r.createElement);t.exports=function(t){return o?r.createElement(t):{}}},function(t,e,i){var n=i(28).f,r=i(26),o=i(7)("toStringTag");t.exports=function(t,e,i){t&&!r(t=i?t:t.prototype,o)&&n(t,o,{configurable:!0,value:e})}},function(t,e,i){var n=i(48)("keys"),r=i(51);t.exports=function(t){return n[t]||(n[t]=r(t))}},function(t,e){var i=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:i)(t)}},function(t,e,i){var n=i(147),r=i(32);t.exports=function(t){return n(r(t))}},function(t,e){},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(4),o=n(r),s=i(5),a=(0,s.keyMirror)("UN_IMPLEMENTATION","NO_COMPONENT_NAME"),c={UN_IMPLEMENTATION:"Should implement a method: ",NO_COMPONENT_NAME:"Should set a component name"},l={UN_IMPLEMENTATION:function(t){return c.UN_IMPLEMENTATION+t},NO_COMPONENT_NAME:function(){return c.NO_COMPONENT_NAME}};t.exports={types:o.default.extend({},a),create:function(t){t=t.toLowerCase();for(var e=l[t],i=arguments.length,n=Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}}},function(t,e,i){var n=i(24),r=i(7)("toStringTag"),o="Arguments"==n(function(){return arguments}()),s=function(t,e){try{return t[e]}catch(t){}};t.exports=function(t){var e,i,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=s(e=Object(t),r))?i:o?n(e):"Object"==(a=n(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,i){var n=i(8),r=i(20),o=i(25),s=i(15),a="prototype",c=function(t,e,i){var l,u,h,f=t&c.F,d=t&c.G,p=t&c.S,g=t&c.P,v=t&c.B,m=t&c.W,b=d?r:r[e]||(r[e]={}),y=b[a],_=d?n:p?n[e]:(n[e]||{})[a];d&&(i=e);for(l in i)u=!f&&_&&void 0!==_[l],u&&l in b||(h=u?_[l]:i[l],b[l]=d&&"function"!=typeof _[l]?i[l]:v&&u?o(h,n):m&&_[l]==h?function(t){var e=function(e,i,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,n)}return t.apply(this,arguments)};return e[a]=t[a],e}(h):g&&"function"==typeof h?o(Function.call,h):h,g&&((b.virtual||(b.virtual={}))[l]=h,t&c.R&&y&&!y[l]&&s(y,l,h)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,i){t.exports=i(8).document&&document.documentElement},function(t,e,i){"use strict";var n=i(46),r=i(42),o=i(160),s=i(15),a=i(26),c=i(22),l=i(150),u=i(34),h=i(156),f=i(7)("iterator"),d=!([].keys&&"next"in[].keys()),p="@@iterator",g="keys",v="values",m=function(){return this};t.exports=function(t,e,i,b,y,_,x){l(i,e,b);var w,S,C,k=function(t){if(!d&&t in j)return j[t];switch(t){case g:return function(){return new i(this,t)};case v:return function(){return new i(this,t)}}return function(){return new i(this,t)}},O=e+" Iterator",T=y==v,E=!1,j=t.prototype,M=j[f]||j[p]||y&&j[y],A=M||k(y),P=y?T?k("entries"):A:void 0,I="Array"==e?j.entries||M:M;if(I&&(C=h(I.call(new t)),C!==Object.prototype&&(u(C,O,!0),n||a(C,f)||s(C,f,m))),T&&M&&M.name!==v&&(E=!0,A=function(){return M.call(this)}),n&&!x||!d&&!E&&j[f]||s(j,f,A),c[e]=A,c[O]=m,y)if(w={values:T?A:k(v),keys:_?A:k(g),entries:P},x)for(S in w)S in j||o(j,S,w[S]);else r(r.P+r.F*(d||E),e,w);return w}},function(t,e){t.exports=!0},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){var n=i(8),r="__core-js_shared__",o=n[r]||(n[r]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e,i){var n,r,o,s=i(25),a=i(146),c=i(44),l=i(33),u=i(8),h=u.process,f=u.setImmediate,d=u.clearImmediate,p=u.MessageChannel,g=0,v={},m="onreadystatechange",b=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},y=function(t){b.call(t.data)};f&&d||(f=function(t){for(var e=[],i=1;arguments.length>i;)e.push(arguments[i++]);return v[++g]=function(){a("function"==typeof t?t:Function(t),e)},n(g),g},d=function(t){delete v[t]},"process"==i(24)(h)?n=function(t){h.nextTick(s(b,t,1))}:p?(r=new p,o=r.port2,r.port1.onmessage=y,n=s(o.postMessage,o,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(n=function(t){u.postMessage(t+"","*")},u.addEventListener("message",y,!1)):n=m in l("script")?function(t){c.appendChild(l("script"))[m]=function(){c.removeChild(this),b.call(t)}}:function(t){setTimeout(s(b,t,1),0)}),t.exports={set:f,clear:d}},function(t,e,i){var n=i(36),r=Math.min;t.exports=function(t){return t>0?r(n(t),9007199254740991):0}},function(t,e){var i=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+n).toString(36))}},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function r(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!r(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,i,r,a,c,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(i=this._events[t],s(i))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(o(i))for(a=Array.prototype.slice.call(arguments,1),l=i.slice(),r=l.length,c=0;c<r;c++)l[c].apply(this,a);return!0},i.prototype.addListener=function(t,e){var r;if(!n(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(r=s(this._maxListeners)?i.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){function i(){this.removeListener(t,i),r||(r=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var r=!1;return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var i,r,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=this._events[t],s=i.length,r=-1,i===e||n(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(i)){for(a=s;a-- >0;)if(i[a]===e||i[a].listener&&i[a].listener===e){r=a;break}if(r<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[t],n(i))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){(function(e,n){"use strict";function r(t){return B.from(t)}function o(t){return B.isBuffer(t)||t instanceof N}function s(t,e,i){return"function"==typeof t.prependListener?t.prependListener(e,i):void(t._events&&t._events[e]?D(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i))}function a(t,e){I=I||i(16),t=t||{};var n=e instanceof I;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;r||0===r?this.highWaterMark=r:n&&(o||0===o)?this.highWaterMark=o:this.highWaterMark=s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new U,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(X||(X=i(63).StringDecoder),this.decoder=new X(t.encoding),this.encoding=t.encoding)}function c(t){return I=I||i(16),this instanceof c?(this._readableState=new a(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),void R.call(this)):new c(t)}function l(t,e,i,n,o){var s=t._readableState;if(null===e)s.reading=!1,g(t,s);else{var a;o||(a=h(s,e)),a?t.emit("error",a):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===B.prototype||(e=r(e)),n?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):u(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!i?(e=s.decoder.write(e),s.objectMode||0!==e.length?u(t,s,e,!1):b(t,s)):u(t,s,e,!1))):n||(s.reading=!1)}return f(s)}function u(t,e,i,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",i),t.read(0)):(e.length+=e.objectMode?1:i.length,n?e.buffer.unshift(i):e.buffer.push(i),e.needReadable&&v(t)),b(t,e)}function h(t,e){var i;return o(e)||"string"==typeof e||void 0===e||t.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}function f(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}function d(t){return t>=G?t=G:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function p(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=d(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function g(t,e){if(!e.ended){if(e.decoder){var i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,v(t)}}function v(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(W("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?P.nextTick(m,t):m(t))}function m(t){W("emit readable"),t.emit("readable"),C(t)}function b(t,e){e.readingMore||(e.readingMore=!0,P.nextTick(y,t,e))}function y(t,e){for(var i=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(W("maybeReadMore read 0"),t.read(0),i!==e.length);)i=e.length;e.readingMore=!1}function _(t){return function(){var e=t._readableState;W("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&L(t,"data")&&(e.flowing=!0,C(t))}}function x(t){W("readable nexttick read 0"),t.read(0)}function w(t,e){e.resumeScheduled||(e.resumeScheduled=!0,P.nextTick(S,t,e))}function S(t,e){e.reading||(W("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(W("flow",e.flowing);e.flowing&&null!==t.read(););}function k(t,e){if(0===e.length)return null;var i;return e.objectMode?i=e.buffer.shift():!t||t>=e.length?(i=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):i=O(t,e.buffer,e.decoder),i}function O(t,e,i){var n;return t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():i?T(t,e):E(t,e),n}function T(t,e){var i=e.head,n=1,r=i.data;for(t-=r.length;i=i.next;){var o=i.data,s=t>o.length?o.length:t;if(r+=s===o.length?o:o.slice(0,t),t-=s,0===t){s===o.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=o.slice(s));break}++n}return e.length-=n,r}function E(t,e){var i=B.allocUnsafe(t),n=e.head,r=1;for(n.data.copy(i),t-=n.data.length;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(i,i.length-t,0,s),t-=s,0===t){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++r}return e.length-=r,i}function j(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,P.nextTick(M,e,t))}function M(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function A(t,e){for(var i=0,n=t.length;i<n;i++)if(t[i]===e)return i;return-1}var P=i(29);t.exports=c;var I,D=i(53);c.ReadableState=a;var L=(i(52).EventEmitter,function(t,e){return t.listeners(e).length}),R=i(58),B=i(30).Buffer,N=e.Uint8Array||function(){},F=i(23);F.inherits=i(11);var z=i(194),W=void 0;W=z&&z.debuglog?z.debuglog("stream"):function(){};var X,U=i(180),H=i(57);F.inherits(c,R);var Y=["error","close","destroy","pause","resume"];Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),c.prototype.destroy=H.destroy,c.prototype._undestroy=H.undestroy,c.prototype._destroy=function(t,e){this.push(null),e(t)},c.prototype.push=function(t,e){var i,n=this._readableState;return n.objectMode?i=!0:"string"==typeof t&&(e=e||n.defaultEncoding,e!==n.encoding&&(t=B.from(t,e),e=""),i=!0),l(this,t,e,!1,i)},c.prototype.unshift=function(t){return l(this,t,null,!0,!1)},c.prototype.isPaused=function(){return this._readableState.flowing===!1},c.prototype.setEncoding=function(t){return X||(X=i(63).StringDecoder),this._readableState.decoder=new X(t),this._readableState.encoding=t,this};var G=8388608;c.prototype.read=function(t){W("read",t),t=parseInt(t,10);var e=this._readableState,i=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return W("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?j(this):v(this),null;if(t=p(t,e),0===t&&e.ended)return 0===e.length&&j(this),null;var n=e.needReadable;W("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&(n=!0,W("length less than watermark",n)),e.ended||e.reading?(n=!1,W("reading or ended",n)):n&&(W("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=p(i,e)));var r;return r=t>0?k(t,e):null,null===r?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&j(this)),null!==r&&this.emit("data",r),r},c.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},c.prototype.pipe=function(t,e){function i(t,e){W("onunpipe"),t===f&&e&&e.hasUnpiped===!1&&(e.hasUnpiped=!0,o())}function r(){W("onend"),t.end()}function o(){W("cleanup"),t.removeListener("close",l),t.removeListener("finish",u),t.removeListener("drain",v),t.removeListener("error",c),t.removeListener("unpipe",i),f.removeListener("end",r),f.removeListener("end",h),f.removeListener("data",a),m=!0,!d.awaitDrain||t._writableState&&!t._writableState.needDrain||v()}function a(e){W("ondata"),b=!1;var i=t.write(e);!1!==i||b||((1===d.pipesCount&&d.pipes===t||d.pipesCount>1&&A(d.pipes,t)!==-1)&&!m&&(W("false write response, pause",f._readableState.awaitDrain),f._readableState.awaitDrain++,b=!0),f.pause())}function c(e){W("onerror",e),h(),t.removeListener("error",c),0===L(t,"error")&&t.emit("error",e)}function l(){t.removeListener("finish",u),h()}function u(){W("onfinish"),t.removeListener("close",l),h()}function h(){W("unpipe"),f.unpipe(t)}var f=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=t;break;case 1:d.pipes=[d.pipes,t];break;default:d.pipes.push(t)}d.pipesCount+=1,W("pipe count=%d opts=%j",d.pipesCount,e);var p=(!e||e.end!==!1)&&t!==n.stdout&&t!==n.stderr,g=p?r:h;d.endEmitted?P.nextTick(g):f.once("end",g),t.on("unpipe",i);var v=_(f);t.on("drain",v);var m=!1,b=!1;return f.on("data",a),s(t,"error",c),t.once("close",l),t.once("finish",u),t.emit("pipe",f),d.flowing||(W("pipe resume"),f.resume()),t},c.prototype.unpipe=function(t){var e=this._readableState,i={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,i),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<r;o++)n[o].emit("unpipe",this,i);return this}var s=A(e.pipes,t);return s===-1?this:(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,i),this)},c.prototype.on=function(t,e){var i=R.prototype.on.call(this,t,e);if("data"===t)this._readableState.flowing!==!1&&this.resume();else if("readable"===t){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&v(this):P.nextTick(x,this))}return i},c.prototype.addListener=c.prototype.on,c.prototype.resume=function(){var t=this._readableState;return t.flowing||(W("resume"),t.flowing=!0,w(this,t)),this},c.prototype.pause=function(){return W("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(W("pause"),this._readableState.flowing=!1,this.emit("pause")),this},c.prototype.wrap=function(t){var e=this,i=this._readableState,n=!1;t.on("end",function(){if(W("wrapped end"),i.decoder&&!i.ended){var t=i.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(r){if(W("wrapped data"),i.decoder&&(r=i.decoder.write(r)),(!i.objectMode||null!==r&&void 0!==r)&&(i.objectMode||r&&r.length)){var o=e.push(r);o||(n=!0,t.pause())}});for(var r in t)void 0===this[r]&&"function"==typeof t[r]&&(this[r]=function(e){return function(){return t[e].apply(t,arguments)}}(r));for(var o=0;o<Y.length;o++)t.on(Y[o],this.emit.bind(this,Y[o]));return this._read=function(e){W("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(c.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),c._fromList=k}).call(e,function(){return this}(),i(12))},function(t,e,i){"use strict";function n(t,e){var i=this._transformState;i.transforming=!1;var n=i.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,null!=e&&this.push(e),n(t);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function r(t){return this instanceof r?(a.call(this,t),this._transformState={afterTransform:n.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),void this.on("prefinish",o)):new r(t)}function o(){var t=this;"function"==typeof this._flush?this._flush(function(e,i){s(t,e,i)}):s(this,null,null)}function s(t,e,i){if(e)return t.emit("error",e);if(null!=i&&t.push(i),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}t.exports=r;var a=i(16),c=i(23);c.inherits=i(11),c.inherits(r,a),r.prototype.push=function(t,e){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,e)},r.prototype._transform=function(t,e,i){throw new Error("_transform() is not implemented")},r.prototype._write=function(t,e,i){var n=this._transformState;if(n.writecb=i,n.writechunk=t,n.writeencoding=e,!n.transforming){var r=this._readableState;(n.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},r.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},r.prototype._destroy=function(t,e){var i=this;a.prototype._destroy.call(this,t,function(t){e(t),i.emit("close")})}},function(t,e,i){(function(e,n,r){"use strict";function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){T(e,t)}}function s(t){return D.from(t)}function a(t){return D.isBuffer(t)||t instanceof L}function c(){}function l(t,e){j=j||i(16),t=t||{};var n=e instanceof j;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,s=t.writableHighWaterMark,a=this.objectMode?16:16384;r||0===r?this.highWaterMark=r:n&&(s||0===s)?this.highWaterMark=s:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=t.decodeStrings===!1;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){b(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function u(t){return j=j||i(16),B.call(u,this)||this instanceof j?(this._writableState=new l(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),void I.call(this)):new u(t)}function h(t,e){var i=new Error("write after end");t.emit("error",i),E.nextTick(e,i)}function f(t,e,i,n){var r=!0,o=!1;return null===i?o=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),E.nextTick(n,o),r=!1),r}function d(t,e,i){return t.objectMode||t.decodeStrings===!1||"string"!=typeof e||(e=D.from(e,i)),e}function p(t,e,i,n,r,o){if(!i){var s=d(e,n,r);n!==s&&(i=!0,r="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var c=e.length<e.highWaterMark;if(c||(e.needDrain=!0),e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:r,isBuf:i,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else g(t,e,!1,a,n,r,o);return c}function g(t,e,i,n,r,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,i?t._writev(r,e.onwrite):t._write(r,o,e.onwrite),e.sync=!1}function v(t,e,i,n,r){--e.pendingcb,i?(E.nextTick(r,n),E.nextTick(k,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(r(n),t._writableState.errorEmitted=!0,t.emit("error",n),k(t,e))}function m(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function b(t,e){var i=t._writableState,n=i.sync,r=i.writecb;if(m(i),e)v(t,i,n,e,r);else{var o=w(i);o||i.corked||i.bufferProcessing||!i.bufferedRequest||x(t,i),n?M(y,t,i,o,r):y(t,i,o,r)}}function y(t,e,i,n){i||_(t,e),e.pendingcb--,n(),k(t,e)}function _(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function x(t,e){e.bufferProcessing=!0;var i=e.bufferedRequest;if(t._writev&&i&&i.next){var n=e.bufferedRequestCount,r=new Array(n),s=e.corkedRequestsFree;s.entry=i;for(var a=0,c=!0;i;)r[a]=i,i.isBuf||(c=!1),i=i.next,a+=1;r.allBuffers=c,g(t,e,!0,e.length,r,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,u=i.encoding,h=i.callback,f=e.objectMode?1:l.length;if(g(t,e,!1,f,l,u,h),i=i.next,e.bufferedRequestCount--,e.writing)break}null===i&&(e.lastBufferedRequest=null)}e.bufferedRequest=i,e.bufferProcessing=!1}function w(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final(function(i){e.pendingcb--,i&&t.emit("error",i),e.prefinished=!0,t.emit("prefinish"),k(t,e)})}function C(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,E.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function k(t,e){var i=w(e);return i&&(C(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),i}function O(t,e,i){e.ending=!0,k(t,e),i&&(e.finished?E.nextTick(i):t.once("finish",i)),e.ended=!0,t.writable=!1}function T(t,e,i){var n=t.entry;for(t.entry=null;n;){var r=n.callback;e.pendingcb--,r(i),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}var E=i(29);t.exports=u;var j,M=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:E.nextTick;u.WritableState=l;var A=i(23);A.inherits=i(11);var P={deprecate:i(188)},I=i(58),D=i(30).Buffer,L=r.Uint8Array||function(){},R=i(57);A.inherits(u,I),l.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(l.prototype,"buffer",{get:P.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}();var B;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(B=Function.prototype[Symbol.hasInstance],Object.defineProperty(u,Symbol.hasInstance,{value:function(t){return!!B.call(this,t)||this===u&&(t&&t._writableState instanceof l)}})):B=function(t){return t instanceof this},u.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},u.prototype.write=function(t,e,i){var n=this._writableState,r=!1,o=!n.objectMode&&a(t);return o&&!D.isBuffer(t)&&(t=s(t)),"function"==typeof e&&(i=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof i&&(i=c),n.ended?h(this,i):(o||f(this,n,t,i))&&(n.pendingcb++,r=p(this,n,o,t,e,i)),r},u.prototype.cork=function(){var t=this._writableState;t.corked++},u.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||x(this,t))},u.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),u.prototype._write=function(t,e,i){i(new Error("_write() is not implemented"))},u.prototype._writev=null,u.prototype.end=function(t,e,i){var n=this._writableState;"function"==typeof t?(i=t,t=null,e=null):"function"==typeof e&&(i=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||O(this,n,i)},Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),u.prototype.destroy=R.destroy,u.prototype._undestroy=R.undestroy,u.prototype._destroy=function(t,e){this.end(),e(t)}}).call(e,i(12),i(183).setImmediate,function(){return this}())},function(t,e,i){"use strict";function n(t,e){var i=this,n=this._readableState&&this._readableState.destroyed,r=this._writableState&&this._writableState.destroyed;return n||r?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||s.nextTick(o,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(s.nextTick(o,i,t),i._writableState&&(i._writableState.errorEmitted=!0)):e&&e(t)}),this)}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(t,e){t.emit("error",e)}var s=i(29);t.exports={destroy:n,undestroy:r}},function(t,e,i){t.exports=i(52).EventEmitter},function(t,e,i){e=t.exports=i(54),e.Stream=e,e.Readable=e,e.Writable=i(56),e.Duplex=i(16),e.Transform=i(55),e.PassThrough=i(179)},function(t,e,i){(function(t){var n=i(182),r=i(62),o=i(190),s=i(140),a=i(64),c=e;c.request=function(e,i){e="string"==typeof e?a.parse(e):o(e);var r=t.location.protocol.search(/^https?:$/)===-1?"http:":"",s=e.protocol||r,c=e.hostname||e.host,l=e.port,u=e.path||"/";c&&c.indexOf(":")!==-1&&(c="["+c+"]"),e.url=(c?s+"//"+c:"")+(l?":"+l:"")+u,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var h=new n(e);return i&&h.on("response",i),h},c.get=function(t,e){var i=c.request(t,e);return i.end(),i},c.ClientRequest=n,c.IncomingMessage=r.IncomingMessage,c.Agent=function(){},c.Agent.defaultMaxSockets=4,c.globalAgent=new c.Agent,c.STATUS_CODES=s,c.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(e,function(){return this}())},function(t,e){(function(t){function i(){if(void 0!==o)return o;if(t.XMLHttpRequest){o=new t.XMLHttpRequest;try{o.open("GET",t.XDomainRequest?"/":"https://example.com")}catch(t){o=null}}else o=null;return o}function n(t){var e=i();if(!e)return!1;try{return e.responseType=t,e.responseType===t}catch(t){}return!1}function r(t){return"function"==typeof t}e.fetch=r(t.fetch)&&r(t.ReadableStream),e.writableStream=r(t.WritableStream),e.abortController=r(t.AbortController),e.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),e.blobConstructor=!0}catch(t){}var o,s="undefined"!=typeof t.ArrayBuffer,a=s&&r(t.ArrayBuffer.prototype.slice);e.arraybuffer=e.fetch||s&&n("arraybuffer"),e.msstream=!e.fetch&&a&&n("ms-stream"),e.mozchunkedarraybuffer=!e.fetch&&s&&n("moz-chunked-arraybuffer"),e.overrideMimeType=e.fetch||!!i()&&r(i().overrideMimeType),e.vbArray=r(t.VBArray),o=null}).call(e,function(){return this}())},function(t,e,i){(function(t,n,r){var o=i(61),s=i(11),a=i(59),c=e.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=e.IncomingMessage=function(e,i,s,c){function l(){f.read().then(function(t){if(!u._destroyed){if(t.done)return r.clearTimeout(c),void u.push(null);u.push(new n(t.value)),l()}}).catch(function(t){r.clearTimeout(c),u._destroyed||u.emit("error",t)})}var u=this;if(a.Readable.call(u),u._mode=s,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",function(){t.nextTick(function(){u.emit("close")})}),"fetch"===s){if(u._fetchResponse=i,u.url=i.url,u.statusCode=i.status,u.statusMessage=i.statusText,i.headers.forEach(function(t,e){u.headers[e.toLowerCase()]=t,u.rawHeaders.push(e,t)}),o.writableStream){var h=new WritableStream({
write:function(t){return new Promise(function(e,i){u._destroyed?i():u.push(new n(t))?e():u._resumeFetch=e})},close:function(){r.clearTimeout(c),u._destroyed||u.push(null)},abort:function(t){u._destroyed||u.emit("error",t)}});try{return void i.body.pipeTo(h).catch(function(t){r.clearTimeout(c),u._destroyed||u.emit("error",t)})}catch(t){}}var f=i.body.getReader();l()}else{u._xhr=e,u._pos=0,u.url=e.responseURL,u.statusCode=e.status,u.statusMessage=e.statusText;var d=e.getAllResponseHeaders().split(/\r?\n/);if(d.forEach(function(t){var e=t.match(/^([^:]+):\s*(.*)/);if(e){var i=e[1].toLowerCase();"set-cookie"===i?(void 0===u.headers[i]&&(u.headers[i]=[]),u.headers[i].push(e[2])):void 0!==u.headers[i]?u.headers[i]+=", "+e[2]:u.headers[i]=e[2],u.rawHeaders.push(e[1],e[2])}}),u._charset="x-user-defined",!o.overrideMimeType){var p=u.rawHeaders["mime-type"];if(p){var g=p.match(/;\s*charset=([^;])(;|$)/);g&&(u._charset=g[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};s(l,a.Readable),l.prototype._read=function(){var t=this,e=t._resumeFetch;e&&(t._resumeFetch=null,e())},l.prototype._onXHRProgress=function(){var t=this,e=t._xhr,i=null;switch(t._mode){case"text:vbarray":if(e.readyState!==c.DONE)break;try{i=new r.VBArray(e.responseBody).toArray()}catch(t){}if(null!==i){t.push(new n(i));break}case"text":try{i=e.responseText}catch(e){t._mode="text:vbarray";break}if(i.length>t._pos){var o=i.substr(t._pos);if("x-user-defined"===t._charset){for(var s=new n(o.length),a=0;a<o.length;a++)s[a]=255&o.charCodeAt(a);t.push(s)}else t.push(o,t._charset);t._pos=i.length}break;case"arraybuffer":if(e.readyState!==c.DONE||!e.response)break;i=e.response,t.push(new n(new Uint8Array(i)));break;case"moz-chunked-arraybuffer":if(i=e.response,e.readyState!==c.LOADING||!i)break;t.push(new n(new Uint8Array(i)));break;case"ms-stream":if(i=e.response,e.readyState!==c.LOADING)break;var l=new r.MSStreamReader;l.onprogress=function(){l.result.byteLength>t._pos&&(t.push(new n(new Uint8Array(l.result.slice(t._pos)))),t._pos=l.result.byteLength)},l.onload=function(){t.push(null)},l.readAsArrayBuffer(i)}t._xhr.readyState===c.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(e,i(12),i(13).Buffer,function(){return this}())},function(t,e,i){"use strict";function n(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function r(t){var e=n(t);if("string"!=typeof e&&(b.isEncoding===y||!y(t)))throw new Error("Unknown encoding: "+t);return e||t}function o(t){this.encoding=r(t);var e;switch(this.encoding){case"utf16le":this.text=f,this.end=d,e=4;break;case"utf8":this.fillLast=l,e=4;break;case"base64":this.text=p,this.end=g,e=3;break;default:return this.write=v,void(this.end=m)}this.lastNeed=0,this.lastTotal=0,this.lastChar=b.allocUnsafe(e)}function s(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function a(t,e,i){var n=e.length-1;if(n<i)return 0;var r=s(e[n]);return r>=0?(r>0&&(t.lastNeed=r-1),r):--n<i||r===-2?0:(r=s(e[n]),r>=0?(r>0&&(t.lastNeed=r-2),r):--n<i||r===-2?0:(r=s(e[n]),r>=0?(r>0&&(2===r?r=0:t.lastNeed=r-3),r):0))}function c(t,e,i){if(128!==(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!==(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!==(192&e[2]))return t.lastNeed=2,"�"}}function l(t){var e=this.lastTotal-this.lastNeed,i=c(this,t,e);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){var i=a(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var n=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function f(t,e){if((t.length-e)%2===0){var i=t.toString("utf16le",e);if(i){var n=i.charCodeAt(i.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function d(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}function p(t,e){var i=(t.length-e)%3;return 0===i?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}function g(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function v(t){return t.toString(this.encoding)}function m(t){return t&&t.length?this.write(t):""}var b=i(30).Buffer,y=b.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,i;if(this.lastNeed){if(e=this.fillLast(t),void 0===e)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?e?e+this.text(t,i):this.text(t,i):e||""},o.prototype.end=h,o.prototype.text=u,o.prototype.fillLast=function(t){return this.lastNeed<=t.length?(t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),void(this.lastNeed-=t.length))}},function(t,e,i){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function r(t,e,i){if(t&&l.isObject(t)&&t instanceof n)return t;var r=new n;return r.parse(t,e,i),r}function o(t){return l.isString(t)&&(t=r(t)),t instanceof n?t.format():n.prototype.format.call(t)}function s(t,e){return r(t,!1,!0).resolve(e)}function a(t,e){return t?r(t,!1,!0).resolveObject(e):e}var c=i(186),l=i(187);e.parse=r,e.resolve=s,e.resolveObject=a,e.format=o,e.Url=n;var u=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),g=["'"].concat(p),v=["%","/","?",";","#"].concat(g),m=["/","?","#"],b=255,y=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,x={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},S={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},C=i(178);n.prototype.parse=function(t,e,i){if(!l.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),r=n!==-1&&n<t.indexOf("#")?"?":"#",o=t.split(r),s=/\\/g;o[0]=o[0].replace(s,"/"),t=o.join(r);var a=t;if(a=a.trim(),!i&&1===t.split("#").length){var h=f.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],e?this.query=C.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var d=u.exec(a);if(d){d=d[0];var p=d.toLowerCase();this.protocol=p,a=a.substr(d.length)}if(i||d||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===a.substr(0,2);!k||d&&w[d]||(a=a.substr(2),this.slashes=!0)}if(!w[d]&&(k||d&&!S[d])){for(var O=-1,T=0;T<m.length;T++){var E=a.indexOf(m[T]);E!==-1&&(O===-1||E<O)&&(O=E)}var j,M;M=O===-1?a.lastIndexOf("@"):a.lastIndexOf("@",O),M!==-1&&(j=a.slice(0,M),a=a.slice(M+1),this.auth=decodeURIComponent(j)),O=-1;for(var T=0;T<v.length;T++){var E=a.indexOf(v[T]);E!==-1&&(O===-1||E<O)&&(O=E)}O===-1&&(O=a.length),this.host=a.slice(0,O),a=a.slice(O),this.parseHost(),this.hostname=this.hostname||"";var A="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!A)for(var P=this.hostname.split(/\./),T=0,I=P.length;T<I;T++){var D=P[T];if(D&&!D.match(y)){for(var L="",R=0,B=D.length;R<B;R++)L+=D.charCodeAt(R)>127?"x":D[R];if(!L.match(y)){var N=P.slice(0,T),F=P.slice(T+1),z=D.match(_);z&&(N.push(z[1]),F.unshift(z[2])),F.length&&(a="/"+F.join(".")+a),this.hostname=N.join(".");break}}}this.hostname.length>b?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=c.toASCII(this.hostname));var W=this.port?":"+this.port:"",X=this.hostname||"";this.host=X+W,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!x[p])for(var T=0,I=g.length;T<I;T++){var U=g[T];if(a.indexOf(U)!==-1){var H=encodeURIComponent(U);H===U&&(H=escape(U)),a=a.split(U).join(H)}}var Y=a.indexOf("#");Y!==-1&&(this.hash=a.substr(Y),a=a.slice(0,Y));var G=a.indexOf("?");if(G!==-1?(this.search=a.substr(G),this.query=a.substr(G+1),e&&(this.query=C.parse(this.query)),a=a.slice(0,G)):e&&(this.search="",this.query={}),a&&(this.pathname=a),S[p]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var W=this.pathname||"",V=this.search||"";this.path=W+V}return this.href=this.format(),this},n.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",i=this.pathname||"",n=this.hash||"",r=!1,o="";this.host?r=t+this.host:this.hostname&&(r=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&l.isObject(this.query)&&Object.keys(this.query).length&&(o=C.stringify(this.query));var s=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||S[e])&&r!==!1?(r="//"+(r||""),i&&"/"!==i.charAt(0)&&(i="/"+i)):r||(r=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),i=i.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),s=s.replace("#","%23"),e+r+i+s+n},n.prototype.resolve=function(t){return this.resolveObject(r(t,!1,!0)).format()},n.prototype.resolveObject=function(t){if(l.isString(t)){var e=new n;e.parse(t,!1,!0),t=e}for(var i=new n,r=Object.keys(this),o=0;o<r.length;o++){var s=r[o];i[s]=this[s]}if(i.hash=t.hash,""===t.href)return i.href=i.format(),i;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),c=0;c<a.length;c++){var u=a[c];"protocol"!==u&&(i[u]=t[u])}return S[i.protocol]&&i.hostname&&!i.pathname&&(i.path=i.pathname="/"),i.href=i.format(),i}if(t.protocol&&t.protocol!==i.protocol){if(!S[t.protocol]){for(var h=Object.keys(t),f=0;f<h.length;f++){var d=h[f];i[d]=t[d]}return i.href=i.format(),i}if(i.protocol=t.protocol,t.host||w[t.protocol])i.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),i.pathname=p.join("/")}if(i.search=t.search,i.query=t.query,i.host=t.host||"",i.auth=t.auth,i.hostname=t.hostname||t.host,i.port=t.port,i.pathname||i.search){var g=i.pathname||"",v=i.search||"";i.path=g+v}return i.slashes=i.slashes||t.slashes,i.href=i.format(),i}var m=i.pathname&&"/"===i.pathname.charAt(0),b=t.host||t.pathname&&"/"===t.pathname.charAt(0),y=b||m||i.host&&t.pathname,_=y,x=i.pathname&&i.pathname.split("/")||[],p=t.pathname&&t.pathname.split("/")||[],C=i.protocol&&!S[i.protocol];if(C&&(i.hostname="",i.port=null,i.host&&(""===x[0]?x[0]=i.host:x.unshift(i.host)),i.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),y=y&&(""===p[0]||""===x[0])),b)i.host=t.host||""===t.host?t.host:i.host,i.hostname=t.hostname||""===t.hostname?t.hostname:i.hostname,i.search=t.search,i.query=t.query,x=p;else if(p.length)x||(x=[]),x.pop(),x=x.concat(p),i.search=t.search,i.query=t.query;else if(!l.isNullOrUndefined(t.search)){if(C){i.hostname=i.host=x.shift();var k=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");k&&(i.auth=k.shift(),i.host=i.hostname=k.shift())}return i.search=t.search,i.query=t.query,l.isNull(i.pathname)&&l.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!x.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var O=x.slice(-1)[0],T=(i.host||t.host||x.length>1)&&("."===O||".."===O)||""===O,E=0,j=x.length;j>=0;j--)O=x[j],"."===O?x.splice(j,1):".."===O?(x.splice(j,1),E++):E&&(x.splice(j,1),E--);if(!y&&!_)for(;E--;E)x.unshift("..");!y||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),T&&"/"!==x.join("/").substr(-1)&&x.push("");var M=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(C){i.hostname=i.host=M?"":x.length?x.shift():"";var k=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");k&&(i.auth=k.shift(),i.host=i.hostname=k.shift())}return y=y||i.host&&x.length,y&&!M&&x.unshift(""),x.length?i.pathname=x.join("/"):(i.pathname=null,i.path=null),l.isNull(i.pathname)&&l.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=t.auth||i.auth,i.slashes=i.slashes||t.slashes,i.href=i.format(),i},n.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=i(4),o=i(5),s=n(o),a=i(109),c=n(a);e.default={getActions:function(){return{main:this._mainAction(),shape:this._shapeAction(),crop:this._cropAction(),flip:this._flipAction(),rotate:this._rotateAction(),text:this._textAction(),mask:this._maskAction(),draw:this._drawAction(),icon:this._iconAction(),filter:this._filterAction()}},_mainAction:function(){var t=this,e=function(){"crop"===t.ui.submenu&&(t.stopDrawingMode(),t.ui.changeMenu("crop"))};return(0,r.extend)({initLoadImage:function(i,n){return t.loadImageFromURL(i,n).then(function(n){e(),t.ui.initializeImgUrl=i,t.ui.resizeEditor({imageSize:n}),t.clearUndoStack()})},undo:function(){t.isEmptyUndoStack()||(e(),t.undo())},redo:function(){t.isEmptyRedoStack()||(e(),t.redo())},reset:function(){e(),t.loadImageFromURL(t.ui.initializeImgUrl,"resetImage").then(function(i){e(),t.ui.resizeEditor({imageSize:i}),t.clearUndoStack()})},delete:function(){t.ui.changeDeleteButtonEnabled(!1),e(),t.removeActiveObject(),t.activeObjectId=null},deleteAll:function(){e(),t.clearObjects(),t.ui.changeDeleteButtonEnabled(!1),t.ui.changeDeleteAllButtonEnabled(!1)},load:function(i){s.default.isSupportFileApi()||alert("This browser does not support file-api"),t.ui.initializeImgUrl=URL.createObjectURL(i),t.loadImageFromFile(i).then(function(){e(),t.clearUndoStack(),t.ui.resizeEditor()}).catch(function(t){return Promise.reject(t)})},download:function(){var e=t.toDataURL(),i=t.getImageName(),n=void 0,r=void 0,o=void 0;s.default.isSupportFileApi()&&window.saveAs?(n=s.default.base64ToBlob(e),r=n.type.split("/")[1],i.split(".").pop()!==r&&(i+="."+r),saveAs(n,i)):(o=window.open(),o.document.body.innerHTML="<img src='"+e+"'>")}},this._commonAction())},_iconAction:function(){var t=this,e=void 0,i=void 0,n=void 0,o=void 0,s=void 0,a=void 0,l=void 0;this.on({iconCreateResize:function(e){var i=e.moveOriginPointer,r=(i.x-n)/s,c=(i.y-o)/a;t.setObjectPropertiesQuietly(l,{scaleX:Math.abs(2*r),scaleY:Math.abs(2*c)})},iconCreateEnd:function(){t.ui.icon.clearIconType(),t.changeSelectableAll(!0)}});var u=function(r,c){n=c.x,o=c.y,t.addIcon(e,{left:c.x,top:c.y,fill:i}).then(function(t){l=t.id,s=t.width,a=t.height})};return(0,r.extend)({changeColor:function(e){t.activeObjectId&&t.changeIconColor(t.activeObjectId,e)},addIcon:function(n,r){e=n,i=r,t.changeCursor("crosshair"),t.off("mousedown"),t.once("mousedown",u.bind(t))},cancelAddIcon:function(){t.off("mousedown"),t.ui.icon.clearIconType(),t.changeSelectableAll(!0),t.changeCursor("default")},registDefalutIcons:function(e,i){var n={};n[e]=i,t.registerIcons(n)},registCustomIcon:function(e,i){var n=new c.default;n.imageToSVG(e,function(e){var n=e.match(/path[^>]*d="([^"]*)"/),r=n[1],o={};o[i.name]=r,t.registerIcons(o),t.addIcon(i.name,{left:100,top:100})},c.default.tracerDefaultOption())}},this._commonAction())},_drawAction:function(){var t=this;return(0,r.extend)({setDrawMode:function(e,i){t.stopDrawingMode(),"free"===e?t.startDrawingMode("FREE_DRAWING",i):t.startDrawingMode("LINE_DRAWING",i)},setColor:function(e){t.setBrush({color:e})}},this._commonAction())},_maskAction:function(){var t=this;return(0,r.extend)({loadImageFromURL:function(e,i){return t.loadImageFromURL(t.toDataURL(),"FilterImage").then(function(){t.addImageObject(e).then(function(){URL.revokeObjectURL(i)})})},applyFilter:function(){t.applyFilter("mask",{maskObjId:t.activeObjectId})}},this._commonAction())},_textAction:function(){var t=this;return(0,r.extend)({changeTextStyle:function(e){t.activeObjectId&&t.changeTextStyle(t.activeObjectId,e)}},this._commonAction())},_rotateAction:function(){var t=this;return(0,r.extend)({rotate:function(e){t.rotate(e),t.ui.resizeEditor()},setAngle:function(e){t.setAngle(e),t.ui.resizeEditor()}},this._commonAction())},_shapeAction:function(){var t=this;return(0,r.extend)({changeShape:function(e){t.activeObjectId&&t.changeShape(t.activeObjectId,e)},setDrawingShape:function(e){t.setDrawingShape(e)}},this._commonAction())},_cropAction:function(){var t=this;return(0,r.extend)({crop:function(){var e=t.getCropzoneRect();e&&t.crop(e).then(function(){t.stopDrawingMode(),t.ui.resizeEditor(),t.ui.changeMenu("crop")}).catch(function(t){return Promise.reject(t)})},cancel:function(){t.stopDrawingMode(),t.ui.changeMenu("crop")}},this._commonAction())},_flipAction:function(){var t=this;return(0,r.extend)({flip:function(e){return t[e]()}},this._commonAction())},_filterAction:function(){var t=this;return(0,r.extend)({applyFilter:function(e,i,n){e?t.applyFilter(i,n):t.hasFilter(i)&&t.removeFilter(i)}},this._commonAction())},setReAction:function(){var t=this;this.on({undoStackChanged:function(e){e?(t.ui.changeUndoButtonStatus(!0),t.ui.changeResetButtonStatus(!0)):(t.ui.changeUndoButtonStatus(!1),t.ui.changeResetButtonStatus(!1)),t.ui.resizeEditor()},redoStackChanged:function(e){e?t.ui.changeRedoButtonStatus(!0):t.ui.changeRedoButtonStatus(!1),t.ui.resizeEditor()},objectActivated:function(e){t.activeObjectId=e.id,t.ui.changeDeleteButtonEnabled(!0),t.ui.changeDeleteAllButtonEnabled(!0),"cropzone"===e.type?t.ui.crop.changeApplyButtonStatus(!0):["rect","circle","triangle"].indexOf(e.type)>-1?(t.stopDrawingMode(),"shape"!==t.ui.submenu&&t.ui.changeMenu("shape",!1,!1),t.ui.shape.setShapeStatus({strokeColor:e.stroke,strokeWidth:e.strokeWidth,fillColor:e.fill}),t.ui.shape.setMaxStrokeValue(Math.min(e.width,e.height))):"path"===e.type||"line"===e.type?"draw"!==t.ui.submenu&&(t.ui.changeMenu("draw",!1,!1),t.ui.draw.changeStandbyMode()):["i-text","text"].indexOf(e.type)>-1?"text"!==t.ui.submenu&&t.ui.changeMenu("text",!1,!1):"icon"===e.type&&(t.stopDrawingMode(),"icon"!==t.ui.submenu&&t.ui.changeMenu("icon",!1,!1),t.ui.icon.setIconPickerColor(e.fill))},addText:function(e){t.addText("Double Click",{position:e.originPosition,styles:{fill:t.ui.text.textColor,fontSize:s.default.toInteger(t.ui.text.fontSize),fontFamily:"Noto Sans"}}).then(function(){t.changeCursor("default")})},addObjectAfter:function(e){["rect","circle","triangle"].indexOf(e.type)>-1&&(t.ui.shape.setMaxStrokeValue(Math.min(e.width,e.height)),t.ui.shape.changeStandbyMode())},objectScaled:function(e){if(["i-text","text"].indexOf(e.type)>-1)t.ui.text.fontSize=s.default.toInteger(e.fontSize);else if(["rect","circle","triangle"].indexOf(e.type)>=0){var i=e.width,n=e.height,r=t.ui.shape.getStrokeValue();i<r&&t.ui.shape.setStrokeValue(i),n<r&&t.ui.shape.setStrokeValue(n)}},selectionCleared:function(){t.activeObjectId=null,"text"===t.ui.submenu?t.changeCursor("text"):"draw"!==t.ui.submenu&&"crop"!==t.ui.submenu&&t.stopDrawingMode()}})},_commonAction:function(){var t=this;return{modeChange:function(e){switch(e){case"text":t._changeActivateMode("TEXT");break;case"crop":t.startDrawingMode("CROPPER");break;case"shape":t._changeActivateMode("SHAPE"),t.setDrawingShape(t.ui.shape.type,t.ui.shape.options)}},deactivateAll:this.deactivateAll.bind(this),changeSelectableAll:this.changeSelectableAll.bind(this),discardSelection:this.discardSelection.bind(this),stopDrawingMode:this.stopDrawingMode.bind(this)}},mixin:function(t){(0,r.extend)(t.prototype,this)}}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.componentNames,h=l.default.commandNames,f=u.ICON,d={name:h.ADD_ICON,execute:function(t,e,i){var n=this,r=t.getComponent(f);return r.add(e,i).then(function(e){return n.undoData.object=t.getObject(e.id),e})},undo:function(t){return t.remove(this.undoData.object),a.default.resolve()}};o.default.register(d),t.exports=d},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.commandNames,h={name:u.ADD_IMAGE_OBJECT,execute:function(t,e){var i=this;return t.addImageObject(e).then(function(e){return i.undoData.object=t.getObject(e.id),e})},undo:function(t){return t.remove(this.undoData.object),a.default.resolve()}};o.default.register(h),t.exports=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.commandNames,h=l.default.rejectMessages,f={name:u.ADD_OBJECT,execute:function(t,e){return new a.default(function(i,n){t.contains(e)?n(h.addedObject):(t.add(e),i(e))})},undo:function(t,e){return new a.default(function(i,n){t.contains(e)?(t.remove(e),i(e)):n(h.noObject)})}};o.default.register(f),t.exports=f},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.componentNames,h=l.default.commandNames,f=u.SHAPE,d={name:h.ADD_SHAPE,execute:function(t,e,i){var n=this,r=t.getComponent(f);return r.add(e,i).then(function(e){return n.undoData.object=t.getObject(e.id),e})},undo:function(t){return t.remove(this.undoData.object),a.default.resolve()}};o.default.register(d),t.exports=d},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.componentNames,h=l.default.commandNames,f=u.TEXT,d={name:h.ADD_TEXT,execute:function(t,e,i){var n=this,r=t.getComponent(f);return r.add(e,i).then(function(e){return n.undoData.object=t.getObject(e.id),e})},undo:function(t){return t.remove(this.undoData.object),a.default.resolve()}};o.default.register(d),t.exports=d},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.componentNames,h=l.default.commandNames,f=u.TEXT,d={name:h.ADD_TEXTS,execute:function(t,e){var i=this,n=t.getComponent(f),r=[],o=null,s=null;this.undoData.objectArray=[];for(var c=0;c<e.length;c+=1)o=e[c],s=n.add(o.text,o.options).then(function(e){return i.undoData.objectArray.push(t.getObject(e.id)),e}),r.push(s);return a.default.all(r).then(function(t){return t})},undo:function(t){for(var e=0;e<this.undoData.objectArray.length;e+=1)t.remove(this.undoData.objectArray[e]);return a.default.resolve()}};o.default.register(d),t.exports=d},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(1),a=n(s),c=a.default.componentNames,l=a.default.rejectMessages,u=a.default.commandNames,h=c.FILTER,f={name:u.APPLY_FILTER,execute:function(t,e,i){var n=t.getComponent(h);if("mask"===e){var r=t.getObject(i.maskObjId);if(!r||!r.isType("image"))return Promise.reject(l.invalidParameters);i={mask:r}}return"mask"===e?(this.undoData.object=i.mask,t.remove(i.mask)):this.undoData.options=n.getOptions(e),n.add(e,i)},undo:function(t,e){var i=t.getComponent(h);if("mask"===e){var n=this.undoData.object;return t.add(n),t.setActiveObject(n),i.remove(e)}return this.undoData.options?i.add(e,this.undoData.options):i.remove(e)}};o.default.register(f),t.exports=f},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.componentNames,h=l.default.rejectMessages,f=l.default.commandNames,d=u.ICON,p={name:f.CHANGE_ICON_COLOR,execute:function(t,e,i){var n=this;return new a.default(function(r,o){var s=t.getComponent(d),a=t.getObject(e);a||o(h.noObject),n.undoData.object=a,n.undoData.color=s.getColor(a),s.setColor(i,a),r()})},undo:function(t){var e=t.getComponent(d),i=this.undoData.object,n=i.object,r=i.color;return e.setColor(r,n),a.default.resolve()}};o.default.register(p),t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(4),o=n(r),s=i(3),a=n(s),c=i(2),l=n(c),u=i(1),h=n(u),f=h.default.componentNames,d=h.default.rejectMessages,p=h.default.commandNames,g=f.SHAPE,v={name:p.CHANGE_SHAPE,execute:function(t,e,i){var n=this,r=t.getComponent(g),s=t.getObject(e);return s?(this.undoData.object=s,this.undoData.options={},o.default.forEachOwnProperties(i,function(t,e){n.undoData.options[e]=s[e]}),r.change(s,i)):l.default.reject(d.noObject)},undo:function(t){var e=t.getComponent(g),i=this.undoData,n=i.object,r=i.options;return e.change(n,r)}};a.default.register(v),t.exports=v},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.componentNames,h=l.default.rejectMessages,f=l.default.commandNames,d=u.TEXT,p={name:f.CHANGE_TEXT,execute:function(t,e,i){var n=t.getComponent(d),r=t.getObject(e);return r?(this.undoData.object=r,this.undoData.text=n.getText(r),n.change(r,i)):a.default.reject(h.noObject)},undo:function(t){var e=t.getComponent(d),i=this.undoData,n=i.object,r=i.text;return e.change(n,r)}};o.default.register(p),t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(4),o=n(r),s=i(3),a=n(s),c=i(2),l=n(c),u=i(1),h=n(u),f=h.default.componentNames,d=h.default.rejectMessages,p=h.default.commandNames,g=f.TEXT,v={name:p.CHANGE_TEXT_STYLE,execute:function(t,e,i,n){var r=this,s=t.getComponent(g),a=t.getObject(e);return n="undefined"!=typeof n&&n,a?(this.undoData.object=a,this.undoData.styles={},this.undoData.notReset=n,o.default.forEachOwnProperties(i,function(t,e){r.undoData.styles[e]=a[e]}),s.setStyle(a,i,n)):l.default.reject(d.noObject)},undo:function(t){var e=t.getComponent(g),i=this.undoData,n=i.object,r=i.styles,o=i.notReset;return e.setStyle(n,r,o)}};a.default.register(v),t.exports=v},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.commandNames,h={name:u.CLEAR_OBJECTS,execute:function(t){var e=this;return new a.default(function(i){e.undoData.objects=t.removeAll(),i()})},undo:function(t){return t.add(this.undoData.objects),a.default.resolve()}};o.default.register(h),t.exports=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(1),a=n(s),c=a.default.componentNames,l=a.default.commandNames,u=c.FLIP,h={name:l.FLIP_IMAGE,execute:function(t,e){var i=t.getComponent(u);return this.undoData.setting=i.getCurrentSetting(),i[e]()},undo:function(t){var e=t.getComponent(u);return e.set(this.undoData.setting)}};o.default.register(h),t.exports=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(1),a=n(s),c=a.default.componentNames,l=a.default.commandNames,u=c.IMAGE_LOADER,h={name:l.LOAD_IMAGE,execute:function(t,e,i){var n=t.getComponent(u),r=n.getCanvasImage(),o=r?r.width:0,s=r?r.height:0;return this.undoData={name:n.getImageName(),image:r,objects:t.removeAll(!0)},n.load(e,i).then(function(t){return{oldWidth:o,oldHeight:s,newWidth:t.width,newHeight:t.height}})},undo:function(t){var e=t.getComponent(u),i=this.undoData,n=i.objects,r=i.name,o=i.image;return t.removeAll(!0),t.add(n),e.load(r,o)}};o.default.register(h),t.exports=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(1),a=n(s),c=a.default.componentNames,l=a.default.commandNames,u=c.FILTER,h={name:l.REMOVE_FILTER,execute:function(t,e){var i=t.getComponent(u);return this.undoData.options=i.getOptions(e),i.remove(e)},undo:function(t,e){var i=t.getComponent(u),n=this.undoData.options;return i.add(e,n)}};o.default.register(h),t.exports=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.commandNames,h=l.default.rejectMessages,f={name:u.REMOVE_OBJECT,execute:function(t,e){var i=this;return new a.default(function(n,r){i.undoData.objects=t.removeObjectById(e),i.undoData.objects.length?n():r(h.noObject)})},undo:function(t){return t.add(this.undoData.objects),a.default.resolve()}};o.default.register(f),t.exports=f},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.commandNames,h={name:u.RESIZE_CANVAS_DIMENSION,execute:function(t,e){var i=this;return new a.default(function(n){i.undoData.size={width:t.cssMaxWidth,height:t.cssMaxHeight},t.setCssMaxDimension(e),t.adjustCanvasDimension(),n()})},undo:function(t){return t.setCssMaxDimension(this.undoData.size),t.adjustCanvasDimension(),a.default.resolve()}};o.default.register(h),t.exports=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(1),a=n(s),c=a.default.componentNames,l=a.default.commandNames,u=c.ROTATION,h={name:l.ROTATE_IMAGE,execute:function(t,e,i){var n=t.getComponent(u);return this.undoData.angle=n.getCurrentAngle(),n[e](i)},undo:function(t){var e=t.getComponent(u),i=this.undoData.angle;return e.setAngle(i)}};o.default.register(h),t.exports=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.commandNames,h=l.default.rejectMessages,f={name:u.SET_OBJECT_POSITION,execute:function(t,e,i){var n=t.getObject(e);return n?(this.undoData.objectId=e,this.undoData.props=t.getObjectProperties(e,["left","top"]),t.setObjectPosition(e,i),t.renderAll(),a.default.resolve()):a.default.reject(h.noObject)},undo:function(t){var e=this.undoData,i=e.objectId,n=e.props;return t.setObjectProperties(i,n),t.renderAll(),a.default.resolve()}};o.default.register(f),t.exports=f},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(3),o=n(r),s=i(2),a=n(s),c=i(1),l=n(c),u=l.default.commandNames,h={name:u.SET_OBJECT_POSITIONS,execute:function(t,e){this.undoData.propsList=[];for(var i=null,n=null,r=0;r<e.length;r+=1)i=e[r],n=t.getObject(i.id),n&&(this.undoData.propsList.push({id:i.id,props:t.getObjectProperties(i.id,["left","top"])}),t.setObjectPosition(i.id,i.posInfo));return t.renderAll(),a.default.resolve()},undo:function(t){for(var e=0;e<this.undoData.propsList.length;e+=1){var i=this.undoData.propsList[e],n=i.id,r=i.props;t.setObjectProperties(n,r)}return t.renderAll(),a.default.resolve()}};o.default.register(h),t.exports=h},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(4),o=n(r),s=i(3),a=n(s),c=i(2),l=n(c),u=i(1),h=n(u),f=h.default.commandNames,d=h.default.rejectMessages,p={name:f.SET_OBJECT_PROPERTIES,execute:function(t,e,i){var n=this,r=t.getObject(e);return r?(this.undoData.props={},o.default.forEachOwnProperties(i,function(t,e){n.undoData.props[e]=r[e]}),t.setObjectProperties(e,i),l.default.resolve()):l.default.reject(d.noObject)},undo:function(t,e){var i=this.undoData.props;return t.setObjectProperties(e,i),l.default.resolve()}};a.default.register(p),t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function");
}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(6),l=n(c),u=i(9),h=n(u),f=i(103),d=n(f),p=i(1),g=i(5),v=10,m=function(t){function e(t){r(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,p.componentNames.CROPPER,t));return i._cropzone=null,i._startX=null,i._startY=null,i._withShiftKey=!1,i._listeners={keydown:i._onKeyDown.bind(i),keyup:i._onKeyUp.bind(i),mousedown:i._onFabricMouseDown.bind(i),mousemove:i._onFabricMouseMove.bind(i),mouseup:i._onFabricMouseUp.bind(i)},i}return s(e,t),a(e,[{key:"start",value:function(t){if(this.options=t||{},!this._cropzone){var e=this.getCanvas();e.forEachObject(function(t){t.evented=!1}),this._cropzone=new d.default(Object.assign({left:-10,top:-10,width:1,height:1,strokeWidth:0,cornerSize:10,cornerColor:"black",fill:"transparent",hasRotatingPoint:!1,hasBorders:!1,lockScalingFlip:!0,lockRotation:!0},t),this.graphics.cropSelectionStyle),e.deactivateAll(),e.add(this._cropzone),e.on("mouse:down",this._listeners.mousedown),e.selection=!1,e.defaultCursor="crosshair",e.setActiveObject(this._cropzone),l.default.util.addListener(document,"keydown",this._listeners.keydown),l.default.util.addListener(document,"keyup",this._listeners.keyup)}}},{key:"end",value:function(){var t=this.getCanvas(),e=this._cropzone;e&&(e.remove(),t.selection=!0,t.defaultCursor="default",t.off("mouse:down",this._listeners.mousedown),t.forEachObject(function(t){t.evented=!0}),this._cropzone=null,l.default.util.removeListener(document,"keydown",this._listeners.keydown),l.default.util.removeListener(document,"keyup",this._listeners.keyup))}},{key:"_onFabricMouseDown",value:function(t){var e=this.getCanvas();if(!t.target){e.selection=!1;var i=e.getPointer(t.e);this._startX=i.x,this._startY=i.y,e.on({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}}},{key:"_onFabricMouseMove",value:function(t){var e=this.getCanvas(),i=e.getPointer(t.e),n=i.x,r=i.y,o=this._cropzone;Math.abs(n-this._startX)+Math.abs(r-this._startY)>v&&(o.remove(),o.set(this._calcRectDimensionFromPoint(n,r)),e.add(o))}},{key:"_calcRectDimensionFromPoint",value:function(t,e){var i=this.getCanvas(),n=i.getWidth(),r=i.getHeight(),o=this._startX,s=this._startY,a=(0,g.clamp)(t,0,o),c=(0,g.clamp)(e,0,s),l=(0,g.clamp)(t,o,n)-a,u=(0,g.clamp)(e,s,r)-c;return(this.options.lockProportion||this._withShiftKey)&&(l>u?u=l:u>l&&(l=u),o>=t&&(a=o-l),s>=e&&(c=s-u)),{left:a,top:c,width:l,height:u}}},{key:"_onFabricMouseUp",value:function(){var t=this._cropzone,e=this._listeners,i=this.getCanvas();i.setActiveObject(t),i.off({"mouse:move":e.mousemove,"mouse:up":e.mouseup})}},{key:"getCroppedImageData",value:function(t){var e=this.getCanvas(),i=e.contains(this._cropzone);if(!t)return null;i&&this._cropzone.remove();var n={imageName:this.getImageName(),url:e.toDataURL(t)};return i&&e.add(this._cropzone),n}},{key:"getCropzoneRect",value:function(){var t=this._cropzone;return t.isValid()?{left:t.getLeft(),top:t.getTop(),width:t.getWidth(),height:t.getHeight()}:null}},{key:"_onKeyDown",value:function(t){t.keyCode===p.keyCodes.SHIFT&&(this._withShiftKey=!0)}},{key:"_onKeyUp",value:function(t){t.keyCode===p.keyCodes.SHIFT&&(this._withShiftKey=!1)}}]),e}(h.default);t.exports=m},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(4),l=i(2),u=n(l),h=i(6),f=n(h),d=i(9),p=n(d),g=i(105),v=n(g),m=i(1),b=n(m),y=i(101),_=n(y),x=i(107),w=n(x),S=i(104),C=n(S),k=i(102),O=n(k),T=i(106),E=n(T),j=b.default.rejectMessages,M=f.default.Image.filters;M.Mask=v.default,M.Blur=_.default,M.Sharpen=w.default,M.Emboss=C.default,M.ColorFilter=O.default,M.OldMaker=E.default;var A=function(t){function e(t){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,b.default.componentNames.FILTER,t))}return s(e,t),a(e,[{key:"add",value:function(t,e){var i=this;return new u.default(function(n,r){var o=i._getSourceImage(),s=i.getCanvas(),a=i._getFilter(o,t);a||(a=i._createFilter(o,t,e)),a||r(j.invalidParameters),i._changeFilterValues(a,e),i._apply(o,function(){s.renderAll(),n({type:t,action:"add"})})})}},{key:"remove",value:function(t){var e=this;return new u.default(function(i,n){var r=e._getSourceImage(),o=e.getCanvas();r.filters.length||n(j.unsupportedOperation),e._removeFilter(r,t),e._apply(r,function(){o.renderAll(),i({type:t,action:"remove"})})})}},{key:"hasFilter",value:function(t){return!!this._getFilter(this._getSourceImage(),t)}},{key:"getOptions",value:function(t){var e=this._getSourceImage(),i=this._getFilter(e,t);return i?(0,c.extend)({},i.options):null}},{key:"_changeFilterValues",value:function(t,e){(0,c.forEach)(e,function(e,i){(0,c.isUndefined)(t[i])||(t[i]=e)}),(0,c.forEach)(t.options,function(i,n){(0,c.isUndefined)(e[n])||(t.options[n]=e[n])})}},{key:"_apply",value:function(t,e){t.applyFilters(e)}},{key:"_getSourceImage",value:function(){return this.getCanvasImage()}},{key:"_createFilter",value:function(t,e,i){var n=void 0,r=this._getFabricFilterType(e),o=f.default.Image.filters[r];return o&&(n=new o(i),n.options=i,t.filters.push(n)),n}},{key:"_getFilter",value:function(t,e){var i=null;if(t){var n=this._getFabricFilterType(e),r=t.filters.length,o=void 0,s=void 0;for(s=0;s<r;s+=1)if(o=t.filters[s],o.type===n){i=o;break}}return i}},{key:"_removeFilter",value:function(t,e){var i=this._getFabricFilterType(e);t.filters=(0,c.filter)(t.filters,function(t){return t.type!==i})}},{key:"_getFabricFilterType",value:function(t){return t.charAt(0).toUpperCase()+t.slice(1)}}]),e}(p.default);t.exports=A},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(4),l=n(c),u=i(2),h=n(u),f=i(9),d=n(f),p=i(1),g=n(p),v=g.default.componentNames,m=g.default.rejectMessages,b=function(t){function e(t){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,v.FLIP,t))}return s(e,t),a(e,[{key:"getCurrentSetting",value:function(){var t=this.getCanvasImage();return{flipX:t.flipX,flipY:t.flipY}}},{key:"set",value:function(t){var e=this.getCurrentSetting(),i=e.flipX!==t.flipX,n=e.flipY!==t.flipY;return i||n?(l.default.extend(e,t),this.setImageProperties(e,!0),this._invertAngle(i,n),this._flipObjects(i,n),h.default.resolve({flipX:e.flipX,flipY:e.flipY,angle:this.getCanvasImage().angle})):h.default.reject(m.flip)}},{key:"_invertAngle",value:function(t,e){var i=this.getCanvasImage(),n=i.angle;t&&(n*=-1),e&&(n*=-1),i.setAngle(parseFloat(n)).setCoords()}},{key:"_flipObjects",value:function(t,e){var i=this.getCanvas();t&&i.forEachObject(function(t){t.set({angle:parseFloat(t.angle*-1),flipX:!t.flipX,left:i.width-t.left}).setCoords()}),e&&i.forEachObject(function(t){t.set({angle:parseFloat(t.angle*-1),flipY:!t.flipY,top:i.height-t.top}).setCoords()}),i.renderAll()}},{key:"reset",value:function(){return this.set({flipX:!1,flipY:!1})}},{key:"flipX",value:function(){var t=this.getCurrentSetting();return this.set({flipX:!t.flipX,flipY:t.flipY})}},{key:"flipY",value:function(){var t=this.getCurrentSetting();return this.set({flipX:t.flipX,flipY:!t.flipY})}}]),e}(d.default);t.exports=b},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(6),l=n(c),u=i(9),h=n(u),f=i(1),d=n(f),p=function(t){function e(t){r(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,d.default.componentNames.FREE_DRAWING,t));return i.width=12,i.oColor=new l.default.Color("rgba(0, 0, 0, 0.5)"),i}return s(e,t),a(e,[{key:"start",value:function(t){var e=this.getCanvas();e.isDrawingMode=!0,this.setBrush(t)}},{key:"setBrush",value:function(t){t=t||{};var e=t.mosaic,i=e?this.getCanvas().MosaicDrawingBrush:this.getCanvas().freeDrawingBrush;e&&(i.blocksize=t.blocksize||10,t.isNew&&(i.mosaicSign=(new Date).getTime())),this.width=t.width||this.width,t.color&&(this.oColor=new l.default.Color(t.color)),i.width=this.width,i.color=this.oColor.toRgba(),this.getCanvas().freeDrawingBrush=i}},{key:"end",value:function(){var t=this.getCanvas();t.isDrawingMode=!1}}]),e}(h.default);t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(6),l=n(c),u=i(4),h=n(u),f=i(2),d=n(f),p=i(9),g=n(p),v=i(1),m=n(v),b=m.default.eventNames,y=m.default.rejectMessages,_={arrow:"M 0 90 H 105 V 120 L 160 60 L 105 0 V 30 H 0 Z",cancel:"M 0 30 L 30 60 L 0 90 L 30 120 L 60 90 L 90 120 L 120 90 L 90 60 L 120 30 L 90 0 L 60 30 L 30 0 Z"},x=function(t){function e(t){r(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,m.default.componentNames.ICON,t));return i._oColor="#000000",i._pathMap=_,i.useDragAddIcon=t.useDragAddIcon,i}return s(e,t),a(e,[{key:"add",value:function(t,e){var i=this;return new d.default(function(n,r){var o=i.getCanvas(),s=i._pathMap[t],a=m.default.fObjectOptions.SELECTION_STYLE,c=Object.keys(m.default.defaultIconPath).indexOf(t)>=0,l=i.useDragAddIcon&&c,u=s?i._createIcon(s):null;u||r(y.invalidParameters),u.set(h.default.extend({type:"icon",fill:i._oColor},a,e,i.graphics.controlStyle)),o.add(u).setActiveObject(u),l&&i._addWithDragEvent(o),n(i.graphics.createObjectProperties(u))})}},{key:"_addWithDragEvent",value:function(t){var e=this;t.on({"mouse:move":function(i){t.selection=!1,e.fire(b.ICON_CREATE_RESIZE,{moveOriginPointer:t.getPointer(i.e)})},"mouse:up":function(i){e.fire(b.ICON_CREATE_END,{moveOriginPointer:t.getPointer(i.e)}),t.defaultCursor="default",t.off("mouse:up"),t.off("mouse:move"),t.selection=!0}})}},{key:"registerPaths",value:function(t){var e=this;h.default.forEach(t,function(t,i){e._pathMap[i]=t},this)}},{key:"setColor",value:function(t,e){this._oColor=t,e&&"icon"===e.get("type")&&(e.setFill(this._oColor),this.getCanvas().renderAll())}},{key:"getColor",value:function(t){return t.fill}},{key:"_createIcon",value:function(t){return new l.default.Path(t)}}]),e}(g.default);t.exports=x},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(2),l=n(c),u=i(9),h=n(u),f=i(1),d=n(f),p=d.default.componentNames,g=d.default.rejectMessages,v={padding:0,crossOrigin:"Anonymous"},m=function(t){function e(t){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,p.IMAGE_LOADER,t))}return s(e,t),a(e,[{key:"load",value:function(t,e){var i=this,n=void 0;if(t||e)n=this._setBackgroundImage(e).then(function(e){return i.setCanvasImage(t,e),i.adjustCanvasDimension(),e});else{var r=this.getCanvas();r.backgroundImage=null,r.renderAll(),n=new l.default(function(t){i.setCanvasImage("",null),t()})}return n}},{key:"_setBackgroundImage",value:function(t){var e=this;return t?new l.default(function(i,n){var r=e.getCanvas();r.setBackgroundImage(t,function(){var t=r.backgroundImage;t.getElement()?i(t):n(g.loadingImageFailed)},v)}):l.default.reject(g.loadImage)}}]),e}(h.default);t.exports=m},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(6),l=n(c),u=i(9),h=n(u),f=i(1),d=n(f),p=d.default.eventNames,g=function(t){function e(t){r(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,d.default.componentNames.LINE,t));return i._width=12,i._oColor=new l.default.Color("rgba(0, 0, 0, 0.5)"),i._listeners={mousedown:i._onFabricMouseDown.bind(i),mousemove:i._onFabricMouseMove.bind(i),mouseup:i._onFabricMouseUp.bind(i)},i}return s(e,t),a(e,[{key:"start",value:function(t){var e=this.getCanvas();e.defaultCursor="crosshair",e.selection=!1,this.setBrush(t),e.forEachObject(function(t){t.set({evented:!1})}),e.on({"mouse:down":this._listeners.mousedown})}},{key:"setBrush",value:function(t){var e=this.getCanvas().freeDrawingBrush;t=t||{},this._width=t.width||this._width,t.color&&(this._oColor=new l.default.Color(t.color)),e.width=this._width,e.color=this._oColor.toRgba()}},{key:"end",value:function(){var t=this.getCanvas();t.defaultCursor="default",t.selection=!0,t.forEachObject(function(t){t.set({evented:!0})}),t.off("mouse:down",this._listeners.mousedown)}},{key:"_onFabricMouseDown",value:function(t){var e=this.getCanvas(),i=e.getPointer(t.e),n=[i.x,i.y,i.x,i.y];this._line=new l.default.Line(n,{stroke:this._oColor.toRgba(),strokeWidth:this._width,evented:!1}),this._line.set(d.default.fObjectOptions.SELECTION_STYLE),e.add(this._line),e.on({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}},{key:"_onFabricMouseMove",value:function(t){var e=this.getCanvas(),i=e.getPointer(t.e);this._line.set({x2:i.x,y2:i.y}),this._line.setCoords(),e.renderAll()}},{key:"_onFabricMouseUp",value:function(){var t=this.getCanvas(),e=this.graphics.createObjectProperties(this._line);this.fire(p.ADD_OBJECT,e),this._line=null,t.off({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}}]),e}(h.default);t.exports=g},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(6),l=n(c),u=i(2),h=n(u),f=i(9),d=n(f),p=i(1),g=n(p),v=g.default.componentNames,m=function(t){function e(t){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,v.ROTATION,t))}return s(e,t),a(e,[{key:"getCurrentAngle",value:function(){return this.getCanvasImage().angle}},{key:"setAngle",value:function(t){var e=this.getCurrentAngle()%360;t%=360;var i=this.getCanvasImage(),n=i.getCenterPoint();i.setAngle(t).setCoords(),this.adjustCanvasDimension();var r=i.getCenterPoint();return this._rotateForEachObject(n,r,t-e),h.default.resolve(t)}},{key:"_rotateForEachObject",value:function(t,e,i){var n=this.getCanvas(),r={x:t.x-e.x,y:t.y-e.y};n.forEachObject(function(e){var n=e.getCenterPoint(),o=l.default.util.degreesToRadians(i),s=l.default.util.rotatePoint(n,t,o);e.set({left:s.x-r.x,top:s.y-r.y,angle:(e.angle+i)%360}),e.setCoords()}),n.renderAll()}},{key:"rotate",value:function(t){var e=this.getCurrentAngle();return this.setAngle(e+t)}}]),e}(d.default);t.exports=m},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(6),l=n(c),u=i(2),h=n(u),f=i(9),d=n(f),p=i(1),g=n(p),v=i(110),m=n(v),b=i(4),y=g.default.rejectMessages,_=g.default.eventNames,x=g.default.keyCodes,w="rect",S={strokeWidth:1,stroke:"#000000",fill:"#ffffff",width:1,height:1,rx:0,ry:0,lockSkewingX:!0,lockSkewingY:!0,lockUniScaling:!1,bringForward:!0,isRegular:!1},C=["rect","circle","triangle"],k=function(t){function e(t){r(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,g.default.componentNames.SHAPE,t));return i._shapeObj=null,i._type=w,i._options=(0,b.extend)({},S),i._isSelected=!1,i._startPoint={},i._withShiftKey=!1,i._handlers={mousedown:i._onFabricMouseDown.bind(i),mousemove:i._onFabricMouseMove.bind(i),mouseup:i._onFabricMouseUp.bind(i),keydown:i._onKeyDown.bind(i),keyup:i._onKeyUp.bind(i)},i}return s(e,t),a(e,[{key:"start",value:function(){var t=this.getCanvas();this._isSelected=!1,t.defaultCursor="crosshair",t.selection=!1,t.uniScaleTransform=!0,t.on({"mouse:down":this._handlers.mousedown}),l.default.util.addListener(document,"keydown",this._handlers.keydown),l.default.util.addListener(document,"keyup",this._handlers.keyup)}},{key:"end",value:function(){var t=this.getCanvas();this._isSelected=!1,t.defaultCursor="default",t.selection=!0,t.uniScaleTransform=!1,t.off({"mouse:down":this._handlers.mousedown}),l.default.util.removeListener(document,"keydown",this._handlers.keydown),l.default.util.removeListener(document,"keyup",this._handlers.keyup)}},{key:"setStates",value:function(t,e){this._type=t,e&&(this._options=(0,b.extend)(this._options,e))}},{key:"add",value:function(t,e){var i=this;return new h.default(function(n){var r=i.getCanvas();e=i._createOptions(e);var o=i._createInstance(t,e);i._bindEventOnShape(o),r.add(o).setActiveObject(o),n(i.graphics.createObjectProperties(o))})}},{key:"change",value:function(t,e){var i=this;return new h.default(function(n,r){(0,b.inArray)(t.get("type"),C)<0&&r(y.unsupportedType),t.set(e),i.getCanvas().renderAll(),n()})}},{key:"_createInstance",value:function(t,e){var i=void 0;switch(t){case"rect":i=new l.default.Rect(e);break;case"circle":i=new l.default.Ellipse((0,b.extend)({type:"circle"},e));break;case"triangle":i=new l.default.Triangle(e);break;default:i={}}return i}},{key:"_createOptions",value:function(t){var e=g.default.fObjectOptions.SELECTION_STYLE;return t=(0,b.extend)({},S,this._options,e,t),t.isRegular&&(t.lockUniScaling=!0),t}},{key:"_bindEventOnShape",value:function(t){var e=this,i=this.getCanvas();t.on({added:function(){e._shapeObj=this,m.default.setOrigins(e._shapeObj)},selected:function(){e._isSelected=!0,e._shapeObj=this,i.uniScaleTransform=!0,i.defaultCursor="default",m.default.setOrigins(e._shapeObj)},deselected:function(){e._isSelected=!1,e._shapeObj=null,i.defaultCursor="crosshair",i.uniScaleTransform=!1},modified:function(){var t=e._shapeObj;m.default.adjustOriginToCenter(t),m.default.setOrigins(t)},scaling:function(t){var n=i.getPointer(t.e),r=e._shapeObj;i.setCursor("crosshair"),m.default.resize(r,n,!0)}})}},{key:"_onFabricMouseDown",value:function(t){if(t.target||(this._isSelected=!1,this._shapeObj=!1),!this._isSelected&&!this._shapeObj){var e=this.getCanvas();this._startPoint=e.getPointer(t.e),e.on({"mouse:move":this._handlers.mousemove,"mouse:up":this._handlers.mouseup})}}},{key:"_onFabricMouseMove",value:function(t){var e=this,i=this.getCanvas(),n=i.getPointer(t.e),r=this._startPoint.x,o=this._startPoint.y,s=r-n.x,a=o-n.y,c=this._shapeObj;c?(this._shapeObj.set({isRegular:this._withShiftKey}),m.default.resize(c,n),i.renderAll()):this.add(this._type,{left:r,top:o,width:s,height:a}).then(function(t){e.fire(_.ADD_OBJECT,t)})}},{key:"_onFabricMouseUp",value:function(){var t=this.getCanvas(),e=this._shapeObj;e&&m.default.adjustOriginToCenter(e),this.fire(_.ADD_OBJECT_AFTER,this.graphics.createObjectProperties(e)),t.off({"mouse:move":this._handlers.mousemove,"mouse:up":this._handlers.mouseup})}},{key:"_onKeyDown",value:function(t){t.keyCode===x.SHIFT&&(this._withShiftKey=!0,this._shapeObj&&(this._shapeObj.isRegular=!0))}},{key:"_onKeyUp",value:function(t){t.keyCode===x.SHIFT&&(this._withShiftKey=!1,this._shapeObj&&(this._shapeObj.isRegular=!1))}}]),e}(d.default);t.exports=k},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(17),l=n(c),u=i(1),h=n(u),f=h.default.drawingModes,d=h.default.componentNames,p=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,f.CROPPER))}return s(e,t),a(e,[{key:"start",value:function(t,e){var i=t.getComponent(d.CROPPER);i.start(e)}},{key:"end",value:function(t){var e=t.getComponent(d.CROPPER);e.end()}}]),e}(l.default);t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(17),l=n(c),u=i(1),h=n(u),f=h.default.drawingModes,d=h.default.componentNames,p=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,f.FREE_DRAWING))}return s(e,t),a(e,[{key:"start",value:function(t,e){var i=t.getComponent(d.FREE_DRAWING);i.start(e)}},{key:"end",value:function(t){var e=t.getComponent(d.FREE_DRAWING);e.end()}}]),e}(l.default);t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(17),l=n(c),u=i(1),h=n(u),f=h.default.drawingModes,d=h.default.componentNames,p=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,f.LINE_DRAWING))}return s(e,t),a(e,[{key:"start",value:function(t,e){var i=t.getComponent(d.LINE);i.start(e)}},{key:"end",value:function(t){var e=t.getComponent(d.LINE);e.end()}}]),e}(l.default);t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(17),l=n(c),u=i(1),h=n(u),f=h.default.drawingModes,d=h.default.componentNames,p=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,f.SHAPE))}return s(e,t),a(e,[{key:"start",value:function(t){var e=t.getComponent(d.SHAPE);e.start()}},{key:"end",value:function(t){var e=t.getComponent(d.SHAPE);e.end()}}]),e}(l.default);t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(17),l=n(c),u=i(1),h=n(u),f=h.default.drawingModes,d=h.default.componentNames,p=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,f.TEXT))}return s(e,t),a(e,[{key:"start",value:function(t){var e=t.getComponent(d.TEXT);e.start()}},{key:"end",value:function(t){var e=t.getComponent(d.TEXT);e.end()}}]),e}(l.default);t.exports=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(6),o=n(r),s=o.default.util.createClass(o.default.Image.filters.Convolute,{type:"Blur",initialize:function(){var t=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9];this.matrix=t}});t.exports=s},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(6),o=n(r),s=o.default.util.createClass(o.default.Image.filters.BaseFilter,{
type:"ColorFilter",initialize:function(t){t||(t={}),this.color=t.color||"#FFFFFF",this.threshold=t.threshold||45,this.x=t.x||null,this.y=t.y||null},applyTo:function(t){var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,r=this.threshold,s=o.default.Color.sourceFromHex(this.color),a=void 0,c=void 0;for(this.x&&this.y&&(s=this._getColor(i,this.x,this.y)),a=0,c=n.length;a<c;a+=4)this._isOutsideThreshold(n[a],s[0],r)||this._isOutsideThreshold(n[a+1],s[1],r)||this._isOutsideThreshold(n[a+2],s[2],r)||(n[a]=n[a+1]=n[a+2]=n[a+3]=0);e.putImageData(i,0,0)},_isOutsideThreshold:function(t,e,i){var n=t-e;return Math.abs(n)>i},_getColor:function(t,e,i){var n=[0,0,0,0],r=t.data,o=t.width,s=4,a=(o*i+e)*s;return n[0]=r[a],n[1]=r[a+1],n[2]=r[a+2],n[3]=r[a+3],n}});t.exports=s},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(4),o=n(r),s=i(6),a=n(s),c=i(5),l="tl",u="tr",h="mt",f="ml",d="mr",p="mb",g="bl",v="br",m=a.default.util.createClass(a.default.Rect,{initialize:function(t,e){t=o.default.extend(t,e),t.type="cropzone",this.callSuper("initialize",t),this.options=t,this.on({moving:this._onMoving,scaling:this._onScaling})},_render:function(t){var e=7,i=7;this.callSuper("_render",t);var n=this.flipX?-1:1,r=this.flipY?-1:1,o=n/this.scaleX,s=r/this.scaleY;t.scale(o,s),this._fillOuterRect(t,"rgba(0, 0, 0, 0.55)"),this.options.lineWidth?(this._fillInnerRect(t),this._strokeBorder(t,"rgb(255, 255, 255)",{lineWidth:this.options.lineWidth})):(this._strokeBorder(t,"rgb(0, 0, 0)",{lineDashWidth:e}),this._strokeBorder(t,"rgb(255, 255, 255)",{lineDashWidth:e,lineDashOffset:i})),t.scale(1/o,1/s)},_fillOuterRect:function(t,e){var i=this._getCoordinates(t),n=i.x,r=i.y;t.save(),t.fillStyle=e,t.beginPath(),t.moveTo(n[0]-1,r[0]-1),t.lineTo(n[3]+1,r[0]-1),t.lineTo(n[3]+1,r[3]+1),t.lineTo(n[0]-1,r[3]+1),t.lineTo(n[0]-1,r[0]-1),t.closePath(),t.moveTo(n[1],r[1]),t.lineTo(n[1],r[2]),t.lineTo(n[2],r[2]),t.lineTo(n[2],r[1]),t.lineTo(n[1],r[1]),t.closePath(),t.fill(),t.restore()},_fillInnerRect:function(t){var e=this._getCoordinates(t),i=e.x,n=e.y,r=this._caculateInnerPosition(i,(i[2]-i[1])/3),o=this._caculateInnerPosition(n,(n[2]-n[1])/3);t.save(),t.strokeStyle="rgba(255, 255, 255, 0.7)",t.lineWidth=this.options.lineWidth,t.beginPath(),t.moveTo(r[0],o[1]),t.lineTo(r[3],o[1]),t.moveTo(r[0],o[2]),t.lineTo(r[3],o[2]),t.moveTo(r[1],o[0]),t.lineTo(r[1],o[3]),t.moveTo(r[2],o[0]),t.lineTo(r[2],o[3]),t.stroke(),t.closePath(),t.restore()},_caculateInnerPosition:function(t,e){var i=[];return i[0]=t[1],i[1]=t[1]+e,i[2]=t[1]+2*e,i[3]=t[2],i},_getCoordinates:function(t){var e=this.getWidth(),i=this.getHeight(),n=e/2,r=i/2,s=this.getLeft(),a=this.getTop(),c=t.canvas;return{x:o.default.map([-(n+s),-n,n,n+(c.width-s-e)],Math.ceil),y:o.default.map([-(r+a),-r,r,r+(c.height-a-i)],Math.ceil)}},_strokeBorder:function(t,e,i){var n=i.lineDashWidth,r=i.lineDashOffset,o=i.lineWidth,s=this.getWidth()/2,a=this.getHeight()/2;t.save(),t.strokeStyle=e,t.setLineDash&&t.setLineDash([n,n]),r&&(t.lineDashOffset=r),o&&(t.lineWidth=o),t.beginPath(),t.moveTo(-s,-a),t.lineTo(s,-a),t.lineTo(s,a),t.lineTo(-s,a),t.lineTo(-s,-a),t.stroke(),t.restore()},_onMoving:function(){var t=this.getLeft(),e=this.getTop(),i=this.getWidth(),n=this.getHeight(),r=this.canvas.getWidth()-i,o=this.canvas.getHeight()-n;this.setLeft((0,c.clamp)(t,0,r)),this.setTop((0,c.clamp)(e,0,o))},_onScaling:function(t){var e=this.canvas.getPointer(t.e),i=this._calcScalingSizeFromPointer(e);this.scale(1).set(i)},_calcScalingSizeFromPointer:function(t){var e=t.x,i=t.y,n=this._calcTopLeftScalingSizeFromPointer(e,i),r=this._calcBottomRightScalingSizeFromPointer(e,i);return this._makeScalingSettings(n,r)},_calcTopLeftScalingSizeFromPointer:function(t,e){var i=this.getHeight()+this.top,n=this.getWidth()+this.left,r=(0,c.clamp)(e,0,i-1),o=(0,c.clamp)(t,0,n-1),s=n-o,a=i-r,l={top:r,left:o,width:s,height:a};return l},_calcBottomRightScalingSizeFromPointer:function(t,e){var i=this.canvas,n=i.width,r=i.height,o=this.left,s=this.top,a=(0,c.clamp)(t,o+1,n)-o,l=(0,c.clamp)(e,s+1,r)-s,u={width:a,height:l};return u},_makeScalingSettings:function(t,e){var i=t.width,n=t.height,r=e.height,o=e.width,s=t.left,a=t.top,c=void 0;switch(this.__corner){case l:if(this.options.lockProportion){var m=t.width<t.height?t.width:t.height;m===t.width?t.top+=t.height-t.width:t.left+=t.width-t.height,t.width=m,t.height=m}c=t;break;case u:if(this.options.lockProportion){var b=o>n?n:o;b===o&&(a+=n-o),n=b,o=b}c={width:o,height:n,top:a};break;case g:if(this.options.lockProportion){var y=i>r?r:i;y===r&&(s+=i-r),i=y,r=y}c={width:i,height:r,left:s};break;case v:if(this.options.lockProportion){var _=e.height>e.width?e.width:e.height;e.height=_,e.width=_}c=e;break;case f:c={width:i,left:s};break;case h:c={height:n,top:a};break;case d:c={width:o};break;case p:c={height:r}}return c},isValid:function(){return this.left>=0&&this.top>=0&&this.width>0&&this.height>0}});t.exports=m},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(6),o=n(r),s=o.default.util.createClass(o.default.Image.filters.Convolute,{type:"Emboss",initialize:function(){var t=[1,1,1,1,.7,-1,-1,-1,-1];this.matrix=t}});t.exports=s},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(6),o=n(r),s=o.default.util.createClass(o.default.Image.filters.Mask,{applyTo:function(t){if(this.mask){var e=t.width,i=t.height,n=this._createCanvasOfMask(e,i),r=t.getContext("2d"),o=n.getContext("2d"),s=r.getImageData(0,0,e,i);this._drawMask(o,t,r),this._mapData(o,s,e,i),r.putImageData(s,0,0)}},_createCanvasOfMask:function(t,e){var i=o.default.util.createCanvasElement();return i.width=t,i.height=e,i},_drawMask:function(t){var e=this.mask,i=e.getElement(),n=e.getLeft(),r=e.getTop(),o=e.getAngle();t.save(),t.translate(n,r),t.rotate(o*Math.PI/180),t.scale(e.scaleX,e.scaleY),t.drawImage(i,-i.width/2,-i.height/2),t.restore()},_mapData:function(t,e,i,n){for(var r=e.data,o=t.getImageData(0,0,i,n).data,s=this.channel,a=e.width*e.height*4,c=0;c<a;c+=4)r[c+3]=o[c+s]}});t.exports=s},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(6),o=n(r),s=o.default.util.createClass(o.default.Image.filters.BaseFilter,{type:"OldMaker",initialize:function(t){t||(t={}),this.percent=t.percent||50},applyTo:function(t){var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i,r=n.data,o=n.width,s=n.height,a=o<s?o:s,c=15,l=.026*Math.pow(a,.737),u=.02,h=this.percent/100;this._addNoise(r,Math.floor(c*h)),this._addPixed(r,s,o,Math.floor(l*h)),i=this._simpleBlur(e,i,h*u),e.putImageData(i,0,0)},_addNoise:function(t,e){for(var i=0,n=0,r=t.length;n<r;n+=4)i=(.5-Math.random())*e,t[n]+=i,t[n+1]+=i,t[n+2]+=i},_addPixed:function(t,e,i,n){var r=void 0,o=void 0,s=void 0,a=void 0,c=void 0,l=void 0;if(n*=1,!(n<=0))for(var u=0;u<e;u+=n)for(var h=0;h<i;h+=n){var f=4*u*i+4*h;r=t[f],o=t[f+1],s=t[f+2],a=t[f+3],c=Math.min(u+n,e),l=Math.min(h+n,i);for(var d=u;d<c;d+=1)for(var p=h;p<l;p+=1)f=4*d*i+4*p,t[f]=r,t[f+1]=o,t[f+2]=s,t[f+3]=a}},_simpleBlur:function(t,e,i){var n=void 0,r=void 0,s=e.width,a=e.height;n=o.default.util.createCanvasElement(),r=o.default.util.createCanvasElement(),n.width===s&&n.height===a||(r.width=n.width=s,r.height=n.height=a);var c=n.getContext("2d"),l=r.getContext("2d"),u=15,h=void 0,f=void 0,d=void 0,p=void 0,g=.06*i*.5;for(c.putImageData(e,0,0),l.clearRect(0,0,s,a),p=-u;p<=u;p++)f=p/u,d=g*f*s+h,l.globalAlpha=1-Math.abs(f),l.drawImage(n,d,h),c.drawImage(r,0,0),l.globalAlpha=1,l.clearRect(0,0,r.width,r.height);for(p=-u;p<=u;p++)h=0,f=p/u,d=g*f*a+h,l.globalAlpha=1-Math.abs(f),l.drawImage(n,h,d),c.drawImage(r,0,0),l.globalAlpha=1,l.clearRect(0,0,r.width,r.height);t.drawImage(n,0,0);var v=t.getImageData(0,0,n.width,n.height);return c.globalAlpha=1,c.clearRect(0,0,n.width,n.height),v}});t.exports=s},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var r=i(6),o=n(r),s=o.default.util.createClass(o.default.Image.filters.Convolute,{type:"Sharpen",initialize:function(){var t=[0,-1,0,-1,5,-1,0,-1,0];this.matrix=t}});t.exports=s},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(4),a=n(s),c=i(2),l=n(c),u=i(6),h=n(u),f=i(92),d=n(f),p=i(87),g=n(p),v=i(89),m=n(v),b=i(94),y=n(b),_=i(90),x=n(_),w=i(93),S=n(w),C=i(!function(){var t=new Error('Cannot find module "./component/text"');throw t.code="MODULE_NOT_FOUND",t}()),k=n(C),O=i(91),T=n(O),E=i(88),j=n(E),M=i(95),A=n(M),P=i(96),I=n(P),D=i(97),L=n(D),R=i(98),B=n(R),N=i(99),F=n(N),z=i(100),W=n(z),X=i(1),U=n(X),H=i(5),Y=n(H),G=U.default.componentNames,V=U.default.eventNames,q=U.default.drawingModes,Z=U.default.fObjectOptions,K=a.default.extend,J=a.default.stamp,$=a.default.isArray,Q=a.default.isString,tt=a.default.forEachArray,et=a.default.forEachOwnProperties,it=a.default.CustomEvents,nt=1e3,rt=800,ot={cssOnly:!0},st={backstoreOnly:!0},at=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.cssMaxWidth,o=i.cssMaxHeight,s=i.useItext,a=void 0!==s&&s,c=i.useDragAddIcon,l=void 0!==c&&c,u=i.noSelector,h=void 0!==u&&u;r(this,t),this.canvasImage=null,this.cssMaxWidth=n||nt,this.cssMaxHeight=o||rt,this.useItext=a,this.useDragAddIcon=l,this.noSelector=h,this.cropSelectionStyle={},this.imageName="",this._objects={},this._canvas=null,this._drawingMode=q.NORMAL,this._drawingModeMap={},this._componentMap={},this._handler={onMouseDown:this._onMouseDown.bind(this),onObjectAdded:this._onObjectAdded.bind(this),onObjectRemoved:this._onObjectRemoved.bind(this),onObjectMoved:this._onObjectMoved.bind(this),onObjectScaled:this._onObjectScaled.bind(this),onObjectSelected:this._onObjectSelected.bind(this),onObjectRemove:this._onObjectRemove.bind(this),onObjectRotateFix:this._onObjectRotateFix.bind(this),onPathCreated:this._onPathCreated.bind(this),onSelectionCleared:this._onSelectionCleared.bind(this)},this._setCanvasElement(e),this._createDrawingModeInstances(),this._createComponents(),this._attachCanvasEvents()}return o(t,[{key:"destroy",value:function(){var t=this._canvas.wrapperEl;this._canvas.clear(),t.parentNode.removeChild(t)}},{key:"deactivateAll",value:function(){return this._canvas.deactivateAll(),this}},{key:"renderAll",value:function(){return this._canvas.renderAll(),this}},{key:"add",value:function(t){var e,i=[];$(t)?i=t:i.push(t),(e=this._canvas).add.apply(e,i)}},{key:"contains",value:function(t){return this._canvas.contains(t)}},{key:"getObjects",value:function(){return this._canvas.getObjects().slice()}},{key:"getObject",value:function(t){return this._objects[t]}},{key:"remove",value:function(t){this._canvas.remove(t)}},{key:"removeAll",value:function(t){var e=this._canvas,i=e.getObjects().slice();return e.remove.apply(e,this._canvas.getObjects()),t&&e.clear(),i}},{key:"removeObjectById",value:function(t){var e=[],i=this._canvas,n=this.getObject(t),r=n&&n.isType("group")&&!n.isEmpty();return r?(i.discardActiveGroup(),n.forEachObject(function(t){e.push(t),t.remove()})):i.contains(n)&&(e.push(n),n.remove()),e}},{key:"getObjectId",value:function(t){var e=null;for(e in this._objects)if(this._objects.hasOwnProperty(e)&&t===this._objects[e])return e;return null}},{key:"getActiveObject",value:function(){return this._canvas.getActiveObject()}},{key:"getActiveGroupObject",value:function(){return this._canvas.getActiveGroup()}},{key:"setActiveObject",value:function(t){this._canvas.setActiveObject(t)}},{key:"setCropSelectionStyle",value:function(t){this.cropSelectionStyle=t}},{key:"getComponent",value:function(t){return this._componentMap[t]}},{key:"getDrawingMode",value:function(){return this._drawingMode}},{key:"startDrawingMode",value:function(t,e){if(this._isSameDrawingMode(t))return!0;this.stopDrawingMode();var i=this._getDrawingModeInstance(t);return i&&i.start&&(i.start(this,e),this._drawingMode=t),!!i}},{key:"stopDrawingMode",value:function(){if(!this._isSameDrawingMode(q.NORMAL)){var t=this._getDrawingModeInstance(this.getDrawingMode());t&&t.end&&t.end(this),this._drawingMode=q.NORMAL}}},{key:"toDataURL",value:function(t){return this._canvas&&this._canvas.toDataURL(t)}},{key:"setCanvasImage",value:function(t,e){e&&J(e),this.imageName=t,this.canvasImage=e}},{key:"setCssMaxDimension",value:function(t){this.cssMaxWidth=t.width||this.cssMaxWidth,this.cssMaxHeight=t.height||this.cssMaxHeight}},{key:"adjustCanvasDimension",value:function(){var t=this.canvasImage.scale(1),e=t.getBoundingRect(),i=e.width,n=e.height,r=this._calcMaxDimension(i,n);this.setCanvasCssDimension({width:"100%",height:"100%","max-width":r.width+"px","max-height":r.height+"px"}),this.setCanvasBackstoreDimension({width:i,height:n}),this._canvas.centerObject(t)}},{key:"setCanvasCssDimension",value:function(t){this._canvas.setDimensions(t,ot)}},{key:"setCanvasBackstoreDimension",value:function(t){this._canvas.setDimensions(t,st)}},{key:"setImageProperties",value:function(t,e){var i=this.canvasImage;i&&(i.set(t).setCoords(),e&&this._canvas.renderAll())}},{key:"getCanvasElement",value:function(){return this._canvas.getElement()}},{key:"getCanvas",value:function(){return this._canvas}},{key:"getCanvasImage",value:function(){return this.canvasImage}},{key:"getImageName",value:function(){return this.imageName}},{key:"addImageObject",value:function(t){var e=this,i=this._callbackAfterLoadingImageObject.bind(this);return new l.default(function(n){h.default.Image.fromURL(t,function(t){i(t),n(e.createObjectProperties(t))},{crossOrigin:"Anonymous"})})}},{key:"getCenter",value:function(){return this._canvas.getCenter()}},{key:"getCropzoneRect",value:function(){return this.getComponent(G.CROPPER).getCropzoneRect()}},{key:"getCroppedImageData",value:function(t){return this.getComponent(G.CROPPER).getCroppedImageData(t)}},{key:"setBrush",value:function(t){var e=this._drawingMode,i=G.FREE_DRAWING;e===q.LINE&&(i=q.LINE),this.getComponent(i).setBrush(t)}},{key:"setDrawingShape",value:function(t,e){this.getComponent(G.SHAPE).setStates(t,e)}},{key:"registerPaths",value:function(t){this.getComponent(G.ICON).registerPaths(t)}},{key:"changeCursor",value:function(t){var e=this.getCanvas();e.defaultCursor=t,e.renderAll()}},{key:"hasFilter",value:function(t){return this.getComponent(G.FILTER).hasFilter(t)}},{key:"setSelectionStyle",value:function(t){K(Z.SELECTION_STYLE,t)}},{key:"setObjectProperties",value:function(t,e){var i=this.getObject(t),n=K({},e);return i.set(n),i.setCoords(),this.getCanvas().renderAll(),n}},{key:"getObjectProperties",value:function(t,e){var i=this.getObject(t),n={};return Q(e)?n[e]=i[e]:$(e)?tt(e,function(t){n[t]=i[t]}):et(e,function(t,e){n[e]=i[e]}),n}},{key:"getObjectPosition",value:function(t,e,i){var n=this.getObject(t);return n?n.getPointByOrigin(e,i):null}},{key:"setObjectPosition",value:function(t,e){var i=this.getObject(t),n=e.x,r=e.y,o=e.originX,s=e.originY;if(!i)return!1;var a=i.getPointByOrigin(o,s),c=i.getPointByOrigin("center","center"),l=c.x-a.x,u=c.y-a.y;return i.set({left:n+l,top:r+u}),i.setCoords(),!0}},{key:"getCanvasSize",value:function(){var t=this.getCanvasImage();return{width:t?t.width:0,height:t?t.height:0}}},{key:"_getDrawingModeInstance",value:function(t){return this._drawingModeMap[t]}},{key:"_setCanvasElement",value:function(t){var e=void 0,i=void 0;e=t.jquery?t[0]:t.nodeType?t:document.querySelector(t),"CANVAS"!==e.nodeName.toUpperCase()&&(i=document.createElement("canvas"),e.appendChild(i)),this._canvas=new h.default.Canvas(i,{containerClass:"tui-image-editor-canvas-container",enableRetinaScaling:!1,noSelector:this.noSelector})}},{key:"_createDrawingModeInstances",value:function(){this._register(this._drawingModeMap,new I.default),this._register(this._drawingModeMap,new L.default),this._register(this._drawingModeMap,new B.default),this._register(this._drawingModeMap,new F.default),this._register(this._drawingModeMap,new W.default)}},{key:"_createComponents",value:function(){this._register(this._componentMap,new d.default(this)),this._register(this._componentMap,new g.default(this)),this._register(this._componentMap,new m.default(this)),this._register(this._componentMap,new y.default(this)),this._register(this._componentMap,new x.default(this)),this._register(this._componentMap,new S.default(this)),this._register(this._componentMap,new k.default(this)),this._register(this._componentMap,new T.default(this)),this._register(this._componentMap,new j.default(this)),this._register(this._componentMap,new A.default(this))}},{key:"_register",value:function(t,e){t[e.getName()]=e}},{key:"_isSameDrawingMode",value:function(t){return this.getDrawingMode()===t}},{key:"_calcMaxDimension",value:function(t,e){var i=this.cssMaxWidth/t,n=this.cssMaxHeight/e,r=Math.min(t,this.cssMaxWidth),o=Math.min(e,this.cssMaxHeight);return i<1&&i<n?(r=t*i,o=e*i):n<1&&n<i&&(r=t*n,o=e*n),{width:Math.floor(r),height:Math.floor(o)}}},{key:"_callbackAfterLoadingImageObject",value:function(t){var e=this.getCanvasImage().getCenterPoint();t.set(U.default.fObjectOptions.SELECTION_STYLE),t.set({left:e.x,top:e.y,crossOrigin:"Anonymous"}),this.getCanvas().add(t).setActiveObject(t)}},{key:"_attachCanvasEvents",value:function(){var t=this._canvas,e=this._handler;t.on({"mouse:down":e.onMouseDown,"object:added":e.onObjectAdded,"object:removed":e.onObjectRemoved,"object:moving":e.onObjectMoved,"object:scaling":e.onObjectScaled,"object:selected":e.onObjectSelected,"object:remove":e.onObjectRemove,"object:rotateFix":e.onObjectRotateFix,"path:created":e.onPathCreated,"selection:cleared":e.onSelectionCleared})}},{key:"_onMouseDown",value:function(t){var e=this._canvas.getPointer(t.e);this.fire(V.MOUSE_DOWN,t.e,e)}},{key:"_onObjectAdded",value:function(t){var e=t.target;e.isType("cropzone")||this._addFabricObject(e)}},{key:"_onObjectRemoved",value:function(t){var e=t.target;this._removeFabricObject(J(e))}},{key:"_onObjectRemove",value:function(t){this.fire(V.OBJECT_REMOVE,t)}},{key:"_onObjectRotateFix",value:function(t){this.fire(V.OBJECT_ROTATE_FIX,t)}},{key:"_onObjectMoved",value:function(t){var e=t.target,i=this.createObjectProperties(e);this.fire(V.OBJECT_MOVED,i)}},{key:"_onObjectScaled",value:function(t){var e=t.target,i=this.createObjectProperties(e);this.fire(V.OBJECT_SCALED,i)}},{key:"_onObjectSelected",value:function(t){var e=t.target,i=this.createObjectProperties(e);this.fire(V.OBJECT_ACTIVATED,i)}},{key:"_onPathCreated",value:function(t){t.path.set(U.default.fObjectOptions.SELECTION_STYLE);var e=this.createObjectProperties(t.path);this.fire(V.ADD_OBJECT,e)}},{key:"_onSelectionCleared",value:function(){this.fire(V.SELECTION_CLEARED)}},{key:"_onSelectionCreated",value:function(t){this.fire(V.SELECTION_CREATED,t.target)}},{key:"discardSelection",value:function(){this._canvas.discardActiveGroup(),this._canvas.discardActiveObject(),this._canvas.renderAll()}},{key:"changeSelectableAll",value:function(t){this._canvas.forEachObject(function(e){e.selectable=t,e.hoverCursor=t?"move":"crosshair"})}},{key:"createObjectProperties",value:function(t){var e=["left","top","width","height","fill","stroke","strokeWidth","opacity"],i={id:J(t),type:t.type};return K(i,Y.default.getProperties(t,e)),["i-text","text"].indexOf(t.type)>-1&&K(i,this._createTextProperties(t,i)),i}},{key:"_createTextProperties",value:function(t){var e=["text","fontFamily","fontSize","fontStyle","textAlign","textDecoration"],i={};return K(i,Y.default.getProperties(t,e)),i}},{key:"_addFabricObject",value:function(t){var e=J(t);return this._objects[e]=t,e}},{key:"_removeFabricObject",value:function(t){delete this._objects[t]}}]),t}();it.mixin(at),t.exports=at},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(){i(this,t),this.versionnumber="1.2.4",this.optionpresets={default:{corsenabled:!1,ltres:1,qtres:1,pathomit:8,rightangleenhance:!0,colorsampling:2,numberofcolors:16,mincolorratio:0,colorquantcycles:3,layering:0,strokewidth:1,linefilter:!1,scale:1,roundcoords:1,viewbox:!1,desc:!1,lcpr:0,qcpr:0,blurradius:0,blurdelta:20},posterized1:{colorsampling:0,numberofcolors:2},posterized2:{numberofcolors:4,blurradius:5},curvy:{ltres:.01,linefilter:!0,rightangleenhance:!1},sharp:{qtres:.01,linefilter:!1},detailed:{pathomit:0,roundcoords:2,ltres:.5,qtres:.5,numberofcolors:64},smoothed:{blurradius:5,blurdelta:64},grayscale:{colorsampling:0,colorquantcycles:1,numberofcolors:7},fixedpalette:{colorsampling:0,colorquantcycles:1,numberofcolors:27},randomsampling1:{colorsampling:1,numberofcolors:8},randomsampling2:{colorsampling:1,numberofcolors:64},artistic1:{colorsampling:0,colorquantcycles:1,pathomit:0,blurradius:5,blurdelta:64,ltres:.01,linefilter:!0,numberofcolors:16,strokewidth:2},artistic2:{qtres:.01,colorsampling:0,colorquantcycles:1,numberofcolors:4,strokewidth:0},artistic3:{qtres:10,ltres:10,numberofcolors:8},artistic4:{qtres:10,ltres:10,numberofcolors:64,blurradius:5,blurdelta:256,strokewidth:2},posterized3:{ltres:1,qtres:1,pathomit:20,rightangleenhance:!0,colorsampling:0,numberofcolors:3,mincolorratio:0,colorquantcycles:3,blurradius:3,blurdelta:20,strokewidth:0,linefilter:!1,roundcoords:1,pal:[{r:0,g:0,b:100,a:255},{r:255,g:255,b:255,a:255}]}},this.pathscan_combined_lookup=[[[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[0,1,0,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[0,2,-1,0]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[0,1,0,-1],[0,0,1,0]],[[0,0,1,0],[-1,-1,-1,-1],[0,2,-1,0],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[0,0,1,0],[0,3,0,1],[-1,-1,-1,-1]],[[13,3,0,1],[13,2,-1,0],[7,1,0,-1],[7,0,1,0]],[[-1,-1,-1,-1],[0,1,0,-1],[-1,-1,-1,-1],[0,3,0,1]],[[0,3,0,1],[0,2,-1,0],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[0,3,0,1],[0,2,-1,0],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[0,1,0,-1],[-1,-1,-1,-1],[0,3,0,1]],[[11,1,0,-1],[14,0,1,0],[14,3,0,1],[11,2,-1,0]],[[-1,-1,-1,-1],[0,0,1,0],[0,3,0,1],[-1,-1,-1,-1]],[[0,0,1,0],[-1,-1,-1,-1],[0,2,-1,0],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[0,1,0,-1],[0,0,1,0]],[[0,1,0,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[0,2,-1,0]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1]]],this.gks=[[.27901,.44198,.27901],[.135336,.228569,.272192,.228569,.135336],[.086776,.136394,.178908,.195843,.178908,.136394,.086776],[.063327,.093095,.122589,.144599,.152781,.144599,.122589,.093095,.063327],[.049692,.069304,.089767,.107988,.120651,.125194,.120651,.107988,.089767,.069304,.049692]],this.specpalette=[{r:0,g:0,b:0,a:255},{r:128,g:128,b:128,a:255},{r:0,g:0,b:128,a:255},{r:64,g:64,b:128,a:255},{r:192,g:192,b:192,a:255},{r:255,g:255,b:255,a:255},{r:128,g:128,b:192,a:255},{r:0,g:0,b:192,a:255},{r:128,g:0,b:0,a:255},{r:128,g:64,b:64,a:255},{r:128,g:0,b:128,a:255},{r:168,g:168,b:168,a:255},{r:192,g:128,b:128,a:255},{r:192,g:0,b:0,a:255},{r:255,g:255,b:255,a:255},{r:0,g:128,b:0,a:255}]}return n(t,null,[{key:"tracerDefaultOption",value:function(){return{pathomit:100,ltres:.1,qtres:1,scale:1,strokewidth:5,viewbox:!1,linefilter:!0,desc:!1,rightangleenhance:!1,pal:[{r:0,g:0,b:0,a:255},{r:255,g:255,b:255,a:255}]}}}]),n(t,[{key:"imageToSVG",value:function(t,e,i){var n=this;i=this.checkoptions(i),this.loadImage(t,function(t){e(n.imagedataToSVG(n.getImgdata(t),i))},i)}},{key:"imagedataToSVG",value:function(t,e){e=this.checkoptions(e);var i=this.imagedataToTracedata(t,e);return this.getsvgstring(i,e)}},{key:"imageToTracedata",value:function(t,e,i){var n=this;i=this.checkoptions(i),this.loadImage(t,function(t){e(n.imagedataToTracedata(n.getImgdata(t),i))},i)}},{key:"imagedataToTracedata",value:function(t,e){e=this.checkoptions(e);var i=this.colorquantization(t,e),n=void 0;if(0===e.layering){n={layers:[],palette:i.palette,width:i.array[0].length-2,height:i.array.length-2};for(var r=0;r<i.palette.length;r+=1){var o=this.batchtracepaths(this.internodes(this.pathscan(this.layeringstep(i,r),e.pathomit),e),e.ltres,e.qtres);n.layers.push(o)}}else{var s=this.layering(i);e.layercontainerid&&this.drawLayers(s,this.specpalette,e.scale,e.layercontainerid);var a=this.batchpathscan(s,e.pathomit),c=this.batchinternodes(a,e);n={layers:this.batchtracelayers(c,e.ltres,e.qtres),palette:i.palette,width:t.width,height:t.height}}return n}},{key:"checkoptions",value:function(t){t=t||{},"string"==typeof t&&(t=t.toLowerCase(),t=this.optionpresets[t]?this.optionpresets[t]:{});for(var e=Object.keys(this.optionpresets.default),i=0;i<e.length;i+=1)t.hasOwnProperty(e[i])||(t[e[i]]=this.optionpresets.default[e[i]]);return t}},{key:"colorquantization",value:function(t,e){var i=[],n=0,r=void 0,o=void 0,s=void 0,a=[],c=t.width*t.height,l=void 0,u=void 0,h=void 0,f=void 0,d=void 0;for(u=0;u<t.height+2;u+=1)for(i[u]=[],l=0;l<t.width+2;l+=1)i[u][l]=-1;for(d=e.pal?e.pal:0===e.colorsampling?this.generatepalette(e.numberofcolors):1===e.colorsampling?this.samplepalette(e.numberofcolors,t):this.samplepalette2(e.numberofcolors,t),e.blurradius>0&&(t=this.blur(t,e.blurradius,e.blurdelta)),f=0;f<e.colorquantcycles;f+=1){if(f>0)for(h=0;h<d.length;h+=1)a[h].n>0&&(d[h]={r:Math.floor(a[h].r/a[h].n),g:Math.floor(a[h].g/a[h].n),b:Math.floor(a[h].b/a[h].n),a:Math.floor(a[h].a/a[h].n)}),a[h].n/c<e.mincolorratio&&f<e.colorquantcycles-1&&(d[h]={r:Math.floor(255*Math.random()),g:Math.floor(255*Math.random()),b:Math.floor(255*Math.random()),a:Math.floor(255*Math.random())});for(l=0;l<d.length;l+=1)a[l]={r:0,g:0,b:0,a:0,n:0};for(u=0;u<t.height;u+=1)for(l=0;l<t.width;l+=1){for(n=4*(u*t.width+l),s=0,o=1024,h=0;h<d.length;h+=1)r=Math.abs(d[h].r-t.data[n])+Math.abs(d[h].g-t.data[n+1])+Math.abs(d[h].b-t.data[n+2])+Math.abs(d[h].a-t.data[n+3]),r<o&&(o=r,s=h);a[s].r+=t.data[n],a[s].g+=t.data[n+1],a[s].b+=t.data[n+2],a[s].a+=t.data[n+3],a[s].n+=1,i[u+1][l+1]=s}}return{array:i,palette:d}}},{key:"samplepalette",value:function(t,e){for(var i=void 0,n=[],r=0;r<t;r+=1)i=4*Math.floor(Math.random()*e.data.length/4),n.push({r:e.data[i],g:e.data[i+1],b:e.data[i+2],a:e.data[i+3]});return n}},{key:"samplepalette2",value:function(t,e){for(var i=void 0,n=[],r=Math.ceil(Math.sqrt(t)),o=Math.ceil(t/r),s=e.width/(r+1),a=e.height/(o+1),c=0;c<o;c+=1)for(var l=0;l<r&&n.length!==t;l+=1)i=4*Math.floor((c+1)*a*e.width+(l+1)*s),n.push({r:e.data[i],g:e.data[i+1],b:e.data[i+2],a:e.data[i+3]});return n}},{key:"generatepalette",value:function(t){var e=[],i=void 0,n=void 0,r=void 0;if(t<8)for(var o=Math.floor(255/(t-1)),s=0;s<t;s+=1)e.push({r:s*o,g:s*o,b:s*o,a:255});else{var a=Math.floor(Math.pow(t,1/3)),c=Math.floor(255/(a-1)),l=t-a*a*a;for(i=0;i<a;i+=1)for(n=0;n<a;n+=1)for(r=0;r<a;r+=1)e.push({r:i*c,g:n*c,b:r*c,a:255});for(i=0;i<l;i+=1)e.push({r:Math.floor(255*Math.random()),g:Math.floor(255*Math.random()),b:Math.floor(255*Math.random()),a:Math.floor(255*Math.random())})}return e}},{key:"layering",value:function(t){var e=[],i=0,n=t.array.length,r=t.array[0].length,o=void 0,s=void 0,a=void 0,c=void 0,l=void 0,u=void 0,h=void 0,f=void 0,d=void 0,p=void 0,g=void 0;for(g=0;g<t.palette.length;g+=1)for(e[g]=[],p=0;p<n;p+=1)for(e[g][p]=[],d=0;d<r;d+=1)e[g][p][d]=0;for(p=1;p<n-1;p+=1)for(d=1;d<r-1;d+=1)i=t.array[p][d],o=t.array[p-1][d-1]===i?1:0,s=t.array[p-1][d]===i?1:0,a=t.array[p-1][d+1]===i?1:0,c=t.array[p][d-1]===i?1:0,l=t.array[p][d+1]===i?1:0,u=t.array[p+1][d-1]===i?1:0,h=t.array[p+1][d]===i?1:0,f=t.array[p+1][d+1]===i?1:0,e[i][p+1][d+1]=1+2*l+4*f+8*h,c||(e[i][p+1][d]=2+4*h+8*u),s||(e[i][p][d+1]=0+2*a+4*l+8),o||(e[i][p][d]=0+2*s+4+8*c);return e}},{key:"layeringstep",value:function(t,e){var i=[],n=t.array.length,r=t.array[0].length,o=void 0,s=void 0;for(s=0;s<n;s+=1)for(i[s]=[],o=0;o<r;o+=1)i[s][o]=0;for(s=1;s<n;s+=1)for(o=1;o<r;o+=1)i[s][o]=(t.array[s-1][o-1]===e?1:0)+(t.array[s-1][o]===e?2:0)+(t.array[s][o-1]===e?8:0)+(t.array[s][o]===e?4:0);return i}},{key:"pathscan",value:function(t,e){for(var i=[],n=0,r=0,o=0,s=0,a=t[0].length,c=t.length,l=0,u=!0,h=!1,f=void 0,d=0;d<c;d+=1)for(var p=0;p<a;p+=1)if(4===t[d][p]||11===t[d][p])for(o=p,s=d,i[n]={},i[n].points=[],i[n].boundingbox=[o,s,o,s],i[n].holechildren=[],u=!1,r=0,h=11===t[d][p],l=1;!u;){if(i[n].points[r]={},i[n].points[r].x=o-1,i[n].points[r].y=s-1,i[n].points[r].t=t[s][o],o-1<i[n].boundingbox[0]&&(i[n].boundingbox[0]=o-1),o-1>i[n].boundingbox[2]&&(i[n].boundingbox[2]=o-1),s-1<i[n].boundingbox[1]&&(i[n].boundingbox[1]=s-1),s-1>i[n].boundingbox[3]&&(i[n].boundingbox[3]=s-1),f=this.pathscan_combined_lookup[t[s][o]][l],t[s][o]=f[0],l=f[1],o+=f[2],s+=f[3],o-1===i[n].points[0].x&&s-1===i[n].points[0].y)if(u=!0,i[n].points.length<e)i.pop();else{if(i[n].isholepath=!!h,h){for(var g=0,v=[-1,-1,a+1,c+1],m=0;m<n;m++)!i[m].isholepath&&this.boundingboxincludes(i[m].boundingbox,i[n].boundingbox)&&this.boundingboxincludes(v,i[m].boundingbox)&&(g=m,v=i[m].boundingbox);i[g].holechildren.push(n)}n+=1}r+=1}return i}},{key:"boundingboxincludes",value:function(t,e){return t[0]<e[0]&&t[1]<e[1]&&t[2]>e[2]&&t[3]>e[3]}},{key:"batchpathscan",value:function(t,e){var i=[];for(var n in t)t.hasOwnProperty(n)&&(i[n]=this.pathscan(t[n],e));return i}},{key:"internodes",value:function(t,e){var i=[],n=0,r=0,o=0,s=0,a=0,c=void 0,l=void 0;for(c=0;c<t.length;c+=1)for(i[c]={},i[c].points=[],i[c].boundingbox=t[c].boundingbox,i[c].holechildren=t[c].holechildren,i[c].isholepath=t[c].isholepath,n=t[c].points.length,l=0;l<n;l+=1)r=(l+1)%n,o=(l+2)%n,s=(l-1+n)%n,a=(l-2+n)%n,e.rightangleenhance&&this.testrightangle(t[c],a,s,l,r,o)&&(i[c].points.length>0&&(i[c].points[i[c].points.length-1].linesegment=this.getdirection(i[c].points[i[c].points.length-1].x,i[c].points[i[c].points.length-1].y,t[c].points[l].x,t[c].points[l].y)),i[c].points.push({x:t[c].points[l].x,y:t[c].points[l].y,linesegment:this.getdirection(t[c].points[l].x,t[c].points[l].y,(t[c].points[l].x+t[c].points[r].x)/2,(t[c].points[l].y+t[c].points[r].y)/2)})),i[c].points.push({x:(t[c].points[l].x+t[c].points[r].x)/2,y:(t[c].points[l].y+t[c].points[r].y)/2,linesegment:this.getdirection((t[c].points[l].x+t[c].points[r].x)/2,(t[c].points[l].y+t[c].points[r].y)/2,(t[c].points[r].x+t[c].points[o].x)/2,(t[c].points[r].y+t[c].points[o].y)/2)});return i}},{key:"testrightangle",value:function(t,e,i,n,r,o){return t.points[n].x===t.points[e].x&&t.points[n].x===t.points[i].x&&t.points[n].y===t.points[r].y&&t.points[n].y===t.points[o].y||t.points[n].y===t.points[e].y&&t.points[n].y===t.points[i].y&&t.points[n].x===t.points[r].x&&t.points[n].x===t.points[o].x}},{key:"getdirection",value:function(t,e,i,n){var r=8;return r=t<i?e<n?1:e>n?7:0:t>i?e<n?3:e>n?5:4:e<n?2:e>n?6:8}},{key:"batchinternodes",value:function(t,e){var i=[];for(var n in t)t.hasOwnProperty(n)&&(i[n]=this.internodes(t[n],e));return i}},{key:"tracepath",value:function(t,e,i){var n=0,r=void 0,o=void 0,s=void 0,a={};for(a.segments=[],a.boundingbox=t.boundingbox,a.holechildren=t.holechildren,a.isholepath=t.isholepath;n<t.points.length;){for(r=t.points[n].linesegment,o=-1,s=n+1;(t.points[s].linesegment===r||t.points[s].linesegment===o||o===-1)&&s<t.points.length-1;)t.points[s].linesegment!==r&&o===-1&&(o=t.points[s].linesegment),s+=1;s===t.points.length-1&&(s=0),a.segments=a.segments.concat(this.fitseq(t,e,i,n,s)),n=s>0?s:t.points.length}return a}},{key:"fitseq",value:function(t,e,i,n,r){if(r>t.points.length||r<0)return[];var o=n,s=0,a=!0,c=void 0,l=void 0,u=void 0,h=r-n;h<0&&(h+=t.points.length);for(var f=(t.points[r].x-t.points[n].x)/h,d=(t.points[r].y-t.points[n].y)/h,p=(n+1)%t.points.length,g=void 0;p!=r;)g=p-n,g<0&&(g+=t.points.length),c=t.points[n].x+f*g,l=t.points[n].y+d*g,u=(t.points[p].x-c)*(t.points[p].x-c)+(t.points[p].y-l)*(t.points[p].y-l),
u>e&&(a=!1),u>s&&(o=p,s=u),p=(p+1)%t.points.length;if(a)return[{type:"L",x1:t.points[n].x,y1:t.points[n].y,x2:t.points[r].x,y2:t.points[r].y}];var v=o;a=!0,s=0;var m=(v-n)/h,b=(1-m)*(1-m),y=2*(1-m)*m,_=m*m,x=(b*t.points[n].x+_*t.points[r].x-t.points[v].x)/-y,w=(b*t.points[n].y+_*t.points[r].y-t.points[v].y)/-y;for(p=n+1;p!=r;)m=(p-n)/h,b=(1-m)*(1-m),y=2*(1-m)*m,_=m*m,c=b*t.points[n].x+y*x+_*t.points[r].x,l=b*t.points[n].y+y*w+_*t.points[r].y,u=(t.points[p].x-c)*(t.points[p].x-c)+(t.points[p].y-l)*(t.points[p].y-l),u>i&&(a=!1),u>s&&(o=p,s=u),p=(p+1)%t.points.length;if(a)return[{type:"Q",x1:t.points[n].x,y1:t.points[n].y,x2:x,y2:w,x3:t.points[r].x,y3:t.points[r].y}];var S=v;return this.fitseq(t,e,i,n,S).concat(this.fitseq(t,e,i,S,r))}},{key:"batchtracepaths",value:function(t,e,i){var n=[];for(var r in t)t.hasOwnProperty(r)&&n.push(this.tracepath(t[r],e,i));return n}},{key:"batchtracelayers",value:function(t,e,i){var n=[];for(var r in t)t.hasOwnProperty(r)&&(n[r]=this.batchtracepaths(t[r],e,i));return n}},{key:"roundtodec",value:function(t,e){return Number(t.toFixed(e))}},{key:"svgpathstring",value:function(t,e,i,n){var r=t.layers[e],o=r[i],s="",a=void 0;if(n.linefilter&&o.segments.length<3)return s;if(s="<path "+(n.desc?'desc="l '+e+" p "+i+'" ':"")+this.tosvgcolorstr(t.palette[e],n)+'d="',n.roundcoords===-1){for(s+="M "+o.segments[0].x1*n.scale+" "+o.segments[0].y1*n.scale+" ",a=0;a<o.segments.length;a++)s+=o.segments[a].type+" "+o.segments[a].x2*n.scale+" "+o.segments[a].y2*n.scale+" ",o.segments[a].hasOwnProperty("x3")&&(s+=o.segments[a].x3*n.scale+" "+o.segments[a].y3*n.scale+" ");s+="Z "}else{for(s+="M "+this.roundtodec(o.segments[0].x1*n.scale,n.roundcoords)+" "+this.roundtodec(o.segments[0].y1*n.scale,n.roundcoords)+" ",a=0;a<o.segments.length;a++)s+=o.segments[a].type+" "+this.roundtodec(o.segments[a].x2*n.scale,n.roundcoords)+" "+this.roundtodec(o.segments[a].y2*n.scale,n.roundcoords)+" ",o.segments[a].hasOwnProperty("x3")&&(s+=this.roundtodec(o.segments[a].x3*n.scale,n.roundcoords)+" "+this.roundtodec(o.segments[a].y3*n.scale,n.roundcoords)+" ");s+="Z "}for(var c=0;c<o.holechildren.length;c++){var l=r[o.holechildren[c]];if(n.roundcoords===-1)for(s+=l.segments[l.segments.length-1].hasOwnProperty("x3")?"M "+l.segments[l.segments.length-1].x3*n.scale+" "+l.segments[l.segments.length-1].y3*n.scale+" ":"M "+l.segments[l.segments.length-1].x2*n.scale+" "+l.segments[l.segments.length-1].y2*n.scale+" ",a=l.segments.length-1;a>=0;a--)s+=l.segments[a].type+" ",l.segments[a].hasOwnProperty("x3")&&(s+=l.segments[a].x2*n.scale+" "+l.segments[a].y2*n.scale+" "),s+=l.segments[a].x1*n.scale+" "+l.segments[a].y1*n.scale+" ";else for(s+=l.segments[l.segments.length-1].hasOwnProperty("x3")?"M "+this.roundtodec(l.segments[l.segments.length-1].x3*n.scale)+" "+this.roundtodec(l.segments[l.segments.length-1].y3*n.scale)+" ":"M "+this.roundtodec(l.segments[l.segments.length-1].x2*n.scale)+" "+this.roundtodec(l.segments[l.segments.length-1].y2*n.scale)+" ",a=l.segments.length-1;a>=0;a--)s+=l.segments[a].type+" ",l.segments[a].hasOwnProperty("x3")&&(s+=this.roundtodec(l.segments[a].x2*n.scale)+" "+this.roundtodec(l.segments[a].y2*n.scale)+" "),s+=this.roundtodec(l.segments[a].x1*n.scale)+" "+this.roundtodec(l.segments[a].y1*n.scale)+" ";s+="Z "}if(s+='" />',n.lcpr||n.qcpr){for(a=0;a<o.segments.length;a++)o.segments[a].hasOwnProperty("x3")&&n.qcpr&&(s+='<circle cx="'+o.segments[a].x2*n.scale+'" cy="'+o.segments[a].y2*n.scale+'" r="'+n.qcpr+'" fill="cyan" stroke-width="'+.2*n.qcpr+'" stroke="black" />',s+='<circle cx="'+o.segments[a].x3*n.scale+'" cy="'+o.segments[a].y3*n.scale+'" r="'+n.qcpr+'" fill="white" stroke-width="'+.2*n.qcpr+'" stroke="black" />',s+='<line x1="'+o.segments[a].x1*n.scale+'" y1="'+o.segments[a].y1*n.scale+'" x2="'+o.segments[a].x2*n.scale+'" y2="'+o.segments[a].y2*n.scale+'" stroke-width="'+.2*n.qcpr+'" stroke="cyan" />',s+='<line x1="'+o.segments[a].x2*n.scale+'" y1="'+o.segments[a].y2*n.scale+'" x2="'+o.segments[a].x3*n.scale+'" y2="'+o.segments[a].y3*n.scale+'" stroke-width="'+.2*n.qcpr+'" stroke="cyan" />'),!o.segments[a].hasOwnProperty("x3")&&n.lcpr&&(s+='<circle cx="'+o.segments[a].x2*n.scale+'" cy="'+o.segments[a].y2*n.scale+'" r="'+n.lcpr+'" fill="white" stroke-width="'+.2*n.lcpr+'" stroke="black" />');for(var c=0;c<o.holechildren.length;c++){var l=r[o.holechildren[c]];for(a=0;a<l.segments.length;a++)l.segments[a].hasOwnProperty("x3")&&n.qcpr&&(s+='<circle cx="'+l.segments[a].x2*n.scale+'" cy="'+l.segments[a].y2*n.scale+'" r="'+n.qcpr+'" fill="cyan" stroke-width="'+.2*n.qcpr+'" stroke="black" />',s+='<circle cx="'+l.segments[a].x3*n.scale+'" cy="'+l.segments[a].y3*n.scale+'" r="'+n.qcpr+'" fill="white" stroke-width="'+.2*n.qcpr+'" stroke="black" />',s+='<line x1="'+l.segments[a].x1*n.scale+'" y1="'+l.segments[a].y1*n.scale+'" x2="'+l.segments[a].x2*n.scale+'" y2="'+l.segments[a].y2*n.scale+'" stroke-width="'+.2*n.qcpr+'" stroke="cyan" />',s+='<line x1="'+l.segments[a].x2*n.scale+'" y1="'+l.segments[a].y2*n.scale+'" x2="'+l.segments[a].x3*n.scale+'" y2="'+l.segments[a].y3*n.scale+'" stroke-width="'+.2*n.qcpr+'" stroke="cyan" />'),!l.segments[a].hasOwnProperty("x3")&&n.lcpr&&(s+='<circle cx="'+l.segments[a].x2*n.scale+'" cy="'+l.segments[a].y2*n.scale+'" r="'+n.lcpr+'" fill="white" stroke-width="'+.2*n.lcpr+'" stroke="black" />')}}return s}},{key:"getsvgstring",value:function(t,e){e=this.checkoptions(e);for(var i=t.width*e.scale,n=t.height*e.scale,r="<svg "+(e.viewbox?'viewBox="0 0 '+i+" "+n+'" ':'width="'+i+'" height="'+n+'" ')+'version="1.1" xmlns="http://www.w3.org/2000/svg" desc="Created with imagetracer.js version '+this.versionnumber+'" >',o=0;o<t.layers.length;o+=1)for(var s=0;s<t.layers[o].length;s+=1)t.layers[o][s].isholepath||(r+=this.svgpathstring(t,o,s,e));return r+="</svg>"}},{key:"compareNumbers",value:function(t,e){return t-e}},{key:"torgbastr",value:function(t){return"rgba("+t.r+","+t.g+","+t.b+","+t.a+")"}},{key:"tosvgcolorstr",value:function(t,e){return'fill="rgb('+t.r+","+t.g+","+t.b+')" stroke="rgb('+t.r+","+t.g+","+t.b+')" stroke-width="'+e.strokewidth+'" opacity="'+t.a/255+'" '}},{key:"appendSVGString",value:function(t,e){var i=void 0;e?(i=document.getElementById(e),i||(i=document.createElement("div"),i.id=e,document.body.appendChild(i))):(i=document.createElement("div"),document.body.appendChild(i)),i.innerHTML+=t}},{key:"blur",value:function(t,e,i){var n=void 0,r=void 0,o=void 0,s=void 0,a=void 0,c=void 0,l=void 0,u=void 0,h=void 0,f=void 0,d={width:t.width,height:t.height,data:[]};if(e=Math.floor(e),e<1)return t;e>5&&(e=5),i=Math.abs(i),i>1024&&(i=1024);var p=this.gks[e-1];for(r=0;r<t.height;r++)for(n=0;n<t.width;n++){for(c=0,l=0,u=0,h=0,f=0,o=-e;o<e+1;o++)n+o>0&&n+o<t.width&&(a=4*(r*t.width+n+o),c+=t.data[a]*p[o+e],l+=t.data[a+1]*p[o+e],u+=t.data[a+2]*p[o+e],h+=t.data[a+3]*p[o+e],f+=p[o+e]);a=4*(r*t.width+n),d.data[a]=Math.floor(c/f),d.data[a+1]=Math.floor(l/f),d.data[a+2]=Math.floor(u/f),d.data[a+3]=Math.floor(h/f)}var g=new Uint8ClampedArray(d.data);for(r=0;r<t.height;r++)for(n=0;n<t.width;n++){for(c=0,l=0,u=0,h=0,f=0,o=-e;o<e+1;o++)r+o>0&&r+o<t.height&&(a=4*((r+o)*t.width+n),c+=g[a]*p[o+e],l+=g[a+1]*p[o+e],u+=g[a+2]*p[o+e],h+=g[a+3]*p[o+e],f+=p[o+e]);a=4*(r*t.width+n),d.data[a]=Math.floor(c/f),d.data[a+1]=Math.floor(l/f),d.data[a+2]=Math.floor(u/f),d.data[a+3]=Math.floor(h/f)}for(r=0;r<t.height;r++)for(n=0;n<t.width;n++)a=4*(r*t.width+n),s=Math.abs(d.data[a]-t.data[a])+Math.abs(d.data[a+1]-t.data[a+1])+Math.abs(d.data[a+2]-t.data[a+2])+Math.abs(d.data[a+3]-t.data[a+3]),s>i&&(d.data[a]=t.data[a],d.data[a+1]=t.data[a+1],d.data[a+2]=t.data[a+2],d.data[a+3]=t.data[a+3]);return d}},{key:"loadImage",value:function(t,e,i){var n=new Image;i&&i.corsenabled&&(n.crossOrigin="Anonymous"),n.src=t,n.onload=function(){var t=document.createElement("canvas");t.width=n.width,t.height=n.height;var i=t.getContext("2d");i.drawImage(n,0,0),e(t)}}},{key:"getImgdata",value:function(t){var e=t.getContext("2d");return e.getImageData(0,0,t.width,t.height)}},{key:"drawLayers",value:function(t,e,i,n){i=i||1;var r=void 0,o=void 0,s=void 0,a=void 0,c=void 0,l=void 0;n?(l=document.getElementById(n),l||(l=document.createElement("div"),l.id=n,document.body.appendChild(l))):(l=document.createElement("div"),document.body.appendChild(l));for(c in t)if(t.hasOwnProperty(c)){r=t[c][0].length,o=t[c].length;var u=document.createElement("canvas");u.width=r*i,u.height=o*i;var h=u.getContext("2d");for(a=0;a<o;a+=1)for(s=0;s<r;s+=1)h.fillStyle=this.torgbastr(e[t[c][a][s]%e.length]),h.fillRect(s*i,a*i,i,i);l.appendChild(u)}}}]),t}();e.default=r},function(t,e){"use strict";function i(t){var e=t.getOriginX(),i=t.getOriginY(),n=e.substring(0,1)+i.substring(0,1);t.startPoint=t.origins[n]}function n(t,e,i){var n=t.x,r=t.y,o=e.x,s=e.y,a=i*Math.PI/180,c=(o-n)*Math.cos(a)-(s-r)*Math.sin(a)+n,l=(o-n)*Math.sin(a)+(s-r)*Math.cos(a)+r;return{originX:n>c?"right":"left",originY:r>l?"bottom":"top"}}function r(t){return"center"===t.getOriginX()&&"center"===t.getOriginY()}function o(t,e){var i=e.getPointByOrigin("center","center"),r=-e.getAngle(),o=n(i,t,r),s=o.originX,a=o.originY,c=e.getPointByOrigin(s,a),l=e.getLeft()-(i.x-c.x),u=e.getTop()-(i.x-c.y);e.set({originX:s,originY:a,left:l,top:u}),e.setCoords()}function s(t,e){var i=e.startPoint,r=-e.getAngle(),o=n(i,t,r),s=o.originX,a=o.originY;e.setPositionByOrigin(i,s,a)}function a(t){var e=t.type,i=t.scaleX,n=t.scaleY,r=u[e],o=t[r.w]*i,s=t[r.h]*n;if(t.isRegular){var a=Math.max(i,n);o=t[r.w]*a,s=t[r.h]*a}var c={hasControls:!1,hasBorders:!1,scaleX:1,scaleY:1};c[r.w]=o,c[r.h]=s,t.set(c)}function c(t,e){var i=e.type,n=e.strokeWidth,r=e.startPoint,o=l[i],s=u[i],a=!("triangle"!==e.type),c={},h=Math.abs(r.x-t.x)/o,f=Math.abs(r.y-t.y)/o;h>n&&(h-=n/o),f>n&&(f-=n/o),e.isRegular&&(h=f=Math.max(h,f),a&&(f=Math.sqrt(3)/2*h)),c[s.w]=h,c[s.h]=f,e.set(c)}var l={rect:1,circle:2,triangle:1},u={rect:{w:"width",h:"height"},circle:{w:"rx",h:"ry"},triangle:{w:"width",h:"height"}};t.exports={setOrigins:function(t){var e=t.getPointByOrigin("left","top"),i=t.getPointByOrigin("right","top"),n=t.getPointByOrigin("right","bottom"),r=t.getPointByOrigin("left","bottom");t.origins={lt:e,rt:i,rb:n,lb:r}},resize:function(t,e,n){r(t)&&(o(e,t),i(t)),n?a(t,e):c(e,t),s(e,t)},adjustOriginToCenter:function(t){var e=t.getPointByOrigin("center","center"),i=t.getOriginX(),n=t.getOriginY(),r=t.getPointByOrigin(i,n),o=t.getLeft()+(e.x-r.x),s=t.getTop()+(e.y-r.y);t.set({hasControls:!0,hasBorders:!0,originX:"center",originY:"center",left:o,top:s}),t.setCoords()}}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(4),a=n(s),c=i(2),l=n(c),u=i(113),h=n(u),f=i(115),d=n(f),p=i(65),g=n(p),v=i(3),m=n(v),b=i(108),y=n(b),_=i(1),x=n(_),w=i(5),S=x.default.eventNames,C=x.default.commandNames,k=x.default.keyCodes,O=x.default.rejectMessages,T=a.default.isUndefined,E=a.default.forEach,j=a.default.CustomEvents,M=function(){function t(e,i){r(this,t),i=a.default.extend({includeUI:!1,usageStatistics:!0},i),this.mode=null,this.activeObjectId=null,this.preventBackspaceDel="undefined"!=typeof i.preventBackspaceDel&&i.preventBackspaceDel,i.includeUI&&(this.ui=new d.default(e,i.includeUI,this.getActions()),i=this.ui.setUiDefaultSelectionStyle(i)),this._invoker=new h.default,this._graphics=new y.default(this.ui?this.ui.getEditorArea():e,{cssMaxWidth:i.cssMaxWidth,cssMaxHeight:i.cssMaxHeight,useItext:!!this.ui,useDragAddIcon:!!this.ui,noSelector:i.noSelector||!1}),this._handlers={keydown:this._onKeyDown.bind(this),mousedown:this._onMouseDown.bind(this),objectActivated:this._onObjectActivated.bind(this),objectMoved:this._onObjectMoved.bind(this),objectScaled:this._onObjectScaled.bind(this),addText:this._onAddText.bind(this),addObject:this._onAddObject.bind(this),addObjectAfter:this._onAddObjectAfter.bind(this),textEditing:this._onTextEditing.bind(this),textChanged:this._onTextChanged.bind(this),iconCreateResize:this._onIconCreateResize.bind(this),iconCreateEnd:this._onIconCreateEnd.bind(this),selectionCleared:this._selectionCleared.bind(this),selectionCreated:this._selectionCreated.bind(this),objectRotateFix:this._onObjectRotateFix.bind(this),objectRemove:this._onObjectRemove.bind(this)},this._attachInvokerEvents(),this._attachGraphicsEvents(),this._attachDomEvents(),this._setSelectionStyle(i.selectionStyle,{applyCropSelectionStyle:i.applyCropSelectionStyle,applyGroupSelectionStyle:i.applyGroupSelectionStyle}),i.usageStatistics&&(0,w.sendHostName)(),this.ui&&(this.ui.initCanvas(),this.setReAction())}return o(t,[{key:"_setSelectionStyle",value:function(t,e){var i=e.applyCropSelectionStyle,n=e.applyGroupSelectionStyle;t&&this._graphics.setSelectionStyle(t),i&&this._graphics.setCropSelectionStyle(t),n&&this.on("selectionCreated",function(e){"group"===e.type&&e.set(t)})}},{key:"_attachInvokerEvents",value:function(){var t=S.UNDO_STACK_CHANGED,e=S.REDO_STACK_CHANGED;this._invoker.on(t,this.fire.bind(this,t)),this._invoker.on(e,this.fire.bind(this,e))}},{key:"_attachGraphicsEvents",value:function(){this._graphics.on({mousedown:this._handlers.mousedown,objectMoved:this._handlers.objectMoved,objectScaled:this._handlers.objectScaled,objectActivated:this._handlers.objectActivated,addText:this._handlers.addText,addObject:this._handlers.addObject,textEditing:this._handlers.textEditing,textChanged:this._handlers.textChanged,iconCreateResize:this._handlers.iconCreateResize,iconCreateEnd:this._handlers.iconCreateEnd,selectionCleared:this._handlers.selectionCleared,selectionCreated:this._handlers.selectionCreated,addObjectAfter:this._handlers.addObjectAfter,objectRotateFix:this._handlers.objectRotateFix,objectRemove:this._handlers.objectRemove})}},{key:"_attachDomEvents",value:function(){document.addEventListener("keydown",this._handlers.keydown)}},{key:"_detachDomEvents",value:function(){document.removeEventListener("keydown",this._handlers.keydown)}},{key:"_onKeyDown",value:function(t){var e=this._graphics.getActiveObject(),i=this._graphics.getActiveGroupObject(),n=e||i;(t.ctrlKey||t.metaKey)&&t.keyCode===k.Z&&this.undo().catch(function(){}),(t.ctrlKey||t.metaKey)&&t.keyCode===k.Y&&this.redo().catch(function(){}),this.preventBackspaceDel||t.keyCode!==k.BACKSPACE&&t.keyCode!==k.DEL||!n||(t.preventDefault(),this.removeActiveObject())}},{key:"removeActiveObject",value:function(){var t=this._graphics.getActiveObject(),e=this._graphics.getActiveGroupObject();if(e){var i=e.getObjects();this.discardSelection(),this._removeObjectStream(i)}else if(t){var n=this._graphics.getObjectId(t);this.removeObject(n)}}},{key:"_removeObjectStream",value:function(t){var e=this;if(!t.length)return!0;var i=t.pop();return this.removeObject(this._graphics.getObjectId(i)).then(function(){return e._removeObjectStream(t)})}},{key:"_onMouseDown",value:function(t,e){this.fire(S.MOUSE_DOWN,t,e)}},{key:"_pushAddObjectCommand",value:function(t){var e=m.default.create(C.ADD_OBJECT,this._graphics,t);this._invoker.pushUndoStack(e)}},{key:"_onObjectActivated",value:function(t){this.fire(S.OBJECT_ACTIVATED,t)}},{key:"_onObjectMoved",value:function(t){this.fire(S.OBJECT_MOVED,t)}},{key:"_onObjectRotateFix",value:function(t){this.fire(S.OBJECT_ROTATE_FIX,t)}},{key:"_onObjectRemove",value:function(t){this.fire(S.OBJECT_REMOVE,t)}},{key:"_onObjectScaled",value:function(t){this.fire(S.OBJECT_SCALED,t)}},{key:"getDrawingMode",value:function(){return this._graphics.getDrawingMode()}},{key:"clearObjects",value:function(){return this.execute(C.CLEAR_OBJECTS)}},{key:"deactivateAll",value:function(){this._graphics.deactivateAll(),this._graphics.renderAll()}},{key:"discardSelection",value:function(){this._graphics.discardSelection()}},{key:"changeSelectableAll",value:function(t){this._graphics.changeSelectableAll(t)}},{key:"execute",value:function(t){for(var e,i=arguments.length,n=Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];var o=[this._graphics].concat(n);return(e=this._invoker).execute.apply(e,[t].concat(o))}},{key:"undo",value:function(){return this._invoker.undo()}},{key:"redo",value:function(){return this._invoker.redo()}},{key:"loadImageFromFile",value:function(t,e){if(!t)return l.default.reject(O.invalidParameters);var i=URL.createObjectURL(t);return e=e||t.name,this.loadImageFromURL(i,e).then(function(e){return URL.revokeObjectURL(t),e})}},{key:"loadImageFromURL",value:function(t,e){return e&&t?this.execute(C.LOAD_IMAGE,e,t):l.default.reject(O.invalidParameters)}},{key:"addImageObject",value:function(t){return t?this.execute(C.ADD_IMAGE_OBJECT,t):l.default.reject(O.invalidParameters)}},{key:"startDrawingMode",value:function(t,e){return this._graphics.startDrawingMode(t,e)}},{key:"stopDrawingMode",value:function(){this._graphics.stopDrawingMode()}},{key:"crop",value:function(t){var e=this._graphics.getCroppedImageData(t);return e?this.loadImageFromURL(e.url,e.imageName):l.default.reject(O.invalidParameters)}},{key:"getCropzoneRect",value:function(){return this._graphics.getCropzoneRect()}},{key:"_flip",value:function(t){return this.execute(C.FLIP_IMAGE,t)}},{key:"flipX",value:function(){return this._flip("flipX")}},{key:"flipY",value:function(){return this._flip("flipY")}},{key:"resetFlip",value:function(){return this._flip("reset")}},{key:"_rotate",value:function(t,e){return this.execute(C.ROTATE_IMAGE,t,e)}},{key:"rotate",value:function(t){return this._rotate("rotate",t)}},{key:"setAngle",value:function(t){return this._rotate("setAngle",t)}},{key:"setBrush",value:function(t){this._graphics.setBrush(t)}},{key:"setDrawingShape",value:function(t,e){this._graphics.setDrawingShape(t,e)}},{key:"addShape",value:function(t,e){return e=e||{},this._setPositions(e),this.execute(C.ADD_SHAPE,t,e)}},{key:"changeShape",value:function(t,e){return this.execute(C.CHANGE_SHAPE,t,e)}},{key:"addText",value:function(t,e){return t=t||"",e=e||{},this.execute(C.ADD_TEXT,t,e)}},{key:"addTexts",value:function(t){return this.execute(C.ADD_TEXTS,t)}},{key:"changeText",value:function(t,e){return e=e||"",this.execute(C.CHANGE_TEXT,t,e)}},{key:"changeTextStyle",value:function(t,e,i){return this.execute(C.CHANGE_TEXT_STYLE,t,e,i)}},{key:"_changeActivateMode",value:function(t){"ICON"!==t&&this.getDrawingMode()!==t&&this.startDrawingMode(t)}},{key:"_onTextChanged",value:function(t){this.changeText(t.id,t.text)}},{key:"_onIconCreateResize",value:function(t){this.fire(S.ICON_CREATE_RESIZE,t)}},{key:"_onIconCreateEnd",value:function(t){this.fire(S.ICON_CREATE_END,t)}},{key:"_onTextEditing",value:function(t){this.fire(S.TEXT_EDITING,t)}},{key:"_onAddText",value:function(t){this.fire(S.ADD_TEXT,{originPosition:t.originPosition,clientPosition:t.clientPosition})}},{key:"_onAddObject",value:function(t){var e=this._graphics.getObject(t.id);this._pushAddObjectCommand(e)}},{key:"_onAddObjectAfter",value:function(t){this.fire(S.ADD_OBJECT_AFTER,t)}},{key:"_selectionCleared",value:function(){this.fire(S.SELECTION_CLEARED)}},{key:"_selectionCreated",value:function(t){this.fire(S.SELECTION_CREATED,t)}},{key:"registerIcons",value:function(t){this._graphics.registerPaths(t)}},{key:"changeCursor",value:function(t){this._graphics.changeCursor(t)}},{key:"addIcon",value:function(t,e){return e=e||{},this._setPositions(e),this.execute(C.ADD_ICON,t,e)}},{key:"changeIconColor",value:function(t,e){return this.execute(C.CHANGE_ICON_COLOR,t,e)}},{key:"removeObject",value:function(t){return this.execute(C.REMOVE_OBJECT,t)}},{key:"hasFilter",value:function(t){return this._graphics.hasFilter(t)}},{key:"removeFilter",value:function(t){return this.execute(C.REMOVE_FILTER,t)}},{key:"applyFilter",value:function(t,e){return this.execute(C.APPLY_FILTER,t,e)}},{key:"toDataURL",value:function(t){return this._graphics.toDataURL(t)}},{key:"getImageName",value:function(){return this._graphics.getImageName()}},{key:"clearUndoStack",value:function(){this._invoker.clearUndoStack()}},{key:"clearRedoStack",value:function(){this._invoker.clearRedoStack()}},{key:"isEmptyUndoStack",value:function(){return this._invoker.isEmptyUndoStack()}},{key:"isEmptyRedoStack",value:function(){return this._invoker.isEmptyRedoStack()}},{key:"resizeCanvasDimension",value:function(t){return t?this.execute(C.RESIZE_CANVAS_DIMENSION,t):l.default.reject(O.invalidParameters)}},{key:"destroy",value:function(){var t=this;this.stopDrawingMode(),this._detachDomEvents(),this._graphics.destroy(),this._graphics=null,E(this,function(e,i){t[i]=null},this)}},{key:"_setPositions",value:function(t){var e=this._graphics.getCenter();T(t.left)&&(t.left=e.left),T(t.top)&&(t.top=e.top)}},{key:"setObjectProperties",value:function(t,e){return this.execute(C.SET_OBJECT_PROPERTIES,t,e)}},{key:"setObjectPropertiesQuietly",value:function(t,e){this._graphics.setObjectProperties(t,e)}},{key:"getObjectProperties",value:function(t,e){var i=this._graphics.getObject(t);return i?this._graphics.getObjectProperties(t,e):null}},{key:"getCanvasSize",value:function(){return this._graphics.getCanvasSize()}},{key:"getObjectPosition",value:function(t,e,i){return this._graphics.getObjectPosition(t,e,i)}},{key:"setObjectPosition",value:function(t,e){return this.execute(C.SET_OBJECT_POSITION,t,e)}},{key:"setObjectPositions",value:function(t){return this.execute(C.SET_OBJECT_POSITIONS,t)}}]),t}();g.default.mixin(M),j.mixin(M),t.exports=M},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(39),a=n(s),c=a.default.create,l=a.default.types,u=function(){function t(e,i){r(this,t),this.name=e.name,this.args=i,this.execute=e.execute,this.undo=e.undo,this.executeCallback=e.executeCallback||null,this.undoCallback=e.undoCallback||null,this.undoData={}}return o(t,[{key:"execute",value:function(){throw new Error(c(l.UN_IMPLEMENTATION,"execute"))}},{key:"undo",value:function(){throw new Error(c(l.UN_IMPLEMENTATION,"undo"))}},{key:"setExecuteCallback",value:function(t){return this.executeCallback=t,this}},{key:"setUndoCallback",value:function(t){return this.undoCallback=t,this}}]),t}();t.exports=u},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(4),a=n(s),c=i(2),l=n(c),u=i(3),h=n(u),f=i(1),d=n(f),p=d.default.eventNames,g=d.default.rejectMessages,v=a.default.isFunction,m=a.default.isString,b=a.default.CustomEvents,y=function(){function t(){r(this,t),this._undoStack=[],this._redoStack=[],this._isLocked=!1}return o(t,[{key:"_invokeExecution",value:function(t){var e=this;this.lock();var i=t.args;return i||(i=[]),t.execute.apply(t,i).then(function(i){return e.pushUndoStack(t),e.unlock(),v(t.executeCallback)&&t.executeCallback(i),i}).catch(function(t){return e.unlock(),l.default.reject(t)})}},{key:"_invokeUndo",value:function(t){var e=this;this.lock();var i=t.args;return i||(i=[]),t.undo.apply(t,i).then(function(i){return e.pushRedoStack(t),e.unlock(),v(t.undoCallback)&&t.undoCallback(i),i}).catch(function(t){return e.unlock(),l.default.reject(t)})}},{key:"_fireRedoStackChanged",value:function(){this.fire(p.REDO_STACK_CHANGED,this._redoStack.length)}},{key:"_fireUndoStackChanged",value:function(){this.fire(p.UNDO_STACK_CHANGED,this._undoStack.length)}},{key:"lock",value:function(){this._isLocked=!0}},{key:"unlock",value:function(){this._isLocked=!1}},{key:"execute",value:function(){var t=this;if(this._isLocked)return l.default.reject(g.isLock);for(var e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=i[0];return m(r)&&(r=h.default.create.apply(h.default,i)),this._invokeExecution(r).then(function(e){return t.clearRedoStack(),e})}},{key:"undo",value:function(){var t=this._undoStack.pop(),e=void 0,i="";return t&&this._isLocked&&(this.pushUndoStack(t,!0),t=null),t?(this.isEmptyUndoStack()&&this._fireUndoStackChanged(),e=this._invokeUndo(t)):(i=g.undo,this._isLocked&&(i=i+" Because "+g.isLock),e=l.default.reject(i)),e}},{key:"redo",value:function(){var t=this._redoStack.pop(),e=void 0,i="";return t&&this._isLocked&&(this.pushRedoStack(t,!0),t=null),t?(this.isEmptyRedoStack()&&this._fireRedoStackChanged(),e=this._invokeExecution(t)):(i=g.redo,this._isLocked&&(i=i+" Because "+g.isLock),e=l.default.reject(i)),e}},{key:"pushUndoStack",value:function(t,e){this._undoStack.push(t),e||this._fireUndoStackChanged()}},{key:"pushRedoStack",value:function(t,e){this._redoStack.push(t),e||this._fireRedoStackChanged()}},{key:"isEmptyRedoStack",value:function(){return 0===this._redoStack.length}},{key:"isEmptyUndoStack",value:function(){return 0===this._undoStack.length}},{key:"clearUndoStack",value:function(){this.isEmptyUndoStack()||(this._undoStack=[],this._fireUndoStackChanged())}},{key:"clearRedoStack",value:function(){this.isEmptyRedoStack()||(this._redoStack=[],this._fireRedoStackChanged())}}]),t}();b.mixin(y),t.exports=y},function(t,e){"use strict";Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Element.prototype.closest||(Element.prototype.closest=function(t){var e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}),/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
"document"in window.self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||!function(t){if("Element"in t){var e="classList",i="prototype",n=t.Element[i],r=Object,o=String[i].trim||function(){return this.replace(/^\s+|\s+$/g,"")},s=Array[i].indexOf||function(t){for(var e=0,i=this.length;e<i;e++)if(e in this&&this[e]===t)return e;return-1},a=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},c=function(t,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return s.call(t,e)},l=function(t){for(var e=o.call(t.getAttribute("class")||""),i=e?e.split(/\s+/):[],n=0,r=i.length;n<r;n++)this.push(i[n]);this._updateClassName=function(){t.setAttribute("class",this.toString())}},u=l[i]=[],h=function(){return new l(this)};if(a[i]=Error[i],u.item=function(t){return this[t]||null},u.contains=function(t){return t+="",c(this,t)!==-1},u.add=function(){var t,e=arguments,i=0,n=e.length,r=!1;do t=e[i]+"",c(this,t)===-1&&(this.push(t),r=!0);while(++i<n);r&&this._updateClassName()},u.remove=function(){var t,e,i=arguments,n=0,r=i.length,o=!1;do for(t=i[n]+"",e=c(this,t);e!==-1;)this.splice(e,1),o=!0,e=c(this,t);while(++n<r);o&&this._updateClassName()},u.toggle=function(t,e){t+="";var i=this.contains(t),n=i?e!==!0&&"remove":e!==!1&&"add";return n&&this[n](t),e===!0||e===!1?e:!i},u.toString=function(){return this.join(" ")},r.defineProperty){var f={get:h,enumerable:!0,configurable:!0};try{r.defineProperty(n,e,f)}catch(t){void 0!==t.number&&t.number!==-2146823252||(f.enumerable=!1,r.defineProperty(n,e,f))}}else r[i].__defineGetter__&&n.__defineGetter__(e,h)}}(window.self),function(){var t=document.createElement("_");if(t.classList.add("c1","c2"),!t.classList.contains("c2")){var e=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var i,n=arguments.length;for(i=0;i<n;i++)t=arguments[i],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:i.call(this,t)}}t=null}()),/*!
	 * @copyright Copyright (c) 2017 IcoMoon.io
	 * @license   Licensed under MIT license
	 *            See https://github.com/Keyamoon/svgxuse
	 * @version   1.2.6
	 */
function(){if("undefined"!=typeof window&&window.addEventListener){var t,e,i=Object.create(null),n=function(){clearTimeout(e),e=setTimeout(t,100)},r=function(){},o=function(){var t;window.addEventListener("resize",n,!1),window.addEventListener("orientationchange",n,!1),window.MutationObserver?(t=new MutationObserver(n),t.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),r=function(){try{t.disconnect(),window.removeEventListener("resize",n,!1),window.removeEventListener("orientationchange",n,!1)}catch(t){}}):(document.documentElement.addEventListener("DOMSubtreeModified",n,!1),r=function(){document.documentElement.removeEventListener("DOMSubtreeModified",n,!1),window.removeEventListener("resize",n,!1),window.removeEventListener("orientationchange",n,!1)})},s=function(t){function e(t){var e;return void 0!==t.protocol?e=t:(e=document.createElement("a"),e.href=t),e.protocol.replace(/:/g,"")+e.host}var i,n,r;return window.XMLHttpRequest&&(i=new XMLHttpRequest,n=e(location),r=e(t),i=void 0===i.withCredentials&&""!==r&&r!==n?XDomainRequest||void 0:XMLHttpRequest),i},a="http://www.w3.org/1999/xlink";t=function(){function t(){_-=1,0===_&&(r(),o())}function e(t){return function(){i[t.base]!==!0&&(t.useEl.setAttributeNS(a,"xlink:href","#"+t.hash),t.useEl.hasAttribute("href")&&t.useEl.setAttribute("href","#"+t.hash))}}function n(e){return function(){var i,n=document.body,r=document.createElement("x");e.onload=null,r.innerHTML=e.responseText,i=r.getElementsByTagName("svg")[0],i&&(i.setAttribute("aria-hidden","true"),i.style.position="absolute",i.style.width=0,i.style.height=0,i.style.overflow="hidden",n.insertBefore(i,n.firstChild)),t()}}function c(e){return function(){e.onerror=null,e.ontimeout=null,t()}}var l,u,h,f,d,p,g,v,m,b,y="",_=0;for(r(),m=document.getElementsByTagName("use"),d=0;d<m.length;d+=1){try{u=m[d].getBoundingClientRect()}catch(t){u=!1}f=m[d].getAttribute("href")||m[d].getAttributeNS(a,"href")||m[d].getAttribute("xlink:href"),v=f&&f.split?f.split("#"):["",""],l=v[0],h=v[1],p=u&&0===u.left&&0===u.right&&0===u.top&&0===u.bottom,u&&0===u.width&&0===u.height&&!p?(y&&!l.length&&h&&!document.getElementById(h)&&(l=y),m[d].hasAttribute("href")&&m[d].setAttributeNS(a,"xlink:href",f),l.length&&(b=i[l],b!==!0&&setTimeout(e({useEl:m[d],base:l,hash:h}),0),void 0===b&&(g=s(l),void 0!==g&&(b=new g,i[l]=b,b.onload=n(b),b.onerror=c(b),b.ontimeout=c(b),b.open("GET",l),b.send(),_+=1)))):p?l.length&&i[l]&&setTimeout(e({useEl:m[d],base:l,hash:h}),0):void 0===i[l]?i[l]=!0:i[l].onload&&(i[l].abort(),delete i[l].onload,i[l]=!0)}m="",_+=1,t()};var c;c=function(){window.removeEventListener("load",c,!1),e=setTimeout(t,0)},"complete"!==document.readyState?window.addEventListener("load",c,!1):c()}}()},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(4),a=n(s),c=i(5),l=n(c),u=i(125),h=n(u),f=i(124),d=n(f),p=i(138),g=n(p),v=i(123),m=n(v),b=i(116),y=n(b),_=i(119),x=n(_),w=i(122),S=n(w),C=i(136),k=n(C),O=i(121),T=n(O),E=i(120),j=n(E),M=i(117),A=n(M),P=i(118),I=n(P),D={Shape:m.default,Crop:y.default,Flip:x.default,Rotate:S.default,Text:k.default,Mask:T.default,Icon:j.default,Draw:A.default,Filter:I.default},L="1300",R=function(){function t(e,i,n){r(this,t),this.options=this._initializeOption(i),this._actions=n,this.submenu=!1,this.imageSize={},this.uiSize={},this.theme=new g.default(this.options.theme),this._submenuChangeTransection=!1,this._selectedElement=null,this._mainElement=null,this._editorElementWrap=null,this._editorElement=null,this._menuElement=null,this._subMenuElement=null,this._makeUiElement(e),this._setUiSize(),this._els={undo:this._menuElement.querySelector("#tie-btn-undo"),redo:this._menuElement.querySelector("#tie-btn-redo"),reset:this._menuElement.querySelector("#tie-btn-reset"),delete:this._menuElement.querySelector("#tie-btn-delete"),deleteAll:this._menuElement.querySelector("#tie-btn-delete-all"),download:this._selectedElement.querySelectorAll(".tui-image-editor-download-btn"),load:this._selectedElement.querySelectorAll(".tui-image-editor-load-btn")},this._makeSubMenu()}return o(t,[{key:"setUiDefaultSelectionStyle",value:function(t){return a.default.extend({applyCropSelectionStyle:!0,applyGroupSelectionStyle:!0,selectionStyle:{cornerStyle:"circle",cornerSize:16,cornerColor:"#fff",cornerStrokeColor:"#fff",transparentCorners:!1,lineWidth:2,borderColor:"#fff"}},t)}},{key:"resizeEditor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.uiSize,i=t.imageSize,n=void 0===i?this.imageSize:i;n!==this.imageSize&&(this.imageSize=n),e&&this._setUiSize(e);var r=this._getEditorDimension(),o=r.width,s=r.height,a=this._editorElement.style,c=this.options.menuBarPosition;a.height=s+"px",a.width=o+"px",this._setEditorPosition(c),this._editorElementWrap.style.bottom="0px",this._editorElementWrap.style.top="0px",this._editorElementWrap.style.left="0px",this._editorElementWrap.style.width="100%";var l=this._selectedElement.classList;"top"===c&&this._selectedElement.offsetWidth<L?l.add("tui-image-editor-top-optimization"):l.remove("tui-image-editor-top-optimization")}},{key:"changeUndoButtonStatus",value:function(t){t?this._els.undo.classList.add("enabled"):this._els.undo.classList.remove("enabled")}},{key:"changeRedoButtonStatus",value:function(t){t?this._els.redo.classList.add("enabled"):this._els.redo.classList.remove("enabled")}},{key:"changeResetButtonStatus",value:function(t){t?this._els.reset.classList.add("enabled"):this._els.reset.classList.remove("enabled")}},{key:"changeDeleteAllButtonEnabled",value:function(t){t?this._els.deleteAll.classList.add("enabled"):this._els.deleteAll.classList.remove("enabled")}},{key:"changeDeleteButtonEnabled",value:function(t){t?this._els.delete.classList.add("enabled"):this._els.delete.classList.remove("enabled")}},{key:"_initializeOption",value:function(t){return a.default.extend({loadImage:{path:"",name:""},menuIconPath:"",menu:["crop","flip","rotate","draw","shape","icon","text","mask","filter"],initMenu:!1,uiSize:{width:"100%",height:"100%"},menuBarPosition:"bottom"},t)}},{key:"_setUiSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.uiSize,e=this._selectedElement.style;e.width=t.width,e.height=t.height}},{key:"_makeSubMenu",value:function(){var t=this;a.default.forEach(this.options.menu,function(e){var i=D[e.replace(/^[a-z]/,function(t){return t.toUpperCase()})];t._makeMenuElement(e),t._els[e]=t._menuElement.querySelector("#tie-btn-"+e),t[e]=new i(t._subMenuElement,{iconStyle:t.theme.getStyle("submenu.icon"),menuBarPosition:t.options.menuBarPosition})})}},{key:"_makeUiElement",value:function(t){var e=void 0;window.snippet=a.default,e=t.jquery?t[0]:t.nodeType?t:document.querySelector(t);var i=l.default.getSelector(e);e.classList.add("tui-image-editor-container"),e.innerHTML=(0,d.default)({biImage:this.theme.getStyle("common.bi"),iconStyle:this.theme.getStyle("menu.icon"),loadButtonStyle:this.theme.getStyle("loadButton"),downloadButtonStyle:this.theme.getStyle("downloadButton")})+(0,h.default)({biImage:this.theme.getStyle("common.bi"),commonStyle:this.theme.getStyle("common"),headerStyle:this.theme.getStyle("header"),loadButtonStyle:this.theme.getStyle("loadButton"),downloadButtonStyle:this.theme.getStyle("downloadButton"),submenuStyle:this.theme.getStyle("submenu")}),this._selectedElement=e,this._selectedElement.classList.add(this.options.menuBarPosition),this._mainElement=i(".tui-image-editor-main"),this._editorElementWrap=i(".tui-image-editor-wrap"),this._editorElement=i(".tui-image-editor"),this._menuElement=i(".tui-image-editor-menu"),this._subMenuElement=i(".tui-image-editor-submenu")}},{key:"_makeMenuElement",value:function(t){var e=document.createElement("li"),i=this.theme.getStyle("menu.icon"),n=i.normal,r=i.active,o=i.hover,s='\n            <svg class="svg_ic-menu">\n                <use xlink:href="'+n.path+"#"+n.name+"-ic-"+t+'" class="normal"/>\n                <use xlink:href="'+r.path+"#"+r.name+"-ic-"+t+'" class="active"/>\n                <use xlink:href="'+o.path+"#"+o.name+"-ic-"+t+'" class="hover"/>\n            </svg>\n        ';e.id="tie-btn-"+t,e.className="tui-image-editor-item normal",e.title=t.replace(/^[a-z]/g,function(t){return t.toUpperCase()}),e.innerHTML=s,this._menuElement.appendChild(e)}},{key:"_addHelpActionEvent",value:function(t){var e=this;this._els[t].addEventListener("click",function(){e._actions.main[t]()})}},{key:"_addDownloadEvent",value:function(){var t=this;a.default.forEach(this._els.download,function(e){e.addEventListener("click",function(){t._actions.main.download()})})}},{key:"_addLoadEvent",value:function(){var t=this;a.default.forEach(this._els.load,function(e){e.addEventListener("change",function(e){t._actions.main.load(e.target.files[0])})})}},{key:"_addMenuEvent",value:function(t){var e=this;this._els[t].addEventListener("click",function(){e.changeMenu(t)})}},{key:"_addSubMenuEvent",value:function(t){this[t].addEvent(this._actions[t])}},{key:"getEditorArea",value:function(){return this._editorElement}},{key:"initCanvas",value:function(){var t=this,e=this._getLoadImage();e&&this._actions.main.initLoadImage(e.path,e.name).then(function(){t._addHelpActionEvent("undo"),t._addHelpActionEvent("redo"),t._addHelpActionEvent("reset"),t._addHelpActionEvent("delete"),t._addHelpActionEvent("deleteAll"),t._addDownloadEvent(),t._addLoadEvent(),a.default.forEach(t.options.menu,function(e){t._addMenuEvent(e),t._addSubMenuEvent(e)}),t._initMenu()});var i=document.createElement("div");i.className="tui-image-editor-grid-visual";var n='<table>\n           <tr><td class="dot left-top"></td><td></td><td class="dot right-top"></td></tr>\n           <tr><td></td><td></td><td></td></tr>\n           <tr><td class="dot left-bottom"></td><td></td><td class="dot right-bottom"></td></tr>\n         </table>';i.innerHTML=n,this._editorContainerElement=this._editorElement.querySelector(".tui-image-editor-canvas-container"),this._editorContainerElement.appendChild(i)}},{key:"_getLoadImage",value:function(){return this.options.loadImage}},{key:"changeMenu",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this._submenuChangeTransection||(this._submenuChangeTransection=!0,this._changeMenu(t,e,i),this._submenuChangeTransection=!1)}},{key:"_changeMenu",value:function(t,e,i){this.submenu&&(this._els[this.submenu].classList.remove("active"),this._mainElement.classList.remove("tui-image-editor-menu-"+this.submenu),i&&this._actions.main.discardSelection(),this._actions.main.changeSelectableAll(!0),this[this.submenu].changeStandbyMode()),this.submenu===t&&e?this.submenu=null:(this._els[t].classList.add("active"),this._mainElement.classList.add("tui-image-editor-menu-"+t),this.submenu=t,this[this.submenu].changeStartMode()),this.resizeEditor()}},{key:"_initMenu",value:function(){if(this.options.initMenu){var t=document.createEvent("MouseEvents");t.initEvent("click",!0,!1),this._els[this.options.initMenu].dispatchEvent(t),this.icon&&this.icon.registDefaultIcon()}}},{key:"_getEditorDimension",value:function(){var t=parseFloat(this._editorContainerElement.style.maxHeight),e=this.imageSize.newHeight>t?t:this.imageSize.newHeight,i=parseFloat(this._editorContainerElement.style.maxWidth),n=this.imageSize.newWidth>i?i:this.imageSize.newWidth;return{width:n,height:e}}},{key:"_setEditorPosition",value:function(t){var e=this._getEditorDimension(),i=e.width,n=e.height,r=this._editorElement.style,o=0,s=0;this.submenu&&("bottom"===t?o=n>this._editorElementWrap.scrollHeight-150?(n-this._editorElementWrap.scrollHeight)/2:-75:"top"===t?o=n>this._editorElementWrap.offsetHeight-150?75-(n-(this._editorElementWrap.offsetHeight-150))/2:75:"left"===t?s=i>this._editorElementWrap.offsetWidth-248?124-(i-(this._editorElementWrap.offsetWidth-248))/2:124:"right"===t&&(s=i>this._editorElementWrap.scrollWidth-248?(i-this._editorElementWrap.scrollWidth)/2:-124)),r.top=o+"px",r.left=s+"px"}}]),t}();e.default=R},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(10),l=n(c),u=i(127),h=n(u),f=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"crop",iconStyle:n,menuBarPosition:s,templateHtml:h.default}));return a.status="active",a._els={apply:a.selector("#tie-crop-button .apply"),cancel:a.selector("#tie-crop-button .cancel")},a}return s(e,t),a(e,[{key:"addEvent",value:function(t){var e=this;this.actions=t,this._els.apply.addEventListener("click",function(){e.actions.crop(),e._els.apply.classList.remove("active")}),this._els.cancel.addEventListener("click",function(){e.actions.cancel(),e._els.apply.classList.remove("active")})}},{key:"changeStartMode",value:function(){this.actions.modeChange("crop")}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeApplyButtonStatus",value:function(t){t?this._els.apply.classList.add("active"):this._els.apply.classList.remove("active")}}]),e}(l.default);e.default=f},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(5),l=n(c),u=i(18),h=n(u),f=i(19),d=n(f),p=i(10),g=n(p),v=i(128),m=n(v),b=i(1),y=.7,_=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"draw",iconStyle:n,menuBarPosition:s,templateHtml:m.default}));return a._els={lineSelectButton:a.selector("#tie-draw-line-select-button"),drawColorpicker:new h.default(a.selector("#tie-draw-color"),"#00a9ff",a.toggleDirection),drawRange:new d.default(a.selector("#tie-draw-range"),b.defaultDrawRangeValus),drawRangeValue:a.selector("#tie-draw-range-value")},a.type=null,a.color=a._els.drawColorpicker.color,a.width=a._els.drawRange.value,a}return s(e,t),a(e,[{key:"addEvent",value:function(t){this.actions=t,this._els.lineSelectButton.addEventListener("click",this._changeDrawType.bind(this)),this._els.drawColorpicker.on("change",this._changeDrawColor.bind(this)),this._els.drawRange.on("change",this._changeDrawRange.bind(this)),this._els.drawRangeValue.value=this._els.drawRange.value,this._els.drawRangeValue.setAttribute("readonly",!0)}},{key:"setDrawMode",value:function(){this.actions.setDrawMode(this.type,{width:this.width,color:l.default.getRgb(this.color,y)})}},{key:"changeStandbyMode",value:function(){this.type=null,this.actions.stopDrawingMode(),this.actions.changeSelectableAll(!0),this._els.lineSelectButton.classList.remove("free"),this._els.lineSelectButton.classList.remove("line")}},{key:"changeStartMode",value:function(){this.type="free",this._els.lineSelectButton.classList.add("free"),this.setDrawMode()}},{key:"_changeDrawType",value:function(t){var e=t.target.closest(".tui-image-editor-button");if(e){var i=this.getButtonType(e,["free","line"]);if(this.actions.discardSelection(),this.type===i)return void this.changeStandbyMode();this.changeStandbyMode(),this.type=i,this._els.lineSelectButton.classList.add(i),this.setDrawMode()}}},{key:"_changeDrawColor",value:function(t){this.color=t||"transparent",this.type?this.setDrawMode():this.changeStartMode()}},{key:"_changeDrawRange",value:function(t){t=l.default.toInteger(t),this._els.drawRangeValue.value=t,this.width=t,this.type?this.setDrawMode():this.changeStartMode()}}]),e}(g.default);e.default=_},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(4),l=n(c),u=i(18),h=n(u),f=i(19),d=n(f),p=i(10),g=n(p),v=i(129),m=n(v),b=i(5),y=i(1),_="130px",x=["add","diff","subtract","multiply","screen","lighten","darken"],w=["grayscale","invert","sepia","sepia2","blur","sharpen","emboss","remove-white","gradient-transparency","brightness","noise","pixelate","color-filter","tint","multiply","blend"],S=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"filter",iconStyle:n,menuBarPosition:s,templateHtml:m.default}));return a.selectBoxShow=!1,a.checkedMap={},a._makeControlElement(),a}return s(e,t),a(e,[{key:"addEvent",value:function(t){var e=this,i=t.applyFilter,n=this._changeRangeValue.bind(this,i);l.default.forEach(w,function(t){var i=e.selector("#tie-"+t),r=(0,b.toCamelCase)(t);e.checkedMap[r]=i,i.addEventListener("change",function(){return n(r)})}),this._els.removewhiteThresholdRange.on("change",function(){return n("removeWhite")}),this._els.removewhiteDistanceRange.on("change",function(){return n("removeWhite")}),this._els.gradientTransparencyRange.on("change",function(){return n("gradientTransparency")}),this._els.colorfilterThresholeRange.on("change",function(){return n("colorFilter")}),this._els.pixelateRange.on("change",function(){return n("pixelate")}),this._els.noiseRange.on("change",function(){return n("noise")}),this._els.brightnessRange.on("change",function(){return n("brightness")}),this._els.blendType.addEventListener("change",function(){return n("blend")}),this._els.filterBlendColor.on("change",function(){return n("blend")}),this._els.filterMultiplyColor.on("change",function(){return n("multiply")}),this._els.tintOpacity.on("change",function(){return n("tint")}),this._els.filterTintColor.on("change",function(){return n("tint")}),this._els.blendType.addEventListener("click",function(t){return t.stopPropagation()}),this._els.filterMultiplyColor.on("changeShow",this.colorPickerChangeShow.bind(this)),this._els.filterTintColor.on("changeShow",this.colorPickerChangeShow.bind(this)),this._els.filterBlendColor.on("changeShow",this.colorPickerChangeShow.bind(this))}},{key:"_changeRangeValue",value:function(t,e){var i=this.checkedMap[e].checked,n=e,r=this.checkedMap[e].closest(".tui-image-editor-checkbox-group");r&&(i?r.classList.remove("tui-image-editor-disabled"):r.classList.add("tui-image-editor-disabled")),t(i,n,this._getFilterOption(n))}},{key:"_getFilterOption",value:function(t){var e={};switch(t){case"removeWhite":e.threshold=(0,b.toInteger)(this._els.removewhiteThresholdRange.value),e.distance=(0,b.toInteger)(this._els.removewhiteDistanceRange.value);break;case"gradientTransparency":e.threshold=(0,b.toInteger)(this._els.gradientTransparencyRange.value);break;case"colorFilter":e.color="#FFFFFF",e.threshold=this._els.colorfilterThresholeRange.value;break;case"pixelate":e.blocksize=(0,b.toInteger)(this._els.pixelateRange.value);break;case"noise":e.noise=(0,b.toInteger)(this._els.noiseRange.value);break;case"brightness":e.brightness=(0,b.toInteger)(this._els.brightnessRange.value);break;case"blend":e.color=this._els.filterBlendColor.color,e.mode=this._els.blendType.value;break;case"multiply":e.color=this._els.filterMultiplyColor.color;break;case"tint":e.color=this._els.filterTintColor.color,e.opacity=this._els.tintOpacity.value}return e}},{key:"_makeControlElement",value:function(){var t=this.selector;this._els={removewhiteThresholdRange:new d.default(t("#tie-removewhite-threshold-range"),y.defaultFilterRangeValus.removewhiteThresholdRange),removewhiteDistanceRange:new d.default(t("#tie-removewhite-distance-range"),y.defaultFilterRangeValus.removewhiteDistanceRange),gradientTransparencyRange:new d.default(t("#tie-gradient-transparency-range"),y.defaultFilterRangeValus.gradientTransparencyRange),brightnessRange:new d.default(t("#tie-brightness-range"),y.defaultFilterRangeValus.brightnessRange),noiseRange:new d.default(t("#tie-noise-range"),y.defaultFilterRangeValus.noiseRange),pixelateRange:new d.default(t("#tie-pixelate-range"),y.defaultFilterRangeValus.pixelateRange),colorfilterThresholeRange:new d.default(t("#tie-colorfilter-threshole-range"),y.defaultFilterRangeValus.colorfilterThresholeRange),filterTintColor:new h.default(t("#tie-filter-tint-color"),"#03bd9e",this.toggleDirection),filterMultiplyColor:new h.default(t("#tie-filter-multiply-color"),"#515ce6",this.toggleDirection),filterBlendColor:new h.default(t("#tie-filter-blend-color"),"#ffbb3b",this.toggleDirection)},this._els.tintOpacity=this._pickerWithRange(this._els.filterTintColor.pickerControl),this._els.blendType=this._pickerWithSelectbox(this._els.filterBlendColor.pickerControl),this.colorPickerControls.push(this._els.filterTintColor),this.colorPickerControls.push(this._els.filterMultiplyColor),this.colorPickerControls.push(this._els.filterBlendColor)}},{key:"_pickerWithRange",value:function(t){var e=document.createElement("div"),i=document.createElement("label"),n=document.createElement("div");return n.id="tie-filter-tint-opacity",i.innerHTML="Opacity",e.appendChild(i),e.appendChild(n),t.appendChild(e),t.style.height=_,new d.default(n,y.defaultFilterRangeValus.tintOpacityRange)}},{key:"_pickerWithSelectbox",value:function(t){var e=document.createElement("div"),i=document.createElement("select"),n=document.createElement("ul");return e.className="tui-image-editor-selectlist-wrap",n.className="tui-image-editor-selectlist",e.appendChild(i),e.appendChild(n),this._makeSelectOptionList(i),t.appendChild(e),t.style.height=_,this._drawSelectOptionList(i,n),this._pickerWithSelectboxForAddEvent(i,n),i}},{key:"_drawSelectOptionList",value:function(t,e){var i=t.querySelectorAll("option");l.default.forEach(i,function(t){var i=document.createElement("li");i.innerHTML=t.innerHTML,i.setAttribute("data-item",t.value),e.appendChild(i)})}},{key:"_pickerWithSelectboxForAddEvent",value:function(t,e){var i=this;e.addEventListener("click",function(n){var r=n.target.getAttribute("data-item"),o=document.createEvent("HTMLEvents");t.querySelector('[value="'+r+'"]').selected=!0,o.initEvent("change",!0,!0),t.dispatchEvent(o),i.selectBoxShow=!1,e.style.display="none"}),t.addEventListener("mousedown",function(n){n.preventDefault(),i.selectBoxShow=!i.selectBoxShow,e.style.display=i.selectBoxShow?"block":"none",e.setAttribute("data-selectitem",t.value),e.querySelector("[data-item='"+t.value+"']").classList.add("active")})}},{key:"_makeSelectOptionList",value:function(t){l.default.forEach(x,function(e){var i=document.createElement("option");i.setAttribute("value",e),i.innerHTML=e.replace(/^[a-z]/,function(t){return t.toUpperCase()}),t.appendChild(i)})}}]),e}(g.default);e.default=S},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(4),l=n(c),u=i(10),h=n(u),f=i(130),d=n(f),p=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"flip",iconStyle:n,menuBarPosition:s,templateHtml:d.default}));return a.flipStatus=!1,a._els={flipButton:a.selector("#tie-flip-button")},a}return s(e,t),a(e,[{key:"addEvent",value:function(t){this._actions=t,this._els.flipButton.addEventListener("click",this._changeFlip.bind(this))}},{key:"_changeFlip",value:function(t){var e=this,i=t.target.closest(".tui-image-editor-button");if(i){var n=this.getButtonType(i,["flipX","flipY","resetFlip"]);if(!this.flipStatus&&"resetFlip"===n)return;this._actions.flip(n).then(function(t){var i=e._els.flipButton.classList;e.flipStatus=!1,i.remove("resetFlip"),l.default.forEach(["flipX","flipY"],function(n){i.remove(n),t[n]&&(i.add(n),i.add("resetFlip"),e.flipStatus=!0)})})}}}]),e}(h.default);e.default=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(4),l=n(c),u=i(18),h=n(u),f=i(10),d=n(f),p=i(131),g=n(p),v=i(5),m=i(1),b=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"icon",iconStyle:n,menuBarPosition:s,templateHtml:g.default}));return a.iconType=null,a._iconMap={},a._els={registIconButton:a.selector("#tie-icon-image-file"),addIconButton:a.selector("#tie-icon-add-button"),iconColorpicker:new h.default(a.selector("#tie-icon-color"),"#ffbb3b",a.toggleDirection)},a}return s(e,t),a(e,[{key:"addEvent",value:function(t){this.actions=t,this._els.iconColorpicker.on("change",this._changeColorHandler.bind(this)),this._els.registIconButton.addEventListener("change",this._registeIconHandler.bind(this)),this._els.addIconButton.addEventListener("click",this._addIconHandler.bind(this))}},{key:"clearIconType",value:function(){this._els.addIconButton.classList.remove(this.iconType),this.iconType=null}},{key:"registDefaultIcon",value:function(){var t=this;l.default.forEach(m.defaultIconPath,function(e,i){t.actions.registDefalutIcons(i,e)})}},{key:"setIconPickerColor",value:function(t){this._els.iconColorpicker.color=t}},{key:"changeStandbyMode",value:function(){this.clearIconType(),this.actions.cancelAddIcon()}},{key:"_changeColorHandler",value:function(t){t=t||"transparent",this.actions.changeColor(t)}},{key:"_addIconHandler",value:function(t){var e=t.target.closest(".tui-image-editor-button");if(e){var i=e.getAttribute("data-icontype"),n=this._els.iconColorpicker.color;this.actions.discardSelection(),this.actions.changeSelectableAll(!1),this._els.addIconButton.classList.remove(this.iconType),this._els.addIconButton.classList.add(i),this.iconType===i?this.changeStandbyMode():(this.actions.addIcon(i,n),this.iconType=i)}}},{key:"_registeIconHandler",value:function(t){var e=void 0;v.isSupportFileApi||alert("This browser does not support file-api");var i=t.target.files,n=i[0];n&&(e=URL.createObjectURL(n),this.actions.registCustomIcon(e,n))}}]),e}(d.default);e.default=b},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(10),l=n(c),u=i(5),h=n(u),f=i(132),d=n(f),p=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"mask",iconStyle:n,menuBarPosition:s,templateHtml:d.default}));return a._els={applyButton:a.selector("#tie-mask-apply"),maskImageButton:a.selector("#tie-mask-image-file")},a}return s(e,t),a(e,[{key:"addEvent",value:function(t){this.actions=t,this._els.maskImageButton.addEventListener("change",this._loadMaskFile.bind(this)),this._els.applyButton.addEventListener("click",this._applyMask.bind(this))}},{key:"_applyMask",value:function(){this.actions.applyFilter(),this._els.applyButton.classList.remove("active")}},{key:"_loadMaskFile",value:function(t){var e=void 0;h.default.isSupportFileApi()||alert("This browser does not support file-api");var i=t.target.files,n=i[0];n&&(e=URL.createObjectURL(n),this.actions.loadImageFromURL(e,n),this._els.applyButton.classList.add("active"));
}}]),e}(l.default);e.default=p},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(19),l=n(c),u=i(10),h=n(u),f=i(133),d=n(f),p=i(5),g=i(1),v=30,m=-30,b=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"rotate",iconStyle:n,menuBarPosition:s,templateHtml:d.default}));return a._els={rotateButton:a.selector("#tie-retate-button"),rotateRange:new l.default(a.selector("#tie-rotate-range"),g.defaultRotateRangeValus),rotateRangeValue:a.selector("#tie-ratate-range-value")},a}return s(e,t),a(e,[{key:"addEvent",value:function(t){this.actions=t,this._els.rotateButton.addEventListener("click",this._changeRotateForButton.bind(this)),this._els.rotateRange.on("change",this._changeRotateForRange.bind(this)),this._els.rotateRangeValue.setAttribute("readonly",!0)}},{key:"_changeRotateForRange",value:function(t){var e=(0,p.toInteger)(t);this._els.rotateRangeValue.value=e,this.actions.setAngle(e)}},{key:"_changeRotateForButton",value:function(t){var e=t.target.closest(".tui-image-editor-button");if(e){var i=this.getButtonType(e,["counterclockwise","clockwise"]),n={clockwise:v,counterclockwise:m}[i];this.actions.rotate(n)}}}]),e}(h.default);e.default=b},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(18),l=n(c),u=i(19),h=n(u),f=i(10),d=n(f),p=i(134),g=n(p),v=i(5),m=i(1),b={stroke:"#ffbb3b",fill:"",strokeWidth:3},y=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"shape",iconStyle:n,menuBarPosition:s,templateHtml:g.default}));return a.type=null,a.options=b,a._els={shapeSelectButton:a.selector("#tie-shape-button"),shapeColorButton:a.selector("#tie-shape-color-button"),strokeRange:new h.default(a.selector("#tie-stroke-range"),m.defaultShapeStrokeValus),strokeRangeValue:a.selector("#tie-stroke-range-value"),fillColorpicker:new l.default(a.selector("#tie-color-fill"),"",a.toggleDirection),strokeColorpicker:new l.default(a.selector("#tie-color-stroke"),"#ffbb3b",a.toggleDirection)},a.colorPickerControls.push(a._els.fillColorpicker),a.colorPickerControls.push(a._els.strokeColorpicker),a}return s(e,t),a(e,[{key:"addEvent",value:function(t){this.actions=t,this._els.shapeSelectButton.addEventListener("click",this._changeShapeHandler.bind(this)),this._els.strokeRange.on("change",this._changeStrokeRangeHandler.bind(this)),this._els.fillColorpicker.on("change",this._changeFillColorHandler.bind(this)),this._els.strokeColorpicker.on("change",this._changeStrokeColorHandler.bind(this)),this._els.fillColorpicker.on("changeShow",this.colorPickerChangeShow.bind(this)),this._els.strokeColorpicker.on("changeShow",this.colorPickerChangeShow.bind(this)),this._els.strokeRangeValue.value=this._els.strokeRange.value,this._els.strokeRangeValue.setAttribute("readonly",!0)}},{key:"setShapeStatus",value:function(t){var e=t.strokeWidth,i=t.strokeColor,n=t.fillColor;this._els.strokeRange.value=e,this._els.strokeRange.trigger("change"),this._els.strokeColorpicker.color=i,this._els.fillColorpicker.color=n,this.options.stroke=i,this.options.fill=n,this.options.strokeWidth=e}},{key:"changeStartMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeStandbyMode",value:function(){this.type=null,this.actions.changeSelectableAll(!0),this._els.shapeSelectButton.classList.remove("circle"),this._els.shapeSelectButton.classList.remove("triangle"),this._els.shapeSelectButton.classList.remove("rect")}},{key:"setMaxStrokeValue",value:function(t){var e=t;e<=0&&(e=m.defaultShapeStrokeValus.max),this._els.strokeRange.max=e}},{key:"setStrokeValue",value:function(t){this._els.strokeRange.value=t,this._els.strokeRange.trigger("change")}},{key:"getStrokeValue",value:function(){return this._els.strokeRange.value}},{key:"_changeShapeHandler",value:function(t){var e=t.target.closest(".tui-image-editor-button");if(e){this.actions.stopDrawingMode(),this.actions.discardSelection();var i=this.getButtonType(e,["circle","triangle","rect"]);if(this.type===i)return void this.changeStandbyMode();this.changeStandbyMode(),this.type=i,t.currentTarget.classList.add(i),this.actions.changeSelectableAll(!1),this.actions.modeChange("shape")}}},{key:"_changeStrokeRangeHandler",value:function(t){this.options.strokeWidth=(0,v.toInteger)(t),this._els.strokeRangeValue.value=(0,v.toInteger)(t),this.actions.changeShape({strokeWidth:t}),this.actions.setDrawingShape(this.type,this.options)}},{key:"_changeFillColorHandler",value:function(t){t=t||"transparent",this.options.fill=t,this.actions.changeShape({fill:t})}},{key:"_changeStrokeColorHandler",value:function(t){t=t||"transparent",this.options.stroke=t,this.actions.changeShape({stroke:t})}}]),e}(d.default);e.default=y},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.biImage,i=t.iconStyle,n=i.normal,r=i.hover,o=i.disabled,s=t.loadButtonStyle,a=t.downloadButtonStyle;return'\n    <div class="tui-image-editor-controls">\n        <div class="tui-image-editor-controls-logo">\n            <img src="'+e+'" />\n        </div>\n        <ul class="tui-image-editor-menu">\n            <li id="tie-btn-undo" class="tui-image-editor-item" title="Undo">\n                <svg class="svg_ic-menu">\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-undo" class="enabled"/>\n                    <use xlink:href="'+o.path+"#"+o.name+'-ic-undo" class="normal"/>\n                    <use xlink:href="'+r.path+"#"+r.name+'-ic-undo" class="hover"/>\n                </svg>\n            </li>\n            <li id="tie-btn-redo" class="tui-image-editor-item" title="Redo">\n                <svg class="svg_ic-menu">\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-redo" class="enabled"/>\n                    <use xlink:href="'+o.path+"#"+o.name+'-ic-redo" class="normal"/>\n                    <use xlink:href="'+r.path+"#"+r.name+'-ic-redo" class="hover"/>\n                </svg>\n            </li>\n            <li id="tie-btn-reset" class="tui-image-editor-item" title="Reset">\n                <svg class="svg_ic-menu">\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-reset" class="enabled"/>\n                    <use xlink:href="'+o.path+"#"+o.name+'-ic-reset" class="normal"/>\n                    <use xlink:href="'+r.path+"#"+r.name+'-ic-reset" class="hover"/>\n                </svg>\n            </li>\n            <li class="tui-image-editor-item">\n                <div class="tui-image-editor-icpartition"></div>\n            </li>\n            <li id="tie-btn-delete" class="tui-image-editor-item" title="Delete">\n                <svg class="svg_ic-menu">\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-delete" class="enabled"/>\n                    <use xlink:href="'+o.path+"#"+o.name+'-ic-delete" class="normal"/>\n                    <use xlink:href="'+r.path+"#"+r.name+'-ic-delete" class="hover"/>\n                </svg>\n            </li>\n            <li id="tie-btn-delete-all" class="tui-image-editor-item" title="Delete-all">\n                <svg class="svg_ic-menu">\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-delete-all" class="enabled"/>\n                    <use xlink:href="'+o.path+"#"+o.name+'-ic-delete-all" class="normal"/>\n                    <use xlink:href="'+r.path+"#"+r.name+'-ic-delete-all" class="hover"/>\n                </svg>\n            </li>\n            <li class="tui-image-editor-item">\n                <div class="tui-image-editor-icpartition"></div>\n            </li>\n        </ul>\n\n        <div class="tui-image-editor-controls-buttons">\n            <button style="'+s+'">\n                Load\n                <input type="file" class="tui-image-editor-load-btn" />\n            </button>\n            <button class="tui-image-editor-download-btn" style="'+a+'">\n                Download\n            </button>\n        </div>\n    </div>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.biImage,i=t.commonStyle,n=t.headerStyle,r=t.loadButtonStyle,o=t.downloadButtonStyle,s=t.submenuStyle;return'\n    <div class="tui-image-editor-main-container" style="'+i+'">\n        <div class="tui-image-editor-header" style="'+n+'">\n            <div class="tui-image-editor-header-logo">\n                <img src="'+e+'" />\n            </div>\n            <div class="tui-image-editor-header-buttons">\n                <button style="'+r+'">\n                    Load\n                    <input type="file" class="tui-image-editor-load-btn" />\n                </button>\n                <button class="tui-image-editor-download-btn" style="'+o+'">\n                    Download\n                </button>\n            </div>\n        </div>\n        <div class="tui-image-editor-main">\n            <div class="tui-image-editor-submenu">\n                <div class="tui-image-editor-submenu-style" style="'+s+'"></div>\n            </div>\n            <div class="tui-image-editor-wrap">\n                <div class="tui-image-editor-size-wrap">\n                    <div class="tui-image-editor-align-wrap">\n                        <div class="tui-image-editor"></div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.subMenuLabelActive,i=t.subMenuLabelNormal,n=t.subMenuRangeTitle,r=t.submenuPartitionVertical,o=t.submenuPartitionHorizontal,s=t.submenuCheckbox,a=t.submenuRangePointer,c=t.submenuRangeValue,l=t.submenuColorpickerTitle,u=t.submenuColorpickerButton,h=t.submenuRangeBar,f=t.submenuRangeSubbar,d=t.submenuDisabledRangePointer,p=t.submenuDisabledRangeBar,g=t.submenuDisabledRangeSubbar,v=t.submenuIconSize,m=t.menuIconSize,b=t.biSize;return'\n    #tie-icon-add-button.icon-bubble .tui-image-editor-button[data-icontype="icon-bubble"] label,\n    #tie-icon-add-button.icon-heart .tui-image-editor-button[data-icontype="icon-heart"] label,\n    #tie-icon-add-button.icon-location .tui-image-editor-button[data-icontype="icon-location"] label,\n    #tie-icon-add-button.icon-polygon .tui-image-editor-button[data-icontype="icon-polygon"] label,\n    #tie-icon-add-button.icon-star .tui-image-editor-button[data-icontype="icon-star"] label,\n    #tie-icon-add-button.icon-arrow-3 .tui-image-editor-button[data-icontype="icon-arrow-3"] label,\n    #tie-icon-add-button.icon-arrow-2 .tui-image-editor-button[data-icontype="icon-arrow-2"] label,\n    #tie-icon-add-button.icon-arrow .tui-image-editor-button[data-icontype="icon-arrow"] label,\n    #tie-icon-add-button.icon-bubble .tui-image-editor-button[data-icontype="icon-bubble"] label,\n    #tie-draw-line-select-button.line .tui-image-editor-button.line label,\n    #tie-draw-line-select-button.free .tui-image-editor-button.free label,\n    #tie-flip-button.flipX .tui-image-editor-button.flipX label,\n    #tie-flip-button.flipY .tui-image-editor-button.flipY label,\n    #tie-flip-button.resetFlip .tui-image-editor-button.resetFlip label,\n    #tie-crop-button .tui-image-editor-button.apply.active label,\n    #tie-shape-button.rect .tui-image-editor-button.rect label,\n    #tie-shape-button.circle .tui-image-editor-button.circle label,\n    #tie-shape-button.triangle .tui-image-editor-button.triangle label,\n    #tie-text-effect-button .tui-image-editor-button.active label,\n    #tie-text-align-button.left .tui-image-editor-button.left label,\n    #tie-text-align-button.center .tui-image-editor-button.center label,\n    #tie-text-align-button.right .tui-image-editor-button.right label,\n    #tie-mask-apply.apply.active .tui-image-editor-button.apply label,\n    .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button:hover > label,\n    .tui-image-editor-container .tui-image-editor-checkbox input + label {\n        '+e+"\n    }\n    .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button > label,\n    .tui-image-editor-container .tui-image-editor-range-wrap.tui-image-editor-newline.short label {\n        "+i+"\n    }\n    .tui-image-editor-container .tui-image-editor-range-wrap label {\n        "+n+"\n    }\n    .tui-image-editor-container .tui-image-editor-partition > div {\n        "+r+"\n    }\n    .tui-image-editor-container.left .tui-image-editor-submenu .tui-image-editor-partition > div,\n    .tui-image-editor-container.right .tui-image-editor-submenu .tui-image-editor-partition > div {\n        "+o+"\n    }\n    .tui-image-editor-container .tui-image-editor-checkbox input + label:before {\n        "+s+"\n    }\n    .tui-image-editor-container .tui-image-editor-checkbox input:checked + label:before {\n        border: 0;\n    }\n    .tui-image-editor-container .tui-image-editor-virtual-range-pointer {\n        "+a+"\n    }\n    .tui-image-editor-container .tui-image-editor-virtual-range-bar {\n        "+h+"\n    }\n    .tui-image-editor-container .tui-image-editor-virtual-range-subbar {\n        "+f+"\n    }\n    .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-pointer {\n        "+d+"\n    }\n    .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-subbar {\n        "+g+"\n    }\n    .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-bar {\n        "+p+"\n    }\n    .tui-image-editor-container .tui-image-editor-range-value {\n        "+c+"\n    }\n    .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value + label {\n        "+l+"\n    }\n    .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value {\n        "+u+"\n    }\n    .tui-image-editor-container .svg_ic-menu {\n        "+m+"\n    }\n    .tui-image-editor-container .svg_ic-submenu {\n        "+v+"\n    }\n    .tui-image-editor-container .tui-image-editor-controls-logo > img,\n    .tui-image-editor-container .tui-image-editor-header-logo > img {\n        "+b+"\n    }\n\n"}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.iconStyle,i=e.normal,n=e.active;return'\n    <ul class="tui-image-editor-submenu-item">\n        <li id="tie-crop-button" class="apply">\n            <div class="tui-image-editor-button apply">\n                <svg class="svg_ic-menu">\n                    <use xlink:href="'+i.path+"#"+i.name+'-ic-apply" class="normal"/>\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-apply" class="active"/>\n                </svg>\n                <label>\n                    Apply\n                </label>\n            </div>\n            <div class="tui-image-editor-button cancel">\n                <svg class="svg_ic-menu">\n                    <use xlink:href="'+i.path+"#"+i.name+'-ic-cancel" class="normal"/>\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-cancel" class="active"/>\n                </svg>\n                <label>\n                    Cancel\n                </label>\n            </div>\n        </li>\n    </ul>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.iconStyle,i=e.normal,n=e.active;return'\n    <ul class="tui-image-editor-submenu-item">\n        <li id="tie-draw-line-select-button">\n            <div class="tui-image-editor-button free">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-draw-free" class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-draw-free" class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Free\n                </label>\n            </div>\n            <div class="tui-image-editor-button line">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-draw-line" class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-draw-line" class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Straight\n                </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li>\n            <div id="tie-draw-color" title="Color"></div>\n        </li>\n        <li class="tui-image-editor-partition only-left-right">\n            <div></div>\n        </li>\n        <li class="tui-image-editor-newline tui-image-editor-range-wrap">\n            <label class="range">Range</label>\n            <div id="tie-draw-range"></div>\n            <input id="tie-draw-range-value" class="tui-image-editor-range-value" value="0" />\n        </li>\n    </ul>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return'\n    <ul class="tui-image-editor-submenu-item">\n        <li class="tui-image-editor-submenu-align">\n            <div class="tui-image-editor-checkbox-wrap fixed-width">\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-grayscale">\n                    <label for="tie-grayscale">Grayscale</label>\n                </div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-invert">\n                    <label for="tie-invert">Invert</label>\n                </div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-sepia">\n                    <label for="tie-sepia">Sepia</label>\n                </div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-sepia2">\n                    <label for="tie-sepia2">Sepia2</label>\n                </div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-blur">\n                    <label for="tie-blur">Blur</label>\n                </div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-sharpen">\n                    <label for="tie-sharpen">Sharpen</label>\n                </div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-emboss">\n                    <label for="tie-emboss">Emboss</label>\n                </div>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li class="tui-image-editor-submenu-align">\n            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled" style="margin-bottom: 7px;">\n                <div class="tui-image-editor-checkbox-wrap">\n                    <div class="tui-image-editor-checkbox">\n                        <input type="checkbox" id="tie-remove-white">\n                        <label for="tie-remove-white">Remove White</label>\n                    </div>\n                </div>\n                <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n                    <label>Threshold</label>\n                    <div id="tie-removewhite-threshold-range"></div>\n                </div>\n                <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n                    <label>Distance</label>\n                    <div id="tie-removewhite-distance-range"></div>\n                </div>\n            </div>\n            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">\n                <div class="tui-image-editor-newline tui-image-editor-checkbox-wrap">\n                    <div class="tui-image-editor-checkbox">\n                        <input type="checkbox" id="tie-gradient-transparency">\n                        <label for="tie-gradient-transparency">Grayscale</label>\n                    </div>\n                </div>\n                <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n                    <label>Value</label>\n                    <div id="tie-gradient-transparency-range"></div>\n                </div>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition only-left-right">\n            <div></div>\n        </li>\n        <li class="tui-image-editor-submenu-align">\n            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-brightness">\n                    <label for="tie-brightness">Brightness</label>\n                </div>\n                <div class="tui-image-editor-range-wrap short">\n                    <div id="tie-brightness-range"></div>\n                </div>\n            </div>\n            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-noise">\n                    <label for="tie-noise">Noise</label>\n                </div>\n                <div class="tui-image-editor-range-wrap short">\n                    <div id="tie-noise-range"></div>\n                </div>\n            </div>\n\n            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-pixelate">\n                    <label for="tie-pixelate">Pixelate</label>\n                </div>\n                <div class="tui-image-editor-range-wrap short">\n                    <div id="tie-pixelate-range"></div>\n                </div>\n            </div>\n            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">\n                <div class="tui-image-editor-newline tui-image-editor-checkbox-wrap">\n                    <div class="tui-image-editor-checkbox">\n                        <input type="checkbox" id="tie-color-filter">\n                        <label for="tie-color-filter">Color Filter</label>\n                    </div>\n                </div>\n                <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n                    <label>Threshold</label>\n                    <div id="tie-colorfilter-threshole-range"></div>\n                </div>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li>\n            <div class="filter-color-item">\n                <div id="tie-filter-tint-color" title="Tint"></div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-tint">\n                    <label for="tie-tint"></label>\n                </div>\n            </div>\n            <div class="filter-color-item">\n                <div id="tie-filter-multiply-color" title="Multiply"></div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-multiply">\n                    <label for="tie-multiply"></label>\n                </div>\n            </div>\n            <div class="filter-color-item">\n                <div id="tie-filter-blend-color" title="Blend"></div>\n                <div class="tui-image-editor-checkbox">\n                    <input type="checkbox" id="tie-blend">\n                    <label for="tie-blend"></label>\n                </div>\n            </div>\n        </li>\n    </ul>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.iconStyle,i=e.normal,n=e.active;return'\n    <ul id="tie-flip-button" class="tui-image-editor-submenu-item">\n        <li>\n            <div class="tui-image-editor-button flipX">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-flip-x" class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-flip-x" class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Flip X\n                </label>\n            </div>\n            <div class="tui-image-editor-button flipY">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-flip-y" class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-flip-y" class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Flip Y\n                </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li>\n            <div class="tui-image-editor-button resetFlip">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-flip-reset"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-flip-reset"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Reset\n                </label>\n            </div>\n        </li>\n    </ul>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.iconStyle,i=e.normal,n=e.active;return'\n    <ul class="tui-image-editor-submenu-item">\n        <li id="tie-icon-add-button">\n            <div class="tui-image-editor-button" data-icontype="icon-arrow">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-arrow"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-arrow"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Arrow\n                </label>\n            </div>\n            <div class="tui-image-editor-button" data-icontype="icon-arrow-2">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-arrow-2"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-arrow-2"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Arrow-2\n                </label>\n            </div>\n            <div class="tui-image-editor-button" data-icontype="icon-arrow-3">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-arrow-3"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-arrow-3"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Arrow-3\n                </label>\n            </div>\n            <div class="tui-image-editor-button" data-icontype="icon-star">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-star" class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-star" class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Star-1\n                </label>\n            </div>\n            <div class="tui-image-editor-button" data-icontype="icon-star-2">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-star-2"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-star-2"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Star-2\n                </label>\n            </div>\n\n            <div class="tui-image-editor-button" data-icontype="icon-polygon">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-polygon"\n                            class="normal"/>\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-polygon"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Polygon\n                </label>\n            </div>\n\n            <div class="tui-image-editor-button" data-icontype="icon-location">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-location"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-location"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Location\n                </label>\n            </div>\n\n            <div class="tui-image-editor-button" data-icontype="icon-heart">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-heart"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-heart"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Heart\n                </label>\n            </div>\n\n            <div class="tui-image-editor-button" data-icontype="icon-bubble">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-bubble"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-bubble"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Bubble\n                </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li id="tie-icon-add-button">\n            <div class="tui-image-editor-button" style="margin:0">\n                <div>\n                    <input type="file" accept="image/*" id="tie-icon-image-file">\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-load" class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-load" class="active"/>\n                    </svg>\n                </div>\n                <label>\n                    Custom icon\n                </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li>\n            <div id="tie-icon-color" title="Color"></div>\n        </li>\n    </ul>\n';
}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.iconStyle,i=e.normal,n=e.active;return'\n    <ul class="tui-image-editor-submenu-item">\n        <li>\n            <div class="tui-image-editor-button">\n                <div>\n                    <input type="file" accept="image/*" id="tie-mask-image-file">\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-mask-load" class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-mask-load" class="active"/>\n                    </svg>\n                </div>\n                <label> Load Mask Image </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition only-left-right">\n            <div></div>\n        </li>\n        <li id="tie-mask-apply" class="tui-image-editor-newline apply" style="margin-top: 22px;margin-bottom: 5px">\n            <div class="tui-image-editor-button apply">\n                <svg class="svg_ic-menu">\n                    <use xlink:href="'+i.path+"#"+i.name+'-ic-apply" class="normal"/>\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-apply" class="active"/>\n                </svg>\n                <label>\n                    Apply\n                </label>\n            </div>\n        </li>\n    </ul>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.iconStyle,i=e.normal,n=e.active;return'\n    <ul class="tui-image-editor-submenu-item">\n        <li id="tie-retate-button">\n            <div class="tui-image-editor-button clockwise">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-rotate-clockwise"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-rotate-clockwise"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label> 30 </label>\n            </div>\n            <div class="tui-image-editor-button counterclockwise">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-rotate-counterclockwise"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-rotate-counterclockwise"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label> -30 </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition only-left-right">\n            <div></div>\n        </li>\n        <li class="tui-image-editor-newline tui-image-editor-range-wrap">\n            <label class="range">Range</label>\n            <div id="tie-rotate-range"></div>\n            <input id="tie-ratate-range-value" class="tui-image-editor-range-value" value="0" />\n        </li>\n    </ul>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.iconStyle,i=e.normal,n=e.active;return'\n    <ul class="tui-image-editor-submenu-item">\n        <li id="tie-shape-button">\n            <div class="tui-image-editor-button rect">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-shape-rectangle"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-shape-rectangle"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label> Rectangle </label>\n            </div>\n            <div class="tui-image-editor-button circle">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-shape-circle"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-shape-circle"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label> Circle </label>\n            </div>\n            <div class="tui-image-editor-button triangle">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-shape-triangle"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-shape-triangle"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label> Triangle </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li id="tie-shape-color-button">\n            <div id="tie-color-fill" title="Fill"></div>\n            <div id="tie-color-stroke" title="Stroke"></div>\n        </li>\n        <li class="tui-image-editor-partition only-left-right">\n            <div></div>\n        </li>\n        <li class="tui-image-editor-newline tui-image-editor-range-wrap">\n            <label class="range">Stroke</label>\n            <div id="tie-stroke-range"></div>\n            <input id="tie-stroke-range-value" class="tui-image-editor-range-value" value="0" />\n        </li>\n    </ul>\n'}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.iconStyle,i=e.normal,n=e.active;return'\n    <ul class="tui-image-editor-submenu-item">\n        <li id="tie-text-effect-button">\n            <div class="tui-image-editor-button bold">\n                <div>\n                    <svg class="svg_ic-submenu">\n                    <use xlink:href="'+i.path+"#"+i.name+'-ic-text-bold" class="normal"/>\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-text-bold" class="active"/>\n                    </svg>\n                </div>\n                <label> Bold </label>\n            </div>\n            <div class="tui-image-editor-button italic">\n                <div>\n                    <svg class="svg_ic-submenu">\n                    <use xlink:href="'+i.path+"#"+i.name+'-ic-text-italic" class="normal"/>\n                    <use xlink:href="'+n.path+"#"+n.name+'-ic-text-italic" class="active"/>\n                    </svg>\n                </div>\n                <label> Italic </label>\n            </div>\n            <div class="tui-image-editor-button underline">\n                <div>\n                    <svg class="svg_ic-submenu">\n                        <use xlink:href="'+i.path+"#"+i.name+'-ic-text-underline"\n                            class="normal"/>\n                        <use xlink:href="'+n.path+"#"+n.name+'-ic-text-underline"\n                            class="active"/>\n                    </svg>\n                </div>\n                <label> Underline </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li id="tie-text-align-button">\n            <div class="tui-image-editor-button left">\n                <div>\n                    <svg class="svg_ic-submenu">\n                     <use xlink:href="'+i.path+"#"+i.name+'-ic-text-align-left"\n                        class="normal"/>\n                     <use xlink:href="'+n.path+"#"+n.name+'-ic-text-align-left"\n                        class="active"/>\n                    </svg>\n                </div>\n                <label> Left </label>\n            </div>\n            <div class="tui-image-editor-button center">\n                <div>\n                    <svg class="svg_ic-submenu">\n                     <use xlink:href="'+i.path+"#"+i.name+'-ic-text-align-center"\n                        class="normal"/>\n                     <use xlink:href="'+n.path+"#"+n.name+'-ic-text-align-center"\n                        class="active"/>\n                    </svg>\n                </div>\n                <label> Center </label>\n            </div>\n            <div class="tui-image-editor-button right">\n                <div>\n                    <svg class="svg_ic-submenu">\n                     <use xlink:href="'+i.path+"#"+i.name+'-ic-text-align-right"\n                        class="normal"/>\n                     <use xlink:href="'+n.path+"#"+n.name+'-ic-text-align-right"\n                        class="active"/>\n                    </svg>\n                </div>\n                <label> Right </label>\n            </div>\n        </li>\n        <li class="tui-image-editor-partition">\n            <div></div>\n        </li>\n        <li>\n            <div id="tie-text-color" title="Color"></div>\n        </li>\n        <li class="tui-image-editor-partition only-left-right">\n            <div></div>\n        </li>\n        <li class="tui-image-editor-newline tui-image-editor-range-wrap">\n            <label class="range">Text size</label>\n            <div id="tie-text-range"></div>\n            <input id="tie-text-range-value" class="tui-image-editor-range-value" value="0" />\n        </li>\n    </ul>\n'}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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}function s(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=i(19),l=n(c),u=i(18),h=n(u),f=i(10),d=n(f),p=i(135),g=n(p),v=i(5),m=i(1),b=function(t){function e(t,i){var n=i.iconStyle,s=i.menuBarPosition;r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,{name:"text",iconStyle:n,menuBarPosition:s,templateHtml:g.default}));return a.effect={bold:!1,italic:!1,underline:!1},a.align="left",a._els={textEffectButton:a.selector("#tie-text-effect-button"),textAlignButton:a.selector("#tie-text-align-button"),textColorpicker:new h.default(a.selector("#tie-text-color"),"#ffbb3b",a.toggleDirection),textRange:new l.default(a.selector("#tie-text-range"),m.defaultTextRangeValus),textRangeValue:a.selector("#tie-text-range-value")},a}return s(e,t),a(e,[{key:"addEvent",value:function(t){this.actions=t,this._els.textEffectButton.addEventListener("click",this._setTextEffectHandler.bind(this)),this._els.textAlignButton.addEventListener("click",this._setTextAlignHandler.bind(this)),this._els.textRange.on("change",this._changeTextRnageHandler.bind(this)),this._els.textRangeValue.value=this._els.textRange.value,this._els.textRangeValue.setAttribute("readonly",!0),this._els.textColorpicker.on("change",this._changeColorHandler.bind(this))}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeStartMode",value:function(){this.actions.modeChange("text")}},{key:"_setTextEffectHandler",value:function(t){var e=t.target.closest(".tui-image-editor-button"),i=e.className.match(/(bold|italic|underline)/),n=i[0],r={bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},underline:{textDecoration:"underline"}}[n];this.effect[n]=!this.effect[n],e.classList.toggle("active"),this.actions.changeTextStyle(r)}},{key:"_setTextAlignHandler",value:function(t){var e=t.target.closest(".tui-image-editor-button");if(e){var i=this.getButtonType(e,["left","center","right"]);t.currentTarget.classList.remove(this.align),this.align!==i&&t.currentTarget.classList.add(i),this.actions.changeTextStyle({textAlign:i}),this.align=i}}},{key:"_changeTextRnageHandler",value:function(t){t=(0,v.toInteger)(t),(0,v.toInteger)(this._els.textRangeValue.value)!==t&&(this.actions.changeTextStyle({fontSize:t}),this._els.textRangeValue.value=t)}},{key:"_changeColorHandler",value:function(t){t=t||"transparent",this.actions.changeTextStyle({fill:t})}},{key:"textColor",get:function(){return this._els.textColorpicker.color}},{key:"fontSize",get:function(){return this._els.textRange.value},set:function(t){this._els.textRange.value=t,this._els.textRangeValue.value=t}}]),e}(d.default);e.default=b},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={"common.bi.image":"https://uicdn.toast.com/toastui/img/tui-image-editor-bi.png","common.bisize.width":"251px","common.bisize.height":"21px","common.backgroundImage":"none","common.backgroundColor":"#1e1e1e","common.border":"0px","header.backgroundImage":"none","header.backgroundColor":"transparent","header.border":"0px","loadButton.backgroundColor":"#fff","loadButton.border":"1px solid #ddd","loadButton.color":"#222","loadButton.fontFamily":'"Noto Sans", sans-serif',"loadButton.fontSize":"12px","downloadButton.backgroundColor":"#fdba3b","downloadButton.border":"1px solid #fdba3b","downloadButton.color":"#fff","downloadButton.fontFamily":'"Noto Sans", sans-serif',"downloadButton.fontSize":"12px","menu.normalIcon.path":"icon-d.svg","menu.normalIcon.name":"icon-d","menu.activeIcon.path":"icon-b.svg","menu.activeIcon.name":"icon-b","menu.disabledIcon.path":"icon-a.svg","menu.disabledIcon.name":"icon-a","menu.hoverIcon.path":"icon-c.svg","menu.hoverIcon.name":"icon-c","menu.iconSize.width":"24px","menu.iconSize.height":"24px","submenu.backgroundColor":"transparent","submenu.partition.color":"#858585","submenu.normalIcon.path":"icon-a.svg","submenu.normalIcon.name":"icon-a","submenu.activeIcon.path":"icon-c.svg","submenu.activeIcon.name":"icon-c","submenu.iconSize.width":"32px","submenu.iconSize.height":"32px","submenu.normalLabel.color":"#858585","submenu.normalLabel.fontWeight":"lighter","submenu.activeLabel.color":"#fff","submenu.activeLabel.fontWeight":"lighter","checkbox.border":"1px solid #ccc","checkbox.backgroundColor":"#fff","range.pointer.color":"#fff","range.bar.color":"#666","range.subbar.color":"#d1d1d1","range.disabledPointer.color":"red","range.disabledBar.color":"blue","range.disabledSubbar.color":"red","range.value.color":"#fff","range.value.fontWeight":"lighter","range.value.fontSize":"11px","range.value.border":"1px solid #353535","range.value.backgroundColor":"#151515","range.title.color":"#fff","range.title.fontWeight":"lighter","colorpicker.button.border":"1px solid #1e1e1e","colorpicker.title.color":"#fff"}},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=i(4),a=i(5),c=i(126),l=n(c),u=i(137),h=n(u),f=function(){function t(e){r(this,t),this.styles=this._changeToObject((0,s.extend)(h.default,e)),(0,a.styleLoad)(this._styleMaker())}return o(t,[{key:"getStyle",value:function(t){var e=null,i=t.replace(/\..+$/,""),n=this.styles[t];switch(t){case"common.bi":e=this.styles[t].image;break;case"menu.icon":case"submenu.icon":e={active:this.styles[i+".activeIcon"],normal:this.styles[i+".normalIcon"],hover:this.styles[i+".hoverIcon"],disabled:this.styles[i+".disabledIcon"]};break;case"submenu.label":e={active:this._makeCssText(this.styles[i+".activeLabel"]),normal:this._makeCssText(this.styles[i+".normalLabel"])};break;case"submenu.partition":e={vertical:this._makeCssText((0,s.extend)({},n,{borderLeft:"1px solid "+n.color})),horizontal:this._makeCssText((0,s.extend)({},n,{borderBottom:"1px solid "+n.color}))};break;case"range.disabledPointer":case"range.disabledBar":case"range.disabledSubbar":case"range.pointer":case"range.bar":case"range.subbar":n.backgroundColor=n.color,e=this._makeCssText(n);break;default:e=this._makeCssText(n)}return e}},{key:"_styleMaker",value:function(){var t=this.getStyle("submenu.label"),e=this.getStyle("submenu.partition");return(0,l.default)({subMenuLabelActive:t.active,subMenuLabelNormal:t.normal,submenuPartitionVertical:e.vertical,submenuPartitionHorizontal:e.horizontal,biSize:this.getStyle("common.bisize"),subMenuRangeTitle:this.getStyle("range.title"),submenuRangePointer:this.getStyle("range.pointer"),submenuRangeBar:this.getStyle("range.bar"),submenuRangeSubbar:this.getStyle("range.subbar"),submenuDisabledRangePointer:this.getStyle("range.disabledPointer"),submenuDisabledRangeBar:this.getStyle("range.disabledBar"),submenuDisabledRangeSubbar:this.getStyle("range.disabledSubbar"),submenuRangeValue:this.getStyle("range.value"),submenuColorpickerTitle:this.getStyle("colorpicker.title"),submenuColorpickerButton:this.getStyle("colorpicker.button"),submenuCheckbox:this.getStyle("checkbox"),menuIconSize:this.getStyle("menu.iconSize"),submenuIconSize:this.getStyle("submenu.iconSize")})}},{key:"_changeToObject",value:function(t){var e={};return(0,s.forEach)(t,function(t,i){var n=i.match(/^(.+)\.([a-z]+)$/i),r=n[1],o=n[2];e[r]||(e[r]={}),e[r][o]=t}),e}},{key:"_makeCssText",value:function(t){var e=this,i=[];return(0,s.forEach)(t,function(t,n){["backgroundImage"].indexOf(n)>-1&&"none"!==t&&(t="url("+t+")"),i.push(e._toUnderScore(n)+": "+t)}),i.join(";")}},{key:"_toUnderScore",value:function(t){return t.replace(/([A-Z])/g,function(t,e){return"-"+e.toLowerCase()})}}]),t}();e.default=f},function(t,e){"use strict";function i(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");i===-1&&(i=e);var n=i===e?0:4-i%4;return[i,n]}function n(t){var e=i(t),n=e[0],r=e[1];return 3*(n+r)/4-r}function r(t,e,i){return 3*(e+i)/4-i}function o(t){for(var e,n=i(t),o=n[0],s=n[1],a=new h(r(t,o,s)),c=0,l=s>0?o-4:o,f=0;f<l;f+=4)e=u[t.charCodeAt(f)]<<18|u[t.charCodeAt(f+1)]<<12|u[t.charCodeAt(f+2)]<<6|u[t.charCodeAt(f+3)],a[c++]=e>>16&255,a[c++]=e>>8&255,a[c++]=255&e;return 2===s&&(e=u[t.charCodeAt(f)]<<2|u[t.charCodeAt(f+1)]>>4,a[c++]=255&e),1===s&&(e=u[t.charCodeAt(f)]<<10|u[t.charCodeAt(f+1)]<<4|u[t.charCodeAt(f+2)]>>2,a[c++]=e>>8&255,a[c++]=255&e),a}function s(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function a(t,e,i){for(var n,r=[],o=e;o<i;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),r.push(s(n));return r.join("")}function c(t){for(var e,i=t.length,n=i%3,r=[],o=16383,s=0,c=i-n;s<c;s+=o)r.push(a(t,s,s+o>c?c:s+o));return 1===n?(e=t[i-1],r.push(l[e>>2]+l[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],r.push(l[e>>10]+l[e>>4&63]+l[e<<2&63]+"=")),r.join("")}e.byteLength=n,e.toByteArray=o,e.fromByteArray=c;for(var l=[],u=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=f.length;d<p;++d)l[d]=f[d],u[f.charCodeAt(d)]=d;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},function(t,e){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e,i,n){if(!(t instanceof e)||void 0!==n&&n in t)throw TypeError(i+": incorrect invocation!");return t}},function(t,e,i){var n=i(37),r=i(50),o=i(164);t.exports=function(t){return function(e,i,s){var a,c=n(e),l=r(c.length),u=o(s,l);if(t&&i!=i){for(;l>u;)if(a=c[u++],a!=a)return!0}else for(;l>u;u++)if((t||u in c)&&c[u]===i)return t||u||0;return!t&&-1}}},function(t,e,i){var n=i(25),r=i(149),o=i(148),s=i(14),a=i(50),c=i(167),l={},u={},e=t.exports=function(t,e,i,h,f){var d,p,g,v,m=f?function(){return t}:c(t),b=n(i,h,e?2:1),y=0;if("function"!=typeof m)throw TypeError(t+" is not iterable!");if(o(m)){for(d=a(t.length);d>y;y++)if(v=e?b(s(p=t[y])[0],p[1]):b(t[y]),v===l||v===u)return v}else for(g=m.call(t);!(p=g.next()).done;)if(v=r(g,b,p.value,e),v===l||v===u)return v};e.BREAK=l,e.RETURN=u},function(t,e,i){t.exports=!i(21)&&!i(43)(function(){return 7!=Object.defineProperty(i(33)("div"),"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t,e,i){var n=void 0===i;switch(e.length){case 0:return n?t():t.call(i);case 1:return n?t(e[0]):t.call(i,e[0]);case 2:return n?t(e[0],e[1]):t.call(i,e[0],e[1]);case 3:return n?t(e[0],e[1],e[2]):t.call(i,e[0],e[1],e[2]);case 4:return n?t(e[0],e[1],e[2],e[3]):t.call(i,e[0],e[1],e[2],e[3])}return t.apply(i,e)}},function(t,e,i){var n=i(24);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t,e,i){var n=i(22),r=i(7)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(n.Array===t||o[r]===t)}},function(t,e,i){var n=i(14);t.exports=function(t,e,i,r){try{return r?e(n(i)[0],i[1]):e(i)}catch(e){var o=t.return;throw void 0!==o&&n(o.call(t)),e}}},function(t,e,i){"use strict";var n=i(154),r=i(47),o=i(34),s={};i(15)(s,i(7)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=n(s,{next:r(1,i)}),o(t,e+" Iterator")}},function(t,e,i){var n=i(7)("iterator"),r=!1;try{var o=[7][n]();o.return=function(){r=!0},Array.from(o,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!r)return!1;var i=!1;try{var o=[7],s=o[n]();s.next=function(){return{done:i=!0}},o[n]=function(){return s},t(o)}catch(t){}return i}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,i){var n=i(8),r=i(49).set,o=n.MutationObserver||n.WebKitMutationObserver,s=n.process,a=n.Promise,c="process"==i(24)(s);t.exports=function(){var t,e,i,l=function(){var n,r;for(c&&(n=s.domain)&&n.exit();t;){r=t.fn,t=t.next;try{r()}catch(n){throw t?i():e=void 0,n}}e=void 0,n&&n.enter()};if(c)i=function(){s.nextTick(l)};else if(o){var u=!0,h=document.createTextNode("");new o(l).observe(h,{characterData:!0}),i=function(){h.data=u=!u}}else if(a&&a.resolve){var f=a.resolve();i=function(){f.then(l)}}else i=function(){r.call(n,l)};return function(n){var r={fn:n,next:void 0};e&&(e.next=r),t||(t=r,i()),e=r}}},function(t,e,i){var n=i(14),r=i(155),o=i(41),s=i(35)("IE_PROTO"),a=function(){},c="prototype",l=function(){var t,e=i(33)("iframe"),n=o.length,r="<",s=">";for(e.style.display="none",i(44).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(r+"script"+s+"document.F=Object"+r+"/script"+s),t.close(),l=t.F;n--;)delete l[c][o[n]];return l()};t.exports=Object.create||function(t,e){var i;return null!==t?(a[c]=n(t),i=new a,a[c]=null,i[s]=t):i=l(),void 0===e?i:r(i,e)}},function(t,e,i){var n=i(28),r=i(14),o=i(158);t.exports=i(21)?Object.defineProperties:function(t,e){r(t);for(var i,s=o(e),a=s.length,c=0;a>c;)n.f(t,i=s[c++],e[i]);return t}},function(t,e,i){var n=i(26),r=i(165),o=i(35)("IE_PROTO"),s=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=r(t),n(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},function(t,e,i){var n=i(26),r=i(37),o=i(143)(!1),s=i(35)("IE_PROTO");t.exports=function(t,e){var i,a=r(t),c=0,l=[];for(i in a)i!=s&&n(a,i)&&l.push(i);for(;e.length>c;)n(a,i=e[c++])&&(~o(l,i)||l.push(i));return l}},function(t,e,i){var n=i(157),r=i(41);t.exports=Object.keys||function(t){return n(t,r)}},function(t,e,i){var n=i(15);t.exports=function(t,e,i){for(var r in e)i&&t[r]?t[r]=e[r]:n(t,r,e[r]);return t}},function(t,e,i){t.exports=i(15)},function(t,e,i){"use strict";var n=i(8),r=i(20),o=i(28),s=i(21),a=i(7)("species");t.exports=function(t){var e="function"==typeof r[t]?r[t]:n[t];s&&e&&!e[a]&&o.f(e,a,{configurable:!0,get:function(){return this}})}},function(t,e,i){var n=i(14),r=i(31),o=i(7)("species");t.exports=function(t,e){var i,s=n(t).constructor;return void 0===s||void 0==(i=n(s)[o])?e:r(i)}},function(t,e,i){var n=i(36),r=i(32);t.exports=function(t){return function(e,i){var o,s,a=String(r(e)),c=n(i),l=a.length;return c<0||c>=l?t?"":void 0:(o=a.charCodeAt(c),o<55296||o>56319||c+1===l||(s=a.charCodeAt(c+1))<56320||s>57343?t?a.charAt(c):o:t?a.slice(c,c+2):(o-55296<<10)+(s-56320)+65536)}}},function(t,e,i){var n=i(36),r=Math.max,o=Math.min;t.exports=function(t,e){return t=n(t),t<0?r(t+e,0):o(t,e)}},function(t,e,i){var n=i(32);t.exports=function(t){return Object(n(t))}},function(t,e,i){var n=i(27);t.exports=function(t,e){if(!n(t))return t;var i,r;if(e&&"function"==typeof(i=t.toString)&&!n(r=i.call(t)))return r;if("function"==typeof(i=t.valueOf)&&!n(r=i.call(t)))return r;if(!e&&"function"==typeof(i=t.toString)&&!n(r=i.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){var n=i(40),r=i(7)("iterator"),o=i(22);t.exports=i(20).getIteratorMethod=function(t){if(void 0!=t)return t[r]||t["@@iterator"]||o[n(t)]}},function(t,e,i){"use strict";var n=i(141),r=i(152),o=i(22),s=i(37);t.exports=i(45)(Array,"Array",function(t,e){this._t=s(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,i=this._i++;return!t||i>=t.length?(this._t=void 0,r(1)):"keys"==e?r(0,i):"values"==e?r(0,t[i]):r(0,[i,t[i]])},"values"),o.Arguments=o.Array,n("keys"),n("values"),n("entries")},function(t,e){},function(t,e,i){"use strict";var n,r,o,s=i(46),a=i(8),c=i(25),l=i(40),u=i(42),h=i(27),f=i(31),d=i(142),p=i(144),g=i(162),v=i(49).set,m=i(153)(),b="Promise",y=a.TypeError,_=a.process,x=a[b],_=a.process,w="process"==l(_),S=function(){},C=!!function(){try{var t=x.resolve(1),e=(t.constructor={})[i(7)("species")]=function(t){t(S,S)};return(w||"function"==typeof PromiseRejectionEvent)&&t.then(S)instanceof e}catch(t){}}(),k=function(t,e){return t===e||t===x&&e===o},O=function(t){var e;return!(!h(t)||"function"!=typeof(e=t.then))&&e},T=function(t){return k(x,t)?new E(t):new r(t)},E=r=function(t){var e,i;this.promise=new t(function(t,n){if(void 0!==e||void 0!==i)throw y("Bad Promise constructor");e=t,i=n}),this.resolve=f(e),this.reject=f(i)},j=function(t){try{t()}catch(t){return{error:t}}},M=function(t,e){if(!t._n){t._n=!0;var i=t._c;m(function(){for(var n=t._v,r=1==t._s,o=0,s=function(e){var i,o,s=r?e.ok:e.fail,a=e.resolve,c=e.reject,l=e.domain;try{s?(r||(2==t._h&&I(t),t._h=1),s===!0?i=n:(l&&l.enter(),i=s(n),l&&l.exit()),i===e.promise?c(y("Promise-chain cycle")):(o=O(i))?o.call(i,a,c):a(i)):c(n)}catch(t){c(t)}};i.length>o;)s(i[o++]);t._c=[],t._n=!1,e&&!t._h&&A(t)})}},A=function(t){v.call(a,function(){var e,i,n,r=t._v;if(P(t)&&(e=j(function(){w?_.emit("unhandledRejection",r,t):(i=a.onunhandledrejection)?i({promise:t,reason:r}):(n=a.console)&&n.error&&n.error("Unhandled promise rejection",r)}),t._h=w||P(t)?2:1),t._a=void 0,e)throw e.error})},P=function(t){if(1==t._h)return!1;for(var e,i=t._a||t._c,n=0;i.length>n;)if(e=i[n++],e.fail||!P(e.promise))return!1;return!0},I=function(t){v.call(a,function(){var e;w?_.emit("rejectionHandled",t):(e=a.onrejectionhandled)&&e({promise:t,reason:t._v})})},D=function(t){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=t,e._s=2,e._a||(e._a=e._c.slice()),M(e,!0))},L=function(t){var e,i=this;if(!i._d){i._d=!0,i=i._w||i;try{if(i===t)throw y("Promise can't be resolved itself");(e=O(t))?m(function(){var n={_w:i,_d:!1};try{e.call(t,c(L,n,1),c(D,n,1))}catch(t){D.call(n,t)}}):(i._v=t,i._s=1,M(i,!1))}catch(t){D.call({_w:i,_d:!1},t)}}};C||(x=function(t){d(this,x,b,"_h"),f(t),n.call(this);try{t(c(L,this,1),c(D,this,1))}catch(t){D.call(this,t)}},n=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},n.prototype=i(159)(x.prototype,{then:function(t,e){var i=T(g(this,x));return i.ok="function"!=typeof t||t,i.fail="function"==typeof e&&e,i.domain=w?_.domain:void 0,this._c.push(i),this._a&&this._a.push(i),this._s&&M(this,!1),i.promise},catch:function(t){return this.then(void 0,t)}}),E=function(){var t=new n;this.promise=t,this.resolve=c(L,t,1),this.reject=c(D,t,1)}),u(u.G+u.W+u.F*!C,{Promise:x}),i(34)(x,b),i(161)(b),o=i(20)[b],u(u.S+u.F*!C,b,{reject:function(t){var e=T(this),i=e.reject;return i(t),e.promise}}),u(u.S+u.F*(s||!C),b,{resolve:function(t){if(t instanceof x&&k(t.constructor,this))return t;var e=T(this),i=e.resolve;return i(t),e.promise}}),u(u.S+u.F*!(C&&i(151)(function(t){x.all(t).catch(S)})),b,{all:function(t){var e=this,i=T(e),n=i.resolve,r=i.reject,o=j(function(){var i=[],o=0,s=1;p(t,!1,function(t){var a=o++,c=!1;i.push(void 0),s++,e.resolve(t).then(function(t){c||(c=!0,i[a]=t,--s||n(i))},r)}),--s||n(i)});return o&&r(o.error),i.promise},race:function(t){var e=this,i=T(e),n=i.reject,r=j(function(){p(t,!1,function(t){e.resolve(t).then(i.resolve,n)})});return r&&n(r.error),i.promise}})},function(t,e,i){"use strict";var n=i(163)(!0);i(45)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,i=this._i;return i>=e.length?{value:void 0,done:!0}:(t=n(e,i),this._i+=t.length,{value:t,done:!1})})},function(t,e,i){i(168);for(var n=i(8),r=i(15),o=i(22),s=i(7)("toStringTag"),a=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],c=0;c<5;c++){var l=a[c],u=n[l],h=u&&u.prototype;h&&!h[s]&&r(h,s,l),o[l]=o.Array}},function(t,e){},function(t,e,i){var n=i(60),r=t.exports;for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o]);r.request=function(t,e){return t||(t={}),t.scheme="https",t.protocol="https:",n.request.call(this,t,e)}},function(t,e){e.read=function(t,e,i,n,r){var o,s,a=8*r-n-1,c=(1<<a)-1,l=c>>1,u=-7,h=i?r-1:0,f=i?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+t[e+h],h+=f,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:(d?-1:1)*(1/0);s+=Math.pow(2,n),o-=l}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,i,n,r,o){var s,a,c,l=8*o-r-1,u=(1<<l)-1,h=u>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+h>=1?f/c:f*Math.pow(2,1-h),e*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[i+d]=255&a,d+=p,a/=256,r-=8);for(s=s<<r|a,l+=r;l>0;t[i+d]=255&s,d+=p,s/=256,l-=8);t[i+d-p]|=128*g}},function(t,e){"use strict";function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if("string"!=typeof t||0===t.length)return o;
var s=/\+/g;t=t.split(e);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var c=t.length;a>0&&c>a&&(c=a);for(var l=0;l<c;++l){var u,h,f,d,p=t[l].replace(s,"%20"),g=p.indexOf(n);g>=0?(u=p.substr(0,g),h=p.substr(g+1)):(u=p,h=""),f=decodeURIComponent(u),d=decodeURIComponent(h),i(o,f)?Array.isArray(o[f])?o[f].push(d):o[f]=[o[f],d]:o[f]=d}return o}},function(t,e){"use strict";var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,n,r){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map(function(r){var o=encodeURIComponent(i(r))+n;return Array.isArray(t[r])?t[r].map(function(t){return o+encodeURIComponent(i(t))}).join(e):o+encodeURIComponent(i(t[r]))}).join(e):r?encodeURIComponent(i(r))+n+encodeURIComponent(i(t)):""}},function(t,e,i){"use strict";e.decode=e.parse=i(176),e.encode=e.stringify=i(177)},function(t,e,i){"use strict";function n(t){return this instanceof n?void r.call(this,t):new n(t)}t.exports=n;var r=i(55),o=i(23);o.inherits=i(11),o.inherits(n,r),n.prototype._transform=function(t,e,i){i(null,t)}},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e,i){t.copy(e,i)}var o=i(30).Buffer,s=i(195);t.exports=function(){function t(){n(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,i=""+e.data;e=e.next;)i+=t+e.data;return i},t.prototype.concat=function(t){if(0===this.length)return o.alloc(0);if(1===this.length)return this.head.data;for(var e=o.allocUnsafe(t>>>0),i=this.head,n=0;i;)r(i.data,e,n),n+=i.data.length,i=i.next;return e},t}(),s&&s.inspect&&s.inspect.custom&&(t.exports.prototype[s.inspect.custom]=function(){var t=s.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e,i){(function(t,e){!function(t,i){"use strict";function n(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i<e.length;i++)e[i]=arguments[i+1];var n={callback:t,args:e};return g[p]=n,d(p),p++}function r(t){delete g[t]}function o(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(i,n)}}function s(t){if(v)setTimeout(s,0,t);else{var e=g[t];if(e){v=!0;try{o(e)}finally{r(t),v=!1}}}}function a(){d=function(t){e.nextTick(function(){s(t)})}}function c(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}function l(){var e="setImmediate$"+Math.random()+"$",i=function(i){i.source===t&&"string"==typeof i.data&&0===i.data.indexOf(e)&&s(+i.data.slice(e.length))};t.addEventListener?t.addEventListener("message",i,!1):t.attachEvent("onmessage",i),d=function(i){t.postMessage(e+i,"*")}}function u(){var t=new MessageChannel;t.port1.onmessage=function(t){var e=t.data;s(e)},d=function(e){t.port2.postMessage(e)}}function h(){var t=m.documentElement;d=function(e){var i=m.createElement("script");i.onreadystatechange=function(){s(e),i.onreadystatechange=null,t.removeChild(i),i=null},t.appendChild(i)}}function f(){d=function(t){setTimeout(s,0,t)}}if(!t.setImmediate){var d,p=1,g={},v=!1,m=t.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(t);b=b&&b.setTimeout?b:t,"[object process]"==={}.toString.call(t.process)?a():c()?l():t.MessageChannel?u():m&&"onreadystatechange"in m.createElement("script")?h():f(),b.setImmediate=n,b.clearImmediate=r}}("undefined"==typeof self?"undefined"==typeof t?this:t:self)}).call(e,function(){return this}(),i(12))},function(t,e,i){(function(e,n,r){function o(t,e){return a.fetch&&e?"fetch":a.mozchunkedarraybuffer?"moz-chunked-arraybuffer":a.msstream?"ms-stream":a.arraybuffer&&t?"arraybuffer":a.vbArray&&t?"text:vbarray":"text"}function s(t){try{var e=t.status;return null!==e&&0!==e}catch(t){return!1}}var a=i(61),c=i(11),l=i(62),u=i(59),h=i(184),f=l.IncomingMessage,d=l.readyStates,p=t.exports=function(t){var i=this;u.Writable.call(i),i._opts=t,i._body=[],i._headers={},t.auth&&i.setHeader("Authorization","Basic "+new e(t.auth).toString("base64")),Object.keys(t.headers).forEach(function(e){i.setHeader(e,t.headers[e])});var n,r=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!a.abortController)r=!1,n=!0;else if("prefer-streaming"===t.mode)n=!1;else if("allow-wrong-content-type"===t.mode)n=!a.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");n=!0}i._mode=o(n,r),i._fetchTimer=null,i.on("finish",function(){i._onFinish()})};c(p,u.Writable),p.prototype.setHeader=function(t,e){var i=this,n=t.toLowerCase();g.indexOf(n)===-1&&(i._headers[n]={name:t,value:e})},p.prototype.getHeader=function(t){var e=this._headers[t.toLowerCase()];return e?e.value:null},p.prototype.removeHeader=function(t){var e=this;delete e._headers[t.toLowerCase()]},p.prototype._onFinish=function(){var t=this;if(!t._destroyed){var i=t._opts,o=t._headers,s=null;"GET"!==i.method&&"HEAD"!==i.method&&(s=a.arraybuffer?h(e.concat(t._body)):a.blobConstructor?new n.Blob(t._body.map(function(t){return h(t)}),{type:(o["content-type"]||{}).value||""}):e.concat(t._body).toString());var c=[];if(Object.keys(o).forEach(function(t){var e=o[t].name,i=o[t].value;Array.isArray(i)?i.forEach(function(t){c.push([e,t])}):c.push([e,i])}),"fetch"===t._mode){var l=null;if(a.abortController){var u=new AbortController;l=u.signal,t._fetchAbortController=u,"requestTimeout"in i&&0!==i.requestTimeout&&(t._fetchTimer=n.setTimeout(function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()},i.requestTimeout))}n.fetch(t._opts.url,{method:t._opts.method,headers:c,body:s||void 0,mode:"cors",credentials:i.withCredentials?"include":"same-origin",signal:l}).then(function(e){t._fetchResponse=e,t._connect()},function(e){n.clearTimeout(t._fetchTimer),t._destroyed||t.emit("error",e)})}else{var f=t._xhr=new n.XMLHttpRequest;try{f.open(t._opts.method,t._opts.url,!0)}catch(e){return void r.nextTick(function(){t.emit("error",e)})}"responseType"in f&&(f.responseType=t._mode.split(":")[0]),"withCredentials"in f&&(f.withCredentials=!!i.withCredentials),"text"===t._mode&&"overrideMimeType"in f&&f.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in i&&(f.timeout=i.requestTimeout,f.ontimeout=function(){t.emit("requestTimeout")}),c.forEach(function(t){f.setRequestHeader(t[0],t[1])}),t._response=null,f.onreadystatechange=function(){switch(f.readyState){case d.LOADING:case d.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(f.onprogress=function(){t._onXHRProgress()}),f.onerror=function(){t._destroyed||t.emit("error",new Error("XHR error"))};try{f.send(s)}catch(e){return void r.nextTick(function(){t.emit("error",e)})}}}},p.prototype._onXHRProgress=function(){var t=this;s(t._xhr)&&!t._destroyed&&(t._response||t._connect(),t._response._onXHRProgress())},p.prototype._connect=function(){var t=this;t._destroyed||(t._response=new f(t._xhr,t._fetchResponse,t._mode,t._fetchTimer),t._response.on("error",function(e){t.emit("error",e)}),t.emit("response",t._response))},p.prototype._write=function(t,e,i){var n=this;n._body.push(t),i()},p.prototype.abort=p.prototype.destroy=function(){var t=this;t._destroyed=!0,n.clearTimeout(t._fetchTimer),t._response&&(t._response._destroyed=!0),t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort()},p.prototype.end=function(t,e,i){var n=this;"function"==typeof t&&(i=t,t=void 0),u.Writable.prototype.end.call(n,t,e,i)},p.prototype.flushHeaders=function(){},p.prototype.setTimeout=function(){},p.prototype.setNoDelay=function(){},p.prototype.setSocketKeepAlive=function(){};var g=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(e,i(13).Buffer,function(){return this}(),i(12))},function(t,e,i){(function(t){function n(t,e){this._id=t,this._clearFn=e}var r="undefined"!=typeof t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;e.setTimeout=function(){return new n(o.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new n(o.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},i(181),e.setImmediate="undefined"!=typeof self&&self.setImmediate||"undefined"!=typeof t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||"undefined"!=typeof t&&t.clearImmediate||this&&this.clearImmediate}).call(e,function(){return this}())},function(t,e,i){var n=i(13).Buffer;t.exports=function(t){if(t instanceof Uint8Array){if(0===t.byteOffset&&t.byteLength===t.buffer.byteLength)return t.buffer;if("function"==typeof t.buffer.slice)return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}if(n.isBuffer(t)){for(var e=new Uint8Array(t.length),i=t.length,r=0;r<i;r++)e[r]=t[r];return e.buffer}throw new Error("Argument must be a Buffer")}},function(t,e,i){/*!
	 * Toast UI Colorpicker
	 * @version 2.2.0
	 * @author NHNEnt FE Development Team <dl_javascript@nhnent.com>
	 * @license MIT
	 */
!function(e,n){t.exports=n(i(4))}(this,function(t){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="dist",e(0)}([function(t,e,i){i(1),t.exports=i(6)},function(t,e){},,,,,function(t,e,i){"use strict";var n=i(7),r=i(9),o=i(10),s=i(11),a=i(12),c=i(13),l=i(16),u=i(18),h=i(14),f=i(19),d={domutil:n,domevent:r,Collection:o,View:s,Drag:a,create:c,Palette:l,Slider:u,colorutil:h,svgvml:f};t.exports=d},function(t,e,i){"use strict";function n(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var r,o,s=i(8),a=i(9),c=i(10),l=s,u="_pos",h="onselectstart"in document,f="",d=/^auto$|^$|%/;r={appendHTMLElement:function(t,e,i){var n;return i=i||"",n=document.createElement(t),n.className=i,e?e.appendChild(n):document.body.appendChild(n),n},remove:function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},get:function(t){return document.getElementById(t)},_matcher:function(t,e){var i=/^\./,n=/^#/;return i.test(e)?r.hasClass(t,e.replace(".","")):n.test(e)?t.id===e.replace("#",""):t.nodeName.toLowerCase()===e.toLowerCase()},find:function(t,e,i){function n(t,e){for(var l,u=t.childNodes,h=0,f=u.length;h<f;h+=1)if(l=u[h],"#text"!==l.nodeName)if(r._matcher(l,e)){if((c&&i(l)||!c)&&o.push(l),a){s=!0;break}}else if(l.childNodes.length>0&&(n(l,e),s))break}var o=[],s=!1,a=l.isUndefined(i)||i===!1,c=l.isFunction(i);return l.isString(e)&&(e=r.get(e)),e=e||window.document.body,n(e,t),a?o[0]||null:o},closest:function(t,e){var i=t.parentNode;if(r._matcher(t,e))return t;for(;i&&i!==window.document.body;){if(r._matcher(i,e))return i;i=i.parentNode}},text:function(t){var e="",i=0,n=t.nodeType;if(n){if(1===n||9===n||11===n){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)e+=r.text(t)}else if(3===n||4===n)return t.nodeValue}else for(;t[i];i+=1)e+=r.text(t[i]);return e},setData:function(t,e,i){return"dataset"in t?void(t.dataset[e]=i):void t.setAttribute("data-"+e,i)},getData:function(t,e){return"dataset"in t?t.dataset[e]:t.getAttribute("data-"+e)},hasClass:function(t,e){var i;return l.isUndefined(t.classList)?(i=r.getClass(t),i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)):t.classList.contains(e)},addClass:function(t,e){var i;l.isUndefined(t.classList)?r.hasClass(t,e)||(i=r.getClass(t),r.setClass(t,(i?i+" ":"")+e)):l.forEachArray(e.split(" "),function(e){t.classList.add(e)})},setClass:function(t,e){l.isUndefined(t.className.baseVal)?t.className=e:t.className.baseVal=e},removeClass:function(t,e){var i="";l.isUndefined(t.classList)?(i=(" "+r.getClass(t)+" ").replace(" "+e+" "," "),r.setClass(t,n(i))):t.classList.remove(e)},getClass:function(t){return t&&t.className?l.isUndefined(t.className.baseVal)?t.className:t.className.baseVal:""},getStyle:function(t,e){var i,n=t.style[e]||t.currentStyle&&t.currentStyle[e];return n&&"auto"!==n||!document.defaultView||(i=document.defaultView.getComputedStyle(t,null),n=i?i[e]:null),"auto"===n?null:n},getComputedStyle:function(t){var e=document.defaultView;return e&&e.getComputedStyle?document.defaultView.getComputedStyle(t):{getPropertyValue:function(e){var i=/(\-([a-z]){1})/g;return"float"===e&&(e="styleFloat"),i.test(e)&&(e=e.replace(i,function(){return arguments[2].toUpperCase()})),t.currentStyle[e]?t.currentStyle[e]:null}}},setPosition:function(t,e,i){e=l.isUndefined(e)?0:e,i=l.isUndefined(i)?0:i,t[u]=[e,i],t.style.left=e+"px",t.style.top=i+"px"},getPosition:function(t,e){var i,n,r;return e&&(t[u]=null),t[u]?t[u]:(i=0,n=0,(d.test(t.style.left)||d.test(t.style.top))&&"getBoundingClientRect"in t?(r=t.getBoundingClientRect(),i=r.left,n=r.top):(i=parseFloat(t.style.left||0),n=parseFloat(t.style.top||0)),[i,n])},getSize:function(t){var e,i=r.getStyle(t,"width"),n=r.getStyle(t,"height");return(d.test(i)||d.test(n))&&"getBoundingClientRect"in t?(e=t.getBoundingClientRect(),i=e.width,n=e.height):(i=parseFloat(i||0),n=parseFloat(n||0)),[i,n]},testProp:function(t){for(var e=document.documentElement.style,i=0,n=t.length;i<n;i+=1)if(t[i]in e)return t[i];return!1},getFormData:function(t){var e=new c(function(){return this.length}),i=function(t){return!t.disabled},n={};return e.add.apply(e,r.find("input",t,i).concat(r.find("select",t,i)).concat(r.find("textarea",t,i))),e=e.groupBy(function(t){return t&&t.getAttribute("name")||"_other"}),l.forEach(e,function(t,e){"_other"!==e&&t.each(function(i){var o=i.nodeName.toLowerCase(),s=i.type,a=[];"radio"===s?a=[t.find(function(t){return t.checked}).toArray().pop()]:"checkbox"===s?a=t.find(function(t){return t.checked}).toArray():"select"===o?t.find(function(t){return!!t.childNodes.length}).each(function(t){a=a.concat(r.find("option",t,function(t){return t.selected}))}):a=t.find(function(t){return""!==t.value}).toArray(),a=l.map(a,function(t){return t.value}),a.length?1===a.length&&(a=a[0]):a="",n[e]=a})}),n}},o=r.testProp(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]),r.disableTextSelection=function(){return h?function(){a.on(window,"selectstart",a.preventDefault)}:function(){var t=document.documentElement.style;f=t[o],t[o]="none"}}(),r.enableTextSelection=function(){return h?function(){a.off(window,"selectstart",a.preventDefault)}:function(){document.documentElement.style[o]=f}}(),r.disableImageDrag=function(){a.on(window,"dragstart",a.preventDefault)},r.enableImageDrag=function(){a.off(window,"dragstart",a.preventDefault)},r.applyTemplate=function(t,e){var i=t.replace(/\{\{(\w*)\}\}/g,function(t,i){return e.hasOwnProperty(i)?e[i]:""});return i},t.exports=r},function(e,i){e.exports=t},function(t,e,i){"use strict";var n=i(8),r=n,o=r.browser,s="_evt",a={START:["touchstart","mousedown"],END:{mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},MOVE:{mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"}},c={on:function(t,e,i,n){return r.isString(e)?void r.forEach(e.split(" "),function(e){c._on(t,e,i,n)}):void r.forEachOwnProperties(e,function(e,n){c._on(t,n,e,i)})},_on:function(t,e,i,n){var o,a,l;o=e+r.stamp(i)+(n?"_"+r.stamp(n):""),t[s]&&t[s][o]||(a=function(e){i.call(n||t,e||window.event)},l=a,"addEventListener"in t?"mouseenter"===e||"mouseleave"===e?(a=function(e){e=e||window.event,c._checkMouse(t,e)&&l(e)},t.addEventListener("mouseenter"===e?"mouseover":"mouseout",a,!1)):("mousewheel"===e&&t.addEventListener("DOMMouseScroll",a,!1),t.addEventListener(e,a,!1)):"attachEvent"in t&&t.attachEvent("on"+e,a),t[s]=t[s]||{},t[s][o]=a)},off:function(t,e,i,n){return r.isString(e)?void r.forEach(e.split(" "),function(e){c._off(t,e,i,n)}):void r.forEachOwnProperties(e,function(e,n){c._off(t,n,e,i)})},_off:function(t,e,i,n){var o=e+r.stamp(i)+(n?"_"+r.stamp(n):""),a=t[s]&&t[s][o];if(a){if("removeEventListener"in t)"mouseenter"===e||"mouseleave"===e?t.removeEventListener("mouseenter"===e?"mouseover":"mouseout",a,!1):("mousewheel"===e&&t.removeEventListener("DOMMouseScroll",a,!1),t.removeEventListener(e,a,!1));else if("detachEvent"in t)try{t.detachEvent("on"+e,a)}catch(t){}if(delete t[s][o],!r.keys(t[s]).length)return r.browser.msie&&r.browser.version<9?void(t[s]=null):void delete t[s]}},once:function(t,e,i,n){function o(){i.apply(n||t,arguments),s._off(t,e,o,n)}var s=this;return r.isObject(e)?void r.forEachOwnProperties(e,function(e,n){c.once(t,n,e,i)}):void c.on(t,e,o,n)},stopPropagation:function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},preventDefault:function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},stop:function(t){c.preventDefault(t),c.stopPropagation(t)},disableScrollPropagation:function(t){c.on(t,"mousewheel MozMousePixelScroll",c.stopPropagation)},disableClickPropagation:function(t){c.on(t,a.START.join(" ")+" click dblclick",c.stopPropagation)},getMousePosition:function(t,e){var i;return e?(i=e.getBoundingClientRect(),[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]):[t.clientX,t.clientY]},getWheelDelta:function(t){var e=0;return t.wheelDelta&&(e=t.wheelDelta/120),t.detail&&(e=-t.detail/3),e},_checkMouse:function(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t},trigger:function(t,e,i){var n=/(mouse|click)/;r.isUndefined(i)&&n.exec(e)&&(i=c.mouseEvent(e)),t.dispatchEvent?t.dispatchEvent(i):t.fireEvent&&t.fireEvent("on"+e,i)},mouseEvent:function(t,e){var i,n;return n=r.extend({bubbles:!0,cancelable:"mousemove"!==t,view:window,wheelDelta:0,detail:0,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:void 0},e),o.msie&&o.version<9&&delete n.wheelDelta,"function"==typeof document.createEvent?(i=document.createEvent("MouseEvents"),i.initMouseEvent(t,n.bubbles,n.cancelable,n.view,n.detail,n.screenX,n.screenY,n.clientX,n.clientY,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey,n.button,document.body.parentNode)):document.createEventObject&&(i=document.createEventObject(),r.forEach(n,function(t,e){i[e]=t},this),i.button={0:1,1:4,2:2}[i.button]||i.button),i},getMouseButton:function(t){var e,i="0,1,3,5,7",n="2,6",r="4";return document.implementation.hasFeature("MouseEvents","2.0")?t.button:(e=t.button+"",~i.indexOf(e)?0:~n.indexOf(e)?2:~r.indexOf(e)?1:void 0)}};t.exports=c},function(t,e,i){"use strict";function n(t){this.items={},this.length=0,c(t)&&(this.getItemID=t)}var r=i(8),o=r,s=o.forEachOwnProperties,a=o.forEachArray,c=o.isFunction,l=o.isObject,u=Array.prototype.slice;n.and=function(t){var e;return t=u.call(arguments),e=t.length,function(i){for(var n=0;n<e;n+=1)if(!t[n].call(null,i))return!1;return!0}},n.or=function(t){var e;return t=u.call(arguments),e=t.length,function(i){for(var n=1,r=t[0].call(null,i);n<e;n+=1)r=r||t[n].call(null,i);return r}},n.merge=function(t){var e=u.call(arguments),i={},r=new n(e[0].getItemID),s=o.extend;return a(e,function(t){s(i,t.items)}),r.items=i,r.length=o.keys(r.items).length,r},n.prototype.getItemID=function(t){return t._id+""},n.prototype.add=function(t){var e,i;return arguments.length>1?void a(u.call(arguments),function(t){this.add(t)},this):(e=this.getItemID(t),i=this.items,i[e]||(this.length+=1),void(i[e]=t))},n.prototype.remove=function(t){var e,i,n=[];return this.length?arguments.length>1?n=o.map(u.call(arguments),function(t){return this.remove(t)},this):(e=this.items,l(t)&&(t=this.getItemID(t)),e[t]?(this.length-=1,i=e[t],delete e[t],i):n):n},n.prototype.clear=function(){this.items={},this.length=0},n.prototype.has=function(t){var e,i;return!!this.length&&(e=c(t),i=!1,e?this.each(function(e){return t(e)!==!0||(i=!0,!1)}):(t=l(t)?this.getItemID(t):t,i=o.isExisty(this.items[t])),i)},n.prototype.doWhenHas=function(t,e,i){var n=this.items[t];o.isExisty(n)&&e.call(i||this,n)},n.prototype.find=function(t){var e=new n;return this.hasOwnProperty("getItemID")&&(e.getItemID=this.getItemID),this.each(function(i){t(i)===!0&&e.add(i)}),e},n.prototype.groupBy=function(t,e){var i,r,s={},a=c(t),l=this.getItemID;if(o.isArray(t)){if(o.forEachArray(t,function(t){s[t+""]=new n(l)}),!e)return s;t=e,a=!0}return this.each(function(e){a?r=t(e):(r=e[t],c(r)&&(r=r.apply(e))),i=s[r],i||(i=s[r]=new n(l)),i.add(e)}),s},n.prototype.single=function(){var t;return this.each(function(e){return t=e,!1},this),t},n.prototype.sort=function(t){var e=[];return this.each(function(t){e.push(t)}),c(t)&&(e=e.sort(t)),e},n.prototype.each=function(t,e){s(this.items,t,e||this)},n.prototype.toArray=function(){return this.length?o.map(this.items,function(t){return t}):[]},t.exports=n},function(t,e,i){"use strict";function n(t,e){var i=r.stamp(this);t=t||{},r.isUndefined(e)&&(e=o.appendHTMLElement("div")),o.addClass(e,"tui-view-"+i),this.id=i,this.container=e,this.childs=new s(function(t){return r.stamp(t)}),this.parent=null}var r=i(8),o=i(7),s=i(10);n.prototype.addChild=function(t,e){e&&e.call(t,this),t.parent=this,this.childs.add(t)},n.prototype.removeChild=function(t,e){var i=r.isNumber(t)?this.childs.items[t]:t;t=r.stamp(i),e&&e.call(i,this),this.childs.remove(t)},n.prototype.render=function(){this.childs.each(function(t){t.render()})},n.prototype.recursive=function(t,e){r.isFunction(t)&&(e||t(this),this.childs.each(function(e){e.recursive(t)}))},n.prototype.resize=function(){for(var t=Array.prototype.slice.call(arguments),e=this.parent;e;)r.isFunction(e._onResize)&&e._onResize.apply(e,t),e=e.parent},n.prototype._beforeDestroy=function(){},n.prototype._destroy=function(){this._beforeDestroy(),this.childs.clear(),this.container.innerHTML="",this.id=this.parent=this.childs=this.container=null},n.prototype.destroy=function(t){this.childs.each(function(t){t.destroy(!0),t._destroy()}),t||this._destroy()},n.prototype.getViewBound=function(){var t=this.container,e=o.getPosition(t),i=o.getSize(t);return{x:e[0],y:e[1],width:i[0],height:i[1]}},t.exports=n},function(t,e,i){(function(e){"use strict";function n(t,e){s.on(e,"mousedown",this._onMouseDown,this),this.options=r.extend({distance:10},t),this.container=e,this._isMoved=!1,this._distance=0,this._dragStartFired=!1,this._dragStartEventData=null}var r=i(8),o=i(7),s=i(9);n.prototype.destroy=function(){s.off(this.container,"mousedown",this._onMouseDown,this),this.options=this.container=this._isMoved=this._distance=this._dragStartFired=this._dragStartEventData=null},n.prototype._toggleDragEvent=function(t){var i,n,r=this.container;t?(i="on",n="disable"):(i="off",n="enable"),o[n+"TextSelection"](r),o[n+"ImageDrag"](r),s[i](e.document,{mousemove:this._onMouseMove,mouseup:this._onMouseUp},this)},n.prototype._getEventData=function(t){return{target:t.target||t.srcElement,originEvent:t}},n.prototype._onMouseDown=function(t){0===s.getMouseButton(t)&&(this._distance=0,this._dragStartFired=!1,this._dragStartEventData=this._getEventData(t),this._toggleDragEvent(!0))},n.prototype._onMouseMove=function(t){var e=this.options.distance;return s.preventDefault(t),this._isMoved=!0,this._distance<e?void(this._distance+=1):this._dragStartFired||(this._dragStartFired=!0,this.invoke("dragStart",this._dragStartEventData))?void this.fire("drag",this._getEventData(t)):void this._toggleDragEvent(!1)},n.prototype._onMouseUp=function(t){return this._toggleDragEvent(!1),this._isMoved?(this._isMoved=!1,void this.fire("dragEnd",this._getEventData(t))):void this.fire("click",this._getEventData(t))},r.CustomEvents.mixin(n),t.exports=n}).call(e,function(){return this}())},function(t,e,i){"use strict";function n(){var t=location.hostname;u||(u=!0,o.imagePing("https://www.google-analytics.com/collect",{v:1,t:"event",tid:"UA-115377265-9",cid:t,dp:t,dh:"color-picker"}))}function r(t){var e;if(!(this instanceof r))return new r(t);if(t=this.options=o.extend({container:null,color:"#f8f8f8",preset:["#181818","#282828","#383838","#585858","#b8b8b8","#d8d8d8","#e8e8e8","#f8f8f8","#ab4642","#dc9656","#f7ca88","#a1b56c","#86c1b9","#7cafc2","#ba8baf","#a16946"],cssPrefix:"tui-colorpicker-",detailTxt:"Detail",usageStatistics:!0},t),!t.container)throw new Error("ColorPicker(): need container option.");e=this.layout=new a(t,t.container),this.palette=new c(t,e.container),this.palette.on({_selectColor:this._onSelectColorInPalette,_toggleSlider:this._onToggleSlider},this),this.slider=new l(t,e.container),this.slider.on("_selectColor",this._onSelectColorInSlider,this),e.addChild(this.palette),e.addChild(this.slider),this.render(t.color),t.usageStatistics&&n()}var o=i(8),s=i(14),a=i(15),c=i(16),l=i(18),u=!1;r.prototype._onSelectColorInPalette=function(t){var e=t.color,i=this.options;return s.isValidRGB(e)||""===e?(this.fire("selectColor",{color:e,origin:"palette"}),void(i.color!==e&&(i.color=e,this.render(e)))):void this.render()},r.prototype._onToggleSlider=function(){this.slider.toggle(!this.slider.isVisible())},r.prototype._onSelectColorInSlider=function(t){var e=t.color,i=this.options;this.fire("selectColor",{color:e,origin:"slider"}),i.color!==e&&(i.color=e,this.palette.render(e))},r.prototype.setColor=function(t){if(!s.isValidRGB(t))throw new Error("ColorPicker#setColor(): need valid hex string color value");this.options.color=t,this.render(t)},r.prototype.getColor=function(){return this.options.color},r.prototype.toggle=function(t){this.layout.container.style.display=t?"block":"none"},r.prototype.render=function(t){this.layout.render(t||this.options.color)},r.prototype.destroy=function(){this.layout.destroy(),this.options.container.innerHTML="",this.layout=this.slider=this.palette=this.options=null},o.CustomEvents.mixin(r),t.exports=r},function(t,e){"use strict";var i=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,n={leadingZero:function(t,e){var i="",n=0;if((t+"").length>e)return t+"";for(;n<e-1;n+=1)i+="0";return(i+t).slice(e*-1)},isValidRGB:function(t){return i.test(t)},
// @license RGB <-> HSV conversion utilities based off of http://www.cs.rit.edu/~ncs/color/t_convert.html
hexToRGB:function(t){var e,i,r;return!!n.isValidRGB(t)&&(t=t.substring(1),e=parseInt(t.substr(0,2),16),i=parseInt(t.substr(2,2),16),r=parseInt(t.substr(4,2),16),[e,i,r])},rgbToHEX:function(t,e,i){var r="#"+n.leadingZero(t.toString(16),2)+n.leadingZero(e.toString(16),2)+n.leadingZero(i.toString(16),2);return!!n.isValidRGB(r)&&r},rgbToHSV:function(t,e,i){var n,r,o,s,a,c;if(t/=255,e/=255,i/=255,n=Math.max(t,e,i),r=Math.min(t,e,i),a=n,c=n-r,s=0===n?0:c/n,n===r)o=0;else{switch(n){case t:o=(e-i)/c+(e<i?6:0);break;case e:o=(i-t)/c+2;break;case i:o=(t-e)/c+4}o/=6}return[Math.round(360*o),Math.round(100*s),Math.round(100*a)]},hsvToRGB:function(t,e,i){var n,r,o,s,a,c,l,u;if(t=Math.max(0,Math.min(360,t)),e=Math.max(0,Math.min(100,e)),i=Math.max(0,Math.min(100,i)),e/=100,i/=100,0===e)return n=r=o=i,[Math.round(255*n),Math.round(255*r),Math.round(255*o)];switch(t/=60,s=Math.floor(t),a=t-s,c=i*(1-e),l=i*(1-e*a),u=i*(1-e*(1-a)),s){case 0:n=i,r=u,o=c;break;case 1:n=l,r=i,o=c;break;case 2:n=c,r=i,o=u;break;case 3:n=c,r=l,o=i;break;case 4:n=u,r=c,o=i;break;default:n=i,r=c,o=l}return[Math.round(255*n),Math.round(255*r),Math.round(255*o)]}};t.exports=n},function(t,e,i){"use strict";function n(t,e){this.options=r.extend({cssPrefix:"tui-colorpicker-"},t),e=o.appendHTMLElement("div",e,this.options.cssPrefix+"container"),s.call(this,t,e),this.render()}var r=i(8),o=i(7),s=i(11);r.inherit(n,s),n.prototype.render=function(t){this.recursive(function(e){e.render(t)},!0)},t.exports=n},function(t,e,i){"use strict";function n(t,e){this.options=r.extend({cssPrefix:"tui-colorpicker-",preset:["#181818","#282828","#383838","#585858","#B8B8B8","#D8D8D8","#E8E8E8","#F8F8F8","#AB4642","#DC9656","#F7CA88","#A1B56C","#86C1B9","#7CAFC2","#BA8BAF","#A16946"],detailTxt:"Detail"},t),e=o.appendHTMLElement("div",e,this.options.cssPrefix+"palette-container"),c.call(this,t,e)}var r=i(8),o=i(7),s=i(14),a=i(9),c=i(11),l=i(17);r.inherit(n,c),n.prototype._onClick=function(t){var e=this.options,i=t.srcElement||t.target,n={};return o.hasClass(i,e.cssPrefix+"palette-button")?(n.color=i.value,void this.fire("_selectColor",n)):void(o.hasClass(i,e.cssPrefix+"palette-toggle-slider")&&this.fire("_toggleSlider"))},n.prototype._onChange=function(t){var e=this.options,i=t.srcElement||t.target,n={};o.hasClass(i,e.cssPrefix+"palette-hex")&&(n.color=i.value,this.fire("_selectColor",n))},n.prototype._beforeDestroy=function(){this._toggleEvent(!1)},n.prototype._toggleEvent=function(t){var e,i=this.options,n=this.container,r=a[t?"on":"off"];r(n,"click",this._onClick,this),e=o.find("."+i.cssPrefix+"palette-hex",n),e&&r(e,"change",this._onChange,this)},n.prototype.render=function(t){var e=this.options,i="";this._toggleEvent(!1),i=l.layout.replace("{{colorList}}",r.map(e.preset,function(i){var n="",r="";return s.isValidRGB(i)&&(r=o.applyTemplate(l.itemStyle,{color:i})),n=o.applyTemplate(l.item,{itemStyle:r,itemClass:i?"":" "+e.cssPrefix+"color-transparent",color:i,cssPrefix:e.cssPrefix,selected:i===t?" "+e.cssPrefix+"selected":""})}).join("")),i=o.applyTemplate(i,{cssPrefix:e.cssPrefix,detailTxt:e.detailTxt,color:t}),this.container.innerHTML=i,this._toggleEvent(!0)},r.CustomEvents.mixin(n),t.exports=n},function(t,e){"use strict";var i=['<ul class="{{cssPrefix}}clearfix">{{colorList}}</ul>','<div class="{{cssPrefix}}clearfix" style="overflow:hidden">','<input type="button" class="{{cssPrefix}}palette-toggle-slider" value="{{detailTxt}}" />','<input type="text" class="{{cssPrefix}}palette-hex" value="{{color}}" maxlength="7" />','<span class="{{cssPrefix}}palette-preview" style="background-color:{{color}};color:{{color}}">{{color}}</span>',"</div>"].join("\n"),n='<li><input class="{{cssPrefix}}palette-button{{selected}}{{itemClass}}" type="button" style="{{itemStyle}}" title="{{color}}" value="{{color}}" /></li>',r="background-color:{{color}};color:{{color}}";t.exports={layout:i,item:n,itemStyle:r}},function(t,e,i){"use strict";function n(t,e){e=o.appendHTMLElement("div",e,t.cssPrefix+"slider-container"),e.style.display="none",l.call(this,t,e),this.options=r.extend({color:"#f8f8f8",cssPrefix:"tui-colorpicker-"},t),this._dragDataCache={},this.sliderHandleElement=null,this.huebarHandleElement=null,this.baseColorElement=null,this.drag=new u({distance:0},e),this.drag.on({dragStart:this._onDragStart,drag:this._onDrag,dragEnd:this._onDragEnd,click:this._onClick},this)}var r=i(8),o=i(7),s=i(9),a=i(19),c=i(14),l=i(11),u=i(12),h=i(20),f=[-7,112],d=[-3,115],p=359.99;r.inherit(n,l),n.prototype._beforeDestroy=function(){this.drag.off(),this.drag=this.options=this._dragDataCache=this.sliderHandleElement=this.huebarHandleElement=this.baseColorElement=null},n.prototype.toggle=function(t){this.container.style.display=t?"block":"none"},n.prototype.isVisible=function(){return"block"===this.container.style.display},n.prototype.render=function(t){var e,i,n=this,r=n.container,s=n.options,a=h.layout;c.isValidRGB(t)&&(a=a.replace(/{{slider}}/,h.slider),a=a.replace(/{{huebar}}/,h.huebar),a=a.replace(/{{cssPrefix}}/g,s.cssPrefix),n.container.innerHTML=a,n.sliderHandleElement=o.find("."+s.cssPrefix+"slider-handle",r),n.huebarHandleElement=o.find("."+s.cssPrefix+"huebar-handle",r),n.baseColorElement=o.find("."+s.cssPrefix+"slider-basecolor",r),e=c.hexToRGB(t),i=c.rgbToHSV.apply(null,e),this.moveHue(i[0],!0),this.moveSaturationAndValue(i[1],i[2],!0))},n.prototype._moveColorSliderHandle=function(t,e,i){var n,r=this.sliderHandleElement;e=Math.max(f[0],e),e=Math.min(f[1],e),t=Math.max(f[0],t),t=Math.min(f[1],t),a.setTranslateXY(r,t,e),n=e>50?"white":"black",a.setStrokeColor(r,n),i||this.fire("_selectColor",{color:c.rgbToHEX.apply(null,this.getRGB())})},n.prototype.moveSaturationAndValue=function(t,e,i){var n,r,o,s;t=t||0,e=e||0,n=Math.abs(f[0]),r=f[1],o=t*r/100-n,s=r-e*r/100-n,this._moveColorSliderHandle(o,s,i)},n.prototype._moveColorSliderByPosition=function(t,e){var i=f[0];this._moveColorSliderHandle(t+i,e+i)},n.prototype.getSaturationAndValue=function(){var t,e,i=Math.abs(f[0]),n=i+f[1],r=a.getTranslateXY(this.sliderHandleElement);return t=(r[1]+i)/n*100,e=100-(r[0]+i)/n*100,[t,e]},n.prototype._moveHueHandle=function(t,e){var i,n,r=this.huebarHandleElement,o=this.baseColorElement;t=Math.max(d[0],t),t=Math.min(d[1],t),a.setTranslateY(r,t),i=c.hsvToRGB(this.getHue(),100,100),n=c.rgbToHEX.apply(null,i),a.setGradientColorStop(o,n),e||this.fire("_selectColor",{color:c.rgbToHEX.apply(null,this.getRGB())})},n.prototype.moveHue=function(t,e){var i,n,r=0;i=Math.abs(d[0]),n=i+d[1],t=t||0,r=n*t/p-i,this._moveHueHandle(r,e)},n.prototype._moveHueByPosition=function(t){var e=d[0];this._moveHueHandle(t+e)},n.prototype.getHue=function(){var t,e,i=this.huebarHandleElement,n=a.getTranslateXY(i);return t=Math.abs(d[0]),e=t+d[1],(n[0]+t)*p/e},n.prototype.getHSV=function(){var t=this.getSaturationAndValue(),e=this.getHue();return[e].concat(t)},n.prototype.getRGB=function(){return c.hsvToRGB.apply(null,this.getHSV())},n.prototype._prepareColorSliderForMouseEvent=function(t){var e,i=this.options,n=o.closest(t.target,"."+i.cssPrefix+"slider-part");return e=this._dragDataCache={isColorSlider:o.hasClass(n,i.cssPrefix+"slider-left"),parentElement:n}},n.prototype._onClick=function(t){var e=this._prepareColorSliderForMouseEvent(t),i=s.getMousePosition(t.originEvent,e.parentElement);e.isColorSlider?this._moveColorSliderByPosition(i[0],i[1]):this._moveHueByPosition(i[1]),this._dragDataCache=null},n.prototype._onDragStart=function(t){this._prepareColorSliderForMouseEvent(t)},n.prototype._onDrag=function(t){var e=this._dragDataCache,i=s.getMousePosition(t.originEvent,e.parentElement);e.isColorSlider?this._moveColorSliderByPosition(i[0],i[1]):this._moveHueByPosition(i[1])},n.prototype._onDragEnd=function(){this._dragDataCache=null},r.CustomEvents.mixin(n),t.exports=n},function(t,e,i){"use strict";var n=i(8),r=/[\.\-0-9]+/g,o=-6,s={isOldBrowser:function(){var t=s._isOldBrowser;return n.isExisty(t)||(s._isOldBrowser=t=n.browser.msie&&n.browser.version<9),t},getTranslateXY:function(t){var e;return s.isOldBrowser()?(e=t.style,[parseFloat(e.top),parseFloat(e.left)]):(e=t.getAttribute("transform"))?(e=e.match(r),[parseFloat(e[1]),parseFloat(e[0])]):[0,0]},setTranslateXY:function(t,e,i){s.isOldBrowser()?(t.style.left=e+"px",t.style.top=i+"px"):t.setAttribute("transform","translate("+e+","+i+")")},setTranslateY:function(t,e){s.isOldBrowser()?t.style.top=e+"px":t.setAttribute("transform","translate("+o+","+e+")")},setStrokeColor:function(t,e){s.isOldBrowser()?t.strokecolor=e:t.setAttribute("stroke",e)},setGradientColorStop:function(t,e){s.isOldBrowser()?t.color=e:t.setAttribute("stop-color",e)}};t.exports=s},function(t,e,i){(function(e){"use strict";var n=i(8),r=['<div class="{{cssPrefix}}slider-left {{cssPrefix}}slider-part">{{slider}}</div>','<div class="{{cssPrefix}}slider-right {{cssPrefix}}slider-part">{{huebar}}</div>'].join("\n"),o=['<svg class="{{cssPrefix}}svg {{cssPrefix}}svg-slider">',"<defs>",'<linearGradient id="{{cssPrefix}}svg-fill-color" x1="0%" y1="0%" x2="100%" y2="0%">','<stop offset="0%" stop-color="rgb(255,255,255)" />','<stop class="{{cssPrefix}}slider-basecolor" offset="100%" stop-color="rgb(255,0,0)" />',"</linearGradient>",'<linearGradient id="{{cssPrefix}}svn-fill-black" x1="0%" y1="0%" x2="0%" y2="100%">','<stop offset="0%" style="stop-color:rgb(0,0,0);stop-opacity:0" />','<stop offset="100%" style="stop-color:rgb(0,0,0);stop-opacity:1" />',"</linearGradient>","</defs>",'<rect width="100%" height="100%" fill="url(#{{cssPrefix}}svg-fill-color)"></rect>','<rect width="100%" height="100%" fill="url(#{{cssPrefix}}svn-fill-black)"></rect>','<path transform="translate(0,0)" class="{{cssPrefix}}slider-handle" d="M0 7.5 L15 7.5 M7.5 15 L7.5 0 M2 7 a5.5 5.5 0 1 1 0 1 Z" stroke="black" stroke-width="0.75" fill="none" />',"</svg>"].join("\n"),s=['<div class="{{cssPrefix}}vml-slider">','<v:rect strokecolor="none" class="{{cssPrefix}}vml {{cssPrefix}}vml-slider-bg">','<v:fill class="{{cssPrefix}}vml {{cssPrefix}}slider-basecolor" type="gradient" method="none" color="#ff0000" color2="#fff" angle="90" />',"</v:rect>",'<v:rect strokecolor="#ccc" class="{{cssPrefix}}vml {{cssPrefix}}vml-slider-bg">','<v:fill type="gradient" method="none" color="black" color2="white" o:opacity2="0%" class="{{cssPrefix}}vml" />',"</v:rect>",'<v:shape class="{{cssPrefix}}vml {{cssPrefix}}slider-handle" coordsize="1 1" style="width:1px;height:1px;"path="m 0,7 l 14,7 m 7,14 l 7,0 ar 12,12 2,2 z" filled="false" stroked="true" />',"</div>"].join("\n"),a=['<svg class="{{cssPrefix}}svg {{cssPrefix}}svg-huebar">',"<defs>",'<linearGradient id="g" x1="0%" y1="0%" x2="0%" y2="100%">','<stop offset="0%" stop-color="rgb(255,0,0)" />','<stop offset="16.666%" stop-color="rgb(255,255,0)" />','<stop offset="33.333%" stop-color="rgb(0,255,0)" />','<stop offset="50%" stop-color="rgb(0,255,255)" />','<stop offset="66.666%" stop-color="rgb(0,0,255)" />','<stop offset="83.333%" stop-color="rgb(255,0,255)" />','<stop offset="100%" stop-color="rgb(255,0,0)" />',"</linearGradient>","</defs>",'<rect width="18px" height="100%" fill="url(#g)"></rect>','<path transform="translate(-6,-3)" class="{{cssPrefix}}huebar-handle" d="M0 0 L4 4 L0 8 L0 0 Z" fill="black" stroke="none" />',"</svg>"].join("\n"),c=['<div class="{{cssPrefix}}vml-huebar">','<v:rect strokecolor="#ccc" class="{{cssPrefix}}vml {{cssPrefix}}vml-huebar-bg">','<v:fill type="gradient" method="none" colors="0% rgb(255,0,0), 16.666% rgb(255,255,0), 33.333% rgb(0,255,0), 50% rgb(0,255,255), 66.666% rgb(0,0,255), 83.333% rgb(255,0,255), 100% rgb(255,0,0)" angle="180" class="{{cssPrefix}}vml" />',"</v:rect>",'<v:shape class="{{cssPrefix}}vml {{cssPrefix}}huebar-handle" coordsize="1 1" style="width:1px;height:1px;position:absolute;z-index:1;right:22px;top:-3px;"path="m 0,0 l 4,4 l 0,8 l 0,0 z" filled="true" fillcolor="black" stroked="false" />',"</div>"].join("\n"),l=n.browser.msie&&n.browser.version<9;l&&e.document.namespaces.add("v","urn:schemas-microsoft-com:vml"),t.exports={layout:r,slider:l?s:o,huebar:l?c:a}}).call(e,function(){return this}())}])})},function(t,e,i){var n;(function(t,r){!function(o){function s(t){throw RangeError(P[t])}function a(t,e){for(var i=t.length,n=[];i--;)n[i]=e(t[i]);return n}function c(t,e){var i=t.split("@"),n="";i.length>1&&(n=i[0]+"@",t=i[1]),t=t.replace(A,".");var r=t.split("."),o=a(r,e).join(".");return n+o}function l(t){for(var e,i,n=[],r=0,o=t.length;r<o;)e=t.charCodeAt(r++),e>=55296&&e<=56319&&r<o?(i=t.charCodeAt(r++),56320==(64512&i)?n.push(((1023&e)<<10)+(1023&i)+65536):(n.push(e),r--)):n.push(e);return n}function u(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=L(t>>>10&1023|55296),t=56320|1023&t),e+=L(t)}).join("")}function h(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:x}function f(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function d(t,e,i){var n=0;for(t=i?D(t/k):t>>1,t+=D(t/e);t>I*S>>1;n+=x)t=D(t/I);return D(n+(I+1)*t/(t+C))}function p(t){var e,i,n,r,o,a,c,l,f,p,g=[],v=t.length,m=0,b=T,y=O;for(i=t.lastIndexOf(E),i<0&&(i=0),n=0;n<i;++n)t.charCodeAt(n)>=128&&s("not-basic"),g.push(t.charCodeAt(n));for(r=i>0?i+1:0;r<v;){for(o=m,a=1,c=x;r>=v&&s("invalid-input"),l=h(t.charCodeAt(r++)),(l>=x||l>D((_-m)/a))&&s("overflow"),m+=l*a,f=c<=y?w:c>=y+S?S:c-y,!(l<f);c+=x)p=x-f,a>D(_/p)&&s("overflow"),a*=p;e=g.length+1,y=d(m-o,e,0==o),D(m/e)>_-b&&s("overflow"),b+=D(m/e),m%=e,g.splice(m++,0,b)}return u(g)}function g(t){var e,i,n,r,o,a,c,u,h,p,g,v,m,b,y,C=[];for(t=l(t),v=t.length,e=T,i=0,o=O,a=0;a<v;++a)g=t[a],g<128&&C.push(L(g));for(n=r=C.length,r&&C.push(E);n<v;){for(c=_,a=0;a<v;++a)g=t[a],g>=e&&g<c&&(c=g);for(m=n+1,c-e>D((_-i)/m)&&s("overflow"),i+=(c-e)*m,e=c,a=0;a<v;++a)if(g=t[a],g<e&&++i>_&&s("overflow"),g==e){for(u=i,h=x;p=h<=o?w:h>=o+S?S:h-o,!(u<p);h+=x)y=u-p,b=x-p,C.push(L(f(p+y%b,0))),u=D(y/b);C.push(L(f(u,0))),o=d(i,m,n==r),i=0,++n}++i,++e}return C.join("")}function v(t){return c(t,function(t){return j.test(t)?p(t.slice(4).toLowerCase()):t})}function m(t){return c(t,function(t){return M.test(t)?"xn--"+g(t):t})}var b=("object"==typeof e&&e&&!e.nodeType&&e,"object"==typeof t&&t&&!t.nodeType&&t,"object"==typeof r&&r);b.global!==b&&b.window!==b&&b.self!==b||(o=b);var y,_=2147483647,x=36,w=1,S=26,C=38,k=700,O=72,T=128,E="-",j=/^xn--/,M=/[^\x20-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,P={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=x-w,D=Math.floor,L=String.fromCharCode;y={version:"1.3.2",ucs2:{decode:l,encode:u},decode:p,encode:g,toASCII:m,toUnicode:v},n=function(){return y}.call(e,i,e,t),!(void 0!==n&&(t.exports=n))}(this)}).call(e,i(189)(t),function(){return this}())},function(t,e){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e){(function(e){function i(t,e){function i(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}if(n("noDeprecation"))return t;var r=!1;return i}function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var i=e.localStorage[t];return null!=i&&"true"===String(i).toLowerCase()}t.exports=i}).call(e,function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){function i(){for(var t={},e=0;e<arguments.length;e++){var i=arguments[e];for(var r in i)n.call(i,r)&&(t[r]=i[r])}return t}t.exports=i;var n=Object.prototype.hasOwnProperty},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){}])});