ZwiiCMS/core/vendor/filemanager/js/tui-image-editor.js

15 lines
657 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
* TOAST UI ImageEditor
* @version 3.15.3
* @license MIT
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("tui-color-picker")):"function"==typeof define&&define.amd?define(["tui-color-picker"],e):"object"==typeof exports?exports.tui=e(require("tui-color-picker")):(t.tui=t.tui||{},t.tui.ImageEditor=e(t.tui.colorPicker))}(self,(function(t){return function(){var e={2777:function(t,e,i){
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
var n,r,o,a,s,l,c,u,h,f,g,d,v,p,m,y,b,x,C,I,_,M,S=S||{version:"4.6.0"};if(e.fabric=S,"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?S.document=document:S.document=document.implementation.createHTMLDocument(""),S.window=window;else{var w=new(i(4960).JSDOM)(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;S.document=w.document,S.jsdomImplForWrapper=i(6759).implForWrapper,S.nodeCanvas=i(6272).Canvas,S.window=w,DOMParser=S.window.DOMParser}function k(t,e){var i=t.canvas,n=e.targetCanvas,r=n.getContext("2d");r.translate(0,n.height),r.scale(1,-1);var o=i.height-n.height;r.drawImage(i,0,o,n.width,n.height,0,0,n.width,n.height)}function T(t,e){var i=e.targetCanvas.getContext("2d"),n=e.destinationWidth,r=e.destinationHeight,o=n*r*4,a=new Uint8Array(this.imageBuffer,0,o),s=new Uint8ClampedArray(this.imageBuffer,0,o);t.readPixels(0,0,n,r,t.RGBA,t.UNSIGNED_BYTE,a);var l=new ImageData(s,n,r);i.putImageData(l,0,0)}S.isTouchSupported="ontouchstart"in S.window||"ontouchstart"in S.document||S.window&&S.window.navigator&&S.window.navigator.maxTouchPoints>0,S.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,S.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],S.DPI=96,S.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",S.commaWsp="(?:\\s+,?\\s*|,\\s*)",S.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,S.reNonWord=/[ \n\.,;!\?\-]/,S.fontPaths={},S.iMatrix=[1,0,0,1,0,0],S.svgNS="http://www.w3.org/2000/svg",S.perfLimitSizeTotal=2097152,S.maxCacheSideLimit=4096,S.minCacheSideLimit=256,S.charWidthsCache={},S.textureSize=2048,S.disableStyleCopyPaste=!1,S.enableGLFiltering=!0,S.devicePixelRatio=S.window.devicePixelRatio||S.window.webkitDevicePixelRatio||S.window.mozDevicePixelRatio||1,S.browserShadowBlurConstant=1,S.arcToSegmentsCache={},S.boundsOfCurveCache={},S.cachesBoundsOfCurve=!0,S.forceGLPutImageData=!1,S.initFilterBackend=function(){return S.enableGLFiltering&&S.isWebglSupported&&S.isWebglSupported(S.textureSize)?new S.WebglFilterBackend({tileSize:S.textureSize}):S.Canvas2dFilterBackend?new S.Canvas2dFilterBackend:void 0},"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=S),function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:S.util.array.fill(i,!1)}}function e(t,e){var i=function(){e.apply(this,arguments),this.off(t,i)}.bind(this);this.on(t,i)}S.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var i=this.__eventListeners[t];if(!i)return this;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!1!==t})),this},on:function(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},once:function(t,i){if(1===arguments.length)for(var n in t)e.call(this,n,t[n]);else e.call(this,t,i);return this},off:function(e,i){if(!this.__eventListeners)return this;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}}}(),S.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.requestRenderAll(),this},insertAt:function(t,e,i){var n=this._objects;return i?n[e]=t:n.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var t,e=this._objects,i=!1,n=0,r=arguments.length;n<r;n++)-1!==(t=e.indexOf(arguments[n]))&&(i=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[n]));return this.renderOnAddRemove&&i&&this.requestRenderAll(),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 void 0===t?this._objects.concat():this._objects.filter((function(e){return e.type===t}))},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(t,e){return this._objects.indexOf(t)>-1||!!e&&this._objects.some((function(e){return"function"==typeof e.contains&&e.contains(t,!0)}))},complexity:function(){return this._objects.reduce((function(t,e){return t+=e.complexity?e.complexity():0}),0)}},S.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof S.Gradient||this.set(e,new S.Gradient(t))},_initPattern:function(t,e,i){!t||!t.source||t instanceof S.Pattern?i&&i():this.set(e,new S.Pattern(t,i))},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},n=e,r=Math.sqrt,o=Math.atan2,a=Math.pow,s=Math.PI/180,l=Math.PI/2,S.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/l){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=1;switch(t<0&&(e=-1),t/l){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var i=t.indexOf(e);return-1!==i&&t.splice(i,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*s},radiansToDegrees:function(t){return t/s},rotatePoint:function(t,e,i){var n=new S.Point(t.x-e.x,t.y-e.y),r=S.util.rotateVector(n,i);return new S.Point(r.x,r.y).addEquals(e)},rotateVector:function(t,e){var i=S.util.sin(e),n=S.util.cos(e);return{x:t.x*n-t.y*i,y:t.x*i+t.y*n}},transformPoint:function(t,e,i){return i?new S.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new S.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var i=0;i<t.length;i++)t[i]=S.util.transformPoint(t[i],e);var n=[t[0].x,t[1].x,t[2].x,t[3].x],r=S.util.array.min(n),o=S.util.array.max(n)-r,a=[t[0].y,t[1].y,t[2].y,t[3].y],s=S.util.array.min(a);return{left:r,top:s,width:o,height:S.util.array.max(a)-s}},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=S.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=S.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case"mm":return n*S.DPI/25.4;case"cm":return n*S.DPI/2.54;case"in":return n*S.DPI;case"pt":return n*S.DPI/72;case"pc":return n*S.DPI/72*12;case"em":return n*e;default:return n}},falseFunction:function(){return!1},getKlass:function(t,e){return t=S.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),S.util.resolveNamespace(e)[t]},getSvgAttributes:function(t){var e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":e=e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":e=e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":e=e.concat(["offset","stop-color","stop-opacity"]);break}return e},resolveNamespace:function(t){if(!t)return S;var e,i=t.split("."),r=i.length,o=n||S.window;for(e=0;e<r;++e)o=o[i[e]];return o},loadImage:function(t,e,i,n){if(t){var r=S.util.createImage(),o=function(){e&&e.call(i,r,!1),r=r.onload=r.onerror=null};r.onload=o,r.onerror=function(){S.log("Error loading "+r.src),e&&e.call(i,null,!0),r=r.onload=r.onerror=null},0!==t.indexOf("data")&&null!=n&&(r.crossOrigin=n),"data:image/svg"===t.substring(0,14)&&(r.onload=null,S.util.loadImageInDom(r,o)),r.src=t}else e&&e.call(i,t)},loadImageInDom:function(t,e){var i=S.document.createElement("div");i.style.width=i.style.height="1px",i.style.left=i.style.top="-100%",i.style.position="absolute",i.appendChild(t),S.document.querySelector("body").appendChild(i),t.onload=function(){e(),i.parentNode.removeChild(i),i=null}},enlivenObjects:function(t,e,i,n){var r=[],o=0,a=(t=t||[]).length;function s(){++o===a&&e&&e(r.filter((function(t){return t})))}a?t.forEach((function(t,e){t&&t.type?S.util.getKlass(t.type,i).fromObject(t,(function(i,o){o||(r[e]=i),n&&n(t,i,o),s()})):s()})):e&&e(r)},enlivenPatterns:function(t,e){function i(){++r===o&&e&&e(n)}var n=[],r=0,o=(t=t||[]).length;o?t.forEach((function(t,e){t&&t.source?new S.Pattern(t,(function(t){n[e]=t,i()})):(n[e]=t,i())})):e&&e(n)},groupSVGElements:function(t,e,i){var n;return t&&1===t.length?t[0]:(e&&(e.width&&e.height?e.centerPoint={x:e.width/2,y:e.height/2}:(delete e.width,delete e.height)),n=new S.Group(t,e),void 0!==i&&(n.sourcePath=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,e,i,n,a,s){var l=n-e,c=a-i,u=r(l*l+c*c),h=o(c,l),f=s.length,g=0,d=!0;for(t.save(),t.translate(e,i),t.moveTo(0,0),t.rotate(h),e=0;u>e;)(e+=s[g++%f])>u&&(e=u),t[d?"lineTo":"moveTo"](e,0),d=!d;t.restore()},createCanvasElement:function(){return S.document.createElement("canvas")},copyCanvasElement:function(t){var e=S.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,i){return t.toDataURL("image/"+e,i)},createImage:function(){return S.document.createElement("img")},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 e=o(t[1],t[0]),i=a(t[0],2)+a(t[1],2),n=r(i),l=(t[0]*t[3]-t[2]*t[1])/n,c=o(t[0]*t[2]+t[1]*t[3],i);return{angle:e/s,scaleX:n,scaleY:l,skewX:c/s,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return S.iMatrix.concat();var e=S.util.degreesToRadians(t.angle),i=S.util.cos(e),n=S.util.sin(e);return[i,n,-n,i,0,0]},calcDimensionsMatrix:function(t){var e=void 0===t.scaleX?1:t.scaleX,i=void 0===t.scaleY?1:t.scaleY,n=[t.flipX?-e:e,0,0,t.flipY?-i:i,0,0],r=S.util.multiplyTransformMatrices,o=S.util.degreesToRadians;return t.skewX&&(n=r(n,[1,0,Math.tan(o(t.skewX)),1],!0)),t.skewY&&(n=r(n,[1,Math.tan(o(t.skewY)),0,1],!0)),n},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],i=S.util.multiplyTransformMatrices;return t.angle&&(e=i(e,S.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=i(e,S.util.calcDimensionsMatrix(t))),e},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},isTransparent:function(t,e,i,n){n>0&&(e>n?e-=n:e=0,i>n?i-=n:i=0);var r,o=!0,a=t.getImageData(e,i,2*n||1,2*n||1),s=a.data.length;for(r=3;r<s&&!1!=(o=a.data[r]<=0);r+=4);return a=null,o},parsePreserveAspectRatioAttribute:function(t){var e,i="meet",n=t.split(" ");return n&&n.length&&("meet"!==(i=n.pop())&&"slice"!==i?(e=i,i="meet"):n.length&&(e=n.pop())),{meetOrSlice:i,alignX:"none"!==e?e.slice(1,4):"none",alignY:"none"!==e?e.slice(5,8):"none"}},clearFabricFontCache:function(t){(t=(t||"").toLowerCase())?S.charWidthsCache[t]&&delete S.charWidthsCache[t]:S.charWidthsCache={}},limitDimsByArea:function(t,e){var i=Math.sqrt(e*t),n=Math.floor(e/i);return{x:Math.floor(i),y:n}},capValue:function(t,e,i){return Math.max(t,Math.min(e,i))},findScaleToFit:function(t,e){return Math.min(e.width/t.width,e.height/t.height)},findScaleToCover:function(t,e){return Math.max(e.width/t.width,e.height/t.height)},matrixToSVG:function(t){return"matrix("+t.map((function(t){return S.util.toFixed(t,S.Object.NUM_FRACTION_DIGITS)})).join(" ")+")"},removeTransformFromObject:function(t,e){var i=S.util.invertTransform(e),n=S.util.multiplyTransformMatrices(i,t.calcOwnMatrix());S.util.applyTransformToObject(t,n)},addTransformToObject:function(t,e){S.util.applyTransformToObject(t,S.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var i=S.util.qrDecompose(e),n=new S.Point(i.translateX,i.translateY);t.flipX=!1,t.flipY=!1,t.set("scaleX",i.scaleX),t.set("scaleY",i.scaleY),t.skewX=i.skewX,t.skewY=i.skewY,t.angle=i.angle,t.setPositionByOrigin(n,"center","center")},sizeAfterTransform:function(t,e,i){var n=t/2,r=e/2,o=[{x:-n,y:-r},{x:n,y:-r},{x:-n,y:r},{x:n,y:r}],a=S.util.calcDimensionsMatrix(i),s=S.util.makeBoundingBoxFromPoints(o,a);return{x:s.width,y:s.height}}},function(){var t=Array.prototype.join,e={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},i={m:"l",M:"L"};function n(t,e,i,n,r,o,a,s,l,c,u){var h=S.util.cos(t),f=S.util.sin(t),g=S.util.cos(e),d=S.util.sin(e),v=i*r*g-n*o*d+a,p=n*r*g+i*o*d+s;return["C",c+l*(-i*r*f-n*o*h),u+l*(-n*r*f+i*o*h),v+l*(i*r*d+n*o*g),p+l*(n*r*d-i*o*g),v,p]}function r(t,e,i,r,a,s,l){var c=Math.PI,u=l*c/180,h=S.util.sin(u),f=S.util.cos(u),g=0,d=0,v=-f*t*.5-h*e*.5,p=-f*e*.5+h*t*.5,m=(i=Math.abs(i))*i,y=(r=Math.abs(r))*r,b=p*p,x=v*v,C=m*y-m*b-y*x,I=0;if(C<0){var _=Math.sqrt(1-C/(m*y));i*=_,r*=_}else I=(a===s?-1:1)*Math.sqrt(C/(m*b+y*x));var M=I*i*p/r,w=-I*r*v/i,k=f*M-h*w+.5*t,T=h*M+f*w+.5*e,D=o(1,0,(v-M)/i,(p-w)/r),A=o((v-M)/i,(p-w)/r,(-v-M)/i,(-p-w)/r);0===s&&A>0?A-=2*c:1===s&&A<0&&(A+=2*c);for(var j=Math.ceil(Math.abs(A/c*2)),O=[],E=A/j,L=8/3*Math.sin(E/4)*Math.sin(E/4)/Math.sin(E/2),N=D+E,P=0;P<j;P++)O[P]=n(D,N,f,h,i,r,k,T,L,g,d),g=O[P][5],d=O[P][6],D=N,N+=E;return O}function o(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 a(e,i,n,r,o,a,s,l){var c;if(S.cachesBoundsOfCurve&&(c=t.call(arguments),S.boundsOfCurveCache[c]))return S.boundsOfCurveCache[c];var u,h,f,g,d,v,p,m,y=Math.sqrt,b=Math.min,x=Math.max,C=Math.abs,I=[],_=[[],[]];h=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*s,f=3*n-3*e;for(var M=0;M<2;++M)if(M>0&&(h=6*i-12*r+6*a,u=-3*i+9*r-9*a+3*l,f=3*r-3*i),C(u)<1e-12){if(C(h)<1e-12)continue;0<(g=-f/h)&&g<1&&I.push(g)}else(p=h*h-4*f*u)<0||(0<(d=(-h+(m=y(p)))/(2*u))&&d<1&&I.push(d),0<(v=(-h-m)/(2*u))&&v<1&&I.push(v));for(var w,k,T,D=I.length,A=D;D--;)w=(T=1-(g=I[D]))*T*T*e+3*T*T*g*n+3*T*g*g*o+g*g*g*s,_[0][D]=w,k=T*T*T*i+3*T*T*g*r+3*T*g*g*a+g*g*g*l,_[1][D]=k;_[0][A]=e,_[1][A]=i,_[0][A+1]=s,_[1][A+1]=l;var j=[{x:b.apply(null,_[0]),y:b.apply(null,_[1])},{x:x.apply(null,_[0]),y:x.apply(null,_[1])}];return S.cachesBoundsOfCurve&&(S.boundsOfCurveCache[c]=j),j}function s(t,e,i){for(var n=i[1],o=i[2],a=i[3],s=i[4],l=i[5],c=r(i[6]-t,i[7]-e,n,o,s,l,a),u=0,h=c.length;u<h;u++)c[u][1]+=t,c[u][2]+=e,c[u][3]+=t,c[u][4]+=e,c[u][5]+=t,c[u][6]+=e;return c}function l(t,e,i,n){return Math.sqrt((i-t)*(i-t)+(n-e)*(n-e))}function c(t,e,i,n,r,o,a,s){return function(l){var c,u=(c=l)*c*c,h=function(t){return 3*t*t*(1-t)}(l),f=function(t){return 3*t*(1-t)*(1-t)}(l),g=function(t){return(1-t)*(1-t)*(1-t)}(l);return{x:a*u+r*h+i*f+t*g,y:s*u+o*h+n*f+e*g}}}function u(t,e,i,n,r,o,a,s){return function(l){var c=1-l,u=3*c*c*(i-t)+6*c*l*(r-i)+3*l*l*(a-r),h=3*c*c*(n-e)+6*c*l*(o-n)+3*l*l*(s-o);return Math.atan2(h,u)}}function h(t,e,i,n,r,o){return function(a){var s,l=(s=a)*s,c=function(t){return 2*t*(1-t)}(a),u=function(t){return(1-t)*(1-t)}(a);return{x:r*l+i*c+t*u,y:o*l+n*c+e*u}}}function f(t,e,i,n,r,o){return function(a){var s=1-a,l=2*s*(i-t)+2*a*(r-i),c=2*s*(n-e)+2*a*(o-n);return Math.atan2(c,l)}}function g(t,e,i){var n,r,o={x:e,y:i},a=0;for(r=1;r<=100;r+=1)n=t(r/100),a+=l(o.x,o.y,n.x,n.y),o=n;return a}function d(t,e){for(var i,n,r,o=0,a=0,s=t.iterator,c={x:t.x,y:t.y},u=.01,h=t.angleFinder;a<e&&o<=1&&u>1e-4;)i=s(o),r=o,(n=l(c.x,c.y,i.x,i.y))+a>e?o-=u/=2:(c=i,o+=u,a+=n);return i.angle=h(r),i}function v(t){for(var e,i,n,r,o=0,a=t.length,s=0,d=0,v=0,p=0,m=[],y=0;y<a;y++){switch(n={x:s,y:d,command:(e=t[y])[0]},e[0]){case"M":n.length=0,v=s=e[1],p=d=e[2];break;case"L":n.length=l(s,d,e[1],e[2]),s=e[1],d=e[2];break;case"C":i=c(s,d,e[1],e[2],e[3],e[4],e[5],e[6]),r=u(s,d,e[1],e[2],e[3],e[4],e[5],e[6]),n.iterator=i,n.angleFinder=r,n.length=g(i,s,d),s=e[5],d=e[6];break;case"Q":i=h(s,d,e[1],e[2],e[3],e[4]),r=f(s,d,e[1],e[2],e[3],e[4]),n.iterator=i,n.angleFinder=r,n.length=g(i,s,d),s=e[3],d=e[4];break;case"Z":case"z":n.destX=v,n.destY=p,n.length=l(s,d,v,p),s=v,d=p;break}o+=n.length,m.push(n)}return m.push({length:o,x:s,y:d}),m}S.util.joinPath=function(t){return t.map((function(t){return t.join(" ")})).join(" ")},S.util.parsePath=function(t){var n,r,o,a,s,l=[],c=[],u=S.rePathCommand,h="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",f="("+h+")"+S.commaWsp,g="([01])"+S.commaWsp+"?",d=new RegExp(f+"?"+f+"?"+f+g+g+f+"?("+h+")","g");if(!t||!t.match)return l;for(var v,p=0,m=(s=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;p<m;p++){a=(n=s[p]).slice(1).trim(),c.length=0;var y=n.charAt(0);if(v=[y],"a"===y.toLowerCase())for(var b;b=d.exec(a);)for(var x=1;x<b.length;x++)c.push(b[x]);else for(;o=u.exec(a);)c.push(o[0]);x=0;for(var C=c.length;x<C;x++)r=parseFloat(c[x]),isNaN(r)||v.push(r);var I=e[y.toLowerCase()],_=i[y]||y;if(v.length-1>I)for(var M=1,w=v.length;M<w;M+=I)l.push([y].concat(v.slice(M,M+I))),y=_;else l.push(v)}return l},S.util.makePathSimpler=function(t){var e,i,n,r,o,a,l=0,c=0,u=t.length,h=0,f=0,g=[];for(i=0;i<u;++i){switch(n=!1,(e=t[i].slice(0))[0]){case"l":e[0]="L",e[1]+=l,e[2]+=c;case"L":l=e[1],c=e[2];break;case"h":e[1]+=l;case"H":e[0]="L",e[2]=c,l=e[1];break;case"v":e[1]+=c;case"V":e[0]="L",c=e[1],e[1]=l,e[2]=c;break;case"m":e[0]="M",e[1]+=l,e[2]+=c;case"M":l=e[1],c=e[2],h=e[1],f=e[2];break;case"c":e[0]="C",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c,e[5]+=l,e[6]+=c;case"C":o=e[3],a=e[4],l=e[5],c=e[6];break;case"s":e[0]="S",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c;case"S":"C"===r?(o=2*l-o,a=2*c-a):(o=l,a=c),l=e[3],c=e[4],e[0]="C",e[5]=e[3],e[6]=e[4],e[3]=e[1],e[4]=e[2],e[1]=o,e[2]=a,o=e[3],a=e[4];break;case"q":e[0]="Q",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c;case"Q":o=e[1],a=e[2],l=e[3],c=e[4];break;case"t":e[0]="T",e[1]+=l,e[2]+=c;case"T":"Q"===r?(o=2*l-o,a=2*c-a):(o=l,a=c),e[0]="Q",l=e[1],c=e[2],e[1]=o,e[2]=a,e[3]=l,e[4]=c;break;case"a":e[0]="A",e[6]+=l,e[7]+=c;case"A":n=!0,g=g.concat(s(l,c,e)),l=e[6],c=e[7];break;case"z":case"Z":l=h,c=f;break;default:}n||g.push(e),r=e[0]}return g},S.util.getSmoothPathFromPoints=function(t,e){var i,n=[],r=new S.Point(t[0].x,t[0].y),o=new S.Point(t[1].x,t[1].y),a=t.length,s=1,l=0,c=a>2;for(e=e||0,c&&(s=t[2].x<o.x?-1:t[2].x===o.x?0:1,l=t[2].y<o.y?-1:t[2].y===o.y?0:1),n.push(["M",r.x-s*e,r.y-l*e]),i=1;i<a;i++){if(!r.eq(o)){var u=r.midPointFrom(o);n.push(["Q",r.x,r.y,u.x,u.y])}r=t[i],i+1<t.length&&(o=t[i+1])}return c&&(s=r.x>t[i-2].x?1:r.x===t[i-2].x?0:-1,l=r.y>t[i-2].y?1:r.y===t[i-2].y?0:-1),n.push(["L",r.x+s*e,r.y+l*e]),n},S.util.getPathSegmentsInfo=v,S.util.getBoundsOfCurve=a,S.util.getPointOnPath=function(t,e,i){i||(i=v(t));for(var n=0;e-i[n].length>0&&n<i.length-2;)e-=i[n].length,n++;var r,o=i[n],a=e/o.length,s=o.command,l=t[n];switch(s){case"M":return{x:o.x,y:o.y,angle:0};case"Z":case"z":return(r=new S.Point(o.x,o.y).lerp(new S.Point(o.destX,o.destY),a)).angle=Math.atan2(o.destY-o.y,o.destX-o.x),r;case"L":return(r=new S.Point(o.x,o.y).lerp(new S.Point(l[1],l[2]),a)).angle=Math.atan2(l[2]-o.y,l[1]-o.x),r;case"C":return d(o,e);case"Q":return d(o,e)}},S.util.transformPath=function(t,e,i){return i&&(e=S.util.multiplyTransformMatrices(e,[1,0,0,1,-i.x,-i.y])),t.map((function(t){for(var i=t.slice(0),n={},r=1;r<t.length-1;r+=2)n.x=t[r],n.y=t[r+1],n=S.util.transformPoint(n,e),i[r]=n.x,i[r+1]=n.y;return i}))},S.util.fromArcToBeizers=s,S.util.getBoundsOfArc=function(t,e,i,n,o,s,l,c,u){for(var h,f=0,g=0,d=[],v=r(c-t,u-e,i,n,s,l,o),p=0,m=v.length;p<m;p++)h=a(f,g,v[p][1],v[p][2],v[p][3],v[p][4],v[p][5],v[p][6]),d.push({x:h[0].x+t,y:h[0].y+e}),d.push({x:h[1].x+t,y:h[1].y+e}),f=v[p][5],g=v[p][6];return d},S.util.drawArc=function(t,e,i,n){s(e,i,n=n.slice(0).unshift("X")).forEach((function(e){t.bezierCurveTo.apply(t,e.slice(1))}))}}(),function(){var t=Array.prototype.slice;function e(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}}S.util.array={fill:function(t,e){for(var i=t.length;i--;)t[i]=e;return t},invoke:function(e,i){for(var n=t.call(arguments,2),r=[],o=0,a=e.length;o<a;o++)r[o]=n.length?e[o][i].apply(e[o],n):e[o][i].call(e[o]);return r},min:function(t,i){return e(t,i,(function(t,e){return t<e}))},max:function(t,i){return e(t,i,(function(t,e){return t>=e}))}}}(),function(){function t(e,i,n){if(n)if(!S.isLikelyNode&&i instanceof Element)e=i;else if(i instanceof Array){e=[];for(var r=0,o=i.length;r<o;r++)e[r]=t({},i[r],n)}else if(i&&"object"==typeof i)for(var a in i)"canvas"===a||"group"===a?e[a]=null:i.hasOwnProperty(a)&&(e[a]=t({},i[a],n));else e=i;else for(var a in i)e[a]=i[a];return e}S.util.object={extend:t,clone:function(e,i){return t({},e,i)}},S.util.object.extend(S.util,S.Observable)}(),function(){function t(t,e){var i=t.charCodeAt(e);if(isNaN(i))return"";if(i<55296||i>57343)return t.charAt(e);if(55296<=i&&i<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var n=t.charCodeAt(e+1);if(56320>n||n>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";var r=t.charCodeAt(e-1);if(55296>r||r>56319)throw"Low surrogate without preceding high surrogate";return!1}S.util.string={camelize:function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():""}))},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},graphemeSplit:function(e){var i,n=0,r=[];for(n=0;n<e.length;n++)!1!==(i=t(e,n))&&r.push(i);return r}}}(),function(){var t=Array.prototype.slice,e=function(){},i=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),n=function(t,e,n){for(var r in e)r in t.prototype&&"function"==typeof t.prototype[r]&&(e[r]+"").indexOf("callSuper")>-1?t.prototype[r]=function(t){return function(){var i=this.constructor.superclass;this.constructor.superclass=n;var r=e[t].apply(this,arguments);if(this.constructor.superclass=i,"initialize"!==t)return r}}(r):t.prototype[r]=e[r],i&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function r(){}function o(e){for(var i=null,n=this;n.constructor.superclass;){var r=n.constructor.superclass.prototype[e];if(n[e]!==r){i=r;break}n=n.constructor.superclass.prototype}if(i)return arguments.length>1?i.apply(this,t.call(arguments,1)):i.call(this)}S.util.createClass=function(){var i=null,a=t.call(arguments,0);function s(){this.initialize.apply(this,arguments)}"function"==typeof a[0]&&(i=a.shift()),s.superclass=i,s.subclasses=[],i&&(r.prototype=i.prototype,s.prototype=new r,i.subclasses.push(s));for(var l=0,c=a.length;l<c;l++)n(s,a[l],i);return s.prototype.initialize||(s.prototype.initialize=e),s.prototype.constructor=s,s.prototype.callSuper=o,s}}(),c=!!S.document.createElement("div").attachEvent,u=["touchstart","touchmove","touchend"],S.util.addListener=function(t,e,i,n){t&&t.addEventListener(e,i,!c&&n)},S.util.removeListener=function(t,e,i,n){t&&t.removeEventListener(e,i,!c&&n)},S.util.getPointer=function(t){var e=t.target,i=S.util.getScrollLeftTop(e),n=function(t){var e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return{x:n.clientX+i.left,y:n.clientY+i.top}},S.util.isTouchEvent=function(t){return u.indexOf(t.type)>-1||"touch"===t.pointerType},h=S.document.createElement("div"),f="string"==typeof h.style.opacity,g="string"==typeof h.style.filter,d=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,v=function(t){return t},f?v=function(t,e){return t.style.opacity=e,t}:g&&(v=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),d.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(d,e)):i.filter+=" alpha(opacity="+100*e+")",t}),S.util.setStyle=function(t,e){var i=t.style;if(!i)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?v(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var n in e)"opacity"===n?v(t,e[n]):i["float"===n||"cssFloat"===n?void 0===i.styleFloat?"cssFloat":"styleFloat":n]=e[n];return t},function(){var t=Array.prototype.slice;var e,i,n,r,o=function(e){return t.call(e,0)};try{e=o(S.document.childNodes)instanceof Array}catch(t){}function a(t,e){var i=S.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 s(t){for(var e=0,i=0,n=S.document.documentElement,r=S.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===S.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"!==t.style.position););return{left:e,top:i}}e||(o=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e}),i=S.document.defaultView&&S.document.defaultView.getComputedStyle?function(t,e){var i=S.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},n=S.document.documentElement.style,r="userSelect"in n?"userSelect":"MozUserSelect"in n?"MozUserSelect":"WebkitUserSelect"in n?"WebkitUserSelect":"KhtmlUserSelect"in n?"KhtmlUserSelect":"",S.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=S.util.falseFunction),r?t.style[r]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},S.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),r?t.style[r]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},S.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},S.util.getById=function(t){return"string"==typeof t?S.document.getElementById(t):t},S.util.toArray=o,S.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},S.util.makeElement=a,S.util.wrapElement=function(t,e,i){return"string"==typeof e&&(e=a(e,i)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},S.util.getScrollLeftTop=s,S.util.getElementOffset=function(t){var e,n,r=t&&t.ownerDocument,o={left:0,top:0},a={left:0,top:0},l={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!r)return a;for(var c in l)a[l[c]]+=parseInt(i(t,c),10)||0;return e=r.documentElement,void 0!==t.getBoundingClientRect&&(o=t.getBoundingClientRect()),n=s(t),{left:o.left+n.left-(e.clientLeft||0)+a.left,top:o.top+n.top-(e.clientTop||0)+a.top}},S.util.getNodeCanvas=function(t){var e=S.jsdomImplForWrapper(t);return e._canvas||e._image},S.util.cleanUpJsdomNode=function(t){if(S.isLikelyNode){var e=S.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}S.util.request=function(e,i){i||(i={});var n=i.method?i.method.toUpperCase():"GET",r=i.onComplete||function(){},o=new S.window.XMLHttpRequest,a=i.body||i.parameters;return o.onreadystatechange=function(){4===o.readyState&&(r(o),o.onreadystatechange=t)},"GET"===n&&(a=null,"string"==typeof i.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,i.parameters))),o.open(n,e,!0),"POST"!==n&&"PUT"!==n||o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(a),o}}(),S.log=console.log,S.warn=console.warn,function(){function t(){return!1}function e(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e}var i=S.window.requestAnimationFrame||S.window.webkitRequestAnimationFrame||S.window.mozRequestAnimationFrame||S.window.oRequestAnimationFrame||S.window.msRequestAnimationFrame||function(t){return S.window.setTimeout(t,1e3/60)},n=S.window.cancelAnimationFrame||S.window.clearTimeout;function r(){return i.apply(S.window,arguments)}S.util.animate=function(i){var n=!1;return r((function(o){i||(i={});var a,s=o||+new Date,l=i.duration||500,c=s+l,u=i.onChange||t,h=i.abort||t,f=i.onComplete||t,g=i.easing||e,d="startValue"in i?i.startValue:0,v="endValue"in i?i.endValue:100,p=i.byValue||v-d;i.onStart&&i.onStart(),function t(e){var i=(a=e||+new Date)>c?l:a-s,o=i/l,m=g(i,d,p,l),y=Math.abs((m-d)/p);if(!n){if(!h(m,y,o))return a>c?(u(v,1,1),void f(v,1,1)):(u(m,y,o),void r(t));f(v,1,1)}}(s)})),function(){n=!0}},S.util.requestAnimFrame=r,S.util.cancelAnimFrame=function(){return n.apply(S.window,arguments)}}(),function(){function t(t,e,i){var n="rgba("+parseInt(t[0]+i*(e[0]-t[0]),10)+","+parseInt(t[1]+i*(e[1]-t[1]),10)+","+parseInt(t[2]+i*(e[2]-t[2]),10);return n+=","+(t&&e?parseFloat(t[3]+i*(e[3]-t[3])):1),n+=")"}S.util.animateColor=function(e,i,n,r){var o=new S.Color(e).getSource(),a=new S.Color(i).getSource(),s=r.onComplete,l=r.onChange;return r=r||{},S.util.animate(S.util.object.extend(r,{duration:n||500,startValue:o,endValue:a,byValue:a,easing:function(e,i,n,o){return t(i,n,r.colorEasing?r.colorEasing(e,o):1-Math.cos(e/o*(Math.PI/2)))},onComplete:function(e,i,n){if(s)return s(t(a,a,0),i,n)},onChange:function(e,i,n){if(l){if(Array.isArray(e))return l(t(e,e,0),i,n);l(e,i,n)}}}))}}(),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,r){return i-n(r-t,0,i,r)+e}function n(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}S.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)<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:function(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,i,n){return i*(t/=n)*t*t*t+e},easeOutQuart:function(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},easeOutQuint:function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,n){return i*Math.sin(t/n*(Math.PI/2))+e},easeInOutSine:function(t,e,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+e},easeInExpo:function(t,e,i,n){return 0===t?e:i*Math.pow(2,10*(t/n-1))+e},easeOutExpo:function(t,e,i,n){return t===n?e+i:i*(1-Math.pow(2,-10*t/n))+e},easeInOutExpo:function(t,e,i,n){return 0===t?e:t===n?e+i:(t/=n/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e},easeOutCirc:function(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e},easeInOutCirc:function(t,e,i,n){return(t/=n/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(i,n,r,o){var a=0;return 0===i?n:1===(i/=o)?n+r:(a||(a=.3*o),-e(t(r,r,a,1.70158),i,o)+n)},easeOutElastic:function(e,i,n,r){var o=0;if(0===e)return i;if(1===(e/=r))return i+n;o||(o=.3*r);var a=t(n,n,o,1.70158);return a.a*Math.pow(2,-10*e)*Math.sin((e*r-a.s)*(2*Math.PI)/a.p)+a.c+i},easeInOutElastic:function(i,n,r,o){var a=0;if(0===i)return n;if(2===(i/=o/2))return n+r;a||(a=o*(.3*1.5));var s=t(r,r,a,1.70158);return i<1?-.5*e(s,i,o)+n:s.a*Math.pow(2,-10*(i-=1))*Math.sin((i*o-s.s)*(2*Math.PI)/s.p)*.5+s.c+n},easeInBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),i*(t/=n)*t*((r+1)*t-r)+e},easeOutBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),i*((t=t/n-1)*t*((r+1)*t+r)+1)+e},easeInOutBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),(t/=n/2)<1?i/2*(t*t*((1+(r*=1.525))*t-r))+e:i/2*((t-=2)*t*((1+(r*=1.525))*t+r)+2)+e},easeInBounce:i,easeOutBounce:n,easeInOutBounce:function(t,e,r,o){return t<o/2?.5*i(2*t,0,r,o)+e:.5*n(2*t-o,0,r,o)+.5*r+e}}}(),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.object.clone,r=e.util.toFixed,o=e.util.parseUnit,a=e.util.multiplyTransformMatrices,s={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","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing"},l={stroke:"strokeOpacity",fill:"fillOpacity"},c="font-size",u="clip-path";function h(t){return t in s?s[t]:t}function f(t,i,n,r){var s,l="[object Array]"===Object.prototype.toString.call(i);if("fill"!==t&&"stroke"!==t||"none"!==i){if("strokeUniform"===t)return"non-scaling-stroke"===i;if("strokeDashArray"===t)i="none"===i?null:i.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)i=n&&n.transformMatrix?a(n.transformMatrix,e.parseTransformAttribute(i)):e.parseTransformAttribute(i);else if("visible"===t)i="none"!==i&&"hidden"!==i,n&&!1===n.visible&&(i=!1);else if("opacity"===t)i=parseFloat(i),n&&void 0!==n.opacity&&(i*=n.opacity);else if("textAnchor"===t)i="start"===i?"left":"end"===i?"right":"center";else if("charSpacing"===t)s=o(i,r)/r*1e3;else if("paintFirst"===t){var c=i.indexOf("fill"),u=i.indexOf("stroke");i="fill";(c>-1&&u>-1&&u<c||-1===c&&u>-1)&&(i="stroke")}else{if("href"===t||"xlink:href"===t||"font"===t)return i;if("imageSmoothing"===t)return"optimizeQuality"===i;s=l?i.map(o):o(i,r)}}else i="";return!l&&isNaN(s)?i:s}function g(t){return new RegExp("^("+t.join("|")+")\\b","i")}function d(t,e){var i,n,r,o,a=[];for(r=0,o=e.length;r<o;r++)i=e[r],n=t.getElementsByTagName(i),a=a.concat(Array.prototype.slice.call(n));return a}function v(t,e){var i,n=!0;return(i=p(t,e.pop()))&&e.length&&(n=function(t,e){var i,n=!0;for(;t.parentNode&&1===t.parentNode.nodeType&&e.length;)n&&(i=e.pop()),n=p(t=t.parentNode,i);return 0===e.length}(t,e)),i&&n&&0===e.length}function p(t,e){var i,n,r=t.nodeName,o=t.getAttribute("class"),a=t.getAttribute("id");if(i=new RegExp("^"+r,"i"),e=e.replace(i,""),a&&e.length&&(i=new RegExp("#"+a+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")),o&&e.length)for(n=(o=o.split(" ")).length;n--;)i=new RegExp("\\."+o[n]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"");return 0===e.length}function m(t,e){var i;if(t.getElementById&&(i=t.getElementById(e)),i)return i;var n,r,o,a=t.getElementsByTagName("*");for(r=0,o=a.length;r<o;r++)if(e===(n=a[r]).getAttribute("id"))return n}e.svgValidTagNamesRegEx=g(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),e.svgViewBoxElementsRegEx=g(["symbol","image","marker","pattern","view","svg"]),e.svgInvalidAncestorsRegEx=g(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),e.svgValidParentsRegEx=g(["symbol","g","a","svg","clipPath","defs"]),e.cssRules={},e.gradientDefs={},e.clipPaths={},e.parseTransformAttribute=function(){function t(t,i,n){t[n]=Math.tan(e.util.degreesToRadians(i[0]))}var i=e.iMatrix,n=e.reNum,r=e.commaWsp,o="(?:"+("(?:(matrix)\\s*\\(\\s*("+n+")"+r+"("+n+")"+r+"("+n+")"+r+"("+n+")"+r+"("+n+")"+r+"("+n+")\\s*\\))")+"|"+("(?:(translate)\\s*\\(\\s*("+n+")(?:"+r+"("+n+"))?\\s*\\))")+"|"+("(?:(scale)\\s*\\(\\s*("+n+")(?:"+r+"("+n+"))?\\s*\\))")+"|"+("(?:(rotate)\\s*\\(\\s*("+n+")(?:"+r+"("+n+")"+r+"("+n+"))?\\s*\\))")+"|"+("(?:(skewX)\\s*\\(\\s*("+n+")\\s*\\))")+"|"+("(?:(skewY)\\s*\\(\\s*("+n+")\\s*\\))")+")",a=new RegExp("^\\s*(?:"+("(?:"+o+"(?:"+r+"*"+o+")*)")+"?)\\s*$"),s=new RegExp(o,"g");return function(n){var r=i.concat(),l=[];if(!n||n&&!a.test(n))return r;n.replace(s,(function(n){var a=new RegExp(o).exec(n).filter((function(t){return!!t})),s=a[1],c=a.slice(2).map(parseFloat);switch(s){case"translate":!function(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}(r,c);break;case"rotate":c[0]=e.util.degreesToRadians(c[0]),function(t,i){var n=e.util.cos(i[0]),r=e.util.sin(i[0]),o=0,a=0;3===i.length&&(o=i[1],a=i[2]),t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=o-(n*o-r*a),t[5]=a-(r*o+n*a)}(r,c);break;case"scale":!function(t,e){var i=e[0],n=2===e.length?e[1]:e[0];t[0]=i,t[3]=n}(r,c);break;case"skewX":t(r,c,2);break;case"skewY":t(r,c,1);break;case"matrix":r=c;break}l.push(r.concat()),r=i.concat()}));for(var c=l[0];l.length>1;)l.shift(),c=e.util.multiplyTransformMatrices(c,l[0]);return c}}();var y=new RegExp("^\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*$");function b(t){if(!e.svgViewBoxElementsRegEx.test(t.nodeName))return{};var i,n,r,a,s,l,c=t.getAttribute("viewBox"),u=1,h=1,f=t.getAttribute("width"),g=t.getAttribute("height"),d=t.getAttribute("x")||0,v=t.getAttribute("y")||0,p=t.getAttribute("preserveAspectRatio")||"",m=!c||!(c=c.match(y)),b=!f||!g||"100%"===f||"100%"===g,x=m&&b,C={},I="",_=0,M=0;if(C.width=0,C.height=0,C.toBeParsed=x,m&&(d||v)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(I=" translate("+o(d)+" "+o(v)+") ",s=(t.getAttribute("transform")||"")+I,t.setAttribute("transform",s),t.removeAttribute("x"),t.removeAttribute("y")),x)return C;if(m)return C.width=o(f),C.height=o(g),C;if(i=-parseFloat(c[1]),n=-parseFloat(c[2]),r=parseFloat(c[3]),a=parseFloat(c[4]),C.minX=i,C.minY=n,C.viewBoxWidth=r,C.viewBoxHeight=a,b?(C.width=r,C.height=a):(C.width=o(f),C.height=o(g),u=C.width/r,h=C.height/a),"none"!==(p=e.util.parsePreserveAspectRatioAttribute(p)).alignX&&("meet"===p.meetOrSlice&&(h=u=u>h?h:u),"slice"===p.meetOrSlice&&(h=u=u>h?u:h),_=C.width-r*u,M=C.height-a*u,"Mid"===p.alignX&&(_/=2),"Mid"===p.alignY&&(M/=2),"Min"===p.alignX&&(_=0),"Min"===p.alignY&&(M=0)),1===u&&1===h&&0===i&&0===n&&0===d&&0===v)return C;if((d||v)&&"#document"!==t.parentNode.nodeName&&(I=" translate("+o(d)+" "+o(v)+") "),s=I+" matrix("+u+" 0 0 "+h+" "+(i*u+_)+" "+(n*h+M)+") ","svg"===t.nodeName){for(l=t.ownerDocument.createElementNS(e.svgNS,"g");t.firstChild;)l.appendChild(t.firstChild);t.appendChild(l)}else(l=t).removeAttribute("x"),l.removeAttribute("y"),s=l.getAttribute("transform")+s;return l.setAttribute("transform",s),C}function x(t,e){var i="xlink:href",n=m(t,e.getAttribute(i).substr(1));if(n&&n.getAttribute(i)&&x(t,n),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach((function(t){n&&!e.hasAttribute(t)&&n.hasAttribute(t)&&e.setAttribute(t,n.getAttribute(t))})),!e.children.length)for(var r=n.cloneNode(!0);r.firstChild;)e.appendChild(r.firstChild);e.removeAttribute(i)}e.parseSVGDocument=function(t,i,r,o){if(t){!function(t){for(var i=d(t,["use","svg:use"]),n=0;i.length&&n<i.length;){var r=i[n],o=r.getAttribute("xlink:href")||r.getAttribute("href");if(null===o)return;var a,s,l,c,u=o.substr(1),h=r.getAttribute("x")||0,f=r.getAttribute("y")||0,g=m(t,u).cloneNode(!0),v=(g.getAttribute("transform")||"")+" translate("+h+", "+f+")",p=i.length,y=e.svgNS;if(b(g),/^svg$/i.test(g.nodeName)){var x=g.ownerDocument.createElementNS(y,"g");for(s=0,c=(l=g.attributes).length;s<c;s++)a=l.item(s),x.setAttributeNS(y,a.nodeName,a.nodeValue);for(;g.firstChild;)x.appendChild(g.firstChild);g=x}for(s=0,c=(l=r.attributes).length;s<c;s++)"x"!==(a=l.item(s)).nodeName&&"y"!==a.nodeName&&"xlink:href"!==a.nodeName&&"href"!==a.nodeName&&("transform"===a.nodeName?v=a.nodeValue+" "+v:g.setAttribute(a.nodeName,a.nodeValue));g.setAttribute("transform",v),g.setAttribute("instantiated_by_use","1"),g.removeAttribute("id"),r.parentNode.replaceChild(g,r),i.length===p&&n++}}(t);var a,s,l=e.Object.__uid++,c=b(t),u=e.util.toArray(t.getElementsByTagName("*"));if(c.crossOrigin=o&&o.crossOrigin,c.svgUid=l,0===u.length&&e.isLikelyNode){var h=[];for(a=0,s=(u=t.selectNodes('//*[name(.)!="svg"]')).length;a<s;a++)h[a]=u[a];u=h}var f=u.filter((function(t){return b(t),e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))&&!function(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}(t,e.svgInvalidAncestorsRegEx)}));if(!f||f&&!f.length)i&&i([],{});else{var g={};u.filter((function(t){return"clipPath"===t.nodeName.replace("svg:","")})).forEach((function(t){var i=t.getAttribute("id");g[i]=e.util.toArray(t.getElementsByTagName("*")).filter((function(t){return e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))}))})),e.gradientDefs[l]=e.getGradientDefs(t),e.cssRules[l]=e.getCSSRules(t),e.clipPaths[l]=g,e.parseElements(f,(function(t,n){i&&(i(t,c,n,u),delete e.gradientDefs[l],delete e.cssRules[l],delete e.clipPaths[l])}),n(c),r,o)}}};var C=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+e.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+e.reNum+"))?\\s+(.*)");i(e,{parseFontDeclaration:function(t,e){var i=t.match(C);if(i){var n=i[1],r=i[3],a=i[4],s=i[5],l=i[6];n&&(e.fontStyle=n),r&&(e.fontWeight=isNaN(parseFloat(r))?r:parseFloat(r)),a&&(e.fontSize=o(a)),l&&(e.fontFamily=l),s&&(e.lineHeight="normal"===s?1:s)}},getGradientDefs:function(t){var e,i=d(t,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),n=0,r={};for(n=i.length;n--;)(e=i[n]).getAttribute("xlink:href")&&x(t,e),r[e.getAttribute("id")]=e;return r},parseAttributes:function(t,n,a){if(t){var s,g,d,p={};void 0===a&&(a=t.getAttribute("svgUid")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(p=e.parseAttributes(t.parentNode,n,a));var m=n.reduce((function(e,i){return(s=t.getAttribute(i))&&(e[i]=s),e}),{}),y=i(function(t,i){var n={};for(var r in e.cssRules[i])if(v(t,r.split(" ")))for(var o in e.cssRules[i][r])n[o]=e.cssRules[i][r][o];return n}(t,a),e.parseStyleAttribute(t));m=i(m,y),y[u]&&t.setAttribute(u,y[u]),g=d=p.fontSize||e.Text.DEFAULT_SVG_FONT_SIZE,m[c]&&(m[c]=g=o(m[c],d));var b,x,C={};for(var I in m)x=f(b=h(I),m[I],p,g),C[b]=x;C&&C.font&&e.parseFontDeclaration(C.font,C);var _=i(p,C);return e.svgValidParentsRegEx.test(t.nodeName)?_:function(t){for(var i in l)if(void 0!==t[l[i]]&&""!==t[i]){if(void 0===t[i]){if(!e.Object.prototype[i])continue;t[i]=e.Object.prototype[i]}if(0!==t[i].indexOf("url(")){var n=new e.Color(t[i]);t[i]=n.setAlpha(r(n.getAlpha()*t[l[i]],2)).toRgba()}}return t}(_)}},parseElements:function(t,i,n,r,o){new e.ElementsParser(t,i,n,r,o).parse()},parseStyleAttribute:function(t){var e={},i=t.getAttribute("style");return i?("string"==typeof i?function(t,e){var i,n;t.replace(/;\s*$/,"").split(";").forEach((function(t){var r=t.split(":");i=r[0].trim().toLowerCase(),n=r[1].trim(),e[i]=n}))}(i,e):function(t,e){var i,n;for(var r in t)void 0!==t[r]&&(i=r.toLowerCase(),n=t[r],e[i]=n)}(i,e),e):e},parsePointsAttribute:function(t){if(!t)return null;var e,i,n=[];for(e=0,i=(t=(t=t.replace(/,/g," ").trim()).split(/\s+/)).length;e<i;e+=2)n.push({x:parseFloat(t[e]),y:parseFloat(t[e+1])});return n},getCSSRules:function(t){var i,n,r=t.getElementsByTagName("style"),o={};for(i=0,n=r.length;i<n;i++){var a=r[i].textContent;""!==(a=a.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&a.match(/[^{]*\{[\s\S]*?\}/g).map((function(t){return t.trim()})).forEach((function(t){var r=t.match(/([\s\S]*?)\s*\{([^}]*)\}/),a={},s=r[2].trim().replace(/;$/,"").split(/\s*;\s*/);for(i=0,n=s.length;i<n;i++){var l=s[i].split(/\s*:\s*/),c=l[0],u=l[1];a[c]=u}(t=r[1]).split(",").forEach((function(t){""!==(t=t.replace(/^svg/i,"").trim())&&(o[t]?e.util.object.extend(o[t],a):o[t]=e.util.object.clone(a))}))}))}return o},loadSVGFromURL:function(t,i,n,r){t=t.replace(/^\n\s*/,"").trim(),new e.util.request(t,{method:"get",onComplete:function(t){var o=t.responseXML;if(!o||!o.documentElement)return i&&i(null),!1;e.parseSVGDocument(o.documentElement,(function(t,e,n,r){i&&i(t,e,n,r)}),n,r)}})},loadSVGFromString:function(t,i,n,r){var o=(new e.window.DOMParser).parseFromString(t.trim(),"text/xml");e.parseSVGDocument(o.documentElement,(function(t,e,n,r){i(t,e,n,r)}),n,r)}})}(e),S.ElementsParser=function(t,e,i,n,r,o){this.elements=t,this.callback=e,this.options=i,this.reviver=n,this.svgUid=i&&i.svgUid||0,this.parsingOptions=r,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=o},(p=S.ElementsParser.prototype).parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},p.createObjects=function(){var t=this;this.elements.forEach((function(e,i){e.setAttribute("svgUid",t.svgUid),t.createObject(e,i)}))},p.findTag=function(t){return S[S.util.string.capitalize(t.tagName.replace("svg:",""))]},p.createObject=function(t,e){var i=this.findTag(t);if(i&&i.fromElement)try{i.fromElement(t,this.createCallback(e,t),this.options)}catch(t){S.log(t)}else this.checkIfDone()},p.createCallback=function(t,e){var i=this;return function(n){var r;i.resolveGradient(n,e,"fill"),i.resolveGradient(n,e,"stroke"),n instanceof S.Image&&n._originalElement&&(r=n.parsePreserveAspectRatioAttribute(e)),n._removeTransformMatrix(r),i.resolveClipPath(n,e),i.reviver&&i.reviver(e,n),i.instances[t]=n,i.checkIfDone()}},p.extractPropertyDefinition=function(t,e,i){var n=t[e],r=this.regexUrl;if(r.test(n)){r.lastIndex=0;var o=r.exec(n)[1];return r.lastIndex=0,S[i][this.svgUid][o]}},p.resolveGradient=function(t,e,i){var n=this.extractPropertyDefinition(t,i,"gradientDefs");if(n){var r=e.getAttribute(i+"-opacity"),o=S.Gradient.fromElement(n,t,r,this.options);t.set(i,o)}},p.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},p.resolveClipPath=function(t,e){var i,n,r,o,a=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(a){r=[],n=S.util.invertTransform(t.calcTransformMatrix());for(var s=a[0].parentNode,l=e;l.parentNode&&l.getAttribute("clip-path")!==t.clipPath;)l=l.parentNode;l.parentNode.appendChild(s);for(var c=0;c<a.length;c++)i=a[c],this.findTag(i).fromElement(i,this.createClipPathCallback(t,r),this.options);a=1===r.length?r[0]:new S.Group(r),o=S.util.multiplyTransformMatrices(n,a.calcTransformMatrix()),a.clipPath&&this.resolveClipPath(a,l);var u=S.util.qrDecompose(o);a.flipX=!1,a.flipY=!1,a.set("scaleX",u.scaleX),a.set("scaleY",u.scaleY),a.angle=u.angle,a.skewX=u.skewX,a.skewY=0,a.setPositionByOrigin({x:u.translateX,y:u.translateY},"center","center"),t.clipPath=a}else delete t.clipPath},p.checkIfDone=function(){0==--this.numElements&&(this.instances=this.instances.filter((function(t){return null!=t})),this.callback(this.instances,this.elements))},function(t){"use strict";var e=t.fabric||(t.fabric={});function i(t,e){this.x=t,this.y=e}e.Point?e.warn("fabric.Point is already defined"):(e.Point=i,i.prototype={type:"point",constructor:i,add:function(t){return new i(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 i(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new i(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 i(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new i(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new i(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,e){return void 0===e&&(e=.5),e=Math.max(Math.min(1,e),0),new i(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},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 i(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new i(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 i(this.x,this.y)}})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});function i(t){this.status=t,this.points=[]}e.Intersection?e.warn("fabric.Intersection is already defined"):(e.Intersection=i,e.Intersection.prototype={constructor:i,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},e.Intersection.intersectLineLine=function(t,n,r,o){var a,s=(o.x-r.x)*(t.y-r.y)-(o.y-r.y)*(t.x-r.x),l=(n.x-t.x)*(t.y-r.y)-(n.y-t.y)*(t.x-r.x),c=(o.y-r.y)*(n.x-t.x)-(o.x-r.x)*(n.y-t.y);if(0!==c){var u=s/c,h=l/c;0<=u&&u<=1&&0<=h&&h<=1?(a=new i("Intersection")).appendPoint(new e.Point(t.x+u*(n.x-t.x),t.y+u*(n.y-t.y))):a=new i}else a=new i(0===s||0===l?"Coincident":"Parallel");return a},e.Intersection.intersectLinePolygon=function(t,e,n){var r,o,a,s,l=new i,c=n.length;for(s=0;s<c;s++)r=n[s],o=n[(s+1)%c],a=i.intersectLineLine(t,e,r,o),l.appendPoints(a.points);return l.points.length>0&&(l.status="Intersection"),l},e.Intersection.intersectPolygonPolygon=function(t,e){var n,r=new i,o=t.length;for(n=0;n<o;n++){var a=t[n],s=t[(n+1)%o],l=i.intersectLinePolygon(a,s,e);r.appendPoints(l.points)}return r.points.length>0&&(r.status="Intersection"),r},e.Intersection.intersectPolygonRectangle=function(t,n,r){var o=n.min(r),a=n.max(r),s=new e.Point(a.x,o.y),l=new e.Point(o.x,a.y),c=i.intersectLinePolygon(o,s,t),u=i.intersectLinePolygon(s,a,t),h=i.intersectLinePolygon(a,l,t),f=i.intersectLinePolygon(l,o,t),g=new i;return g.appendPoints(c.points),g.appendPoints(u.points),g.appendPoints(h.points),g.appendPoints(f.points),g.points.length>0&&(g.status="Intersection"),g})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});function i(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function n(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}e.Color?e.warn("fabric.Color is already defined."):(e.Color=i,e.Color.prototype={_tryParsingColor:function(t){var e;t in i.colorNameMap&&(t=i.colorNameMap[t]),"transparent"===t&&(e=[255,255,255,0]),e||(e=i.sourceFromHex(t)),e||(e=i.sourceFromRgb(t)),e||(e=i.sourceFromHsl(t)),e||(e=[0,0,0,1]),e&&this.setSource(e)},_rgbToHsl:function(t,i,n){t/=255,i/=255,n/=255;var r,o,a,s=e.util.array.max([t,i,n]),l=e.util.array.min([t,i,n]);if(a=(s+l)/2,s===l)r=o=0;else{var c=s-l;switch(o=a>.5?c/(2-s-l):c/(s+l),s){case t:r=(i-n)/c+(i<n?6:0);break;case i:r=(n-t)/c+2;break;case n:r=(t-i)/c+4;break}r/=6}return[Math.round(360*r),Math.round(100*o),Math.round(100*a)]},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=1===(t=n[0].toString(16)).length?"0"+t:t,e=1===(e=n[1].toString(16)).length?"0"+e:e,i=1===(i=n[2].toString(16)).length?"0"+i:i,t.toUpperCase()+e.toUpperCase()+i.toUpperCase()},toHexa:function(){var t,e=this.getSource();return t=1===(t=(t=Math.round(255*e[3])).toString(16)).length?"0"+t:t,this.toHex()+t.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 i||(t=new i(t));var e,n=[],r=this.getAlpha(),o=this.getSource(),a=t.getSource();for(e=0;e<3;e++)n.push(Math.round(.5*o[e]+.5*a[e]));return n[3]=r,this.setSource(n),this}},e.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*)?\)$/i,e.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,e.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,e.Color.colorNameMap={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"},e.Color.fromRgb=function(t){return i.fromSource(i.sourceFromRgb(t))},e.Color.sourceFromRgb=function(t){var e=t.match(i.reRGBa);if(e){var n=parseInt(e[1],10)/(/%$/.test(e[1])?100:1)*(/%$/.test(e[1])?255:1),r=parseInt(e[2],10)/(/%$/.test(e[2])?100:1)*(/%$/.test(e[2])?255:1),o=parseInt(e[3],10)/(/%$/.test(e[3])?100:1)*(/%$/.test(e[3])?255:1);return[parseInt(n,10),parseInt(r,10),parseInt(o,10),e[4]?parseFloat(e[4]):1]}},e.Color.fromRgba=i.fromRgb,e.Color.fromHsl=function(t){return i.fromSource(i.sourceFromHsl(t))},e.Color.sourceFromHsl=function(t){var e=t.match(i.reHSLa);if(e){var r,o,a,s=(parseFloat(e[1])%360+360)%360/360,l=parseFloat(e[2])/(/%$/.test(e[2])?100:1),c=parseFloat(e[3])/(/%$/.test(e[3])?100:1);if(0===l)r=o=a=c;else{var u=c<=.5?c*(l+1):c+l-c*l,h=2*c-u;r=n(h,u,s+1/3),o=n(h,u,s),a=n(h,u,s-1/3)}return[Math.round(255*r),Math.round(255*o),Math.round(255*a),e[4]?parseFloat(e[4]):1]}},e.Color.fromHsla=i.fromHsl,e.Color.fromHex=function(t){return i.fromSource(i.sourceFromHex(t))},e.Color.sourceFromHex=function(t){if(t.match(i.reHex)){var e=t.slice(t.indexOf("#")+1),n=3===e.length||4===e.length,r=8===e.length||4===e.length,o=n?e.charAt(0)+e.charAt(0):e.substring(0,2),a=n?e.charAt(1)+e.charAt(1):e.substring(2,4),s=n?e.charAt(2)+e.charAt(2):e.substring(4,6),l=r?n?e.charAt(3)+e.charAt(3):e.substring(6,8):"FF";return[parseInt(o,16),parseInt(a,16),parseInt(s,16),parseFloat((parseInt(l,16)/255).toFixed(2))]}},e.Color.fromSource=function(t){var e=new i;return e.setSource(t),e})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=["e","se","s","sw","w","nw","n","ne","e"],n=["ns","nesw","ew","nwse"],r={},o="left",a="top",s="right",l="bottom",c="center",u={top:l,bottom:a,left:s,right:o,center:c},h=e.util.radiansToDegrees,f=Math.sign||function(t){return(t>0)-(t<0)||+t};function g(t,e){var i=t.angle+h(Math.atan2(e.y,e.x))+360;return Math.round(i%360/45)}function d(t,i){var n=i.transform.target,r=n.canvas,o=e.util.object.clone(i);o.target=n,r&&r.fire("object:"+t,o),n.fire(t,i)}function v(t,e){var i=e.canvas,n=t[i.uniScaleKey];return i.uniformScaling&&!n||!i.uniformScaling&&n}function p(t){return t.originX===c&&t.originY===c}function m(t,e,i){var n=t.lockScalingX,r=t.lockScalingY;return!(!n||!r)||(!(e||!n&&!r||!i)||(!(!n||"x"!==e)||!(!r||"y"!==e)))}function y(t,e,i,n){return{e:t,transform:e,pointer:{x:i,y:n}}}function b(t){return function(e,i,n,r){var o=i.target,a=o.getCenterPoint(),s=o.translateToOriginPoint(a,i.originX,i.originY),l=t(e,i,n,r);return o.setPositionByOrigin(s,i.originX,i.originY),l}}function x(t,e){return function(i,n,r,o){var a=e(i,n,r,o);return a&&d(t,y(i,n,r,o)),a}}function C(t,i,n,r,o){var a=t.target,s=a.controls[t.corner],l=a.canvas.getZoom(),c=a.padding/l,u=a.toLocalPoint(new e.Point(r,o),i,n);return u.x>=c&&(u.x-=c),u.x<=-c&&(u.x+=c),u.y>=c&&(u.y-=c),u.y<=c&&(u.y+=c),u.x-=s.offsetX,u.y-=s.offsetY,u}function I(t){return t.flipX!==t.flipY}function _(t,e,i,n,r){if(0!==t[e]){var o=r/t._getTransformedDimensions()[n]*t[i];t.set(i,o)}}function M(t,e,i,n){var r,c=e.target,u=c._getTransformedDimensions(0,c.skewY),f=C(e,e.originX,e.originY,i,n),g=Math.abs(2*f.x)-u.x,d=c.skewX;g<2?r=0:(r=h(Math.atan2(g/c.scaleX,u.y/c.scaleY)),e.originX===o&&e.originY===l&&(r=-r),e.originX===s&&e.originY===a&&(r=-r),I(c)&&(r=-r));var v=d!==r;if(v){var p=c._getTransformedDimensions().y;c.set("skewX",r),_(c,"skewY","scaleY","y",p)}return v}function S(t,e,i,n){var r,c=e.target,u=c._getTransformedDimensions(c.skewX,0),f=C(e,e.originX,e.originY,i,n),g=Math.abs(2*f.y)-u.y,d=c.skewY;g<2?r=0:(r=h(Math.atan2(g/c.scaleY,u.x/c.scaleX)),e.originX===o&&e.originY===l&&(r=-r),e.originX===s&&e.originY===a&&(r=-r),I(c)&&(r=-r));var v=d!==r;if(v){var p=c._getTransformedDimensions().x;c.set("skewY",r),_(c,"skewX","scaleX","x",p)}return v}function w(t,e,i,n,r){r=r||{};var o,a,s,l,c,h,g=e.target,d=g.lockScalingX,y=g.lockScalingY,b=r.by,x=v(t,g),I=m(g,b,x),_=e.gestureScale;if(I)return!1;if(_)a=e.scaleX*_,s=e.scaleY*_;else{if(o=C(e,e.originX,e.originY,i,n),c="y"!==b?f(o.x):1,h="x"!==b?f(o.y):1,e.signX||(e.signX=c),e.signY||(e.signY=h),g.lockScalingFlip&&(e.signX!==c||e.signY!==h))return!1;if(l=g._getTransformedDimensions(),x&&!b){var M=Math.abs(o.x)+Math.abs(o.y),S=e.original,w=M/(Math.abs(l.x*S.scaleX/g.scaleX)+Math.abs(l.y*S.scaleY/g.scaleY));a=S.scaleX*w,s=S.scaleY*w}else a=Math.abs(o.x*g.scaleX/l.x),s=Math.abs(o.y*g.scaleY/l.y);p(e)&&(a*=2,s*=2),e.signX!==c&&"y"!==b&&(e.originX=u[e.originX],a*=-1,e.signX=c),e.signY!==h&&"x"!==b&&(e.originY=u[e.originY],s*=-1,e.signY=h)}var k=g.scaleX,T=g.scaleY;return b?("x"===b&&g.set("scaleX",a),"y"===b&&g.set("scaleY",s)):(!d&&g.set("scaleX",a),!y&&g.set("scaleY",s)),k!==g.scaleX||T!==g.scaleY}r.scaleCursorStyleHandler=function(t,e,n){var r=v(t,n),o="";if(0!==e.x&&0===e.y?o="x":0===e.x&&0!==e.y&&(o="y"),m(n,o,r))return"not-allowed";var a=g(n,e);return i[a]+"-resize"},r.skewCursorStyleHandler=function(t,e,i){var r="not-allowed";if(0!==e.x&&i.lockSkewingY)return r;if(0!==e.y&&i.lockSkewingX)return r;var o=g(i,e)%4;return n[o]+"-resize"},r.scaleSkewCursorStyleHandler=function(t,e,i){return t[i.canvas.altActionKey]?r.skewCursorStyleHandler(t,e,i):r.scaleCursorStyleHandler(t,e,i)},r.rotationWithSnapping=x("rotating",b((function(t,e,i,n){var r=e,o=r.target,a=o.translateToOriginPoint(o.getCenterPoint(),r.originX,r.originY);if(o.lockRotation)return!1;var s,l=Math.atan2(r.ey-a.y,r.ex-a.x),c=Math.atan2(n-a.y,i-a.x),u=h(c-l+r.theta);if(o.snapAngle>0){var f=o.snapAngle,g=o.snapThreshold||f,d=Math.ceil(u/f)*f,v=Math.floor(u/f)*f;Math.abs(u-v)<g?u=v:Math.abs(u-d)<g&&(u=d)}return u<0&&(u=360+u),u%=360,s=o.angle!==u,o.angle=u,s}))),r.scalingEqually=x("scaling",b((function(t,e,i,n){return w(t,e,i,n)}))),r.scalingX=x("scaling",b((function(t,e,i,n){return w(t,e,i,n,{by:"x"})}))),r.scalingY=x("scaling",b((function(t,e,i,n){return w(t,e,i,n,{by:"y"})}))),r.scalingYOrSkewingX=function(t,e,i,n){return t[e.target.canvas.altActionKey]?r.skewHandlerX(t,e,i,n):r.scalingY(t,e,i,n)},r.scalingXOrSkewingY=function(t,e,i,n){return t[e.target.canvas.altActionKey]?r.skewHandlerY(t,e,i,n):r.scalingX(t,e,i,n)},r.changeWidth=x("resizing",b((function(t,e,i,n){var r=e.target,o=C(e,e.originX,e.originY,i,n),a=r.strokeWidth/(r.strokeUniform?r.scaleX:1),s=p(e)?2:1,l=r.width,c=Math.abs(o.x*s/r.scaleX)-a;return r.set("width",Math.max(c,0)),l!==c}))),r.skewHandlerX=function(t,e,i,n){var r,l=e.target,u=l.skewX,h=e.originY;return!l.lockSkewingX&&(0===u?r=C(e,c,c,i,n).x>0?o:s:(u>0&&(r=h===a?o:s),u<0&&(r=h===a?s:o),I(l)&&(r=r===o?s:o)),e.originX=r,x("skewing",b(M))(t,e,i,n))},r.skewHandlerY=function(t,e,i,n){var r,s=e.target,u=s.skewY,h=e.originX;return!s.lockSkewingY&&(0===u?r=C(e,c,c,i,n).y>0?a:l:(u>0&&(r=h===o?a:l),u<0&&(r=h===o?l:a),I(s)&&(r=r===a?l:a)),e.originY=r,x("skewing",b(S))(t,e,i,n))},r.dragHandler=function(t,e,i,n){var r=e.target,o=i-e.offsetX,a=n-e.offsetY,s=!r.get("lockMovementX")&&r.left!==o,l=!r.get("lockMovementY")&&r.top!==a;return s&&r.set("left",o),l&&r.set("top",a),(s||l)&&d("moving",y(t,e,i,n)),s||l},r.scaleOrSkewActionName=function(t,e,i){var n=t[i.canvas.altActionKey];return 0===e.x?n?"skewX":"scaleY":0===e.y?n?"skewY":"scaleX":void 0},r.rotationStyleHandler=function(t,e,i){return i.lockRotation?"not-allowed":e.cursorStyle},r.fireEvent=d,r.wrapWithFixedAnchor=b,r.wrapWithFireEvent=x,r.getLocalPoint=C,e.controlsUtils=r}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.degreesToRadians,n=e.controlsUtils;n.renderCircleControl=function(t,e,i,n,r){n=n||{};var o,a=this.sizeX||n.cornerSize||r.cornerSize,s=this.sizeY||n.cornerSize||r.cornerSize,l=void 0!==n.transparentCorners?n.transparentCorners:r.transparentCorners,c=l?"stroke":"fill",u=!l&&(n.cornerStrokeColor||r.cornerStrokeColor),h=e,f=i;t.save(),t.fillStyle=n.cornerColor||r.cornerColor,t.strokeStyle=n.cornerStrokeColor||r.cornerStrokeColor,a>s?(o=a,t.scale(1,s/a),f=i*a/s):s>a?(o=s,t.scale(a/s,1),h=e*s/a):o=a,t.lineWidth=1,t.beginPath(),t.arc(h,f,o/2,0,2*Math.PI,!1),t[c](),u&&t.stroke(),t.restore()},n.renderSquareControl=function(t,e,n,r,o){r=r||{};var a=this.sizeX||r.cornerSize||o.cornerSize,s=this.sizeY||r.cornerSize||o.cornerSize,l=void 0!==r.transparentCorners?r.transparentCorners:o.transparentCorners,c=l?"stroke":"fill",u=!l&&(r.cornerStrokeColor||o.cornerStrokeColor),h=a/2,f=s/2;t.save(),t.fillStyle=r.cornerColor||o.cornerColor,t.strokeStyle=r.cornerStrokeColor||o.cornerStrokeColor,t.lineWidth=1,t.translate(e,n),t.rotate(i(o.angle)),t[c+"Rect"](-h,-f,a,s),u&&t.strokeRect(-h,-f,a,s),t.restore()}}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Control=function(t){for(var e in t)this[e]=t[e]},e.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(t,e){return e.cursorStyle},getActionName:function(t,e){return e.actionName},getVisibility:function(t,e){var i=t._controlsVisibility;return i&&void 0!==i[e]?i[e]:this.visible},setVisibility:function(t){this.visible=t},positionHandler:function(t,i){return e.util.transformPoint({x:this.x*t.x+this.offsetX,y:this.y*t.y+this.offsetY},i)},calcCornerCoords:function(t,i,n,r,o){var a,s,l,c,u=o?this.touchSizeX:this.sizeX,h=o?this.touchSizeY:this.sizeY;if(u&&h&&u!==h){var f=Math.atan2(h,u),g=Math.sqrt(u*u+h*h)/2,d=f-e.util.degreesToRadians(t),v=Math.PI/2-f-e.util.degreesToRadians(t);a=g*e.util.cos(d),s=g*e.util.sin(d),l=g*e.util.cos(v),c=g*e.util.sin(v)}else{g=.7071067812*(u&&h?u:i);d=e.util.degreesToRadians(45-t);a=l=g*e.util.cos(d),s=c=g*e.util.sin(d)}return{tl:{x:n-c,y:r-l},tr:{x:n+a,y:r-s},bl:{x:n-a,y:r+s},br:{x:n+c,y:r+l}}},render:function(t,i,n,r,o){switch((r=r||{}).cornerStyle||o.cornerStyle){case"circle":e.controlsUtils.renderCircleControl.call(this,t,i,n,r,o);break;default:e.controlsUtils.renderSquareControl.call(this,t,i,n,r,o)}}}}(e),function(){function t(t,e){var i,n,r,o,a=t.getAttribute("style"),s=t.getAttribute("offset")||0;if(s=(s=parseFloat(s)/(/%$/.test(s)?100:1))<0?0:s>1?1:s,a){var l=a.split(/\s*;\s*/);for(""===l[l.length-1]&&l.pop(),o=l.length;o--;){var c=l[o].split(/\s*:\s*/),u=c[0].trim(),h=c[1].trim();"stop-color"===u?i=h:"stop-opacity"===u&&(r=h)}}return i||(i=t.getAttribute("stop-color")||"rgb(0,0,0)"),r||(r=t.getAttribute("stop-opacity")),n=(i=new S.Color(i)).getAlpha(),r=isNaN(parseFloat(r))?1:parseFloat(r),r*=n*e,{offset:s,color:i.toRgb(),opacity:r}}var e=S.util.object.clone;S.Gradient=S.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(t){t||(t={}),t.coords||(t.coords={});var e,i=this;Object.keys(t).forEach((function(e){i[e]=t[e]})),this.id?this.id+="_"+S.Object.__uid++:this.id=S.Object.__uid++,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()},addColorStop:function(t){for(var e in t){var i=new S.Color(t[e]);this.colorStops.push({offset:parseFloat(e),color:i.toRgb(),opacity:i.getAlpha()})}return this},toObject:function(t){var e={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return S.util.populateWithProperties(this,e,t),e},toSVG:function(t,i){var n,r,o,a,s=e(this.coords,!0),l=(i=i||{},e(this.colorStops,!0)),c=s.r1>s.r2,u=this.gradientTransform?this.gradientTransform.concat():S.iMatrix.concat(),h=-this.offsetX,f=-this.offsetY,g=!!i.additionalTransform,d="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(l.sort((function(t,e){return t.offset-e.offset})),"objectBoundingBox"===d?(h/=t.width,f/=t.height):(h+=t.width/2,f+=t.height/2),"path"===t.type&&"percentage"!==this.gradientUnits&&(h-=t.pathOffset.x,f-=t.pathOffset.y),u[4]-=h,u[5]-=f,a='id="SVGID_'+this.id+'" gradientUnits="'+d+'"',a+=' gradientTransform="'+(g?i.additionalTransform+" ":"")+S.util.matrixToSVG(u)+'" ',"linear"===this.type?o=["<linearGradient ",a,' x1="',s.x1,'" y1="',s.y1,'" x2="',s.x2,'" y2="',s.y2,'">\n']:"radial"===this.type&&(o=["<radialGradient ",a,' cx="',c?s.x1:s.x2,'" cy="',c?s.y1:s.y2,'" r="',c?s.r1:s.r2,'" fx="',c?s.x2:s.x1,'" fy="',c?s.y2:s.y1,'">\n']),"radial"===this.type){if(c)for((l=l.concat()).reverse(),n=0,r=l.length;n<r;n++)l[n].offset=1-l[n].offset;var v=Math.min(s.r1,s.r2);if(v>0){var p=v/Math.max(s.r1,s.r2);for(n=0,r=l.length;n<r;n++)l[n].offset+=p*(1-l[n].offset)}}for(n=0,r=l.length;n<r;n++){var m=l[n];o.push("<stop ",'offset="',100*m.offset+"%",'" style="stop-color:',m.color,void 0!==m.opacity?";stop-opacity: "+m.opacity:";",'"/>\n')}return o.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),o.join("")},toLive:function(t){var e,i,n,r=S.util.object.clone(this.coords);if(this.type){for("linear"===this.type?e=t.createLinearGradient(r.x1,r.y1,r.x2,r.y2):"radial"===this.type&&(e=t.createRadialGradient(r.x1,r.y1,r.r1,r.x2,r.y2,r.r2)),i=0,n=this.colorStops.length;i<n;i++){var o=this.colorStops[i].color,a=this.colorStops[i].opacity,s=this.colorStops[i].offset;void 0!==a&&(o=new S.Color(o).setAlpha(a).toRgba()),e.addColorStop(s,o)}return e}}}),S.util.object.extend(S.Gradient,{fromElement:function(e,i,n,r){var o=parseFloat(n)/(/%$/.test(n)?100:1);o=o<0?0:o>1?1:o,isNaN(o)&&(o=1);var a,s,l,c,u=e.getElementsByTagName("stop"),h="userSpaceOnUse"===e.getAttribute("gradientUnits")?"pixels":"percentage",f=e.getAttribute("gradientTransform")||"",g=[],d=0,v=0;for("linearGradient"===e.nodeName||"LINEARGRADIENT"===e.nodeName?(a="linear",s=function(t){return{x1:t.getAttribute("x1")||0,y1:t.getAttribute("y1")||0,x2:t.getAttribute("x2")||"100%",y2:t.getAttribute("y2")||0}}(e)):(a="radial",s=function(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%"}}(e)),l=u.length;l--;)g.push(t(u[l],o));return c=S.parseTransformAttribute(f),function(t,e,i,n){var r,o;Object.keys(e).forEach((function(t){"Infinity"===(r=e[t])?o=1:"-Infinity"===r?o=0:(o=parseFloat(e[t],10),"string"==typeof r&&/^(\d+\.\d+)%|(\d+)%$/.test(r)&&(o*=.01,"pixels"===n&&("x1"!==t&&"x2"!==t&&"r2"!==t||(o*=i.viewBoxWidth||i.width),"y1"!==t&&"y2"!==t||(o*=i.viewBoxHeight||i.height)))),e[t]=o}))}(0,s,r,h),"pixels"===h&&(d=-i.left,v=-i.top),new S.Gradient({id:e.getAttribute("id"),type:a,coords:s,colorStops:g,gradientUnits:h,gradientTransform:c,offsetX:d,offsetY:v})}})}(),function(){"use strict";var t=S.util.toFixed;S.Pattern=S.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(t,e){if(t||(t={}),this.id=S.Object.__uid++,this.setOptions(t),!t.source||t.source&&"string"!=typeof t.source)e&&e(this);else{var i=this;this.source=S.util.createImage(),S.util.loadImage(t.source,(function(t,n){i.source=t,e&&e(i,n)}),null,this.crossOrigin)}},toObject:function(e){var i,n,r=S.Object.NUM_FRACTION_DIGITS;return"string"==typeof this.source.src?i=this.source.src:"object"==typeof this.source&&this.source.toDataURL&&(i=this.source.toDataURL()),n={type:"pattern",source:i,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:t(this.offsetX,r),offsetY:t(this.offsetY,r),patternTransform:this.patternTransform?this.patternTransform.concat():null},S.util.populateWithProperties(this,n,e),n},toSVG:function(t){var e="function"==typeof this.source?this.source():this.source,i=e.width/t.width,n=e.height/t.height,r=this.offsetX/t.width,o=this.offsetY/t.height,a="";return"repeat-x"!==this.repeat&&"no-repeat"!==this.repeat||(n=1,o&&(n+=Math.abs(o))),"repeat-y"!==this.repeat&&"no-repeat"!==this.repeat||(i=1,r&&(i+=Math.abs(r))),e.src?a=e.src:e.toDataURL&&(a=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="'+a+'"></image>\n</pattern>\n'},setOptions:function(t){for(var e in t)this[e]=t[e]},toLive:function(t){var e=this.source;if(!e)return"";if(void 0!==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;e.Shadow?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,nonScaling:!1,initialize:function(t){for(var i in"string"==typeof t&&(t=this._parseShadow(t)),t)this[i]=t[i];this.id=e.Object.__uid++},_parseShadow:function(t){var i=t.trim(),n=e.Shadow.reOffsetsAndBlur.exec(i)||[];return{color:(i.replace(e.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)").trim(),offsetX:parseFloat(n[1],10)||0,offsetY:parseFloat(n[2],10)||0,blur:parseFloat(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,a=e.util.rotateVector({x:this.offsetX,y:this.offsetY},e.util.degreesToRadians(-t.angle)),s=new e.Color(this.color);return t.width&&t.height&&(n=100*i((Math.abs(a.x)+this.blur)/t.width,o)+20,r=100*i((Math.abs(a.y)+this.blur)/t.height,o)+20),t.flipX&&(a.x*=-1),t.flipY&&(a.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(a.x,o)+'" dy="'+i(a.y,o)+'" result="oBlur" ></feOffset>\n\t<feFlood flood-color="'+s.toRgb()+'" flood-opacity="'+s.getAlpha()+'"/>\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,nonScaling:this.nonScaling};var t={},i=e.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach((function(e){this[e]!==i[e]&&(t[e]=this[e])}),this),t}}),e.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/)}(e),function(){"use strict";if(S.StaticCanvas)S.warn("fabric.StaticCanvas is already defined.");else{var t=S.util.object.extend,e=S.util.getElementOffset,i=S.util.removeFromArray,n=S.util.toFixed,r=S.util.transformPoint,o=S.util.invertTransform,a=S.util.getNodeCanvas,s=S.util.createCanvasElement,l=new Error("Could not initialize `canvas` element");S.StaticCanvas=S.util.createClass(S.CommonMethods,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:S.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(t,e){var i=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(t),this._initOptions(e),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!==S.devicePixelRatio&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?S.devicePixelRatio:1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var t=S.devicePixelRatio;this.__initRetinaScaling(t,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(t,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(t,e,i){e.setAttribute("width",this.width*t),e.setAttribute("height",this.height*t),i.scale(t,t)},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)},__setBgOverlayImage:function(t,e,i,n){return"string"==typeof e?S.util.loadImage(e,(function(e,r){if(e){var o=new S.Image(e,n);this[t]=o,o.canvas=this}i&&i(e,r)}),this,n&&n.crossOrigin):(n&&e.setOptions(n),this[t]=e,e&&(e.canvas=this),i&&i(e,!1)),this},__setBgOverlayColor:function(t,e,i){return this[t]=e,this._initGradient(e,t),this._initPattern(e,t,i),this},_createCanvasElement:function(){var t=s();if(!t)throw l;if(t.style||(t.style={}),void 0===t.getContext)throw l;return t},_initOptions:function(t){var e=this.lowerCanvasEl;this._setOptions(t),this.width=this.width||parseInt(e.width,10)||0,this.height=this.height||parseInt(e.height,10)||0,this.lowerCanvasEl.style&&(e.width=this.width,e.height=this.height,e.style.width=this.width+"px",e.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){t&&t.getContext?this.lowerCanvasEl=t:this.lowerCanvasEl=S.util.getById(t)||this._createCanvasElement(),S.util.addClass(this.lowerCanvasEl,"lower-canvas"),this._originalCanvasStyle=this.lowerCanvasEl.style,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;for(var n in e=e||{},t)i=t[n],e.cssOnly||(this._setBackstoreDimension(n,t[n]),i+="px",this.hasLostContext=!0),e.backstoreOnly||this._setCssDimension(n,i);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(),this._initRetinaScaling(),this.calcOffset(),e.cssOnly||this.requestRenderAll(),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 this.viewportTransform[0]},setViewportTransform:function(t){var e,i,n,r=this._activeObject,o=this.backgroundImage,a=this.overlayImage;for(this.viewportTransform=t,i=0,n=this._objects.length;i<n;i++)(e=this._objects[i]).group||e.setCoords(!0);return r&&r.setCoords(),o&&o.setCoords(!0),a&&a.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(t,e){var i=t,n=this.viewportTransform.slice(0);t=r(t,o(this.viewportTransform)),n[0]=e,n[3]=e;var a=r(t,n);return n[4]+=i.x-a.x,n[5]+=i.y-a.y,this.setViewportTransform(n)},setZoom:function(t){return this.zoomToPoint(new S.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 S.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.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var t=this.contextContainer;return this.renderCanvas(t,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=S.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var t={},e=this.width,i=this.height,n=o(this.viewportTransform);return t.tl=r({x:0,y:0},n),t.br=r({x:e,y:i},n),t.tr=new S.Point(t.br.x,t.tl.y),t.bl=new S.Point(t.tl.x,t.br.y),this.vptCoords=t,t},cancelRequestedRender:function(){this.isRendering&&(S.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(t,e){var i=this.viewportTransform,n=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(t),S.util.setImageSmoothing(t,this.imageSmoothingEnabled),this.fire("before:render",{ctx:t}),this._renderBackground(t),t.save(),t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this._renderObjects(t,e),t.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),n&&(n.canvas=this,n.shouldCache(),n._transformDone=!0,n.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(t)),this._renderOverlay(t),this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),this.fire("after:render",{ctx:t})},drawClipPathOnCanvas:function(t){var e=this.viewportTransform,i=this.clipPath;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t.globalCompositeOperation="destination-in",i.transform(t),t.scale(1/i.zoomX,1/i.zoomY),t.drawImage(i._cacheCanvas,-i.cacheTranslationX,-i.cacheTranslationY),t.restore()},_renderObjects:function(t,e){var i,n;for(i=0,n=e.length;i<n;++i)e[i]&&e[i].render(t)},_renderBackgroundOrOverlay:function(t,e){var i=this[e+"Color"],n=this[e+"Image"],r=this.viewportTransform,o=this[e+"Vpt"];if(i||n){if(i){t.save(),t.beginPath(),t.moveTo(0,0),t.lineTo(this.width,0),t.lineTo(this.width,this.height),t.lineTo(0,this.height),t.closePath(),t.fillStyle=i.toLive?i.toLive(t,this):i,o&&t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),t.transform(1,0,0,1,i.offsetX||0,i.offsetY||0);var a=i.gradientTransform||i.patternTransform;a&&t.transform(a[0],a[1],a[2],a[3],a[4],a[5]),t.fill(),t.restore()}n&&(t.save(),o&&t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),n.render(t),t.restore())}},_renderBackground:function(t){this._renderBackgroundOrOverlay(t,"background")},_renderOverlay:function(t){this._renderBackgroundOrOverlay(t,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},centerObjectH:function(t){return this._centerObject(t,new S.Point(this.getCenter().left,t.getCenterPoint().y))},centerObjectV:function(t){return this._centerObject(t,new S.Point(t.getCenterPoint().x,this.getCenter().top))},centerObject:function(t){var e=this.getCenter();return this._centerObject(t,new S.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 S.Point(e.x,t.getCenterPoint().y)),this},viewportCenterObjectV:function(t){var e=this.getVpCenter();return this._centerObject(t,new S.Point(t.getCenterPoint().x,e.y))},getVpCenter:function(){var t=this.getCenter(),e=o(this.viewportTransform);return r({x:t.left,y:t.top},e)},_centerObject:function(t,e){return t.setPositionByOrigin(e,"center","center"),t.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),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=this.clipPath,r={version:S.version,objects:this._toObjects(e,i)};return n&&!n.excludeFromExport&&(r.clipPath=this._toObject(this.clipPath,e,i)),t(r,this.__serializeBgOverlay(e,i)),S.util.populateWithProperties(this,r,i),r},_toObjects:function(t,e){return this._objects.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={},n=this.backgroundImage,r=this.overlayImage,o=this.backgroundColor,a=this.overlayColor;return o&&o.toObject?o.excludeFromExport||(i.background=o.toObject(e)):o&&(i.background=o),a&&a.toObject?a.excludeFromExport||(i.overlay=a.toObject(e)):a&&(i.overlay=a),n&&!n.excludeFromExport&&(i.backgroundImage=this._toObject(n,t,e)),r&&!r.excludeFromExport&&(i.overlayImage=this._toObject(r,t,e)),i},svgViewportTransformation:!0,toSVG:function(t,e){t||(t={}),t.reviver=e;var i=[];return this._setSVGPreamble(i,t),this._setSVGHeader(i,t),this.clipPath&&i.push('<g clip-path="url(#'+this.clipPath.clipPathId+')" >\n'),this._setSVGBgOverlayColor(i,"background"),this._setSVGBgOverlayImage(i,"backgroundImage",e),this._setSVGObjects(i,e),this.clipPath&&i.push("</g>\n"),this._setSVGBgOverlayColor(i,"overlay"),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,a='viewBox="0 0 '+this.width+" "+this.height+'" ',s=S.Object.NUM_FRACTION_DIGITS;e.viewBox?a='viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':this.svgViewportTransformation&&(i=this.viewportTransform,a='viewBox="'+n(-i[4]/i[0],s)+" "+n(-i[5]/i[3],s)+" "+n(this.width/i[0],s)+" "+n(this.height/i[3],s)+'" '),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,'" ',a,'xml:space="preserve">\n',"<desc>Created with Fabric.js ",S.version,"</desc>\n","<defs>\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(e),"</defs>\n")},createSVGClipPathMarkup:function(t){var e=this.clipPath;return e?(e.clipPathId="CLIPPATH_"+S.Object.__uid++,'<clipPath id="'+e.clipPathId+'" >\n'+this.clipPath.toClipPathSVG(t.reviver)+"</clipPath>\n"):""},createSVGRefElementsMarkup:function(){var t=this;return["background","overlay"].map((function(e){var i=t[e+"Color"];if(i&&i.toLive){var n=t[e+"Vpt"],r=t.viewportTransform,o={width:t.width/(n?r[0]:1),height:t.height/(n?r[3]:1)};return i.toSVG(o,{additionalTransform:n?S.util.matrixToSVG(r):""})}})).join("")},createSVGFontFacesMarkup:function(){var t,e,i,n,r,o,a,s,l="",c={},u=S.fontPaths,h=[];for(this._objects.forEach((function t(e){h.push(e),e._objects&&e._objects.forEach(t)})),a=0,s=h.length;a<s;a++)if(e=(t=h[a]).fontFamily,-1!==t.type.indexOf("text")&&!c[e]&&u[e]&&(c[e]=!0,t.styles))for(r in i=t.styles)for(o in n=i[r])!c[e=n[o].fontFamily]&&u[e]&&(c[e]=!0);for(var f in c)l+=["\t\t@font-face {\n","\t\t\tfont-family: '",f,"';\n","\t\t\tsrc: url('",u[f],"');\n","\t\t}\n"].join("");return l&&(l=['\t<style type="text/css">',"<![CDATA[\n",l,"]]>","</style>\n"].join("")),l},_setSVGObjects:function(t,e){var i,n,r,o=this._objects;for(n=0,r=o.length;n<r;n++)(i=o[n]).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].excludeFromExport&&this[e].toSVG&&t.push(this[e].toSVG(i))},_setSVGBgOverlayColor:function(t,e){var i=this[e+"Color"],n=this.viewportTransform,r=this.width,o=this.height;if(i)if(i.toLive){var a=i.repeat,s=S.util.invertTransform(n),l=this[e+"Vpt"]?S.util.matrixToSVG(s):"";t.push('<rect transform="'+l+" translate(",r/2,",",o/2,')"',' x="',i.offsetX-r/2,'" y="',i.offsetY-o/2,'" ','width="',"repeat-y"===a||"no-repeat"===a?i.source.width:r,'" height="',"repeat-x"===a||"no-repeat"===a?i.source.height:o,'" fill="url(#SVGID_'+i.id+')"',"></rect>\n")}else t.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',i,'"',"></rect>\n")},sendToBack:function(t){if(!t)return this;var e,n,r,o=this._activeObject;if(t===o&&"activeSelection"===t.type)for(e=(r=o._objects).length;e--;)n=r[e],i(this._objects,n),this._objects.unshift(n);else i(this._objects,t),this._objects.unshift(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(t){if(!t)return this;var e,n,r,o=this._activeObject;if(t===o&&"activeSelection"===t.type)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.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(t,e){if(!t)return this;var n,r,o,a,s,l=this._activeObject,c=0;if(t===l&&"activeSelection"===t.type)for(s=l._objects,n=0;n<s.length;n++)r=s[n],(o=this._objects.indexOf(r))>0+c&&(a=o-1,i(this._objects,r),this._objects.splice(a,0,r)),c++;else 0!==(o=this._objects.indexOf(t))&&(a=this._findNewLowerIndex(t,o,e),i(this._objects,t),this._objects.splice(a,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(t,e,i){var n,r;if(i)for(n=e,r=e-1;r>=0;--r){if(t.intersectsWithObject(this._objects[r])||t.isContainedWithinObject(this._objects[r])||this._objects[r].isContainedWithinObject(t)){n=r;break}}else n=e-1;return n},bringForward:function(t,e){if(!t)return this;var n,r,o,a,s,l=this._activeObject,c=0;if(t===l&&"activeSelection"===t.type)for(n=(s=l._objects).length;n--;)r=s[n],(o=this._objects.indexOf(r))<this._objects.length-1-c&&(a=o+1,i(this._objects,r),this._objects.splice(a,0,r)),c++;else(o=this._objects.indexOf(t))!==this._objects.length-1&&(a=this._findNewUpperIndex(t,o,e),i(this._objects,t),this._objects.splice(a,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(t,e,i){var n,r,o;if(i)for(n=e,r=e+1,o=this._objects.length;r<o;++r){if(t.intersectsWithObject(this._objects[r])||t.isContainedWithinObject(this._objects[r])||this._objects[r].isContainedWithinObject(t)){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.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(S.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject((function(t){t.dispose&&t.dispose()})),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove("lower-canvas"),this.lowerCanvasEl.style=this._originalCanvasStyle,delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),S.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),t(S.StaticCanvas.prototype,S.Observable),t(S.StaticCanvas.prototype,S.Collection),t(S.StaticCanvas.prototype,S.DataURLExporter),t(S.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=s();if(!e||!e.getContext)return null;var i=e.getContext("2d");if(!i)return null;switch(t){case"setLineDash":return void 0!==i.setLineDash;default:return null}}}),S.StaticCanvas.prototype.toJSON=S.StaticCanvas.prototype.toObject,S.isLikelyNode&&(S.StaticCanvas.prototype.createPNGStream=function(){var t=a(this.lowerCanvasEl);return t&&t.createPNGStream()},S.StaticCanvas.prototype.createJPEGStream=function(t){var e=a(this.lowerCanvasEl);return e&&e.createJPEGStream(t)})}}(),S.BaseBrush=S.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(){var t=this.canvas.contextTop;t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.miterLimit=this.strokeMiterLimit,t.lineJoin=this.strokeLineJoin,t.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(t){var e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])},_setShadow:function(){if(this.shadow){var t=this.canvas,e=this.shadow,i=t.contextTop,n=t.getZoom();t&&t._isRetinaScaling()&&(n*=S.devicePixelRatio),i.shadowColor=e.color,i.shadowBlur=e.blur*n,i.shadowOffsetX=e.offsetX*n,i.shadowOffsetY=e.offsetY*n}},needsFullRender:function(){return new S.Color(this.color).getAlpha()<1||!!this.shadow},_resetShadow:function(){var t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0},_isOutSideCanvas:function(t){return t.x<0||t.x>this.canvas.getWidth()||t.y<0||t.y>this.canvas.getHeight()}}),S.PencilBrush=S.util.createClass(S.BaseBrush,{decimate:.4,initialize:function(t){this.canvas=t,this._points=[]},_drawSegment:function(t,e,i){var n=e.midPointFrom(i);return t.quadraticCurveTo(e.x,e.y,n.x,n.y),n},onMouseDown:function(t,e){this.canvas._isMainEvent(e.e)&&(this._prepareForDrawing(t),this._captureDrawingPath(t),this._render())},onMouseMove:function(t,e){if(this.canvas._isMainEvent(e.e)&&(!0!==this.limitedToCanvasSize||!this._isOutSideCanvas(t))&&this._captureDrawingPath(t)&&this._points.length>1)if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var i=this._points,n=i.length,r=this.canvas.contextTop;this._saveAndTransform(r),this.oldEnd&&(r.beginPath(),r.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(r,i[n-2],i[n-1],!0),r.stroke(),r.restore()}},onMouseUp:function(t){return!this.canvas._isMainEvent(t.e)||(this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(t){var e=new S.Point(t.x,t.y);this._reset(),this._addPoint(e),this.canvas.contextTop.moveTo(e.x,e.y)},_addPoint:function(t){return!(this._points.length>1&&t.eq(this._points[this._points.length-1])||(this._points.push(t),0))},_reset:function(){this._points=[],this._setBrushStyles(),this._setShadow()},_captureDrawingPath:function(t){var e=new S.Point(t.x,t.y);return this._addPoint(e)},_render:function(){var t,e,i=this.canvas.contextTop,n=this._points[0],r=this._points[1];if(this._saveAndTransform(i),i.beginPath(),2===this._points.length&&n.x===r.x&&n.y===r.y){var o=this.width/1e3;n=new S.Point(n.x,n.y),r=new S.Point(r.x,r.y),n.x-=o,r.x+=o}for(i.moveTo(n.x,n.y),t=1,e=this._points.length;t<e;t++)this._drawSegment(i,n,r),n=this._points[t],r=this._points[t+1];i.lineTo(n.x,n.y),i.stroke(),i.restore()},convertPointsToSVGPath:function(t){var e=this.width/1e3;return S.util.getSmoothPathFromPoints(t,e)},_isEmptySVGPath:function(t){return"M 0 0 Q 0 0 0 0 L 0 0"===S.util.joinPath(t)},createPath:function(t){var e=new S.Path(t,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,e.shadow=new S.Shadow(this.shadow)),e},decimatePoints:function(t,e){if(t.length<=2)return t;var i,n=this.canvas.getZoom(),r=Math.pow(e/n,2),o=t.length-1,a=t[0],s=[a];for(i=1;i<o-1;i++)Math.pow(a.x-t[i].x,2)+Math.pow(a.y-t[i].y,2)>=r&&(a=t[i],s.push(a));return s.push(t[o]),s},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var t=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(t))this.canvas.requestRenderAll();else{var e=this.createPath(t);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:e}),this.canvas.add(e),this.canvas.requestRenderAll(),e.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:e})}}}),S.CircleBrush=S.util.createClass(S.BaseBrush,{width:10,initialize:function(t){this.canvas=t,this.points=[]},drawDot:function(t){var e=this.addPoint(t),i=this.canvas.contextTop;this._saveAndTransform(i),this.dot(i,e),i.restore()},dot:function(t,e){t.fillStyle=e.fill,t.beginPath(),t.arc(e.x,e.y,e.radius,0,2*Math.PI,!1),t.closePath(),t.fill()},onMouseDown:function(t){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(t)},_render:function(){var t,e,i=this.canvas.contextTop,n=this.points;for(this._saveAndTransform(i),t=0,e=n.length;t<e;t++)this.dot(i,n[t]);i.restore()},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(t),this._render()):this.drawDot(t))},onMouseUp:function(){var t,e,i=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;var n=[];for(t=0,e=this.points.length;t<e;t++){var r=this.points[t],o=new S.Circle({radius:r.radius,left:r.x,top:r.y,originX:"center",originY:"center",fill:r.fill});this.shadow&&(o.shadow=new S.Shadow(this.shadow)),n.push(o)}var a=new S.Group(n);a.canvas=this.canvas,this.canvas.fire("before:path:created",{path:a}),this.canvas.add(a),this.canvas.fire("path:created",{path:a}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=i,this.canvas.requestRenderAll()},addPoint:function(t){var e=new S.Point(t.x,t.y),i=S.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,n=new S.Color(this.color).setAlpha(S.util.getRandomInt(0,100)/100).toRgba();return e.radius=i,e.fill=n,this.points.push(e),e}}),S.SprayBrush=S.util.createClass(S.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(this.sprayChunkPoints)},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.addSprayChunk(t),this.render(this.sprayChunkPoints))},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,a=r.length;o<a;o++){var s=new S.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});e.push(s)}this.optimizeOverlapping&&(e=this._getOptimizedRects(e));var l=new S.Group(e);this.shadow&&l.set("shadow",new S.Shadow(this.shadow)),this.canvas.fire("before:path:created",{path:l}),this.canvas.add(l),this.canvas.fire("path:created",{path:l}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.requestRenderAll()},_getOptimizedRects:function(t){var e,i,n,r={};for(i=0,n=t.length;i<n;i++)r[e=t[i].left+""+t[i].top]||(r[e]=t[i]);var o=[];for(e in r)o.push(r[e]);return o},render:function(t){var e,i,n=this.canvas.contextTop;for(n.fillStyle=this.color,this._saveAndTransform(n),e=0,i=t.length;e<i;e++){var r=t[e];void 0!==r.opacity&&(n.globalAlpha=r.opacity),n.fillRect(r.x,r.y,r.width,r.width)}n.restore()},_render:function(){var t,e,i=this.canvas.contextTop;for(i.fillStyle=this.color,this._saveAndTransform(i),t=0,e=this.sprayChunks.length;t<e;t++)this.render(this.sprayChunks[t]);i.restore()},addSprayChunk:function(t){this.sprayChunkPoints=[];var e,i,n,r,o=this.width/2;for(r=0;r<this.density;r++){e=S.util.getRandomInt(t.x-o,t.x+o),i=S.util.getRandomInt(t.y-o,t.y+o),n=this.dotWidthVariance?S.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var a=new S.Point(e,i);a.width=n,this.randomOpacity&&(a.opacity=S.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(a)}this.sprayChunks.push(this.sprayChunkPoints)}}),S.PatternBrush=S.util.createClass(S.PencilBrush,{getPatternSrc:function(){var t=S.util.createCanvasElement(),e=t.getContext("2d");return t.width=t.height=25,e.fillStyle=this.color,e.beginPath(),e.arc(10,10,10,0,2*Math.PI,!1),e.closePath(),e.fill(),t},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 S.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-i.x,offsetY:-i.y}),e}}),function(){var t=S.util.getPointer,e=S.util.degreesToRadians,i=S.util.isTouchEvent;for(var n in S.Canvas=S.util.createClass(S.StaticCanvas,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,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,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",rotationCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=S.PencilBrush&&new S.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var t,e,i,n=this.getActiveObjects();if(n.length>0&&!this.preserveObjectStacking){e=[],i=[];for(var r=0,o=this._objects.length;r<o;r++)t=this._objects[r],-1===n.indexOf(t)?e.push(t):i.push(t);n.length>1&&(this._activeObject._objects=i),e.push.apply(e,i)}else e=this._objects;return e},renderAll:function(){!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&this.renderTopLayer(this.contextTop);var t=this.contextContainer;return this.renderCanvas(t,this._chooseObjectsToRender()),this},renderTopLayer:function(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()},renderTop:function(){var t=this.contextTop;return this.clearContext(t),this.renderTopLayer(t),this.fire("after:render"),this},_normalizePointer:function(t,e){var i=t.calcTransformMatrix(),n=S.util.invertTransform(i),r=this.restorePointerVpt(e);return S.util.transformPoint(r,n)},isTargetTransparent:function(t,e,i){if(t.shouldCache()&&t._cacheCanvas&&t!==this._activeObject){var n=this._normalizePointer(t,{x:e,y:i}),r=Math.max(t.cacheTranslationX+n.x*t.zoomX,0),o=Math.max(t.cacheTranslationY+n.y*t.zoomY,0);return S.util.isTransparent(t._cacheContext,Math.round(r),Math.round(o),this.targetFindTolerance)}var a=this.contextCache,s=t.selectionBackgroundColor,l=this.viewportTransform;return t.selectionBackgroundColor="",this.clearContext(a),a.save(),a.transform(l[0],l[1],l[2],l[3],l[4],l[5]),t.render(a),a.restore(),t.selectionBackgroundColor=s,S.util.isTransparent(a,e,i,this.targetFindTolerance)},_isSelectionKeyPressed:function(t){return"[object Array]"===Object.prototype.toString.call(this.selectionKey)?!!this.selectionKey.find((function(e){return!0===t[e]})):t[this.selectionKey]},_shouldClearSelection:function(t,e){var i=this.getActiveObjects(),n=this._activeObject;return!e||e&&n&&i.length>1&&-1===i.indexOf(e)&&n!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&n&&n!==e},_shouldCenterTransform:function(t,e,i){var n;if(t)return"scale"===e||"scaleX"===e||"scaleY"===e||"resizing"===e?n=this.centeredScaling||t.centeredScaling:"rotate"===e&&(n=this.centeredRotation||t.centeredRotation),n?!i:i},_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,n){if(!e||!t)return"drag";var r=n.controls[e];return r.getActionName(i,r,n)},_setupCurrentTransform:function(t,i,n){if(i){var r=this.getPointer(t),o=i.__corner,a=i.controls[o],s=n&&o?a.getActionHandler(t,i,a):S.controlsUtils.dragHandler,l=this._getActionFromCorner(n,o,t,i),c=this._getOriginFromCorner(i,o),u=t[this.centeredKey],h={target:i,action:l,actionHandler:s,corner:o,scaleX:i.scaleX,scaleY:i.scaleY,skewX:i.skewX,skewY:i.skewY,offsetX:r.x-i.left,offsetY:r.y-i.top,originX:c.x,originY:c.y,ex:r.x,ey:r.y,lastX:r.x,lastY:r.y,theta:e(i.angle),width:i.width*i.scaleX,shiftKey:t.shiftKey,altKey:u,original:S.util.saveObjectTransform(i)};this._shouldCenterTransform(i,l,u)&&(h.originX="center",h.originY="center"),h.original.originX=c.x,h.original.originY=c.y,this._currentTransform=h,this._beforeTransform(t)}},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_drawSelection:function(t){var e=this._groupSelector,i=new S.Point(e.ex,e.ey),n=S.util.transformPoint(i,this.viewportTransform),r=new S.Point(e.ex+e.left,e.ey+e.top),o=S.util.transformPoint(r,this.viewportTransform),a=Math.min(n.x,o.x),s=Math.min(n.y,o.y),l=Math.max(n.x,o.x),c=Math.max(n.y,o.y),u=this.selectionLineWidth/2;this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(a,s,l-a,c-s)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,a+=u,s+=u,l-=u,c-=u,S.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(a,s,l-a,c-s))},findTarget:function(t,e){if(!this.skipTargetFind){var n,r,o=this.getPointer(t,!0),a=this._activeObject,s=this.getActiveObjects(),l=i(t),c=s.length>1&&!e||1===s.length;if(this.targets=[],c&&a._findTargetCorner(o,l))return a;if(s.length>1&&!e&&a===this._searchPossibleTargets([a],o))return a;if(1===s.length&&a===this._searchPossibleTargets([a],o)){if(!this.preserveObjectStacking)return a;n=a,r=this.targets,this.targets=[]}var u=this._searchPossibleTargets(this._objects,o);return t[this.altSelectionKey]&&u&&n&&u!==n&&(u=n,this.targets=r),u}},_checkTarget:function(t,e,i){if(e&&e.visible&&e.evented&&e.containsPoint(t)){if(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing)return!0;if(!this.isTargetTransparent(e,i.x,i.y))return!0}},_searchPossibleTargets:function(t,e){for(var i,n,r=t.length;r--;){var o=t[r],a=o.group?this._normalizePointer(o.group,e):e;if(this._checkTarget(a,o,e)){(i=t[r]).subTargetCheck&&i instanceof S.Group&&(n=this._searchPossibleTargets(i._objects,e))&&this.targets.push(n);break}}return i},restorePointerVpt:function(t){return S.util.transformPoint(t,S.util.invertTransform(this.viewportTransform))},getPointer:function(e,i){if(this._absolutePointer&&!i)return this._absolutePointer;if(this._pointer&&i)return this._pointer;var n,r=t(e),o=this.upperCanvasEl,a=o.getBoundingClientRect(),s=a.width||0,l=a.height||0;s&&l||("top"in a&&"bottom"in a&&(l=Math.abs(a.top-a.bottom)),"right"in a&&"left"in a&&(s=Math.abs(a.right-a.left))),this.calcOffset(),r.x=r.x-this._offset.left,r.y=r.y-this._offset.top,i||(r=this.restorePointerVpt(r));var c=this.getRetinaScaling();return 1!==c&&(r.x/=c,r.y/=c),n=0===s||0===l?{width:1,height:1}:{width:o.width/s,height:o.height/l},{x:r.x*n.width,y:r.y*n.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),e=this.lowerCanvasEl,i=this.upperCanvasEl;i?i.className="":(i=this._createCanvasElement(),this.upperCanvasEl=i),S.util.addClass(i,"upper-canvas "+t),this.wrapperEl.appendChild(i),this._copyCanvasStyle(e,i),this._applyCanvasStyle(i),this.contextTop=i.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=S.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),S.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),S.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.width||t.width,i=this.height||t.height;S.util.setStyle(t,{position:"absolute",width:e+"px",height:i+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),t.width=e,t.height=i,S.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var t=this._activeObject;return t?"activeSelection"===t.type&&t._objects?t._objects.slice(0):[t]:[]},_onObjectRemoved:function(t){t===this._activeObject&&(this.fire("before:selection:cleared",{target:t}),this._discardActiveObject(),this.fire("selection:cleared",{target:t}),t.fire("deselected")),t===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",t)},_fireSelectionEvents:function(t,e){var i=!1,n=this.getActiveObjects(),r=[],o=[];t.forEach((function(t){-1===n.indexOf(t)&&(i=!0,t.fire("deselected",{e:e,target:t}),o.push(t))})),n.forEach((function(n){-1===t.indexOf(n)&&(i=!0,n.fire("selected",{e:e,target:n}),r.push(n))})),t.length>0&&n.length>0?i&&this.fire("selection:updated",{e:e,selected:r,deselected:o,updated:r[0]||o[0],target:this._activeObject}):n.length>0?this.fire("selection:created",{e:e,selected:r,target:this._activeObject}):t.length>0&&this.fire("selection:cleared",{e:e,deselected:o})},setActiveObject:function(t,e){var i=this.getActiveObjects();return this._setActiveObject(t,e),this._fireSelectionEvents(i,e),this},_setActiveObject:function(t,e){return this._activeObject!==t&&(!!this._discardActiveObject(e,t)&&(!t.onSelect({e:e})&&(this._activeObject=t,!0)))},_discardActiveObject:function(t,e){var i=this._activeObject;if(i){if(i.onDeselect({e:t,object:e}))return!1;this._activeObject=null}return!0},discardActiveObject:function(t){var e=this.getActiveObjects(),i=this.getActiveObject();return e.length&&this.fire("before:selection:cleared",{target:i,e:t}),this._discardActiveObject(t),this._fireSelectionEvents(e,t),this},dispose:function(){var t=this.wrapperEl;return this.removeListeners(),t.removeChild(this.upperCanvasEl),t.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(t){S.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this)),t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,S.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(t){var e=this._activeObject;e&&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){if(t.group&&"activeSelection"===t.group.type&&this._activeObject===t.group){var e={};return["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach((function(i){e[i]=t[i]})),S.util.addTransformToObject(t,this._activeObject.calcOwnMatrix()),e}return null},_unwindGroupTransformOnObject:function(t,e){e&&t.set(e)},_setSVGObject:function(t,e,i){var n=this._realizeGroupTransformOnObject(e);this.callSuper("_setSVGObject",t,e,i),this._unwindGroupTransformOnObject(e,n)},setViewportTransform:function(t){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),S.StaticCanvas.prototype.setViewportTransform.call(this,t)}}),S.StaticCanvas)"prototype"!==n&&(S.Canvas[n]=S.StaticCanvas[n])}(),function(){var t=S.util.addListener,e=S.util.removeListener,i={passive:!1};function n(t,e){return t.button&&t.button===e-1}S.util.object.extend(S.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(t,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(t,e){var n=this.upperCanvasEl,r=this._getEventPrefix();t(S.window,"resize",this._onResize),t(n,r+"down",this._onMouseDown),t(n,r+"move",this._onMouseMove,i),t(n,r+"out",this._onMouseOut),t(n,r+"enter",this._onMouseEnter),t(n,"wheel",this._onMouseWheel),t(n,"contextmenu",this._onContextMenu),t(n,"dblclick",this._onDoubleClick),t(n,"dragover",this._onDragOver),t(n,"dragenter",this._onDragEnter),t(n,"dragleave",this._onDragLeave),t(n,"drop",this._onDrop),this.enablePointerEvents||t(n,"touchstart",this._onTouchStart,i),"undefined"!=typeof eventjs&&e in eventjs&&(eventjs[e](n,"gesture",this._onGesture),eventjs[e](n,"drag",this._onDrag),eventjs[e](n,"orientation",this._onOrientationChange),eventjs[e](n,"shake",this._onShake),eventjs[e](n,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(e,"remove");var t=this._getEventPrefix();e(S.document,t+"up",this._onMouseUp),e(S.document,"touchend",this._onTouchEnd,i),e(S.document,t+"move",this._onMouseMove,i),e(S.document,"touchmove",this._onMouseMove,i)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.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),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._simpleEventHandler.bind(this,"drop"),this.eventsBound=!0)},_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});var i=this;this._hoveredTargets.forEach((function(n){i.fire("mouse:out",{target:e,e:t}),n&&e.fire("mouseout",{e:t})})),this._hoveredTargets=[],this._iTextInstances&&this._iTextInstances.forEach((function(t){t.isEditing&&t.hiddenTextarea.focus()}))},_onMouseEnter:function(t){this._currentTransform||this.findTarget(t)||(this.fire("mouse:over",{target:null,e:t}),this._hoveredTarget=null,this._hoveredTargets=[])},_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)},_onDragOver:function(t){t.preventDefault();var e=this._simpleEventHandler("dragover",t);this._fireEnterLeaveEvents(e,t)},_onContextMenu:function(t){return this.stopContextMenu&&(t.stopPropagation(),t.preventDefault()),!1},_onDoubleClick:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"dblclick"),this._resetTransformEventData(t)},getPointerId:function(t){var e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1},_isMainEvent:function(t){return!0===t.isPrimary||!1!==t.isPrimary&&("touchend"===t.type&&0===t.touches.length||(!t.changedTouches||t.changedTouches[0].identifier===this.mainTouchId))},_onTouchStart:function(n){n.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(n)),this.__onMouseDown(n),this._resetTransformEventData();var r=this.upperCanvasEl,o=this._getEventPrefix();t(S.document,"touchend",this._onTouchEnd,i),t(S.document,"touchmove",this._onMouseMove,i),e(r,o+"down",this._onMouseDown)},_onMouseDown:function(n){this.__onMouseDown(n),this._resetTransformEventData();var r=this.upperCanvasEl,o=this._getEventPrefix();e(r,o+"move",this._onMouseMove,i),t(S.document,o+"up",this._onMouseUp),t(S.document,o+"move",this._onMouseMove,i)},_onTouchEnd:function(n){if(!(n.touches.length>0)){this.__onMouseUp(n),this._resetTransformEventData(),this.mainTouchId=null;var r=this._getEventPrefix();e(S.document,"touchend",this._onTouchEnd,i),e(S.document,"touchmove",this._onMouseMove,i);var o=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout((function(){t(o.upperCanvasEl,r+"down",o._onMouseDown),o._willAddMouseDown=0}),400)}},_onMouseUp:function(n){this.__onMouseUp(n),this._resetTransformEventData();var r=this.upperCanvasEl,o=this._getEventPrefix();this._isMainEvent(n)&&(e(S.document,o+"up",this._onMouseUp),e(S.document,o+"move",this._onMouseMove,i),t(r,o+"move",this._onMouseMove,i))},_onMouseMove:function(t){!this.allowTouchScrolling&&t.preventDefault&&t.preventDefault(),this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t){var e=this._activeObject;return!!(!!e!=!!t||e&&t&&e!==t)||(e&&e.isEditing,!1)},__onMouseUp:function(t){var e,i=this._currentTransform,r=this._groupSelector,o=!1,a=!r||0===r.left&&0===r.top;if(this._cacheTransformEventData(t),e=this._target,this._handleEvent(t,"up:before"),n(t,3))this.fireRightClick&&this._handleEvent(t,"up",3,a);else{if(n(t,2))return this.fireMiddleClick&&this._handleEvent(t,"up",2,a),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(t);else if(this._isMainEvent(t)){if(i&&(this._finalizeCurrentTransform(t),o=i.actionPerformed),!a){var s=e===this._activeObject;this._maybeGroupObjects(t),o||(o=this._shouldRender(e)||!s&&e===this._activeObject)}if(e){if(e.selectable&&e!==this._activeObject&&"up"===e.activeOn)this.setActiveObject(e,t),o=!0;else{var l=e._findTargetCorner(this.getPointer(t,!0),S.util.isTouchEvent(t)),c=e.controls[l],u=c&&c.getMouseUpHandler(t,e,c);if(u){var h=this.getPointer(t);u(t,i,h.x,h.y)}}e.isMoving=!1}this._setCursorFromEvent(t,e),this._handleEvent(t,"up",1,a),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),o?this.requestRenderAll():a||this.renderTop()}}},_simpleEventHandler:function(t,e){var i=this.findTarget(e),n=this.targets,r={e:e,target:i,subTargets:n};if(this.fire(t,r),i&&i.fire(t,r),!n)return i;for(var o=0;o<n.length;o++)n[o].fire(t,r);return i},_handleEvent:function(t,e,i,n){var r=this._target,o=this.targets||[],a={e:t,target:r,subTargets:o,button:i||1,isClick:n||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};"up"===e&&(a.currentTarget=this.findTarget(t),a.currentSubTargets=this.targets),this.fire("mouse:"+e,a),r&&r.fire("mouse"+e,a);for(var s=0;s<o.length;s++)o[s].fire("mouse"+e,a)},_finalizeCurrentTransform:function(t){var e,i=this._currentTransform,n=i.target,r={e:t,target:n,transform:i,action:i.action};n._scaling&&(n._scaling=!1),n.setCoords(),(i.actionPerformed||this.stateful&&n.hasStateChanged())&&(i.actionPerformed&&(e=this._addEventOptions(r,i),this._fire(e,r)),this._fire("modified",r))},_addEventOptions:function(t,e){var i,n;switch(e.action){case"scaleX":i="scaled",n="x";break;case"scaleY":i="scaled",n="y";break;case"skewX":i="skewed",n="x";break;case"skewY":i="skewed",n="y";break;case"scale":i="scaled",n="equally";break;case"rotate":i="rotated";break;case"drag":i="moved";break}return t.by=n,i},_onMouseDownInDrawingMode:function(t){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(t).requestRenderAll();var e=this.getPointer(t);this.freeDrawingBrush.onMouseDown(e,{e:t,pointer:e}),this._handleEvent(t,"down")},_onMouseMoveInDrawingMode:function(t){if(this._isCurrentlyDrawing){var e=this.getPointer(t);this.freeDrawingBrush.onMouseMove(e,{e:t,pointer:e})}this.setCursor(this.freeDrawingCursor),this._handleEvent(t,"move")},_onMouseUpInDrawingMode:function(t){var e=this.getPointer(t);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:t,pointer:e}),this._handleEvent(t,"up")},__onMouseDown:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"down:before");var e=this._target;if(n(t,3))this.fireRightClick&&this._handleEvent(t,"down",3);else if(n(t,2))this.fireMiddleClick&&this._handleEvent(t,"down",2);else if(this.isDrawingMode)this._onMouseDownInDrawingMode(t);else if(this._isMainEvent(t)&&!this._currentTransform){var i=this._pointer;this._previousPointer=i;var r=this._shouldRender(e),o=this._shouldGroup(t,e);if(this._shouldClearSelection(t,e)?this.discardActiveObject(t):o&&(this._handleGrouping(t,e),e=this._activeObject),!this.selection||e&&(e.selectable||e.isEditing||e===this._activeObject)||(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),e){var a=e===this._activeObject;e.selectable&&"down"===e.activeOn&&this.setActiveObject(e,t);var s=e._findTargetCorner(this.getPointer(t,!0),S.util.isTouchEvent(t));if(e.__corner=s,e===this._activeObject&&(s||!o)){this._setupCurrentTransform(t,e,a);var l=e.controls[s],c=(i=this.getPointer(t),l&&l.getMouseDownHandler(t,e,l));c&&c(t,this._currentTransform,i.x,i.y)}}this._handleEvent(t,"down"),(r||o)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(t){this._resetTransformEventData(),this._pointer=this.getPointer(t,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(t)||null},_beforeTransform:function(t){var e=this._currentTransform;this.stateful&&e.target.saveState(),this.fire("before:transform",{e:t,transform:e})},__onMouseMove:function(t){var e,i;if(this._handleEvent(t,"move:before"),this._cacheTransformEventData(t),this.isDrawingMode)this._onMouseMoveInDrawingMode(t);else if(this._isMainEvent(t)){var n=this._groupSelector;n?(i=this._absolutePointer,n.left=i.x-n.ex,n.top=i.y-n.ey,this.renderTop()):this._currentTransform?this._transformObject(t):(e=this.findTarget(t)||null,this._setCursorFromEvent(t,e),this._fireOverOutEvents(e,t)),this._handleEvent(t,"move"),this._resetTransformEventData()}},_fireOverOutEvents:function(t,e){var i=this._hoveredTarget,n=this._hoveredTargets,r=this.targets,o=Math.max(n.length,r.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:i,evtOut:"mouseout",canvasEvtOut:"mouse:out",evtIn:"mouseover",canvasEvtIn:"mouse:over"});for(var a=0;a<o;a++)this.fireSyntheticInOutEvents(r[a],e,{oldTarget:n[a],evtOut:"mouseout",evtIn:"mouseover"});this._hoveredTarget=t,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(t,e){var i=this._draggedoverTarget,n=this._hoveredTargets,r=this.targets,o=Math.max(n.length,r.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:i,evtOut:"dragleave",evtIn:"dragenter"});for(var a=0;a<o;a++)this.fireSyntheticInOutEvents(r[a],e,{oldTarget:n[a],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=t},fireSyntheticInOutEvents:function(t,e,i){var n,r,o,a=i.oldTarget,s=a!==t,l=i.canvasEvtIn,c=i.canvasEvtOut;s&&(n={e:e,target:t,previousTarget:a},r={e:e,target:a,nextTarget:t}),o=t&&s,a&&s&&(c&&this.fire(c,r),a.fire(i.evtOut,r)),o&&(l&&this.fire(l,n),t.fire(i.evtIn,n))},__onMouseWheel:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"wheel"),this._resetTransformEventData()},_transformObject:function(t){var e=this.getPointer(t),i=this._currentTransform;i.reset=!1,i.shiftKey=t.shiftKey,i.altKey=t[this.centeredKey],this._performTransformAction(t,i,e),i.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(t,e,i){var n=i.x,r=i.y,o=e.action,a=!1,s=e.actionHandler;s&&(a=s(t,e,n,r)),"drag"===o&&a&&(e.target.isMoving=!0,this.setCursor(e.target.moveCursor||this.moveCursor)),e.actionPerformed=e.actionPerformed||a},_fire:S.controlsUtils.fireEvent,_setCursorFromEvent:function(t,e){if(!e)return this.setCursor(this.defaultCursor),!1;var i=e.hoverCursor||this.hoverCursor,n=this._activeObject&&"activeSelection"===this._activeObject.type?this._activeObject:null,r=(!n||!n.contains(e))&&e._findTargetCorner(this.getPointer(t,!0));r?this.setCursor(this.getCornerCursor(r,e,t)):(e.subTargetCheck&&this.targets.concat().reverse().map((function(t){i=t.hoverCursor||i})),this.setCursor(i))},getCornerCursor:function(t,e,i){var n=e.controls[t];return n.cursorStyleHandler(i,n,e)}})}(),m=Math.min,y=Math.max,S.util.object.extend(S.Canvas.prototype,{_shouldGroup:function(t,e){var i=this._activeObject;return i&&this._isSelectionKeyPressed(t)&&e&&e.selectable&&this.selection&&(i!==e||"activeSelection"===i.type)&&!e.onSelect({e:t})},_handleGrouping:function(t,e){var i=this._activeObject;i.__corner||(e!==i||(e=this.findTarget(t,!0))&&e.selectable)&&(i&&"activeSelection"===i.type?this._updateActiveSelection(e,t):this._createActiveSelection(e,t))},_updateActiveSelection:function(t,e){var i=this._activeObject,n=i._objects.slice(0);i.contains(t)?(i.removeWithUpdate(t),this._hoveredTarget=t,this._hoveredTargets=this.targets.concat(),1===i.size()&&this._setActiveObject(i.item(0),e)):(i.addWithUpdate(t),this._hoveredTarget=i,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(n,e)},_createActiveSelection:function(t,e){var i=this.getActiveObjects(),n=this._createGroup(t);this._hoveredTarget=n,this._setActiveObject(n,e),this._fireSelectionEvents(i,e)},_createGroup:function(t){var e=this._objects,i=e.indexOf(this._activeObject)<e.indexOf(t)?[this._activeObject,t]:[t,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new S.ActiveSelection(i,{canvas:this})},_groupSelectedObjects:function(t){var e,i=this._collectObjects(t);1===i.length?this.setActiveObject(i[0],t):i.length>1&&(e=new S.ActiveSelection(i.reverse(),{canvas:this}),this.setActiveObject(e,t))},_collectObjects:function(t){for(var e,i=[],n=this._groupSelector.ex,r=this._groupSelector.ey,o=n+this._groupSelector.left,a=r+this._groupSelector.top,s=new S.Point(m(n,o),m(r,a)),l=new S.Point(y(n,o),y(r,a)),c=!this.selectionFullyContained,u=n===o&&r===a,h=this._objects.length;h--&&!((e=this._objects[h])&&e.selectable&&e.visible&&(c&&e.intersectsWithRect(s,l,!0)||e.isContainedWithinRect(s,l,!0)||c&&e.containsPoint(s,null,!0)||c&&e.containsPoint(l,null,!0))&&(i.push(e),u)););return i.length>1&&(i=i.filter((function(e){return!e.onSelect({e:t})}))),i},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t),this.setCursor(this.defaultCursor),this._groupSelector=null}}),S.util.object.extend(S.StaticCanvas.prototype,{toDataURL:function(t){t||(t={});var e=t.format||"png",i=t.quality||1,n=(t.multiplier||1)*(t.enableRetinaScaling?this.getRetinaScaling():1),r=this.toCanvasElement(n,t);return S.util.toDataURL(r,e,i)},toCanvasElement:function(t,e){t=t||1;var i=((e=e||{}).width||this.width)*t,n=(e.height||this.height)*t,r=this.getZoom(),o=this.width,a=this.height,s=r*t,l=this.viewportTransform,c=(l[4]-(e.left||0))*t,u=(l[5]-(e.top||0))*t,h=this.interactive,f=[s,0,0,s,c,u],g=this.enableRetinaScaling,d=S.util.createCanvasElement(),v=this.contextTop;return d.width=i,d.height=n,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=f,this.width=i,this.height=n,this.calcViewportBoundaries(),this.renderCanvas(d.getContext("2d"),this._objects),this.viewportTransform=l,this.width=o,this.height=a,this.calcViewportBoundaries(),this.interactive=h,this.enableRetinaScaling=g,this.contextTop=v,d}}),S.util.object.extend(S.StaticCanvas.prototype,{loadFromJSON:function(t,e,i){if(t){var n="string"==typeof t?JSON.parse(t):S.util.object.clone(t),r=this,o=n.clipPath,a=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete n.clipPath,this._enlivenObjects(n.objects,(function(t){r.clear(),r._setBgOverlay(n,(function(){o?r._enlivenObjects([o],(function(i){r.clipPath=i[0],r.__setupCanvas.call(r,n,t,a,e)})):r.__setupCanvas.call(r,n,t,a,e)}))}),i),this}},__setupCanvas:function(t,e,i,n){var r=this;e.forEach((function(t,e){r.insertAt(t,e)})),this.renderOnAddRemove=i,delete t.objects,delete t.backgroundImage,delete t.overlayImage,delete t.background,delete t.overlay,this._setOptions(t),this.renderAll(),n&&n()},_setBgOverlay:function(t,e){var i={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(t.backgroundImage||t.overlayImage||t.background||t.overlay){var n=function(){i.backgroundImage&&i.overlayImage&&i.backgroundColor&&i.overlayColor&&e&&e()};this.__setBgOverlay("backgroundImage",t.backgroundImage,i,n),this.__setBgOverlay("overlayImage",t.overlayImage,i,n),this.__setBgOverlay("backgroundColor",t.background,i,n),this.__setBgOverlay("overlayColor",t.overlay,i,n)}else e&&e()},__setBgOverlay:function(t,e,i,n){var r=this;if(!e)return i[t]=!0,void(n&&n());"backgroundImage"===t||"overlayImage"===t?S.util.enlivenObjects([e],(function(e){r[t]=e[0],i[t]=!0,n&&n()})):this["set"+S.util.string.capitalize(t,!0)](e,(function(){i[t]=!0,n&&n()}))},_enlivenObjects:function(t,e,i){t&&0!==t.length?S.util.enlivenObjects(t,(function(t){e&&e(t)}),null,i):e&&e([])},_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=S.util.createCanvasElement();e.width=this.width,e.height=this.height;var i=new S.Canvas(e);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.object.clone,r=e.util.toFixed,o=e.util.string.capitalize,a=e.util.degreesToRadians,s=!e.isLikelyNode;e.Object||(e.Object=e.util.createClass(e.CommonMethods,{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,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgb(178,204,255)",borderDashArray:null,cornerColor:"rgb(178,204,255)",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,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:s,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",activeOn:"down",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),colorProperties:"fill stroke backgroundColor".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(t){t&&this.setOptions(t)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=e.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(t){var i=e.perfLimitSizeTotal,n=t.width,r=t.height,o=e.maxCacheSideLimit,a=e.minCacheSideLimit;if(n<=o&&r<=o&&n*r<=i)return n<a&&(t.width=a),r<a&&(t.height=a),t;var s=n/r,l=e.util.limitDimsByArea(s,i),c=e.util.capValue,u=c(a,l.x,o),h=c(a,l.y,o);return n>u&&(t.zoomX/=n/u,t.width=u,t.capped=!0),r>h&&(t.zoomY/=r/h,t.height=h,t.capped=!0),t},_getCacheCanvasDimensions:function(){var t=this.getTotalObjectScaling(),e=this._getTransformedDimensions(0,0),i=e.x*t.scaleX/this.scaleX,n=e.y*t.scaleY/this.scaleY;return{width:i+2,height:n+2,zoomX:t.scaleX,zoomY:t.scaleY,x:i,y:n}},_updateCacheCanvas:function(){var t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){var i=t._currentTransform.target,n=t._currentTransform.action;if(this===i&&n.slice&&"scale"===n.slice(0,5))return!1}var r,o,a=this._cacheCanvas,s=this._limitCacheSize(this._getCacheCanvasDimensions()),l=e.minCacheSideLimit,c=s.width,u=s.height,h=s.zoomX,f=s.zoomY,g=c!==this.cacheWidth||u!==this.cacheHeight,d=this.zoomX!==h||this.zoomY!==f,v=g||d,p=0,m=0,y=!1;if(g){var b=this._cacheCanvas.width,x=this._cacheCanvas.height,C=c>b||u>x;y=C||(c<.9*b||u<.9*x)&&b>l&&x>l,C&&!s.capped&&(c>l||u>l)&&(p=.1*c,m=.1*u)}return this instanceof e.Text&&this.path&&(v=!0,y=!0,p+=this.getHeightOfLine(0)*this.zoomX,m+=this.getHeightOfLine(0)*this.zoomY),!!v&&(y?(a.width=Math.ceil(c+p),a.height=Math.ceil(u+m)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,a.width,a.height)),r=s.x/2,o=s.y/2,this.cacheTranslationX=Math.round(a.width/2-r)+r,this.cacheTranslationY=Math.round(a.height/2-o)+o,this.cacheWidth=c,this.cacheHeight=u,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(h,f),this.zoomX=h,this.zoomY=f,!0)},setOptions:function(t){this._setOptions(t),this._initGradient(t.fill,"fill"),this._initGradient(t.stroke,"stroke"),this._initPattern(t.fill,"fill"),this._initPattern(t.stroke,"stroke")},transform:function(t){var e=this.group&&!this.group._transformDone||this.group&&this.canvas&&t===this.canvas.contextTop,i=this.calcTransformMatrix(!e);t.transform(i[0],i[1],i[2],i[3],i[4],i[5])},toObject:function(t){var i=e.Object.NUM_FRACTION_DIGITS,n={type:this.type,version:e.version,originX:this.originX,originY:this.originY,left:r(this.left,i),top:r(this.top,i),width:r(this.width,i),height:r(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:r(this.strokeWidth,i),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:r(this.strokeMiterLimit,i),scaleX:r(this.scaleX,i),scaleY:r(this.scaleY,i),angle:r(this.angle,i),flipX:this.flipX,flipY:this.flipY,opacity:r(this.opacity,i),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:r(this.skewX,i),skewY:r(this.skewY,i)};return this.clipPath&&!this.clipPath.excludeFromExport&&(n.clipPath=this.clipPath.toObject(t),n.clipPath.inverted=this.clipPath.inverted,n.clipPath.absolutePositioned=this.clipPath.absolutePositioned),e.util.populateWithProperties(this,n,t),this.includeDefaultValues||(n=this._removeDefaultValues(n)),n},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(t){var i=e.util.getKlass(t.type).prototype;return i.stateProperties.forEach((function(e){"left"!==e&&"top"!==e&&(t[e]===i[e]&&delete t[e],"[object Array]"===Object.prototype.toString.call(t[e])&&"[object Array]"===Object.prototype.toString.call(i[e])&&0===t[e].length&&0===i[e].length&&delete t[e])})),t},toString:function(){return"#<fabric."+o(this.type)+">"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var t=e.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(t.scaleX),scaleY:Math.abs(t.scaleY)}},getTotalObjectScaling:function(){var t=this.getObjectScaling(),e=t.scaleX,i=t.scaleY;if(this.canvas){var n=this.canvas.getZoom(),r=this.canvas.getRetinaScaling();e*=n*r,i*=n*r}return{scaleX:e,scaleY:i}},getObjectOpacity:function(){var t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t},_set:function(t,i){var n="scaleX"===t||"scaleY"===t,r=this[t]!==i,o=!1;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?"dirty"===t&&this.group&&this.group.set("dirty",i):i=new e.Shadow(i),this[t]=i,r&&(o=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(t)>-1?(this.dirty=!0,o&&this.group.set("dirty",!0)):o&&this.stateProperties.indexOf(t)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:e.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||!this.width&&!this.height&&0===this.strokeWidth||!this.visible},render:function(t){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(t.save(),this._setupCompositeOperation(t),this.drawSelectionBackground(t),this.transform(t),this._setOpacity(t),this._setShadow(t,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(t)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(t),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),t.restore())},renderCache:function(t){t=t||{},this._cacheCanvas||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,t.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&"transparent"!==this.stroke&&0!==this.strokeWidth},hasFill:function(){return this.fill&&"transparent"!==this.fill},needsItsOwnCache:function(){return!("stroke"!==this.paintFirst||!this.hasFill()||!this.hasStroke()||"object"!=typeof this.shadow)||!!this.clipPath},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(0!==this.shadow.offsetX||0!==this.shadow.offsetY)},drawClipPathOnCache:function(t){var i=this.clipPath;if(t.save(),i.inverted?t.globalCompositeOperation="destination-out":t.globalCompositeOperation="destination-in",i.absolutePositioned){var n=e.util.invertTransform(this.calcTransformMatrix());t.transform(n[0],n[1],n[2],n[3],n[4],n[5])}i.transform(t),t.scale(1/i.zoomX,1/i.zoomY),t.drawImage(i._cacheCanvas,-i.cacheTranslationX,-i.cacheTranslationY),t.restore()},drawObject:function(t,e){var i=this.fill,n=this.stroke;e?(this.fill="black",this.stroke="",this._setClippingProperties(t)):this._renderBackground(t),this._render(t),this._drawClipPath(t),this.fill=i,this.stroke=n},_drawClipPath:function(t){var e=this.clipPath;e&&(e.canvas=this.canvas,e.shouldCache(),e._transformDone=!0,e.renderCache({forClipping:!0}),this.drawClipPathOnCache(t))},drawCacheOnCanvas:function(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(t){if(this.isNotVisible())return!1;if(this._cacheCanvas&&!t&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&!t){var e=this.cacheWidth/this.zoomX,i=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-e/2,-i/2,e,i)}return!0}return!1},_renderBackground:function(t){if(this.backgroundColor){var e=this._getNonTransformedDimensions();t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t)}},_setOpacity:function(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity},_setStrokeStyles:function(t,e){var i=e.stroke;i&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,i.toLive?"percentage"===i.gradientUnits||i.gradientTransform||i.patternTransform?this._applyPatternForTransformedGradient(t,i):(t.strokeStyle=i.toLive(t,this),this._applyPatternGradientTransform(t,i)):t.strokeStyle=e.stroke)},_setFillStyles:function(t,e){var i=e.fill;i&&(i.toLive?(t.fillStyle=i.toLive(t,this),this._applyPatternGradientTransform(t,e.fill)):t.fillStyle=i)},_setClippingProperties:function(t){t.globalAlpha=1,t.strokeStyle="transparent",t.fillStyle="#000000"},_setLineDash:function(t,e){e&&0!==e.length&&(1&e.length&&e.push.apply(e,e),t.setLineDash(e))},_renderControls:function(t,i){var n,r,o,s=this.getViewportTransform(),l=this.calcTransformMatrix();r=void 0!==(i=i||{}).hasBorders?i.hasBorders:this.hasBorders,o=void 0!==i.hasControls?i.hasControls:this.hasControls,l=e.util.multiplyTransformMatrices(s,l),n=e.util.qrDecompose(l),t.save(),t.translate(n.translateX,n.translateY),t.lineWidth=1*this.borderScaleFactor,this.group||(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),t.rotate(a(n.angle)),i.forActiveSelection||this.group?r&&this.drawBordersInGroup(t,n,i):r&&this.drawBorders(t,i),o&&this.drawControls(t,i),t.restore()},_setShadow:function(t){if(this.shadow){var i,n=this.shadow,r=this.canvas,o=r&&r.viewportTransform[0]||1,a=r&&r.viewportTransform[3]||1;i=n.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),r&&r._isRetinaScaling()&&(o*=e.devicePixelRatio,a*=e.devicePixelRatio),t.shadowColor=n.color,t.shadowBlur=n.blur*e.browserShadowBlurConstant*(o+a)*(i.scaleX+i.scaleY)/4,t.shadowOffsetX=n.offsetX*o*i.scaleX,t.shadowOffsetY=n.offsetY*a*i.scaleY}},_removeShadow:function(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_applyPatternGradientTransform:function(t,e){if(!e||!e.toLive)return{offsetX:0,offsetY:0};var i=e.gradientTransform||e.patternTransform,n=-this.width/2+e.offsetX||0,r=-this.height/2+e.offsetY||0;return"percentage"===e.gradientUnits?t.transform(this.width,0,0,this.height,n,r):t.transform(1,0,0,1,n,r),i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),{offsetX:n,offsetY:r}},_renderPaintInOrder:function(t){"stroke"===this.paintFirst?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))},_render:function(){},_renderFill:function(t){this.fill&&(t.save(),this._setFillStyles(t,this),"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.strokeUniform&&this.group){var e=this.getObjectScaling();t.scale(1/e.scaleX,1/e.scaleY)}else this.strokeUniform&&t.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(t,this.strokeDashArray),this._setStrokeStyles(t,this),t.stroke(),t.restore()}},_applyPatternForTransformedGradient:function(t,i){var n,r=this._limitCacheSize(this._getCacheCanvasDimensions()),o=e.util.createCanvasElement(),a=this.canvas.getRetinaScaling(),s=r.x/this.scaleX/a,l=r.y/this.scaleY/a;o.width=s,o.height=l,(n=o.getContext("2d")).beginPath(),n.moveTo(0,0),n.lineTo(s,0),n.lineTo(s,l),n.lineTo(0,l),n.closePath(),n.translate(s/2,l/2),n.scale(r.zoomX/this.scaleX/a,r.zoomY/this.scaleY/a),this._applyPatternGradientTransform(n,i),n.fillStyle=i.toLive(t),n.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(a*this.scaleX/r.zoomX,a*this.scaleY/r.zoomY),t.strokeStyle=n.createPattern(o,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var t=e.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",t.scaleX),this.set("scaleY",t.scaleY),this.angle=t.angle,this.skewX=t.skewX,this.skewY=0}},_removeTransformMatrix:function(t){var i=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),i=e.util.transformPoint(i,this.transformMatrix)),this.transformMatrix=null,t&&(this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this.cropX=t.cropX,this.cropY=t.cropY,i.x+=t.offsetLeft,i.y+=t.offsetTop,this.width=t.width,this.height=t.height),this.setPositionByOrigin(i,"center","center")},clone:function(t,i){var n=this.toObject(i);this.constructor.fromObject?this.constructor.fromObject(n,t):e.Object._fromObject("Object",n,t)},cloneAsImage:function(t,i){var n=this.toCanvasElement(i);return t&&t(new e.Image(n)),this},toCanvasElement:function(t){t||(t={});var i=e.util,n=i.saveObjectTransform(this),r=this.group,o=this.shadow,a=Math.abs,s=(t.multiplier||1)*(t.enableRetinaScaling?e.devicePixelRatio:1);delete this.group,t.withoutTransform&&i.resetObjectTransform(this),t.withoutShadow&&(this.shadow=null);var l,c,u,h,f=e.util.createCanvasElement(),g=this.getBoundingRect(!0,!0),d=this.shadow,v={x:0,y:0};d&&(c=d.blur,l=d.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),v.x=2*Math.round(a(d.offsetX)+c)*a(l.scaleX),v.y=2*Math.round(a(d.offsetY)+c)*a(l.scaleY)),u=g.width+v.x,h=g.height+v.y,f.width=Math.ceil(u),f.height=Math.ceil(h);var p=new e.StaticCanvas(f,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});"jpeg"===t.format&&(p.backgroundColor="#fff"),this.setPositionByOrigin(new e.Point(p.width/2,p.height/2),"center","center");var m=this.canvas;p.add(this);var y=p.toCanvasElement(s||1,t);return this.shadow=o,this.set("canvas",m),r&&(this.group=r),this.set(n).setCoords(),p._objects=[],p.dispose(),p=null,y},toDataURL:function(t){return t||(t={}),e.util.toDataURL(this.toCanvasElement(t),t.format||"png",t.quality||1)},isType:function(t){return this.type===t},complexity:function(){return 1},toJSON:function(t){return this.toObject(t)},rotate: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},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,a(-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.util.createAccessors(e.Object),i(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object._fromObject=function(t,i,r,o){var a=e[t];i=n(i,!0),e.util.enlivenPatterns([i.fill,i.stroke],(function(t){void 0!==t[0]&&(i.fill=t[0]),void 0!==t[1]&&(i.stroke=t[1]),e.util.enlivenObjects([i.clipPath],(function(t){i.clipPath=t[0];var e=o?new a(i[o],i):new a(i);r&&r(e)}))}))},e.Object.__uid=0)}(e),b=S.util.degreesToRadians,x={left:-.5,center:0,right:.5},C={top:-.5,center:0,bottom:.5},S.util.object.extend(S.Object.prototype,{translateToGivenOrigin:function(t,e,i,n,r){var o,a,s,l=t.x,c=t.y;return"string"==typeof e?e=x[e]:e-=.5,"string"==typeof n?n=x[n]:n-=.5,"string"==typeof i?i=C[i]:i-=.5,"string"==typeof r?r=C[r]:r-=.5,a=r-i,((o=n-e)||a)&&(s=this._getTransformedDimensions(),l=t.x+o*s.x,c=t.y+a*s.y),new S.Point(l,c)},translateToCenterPoint:function(t,e,i){var n=this.translateToGivenOrigin(t,e,i,"center","center");return this.angle?S.util.rotatePoint(n,t,b(this.angle)):n},translateToOriginPoint:function(t,e,i){var n=this.translateToGivenOrigin(t,"center","center",e,i);return this.angle?S.util.rotatePoint(n,t,b(this.angle)):n},getCenterPoint:function(){var t=new S.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(t,e,i){var n,r,o=this.getCenterPoint();return n=void 0!==e&&void 0!==i?this.translateToGivenOrigin(o,"center","center",e,i):new S.Point(this.left,this.top),r=new S.Point(t.x,t.y),this.angle&&(r=S.util.rotatePoint(r,o,-b(this.angle))),r.subtractEquals(n)},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(t){var e,i,n=b(this.angle),r=this.getScaledWidth(),o=S.util.cos(n)*r,a=S.util.sin(n)*r;e="string"==typeof this.originX?x[this.originX]:this.originX-.5,i="string"==typeof t?x[t]:t-.5,this.left+=o*(i-e),this.top+=a*(i-e),this.setCoords(),this.originX=t},_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")}}),function(){var t=S.util,e=t.degreesToRadians,i=t.multiplyTransformMatrices,n=t.transformPoint;t.object.extend(S.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(t,e){return e?t?this.calcACoords():this.calcLineCoords():(this.aCoords&&this.lineCoords||this.setCoords(!0),t?this.aCoords:this.lineCoords)},getCoords:function(t,e){return i=this._getCoords(t,e),[new S.Point(i.tl.x,i.tl.y),new S.Point(i.tr.x,i.tr.y),new S.Point(i.br.x,i.br.y),new S.Point(i.bl.x,i.bl.y)];var i},intersectsWithRect:function(t,e,i,n){var r=this.getCoords(i,n);return"Intersection"===S.Intersection.intersectPolygonRectangle(r,t,e).status},intersectsWithObject:function(t,e,i){return"Intersection"===S.Intersection.intersectPolygonPolygon(this.getCoords(e,i),t.getCoords(e,i)).status||t.isContainedWithinObject(this,e,i)||this.isContainedWithinObject(t,e,i)},isContainedWithinObject:function(t,e,i){for(var n=this.getCoords(e,i),r=e?t.aCoords:t.lineCoords,o=0,a=t._getImageLines(r);o<4;o++)if(!t.containsPoint(n[o],a))return!1;return!0},isContainedWithinRect:function(t,e,i,n){var r=this.getBoundingRect(i,n);return r.left>=t.x&&r.left+r.width<=e.x&&r.top>=t.y&&r.top+r.height<=e.y},containsPoint:function(t,e,i,n){var r=this._getCoords(i,n),o=(e=e||this._getImageLines(r),this._findCrossPoints(t,e));return 0!==o&&o%2==1},isOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,i=this.canvas.vptCoords.br;return!!this.getCoords(!0,t).some((function(t){return t.x<=i.x&&t.x>=e.x&&t.y<=i.y&&t.y>=e.y}))||(!!this.intersectsWithRect(e,i,!0,t)||this._containsCenterOfCanvas(e,i,t))},_containsCenterOfCanvas:function(t,e,i){var n={x:(t.x+e.x)/2,y:(t.y+e.y)/2};return!!this.containsPoint(n,null,!0,i)},isPartiallyOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,i=this.canvas.vptCoords.br;return!!this.intersectsWithRect(e,i,!0,t)||this.getCoords(!0,t).every((function(t){return(t.x>=i.x||t.x<=e.x)&&(t.y>=i.y||t.y<=e.y)}))&&this._containsCenterOfCanvas(e,i,t)},_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=0;for(var a in e)if(!((r=e[a]).o.y<t.y&&r.d.y<t.y||r.o.y>=t.y&&r.d.y>=t.y||(r.o.x===r.d.x&&r.o.x>=t.x?n=r.o.x:(0,i=(r.d.y-r.o.y)/(r.d.x-r.o.x),n=-(t.y-0*t.x-(r.o.y-i*r.o.x))/(0-i)),n>=t.x&&(o+=1),2!==o)))break;return o},getBoundingRect:function(e,i){var n=this.getCoords(e,i);return t.makeBoundingBoxFromPoints(n)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(t){return Math.abs(t)<this.minScaleLimit?t<0?-this.minScaleLimit:this.minScaleLimit:0===t?1e-4:t},scale:function(t){return this._set("scaleX",t),this._set("scaleY",t),this.setCoords()},scaleToWidth:function(t,e){var i=this.getBoundingRect(e).width/this.getScaledWidth();return this.scale(t/this.width/i)},scaleToHeight:function(t,e){var i=this.getBoundingRect(e).height/this.getScaledHeight();return this.scale(t/this.height/i)},calcCoords:function(t){return t?this.calcACoords():this.calcOCoords()},calcLineCoords:function(){var i=this.getViewportTransform(),r=this.padding,o=e(this.angle),a=t.cos(o)*r,s=t.sin(o)*r,l=a+s,c=a-s,u=this.calcACoords(),h={tl:n(u.tl,i),tr:n(u.tr,i),bl:n(u.bl,i),br:n(u.br,i)};return r&&(h.tl.x-=c,h.tl.y-=l,h.tr.x+=l,h.tr.y-=c,h.bl.x-=l,h.bl.y+=c,h.br.x+=c,h.br.y+=l),h},calcOCoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),n=this.getViewportTransform(),r=i(n,e),o=i(r,t),a=(o=i(o,[1/n[0],0,0,1/n[3],0,0]),this._calculateCurrentDimensions()),s={};return this.forEachControl((function(t,e,i){s[e]=t.positionHandler(a,o,i)})),s},calcACoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),r=i(e,t),o=this._getTransformedDimensions(),a=o.x/2,s=o.y/2;return{tl:n({x:-a,y:-s},r),tr:n({x:a,y:-s},r),bl:n({x:-a,y:s},r),br:n({x:a,y:s},r)}},setCoords:function(t){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),t||(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords()),this},_calcRotateMatrix:function(){return t.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var t=this.getCenterPoint();return[1,0,0,1,t.x,t.y]},transformMatrixKey:function(t){var e="_",i="";return!t&&this.group&&(i=this.group.transformMatrixKey(t)+e),i+this.top+e+this.left+e+this.scaleX+e+this.scaleY+e+this.skewX+e+this.skewY+e+this.angle+e+this.originX+e+this.originY+e+this.width+e+this.height+e+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(t){var e=this.calcOwnMatrix();if(t||!this.group)return e;var n=this.transformMatrixKey(t),r=this.matrixCache||(this.matrixCache={});return r.key===n?r.value:(this.group&&(e=i(this.group.calcTransformMatrix(!1),e)),r.key=n,r.value=e,e)},calcOwnMatrix:function(){var e=this.transformMatrixKey(!0),i=this.ownMatrixCache||(this.ownMatrixCache={});if(i.key===e)return i.value;var n=this._calcTranslateMatrix(),r={angle:this.angle,translateX:n[4],translateY:n[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return i.key=e,i.value=t.composeMatrix(r),i.value},_calcDimensionsTransformMatrix:function(e,i,n){return t.calcDimensionsMatrix({skewX:e,skewY:i,scaleX:this.scaleX*(n&&this.flipX?-1:1),scaleY:this.scaleY*(n&&this.flipY?-1:1)})},_getNonTransformedDimensions:function(){var t=this.strokeWidth;return{x:this.width+t,y:this.height+t}},_getTransformedDimensions:function(e,i){void 0===e&&(e=this.skewX),void 0===i&&(i=this.skewY);var n,r,o,a=0===e&&0===i;if(this.strokeUniform?(r=this.width,o=this.height):(r=(n=this._getNonTransformedDimensions()).x,o=n.y),a)return this._finalizeDimensions(r*this.scaleX,o*this.scaleY);var s=t.sizeAfterTransform(r,o,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:e,skewY:i});return this._finalizeDimensions(s.x,s.y)},_finalizeDimensions:function(t,e){return this.strokeUniform?{x:t+this.strokeWidth,y:e+this.strokeWidth}:{x:t,y:e}},_calculateCurrentDimensions:function(){var t=this.getViewportTransform(),e=this._getTransformedDimensions();return n(e,t,!0).scalarAdd(2*this.padding)}})}(),S.util.object.extend(S.Object.prototype,{sendToBack:function(){return this.group?S.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?S.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?S.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas&&this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?S.StaticCanvas.prototype.bringForward.call(this.group,this,t):this.canvas&&this.canvas.bringForward(this,t),this},moveTo:function(t){return this.group&&"activeSelection"!==this.group.type?S.StaticCanvas.prototype.moveTo.call(this.group,this,t):this.canvas&&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 S.Color(e),n=t+": "+i.toRgb()+"; ",r=i.getAlpha();return 1!==r&&(n+=t+"-opacity: "+r.toString()+"; "),n}return t+": none; "}var e=S.util.toFixed;S.util.object.extend(S.Object.prototype,{getSvgStyles:function(e){var i=this.fillRule?this.fillRule:"nonzero",n=this.strokeWidth?this.strokeWidth:"0",r=this.strokeDashArray?this.strokeDashArray.join(" "):"none",o=this.strokeDashOffset?this.strokeDashOffset:"0",a=this.strokeLineCap?this.strokeLineCap:"butt",s=this.strokeLineJoin?this.strokeLineJoin:"miter",l=this.strokeMiterLimit?this.strokeMiterLimit:"4",c=void 0!==this.opacity?this.opacity:"1",u=this.visible?"":" visibility: hidden;",h=e?"":this.getSvgFilter(),f=t("fill",this.fill);return[t("stroke",this.stroke),"stroke-width: ",n,"; ","stroke-dasharray: ",r,"; ","stroke-linecap: ",a,"; ","stroke-dashoffset: ",o,"; ","stroke-linejoin: ",s,"; ","stroke-miterlimit: ",l,"; ",f,"fill-rule: ",i,"; ","opacity: ",c,";",h,u].join("")},getSvgSpanStyles:function(e,i){var n="; ",r=e.fontFamily?"font-family: "+(-1===e.fontFamily.indexOf("'")&&-1===e.fontFamily.indexOf('"')?"'"+e.fontFamily+"'":e.fontFamily)+n:"",o=e.strokeWidth?"stroke-width: "+e.strokeWidth+n:"",a=(r=r,e.fontSize?"font-size: "+e.fontSize+"px"+n:""),s=e.fontStyle?"font-style: "+e.fontStyle+n:"",l=e.fontWeight?"font-weight: "+e.fontWeight+n:"",c=e.fill?t("fill",e.fill):"",u=e.stroke?t("stroke",e.stroke):"",h=this.getSvgTextDecoration(e);return h&&(h="text-decoration: "+h+n),[u,o,r,a,s,l,h,c,e.deltaY?"baseline-shift: "+-e.deltaY+"; ":"",i?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(t){return["overline","underline","line-through"].filter((function(e){return t[e.replace("-","")]})).join(" ")},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""},getSvgCommons:function(){return[this.id?'id="'+this.id+'" ':"",this.clipPath?'clip-path="url(#'+this.clipPath.clipPathId+')" ':""].join("")},getSvgTransform:function(t,e){var i=t?this.calcTransformMatrix():this.calcOwnMatrix();return'transform="'+S.util.matrixToSVG(i)+(e||"")+'" '},_setSVGBg:function(t){if(this.backgroundColor){var i=S.Object.NUM_FRACTION_DIGITS;t.push("\t\t<rect ",this._getFillAttributes(this.backgroundColor),' x="',e(-this.width/2,i),'" y="',e(-this.height/2,i),'" width="',e(this.width,i),'" height="',e(this.height,i),'"></rect>\n')}},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(t),{reviver:t})},toClipPathSVG:function(t){return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(t),{reviver:t})},_createBaseClipPathSVGMarkup:function(t,e){var i=(e=e||{}).reviver,n=e.additionalTransform||"",r=[this.getSvgTransform(!0,n),this.getSvgCommons()].join(""),o=t.indexOf("COMMON_PARTS");return t[o]=r,i?i(t.join("")):t.join("")},_createBaseSVGMarkup:function(t,e){var i,n,r=(e=e||{}).noStyle,o=e.reviver,a=r?"":'style="'+this.getSvgStyles()+'" ',s=e.withShadow?'style="'+this.getSvgFilter()+'" ':"",l=this.clipPath,c=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",u=l&&l.absolutePositioned,h=this.stroke,f=this.fill,g=this.shadow,d=[],v=t.indexOf("COMMON_PARTS"),p=e.additionalTransform;return l&&(l.clipPathId="CLIPPATH_"+S.Object.__uid++,n='<clipPath id="'+l.clipPathId+'" >\n'+l.toClipPathSVG(o)+"</clipPath>\n"),u&&d.push("<g ",s,this.getSvgCommons()," >\n"),d.push("<g ",this.getSvgTransform(!1),u?"":s+this.getSvgCommons()," >\n"),i=[a,c,r?"":this.addPaintOrder()," ",p?'transform="'+p+'" ':""].join(""),t[v]=i,f&&f.toLive&&d.push(f.toSVG(this)),h&&h.toLive&&d.push(h.toSVG(this)),g&&d.push(g.toSVG(this)),l&&d.push(n),d.push(t.join("")),d.push("</g>\n"),u&&d.push("</g>\n"),o?o(d.join("")):d.join("")},addPaintOrder:function(){return"fill"!==this.paintFirst?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var t=S.util.object.extend,e="stateProperties";function i(e,i,n){var r={};n.forEach((function(t){r[t]=e[t]})),t(e[i],r,!0)}function n(t,e,i){if(t===e)return!0;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0,o=t.length;r<o;r++)if(!n(t[r],e[r]))return!1;return!0}if(t&&"object"==typeof t){var a,s=Object.keys(t);if(!e||"object"!=typeof e||!i&&s.length!==Object.keys(e).length)return!1;for(r=0,o=s.length;r<o;r++)if("canvas"!==(a=s[r])&&"group"!==a&&!n(t[a],e[a]))return!1;return!0}}S.util.object.extend(S.Object.prototype,{hasStateChanged:function(t){var i="_"+(t=t||e);return Object.keys(this[i]).length<this[t].length||!n(this[i],this,!0)},saveState:function(t){var n=t&&t.propertySet||e,r="_"+n;return this[r]?(i(this,r,this[n]),t&&t.stateProperties&&i(this,r,t.stateProperties),this):this.setupState(t)},setupState:function(t){var i=(t=t||{}).propertySet||e;return t.propertySet=i,this["_"+i]={},this.saveState(t),this}})}(),function(){var t=S.util.degreesToRadians;S.util.object.extend(S.Object.prototype,{_findTargetCorner:function(t,e){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var i,n,r,o=t.x,a=t.y,s=Object.keys(this.oCoords),l=s.length-1;for(this.__corner=0;l>=0;l--)if(r=s[l],this.isControlVisible(r)&&(n=this._getImageLines(e?this.oCoords[r].touchCorner:this.oCoords[r].corner),0!==(i=this._findCrossPoints({x:o,y:a},n))&&i%2==1))return this.__corner=r,r;return!1},forEachControl:function(t){for(var e in this.controls)t(this.controls[e],e,this)},_setCornerCoords:function(){var t=this.oCoords;for(var e in t){var i=this.controls[e];t[e].corner=i.calcCornerCoords(this.angle,this.cornerSize,t[e].x,t[e].y,!1),t[e].touchCorner=i.calcCornerCoords(this.angle,this.touchCornerSize,t[e].x,t[e].y,!0)}},drawSelectionBackground:function(e){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;e.save();var i=this.getCenterPoint(),n=this._calculateCurrentDimensions(),r=this.canvas.viewportTransform;return e.translate(i.x,i.y),e.scale(1/r[0],1/r[3]),e.rotate(t(this.angle)),e.fillStyle=this.selectionBackgroundColor,e.fillRect(-n.x/2,-n.y/2,n.x,n.y),e.restore(),this},drawBorders:function(t,e){e=e||{};var i=this._calculateCurrentDimensions(),n=this.borderScaleFactor,r=i.x+n,o=i.y+n,a=void 0!==e.hasControls?e.hasControls:this.hasControls,s=!1;return t.save(),t.strokeStyle=e.borderColor||this.borderColor,this._setLineDash(t,e.borderDashArray||this.borderDashArray),t.strokeRect(-r/2,-o/2,r,o),a&&(t.beginPath(),this.forEachControl((function(e,i,n){e.withConnection&&e.getVisibility(n,i)&&(s=!0,t.moveTo(e.x*r,e.y*o),t.lineTo(e.x*r+e.offsetX,e.y*o+e.offsetY))})),s&&t.stroke()),t.restore(),this},drawBordersInGroup:function(t,e,i){i=i||{};var n=S.util.sizeAfterTransform(this.width,this.height,e),r=this.strokeWidth,o=this.strokeUniform,a=this.borderScaleFactor,s=n.x+r*(o?this.canvas.getZoom():e.scaleX)+a,l=n.y+r*(o?this.canvas.getZoom():e.scaleY)+a;return t.save(),this._setLineDash(t,i.borderDashArray||this.borderDashArray),t.strokeStyle=i.borderColor||this.borderColor,t.strokeRect(-s/2,-l/2,s,l),t.restore(),this},drawControls:function(t,e){e=e||{},t.save();var i,n,r=this.canvas.getRetinaScaling();return t.setTransform(r,0,0,r,0,0),t.strokeStyle=t.fillStyle=e.cornerColor||this.cornerColor,this.transparentCorners||(t.strokeStyle=e.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(t,e.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(i=this.group.calcTransformMatrix()),this.forEachControl((function(r,o,a){n=a.oCoords[o],r.getVisibility(a,o)&&(i&&(n=S.util.transformPoint(n,i)),r.render(t,n.x,n.y,e,a))})),t.restore(),this},isControlVisible:function(t){return this.controls[t]&&this.controls[t].getVisibility(this,t)},setControlVisible:function(t,e){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[t]=e,this},setControlsVisibility:function(t){for(var e in t||(t={}),t)this.setControlVisible(e,t[e]);return this},onDeselect:function(){},onSelect:function(){}})}(),S.util.object.extend(S.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return S.util.animate({startValue:t.left,endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(e){t.set("left",e),o.requestRenderAll(),r()},onComplete:function(){t.setCoords(),n()}}),this},fxCenterObjectV:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return S.util.animate({startValue:t.top,endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(e){t.set("top",e),o.requestRenderAll(),r()},onComplete:function(){t.setCoords(),n()}}),this},fxRemove:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return S.util.animate({startValue:t.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(e){t.set("opacity",e),o.requestRenderAll(),r()},onComplete:function(){o.remove(t),n()}}),this}}),S.util.object.extend(S.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?S.util.object.clone(i):{},~t.indexOf(".")&&(r=t.split("."));var a=o.colorProperties.indexOf(t)>-1||r&&o.colorProperties.indexOf(r[1])>-1,s=r?this.get(r[0])[r[1]]:this.get(t);"from"in i||(i.from=s),a||(e=~e.indexOf("=")?s+parseFloat(e.replace("=","")):parseFloat(e));var l={startValue:i.from,endValue:e,byValue:i.by,easing:i.easing,duration:i.duration,abort:i.abort&&function(t,e,n){return i.abort.call(o,t,e,n)},onChange:function(e,a,s){r?o[r[0]][r[1]]=e:o.set(t,e),n||i.onChange&&i.onChange(e,a,s)},onComplete:function(t,e,r){n||(o.setCoords(),i.onComplete&&i.onComplete(t,e,r))}};return a?S.util.animateColor(l.startValue,l.endValue,l.duration,l):S.util.animate(l)}}),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.object.clone,r={x1:1,x2:1,y1:1,y2:1};function o(t,e){var i=t.origin,n=t.axis1,r=t.axis2,o=t.dimension,a=e.nearest,s=e.center,l=e.farthest;return function(){switch(this.get(i)){case a:return Math.min(this.get(n),this.get(r));case s:return Math.min(this.get(n),this.get(r))+.5*this.get(o);case l:return Math.max(this.get(n),this.get(r))}}}e.Line?e.warn("fabric.Line is already defined"):(e.Line=e.util.createClass(e.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:e.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(t,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),void 0!==r[t]&&this._setWidthHeight(),this},_getLeftToOriginX:o({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:o({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(t){t.beginPath();var e=this.calcLinePoints();t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.lineWidth=this.strokeWidth;var i=t.strokeStyle;t.strokeStyle=this.stroke||t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=i},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(t){return i(this.callSuper("toObject",t),this.calcLinePoints())},_getNonTransformedDimensions:function(){var t=this.callSuper("_getNonTransformedDimensions");return"butt"===this.strokeLineCap&&(0===this.width&&(t.y-=this.strokeWidth),0===this.height&&(t.x-=this.strokeWidth)),t},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;return{x1:i,x2:t*this.width*-.5,y1:n,y2:e*this.height*-.5}},_toSVG:function(){var t=this.calcLinePoints();return["<line ","COMMON_PARTS",'x1="',t.x1,'" y1="',t.y1,'" x2="',t.x2,'" y2="',t.y2,'" />\n']}}),e.Line.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),e.Line.fromElement=function(t,n,r){r=r||{};var o=e.parseAttributes(t,e.Line.ATTRIBUTE_NAMES),a=[o.x1||0,o.y1||0,o.x2||0,o.y2||0];n(new e.Line(a,i(o,r)))},e.Line.fromObject=function(t,i){var r=n(t,!0);r.points=[t.x1,t.y1,t.x2,t.y2],e.Object._fromObject("Line",r,(function(t){delete t.points,i&&i(t)}),"points")})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=Math.PI;e.Circle?e.warn("fabric.Circle is already defined."):(e.Circle=e.util.createClass(e.Object,{type:"circle",radius:0,startAngle:0,endAngle:2*i,cacheProperties:e.Object.prototype.cacheProperties.concat("radius","startAngle","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(){var t,n=(this.endAngle-this.startAngle)%(2*i);if(0===n)t=["<circle ","COMMON_PARTS",'cx="0" cy="0" ','r="',this.radius,'" />\n'];else{var r=e.util.cos(this.startAngle)*this.radius,o=e.util.sin(this.startAngle)*this.radius,a=e.util.cos(this.endAngle)*this.radius,s=e.util.sin(this.endAngle)*this.radius,l=n>i?"1":"0";t=['<path d="M '+r+" "+o," A "+this.radius+" "+this.radius," 0 ",+l+" 1"," "+a+" "+s,'" ',"COMMON_PARTS"," />\n"]}return t},_render:function(t){t.beginPath(),t.arc(0,0,this.radius,this.startAngle,this.endAngle,!1),this._renderPaintInOrder(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)}}),e.Circle.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),e.Circle.fromElement=function(t,i){var n,r=e.parseAttributes(t,e.Circle.ATTRIBUTE_NAMES);if(!("radius"in(n=r)&&n.radius>=0))throw new Error("value of `r` attribute is required and can not be negative");r.left=(r.left||0)-r.radius,r.top=(r.top||0)-r.radius,i(new e.Circle(r))},e.Circle.fromObject=function(t,i){e.Object._fromObject("Circle",t,i)})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Triangle?e.warn("fabric.Triangle is already defined"):(e.Triangle=e.util.createClass(e.Object,{type:"triangle",width:100,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._renderPaintInOrder(t)},_toSVG:function(){var t=this.width/2,e=this.height/2;return["<polygon ","COMMON_PARTS",'points="',[-t+" "+e,"0 "+-e,t+" "+e].join(","),'" />']}}),e.Triangle.fromObject=function(t,i){return e.Object._fromObject("Triangle",t,i)})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=2*Math.PI;e.Ellipse?e.warn("fabric.Ellipse is already defined."):(e.Ellipse=e.util.createClass(e.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this.set("rx",t&&t.rx||0),this.set("ry",t&&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);break}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(){return["<ellipse ","COMMON_PARTS",'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,'" />\n']},_render:function(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,i,!1),t.restore(),this._renderPaintInOrder(t)}}),e.Ellipse.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),e.Ellipse.fromElement=function(t,i){var n=e.parseAttributes(t,e.Ellipse.ATTRIBUTE_NAMES);n.left=(n.left||0)-n.rx,n.top=(n.top||0)-n.ry,i(new e.Ellipse(n))},e.Ellipse.fromObject=function(t,i){e.Object._fromObject("Ellipse",t,i)})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Rect?e.warn("fabric.Rect is already defined"):(e.Rect=e.util.createClass(e.Object,{stateProperties:e.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(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){var e=this.rx?Math.min(this.rx,this.width/2):0,i=this.ry?Math.min(this.ry,this.height/2):0,n=this.width,r=this.height,o=-this.width/2,a=-this.height/2,s=0!==e||0!==i,l=.4477152502;t.beginPath(),t.moveTo(o+e,a),t.lineTo(o+n-e,a),s&&t.bezierCurveTo(o+n-l*e,a,o+n,a+l*i,o+n,a+i),t.lineTo(o+n,a+r-i),s&&t.bezierCurveTo(o+n,a+r-l*i,o+n-l*e,a+r,o+n-e,a+r),t.lineTo(o+e,a+r),s&&t.bezierCurveTo(o+l*e,a+r,o,a+r-l*i,o,a+r-i),t.lineTo(o,a+i),s&&t.bezierCurveTo(o,a+l*i,o+l*e,a,o+e,a),t.closePath(),this._renderPaintInOrder(t)},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_toSVG:function(){return["<rect ","COMMON_PARTS",'x="',-this.width/2,'" y="',-this.height/2,'" rx="',this.rx,'" ry="',this.ry,'" width="',this.width,'" height="',this.height,'" />\n']}}),e.Rect.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),e.Rect.fromElement=function(t,n,r){if(!t)return n(null);r=r||{};var o=e.parseAttributes(t,e.Rect.ATTRIBUTE_NAMES);o.left=o.left||0,o.top=o.top||0,o.height=o.height||0,o.width=o.width||0;var a=new e.Rect(i(r?e.util.object.clone(r):{},o));a.visible=a.visible&&a.width>0&&a.height>0,n(a)},e.Rect.fromObject=function(t,i){return e.Object._fromObject("Rect",t,i)})}(e),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;e.Polyline?e.warn("fabric.Polyline is already defined"):(e.Polyline=e.util.createClass(e.Object,{type:"polyline",points:null,cacheProperties:e.Object.prototype.cacheProperties.concat("points"),initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper("initialize",e),this._setPositionDimensions(e)},_setPositionDimensions:function(t){var e,i=this._calcDimensions(t);this.width=i.width,this.height=i.height,t.fromSVG||(e=this.translateToGivenOrigin({x:i.left-this.strokeWidth/2,y:i.top-this.strokeWidth/2},"left","top",this.originX,this.originY)),void 0===t.left&&(this.left=t.fromSVG?i.left:e.x),void 0===t.top&&(this.top=t.fromSVG?i.top:e.y),this.pathOffset={x:i.left+this.width/2,y:i.top+this.height/2}},_calcDimensions:function(){var t=this.points,e=n(t,"x")||0,i=n(t,"y")||0;return{left:e,top:i,width:(r(t,"x")||0)-e,height:(r(t,"y")||0)-i}},toObject:function(t){return i(this.callSuper("toObject",t),{points:this.points.concat()})},_toSVG:function(){for(var t=[],i=this.pathOffset.x,n=this.pathOffset.y,r=e.Object.NUM_FRACTION_DIGITS,a=0,s=this.points.length;a<s;a++)t.push(o(this.points[a].x-i,r),",",o(this.points[a].y-n,r)," ");return["<"+this.type+" ","COMMON_PARTS",'points="',t.join(""),'" />\n']},commonRender:function(t){var e,i=this.points.length,n=this.pathOffset.x,r=this.pathOffset.y;if(!i||isNaN(this.points[i-1].y))return!1;t.beginPath(),t.moveTo(this.points[0].x-n,this.points[0].y-r);for(var o=0;o<i;o++)e=this.points[o],t.lineTo(e.x-n,e.y-r);return!0},_render:function(t){this.commonRender(t)&&this._renderPaintInOrder(t)},complexity:function(){return this.get("points").length}}),e.Polyline.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polyline.fromElementGenerator=function(t){return function(n,r,o){if(!n)return r(null);o||(o={});var a=e.parsePointsAttribute(n.getAttribute("points")),s=e.parseAttributes(n,e[t].ATTRIBUTE_NAMES);s.fromSVG=!0,r(new e[t](a,i(s,o)))}},e.Polyline.fromElement=e.Polyline.fromElementGenerator("Polyline"),e.Polyline.fromObject=function(t,i){return e.Object._fromObject("Polyline",t,i,"points")})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Polygon?e.warn("fabric.Polygon is already defined"):(e.Polygon=e.util.createClass(e.Polyline,{type:"polygon",_render:function(t){this.commonRender(t)&&(t.closePath(),this._renderPaintInOrder(t))}}),e.Polygon.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polygon.fromElement=e.Polyline.fromElementGenerator("Polygon"),e.Polygon.fromObject=function(t,i){e.Object._fromObject("Polygon",t,i,"points")})}(e),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,a=e.util.toFixed;e.Path?e.warn("fabric.Path is already defined"):(e.Path=e.util.createClass(e.Object,{type:"path",path:null,cacheProperties:e.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:e.Object.prototype.stateProperties.concat("path"),initialize:function(t,i){i=i||{},this.callSuper("initialize",i),t||(t=[]);var n="[object Array]"===o.call(t);this.path=e.util.makePathSimpler(n?t:e.util.parsePath(t)),this.path&&e.Polyline.prototype._setPositionDimensions.call(this,i)},_renderPathCommands:function(t){var e,i=0,n=0,r=0,o=0,a=0,s=0,l=-this.pathOffset.x,c=-this.pathOffset.y;t.beginPath();for(var u=0,h=this.path.length;u<h;++u)switch((e=this.path[u])[0]){case"L":r=e[1],o=e[2],t.lineTo(r+l,o+c);break;case"M":i=r=e[1],n=o=e[2],t.moveTo(r+l,o+c);break;case"C":r=e[5],o=e[6],a=e[3],s=e[4],t.bezierCurveTo(e[1]+l,e[2]+c,a+l,s+c,r+l,o+c);break;case"Q":t.quadraticCurveTo(e[1]+l,e[2]+c,e[3]+l,e[4]+c),r=e[3],o=e[4],a=e[1],s=e[2];break;case"z":case"Z":r=i,o=n,t.closePath();break}},_render:function(t){this._renderPathCommands(t),this._renderPaintInOrder(t)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(t){return r(this.callSuper("toObject",t),{path:this.path.map((function(t){return t.slice()}))})},toDatalessObject:function(t){var e=this.toObject(["sourcePath"].concat(t));return e.sourcePath&&delete e.path,e},_toSVG:function(){return["<path ","COMMON_PARTS",'d="',e.util.joinPath(this.path),'" stroke-linecap="round" ',"/>\n"]},_getOffsetTransform:function(){var t=e.Object.NUM_FRACTION_DIGITS;return" translate("+a(-this.pathOffset.x,t)+", "+a(-this.pathOffset.y,t)+")"},toClipPathSVG:function(t){var e=this._getOffsetTransform();return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},toSVG:function(t){var e=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var t,r,o=[],a=[],s=0,l=0,c=0,u=0,h=0,f=this.path.length;h<f;++h){switch((t=this.path[h])[0]){case"L":c=t[1],u=t[2],r=[];break;case"M":s=c=t[1],l=u=t[2],r=[];break;case"C":r=e.util.getBoundsOfCurve(c,u,t[1],t[2],t[3],t[4],t[5],t[6]),c=t[5],u=t[6];break;case"Q":r=e.util.getBoundsOfCurve(c,u,t[1],t[2],t[1],t[2],t[3],t[4]),c=t[3],u=t[4];break;case"z":case"Z":c=s,u=l;break}r.forEach((function(t){o.push(t.x),a.push(t.y)})),o.push(c),a.push(u)}var g=i(o)||0,d=i(a)||0;return{left:g,top:d,width:(n(o)||0)-g,height:(n(a)||0)-d}}}),e.Path.fromObject=function(t,i){if("string"==typeof t.sourcePath){var n=t.sourcePath;e.loadSVGFromURL(n,(function(e){var n=e[0];n.setOptions(t),i&&i(n)}))}else e.Object._fromObject("Path",t,i,"path")},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);o.fromSVG=!0,i(new e.Path(o.d,r(o,n)))})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.array.min,n=e.util.array.max;e.Group||(e.Group=e.util.createClass(e.Object,e.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!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;if(i)this._updateObjectsACoords();else{var r=e&&e.centerPoint;void 0!==e.originX&&(this.originX=e.originX),void 0!==e.originY&&(this.originY=e.originY),r||this._calcBounds(),this._updateObjectsCoords(r),delete e.centerPoint,this.callSuper("initialize",e)}this.setCoords()},_updateObjectsACoords:function(){for(var t=this._objects.length;t--;)this._objects[t].setCoords(true)},_updateObjectsCoords:function(t){t=t||this.getCenterPoint();for(var e=this._objects.length;e--;)this._updateObjectCoords(this._objects[e],t)},_updateObjectCoords:function(t,e){var i=t.left,n=t.top;t.set({left:i-e.x,top:n-e.y}),t.group=this,t.setCoords(!0)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(t){var i=!!this.group;return this._restoreObjectsState(),e.util.resetObjectTransform(this),t&&(i&&e.util.removeTransformFromObject(t,this.group.calcTransformMatrix()),this._objects.push(t),t.group=this,t._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,i?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(t){return this._restoreObjectsState(),e.util.resetObjectTransform(this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(t){this.dirty=!0,t.group=this,t._set("canvas",this.canvas)},_onObjectRemoved:function(t){this.dirty=!0,delete t.group},_set:function(t,i){var n=this._objects.length;if(this.useSetOnGroup)for(;n--;)this._objects[n].setOnGroup(t,i);if("canvas"===t)for(;n--;)this._objects[n]._set(t,i);e.Object.prototype._set.call(this,t,i)},toObject:function(t){var i=this.includeDefaultValues,n=this._objects.filter((function(t){return!t.excludeFromExport})).map((function(e){var n=e.includeDefaultValues;e.includeDefaultValues=i;var r=e.toObject(t);return e.includeDefaultValues=n,r})),r=e.Object.prototype.toObject.call(this,t);return r.objects=n,r},toDatalessObject:function(t){var i,n=this.sourcePath;if(n)i=n;else{var r=this.includeDefaultValues;i=this._objects.map((function(e){var i=e.includeDefaultValues;e.includeDefaultValues=r;var n=e.toDatalessObject(t);return e.includeDefaultValues=i,n}))}var o=e.Object.prototype.toDatalessObject.call(this,t);return o.objects=i,o},render:function(t){this._transformDone=!0,this.callSuper("render",t),this._transformDone=!1},shouldCache:function(){var t=e.Object.prototype.shouldCache.call(this);if(t)for(var i=0,n=this._objects.length;i<n;i++)if(this._objects[i].willDrawShadow())return this.ownCaching=!1,!1;return t},willDrawShadow:function(){if(e.Object.prototype.willDrawShadow.call(this))return!0;for(var t=0,i=this._objects.length;t<i;t++)if(this._objects[t].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(t){for(var e=0,i=this._objects.length;e<i;e++)this._objects[e].render(t);this._drawClipPath(t)},isCacheDirty:function(t){if(this.callSuper("isCacheDirty",t))return!0;if(!this.statefullCache)return!1;for(var e=0,i=this._objects.length;e<i;e++)if(this._objects[e].isCacheDirty(!0)){if(this._cacheCanvas){var n=this.cacheWidth/this.zoomX,r=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-n/2,-r/2,n,r)}return!0}return!1},_restoreObjectsState:function(){var t=this.calcOwnMatrix();return this._objects.forEach((function(i){e.util.addTransformToObject(i,t),delete i.group,i.setCoords()})),this},realizeTransform:function(t,i){return e.util.addTransformToObject(t,i),t},destroy:function(){return this._objects.forEach((function(t){t.set("dirty",!0)})),this._restoreObjectsState()},toActiveSelection:function(){if(this.canvas){var t=this._objects,i=this.canvas;this._objects=[];var n=this.toObject();delete n.objects;var r=new e.ActiveSelection([]);return r.set(n),r.type="activeSelection",i.remove(this),t.forEach((function(t){t.group=r,t.dirty=!0,i.add(t)})),r.canvas=i,r._objects=t,i._activeObject=r,r.setCoords(),r}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){return this.forEachObject((function(t){t.setCoords(true)})),this},_calcBounds:function(t){for(var e,i,n,r,o=[],a=[],s=["tr","br","bl","tl"],l=0,c=this._objects.length,u=s.length;l<c;++l){for(n=(e=this._objects[l]).calcACoords(),r=0;r<u;r++)i=s[r],o.push(n[i].x),a.push(n[i].y);e.aCoords=n}this._getBounds(o,a,t)},_getBounds:function(t,r,o){var a=new e.Point(i(t),i(r)),s=new e.Point(n(t),n(r)),l=a.y||0,c=a.x||0,u=s.x-a.x||0,h=s.y-a.y||0;this.width=u,this.height=h,o||this.setPositionByOrigin({x:c,y:l},"left","top")},_toSVG:function(t){for(var e=["<g ","COMMON_PARTS"," >\n"],i=0,n=this._objects.length;i<n;i++)e.push("\t\t",this._objects[i].toSVG(t));return e.push("</g>\n"),e},getSvgStyles:function(){var t=void 0!==this.opacity&&1!==this.opacity?"opacity: "+this.opacity+";":"",e=this.visible?"":" visibility: hidden;";return[t,this.getSvgFilter(),e].join("")},toClipPathSVG:function(t){for(var e=[],i=0,n=this._objects.length;i<n;i++)e.push("\t",this._objects[i].toClipPathSVG(t));return this._createBaseClipPathSVGMarkup(e,{reviver:t})}}),e.Group.fromObject=function(t,i){var n=t.objects,r=e.util.object.clone(t,!0);delete r.objects,"string"!=typeof n?e.util.enlivenObjects(n,(function(n){e.util.enlivenObjects([t.clipPath],(function(r){var o=e.util.object.clone(t,!0);o.clipPath=r[0],delete o.objects,i&&i(new e.Group(n,o,!0))}))})):e.loadSVGFromURL(n,(function(o){var a=e.util.groupSVGElements(o,t,n);a.set(r),i&&i(a)}))})}(e),function(t){"use strict";var e=t.fabric||(t.fabric={});e.ActiveSelection||(e.ActiveSelection=e.util.createClass(e.Group,{type:"activeSelection",initialize:function(t,i){i=i||{},this._objects=t||[];for(var n=this._objects.length;n--;)this._objects[n].group=this;i.originX&&(this.originX=i.originX),i.originY&&(this.originY=i.originY),this._calcBounds(),this._updateObjectsCoords(),e.Object.prototype.initialize.call(this,i),this.setCoords()},toGroup:function(){var t=this._objects.concat();this._objects=[];var i=e.Object.prototype.toObject.call(this),n=new e.Group([]);if(delete i.type,n.set(i),t.forEach((function(t){t.canvas.remove(t),t.group=n})),n._objects=t,!this.canvas)return n;var r=this.canvas;return r.add(n),r._activeObject=n,n.setCoords(),n},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(t,e,i){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",t,e),void 0===(i=i||{}).hasControls&&(i.hasControls=!1),i.forActiveSelection=!0;for(var n=0,r=this._objects.length;n<r;n++)this._objects[n]._renderControls(t,i);t.restore()}}),e.ActiveSelection.fromObject=function(t,i){e.util.enlivenObjects(t.objects,(function(n){delete t.objects,i&&i(new e.ActiveSelection(n,t,!0))}))})}(e),function(t){"use strict";var e=S.util.object.extend;t.fabric||(t.fabric={}),t.fabric.Image?S.warn("fabric.Image is already defined."):(S.Image=S.util.createClass(S.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:S.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:S.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(t,e){e||(e={}),this.filters=[],this.cacheKey="texture"+S.Object.__uid++,this.callSuper("initialize",e),this._initElement(t,e)},getElement:function(){return this._element||{}},setElement:function(t,e){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=t,this._originalElement=t,this._initConfig(e),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(t){var e=S.filterBackend;e&&e.evictCachesForKey&&e.evictCachesForKey(t)},dispose:function(){this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(t){S.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var t=this.getElement();return{width:t.naturalWidth||t.width,height:t.naturalHeight||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()}},toObject:function(t){var i=[];this.filters.forEach((function(t){t&&i.push(t.toObject())}));var n=e(this.callSuper("toObject",["cropX","cropY"].concat(t)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:i});return this.resizeFilter&&(n.resizeFilter=this.resizeFilter.toObject()),n},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var t,e=[],i=[],n=this._element,r=-this.width/2,o=-this.height/2,a="",s="";if(!n)return[];if(this.hasCrop()){var l=S.Object.__uid++;e.push('<clipPath id="imageCrop_'+l+'">\n','\t<rect x="'+r+'" y="'+o+'" width="'+this.width+'" height="'+this.height+'" />\n',"</clipPath>\n"),a=' clip-path="url(#imageCrop_'+l+')" '}if(this.imageSmoothing||(s='" image-rendering="optimizeSpeed'),i.push("\t<image ","COMMON_PARTS",'xlink:href="',this.getSvgSrc(!0),'" x="',r-this.cropX,'" y="',o-this.cropY,'" width="',n.width||n.naturalWidth,'" height="',n.height||n.height,s,'"',a,"></image>\n"),this.stroke||this.strokeDashArray){var c=this.fill;this.fill=null,t=["\t<rect ",'x="',r,'" y="',o,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'],this.fill=c}return e="fill"!==this.paintFirst?e.concat(t,i):e.concat(i,t)},getSrc:function(t){var e=t?this._element:this._originalElement;return e?e.toDataURL?e.toDataURL():this.srcFromAttribute?e.getAttribute("src"):e.src:this.src||""},setSrc:function(t,e,i){return S.util.loadImage(t,(function(t,n){this.setElement(t,i),this._setWidthHeight(),e&&e(this,n)}),this,i&&i.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var t=this.resizeFilter,e=this.minimumScaleTrigger,i=this.getTotalObjectScaling(),n=i.scaleX,r=i.scaleY,o=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||n>e&&r>e)return this._element=o,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=n,void(this._lastScaleY=r);S.filterBackend||(S.filterBackend=S.initFilterBackend());var a=S.util.createCanvasElement(),s=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,l=o.width,c=o.height;a.width=l,a.height=c,this._element=a,this._lastScaleX=t.scaleX=n,this._lastScaleY=t.scaleY=r,S.filterBackend.applyFilters([t],o,l,c,this._element,s),this._filterScalingX=a.width/this._originalElement.width,this._filterScalingY=a.height/this._originalElement.height},applyFilters:function(t){if(t=(t=t||this.filters||[]).filter((function(t){return t&&!t.isNeutralState()})),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),0===t.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var e=this._originalElement,i=e.naturalWidth||e.width,n=e.naturalHeight||e.height;if(this._element===this._originalElement){var r=S.util.createCanvasElement();r.width=i,r.height=n,this._element=r,this._filteredEl=r}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,i,n),this._lastScaleX=1,this._lastScaleY=1;return S.filterBackend||(S.filterBackend=S.initFilterBackend()),S.filterBackend.applyFilters(t,this._originalElement,i,n,this._element,this.cacheKey),this._originalElement.width===this._element.width&&this._originalElement.height===this._element.height||(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(t){S.util.setImageSmoothing(t,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)},drawCacheOnCanvas:function(t){S.util.setImageSmoothing(t,this.imageSmoothing),S.Object.prototype.drawCacheOnCanvas.call(this,t)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(t){var e=this._element;if(e){var i=this._filterScalingX,n=this._filterScalingY,r=this.width,o=this.height,a=Math.min,s=Math.max,l=s(this.cropX,0),c=s(this.cropY,0),u=e.naturalWidth||e.width,h=e.naturalHeight||e.height,f=l*i,g=c*n,d=a(r*i,u-f),v=a(o*n,h-g),p=-r/2,m=-o/2,y=a(r,u/i-l),b=a(o,h/n-c);e&&t.drawImage(e,f,g,d,v,p,m,y,b)}},_needsResize:function(){var t=this.getTotalObjectScaling();return t.scaleX!==this._lastScaleX||t.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(t,e){this.setElement(S.util.getById(t),e),S.util.addClass(this.getElement(),S.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t)},_initFilters:function(t,e){t&&t.length?S.util.enlivenObjects(t,(function(t){e&&e(t)}),"fabric.Image.filters"):e&&e()},_setWidthHeight:function(t){t||(t={});var e=this.getElement();this.width=t.width||e.naturalWidth||e.width||0,this.height=t.height||e.naturalHeight||e.height||0},parsePreserveAspectRatioAttribute:function(){var t,e=S.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),i=this._element.width,n=this._element.height,r=1,o=1,a=0,s=0,l=0,c=0,u=this.width,h=this.height,f={width:u,height:h};return!e||"none"===e.alignX&&"none"===e.alignY?(r=u/i,o=h/n):("meet"===e.meetOrSlice&&(t=(u-i*(r=o=S.util.findScaleToFit(this._element,f)))/2,"Min"===e.alignX&&(a=-t),"Max"===e.alignX&&(a=t),t=(h-n*o)/2,"Min"===e.alignY&&(s=-t),"Max"===e.alignY&&(s=t)),"slice"===e.meetOrSlice&&(t=i-u/(r=o=S.util.findScaleToCover(this._element,f)),"Mid"===e.alignX&&(l=t/2),"Max"===e.alignX&&(l=t),t=n-h/o,"Mid"===e.alignY&&(c=t/2),"Max"===e.alignY&&(c=t),i=u/r,n=h/o)),{width:i,height:n,scaleX:r,scaleY:o,offsetLeft:a,offsetTop:s,cropX:l,cropY:c}}}),S.Image.CSS_CANVAS="canvas-img",S.Image.prototype.getSvgSrc=S.Image.prototype.getSrc,S.Image.fromObject=function(t,e){var i=S.util.object.clone(t);S.util.loadImage(i.src,(function(t,n){n?e&&e(null,!0):S.Image.prototype._initFilters.call(i,i.filters,(function(n){i.filters=n||[],S.Image.prototype._initFilters.call(i,[i.resizeFilter],(function(n){i.resizeFilter=n[0],S.util.enlivenObjects([i.clipPath],(function(n){i.clipPath=n[0];var r=new S.Image(t,i);e(r,!1)}))}))}))}),null,i.crossOrigin)},S.Image.fromURL=function(t,e,i){S.util.loadImage(t,(function(t,n){e&&e(new S.Image(t,i),n)}),null,i&&i.crossOrigin)},S.Image.ATTRIBUTE_NAMES=S.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),S.Image.fromElement=function(t,i,n){var r=S.parseAttributes(t,S.Image.ATTRIBUTE_NAMES);S.Image.fromURL(r["xlink:href"],i,e(n?S.util.object.clone(n):{},r))})}(e),S.util.object.extend(S.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.angle%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten()),this},fxStraighten:function(t){var e=function(){},i=(t=t||{}).onComplete||e,n=t.onChange||e,r=this;return S.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){r.rotate(t),n()},onComplete:function(){r.setCoords(),i()}}),this}}),S.util.object.extend(S.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.requestRenderAllBound}),this}}),function(){"use strict";function t(t,e){var i="precision "+e+" float;\nvoid main(){}",n=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(n,i),t.compileShader(n),!!t.getShaderParameter(n,t.COMPILE_STATUS)}function e(t){t&&t.tileSize&&(this.tileSize=t.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}S.isWebglSupported=function(e){if(S.isLikelyNode)return!1;e=e||S.WebglFilterBackend.prototype.tileSize;var i=document.createElement("canvas"),n=i.getContext("webgl")||i.getContext("experimental-webgl"),r=!1;if(n){S.maxTextureSize=n.getParameter(n.MAX_TEXTURE_SIZE),r=S.maxTextureSize>=e;for(var o=["highp","mediump","lowp"],a=0;a<3;a++)if(t(n,o[a])){S.webGlPrecision=o[a];break}}return this.isSupported=r,r},S.WebglFilterBackend=e,e.prototype={tileSize:2048,resources:{},setupGLContext:function(t,e){this.dispose(),this.createWebGLCanvas(t,e),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(t,e)},chooseFastestCopyGLTo2DMethod:function(t,e){var i,n=void 0!==window.performance;try{new ImageData(1,1),i=!0}catch(t){i=!1}var r="undefined"!=typeof ArrayBuffer,o="undefined"!=typeof Uint8ClampedArray;if(n&&i&&r&&o){var a=S.util.createCanvasElement(),s=new ArrayBuffer(t*e*4);if(S.forceGLPutImageData)return this.imageBuffer=s,void(this.copyGLTo2D=T);var l,c,u={imageBuffer:s,destinationWidth:t,destinationHeight:e,targetCanvas:a};a.width=t,a.height=e,l=window.performance.now(),k.call(u,this.gl,u),c=window.performance.now()-l,l=window.performance.now(),T.call(u,this.gl,u),c>window.performance.now()-l?(this.imageBuffer=s,this.copyGLTo2D=T):this.copyGLTo2D=k}},createWebGLCanvas:function(t,e){var i=S.util.createCanvasElement();i.width=t,i.height=e;var n={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},r=i.getContext("webgl",n);r||(r=i.getContext("experimental-webgl",n)),r&&(r.clearColor(0,0,0,0),this.canvas=i,this.gl=r)},applyFilters:function(t,e,i,n,r,o){var a,s=this.gl;o&&(a=this.getCachedTexture(o,e));var l={originalWidth:e.width||e.originalWidth,originalHeight:e.height||e.originalHeight,sourceWidth:i,sourceHeight:n,destinationWidth:i,destinationHeight:n,context:s,sourceTexture:this.createTexture(s,i,n,!a&&e),targetTexture:this.createTexture(s,i,n),originalTexture:a||this.createTexture(s,i,n,!a&&e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:r},c=s.createFramebuffer();return s.bindFramebuffer(s.FRAMEBUFFER,c),t.forEach((function(t){t&&t.applyTo(l)})),function(t){var e=t.targetCanvas,i=e.width,n=e.height,r=t.destinationWidth,o=t.destinationHeight;i===r&&n===o||(e.width=r,e.height=o)}(l),this.copyGLTo2D(s,l),s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(l.sourceTexture),s.deleteTexture(l.targetTexture),s.deleteFramebuffer(c),r.getContext("2d").setTransform(1,0,0,1,0,0),l},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(t,e,i,n){var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),n?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,t.RGBA,t.UNSIGNED_BYTE,null),r},getCachedTexture:function(t,e){if(this.textureCache[t])return this.textureCache[t];var i=this.createTexture(this.gl,e.width,e.height,e);return this.textureCache[t]=i,i},evictCachesForKey:function(t){this.textureCache[t]&&(this.gl.deleteTexture(this.textureCache[t]),delete this.textureCache[t])},copyGLTo2D:k,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var t=this.gl,e={renderer:"",vendor:""};if(!t)return e;var i=t.getExtension("WEBGL_debug_renderer_info");if(i){var n=t.getParameter(i.UNMASKED_RENDERER_WEBGL),r=t.getParameter(i.UNMASKED_VENDOR_WEBGL);n&&(e.renderer=n.toLowerCase()),r&&(e.vendor=r.toLowerCase())}return this.gpuInfo=e,e}}}(),function(){"use strict";var t=function(){};function e(){}S.Canvas2dFilterBackend=e,e.prototype={evictCachesForKey:t,dispose:t,clearWebGLCaches:t,resources:{},applyFilters:function(t,e,i,n,r){var o=r.getContext("2d");o.drawImage(e,0,0,i,n);var a={sourceWidth:i,sourceHeight:n,imageData:o.getImageData(0,0,i,n),originalEl:e,originalImageData:o.getImageData(0,0,i,n),canvasEl:r,ctx:o,filterBackend:this};return t.forEach((function(t){t.applyTo(a)})),a.imageData.width===i&&a.imageData.height===n||(r.width=a.imageData.width,r.height=a.imageData.height),o.putImageData(a.imageData,0,0),a}}}(),S.Image=S.Image||{},S.Image.filters=S.Image.filters||{},S.Image.filters.BaseFilter=S.util.createClass({type:"BaseFilter",vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvoid main() {\nvTexCoord = aPosition;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D uTexture;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\n}",initialize:function(t){t&&this.setOptions(t)},setOptions:function(t){for(var e in t)this[e]=t[e]},createProgram:function(t,e,i){e=e||this.fragmentSource,i=i||this.vertexSource,"highp"!==S.webGlPrecision&&(e=e.replace(/precision highp float/g,"precision "+S.webGlPrecision+" float"));var n=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(n,i),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+t.getShaderInfoLog(n));var r=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+t.getShaderInfoLog(r));var o=t.createProgram();if(t.attachShader(o,n),t.attachShader(o,r),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+t.getProgramInfoLog(o));var a=this.getAttributeLocations(t,o),s=this.getUniformLocations(t,o)||{};return s.uStepW=t.getUniformLocation(o,"uStepW"),s.uStepH=t.getUniformLocation(o,"uStepH"),{program:o,attributeLocations:a,uniformLocations:s}},getAttributeLocations:function(t,e){return{aPosition:t.getAttribLocation(e,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(t,e,i){var n=e.aPosition,r=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,r),t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW)},_setupFrameBuffer:function(t){var e,i,n=t.context;t.passes>1?(e=t.destinationWidth,i=t.destinationHeight,t.sourceWidth===e&&t.sourceHeight===i||(n.deleteTexture(t.targetTexture),t.targetTexture=t.filterBackend.createTexture(n,e,i)),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t.targetTexture,0)):(n.bindFramebuffer(n.FRAMEBUFFER,null),n.finish())},_swapTextures:function(t){t.passes--,t.pass++;var e=t.targetTexture;t.targetTexture=t.sourceTexture,t.sourceTexture=e},isNeutralState:function(){var t=this.mainParameter,e=S.Image.filters[this.type].prototype;if(t){if(Array.isArray(e[t])){for(var i=e[t].length;i--;)if(this[t][i]!==e[t][i])return!1;return!0}return e[t]===this[t]}return!1},applyTo:function(t){t.webgl?(this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},retrieveShader:function(t){return t.programCache.hasOwnProperty(this.type)||(t.programCache[this.type]=this.createProgram(t.context)),t.programCache[this.type]},applyToWebGL:function(t){var e=t.context,i=this.retrieveShader(t);0===t.pass&&t.originalTexture?e.bindTexture(e.TEXTURE_2D,t.originalTexture):e.bindTexture(e.TEXTURE_2D,t.sourceTexture),e.useProgram(i.program),this.sendAttributeData(e,i.attributeLocations,t.aPosition),e.uniform1f(i.uniformLocations.uStepW,1/t.sourceWidth),e.uniform1f(i.uniformLocations.uStepH,1/t.sourceHeight),this.sendUniformData(e,i.uniformLocations),e.viewport(0,0,t.destinationWidth,t.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(t,e,i){t.activeTexture(i),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE0)},unbindAdditionalTexture:function(t,e){t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(t){this[this.mainParameter]=t},sendUniformData:function(){},createHelpLayer:function(t){if(!t.helpLayer){var e=document.createElement("canvas");e.width=t.sourceWidth,e.height=t.sourceHeight,t.helpLayer=e}},toObject:function(){var t={type:this.type},e=this.mainParameter;return e&&(t[e]=this[e]),t},toJSON:function(){return this.toObject()}}),S.Image.filters.BaseFilter.fromObject=function(t,e){var i=new S.Image.filters[t.type](t);return e&&e(i),i},function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.ColorMatrix=n(i.BaseFilter,{type:"ColorMatrix",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform mat4 uColorMatrix;\nuniform vec4 uConstants;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor *= uColorMatrix;\ncolor += uConstants;\ngl_FragColor = color;\n}",matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(t){this.callSuper("initialize",t),this.matrix=this.matrix.slice(0)},applyTo2d:function(t){var e,i,n,r,o,a=t.imageData.data,s=a.length,l=this.matrix,c=this.colorsOnly;for(o=0;o<s;o+=4)e=a[o],i=a[o+1],n=a[o+2],c?(a[o]=e*l[0]+i*l[1]+n*l[2]+255*l[4],a[o+1]=e*l[5]+i*l[6]+n*l[7]+255*l[9],a[o+2]=e*l[10]+i*l[11]+n*l[12]+255*l[14]):(r=a[o+3],a[o]=e*l[0]+i*l[1]+n*l[2]+r*l[3]+255*l[4],a[o+1]=e*l[5]+i*l[6]+n*l[7]+r*l[8]+255*l[9],a[o+2]=e*l[10]+i*l[11]+n*l[12]+r*l[13]+255*l[14],a[o+3]=e*l[15]+i*l[16]+n*l[17]+r*l[18]+255*l[19])},getUniformLocations:function(t,e){return{uColorMatrix:t.getUniformLocation(e,"uColorMatrix"),uConstants:t.getUniformLocation(e,"uConstants")}},sendUniformData:function(t,e){var i=this.matrix,n=[i[0],i[1],i[2],i[3],i[5],i[6],i[7],i[8],i[10],i[11],i[12],i[13],i[15],i[16],i[17],i[18]],r=[i[4],i[9],i[14],i[19]];t.uniformMatrix4fv(e.uColorMatrix,!1,n),t.uniform4fv(e.uConstants,r)}}),e.Image.filters.ColorMatrix.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Brightness=n(i.BaseFilter,{type:"Brightness",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBrightness;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += uBrightness;\ngl_FragColor = color;\n}",brightness:0,mainParameter:"brightness",applyTo2d:function(t){if(0!==this.brightness){var e,i=t.imageData.data,n=i.length,r=Math.round(255*this.brightness);for(e=0;e<n;e+=4)i[e]=i[e]+r,i[e+1]=i[e+1]+r,i[e+2]=i[e+2]+r}},getUniformLocations:function(t,e){return{uBrightness:t.getUniformLocation(e,"uBrightness")}},sendUniformData:function(t,e){t.uniform1f(e.uBrightness,this.brightness)}}),e.Image.filters.Brightness.fromObject=e.Image.filters.BaseFilter.fromObject}(e),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",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_3_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_5_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_5_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_7_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_7_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_9_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_9_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}"},retrieveShader:function(t){var e=Math.sqrt(this.matrix.length),i=this.type+"_"+e+"_"+(this.opaque?1:0),n=this.fragmentSource[i];return t.programCache.hasOwnProperty(i)||(t.programCache[i]=this.createProgram(t.context,n)),t.programCache[i]},applyTo2d:function(t){var e,i,n,r,o,a,s,l,c,u,h,f,g,d=t.imageData,v=d.data,p=this.matrix,m=Math.round(Math.sqrt(p.length)),y=Math.floor(m/2),b=d.width,x=d.height,C=t.ctx.createImageData(b,x),I=C.data,_=this.opaque?1:0;for(h=0;h<x;h++)for(u=0;u<b;u++){for(o=4*(h*b+u),e=0,i=0,n=0,r=0,g=0;g<m;g++)for(f=0;f<m;f++)a=u+f-y,(s=h+g-y)<0||s>=x||a<0||a>=b||(l=4*(s*b+a),c=p[g*m+f],e+=v[l]*c,i+=v[l+1]*c,n+=v[l+2]*c,_||(r+=v[l+3]*c));I[o]=e,I[o+1]=i,I[o+2]=n,I[o+3]=_?v[o+3]:r}t.imageData=C},getUniformLocations:function(t,e){return{uMatrix:t.getUniformLocation(e,"uMatrix"),uOpaque:t.getUniformLocation(e,"uOpaque"),uHalfSize:t.getUniformLocation(e,"uHalfSize"),uSize:t.getUniformLocation(e,"uSize")}},sendUniformData:function(t,e){t.uniform1fv(e.uMatrix,this.matrix)},toObject:function(){return i(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),e.Image.filters.Convolute.fromObject=e.Image.filters.BaseFilter.fromObject}(e),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",fragmentSource:{average:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat average = (color.r + color.b + color.g) / 3.0;\ngl_FragColor = vec4(average, average, average, color.a);\n}",lightness:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\ngl_FragColor = vec4(average, average, average, col.a);\n}",luminosity:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\ngl_FragColor = vec4(average, average, average, col.a);\n}"},mode:"average",mainParameter:"mode",applyTo2d:function(t){var e,i,n=t.imageData.data,r=n.length,o=this.mode;for(e=0;e<r;e+=4)"average"===o?i=(n[e]+n[e+1]+n[e+2])/3:"lightness"===o?i=(Math.min(n[e],n[e+1],n[e+2])+Math.max(n[e],n[e+1],n[e+2]))/2:"luminosity"===o&&(i=.21*n[e]+.72*n[e+1]+.07*n[e+2]),n[e]=i,n[e+1]=i,n[e+2]=i},retrieveShader:function(t){var e=this.type+"_"+this.mode;if(!t.programCache.hasOwnProperty(e)){var i=this.fragmentSource[this.mode];t.programCache[e]=this.createProgram(t.context,i)}return t.programCache[e]},getUniformLocations:function(t,e){return{uMode:t.getUniformLocation(e,"uMode")}},sendUniformData:function(t,e){t.uniform1i(e.uMode,1)},isNeutralState:function(){return!1}}),e.Image.filters.Grayscale.fromObject=e.Image.filters.BaseFilter.fromObject}(e),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",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uInvert;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nif (uInvert == 1) {\ngl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);\n} else {\ngl_FragColor = color;\n}\n}",invert:!0,mainParameter:"invert",applyTo2d:function(t){var e,i=t.imageData.data,n=i.length;for(e=0;e<n;e+=4)i[e]=255-i[e],i[e+1]=255-i[e+1],i[e+2]=255-i[e+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(t,e){return{uInvert:t.getUniformLocation(e,"uInvert")}},sendUniformData:function(t,e){t.uniform1i(e.uInvert,this.invert)}}),e.Image.filters.Invert.fromObject=e.Image.filters.BaseFilter.fromObject}(e),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",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uStepH;\nuniform float uNoise;\nuniform float uSeed;\nvarying vec2 vTexCoord;\nfloat rand(vec2 co, float seed, float vScale) {\nreturn fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\n}\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\ngl_FragColor = color;\n}",mainParameter:"noise",noise:0,applyTo2d:function(t){if(0!==this.noise){var e,i,n=t.imageData.data,r=n.length,o=this.noise;for(e=0,r=n.length;e<r;e+=4)i=(.5-Math.random())*o,n[e]+=i,n[e+1]+=i,n[e+2]+=i}},getUniformLocations:function(t,e){return{uNoise:t.getUniformLocation(e,"uNoise"),uSeed:t.getUniformLocation(e,"uSeed")}},sendUniformData:function(t,e){t.uniform1f(e.uNoise,this.noise/255),t.uniform1f(e.uSeed,Math.random())},toObject:function(){return i(this.callSuper("toObject"),{noise:this.noise})}}),e.Image.filters.Noise.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Pixelate=n(i.BaseFilter,{type:"Pixelate",blocksize:4,mainParameter:"blocksize",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBlocksize;\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nfloat blockW = uBlocksize * uStepW;\nfloat blockH = uBlocksize * uStepW;\nint posX = int(vTexCoord.x / blockW);\nint posY = int(vTexCoord.y / blockH);\nfloat fposX = float(posX);\nfloat fposY = float(posY);\nvec2 squareCoords = vec2(fposX * blockW, fposY * blockH);\nvec4 color = texture2D(uTexture, squareCoords);\ngl_FragColor = color;\n}",applyTo2d:function(t){var e,i,n,r,o,a,s,l,c,u,h,f=t.imageData,g=f.data,d=f.height,v=f.width;for(i=0;i<d;i+=this.blocksize)for(n=0;n<v;n+=this.blocksize)for(r=g[e=4*i*v+4*n],o=g[e+1],a=g[e+2],s=g[e+3],u=Math.min(i+this.blocksize,d),h=Math.min(n+this.blocksize,v),l=i;l<u;l++)for(c=n;c<h;c++)g[e=4*l*v+4*c]=r,g[e+1]=o,g[e+2]=a,g[e+3]=s},isNeutralState:function(){return 1===this.blocksize},getUniformLocations:function(t,e){return{uBlocksize:t.getUniformLocation(e,"uBlocksize"),uStepW:t.getUniformLocation(e,"uStepW"),uStepH:t.getUniformLocation(e,"uStepH")}},sendUniformData:function(t,e){t.uniform1f(e.uBlocksize,this.blocksize)}}),e.Image.filters.Pixelate.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.Image.filters,r=e.util.createClass;n.RemoveColor=r(n.BaseFilter,{type:"RemoveColor",color:"#FFFFFF",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\nif(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\ngl_FragColor.a = 0.0;\n}\n}",distance:.02,useAlpha:!1,applyTo2d:function(t){var i,n,r,o,a=t.imageData.data,s=255*this.distance,l=new e.Color(this.color).getSource(),c=[l[0]-s,l[1]-s,l[2]-s],u=[l[0]+s,l[1]+s,l[2]+s];for(i=0;i<a.length;i+=4)n=a[i],r=a[i+1],o=a[i+2],n>c[0]&&r>c[1]&&o>c[2]&&n<u[0]&&r<u[1]&&o<u[2]&&(a[i+3]=0)},getUniformLocations:function(t,e){return{uLow:t.getUniformLocation(e,"uLow"),uHigh:t.getUniformLocation(e,"uHigh")}},sendUniformData:function(t,i){var n=new e.Color(this.color).getSource(),r=parseFloat(this.distance),o=[0+n[0]/255-r,0+n[1]/255-r,0+n[2]/255-r,1],a=[n[0]/255+r,n[1]/255+r,n[2]/255+r,1];t.uniform4fv(i.uLow,o),t.uniform4fv(i.uHigh,a)},toObject:function(){return i(this.callSuper("toObject"),{color:this.color,distance:this.distance})}}),e.Image.filters.RemoveColor.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass,r={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(var o in r)i[o]=n(i.ColorMatrix,{type:o,matrix:r[o],mainParameter:!1,colorsOnly:!0}),e.Image.filters[o].fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric,i=e.Image.filters,n=e.util.createClass;i.BlendColor=n(i.BaseFilter,{type:"BlendColor",color:"#F95C63",mode:"multiply",alpha:1,fragmentSource:{multiply:"gl_FragColor.rgb *= uColor.rgb;\n",screen:"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n",add:"gl_FragColor.rgb += uColor.rgb;\n",diff:"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n",subtract:"gl_FragColor.rgb -= uColor.rgb;\n",lighten:"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n",darken:"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n",exclusion:"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n",overlay:"if (uColor.r < 0.5) {\ngl_FragColor.r *= 2.0 * uColor.r;\n} else {\ngl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n}\nif (uColor.g < 0.5) {\ngl_FragColor.g *= 2.0 * uColor.g;\n} else {\ngl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n}\nif (uColor.b < 0.5) {\ngl_FragColor.b *= 2.0 * uColor.b;\n} else {\ngl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n}\n",tint:"gl_FragColor.rgb *= (1.0 - uColor.a);\ngl_FragColor.rgb += uColor.rgb;\n"},buildSource:function(t){return"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ngl_FragColor = color;\nif (color.a > 0.0) {\n"+this.fragmentSource[t]+"}\n}"},retrieveShader:function(t){var e,i=this.type+"_"+this.mode;return t.programCache.hasOwnProperty(i)||(e=this.buildSource(this.mode),t.programCache[i]=this.createProgram(t.context,e)),t.programCache[i]},applyTo2d:function(t){var i,n,r,o,a,s,l,c=t.imageData.data,u=c.length,h=1-this.alpha;i=(l=new e.Color(this.color).getSource())[0]*this.alpha,n=l[1]*this.alpha,r=l[2]*this.alpha;for(var f=0;f<u;f+=4)switch(o=c[f],a=c[f+1],s=c[f+2],this.mode){case"multiply":c[f]=o*i/255,c[f+1]=a*n/255,c[f+2]=s*r/255;break;case"screen":c[f]=255-(255-o)*(255-i)/255,c[f+1]=255-(255-a)*(255-n)/255,c[f+2]=255-(255-s)*(255-r)/255;break;case"add":c[f]=o+i,c[f+1]=a+n,c[f+2]=s+r;break;case"diff":case"difference":c[f]=Math.abs(o-i),c[f+1]=Math.abs(a-n),c[f+2]=Math.abs(s-r);break;case"subtract":c[f]=o-i,c[f+1]=a-n,c[f+2]=s-r;break;case"darken":c[f]=Math.min(o,i),c[f+1]=Math.min(a,n),c[f+2]=Math.min(s,r);break;case"lighten":c[f]=Math.max(o,i),c[f+1]=Math.max(a,n),c[f+2]=Math.max(s,r);break;case"overlay":c[f]=i<128?2*o*i/255:255-2*(255-o)*(255-i)/255,c[f+1]=n<128?2*a*n/255:255-2*(255-a)*(255-n)/255,c[f+2]=r<128?2*s*r/255:255-2*(255-s)*(255-r)/255;break;case"exclusion":c[f]=i+o-2*i*o/255,c[f+1]=n+a-2*n*a/255,c[f+2]=r+s-2*r*s/255;break;case"tint":c[f]=i+o*h,c[f+1]=n+a*h,c[f+2]=r+s*h}},getUniformLocations:function(t,e){return{uColor:t.getUniformLocation(e,"uColor")}},sendUniformData:function(t,i){var n=new e.Color(this.color).getSource();n[0]=this.alpha*n[0]/255,n[1]=this.alpha*n[1]/255,n[2]=this.alpha*n[2]/255,n[3]=this.alpha,t.uniform4fv(i.uColor,n)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),e.Image.filters.BlendColor.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric,i=e.Image.filters,n=e.util.createClass;i.BlendImage=n(i.BaseFilter,{type:"BlendImage",image:null,mode:"multiply",alpha:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:{multiply:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.rgba *= color2.rgba;\ngl_FragColor = color;\n}",mask:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.a = color2.a;\ngl_FragColor = color;\n}"},retrieveShader:function(t){var e=this.type+"_"+this.mode,i=this.fragmentSource[this.mode];return t.programCache.hasOwnProperty(e)||(t.programCache[e]=this.createProgram(t.context,i)),t.programCache[e]},applyToWebGL:function(t){var e=t.context,i=this.createTexture(t.filterBackend,this.image);this.bindAdditionalTexture(e,i,e.TEXTURE1),this.callSuper("applyToWebGL",t),this.unbindAdditionalTexture(e,e.TEXTURE1)},createTexture:function(t,e){return t.getCachedTexture(e.cacheKey,e._element)},calculateMatrix:function(){var t=this.image,e=t._element.width,i=t._element.height;return[1/t.scaleX,0,0,0,1/t.scaleY,0,-t.left/e,-t.top/i,1]},applyTo2d:function(t){var i,n,r,o,a,s,l,c,u,h,f,g=t.imageData,d=t.filterBackend.resources,v=g.data,p=v.length,m=g.width,y=g.height,b=this.image;d.blendImage||(d.blendImage=e.util.createCanvasElement()),h=(u=d.blendImage).getContext("2d"),u.width!==m||u.height!==y?(u.width=m,u.height=y):h.clearRect(0,0,m,y),h.setTransform(b.scaleX,0,0,b.scaleY,b.left,b.top),h.drawImage(b._element,0,0,m,y),f=h.getImageData(0,0,m,y).data;for(var x=0;x<p;x+=4)switch(a=v[x],s=v[x+1],l=v[x+2],c=v[x+3],i=f[x],n=f[x+1],r=f[x+2],o=f[x+3],this.mode){case"multiply":v[x]=a*i/255,v[x+1]=s*n/255,v[x+2]=l*r/255,v[x+3]=c*o/255;break;case"mask":v[x+3]=o;break}},getUniformLocations:function(t,e){return{uTransformMatrix:t.getUniformLocation(e,"uTransformMatrix"),uImage:t.getUniformLocation(e,"uImage")}},sendUniformData:function(t,e){var i=this.calculateMatrix();t.uniform1i(e.uImage,1),t.uniformMatrix3fv(e.uTransformMatrix,!1,i)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),e.Image.filters.BlendImage.fromObject=function(t,i){e.Image.fromObject(t.image,(function(n){var r=e.util.object.clone(t);r.image=n,i(new e.Image.filters.BlendImage(r))}))}}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=Math.pow,n=Math.floor,r=Math.sqrt,o=Math.abs,a=Math.round,s=Math.sin,l=Math.ceil,c=e.Image.filters,u=e.util.createClass;c.Resize=u(c.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(t,e){return{uDelta:t.getUniformLocation(e,"uDelta"),uTaps:t.getUniformLocation(e,"uTaps")}},sendUniformData:function(t,e){t.uniform2fv(e.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),t.uniform1fv(e.uTaps,this.taps)},retrieveShader:function(t){var e=this.getFilterWindow(),i=this.type+"_"+e;if(!t.programCache.hasOwnProperty(i)){var n=this.generateShader(e);t.programCache[i]=this.createProgram(t.context,n)}return t.programCache[i]},getFilterWindow:function(){var t=this.tempScale;return Math.ceil(this.lanczosLobes/t)},getTaps:function(){for(var t=this.lanczosCreate(this.lanczosLobes),e=this.tempScale,i=this.getFilterWindow(),n=new Array(i),r=1;r<=i;r++)n[r-1]=t(r*e);return n},generateShader:function(t){for(var e=new Array(t),i=this.fragmentSourceTOP,n=1;n<=t;n++)e[n-1]=n+".0 * uDelta";return i+="uniform float uTaps["+t+"];\n",i+="void main() {\n",i+=" vec4 color = texture2D(uTexture, vTexCoord);\n",i+=" float sum = 1.0;\n",e.forEach((function(t,e){i+=" color += texture2D(uTexture, vTexCoord + "+t+") * uTaps["+e+"];\n",i+=" color += texture2D(uTexture, vTexCoord - "+t+") * uTaps["+e+"];\n",i+=" sum += 2.0 * uTaps["+e+"];\n"})),i+=" gl_FragColor = color / sum;\n",i+="}"},fragmentSourceTOP:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\n",applyTo:function(t){t.webgl?(t.passes++,this.width=t.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=t.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),t.destinationWidth=this.dW,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceWidth=t.destinationWidth,this.height=t.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),t.destinationHeight=this.dH,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceHeight=t.destinationHeight):this.applyTo2d(t)},isNeutralState:function(){return 1===this.scaleX&&1===this.scaleY},lanczosCreate:function(t){return function(e){if(e>=t||e<=-t)return 0;if(e<1.1920929e-7&&e>-1.1920929e-7)return 1;var i=(e*=Math.PI)/t;return s(e)/e*s(i)/i}},applyTo2d:function(t){var e=t.imageData,i=this.scaleX,n=this.scaleY;this.rcpScaleX=1/i,this.rcpScaleY=1/n;var r,o=e.width,s=e.height,l=a(o*i),c=a(s*n);"sliceHack"===this.resizeType?r=this.sliceByTwo(t,o,s,l,c):"hermite"===this.resizeType?r=this.hermiteFastResize(t,o,s,l,c):"bilinear"===this.resizeType?r=this.bilinearFiltering(t,o,s,l,c):"lanczos"===this.resizeType&&(r=this.lanczosResize(t,o,s,l,c)),t.imageData=r},sliceByTwo:function(t,i,r,o,a){var s,l,c=t.imageData,u=.5,h=!1,f=!1,g=i*u,d=r*u,v=e.filterBackend.resources,p=0,m=0,y=i,b=0;for(v.sliceByTwo||(v.sliceByTwo=document.createElement("canvas")),((s=v.sliceByTwo).width<1.5*i||s.height<r)&&(s.width=1.5*i,s.height=r),(l=s.getContext("2d")).clearRect(0,0,1.5*i,r),l.putImageData(c,0,0),o=n(o),a=n(a);!h||!f;)i=g,r=d,o<n(g*u)?g=n(g*u):(g=o,h=!0),a<n(d*u)?d=n(d*u):(d=a,f=!0),l.drawImage(s,p,m,i,r,y,b,g,d),p=y,m=b,b+=d;return l.getImageData(p,m,o,a)},lanczosResize:function(t,e,a,s,c){var u=t.imageData.data,h=t.ctx.createImageData(s,c),f=h.data,g=this.lanczosCreate(this.lanczosLobes),d=this.rcpScaleX,v=this.rcpScaleY,p=2/this.rcpScaleX,m=2/this.rcpScaleY,y=l(d*this.lanczosLobes/2),b=l(v*this.lanczosLobes/2),x={},C={},I={};return function t(l){var _,M,S,w,k,T,D,A,j,O,E;for(C.x=(l+.5)*d,I.x=n(C.x),_=0;_<c;_++){for(C.y=(_+.5)*v,I.y=n(C.y),k=0,T=0,D=0,A=0,j=0,M=I.x-y;M<=I.x+y;M++)if(!(M<0||M>=e)){O=n(1e3*o(M-C.x)),x[O]||(x[O]={});for(var L=I.y-b;L<=I.y+b;L++)L<0||L>=a||(E=n(1e3*o(L-C.y)),x[O][E]||(x[O][E]=g(r(i(O*p,2)+i(E*m,2))/1e3)),(S=x[O][E])>0&&(k+=S,T+=S*u[w=4*(L*e+M)],D+=S*u[w+1],A+=S*u[w+2],j+=S*u[w+3]))}f[w=4*(_*s+l)]=T/k,f[w+1]=D/k,f[w+2]=A/k,f[w+3]=j/k}return++l<s?t(l):h}(0)},bilinearFiltering:function(t,e,i,r,o){var a,s,l,c,u,h,f,g,d,v=0,p=this.rcpScaleX,m=this.rcpScaleY,y=4*(e-1),b=t.imageData.data,x=t.ctx.createImageData(r,o),C=x.data;for(l=0;l<o;l++)for(c=0;c<r;c++)for(u=p*c-(a=n(p*c)),h=m*l-(s=n(m*l)),d=4*(s*e+a),f=0;f<4;f++)g=b[d+f]*(1-u)*(1-h)+b[d+4+f]*u*(1-h)+b[d+y+f]*h*(1-u)+b[d+y+4+f]*u*h,C[v++]=g;return x},hermiteFastResize:function(t,e,i,a,s){for(var c=this.rcpScaleX,u=this.rcpScaleY,h=l(c/2),f=l(u/2),g=t.imageData.data,d=t.ctx.createImageData(a,s),v=d.data,p=0;p<s;p++)for(var m=0;m<a;m++){for(var y=4*(m+p*a),b=0,x=0,C=0,I=0,_=0,M=0,S=0,w=(p+.5)*u,k=n(p*u);k<(p+1)*u;k++)for(var T=o(w-(k+.5))/f,D=(m+.5)*c,A=T*T,j=n(m*c);j<(m+1)*c;j++){var O=o(D-(j+.5))/h,E=r(A+O*O);E>1&&E<-1||(b=2*E*E*E-3*E*E+1)>0&&(S+=b*g[(O=4*(j+k*e))+3],C+=b,g[O+3]<255&&(b=b*g[O+3]/250),I+=b*g[O],_+=b*g[O+1],M+=b*g[O+2],x+=b)}v[y]=I/x,v[y+1]=_/x,v[y+2]=M/x,v[y+3]=S/C}return d},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),e.Image.filters.Resize.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Contrast=n(i.BaseFilter,{type:"Contrast",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uContrast;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\ngl_FragColor = color;\n}",contrast:0,mainParameter:"contrast",applyTo2d:function(t){if(0!==this.contrast){var e,i=t.imageData.data,n=i.length,r=Math.floor(255*this.contrast),o=259*(r+255)/(255*(259-r));for(e=0;e<n;e+=4)i[e]=o*(i[e]-128)+128,i[e+1]=o*(i[e+1]-128)+128,i[e+2]=o*(i[e+2]-128)+128}},getUniformLocations:function(t,e){return{uContrast:t.getUniformLocation(e,"uContrast")}},sendUniformData:function(t,e){t.uniform1f(e.uContrast,this.contrast)}}),e.Image.filters.Contrast.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Saturation=n(i.BaseFilter,{type:"Saturation",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uSaturation;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat rgMax = max(color.r, color.g);\nfloat rgbMax = max(rgMax, color.b);\ncolor.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\ncolor.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\ncolor.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\ngl_FragColor = color;\n}",saturation:0,mainParameter:"saturation",applyTo2d:function(t){if(0!==this.saturation){var e,i,n=t.imageData.data,r=n.length,o=-this.saturation;for(e=0;e<r;e+=4)i=Math.max(n[e],n[e+1],n[e+2]),n[e]+=i!==n[e]?(i-n[e])*o:0,n[e+1]+=i!==n[e+1]?(i-n[e+1])*o:0,n[e+2]+=i!==n[e+2]?(i-n[e+2])*o:0}},getUniformLocations:function(t,e){return{uSaturation:t.getUniformLocation(e,"uSaturation")}},sendUniformData:function(t,e){t.uniform1f(e.uSaturation,-this.saturation)}}),e.Image.filters.Saturation.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Vibrance=n(i.BaseFilter,{type:"Vibrance",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uVibrance;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat max = max(color.r, max(color.g, color.b));\nfloat avg = (color.r + color.g + color.b) / 3.0;\nfloat amt = (abs(max - avg) * 2.0) * uVibrance;\ncolor.r += max != color.r ? (max - color.r) * amt : 0.00;\ncolor.g += max != color.g ? (max - color.g) * amt : 0.00;\ncolor.b += max != color.b ? (max - color.b) * amt : 0.00;\ngl_FragColor = color;\n}",vibrance:0,mainParameter:"vibrance",applyTo2d:function(t){if(0!==this.vibrance){var e,i,n,r,o=t.imageData.data,a=o.length,s=-this.vibrance;for(e=0;e<a;e+=4)i=Math.max(o[e],o[e+1],o[e+2]),n=(o[e]+o[e+1]+o[e+2])/3,r=2*Math.abs(i-n)/255*s,o[e]+=i!==o[e]?(i-o[e])*r:0,o[e+1]+=i!==o[e+1]?(i-o[e+1])*r:0,o[e+2]+=i!==o[e+2]?(i-o[e+2])*r:0}},getUniformLocations:function(t,e){return{uVibrance:t.getUniformLocation(e,"uVibrance")}},sendUniformData:function(t,e){t.uniform1f(e.uVibrance,-this.vibrance)}}),e.Image.filters.Vibrance.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Blur=n(i.BaseFilter,{type:"Blur",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(v3offset);\nfor (float t = -nSamples; t <= nSamples; t++) {\nfloat percent = (t + offset - 0.5) / nSamples;\nfloat weight = 1.0 - abs(percent);\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\ntotal += weight;\n}\ngl_FragColor = color / total;\n}",blur:0,mainParameter:"blur",applyTo:function(t){t.webgl?(this.aspectRatio=t.sourceWidth/t.sourceHeight,t.passes++,this._setupFrameBuffer(t),this.horizontal=!0,this.applyToWebGL(t),this._swapTextures(t),this._setupFrameBuffer(t),this.horizontal=!1,this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},applyTo2d:function(t){t.imageData=this.simpleBlur(t)},simpleBlur:function(t){var i,n,r=t.filterBackend.resources,o=t.imageData.width,a=t.imageData.height;r.blurLayer1||(r.blurLayer1=e.util.createCanvasElement(),r.blurLayer2=e.util.createCanvasElement()),i=r.blurLayer1,n=r.blurLayer2,i.width===o&&i.height===a||(n.width=i.width=o,n.height=i.height=a);var s,l,c,u,h=i.getContext("2d"),f=n.getContext("2d"),g=15,d=.06*this.blur*.5;for(h.putImageData(t.imageData,0,0),f.clearRect(0,0,o,a),u=-15;u<=g;u++)c=d*(l=u/g)*o+(s=(Math.random()-.5)/4),f.globalAlpha=1-Math.abs(l),f.drawImage(i,c,s),h.drawImage(n,0,0),f.globalAlpha=1,f.clearRect(0,0,n.width,n.height);for(u=-15;u<=g;u++)c=d*(l=u/g)*a+(s=(Math.random()-.5)/4),f.globalAlpha=1-Math.abs(l),f.drawImage(i,s,c),h.drawImage(n,0,0),f.globalAlpha=1,f.clearRect(0,0,n.width,n.height);t.ctx.drawImage(i,0,0);var v=t.ctx.getImageData(0,0,i.width,i.height);return h.globalAlpha=1,h.clearRect(0,0,i.width,i.height),v},getUniformLocations:function(t,e){return{delta:t.getUniformLocation(e,"uDelta")}},sendUniformData:function(t,e){var i=this.chooseRightDelta();t.uniform2fv(e.delta,i)},chooseRightDelta:function(){var t,e=1,i=[0,0];return this.horizontal?this.aspectRatio>1&&(e=1/this.aspectRatio):this.aspectRatio<1&&(e=this.aspectRatio),t=e*this.blur*.12,this.horizontal?i[0]=t:i[1]=t,i}}),i.Blur.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Gamma=n(i.BaseFilter,{type:"Gamma",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec3 uGamma;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec3 correction = (1.0 / uGamma);\ncolor.r = pow(color.r, correction.r);\ncolor.g = pow(color.g, correction.g);\ncolor.b = pow(color.b, correction.b);\ngl_FragColor = color;\ngl_FragColor.rgb *= color.a;\n}",gamma:[1,1,1],mainParameter:"gamma",initialize:function(t){this.gamma=[1,1,1],i.BaseFilter.prototype.initialize.call(this,t)},applyTo2d:function(t){var e,i=t.imageData.data,n=this.gamma,r=i.length,o=1/n[0],a=1/n[1],s=1/n[2];for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),e=0,r=256;e<r;e++)this.rVals[e]=255*Math.pow(e/255,o),this.gVals[e]=255*Math.pow(e/255,a),this.bVals[e]=255*Math.pow(e/255,s);for(e=0,r=i.length;e<r;e+=4)i[e]=this.rVals[i[e]],i[e+1]=this.gVals[i[e+1]],i[e+2]=this.bVals[i[e+2]]},getUniformLocations:function(t,e){return{uGamma:t.getUniformLocation(e,"uGamma")}},sendUniformData:function(t,e){t.uniform3fv(e.uGamma,this.gamma)}}),e.Image.filters.Gamma.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.Composed=n(i.BaseFilter,{type:"Composed",subFilters:[],initialize:function(t){this.callSuper("initialize",t),this.subFilters=this.subFilters.slice(0)},applyTo:function(t){t.passes+=this.subFilters.length-1,this.subFilters.forEach((function(e){e.applyTo(t)}))},toObject:function(){return e.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map((function(t){return t.toObject()}))})},isNeutralState:function(){return!this.subFilters.some((function(t){return!t.isNeutralState()}))}}),e.Image.filters.Composed.fromObject=function(t,i){var n=(t.subFilters||[]).map((function(t){return new e.Image.filters[t.type](t)})),r=new e.Image.filters.Composed({subFilters:n});return i&&i(r),r}}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.Image.filters,n=e.util.createClass;i.HueRotation=n(i.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var t=this.rotation*Math.PI,i=e.util.cos(t),n=e.util.sin(t),r=1/3,o=Math.sqrt(r)*n,a=1-i;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=i+a/3,this.matrix[1]=r*a-o,this.matrix[2]=r*a+o,this.matrix[5]=r*a+o,this.matrix[6]=i+r*a,this.matrix[7]=r*a-o,this.matrix[10]=r*a-o,this.matrix[11]=r*a+o,this.matrix[12]=i+r*a},isNeutralState:function(t){return this.calculateMatrix(),i.BaseFilter.prototype.isNeutralState.call(this,t)},applyTo:function(t){this.calculateMatrix(),i.BaseFilter.prototype.applyTo.call(this,t)}}),e.Image.filters.HueRotation.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.clone;if(e.Text)e.warn("fabric.Text is already defined");else{var n="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide".split(" ");e.Text=e.util.createClass(e.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide"],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:"left",fontStyle:"normal",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:"",stateProperties:e.Object.prototype.stateProperties.concat(n),cacheProperties:e.Object.prototype.cacheProperties.concat(n),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:"left",_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:"ltr",_styleProperties:["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor"],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(t,e){this.styles=e&&e.styles||{},this.text=t,this.__skipDimension=!0,this.callSuper("initialize",e),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:"_dimensionAffectingProps"})},setPathInfo:function(){var t=this.path;t&&(t.segmentsInfo=e.util.getPathSegmentsInfo(t.path))},getMeasuringContext:function(){return e._measuringContext||(e._measuringContext=this.canvas&&this.canvas.contextCache||e.util.createCanvasElement().getContext("2d")),e._measuringContext},_splitText:function(){var t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.saveState({propertySet:"_dimensionAffectingProps"}))},enlargeSpaces:function(){for(var t,e,i,n,r,o,a,s=0,l=this._textLines.length;s<l;s++)if(("justify"===this.textAlign||s!==l-1&&!this.isEndOfWrapping(s))&&(n=0,r=this._textLines[s],(e=this.getLineWidth(s))<this.width&&(a=this.textLines[s].match(this._reSpacesAndTabs)))){i=a.length,t=(this.width-e)/i;for(var c=0,u=r.length;c<=u;c++)o=this.__charBounds[s][c],this._reSpaceAndTab.test(r[c])?(o.width+=t,o.kernedWidth+=t,o.left+=n,n+=t):o.left+=n}},isEndOfWrapping:function(t){return t===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var t=this.callSuper("_getCacheCanvasDimensions"),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t},_render:function(t){var e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")},_renderText:function(t){"stroke"===this.paintFirst?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))},_setTextStyles:function(t,e,i){t.textBaseline="alphabetic",t.font=this._getFontDeclaration(e,i)},calcTextWidth:function(){for(var t=this.getLineWidth(0),e=1,i=this._textLines.length;e<i;e++){var n=this.getLineWidth(e);n>t&&(t=n)}return t},_renderTextLine:function(t,e,i,n,r,o){this._renderChars(t,e,i,n,r,o)},_renderTextLinesBackground:function(t){if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){for(var e,i,n,r,o,a,s,l=t.fillStyle,c=this._getLeftOffset(),u=this._getTopOffset(),h=0,f=0,g=this.path,d=0,v=this._textLines.length;d<v;d++)if(e=this.getHeightOfLine(d),this.textBackgroundColor||this.styleHas("textBackgroundColor",d)){n=this._textLines[d],i=this._getLineLeftOffset(d),f=0,h=0,r=this.getValueOfPropertyAt(d,0,"textBackgroundColor");for(var p=0,m=n.length;p<m;p++)o=this.__charBounds[d][p],a=this.getValueOfPropertyAt(d,p,"textBackgroundColor"),g?(t.save(),t.translate(o.renderLeft,o.renderTop),t.rotate(o.angle),t.fillStyle=a,a&&t.fillRect(-o.width/2,-e/this.lineHeight*(1-this._fontSizeFraction),o.width,e/this.lineHeight),t.restore()):a!==r?(s=c+i+h,"rtl"===this.direction&&(s=this.width-s-f),t.fillStyle=r,r&&t.fillRect(s,u,f,e/this.lineHeight),h=o.left,f=o.width,r=a):f+=o.kernedWidth;a&&!g&&(s=c+i+h,"rtl"===this.direction&&(s=this.width-s-f),t.fillStyle=a,t.fillRect(s,u,f,e/this.lineHeight)),u+=e}else u+=e;t.fillStyle=l,this._removeShadow(t)}},getFontCache:function(t){var i=t.fontFamily.toLowerCase();e.charWidthsCache[i]||(e.charWidthsCache[i]={});var n=e.charWidthsCache[i],r=t.fontStyle.toLowerCase()+"_"+(t.fontWeight+"").toLowerCase();return n[r]||(n[r]={}),n[r]},_measureChar:function(t,e,i,n){var r,o,a,s,l=this.getFontCache(e),c=i+t,u=this._getFontDeclaration(e)===this._getFontDeclaration(n),h=e.fontSize/this.CACHE_FONT_SIZE;if(i&&void 0!==l[i]&&(a=l[i]),void 0!==l[t]&&(s=r=l[t]),u&&void 0!==l[c]&&(s=(o=l[c])-a),void 0===r||void 0===a||void 0===o){var f=this.getMeasuringContext();this._setTextStyles(f,e,!0)}return void 0===r&&(s=r=f.measureText(t).width,l[t]=r),void 0===a&&u&&i&&(a=f.measureText(i).width,l[i]=a),u&&void 0===o&&(o=f.measureText(c).width,l[c]=o,s=o-a),{width:r*h,kernedWidth:s*h}},getHeightOfChar:function(t,e){return this.getValueOfPropertyAt(t,e,"fontSize")},measureLine:function(t){var e=this._measureLine(t);return 0!==this.charSpacing&&(e.width-=this._getWidthOfCharSpacing()),e.width<0&&(e.width=0),e},_measureLine:function(t){var i,n,r,o,a,s,l=0,c=this._textLines[t],u=new Array(c.length),h=0,f=this.path,g="right"===this.pathSide;for(this.__charBounds[t]=u,i=0;i<c.length;i++)n=c[i],o=this._getGraphemeBox(n,t,i,r),u[i]=o,l+=o.kernedWidth,r=n;if(u[i]={left:o?o.left+o.width:0,width:0,kernedWidth:0,height:this.fontSize},f){switch(s=f.segmentsInfo[f.segmentsInfo.length-1].length,(a=e.util.getPointOnPath(f.path,0,f.segmentsInfo)).x+=f.pathOffset.x,a.y+=f.pathOffset.y,this.textAlign){case"left":h=g?s-l:0;break;case"center":h=(s-l)/2;break;case"right":h=g?0:s-l;break}for(h+=this.pathStartOffset*(g?-1:1),i=g?c.length-1:0;g?i>=0:i<c.length;g?i--:i++)o=u[i],h>s?h%=s:h<0&&(h+=s),this._setGraphemeOnPath(h,o,a),h+=o.kernedWidth}return{width:l,numOfSpaces:0}},_setGraphemeOnPath:function(t,i,n){var r=t+i.kernedWidth/2,o=this.path,a=e.util.getPointOnPath(o.path,r,o.segmentsInfo);i.renderLeft=a.x-n.x,i.renderTop=a.y-n.y,i.angle=a.angle+("right"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(t,e,i,n,r){var o,a=this.getCompleteStyleDeclaration(e,i),s=n?this.getCompleteStyleDeclaration(e,i-1):{},l=this._measureChar(t,a,n,s),c=l.kernedWidth,u=l.width;0!==this.charSpacing&&(u+=o=this._getWidthOfCharSpacing(),c+=o);var h={width:u,left:0,height:a.fontSize,kernedWidth:c,deltaY:a.deltaY};if(i>0&&!r){var f=this.__charBounds[e][i-1];h.left=f.left+f.width+l.kernedWidth-l.width}return h},getHeightOfLine:function(t){if(this.__lineHeights[t])return this.__lineHeights[t];for(var e=this._textLines[t],i=this.getHeightOfChar(t,0),n=1,r=e.length;n<r;n++)i=Math.max(this.getHeightOfChar(t,n),i);return this.__lineHeights[t]=i*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var t,e=0,i=0,n=this._textLines.length;i<n;i++)t=this.getHeightOfLine(i),e+=i===n-1?t/this.lineHeight:t;return e},_getLeftOffset:function(){return"ltr"===this.direction?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(t,e){t.save();for(var i=0,n=this._getLeftOffset(),r=this._getTopOffset(),o=0,a=this._textLines.length;o<a;o++){var s=this.getHeightOfLine(o),l=s/this.lineHeight,c=this._getLineLeftOffset(o);this._renderTextLine(e,t,this._textLines[o],n+c,r+i+l,o),i+=s}t.restore()},_renderTextFill:function(t){(this.fill||this.styleHas("fill"))&&this._renderTextCommon(t,"fillText")},_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())},_renderChars:function(t,e,i,n,r,o){var a,s,l,c,u,h=this.getHeightOfLine(o),f=-1!==this.textAlign.indexOf("justify"),g="",d=0,v=this.path,p=!f&&0===this.charSpacing&&this.isEmptyStyles(o)&&!v,m="ltr"===this.direction,y="ltr"===this.direction?1:-1;if(e.save(),r-=h*this._fontSizeFraction/this.lineHeight,p)return e.canvas.setAttribute("dir",m?"ltr":"rtl"),e.direction=m?"ltr":"rtl",e.textAlign=m?"left":"right",this._renderChar(t,e,o,0,i.join(""),n,r,h),void e.restore();for(var b=0,x=i.length-1;b<=x;b++)c=b===x||this.charSpacing||v,g+=i[b],l=this.__charBounds[o][b],0===d?(n+=y*(l.kernedWidth-l.width),d+=l.width):d+=l.kernedWidth,f&&!c&&this._reSpaceAndTab.test(i[b])&&(c=!0),c||(a=a||this.getCompleteStyleDeclaration(o,b),s=this.getCompleteStyleDeclaration(o,b+1),c=this._hasStyleChanged(a,s)),c&&(v?(e.save(),e.translate(l.renderLeft,l.renderTop),e.rotate(l.angle),this._renderChar(t,e,o,b,g,-d/2,0,h),e.restore()):(u=n,e.canvas.setAttribute("dir",m?"ltr":"rtl"),e.direction=m?"ltr":"rtl",e.textAlign=m?"left":"right",this._renderChar(t,e,o,b,g,u,r,h)),g="",a=s,n+=y*d,d=0);e.restore()},_applyPatternGradientTransformText:function(t){var i,n=e.util.createCanvasElement(),r=this.width+this.strokeWidth,o=this.height+this.strokeWidth;return n.width=r,n.height=o,(i=n.getContext("2d")).beginPath(),i.moveTo(0,0),i.lineTo(r,0),i.lineTo(r,o),i.lineTo(0,o),i.closePath(),i.translate(r/2,o/2),i.fillStyle=t.toLive(i),this._applyPatternGradientTransform(i,t),i.fill(),i.createPattern(n,"no-repeat")},handleFiller:function(t,e,i){var n,r;return i.toLive?"percentage"===i.gradientUnits||i.gradientTransform||i.patternTransform?(n=-this.width/2,r=-this.height/2,t.translate(n,r),t[e]=this._applyPatternGradientTransformText(i),{offsetX:n,offsetY:r}):(t[e]=i.toLive(t,this),this._applyPatternGradientTransform(t,i)):(t[e]=i,{offsetX:0,offsetY:0})},_setStrokeStyles:function(t,e){return t.lineWidth=e.strokeWidth,t.lineCap=this.strokeLineCap,t.lineDashOffset=this.strokeDashOffset,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,this.handleFiller(t,"strokeStyle",e.stroke)},_setFillStyles:function(t,e){return this.handleFiller(t,"fillStyle",e.fill)},_renderChar:function(t,e,i,n,r,o,a){var s,l,c=this._getStyleDeclaration(i,n),u=this.getCompleteStyleDeclaration(i,n),h="fillText"===t&&u.fill,f="strokeText"===t&&u.stroke&&u.strokeWidth;(f||h)&&(e.save(),h&&(s=this._setFillStyles(e,u)),f&&(l=this._setStrokeStyles(e,u)),e.font=this._getFontDeclaration(u),c&&c.textBackgroundColor&&this._removeShadow(e),c&&c.deltaY&&(a+=c.deltaY),h&&e.fillText(r,o-s.offsetX,a-s.offsetY),f&&e.strokeText(r,o-l.offsetX,a-l.offsetY),e.restore())},setSuperscript:function(t,e){return this._setScript(t,e,this.superscript)},setSubscript:function(t,e){return this._setScript(t,e,this.subscript)},_setScript:function(t,e,i){var n=this.get2DCursorLocation(t,!0),r=this.getValueOfPropertyAt(n.lineIndex,n.charIndex,"fontSize"),o=this.getValueOfPropertyAt(n.lineIndex,n.charIndex,"deltaY"),a={fontSize:r*i.size,deltaY:o+r*i.baseline};return this.setSelectionStyles(a,t,e),this},_hasStyleChanged:function(t,e){return t.fill!==e.fill||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth||t.fontSize!==e.fontSize||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.deltaY!==e.deltaY},_hasStyleChangedForSvg:function(t,e){return this._hasStyleChanged(t,e)||t.overline!==e.overline||t.underline!==e.underline||t.linethrough!==e.linethrough},_getLineLeftOffset:function(t){var e=this.getLineWidth(t),i=this.width-e,n=this.textAlign,r=this.direction,o=0,a=this.isEndOfWrapping(t);return"justify"===n||"justify-center"===n&&!a||"justify-right"===n&&!a||"justify-left"===n&&!a?0:("center"===n&&(o=i/2),"right"===n&&(o=i),"justify-center"===n&&(o=i/2),"justify-right"===n&&(o=i),"rtl"===r&&(o-=i),o)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var t=this._forceClearCache;return t||(t=this.hasStateChanged("_dimensionAffectingProps")),t&&(this.dirty=!0,this._forceClearCache=!1),t},getLineWidth:function(t){return this.__lineWidths[t]?this.__lineWidths[t]:(e=""===this._textLines[t]?0:this.measureLine(t).width,this.__lineWidths[t]=e,e);var e},_getWidthOfCharSpacing:function(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(t,e,i){var n=this._getStyleDeclaration(t,e);return n&&void 0!==n[i]?n[i]:this[i]},_renderTextDecoration:function(t,e){if(this[e]||this.styleHas(e)){for(var i,n,r,o,a,s,l,c,u,h,f,g,d,v,p,m,y=this._getLeftOffset(),b=this._getTopOffset(),x=this.path,C=this._getWidthOfCharSpacing(),I=this.offsets[e],_=0,M=this._textLines.length;_<M;_++)if(i=this.getHeightOfLine(_),this[e]||this.styleHas(e,_)){l=this._textLines[_],v=i/this.lineHeight,o=this._getLineLeftOffset(_),h=0,f=0,c=this.getValueOfPropertyAt(_,0,e),m=this.getValueOfPropertyAt(_,0,"fill"),u=b+v*(1-this._fontSizeFraction),n=this.getHeightOfChar(_,0),a=this.getValueOfPropertyAt(_,0,"deltaY");for(var S=0,w=l.length;S<w;S++)if(g=this.__charBounds[_][S],d=this.getValueOfPropertyAt(_,S,e),p=this.getValueOfPropertyAt(_,S,"fill"),r=this.getHeightOfChar(_,S),s=this.getValueOfPropertyAt(_,S,"deltaY"),x&&d&&p)t.save(),t.fillStyle=m,t.translate(g.renderLeft,g.renderTop),t.rotate(g.angle),t.fillRect(-g.kernedWidth/2,I*r+s,g.kernedWidth,this.fontSize/15),t.restore();else if((d!==c||p!==m||r!==n||s!==a)&&f>0){var k=y+o+h;"rtl"===this.direction&&(k=this.width-k-f),c&&m&&(t.fillStyle=m,t.fillRect(k,u+I*n+a,f,this.fontSize/15)),h=g.left,f=g.width,c=d,m=p,n=r,a=s}else f+=g.kernedWidth;k=y+o+h;"rtl"===this.direction&&(k=this.width-k-f),t.fillStyle=p,d&&p&&t.fillRect(k,u+I*n+a,f-C,this.fontSize/15),b+=i}else b+=i;this._removeShadow(t)}},_getFontDeclaration:function(t,i){var n=t||this,r=this.fontFamily,o=e.Text.genericFonts.indexOf(r.toLowerCase())>-1,a=void 0===r||r.indexOf("'")>-1||r.indexOf(",")>-1||r.indexOf('"')>-1||o?n.fontFamily:'"'+n.fontFamily+'"';return[e.isLikelyNode?n.fontWeight:n.fontStyle,e.isLikelyNode?n.fontStyle:n.fontWeight,i?this.CACHE_FONT_SIZE+"px":n.fontSize+"px",a].join(" ")},render:function(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",t)))},_splitTextIntoLines:function(t){for(var i=t.split(this._reNewline),n=new Array(i.length),r=["\n"],o=[],a=0;a<i.length;a++)n[a]=e.util.string.graphemeSplit(i[a]),o=o.concat(n[a],r);return o.pop(),{_unwrappedLines:n,lines:i,graphemeText:o,graphemeLines:n}},toObject:function(t){var e=n.concat(t),r=this.callSuper("toObject",e);return r.styles=i(this.styles,!0),r.path&&(r.path=this.path.toObject()),r},set:function(t,e){this.callSuper("set",t,e);var i=!1,n=!1;if("object"==typeof t)for(var r in t)"path"===r&&this.setPathInfo(),i=i||-1!==this._dimensionAffectingProps.indexOf(r),n=n||"path"===r;else i=-1!==this._dimensionAffectingProps.indexOf(t),n="path"===t;return n&&this.setPathInfo(),i&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),e.Text.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")),e.Text.DEFAULT_SVG_FONT_SIZE=16,e.Text.fromElement=function(t,n,r){if(!t)return n(null);var o=e.parseAttributes(t,e.Text.ATTRIBUTE_NAMES),a=o.textAnchor||"left";if((r=e.util.object.extend(r?i(r):{},o)).top=r.top||0,r.left=r.left||0,o.textDecoration){var s=o.textDecoration;-1!==s.indexOf("underline")&&(r.underline=!0),-1!==s.indexOf("overline")&&(r.overline=!0),-1!==s.indexOf("line-through")&&(r.linethrough=!0),delete r.textDecoration}"dx"in o&&(r.left+=o.dx),"dy"in o&&(r.top+=o.dy),"fontSize"in r||(r.fontSize=e.Text.DEFAULT_SVG_FONT_SIZE);var l="";"textContent"in t?l=t.textContent:"firstChild"in t&&null!==t.firstChild&&"data"in t.firstChild&&null!==t.firstChild.data&&(l=t.firstChild.data),l=l.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var c=r.strokeWidth;r.strokeWidth=0;var u=new e.Text(l,r),h=u.getScaledHeight()/u.height,f=((u.height+u.strokeWidth)*u.lineHeight-u.height)*h,g=u.getScaledHeight()+f,d=0;"center"===a&&(d=u.getScaledWidth()/2),"right"===a&&(d=u.getScaledWidth()),u.set({left:u.left-d,top:u.top-(g-u.fontSize*(.07+u._fontSizeFraction))/u.lineHeight,strokeWidth:void 0!==c?c:1}),n(u)},e.Text.fromObject=function(t,n){var r=i(t),o=t.path;return delete r.path,e.Object._fromObject("Text",r,(function(t){o?e.Object._fromObject("Path",o,(function(e){t.set("path",e),n(t)}),"path"):n(t)}),"text")},e.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],e.util.createAccessors&&e.util.createAccessors(e.Text)}}(e),S.util.object.extend(S.Text.prototype,{isEmptyStyles:function(t){if(!this.styles)return!0;if(void 0!==t&&!this.styles[t])return!0;var e=void 0===t?this.styles:{line:this.styles[t]};for(var i in e)for(var n in e[i])for(var r in e[i][n])return!1;return!0},styleHas:function(t,e){if(!this.styles||!t||""===t)return!1;if(void 0!==e&&!this.styles[e])return!1;var i=void 0===e?this.styles:{0:this.styles[e]};for(var n in i)for(var r in i[n])if(void 0!==i[n][r][t])return!0;return!1},cleanStyle:function(t){if(!this.styles||!t||""===t)return!1;var e,i,n=this.styles,r=0,o=!0,a=0;for(var s in n){for(var l in e=0,n[s]){var c;r++,(c=n[s][l]).hasOwnProperty(t)?(i?c[t]!==i&&(o=!1):i=c[t],c[t]===this[t]&&delete c[t]):o=!1,0!==Object.keys(c).length?e++:delete n[s][l]}0===e&&delete n[s]}for(var u=0;u<this._textLines.length;u++)a+=this._textLines[u].length;o&&r===a&&(this[t]=i,this.removeStyle(t))},removeStyle:function(t){if(this.styles&&t&&""!==t){var e,i,n,r=this.styles;for(i in r){for(n in e=r[i])delete e[n][t],0===Object.keys(e[n]).length&&delete e[n];0===Object.keys(e).length&&delete r[i]}}},_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,{}),S.util.object.extend(this._getStyleDeclaration(i.lineIndex,i.charIndex),e)},get2DCursorLocation:function(t,e){void 0===t&&(t=this.selectionStart);for(var i=e?this._unwrappedTextLines:this._textLines,n=i.length,r=0;r<n;r++){if(t<=i[r].length)return{lineIndex:r,charIndex:t};t-=i[r].length+this.missingNewlineOffset(r)}return{lineIndex:r-1,charIndex:i[r-1].length<t?i[r-1].length:t}},getSelectionStyles:function(t,e,i){void 0===t&&(t=this.selectionStart||0),void 0===e&&(e=this.selectionEnd||t);for(var n=[],r=t;r<e;r++)n.push(this.getStyleAtPosition(r,i));return n},getStyleAtPosition:function(t,e){var i=this.get2DCursorLocation(t);return(e?this.getCompleteStyleDeclaration(i.lineIndex,i.charIndex):this._getStyleDeclaration(i.lineIndex,i.charIndex))||{}},setSelectionStyles:function(t,e,i){void 0===e&&(e=this.selectionStart||0),void 0===i&&(i=this.selectionEnd||e);for(var n=e;n<i;n++)this._extendStyles(n,t);return this._forceClearCache=!0,this},_getStyleDeclaration:function(t,e){var i=this.styles&&this.styles[t];return i?i[e]:null},getCompleteStyleDeclaration:function(t,e){for(var i,n=this._getStyleDeclaration(t,e)||{},r={},o=0;o<this._styleProperties.length;o++)r[i=this._styleProperties[o]]=void 0===n[i]?this[i]:n[i];return r},_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){this.styles[t]={}},_deleteLineStyle:function(t){delete this.styles[t]}}),function(){function t(t){t.textDecoration&&(t.textDecoration.indexOf("underline")>-1&&(t.underline=!0),t.textDecoration.indexOf("line-through")>-1&&(t.linethrough=!0),t.textDecoration.indexOf("overline")>-1&&(t.overline=!0),delete t.textDecoration)}S.IText=S.util.createClass(S.Text,S.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(t,e){this.callSuper("initialize",t,e),this.initBehavior()},setSelectionStart:function(t){t=Math.max(t,0),this._updateAndFire("selectionStart",t)},setSelectionEnd:function(t){t=Math.min(t,this.text.length),this._updateAndFire("selectionEnd",t)},_updateAndFire:function(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(t){this.clearContextTop(),this.callSuper("render",t),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(t){this.callSuper("_render",t)},clearContextTop:function(t){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var e=this.canvas.contextTop,i=this.canvas.viewportTransform;e.save(),e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this.transform(e),this._clearTextArea(e),t||e.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this._getCursorBoundaries(),e=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(t,e):this.renderSelection(t,e),e.restore()}},_clearTextArea:function(t){var e=this.width+4,i=this.height+4;t.clearRect(-e/2,-i/2,e,i)},_getCursorBoundaries:function(t){void 0===t&&(t=this.selectionStart);var e=this._getLeftOffset(),i=this._getTopOffset(),n=this._getCursorBoundariesOffsets(t);return{left:e,top:i,leftOffset:n.left,topOffset:n.top}},_getCursorBoundariesOffsets:function(t){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var e,i,n,r,o=0,a=0,s=this.get2DCursorLocation(t);n=s.charIndex,i=s.lineIndex;for(var l=0;l<i;l++)o+=this.getHeightOfLine(l);e=this._getLineLeftOffset(i);var c=this.__charBounds[i][n];return c&&(a=c.left),0!==this.charSpacing&&n===this._textLines[i].length&&(a-=this._getWidthOfCharSpacing()),r={top:o,left:e+(a>0?a:0)},"rtl"===this.direction&&(r.left*=-1),this.cursorOffsetCache=r,this.cursorOffsetCache},renderCursor:function(t,e){var i=this.get2DCursorLocation(),n=i.lineIndex,r=i.charIndex>0?i.charIndex-1:0,o=this.getValueOfPropertyAt(n,r,"fontSize"),a=this.scaleX*this.canvas.getZoom(),s=this.cursorWidth/a,l=t.topOffset,c=this.getValueOfPropertyAt(n,r,"deltaY");l+=(1-this._fontSizeFraction)*this.getHeightOfLine(n)/this.lineHeight-o*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(t,e),e.fillStyle=this.cursorColor||this.getValueOfPropertyAt(n,r,"fill"),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+t.leftOffset-s/2,l+t.top+c,s,o)},renderSelection:function(t,e){for(var i=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,n=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,r=-1!==this.textAlign.indexOf("justify"),o=this.get2DCursorLocation(i),a=this.get2DCursorLocation(n),s=o.lineIndex,l=a.lineIndex,c=o.charIndex<0?0:o.charIndex,u=a.charIndex<0?0:a.charIndex,h=s;h<=l;h++){var f,g=this._getLineLeftOffset(h)||0,d=this.getHeightOfLine(h),v=0,p=0;if(h===s&&(v=this.__charBounds[s][c].left),h>=s&&h<l)p=r&&!this.isEndOfWrapping(h)?this.width:this.getLineWidth(h)||5;else if(h===l)if(0===u)p=this.__charBounds[l][u].left;else{var m=this._getWidthOfCharSpacing();p=this.__charBounds[l][u-1].left+this.__charBounds[l][u-1].width-m}f=d,(this.lineHeight<1||h===l&&this.lineHeight>1)&&(d/=this.lineHeight);var y=t.left+g+v,b=p-v,x=d,C=0;this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",x=1,C=d):e.fillStyle=this.selectionColor,"rtl"===this.direction&&(y=this.width-y-b),e.fillRect(y,t.top+t.topOffset+C,b,x),t.topOffset+=f}},getCurrentCharFontSize:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fontSize")},getCurrentCharColor:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fill")},_getCurrentCharIndex:function(){var t=this.get2DCursorLocation(this.selectionStart,!0),e=t.charIndex>0?t.charIndex-1:0;return{l:t.lineIndex,c:e}}}),S.IText.fromObject=function(e,i){if(t(e),e.styles)for(var n in e.styles)for(var r in e.styles[n])t(e.styles[n][r]);S.Object._fromObject("IText",e,i,"text")}}(),I=S.util.object.clone,S.util.object.extend(S.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var t=this;this.on("added",(function(){var e=t.canvas;e&&(e._hasITextHandlers||(e._hasITextHandlers=!0,t._initCanvasHandlers(e)),e._iTextInstances=e._iTextInstances||[],e._iTextInstances.push(t))}))},initRemovedHandler:function(){var t=this;this.on("removed",(function(){var e=t.canvas;e&&(e._iTextInstances=e._iTextInstances||[],S.util.removeFromArray(e._iTextInstances,t),0===e._iTextInstances.length&&(e._hasITextHandlers=!1,t._removeCanvasHandlers(e)))}))},_initCanvasHandlers:function(t){t._mouseUpITextHandler=function(){t._iTextInstances&&t._iTextInstances.forEach((function(t){t.__isMousedown=!1}))},t.on("mouse:up",t._mouseUpITextHandler)},_removeCanvasHandlers:function(t){t.off("mouse:up",t._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(t,e,i,n){var r;return r={isAborted:!1,abort:function(){this.isAborted=!0}},t.animate("_currentCursorOpacity",e,{duration:i,onComplete:function(){r.isAborted||t[n]()},onChange:function(){t.canvas&&t.selectionStart===t.selectionEnd&&t.renderCursorOrSelection()},abort:function(){return r.isAborted}}),r},_onTickComplete:function(){var t=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout((function(){t._currentTickCompleteState=t._animateCursor(t,0,this.cursorDuration/2,"_tick")}),100)},initDelayedCursor:function(t){var e=this,i=t?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout((function(){e._tick()}),i)},abortCursorAnimation:function(){var t=this._currentTickState||this._currentTickCompleteState,e=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,t&&e&&e.clearContext(e.contextTop||e.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(t){var e=0,i=t-1;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i--;for(;/\S/.test(this._text[i])&&i>-1;)e++,i--;return t-e},findWordBoundaryRight:function(t){var e=0,i=t;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i++;for(;/\S/.test(this._text[i])&&i<this._text.length;)e++,i++;return t+e},findLineBoundaryLeft:function(t){for(var e=0,i=t-1;!/\n/.test(this._text[i])&&i>-1;)e++,i--;return t-e},findLineBoundaryRight:function(t){for(var e=0,i=t;!/\n/.test(this._text[i])&&i<this._text.length;)e++,i++;return t+e},searchWordBoundary:function(t,e){for(var i=this._text,n=this._reSpace.test(i[t])?t-1:t,r=i[n],o=S.reNonWord;!o.test(r)&&n>0&&n<i.length;)r=i[n+=e];return o.test(r)&&(n+=1===e?0:1),n},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);return this.selectionStart=e,this.selectionEnd=i,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(t){if(!this.isEditing&&this.editable)return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(t),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this._fireSelectionChanged(),this.canvas?(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll(),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&&i!==n||i!==e&&n!==e)&&(e>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=e):(this.selectionStart=e,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===i&&this.selectionEnd===n||(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(t,e,i){var n=i.slice(0,t),r=S.util.string.graphemeSplit(n).length;if(t===e)return{selectionStart:r,selectionEnd:r};var o=i.slice(t,e);return{selectionStart:r,selectionEnd:r+S.util.string.graphemeSplit(o).length}},fromGraphemeToStringSelection:function(t,e,i){var n=i.slice(0,t).join("").length;return t===e?{selectionStart:n,selectionEnd:n}:{selectionStart:n,selectionEnd:n+i.slice(t,e).join("").length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var t=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=t.selectionEnd,this.inCompositionMode||(this.selectionStart=t.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),i=this.get2DCursorLocation(t),n=i.lineIndex,r=i.charIndex,o=this.getValueOfPropertyAt(n,r,"fontSize")*this.lineHeight,a=e.leftOffset,s=this.calcTransformMatrix(),l={x:e.left+a,y:e.top+e.topOffset+o},c=this.canvas.getRetinaScaling(),u=this.canvas.upperCanvasEl,h=u.width/c,f=u.height/c,g=h-o,d=f-o,v=u.clientWidth/h,p=u.clientHeight/f;return l=S.util.transformPoint(l,s),(l=S.util.transformPoint(l,this.canvas.viewportTransform)).x*=v,l.y*=p,l.x<0&&(l.x=0),l.x>g&&(l.x=g),l.y<0&&(l.y=0),l.y>d&&(l.y=d),l.x+=this.canvas._offset.left,l.y+=this.canvas._offset.top,{left:l.x+"px",top:l.y+"px",fontSize:o+"px",charHeight:o}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var t=this._textBeforeEdit!==this.text,e=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,e&&(e.blur&&e.blur(),e.parentNode&&e.parentNode.removeChild(e)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),t&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var t in this.styles)this._textLines[t]||delete this.styles[t]},removeStyleFromTo:function(t,e){var i,n,r=this.get2DCursorLocation(t,!0),o=this.get2DCursorLocation(e,!0),a=r.lineIndex,s=r.charIndex,l=o.lineIndex,c=o.charIndex;if(a!==l){if(this.styles[a])for(i=s;i<this._unwrappedTextLines[a].length;i++)delete this.styles[a][i];if(this.styles[l])for(i=c;i<this._unwrappedTextLines[l].length;i++)(n=this.styles[l][i])&&(this.styles[a]||(this.styles[a]={}),this.styles[a][s+i-c]=n);for(i=a+1;i<=l;i++)delete this.styles[i];this.shiftLineStyles(l,a-l)}else if(this.styles[a]){n=this.styles[a];var u,h,f=c-s;for(i=s;i<c;i++)delete n[i];for(h in this.styles[a])(u=parseInt(h,10))>=c&&(n[u-f]=n[h],delete n[h])}},shiftLineStyles:function(t,e){var i=I(this.styles);for(var n in this.styles){var r=parseInt(n,10);r>t&&(this.styles[r+e]=i[r],i[r-e]||delete this.styles[r])}},restartCursorIfNeeded:function(){this._currentTickState&&!this._currentTickState.isAborted&&this._currentTickCompleteState&&!this._currentTickCompleteState.isAborted||this.initDelayedCursor()},insertNewlineStyleObject:function(t,e,i,n){var r,o={},a=!1,s=this._unwrappedTextLines[t].length===e;for(var l in i||(i=1),this.shiftLineStyles(t,i),this.styles[t]&&(r=this.styles[t][0===e?e:e-1]),this.styles[t]){var c=parseInt(l,10);c>=e&&(a=!0,o[c-e]=this.styles[t][l],s&&0===e||delete this.styles[t][l])}var u=!1;for(a&&!s&&(this.styles[t+i]=o,u=!0),u&&i--;i>0;)n&&n[i-1]?this.styles[t+i]={0:I(n[i-1])}:r?this.styles[t+i]={0:I(r)}:delete this.styles[t+i],i--;this._forceClearCache=!0},insertCharStyleObject:function(t,e,i,n){this.styles||(this.styles={});var r=this.styles[t],o=r?I(r):{};for(var a in i||(i=1),o){var s=parseInt(a,10);s>=e&&(r[s+i]=o[s],o[s-i]||delete r[s])}if(this._forceClearCache=!0,n)for(;i--;)Object.keys(n[i]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][e+i]=I(n[i]));else if(r)for(var l=r[e?e-1:1];l&&i--;)this.styles[t][e+i]=I(l)},insertNewStyleBlock:function(t,e,i){for(var n=this.get2DCursorLocation(e,!0),r=[0],o=0,a=0;a<t.length;a++)"\n"===t[a]?r[++o]=0:r[o]++;for(r[0]>0&&(this.insertCharStyleObject(n.lineIndex,n.charIndex,r[0],i),i=i&&i.slice(r[0]+1)),o&&this.insertNewlineStyleObject(n.lineIndex,n.charIndex+r[0],o),a=1;a<o;a++)r[a]>0?this.insertCharStyleObject(n.lineIndex+a,0,r[a],i):i&&(this.styles[n.lineIndex+a][0]=i[0]),i=i&&i.slice(r[a]+1);r[a]>0&&this.insertCharStyleObject(n.lineIndex+a,0,r[a],i)},setSelectionStartEndWithShift:function(t,e,i){i<=t?(e===t?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=t),this.selectionStart=i):i>t&&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)}}),S.util.object.extend(S.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(t){if(this.canvas){this.__newClickTime=+new Date;var e=t.pointer;this.isTripleClick(e)&&(this.fire("tripleclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(t){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(t.e))},tripleClickHandler:function(t){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(t.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(t.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(t){if(this.__isMousedown=!1,!(!this.editable||this.group||t.transform&&t.transform.actionPerformed||t.e.button&&1!==t.e.button)){if(this.canvas){var e=this.canvas._activeObject;if(e&&e!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(t.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t),i=this.selectionStart,n=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(i,n,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(t){for(var e,i=this.getLocalPointer(t),n=0,r=0,o=0,a=0,s=0,l=0,c=this._textLines.length;l<c&&o<=i.y;l++)o+=this.getHeightOfLine(l)*this.scaleY,s=l,l>0&&(a+=this._textLines[l-1].length+this.missingNewlineOffset(l-1));r=this._getLineLeftOffset(s)*this.scaleX,e=this._textLines[s],"rtl"===this.direction&&(i.x=this.width*this.scaleX-i.x+r);for(var u=0,h=e.length;u<h&&(n=r,(r+=this.__charBounds[s][u].kernedWidth*this.scaleX)<=i.x);u++)a++;return this._getNewSelectionStartFromOffset(i,n,r,a,h)},_getNewSelectionStartFromOffset:function(t,e,i,n,r){var o=t.x-e,a=i-t.x,s=n+(a>o||a<0?0:1);return this.flipX&&(s=r-s),s>this._text.length&&(s=this._text.length),s}}),S.util.object.extend(S.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=S.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var t=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+t.top+"; left: "+t.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; paddingï½°top: "+t.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):S.document.body.appendChild(this.hiddenTextarea),S.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),S.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),S.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),S.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),S.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),S.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),S.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),S.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),S.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(S.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(t){if(this.isEditing){var e="rtl"===this.direction?this.keysMapRtl:this.keysMap;if(t.keyCode in e)this[e[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown)||!t.ctrlKey&&!t.metaKey)return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),t.keyCode>=33&&t.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(t){var e=this.fromPaste;if(this.fromPaste=!1,t&&t.stopPropagation(),this.isEditing){var i,n,r,o,a,s=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,l=this._text.length,c=s.length,u=c-l,h=this.selectionStart,f=this.selectionEnd,g=h!==f;if(""===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire("changed"),void(this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll()));var d=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),v=h>d.selectionStart;g?(i=this._text.slice(h,f),u+=f-h):c<l&&(i=v?this._text.slice(f+u,f):this._text.slice(h,h-u)),n=s.slice(d.selectionEnd-u,d.selectionEnd),i&&i.length&&(n.length&&(r=this.getSelectionStyles(h,h+1,!1),r=n.map((function(){return r[0]}))),g?(o=h,a=f):v?(o=f-i.length,a=f):(o=f,a=f+i.length),this.removeStyleFromTo(o,a)),n.length&&(e&&n.join("")===S.copiedText&&!S.disableStyleCopyPaste&&(r=S.copiedTextStyle),this.insertNewStyleBlock(n,h,r)),this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(t){this.compositionStart=t.target.selectionStart,this.compositionEnd=t.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(S.copiedText=this.getSelectedText(),S.disableStyleCopyPaste?S.copiedTextStyle=null:S.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(t){return t&&t.clipboardData||S.window.clipboardData},_getWidthBeforeCursor:function(t,e){var i,n=this._getLineLeftOffset(t);return e>0&&(n+=(i=this.__charBounds[t][e-1]).left+i.width),n},getDownCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),n=this.get2DCursorLocation(i),r=n.lineIndex;if(r===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-i;var o=n.charIndex,a=this._getWidthBeforeCursor(r,o),s=this._getIndexOnLine(r+1,a);return this._textLines[r].slice(o).length+s+1+this.missingNewlineOffset(r)},_getSelectionForOffset:function(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),n=this.get2DCursorLocation(i),r=n.lineIndex;if(0===r||t.metaKey||33===t.keyCode)return-i;var o=n.charIndex,a=this._getWidthBeforeCursor(r,o),s=this._getIndexOnLine(r-1,a),l=this._textLines[r].slice(0,o),c=this.missingNewlineOffset(r-1);return-this._textLines[r-1].length+s-l.length+(1-c)},_getIndexOnLine:function(t,e){for(var i,n,r=this._textLines[t],o=this._getLineLeftOffset(t),a=0,s=0,l=r.length;s<l;s++)if((o+=i=this.__charBounds[t][s].width)>e){n=!0;var c=o-i,u=o,h=Math.abs(c-e);a=Math.abs(u-e)<h?s:s-1;break}return n||(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=this["get"+t+"CursorOffset"](e,"right"===this._selectionDirection);e.shiftKey?this.moveCursorWithShift(i):this.moveCursorWithoutShift(i),0!==i&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(t){var e="left"===this._selectionDirection?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t},moveCursorWithoutShift:function(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t},moveCursorLeft:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",t)},_move:function(t,e,i){var n;if(t.altKey)n=this["findWordBoundary"+i](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+="Left"===i?-1:1,!0;n=this["findLineBoundary"+i](this[e])}if(void 0!==typeof n&&this[e]!==n)return this[e]=n,!0},_moveLeft:function(t,e){return this._move(t,e,"Left")},_moveRight:function(t,e){return this._move(t,e,"Right")},moveCursorLeftWithoutShift:function(t){var e=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,"selectionStart")),this.selectionEnd=this.selectionStart,e},moveCursorLeftWithShift:function(t){return"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection="left",this._moveLeft(t,"selectionStart")):void 0},moveCursorRight:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",t)},_moveCursorLeftOrRight:function(t,e){var i="moveCursor"+t+"With";this._currentCursorOpacity=1,e.shiftKey?i+="Shift":i+="outShift",this[i](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(t){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(t,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(t){var e=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(e=this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e},removeChars:function(t,e){void 0===e&&(e=t+1),this.removeStyleFromTo(t,e),this._text.splice(t,e-t),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(t,e,i,n){void 0===n&&(n=i),n>i&&this.removeStyleFromTo(i,n);var r=S.util.string.graphemeSplit(t);this.insertNewStyleBlock(r,i,e),this._text=[].concat(this._text.slice(0,i),r,this._text.slice(n)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),_=S.util.toFixed,M=/ +/g,S.util.object.extend(S.Text.prototype,{_toSVG:function(){var t=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(e)},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(t){var e=this.getSvgTextDecoration(this);return[t.textBgRects.join(""),'\t\t<text xml:space="preserve" ',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+'" ':"",e?'text-decoration="'+e+'" ':"",'style="',this.getSvgStyles(!0),'"',this.addPaintOrder()," >",t.textSpans.join(""),"</text>\n"]},_getSVGTextAndBg:function(t,e){var i,n=[],r=[],o=t;this._setSVGBg(r);for(var a=0,s=this._textLines.length;a<s;a++)i=this._getLineLeftOffset(a),(this.textBackgroundColor||this.styleHas("textBackgroundColor",a))&&this._setSVGTextLineBg(r,a,e+i,o),this._setSVGTextLineText(n,a,e+i,o),o+=this.getHeightOfLine(a);return{textSpans:n,textBgRects:r}},_createTextCharSpan:function(t,e,i,n){var r=t!==t.trim()||t.match(M),o=this.getSvgSpanStyles(e,r),a=o?'style="'+o+'"':"",s=e.deltaY,l="",c=S.Object.NUM_FRACTION_DIGITS;return s&&(l=' dy="'+_(s,c)+'" '),['<tspan x="',_(i,c),'" y="',_(n,c),'" ',l,a,">",S.util.string.escapeXml(t),"</tspan>"].join("")},_setSVGTextLineText:function(t,e,i,n){var r,o,a,s,l,c=this.getHeightOfLine(e),u=-1!==this.textAlign.indexOf("justify"),h="",f=0,g=this._textLines[e];n+=c*(1-this._fontSizeFraction)/this.lineHeight;for(var d=0,v=g.length-1;d<=v;d++)l=d===v||this.charSpacing,h+=g[d],a=this.__charBounds[e][d],0===f?(i+=a.kernedWidth-a.width,f+=a.width):f+=a.kernedWidth,u&&!l&&this._reSpaceAndTab.test(g[d])&&(l=!0),l||(r=r||this.getCompleteStyleDeclaration(e,d),o=this.getCompleteStyleDeclaration(e,d+1),l=this._hasStyleChangedForSvg(r,o)),l&&(s=this._getStyleDeclaration(e,d)||{},t.push(this._createTextCharSpan(h,s,i,n)),h="",r=o,i+=f,f=0)},_pushTextBgRect:function(t,e,i,n,r,o){var a=S.Object.NUM_FRACTION_DIGITS;t.push("\t\t<rect ",this._getFillAttributes(e),' x="',_(i,a),'" y="',_(n,a),'" width="',_(r,a),'" height="',_(o,a),'"></rect>\n')},_setSVGTextLineBg:function(t,e,i,n){for(var r,o,a=this._textLines[e],s=this.getHeightOfLine(e)/this.lineHeight,l=0,c=0,u=this.getValueOfPropertyAt(e,0,"textBackgroundColor"),h=0,f=a.length;h<f;h++)r=this.__charBounds[e][h],(o=this.getValueOfPropertyAt(e,h,"textBackgroundColor"))!==u?(u&&this._pushTextBgRect(t,u,i+c,n,l,s),c=r.left,l=r.width,u=o):l+=r.kernedWidth;o&&this._pushTextBgRect(t,o,i+c,n,l,s)},_getFillAttributes:function(t){var e=t&&"string"==typeof t?new S.Color(t):"";return e&&e.getSource()&&1!==e.getAlpha()?'opacity="'+e.getAlpha()+'" fill="'+e.setAlpha(1).toRgb()+'"':'fill="'+t+'"'},_getSVGLineTopOffset:function(t){for(var e,i=0,n=0;n<t;n++)i+=this.getHeightOfLine(n);return e=this.getHeightOfLine(n),{lineTop:i,offset:(this._fontSizeMult-this._fontSizeFraction)*e/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(t){return S.Object.prototype.getSvgStyles.call(this,t)+" white-space: pre;"}}),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Textbox=e.util.createClass(e.IText,e.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:e.Text.prototype._dimensionAffectingProps.concat("width"),_wordJoiners:/[ \t\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(t){for(var e=0,i=0,n=0,r={},o=0;o<t.graphemeLines.length;o++)"\n"===t.graphemeText[n]&&o>0?(i=0,n++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[n])&&o>0&&(i++,n++),r[o]={line:e,offset:i},n+=t.graphemeLines[o].length,i+=t.graphemeLines[o].length;return r},styleHas:function(t,i){if(this._styleMap&&!this.isWrapping){var n=this._styleMap[i];n&&(i=n.line)}return e.Text.prototype.styleHas.call(this,t,i)},isEmptyStyles:function(t){if(!this.styles)return!0;var e,i,n=0,r=!1,o=this._styleMap[t],a=this._styleMap[t+1];for(var s in o&&(t=o.line,n=o.offset),a&&(r=a.line===t,e=a.offset),i=void 0===t?this.styles:{line:this.styles[t]})for(var l in i[s])if(l>=n&&(!r||l<e))for(var c in i[s][l])return!1;return!0},_getStyleDeclaration:function(t,e){if(this._styleMap&&!this.isWrapping){var i=this._styleMap[t];if(!i)return null;t=i.line,e=i.offset+e}return this.callSuper("_getStyleDeclaration",t,e)},_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){var e=this._styleMap[t];this.styles[e.line]={}},_wrapText:function(t,e){var i,n=[];for(this.isWrapping=!0,i=0;i<t.length;i++)n=n.concat(this._wrapLine(t[i],i,e));return this.isWrapping=!1,n},_measureWord:function(t,e,i){var n,r=0;i=i||0;for(var o=0,a=t.length;o<a;o++){r+=this._getGraphemeBox(t[o],e,o+i,n,true).kernedWidth,n=t[o]}return r},_wrapLine:function(t,i,n,r){var o=0,a=this.splitByGrapheme,s=[],l=[],c=a?e.util.string.graphemeSplit(t):t.split(this._wordJoiners),u="",h=0,f=a?"":" ",g=0,d=0,v=0,p=!0,m=this._getWidthOfCharSpacing();r=r||0;0===c.length&&c.push([]),n-=r;for(var y=0;y<c.length;y++)u=a?c[y]:e.util.string.graphemeSplit(c[y]),g=this._measureWord(u,i,h),h+=u.length,(o+=d+g-m)>n&&!p?(s.push(l),l=[],o=g,p=!0):o+=m,p||a||l.push(f),l=l.concat(u),d=a?0:this._measureWord([f],i,h),h++,p=!1,g>v&&(v=g);return y&&s.push(l),v+r>this.dynamicMinWidth&&(this.dynamicMinWidth=v-m+r),s},isEndOfWrapping:function(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line},missingNewlineOffset:function(t){return this.splitByGrapheme?this.isEndOfWrapping(t)?1:0:1},_splitTextIntoLines:function(t){for(var i=e.Text.prototype._splitTextIntoLines.call(this,t),n=this._wrapText(i.lines,this.width),r=new Array(n.length),o=0;o<n.length;o++)r[o]=n[o].join("");return i.lines=r,i.graphemeLines=n,i},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var t={};for(var e in this._styleMap)this._textLines[e]&&(t[this._styleMap[e].line]=1);for(var e in this.styles)t[e]||delete this.styles[e]},toObject:function(t){return this.callSuper("toObject",["minWidth","splitByGrapheme"].concat(t))}}),e.Textbox.fromObject=function(t,i){return e.Object._fromObject("Textbox",t,i,"text")}}(e),function(){var t=S.controlsUtils,e=t.scaleSkewCursorStyleHandler,i=t.scaleCursorStyleHandler,n=t.scalingEqually,r=t.scalingYOrSkewingX,o=t.scalingXOrSkewingY,a=t.scaleOrSkewActionName,s=S.Object.prototype.controls;if(s.ml=new S.Control({x:-.5,y:0,cursorStyleHandler:e,actionHandler:o,getActionName:a}),s.mr=new S.Control({x:.5,y:0,cursorStyleHandler:e,actionHandler:o,getActionName:a}),s.mb=new S.Control({x:0,y:.5,cursorStyleHandler:e,actionHandler:r,getActionName:a}),s.mt=new S.Control({x:0,y:-.5,cursorStyleHandler:e,actionHandler:r,getActionName:a}),s.tl=new S.Control({x:-.5,y:-.5,cursorStyleHandler:i,actionHandler:n}),s.tr=new S.Control({x:.5,y:-.5,cursorStyleHandler:i,actionHandler:n}),s.bl=new S.Control({x:-.5,y:.5,cursorStyleHandler:i,actionHandler:n}),s.br=new S.Control({x:.5,y:.5,cursorStyleHandler:i,actionHandler:n}),s.mtr=new S.Control({x:0,y:-.5,actionHandler:t.rotationWithSnapping,cursorStyleHandler:t.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),S.Textbox){var l=S.Textbox.prototype.controls={};l.mtr=s.mtr,l.tr=s.tr,l.br=s.br,l.tl=s.tl,l.bl=s.bl,l.mt=s.mt,l.mb=s.mb,l.mr=new S.Control({x:.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"}),l.ml=new S.Control({x:-.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"})}}()},3053:function(t,e,i){"use strict";var n=i(602);t.exports=function(t,e,i){var r,o;if(i=i||0,!n(e))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t,i);for(o=e.length,r=i;i>=0&&r<o;r+=1)if(e[r]===t)return r;return-1}},8592:function(t,e,i){"use strict";var n=i(602),r=i(6092),o=i(5573);t.exports=function(t,e,i){n(t)?r(t,e,i):o(t,e,i)}},6092:function(t){"use strict";t.exports=function(t,e,i){var n=0,r=t.length;for(i=i||null;n<r&&!1!==e.call(i,t[n],n,t);n+=1);}},5573:function(t){"use strict";t.exports=function(t,e,i){var n;for(n in i=i||null,t)if(t.hasOwnProperty(n)&&!1===e.call(i,t[n],n,t))break}},9052:function(t,e,i){"use strict";var n=i(961),r=i(9886),o=i(2560),a=i(5393),s=i(602),l=i(5183),c=i(8592),u=/\s+/g;function h(){this.events=null,this.contexts=null}h.mixin=function(t){n(t.prototype,h.prototype)},h.prototype._getHandlerItem=function(t,e){var i={handler:t};return e&&(i.context=e),i},h.prototype._safeEvent=function(t){var e,i=this.events;return i||(i=this.events={}),t&&((e=i[t])||(e=[],i[t]=e),i=e),i},h.prototype._safeContext=function(){var t=this.contexts;return t||(t=this.contexts=[]),t},h.prototype._indexOfContext=function(t){for(var e=this._safeContext(),i=0;e[i];){if(t===e[i][0])return i;i+=1}return-1},h.prototype._memorizeContext=function(t){var e,i;r(t)&&(e=this._safeContext(),(i=this._indexOfContext(t))>-1?e[i][1]+=1:e.push([t,1]))},h.prototype._forgetContext=function(t){var e,i;r(t)&&(e=this._safeContext(),(i=this._indexOfContext(t))>-1&&(e[i][1]-=1,e[i][1]<=0&&e.splice(i,1)))},h.prototype._bindEvent=function(t,e,i){var n=this._safeEvent(t);this._memorizeContext(i),n.push(this._getHandlerItem(e,i))},h.prototype.on=function(t,e,i){var n=this;o(t)?(t=t.split(u),c(t,(function(t){n._bindEvent(t,e,i)}))):a(t)&&(i=e,c(t,(function(t,e){n.on(e,t,i)})))},h.prototype.once=function(t,e,i){var n=this;if(a(t))return i=e,void c(t,(function(t,e){n.once(e,t,i)}));this.on(t,(function r(){e.apply(i,arguments),n.off(t,r,i)}),i)},h.prototype._spliceMatches=function(t,e){var i,n=0;if(s(t))for(i=t.length;n<i;n+=1)!0===e(t[n])&&(t.splice(n,1),i-=1,n-=1)},h.prototype._matchHandler=function(t){var e=this;return function(i){var n=t===i.handler;return n&&e._forgetContext(i.context),n}},h.prototype._matchContext=function(t){var e=this;return function(i){var n=t===i.context;return n&&e._forgetContext(i.context),n}},h.prototype._matchHandlerAndContext=function(t,e){var i=this;return function(n){var r=t===n.handler,o=e===n.context,a=r&&o;return a&&i._forgetContext(n.context),a}},h.prototype._offByEventName=function(t,e){var i=this,n=l(e),r=i._matchHandler(e);t=t.split(u),c(t,(function(t){var e=i._safeEvent(t);n?i._spliceMatches(e,r):(c(e,(function(t){i._forgetContext(t.context)})),i.events[t]=[])}))},h.prototype._offByHandler=function(t){var e=this,i=this._matchHandler(t);c(this._safeEvent(),(function(t){e._spliceMatches(t,i)}))},h.prototype._offByObject=function(t,e){var i,n=this;this._indexOfContext(t)<0?c(t,(function(t,e){n.off(e,t)})):o(e)?(i=this._matchContext(t),n._spliceMatches(this._safeEvent(e),i)):l(e)?(i=this._matchHandlerAndContext(e,t),c(this._safeEvent(),(function(t){n._spliceMatches(t,i)}))):(i=this._matchContext(t),c(this._safeEvent(),(function(t){n._spliceMatches(t,i)})))},h.prototype.off=function(t,e){o(t)?this._offByEventName(t,e):arguments.length?l(t)?this._offByHandler(t):a(t)&&this._offByObject(t,e):(this.events={},this.contexts=[])},h.prototype.fire=function(t){this.invoke.apply(this,arguments)},h.prototype.invoke=function(t){var e,i,n,r;if(!this.hasListener(t))return!0;for(e=this._safeEvent(t),i=Array.prototype.slice.call(arguments,1),n=0;e[n];){if(!1===(r=e[n]).handler.apply(r.context,i))return!1;n+=1}return!0},h.prototype.hasListener=function(t){return this.getListenerLength(t)>0},h.prototype.getListenerLength=function(t){return this._safeEvent(t).length},t.exports=h},961:function(t){"use strict";t.exports=function(t,e){var i,n,r,o,a=Object.prototype.hasOwnProperty;for(r=1,o=arguments.length;r<o;r+=1)for(n in i=arguments[r])a.call(i,n)&&(t[n]=i[n]);return t}},1610:function(t,e,i){"use strict";var n=i(5695),r=i(3778);t.exports=function(t,e){for(var i=arguments,o=i[0],a=1,s=i.length;a<s;a+=1){if(n(o)||r(o))return;o=o[i[a]]}return o}},4564:function(t,e,i){"use strict";var n=i(5573);t.exports=function(t,e){var i=document.createElement("img"),r="";return n(e,(function(t,e){r+="&"+e+"="+t})),r=r.substring(1),i.src=t+"?"+r,i.style.display="none",document.body.appendChild(i),document.body.removeChild(i),i}},4729:function(t,e,i){"use strict";var n=i(5695),r=i(4564);t.exports=function(t,e){var i=location.hostname,o="TOAST UI "+t+" for "+i+": Statistics",a=window.localStorage.getItem(o);(n(window.tui)||!1!==window.tui.usageStatistics)&&(a&&!function(t){return(new Date).getTime()-t>6048e5}(a)||(window.localStorage.setItem(o,(new Date).getTime()),setTimeout((function(){"interactive"!==document.readyState&&"complete"!==document.readyState||r("https://www.google-analytics.com/collect",{v:1,t:"event",tid:e,cid:i,dp:i,dh:t,el:t,ec:"use"})}),1e3)))}},602:function(t){"use strict";t.exports=function(t){return t instanceof Array}},9886:function(t,e,i){"use strict";var n=i(5695),r=i(3778);t.exports=function(t){return!n(t)&&!r(t)}},5183:function(t){"use strict";t.exports=function(t){return t instanceof Function}},3778:function(t){"use strict";t.exports=function(t){return null===t}},5393:function(t){"use strict";t.exports=function(t){return t===Object(t)}},2560:function(t){"use strict";t.exports=function(t){return"string"==typeof t||t instanceof String}},5695:function(t){"use strict";t.exports=function(t){return void 0===t}},4426:function(t,e,i){t.exports=i(4486)},9406:function(t,e,i){t.exports=i(4877)},789:function(t,e,i){t.exports=i(7178)},381:function(t,e,i){t.exports=i(5603)},7636:function(t,e,i){t.exports=i(1206)},1899:function(t,e,i){t.exports=i(6174)},899:function(t,e,i){t.exports=i(57)},8005:function(t,e,i){t.exports=i(4741)},6562:function(t,e,i){t.exports=i(8368)},9131:function(t,e,i){t.exports=i(3739)},4383:function(t,e,i){t.exports=i(172)},6065:function(t,e,i){t.exports=i(4963)},1734:function(t,e,i){t.exports=i(7820)},2461:function(t,e,i){t.exports=i(5636)},5214:function(t,e,i){t.exports=i(5059)},6397:function(t,e,i){t.exports=i(3969)},8189:function(t,e,i){t.exports=i(6618)},9146:function(t,e,i){t.exports=i(5279)},4496:function(t,e,i){t.exports=i(9562)},3972:function(t,e,i){t.exports=i(652)},7172:function(t,e,i){t.exports=i(2813)},1845:function(t,e,i){t.exports=i(8664)},662:function(t,e,i){t.exports=i(1457)},711:function(t,e,i){t.exports=i(2937)},6623:function(t,e,i){t.exports=i(9297)},7077:function(t,e,i){t.exports=i(8026)},9856:function(t,e,i){t.exports=i(2044)},4230:function(t,e,i){t.exports=i(2214)},184:function(t,e,i){t.exports=i(9256)},3742:function(t,e,i){t.exports=i(5659)},1801:function(t){var e={rect:1,circle:2,triangle:1},i={rect:{w:"width",h:"height"},circle:{w:"rx",h:"ry"},triangle:{w:"width",h:"height"}};function n(t,e,i){var n=t.x,r=t.y,o=e.x,a=e.y,s=i*Math.PI/180;return{originX:n>(o-n)*Math.cos(s)-(a-r)*Math.sin(s)+n?"right":"left",originY:r>(o-n)*Math.sin(s)+(a-r)*Math.cos(s)+r?"bottom":"top"}}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,r,o){(function(t){return"center"===t.originX&&"center"===t.originY})(t)&&(function(t,e){var i=e.getPointByOrigin("center","center"),r=n(i,t,-e.angle),o=r.originX,a=r.originY,s=e.getPointByOrigin(o,a),l=e.left-(i.x-s.x),c=e.top-(i.y-s.y);e.set({originX:o,originY:a,left:l,top:c}),e.setCoords()}(r,t),function(t){var e=t.originX,i=t.originY,n=e.substring(0,1)+i.substring(0,1);t.startPoint=t.origins[n]}(t)),o?function(t){var e=t.type,n=t.scaleX,r=t.scaleY,o=i[e],a=t[o.w]*n,s=t[o.h]*r;if(t.isRegular){var l=Math.max(n,r);a=t[o.w]*l,s=t[o.h]*l}var c={hasControls:!1,hasBorders:!1,scaleX:1,scaleY:1};c[o.w]=a,c[o.h]=s,t.set(c)}(t):function(t,n){var r=n.type,o=n.strokeWidth,a=n.startPoint,s=e[r],l=i[r],c=!("triangle"!==n.type),u={},h=Math.abs(a.x-t.x)/s,f=Math.abs(a.y-t.y)/s;h>o&&(h-=o/s),f>o&&(f-=o/s),n.isRegular&&(h=f=Math.max(h,f),c&&(f=Math.sqrt(3)/2*h)),u[l.w]=h,u[l.h]=f,n.set(u)}(r,t),function(t,e){var i=e.startPoint,r=n(i,t,-e.angle),o=r.originX,a=r.originY;e.setPositionByOrigin(i,o,a),e.setCoords()}(r,t)},adjustOriginToCenter:function(t){var e=t.getPointByOrigin("center","center"),i=t.originX,n=t.originY,r=t.getPointByOrigin(i,n),o=t.left+(e.x-r.x),a=t.top+(e.y-r.y);t.set({hasControls:!0,hasBorders:!0,originX:"center",originY:"center",left:o,top:a}),t.setCoords()}}},2221:function(t,e,i){i(5454),i(9173);var n=i(7545);t.exports=n.Array.from},5078:function(t,e,i){i(8118);var n=i(7545);t.exports=n.Array.isArray},6135:function(t,e,i){i(9106);var n=i(5607);t.exports=n("Array").concat},9510:function(t,e,i){i(1710);var n=i(5607);t.exports=n("Array").fill},3971:function(t,e,i){i(3436);var n=i(5607);t.exports=n("Array").filter},98:function(t,e,i){i(9823);var n=i(5607);t.exports=n("Array").forEach},2089:function(t,e,i){i(2276);var n=i(5607);t.exports=n("Array").indexOf},6209:function(t,e,i){i(3838);var n=i(5607);t.exports=n("Array").map},2671:function(t,e,i){i(5818);var n=i(5607);t.exports=n("Array").slice},1375:function(t,e,i){i(2178);var n=i(5607);t.exports=n("Array").splice},3528:function(t,e,i){i(665);var n=i(5607);t.exports=n("Function").bind},5739:function(t,e,i){i(8939),i(5454);var n=i(8703);t.exports=n},278:function(t,e,i){var n=i(3528),r=Function.prototype;t.exports=function(t){var e=t.bind;return t===r||t instanceof Function&&e===r.bind?n:e}},1484:function(t,e,i){var n=i(6135),r=Array.prototype;t.exports=function(t){var e=t.concat;return t===r||t instanceof Array&&e===r.concat?n:e}},7731:function(t,e,i){var n=i(9510),r=Array.prototype;t.exports=function(t){var e=t.fill;return t===r||t instanceof Array&&e===r.fill?n:e}},3669:function(t,e,i){var n=i(3971),r=Array.prototype;t.exports=function(t){var e=t.filter;return t===r||t instanceof Array&&e===r.filter?n:e}},2604:function(t,e,i){var n=i(2089),r=Array.prototype;t.exports=function(t){var e=t.indexOf;return t===r||t instanceof Array&&e===r.indexOf?n:e}},263:function(t,e,i){var n=i(6209),r=Array.prototype;t.exports=function(t){var e=t.map;return t===r||t instanceof Array&&e===r.map?n:e}},7663:function(t,e,i){var n=i(2671),r=Array.prototype;t.exports=function(t){var e=t.slice;return t===r||t instanceof Array&&e===r.slice?n:e}},5063:function(t,e,i){var n=i(1375),r=Array.prototype;t.exports=function(t){var e=t.splice;return t===r||t instanceof Array&&e===r.splice?n:e}},6813:function(t,e,i){var n=i(3842),r=String.prototype;t.exports=function(t){var e=t.trim;return"string"==typeof t||t===r||t instanceof String&&e===r.trim?n:e}},6285:function(t,e,i){i(2666);var n=i(7545);t.exports=n.Number.parseInt},3213:function(t,e,i){i(3113);var n=i(7545).Object;t.exports=function(t,e){return n.create(t,e)}},3512:function(t,e,i){i(297);var n=i(7545).Object,r=t.exports=function(t,e,i){return n.defineProperty(t,e,i)};n.defineProperty.sham&&(r.sham=!0)},8168:function(t,e,i){i(9234);var n=i(7545);t.exports=n.Object.getPrototypeOf},8651:function(t,e,i){i(2647);var n=i(7545);t.exports=n.Object.keys},3083:function(t,e,i){i(3222);var n=i(7545);t.exports=n.Object.setPrototypeOf},2987:function(t,e,i){i(4859);var n=i(7545);t.exports=n.parseFloat},2239:function(t,e,i){i(5706);var n=i(7545);t.exports=n.parseInt},3154:function(t,e,i){i(4242),i(8939),i(6663),i(9021),i(7884),i(8885),i(1868),i(5454);var n=i(7545);t.exports=n.Promise},6577:function(t,e,i){i(5397);var n=i(7545);t.exports=n.Reflect.construct},3842:function(t,e,i){i(957);var n=i(5607);t.exports=n("String").trim},5008:function(t,e,i){i(9106),i(6663),i(6187),i(9781),i(492),i(6681),i(9594),i(3665),i(9017),i(1250),i(9786),i(503),i(6565),i(9322),i(3610),i(6886),i(3514),i(8671),i(8556),i(1367);var n=i(7545);t.exports=n.Symbol},994:function(t,e,i){i(8939),i(6663),i(5454),i(3665);var n=i(9207);t.exports=n.f("iterator")},2813:function(t,e,i){var n=i(3822);t.exports=n},8664:function(t,e,i){var n=i(1434);t.exports=n},1457:function(t,e,i){var n=i(7710);t.exports=n},2937:function(t,e,i){var n=i(4741);t.exports=n},9297:function(t,e,i){var n=i(4963);t.exports=n},8026:function(t,e,i){var n=i(7820);t.exports=n},2044:function(t,e,i){var n=i(8980);t.exports=n},2214:function(t,e,i){var n=i(6672);t.exports=n},9256:function(t,e,i){var n=i(2285);i(177),i(9031),i(6658),i(1875),i(8658),i(4592),i(6680),t.exports=n},5659:function(t,e,i){var n=i(8535);t.exports=n},6235:function(t,e,i){var n=i(6447),r=i(9288);t.exports=function(t){if(n(t))return t;throw TypeError(r(t)+" is not a function")}},1404:function(t,e,i){var n=i(2091),r=i(9288);t.exports=function(t){if(n(t))return t;throw TypeError(r(t)+" is not a constructor")}},7757:function(t,e,i){var n=i(6447);t.exports=function(t){if("object"==typeof t||n(t))return t;throw TypeError("Can't set "+String(t)+" as a prototype")}},7423:function(t){t.exports=function(){}},6961:function(t){t.exports=function(t,e,i){if(t instanceof e)return t;throw TypeError("Incorrect "+(i?i+" ":"")+"invocation")}},1138:function(t,e,i){var n=i(5744);t.exports=function(t){if(n(t))return t;throw TypeError(String(t)+" is not an object")}},2724:function(t,e,i){"use strict";var n=i(1795),r=i(7739),o=i(4104);t.exports=function(t){for(var e=n(this),i=o(e),a=arguments.length,s=r(a>1?arguments[1]:void 0,i),l=a>2?arguments[2]:void 0,c=void 0===l?i:r(l,i);c>s;)e[s++]=t;return e}},7397:function(t,e,i){"use strict";var n=i(454).forEach,r=i(424)("forEach");t.exports=r?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},841:function(t,e,i){"use strict";var n=i(8043),r=i(1795),o=i(1635),a=i(6109),s=i(2091),l=i(4104),c=i(9361),u=i(1669),h=i(8703);t.exports=function(t){var e=r(t),i=s(this),f=arguments.length,g=f>1?arguments[1]:void 0,d=void 0!==g;d&&(g=n(g,f>2?arguments[2]:void 0,2));var v,p,m,y,b,x,C=h(e),I=0;if(!C||this==Array&&a(C))for(v=l(e),p=i?new this(v):Array(v);v>I;I++)x=d?g(e[I],I):e[I],c(p,I,x);else for(b=(y=u(e,C)).next,p=i?new this:[];!(m=b.call(y)).done;I++)x=d?o(y,g,[m.value,I],!0):m.value,c(p,I,x);return p.length=I,p}},8180:function(t,e,i){var n=i(101),r=i(7739),o=i(4104),a=function(t){return function(e,i,a){var s,l=n(e),c=o(l),u=r(a,c);if(t&&i!=i){for(;c>u;)if((s=l[u++])!=s)return!0}else for(;c>u;u++)if((t||u in l)&&l[u]===i)return t||u||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},454:function(t,e,i){var n=i(8043),r=i(2202),o=i(1795),a=i(4104),s=i(1321),l=[].push,c=function(t){var e=1==t,i=2==t,c=3==t,u=4==t,h=6==t,f=7==t,g=5==t||h;return function(d,v,p,m){for(var y,b,x=o(d),C=r(x),I=n(v,p,3),_=a(C),M=0,S=m||s,w=e?S(d,_):i||f?S(d,0):void 0;_>M;M++)if((g||M in C)&&(b=I(y=C[M],M,x),t))if(e)w[M]=b;else if(b)switch(t){case 3:return!0;case 5:return y;case 6:return M;case 2:l.call(w,y)}else switch(t){case 4:return!1;case 7:l.call(w,y)}return h?-1:c||u?u:w}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6),filterReject:c(7)}},242:function(t,e,i){var n=i(6192),r=i(8182),o=i(4218),a=r("species");t.exports=function(t){return o>=51||!n((function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},424:function(t,e,i){"use strict";var n=i(6192);t.exports=function(t,e){var i=[][t];return!!i&&n((function(){i.call(null,e||function(){throw 1},1)}))}},3712:function(t,e,i){var n=i(4770),r=i(2091),o=i(5744),a=i(8182)("species");t.exports=function(t){var e;return n(t)&&(e=t.constructor,(r(e)&&(e===Array||n(e.prototype))||o(e)&&null===(e=e[a]))&&(e=void 0)),void 0===e?Array:e}},1321:function(t,e,i){var n=i(3712);t.exports=function(t,e){return new(n(t))(0===e?0:e)}},1635:function(t,e,i){var n=i(1138),r=i(6639);t.exports=function(t,e,i,o){try{return o?e(n(i)[0],i[1]):e(i)}catch(e){r(t,"throw",e)}}},9770:function(t,e,i){var n=i(8182)("iterator"),r=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){r=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!r)return!1;var i=!1;try{var o={};o[n]=function(){return{next:function(){return{done:i=!0}}}},t(o)}catch(t){}return i}},9272:function(t){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},4696:function(t,e,i){var n=i(3471),r=i(6447),o=i(9272),a=i(8182)("toStringTag"),s="Arguments"==o(function(){return arguments}());t.exports=n?o:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),a))?i:s?o(e):"Object"==(n=o(e))&&r(e.callee)?"Arguments":n}},4635:function(t,e,i){var n=i(6192);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},5148:function(t,e,i){"use strict";var n=i(4413).IteratorPrototype,r=i(2853),o=i(774),a=i(1284),s=i(7771),l=function(){return this};t.exports=function(t,e,i){var c=e+" Iterator";return t.prototype=r(n,{next:o(1,i)}),a(t,c,!1,!0),s[c]=l,t}},8711:function(t,e,i){var n=i(69),r=i(2760),o=i(774);t.exports=n?function(t,e,i){return r.f(t,e,o(1,i))}:function(t,e,i){return t[e]=i,t}},774:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},9361:function(t,e,i){"use strict";var n=i(77),r=i(2760),o=i(774);t.exports=function(t,e,i){var a=n(e);a in t?r.f(t,a,o(0,i)):t[a]=i}},7218:function(t,e,i){"use strict";var n=i(3085),r=i(5546),o=i(2282),a=i(6447),s=i(5148),l=i(9341),c=i(4469),u=i(1284),h=i(8711),f=i(9482),g=i(8182),d=i(7771),v=i(4413),p=o.PROPER,m=o.CONFIGURABLE,y=v.IteratorPrototype,b=v.BUGGY_SAFARI_ITERATORS,x=g("iterator"),C="keys",I="values",_="entries",M=function(){return this};t.exports=function(t,e,i,o,g,v,S){s(i,e,o);var w,k,T,D=function(t){if(t===g&&L)return L;if(!b&&t in O)return O[t];switch(t){case C:return function(){return new i(this,t)};case I:return function(){return new i(this,t)};case _:return function(){return new i(this,t)}}return function(){return new i(this)}},A=e+" Iterator",j=!1,O=t.prototype,E=O[x]||O["@@iterator"]||g&&O[g],L=!b&&E||D(g),N="Array"==e&&O.entries||E;if(N&&(w=l(N.call(new t)))!==Object.prototype&&w.next&&(r||l(w)===y||(c?c(w,y):a(w[x])||f(w,x,M)),u(w,A,!0,!0),r&&(d[A]=M)),p&&g==I&&E&&E.name!==I&&(!r&&m?h(O,"name",I):(j=!0,L=function(){return E.call(this)})),g)if(k={values:D(I),keys:v?L:D(C),entries:D(_)},S)for(T in k)(b||j||!(T in O))&&f(O,T,k[T]);else n({target:e,proto:!0,forced:b||j},k);return r&&!S||O[x]===L||f(O,x,L,{name:g}),d[e]=L,k}},1488:function(t,e,i){var n=i(7545),r=i(4500),o=i(9207),a=i(2760).f;t.exports=function(t){var e=n.Symbol||(n.Symbol={});r(e,t)||a(e,t,{value:o.f(t)})}},69:function(t,e,i){var n=i(6192);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},7449:function(t,e,i){var n=i(8576),r=i(5744),o=n.document,a=r(o)&&r(o.createElement);t.exports=function(t){return a?o.createElement(t):{}}},7365:function(t){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},2957:function(t){t.exports="object"==typeof window},9347:function(t,e,i){var n=i(8989),r=i(8576);t.exports=/ipad|iphone|ipod/i.test(n)&&void 0!==r.Pebble},9536:function(t,e,i){var n=i(8989);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(n)},224:function(t,e,i){var n=i(9272),r=i(8576);t.exports="process"==n(r.process)},5914:function(t,e,i){var n=i(8989);t.exports=/web0s(?!.*chrome)/i.test(n)},8989:function(t,e,i){var n=i(150);t.exports=n("navigator","userAgent")||""},4218:function(t,e,i){var n,r,o=i(8576),a=i(8989),s=o.process,l=o.Deno,c=s&&s.versions||l&&l.version,u=c&&c.v8;u?r=(n=u.split("."))[0]<4?1:n[0]+n[1]:a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(r=n[1]),t.exports=r&&+r},5607:function(t,e,i){var n=i(7545);t.exports=function(t){return n[t+"Prototype"]}},2952:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3085:function(t,e,i){"use strict";var n=i(8576),r=i(6447),o=i(5141).f,a=i(9245),s=i(7545),l=i(8043),c=i(8711),u=i(4500),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.prototype=t.prototype,e};t.exports=function(t,e){var i,f,g,d,v,p,m,y,b=t.target,x=t.global,C=t.stat,I=t.proto,_=x?n:C?n[b]:(n[b]||{}).prototype,M=x?s:s[b]||c(s,b,{})[b],S=M.prototype;for(g in e)i=!a(x?g:b+(C?".":"#")+g,t.forced)&&_&&u(_,g),v=M[g],i&&(p=t.noTargetGet?(y=o(_,g))&&y.value:_[g]),d=i&&p?p:e[g],i&&typeof v==typeof d||(m=t.bind&&i?l(d,n):t.wrap&&i?h(d):I&&r(d)?l(Function.call,d):d,(t.sham||d&&d.sham||v&&v.sham)&&c(m,"sham",!0),c(M,g,m),I&&(u(s,f=b+"Prototype")||c(s,f,{}),c(s[f],g,d),t.real&&S&&!S[g]&&c(S,g,d)))}},6192:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},8043:function(t,e,i){var n=i(6235);t.exports=function(t,e,i){if(n(t),void 0===e)return t;switch(i){case 0:return function(){return t.call(e)};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)}}},6782:function(t,e,i){"use strict";var n=i(6235),r=i(5744),o=[].slice,a={},s=function(t,e,i){if(!(e in a)){for(var n=[],r=0;r<e;r++)n[r]="a["+r+"]";a[e]=Function("C,a","return new C("+n.join(",")+")")}return a[e](t,i)};t.exports=Function.bind||function(t){var e=n(this),i=o.call(arguments,1),a=function(){var n=i.concat(o.call(arguments));return this instanceof a?s(e,n.length,n):e.apply(t,n)};return r(e.prototype)&&(a.prototype=e.prototype),a}},2282:function(t,e,i){var n=i(69),r=i(4500),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=r(o,"name"),l=s&&"something"===function(){}.name,c=s&&(!n||n&&a(o,"name").configurable);t.exports={EXISTS:s,PROPER:l,CONFIGURABLE:c}},150:function(t,e,i){var n=i(7545),r=i(8576),o=i(6447),a=function(t){return o(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?a(n[t])||a(r[t]):n[t]&&n[t][e]||r[t]&&r[t][e]}},8703:function(t,e,i){var n=i(4696),r=i(5037),o=i(7771),a=i(8182)("iterator");t.exports=function(t){if(null!=t)return r(t,a)||r(t,"@@iterator")||o[n(t)]}},1669:function(t,e,i){var n=i(6235),r=i(1138),o=i(8703);t.exports=function(t,e){var i=arguments.length<2?o(t):e;if(n(i))return r(i.call(t));throw TypeError(String(t)+" is not iterable")}},5037:function(t,e,i){var n=i(6235);t.exports=function(t,e){var i=t[e];return null==i?void 0:n(i)}},8576:function(t,e,i){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof i.g&&i.g)||function(){return this}()||Function("return this")()},4500:function(t,e,i){var n=i(1795),r={}.hasOwnProperty;t.exports=Object.hasOwn||function(t,e){return r.call(n(t),e)}},4535:function(t){t.exports={}},3681:function(t,e,i){var n=i(8576);t.exports=function(t,e){var i=n.console;i&&i.error&&(1===arguments.length?i.error(t):i.error(t,e))}},7403:function(t,e,i){var n=i(150);t.exports=n("document","documentElement")},188:function(t,e,i){var n=i(69),r=i(6192),o=i(7449);t.exports=!n&&!r((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},2202:function(t,e,i){var n=i(6192),r=i(9272),o="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==r(t)?o.call(t,""):Object(t)}:Object},9516:function(t,e,i){var n=i(6447),r=i(6434),o=Function.toString;n(r.inspectSource)||(r.inspectSource=function(t){return o.call(t)}),t.exports=r.inspectSource},273:function(t,e,i){var n=i(5744),r=i(8711);t.exports=function(t,e){n(e)&&"cause"in e&&r(t,"cause",t.cause)}},3326:function(t,e,i){var n,r,o,a=i(8921),s=i(8576),l=i(5744),c=i(8711),u=i(4500),h=i(6434),f=i(9766),g=i(4535),d="Object already initialized",v=s.WeakMap;if(a||h.state){var p=h.state||(h.state=new v),m=p.get,y=p.has,b=p.set;n=function(t,e){if(y.call(p,t))throw new TypeError(d);return e.facade=t,b.call(p,t,e),e},r=function(t){return m.call(p,t)||{}},o=function(t){return y.call(p,t)}}else{var x=f("state");g[x]=!0,n=function(t,e){if(u(t,x))throw new TypeError(d);return e.facade=t,c(t,x,e),e},r=function(t){return u(t,x)?t[x]:{}},o=function(t){return u(t,x)}}t.exports={set:n,get:r,has:o,enforce:function(t){return o(t)?r(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=r(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return i}}}},6109:function(t,e,i){var n=i(8182),r=i(7771),o=n("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||a[o]===t)}},4770:function(t,e,i){var n=i(9272);t.exports=Array.isArray||function(t){return"Array"==n(t)}},6447:function(t){t.exports=function(t){return"function"==typeof t}},2091:function(t,e,i){var n=i(6192),r=i(6447),o=i(4696),a=i(150),s=i(9516),l=[],c=a("Reflect","construct"),u=/^\s*(?:class|function)\b/,h=u.exec,f=!u.exec((function(){})),g=function(t){if(!r(t))return!1;try{return c(Object,l,t),!0}catch(t){return!1}};t.exports=!c||n((function(){var t;return g(g.call)||!g(Object)||!g((function(){t=!0}))||t}))?function(t){if(!r(t))return!1;switch(o(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return f||!!h.call(u,s(t))}:g},9245:function(t,e,i){var n=i(6192),r=i(6447),o=/#|\.prototype\./,a=function(t,e){var i=l[s(t)];return i==u||i!=c&&(r(e)?n(e):!!e)},s=a.normalize=function(t){return String(t).replace(o,".").toLowerCase()},l=a.data={},c=a.NATIVE="N",u=a.POLYFILL="P";t.exports=a},5744:function(t,e,i){var n=i(6447);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},5546:function(t){t.exports=!0},3236:function(t,e,i){var n=i(6447),r=i(150),o=i(615);t.exports=o?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return n(e)&&Object(t)instanceof e}},3442:function(t,e,i){var n=i(1138),r=i(6109),o=i(4104),a=i(8043),s=i(1669),l=i(8703),c=i(6639),u=function(t,e){this.stopped=t,this.result=e};t.exports=function(t,e,i){var h,f,g,d,v,p,m,y=i&&i.that,b=!(!i||!i.AS_ENTRIES),x=!(!i||!i.IS_ITERATOR),C=!(!i||!i.INTERRUPTED),I=a(e,y,1+b+C),_=function(t){return h&&c(h,"normal",t),new u(!0,t)},M=function(t){return b?(n(t),C?I(t[0],t[1],_):I(t[0],t[1])):C?I(t,_):I(t)};if(x)h=t;else{if(!(f=l(t)))throw TypeError(String(t)+" is not iterable");if(r(f)){for(g=0,d=o(t);d>g;g++)if((v=M(t[g]))&&v instanceof u)return v;return new u(!1)}h=s(t,f)}for(p=h.next;!(m=p.call(h)).done;){try{v=M(m.value)}catch(t){c(h,"throw",t)}if("object"==typeof v&&v&&v instanceof u)return v}return new u(!1)}},6639:function(t,e,i){var n=i(1138),r=i(5037);t.exports=function(t,e,i){var o,a;n(t);try{if(!(o=r(t,"return"))){if("throw"===e)throw i;return i}o=o.call(t)}catch(t){a=!0,o=t}if("throw"===e)throw i;if(a)throw o;return n(o),i}},4413:function(t,e,i){"use strict";var n,r,o,a=i(6192),s=i(6447),l=i(2853),c=i(9341),u=i(9482),h=i(8182),f=i(5546),g=h("iterator"),d=!1;[].keys&&("next"in(o=[].keys())?(r=c(c(o)))!==Object.prototype&&(n=r):d=!0),null==n||a((function(){var t={};return n[g].call(t)!==t}))?n={}:f&&(n=l(n)),s(n[g])||u(n,g,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:d}},7771:function(t){t.exports={}},4104:function(t,e,i){var n=i(8445);t.exports=function(t){return n(t.length)}},2950:function(t,e,i){var n,r,o,a,s,l,c,u,h=i(8576),f=i(5141).f,g=i(7160).set,d=i(9536),v=i(9347),p=i(5914),m=i(224),y=h.MutationObserver||h.WebKitMutationObserver,b=h.document,x=h.process,C=h.Promise,I=f(h,"queueMicrotask"),_=I&&I.value;_||(n=function(){var t,e;for(m&&(t=x.domain)&&t.exit();r;){e=r.fn,r=r.next;try{e()}catch(t){throw r?a():o=void 0,t}}o=void 0,t&&t.enter()},d||m||p||!y||!b?!v&&C&&C.resolve?((c=C.resolve(void 0)).constructor=C,u=c.then,a=function(){u.call(c,n)}):a=m?function(){x.nextTick(n)}:function(){g.call(h,n)}:(s=!0,l=b.createTextNode(""),new y(n).observe(l,{characterData:!0}),a=function(){l.data=s=!s})),t.exports=_||function(t){var e={fn:t,next:void 0};o&&(o.next=e),r||(r=e,a()),o=e}},4471:function(t,e,i){var n=i(8576);t.exports=n.Promise},3045:function(t,e,i){var n=i(4218),r=i(6192);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},4551:function(t,e,i){var n=i(6192),r=i(8182),o=i(5546),a=r("iterator");t.exports=!n((function(){var t=new URL("b?a=1&b=2&c=3","http://a"),e=t.searchParams,i="";return t.pathname="c%20d",e.forEach((function(t,n){e.delete("b"),i+=n+t})),o&&!t.toJSON||!e.sort||"http://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[a]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==i||"x"!==new URL("http://x",void 0).host}))},8921:function(t,e,i){var n=i(8576),r=i(6447),o=i(9516),a=n.WeakMap;t.exports=r(a)&&/native code/.test(o(a))},9438:function(t,e,i){"use strict";var n=i(6235),r=function(t){var e,i;this.promise=new t((function(t,n){if(void 0!==e||void 0!==i)throw TypeError("Bad Promise constructor");e=t,i=n})),this.resolve=n(e),this.reject=n(i)};t.exports.f=function(t){return new r(t)}},15:function(t,e,i){var n=i(8576),r=i(6192),o=i(4845),a=i(4277).trim,s=i(1450),l=n.parseFloat,c=n.Symbol,u=c&&c.iterator,h=1/l(s+"-0")!=-1/0||u&&!r((function(){l(Object(u))}));t.exports=h?function(t){var e=a(o(t)),i=l(e);return 0===i&&"-"==e.charAt(0)?-0:i}:l},2558:function(t,e,i){var n=i(8576),r=i(6192),o=i(4845),a=i(4277).trim,s=i(1450),l=n.parseInt,c=n.Symbol,u=c&&c.iterator,h=/^[+-]?0[Xx]/,f=8!==l(s+"08")||22!==l(s+"0x16")||u&&!r((function(){l(Object(u))}));t.exports=f?function(t,e){var i=a(o(t));return l(i,e>>>0||(h.test(i)?16:10))}:l},2503:function(t,e,i){"use strict";var n=i(69),r=i(6192),o=i(7653),a=i(4750),s=i(6007),l=i(1795),c=i(2202),u=Object.assign,h=Object.defineProperty;t.exports=!u||r((function(){if(n&&1!==u({b:1},u(h({},"a",{enumerable:!0,get:function(){h(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},i=Symbol(),r="abcdefghijklmnopqrst";return t[i]=7,r.split("").forEach((function(t){e[t]=t})),7!=u({},t)[i]||o(u({},e)).join("")!=r}))?function(t,e){for(var i=l(t),r=arguments.length,u=1,h=a.f,f=s.f;r>u;)for(var g,d=c(arguments[u++]),v=h?o(d).concat(h(d)):o(d),p=v.length,m=0;p>m;)g=v[m++],n&&!f.call(d,g)||(i[g]=d[g]);return i}:u},2853:function(t,e,i){var n,r=i(1138),o=i(1187),a=i(2952),s=i(4535),l=i(7403),c=i(7449),u=i(9766),h=u("IE_PROTO"),f=function(){},g=function(t){return"<script>"+t+"</"+"script>"},d=function(t){t.write(g("")),t.close();var e=t.parentWindow.Object;return t=null,e},v=function(){try{n=new ActiveXObject("htmlfile")}catch(t){}var t,e;v="undefined"!=typeof document?document.domain&&n?d(n):((e=c("iframe")).style.display="none",l.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(g("document.F=Object")),t.close(),t.F):d(n);for(var i=a.length;i--;)delete v.prototype[a[i]];return v()};s[h]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(f.prototype=r(t),i=new f,f.prototype=null,i[h]=t):i=v(),void 0===e?i:o(i,e)}},1187:function(t,e,i){var n=i(69),r=i(2760),o=i(1138),a=i(7653);t.exports=n?Object.defineProperties:function(t,e){o(t);for(var i,n=a(e),s=n.length,l=0;s>l;)r.f(t,i=n[l++],e[i]);return t}},2760:function(t,e,i){var n=i(69),r=i(188),o=i(1138),a=i(77),s=Object.defineProperty;e.f=n?s:function(t,e,i){if(o(t),e=a(e),o(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}},5141:function(t,e,i){var n=i(69),r=i(6007),o=i(774),a=i(101),s=i(77),l=i(4500),c=i(188),u=Object.getOwnPropertyDescriptor;e.f=n?u:function(t,e){if(t=a(t),e=s(e),c)try{return u(t,e)}catch(t){}if(l(t,e))return o(!r.f.call(t,e),t[e])}},4052:function(t,e,i){var n=i(101),r=i(2092).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==o.call(t)?function(t){try{return r(t)}catch(t){return a.slice()}}(t):r(n(t))}},2092:function(t,e,i){var n=i(7934),r=i(2952).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,r)}},4750:function(t,e){e.f=Object.getOwnPropertySymbols},9341:function(t,e,i){var n=i(4500),r=i(6447),o=i(1795),a=i(9766),s=i(4635),l=a("IE_PROTO"),c=Object.prototype;t.exports=s?Object.getPrototypeOf:function(t){var e=o(t);if(n(e,l))return e[l];var i=e.constructor;return r(i)&&e instanceof i?i.prototype:e instanceof Object?c:null}},7934:function(t,e,i){var n=i(4500),r=i(101),o=i(8180).indexOf,a=i(4535);t.exports=function(t,e){var i,s=r(t),l=0,c=[];for(i in s)!n(a,i)&&n(s,i)&&c.push(i);for(;e.length>l;)n(s,i=e[l++])&&(~o(c,i)||c.push(i));return c}},7653:function(t,e,i){var n=i(7934),r=i(2952);t.exports=Object.keys||function(t){return n(t,r)}},6007:function(t,e){"use strict";var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);e.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},4469:function(t,e,i){var n=i(1138),r=i(7757);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(i,[]),e=i instanceof Array}catch(t){}return function(i,o){return n(i),r(o),e?t.call(i,o):i.__proto__=o,i}}():void 0)},158:function(t,e,i){"use strict";var n=i(3471),r=i(4696);t.exports=n?{}.toString:function(){return"[object "+r(this)+"]"}},380:function(t,e,i){var n=i(6447),r=i(5744);t.exports=function(t,e){var i,o;if("string"===e&&n(i=t.toString)&&!r(o=i.call(t)))return o;if(n(i=t.valueOf)&&!r(o=i.call(t)))return o;if("string"!==e&&n(i=t.toString)&&!r(o=i.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},7545:function(t){t.exports={}},892:function(t){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},9126:function(t,e,i){var n=i(1138),r=i(5744),o=i(9438);t.exports=function(t,e){if(n(t),r(e)&&e.constructor===t)return e;var i=o.f(t);return(0,i.resolve)(e),i.promise}},533:function(t,e,i){var n=i(9482);t.exports=function(t,e,i){for(var r in e)i&&i.unsafe&&t[r]?t[r]=e[r]:n(t,r,e[r],i);return t}},9482:function(t,e,i){var n=i(8711);t.exports=function(t,e,i,r){r&&r.enumerable?t[e]=i:n(t,e,i)}},3209:function(t){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},7613:function(t,e,i){var n=i(8576);t.exports=function(t,e){try{Object.defineProperty(n,t,{value:e,configurable:!0,writable:!0})}catch(i){n[t]=e}return e}},3656:function(t,e,i){"use strict";var n=i(150),r=i(2760),o=i(8182),a=i(69),s=o("species");t.exports=function(t){var e=n(t),i=r.f;a&&e&&!e[s]&&i(e,s,{configurable:!0,get:function(){return this}})}},1284:function(t,e,i){var n=i(3471),r=i(2760).f,o=i(8711),a=i(4500),s=i(158),l=i(8182)("toStringTag");t.exports=function(t,e,i,c){if(t){var u=i?t:t.prototype;a(u,l)||r(u,l,{configurable:!0,value:e}),c&&!n&&o(u,"toString",s)}}},9766:function(t,e,i){var n=i(8717),r=i(2759),o=n("keys");t.exports=function(t){return o[t]||(o[t]=r(t))}},6434:function(t,e,i){var n=i(8576),r=i(7613),o="__core-js_shared__",a=n[o]||r(o,{});t.exports=a},8717:function(t,e,i){var n=i(5546),r=i(6434);(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.18.2",mode:n?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},4743:function(t,e,i){var n=i(1138),r=i(1404),o=i(8182)("species");t.exports=function(t,e){var i,a=n(t).constructor;return void 0===a||null==(i=n(a)[o])?e:r(i)}},863:function(t,e,i){var n=i(1941),r=i(4845),o=i(3209),a=function(t){return function(e,i){var a,s,l=r(o(e)),c=n(i),u=l.length;return c<0||c>=u?t?"":void 0:(a=l.charCodeAt(c))<55296||a>56319||c+1===u||(s=l.charCodeAt(c+1))<56320||s>57343?t?l.charAt(c):a:t?l.slice(c,c+2):s-56320+(a-55296<<10)+65536}};t.exports={codeAt:a(!1),charAt:a(!0)}},7977:function(t){"use strict";var e=2147483647,i=/[^\0-\u007E]/,n=/[.\u3002\uFF0E\uFF61]/g,r="Overflow: input needs wider integers to process",o=Math.floor,a=String.fromCharCode,s=function(t){return t+22+75*(t<26)},l=function(t,e,i){var n=0;for(t=i?o(t/700):t>>1,t+=o(t/e);t>455;n+=36)t=o(t/35);return o(n+36*t/(t+38))},c=function(t){var i=[];t=function(t){for(var e=[],i=0,n=t.length;i<n;){var r=t.charCodeAt(i++);if(r>=55296&&r<=56319&&i<n){var o=t.charCodeAt(i++);56320==(64512&o)?e.push(((1023&r)<<10)+(1023&o)+65536):(e.push(r),i--)}else e.push(r)}return e}(t);var n,c,u=t.length,h=128,f=0,g=72;for(n=0;n<t.length;n++)(c=t[n])<128&&i.push(a(c));var d=i.length,v=d;for(d&&i.push("-");v<u;){var p=e;for(n=0;n<t.length;n++)(c=t[n])>=h&&c<p&&(p=c);var m=v+1;if(p-h>o((e-f)/m))throw RangeError(r);for(f+=(p-h)*m,h=p,n=0;n<t.length;n++){if((c=t[n])<h&&++f>e)throw RangeError(r);if(c==h){for(var y=f,b=36;;b+=36){var x=b<=g?1:b>=g+26?26:b-g;if(y<x)break;var C=y-x,I=36-x;i.push(a(s(x+C%I))),y=o(C/I)}i.push(a(s(y))),g=l(f,m,v==d),f=0,++v}}++f,++h}return i.join("")};t.exports=function(t){var e,r,o=[],a=t.toLowerCase().replace(n,".").split(".");for(e=0;e<a.length;e++)r=a[e],o.push(i.test(r)?"xn--"+c(r):r);return o.join(".")}},6815:function(t,e,i){var n=i(2282).PROPER,r=i(6192),o=i(1450);t.exports=function(t){return r((function(){return!!o[t]()||"…"!=="…"[t]()||n&&o[t].name!==t}))}},4277:function(t,e,i){var n=i(3209),r=i(4845),o="["+i(1450)+"]",a=RegExp("^"+o+o+"*"),s=RegExp(o+o+"*$"),l=function(t){return function(e){var i=r(n(e));return 1&t&&(i=i.replace(a,"")),2&t&&(i=i.replace(s,"")),i}};t.exports={start:l(1),end:l(2),trim:l(3)}},7160:function(t,e,i){var n,r,o,a,s=i(8576),l=i(6447),c=i(6192),u=i(8043),h=i(7403),f=i(7449),g=i(9536),d=i(224),v=s.setImmediate,p=s.clearImmediate,m=s.process,y=s.MessageChannel,b=s.Dispatch,x=0,C={},I="onreadystatechange";try{n=s.location}catch(t){}var _=function(t){if(C.hasOwnProperty(t)){var e=C[t];delete C[t],e()}},M=function(t){return function(){_(t)}},S=function(t){_(t.data)},w=function(t){s.postMessage(String(t),n.protocol+"//"+n.host)};v&&p||(v=function(t){for(var e=[],i=arguments.length,n=1;i>n;)e.push(arguments[n++]);return C[++x]=function(){(l(t)?t:Function(t)).apply(void 0,e)},r(x),x},p=function(t){delete C[t]},d?r=function(t){m.nextTick(M(t))}:b&&b.now?r=function(t){b.now(M(t))}:y&&!g?(a=(o=new y).port2,o.port1.onmessage=S,r=u(a.postMessage,a,1)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&n&&"file:"!==n.protocol&&!c(w)?(r=w,s.addEventListener("message",S,!1)):r=I in f("script")?function(t){h.appendChild(f("script")).onreadystatechange=function(){h.removeChild(this),_(t)}}:function(t){setTimeout(M(t),0)}),t.exports={set:v,clear:p}},7739:function(t,e,i){var n=i(1941),r=Math.max,o=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):o(i,e)}},101:function(t,e,i){var n=i(2202),r=i(3209);t.exports=function(t){return n(r(t))}},1941:function(t){var e=Math.ceil,i=Math.floor;t.exports=function(t){var n=+t;return n!=n||0===n?0:(n>0?i:e)(n)}},8445:function(t,e,i){var n=i(1941),r=Math.min;t.exports=function(t){return t>0?r(n(t),9007199254740991):0}},1795:function(t,e,i){var n=i(3209);t.exports=function(t){return Object(n(t))}},7888:function(t,e,i){var n=i(5744),r=i(3236),o=i(5037),a=i(380),s=i(8182)("toPrimitive");t.exports=function(t,e){if(!n(t)||r(t))return t;var i,l=o(t,s);if(l){if(void 0===e&&(e="default"),i=l.call(t,e),!n(i)||r(i))return i;throw TypeError("Can't convert object to primitive value")}return void 0===e&&(e="number"),a(t,e)}},77:function(t,e,i){var n=i(7888),r=i(3236);t.exports=function(t){var e=n(t,"string");return r(e)?e:String(e)}},3471:function(t,e,i){var n={};n[i(8182)("toStringTag")]="z",t.exports="[object z]"===String(n)},4845:function(t,e,i){var n=i(4696);t.exports=function(t){if("Symbol"===n(t))throw TypeError("Cannot convert a Symbol value to a string");return String(t)}},9288:function(t){t.exports=function(t){try{return String(t)}catch(t){return"Object"}}},2759:function(t){var e=0,i=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++e+i).toString(36)}},615:function(t,e,i){var n=i(3045);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},9207:function(t,e,i){var n=i(8182);e.f=n},8182:function(t,e,i){var n=i(8576),r=i(8717),o=i(4500),a=i(2759),s=i(3045),l=i(615),c=r("wks"),u=n.Symbol,h=l?u:u&&u.withoutSetter||a;t.exports=function(t){return o(c,t)&&(s||"string"==typeof c[t])||(s&&o(u,t)?c[t]=u[t]:c[t]=h("Symbol."+t)),c[t]}},1450:function(t){t.exports="\t\n\v\f\r    \u2028\u2029\ufeff"},4242:function(t,e,i){"use strict";var n=i(3085),r=i(9341),o=i(4469),a=i(2853),s=i(8711),l=i(774),c=i(273),u=i(3442),h=i(4845),f=function(t,e){var i=this,n=arguments.length>2?arguments[2]:void 0;if(!(i instanceof f))return new f(t,e,n);o&&(i=o(new Error(void 0),r(i))),void 0!==e&&s(i,"message",h(e)),c(i,n);var a=[];return u(t,a.push,{that:a}),s(i,"errors",a),i};f.prototype=a(Error.prototype,{constructor:l(5,f),message:l(5,""),name:l(5,"AggregateError")}),n({global:!0},{AggregateError:f})},9106:function(t,e,i){"use strict";var n=i(3085),r=i(6192),o=i(4770),a=i(5744),s=i(1795),l=i(4104),c=i(9361),u=i(1321),h=i(242),f=i(8182),g=i(4218),d=f("isConcatSpreadable"),v=9007199254740991,p="Maximum allowed index exceeded",m=g>=51||!r((function(){var t=[];return t[d]=!1,t.concat()[0]!==t})),y=h("concat"),b=function(t){if(!a(t))return!1;var e=t[d];return void 0!==e?!!e:o(t)};n({target:"Array",proto:!0,forced:!m||!y},{concat:function(t){var e,i,n,r,o,a=s(this),h=u(a,0),f=0;for(e=-1,n=arguments.length;e<n;e++)if(b(o=-1===e?a:arguments[e])){if(f+(r=l(o))>v)throw TypeError(p);for(i=0;i<r;i++,f++)i in o&&c(h,f,o[i])}else{if(f>=v)throw TypeError(p);c(h,f++,o)}return h.length=f,h}})},1710:function(t,e,i){var n=i(3085),r=i(2724),o=i(7423);n({target:"Array",proto:!0},{fill:r}),o("fill")},3436:function(t,e,i){"use strict";var n=i(3085),r=i(454).filter;n({target:"Array",proto:!0,forced:!i(242)("filter")},{filter:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},9823:function(t,e,i){"use strict";var n=i(3085),r=i(7397);n({target:"Array",proto:!0,forced:[].forEach!=r},{forEach:r})},9173:function(t,e,i){var n=i(3085),r=i(841);n({target:"Array",stat:!0,forced:!i(9770)((function(t){Array.from(t)}))},{from:r})},2276:function(t,e,i){"use strict";var n=i(3085),r=i(8180).indexOf,o=i(424),a=[].indexOf,s=!!a&&1/[1].indexOf(1,-0)<0,l=o("indexOf");n({target:"Array",proto:!0,forced:s||!l},{indexOf:function(t){return s?a.apply(this,arguments)||0:r(this,t,arguments.length>1?arguments[1]:void 0)}})},8118:function(t,e,i){i(3085)({target:"Array",stat:!0},{isArray:i(4770)})},8939:function(t,e,i){"use strict";var n=i(101),r=i(7423),o=i(7771),a=i(3326),s=i(7218),l="Array Iterator",c=a.set,u=a.getterFor(l);t.exports=s(Array,"Array",(function(t,e){c(this,{type:l,target:n(t),index:0,kind:e})}),(function(){var t=u(this),e=t.target,i=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:n,done:!1}:"values"==i?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},3838:function(t,e,i){"use strict";var n=i(3085),r=i(454).map;n({target:"Array",proto:!0,forced:!i(242)("map")},{map:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},5818:function(t,e,i){"use strict";var n=i(3085),r=i(4770),o=i(2091),a=i(5744),s=i(7739),l=i(4104),c=i(101),u=i(9361),h=i(8182),f=i(242)("slice"),g=h("species"),d=[].slice,v=Math.max;n({target:"Array",proto:!0,forced:!f},{slice:function(t,e){var i,n,h,f=c(this),p=l(f),m=s(t,p),y=s(void 0===e?p:e,p);if(r(f)&&(i=f.constructor,(o(i)&&(i===Array||r(i.prototype))||a(i)&&null===(i=i[g]))&&(i=void 0),i===Array||void 0===i))return d.call(f,m,y);for(n=new(void 0===i?Array:i)(v(y-m,0)),h=0;m<y;m++,h++)m in f&&u(n,h,f[m]);return n.length=h,n}})},2178:function(t,e,i){"use strict";var n=i(3085),r=i(7739),o=i(1941),a=i(4104),s=i(1795),l=i(1321),c=i(9361),u=i(242)("splice"),h=Math.max,f=Math.min,g=9007199254740991,d="Maximum allowed length exceeded";n({target:"Array",proto:!0,forced:!u},{splice:function(t,e){var i,n,u,v,p,m,y=s(this),b=a(y),x=r(t,b),C=arguments.length;if(0===C?i=n=0:1===C?(i=0,n=b-x):(i=C-2,n=f(h(o(e),0),b-x)),b+i-n>g)throw TypeError(d);for(u=l(y,n),v=0;v<n;v++)(p=x+v)in y&&c(u,v,y[p]);if(u.length=n,i<n){for(v=x;v<b-n;v++)m=v+i,(p=v+n)in y?y[m]=y[p]:delete y[m];for(v=b;v>b-n+i;v--)delete y[v-1]}else if(i>n)for(v=b-n;v>x;v--)m=v+i-1,(p=v+n-1)in y?y[m]=y[p]:delete y[m];for(v=0;v<i;v++)y[v+x]=arguments[v+2];return y.length=b-n+i,u}})},665:function(t,e,i){i(3085)({target:"Function",proto:!0},{bind:i(6782)})},8671:function(t,e,i){var n=i(8576);i(1284)(n.JSON,"JSON",!0)},8556:function(){},2666:function(t,e,i){var n=i(3085),r=i(2558);n({target:"Number",stat:!0,forced:Number.parseInt!=r},{parseInt:r})},3113:function(t,e,i){i(3085)({target:"Object",stat:!0,sham:!i(69)},{create:i(2853)})},297:function(t,e,i){var n=i(3085),r=i(69);n({target:"Object",stat:!0,forced:!r,sham:!r},{defineProperty:i(2760).f})},9234:function(t,e,i){var n=i(3085),r=i(6192),o=i(1795),a=i(9341),s=i(4635);n({target:"Object",stat:!0,forced:r((function(){a(1)})),sham:!s},{getPrototypeOf:function(t){return a(o(t))}})},2647:function(t,e,i){var n=i(3085),r=i(1795),o=i(7653);n({target:"Object",stat:!0,forced:i(6192)((function(){o(1)}))},{keys:function(t){return o(r(t))}})},3222:function(t,e,i){i(3085)({target:"Object",stat:!0},{setPrototypeOf:i(4469)})},6663:function(){},4859:function(t,e,i){var n=i(3085),r=i(15);n({global:!0,forced:parseFloat!=r},{parseFloat:r})},5706:function(t,e,i){var n=i(3085),r=i(2558);n({global:!0,forced:parseInt!=r},{parseInt:r})},7884:function(t,e,i){"use strict";var n=i(3085),r=i(6235),o=i(9438),a=i(892),s=i(3442);n({target:"Promise",stat:!0},{allSettled:function(t){var e=this,i=o.f(e),n=i.resolve,l=i.reject,c=a((function(){var i=r(e.resolve),o=[],a=0,l=1;s(t,(function(t){var r=a++,s=!1;o.push(void 0),l++,i.call(e,t).then((function(t){s||(s=!0,o[r]={status:"fulfilled",value:t},--l||n(o))}),(function(t){s||(s=!0,o[r]={status:"rejected",reason:t},--l||n(o))}))})),--l||n(o)}));return c.error&&l(c.value),i.promise}})},8885:function(t,e,i){"use strict";var n=i(3085),r=i(6235),o=i(150),a=i(9438),s=i(892),l=i(3442),c="No one promise resolved";n({target:"Promise",stat:!0},{any:function(t){var e=this,i=a.f(e),n=i.resolve,u=i.reject,h=s((function(){var i=r(e.resolve),a=[],s=0,h=1,f=!1;l(t,(function(t){var r=s++,l=!1;a.push(void 0),h++,i.call(e,t).then((function(t){l||f||(f=!0,n(t))}),(function(t){l||f||(l=!0,a[r]=t,--h||u(new(o("AggregateError"))(a,c)))}))})),--h||u(new(o("AggregateError"))(a,c))}));return h.error&&u(h.value),i.promise}})},1868:function(t,e,i){"use strict";var n=i(3085),r=i(5546),o=i(4471),a=i(6192),s=i(150),l=i(6447),c=i(4743),u=i(9126),h=i(9482);if(n({target:"Promise",proto:!0,real:!0,forced:!!o&&a((function(){o.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var e=c(this,s("Promise")),i=l(t);return this.then(i?function(i){return u(e,t()).then((function(){return i}))}:t,i?function(i){return u(e,t()).then((function(){throw i}))}:t)}}),!r&&l(o)){var f=s("Promise").prototype.finally;o.prototype.finally!==f&&h(o.prototype,"finally",f,{unsafe:!0})}},9021:function(t,e,i){"use strict";var n,r,o,a,s=i(3085),l=i(5546),c=i(8576),u=i(150),h=i(4471),f=i(9482),g=i(533),d=i(4469),v=i(1284),p=i(3656),m=i(6235),y=i(6447),b=i(5744),x=i(6961),C=i(9516),I=i(3442),_=i(9770),M=i(4743),S=i(7160).set,w=i(2950),k=i(9126),T=i(3681),D=i(9438),A=i(892),j=i(3326),O=i(9245),E=i(8182),L=i(2957),N=i(224),P=i(4218),z=E("species"),B="Promise",R=j.get,F=j.set,Y=j.getterFor(B),W=h&&h.prototype,H=h,U=W,G=c.TypeError,X=c.document,Z=c.process,V=D.f,J=V,Q=!!(X&&X.createEvent&&c.dispatchEvent),K=y(c.PromiseRejectionEvent),q="unhandledrejection",$=!1,tt=O(B,(function(){var t=C(H),e=t!==String(H);if(!e&&66===P)return!0;if(l&&!U.finally)return!0;if(P>=51&&/native code/.test(t))return!1;var i=new H((function(t){t(1)})),n=function(t){t((function(){}),(function(){}))};return(i.constructor={})[z]=n,!($=i.then((function(){}))instanceof n)||!e&&L&&!K})),et=tt||!_((function(t){H.all(t).catch((function(){}))})),it=function(t){var e;return!(!b(t)||!y(e=t.then))&&e},nt=function(t,e){if(!t.notified){t.notified=!0;var i=t.reactions;w((function(){for(var n=t.value,r=1==t.state,o=0;i.length>o;){var a,s,l,c=i[o++],u=r?c.ok:c.fail,h=c.resolve,f=c.reject,g=c.domain;try{u?(r||(2===t.rejection&&st(t),t.rejection=1),!0===u?a=n:(g&&g.enter(),a=u(n),g&&(g.exit(),l=!0)),a===c.promise?f(G("Promise-chain cycle")):(s=it(a))?s.call(a,h,f):h(a)):f(n)}catch(t){g&&!l&&g.exit(),f(t)}}t.reactions=[],t.notified=!1,e&&!t.rejection&&ot(t)}))}},rt=function(t,e,i){var n,r;Q?((n=X.createEvent("Event")).promise=e,n.reason=i,n.initEvent(t,!1,!0),c.dispatchEvent(n)):n={promise:e,reason:i},!K&&(r=c["on"+t])?r(n):t===q&&T("Unhandled promise rejection",i)},ot=function(t){S.call(c,(function(){var e,i=t.facade,n=t.value;if(at(t)&&(e=A((function(){N?Z.emit("unhandledRejection",n,i):rt(q,i,n)})),t.rejection=N||at(t)?2:1,e.error))throw e.value}))},at=function(t){return 1!==t.rejection&&!t.parent},st=function(t){S.call(c,(function(){var e=t.facade;N?Z.emit("rejectionHandled",e):rt("rejectionhandled",e,t.value)}))},lt=function(t,e,i){return function(n){t(e,n,i)}},ct=function(t,e,i){t.done||(t.done=!0,i&&(t=i),t.value=e,t.state=2,nt(t,!0))},ut=function(t,e,i){if(!t.done){t.done=!0,i&&(t=i);try{if(t.facade===e)throw G("Promise can't be resolved itself");var n=it(e);n?w((function(){var i={done:!1};try{n.call(e,lt(ut,i,t),lt(ct,i,t))}catch(e){ct(i,e,t)}})):(t.value=e,t.state=1,nt(t,!1))}catch(e){ct({done:!1},e,t)}}};if(tt&&(U=(H=function(t){x(this,H,B),m(t),n.call(this);var e=R(this);try{t(lt(ut,e),lt(ct,e))}catch(t){ct(e,t)}}).prototype,(n=function(t){F(this,{type:B,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=g(U,{then:function(t,e){var i=Y(this),n=V(M(this,H));return n.ok=!y(t)||t,n.fail=y(e)&&e,n.domain=N?Z.domain:void 0,i.parent=!0,i.reactions.push(n),0!=i.state&&nt(i,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),r=function(){var t=new n,e=R(t);this.promise=t,this.resolve=lt(ut,e),this.reject=lt(ct,e)},D.f=V=function(t){return t===H||t===o?new r(t):J(t)},!l&&y(h)&&W!==Object.prototype)){a=W.then,$||(f(W,"then",(function(t,e){var i=this;return new H((function(t,e){a.call(i,t,e)})).then(t,e)}),{unsafe:!0}),f(W,"catch",U.catch,{unsafe:!0}));try{delete W.constructor}catch(t){}d&&d(W,U)}s({global:!0,wrap:!0,forced:tt},{Promise:H}),v(H,B,!1,!0),p(B),o=u(B),s({target:B,stat:!0,forced:tt},{reject:function(t){var e=V(this);return e.reject.call(void 0,t),e.promise}}),s({target:B,stat:!0,forced:l||tt},{resolve:function(t){return k(l&&this===o?H:this,t)}}),s({target:B,stat:!0,forced:et},{all:function(t){var e=this,i=V(e),n=i.resolve,r=i.reject,o=A((function(){var i=m(e.resolve),o=[],a=0,s=1;I(t,(function(t){var l=a++,c=!1;o.push(void 0),s++,i.call(e,t).then((function(t){c||(c=!0,o[l]=t,--s||n(o))}),r)})),--s||n(o)}));return o.error&&r(o.value),i.promise},race:function(t){var e=this,i=V(e),n=i.reject,r=A((function(){var r=m(e.resolve);I(t,(function(t){r.call(e,t).then(i.resolve,n)}))}));return r.error&&n(r.value),i.promise}})},5397:function(t,e,i){var n=i(3085),r=i(150),o=i(1404),a=i(1138),s=i(5744),l=i(2853),c=i(6782),u=i(6192),h=r("Reflect","construct"),f=u((function(){function t(){}return!(h((function(){}),[],t)instanceof t)})),g=!u((function(){h((function(){}))})),d=f||g;n({target:"Reflect",stat:!0,forced:d,sham:d},{construct:function(t,e){o(t),a(e);var i=arguments.length<3?t:o(arguments[2]);if(g&&!f)return h(t,e,i);if(t==i){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var n=[null];return n.push.apply(n,e),new(c.apply(t,n))}var r=i.prototype,u=l(s(r)?r:Object.prototype),d=Function.apply.call(t,u,e);return s(d)?d:u}})},1367:function(){},5454:function(t,e,i){"use strict";var n=i(863).charAt,r=i(4845),o=i(3326),a=i(7218),s="String Iterator",l=o.set,c=o.getterFor(s);a(String,"String",(function(t){l(this,{type:s,string:r(t),index:0})}),(function(){var t,e=c(this),i=e.string,r=e.index;return r>=i.length?{value:void 0,done:!0}:(t=n(i,r),e.index+=t.length,{value:t,done:!1})}))},957:function(t,e,i){"use strict";var n=i(3085),r=i(4277).trim;n({target:"String",proto:!0,forced:i(6815)("trim")},{trim:function(){return r(this)}})},9781:function(t,e,i){i(1488)("asyncIterator")},492:function(){},6681:function(t,e,i){i(1488)("hasInstance")},9594:function(t,e,i){i(1488)("isConcatSpreadable")},3665:function(t,e,i){i(1488)("iterator")},6187:function(t,e,i){"use strict";var n=i(3085),r=i(8576),o=i(150),a=i(5546),s=i(69),l=i(3045),c=i(6192),u=i(4500),h=i(4770),f=i(6447),g=i(5744),d=i(3236),v=i(1138),p=i(1795),m=i(101),y=i(77),b=i(4845),x=i(774),C=i(2853),I=i(7653),_=i(2092),M=i(4052),S=i(4750),w=i(5141),k=i(2760),T=i(6007),D=i(9482),A=i(8717),j=i(9766),O=i(4535),E=i(2759),L=i(8182),N=i(9207),P=i(1488),z=i(1284),B=i(3326),R=i(454).forEach,F=j("hidden"),Y="Symbol",W=L("toPrimitive"),H=B.set,U=B.getterFor(Y),G=Object.prototype,X=r.Symbol,Z=o("JSON","stringify"),V=w.f,J=k.f,Q=M.f,K=T.f,q=A("symbols"),$=A("op-symbols"),tt=A("string-to-symbol-registry"),et=A("symbol-to-string-registry"),it=A("wks"),nt=r.QObject,rt=!nt||!nt.prototype||!nt.prototype.findChild,ot=s&&c((function(){return 7!=C(J({},"a",{get:function(){return J(this,"a",{value:7}).a}})).a}))?function(t,e,i){var n=V(G,e);n&&delete G[e],J(t,e,i),n&&t!==G&&J(G,e,n)}:J,at=function(t,e){var i=q[t]=C(X.prototype);return H(i,{type:Y,tag:t,description:e}),s||(i.description=e),i},st=function(t,e,i){t===G&&st($,e,i),v(t);var n=y(e);return v(i),u(q,n)?(i.enumerable?(u(t,F)&&t[F][n]&&(t[F][n]=!1),i=C(i,{enumerable:x(0,!1)})):(u(t,F)||J(t,F,x(1,{})),t[F][n]=!0),ot(t,n,i)):J(t,n,i)},lt=function(t,e){v(t);var i=m(e),n=I(i).concat(ft(i));return R(n,(function(e){s&&!ct.call(i,e)||st(t,e,i[e])})),t},ct=function(t){var e=y(t),i=K.call(this,e);return!(this===G&&u(q,e)&&!u($,e))&&(!(i||!u(this,e)||!u(q,e)||u(this,F)&&this[F][e])||i)},ut=function(t,e){var i=m(t),n=y(e);if(i!==G||!u(q,n)||u($,n)){var r=V(i,n);return!r||!u(q,n)||u(i,F)&&i[F][n]||(r.enumerable=!0),r}},ht=function(t){var e=Q(m(t)),i=[];return R(e,(function(t){u(q,t)||u(O,t)||i.push(t)})),i},ft=function(t){var e=t===G,i=Q(e?$:m(t)),n=[];return R(i,(function(t){!u(q,t)||e&&!u(G,t)||n.push(q[t])})),n};(l||(X=function(){if(this instanceof X)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?b(arguments[0]):void 0,e=E(t),i=function(t){this===G&&i.call($,t),u(this,F)&&u(this[F],e)&&(this[F][e]=!1),ot(this,e,x(1,t))};return s&&rt&&ot(G,e,{configurable:!0,set:i}),at(e,t)},D(X.prototype,"toString",(function(){return U(this).tag})),D(X,"withoutSetter",(function(t){return at(E(t),t)})),T.f=ct,k.f=st,w.f=ut,_.f=M.f=ht,S.f=ft,N.f=function(t){return at(L(t),t)},s&&(J(X.prototype,"description",{configurable:!0,get:function(){return U(this).description}}),a||D(G,"propertyIsEnumerable",ct,{unsafe:!0}))),n({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:X}),R(I(it),(function(t){P(t)})),n({target:Y,stat:!0,forced:!l},{for:function(t){var e=b(t);if(u(tt,e))return tt[e];var i=X(e);return tt[e]=i,et[i]=e,i},keyFor:function(t){if(!d(t))throw TypeError(t+" is not a symbol");if(u(et,t))return et[t]},useSetter:function(){rt=!0},useSimple:function(){rt=!1}}),n({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(t,e){return void 0===e?C(t):lt(C(t),e)},defineProperty:st,defineProperties:lt,getOwnPropertyDescriptor:ut}),n({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ht,getOwnPropertySymbols:ft}),n({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(t){return S.f(p(t))}}),Z)&&n({target:"JSON",stat:!0,forced:!l||c((function(){var t=X();return"[null]"!=Z([t])||"{}"!=Z({a:t})||"{}"!=Z(Object(t))}))},{stringify:function(t,e,i){for(var n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=e,(g(e)||void 0!==t)&&!d(t))return h(e)||(e=function(t,e){if(f(n)&&(e=n.call(this,t,e)),!d(e))return e}),r[1]=e,Z.apply(null,r)}});if(!X.prototype[W]){var gt=X.prototype.valueOf;D(X.prototype,W,(function(){return gt.apply(this,arguments)}))}z(X,Y),O[F]=!0},1250:function(t,e,i){i(1488)("matchAll")},9017:function(t,e,i){i(1488)("match")},9786:function(t,e,i){i(1488)("replace")},503:function(t,e,i){i(1488)("search")},6565:function(t,e,i){i(1488)("species")},9322:function(t,e,i){i(1488)("split")},3610:function(t,e,i){i(1488)("toPrimitive")},6886:function(t,e,i){i(1488)("toStringTag")},3514:function(t,e,i){i(1488)("unscopables")},177:function(t,e,i){i(1488)("asyncDispose")},9031:function(t,e,i){i(1488)("dispose")},6658:function(t,e,i){i(1488)("matcher")},1875:function(t,e,i){i(1488)("metadata")},8658:function(t,e,i){i(1488)("observable")},4592:function(t,e,i){i(1488)("patternMatch")},6680:function(t,e,i){i(1488)("replaceAll")},162:function(t,e,i){i(8939);var n=i(7365),r=i(8576),o=i(4696),a=i(8711),s=i(7771),l=i(8182)("toStringTag");for(var c in n){var u=r[c],h=u&&u.prototype;h&&o(h)!==l&&a(h,l,c),s[c]=s.Array}},2906:function(t,e,i){var n=i(3085),r=i(8576),o=i(6447),a=i(8989),s=[].slice,l=function(t){return function(e,i){var n=arguments.length>2,r=n?s.call(arguments,2):void 0;return t(n?function(){(o(e)?e:Function(e)).apply(this,r)}:e,i)}};n({global:!0,bind:!0,forced:/MSIE .\./.test(a)},{setTimeout:l(r.setTimeout),setInterval:l(r.setInterval)})},9336:function(t,e,i){"use strict";i(8939);var n=i(3085),r=i(150),o=i(4551),a=i(9482),s=i(533),l=i(1284),c=i(5148),u=i(3326),h=i(6961),f=i(6447),g=i(4500),d=i(8043),v=i(4696),p=i(1138),m=i(5744),y=i(4845),b=i(2853),x=i(774),C=i(1669),I=i(8703),_=i(8182),M=r("fetch"),S=r("Request"),w=S&&S.prototype,k=r("Headers"),T=_("iterator"),D="URLSearchParams",A="URLSearchParamsIterator",j=u.set,O=u.getterFor(D),E=u.getterFor(A),L=/\+/g,N=Array(4),P=function(t){return N[t-1]||(N[t-1]=RegExp("((?:%[\\da-f]{2}){"+t+"})","gi"))},z=function(t){try{return decodeURIComponent(t)}catch(e){return t}},B=function(t){var e=t.replace(L," "),i=4;try{return decodeURIComponent(e)}catch(t){for(;i;)e=e.replace(P(i--),z);return e}},R=/[!'()~]|%20/g,F={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Y=function(t){return F[t]},W=function(t){return encodeURIComponent(t).replace(R,Y)},H=function(t,e){if(e)for(var i,n,r=e.split("&"),o=0;o<r.length;)(i=r[o++]).length&&(n=i.split("="),t.push({key:B(n.shift()),value:B(n.join("="))}))},U=function(t){this.entries.length=0,H(this.entries,t)},G=function(t,e){if(t<e)throw TypeError("Not enough arguments")},X=c((function(t,e){j(this,{type:A,iterator:C(O(t).entries),kind:e})}),"Iterator",(function(){var t=E(this),e=t.kind,i=t.iterator.next(),n=i.value;return i.done||(i.value="keys"===e?n.key:"values"===e?n.value:[n.key,n.value]),i})),Z=function(){h(this,Z,D);var t,e,i,n,r,o,a,s,l,c=arguments.length>0?arguments[0]:void 0,u=this,f=[];if(j(u,{type:D,entries:f,updateURL:function(){},updateSearchParams:U}),void 0!==c)if(m(c))if(t=I(c))for(i=(e=C(c,t)).next;!(n=i.call(e)).done;){if((a=(o=(r=C(p(n.value))).next).call(r)).done||(s=o.call(r)).done||!o.call(r).done)throw TypeError("Expected sequence with length 2");f.push({key:y(a.value),value:y(s.value)})}else for(l in c)g(c,l)&&f.push({key:l,value:y(c[l])});else H(f,"string"==typeof c?"?"===c.charAt(0)?c.slice(1):c:y(c))},V=Z.prototype;if(s(V,{append:function(t,e){G(arguments.length,2);var i=O(this);i.entries.push({key:y(t),value:y(e)}),i.updateURL()},delete:function(t){G(arguments.length,1);for(var e=O(this),i=e.entries,n=y(t),r=0;r<i.length;)i[r].key===n?i.splice(r,1):r++;e.updateURL()},get:function(t){G(arguments.length,1);for(var e=O(this).entries,i=y(t),n=0;n<e.length;n++)if(e[n].key===i)return e[n].value;return null},getAll:function(t){G(arguments.length,1);for(var e=O(this).entries,i=y(t),n=[],r=0;r<e.length;r++)e[r].key===i&&n.push(e[r].value);return n},has:function(t){G(arguments.length,1);for(var e=O(this).entries,i=y(t),n=0;n<e.length;)if(e[n++].key===i)return!0;return!1},set:function(t,e){G(arguments.length,1);for(var i,n=O(this),r=n.entries,o=!1,a=y(t),s=y(e),l=0;l<r.length;l++)(i=r[l]).key===a&&(o?r.splice(l--,1):(o=!0,i.value=s));o||r.push({key:a,value:s}),n.updateURL()},sort:function(){var t,e,i,n=O(this),r=n.entries,o=r.slice();for(r.length=0,i=0;i<o.length;i++){for(t=o[i],e=0;e<i;e++)if(r[e].key>t.key){r.splice(e,0,t);break}e===i&&r.push(t)}n.updateURL()},forEach:function(t){for(var e,i=O(this).entries,n=d(t,arguments.length>1?arguments[1]:void 0,3),r=0;r<i.length;)n((e=i[r++]).value,e.key,this)},keys:function(){return new X(this,"keys")},values:function(){return new X(this,"values")},entries:function(){return new X(this,"entries")}},{enumerable:!0}),a(V,T,V.entries,{name:"entries"}),a(V,"toString",(function(){for(var t,e=O(this).entries,i=[],n=0;n<e.length;)t=e[n++],i.push(W(t.key)+"="+W(t.value));return i.join("&")}),{enumerable:!0}),l(Z,D),n({global:!0,forced:!o},{URLSearchParams:Z}),!o&&f(k)){var J=function(t){if(m(t)){var e,i=t.body;if(v(i)===D)return(e=t.headers?new k(t.headers):new k).has("content-type")||e.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),b(t,{body:x(0,String(i)),headers:x(0,e)})}return t};if(f(M)&&n({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return M(t,arguments.length>1?J(arguments[1]):{})}}),f(S)){var Q=function(t){return h(this,Q,"Request"),new S(t,arguments.length>1?J(arguments[1]):{})};w.constructor=Q,Q.prototype=w,n({global:!0,forced:!0},{Request:Q})}}t.exports={URLSearchParams:Z,getState:O}},4948:function(t,e,i){"use strict";i(5454);var n,r=i(3085),o=i(69),a=i(4551),s=i(8576),l=i(1187),c=i(9482),u=i(6961),h=i(4500),f=i(2503),g=i(841),d=i(863).codeAt,v=i(7977),p=i(4845),m=i(1284),y=i(9336),b=i(3326),x=s.URL,C=y.URLSearchParams,I=y.getState,_=b.set,M=b.getterFor("URL"),S=Math.floor,w=Math.pow,k="Invalid scheme",T="Invalid host",D="Invalid port",A=/[A-Za-z]/,j=/[\d+-.A-Za-z]/,O=/\d/,E=/^0x/i,L=/^[0-7]+$/,N=/^\d+$/,P=/^[\dA-Fa-f]+$/,z=/[\0\t\n\r #%/:<>?@[\\\]^|]/,B=/[\0\t\n\r #/:<>?@[\\\]^|]/,R=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,F=/[\t\n\r]/g,Y=function(t,e){var i,n,r;if("["==e.charAt(0)){if("]"!=e.charAt(e.length-1))return T;if(!(i=H(e.slice(1,-1))))return T;t.host=i}else if(K(t)){if(e=v(e),z.test(e))return T;if(null===(i=W(e)))return T;t.host=i}else{if(B.test(e))return T;for(i="",n=g(e),r=0;r<n.length;r++)i+=J(n[r],G);t.host=i}},W=function(t){var e,i,n,r,o,a,s,l=t.split(".");if(l.length&&""==l[l.length-1]&&l.pop(),(e=l.length)>4)return t;for(i=[],n=0;n<e;n++){if(""==(r=l[n]))return t;if(o=10,r.length>1&&"0"==r.charAt(0)&&(o=E.test(r)?16:8,r=r.slice(8==o?1:2)),""===r)a=0;else{if(!(10==o?N:8==o?L:P).test(r))return t;a=parseInt(r,o)}i.push(a)}for(n=0;n<e;n++)if(a=i[n],n==e-1){if(a>=w(256,5-e))return null}else if(a>255)return null;for(s=i.pop(),n=0;n<i.length;n++)s+=i[n]*w(256,3-n);return s},H=function(t){var e,i,n,r,o,a,s,l=[0,0,0,0,0,0,0,0],c=0,u=null,h=0,f=function(){return t.charAt(h)};if(":"==f()){if(":"!=t.charAt(1))return;h+=2,u=++c}for(;f();){if(8==c)return;if(":"!=f()){for(e=i=0;i<4&&P.test(f());)e=16*e+parseInt(f(),16),h++,i++;if("."==f()){if(0==i)return;if(h-=i,c>6)return;for(n=0;f();){if(r=null,n>0){if(!("."==f()&&n<4))return;h++}if(!O.test(f()))return;for(;O.test(f());){if(o=parseInt(f(),10),null===r)r=o;else{if(0==r)return;r=10*r+o}if(r>255)return;h++}l[c]=256*l[c]+r,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==f()){if(h++,!f())return}else if(f())return;l[c++]=e}else{if(null!==u)return;h++,u=++c}}if(null!==u)for(a=c-u,c=7;0!=c&&a>0;)s=l[c],l[c--]=l[u+a-1],l[u+--a]=s;else if(8!=c)return;return l},U=function(t){var e,i,n,r;if("number"==typeof t){for(e=[],i=0;i<4;i++)e.unshift(t%256),t=S(t/256);return e.join(".")}if("object"==typeof t){for(e="",n=function(t){for(var e=null,i=1,n=null,r=0,o=0;o<8;o++)0!==t[o]?(r>i&&(e=n,i=r),n=null,r=0):(null===n&&(n=o),++r);return r>i&&(e=n,i=r),e}(t),i=0;i<8;i++)r&&0===t[i]||(r&&(r=!1),n===i?(e+=i?":":"::",r=!0):(e+=t[i].toString(16),i<7&&(e+=":")));return"["+e+"]"}return t},G={},X=f({},G,{" ":1,'"':1,"<":1,">":1,"`":1}),Z=f({},X,{"#":1,"?":1,"{":1,"}":1}),V=f({},Z,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),J=function(t,e){var i=d(t,0);return i>32&&i<127&&!h(e,t)?t:encodeURIComponent(t)},Q={ftp:21,file:null,http:80,https:443,ws:80,wss:443},K=function(t){return h(Q,t.scheme)},q=function(t){return""!=t.username||""!=t.password},$=function(t){return!t.host||t.cannotBeABaseURL||"file"==t.scheme},tt=function(t,e){var i;return 2==t.length&&A.test(t.charAt(0))&&(":"==(i=t.charAt(1))||!e&&"|"==i)},et=function(t){var e;return t.length>1&&tt(t.slice(0,2))&&(2==t.length||"/"===(e=t.charAt(2))||"\\"===e||"?"===e||"#"===e)},it=function(t){var e=t.path,i=e.length;!i||"file"==t.scheme&&1==i&&tt(e[0],!0)||e.pop()},nt=function(t){return"."===t||"%2e"===t.toLowerCase()},rt={},ot={},at={},st={},lt={},ct={},ut={},ht={},ft={},gt={},dt={},vt={},pt={},mt={},yt={},bt={},xt={},Ct={},It={},_t={},Mt={},St=function(t,e,i,r){var o,a,s,l,c,u=i||rt,f=0,d="",v=!1,p=!1,m=!1;for(i||(t.scheme="",t.username="",t.password="",t.host=null,t.port=null,t.path=[],t.query=null,t.fragment=null,t.cannotBeABaseURL=!1,e=e.replace(R,"")),e=e.replace(F,""),o=g(e);f<=o.length;){switch(a=o[f],u){case rt:if(!a||!A.test(a)){if(i)return k;u=at;continue}d+=a.toLowerCase(),u=ot;break;case ot:if(a&&(j.test(a)||"+"==a||"-"==a||"."==a))d+=a.toLowerCase();else{if(":"!=a){if(i)return k;d="",u=at,f=0;continue}if(i&&(K(t)!=h(Q,d)||"file"==d&&(q(t)||null!==t.port)||"file"==t.scheme&&!t.host))return;if(t.scheme=d,i)return void(K(t)&&Q[t.scheme]==t.port&&(t.port=null));d="","file"==t.scheme?u=mt:K(t)&&r&&r.scheme==t.scheme?u=st:K(t)?u=ht:"/"==o[f+1]?(u=lt,f++):(t.cannotBeABaseURL=!0,t.path.push(""),u=It)}break;case at:if(!r||r.cannotBeABaseURL&&"#"!=a)return k;if(r.cannotBeABaseURL&&"#"==a){t.scheme=r.scheme,t.path=r.path.slice(),t.query=r.query,t.fragment="",t.cannotBeABaseURL=!0,u=Mt;break}u="file"==r.scheme?mt:ct;continue;case st:if("/"!=a||"/"!=o[f+1]){u=ct;continue}u=ft,f++;break;case lt:if("/"==a){u=gt;break}u=Ct;continue;case ct:if(t.scheme=r.scheme,a==n)t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,t.path=r.path.slice(),t.query=r.query;else if("/"==a||"\\"==a&&K(t))u=ut;else if("?"==a)t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,t.path=r.path.slice(),t.query="",u=_t;else{if("#"!=a){t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,t.path=r.path.slice(),t.path.pop(),u=Ct;continue}t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,t.path=r.path.slice(),t.query=r.query,t.fragment="",u=Mt}break;case ut:if(!K(t)||"/"!=a&&"\\"!=a){if("/"!=a){t.username=r.username,t.password=r.password,t.host=r.host,t.port=r.port,u=Ct;continue}u=gt}else u=ft;break;case ht:if(u=ft,"/"!=a||"/"!=d.charAt(f+1))continue;f++;break;case ft:if("/"!=a&&"\\"!=a){u=gt;continue}break;case gt:if("@"==a){v&&(d="%40"+d),v=!0,s=g(d);for(var y=0;y<s.length;y++){var b=s[y];if(":"!=b||m){var x=J(b,V);m?t.password+=x:t.username+=x}else m=!0}d=""}else if(a==n||"/"==a||"?"==a||"#"==a||"\\"==a&&K(t)){if(v&&""==d)return"Invalid authority";f-=g(d).length+1,d="",u=dt}else d+=a;break;case dt:case vt:if(i&&"file"==t.scheme){u=bt;continue}if(":"!=a||p){if(a==n||"/"==a||"?"==a||"#"==a||"\\"==a&&K(t)){if(K(t)&&""==d)return T;if(i&&""==d&&(q(t)||null!==t.port))return;if(l=Y(t,d))return l;if(d="",u=xt,i)return;continue}"["==a?p=!0:"]"==a&&(p=!1),d+=a}else{if(""==d)return T;if(l=Y(t,d))return l;if(d="",u=pt,i==vt)return}break;case pt:if(!O.test(a)){if(a==n||"/"==a||"?"==a||"#"==a||"\\"==a&&K(t)||i){if(""!=d){var C=parseInt(d,10);if(C>65535)return D;t.port=K(t)&&C===Q[t.scheme]?null:C,d=""}if(i)return;u=xt;continue}return D}d+=a;break;case mt:if(t.scheme="file","/"==a||"\\"==a)u=yt;else{if(!r||"file"!=r.scheme){u=Ct;continue}if(a==n)t.host=r.host,t.path=r.path.slice(),t.query=r.query;else if("?"==a)t.host=r.host,t.path=r.path.slice(),t.query="",u=_t;else{if("#"!=a){et(o.slice(f).join(""))||(t.host=r.host,t.path=r.path.slice(),it(t)),u=Ct;continue}t.host=r.host,t.path=r.path.slice(),t.query=r.query,t.fragment="",u=Mt}}break;case yt:if("/"==a||"\\"==a){u=bt;break}r&&"file"==r.scheme&&!et(o.slice(f).join(""))&&(tt(r.path[0],!0)?t.path.push(r.path[0]):t.host=r.host),u=Ct;continue;case bt:if(a==n||"/"==a||"\\"==a||"?"==a||"#"==a){if(!i&&tt(d))u=Ct;else if(""==d){if(t.host="",i)return;u=xt}else{if(l=Y(t,d))return l;if("localhost"==t.host&&(t.host=""),i)return;d="",u=xt}continue}d+=a;break;case xt:if(K(t)){if(u=Ct,"/"!=a&&"\\"!=a)continue}else if(i||"?"!=a)if(i||"#"!=a){if(a!=n&&(u=Ct,"/"!=a))continue}else t.fragment="",u=Mt;else t.query="",u=_t;break;case Ct:if(a==n||"/"==a||"\\"==a&&K(t)||!i&&("?"==a||"#"==a)){if(".."===(c=(c=d).toLowerCase())||"%2e."===c||".%2e"===c||"%2e%2e"===c?(it(t),"/"==a||"\\"==a&&K(t)||t.path.push("")):nt(d)?"/"==a||"\\"==a&&K(t)||t.path.push(""):("file"==t.scheme&&!t.path.length&&tt(d)&&(t.host&&(t.host=""),d=d.charAt(0)+":"),t.path.push(d)),d="","file"==t.scheme&&(a==n||"?"==a||"#"==a))for(;t.path.length>1&&""===t.path[0];)t.path.shift();"?"==a?(t.query="",u=_t):"#"==a&&(t.fragment="",u=Mt)}else d+=J(a,Z);break;case It:"?"==a?(t.query="",u=_t):"#"==a?(t.fragment="",u=Mt):a!=n&&(t.path[0]+=J(a,G));break;case _t:i||"#"!=a?a!=n&&("'"==a&&K(t)?t.query+="%27":t.query+="#"==a?"%23":J(a,G)):(t.fragment="",u=Mt);break;case Mt:a!=n&&(t.fragment+=J(a,X));break}f++}},wt=function(t){var e,i,n=u(this,wt,"URL"),r=arguments.length>1?arguments[1]:void 0,a=p(t),s=_(n,{type:"URL"});if(void 0!==r)if(r instanceof wt)e=M(r);else if(i=St(e={},p(r)))throw TypeError(i);if(i=St(s,a,null,e))throw TypeError(i);var l=s.searchParams=new C,c=I(l);c.updateSearchParams(s.query),c.updateURL=function(){s.query=String(l)||null},o||(n.href=Tt.call(n),n.origin=Dt.call(n),n.protocol=At.call(n),n.username=jt.call(n),n.password=Ot.call(n),n.host=Et.call(n),n.hostname=Lt.call(n),n.port=Nt.call(n),n.pathname=Pt.call(n),n.search=zt.call(n),n.searchParams=Bt.call(n),n.hash=Rt.call(n))},kt=wt.prototype,Tt=function(){var t=M(this),e=t.scheme,i=t.username,n=t.password,r=t.host,o=t.port,a=t.path,s=t.query,l=t.fragment,c=e+":";return null!==r?(c+="//",q(t)&&(c+=i+(n?":"+n:"")+"@"),c+=U(r),null!==o&&(c+=":"+o)):"file"==e&&(c+="//"),c+=t.cannotBeABaseURL?a[0]:a.length?"/"+a.join("/"):"",null!==s&&(c+="?"+s),null!==l&&(c+="#"+l),c},Dt=function(){var t=M(this),e=t.scheme,i=t.port;if("blob"==e)try{return new wt(e.path[0]).origin}catch(t){return"null"}return"file"!=e&&K(t)?e+"://"+U(t.host)+(null!==i?":"+i:""):"null"},At=function(){return M(this).scheme+":"},jt=function(){return M(this).username},Ot=function(){return M(this).password},Et=function(){var t=M(this),e=t.host,i=t.port;return null===e?"":null===i?U(e):U(e)+":"+i},Lt=function(){var t=M(this).host;return null===t?"":U(t)},Nt=function(){var t=M(this).port;return null===t?"":String(t)},Pt=function(){var t=M(this),e=t.path;return t.cannotBeABaseURL?e[0]:e.length?"/"+e.join("/"):""},zt=function(){var t=M(this).query;return t?"?"+t:""},Bt=function(){return M(this).searchParams},Rt=function(){var t=M(this).fragment;return t?"#"+t:""},Ft=function(t,e){return{get:t,set:e,configurable:!0,enumerable:!0}};if(o&&l(kt,{href:Ft(Tt,(function(t){var e=M(this),i=p(t),n=St(e,i);if(n)throw TypeError(n);I(e.searchParams).updateSearchParams(e.query)})),origin:Ft(Dt),protocol:Ft(At,(function(t){var e=M(this);St(e,p(t)+":",rt)})),username:Ft(jt,(function(t){var e=M(this),i=g(p(t));if(!$(e)){e.username="";for(var n=0;n<i.length;n++)e.username+=J(i[n],V)}})),password:Ft(Ot,(function(t){var e=M(this),i=g(p(t));if(!$(e)){e.password="";for(var n=0;n<i.length;n++)e.password+=J(i[n],V)}})),host:Ft(Et,(function(t){var e=M(this);e.cannotBeABaseURL||St(e,p(t),dt)})),hostname:Ft(Lt,(function(t){var e=M(this);e.cannotBeABaseURL||St(e,p(t),vt)})),port:Ft(Nt,(function(t){var e=M(this);$(e)||(""==(t=p(t))?e.port=null:St(e,t,pt))})),pathname:Ft(Pt,(function(t){var e=M(this);e.cannotBeABaseURL||(e.path=[],St(e,p(t),xt))})),search:Ft(zt,(function(t){var e=M(this);""==(t=p(t))?e.query=null:("?"==t.charAt(0)&&(t=t.slice(1)),e.query="",St(e,t,_t)),I(e.searchParams).updateSearchParams(e.query)})),searchParams:Ft(Bt),hash:Ft(Rt,(function(t){var e=M(this);""!=(t=p(t))?("#"==t.charAt(0)&&(t=t.slice(1)),e.fragment="",St(e,t,Mt)):e.fragment=null}))}),c(kt,"toJSON",(function(){return Tt.call(this)}),{enumerable:!0}),c(kt,"toString",(function(){return Tt.call(this)}),{enumerable:!0}),x){var Yt=x.createObjectURL,Wt=x.revokeObjectURL;Yt&&c(wt,"createObjectURL",(function(t){return Yt.apply(x,arguments)})),Wt&&c(wt,"revokeObjectURL",(function(t){return Wt.apply(x,arguments)}))}m(wt,"URL"),r({global:!0,forced:!a,sham:!o},{URL:wt})},9801:function(){},3822:function(t,e,i){var n=i(2221);t.exports=n},1434:function(t,e,i){var n=i(5078);t.exports=n},6899:function(t,e,i){var n=i(98);t.exports=n},7710:function(t,e,i){var n=i(5739);i(162),t.exports=n},4486:function(t,e,i){var n=i(278);t.exports=n},4877:function(t,e,i){var n=i(1484);t.exports=n},7178:function(t,e,i){var n=i(7731);t.exports=n},5603:function(t,e,i){var n=i(3669);t.exports=n},1206:function(t,e,i){i(162);var n=i(6899),r=i(4696),o=Array.prototype,a={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var e=t.forEach;return t===o||t instanceof Array&&e===o.forEach||a.hasOwnProperty(r(t))?n:e}},6174:function(t,e,i){var n=i(2604);t.exports=n},57:function(t,e,i){var n=i(263);t.exports=n},4741:function(t,e,i){var n=i(7663);t.exports=n},8368:function(t,e,i){var n=i(5063);t.exports=n},3739:function(t,e,i){var n=i(6813);t.exports=n},172:function(t,e,i){var n=i(6285);t.exports=n},4963:function(t,e,i){var n=i(3213);t.exports=n},7820:function(t,e,i){var n=i(3512);t.exports=n},8980:function(t,e,i){var n=i(8168);t.exports=n},5636:function(t,e,i){var n=i(8651);t.exports=n},6672:function(t,e,i){var n=i(3083);t.exports=n},5059:function(t,e,i){var n=i(2987);t.exports=n},3969:function(t,e,i){var n=i(2239);t.exports=n},6618:function(t,e,i){var n=i(3154);i(162),t.exports=n},5279:function(t,e,i){var n=i(6577);t.exports=n},9562:function(t,e,i){i(2906);var n=i(7545);t.exports=n.setTimeout},2285:function(t,e,i){var n=i(5008);i(162),t.exports=n},8535:function(t,e,i){var n=i(994);i(162),t.exports=n},652:function(t,e,i){var n=i(5668);t.exports=n},5668:function(t,e,i){i(4948),i(9801),i(9336);var n=i(7545);t.exports=n.URL},2534:function(t){"use strict";t.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyBkaXNwbGF5PSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KPGRlZnMgaWQ9InR1aS1pbWFnZS1lZGl0b3Itc3ZnLWRlZmF1bHQtaWNvbnMiPgo8c3ltYm9sIGlkPSJpYy1hcHBseSIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIHN0cm9rZT0ibm9uZS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MVY0YzAtMS4zOCAxLjEyLTIuNSAyLjUtMi41eiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI5NyAtMjkwKSB0cmFuc2xhdGUoMjk3IDI5MCkiLz4KICAgICAgICA8cGF0aCBmaWxsPSJpbmhlcml0IiBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik0xNi41IDMuNWMxLjMyNSAwIDIuNDEgMS4wMzIgMi40OTUgMi4zMzZMMTkgNnY2LjNoLTFWNmMwLS44MjgtLjY3Mi0xLjUtMS41LTEuNS0uNzggMC0xLjQyLjU5NS0xLjQ5MyAxLjM1NkwxNSA2djIuNDRoLTFWNmMwLTEuMzggMS4xMi0yLjUgMi41LTIuNXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yOTcgLTI5MCkgdHJhbnNsYXRlKDI5NyAyOTApIi8+CiAgICA8L2c+Cjwvc3ltYm9sPgo8L2RlZnM+Cjwvc3ZnPgo="},4858:function(e){"use strict";e.exports=t},4960:function(){},6759:function(){},6272:function(){}},i={};function n(t){var r=i[t];if(void 0!==r)return r.exports;var o=i[t]={exports:{}};return e[t](o,o.exports,n),o.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var r={};return function(){"use strict";n.d(r,{default:function(){return Tl}});var t=n(9131),e=n.n(t),i=n(1899),o=n.n(i),a=n(6562),s=n.n(a),l=n(1734),c=n.n(l),u=n(8005),h=n.n(u),f=n(6065),g=n.n(f),d=n(4496),v=n.n(d);Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var e=this;do{if(Element.prototype.matches.call(e,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 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 i="classList",n=t.Element.prototype,r=Object,a=e()(String.prototype)||function(){return this.replace(/^\s+|\s+$/g,"")},l=o()(Array.prototype)||function(t){for(var e=0,i=this.length;e<i;e++)if(e in this&&this[e]===t)return e;return-1},u=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},h=function(t,e){if(""===e)throw new u("SYNTAX_ERR","The token must not be empty.");if(/\s/.test(e))throw new u("INVALID_CHARACTER_ERR","The token must not contain space characters.");return l.call(t,e)},f=function(t){for(var e=a.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())}},g=f.prototype=[],d=function(){return new f(this)};if(u.prototype=Error.prototype,g.item=function(t){return this[t]||null},g.contains=function(t){return~h(this,t+"")},g.add=function(){var t,e=arguments,i=0,n=e.length,r=!1;do{t=e[i]+"",~h(this,t)||(this.push(t),r=!0)}while(++i<n);r&&this._updateClassName()},g.remove=function(){var t,e,i=arguments,n=0,r=i.length,o=!1;do{for(t=i[n]+"",e=h(this,t);~e;){var a;s()(a=this).call(a,e,1),o=!0,e=h(this,t)}}while(++n<r);o&&this._updateClassName()},g.toggle=function(t,e){var i=this.contains(t),n=i?!0!==e&&"remove":!1!==e&&"add";return n&&this[n](t),!0===e||!1===e?e:!i},g.replace=function(t,e){var i=h(t+"");~i&&(s()(this).call(this,i,1,e),this._updateClassName())},g.toString=function(){return this.join(" ")},c()){var v={get:d,enumerable:!0,configurable:!0};try{c()(n,i,v)}catch(t){void 0!==t.number&&-2146823252!==t.number||(v.enumerable=!1,c()(n,i,v))}}else r.prototype.__defineGetter__&&n.__defineGetter__(i,d)}}(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)}}"replace"in document.createElement("_").classList||(DOMTokenList.prototype.replace=function(t,e){var i=this.toString().split(" "),n=o()(i).call(i,t+"");~n&&(i=h()(i).call(i,n),this.remove.apply(this,i),this.add(e),this.add.apply(this,h()(i).call(i,1)))}),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,n=g()(null),r=function(){clearTimeout(e),e=v()(t,100)},o=function(){},a=function(t){function e(t){var e;return void 0!==t.protocol?e=t:(e=document.createElement("a")).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},s="http://www.w3.org/1999/xlink";t=function(){var t,e,i,l,c,u,h,f,g,d,p=0;function m(){var t;0===(p-=1)&&(o(),window.addEventListener("resize",r,!1),window.addEventListener("orientationchange",r,!1),window.MutationObserver?((t=new MutationObserver(r)).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),o=function(){try{t.disconnect(),window.removeEventListener("resize",r,!1),window.removeEventListener("orientationchange",r,!1)}catch(t){}}):(document.documentElement.addEventListener("DOMSubtreeModified",r,!1),o=function(){document.documentElement.removeEventListener("DOMSubtreeModified",r,!1),window.removeEventListener("resize",r,!1),window.removeEventListener("orientationchange",r,!1)}))}function y(t){return function(){!0!==n[t.base]&&(t.useEl.setAttributeNS(s,"xlink:href","#"+t.hash),t.useEl.hasAttribute("href")&&t.useEl.setAttribute("href","#"+t.hash))}}function b(t){return function(){var e,i=document.body,n=document.createElement("x");t.onload=null,n.innerHTML=t.responseText,(e=n.getElementsByTagName("svg")[0])&&(e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.width=0,e.style.height=0,e.style.overflow="hidden",i.insertBefore(e,i.firstChild)),m()}}function x(t){return function(){t.onerror=null,t.ontimeout=null,m()}}for(o(),g=document.getElementsByTagName("use"),c=0;c<g.length;c+=1){try{e=g[c].getBoundingClientRect()}catch(t){e=!1}t=(f=(l=g[c].getAttribute("href")||g[c].getAttributeNS(s,"href")||g[c].getAttribute("xlink:href"))&&l.split?l.split("#"):["",""])[0],i=f[1],u=e&&0===e.left&&0===e.right&&0===e.top&&0===e.bottom,e&&0===e.width&&0===e.height&&!u?(g[c].hasAttribute("href")&&g[c].setAttributeNS(s,"xlink:href",l),t.length&&(!0!==(d=n[t])&&v()(y({useEl:g[c],base:t,hash:i}),0),void 0===d&&void 0!==(h=a(t))&&(d=new h,n[t]=d,d.onload=b(d),d.onerror=x(d),d.ontimeout=x(d),d.open("GET",t),d.send(),p+=1))):u?t.length&&n[t]&&v()(y({useEl:g[c],base:t,hash:i}),0):void 0===n[t]?n[t]=!0:n[t].onload&&(n[t].abort(),delete n[t].onload,n[t]=!0)}g="",p+=1,m()},i=function(){window.removeEventListener("load",i,!1),e=v()(t,0)},"complete"!==document.readyState?window.addEventListener("load",i,!1):i()}}();var p=n(1845);function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var y=n(184),b=n(662),x=n(7172);var C=n(711);function I(t,e){var i;if(t){if("string"==typeof t)return m(t,e);var n=C(i=Object.prototype.toString.call(t)).call(i,8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?x(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}function _(t){return function(t){if(p(t))return m(t)}(t)||function(t){if(void 0!==y&&null!=b(t)||null!=t["@@iterator"])return x(t)}(t)||I(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var M=n(7077);function S(t,e,i){return e in t?M(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function w(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function k(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),M(t,n.key,n)}}function T(t,e,i){return e&&k(t.prototype,e),i&&k(t,i),t}var D=n(4426),A=n.n(D),j=n(9406),O=n.n(j),E=n(8189),L=n.n(E),N=n(3972),P=n.n(N),z=n(2777),B=n(961),R=n.n(B),F=n(5695),Y=n.n(F),W=n(8592),H=n.n(W),U=n(9052),G=n.n(U),X=n(2560),Z=n.n(X),V=n(2461),J=n.n(V);function Q(t,e){return function(t){if(p(t))return t}(t)||function(t,e){var i=null==t?null:void 0!==y&&b(t)||t["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(t);!(a=(n=i.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,r=t}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,e)||I(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var K,q=n(6397),$=n.n(q),tt=n(7636),et=n.n(tt),it=n(789),nt=n.n(it),rt=n(4729),ot=n.n(rt),at=n(1610),st=n.n(at),lt=n(3053),ct=n.n(lt),ut=["zoomIn","zoomOut","hand"],ht=["history","undo","redo","reset"],ft=["delete","deleteAll"],gt=O()(K=[]).call(K,ut,ht,ft),dt="filter",vt="color",pt=["rect","circle","triangle"],mt="cropzone",yt="vintage",bt="sepia2",xt="removeColor",Ct="colorFilter",It="removeWhite",_t="blendColor",Mt="blend",St=Pi("IMAGE_LOADER","CROPPER","FLIP","ROTATION","FREE_DRAWING","LINE","TEXT","ICON","FILTER","SHAPE","ZOOM","RESIZE"),wt={hasRotatingPoint:!1,hasBorders:!1,lockScalingFlip:!0,lockRotation:!0,lockSkewingX:!0,lockSkewingY:!0},kt="clearObjects",Tt="loadImage",Dt="flip",At="rotate",jt="addObject",Ot="removeObject",Et="applyFilter",Lt="removeFilter",Nt="addIcon",Pt="changeIconColor",zt="addShape",Bt="changeShape",Rt="addText",Ft="changeText",Yt="changeTextStyle",Wt="addImageObject",Ht="resizeCanvasDimension",Ut="setObjectProperties",Gt="setObjectPosition",Xt="changeSelection",Zt="resize",Vt="objectActivated",Jt="objectMoved",Qt="objectScaled",Kt="objectRotated",qt="objectAdded",$t="objectModified",te="textEditing",ee="textChanged",ie="iconCreateResize",ne="iconCreateEnd",re="addText",oe="addObject",ae="addObjectAfter",se="mousedown",le="redoStackChanged",ce="undoStackChanged",ue="selectionCleared",he="selectionCreated",fe="executeCommand",ge="afterUndo",de="afterRedo",ve="zoomChanged",pe="handStarted",me="handStopped",ye="keydown",be="keyup",xe="inputBoxEditingStarted",Ce="inputBoxEditingStopped",Ie="focus",_e="blur",Me=".tui-colorpicker-palette-hex",Se="Load",we="Mask",ke="Mask",Te="Crop",De="Resize",Ae="Filter",je="Filter",Oe="Shape",Ee="Icon",Le="Text",Ne="Text",Pe="Delete",ze="Delete",Be=Pi("NORMAL","CROPPER","FREE_DRAWING","LINE_DRAWING","TEXT","SHAPE","ICON","ZOOM","RESIZE"),Re="text",Fe="crop",Ye="resize",We="shape",He="zoom",Ue="normal",Ge="zoom",Xe="hand",Ze=90,Ve=89,Je=67,Qe=86,Ke=16,qe=8,$e=46,ti=40,ei=38,ii=32,ni=48,ri=57,oi={borderColor:"red",cornerColor:"green",cornerSize:10,originX:"center",originY:"center",transparentCorners:!1},ai="The object is already added.",si="The flipX and flipY setting values are not changed.",li="Invalid parameters.",ci="The executing command state is locked.",ui="The background image is empty.",hi="Invalid image loaded.",fi="The object is not in canvas.",gi="The promise of redo command is reject.",di="The promise of undo command is reject.",vi="Unsupported operation.",pi="Unsupported object type.",mi={"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"},yi={realTimeEvent:!0,min:-360,max:360,value:0},bi={min:5,max:30,value:12},xi={realTimeEvent:!0,min:2,max:300,value:3},Ci={realTimeEvent:!0,min:10,max:100,value:50},Ii={tintOpacityRange:{realTimeEvent:!0,min:0,max:1,value:.7,useDecimal:!0},removewhiteDistanceRange:{realTimeEvent:!0,min:0,max:1,value:.2,useDecimal:!0},brightnessRange:{realTimeEvent:!0,min:-1,max:1,value:0,useDecimal:!0},noiseRange:{realTimeEvent:!0,min:0,max:1e3,value:100},pixelateRange:{realTimeEvent:!0,min:2,max:20,value:4},colorfilterThresholdRange:{realTimeEvent:!0,min:0,max:1,value:.2,useDecimal:!0},blurFilterRange:{value:.1}},_i=0,Mi=0,Si=.5,wi=.5,ki={realTimeEvent:!0,min:32,max:4088,value:800},Ti="tui-image-editor-",Di=Math.min,Ai=Math.max,ji=!1,Oi=0;function Ei(t){return t.__fe_id||(Oi+=1,t.__fe_id=Oi),t.__fe_id}function Li(t){return"function"==typeof t}function Ni(t,e,i){if(e>i){var n=[i,e];e=n[0],i=n[1]}return Ai(e,Di(t,i))}function Pi(){for(var t={},e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return H()(i,(function(e){t[e]=e})),t}function zi(t,e){var i,n={},r=e.length,o=0;for(o=0;o<r;o+=1)n[i=e[o]]=t[i];return n}function Bi(t){return $()(t,10)}function Ri(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function Fi(){return!!(window.File&&window.FileList&&window.FileReader)}function Yi(t,e){var i,n,r,o;4===t.length&&(t=O()(o="".concat(t)).call(o,h()(t).call(t,1,4)));var a=$()(h()(t).call(t,1,3),16),s=$()(h()(t).call(t,3,5),16),l=$()(h()(t).call(t,5,7),16),c=e||1;return O()(i=O()(n=O()(r="rgba(".concat(a,", ")).call(r,s,", ")).call(n,l,", ")).call(i,c,")")}function Wi(t){H()(t,(function(e,i){t[i]=null}))}function Hi(){var t,e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"."===i.charAt(0)?O()(e=".".concat(Ti).concat(n)).call(e,h()(i).call(i,1)):O()(t="".concat(Ti).concat(n)).call(t,i)}function Ui(t,e){t.customProps=t.customProps||{},R()(t.customProps,e)}function Gi(t,e){var i={};return Z()(e)&&(e=[e]),H()(e,(function(e){i[e]=t.customProps[e]})),i}function Xi(t,e){return o()(t).call(t,e)>=0}function Zi(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return st()(t,"type")||vt}function Vi(t){var e=nt()(t);return(void 0===e?{}:e).source?dt:vt}function Ji(t){return ct()(t.get("type"),pt)>=0}function Qi(t){if(Xi(pt,t))return"Shape";switch(t){case"i-text":return"Text";case"path":case"line":return"Draw";case"activeSelection":return"Group";default:return qi(t)}}function Ki(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.useAlpha,r=void 0===n||n,o=i.mode,a=yt,s=xt,l=_t,c=bt,u=Ct,h=It,f=Mt;switch(t){case a:e=c;break;case s:e=r?u:h;break;case l:e="add"===o?f:o;break;default:e=t}return qi(e)}function qi(t){return t.replace(/[a-z]/,(function(t){return t.toUpperCase()}))}var $i=Pi("UN_IMPLEMENTATION","NO_COMPONENT_NAME"),tn="Should implement a method: ",en="Should set a component name",nn={UN_IMPLEMENTATION:function(t){return tn+t},NO_COMPONENT_NAME:function(){return en}},rn={types:R()({},$i),create:function(t){t=t.toLowerCase();for(var e=nn[t],i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}},on=rn.create,an=rn.types,sn=function(){function t(e,i){w(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 T(t,[{key:"execute",value:function(){throw new Error(on(an.UN_IMPLEMENTATION,"execute"))}},{key:"undo",value:function(){throw new Error(on(an.UN_IMPLEMENTATION,"undo"))}},{key:"isRedo",get:function(){return J()(this.undoData).length>0}},{key:"setUndoData",value:function(t,e,i){return e&&(t=e),i?e||(e=t):(R()(this.undoData,t),e=null),e}},{key:"setExecuteCallback",value:function(t){return this.executeCallback=t,this}},{key:"setUndoCallback",value:function(t){return this.undoCallback=t,this}}]),t}(),ln=sn,cn={};var un={create:function(t){var e=cn[t];if(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return new ln(e,n)}return null},register:function(t){cn[t.name]=t}},hn=function(){function t(){w(this,t),this._undoStack=[],this._redoStack=[],this._isLocked=!1,this._isSilent=!1}return T(t,[{key:"_invokeExecution",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.lock();var n=t.args;return n||(n=[]),t.execute.apply(t,_(n)).then((function(n){return e._isSilent||(e.pushUndoStack(t),e.fire(i?de:fe,t)),e.unlock(),Li(t.executeCallback)&&t.executeCallback(n),n})).catch((function(t){return e.unlock(),L().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.fire(ge,t),e.unlock(),Li(t.undoCallback)&&t.undoCallback(i),i})).catch((function(t){return e.unlock(),L().reject(t)}))}},{key:"_fireRedoStackChanged",value:function(){this.fire(le,this._redoStack.length)}},{key:"_fireUndoStackChanged",value:function(){this.fire(ce,this._undoStack.length)}},{key:"lock",value:function(){this._isLocked=!0}},{key:"unlock",value:function(){this._isLocked=!1}},{key:"executeSilent",value:function(){var t=this;this._isSilent=!0;for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return this.execute.apply(this,O()(i).call(i,[this._isSilent])).then((function(){t._isSilent=!1}))}},{key:"execute",value:function(){var t=this;if(this._isLocked)return L().reject(ci);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=i[0];return Z()(r)&&(r=un.create.apply(un,i)),this._invokeExecution(r).then((function(e){return t.clearRedoStack(),e}))}},{key:"undo",value:function(){var t,e=this._undoStack.pop(),i="";if(e&&this._isLocked&&(this.pushUndoStack(e,!0),e=null),e)this.isEmptyUndoStack()&&this._fireUndoStackChanged(),t=this._invokeUndo(e);else{var n;if(i=di,this._isLocked)i=O()(n="".concat(i," Because ")).call(n,ci);t=L().reject(i)}return t}},{key:"redo",value:function(){var t,e=this._redoStack.pop(),i="";if(e&&this._isLocked&&(this.pushRedoStack(e,!0),e=null),e)this.isEmptyRedoStack()&&this._fireRedoStackChanged(),t=this._invokeExecution(e,!0);else{var n;if(i=gi,this._isLocked)i=O()(n="".concat(i," Because ")).call(n,ci);t=L().reject(i)}return t}},{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}();G().mixin(hn);var fn=hn,gn=n(5214),dn=n.n(gn),vn=n(899),pn=n.n(vn),mn={"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.color":"#8a8a8a","menu.activeIcon.color":"#555555","menu.disabledIcon.color":"#434343","menu.hoverIcon.color":"#e9e9e9","submenu.normalIcon.color":"#8a8a8a","submenu.activeIcon.color":"#e9e9e9","menu.iconSize.width":"24px","menu.iconSize.height":"24px","submenu.iconSize.width":"32px","submenu.iconSize.height":"32px","submenu.backgroundColor":"#1e1e1e","submenu.partition.color":"#3c3c3c","submenu.normalLabel.color":"#8a8a8a","submenu.normalLabel.fontWeight":"lighter","submenu.activeLabel.color":"#fff","submenu.activeLabel.fontWeight":"lighter","checkbox.border":"0px","checkbox.backgroundColor":"#fff","range.pointer.color":"#fff","range.bar.color":"#666","range.subbar.color":"#d1d1d1","range.disabledPointer.color":"#414141","range.disabledBar.color":"#282828","range.disabledSubbar.color":"#414141","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"},yn=n(2534),bn=function(){function t(e){var i,n,r,o,a;w(this,t),this.styles=this._changeToObject(R()({},mn,e)),i=this._styleMaker(),r=Q(document.getElementsByTagName("head"),1)[0],o=document.createElement("link"),a=encodeURIComponent(i),n&&(o.id=n),o.setAttribute("rel","stylesheet"),o.setAttribute("type","text/css"),o.setAttribute("href","data:text/css;charset=UTF-8,".concat(a)),r.appendChild(o),this._loadDefaultSvgIcon()}return T(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":e={active:this.styles["".concat(i,".activeIcon")],normal:this.styles["".concat(i,".normalIcon")],hover:this.styles["".concat(i,".hoverIcon")],disabled:this.styles["".concat(i,".disabledIcon")]};break;case"submenu.icon":e={active:this.styles["".concat(i,".activeIcon")],normal:this.styles["".concat(i,".normalIcon")]};break;case"submenu.label":e={active:this._makeCssText(this.styles["".concat(i,".activeLabel")]),normal:this._makeCssText(this.styles["".concat(i,".normalLabel")])};break;case"submenu.partition":e={vertical:this._makeCssText(R()({},n,{borderLeft:"1px solid ".concat(n.color)})),horizontal:this._makeCssText(R()({},n,{borderBottom:"1px solid ".concat(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);break}return e}},{key:"_styleMaker",value:function(){var t=this.getStyle("submenu.label"),e=this.getStyle("submenu.partition");return function(t){var e,i,n,r,o,a,s,l,c,u,h,f,g,d,v,p,m,y,b,x,C,I,_,M,S,w,k,T,D,A=t.subMenuLabelActive,j=t.subMenuLabelNormal,E=t.subMenuRangeTitle,L=t.submenuPartitionVertical,N=t.submenuPartitionHorizontal,P=t.submenuCheckbox,z=t.submenuRangePointer,B=t.submenuRangeValue,R=t.submenuColorpickerTitle,F=t.submenuColorpickerButton,Y=t.submenuRangeBar,W=t.submenuRangeSubbar,H=t.submenuDisabledRangePointer,U=t.submenuDisabledRangeBar,G=t.submenuDisabledRangeSubbar,X=t.submenuIconSize,Z=t.menuIconSize,V=t.biSize,J=t.menuIconStyle,Q=t.submenuIconStyle;return O()(e=O()(i=O()(n=O()(r=O()(o=O()(a=O()(s=O()(l=O()(c=O()(u=O()(h=O()(f=O()(g=O()(d=O()(v=O()(p=O()(m=O()(y=O()(b=O()(x=O()(C=O()(I=O()(_=O()(M=O()(S=O()(w=O()(k=O()(T=O()(D='\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-star-2 .tui-image-editor-button[data-icontype="icon-star-2"] 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-crop-preset-button .tui-image-editor-button.preset.active label,\n .tie-resize-button .tui-image-editor-button.apply.active label,\n .tie-resize-preset-button .tui-image-editor-button.preset.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.tie-text-align-left .tui-image-editor-button.left label,\n .tie-text-align-button.tie-text-align-center .tui-image-editor-button.center label,\n .tie-text-align-button.tie-text-align-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 label > span {\n '.concat(A,"\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 .tui-image-editor-container .tui-image-editor-range-wrap.tui-image-editor-newline.short label > span {\n ")).call(D,j,"\n }\n .tui-image-editor-container .tui-image-editor-range-wrap label > span {\n ")).call(T,E,"\n }\n .tui-image-editor-container .tui-image-editor-partition > div {\n ")).call(k,L,"\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 ")).call(w,N,"\n }\n .tui-image-editor-container .tui-image-editor-checkbox label > span:before {\n ")).call(S,P,"\n }\n .tui-image-editor-container .tui-image-editor-checkbox label > input:checked + span:before {\n border: 0;\n }\n .tui-image-editor-container .tui-image-editor-virtual-range-pointer {\n ")).call(M,z,"\n }\n .tui-image-editor-container .tui-image-editor-virtual-range-bar {\n ")).call(_,Y,"\n }\n .tui-image-editor-container .tui-image-editor-virtual-range-subbar {\n ")).call(I,W,"\n }\n .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-pointer {\n ")).call(C,H,"\n }\n .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-subbar {\n ")).call(x,G,"\n }\n .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-bar {\n ")).call(b,U,"\n }\n .tui-image-editor-container .tui-image-editor-range-value {\n ")).call(y,B,"\n }\n .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value + label {\n ")).call(m,R,"\n }\n .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value {\n ")).call(p,F,"\n }\n .tui-image-editor-container .svg_ic-menu {\n ")).call(v,Z,"\n }\n .tui-image-editor-container .svg_ic-submenu {\n ")).call(d,X,"\n }\n .tui-image-editor-container .tui-image-editor-controls-logo > img,\n .tui-image-editor-container .tui-image-editor-header-logo > img {\n ")).call(g,V,"\n }\n .tui-image-editor-menu use.normal.use-default,\n .tui-image-editor-help-menu use.normal.use-default {\n fill-rule: evenodd;\n fill: ")).call(f,J.normal.color,";\n stroke: ")).call(h,J.normal.color,";\n }\n .tui-image-editor-menu use.active.use-default,\n .tui-image-editor-help-menu use.active.use-default {\n fill-rule: evenodd;\n fill: ")).call(u,J.active.color,";\n stroke: ")).call(c,J.active.color,";\n }\n .tui-image-editor-menu use.hover.use-default,\n .tui-image-editor-help-menu use.hover.use-default {\n fill-rule: evenodd;\n fill: ")).call(l,J.hover.color,";\n stroke: ")).call(s,J.hover.color,";\n }\n .tui-image-editor-menu use.disabled.use-default,\n .tui-image-editor-help-menu use.disabled.use-default {\n fill-rule: evenodd;\n fill: ")).call(a,J.disabled.color,";\n stroke: ")).call(o,J.disabled.color,";\n }\n .tui-image-editor-submenu use.normal.use-default {\n fill-rule: evenodd;\n fill: ")).call(r,Q.normal.color,";\n stroke: ")).call(n,Q.normal.color,";\n }\n .tui-image-editor-submenu use.active.use-default {\n fill-rule: evenodd;\n fill: ")).call(i,Q.active.color,";\n stroke: ")).call(e,Q.active.color,";\n }\n")}({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"),menuIconStyle:this.getStyle("menu.icon"),submenuIconStyle:this.getStyle("submenu.icon")})}},{key:"_changeToObject",value:function(t){var e={};return H()(t,(function(t,i){var n=Q(i.match(/^(.+)\.([a-z]+)$/i),3),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 H()(t,(function(t,n){var r,a;o()(r=["backgroundImage"]).call(r,n)>-1&&"none"!==t&&(t="url(".concat(t,")")),i.push(O()(a="".concat(e._toUnderScore(n),": ")).call(a,t))})),i.join(";")}},{key:"_toUnderScore",value:function(t){return t.replace(/([A-Z])/g,(function(t,e){return"-".concat(e.toLowerCase())}))}},{key:"_loadDefaultSvgIcon",value:function(){if(!document.getElementById("tui-image-editor-svg-default-icons")){var t=new DOMParser,e=yn.replace(/data:image\/svg\+xml;base64,/,""),i=t.parseFromString(atob(e),"text/xml");document.body.appendChild(i.documentElement)}}},{key:"_makeIconClassName",value:function(t,e){var i=(e?this.getStyle("submenu.icon"):this.getStyle("menu.icon"))[t],n=i.path,r=i.name;return n&&r?t:"".concat(t," use-default")}},{key:"_makeSvgIconPrefix",value:function(t,e){var i,n=(e?this.getStyle("submenu.icon"):this.getStyle("menu.icon"))[t],r=n.path,o=n.name;return r&&o?O()(i="".concat(r,"#")).call(i,o,"-"):"#"}},{key:"_makeSvgItem",value:function(t,e,i){var n=this;return pn()(t).call(t,(function(t){var r,o,a=n._makeSvgIconPrefix(t,i),s=n._toUnderScore(e),l=n._makeIconClassName(t,i);return O()(r=O()(o='<use xlink:href="'.concat(a,"ic-")).call(o,s,'" class="')).call(r,l,'"/>')})).join("")}},{key:"makeMenSvgIconSet",value:function(t,e){var i,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return O()(i='<svg class="svg_ic-'.concat(n?"submenu":"menu",'">')).call(i,this._makeSvgItem(t,e,n),"</svg>")}}]),t}(),xn=bn,Cn=n(9146),In=n.n(Cn),_n=n(6623),Mn=n(4230);function Sn(t,e){return Sn=Mn||function(t,e){return t.__proto__=e,t},Sn(t,e)}function wn(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=_n(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Sn(t,e)}var kn=n(3742);function Tn(t){return Tn="function"==typeof y&&"symbol"==typeof kn?function(t){return typeof t}:function(t){return t&&"function"==typeof y&&t.constructor===y&&t!==y.prototype?"symbol":typeof t},Tn(t)}function Dn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function An(t,e){if(e&&("object"===Tn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Dn(t)}var jn=n(9856);function On(t){return On=Mn?jn:function(t){return t.__proto__||jn(t)},On(t)}var En=n(6092),Ln=n.n(En),Nn=n(4858),Pn=n.n(Nn),zn=["#000000","#2a2a2a","#545454","#7e7e7e","#a8a8a8","#d2d2d2","#ffffff","","#ff4040","#ff6518","#ffbb3b","#03bd9e","#00a9ff","#515ce6","#9e5fff","#ff5583"],Bn=function(){function t(e,i){var n=i.defaultColor,r=void 0===n?"#7e7e7e":n,o=i.toggleDirection,a=void 0===o?"up":o,s=i.usageStatistics;w(this,t),this.colorpickerElement=e,this.usageStatistics=s,this._show=!1,this._colorpickerElement=e,this._toggleDirection=a,this._makePickerButtonElement(r),this._makePickerLayerElement(e,e.getAttribute("title")),this._color=r,this.picker=Pn().create({container:this.pickerElement,preset:zn,color:r,usageStatistics:this.usageStatistics}),this._addEvent()}return T(t,[{key:"destroy",value:function(){var t=this;this._removeEvent(),this.picker.destroy(),this.colorpickerElement.innerHTML="",H()(this,(function(e,i){t[i]=null}))}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._changeColorElement(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){this.colorpickerElement.classList.add("tui-image-editor-button"),this.colorElement=document.createElement("div"),this.colorElement.className="color-picker-value",t?this.colorElement.style.backgroundColor=t: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(){var t,e=this;this.picker.on("selectColor",(function(t){e._changeColorElement(t.color),e._color=t.color,e.fire("change",t.color)})),this.eventHandler={pickerToggle:A()(t=this._pickerToggleEventHandler).call(t,this),pickerHide:function(){return e.hide()}},this.colorpickerElement.addEventListener("click",this.eventHandler.pickerToggle),document.body.addEventListener("click",this.eventHandler.pickerHide)}},{key:"_removeEvent",value:function(){this.colorpickerElement.removeEventListener("click",this.eventHandler.pickerToggle),document.body.removeEventListener("click",this.eventHandler.pickerHide),this.picker.off()}},{key:"_pickerToggleEventHandler",value:function(t){var e=t.target,i=e&&this._isElementInColorPickerControl(e);(!i||i&&this._isPaletteButton(e))&&(this._show=!this._show,this.pickerControl.style.display=this._show?"block":"none",this._setPickerControlPosition(),this.fire("changeShow",this)),t.stopPropagation()}},{key:"_isPaletteButton",value:function(t){return"tui-colorpicker-palette-button"===t.className}},{key:"_isElementInColorPickerControl",value:function(t){for(var e=t;e!==document.body&&e;){if(e===this.pickerControl)return!0;e=e.parentNode}return!1}},{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=-1*(this.pickerControl.offsetHeight+10);"down"===this._toggleDirection&&(n=30),t.top="".concat(n,"px"),t.left="-".concat(i,"px")}}]),t}();G().mixin(Bn);var Rn=Bn,Fn=/(-?)([0-9]*)[^0-9]*([0-9]*)/g,Yn=function(){function t(e){var i,n,r,o,a,s,l,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};w(this,t),this._value=c.value||0,this.rangeElement=e.slider,this.rangeInputElement=e.input,this._drawRangeElement(),this.rangeWidth=this._getRangeWidth(),this._min=c.min||0,this._max=c.max||100,this._useDecimal=c.useDecimal,this._absMax=-1*this._min+this._max,this.realTimeEvent=c.realTimeEvent||!1,this._userInputTimer=null,this.eventHandler={startChangingSlide:A()(i=this._startChangingSlide).call(i,this),stopChangingSlide:A()(n=this._stopChangingSlide).call(n,this),changeSlide:A()(r=this._changeSlide).call(r,this),changeSlideFinally:A()(o=this._changeSlideFinally).call(o,this),changeInput:A()(a=this._changeInput).call(a,this),changeInputFinally:A()(s=this._changeValueWithInput).call(s,this,!0),changeInputWithArrow:A()(l=this._changeValueWithInputKeyEvent).call(l,this)},this._addClickEvent(),this._addDragEvent(),this._addInputEvent(),this.value=c.value,this.trigger("change")}return T(t,[{key:"destroy",value:function(){var t=this;this._removeClickEvent(),this._removeDragEvent(),this._removeInputEvent(),this.rangeElement.innerHTML="",H()(this,(function(e,i){t[i]=null}))}},{key:"max",get:function(){return this._max},set:function(t){this._max=t,this._absMax=-1*this._min+this._max,this.value=this._value}},{key:"min",get:function(){return this._min},set:function(t){this._min=t,this.max=this._max}},{key:"value",get:function(){return this._value},set:function(t){var e=((t=this._useDecimal?t:Bi(t))-this._min)*this.rangeWidth/this._absMax;this.rangeWidth<e&&(e=this.rangeWidth),this.pointer.style.left="".concat(e,"px"),this.subbar.style.right="".concat(this.rangeWidth-e,"px"),this._value=t,this.rangeInputElement&&(this.rangeInputElement.value=t)}},{key:"trigger",value:function(t){this.fire(t,this._value)}},{key:"_getRangeWidth",value:function(){var t=function(t){return Bi(window.getComputedStyle(t,null).width)};return t(this.rangeElement)-t(this.pointer)}},{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:"_addInputEvent",value:function(){this.rangeInputElement&&(this.rangeInputElement.addEventListener("keydown",this.eventHandler.changeInputWithArrow),this.rangeInputElement.addEventListener("keydown",this.eventHandler.changeInput),this.rangeInputElement.addEventListener("blur",this.eventHandler.changeInputFinally))}},{key:"_removeInputEvent",value:function(){this.rangeInputElement&&(this.rangeInputElement.removeEventListener("keydown",this.eventHandler.changeInputWithArrow),this.rangeInputElement.removeEventListener("keydown",this.eventHandler.changeInput),this.rangeInputElement.removeEventListener("blur",this.eventHandler.changeInputFinally))}},{key:"_changeValueWithInputKeyEvent",value:function(t){var e,i=t.keyCode,n=t.target;if(!(o()(e=[ei,ti]).call(e,i)<0)){var r=Number(n.value);if(!((r=this._valueUpDownForKeyEvent(r,i))<this._min||r>this._max)){var a=Ni(r,this._min,this.max);this.value=a,this.fire("change",a,!1)}}}},{key:"_valueUpDownForKeyEvent",value:function(t,e){var i=this._useDecimal?.1:1;return e===ei?t+=i:e===ti&&(t-=i),t}},{key:"_changeInput",value:function(t){var e=this;clearTimeout(this._userInputTimer);var i=t.keyCode;i<ni||i>ri?t.preventDefault():this._userInputTimer=v()((function(){e._inputSetValue(t.target.value)}),350)}},{key:"_inputSetValue",value:function(t){var e=this._useDecimal?Number(t):Bi(t);e=Ni(e,this._min,this.max),this.value=e,this.fire("change",e,!0)}},{key:"_changeValueWithInput",value:function(t,e){var i,n=e.keyCode,r=e.target;if(!(o()(i=[ei,ti]).call(i,n)>=0)){var a=this._filterForInputText(r.value),s=!a||isNaN(a);r.value=a,s||this._inputSetValue(a)}}},{key:"_addClickEvent",value:function(){this.rangeElement.addEventListener("click",this.eventHandler.changeSlideFinally)}},{key:"_removeClickEvent",value:function(){this.rangeElement.removeEventListener("click",this.eventHandler.changeSlideFinally)}},{key:"_addDragEvent",value:function(){this.pointer.addEventListener("mousedown",this.eventHandler.startChangingSlide)}},{key:"_removeDragEvent",value:function(){this.pointer.removeEventListener("mousedown",this.eventHandler.startChangingSlide)}},{key:"_changeSlide",value:function(t){var e=t.screenX-this.firstPosition,i=this.firstLeft+e;i=(i=i>this.rangeWidth?this.rangeWidth:i)<0?0:i,this.pointer.style.left="".concat(i,"px"),this.subbar.style.right="".concat(this.rangeWidth-i,"px");var n=i/this.rangeWidth,r=this._absMax*n+this._min,o=this._useDecimal?r:Bi(r);this.value!==o&&(this.value=o,this.realTimeEvent&&this.fire("change",this._value,!1))}},{key:"_changeSlideFinally",value:function(t){if(t.stopPropagation(),"tui-image-editor-range"===t.target.className){var e=t.offsetX/this.rangeWidth,i=this._absMax*e+this._min;this.pointer.style.left="".concat(e*this.rangeWidth,"px"),this.subbar.style.right="".concat((1-e)*this.rangeWidth,"px"),this.value=i,this.fire("change",i,!0)}}},{key:"_startChangingSlide",value:function(t){this.firstPosition=t.screenX,this.firstLeft=Bi(this.pointer.style.left)||0,document.addEventListener("mousemove",this.eventHandler.changeSlide),document.addEventListener("mouseup",this.eventHandler.stopChangingSlide)}},{key:"_stopChangingSlide",value:function(){this.fire("change",this._value,!0),document.removeEventListener("mousemove",this.eventHandler.changeSlide),document.removeEventListener("mouseup",this.eventHandler.stopChangingSlide)}},{key:"_filterForInputText",value:function(t){return t.replace(Fn,"$1$2$3")}}]),t}();G().mixin(Yn);var Wn=Yn,Hn=function(){function t(e,i){var n=i.locale,r=i.name,o=i.makeSvgIcon,a=i.menuBarPosition,s=i.templateHtml,l=i.usageStatistics;w(this,t),this.subMenuElement=e,this.menuBarPosition=a,this.toggleDirection="top"===a?"down":"up",this.colorPickerControls=[],this.usageStatistics=l,this.eventHandler={},this._makeSubMenuElement({locale:n,name:r,makeSvgIcon:o,templateHtml:s})}return T(t,[{key:"selector",value:function(t){return this.subMenuElement.querySelector(t)}},{key:"colorPickerChangeShow",value:function(t){var e;et()(e=this.colorPickerControls).call(e,(function(e){t!==e&&e.hide()}))}},{key:"getButtonType",value:function(t,e){return t.className.match(RegExp("(".concat(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){var e=t.locale,i=t.name,n=t.iconStyle,r=t.makeSvgIcon,o=t.templateHtml,a=document.createElement("div");a.className="tui-image-editor-menu-".concat(i),a.innerHTML=o({locale:e,iconStyle:n,makeSvgIcon:r}),this.subMenuElement.appendChild(a)}},{key:"_onStartEditingInputBox",value:function(){this.fire(xe)}},{key:"_onStopEditingInputBox",value:function(){this.fire(Ce)}}]),t}();G().mixin(Hn);var Un=Hn,Gn=function(t){var e,i,n,r,o,a,s,l,c=t.locale,u=t.makeSvgIcon;return O()(e=O()(i=O()(n=O()(r=O()(o=O()(a=O()(s=O()(l='\n <ul class="tui-image-editor-submenu-item">\n <li class="tie-shape-button">\n <div class="tui-image-editor-button rect">\n <div>\n '.concat(u(["normal","active"],"shape-rectangle",!0),"\n </div>\n <label> ")).call(l,c.localize("Rectangle"),' </label>\n </div>\n <div class="tui-image-editor-button circle">\n <div>\n ')).call(s,u(["normal","active"],"shape-circle",!0),"\n </div>\n <label> ")).call(a,c.localize("Circle"),' </label>\n </div>\n <div class="tui-image-editor-button triangle">\n <div>\n ')).call(o,u(["normal","active"],"shape-triangle",!0),"\n </div>\n <label> ")).call(r,c.localize("Triangle"),' </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li class="tie-shape-color-button">\n <div class="tie-color-fill" title="')).call(n,c.localize("Fill"),'"></div>\n <div class="tie-color-stroke" title="')).call(i,c.localize("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">')).call(e,c.localize("Stroke"),'</label>\n <div class="tie-stroke-range"></div>\n <input class="tie-stroke-range-value tui-image-editor-range-value" value="0" />\n </li>\n </ul>\n')};function Xn(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Zn={stroke:"#ffbb3b",fill:"",strokeWidth:3},Vn=function(t){wn(i,t);var e=Xn(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"shape",makeSvgIcon:a,menuBarPosition:s,templateHtml:Gn,usageStatistics:l})).type=null,r.options=Zn,r._els={shapeSelectButton:r.selector(".tie-shape-button"),shapeColorButton:r.selector(".tie-shape-color-button"),strokeRange:new Wn({slider:r.selector(".tie-stroke-range"),input:r.selector(".tie-stroke-range-value")},xi),fillColorpicker:new Rn(r.selector(".tie-color-fill"),{defaultColor:"",toggleDirection:r.toggleDirection,usageStatistics:r.usageStatistics}),strokeColorpicker:new Rn(r.selector(".tie-color-stroke"),{defaultColor:"#ffbb3b",toggleDirection:r.toggleDirection,usageStatistics:r.usageStatistics})},r.colorPickerControls.push(r._els.fillColorpicker),r.colorPickerControls.push(r._els.strokeColorpicker),r.colorPickerInputBoxes=[],r.colorPickerInputBoxes.push(r._els.fillColorpicker.colorpickerElement.querySelector(Me)),r.colorPickerInputBoxes.push(r._els.strokeColorpicker.colorpickerElement.querySelector(Me)),r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),this._els.strokeRange.destroy(),this._els.fillColorpicker.destroy(),this._els.strokeColorpicker.destroy(),Wi(this)}},{key:"addEvent",value:function(t){var e,i,n,r,o,a,s=this;this.eventHandler.shapeTypeSelected=A()(e=this._changeShapeHandler).call(e,this),this.actions=t,this._els.shapeSelectButton.addEventListener("click",this.eventHandler.shapeTypeSelected),this._els.strokeRange.on("change",A()(i=this._changeStrokeRangeHandler).call(i,this)),this._els.fillColorpicker.on("change",A()(n=this._changeFillColorHandler).call(n,this)),this._els.strokeColorpicker.on("change",A()(r=this._changeStrokeColorHandler).call(r,this)),this._els.fillColorpicker.on("changeShow",A()(o=this.colorPickerChangeShow).call(o,this)),this._els.strokeColorpicker.on("changeShow",A()(a=this.colorPickerChangeShow).call(a,this)),Ln()(this.colorPickerInputBoxes,(function(t){var e,i;t.addEventListener(Ie,A()(e=s._onStartEditingInputBox).call(e,s)),t.addEventListener(_e,A()(i=s._onStopEditingInputBox).call(i,s))}),this)}},{key:"_removeEvent",value:function(){var t=this;this._els.shapeSelectButton.removeEventListener("click",this.eventHandler.shapeTypeSelected),this._els.strokeRange.off(),this._els.fillColorpicker.off(),this._els.strokeColorpicker.off(),Ln()(this.colorPickerInputBoxes,(function(e){var i,n;e.removeEventListener(Ie,A()(i=t._onStartEditingInputBox).call(i,t)),e.removeEventListener(_e,A()(n=t._onStopEditingInputBox).call(n,t))}),this)}},{key:"setShapeStatus",value:function(t){var e=t.strokeWidth,i=t.strokeColor,n=t.fillColor;this._els.strokeRange.value=e,this._els.strokeColorpicker.color=i,this._els.fillColorpicker.color=n,this.options.stroke=i,this.options.fill=n,this.options.strokeWidth=e,this.actions.setDrawingShape(this.type,{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=xi.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,e){this.options.strokeWidth=Bi(t),this.actions.changeShape({strokeWidth:t},!e),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})}}]),i}(Un),Jn=Vn,Qn=function(t){var e,i,n,r,o,a,s,l,c,u,h,f,g,d,v,p,m,y=t.locale,b=t.makeSvgIcon;return O()(e=O()(i=O()(n=O()(r=O()(o=O()(a=O()(s=O()(l=O()(c=O()(u=O()(h=O()(f=O()(g=O()(d=O()(v=O()(p=O()(m='\n <ul class="tui-image-editor-submenu-item">\n <li class="tie-crop-preset-button">\n <div class="tui-image-editor-button preset preset-none active">\n <div>\n '.concat(b(["normal","active"],"shape-rectangle",!0),"\n </div>\n <label> ")).call(m,y.localize("Custom"),' </label>\n </div>\n <div class="tui-image-editor-button preset preset-square">\n <div>\n ')).call(p,b(["normal","active"],"crop",!0),"\n </div>\n <label> ")).call(v,y.localize("Square"),' </label>\n </div>\n <div class="tui-image-editor-button preset preset-3-2">\n <div>\n ')).call(d,b(["normal","active"],"crop",!0),"\n </div>\n <label> ")).call(g,y.localize("3:2"),' </label>\n </div>\n <div class="tui-image-editor-button preset preset-4-3">\n <div>\n ')).call(f,b(["normal","active"],"crop",!0),"\n </div>\n <label> ")).call(h,y.localize("4:3"),' </label>\n </div>\n <div class="tui-image-editor-button preset preset-5-4">\n <div>\n ')).call(u,b(["normal","active"],"crop",!0),"\n </div>\n <label> ")).call(c,y.localize("5:4"),' </label>\n </div>\n <div class="tui-image-editor-button preset preset-7-5">\n <div>\n ')).call(l,b(["normal","active"],"crop",!0),"\n </div>\n <label> ")).call(s,y.localize("7:5"),' </label>\n </div>\n <div class="tui-image-editor-button preset preset-16-9">\n <div>\n ')).call(a,b(["normal","active"],"crop",!0),"\n </div>\n <label> ")).call(o,y.localize("16:9"),' </label>\n </div>\n </li>\n <li class="tui-image-editor-partition tui-image-editor-newline">\n </li>\n <li class="tui-image-editor-partition only-left-right">\n <div></div>\n </li>\n <li class="tie-crop-button action">\n <div class="tui-image-editor-button apply">\n ')).call(r,b(["normal","active"],"apply"),"\n <label>\n ")).call(n,y.localize("Apply"),'\n </label>\n </div>\n <div class="tui-image-editor-button cancel">\n ')).call(i,b(["normal","active"],"cancel"),"\n <label>\n ")).call(e,y.localize("Cancel"),"\n </label>\n </div>\n </li>\n </ul>\n")};function Kn(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var qn=function(t){wn(i,t);var e=Kn(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"crop",makeSvgIcon:a,menuBarPosition:s,templateHtml:Qn,usageStatistics:l})).status="active",r._els={apply:r.selector(".tie-crop-button .apply"),cancel:r.selector(".tie-crop-button .cancel"),preset:r.selector(".tie-crop-preset-button")},r.defaultPresetButton=r._els.preset.querySelector(".preset-none"),r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),Wi(this)}},{key:"addEvent",value:function(t){var e,i,n,r=A()(e=this._applyEventHandler).call(e,this),o=A()(i=this._cancelEventHandler).call(i,this),a=A()(n=this._cropzonePresetEventHandler).call(n,this);this.eventHandler={apply:r,cancel:o,cropzonePreset:a},this.actions=t,this._els.apply.addEventListener("click",r),this._els.cancel.addEventListener("click",o),this._els.preset.addEventListener("click",a)}},{key:"_removeEvent",value:function(){this._els.apply.removeEventListener("click",this.eventHandler.apply),this._els.cancel.removeEventListener("click",this.eventHandler.cancel),this._els.preset.removeEventListener("click",this.eventHandler.cropzonePreset)}},{key:"_applyEventHandler",value:function(){this.actions.crop(),this._els.apply.classList.remove("active")}},{key:"_cancelEventHandler",value:function(){this.actions.cancel(),this._els.apply.classList.remove("active")}},{key:"_cropzonePresetEventHandler",value:function(t){var e=t.target.closest(".tui-image-editor-button.preset");if(e){var i=Q(e.className.match(/preset-[^\s]+/),1)[0];this._setPresetButtonActive(e),this.actions.preset(i)}}},{key:"changeStartMode",value:function(){this.actions.modeChange("crop")}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode(),this._setPresetButtonActive()}},{key:"changeApplyButtonStatus",value:function(t){t?this._els.apply.classList.add("active"):this._els.apply.classList.remove("active")}},{key:"_setPresetButtonActive",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.defaultPresetButton;H()(this._els.preset.querySelectorAll(".preset"),(function(t){t.classList.remove("active")})),t&&t.classList.add("active")}}]),i}(Un),$n=qn,tr=function(t){var e,i,n,r,o,a,s=t.locale,l=t.makeSvgIcon;return O()(e=O()(i=O()(n=O()(r=O()(o=O()(a='\n <ul class="tui-image-editor-submenu-item">\n <li class="tui-image-editor-submenu-align">\n <div class="tui-image-editor-range-wrap tui-image-editor-newline">\n <label class="range">'.concat(s.localize("Width"),'&nbsp;</label>\n <div class="tie-width-range"></div>\n <input class="tie-width-range-value tui-image-editor-range-value" value="0" /> <label>px</label>\n <div class="tui-image-editor-partition tui-image-editor-newline"></div>\n <label class="range">')).call(a,s.localize("Height"),'</label>\n <div class="tie-height-range"></div>\n <input class="tie-height-range-value tui-image-editor-range-value" value="0" /> <label>px</label>\n </div>\n </li>\n <li class="tui-image-editor-partition tui-image-editor-newline"></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-wrap">\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-lock-aspect-ratio">\n <span>')).call(o,s.localize("Lock Aspect Ratio"),'</span>\n </label>\n </div>\n </div>\n </li>\n <li class="tui-image-editor-partition tui-image-editor-newline"></li>\n <li class="tui-image-editor-partition only-left-right">\n <div></div>\n </li>\n <li class="tui-image-editor-partition tui-image-editor-newline"></li>\n <li class="tie-resize-button action">\n <div class="tui-image-editor-button apply">\n ')).call(r,l(["normal","active"],"apply"),"\n <label>\n ")).call(n,s.localize("Apply"),'\n </label>\n </div>\n <div class="tui-image-editor-button cancel">\n ')).call(i,l(["normal","active"],"cancel"),"\n <label>\n ")).call(e,s.localize("Cancel"),"\n </label>\n </div>\n </li>\n </ul>\n")};function er(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var ir=function(t){wn(i,t);var e=er(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"resize",makeSvgIcon:a,menuBarPosition:s,templateHtml:tr,usageStatistics:l})).status="active",r._lockState=!1,r._originalDimensions=null,r._els={widthRange:new Wn({slider:r.selector(".tie-width-range"),input:r.selector(".tie-width-range-value")},ki),heightRange:new Wn({slider:r.selector(".tie-height-range"),input:r.selector(".tie-height-range-value")},ki),lockAspectRatio:r.selector(".tie-lock-aspect-ratio"),apply:r.selector(".tie-resize-button .apply"),cancel:r.selector(".tie-resize-button .cancel")},r}return T(i,[{key:"changeStartMode",value:function(){this.actions.modeChange("resize");var t=this.actions.getCurrentDimensions();this._originalDimensions=t,this.setWidthValue(t.width),this.setHeightValue(t.height)}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode(),this.actions.reset(!0)}},{key:"setLimit",value:function(t){this._els.widthRange.min=this.calcMinValue(t.minWidth),this._els.heightRange.min=this.calcMinValue(t.minHeight),this._els.widthRange.max=this.calcMaxValue(t.maxWidth),this._els.heightRange.max=this.calcMaxValue(t.maxHeight)}},{key:"calcMaxValue",value:function(t){return t<=0&&(t=ki.max),t}},{key:"calcMinValue",value:function(t){return t<=0&&(t=ki.min),t}},{key:"setWidthValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._els.widthRange.value=t,e&&this._els.widthRange.trigger("change")}},{key:"setHeightValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._els.heightRange.value=t,e&&this._els.heightRange.trigger("change")}},{key:"destroy",value:function(){this._removeEvent(),Wi(this)}},{key:"addEvent",value:function(t){var e,i,n,r,o;this._els.widthRange.on("change",A()(e=this._changeWidthRangeHandler).call(e,this)),this._els.heightRange.on("change",A()(i=this._changeHeightRangeHandler).call(i,this)),this._els.lockAspectRatio.addEventListener("change",A()(n=this._changeLockAspectRatio).call(n,this));var a=A()(r=this._applyEventHandler).call(r,this),s=A()(o=this._cancelEventHandler).call(o,this);this.eventHandler={apply:a,cancel:s},this.actions=t,this._els.apply.addEventListener("click",a),this._els.cancel.addEventListener("click",s)}},{key:"_changeWidthRangeHandler",value:function(t){this.actions.preview("width",Bi(t),this._lockState)}},{key:"_changeHeightRangeHandler",value:function(t){this.actions.preview("height",Bi(t),this._lockState)}},{key:"_changeLockAspectRatio",value:function(t){this._lockState=t.target.checked,this.actions.lockAspectRatio(this._lockState,ki.min,ki.max)}},{key:"_removeEvent",value:function(){this._els.apply.removeEventListener("click",this.eventHandler.apply),this._els.cancel.removeEventListener("click",this.eventHandler.cancel)}},{key:"_applyEventHandler",value:function(){this.actions.resize(),this._els.apply.classList.remove("active")}},{key:"_cancelEventHandler",value:function(){this.actions.reset(),this._els.cancel.classList.remove("active")}},{key:"changeApplyButtonStatus",value:function(t){t?this._els.apply.classList.add("active"):this._els.apply.classList.remove("active")}}]),i}(Un),nr=ir,rr=function(t){var e,i,n,r,o,a=t.locale,s=t.makeSvgIcon;return O()(e=O()(i=O()(n=O()(r=O()(o='\n <ul class="tie-flip-button tui-image-editor-submenu-item">\n <li>\n <div class="tui-image-editor-button flipX">\n <div>\n '.concat(s(["normal","active"],"flip-x",!0),"\n </div>\n <label>\n ")).call(o,a.localize("Flip X"),'\n </label>\n </div>\n <div class="tui-image-editor-button flipY">\n <div>\n ')).call(r,s(["normal","active"],"flip-y",!0),"\n </div>\n <label>\n ")).call(n,a.localize("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 ')).call(i,s(["normal","active"],"flip-reset",!0),"\n </div>\n <label>\n ")).call(e,a.localize("Reset"),"\n </label>\n </div>\n </li>\n </ul>\n")};function or(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var ar=function(t){wn(i,t);var e=or(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"flip",makeSvgIcon:a,menuBarPosition:s,templateHtml:rr,usageStatistics:l})).flipStatus=!1,r._els={flipButton:r.selector(".tie-flip-button")},r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),Wi(this)}},{key:"addEvent",value:function(t){var e;this.eventHandler.changeFlip=A()(e=this._changeFlip).call(e,this),this._actions=t,this._els.flipButton.addEventListener("click",this.eventHandler.changeFlip)}},{key:"_removeEvent",value:function(){this._els.flipButton.removeEventListener("click",this.eventHandler.changeFlip)}},{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"),H()(["flipX","flipY"],(function(n){i.remove(n),t[n]&&(i.add(n),i.add("resetFlip"),e.flipStatus=!0)}))}))}}}]),i}(Un),sr=ar,lr=function(t){var e,i,n=t.locale,r=t.makeSvgIcon;return O()(e=O()(i='\n <ul class="tui-image-editor-submenu-item">\n <li class="tie-rotate-button">\n <div class="tui-image-editor-button clockwise">\n <div>\n '.concat(r(["normal","active"],"rotate-clockwise",!0),'\n </div>\n <label> 30 </label>\n </div>\n <div class="tui-image-editor-button counterclockwise">\n <div>\n ')).call(i,r(["normal","active"],"rotate-counterclockwise",!0),'\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">')).call(e,n.localize("Range"),'</label>\n <div class="tie-rotate-range"></div>\n <input class="tie-rotate-range-value tui-image-editor-range-value" value="0" />\n </li>\n </ul>\n')};function cr(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var ur=function(t){wn(i,t);var e=cr(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"rotate",makeSvgIcon:a,menuBarPosition:s,templateHtml:lr,usageStatistics:l}))._value=0,r._els={rotateButton:r.selector(".tie-rotate-button"),rotateRange:new Wn({slider:r.selector(".tie-rotate-range"),input:r.selector(".tie-rotate-range-value")},yi)},r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),this._els.rotateRange.destroy(),Wi(this)}},{key:"setRangeBarAngle",value:function(t,e){var i=e;"rotate"===t&&(i=$()(this._els.rotateRange.value,10)+e),this._setRangeBarRatio(i)}},{key:"_setRangeBarRatio",value:function(t){this._els.rotateRange.value=t}},{key:"addEvent",value:function(t){var e,i;this.eventHandler.rotationAngleChanged=A()(e=this._changeRotateForButton).call(e,this),this.actions=t,this._els.rotateButton.addEventListener("click",this.eventHandler.rotationAngleChanged),this._els.rotateRange.on("change",A()(i=this._changeRotateForRange).call(i,this))}},{key:"_removeEvent",value:function(){this._els.rotateButton.removeEventListener("click",this.eventHandler.rotationAngleChanged),this._els.rotateRange.off()}},{key:"_changeRotateForRange",value:function(t,e){var i=Bi(t);this.actions.setAngle(i,!e),this._value=i}},{key:"_changeRotateForButton",value:function(t){var e=t.target.closest(".tui-image-editor-button"),i=this._els.rotateRange.value;if(e){var n={clockwise:30,counterclockwise:-30}[this.getButtonType(e,["counterclockwise","clockwise"])],r=$()(i,10)+n;r>=-360&&r<=360&&this.actions.rotate(n)}}}]),i}(Un),hr=ur,fr=function(t){var e,i,n,r,o,a,s,l,c,u,h,f,g,d=t.locale,v=t.makeSvgIcon;return O()(e=O()(i=O()(n=O()(r=O()(o=O()(a=O()(s=O()(l=O()(c=O()(u=O()(h=O()(f=O()(g='\n <ul class="tui-image-editor-submenu-item">\n <li class="tie-text-effect-button">\n <div class="tui-image-editor-button bold">\n <div>\n '.concat(v(["normal","active"],"text-bold",!0),"\n </div>\n <label> ")).call(g,d.localize("Bold"),' </label>\n </div>\n <div class="tui-image-editor-button italic">\n <div>\n ')).call(f,v(["normal","active"],"text-italic",!0),"\n </div>\n <label> ")).call(h,d.localize("Italic"),' </label>\n </div>\n <div class="tui-image-editor-button underline">\n <div>\n ')).call(u,v(["normal","active"],"text-underline",!0),"\n </div>\n <label> ")).call(c,d.localize("Underline"),' </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li class="tie-text-align-button">\n <div class="tui-image-editor-button left">\n <div>\n ')).call(l,v(["normal","active"],"text-align-left",!0),"\n </div>\n <label> ")).call(s,d.localize("Left"),' </label>\n </div>\n <div class="tui-image-editor-button center">\n <div>\n ')).call(a,v(["normal","active"],"text-align-center",!0),"\n </div>\n <label> ")).call(o,d.localize("Center"),' </label>\n </div>\n <div class="tui-image-editor-button right">\n <div>\n ')).call(r,v(["normal","active"],"text-align-right",!0),"\n </div>\n <label> ")).call(n,d.localize("Right"),' </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li>\n <div class="tie-text-color" title="')).call(i,d.localize("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">')).call(e,d.localize("Text size"),'</label>\n <div class="tie-text-range"></div>\n <input class="tie-text-range-value tui-image-editor-range-value" value="0" />\n </li>\n </ul>\n')};function gr(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var dr=function(t){wn(i,t);var e=gr(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"text",makeSvgIcon:a,menuBarPosition:s,templateHtml:fr,usageStatistics:l})).effect={bold:!1,italic:!1,underline:!1},r.align="tie-text-align-left",r._els={textEffectButton:r.selector(".tie-text-effect-button"),textAlignButton:r.selector(".tie-text-align-button"),textColorpicker:new Rn(r.selector(".tie-text-color"),{defaultColor:"#ffbb3b",toggleDirection:r.toggleDirection,usageStatistics:r.usageStatistics}),textRange:new Wn({slider:r.selector(".tie-text-range"),input:r.selector(".tie-text-range-value")},Ci)},r.colorPickerInputBox=r._els.textColorpicker.colorpickerElement.querySelector(Me),r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),this._els.textColorpicker.destroy(),this._els.textRange.destroy(),Wi(this)}},{key:"addEvent",value:function(t){var e,i,n,r,o,a,s=A()(e=this._setTextEffectHandler).call(e,this),l=A()(i=this._setTextAlignHandler).call(i,this);this.eventHandler={setTextEffect:s,setTextAlign:l},this.actions=t,this._els.textEffectButton.addEventListener("click",s),this._els.textAlignButton.addEventListener("click",l),this._els.textRange.on("change",A()(n=this._changeTextRnageHandler).call(n,this)),this._els.textColorpicker.on("change",A()(r=this._changeColorHandler).call(r,this)),this.colorPickerInputBox.addEventListener(Ie,A()(o=this._onStartEditingInputBox).call(o,this)),this.colorPickerInputBox.addEventListener(_e,A()(a=this._onStopEditingInputBox).call(a,this))}},{key:"_removeEvent",value:function(){var t,e,i=this.eventHandler,n=i.setTextEffect,r=i.setTextAlign;this._els.textEffectButton.removeEventListener("click",n),this._els.textAlignButton.removeEventListener("click",r),this._els.textRange.off(),this._els.textColorpicker.off(),this.colorPickerInputBox.removeEventListener(Ie,A()(t=this._onStartEditingInputBox).call(t,this)),this.colorPickerInputBox.removeEventListener(_e,A()(e=this._onStopEditingInputBox).call(e,this))}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeStartMode",value:function(){this.actions.modeChange("text")}},{key:"textColor",get:function(){return this._els.textColorpicker.color},set:function(t){this._els.textColorpicker.color=t}},{key:"fontSize",get:function(){return this._els.textRange.value},set:function(t){this._els.textRange.value=t}},{key:"fontStyle",get:function(){return this.effect.italic?"italic":"normal"}},{key:"fontWeight",get:function(){return this.effect.bold?"bold":"normal"}},{key:"underline",get:function(){return this.effect.underline}},{key:"setTextStyleStateOnAction",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=nt()(t),i=t.fontSize,n=t.fontStyle,r=t.fontWeight,o=t.textDecoration,a=t.textAlign;this.textColor=e,this.fontSize=i,this.setEffectState("italic",n),this.setEffectState("bold",r),this.setEffectState("underline",o),this.setAlignState("tie-text-align-".concat(a))}},{key:"setEffectState",value:function(t,e){var i="italic"===e||"bold"===e||"underline"===e,n=this._els.textEffectButton.querySelector(".tui-image-editor-button.".concat(t));this.effect[t]=i,n.classList[i?"add":"remove"]("active")}},{key:"setAlignState",value:function(t){var e=this._els.textAlignButton;e.classList.remove(this.align),e.classList.add(t),this.align=t}},{key:"_setTextEffectHandler",value:function(t){var e=t.target.closest(".tui-image-editor-button");if(e){var i=Q(e.className.match(/(bold|italic|underline)/),1)[0],n={bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},underline:{textDecoration:"underline"}}[i];this.effect[i]=!this.effect[i],e.classList.toggle("active"),this.actions.changeTextStyle(n)}}},{key:"_setTextAlignHandler",value:function(t){var e=t.target.closest(".tui-image-editor-button");if(e){var i=this.getButtonType(e,["left","center","right"]),n="tie-text-align-".concat(i);t.currentTarget.classList.remove(this.align),this.align!==n&&t.currentTarget.classList.add(n),this.actions.changeTextStyle({textAlign:i}),this.align=n}}},{key:"_changeTextRnageHandler",value:function(t,e){this.actions.changeTextStyle({fontSize:t},!e)}},{key:"_changeColorHandler",value:function(t){t=t||"transparent",this.actions.changeTextStyle({fill:t})}}]),i}(Un),vr=dr,pr=function(t){var e,i,n,r=t.locale,o=t.makeSvgIcon;return O()(e=O()(i=O()(n='\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/*" class="tie-mask-image-file">\n '.concat(o(["normal","active"],"mask-load",!0),"\n </div>\n <label> ")).call(n,r.localize("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 class="tie-mask-apply tui-image-editor-newline apply" style="margin-top: 22px;margin-bottom: 5px">\n <div class="tui-image-editor-button apply">\n ')).call(i,o(["normal","active"],"apply"),"\n <label>\n ")).call(e,r.localize("Apply"),"\n </label>\n </div>\n </li>\n </ul>\n")};function mr(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var yr=function(t){wn(i,t);var e=mr(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"mask",makeSvgIcon:a,menuBarPosition:s,templateHtml:pr,usageStatistics:l}))._els={applyButton:r.selector(".tie-mask-apply"),maskImageButton:r.selector(".tie-mask-image-file")},r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),Wi(this)}},{key:"addEvent",value:function(t){var e,i,n=A()(e=this._loadMaskFile).call(e,this),r=A()(i=this._applyMask).call(i,this);this.eventHandler={loadMaskFile:n,applyMask:r},this.actions=t,this._els.maskImageButton.addEventListener("change",n),this._els.applyButton.addEventListener("click",r)}},{key:"_removeEvent",value:function(){this._els.maskImageButton.removeEventListener("change",this.eventHandler.loadMaskFile),this._els.applyButton.removeEventListener("click",this.eventHandler.applyMask)}},{key:"_applyMask",value:function(){this.actions.applyFilter(),this._els.applyButton.classList.remove("active")}},{key:"_loadMaskFile",value:function(t){var e;Fi()||alert("This browser does not support file-api");var i=Q(t.target.files,1)[0];i&&(e=P().createObjectURL(i),this.actions.loadImageFromURL(e,i),this._els.applyButton.classList.add("active"))}}]),i}(Un),br=yr,xr=function(t){var e,i,n,r,o,a,s,l,c,u,h,f,g,d,v,p,m,y,b,x,C=t.locale,I=t.makeSvgIcon;return O()(e=O()(i=O()(n=O()(r=O()(o=O()(a=O()(s=O()(l=O()(c=O()(u=O()(h=O()(f=O()(g=O()(d=O()(v=O()(p=O()(m=O()(y=O()(b=O()(x='\n <ul class="tui-image-editor-submenu-item">\n <li class="tie-icon-add-button">\n <div class="tui-image-editor-button" data-icontype="icon-arrow">\n <div>\n '.concat(I(["normal","active"],"icon-arrow",!0),"\n </div>\n <label>\n ")).call(x,C.localize("Arrow"),'\n </label>\n </div>\n <div class="tui-image-editor-button" data-icontype="icon-arrow-2">\n <div>\n ')).call(b,I(["normal","active"],"icon-arrow-2",!0),"\n </div>\n <label>\n ")).call(y,C.localize("Arrow-2"),'\n </label>\n </div>\n <div class="tui-image-editor-button" data-icontype="icon-arrow-3">\n <div>\n ')).call(m,I(["normal","active"],"icon-arrow-3",!0),"\n </div>\n <label>\n ")).call(p,C.localize("Arrow-3"),'\n </label>\n </div>\n <div class="tui-image-editor-button" data-icontype="icon-star">\n <div>\n ')).call(v,I(["normal","active"],"icon-star",!0),"\n </div>\n <label>\n ")).call(d,C.localize("Star-1"),'\n </label>\n </div>\n <div class="tui-image-editor-button" data-icontype="icon-star-2">\n <div>\n ')).call(g,I(["normal","active"],"icon-star-2",!0),"\n </div>\n <label>\n ")).call(f,C.localize("Star-2"),'\n </label>\n </div>\n\n <div class="tui-image-editor-button" data-icontype="icon-polygon">\n <div>\n ')).call(h,I(["normal","active"],"icon-polygon",!0),"\n </div>\n <label>\n ")).call(u,C.localize("Polygon"),'\n </label>\n </div>\n\n <div class="tui-image-editor-button" data-icontype="icon-location">\n <div>\n ')).call(c,I(["normal","active"],"icon-location",!0),"\n </div>\n <label>\n ")).call(l,C.localize("Location"),'\n </label>\n </div>\n\n <div class="tui-image-editor-button" data-icontype="icon-heart">\n <div>\n ')).call(s,I(["normal","active"],"icon-heart",!0),"\n </div>\n <label>\n ")).call(a,C.localize("Heart"),'\n </label>\n </div>\n\n <div class="tui-image-editor-button" data-icontype="icon-bubble">\n <div>\n ')).call(o,I(["normal","active"],"icon-bubble",!0),"\n </div>\n <label>\n ")).call(r,C.localize("Bubble"),'\n </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li class="tie-icon-add-button">\n <div class="tui-image-editor-button" style="margin:0">\n <div>\n <input type="file" accept="image/*" class="tie-icon-image-file">\n ')).call(n,I(["normal","active"],"icon-load",!0),"\n </div>\n <label>\n ")).call(i,C.localize("Custom icon"),'\n </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li>\n <div class="tie-icon-color" title="')).call(e,C.localize("Color"),'"></div>\n </li>\n </ul>\n')};function Cr(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Ir=function(t){wn(i,t);var e=Cr(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"icon",makeSvgIcon:a,menuBarPosition:s,templateHtml:xr,usageStatistics:l})).iconType=null,r._iconMap={},r._els={registerIconButton:r.selector(".tie-icon-image-file"),addIconButton:r.selector(".tie-icon-add-button"),iconColorpicker:new Rn(r.selector(".tie-icon-color"),{defaultColor:"#ffbb3b",toggleDirection:r.toggleDirection,usageStatistics:r.usageStatistics})},r.colorPickerInputBox=r._els.iconColorpicker.colorpickerElement.querySelector(Me),r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),this._els.iconColorpicker.destroy(),Wi(this)}},{key:"addEvent",value:function(t){var e,i,n,r,o,a=A()(e=this._registerIconHandler).call(e,this),s=A()(i=this._addIconHandler).call(i,this);this.eventHandler={registerIcon:a,addIcon:s},this.actions=t,this._els.iconColorpicker.on("change",A()(n=this._changeColorHandler).call(n,this)),this._els.registerIconButton.addEventListener("change",a),this._els.addIconButton.addEventListener("click",s),this.colorPickerInputBox.addEventListener(Ie,A()(r=this._onStartEditingInputBox).call(r,this)),this.colorPickerInputBox.addEventListener(_e,A()(o=this._onStopEditingInputBox).call(o,this))}},{key:"_removeEvent",value:function(){var t,e;this._els.iconColorpicker.off(),this._els.registerIconButton.removeEventListener("change",this.eventHandler.registerIcon),this._els.addIconButton.removeEventListener("click",this.eventHandler.addIcon),this.colorPickerInputBox.removeEventListener(Ie,A()(t=this._onStartEditingInputBox).call(t,this)),this.colorPickerInputBox.removeEventListener(_e,A()(e=this._onStopEditingInputBox).call(e,this))}},{key:"clearIconType",value:function(){this._els.addIconButton.classList.remove(this.iconType),this.iconType=null}},{key:"registerDefaultIcon",value:function(){var t=this;H()(mi,(function(e,i){t.actions.registerDefaultIcons(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:"_registerIconHandler",value:function(t){var e;Fi||alert("This browser does not support file-api");var i=Q(t.target.files,1)[0];i&&(e=P().createObjectURL(i),this.actions.registerCustomIcon(e,i))}}]),i}(Un),_r=Ir,Mr=function(t){var e,i,n,r,o,a=t.locale,s=t.makeSvgIcon;return O()(e=O()(i=O()(n=O()(r=O()(o='\n <ul class="tui-image-editor-submenu-item">\n <li class="tie-draw-line-select-button">\n <div class="tui-image-editor-button free">\n <div>\n '.concat(s(["normal","active"],"draw-free",!0),"\n </div>\n <label>\n ")).call(o,a.localize("Free"),'\n </label>\n </div>\n <div class="tui-image-editor-button line">\n <div>\n ')).call(r,s(["normal","active"],"draw-line",!0),"\n </div>\n <label>\n ")).call(n,a.localize("Straight"),'\n </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li>\n <div class="tie-draw-color" title="')).call(i,a.localize("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">')).call(e,a.localize("Range"),'</label>\n <div class="tie-draw-range"></div>\n <input class="tie-draw-range-value tui-image-editor-range-value" value="0" />\n </li>\n </ul>\n')};function Sr(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var wr=function(t){wn(i,t);var e=Sr(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon,s=n.menuBarPosition,l=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"draw",makeSvgIcon:a,menuBarPosition:s,templateHtml:Mr,usageStatistics:l}))._els={lineSelectButton:r.selector(".tie-draw-line-select-button"),drawColorPicker:new Rn(r.selector(".tie-draw-color"),{defaultColor:"#00a9ff",toggleDirection:r.toggleDirection,usageStatistics:r.usageStatistics}),drawRange:new Wn({slider:r.selector(".tie-draw-range"),input:r.selector(".tie-draw-range-value")},bi)},r.type=null,r.color=r._els.drawColorPicker.color,r.width=r._els.drawRange.value,r.colorPickerInputBox=r._els.drawColorPicker.colorpickerElement.querySelector(Me),r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),this._els.drawColorPicker.destroy(),this._els.drawRange.destroy(),Wi(this)}},{key:"addEvent",value:function(t){var e,i,n,r,o;this.eventHandler.changeDrawType=A()(e=this._changeDrawType).call(e,this),this.actions=t,this._els.lineSelectButton.addEventListener("click",this.eventHandler.changeDrawType),this._els.drawColorPicker.on("change",A()(i=this._changeDrawColor).call(i,this)),this._els.drawRange.on("change",A()(n=this._changeDrawRange).call(n,this)),this.colorPickerInputBox.addEventListener(Ie,A()(r=this._onStartEditingInputBox).call(r,this)),this.colorPickerInputBox.addEventListener(_e,A()(o=this._onStopEditingInputBox).call(o,this))}},{key:"_removeEvent",value:function(){var t,e;this._els.lineSelectButton.removeEventListener("click",this.eventHandler.changeDrawType),this._els.drawColorPicker.off(),this._els.drawRange.off(),this.colorPickerInputBox.removeEventListener(Ie,A()(t=this._onStartEditingInputBox).call(t,this)),this.colorPickerInputBox.removeEventListener(_e,A()(e=this._onStopEditingInputBox).call(e,this))}},{key:"setDrawMode",value:function(){this.actions.setDrawMode(this.type,{width:this.width,color:Yi(this.color,.7)})}},{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){this.width=t,this.type?this.setDrawMode():this.changeStartMode()}}]),i}(Un),kr=wr,Tr=n(9886),Dr=n.n(Tr),Ar=function(t){var e,i,n,r,o,a,s,l,c,u,h,f,g,d,v,p,m=t.locale;return O()(e=O()(i=O()(n=O()(r=O()(o=O()(a=O()(s=O()(l=O()(c=O()(u=O()(h=O()(f=O()(g=O()(d=O()(v=O()(p='\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 <label>\n <input type="checkbox" class="tie-grayscale">\n <span>'.concat(m.localize("Grayscale"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-invert">\n <span>')).call(p,m.localize("Invert"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-sepia">\n <span>')).call(v,m.localize("Sepia"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-vintage">\n <span>')).call(d,m.localize("Sepia2"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-blur">\n <span>')).call(g,m.localize("Blur"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-sharpen">\n <span>')).call(f,m.localize("Sharpen"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-emboss">\n <span>')).call(h,m.localize("Emboss"),'</span>\n </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 <label>\n <input type="checkbox" class="tie-remove-white">\n <span>')).call(u,m.localize("Remove White"),'</span>\n </label>\n </div>\n </div>\n <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n <label>')).call(c,m.localize("Distance"),'</label>\n <div class="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-checkbox">\n <label>\n <input type="checkbox" class="tie-brightness">\n <span>')).call(l,m.localize("Brightness"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-range-wrap short">\n <div class="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 <label>\n <input type="checkbox" class="tie-noise">\n <span>')).call(s,m.localize("Noise"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-range-wrap short">\n <div class="tie-noise-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 <label>\n <input type="checkbox" class="tie-pixelate">\n <span>')).call(a,m.localize("Pixelate"),'</span>\n </label>\n </div>\n <div class="tui-image-editor-range-wrap short">\n <div class="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 <label>\n <input type="checkbox" class="tie-color-filter">\n <span>')).call(o,m.localize("Color Filter"),'</span>\n </label>\n </div>\n </div>\n <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n <label>')).call(r,m.localize("Threshold"),'</label>\n <div class="tie-colorfilter-threshold-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 class="tie-filter-tint-color" title="')).call(n,m.localize("Tint"),'"></div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-tint">\n <span></span>\n </label>\n </div>\n </div>\n <div class="filter-color-item">\n <div class="tie-filter-multiply-color" title="')).call(i,m.localize("Multiply"),'"></div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-multiply">\n <span></span>\n </label>\n </div>\n </div>\n <div class="filter-color-item">\n <div class="tie-filter-blend-color" title="')).call(e,m.localize("Blend"),'"></div>\n <div class="tui-image-editor-checkbox">\n <label>\n <input type="checkbox" class="tie-blend">\n <span></span>\n </label>\n </div>\n </div>\n </li>\n </ul>\n')};function jr(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Or="130px",Er=["add","diff","subtract","multiply","screen","lighten","darken"],Lr=["grayscale","invert","sepia","vintage","blur","sharpen","emboss","remove-white","brightness","noise","pixelate","color-filter","tint","multiply","blend"],Nr={grayscale:"grayscale",invert:"invert",sepia:"sepia",blur:"blur",sharpen:"sharpen",emboss:"emboss",removeWhite:"removeColor",brightness:"brightness",contrast:"contrast",saturation:"saturation",vintage:"vintage",polaroid:"polaroid",noise:"noise",pixelate:"pixelate",colorFilter:"removeColor",tint:"blendColor",multiply:"blendColor",blend:"blendColor",hue:"hue",gamma:"gamma"},Pr=["removewhiteDistanceRange","colorfilterThresholdRange","pixelateRange","noiseRange","brightnessRange","tintOpacity"],zr=["filterBlendColor","filterMultiplyColor","filterTintColor"],Br=function(t){wn(i,t);var e=jr(i);function i(t,n){var r,o=n.locale,a=n.menuBarPosition,s=n.usageStatistics;return w(this,i),(r=e.call(this,t,{locale:o,name:"filter",menuBarPosition:a,templateHtml:Ar,usageStatistics:s})).selectBoxShow=!1,r.checkedMap={},r._makeControlElement(),r}return T(i,[{key:"destroy",value:function(){this._removeEvent(),this._destroyToolInstance(),Wi(this)}},{key:"_removeEvent",value:function(){var t,e=this;H()(Lr,(function(t){var i=e.selector(".tie-".concat(t)),n=Ri(t);i.removeEventListener("change",e.eventHandler[n])})),H()(O()(t=[]).call(t,Pr,zr),(function(t){e._els[t].off()})),this._els.blendType.removeEventListener("change",this.eventHandler.changeBlendFilter),this._els.blendType.removeEventListener("click",this.eventHandler.changeBlendFilter),Ln()(this.colorPickerInputBoxes,(function(t){var i,n;t.removeEventListener(Ie,A()(i=e._onStartEditingInputBox).call(i,e)),t.removeEventListener(_e,A()(n=e._onStopEditingInputBox).call(n,e))}),this)}},{key:"_destroyToolInstance",value:function(){var t,e=this;H()(O()(t=[]).call(t,Pr,zr),(function(t){e._els[t].destroy()}))}},{key:"addEvent",value:function(t){var e,i,n,r=this,o=t.applyFilter,a=function(t){var e;return A()(e=r._changeFilterState).call(e,r,o,t)},s=function(t){return function(e,i){return r._changeFilterState(o,t,i)}};this.eventHandler={changeBlendFilter:a("blend"),blandTypeClick:function(t){return t.stopPropagation()}},H()(Lr,(function(t){var e=r.selector(".tie-".concat(t)),i=Ri(t);r.checkedMap[i]=e,r.eventHandler[i]=a(i),e.addEventListener("change",r.eventHandler[i])})),this._els.removewhiteDistanceRange.on("change",s("removeWhite")),this._els.colorfilterThresholdRange.on("change",s("colorFilter")),this._els.pixelateRange.on("change",s("pixelate")),this._els.noiseRange.on("change",s("noise")),this._els.brightnessRange.on("change",s("brightness")),this._els.filterBlendColor.on("change",this.eventHandler.changeBlendFilter),this._els.filterMultiplyColor.on("change",a("multiply")),this._els.filterTintColor.on("change",a("tint")),this._els.tintOpacity.on("change",s("tint")),this._els.filterMultiplyColor.on("changeShow",A()(e=this.colorPickerChangeShow).call(e,this)),this._els.filterTintColor.on("changeShow",A()(i=this.colorPickerChangeShow).call(i,this)),this._els.filterBlendColor.on("changeShow",A()(n=this.colorPickerChangeShow).call(n,this)),this._els.blendType.addEventListener("change",this.eventHandler.changeBlendFilter),this._els.blendType.addEventListener("click",this.eventHandler.blandTypeClick),Ln()(this.colorPickerInputBoxes,(function(t){var e,i;t.addEventListener(Ie,A()(e=r._onStartEditingInputBox).call(e,r)),t.addEventListener(_e,A()(i=r._onStopEditingInputBox).call(i,r))}),this)}},{key:"setFilterState",value:function(t){var e=t.type,i=t.options,n=t.action,r=this._getFilterNameFromOptions(e,i),o="remove"===n;o||this._setFilterState(r,i),this.checkedMap[r].checked=!o}},{key:"initFilterCheckBoxState",value:function(){H()(this.checkedMap,(function(t){t.checked=!1}),this)}},{key:"_setFilterState",value:function(t,e){"colorFilter"===t?this._els.colorfilterThresholdRange.value=e.distance:"removeWhite"===t?this._els.removewhiteDistanceRange.value=e.distance:"pixelate"===t?this._els.pixelateRange.value=e.blocksize:"brightness"===t?this._els.brightnessRange.value=e.brightness:"noise"===t?this._els.noiseRange.value=e.noise:"tint"===t?(this._els.tintOpacity.value=e.alpha,this._els.filterTintColor.color=e.color):"blend"===t?this._els.filterBlendColor.color=e.color:"multiply"===t&&(this._els.filterMultiplyColor.color=e.color)}},{key:"_getFilterNameFromOptions",value:function(t,e){var i=t;return"removeColor"===t?i=Dr()(e.useAlpha)?"removeWhite":"colorFilter":"blendColor"===t&&(i={add:"blend",multiply:"multiply",tint:"tint"}[e.mode]),i}},{key:"_changeFilterState",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=this.checkedMap[e].checked,r=Nr[e],o=this.checkedMap[e].closest(".tui-image-editor-checkbox-group");o&&(n?o.classList.remove("tui-image-editor-disabled"):o.classList.add("tui-image-editor-disabled")),t(n,r,this._getFilterOption(e),!i)}},{key:"_getFilterOption",value:function(t){var e={};switch(t){case"removeWhite":e.color="#FFFFFF",e.useAlpha=!1,e.distance=dn()(this._els.removewhiteDistanceRange.value);break;case"colorFilter":e.color="#FFFFFF",e.distance=dn()(this._els.colorfilterThresholdRange.value);break;case"pixelate":e.blocksize=Bi(this._els.pixelateRange.value);break;case"noise":e.noise=Bi(this._els.noiseRange.value);break;case"brightness":e.brightness=dn()(this._els.brightnessRange.value);break;case"blend":e.mode="add",e.color=this._els.filterBlendColor.color,e.mode=this._els.blendType.value;break;case"multiply":e.mode="multiply",e.color=this._els.filterMultiplyColor.color;break;case"tint":e.mode="tint",e.color=this._els.filterTintColor.color,e.alpha=this._els.tintOpacity.value;break;case"blur":e.blur=this._els.blurRange.value;break;default:break}return e}},{key:"_makeControlElement",value:function(){this._els={removewhiteDistanceRange:new Wn({slider:this.selector(".tie-removewhite-distance-range")},Ii.removewhiteDistanceRange),brightnessRange:new Wn({slider:this.selector(".tie-brightness-range")},Ii.brightnessRange),noiseRange:new Wn({slider:this.selector(".tie-noise-range")},Ii.noiseRange),pixelateRange:new Wn({slider:this.selector(".tie-pixelate-range")},Ii.pixelateRange),colorfilterThresholdRange:new Wn({slider:this.selector(".tie-colorfilter-threshold-range")},Ii.colorfilterThresholdRange),filterTintColor:new Rn(this.selector(".tie-filter-tint-color"),{defaultColor:"#03bd9e",toggleDirection:this.toggleDirection,usageStatistics:this.usageStatistics}),filterMultiplyColor:new Rn(this.selector(".tie-filter-multiply-color"),{defaultColor:"#515ce6",toggleDirection:this.toggleDirection,usageStatistics:this.usageStatistics}),filterBlendColor:new Rn(this.selector(".tie-filter-blend-color"),{defaultColor:"#ffbb3b",toggleDirection:this.toggleDirection,usageStatistics:this.usageStatistics}),blurRange:Ii.blurFilterRange},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),this.colorPickerInputBoxes=[],this.colorPickerInputBoxes.push(this._els.filterTintColor.colorpickerElement.querySelector(Me)),this.colorPickerInputBoxes.push(this._els.filterMultiplyColor.colorpickerElement.querySelector(Me)),this.colorPickerInputBoxes.push(this._els.filterBlendColor.colorpickerElement.querySelector(Me))}},{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=Or,new Wn({slider:n},Ii.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=Or,this._drawSelectOptionList(i,n),this._pickerWithSelectboxForAddEvent(i,n),i}},{key:"_drawSelectOptionList",value:function(t,e){var i=t.querySelectorAll("option");H()(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="'.concat(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='".concat(t.value,"']")).classList.add("active")}))}},{key:"_makeSelectOptionList",value:function(t){H()(Er,(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)}))}}]),i}(Un),Rr=Br,Fr=n(4383),Yr=n.n(Fr);function Wr(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Hr="selected-item",Ur="disabled-item",Gr=function(t){wn(i,t);var e=Wr(i);function i(t,n){var r,o=n.locale,a=n.makeSvgIcon;return w(this,i),r=e.call(this,t,{name:"history"}),t.classList.add("enabled"),r.locale=o,r.makeSvgIcon=a,r._eventHandler={},r._historyIndex=r.getListLength(),r}return T(i,[{key:"add",value:function(t){var e=t.name,i=t.detail;this._hasDisabledItem()&&this.deleteListItemElement(this._historyIndex+1,this.getListLength());var n=function(t){var e,i,n,r=t.locale,o=t.makeSvgIcon,a=t.name,s=t.detail;return O()(e=O()(i=O()(n='\n <div class="tui-image-editor-history-item history">\n <div class="history-item-icon">\n '.concat(o(["normal","active"],"history-".concat(a.toLowerCase()),!0),"\n </div>\n <span>\n ")).call(n,r.localize(a),"\n ")).call(i,s?"(".concat(r.localize(s),")"):"",'\n </span>\n <div class="history-item-checkbox">\n ')).call(e,o(["normal"],"history-check",!0),"\n </div>\n </div>\n")}({locale:this.locale,makeSvgIcon:this.makeSvgIcon,name:e,detail:i}),r=this.makeListItemElement(n);this.pushListItemElement(r),this._historyIndex=this.getListLength()-1,this._selectItem(this._historyIndex)}},{key:"init",value:function(){this.deleteListItemElement(1,this.getListLength()),this._historyIndex=0,this._selectItem(this._historyIndex)}},{key:"clear",value:function(){this.deleteListItemElement(0,this.getListLength()),this._historyIndex=-1}},{key:"prev",value:function(){this._historyIndex-=1,this._selectItem(this._historyIndex)}},{key:"next",value:function(){this._historyIndex+=1,this._selectItem(this._historyIndex)}},{key:"_hasDisabledItem",value:function(){return this.getListLength()-1>this._historyIndex}},{key:"_addHistoryEventListener",value:function(){var t=this;this._eventHandler.history=function(e){return t._clickHistoryItem(e)},this.listElement.addEventListener("click",this._eventHandler.history)}},{key:"_removeHistoryEventListener",value:function(){this.listElement.removeEventListener("click",this._eventHandler.history)}},{key:"_clickHistoryItem",value:function(t){var e=t.target.closest(".".concat("history-item"));if(e){var i=Yr()(e.getAttribute("data-index"),10);if(i!==this._historyIndex){var n=Math.abs(i-this._historyIndex);i<this._historyIndex?this._actions.undo(n):this._actions.redo(n)}}}},{key:"_selectItem",value:function(t){for(var e=0;e<this.getListLength();e+=1)this.removeClass(e,Hr),this.removeClass(e,Ur),e>t&&this.addClass(e,Ur);this.addClass(t,Hr)}},{key:"destroy",value:function(){this.removeEvent(),Wi(this)}},{key:"addEvent",value:function(t){this._actions=t,this._addHistoryEventListener()}},{key:"removeEvent",value:function(){this._removeHistoryEventListener()}}]),i}(function(){function t(e,i){var n=i.name;w(this,t),this.name=n,this.items=[],this.panelElement=this._makePanelElement(),this.listElement=this._makeListElement(),this.panelElement.appendChild(this.listElement),e.appendChild(this.panelElement)}return T(t,[{key:"_makePanelElement",value:function(){var t=document.createElement("div");return t.className="tie-panel-".concat(this.name),t}},{key:"_makeListElement",value:function(){var t=document.createElement("ol");return t.className="".concat(this.name,"-list"),t}},{key:"makeListItemElement",value:function(t){var e=document.createElement("li");return e.innerHTML=t,e.className="".concat(this.name,"-item"),e.setAttribute("data-index",this.items.length),e}},{key:"pushListItemElement",value:function(t){this.listElement.appendChild(t),this.listElement.scrollTop+=t.offsetHeight,this.items.push(t)}},{key:"deleteListItemElement",value:function(t,e){for(var i=this.items,n=t;n<e;n+=1)this.listElement.removeChild(i[n]);s()(i).call(i,t,e-t+1)}},{key:"getListLength",value:function(){return this.items.length}},{key:"addClass",value:function(t,e){this.items[t]&&this.items[t].classList.add(e)}},{key:"removeClass",value:function(t,e){this.items[t]&&this.items[t].classList.remove(e)}},{key:"toggleClass",value:function(t,e){this.items[t]&&this.items[t].classList.toggle(e)}}]),t}()),Xr=Gr,Zr=function(){function t(e){w(this,t),this._locale=e}return T(t,[{key:"localize",value:function(t){return this._locale[t]||t}}]),t}(),Vr=Zr,Jr={Shape:Jn,Crop:$n,Resize:nr,Flip:sr,Rotate:hr,Text:vr,Mask:br,Icon:_r,Draw:kr,Filter:Rr},Qr="1300",Kr="on",qr="zoomIn",$r="hand",to=function(){function t(e,i,n){w(this,t),this.options=this._initializeOption(i),this._actions=n,this.submenu=!1,this.imageSize={},this.uiSize={},this._locale=new Vr(this.options.locale),this.theme=new xn(this.options.theme),this.eventHandler={},this._submenuChangeTransection=!1,this._selectedElement=null,this._mainElement=null,this._editorElementWrap=null,this._editorElement=null,this._menuBarElement=null,this._subMenuElement=null,this._makeUiElement(e),this._setUiSize(),this._initMenuEvent=!1,this._makeSubMenu(),this._attachHistoryEvent(),this._attachZoomEvent()}return T(t,[{key:"destroy",value:function(){this._removeUiEvent(),this._destroyAllMenu(),this._selectedElement.innerHTML="",Wi(this)}},{key:"setUiDefaultSelectionStyle",value:function(t){return R()({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._getCanvasMaxDimension(),o=r.width,a=r.height,s=this._editorElement.style,l=this.options.menuBarPosition;s.height="".concat(a,"px"),s.width="".concat(o,"px"),this._setEditorPosition(l),this._editorElementWrap.style.bottom="0px",this._editorElementWrap.style.top="0px",this._editorElementWrap.style.left="0px",this._editorElementWrap.style.width="100%";var c=this._selectedElement.classList;"top"===l&&this._selectedElement.offsetWidth<Qr?c.add("tui-image-editor-top-optimization"):c.remove("tui-image-editor-top-optimization")}},{key:"toggleZoomButtonStatus",value:function(t){this._buttonElements[t].classList.toggle(Kr),t===qr?this._buttonElements[$r].classList.remove(Kr):this._buttonElements[qr].classList.remove(Kr)}},{key:"offZoomInButtonStatus",value:function(){this._buttonElements[qr].classList.remove(Kr)}},{key:"changeHandButtonStatus",value:function(t){this._buttonElements[$r].classList[t?"add":"remove"](Kr)}},{key:"changeHelpButtonEnabled",value:function(t,e){this._buttonElements[t].classList[e?"add":"remove"]("enabled")}},{key:"_initializeOption",value:function(t){return R()({loadImage:{path:"",name:""},locale:{},menuIconPath:"",menu:["resize","crop","flip","rotate","draw","shape","icon","text","mask","filter"],initMenu:"",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;H()(this.options.menu,(function(e){var i,n=Jr[e.replace(/^[a-z]/,(function(t){return t.toUpperCase()}))];t._makeMenuElement(e),t._buttonElements[e]=t._menuBarElement.querySelector(".tie-btn-".concat(e)),t[e]=new n(t._subMenuElement,{locale:t._locale,makeSvgIcon:A()(i=t.theme.makeMenSvgIconSet).call(i,t.theme),menuBarPosition:t.options.menuBarPosition,usageStatistics:t.options.usageStatistics})}))}},{key:"_attachHistoryEvent",value:function(){var t,e,i;this.on(fe,A()(t=this._addHistory).call(t,this)),this.on(ge,A()(e=this._selectPrevHistory).call(e,this)),this.on(de,A()(i=this._selectNextHistory).call(i,this))}},{key:"_attachZoomEvent",value:function(){var t=this;this.on(pe,(function(){t.offZoomInButtonStatus(),t.changeHandButtonStatus(!0)})),this.on(me,(function(){return t.changeHandButtonStatus(!1)}))}},{key:"_makeUiElement",value:function(t){var e,i;i=t.nodeType?t:document.querySelector(t);var n,r=(n=i,function(t){return n.querySelector(t)});i.classList.add("tui-image-editor-container"),i.innerHTML=function(t){var e,i,n,r,o,a,s=t.locale,l=t.biImage,c=t.loadButtonStyle,u=t.downloadButtonStyle,h=t.menuBarPosition;return O()(e=O()(i=O()(n=O()(r=O()(o='\n <ul class="tui-image-editor-help-menu '.concat((a=h,"top"===a?"bottom":"left"===a?"right":"right"===a?"left":"top"),'"></ul>\n <div class="tui-image-editor-controls">\n <div class="tui-image-editor-controls-logo">\n <img src="')).call(o,l,'" />\n </div>\n <ul class="tui-image-editor-menu"></ul>\n\n <div class="tui-image-editor-controls-buttons">\n <div style="')).call(r,c,'">\n ')).call(n,s.localize("Load"),'\n <input type="file" class="tui-image-editor-load-btn" />\n </div>\n <button class="tui-image-editor-download-btn" style="')).call(i,u,'">\n ')).call(e,s.localize("Download"),"\n </button>\n </div>\n </div>\n")}({locale:this._locale,biImage:this.theme.getStyle("common.bi"),loadButtonStyle:this.theme.getStyle("loadButton"),downloadButtonStyle:this.theme.getStyle("downloadButton"),menuBarPosition:this.options.menuBarPosition})+function(t){var e,i,n,r,o,a,s,l=t.locale,c=t.biImage,u=t.commonStyle,h=t.headerStyle,f=t.loadButtonStyle,g=t.downloadButtonStyle,d=t.submenuStyle;return O()(e=O()(i=O()(n=O()(r=O()(o=O()(a=O()(s='\n <div class="tui-image-editor-main-container" style="'.concat(u,'">\n <div class="tui-image-editor-header" style="')).call(s,h,'">\n <div class="tui-image-editor-header-logo">\n <img src="')).call(a,c,'" />\n </div>\n <div class="tui-image-editor-header-buttons">\n <div style="')).call(o,f,'">\n ')).call(r,l.localize("Load"),'\n <input type="file" class="tui-image-editor-load-btn" />\n </div>\n <button class="tui-image-editor-download-btn" style="')).call(n,g,'">\n ')).call(i,l.localize("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="')).call(e,d,'"></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')}({locale:this._locale,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=i,this._selectedElement.classList.add(this.options.menuBarPosition),this._mainElement=r(".tui-image-editor-main"),this._editorElementWrap=r(".tui-image-editor-wrap"),this._editorElement=r(".tui-image-editor"),this._helpMenuBarElement=r(".tui-image-editor-help-menu"),this._menuBarElement=r(".tui-image-editor-menu"),this._subMenuElement=r(".tui-image-editor-submenu"),this._buttonElements={download:this._selectedElement.querySelectorAll(".tui-image-editor-download-btn"),load:this._selectedElement.querySelectorAll(".tui-image-editor-load-btn")},this._addHelpMenus(),this._historyMenu=new Xr(this._buttonElements.history,{locale:this._locale,makeSvgIcon:A()(e=this.theme.makeMenSvgIconSet).call(e,this.theme)}),this._activateZoomMenus()}},{key:"_activateZoomMenus",value:function(){var t=this;H()(ut,(function(e){t.changeHelpButtonEnabled(e,!0)}))}},{key:"_makeHelpMenuWithPartition",value:function(){var t;return O()(t=[]).call(t,_(ut),[""],_(ht),[""],_(ft))}},{key:"_addHelpMenus",value:function(){var t=this,e=this._makeHelpMenuWithPartition();H()(e,(function(e){e?(t._makeMenuElement(e,["normal","disabled","hover"],"help"),t._buttonElements[e]=t._helpMenuBarElement.querySelector(".tie-btn-".concat(e))):t._makeMenuPartitionElement()}))}},{key:"_makeMenuPartitionElement",value:function(){var t=document.createElement("li"),e=document.createElement("div");t.className=Hi("item"),e.className=Hi("icpartition"),t.appendChild(e),this._helpMenuBarElement.appendChild(t)}},{key:"_makeMenuElement",value:function(t){var e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["normal","active","hover"],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal",o=document.createElement("li"),a=this.theme.makeMenSvgIconSet(n,t);this._addTooltipAttribute(o,t),o.className=O()(e=O()(i="tie-btn-".concat(t," ")).call(i,Hi("item")," ")).call(e,r),o.innerHTML=a,"normal"===r?this._menuBarElement.appendChild(o):this._helpMenuBarElement.appendChild(o)}},{key:"_addHelpActionEvent",value:function(){var t=this;H()(gt,(function(e){t.eventHandler[e]=function(i){return t._actions.main[e](i)},t._buttonElements[e].addEventListener("click",t.eventHandler[e])}))}},{key:"_removeHelpActionEvent",value:function(){var t=this;H()(gt,(function(e){t._buttonElements[e].removeEventListener("click",t.eventHandler[e])}))}},{key:"_addHistory",value:function(t){if(!function(t){return"string"==typeof t?Tt===t:Tt===t.name}(t)){var e="string"==typeof t?{name:t}:function(t){var e,i,n,r=Dt,o=At,a=Rt,s=Et,l=Lt,c=Bt,u=Pt,f=Yt,g=kt,d=Wt,v=Ot,p=Zt,m=t.name,y=t.args;switch(m){case r:n={name:m,detail:"reset"===y[1]?y[1]:h()(e=y[1]).call(e,4)};break;case o:n={name:m,detail:y[2]};break;case s:n={name:Ae,detail:Ki(y[1],y[2])};break;case l:n={name:je,detail:"Remove"};break;case c:n={name:Oe,detail:"Change"};break;case u:n={name:Ee,detail:"Change"};break;case f:n={name:Ne,detail:"Change"};break;case v:n={name:Pe,detail:y[2]};break;case g:n={name:ze,detail:"All"};break;case d:n={name:ke,detail:"Add"};break;case a:n={name:Le};break;case p:n={name:De,detail:O()(i="".concat(~~y[1].width,"x")).call(i,~~y[1].height)};break;default:n={name:m};break}return"mask"===y[1]&&(n={name:we,detail:"Apply"}),n}(t);this._historyMenu.add(e)}}},{key:"initHistory",value:function(){this._historyMenu.init()}},{key:"clearHistory",value:function(){this._historyMenu.clear()}},{key:"_selectPrevHistory",value:function(){this._historyMenu.prev()}},{key:"_selectNextHistory",value:function(){this._historyMenu.next()}},{key:"toggleHistoryMenu",value:function(t){t.target.closest(".".concat("tie-panel-history"))||this._buttonElements.history.classList.toggle("opened")}},{key:"_addTooltipAttribute",value:function(t,e){t.setAttribute("tooltip-content",this._locale.localize(e.replace(/^[a-z]/g,(function(t){return t.toUpperCase()}))))}},{key:"_addDownloadEvent",value:function(){var t=this;this.eventHandler.download=function(){return t._actions.main.download()},H()(this._buttonElements.download,(function(e){e.addEventListener("click",t.eventHandler.download)}))}},{key:"_removeDownloadEvent",value:function(){var t=this;H()(this._buttonElements.download,(function(e){e.removeEventListener("click",t.eventHandler.download)}))}},{key:"_addLoadEvent",value:function(){var t=this;this.eventHandler.loadImage=function(e){return t._actions.main.load(e.target.files[0])},H()(this._buttonElements.load,(function(e){e.addEventListener("change",t.eventHandler.loadImage)}))}},{key:"_removeLoadEvent",value:function(){var t=this;H()(this._buttonElements.load,(function(e){e.removeEventListener("change",t.eventHandler.loadImage)}))}},{key:"_addMainMenuEvent",value:function(t){var e=this;this.eventHandler[t]=function(){return e.changeMenu(t)},this._buttonElements[t].addEventListener("click",this.eventHandler[t])}},{key:"_addSubMenuEvent",value:function(t){var e=this;this[t].addEvent(this._actions[t]),this[t].on(xe,(function(){return e.fire(xe)})),this[t].on(Ce,(function(){return e.fire(Ce)}))}},{key:"_addMenuEvent",value:function(){var t=this;H()(this.options.menu,(function(e){t._addMainMenuEvent(e),t._addSubMenuEvent(e)}))}},{key:"_removeMainMenuEvent",value:function(){var t=this;H()(this.options.menu,(function(e){t._buttonElements[e].removeEventListener("click",t.eventHandler[e]),t[e].off(xe),t[e].off(Ce)}))}},{key:"getEditorArea",value:function(){return this._editorElement}},{key:"activeMenuEvent",value:function(){this._initMenuEvent||(this._addHelpActionEvent(),this._addDownloadEvent(),this._addMenuEvent(),this._initMenu(),this._historyMenu.addEvent(this._actions.history),this._initMenuEvent=!0)}},{key:"_removeUiEvent",value:function(){this._removeHelpActionEvent(),this._removeDownloadEvent(),this._removeLoadEvent(),this._removeMainMenuEvent(),this._historyMenu.removeEvent()}},{key:"_destroyAllMenu",value:function(){var t=this;H()(this.options.menu,(function(e){t[e].destroy()})),this._historyMenu.destroy()}},{key:"initCanvas",value:function(){var t=this,e=this._getLoadImage();e.path&&this._actions.main.initLoadImage(e.path,e.name).then((function(){t.activeMenuEvent()})),this._addLoadEvent();var i=document.createElement("div");i.className=Hi("grid-visual");i.innerHTML='<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>',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._buttonElements[this.submenu].classList.remove("active"),this._mainElement.classList.remove("tui-image-editor-menu-".concat(this.submenu)),i&&this._actions.main.discardSelection(),this._actions.main.changeSelectableAll(!0),this[this.submenu].changeStandbyMode()),this.submenu===t&&e?this.submenu=null:(this._buttonElements[t].classList.add("active"),this._mainElement.classList.add("tui-image-editor-menu-".concat(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._buttonElements[this.options.initMenu].dispatchEvent(t)}this.icon&&this.icon.registerDefaultIcon()}},{key:"_getCanvasMaxDimension",value:function(){var t=this._editorContainerElement.style,e=t.maxWidth,i=t.maxHeight;return{width:dn()(e),height:dn()(i)}}},{key:"_setEditorPosition",value:function(t){var e=this._getCanvasMaxDimension(),i=e.width,n=e.height,r=this._editorElement.style,o=0,a=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?a=i>this._editorElementWrap.offsetWidth-248?124-(i-(this._editorElementWrap.offsetWidth-248))/2:124:"right"===t&&(a=i>this._editorElementWrap.scrollWidth-248?(i-this._editorElementWrap.scrollWidth)/2:-124)),r.top="".concat(o,"px"),r.left="".concat(a,"px")}}]),t}();G().mixin(to);var eo=to,io=n(381),no=n.n(io),ro=function(){function t(){w(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 T(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,n=this.colorquantization(t,e);if(0===e.layering){i={layers:[],palette:n.palette,width:n.array[0].length-2,height:n.array.length-2};for(var r=0;r<n.palette.length;r+=1){var o=this.batchtracepaths(this.internodes(this.pathscan(this.layeringstep(n,r),e.pathomit),e),e.ltres,e.qtres);i.layers.push(o)}}else{var a=this.layering(n);e.layercontainerid&&this.drawLayers(a,this.specpalette,e.scale,e.layercontainerid);var s=this.batchpathscan(a,e.pathomit),l=this.batchinternodes(s,e);i={layers:this.batchtracelayers(l,e.ltres,e.qtres),palette:n.palette,width:t.width,height:t.height}}return i}},{key:"checkoptions",value:function(t){"string"==typeof(t=t||{})&&(t=t.toLowerCase(),t=this.optionpresets[t]?this.optionpresets[t]:{});for(var e=J()(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,r,o,a,s,l,c,u=[],h=0,f=[],g=t.width*t.height;for(a=0;a<t.height+2;a+=1)for(u[a]=[],o=0;o<t.width+2;o+=1)u[a][o]=-1;for(c=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)),l=0;l<e.colorquantcycles;l+=1){if(l>0)for(s=0;s<c.length;s+=1)f[s].n>0&&(c[s]={r:Math.floor(f[s].r/f[s].n),g:Math.floor(f[s].g/f[s].n),b:Math.floor(f[s].b/f[s].n),a:Math.floor(f[s].a/f[s].n)}),f[s].n/g<e.mincolorratio&&l<e.colorquantcycles-1&&(c[s]={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(o=0;o<c.length;o+=1)f[o]={r:0,g:0,b:0,a:0,n:0};for(a=0;a<t.height;a+=1)for(o=0;o<t.width;o+=1){for(h=4*(a*t.width+o),r=0,n=1024,s=0;s<c.length;s+=1)(i=Math.abs(c[s].r-t.data[h])+Math.abs(c[s].g-t.data[h+1])+Math.abs(c[s].b-t.data[h+2])+Math.abs(c[s].a-t.data[h+3]))<n&&(n=i,r=s);f[r].r+=t.data[h],f[r].g+=t.data[h+1],f[r].b+=t.data[h+2],f[r].a+=t.data[h+3],f[r].n+=1,u[a+1][o+1]=r}}return{array:u,palette:c}}},{key:"samplepalette",value:function(t,e){for(var i,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,n=[],r=Math.ceil(Math.sqrt(t)),o=Math.ceil(t/r),a=e.width/(r+1),s=e.height/(o+1),l=0;l<o;l+=1)for(var c=0;c<r&&n.length!==t;c+=1)i=4*Math.floor((l+1)*s*e.width+(c+1)*a),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,n,r=[];if(t<8)for(var o=Math.floor(255/(t-1)),a=0;a<t;a+=1)r.push({r:a*o,g:a*o,b:a*o,a:255});else{var s=Math.floor(Math.pow(t,1/3)),l=Math.floor(255/(s-1)),c=t-s*s*s;for(e=0;e<s;e+=1)for(i=0;i<s;i+=1)for(n=0;n<s;n+=1)r.push({r:e*l,g:i*l,b:n*l,a:255});for(e=0;e<c;e+=1)r.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 r}},{key:"layering",value:function(t){var e,i,n,r,o,a,s,l,c,u,h,f=[],g=0,d=t.array.length,v=t.array[0].length;for(h=0;h<t.palette.length;h+=1)for(f[h]=[],u=0;u<d;u+=1)for(f[h][u]=[],c=0;c<v;c+=1)f[h][u][c]=0;for(u=1;u<d-1;u+=1)for(c=1;c<v-1;c+=1)g=t.array[u][c],e=t.array[u-1][c-1]===g?1:0,i=t.array[u-1][c]===g?1:0,n=t.array[u-1][c+1]===g?1:0,r=t.array[u][c-1]===g?1:0,o=t.array[u][c+1]===g?1:0,a=t.array[u+1][c-1]===g?1:0,s=t.array[u+1][c]===g?1:0,l=t.array[u+1][c+1]===g?1:0,f[g][u+1][c+1]=1+2*o+4*l+8*s,r||(f[g][u+1][c]=2+4*s+8*a),i||(f[g][u][c+1]=0+2*n+4*o+8),e||(f[g][u][c]=0+2*i+4+8*r);return f}},{key:"layeringstep",value:function(t,e){var i,n,r=[],o=t.array.length,a=t.array[0].length;for(n=0;n<o;n+=1)for(r[n]=[],i=0;i<a;i+=1)r[n][i]=0;for(n=1;n<o;n+=1)for(i=1;i<a;i+=1)r[n][i]=(t.array[n-1][i-1]===e?1:0)+(t.array[n-1][i]===e?2:0)+(t.array[n][i-1]===e?8:0)+(t.array[n][i]===e?4:0);return r}},{key:"pathscan",value:function(t,e){for(var i,n=[],r=0,o=0,a=0,s=0,l=t[0].length,c=t.length,u=0,h=!0,f=!1,g=0;g<c;g+=1)for(var d=0;d<l;d+=1)if(4===t[g][d]||11===t[g][d])for(a=d,s=g,n[r]={},n[r].points=[],n[r].boundingbox=[a,s,a,s],n[r].holechildren=[],h=!1,o=0,f=11===t[g][d],u=1;!h;){if(n[r].points[o]={},n[r].points[o].x=a-1,n[r].points[o].y=s-1,n[r].points[o].t=t[s][a],a-1<n[r].boundingbox[0]&&(n[r].boundingbox[0]=a-1),a-1>n[r].boundingbox[2]&&(n[r].boundingbox[2]=a-1),s-1<n[r].boundingbox[1]&&(n[r].boundingbox[1]=s-1),s-1>n[r].boundingbox[3]&&(n[r].boundingbox[3]=s-1),i=this.pathscan_combined_lookup[t[s][a]][u],t[s][a]=i[0],u=i[1],a+=i[2],s+=i[3],a-1===n[r].points[0].x&&s-1===n[r].points[0].y)if(h=!0,n[r].points.length<e)n.pop();else{if(n[r].isholepath=!!f,f){for(var v=0,p=[-1,-1,l+1,c+1],m=0;m<r;m++)!n[m].isholepath&&this.boundingboxincludes(n[m].boundingbox,n[r].boundingbox)&&this.boundingboxincludes(p,n[m].boundingbox)&&(v=m,p=n[m].boundingbox);n[v].holechildren.push(r)}r+=1}o+=1}return n}},{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,r=[],o=0,a=0,s=0,l=0,c=0;for(i=0;i<t.length;i+=1)for(r[i]={},r[i].points=[],r[i].boundingbox=t[i].boundingbox,r[i].holechildren=t[i].holechildren,r[i].isholepath=t[i].isholepath,o=t[i].points.length,n=0;n<o;n+=1)a=(n+1)%o,s=(n+2)%o,l=(n-1+o)%o,c=(n-2+o)%o,e.rightangleenhance&&this.testrightangle(t[i],c,l,n,a,s)&&(r[i].points.length>0&&(r[i].points[r[i].points.length-1].linesegment=this.getdirection(r[i].points[r[i].points.length-1].x,r[i].points[r[i].points.length-1].y,t[i].points[n].x,t[i].points[n].y)),r[i].points.push({x:t[i].points[n].x,y:t[i].points[n].y,linesegment:this.getdirection(t[i].points[n].x,t[i].points[n].y,(t[i].points[n].x+t[i].points[a].x)/2,(t[i].points[n].y+t[i].points[a].y)/2)})),r[i].points.push({x:(t[i].points[n].x+t[i].points[a].x)/2,y:(t[i].points[n].y+t[i].points[a].y)/2,linesegment:this.getdirection((t[i].points[n].x+t[i].points[a].x)/2,(t[i].points[n].y+t[i].points[a].y)/2,(t[i].points[a].x+t[i].points[s].x)/2,(t[i].points[a].y+t[i].points[s].y)/2)});return r}},{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){return 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,r,o,a=0,s={segments:[]};for(s.boundingbox=t.boundingbox,s.holechildren=t.holechildren,s.isholepath=t.isholepath;a<t.points.length;){var l;for(n=t.points[a].linesegment,r=-1,o=a+1;(t.points[o].linesegment===n||t.points[o].linesegment===r||-1===r)&&o<t.points.length-1;)t.points[o].linesegment!==n&&-1===r&&(r=t.points[o].linesegment),o+=1;o===t.points.length-1&&(o=0),s.segments=O()(l=s.segments).call(l,this.fitseq(t,e,i,a,o)),a=o>0?o:t.points.length}return s}},{key:"fitseq",value:function(t,e,i,n,r){var o;if(r>t.points.length||r<0)return[];var a,s,l,c=n,u=0,h=!0,f=r-n;f<0&&(f+=t.points.length);for(var g,d=(t.points[r].x-t.points[n].x)/f,v=(t.points[r].y-t.points[n].y)/f,p=(n+1)%t.points.length;p!=r;)(g=p-n)<0&&(g+=t.points.length),a=t.points[n].x+d*g,s=t.points[n].y+v*g,(l=(t.points[p].x-a)*(t.points[p].x-a)+(t.points[p].y-s)*(t.points[p].y-s))>e&&(h=!1),l>u&&(c=p,u=l),p=(p+1)%t.points.length;if(h)return[{type:"L",x1:t.points[n].x,y1:t.points[n].y,x2:t.points[r].x,y2:t.points[r].y}];var m=c;h=!0,u=0;var y=(m-n)/f,b=(1-y)*(1-y),x=2*(1-y)*y,C=y*y,I=(b*t.points[n].x+C*t.points[r].x-t.points[m].x)/-x,_=(b*t.points[n].y+C*t.points[r].y-t.points[m].y)/-x;for(p=n+1;p!=r;)x=2*(1-(y=(p-n)/f))*y,C=y*y,a=(b=(1-y)*(1-y))*t.points[n].x+x*I+C*t.points[r].x,s=b*t.points[n].y+x*_+C*t.points[r].y,(l=(t.points[p].x-a)*(t.points[p].x-a)+(t.points[p].y-s)*(t.points[p].y-s))>i&&(h=!1),l>u&&(c=p,u=l),p=(p+1)%t.points.length;if(h)return[{type:"Q",x1:t.points[n].x,y1:t.points[n].y,x2:I,y2:_,x3:t.points[r].x,y3:t.points[r].y}];var M=m;return O()(o=this.fitseq(t,e,i,n,M)).call(o,this.fitseq(t,e,i,M,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,o,a,s=t.layers[e],l=s[i],c="";if(n.linefilter&&l.segments.length<3)return c;if(c=O()(r="<path ".concat(n.desc?O()(o='desc="l '.concat(e," p ")).call(o,i,'" '):"")).call(r,this.tosvgcolorstr(t.palette[e],n),'d="'),-1===n.roundcoords){var u;for(c+=O()(u="M ".concat(l.segments[0].x1*n.scale," ")).call(u,l.segments[0].y1*n.scale," "),a=0;a<l.segments.length;a++){var h,f,g;if(c+=O()(h=O()(f="".concat(l.segments[a].type," ")).call(f,l.segments[a].x2*n.scale," ")).call(h,l.segments[a].y2*n.scale," "),l.segments[a].hasOwnProperty("x3"))c+=O()(g="".concat(l.segments[a].x3*n.scale," ")).call(g,l.segments[a].y3*n.scale," ")}c+="Z "}else{var d;for(c+=O()(d="M ".concat(this.roundtodec(l.segments[0].x1*n.scale,n.roundcoords)," ")).call(d,this.roundtodec(l.segments[0].y1*n.scale,n.roundcoords)," "),a=0;a<l.segments.length;a++){var v,p,m;if(c+=O()(v=O()(p="".concat(l.segments[a].type," ")).call(p,this.roundtodec(l.segments[a].x2*n.scale,n.roundcoords)," ")).call(v,this.roundtodec(l.segments[a].y2*n.scale,n.roundcoords)," "),l.segments[a].hasOwnProperty("x3"))c+=O()(m="".concat(this.roundtodec(l.segments[a].x3*n.scale,n.roundcoords)," ")).call(m,this.roundtodec(l.segments[a].y3*n.scale,n.roundcoords)," ")}c+="Z "}for(var y=0;y<l.holechildren.length;y++){var b=s[l.holechildren[y]];if(-1===n.roundcoords){var x,C;if(b.segments[b.segments.length-1].hasOwnProperty("x3"))c+=O()(x="M ".concat(b.segments[b.segments.length-1].x3*n.scale," ")).call(x,b.segments[b.segments.length-1].y3*n.scale," ");else c+=O()(C="M ".concat(b.segments[b.segments.length-1].x2*n.scale," ")).call(C,b.segments[b.segments.length-1].y2*n.scale," ");for(a=b.segments.length-1;a>=0;a--){var I,_;if(c+="".concat(b.segments[a].type," "),b.segments[a].hasOwnProperty("x3"))c+=O()(_="".concat(b.segments[a].x2*n.scale," ")).call(_,b.segments[a].y2*n.scale," ");c+=O()(I="".concat(b.segments[a].x1*n.scale," ")).call(I,b.segments[a].y1*n.scale," ")}}else{var M,S;if(b.segments[b.segments.length-1].hasOwnProperty("x3"))c+=O()(M="M ".concat(this.roundtodec(b.segments[b.segments.length-1].x3*n.scale)," ")).call(M,this.roundtodec(b.segments[b.segments.length-1].y3*n.scale)," ");else c+=O()(S="M ".concat(this.roundtodec(b.segments[b.segments.length-1].x2*n.scale)," ")).call(S,this.roundtodec(b.segments[b.segments.length-1].y2*n.scale)," ");for(a=b.segments.length-1;a>=0;a--){var w,k;if(c+="".concat(b.segments[a].type," "),b.segments[a].hasOwnProperty("x3"))c+=O()(k="".concat(this.roundtodec(b.segments[a].x2*n.scale)," ")).call(k,this.roundtodec(b.segments[a].y2*n.scale)," ");c+=O()(w="".concat(this.roundtodec(b.segments[a].x1*n.scale)," ")).call(w,this.roundtodec(b.segments[a].y1*n.scale)," ")}}c+="Z "}if(c+='" />',n.lcpr||n.qcpr){for(a=0;a<l.segments.length;a++){var T,D,A,j,E,L,N,P,z,B,R,F,Y,W,H,U,G;if(l.segments[a].hasOwnProperty("x3")&&n.qcpr)c+=O()(T=O()(D=O()(A='<circle cx="'.concat(l.segments[a].x2*n.scale,'" cy="')).call(A,l.segments[a].y2*n.scale,'" r="')).call(D,n.qcpr,'" fill="cyan" stroke-width="')).call(T,.2*n.qcpr,'" stroke="black" />'),c+=O()(j=O()(E=O()(L='<circle cx="'.concat(l.segments[a].x3*n.scale,'" cy="')).call(L,l.segments[a].y3*n.scale,'" r="')).call(E,n.qcpr,'" fill="white" stroke-width="')).call(j,.2*n.qcpr,'" stroke="black" />'),c+=O()(N=O()(P=O()(z=O()(B='<line x1="'.concat(l.segments[a].x1*n.scale,'" y1="')).call(B,l.segments[a].y1*n.scale,'" x2="')).call(z,l.segments[a].x2*n.scale,'" y2="')).call(P,l.segments[a].y2*n.scale,'" stroke-width="')).call(N,.2*n.qcpr,'" stroke="cyan" />'),c+=O()(R=O()(F=O()(Y=O()(W='<line x1="'.concat(l.segments[a].x2*n.scale,'" y1="')).call(W,l.segments[a].y2*n.scale,'" x2="')).call(Y,l.segments[a].x3*n.scale,'" y2="')).call(F,l.segments[a].y3*n.scale,'" stroke-width="')).call(R,.2*n.qcpr,'" stroke="cyan" />');if(!l.segments[a].hasOwnProperty("x3")&&n.lcpr)c+=O()(H=O()(U=O()(G='<circle cx="'.concat(l.segments[a].x2*n.scale,'" cy="')).call(G,l.segments[a].y2*n.scale,'" r="')).call(U,n.lcpr,'" fill="white" stroke-width="')).call(H,.2*n.lcpr,'" stroke="black" />')}for(y=0;y<l.holechildren.length;y++){b=s[l.holechildren[y]];for(a=0;a<b.segments.length;a++){var X,Z,V,J,Q,K,q,$,tt,et,it,nt,rt,ot,at,st,lt;if(b.segments[a].hasOwnProperty("x3")&&n.qcpr)c+=O()(X=O()(Z=O()(V='<circle cx="'.concat(b.segments[a].x2*n.scale,'" cy="')).call(V,b.segments[a].y2*n.scale,'" r="')).call(Z,n.qcpr,'" fill="cyan" stroke-width="')).call(X,.2*n.qcpr,'" stroke="black" />'),c+=O()(J=O()(Q=O()(K='<circle cx="'.concat(b.segments[a].x3*n.scale,'" cy="')).call(K,b.segments[a].y3*n.scale,'" r="')).call(Q,n.qcpr,'" fill="white" stroke-width="')).call(J,.2*n.qcpr,'" stroke="black" />'),c+=O()(q=O()($=O()(tt=O()(et='<line x1="'.concat(b.segments[a].x1*n.scale,'" y1="')).call(et,b.segments[a].y1*n.scale,'" x2="')).call(tt,b.segments[a].x2*n.scale,'" y2="')).call($,b.segments[a].y2*n.scale,'" stroke-width="')).call(q,.2*n.qcpr,'" stroke="cyan" />'),c+=O()(it=O()(nt=O()(rt=O()(ot='<line x1="'.concat(b.segments[a].x2*n.scale,'" y1="')).call(ot,b.segments[a].y2*n.scale,'" x2="')).call(rt,b.segments[a].x3*n.scale,'" y2="')).call(nt,b.segments[a].y3*n.scale,'" stroke-width="')).call(it,.2*n.qcpr,'" stroke="cyan" />');if(!b.segments[a].hasOwnProperty("x3")&&n.lcpr)c+=O()(at=O()(st=O()(lt='<circle cx="'.concat(b.segments[a].x2*n.scale,'" cy="')).call(lt,b.segments[a].y2*n.scale,'" r="')).call(st,n.lcpr,'" fill="white" stroke-width="')).call(at,.2*n.lcpr,'" stroke="black" />')}}}return c}},{key:"getsvgstring",value:function(t,e){var i,n,r;e=this.checkoptions(e);for(var o=t.width*e.scale,a=t.height*e.scale,s=O()(i="<svg ".concat(e.viewbox?O()(n='viewBox="0 0 '.concat(o," ")).call(n,a,'" '):O()(r='width="'.concat(o,'" height="')).call(r,a,'" '),'version="1.1" xmlns="http://www.w3.org/2000/svg" desc="Created with imagetracer.js version ')).call(i,this.versionnumber,'" >'),l=0;l<t.layers.length;l+=1)for(var c=0;c<t.layers[l].length;c+=1)t.layers[l][c].isholepath||(s+=this.svgpathstring(t,l,c,e));return s+="</svg>"}},{key:"compareNumbers",value:function(t,e){return t-e}},{key:"torgbastr",value:function(t){var e,i,n;return O()(e=O()(i=O()(n="rgba(".concat(t.r,",")).call(n,t.g,",")).call(i,t.b,",")).call(e,t.a,")")}},{key:"tosvgcolorstr",value:function(t,e){var i,n,r,o,a,s,l;return O()(i=O()(n=O()(r=O()(o=O()(a=O()(s=O()(l='fill="rgb('.concat(t.r,",")).call(l,t.g,",")).call(s,t.b,')" stroke="rgb(')).call(a,t.r,",")).call(o,t.g,",")).call(r,t.b,')" stroke-width="')).call(n,e.strokewidth,'" opacity="')).call(i,t.a/255,'" ')}},{key:"appendSVGString",value:function(t,e){var i;e?(i=document.getElementById(e))||((i=document.createElement("div")).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,r,o,a,s,l,c,u,h,f={width:t.width,height:t.height,data:[]};if((e=Math.floor(e))<1)return t;e>5&&(e=5),(i=Math.abs(i))>1024&&(i=1024);var g=this.gks[e-1];for(r=0;r<t.height;r++)for(n=0;n<t.width;n++){for(s=0,l=0,c=0,u=0,h=0,o=-e;o<e+1;o++)n+o>0&&n+o<t.width&&(a=4*(r*t.width+n+o),s+=t.data[a]*g[o+e],l+=t.data[a+1]*g[o+e],c+=t.data[a+2]*g[o+e],u+=t.data[a+3]*g[o+e],h+=g[o+e]);a=4*(r*t.width+n),f.data[a]=Math.floor(s/h),f.data[a+1]=Math.floor(l/h),f.data[a+2]=Math.floor(c/h),f.data[a+3]=Math.floor(u/h)}var d=new Uint8ClampedArray(f.data);for(r=0;r<t.height;r++)for(n=0;n<t.width;n++){for(s=0,l=0,c=0,u=0,h=0,o=-e;o<e+1;o++)r+o>0&&r+o<t.height&&(s+=d[a=4*((r+o)*t.width+n)]*g[o+e],l+=d[a+1]*g[o+e],c+=d[a+2]*g[o+e],u+=d[a+3]*g[o+e],h+=g[o+e]);a=4*(r*t.width+n),f.data[a]=Math.floor(s/h),f.data[a+1]=Math.floor(l/h),f.data[a+2]=Math.floor(c/h),f.data[a+3]=Math.floor(u/h)}for(r=0;r<t.height;r++)for(n=0;n<t.width;n++)a=4*(r*t.width+n),Math.abs(f.data[a]-t.data[a])+Math.abs(f.data[a+1]-t.data[a+1])+Math.abs(f.data[a+2]-t.data[a+2])+Math.abs(f.data[a+3]-t.data[a+3])>i&&(f.data[a]=t.data[a],f.data[a+1]=t.data[a+1],f.data[a+2]=t.data[a+2],f.data[a+3]=t.data[a+3]);return f}},{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,t.getContext("2d").drawImage(n,0,0),e(t)}}},{key:"getImgdata",value:function(t){return t.getContext("2d").getImageData(0,0,t.width,t.height)}},{key:"drawLayers",value:function(t,e,i,n){var r,o,a,s,l,c;for(l in i=i||1,n?(c=document.getElementById(n))||((c=document.createElement("div")).id=n,document.body.appendChild(c)):(c=document.createElement("div"),document.body.appendChild(c)),t)if(t.hasOwnProperty(l)){r=t[l][0].length,o=t[l].length;var u=document.createElement("canvas");u.width=r*i,u.height=o*i;var h=u.getContext("2d");for(s=0;s<o;s+=1)for(a=0;a<r;a+=1)h.fillStyle=this.torgbastr(e[t[l][s][a]%e.length]),h.fillRect(a*i,s*i,i,i);c.appendChild(u)}}}],[{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}]}}}]),t}(),oo={getActions:function(){return{main:this._mainAction(),shape:this._shapeAction(),crop:this._cropAction(),resize:this._resizeAction(),flip:this._flipAction(),rotate:this._rotateAction(),text:this._textAction(),mask:this._maskAction(),draw:this._drawAction(),icon:this._iconAction(),filter:this._filterAction(),history:this._historyAction()}},_mainAction:function(){var t=this,e=function(){"crop"===t.ui.submenu&&(t.stopDrawingMode(),t.ui.changeMenu("crop"))},i=function(e){var i,n;return i=e,"rotate"===t.ui.submenu&&t.ui.rotate.setRangeBarAngle("setAngle",i),n=e,"filter"===t.ui.submenu&&no()(t.ui).setFilterState(n),e},n=function(){no()(t.ui)&&no()(t.ui).initFilterCheckBoxState()};return R()({initLoadImage:function(i,n){return t.loadImageFromURL(i,n).then((function(n){e(),t.ui.initializeImgUrl=i,t.ui.resizeEditor({imageSize:n}),t.clearUndoStack(),t._invoker.fire(fe,Se)}))},undo:function(){t.isEmptyUndoStack()||(e(),t.deactivateAll(),t.undo().then(i))},redo:function(){t.isEmptyRedoStack()||(e(),t.deactivateAll(),t.redo().then(i))},reset:function(){e(),t.loadImageFromURL(t.ui.initializeImgUrl,"resetImage").then((function(i){e(),n(),t.ui.resizeEditor({imageSize:i}),t.clearUndoStack(),t._initHistory()}))},delete:function(){t.ui.changeHelpButtonEnabled("delete",!1),e(),t.removeActiveObject(),t.activeObjectId=null},deleteAll:function(){e(),t.clearObjects(),t.ui.changeHelpButtonEnabled("delete",!1),t.ui.changeHelpButtonEnabled("deleteAll",!1)},load:function(i){Fi()||alert("This browser does not support file-api"),t.ui.initializeImgUrl=P().createObjectURL(i),t.loadImageFromFile(i).then((function(i){e(),n(),t.clearUndoStack(),t.ui.activeMenuEvent(),t.ui.resizeEditor({imageSize:i}),t._clearHistory(),t._invoker.fire(fe,Se)})).catch((function(t){return L().reject(t)}))},download:function(){var e,i,n=t.toDataURL(),r=t.getImageName();Fi()&&window.saveAs?(i=(e=function(t){var e,i,n,r="";e=t.replace(/data:(image\/.+);base64,/,(function(t,e){return r=e,""}));var o=(e=atob(e)).length;for(i=new Uint8Array(o),n=0;n<o;n+=1)i[n]=e.charCodeAt(n);return new Blob([i],{type:r})}(n)).type.split("/")[1],r.split(".").pop()!==i&&(r+=".".concat(i)),saveAs(e,r)):window.open().document.body.innerHTML="<img src='".concat(n,"'>")},history:function(e){t.ui.toggleHistoryMenu(e)},zoomIn:function(){var e;t.ui.toggleZoomButtonStatus("zoomIn"),t.deactivateAll(),e=t._graphics.getZoomMode(),t.stopDrawingMode(),e!==Ge?(t.startDrawingMode(Be.ZOOM),t._graphics.startZoomInMode()):t._graphics.endZoomInMode()},zoomOut:function(){t._graphics.zoomOut()},hand:function(){var e;t.ui.offZoomInButtonStatus(),t.ui.toggleZoomButtonStatus("hand"),t.deactivateAll(),e=t._graphics.getZoomMode(),t.stopDrawingMode(),e!==Xe?(t.startDrawingMode(Be.ZOOM),t._graphics.startHandMode()):t._graphics.endHandMode()}},this._commonAction())},_iconAction:function(){var t=this;return R()({changeColor:function(e){t.activeObjectId&&t.changeIconColor(t.activeObjectId,e)},addIcon:function(e,i){t.startDrawingMode("ICON"),t.setDrawingIcon(e,i)},cancelAddIcon:function(){t.ui.icon.clearIconType(),t.changeSelectableAll(!0),t.changeCursor("default"),t.stopDrawingMode()},registerDefaultIcons:function(e,i){var n={};n[e]=i,t.registerIcons(n)},registerCustomIcon:function(e,i){(new ro).imageToSVG(e,(function(e){var n=Q(e.match(/path[^>]*d="([^"]*)"/),2)[1],r={};r[i.name]=n,t.registerIcons(r),t.addIcon(i.name,{left:100,top:100})}),ro.tracerDefaultOption())}},this._commonAction())},_drawAction:function(){var t=this;return R()({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 R()({loadImageFromURL:function(e,i){return t.loadImageFromURL(t.toDataURL(),"FilterImage").then((function(){t.addImageObject(e).then((function(){P().revokeObjectURL(i)})),t._invoker.fire(fe,we)}))},applyFilter:function(){t.applyFilter("mask",{maskObjId:t.activeObjectId})}},this._commonAction())},_textAction:function(){var t=this;return R()({changeTextStyle:function(e,i){t.activeObjectId&&t.changeTextStyle(t.activeObjectId,e,i)}},this._commonAction())},_rotateAction:function(){var t=this;return R()({rotate:function(e,i){t.rotate(e,i),t.ui.resizeEditor(),t.ui.rotate.setRangeBarAngle("rotate",e)},setAngle:function(e,i){t.setAngle(e,i),t.ui.resizeEditor(),t.ui.rotate.setRangeBarAngle("setAngle",e)}},this._commonAction())},_shapeAction:function(){var t=this;return R()({changeShape:function(e,i){t.activeObjectId&&t.changeShape(t.activeObjectId,e,i)},setDrawingShape:function(e){t.setDrawingShape(e)}},this._commonAction())},_cropAction:function(){var t=this;return R()({crop:function(){var e=t.getCropzoneRect();e&&!function(t){var e=t.left,i=t.top,n=t.width,r=t.height;return e===_i&&i===Mi&&n===Si&&r===wi}(e)&&t.crop(e).then((function(){t.stopDrawingMode(),t.ui.resizeEditor(),t.ui.changeMenu("crop"),t._invoker.fire(fe,Te)})).catch((function(t){return L().reject(t)}))},cancel:function(){t.stopDrawingMode(),t.ui.changeMenu("crop")},preset:function(e){switch(e){case"preset-square":t.setCropzoneRect(1);break;case"preset-3-2":t.setCropzoneRect(1.5);break;case"preset-4-3":t.setCropzoneRect(4/3);break;case"preset-5-4":t.setCropzoneRect(5/4);break;case"preset-7-5":t.setCropzoneRect(1.4);break;case"preset-16-9":t.setCropzoneRect(16/9);break;default:t.setCropzoneRect(),t.ui.crop.changeApplyButtonStatus(!1);break}}},this._commonAction())},_resizeAction:function(){var t=this;return R()({getCurrentDimensions:function(){return t._graphics.getCurrentDimensions()},preview:function(e,i,n){var r=t._graphics.getCurrentDimensions(),o=function(){return r.width/r.height},a={};switch(e){case"width":a.width=i,a.height=n?i/o():r.height;break;case"height":a.height=i,a.width=n?i*o():r.width;break;default:a=r}t._graphics.resize(a).then((function(){t.ui.resizeEditor()})),n&&(t.ui.resize.setWidthValue(a.width),t.ui.resize.setHeightValue(a.height))},lockAspectRatio:function(e,i,n){var r=t._graphics.getCurrentDimensions(),o=r.width,a=r.height,s=o/a;if(e)if(o>a){var l=n/s,c=i*s;t.ui.resize.setLimit({minWidth:c>i?c:i,minHeight:i,maxWidth:n,maxHeight:l<n?l:n})}else{var u=n*s,h=i/s;t.ui.resize.setLimit({minWidth:i,minHeight:h>i?h:i,maxWidth:u<n?u:n,maxHeight:n})}else t.ui.resize.setLimit({minWidth:i,minHeight:i,maxWidth:n,maxHeight:n})},resize:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e||(e=t._graphics.getCurrentDimensions()),t.resize(e).then((function(){t._graphics.setOriginalDimensions(e),t.stopDrawingMode(),t.ui.resizeEditor(),t.ui.changeMenu("resize")})).catch((function(t){return L().reject(t)}))},reset:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=t._graphics.getOriginalDimensions();t.ui.resize.setWidthValue(i.width,!0),t.ui.resize.setHeightValue(i.height,!0),t._graphics.resize(i).then((function(){e||(t.stopDrawingMode(),t.ui.resizeEditor(),t.ui.changeMenu("resize"))}))}},this._commonAction())},_flipAction:function(){var t=this;return R()({flip:function(e){return t[e]()}},this._commonAction())},_filterAction:function(){var t=this;return R()({applyFilter:function(e,i,n,r){e?t.applyFilter(i,n,r):t.hasFilter(i)&&t.removeFilter(i)}},this._commonAction())},setReAction:function(){var t=this;this.on({undoStackChanged:function(e){e?(t.ui.changeHelpButtonEnabled("undo",!0),t.ui.changeHelpButtonEnabled("reset",!0)):(t.ui.changeHelpButtonEnabled("undo",!1),t.ui.changeHelpButtonEnabled("reset",!1)),t.ui.resizeEditor()},redoStackChanged:function(e){e?t.ui.changeHelpButtonEnabled("redo",!0):t.ui.changeHelpButtonEnabled("redo",!1),t.ui.resizeEditor()},objectActivated:function(e){var i,n;t.activeObjectId=e.id,t.ui.changeHelpButtonEnabled("delete",!0),t.ui.changeHelpButtonEnabled("deleteAll",!0),"cropzone"===e.type?t.ui.crop.changeApplyButtonStatus(!0):o()(i=["rect","circle","triangle"]).call(i,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:nt()(e)}),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()):o()(n=["i-text","text"]).call(n,e.type)>-1?("text"!==t.ui.submenu&&t.ui.changeMenu("text",!1,!1),t.ui.text.setTextStyleStateOnAction(e)):"icon"===e.type&&(t.stopDrawingMode(),"icon"!==t.ui.submenu&&t.ui.changeMenu("icon",!1,!1),t.ui.icon.setIconPickerColor(nt()(e)))},addText:function(e){var i=t.ui.text,n=i.textColor,r=i.fontSize,o=i.fontStyle,a=i.fontWeight,s=i.underline;t.addText("Double Click",{position:e.originPosition,styles:{fill:n,fontSize:r,fontFamily:"Noto Sans",fontStyle:o,fontWeight:a,underline:s}}).then((function(){t.changeCursor("default")}))},addObjectAfter:function(e){var i;"icon"===e.type?t.ui.icon.changeStandbyMode():o()(i=["rect","circle","triangle"]).call(i,e.type)>-1&&(t.ui.shape.setMaxStrokeValue(Math.min(e.width,e.height)),t.ui.shape.changeStandbyMode())},objectScaled:function(e){var i,n;if(o()(i=["i-text","text"]).call(i,e.type)>-1)t.ui.text.fontSize=Bi(e.fontSize);else if(o()(n=["rect","circle","triangle"]).call(n,e.type)>=0){var r=e.width,a=e.height,s=t.ui.shape.getStrokeValue();r<s&&t.ui.shape.setStrokeValue(r),a<s&&t.ui.shape.setStrokeValue(a)}},selectionCleared:function(){t.activeObjectId=null,"text"===t.ui.submenu?t.changeCursor("text"):Xi(["draw","crop","resize"],t.ui.submenu)||t.stopDrawingMode()}})},_historyAction:function(){var t=this;return{undo:function(e){return t.undo(e)},redo:function(e){return t.redo(e)}}},_commonAction:function(){var t,e,i,n,r=this,o=Be.TEXT,a=Be.CROPPER,s=Be.SHAPE,l=Be.ZOOM,c=Be.RESIZE;return{modeChange:function(t){switch(t){case Re:r._changeActivateMode(o);break;case Fe:r.startDrawingMode(a);break;case We:r._changeActivateMode(s),r.setDrawingShape(r.ui.shape.type,r.ui.shape.options);break;case He:r.startDrawingMode(l);break;case Ye:r.startDrawingMode(c);break;default:break}},deactivateAll:A()(t=this.deactivateAll).call(t,this),changeSelectableAll:A()(e=this.changeSelectableAll).call(e,this),discardSelection:A()(i=this.discardSelection).call(i,this),stopDrawingMode:A()(n=this.stopDrawingMode).call(n,this)}},mixin:function(t){R()(t.prototype,this)}},ao=n(602),so=n.n(ao),lo=n(5573),co=n.n(lo),uo=function(){function t(e,i){w(this,t),this.name=e,this.graphics=i}return T(t,[{key:"fire",value:function(){for(var t=this.graphics,e=arguments.length,i=new 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()}},{key:"adjustCanvasDimensionBase",value:function(){this.graphics.adjustCanvasDimensionBase()}}]),t}(),ho=uo;function fo(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var go={padding:0,crossOrigin:"Anonymous"},vo=function(t){wn(i,t);var e=fo(i);function i(t){return w(this,i),e.call(this,St.IMAGE_LOADER,t)}return T(i,[{key:"load",value:function(t,e){var i,n=this;if(t||e)i=this._setBackgroundImage(e).then((function(e){return n.setCanvasImage(t,e),n.adjustCanvasDimension(),e}));else{var r=this.getCanvas();r.backgroundImage=null,r.renderAll(),i=new(L())((function(t){n.setCanvasImage("",null),t()}))}return i}},{key:"_setBackgroundImage",value:function(t){var e=this;return t?new(L())((function(i,n){var r=e.getCanvas();r.setBackgroundImage(t,(function(){var t=r.backgroundImage;t&&t.getElement()?i(t):n(hi)}),go)})):L().reject(ui)}}]),i}(ho),po=vo,mo=["tl","tr","mt","ml","mr","mb","bl","br"],yo=function(){};function bo(t,e){return t>e?"width":"height"}var xo=z.fabric.util.createClass(z.fabric.Rect,{initialize:function(t,e,i){(e=R()(e,i)).type="cropzone",this.callSuper("initialize",e),this._addEventHandler(),this.canvas=t,this.options=e},canvasEventDelegation:function(t){var e,i="unregistered";return this.canvasEventTrigger[t]!==yo?i="registered":o()(e=[Jt,Qt]).call(e,t)<0&&(i="none"),i},canvasEventRegister:function(t,e){this.canvasEventTrigger[t]=e},_addEventHandler:function(){var t,e,i,n,r;this.canvasEventTrigger=(S(t={},Jt,yo),S(t,Qt,yo),t),this.on({moving:A()(e=this._onMoving).call(e,this),scaling:A()(i=this._onScaling).call(i,this)}),z.fabric.util.addListener(document,"keydown",A()(n=this._onKeyDown).call(n,this)),z.fabric.util.addListener(document,"keyup",A()(r=this._onKeyUp).call(r,this))},_renderCropzone:function(t){var e=this.flipX?-1:1,i=this.flipY?-1:1,n=e/this.scaleX,r=i/this.scaleY;t.scale(n,r),this._fillOuterRect(t,"rgba(0, 0, 0, 0.5)"),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:7}),this._strokeBorder(t,"rgb(255, 255, 255)",{lineDashWidth:7,lineDashOffset:7})),t.scale(1/n,1/r)},_render:function(t){this.callSuper("_render",t),this._renderCropzone(t)},_fillOuterRect:function(t,e){var i=this._getCoordinates(),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(),nt()(t).call(t),t.restore()},_fillInnerRect:function(t){var e=this._getCoordinates(),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(){var t,e,i=this.canvas,n=this.width,r=this.height,o=this.left,a=this.top,s=n/2,l=r/2,c=i.getHeight(),u=i.getWidth();return{x:pn()(t=[-(s+o),-s,s,s+(u-o-n)]).call(t,Math.ceil),y:pn()(e=[-(l+a),-l,l,l+(c-a-r)]).call(e,Math.ceil)}},_strokeBorder:function(t,e,i){var n=i.lineDashWidth,r=i.lineDashOffset,o=i.lineWidth,a=this.width/2,s=this.height/2;t.save(),t.strokeStyle=e,t.setLineDash&&t.setLineDash([n,n]),r&&(t.lineDashOffset=r),o&&(t.lineWidth=o),t.beginPath(),t.moveTo(-a,-s),t.lineTo(a,-s),t.lineTo(a,s),t.lineTo(-a,s),t.lineTo(-a,-s),t.stroke(),t.restore()},_onMoving:function(){var t=this.height,e=this.width,i=this.left,n=this.top,r=this.canvas.getWidth()-e,o=this.canvas.getHeight()-t;this.left=Ni(i,0,r),this.top=Ni(n,0,o),this.canvasEventTrigger[Jt](this)},_onScaling:function(t){var e=t.transform.corner,i=this.canvas.getPointer(t.e),n=this._calcScalingSizeFromPointer(i,e);this.scale(1).set(n),this.canvasEventTrigger[Qt](this)},_calcScalingSizeFromPointer:function(t,e){var i=function(t){return o()(mo).call(mo,t)>=0}(e);return i&&this._resizeCropZone(t,e)},adjustRatioCropzoneSize:function(t){var e=t.width,i=t.height,n=t.leftMaker,r=t.topMaker,o=t.maxWidth,a=t.maxHeight,s=t.scaleTo;if(e=o?Ni(e,1,o):e,i=a?Ni(i,1,a):i,!this.presetRatio)return this._withShiftKey&&(e>i?i=e:i>e&&(e=i)),{width:e,height:i,left:n(e),top:r(i)};"width"===s?i=e/this.presetRatio:e=i*this.presetRatio;var l=Math.min(o/e,a/i);if(l<=1){var c,u=Q(pn()(c=[e,i]).call(c,(function(t){return t*l})),2);e=u[0],i=u[1]}return{width:e,height:i,left:n(e),top:r(i)}},_getCropzoneRectInfo:function(){var t=this.canvas,e=t.width,i=t.height,n=this.getBoundingRect(!1,!0),r=n.top,o=n.left,a=n.width,s=n.height;return{rectTop:r,rectLeft:o,rectWidth:a,rectHeight:s,rectRight:o+a,rectBottom:r+s,canvasWidth:e,canvasHeight:i}},_resizeCropZone:function(t,e){var i=t.x,n=t.y,r=this._getCropzoneRectInfo(),o=r.rectWidth,a=r.rectHeight,s=r.rectTop,l=r.rectLeft,c=r.rectBottom,u=r.rectRight,h=r.canvasWidth,f=r.canvasHeight,g={tl:{width:u-i,height:c-n,leftMaker:function(t){return u-t},topMaker:function(t){return c-t},maxWidth:u,maxHeight:c,scaleTo:bo(l-i,s-n)},tr:{width:i-l,height:c-n,leftMaker:function(){return l},topMaker:function(t){return c-t},maxWidth:h-l,maxHeight:c,scaleTo:bo(i-u,s-n)},mt:{width:o,height:c-n,leftMaker:function(){return l},topMaker:function(t){return c-t},maxWidth:h-l,maxHeight:c,scaleTo:"height"},ml:{width:u-i,height:a,leftMaker:function(t){return u-t},topMaker:function(){return s},maxWidth:u,maxHeight:f-s,scaleTo:"width"},mr:{width:i-l,height:a,leftMaker:function(){return l},topMaker:function(){return s},maxWidth:h-l,maxHeight:f-s,scaleTo:"width"},mb:{width:o,height:n-s,leftMaker:function(){return l},topMaker:function(){return s},maxWidth:h-l,maxHeight:f-s,scaleTo:"height"},bl:{width:u-i,height:n-s,leftMaker:function(t){return u-t},topMaker:function(){return s},maxWidth:u,maxHeight:f-s,scaleTo:bo(l-i,n-c)},br:{width:i-l,height:n-s,leftMaker:function(){return l},topMaker:function(){return s},maxWidth:h-l,maxHeight:f-s,scaleTo:bo(i-u,n-c)}};return this.adjustRatioCropzoneSize(g[e])},isValid:function(){return this.left>=0&&this.top>=0&&this.width>0&&this.height>0},_onKeyDown:function(t){t.keyCode===Ke&&(this._withShiftKey=!0)},_onKeyUp:function(t){t.keyCode===Ke&&(this._withShiftKey=!1)}}),Co=xo;function Io(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var _o={presetRatio:null,top:-10,left:-10,height:1,width:1},Mo=function(t){wn(i,t);var e=Io(i);function i(t){var n,r,o,a,s,l;return w(this,i),(l=e.call(this,St.CROPPER,t))._cropzone=null,l._startX=null,l._startY=null,l._withShiftKey=!1,l._listeners={keydown:A()(n=l._onKeyDown).call(n,Dn(l)),keyup:A()(r=l._onKeyUp).call(r,Dn(l)),mousedown:A()(o=l._onFabricMouseDown).call(o,Dn(l)),mousemove:A()(a=l._onFabricMouseMove).call(a,Dn(l)),mouseup:A()(s=l._onFabricMouseUp).call(s,Dn(l))},l}return T(i,[{key:"start",value:function(){if(!this._cropzone){var t=this.getCanvas();t.forEachObject((function(t){t.evented=!1})),this._cropzone=new Co(t,R()({left:0,top:0,width:.5,height:.5,strokeWidth:0,cornerSize:10,cornerColor:"black",fill:"transparent"},wt,this.graphics.cropSelectionStyle)),t.discardActiveObject(),t.add(this._cropzone),t.on("mouse:down",this._listeners.mousedown),t.selection=!1,t.defaultCursor="crosshair",z.fabric.util.addListener(document,"keydown",this._listeners.keydown),z.fabric.util.addListener(document,"keyup",this._listeners.keyup)}}},{key:"end",value:function(){var t=this.getCanvas(),e=this._cropzone;e&&(t.remove(e),t.selection=!0,t.defaultCursor="default",t.off("mouse:down",this._listeners.mousedown),t.forEachObject((function(t){t.evented=!0})),this._cropzone=null,z.fabric.util.removeListener(document,"keydown",this._listeners.keydown),z.fabric.util.removeListener(document,"keyup",this._listeners.keyup))}},{key:"changeVisibility",value:function(t){this._cropzone&&this._cropzone.set({visible:t})}},{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)>10&&(e.remove(o),o.set(this._calcRectDimensionFromPoint(n,r,o.presetRatio)),e.add(o),e.setActiveObject(o))}},{key:"_calcRectDimensionFromPoint",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=this.getCanvas(),r=n.getWidth(),o=n.getHeight(),a=this._startX,s=this._startY,l=Ni(t,0,a),c=Ni(e,0,s),u=Ni(t,a,r)-l,h=Ni(e,s,o)-c;return this._withShiftKey&&!i?(u>h?h=u:h>u&&(u=h),a>=t&&(l=a-u),s>=e&&(c=s-h)):i&&(h=u/i,a>=t&&(l=Ni(a-u,0,r)),s>=e&&(c=Ni(s-h,0,o)),c+h>o&&(u=(h=o-c)*i,a>=t&&(l=Ni(a-u,0,r)),s>=e&&(c=Ni(s-h,0,o)))),{left:l,top:c,width:u,height:h}}},{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&&e.remove(this._cropzone);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.left,top:t.top,width:t.width,height:t.height}:null}},{key:"setCropzoneRect",value:function(t){var e=this.getCanvas(),i=this._cropzone;e.discardActiveObject(),e.selection=!1,e.remove(i),i.set(t?this._getPresetPropertiesForCropSize(t):_o),e.add(i),e.selection=!0,t&&e.setActiveObject(i)}},{key:"_getPresetPropertiesForCropSize",value:function(t){var e,i,n=this.getCanvas(),r=n.getWidth(),o=n.getHeight(),a=r>=o?r:o,s=function(t,e){return t>e?e/t:1},l=a*t,c=a,u=s(l,r),h=Q(pn()(e=[l,c]).call(e,(function(t){return t*u})),2);l=h[0];var f=s(c=h[1],o),g=Q(pn()(i=[l,c]).call(i,(function(t){return Number((t*f).toFixed(2))})),2);return l=g[0],{presetRatio:t,top:(o-(c=g[1]))/2,left:(r-l)/2,width:l,height:c}}},{key:"_onKeyDown",value:function(t){t.keyCode===Ke&&(this._withShiftKey=!0)}},{key:"_onKeyUp",value:function(t){t.keyCode===Ke&&(this._withShiftKey=!1)}}]),i}(ho),So=Mo;function wo(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var ko=function(t){wn(i,t);var e=wo(i);function i(t){return w(this,i),e.call(this,St.FLIP,t)}return T(i,[{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?(R()(e,t),this.setImageProperties(e,!0),this._invertAngle(i,n),this._flipObjects(i,n),L().resolve({flipX:e.flipX,flipY:e.flipY,angle:this.getCanvasImage().angle})):L().reject(si)}},{key:"_invertAngle",value:function(t,e){var i=this.getCanvasImage(),n=i.angle;t&&(n*=-1),e&&(n*=-1),i.rotate(dn()(n)).setCoords()}},{key:"_flipObjects",value:function(t,e){var i=this.getCanvas();t&&i.forEachObject((function(t){t.set({angle:dn()(-1*t.angle),flipX:!t.flipX,left:i.width-t.left}).setCoords()})),e&&i.forEachObject((function(t){t.set({angle:dn()(-1*t.angle),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})}}]),i}(ho),To=ko;function Do(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Ao=function(t){wn(i,t);var e=Do(i);function i(t){return w(this,i),e.call(this,St.ROTATION,t)}return T(i,[{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.set({angle:t}).setCoords(),this.adjustCanvasDimension();var r=i.getCenterPoint();return this._rotateForEachObject(n,r,t-e),L().resolve(t)}},{key:"_rotateForEachObject",value:function(t,e,i){var n=this.getCanvas(),r=t.x-e.x,o=t.y-e.y;n.forEachObject((function(e){var n=e.getCenterPoint(),a=z.fabric.util.degreesToRadians(i),s=z.fabric.util.rotatePoint(n,t,a);e.set({left:s.x-r,top:s.y-o,angle:(e.angle+i)%360}),e.setCoords()})),n.renderAll()}},{key:"rotate",value:function(t){var e=this.getCurrentAngle();return this.setAngle(e+t)}}]),i}(ho),jo=Ao;function Oo(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Eo=function(t){wn(i,t);var e=Oo(i);function i(t){var n;return w(this,i),(n=e.call(this,St.FREE_DRAWING,t)).width=12,n.oColor=new z.fabric.Color("rgba(0, 0, 0, 0.5)"),n}return T(i,[{key:"start",value:function(t){this.getCanvas().isDrawingMode=!0,this.setBrush(t)}},{key:"setBrush",value:function(t){var e=this.getCanvas().freeDrawingBrush;t=t||{},this.width=t.width||this.width,t.color&&(this.oColor=new z.fabric.Color(t.color)),e.width=this.width,e.color=this.oColor.toRgba()}},{key:"end",value:function(){this.getCanvas().isDrawingMode=!1}}]),i}(ho),Lo=Eo,No=z.fabric.util.createClass(z.fabric.Line,{type:"line",initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.callSuper("initialize",t,e),this.arrowType=e.arrowType},_render:function(t){var e=this.calcLinePoints(),i={fromX:e.x1,fromY:e.y1,toX:e.x2,toY:e.y2};this.ctx=t,t.lineWidth=this.strokeWidth,this._renderBasicLinePath(i),this._drawDecoratorPath(i),this._renderStroke(t)},_renderBasicLinePath:function(t){var e=t.fromX,i=t.fromY,n=t.toX,r=t.toY;this.ctx.beginPath(),this.ctx.moveTo(e,i),this.ctx.lineTo(n,r)},_drawDecoratorPath:function(t){this._drawDecoratorPathType("head",t),this._drawDecoratorPathType("tail",t)},_drawDecoratorPathType:function(t,e){switch(this.arrowType[t]){case"triangle":this._drawTrianglePath(t,e);break;case"chevron":this._drawChevronPath(t,e);break;default:break}},_drawTrianglePath:function(t,e){var i=1.7*this.ctx.lineWidth;this._drawChevronPath(t,e,i),this.ctx.closePath()},_drawChevronPath:function(t,e,i){var n=this,r=e.fromX,o=e.fromY,a=e.toX,s=e.toY,l=this.ctx;i||(i=2.7*this.ctx.lineWidth);var c=Q("head"===t?[r,o]:[a,s],2),u=c[0],h=c[1],f=Q("head"===t?[a,s]:[r,o],2),g=f[0],d=f[1],v=180*Math.atan2(d-h,g-u)/Math.PI,p=function(t){return n.getRotatePosition(i,t,{x:u,y:h})};l.moveTo.apply(l,_(p(v+30))),l.lineTo(u,h),l.lineTo.apply(l,_(p(v-30)))},getRotatePosition:function(t,e,i){var n=e*Math.PI/180,r=i.x,o=i.y;return[t*Math.cos(n)+r,t*Math.sin(n)+o]}}),Po=No;function zo(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Bo=function(t){wn(i,t);var e=zo(i);function i(t){var n,r,o,a;return w(this,i),(a=e.call(this,St.LINE,t))._width=12,a._oColor=new z.fabric.Color("rgba(0, 0, 0, 0.5)"),a._listeners={mousedown:A()(n=a._onFabricMouseDown).call(n,Dn(a)),mousemove:A()(r=a._onFabricMouseMove).call(r,Dn(a)),mouseup:A()(o=a._onFabricMouseUp).call(o,Dn(a))},a}return T(i,[{key:"setHeadOption",value:function(t){var e=t.arrowType,i=void 0===e?{head:null,tail:null}:e;this._arrowType=i}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.getCanvas();e.defaultCursor="crosshair",e.selection=!1,this.setHeadOption(t),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 z.fabric.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,r=i.y,o=[n,r,n,r];this._line=new Po(o,{stroke:this._oColor.toRgba(),strokeWidth:this._width,arrowType:this._arrowType,evented:!1}),this._line.set(oi),e.add(this._line),e.on({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup}),this.fire(oe,this._createLineEventObjectProperties())}},{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();this.fire(qt,this._createLineEventObjectProperties()),this._line=null,t.off({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}},{key:"_createLineEventObjectProperties",value:function(){var t=this.graphics.createObjectProperties(this._line),e=this._line,i=e.x1,n=e.x2,r=e.y1,o=e.y2;return R()({},t,{startPosition:{x:i,y:r},endPosition:{x:n,y:o}})}}]),i}(ho),Ro=Bo;function Fo(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Yo={fill:"#000000",left:0,top:0},Wo={fill:"#000000",fontStyle:"normal",fontWeight:"normal",textAlign:"tie-text-align-left",underline:!1},Ho=function(t){wn(i,t);var e=Fo(i);function i(t){var n,r,o,a,s,l;return w(this,i),(l=e.call(this,St.TEXT,t))._defaultStyles=Yo,l._isSelected=!1,l._selectedObj={},l._editingObj={},l._listeners={mousedown:A()(n=l._onFabricMouseDown).call(n,Dn(l)),select:A()(r=l._onFabricSelect).call(r,Dn(l)),selectClear:A()(o=l._onFabricSelectClear).call(o,Dn(l)),scaling:A()(a=l._onFabricScaling).call(a,Dn(l)),textChanged:A()(s=l._onFabricTextChanged).call(s,Dn(l))},l._textarea=null,l._ratio=1,l._lastClickTime=(new Date).getTime(),l._editingObjInfos={},l.isPrevEditing=!1,l}return T(i,[{key:"start",value:function(){var t=this,e=this.getCanvas();e.selection=!1,e.defaultCursor="text",e.on({"mouse:down":this._listeners.mousedown,"selection:created":this._listeners.select,"selection:updated":this._listeners.select,"before:selection:cleared":this._listeners.selectClear,"object:scaling":this._listeners.scaling,"text:changed":this._listeners.textChanged}),e.forEachObject((function(e){"i-text"===e.type&&t.adjustOriginPosition(e,"start")})),this.setCanvasRatio()}},{key:"end",value:function(){var t=this,e=this.getCanvas();e.selection=!0,e.defaultCursor="default",e.forEachObject((function(i){"i-text"===i.type&&(""===i.text?e.remove(i):t.adjustOriginPosition(i,"end"))})),e.off({"mouse:down":this._listeners.mousedown,"selection:created":this._listeners.select,"selection:updated":this._listeners.select,"before:selection:cleared":this._listeners.selectClear,"object:selected":this._listeners.select,"object:scaling":this._listeners.scaling,"text:changed":this._listeners.textChanged})}},{key:"adjustOriginPosition",value:function(t,e){var i="center",n="center";"start"===e&&(i="left",n="top");var r=t.getPointByOrigin(i,n),o=r.x,a=r.y;t.set({left:o,top:a,originX:i,originY:n}),t.setCoords()}},{key:"add",value:function(t,e){var i=this;return new(L())((function(n){var r,o=i.getCanvas(),a=null,s=oi,l=i._defaultStyles;i._setInitPos(e.position),e.styles&&(l=R()(l,e.styles)),Dr()(e.autofocus)||(e.autofocus=!0),a=new z.fabric.IText(t,l),s=R()({},s,{originX:"left",originY:"top"}),a.set(s),a.on({mouseup:A()(r=i._onFabricMouseUp).call(r,i)}),o.add(a),e.autofocus&&(a.enterEditing(),a.selectAll()),o.getActiveObject()||o.setActiveObject(a),i.isPrevEditing=!0,n(i.graphics.createObjectProperties(a))}))}},{key:"change",value:function(t,e){var i=this;return new(L())((function(n){t.set("text",e),i.getCanvas().renderAll(),n()}))}},{key:"setStyle",value:function(t,e){var i=this;return new(L())((function(n){H()(e,(function(i,n){t[n]===i&&"fontSize"!==n&&(e[n]=Wo[n]||"")}),i),"textDecoration"in e&&R()(e,i._getTextDecorationAdaptObject(e.textDecoration)),t.set(e),i.getCanvas().renderAll(),n()}))}},{key:"getText",value:function(t){return t.text}},{key:"setSelectedInfo",value:function(t,e){this._selectedObj=t,this._isSelected=e}},{key:"isSelected",value:function(){return this._isSelected}},{key:"getSelectedObj",value:function(){return this._selectedObj}},{key:"setCanvasRatio",value:function(){var t=this.getCanvasElement(),e=$()(t.style.maxWidth,10),i=t.width;this._ratio=i/e}},{key:"getCanvasRatio",value:function(){return this._ratio}},{key:"_getTextDecorationAdaptObject",value:function(t){return{underline:"underline"===t,linethrough:"line-through"===t,overline:"overline"===t}}},{key:"_setInitPos",value:function(t){t=t||this.getCanvasImage().getCenterPoint(),this._defaultStyles.left=t.x,this._defaultStyles.top=t.y}},{key:"_onInput",value:function(){var t=this.getCanvasRatio(),e=this._editingObj,i=this._textarea.style;i.width="".concat(Math.ceil(e.width/t),"px"),i.height="".concat(Math.ceil(e.height/t),"px")}},{key:"_onKeyDown",value:function(){var t=this,e=this.getCanvasRatio(),i=this._editingObj,n=this._textarea.style;v()((function(){i.text(t._textarea.value),n.width="".concat(Math.ceil(i.width/e),"px"),n.height="".concat(Math.ceil(i.height/e),"px")}),0)}},{key:"_onBlur",value:function(){var t=this.getCanvasRatio(),e=this._editingObj,i=this._editingObjInfos,n=this._textarea.value,r=e.width/t-i.width/t,o=e.height/t-i.height/t;if(1===t&&(r/=2,o/=2),this._textarea.style.display="none",e.set({left:i.left+r,top:i.top+o}),n.length){this.getCanvas().add(e);var a={id:Ei(e),type:e.type,text:n};this.fire(ee,a)}}},{key:"_onScroll",value:function(){this._textarea.scrollLeft=0,this._textarea.scrollTop=0}},{key:"_onFabricScaling",value:function(t){var e=t.target;e.fontSize=e.fontSize*e.scaleY,e.scaleX=1,e.scaleY=1}},{key:"_onFabricTextChanged",value:function(t){this.fire(ee,t.target)}},{key:"_onFabricSelectClear",value:function(t){var e=this.getSelectedObj();this.isPrevEditing=!0,this.setSelectedInfo(t.target,!1),e&&""===e.text&&this.getCanvas().remove(e)}},{key:"_onFabricSelect",value:function(t){this.isPrevEditing=!0,this.setSelectedInfo(t.target,!0)}},{key:"_onFabricMouseDown",value:function(t){var e=t.target;e&&!e.isType("text")||(this.isPrevEditing?this.isPrevEditing=!1:this._fireAddText(t))}},{key:"_fireAddText",value:function(t){var e=t.target,i=t.e||{},n=this.getCanvas().getPointer(i);e||this.fire(re,{originPosition:{x:n.x,y:n.y},clientPosition:{x:i.clientX||0,y:i.clientY||0}})}},{key:"_onFabricMouseUp",value:function(t){var e=t.target,i=(new Date).getTime();this._isDoubleClick(i)&&!e.isEditing&&e.enterEditing(),e.isEditing&&this.fire(te),this._lastClickTime=i}},{key:"_isDoubleClick",value:function(t){return t-this._lastClickTime<500}}]),i}(ho),Uo=Ho;function Go(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Xo={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"},Zo=function(t){wn(i,t);var e=Go(i);function i(t){var n,r,o,a;return w(this,i),(a=e.call(this,St.ICON,t))._oColor="#000000",a._pathMap=Xo,a._type=null,a._iconColor=null,a._handlers={mousedown:A()(n=a._onFabricMouseDown).call(n,Dn(a)),mousemove:A()(r=a._onFabricMouseMove).call(r,Dn(a)),mouseup:A()(o=a._onFabricMouseUp).call(o,Dn(a))},a}return T(i,[{key:"setStates",value:function(t,e){this._type=t,this._iconColor=e}},{key:"start",value:function(){var t=this.getCanvas();t.selection=!1,t.on("mouse:down",this._handlers.mousedown)}},{key:"end",value:function(){var t=this.getCanvas();t.selection=!0,t.off({"mouse:down":this._handlers.mousedown})}},{key:"add",value:function(t,e){var i=this;return new(L())((function(n,r){var o=i.getCanvas(),a=i._pathMap[t],s=oi,l=a?i._createIcon(a):null;i._icon=l,l||r(li),l.set(R()({type:"icon",fill:i._oColor},s,e,i.graphics.controlStyle)),o.add(l).setActiveObject(l),n(i.graphics.createObjectProperties(l))}))}},{key:"registerPaths",value:function(t){var e=this;H()(t,(function(t,i){e._pathMap[i]=t}),this)}},{key:"setColor",value:function(t,e){this._oColor=t,e&&"icon"===e.get("type")&&(e.set({fill:this._oColor}),this.getCanvas().renderAll())}},{key:"getColor",value:function(t){return nt()(t)}},{key:"_createIcon",value:function(t){return new z.fabric.Path(t)}},{key:"_onFabricMouseDown",value:function(t){var e=this,i=this.getCanvas();this._startPoint=i.getPointer(t.e);var n=this._startPoint,r=n.x,o=n.y;this.add(this._type,{left:r,top:o,fill:this._iconColor}).then((function(){e.fire(oe,e.graphics.createObjectProperties(e._icon)),i.on("mouse:move",e._handlers.mousemove),i.on("mouse:up",e._handlers.mouseup)}))}},{key:"_onFabricMouseMove",value:function(t){var e=this.getCanvas();if(this._icon){var i=e.getPointer(t.e),n=(i.x-this._startPoint.x)/this._icon.width,r=(i.y-this._startPoint.y)/this._icon.height;this._icon.set({scaleX:Math.abs(2*n),scaleY:Math.abs(2*r)}),this._icon.setCoords(),e.renderAll()}}},{key:"_onFabricMouseUp",value:function(){var t=this.getCanvas();this.fire(qt,this.graphics.createObjectProperties(this._icon)),this._icon=null,t.off("mouse:down",this._handlers.mousedown),t.off("mouse:move",this._handlers.mousemove),t.off("mouse:up",this._handlers.mouseup)}}]),i}(ho),Vo=Zo,Jo=z.fabric.util.createClass(z.fabric.Image.filters.BlendImage,{applyTo:function(t){if(this.mask){var e=t.canvasEl,i=e.width,n=e.height,r=this._createCanvasOfMask(i,n),o=e.getContext("2d"),a=r.getContext("2d"),s=o.getImageData(0,0,i,n);this._drawMask(a,e,o),this._mapData(a,s,i,n),t.imageData=s}},_createCanvasOfMask:function(t,e){var i=z.fabric.util.createCanvasElement();return i.width=t,i.height=e,i},_drawMask:function(t){var e=this.mask,i=e.getElement(),n=e.angle,r=e.left,o=e.scaleX,a=e.scaleY,s=e.top;t.save(),t.translate(r,s),t.rotate(n*Math.PI/180),t.scale(o,a),t.drawImage(i,-i.width/2,-i.height/2),t.restore()},_mapData:function(t,e,i,n){for(var r=e.data,o=e.height,a=r,s=e.width*o*4,l=t.getImageData(0,0,i,n).data,c=0;c<s;c+=4)a[c+3]=l[c]}}),Qo=Jo,Ko=z.fabric.util.createClass(z.fabric.Image.filters.Convolute,{type:"Sharpen",initialize:function(){this.matrix=[0,-1,0,-1,5,-1,0,-1,0]}}),qo=z.fabric.util.createClass(z.fabric.Image.filters.Convolute,{type:"Emboss",initialize:function(){this.matrix=[1,1,1,1,.7,-1,-1,-1,-1]}}),$o=z.fabric.util.createClass(z.fabric.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,i,n=t.canvasEl,r=n.getContext("2d"),o=r.getImageData(0,0,n.width,n.height),a=o.data,s=this.threshold,l=z.fabric.Color.sourceFromHex(this.color);for(this.x&&this.y&&(l=this._getColor(o,this.x,this.y)),e=0,i=a.length;e<i;e+=4)this._isOutsideThreshold(a[e],l[0],s)||this._isOutsideThreshold(a[e+1],l[1],s)||this._isOutsideThreshold(a[e+2],l[2],s)||(a[e]=a[e+1]=a[e+2]=a[e+3]=0);r.putImageData(o,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=4*(t.width*i+e);return n[0]=r[o],n[1]=r[o+1],n[2]=r[o+2],n[3]=r[o+3],n}});function ta(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var ea=z.fabric.Image.filters;ea.Mask=Qo,ea.Sharpen=Ko,ea.Emboss=qo,ea.ColorFilter=$o;var ia,na,ra,oa=function(t){wn(i,t);var e=ta(i);function i(t){return w(this,i),e.call(this,St.FILTER,t)}return T(i,[{key:"add",value:function(t,e){var i=this;return new(L())((function(n,r){var o=i._getSourceImage(),a=i.getCanvas(),s=i._getFilter(o,t);s||(s=i._createFilter(o,t,e)),s||r(li),i._changeFilterValues(s,e),i._apply(o,(function(){a.renderAll(),n({type:t,action:"add",options:e})}))}))}},{key:"remove",value:function(t){var e=this;return new(L())((function(i,n){var r=e._getSourceImage(),o=e.getCanvas(),a=e.getOptions(t);r.filters.length||n(vi),e._removeFilter(r,t),e._apply(r,(function(){o.renderAll(),i({type:t,action:"remove",options:a})}))}))}},{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?R()({},i.options):null}},{key:"_changeFilterValues",value:function(t,e){H()(e,(function(e,i){Y()(t[i])||(t[i]=e)})),H()(t.options,(function(i,n){Y()(e[n])||(t.options[n]=e[n])}))}},{key:"_apply",value:function(t,e){t.filters.push(),t.applyFilters()&&e()}},{key:"_getSourceImage",value:function(){return this.getCanvasImage()}},{key:"_createFilter",value:function(t,e,i){var n,r=this._getFabricFilterType(e),o=z.fabric.Image.filters[r];return o&&((n=new o(i)).options=i,t.filters.push(n)),n}},{key:"_getFilter",value:function(t,e){var i=null;if(t){var n,r,o=this._getFabricFilterType(e),a=t.filters.length;for(r=0;r<a;r+=1)if((n=t.filters[r]).type===o){i=n;break}}return i}},{key:"_removeFilter",value:function(t,e){var i,n=this._getFabricFilterType(e);t.filters=no()(i=t.filters).call(i,(function(t){return t.type!==n}))}},{key:"_getFabricFilterType",value:function(t){return t.charAt(0).toUpperCase()+h()(t).call(t,1)}}]),i}(ho),aa=oa,sa=n(1801),la=n.n(sa),ca={pixelate:"blocksize",blur:"blur"},ua={x:"width",y:"height"},ha=(ia=ca,ra={},et()(na=J()(ia)).call(na,(function(t){ra[ia[t]]=t})),ra),fa=null;function ga(t){return Q(Gi(t,"patternSourceCanvas").patternSourceCanvas.getObjects(),1)[0]}function da(t){var e=t.angle,i=t.flipX,n=t.flipY,r=ga(t),o=function(t){var e=Q(ya(t),4),i=e[0],n=i.x,r=i.y,o=e[1],a=o.x,s=o.y,l=e[2],c=l.x,u=l.y,h=e[3],f=h.x,g=h.y,d=Math.min(n,a,c,f),v=Math.min(r,s,u,g),p=Math.max(n,a,c,f),m=Math.max(r,s,u,g);return{left:d,top:v,right:p,bottom:m,width:p-d,height:m-v}}(t),a=o.right,s=o.bottom,l=o.width,c=o.height,u=(l-t.width)/2,h=(c-t.height)/2,f=t.left-t.width/2-u,g=t.top-t.height/2-h,d=l/2-u,v=c/2-h,p=Math.max(l,c)+Math.max(u,h),m=function(t){var e=t.shapeObj,i=t.left,n=t.top,r=t.width,o=t.height,a=t.cropX,s=t.cropY,l=t.flipX,c=t.flipY,u=t.right,h=t.bottom,f=function(t,i,n,r){return function(t){var e=t.type,i=t.shapeObj,n=t.outDistance,r=t.left,o=t.top,a=t.flipX,s=t.flipY,l=ya(i),c=function(t,e,i){var n=0,r=0;H()(e,(function(e,i){e[t]<n&&(n=e[t],r=i)}));var o=Q(i[r],2),a=o[0],s=o[1];return{startPointIndex:r,endPointIndex1:a,endPointIndex2:s}}(e,l,[[1,2],[0,3],[0,3],[1,2]]),u=function(t,e,i){var n,r=i.startPointIndex,o=i.endPointIndex1,a=i.endPointIndex2,s="x"===t?180:270;return pn()(n=[o,a]).call(n,(function(t){var i=e[r],n=e[t],o=i.y-n.y,a=i.x-n.x;return 180*Math.atan2(o,a)/Math.PI-s}))}(e,l,c),h=c.startPointIndex,f=function(t){var e=t.outDistance,i=t.startPointIndex,n=t.flipX,r=t.flipY,o=t.reatAngles,a=e*Math.cos(o[0]*Math.PI/180),s=e*Math.cos(o[1]*Math.PI/180),l=2===i||3===i,c={top:l?a:s,left:l?s:a};(function(t,e,i){return(!e&&i||!e&&!i)&&0===t||(e&&i||e&&!i)&&1===t||(!e&&!i||!e&&i)&&2===t||(e&&!i||e&&i)&&3===t})(i,n,r)&&(c.left=-1*c.left);(function(t,e,i){return(e&&!i||!e&&!i)&&0===t||(!e&&!i||e&&!i)&&1===t||(e&&i||!e&&i)&&2===t||(!e&&i||e&&i)&&3===t})(i,n,r)&&(c.top=-1*c.top);return c}({outDistance:n,startPointIndex:h,flipX:a,flipY:s,reatAngles:u});return[r+f.left,o+f.top]}({type:t,outDistance:i,shapeObj:e,flipX:l,flipY:c,left:n,top:r})},g=r,d=o,v=Q(function(t,e){var i=e.left,n=e.top,r=e.width,o=e.height,a=e.cropX,s=e.cropY,l={width:r,height:o};return H()(["x","y"],(function(e){var r="x"===e?a:s,o=l[ua[e]],c=fa[ua[e]];if(o>c){var u=(o-c)/2;l[ua[e]]=c;var h=Q(t(e,u,i,n),2);i=h[0],n=h[1]}if(r<0){var f=Q(t(e,r,i,n),2);i=f[0],n=f[1]}})),[i,n,l.width,l.height]}(f,{left:i,top:n,width:r,height:o,cropX:a,cropY:s}),4);i=v[0],n=v[1],r=v[2],o=v[3];var p=Q(function(t,e){var i=e.left,n=e.top,r=e.insideCanvasRealImageWidth,o=e.insideCanvasRealImageHeight,a=e.right,s=e.bottom,l=e.cropX,c=e.cropY,u=e.originalWidth,h=e.originalHeight,f=r,g=o,d=fa,v=d.width,p=d.height;a>v&&l>0&&(f=u-Math.abs(a-v));s>p&&c>0&&(g=h-Math.abs(s-p));var m={x:(r-f)/2,y:(o-g)/2};return H()(["x","y"],(function(e){var r=m[e];if(r>0){var o=Q(t(e,r,i,n),2);i=o[0],n=o[1]}})),[i,n,f,g]}(f,{left:i,top:n,insideCanvasRealImageWidth:r,insideCanvasRealImageHeight:o,right:u,bottom:h,cropX:a,cropY:s,originalWidth:g,originalHeight:d}),4);return i=p[0],n=p[1],r=p[2],o=p[3],[i,n,r,o]}({shapeObj:t,left:d,top:v,width:l,height:c,cropX:f,cropY:g,flipX:i,flipY:n,right:a,bottom:s}),y=Q(m,4);d=y[0],v=y[1],l=y[2],c=y[3],r.set({angle:i===n?-e:e,left:d,top:v,width:l,height:c,cropX:f,cropY:g,flipX:i,flipY:n}),Ui(r,{fillImageMaxSize:p})}function va(t){var e;return pn()(e=t.filters).call(e,(function(t){var e=Q(J()(t),1)[0];return S({},ha[e],t[e])}))}function pa(t,e,i){var n=ba(ma(t),t.angle,e);i.add(n);var r={fill:new z.fabric.Pattern({source:i.getElement(),repeat:"no-repeat"})};return Ui(r,{patternSourceCanvas:i}),r}function ma(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return fa&&!e||(fa=t.toCanvasElement()),fa}function ya(t){return[t.getPointByOrigin("left","top"),t.getPointByOrigin("right","top"),t.getPointByOrigin("left","bottom"),t.getPointByOrigin("right","bottom")]}function ba(t,e,i){var n,r=new z.fabric.Image(t);return H()(R().apply(void 0,O()(n=[{}]).call(n,_(i))),(function(t,e){var i,n=(i=e).charAt(0).toUpperCase()+h()(i).call(i,1),o=new z.fabric.Image.filters[n](S({},ca[e],t));r.filters.push(o)})),r.applyFilters(),Ui(r,{originalAngle:e,fillImageMaxSize:Math.max(r.width,r.height)}),la().adjustOriginToCenter(r),r}function xa(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Ca=R()({strokeWidth:1,stroke:"#000000",fill:"#ffffff",width:1,height:1,rx:0,ry:0},{lockSkewingX:!0,lockSkewingY:!0,bringForward:!0,isRegular:!1});function Ia(t,e,i){var n=nt()(t),r=Zi(nt()(t)),o=n;n.color&&(o=n.color);var a=null;if("filter"===r){var s=i();a=pa(e,no()(n),s)}else a={fill:o};return R()({},t,a)}var _a=function(t){wn(i,t);var e=xa(i);function i(t){var n,r,o,a,s,l;return w(this,i),(l=e.call(this,St.SHAPE,t))._shapeObj=null,l._type="rect",l._options=R()({},Ca),l._isSelected=!1,l._startPoint={},l._withShiftKey=!1,l._handlers={mousedown:A()(n=l._onFabricMouseDown).call(n,Dn(l)),mousemove:A()(r=l._onFabricMouseMove).call(r,Dn(l)),mouseup:A()(o=l._onFabricMouseUp).call(o,Dn(l)),keydown:A()(a=l._onKeyDown).call(a,Dn(l)),keyup:A()(s=l._onKeyUp).call(s,Dn(l))},l}return T(i,[{key:"start",value:function(){var t=this.getCanvas();this._isSelected=!1,t.defaultCursor="crosshair",t.selection=!1,t.uniformScaling=!0,t.on({"mouse:down":this._handlers.mousedown}),z.fabric.util.addListener(document,"keydown",this._handlers.keydown),z.fabric.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.uniformScaling=!1,t.off({"mouse:down":this._handlers.mousedown}),z.fabric.util.removeListener(document,"keydown",this._handlers.keydown),z.fabric.util.removeListener(document,"keyup",this._handlers.keyup)}},{key:"setStates",value:function(t,e){this._type=t,e&&(this._options=R()(this._options,e))}},{key:"add",value:function(t,e){var i=this;return new(L())((function(n){var r=i.getCanvas(),o=i._extendOptions(e),a=i._createInstance(t,o),s=i.graphics.createObjectProperties(a);i._bindEventOnShape(a),r.add(a).setActiveObject(a),i._resetPositionFillFilter(a),n(s)}))}},{key:"change",value:function(t,e){var i=this;return new(L())((function(n,r){Ji(t)||r(pi);var o="filter"===Zi(nt()(e)),a=i.graphics,s=a.canvasImage,l=a.createStaticCanvas;t.set(o?Ia(e,s,l):e),o&&i._resetPositionFillFilter(t),i.getCanvas().renderAll(),n()}))}},{key:"makeFillPropertyForUserEvent",value:function(t){var e=Vi(t),i={};if(e===dt){var n=va(ga(t));i.type=e,i.filter=n}else i.type=vt,i.color=nt()(t)||"transparent";return i}},{key:"processForCopiedObject",value:function(t,e){if(this._bindEventOnShape(t),"filter"===Vi(t)){var i=va(ga(e)),n=this.graphics.createStaticCanvas();t.set(pa(this.graphics.canvasImage,i,n)),this._resetPositionFillFilter(t)}}},{key:"_createInstance",value:function(t,e){var i;switch(t){case"rect":i=new z.fabric.Rect(e);break;case"circle":i=new z.fabric.Ellipse(R()({type:"circle"},e));break;case"triangle":i=new z.fabric.Triangle(e);break;default:i={}}return i}},{key:"_extendOptions",value:function(t){var e=oi,i=this.graphics,n=i.canvasImage,r=i.createStaticCanvas;return Ia(t=R()({},Ca,this._options,e,t),n,r)}},{key:"_bindEventOnShape",value:function(t){var e=this,i=this.getCanvas();t.on({added:function(){e._shapeObj=this,la().setOrigins(e._shapeObj)},selected:function(){e._isSelected=!0,e._shapeObj=this,i.uniformScaling=!0,i.defaultCursor="default",la().setOrigins(e._shapeObj)},deselected:function(){e._isSelected=!1,e._shapeObj=null,i.defaultCursor="crosshair",i.uniformScaling=!1},modified:function(){var t=e._shapeObj;la().adjustOriginToCenter(t),la().setOrigins(t)},modifiedInGroup:function(i){e._fillFilterRePositionInGroupSelection(t,i)},moving:function(){e._resetPositionFillFilter(this)},rotating:function(){e._resetPositionFillFilter(this)},scaling:function(t){var n=i.getPointer(t.e),r=e._shapeObj;i.setCursor("crosshair"),la().resize(r,n,!0),e._resetPositionFillFilter(this)}})}},{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,a=r-n.x,s=o-n.y,l=this._shapeObj;l?(this._shapeObj.set({isRegular:this._withShiftKey}),la().resize(l,n),i.renderAll(),this._resetPositionFillFilter(l)):this.add(this._type,{left:r,top:o,width:a,height:s}).then((function(t){e.fire(oe,t)}))}},{key:"_onFabricMouseUp",value:function(){var t=this,e=this.getCanvas(),i=this._startPoint.x,n=this._startPoint.y,r=this._shapeObj;r?r&&(la().adjustOriginToCenter(r),this.fire(qt,this.graphics.createObjectProperties(r))):this.add(this._type,{left:i,top:n,width:20,height:20}).then((function(e){t.fire(oe,e)})),e.off({"mouse:move":this._handlers.mousemove,"mouse:up":this._handlers.mouseup})}},{key:"_onKeyDown",value:function(t){t.keyCode===Ke&&(this._withShiftKey=!0,this._shapeObj&&(this._shapeObj.isRegular=!0))}},{key:"_onKeyUp",value:function(t){t.keyCode===Ke&&(this._withShiftKey=!1,this._shapeObj&&(this._shapeObj.isRegular=!1))}},{key:"_resetPositionFillFilter",value:function(t){if("filter"===Vi(t)){var e=Gi(t,"patternSourceCanvas").patternSourceCanvas,i=Gi(ga(t),"originalAngle").originalAngle;this.graphics.canvasImage.angle!==i&&function(t,e){var i=Gi(t,"patternSourceCanvas").patternSourceCanvas,n=Q(i.getObjects(),1)[0],r=va(n);i.remove(n);var o=ba(ma(e,!0),e.angle,r);i.add(o)}(t,this.graphics.canvasImage);var n=t.originX,r=t.originY;la().adjustOriginToCenter(t),t.width*=t.scaleX,t.height*=t.scaleY,t.rx*=t.scaleX,t.ry*=t.scaleY,t.scaleX=1,t.scaleY=1,da(t),function(t,e){var i=e.originX,n=e.originY,r=t.getPointByOrigin(i,n),o=r.x,a=r.y;t.set({left:o,top:a,originX:i,originY:n}),t.setCoords()}(t,{originX:n,originY:r}),function(t){var e=Gi(Q(t.getObjects(),1)[0],"fillImageMaxSize").fillImageMaxSize;e=Math.max(1,e),t.setDimensions({width:e,height:e}),t.renderAll()}(e)}}},{key:"_fillFilterRePositionInGroupSelection",value:function(t,e){1===e.scaleX&&1===e.scaleY||e.addWithUpdate();var i=t.angle,n=t.left,r=t.top;z.fabric.util.addTransformToObject(t,e.calcTransformMatrix()),this._resetPositionFillFilter(t),t.set({angle:i,left:n,top:r})}}]),i}(ho);function Ma(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Sa={left:0,top:0,width:0,height:0,stroke:"#000000",strokeWidth:0,fill:"#000000",opacity:.4,evented:!1,selectable:!1,hoverCursor:"auto"},wa=.0045,ka=.003,Ta=.003,Da=.0066,Aa=.0044,ja=.003,Oa=ve,Ea=re,La=te,Na=$t,Pa=ye,za=be,Ba=pe,Ra=me,Fa=function(t){wn(i,t);var e=Ma(i);function i(t){var n,r,o,a,s,l,c,u,h,f,g,d,v;w(this,i),(v=e.call(this,St.ZOOM,t)).zoomArea=null,v._startPoint=null,v._centerPoints=[],v.zoomLevel=1,v.zoomMode=Ue,v._listeners={startZoom:A()(n=v._onMouseDownWithZoomMode).call(n,Dn(v)),moveZoom:A()(r=v._onMouseMoveWithZoomMode).call(r,Dn(v)),stopZoom:A()(o=v._onMouseUpWithZoomMode).call(o,Dn(v)),startHand:A()(a=v._onMouseDownWithHandMode).call(a,Dn(v)),moveHand:A()(s=v._onMouseMoveWithHandMode).call(s,Dn(v)),stopHand:A()(l=v._onMouseUpWithHandMode).call(l,Dn(v)),zoomChanged:A()(c=v._changeScrollState).call(c,Dn(v)),keydown:A()(u=v._startHandModeWithSpaceBar).call(u,Dn(v)),keyup:A()(h=v._endHandModeWithSpaceBar).call(h,Dn(v))};var p=v.getCanvas();return v.aspectRatio=p.width/p.height,v._verticalScroll=new z.fabric.Rect(Sa),v._horizontalScroll=new z.fabric.Rect(Sa),p.on(Oa,v._listeners.zoomChanged),v.graphics.on(Ea,A()(f=v._startTextEditingHandler).call(f,Dn(v))),v.graphics.on(La,A()(g=v._startTextEditingHandler).call(g,Dn(v))),v.graphics.on(Na,A()(d=v._stopTextEditingHandler).call(d,Dn(v))),v}return T(i,[{key:"attachKeyboardZoomEvents",value:function(){z.fabric.util.addListener(document,Pa,this._listeners.keydown),z.fabric.util.addListener(document,za,this._listeners.keyup)}},{key:"detachKeyboardZoomEvents",value:function(){z.fabric.util.removeListener(document,Pa,this._listeners.keydown),z.fabric.util.removeListener(document,za,this._listeners.keyup)}},{key:"_startTextEditingHandler",value:function(){this.isTextEditing=!0}},{key:"_stopTextEditingHandler",value:function(){this.isTextEditing=!1}},{key:"_startHandModeWithSpaceBar",value:function(t){this.withSpace||this.isTextEditing||t.keyCode===ii&&(this.withSpace=!0,this.startHandMode())}},{key:"_endHandModeWithSpaceBar",value:function(t){t.keyCode===ii&&(this.withSpace=!1,this.endHandMode())}},{key:"startZoomInMode",value:function(){if(!this.zoomArea){this.endHandMode(),this.zoomMode=Ge;var t=this.getCanvas();this._changeObjectsEventedState(!1),this.zoomArea=new z.fabric.Rect({left:0,top:0,width:.5,height:.5,stroke:"black",strokeWidth:1,fill:"transparent",hoverCursor:"zoom-in"}),t.discardActiveObject(),t.add(this.zoomArea),t.on("mouse:down",this._listeners.startZoom),t.selection=!1,t.defaultCursor="zoom-in"}}},{key:"endZoomInMode",value:function(){this.zoomMode=Ue;var t=this.getCanvas(),e=this._listeners,i=e.startZoom,n=e.moveZoom,r=e.stopZoom;t.selection=!0,t.defaultCursor="auto",t.off({"mouse:down":i,"mouse:move":n,"mouse:up":r}),this._changeObjectsEventedState(!0),t.remove(this.zoomArea),this.zoomArea=null}},{key:"start",value:function(){this.zoomArea=null,this._startPoint=null,this._startHandPoint=null}},{key:"end",value:function(){this.endZoomInMode(),this.endHandMode()}},{key:"startHandMode",value:function(){this.endZoomInMode(),this.zoomMode=Xe;var t=this.getCanvas();this._changeObjectsEventedState(!1),t.discardActiveObject(),t.off("mouse:down",this._listeners.startHand),t.on("mouse:down",this._listeners.startHand),t.selection=!1,t.defaultCursor="grab",t.fire(Ba)}},{key:"endHandMode",value:function(){this.zoomMode=Ue;var t=this.getCanvas();this._changeObjectsEventedState(!0),t.off("mouse:down",this._listeners.startHand),t.selection=!0,t.defaultCursor="auto",this._startHandPoint=null,t.fire(Ra)}},{key:"_onMouseDownWithZoomMode",value:function(t){var e=t.target,i=t.e;if(!e){var n=this.getCanvas();n.selection=!1,this._startPoint=n.getPointer(i),this.zoomArea.set({width:0,height:0});var r=this._listeners,o=r.moveZoom,a=r.stopZoom;n.on({"mouse:move":o,"mouse:up":a})}}},{key:"_onMouseMoveWithZoomMode",value:function(t){var e=t.e,i=this.getCanvas(),n=i.getPointer(e),r=n.x,o=n.y,a=this.zoomArea,s=this._startPoint;Math.abs(r-s.x)+Math.abs(o-s.y)>10&&(i.remove(a),a.set(this._calcRectDimensionFromPoint(r,o)),i.add(a))}},{key:"_calcRectDimensionFromPoint",value:function(t,e){var i=this.getCanvas(),n=i.getWidth(),r=i.getHeight(),o=this._startPoint,a=o.x,s=o.y,l=Math.min,c=l(a,t),u=l(s,e);return{left:c,top:u,width:Ni(t,a,n)-c,height:Ni(e,s,r)-u}}},{key:"_onMouseUpWithZoomMode",value:function(){var t=this.zoomLevel,e=this.zoomArea,i=this._listeners,n=i.moveZoom,r=i.stopZoom,o=this.getCanvas(),a=this._getCenterPoint(),s=a.x,l=a.y;this._isMaxZoomLevel()||(this._centerPoints.push({x:s,y:l,prevZoomLevel:t,zoomLevel:t+1}),t+=1,o.zoomToPoint({x:s,y:l},t),this._fireZoomChanged(o,t),this.zoomLevel=t),o.off({"mouse:move":n,"mouse:up":r}),o.remove(e),this._startPoint=null}},{key:"_getCenterPoint",value:function(){var t=this.zoomArea,e=t.left,i=t.top,n=t.width,r=t.height,o=this._startPoint,a=o.x,s=o.y,l=this.aspectRatio;return n<10&&r<10?{x:a,y:s}:n>r?{x:e+l*r/2,y:i+r/2}:{x:e+n/2,y:i+n/l/2}}},{key:"zoom",value:function(t){for(var e=t.x,i=t.y,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.zoomLevel,r=this.getCanvas(),o=this._centerPoints,a=o.length-1;a>=0&&!(o[a].zoomLevel<n);a-=1){var s=o.pop(),l=s.x,c=s.y,u=s.prevZoomLevel;r.zoomToPoint({x:l,y:c},u),this.zoomLevel=u}r.zoomToPoint({x:e,y:i},n),this._isDefaultZoomLevel(n)||this._centerPoints.push({x:e,y:i,zoomLevel:n,prevZoomLevel:this.zoomLevel}),this.zoomLevel=n,this._fireZoomChanged(r,n)}},{key:"zoomOut",value:function(){var t=this._centerPoints;if(t.length){var e=this.getCanvas(),i=t.pop(),n=i.x,r=i.y,o=i.prevZoomLevel;this._isDefaultZoomLevel(o)?e.setViewportTransform([1,0,0,1,0,0]):e.zoomToPoint({x:n,y:r},o),this.zoomLevel=o,this._fireZoomChanged(e,this.zoomLevel)}}},{key:"resetZoom",value:function(){var t=this.getCanvas();t.setViewportTransform([1,0,0,1,0,0]),this.zoomLevel=1,this._centerPoints=[],this._fireZoomChanged(t,this.zoomLevel)}},{key:"_isMaxZoomLevel",value:function(){return this.zoomLevel>=5}},{key:"_movePointOfZoom",value:function(t){var e=t.x,i=t.y,n=this._centerPoints;if(n.length){var r=this.getCanvas(),o=this.zoomLevel,a=n.pop(),s=a.x,l=a.y,c=a.prevZoomLevel,u=s-e,h=l-i;r.zoomToPoint({x:s,y:l},c),r.zoomToPoint({x:u,y:h},o),n.push({x:u,y:h,prevZoomLevel:c,zoomLevel:o}),this._fireZoomChanged(r,o)}}},{key:"_onMouseDownWithHandMode",value:function(t){var e=t.target,i=t.e;if(!e){var n=this.getCanvas();if(!(this.zoomLevel<=1)){n.selection=!1,this._startHandPoint=n.getPointer(i);var r=this._listeners,o=r.moveHand,a=r.stopHand;n.on({"mouse:move":o,"mouse:up":a})}}}},{key:"_onMouseMoveWithHandMode",value:function(t){var e=t.e,i=this.getCanvas().getPointer(e),n=i.x,r=i.y,o=n-this._startHandPoint.x,a=r-this._startHandPoint.y;this._movePointOfZoom({x:o,y:a})}},{key:"_onMouseUpWithHandMode",value:function(){var t=this.getCanvas(),e=this._listeners,i=e.moveHand,n=e.stopHand;t.off({"mouse:move":i,"mouse:up":n}),this._startHandPoint=null}},{key:"_changeScrollState",value:function(t){var e=t.viewport,i=t.zoomLevel,n=this.getCanvas();if(n.remove(this._verticalScroll),n.remove(this._horizontalScroll),!this._isDefaultZoomLevel(i)){var r=n.width,o=n.height,a=e.tl,s=e.tr,l=e.bl,c=s.x-a.x,u=l.y-a.y,h=c*c/r,f=u*Da,g=Ni(a.x+a.x/r*c,a.x,s.x-h),d=u*Aa,v=u*ja;this._horizontalScroll.set({left:g,top:l.y-f-d,width:h,height:f,rx:v,ry:v});var p=c*wa,m=u*u/o,y=Ni(a.y+a.y/o*u,s.y,l.y-m),b=c*ka,x=c*Ta;this._verticalScroll.set({left:s.x-p-b,top:y,width:p,height:m,rx:x,ry:x}),this._addScrollBar()}}},{key:"_changeObjectsEventedState",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.getCanvas();e.forEachObject((function(e){e.evented=t}))}},{key:"_addScrollBar",value:function(){var t=this,e=this.getCanvas();e.add(this._horizontalScroll),e.add(this._verticalScroll),this.scrollBarTid&&clearTimeout(this.scrollBarTid),this.scrollBarTid=v()((function(){e.remove(t._horizontalScroll),e.remove(t._verticalScroll)}),3e3)}},{key:"_isDefaultZoomLevel",value:function(t){return 1===t}},{key:"_fireZoomChanged",value:function(t,e){t.fire(Oa,{viewport:t.calcViewportBoundaries(),zoomLevel:e})}},{key:"mode",get:function(){return this.zoomMode}}]),i}(ho),Ya=Fa,Wa=rn.create,Ha=rn.types,Ua=function(){function t(e){w(this,t),this.name=e}return T(t,[{key:"getName",value:function(){return this.name}},{key:"start",value:function(){throw new Error(Wa(Ha.UN_IMPLEMENTATION,"start"))}},{key:"end",value:function(){throw new Error(Wa(Ha.UN_IMPLEMENTATION,"stop"))}}]),t}();function Ga(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Xa=function(t){wn(i,t);var e=Ga(i);function i(){return w(this,i),e.call(this,Be.CROPPER)}return T(i,[{key:"start",value:function(t){t.getComponent(St.CROPPER).start()}},{key:"end",value:function(t){t.getComponent(St.CROPPER).end()}}]),i}(Ua),Za=Xa;function Va(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var Ja=function(t){wn(i,t);var e=Va(i);function i(){return w(this,i),e.call(this,Be.FREE_DRAWING)}return T(i,[{key:"start",value:function(t,e){t.getComponent(St.FREE_DRAWING).start(e)}},{key:"end",value:function(t){t.getComponent(St.FREE_DRAWING).end()}}]),i}(Ua),Qa=Ja;function Ka(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var qa=function(t){wn(i,t);var e=Ka(i);function i(){return w(this,i),e.call(this,Be.LINE_DRAWING)}return T(i,[{key:"start",value:function(t,e){t.getComponent(St.LINE).start(e)}},{key:"end",value:function(t){t.getComponent(St.LINE).end()}}]),i}(Ua),$a=qa;function ts(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var es=function(t){wn(i,t);var e=ts(i);function i(){return w(this,i),e.call(this,Be.SHAPE)}return T(i,[{key:"start",value:function(t){t.getComponent(St.SHAPE).start()}},{key:"end",value:function(t){t.getComponent(St.SHAPE).end()}}]),i}(Ua),is=es;function ns(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var rs=function(t){wn(i,t);var e=ns(i);function i(){return w(this,i),e.call(this,Be.TEXT)}return T(i,[{key:"start",value:function(t){t.getComponent(St.TEXT).start()}},{key:"end",value:function(t){t.getComponent(St.TEXT).end()}}]),i}(Ua),os=rs;function as(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var ss=function(t){wn(i,t);var e=as(i);function i(){return w(this,i),e.call(this,Be.ICON)}return T(i,[{key:"start",value:function(t){t.getComponent(St.ICON).start()}},{key:"end",value:function(t){t.getComponent(St.ICON).end()}}]),i}(Ua),ls=ss;function cs(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var us=function(t){wn(i,t);var e=cs(i);function i(){return w(this,i),e.call(this,Be.ZOOM)}return T(i,[{key:"start",value:function(t){t.getComponent(St.ZOOM).start()}},{key:"end",value:function(t){t.getComponent(St.ZOOM).end()}}]),i}(Ua),hs=us,fs=null;function gs(t){fs=t}function ds(t,e){var i,n;"activeSelection"===t.type?i=pn()(n=t.getObjects()).call(n,(function(i){var n=i.angle,r=i.left,o=i.top,a=i.scaleX,s=i.scaleY,l=i.width,c=i.height;z.fabric.util.addTransformToObject(i,t.calcTransformMatrix());var u=e(i);return i.set({angle:n,left:r,top:o,width:l,height:c,scaleX:a,scaleY:s}),u})):i=[e(t)];return i}function vs(t,e,i){return i?{id:t,width:e.width,height:e.height,top:e.top,left:e.left,angle:e.angle,scaleX:e.scaleX,scaleY:e.scaleY}:R()({id:t},e)}function ps(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var ms=function(t){wn(i,t);var e=ps(i);function i(t){var n;return w(this,i),(n=e.call(this,St.RESIZE,t))._dimensions=null,n._originalDimensions=null,n}return T(i,[{key:"getCurrentDimensions",value:function(){var t=this.getCanvasImage();if(!this._dimensions&&t){var e=t.width,i=t.height;this._dimensions={width:e,height:i}}return this._dimensions}},{key:"getOriginalDimensions",value:function(){return this._originalDimensions}},{key:"setOriginalDimensions",value:function(t){this._originalDimensions=t}},{key:"resize",value:function(t){var e=this.getCanvasImage(),i=e.width,n=e.height,r=e.scaleX,o=e.scaleY,a=t.width,s=t.height,l={scaleX:a?a/i:r,scaleY:s?s/n:o};return r===l.scaleX&&o===l.scaleY||(e.set(l).setCoords(),this._dimensions={width:e.width*e.scaleX,height:e.height*e.scaleY}),this.adjustCanvasDimensionBase(),L().resolve()}},{key:"start",value:function(){var t=this.getCurrentDimensions();this.setOriginalDimensions(t)}},{key:"end",value:function(){}}]),i}(ho),ys=ms;function bs(t){var e=function(){if("undefined"==typeof Reflect||!In())return!1;if(In().sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(In()(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=On(t);if(e){var r=On(this).constructor;i=In()(n,arguments,r)}else i=n.apply(this,arguments);return An(this,i)}}var xs=function(t){wn(i,t);var e=bs(i);function i(){return w(this,i),e.call(this,Be.RESIZE)}return T(i,[{key:"start",value:function(t){t.getComponent(St.RESIZE).start()}},{key:"end",value:function(t){t.getComponent(St.RESIZE).end()}}]),i}(Ua),Cs=xs,Is={cssOnly:!0},_s={backstoreOnly:!0},Ms=function(){function t(e){var i,n,r,o,a,s,l,c,u,h,f,g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=g.cssMaxWidth,v=g.cssMaxHeight;w(this,t),this.canvasImage=null,this.cssMaxWidth=d||1e3,this.cssMaxHeight=v||800,this.cropSelectionStyle={},this.targetObjectForCopyPaste=null,this.imageName="",this._objects={},this._canvas=null,this._drawingMode=Be.NORMAL,this._drawingModeMap={},this._componentMap={},this._handler={onMouseDown:A()(i=this._onMouseDown).call(i,this),onObjectAdded:A()(n=this._onObjectAdded).call(n,this),onObjectRemoved:A()(r=this._onObjectRemoved).call(r,this),onObjectMoved:A()(o=this._onObjectMoved).call(o,this),onObjectScaled:A()(a=this._onObjectScaled).call(a,this),onObjectModified:A()(s=this._onObjectModified).call(s,this),onObjectRotated:A()(l=this._onObjectRotated).call(l,this),onObjectSelected:A()(c=this._onObjectSelected).call(c,this),onPathCreated:A()(u=this._onPathCreated).call(u,this),onSelectionCleared:A()(h=this._onSelectionCleared).call(h,this),onSelectionCreated:A()(f=this._onSelectionCreated).call(f,this)},this._setObjectCachingToFalse(),this._setCanvasElement(e),this._createDrawingModeInstances(),this._createComponents(),this._attachCanvasEvents(),this._attachZoomEvents()}return T(t,[{key:"destroy",value:function(){var t=this._canvas.wrapperEl;this._canvas.clear(),t.parentNode.removeChild(t),this._detachZoomEvents()}},{key:"_attachZoomEvents",value:function(){this.getComponent(St.ZOOM).attachKeyboardZoomEvents()}},{key:"_detachZoomEvents",value:function(){this.getComponent(St.ZOOM).detachKeyboardZoomEvents()}},{key:"deactivateAll",value:function(){return this._canvas.discardActiveObject(),this}},{key:"renderAll",value:function(){return this._canvas.renderAll(),this}},{key:"add",value:function(t){var e,i=[];so()(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(){var t;return h()(t=this._canvas.getObjects()).call(t)}},{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,i=this._canvas,n=h()(e=i.getObjects()).call(e);return i.remove.apply(i,_(this._canvas.getObjects())),t&&i.clear(),n}},{key:"removeObjectById",value:function(t){var e=[],i=this._canvas,n=this.getObject(t);return n&&n.isType("group")&&!n.isEmpty()?(i.discardActiveObject(),n.forEachObject((function(t){e.push(t),i.remove(t)}))):i.contains(n)&&(e.push(n),i.remove(n)),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._activeObject}},{key:"getActiveObjectIdForRemove",value:function(){var t=this.getActiveObject(),e=t.type,i=t.left,n=t.top;if("activeSelection"===e){var r=new z.fabric.Group(_(t.getObjects()),{left:i,top:n});return this._addFabricObject(r)}return this.getObjectId(t)}},{key:"isReadyRemoveObject",value:function(){var t=this.getActiveObject();return t&&!t.isEditing}},{key:"getActiveObjects",value:function(){var t=this._canvas._activeObject;return t&&"activeSelection"===t.type?t:null}},{key:"getActiveSelectionFromObjects",value:function(t){var e=this.getCanvas();return new z.fabric.ActiveSelection(t,{canvas:e})}},{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(Be.NORMAL)){var t=this._getDrawingModeInstance(this.getDrawingMode());t&&t.end&&t.end(this),this._drawingMode=Be.NORMAL}}},{key:"zoom",value:function(t,e){var i=t.x,n=t.y,r=this.getComponent(St.ZOOM);r.zoom({x:i,y:n},e)}},{key:"getZoomMode",value:function(){return this.getComponent(St.ZOOM).mode}},{key:"startZoomInMode",value:function(){this.getComponent(St.ZOOM).startZoomInMode()}},{key:"endZoomInMode",value:function(){this.getComponent(St.ZOOM).endZoomInMode()}},{key:"zoomOut",value:function(){this.getComponent(St.ZOOM).zoomOut()}},{key:"startHandMode",value:function(){this.getComponent(St.ZOOM).startHandMode()}},{key:"endHandMode",value:function(){this.getComponent(St.ZOOM).endHandMode()}},{key:"resetZoom",value:function(){this.getComponent(St.ZOOM).resetZoom()}},{key:"toDataURL",value:function(t){var e=this.getComponent(St.CROPPER);e.changeVisibility(!1);var i=this._canvas&&this._canvas.toDataURL(t);return e.changeVisibility(!0),i}},{key:"setCanvasImage",value:function(t,e){e&&Ei(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(){this.adjustCanvasDimensionBase(this.canvasImage.scale(1))}},{key:"adjustCanvasDimensionBase",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t||(t=this.canvasImage);var e=t.getBoundingRect(),i=e.width,n=e.height,r=this._calcMaxDimension(i,n);this.setCanvasCssDimension({width:"100%",height:"100%","max-width":"".concat(r.width,"px"),"max-height":"".concat(r.height,"px")}),this.setCanvasBackstoreDimension({width:i,height:n}),this._canvas.centerObject(t)}},{key:"setCanvasCssDimension",value:function(t){this._canvas.setDimensions(t,Is)}},{key:"setCanvasBackstoreDimension",value:function(t){this._canvas.setDimensions(t,_s)}},{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,i=this,n=A()(e=this._callbackAfterLoadingImageObject).call(e,this);return new(L())((function(e){z.fabric.Image.fromURL(t,(function(t){n(t),e(i.createObjectProperties(t))}),{crossOrigin:"Anonymous"})}))}},{key:"getCenter",value:function(){return this._canvas.getCenter()}},{key:"getCropzoneRect",value:function(){return this.getComponent(St.CROPPER).getCropzoneRect()}},{key:"setCropzoneRect",value:function(t){this.getComponent(St.CROPPER).setCropzoneRect(t)}},{key:"getCroppedImageData",value:function(t){return this.getComponent(St.CROPPER).getCroppedImageData(t)}},{key:"setBrush",value:function(t){var e=this._drawingMode,i=St.FREE_DRAWING;e===Be.LINE_DRAWING&&(i=St.LINE),this.getComponent(i).setBrush(t)}},{key:"setDrawingShape",value:function(t,e){this.getComponent(St.SHAPE).setStates(t,e)}},{key:"setIconStyle",value:function(t,e){this.getComponent(St.ICON).setStates(t,e)}},{key:"registerPaths",value:function(t){this.getComponent(St.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(St.FILTER).hasFilter(t)}},{key:"setSelectionStyle",value:function(t){R()(oi,t)}},{key:"setObjectProperties",value:function(t,e){var i=this.getObject(t),n=R()({},e);return i.set(n),i.setCoords(),this.getCanvas().renderAll(),n}},{key:"getObjectProperties",value:function(t,e){var i=this.getObject(t),n={};return Z()(e)?n[e]=i[e]:so()(e)?Ln()(e,(function(t){n[t]=i[t]})):co()(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,a=e.originY;if(!i)return!1;var s=i.getPointByOrigin(o,a),l=i.getPointByOrigin("center","center"),c=l.x-s.x,u=l.y-s.y;return i.set({left:n+c,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:"createStaticCanvas",value:function(){var t=new z.fabric.StaticCanvas;return t.set({enableRetinaScaling:!1}),t}},{key:"_getDrawingModeInstance",value:function(t){return this._drawingModeMap[t]}},{key:"_setObjectCachingToFalse",value:function(){z.fabric.Object.prototype.objectCaching=!1}},{key:"_setCanvasElement",value:function(t){var e,i;"CANVAS"!==(e=t.nodeType?t:document.querySelector(t)).nodeName.toUpperCase()&&(i=document.createElement("canvas"),e.appendChild(i)),this._canvas=new z.fabric.Canvas(i,{containerClass:"tui-image-editor-canvas-container",enableRetinaScaling:!1})}},{key:"_createDrawingModeInstances",value:function(){this._register(this._drawingModeMap,new Za),this._register(this._drawingModeMap,new Qa),this._register(this._drawingModeMap,new $a),this._register(this._drawingModeMap,new is),this._register(this._drawingModeMap,new os),this._register(this._drawingModeMap,new ls),this._register(this._drawingModeMap,new hs),this._register(this._drawingModeMap,new Cs)}},{key:"_createComponents",value:function(){this._register(this._componentMap,new po(this)),this._register(this._componentMap,new So(this)),this._register(this._componentMap,new To(this)),this._register(this._componentMap,new jo(this)),this._register(this._componentMap,new Lo(this)),this._register(this._componentMap,new Ro(this)),this._register(this._componentMap,new Uo(this)),this._register(this._componentMap,new Vo(this)),this._register(this._componentMap,new aa(this)),this._register(this._componentMap,new _a(this)),this._register(this._componentMap,new Ya(this)),this._register(this._componentMap,new ys(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(oi),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:modified":e.onObjectModified,"object:rotating":e.onObjectRotated,"path:created":e.onPathCreated,"selection:cleared":e.onSelectionCleared,"selection:created":e.onSelectionCreated,"selection:updated":e.onObjectSelected})}},{key:"_onMouseDown",value:function(t){var e=this,i=t.e,n=t.target,r=this._canvas.getPointer(i);if(n){var o=n.type;gs(ds(n,(function(t){return vs(e.getObjectId(t),t,"activeSelection"===o)})))}this.fire(se,i,r)}},{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(Ei(e))}},{key:"_onObjectMoved",value:function(t){var e=this;this._lazyFire(Jt,(function(t){return e.createObjectProperties(t)}),t.target)}},{key:"_onObjectScaled",value:function(t){var e=this;this._lazyFire(Qt,(function(t){return e.createObjectProperties(t)}),t.target)}},{key:"_onObjectModified",value:function(t){var e=t.target;if("activeSelection"===e.type){var i=e.getObjects();et()(i).call(i,(function(t){return t.fire("modifiedInGroup",e)}))}this.fire($t,e,this.getObjectId(e))}},{key:"_onObjectRotated",value:function(t){var e=this;this._lazyFire(Kt,(function(t){return e.createObjectProperties(t)}),t.target)}},{key:"_lazyFire",value:function(t,e,i){var n=this,r=i&&i.canvasEventDelegation?i.canvasEventDelegation(t):"none";"unregistered"===r&&i.canvasEventRegister(t,(function(i){n.fire(t,e(i))})),"none"===r&&this.fire(t,e(i))}},{key:"_onObjectSelected",value:function(t){var e=t.target,i=this.createObjectProperties(e);this.fire(Vt,i)}},{key:"_onPathCreated",value:function(t){var e=t.path.getCenterPoint(),i=e.x,n=e.y;t.path.set(R()({left:i,top:n},oi));var r=this.createObjectProperties(t.path);this.fire(oe,r)}},{key:"_onSelectionCleared",value:function(){this.fire(ue)}},{key:"_onSelectionCreated",value:function(t){var e=t.target,i=this.createObjectProperties(e);this.fire(Vt,i),this.fire(he,t.target)}},{key:"discardSelection",value:function(){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={id:Ei(t),type:t.type};if(R()(e,zi(t,["left","top","width","height","fill","stroke","strokeWidth","opacity","angle"])),Xi(["i-text","text"],t.type))R()(e,this._createTextProperties(t,e));else if(Xi(["rect","triangle","circle"],t.type)){var i=this.getComponent(St.SHAPE);R()(e,{fill:i.makeFillPropertyForUserEvent(t)})}return e}},{key:"_createTextProperties",value:function(t){var e={};return R()(e,zi(t,["text","fontFamily","fontSize","fontStyle","textAlign","textDecoration","fontWeight"])),e}},{key:"_addFabricObject",value:function(t){var e=Ei(t);return this._objects[e]=t,e}},{key:"_removeFabricObject",value:function(t){delete this._objects[t]}},{key:"resetTargetObjectForCopyPaste",value:function(){var t=this.getActiveObject();t&&(this.targetObjectForCopyPaste=t)}},{key:"pasteObject",value:function(){var t=this;if(!this.targetObjectForCopyPaste)return L().resolve([]);var e=this.targetObjectForCopyPaste,i="activeSelection"===e.type?e.getObjects():[e],n=null;return this.discardSelection(),this._cloneObject(i).then((function(e){if(e.length>1)n=t.getActiveSelectionFromObjects(e);else{var i=Q(e,1);n=i[0]}t.targetObjectForCopyPaste=n,t.setActiveObject(n)}))}},{key:"_cloneObject",value:function(t){var e=this,i=pn()(t).call(t,(function(t){return e._cloneObjectItem(t)}));return L().all(i)}},{key:"_cloneObjectItem",value:function(t){var e=this;return this._copyFabricObjectForPaste(t).then((function(t){var i=e.createObjectProperties(t);return e.add(t),e.fire(oe,i),t}))}},{key:"_copyFabricObjectForPaste",value:function(t){var e=this,i=function(t,e){return e?t-10:t+10};return this._copyFabricObject(t).then((function(t){var n=t.left,r=t.top,o=t.width,a=t.height,s=e.getCanvasSize(),l=s.width,c=s.height,u=n+o/2,h=r+a/2;return t.set(R()({left:i(n,u+10>l),top:i(r,h+10>c)},oi)),t}))}},{key:"_copyFabricObject",value:function(t){var e=this;return new(L())((function(i){t.clone((function(n){var r=e.getComponent(St.SHAPE);Ji(n)&&r.processForCopiedObject(n,t),i(n)}))}))}},{key:"getCurrentDimensions",value:function(){return this.getComponent(St.RESIZE).getCurrentDimensions()}},{key:"getOriginalDimensions",value:function(){return this.getComponent(St.RESIZE).getOriginalDimensions()}},{key:"setOriginalDimensions",value:function(t){this.getComponent(St.RESIZE).setOriginalDimensions(t)}},{key:"resize",value:function(t){var e=this.getComponent(St.RESIZE);return e.resize(t)}}]),t}();G().mixin(Ms);var Ss=Ms,ws=se,ks=Jt,Ts=Qt,Ds=Vt,As=Kt,js=qt,Os=$t,Es=re,Ls=oe,Ns=te,Ps=ee,zs=ie,Bs=ne,Rs=ue,Fs=he,Ys=ae,Ws=function(){function t(e,i){var n,r,o,a,s,l,c,u,h,f,g,d,v,p,m,y;if(w(this,t),i=R()({includeUI:!1,usageStatistics:!0},i),this.mode=null,this.activeObjectId=null,i.includeUI){var b=i.includeUI;b.usageStatistics=i.usageStatistics,this.ui=new eo(e,b,this.getActions()),i=this.ui.setUiDefaultSelectionStyle(i)}this._invoker=new fn,this._graphics=new Ss(this.ui?this.ui.getEditorArea():e,{cssMaxWidth:i.cssMaxWidth,cssMaxHeight:i.cssMaxHeight}),this._handlers={keydown:A()(n=this._onKeyDown).call(n,this),mousedown:A()(r=this._onMouseDown).call(r,this),objectActivated:A()(o=this._onObjectActivated).call(o,this),objectMoved:A()(a=this._onObjectMoved).call(a,this),objectScaled:A()(s=this._onObjectScaled).call(s,this),objectRotated:A()(l=this._onObjectRotated).call(l,this),objectAdded:A()(c=this._onObjectAdded).call(c,this),objectModified:A()(u=this._onObjectModified).call(u,this),createdPath:this._onCreatedPath,addText:A()(h=this._onAddText).call(h,this),addObject:A()(f=this._onAddObject).call(f,this),textEditing:A()(g=this._onTextEditing).call(g,this),textChanged:A()(d=this._onTextChanged).call(d,this),iconCreateResize:A()(v=this._onIconCreateResize).call(v,this),iconCreateEnd:A()(p=this._onIconCreateEnd).call(p,this),selectionCleared:A()(m=this._selectionCleared).call(m,this),selectionCreated:A()(y=this._selectionCreated).call(y,this)},this._attachInvokerEvents(),this._attachGraphicsEvents(),this._attachDomEvents(),this._setSelectionStyle(i.selectionStyle,{applyCropSelectionStyle:i.applyCropSelectionStyle,applyGroupSelectionStyle:i.applyGroupSelectionStyle}),i.usageStatistics&&(ji||(ji=!0,ot()("image-editor","UA-129999381-1"))),this.ui&&(this.ui.initCanvas(),this.setReAction(),this._attachColorPickerInputBoxEvents()),z.fabric.enableGLFiltering=!1}return T(t,[{key:"_attachColorPickerInputBoxEvents",value:function(){var t=this;this.ui.on(xe,(function(){t.isColorPickerInputBoxEditing=!0})),this.ui.on(Ce,(function(){t.isColorPickerInputBoxEditing=!1}))}},{key:"_detachColorPickerInputBoxEvents",value:function(){this.ui.off(xe),this.ui.off(Ce)}},{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){"activeSelection"===e.type&&e.set(t)}))}},{key:"_attachInvokerEvents",value:function(){var t,e,i=this,n=ce,r=le,o=fe,a=ge,s=de,l=pe,c=me;if(this._invoker.on(n,A()(t=this.fire).call(t,this,n)),this._invoker.on(r,A()(e=this.fire).call(e,this,r)),this.ui){var u=this._graphics.getCanvas();this._invoker.on(o,(function(t){return i.ui.fire(o,t)})),this._invoker.on(a,(function(t){return i.ui.fire(a,t)})),this._invoker.on(s,(function(t){return i.ui.fire(s,t)})),u.on(l,(function(){return i.ui.fire(l)})),u.on(c,(function(){return i.ui.fire(c)}))}}},{key:"_attachGraphicsEvents",value:function(){var t;this._graphics.on((S(t={},ws,this._handlers.mousedown),S(t,ks,this._handlers.objectMoved),S(t,Ts,this._handlers.objectScaled),S(t,As,this._handlers.objectRotated),S(t,Ds,this._handlers.objectActivated),S(t,js,this._handlers.objectAdded),S(t,Os,this._handlers.objectModified),S(t,Es,this._handlers.addText),S(t,Ls,this._handlers.addObject),S(t,Ns,this._handlers.textEditing),S(t,Ps,this._handlers.textChanged),S(t,zs,this._handlers.iconCreateResize),S(t,Bs,this._handlers.iconCreateEnd),S(t,Rs,this._handlers.selectionCleared),S(t,Fs,this._handlers.selectionCreated),t))}},{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=t.ctrlKey,i=t.keyCode,n=t.metaKey;(e||n)&&(i===Je?this._graphics.resetTargetObjectForCopyPaste():i===Qe?(this._graphics.pasteObject(),this.clearRedoStack()):i===Ze?this.undo().catch((function(){})):i===Ve&&this.redo().catch((function(){})));var r=i===qe||i===$e,o=this._graphics.isReadyRemoveObject();!this.isColorPickerInputBoxEditing&&o&&r&&(t.preventDefault(),this.removeActiveObject())}},{key:"removeActiveObject",value:function(){var t=this._graphics.getActiveObjectIdForRemove();this.removeObject(t)}},{key:"_onMouseDown",value:function(t,e){this.fire(se,t,e)}},{key:"_pushAddObjectCommand",value:function(t){var e=un.create(jt,this._graphics,t);this._invoker.pushUndoStack(e)}},{key:"_pushModifyObjectCommand",value:function(t){var e=this,i=t.type,n=ds(t,(function(t){return vs(e._graphics.getObjectId(t),t,"activeSelection"===i)})),r=un.create(Xt,this._graphics,n);r.execute(this._graphics,n),this._invoker.pushUndoStack(r)}},{key:"_onObjectActivated",value:function(t){this.fire(Vt,t)}},{key:"_onObjectMoved",value:function(t){this.fire(Jt,t)}},{key:"_onObjectScaled",value:function(t){this.fire(Qt,t)}},{key:"_onObjectRotated",value:function(t){this.fire(Kt,t)}},{key:"getDrawingMode",value:function(){return this._graphics.getDrawingMode()}},{key:"clearObjects",value:function(){return this.execute(kt)}},{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:"_initHistory",value:function(){this.ui&&this.ui.initHistory()}},{key:"_clearHistory",value:function(){this.ui&&this.ui.clearHistory()}},{key:"execute",value:function(t){for(var e,i,n,r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];var s=O()(e=[this._graphics]).call(e,o);return(i=this._invoker).execute.apply(i,O()(n=[t]).call(n,_(s)))}},{key:"executeSilent",value:function(t){for(var e,i,n,r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];var s=O()(e=[this._graphics]).call(e,o);return(i=this._invoker).executeSilent.apply(i,O()(n=[t]).call(n,_(s)))}},{key:"undo",value:function(){for(var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=L().resolve(),n=0;n<e;n+=1)i=i.then((function(){return t._invoker.undo()}));return i}},{key:"redo",value:function(){for(var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=L().resolve(),n=0;n<e;n+=1)i=i.then((function(){return t._invoker.redo()}));return i}},{key:"zoom",value:function(t){var e=t.x,i=t.y,n=t.zoomLevel;this._graphics.zoom({x:e,y:i},n)}},{key:"resetZoom",value:function(){this._graphics.resetZoom()}},{key:"loadImageFromFile",value:function(t,e){if(!t)return L().reject(li);var i=P().createObjectURL(t);return e=e||t.name,this.loadImageFromURL(i,e).then((function(e){return P().revokeObjectURL(t),e}))}},{key:"loadImageFromURL",value:function(t,e){return e&&t?this.execute(Tt,e,t):L().reject(li)}},{key:"addImageObject",value:function(t){return t?this.execute(Wt,t):L().reject(li)}},{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().reject(li)}},{key:"getCropzoneRect",value:function(){return this._graphics.getCropzoneRect()}},{key:"setCropzoneRect",value:function(t){this._graphics.setCropzoneRect(t)}},{key:"_flip",value:function(t){return this.execute(Dt,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,i){return i?this.executeSilent(At,t,e):this.execute(At,t,e)}},{key:"rotate",value:function(t,e){return this._rotate("rotate",t,e)}},{key:"setAngle",value:function(t,e){return this._rotate("setAngle",t,e)}},{key:"setBrush",value:function(t){this._graphics.setBrush(t)}},{key:"setDrawingShape",value:function(t,e){this._graphics.setDrawingShape(t,e)}},{key:"setDrawingIcon",value:function(t,e){this._graphics.setIconStyle(t,e)}},{key:"addShape",value:function(t,e){return e=e||{},this._setPositions(e),this.execute(zt,t,e)}},{key:"changeShape",value:function(t,e,i){return this[i?"executeSilent":"execute"](Bt,t,e)}},{key:"addText",value:function(t,e){return t=t||"",e=e||{},this.execute(Rt,t,e)}},{key:"changeText",value:function(t,e){return e=e||"",this.execute(Ft,t,e)}},{key:"changeTextStyle",value:function(t,e,i){return this[i?"executeSilent":"execute"](Yt,t,e)}},{key:"_changeActivateMode",value:function(t){"ICON"!==t&&this.getDrawingMode()!==t&&this.startDrawingMode(t)}},{key:"_onTextChanged",value:function(t){this.fire(ee,t)}},{key:"_onIconCreateResize",value:function(t){this.fire(ie,t)}},{key:"_onIconCreateEnd",value:function(t){this.fire(ne,t)}},{key:"_onTextEditing",value:function(){this.fire(te)}},{key:"_onAddText",value:function(t){this.fire(re,{originPosition:t.originPosition,clientPosition:t.clientPosition})}},{key:"_onAddObject",value:function(t){var e=this._graphics.getObject(t.id);this._invoker.fire(fe,Qi(e.type)),this._pushAddObjectCommand(e)}},{key:"_onObjectAdded",value:function(t){this.fire(js,t),this.fire(Ys,t)}},{key:"_onObjectModified",value:function(t){t.type!==mt&&(this._invoker.fire(fe,Qi(t.type)),this._pushModifyObjectCommand(t))}},{key:"_selectionCleared",value:function(){this.fire(Rs)}},{key:"_selectionCreated",value:function(t){this.fire(Fs,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(Nt,t,e)}},{key:"changeIconColor",value:function(t,e){return this.execute(Pt,t,e)}},{key:"removeObject",value:function(t){var e=this._graphics.getObject(t).type;return this.execute(Ot,t,Qi(e))}},{key:"hasFilter",value:function(t){return this._graphics.hasFilter(t)}},{key:"removeFilter",value:function(t){return this.execute(Lt,t)}},{key:"applyFilter",value:function(t,e,i){return this[i?"executeSilent":"execute"](Et,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(Ht,t):L().reject(li)}},{key:"destroy",value:function(){var t=this;this.stopDrawingMode(),this._detachDomEvents(),this._graphics.destroy(),this._graphics=null,this.ui&&(this._detachColorPickerInputBoxEvents(),this.ui.destroy()),H()(this,(function(e,i){t[i]=null}),this)}},{key:"_setPositions",value:function(t){var e=this._graphics.getCenter();Y()(t.left)&&(t.left=e.left),Y()(t.top)&&(t.top=e.top)}},{key:"setObjectProperties",value:function(t,e){return this.execute(Ut,t,e)}},{key:"setObjectPropertiesQuietly",value:function(t,e){this._graphics.setObjectProperties(t,e)}},{key:"getObjectProperties",value:function(t,e){return this._graphics.getObject(t)?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(Gt,t,e)}},{key:"resize",value:function(t){return this.execute(Zt,t)}}]),t}();oo.mixin(Ws),G().mixin(Ws);var Hs=Ws,Us=St.ICON,Gs={name:Nt,execute:function(t,e,i){var n=this;return t.getComponent(Us).add(e,i).then((function(e){return n.undoData.object=t.getObject(e.id),e}))},undo:function(t){return t.remove(this.undoData.object),L().resolve()}};un.register(Gs);var Xs={name:Wt,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),L().resolve()}};un.register(Xs);var Zs={name:jt,execute:function(t,e){return new(L())((function(i,n){t.contains(e)?n(ai):(t.add(e),i(e))}))},undo:function(t,e){return new(L())((function(i,n){t.contains(e)?(t.remove(e),i(e)):n(fi)}))}};un.register(Zs);var Vs=St.SHAPE,Js={name:zt,execute:function(t,e,i){var n=this;return t.getComponent(Vs).add(e,i).then((function(e){var i=e.id;return n.undoData.object=t.getObject(i),e}))},undo:function(t){return t.remove(this.undoData.object),L().resolve()}};un.register(Js);var Qs=St.TEXT,Ks={name:Rt,execute:function(t,e,i){var n=this,r=t.getComponent(Qs);if(this.undoData.object){var o=this.undoData.object;return new(L())((function(e,i){t.contains(o)?i(gi):(t.add(o),e(o))}))}return r.add(e,i).then((function(e){var i=e.id,r=t.getObject(i);return n.undoData.object=r,gs(ds(r,(function(){return vs(i,r,!1)}))),e}))},undo:function(t){return t.remove(this.undoData.object),L().resolve()}};un.register(Ks);var qs=St.FILTER,$s=null;var tl={name:Et,execute:function(t,e,i,n){var r=t.getComponent(qs);if("mask"===e){var o=t.getObject(i.maskObjId);if(!o||!o.isType("image"))return L().reject(li);R()(i,{mask:o}),t.remove(i.mask)}if(!this.isRedo){var a=function(t,e,i){var n={};return"mask"===t&&(n.object=i.mask),n.options=e,n}(e,r.getOptions(e),i);$s=this.setUndoData(a,$s,n)}return r.add(e,i)},undo:function(t,e){var i=t.getComponent(qs);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)}};un.register(tl);var el=St.ICON,il={name:Pt,execute:function(t,e,i){var n=this;return new(L())((function(r,o){var a=t.getComponent(el),s=t.getObject(e);s||o(fi),n.undoData.object=s,n.undoData.color=a.getColor(s),a.setColor(i,s),r()}))},undo:function(t){var e=t.getComponent(el),i=this.undoData,n=i.object,r=i.color;return e.setColor(r,n),L().resolve()}};un.register(il);var nl=St.SHAPE,rl=null;var ol={name:Bt,execute:function(t,e,i,n){var r=t.getComponent(nl),o=t.getObject(e);if(!o)return L().reject(fi);if(!this.isRedo){var a=function(t,e){var i={object:e,options:{}};return co()(t,(function(t,n){i.options[n]=e[n]})),i}(i,o);rl=this.setUndoData(a,rl,n)}return r.change(o,i)},undo:function(t){var e=t.getComponent(nl),i=this.undoData,n=i.object,r=i.options;return e.change(n,r)}};un.register(ol);var al=St.TEXT,sl={name:Ft,execute:function(t,e,i){var n=t.getComponent(al),r=t.getObject(e);return r?(this.undoData.object=r,this.undoData.text=n.getText(r),n.change(r,i)):L().reject(fi)},undo:function(t){var e=t.getComponent(al),i=this.undoData,n=i.object,r=i.text;return e.change(n,r)}};un.register(sl);var ll=St.TEXT,cl=null;var ul={name:Yt,execute:function(t,e,i,n){var r=t.getComponent(ll),o=t.getObject(e);if(!o)return L().reject(fi);if(!this.isRedo){var a=function(t,e){var i={object:e,styles:{}};return co()(t,(function(t,n){var r=e[n];i.styles[n]=r})),i}(i,o);cl=this.setUndoData(a,cl,n)}return r.setStyle(o,i)},undo:function(t){var e=t.getComponent(ll),i=this.undoData,n=i.object,r=i.styles;return e.setStyle(n,r)}};un.register(ul);var hl={name:kt,execute:function(t){var e=this;return new(L())((function(i){e.undoData.objects=t.removeAll(),i()}))},undo:function(t){return t.add(this.undoData.objects),L().resolve()}};un.register(hl);var fl=St.FLIP,gl={name:Dt,execute:function(t,e){var i=t.getComponent(fl);return this.undoData.setting=i.getCurrentSetting(),i[e]()},undo:function(t){return t.getComponent(fl).set(this.undoData.setting)}};un.register(gl);var dl=St.IMAGE_LOADER,vl={name:Tt,execute:function(t,e,i){var n,r=t.getComponent(dl),o=r.getCanvasImage(),a=o?o.width:0,s=o?o.height:0,l=no()(n=t.removeAll(!0)).call(n,(function(t){return"cropzone"!==t.type}));return et()(l).call(l,(function(t){t.evented=!0})),this.undoData={name:r.getImageName(),image:o,objects:l},r.load(e,i).then((function(t){return{oldWidth:a,oldHeight:s,newWidth:t.width,newHeight:t.height}}))},undo:function(t){var e=t.getComponent(dl),i=this.undoData,n=i.objects,r=i.name,o=i.image;return t.removeAll(!0),t.add(n),e.load(r,o)}};un.register(vl);var pl=St.FILTER,ml={name:Lt,execute:function(t,e){var i=t.getComponent(pl);return this.undoData.options=i.getOptions(e),i.remove(e)},undo:function(t,e){var i=t.getComponent(pl),n=this.undoData.options;return i.add(e,n)}};un.register(ml);var yl={name:Ot,execute:function(t,e){var i=this;return new(L())((function(n,r){i.undoData.objects=t.removeObjectById(e),i.undoData.objects.length?n():r(fi)}))},undo:function(t){return t.add(this.undoData.objects),L().resolve()}};un.register(yl);var bl={name:Ht,execute:function(t,e){var i=this;return new(L())((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(),L().resolve()}};un.register(bl);var xl=St.ROTATION,Cl=null;var Il={name:At,execute:function(t,e,i,n){var r=t.getComponent(xl);if(!this.isRedo){var o=function(t){return{angle:t.getCurrentAngle()}}(r);Cl=this.setUndoData(o,Cl,n)}return r[e](i)},undo:function(t){var e=t.getComponent(xl),i=Q(this.args,3),n=i[1],r=i[2];return"setAngle"===n?e[n](this.undoData.angle):e.rotate(-r)}};un.register(Il);var _l={name:Ut,execute:function(t,e,i){var n=this,r=t.getObject(e);return r?(this.undoData.props={},co()(i,(function(t,e){n.undoData.props[e]=r[e]})),t.setObjectProperties(e,i),L().resolve()):L().reject(fi)},undo:function(t,e){var i=this.undoData.props;return t.setObjectProperties(e,i),L().resolve()}};un.register(_l);var Ml={name:Gt,execute:function(t,e,i){return t.getObject(e)?(this.undoData.objectId=e,this.undoData.props=t.getObjectProperties(e,["left","top"]),t.setObjectPosition(e,i),t.renderAll(),L().resolve()):L().reject(fi)},undo:function(t){var e=this.undoData,i=e.objectId,n=e.props;return t.setObjectProperties(i,n),t.renderAll(),L().resolve()}};un.register(Ml);var Sl={name:Xt,execute:function(t,e){return this.isRedo?et()(e).call(e,(function(e){t.setObjectProperties(e.id,e)})):this.undoData=fs,L().resolve()},undo:function(t){var e;return et()(e=this.undoData).call(e,(function(e){t.setObjectProperties(e.id,e)})),L().resolve()}};un.register(Sl);var wl=St.RESIZE,kl={name:Zt,execute:function(t,e){var i=t.getComponent(wl),n=i.getOriginalDimensions();return n||(n=i.getCurrentDimensions()),this.undoData.dimensions=n,i.resize(e)},undo:function(t){return t.getComponent(wl).resize(this.undoData.dimensions)}};un.register(kl);var Tl=Hs}(),r=r.default}()}));