gwt.material.design.amplugin.annotation.client.resources.js.annotation.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gwt-material-am4charts
Show all versions of gwt-material-am4charts
Amcharts Version 4 for GMD
/**
* @license
* Copyright (c) 2018 amCharts (Antanas Marcelionis, Martynas Majeris)
*
* This sofware is provided under multiple licenses. Please see below for
* links to appropriate usage.
*
* Free amCharts linkware license. Details and conditions:
* https://github.com/amcharts/amcharts4/blob/master/LICENSE
*
* One of the amCharts commercial licenses. Details and pricing:
* https://www.amcharts.com/online-store/
* https://www.amcharts.com/online-store/licenses-explained/
*
* If in doubt, contact amCharts at [email protected]
*
* PLEASE DO NOT REMOVE THIS COPYRIGHT NOTICE.
* @hidden
*/
am4internal_webpackJsonp(["71c9"],{"/Im6":function(t,e,i){(function(t){var r=r||{version:"3.3.0"};if(e.fabric=r,"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?r.document=document:r.document=document.implementation.createHTMLDocument(""),r.window=window;else{var n=new(i("M4QQ").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;r.document=n.document,r.jsdomImplForWrapper=i(1).implForWrapper,r.nodeCanvas=i(2).Canvas,r.window=n,DOMParser=r.window.DOMParser}function s(t,e){var i=t.canvas,r=e.targetCanvas,n=r.getContext("2d");n.translate(0,r.height),n.scale(1,-1);var s=i.height-r.height;n.drawImage(i,0,s,r.width,r.height,0,0,r.width,r.height)}function o(t,e){var i=e.targetCanvas.getContext("2d"),r=e.destinationWidth,n=e.destinationHeight,s=r*n*4,o=new Uint8Array(this.imageBuffer,0,s),a=new Uint8ClampedArray(this.imageBuffer,0,s);t.readPixels(0,0,r,n,t.RGBA,t.UNSIGNED_BYTE,o);var h=new ImageData(a,r,n);i.putImageData(h,0,0)}r.isTouchSupported="ontouchstart"in r.window||"ontouchstart"in r.document||r.window&&r.window.navigator&&r.window.navigator.maxTouchPoints>0,r.isLikelyNode=void 0!==t&&"undefined"==typeof window,r.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"],r.DPI=96,r.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",r.fontPaths={},r.iMatrix=[1,0,0,1,0,0],r.perfLimitSizeTotal=2097152,r.maxCacheSideLimit=4096,r.minCacheSideLimit=256,r.charWidthsCache={},r.textureSize=2048,r.disableStyleCopyPaste=!1,r.enableGLFiltering=!0,r.devicePixelRatio=r.window.devicePixelRatio||r.window.webkitDevicePixelRatio||r.window.mozDevicePixelRatio||1,r.browserShadowBlurConstant=1,r.arcToSegmentsCache={},r.boundsOfCurveCache={},r.cachesBoundsOfCurve=!0,r.forceGLPutImageData=!1,r.initFilterBackend=function(){return r.enableGLFiltering&&r.isWebglSupported&&r.isWebglSupported(r.textureSize)?(console.log("max texture size: "+r.maxTextureSize),new r.WebglFilterBackend({tileSize:r.textureSize})):r.Canvas2dFilterBackend?new r.Canvas2dFilterBackend:void 0},function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:r.util.array.fill(i,!1)}}function e(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this}function i(e,i){if(!this.__eventListeners)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 r in e)t.call(this,r,e[r]);else t.call(this,e,i);return this}function n(t,e){if(!this.__eventListeners)return this;var i=this.__eventListeners[t];if(!i)return this;for(var r=0,n=i.length;r-1},complexity:function(){return this._objects.reduce(function(t,e){return t+=e.complexity?e.complexity():0},0)}},r.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof r.Gradient||this.set(e,new r.Gradient(t))},_initPattern:function(t,e,i){!t||!t.source||t instanceof r.Pattern?i&&i():this.set(e,new r.Pattern(t,i))},_initClipping:function(t){if(t.clipTo&&"string"==typeof t.clipTo){var e=r.util.getFunctionBody(t.clipTo);void 0!==e&&(this.clipTo=new Function("ctx",e))}},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):"function"==typeof e&&"clipTo"!==t?this._set(t,e(this.get(t))):this._set(t,e),this},_set:function(t,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]}},function(t){var e=Math.sqrt,i=Math.atan2,n=Math.pow,s=Math.abs,o=Math.PI/180,a=Math.PI/2;r.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/a){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/a){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*o},radiansToDegrees:function(t){return t/o},rotatePoint:function(t,e,i){t.subtractEquals(e);var n=r.util.rotateVector(t,i);return new r.Point(n.x,n.y).addEquals(e)},rotateVector:function(t,e){var i=r.util.sin(e),n=r.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 r.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new r.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t){var e=[t[0].x,t[1].x,t[2].x,t[3].x],i=r.util.array.min(e),n=r.util.array.max(e)-i,s=[t[0].y,t[1].y,t[2].y,t[3].y],o=r.util.array.min(s);return{left:i,top:o,width:n,height:r.util.array.max(s)-o}},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=r.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=r.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case"mm":return n*r.DPI/25.4;case"cm":return n*r.DPI/2.54;case"in":return n*r.DPI;case"pt":return n*r.DPI/72;case"pc":return n*r.DPI/72*12;case"em":return n*e;default:return n}},falseFunction:function(){return!1},getKlass:function(t,e){return t=r.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),r.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"])}return e},resolveNamespace:function(e){if(!e)return r;var i,n=e.split("."),s=n.length,o=t||r.window;for(i=0;ir;)(r+=a[d++%f])>l&&(r=l),t[g?"lineTo":"moveTo"](r,0),g=!g;t.restore()},createCanvasElement:function(){return r.document.createElement("canvas")},copyCanvasElement:function(t){var e=r.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 r.document.createElement("img")},clipContext:function(t,e){e.save(),e.beginPath(),t.clipTo(e),e.clip()},multiplyTransformMatrices:function(t,e,i){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],i?0:t[0]*e[4]+t[2]*e[5]+t[4],i?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var r=i(t[1],t[0]),s=n(t[0],2)+n(t[1],2),a=e(s),h=(t[0]*t[3]-t[2]*t[1])/a,c=i(t[0]*t[2]+t[1]*t[3],s);return{angle:r/o,scaleX:a,scaleY:h,skewX:c/o,skewY:0,translateX:t[4],translateY:t[5]}},customTransformMatrix:function(t,e,i){var n=[1,0,s(Math.tan(i*o)),1],a=[s(t),0,0,s(e)];return r.util.multiplyTransformMatrices(a,n,!0)},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}},getFunctionBody:function(t){return(String(t).match(/function[^{]*\{([\s\S]*)\}/)||{})[1]},isTransparent:function(t,e,i,r){r>0&&(e>r?e-=r:e=0,i>r?i-=r:i=0);var n,s=!0,o=t.getImageData(e,i,2*r||1,2*r||1),a=o.data.length;for(n=3;n0?j-=2*f:1===c&&j<0&&(j+=2*f);for(var M=Math.ceil(Math.abs(j/f*2)),F=[],I=j/M,B=8/3*Math.sin(I/4)*Math.sin(I/4)/Math.sin(I/2),L=D+I,R=0;R=n?s-n:2*Math.PI-(n-s)}function s(e,i,n,s,o,a,h,c){var l;if(r.cachesBoundsOfCurve&&(l=t.call(arguments),r.boundsOfCurveCache[l]))return r.boundsOfCurveCache[l];var u,f,d,g,p,v,m,_,y=Math.sqrt,b=Math.min,x=Math.max,C=Math.abs,w=[],S=[[],[]];f=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*h,d=3*n-3*e;for(var T=0;T<2;++T)if(T>0&&(f=6*i-12*s+6*a,u=-3*i+9*s-9*a+3*c,d=3*s-3*i),C(u)<1e-12){if(C(f)<1e-12)continue;0<(g=-d/f)&&g<1&&w.push(g)}else(m=f*f-4*d*u)<0||(0<(p=(-f+(_=y(m)))/(2*u))&&p<1&&w.push(p),0<(v=(-f-_)/(2*u))&&v<1&&w.push(v));for(var O,k,P,E=w.length,A=E;E--;)O=(P=1-(g=w[E]))*P*P*e+3*P*P*g*n+3*P*g*g*o+g*g*g*h,S[0][E]=O,k=P*P*P*i+3*P*P*g*s+3*P*g*g*a+g*g*g*c,S[1][E]=k;S[0][A]=e,S[1][A]=i,S[0][A+1]=h,S[1][A+1]=c;var D=[{x:b.apply(null,S[0]),y:b.apply(null,S[1])},{x:x.apply(null,S[0]),y:x.apply(null,S[1])}];return r.cachesBoundsOfCurve&&(r.boundsOfCurveCache[l]=D),D}r.util.drawArc=function(t,i,r,n){for(var s=n[0],o=n[1],a=n[2],h=n[3],c=n[4],l=[[],[],[],[]],u=e(n[5]-i,n[6]-r,s,o,h,c,a),f=0,d=u.length;f=e})}}}(),function(){function t(e,i,n){if(n)if(!r.isLikelyNode&&i instanceof Element)e=i;else if(i instanceof Array){e=[];for(var s=0,o=i.length;s57343)return t.charAt(e);if(55296<=i&&i<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var r=t.charCodeAt(e+1);if(56320>r||r>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 n=t.charCodeAt(e-1);if(55296>n||n>56319)throw"Low surrogate without preceding high surrogate";return!1}r.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,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")},graphemeSplit:function(e){var i,r=0,n=[];for(r=0;r-1?t.prototype[n]=function(t){return function(){var i=this.constructor.superclass;this.constructor.superclass=r;var n=e[t].apply(this,arguments);if(this.constructor.superclass=i,"initialize"!==t)return n}}(n):t.prototype[n]=e[n],i&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function s(){}function o(e){for(var i=null,r=this;r.constructor.superclass;){var n=r.constructor.superclass.prototype[e];if(r[e]!==n){i=n;break}r=r.constructor.superclass.prototype}return i?arguments.length>1?i.apply(this,t.call(arguments,1)):i.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}r.util.createClass=function(){var i=null,r=t.call(arguments,0);function a(){this.initialize.apply(this,arguments)}"function"==typeof r[0]&&(i=r.shift()),a.superclass=i,a.subclasses=[],i&&(s.prototype=i.prototype,a.prototype=new s,i.subclasses.push(a));for(var h=0,c=r.length;h=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(n,e)):i.filter+=" alpha(opacity="+100*e+")",t}),r.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?s(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var r in e)"opacity"===r?s(t,e[r]):i["float"===r||"cssFloat"===r?void 0===i.styleFloat?"cssFloat":"styleFloat":r]=e[r];return t}}(),function(){var t=Array.prototype.slice;var e,i,n=function(e){return t.call(e,0)};try{e=n(r.document.childNodes)instanceof Array}catch(t){}function s(t,e){var i=r.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 o(t){for(var e=0,i=0,n=r.document.documentElement,s=r.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===r.document?(e=s.scrollLeft||n.scrollLeft||0,i=s.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||(n=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e}),i=r.document.defaultView&&r.document.defaultView.getComputedStyle?function(t,e){var i=r.document.defaultView.getComputedStyle(t,null);return i?i[e]:void 0}:function(t,e){var i=t.style[e];return!i&&t.currentStyle&&(i=t.currentStyle[e]),i},function(){var t=r.document.documentElement.style,e="userSelect"in t?"userSelect":"MozUserSelect"in t?"MozUserSelect":"WebkitUserSelect"in t?"WebkitUserSelect":"KhtmlUserSelect"in t?"KhtmlUserSelect":"";r.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=r.util.falseFunction),e?t.style[e]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},r.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),e?t.style[e]="":"string"==typeof t.unselectable&&(t.unselectable=""),t}}(),function(){r.util.getScript=function(t,e){var i=r.document.getElementsByTagName("head")[0],n=r.document.createElement("script"),s=!0;n.onload=n.onreadystatechange=function(t){if(s){if("string"==typeof this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)return;s=!1,e(t||r.window.event),n=n.onload=n.onreadystatechange=null}},n.src=t,i.appendChild(n)}}(),r.util.getById=function(t){return"string"==typeof t?r.document.getElementById(t):t},r.util.toArray=n,r.util.makeElement=s,r.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},r.util.wrapElement=function(t,e,i){return"string"==typeof e&&(e=s(e,i)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},r.util.getScrollLeftTop=o,r.util.getElementOffset=function(t){var e,r,n=t&&t.ownerDocument,s={left:0,top:0},a={left:0,top:0},h={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!n)return a;for(var c in h)a[h[c]]+=parseInt(i(t,c),10)||0;return e=n.documentElement,void 0!==t.getBoundingClientRect&&(s=t.getBoundingClientRect()),r=o(t),{left:s.left+r.left-(e.clientLeft||0)+a.left,top:s.top+r.top-(e.clientTop||0)+a.top}},r.util.getElementStyle=i,r.util.getNodeCanvas=function(t){var e=r.jsdomImplForWrapper(t);return e._canvas||e._image},r.util.cleanUpJsdomNode=function(t){if(r.isLikelyNode){var e=r.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}r.util.request=function(e,i){i||(i={});var n=i.method?i.method.toUpperCase():"GET",s=i.onComplete||function(){},o=new r.window.XMLHttpRequest,a=i.body||i.parameters;return o.onreadystatechange=function(){4===o.readyState&&(s(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}}(),r.log=function(){},r.warn=function(){},"undefined"!=typeof console&&["log","warn"].forEach(function(t){void 0!==console[t]&&"function"==typeof console[t].apply&&(r[t]=function(){return console[t].apply(console,arguments)})}),function(){function t(){return!1}var e=r.window.requestAnimationFrame||r.window.webkitRequestAnimationFrame||r.window.mozRequestAnimationFrame||r.window.oRequestAnimationFrame||r.window.msRequestAnimationFrame||function(t){return r.window.setTimeout(t,1e3/60)},i=r.window.cancelAnimationFrame||r.window.clearTimeout;function n(){return e.apply(r.window,arguments)}r.util.animate=function(e){n(function(i){e||(e={});var r,s=i||+new Date,o=e.duration||500,a=s+o,h=e.onChange||t,c=e.abort||t,l=e.onComplete||t,u=e.easing||function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},f="startValue"in e?e.startValue:0,d="endValue"in e?e.endValue:100,g=e.byValue||d-f;e.onStart&&e.onStart(),function t(i){if(c())l(d,1,1);else{var p=(r=i||+new Date)>a?o:r-s,v=p/o,m=u(p,f,g,o),_=Math.abs((m-f)/g);h(m,_,v),r>a?e.onComplete&&e.onComplete():n(t)}}(s)})},r.util.requestAnimFrame=n,r.util.cancelAnimFrame=function(){return i.apply(r.window,arguments)}}(),function(){r.util.animateColor=function(t,e,i,n){var s=new r.Color(t).getSource(),o=new r.Color(e).getSource();n=n||{},r.util.animate(r.util.object.extend(n,{duration:i||500,startValue:s,endValue:o,byValue:o,easing:function(t,e,i,r){return function(t,e,i){var r="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 r+=","+(t&&e?parseFloat(t[3]+i*(e[3]-t[3])):1),r+=")"}(e,i,n.colorEasing?n.colorEasing(t,r):1-Math.cos(t/r*(Math.PI/2)))}}))}}(),function(){function t(t,e,i,r){return t-1&&l>-1&&l-1&&(i="stroke")}else{if("href"===t||"xlink:href"===t)return i;a=h?i.map(s):s(i,n)}else i="";return!h&&isNaN(a)?i:a}function u(t){return new RegExp("^("+t.join("|")+")\\b","i")}function f(t,e){var i,r,n,s,o=[];for(n=0,s=e.length;n1;)h.shift(),c=e.util.multiplyTransformMatrices(c,h[0]);return c}}();var v=new RegExp("^\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*$");function m(t){var i,r,n,o,a,h,c=t.getAttribute("viewBox"),l=1,u=1,f=t.getAttribute("width"),d=t.getAttribute("height"),g=t.getAttribute("x")||0,p=t.getAttribute("y")||0,m=t.getAttribute("preserveAspectRatio")||"",_=!c||!e.svgViewBoxElementsRegEx.test(t.nodeName)||!(c=c.match(v)),y=!f||!d||"100%"===f||"100%"===d,b=_&&y,x={},C="",w=0,S=0;if(x.width=0,x.height=0,x.toBeParsed=b,b)return x;if(_)return x.width=s(f),x.height=s(d),x;if(i=-parseFloat(c[1]),r=-parseFloat(c[2]),n=parseFloat(c[3]),o=parseFloat(c[4]),y?(x.width=n,x.height=o):(x.width=s(f),x.height=s(d),l=x.width/n,u=x.height/o),"none"!==(m=e.util.parsePreserveAspectRatioAttribute(m)).alignX&&("meet"===m.meetOrSlice&&(u=l=l>u?u:l),"slice"===m.meetOrSlice&&(u=l=l>u?l:u),w=x.width-n*l,S=x.height-o*l,"Mid"===m.alignX&&(w/=2),"Mid"===m.alignY&&(S/=2),"Min"===m.alignX&&(w=0),"Min"===m.alignY&&(S=0)),1===l&&1===u&&0===i&&0===r&&0===g&&0===p)return x;if((g||p)&&(C=" translate("+s(g)+" "+s(p)+") "),a=C+" matrix("+l+" 0 0 "+u+" "+(i*l+w)+" "+(r*u+S)+") ",x.viewboxTransform=e.parseTransformAttribute(a),"svg"===t.nodeName){for(h=t.ownerDocument.createElement("g");t.firstChild;)h.appendChild(t.firstChild);t.appendChild(h)}else a=(h=t).getAttribute("transform")+a;return h.setAttribute("transform",a),x}function _(t,e){var i=p(t,e.getAttribute("xlink:href").substr(1));if(i&&i.getAttribute("xlink:href")&&_(t,i),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach(function(t){e.hasAttribute(t)||e.setAttribute(t,i.getAttribute(t))}),!e.children.length)for(var r=i.cloneNode(!0);r.firstChild;)e.appendChild(r.firstChild);e.removeAttribute("xlink:href")}e.parseSVGDocument=function(t,i,n,s){if(t){!function(t){for(var e=f(t,["use","svg:use"]),i=0;e.length&&i/i,"")));if(!s||!s.documentElement)return i&&i(null),!1;e.parseSVGDocument(s.documentElement,function(t,e,r,n){i&&i(t,e,r,n)},r,n)}})},loadSVGFromString:function(t,i,r,n){var s;if(t=t.trim(),void 0!==e.window.DOMParser){var o=new e.window.DOMParser;o&&o.parseFromString&&(s=o.parseFromString(t,"text/xml"))}else e.window.ActiveXObject&&((s=new ActiveXObject("Microsoft.XMLDOM")).async="false",s.loadXML(t.replace(//i,"")));e.parseSVGDocument(s.documentElement,function(t,e,r,n){i(t,e,r,n)},r,n)}})}(e),r.ElementsParser=function(t,e,i,r,n){this.elements=t,this.callback=e,this.options=i,this.reviver=r,this.svgUid=i&&i.svgUid||0,this.parsingOptions=n,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g},function(t){t.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},t.createObjects=function(){var t=this;this.elements.forEach(function(e,i){e.setAttribute("svgUid",t.svgUid),t.createObject(e,i)})},t.findTag=function(t){return r[r.util.string.capitalize(t.tagName.replace("svg:",""))]},t.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){r.log(t)}else this.checkIfDone()},t.createCallback=function(t,e){var i=this;return function(n){var s;i.resolveGradient(n,"fill"),i.resolveGradient(n,"stroke"),n instanceof r.Image&&n._originalElement&&(s=n.parsePreserveAspectRatioAttribute(e)),n._removeTransformMatrix(s),i.resolveClipPath(n),i.reviver&&i.reviver(e,n),i.instances[t]=n,i.checkIfDone()}},t.extractPropertyDefinition=function(t,e,i){var n=t[e];if(/^url\(/.test(n)){var s=this.regexUrl.exec(n)[1];return this.regexUrl.lastIndex=0,r[i][this.svgUid][s]}},t.resolveGradient=function(t,e){var i=this.extractPropertyDefinition(t,e,"gradientDefs");i&&t.set(e,r.Gradient.fromElement(i,t))},t.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},t.resolveClipPath=function(t){var e,i,n,s,o=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(o){n=[],i=r.util.invertTransform(t.calcTransformMatrix());for(var a=0;at.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,r,n,s){var o,a=(s.x-n.x)*(t.y-n.y)-(s.y-n.y)*(t.x-n.x),h=(r.x-t.x)*(t.y-n.y)-(r.y-t.y)*(t.x-n.x),c=(s.y-n.y)*(r.x-t.x)-(s.x-n.x)*(r.y-t.y);if(0!==c){var l=a/c,u=h/c;0<=l&&l<=1&&0<=u&&u<=1?(o=new i("Intersection")).appendPoint(new e.Point(t.x+l*(r.x-t.x),t.y+l*(r.y-t.y))):o=new i}else o=new i(0===a||0===h?"Coincident":"Parallel");return o},e.Intersection.intersectLinePolygon=function(t,e,r){var n,s,o,a,h=new i,c=r.length;for(a=0;a0&&(h.status="Intersection"),h},e.Intersection.intersectPolygonPolygon=function(t,e){var r,n=new i,s=t.length;for(r=0;r0&&(n.status="Intersection"),n},e.Intersection.intersectPolygonRectangle=function(t,r,n){var s=r.min(n),o=r.max(n),a=new e.Point(o.x,s.y),h=new e.Point(s.x,o.y),c=i.intersectLinePolygon(s,a,t),l=i.intersectLinePolygon(a,o,t),u=i.intersectLinePolygon(o,h,t),f=i.intersectLinePolygon(h,s,t),d=new i;return d.appendPoints(c.points),d.appendPoints(l.points),d.appendPoints(u.points),d.appendPoints(f.points),d.points.length>0&&(d.status="Intersection"),d})}(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 r(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,r){t/=255,i/=255,r/=255;var n,s,o,a=e.util.array.max([t,i,r]),h=e.util.array.min([t,i,r]);if(o=(a+h)/2,a===h)n=s=0;else{var c=a-h;switch(s=o>.5?c/(2-a-h):c/(a+h),a){case t:n=(i-r)/c+(i1?1:a,o){var h=o.split(/\s*;\s*/);for(""===h[h.length-1]&&h.pop(),s=h.length;s--;){var c=h[s].split(/\s*:\s*/),l=c[0].trim(),u=c[1].trim();"stop-color"===l?e=u:"stop-opacity"===l&&(n=u)}}return e||(e=t.getAttribute("stop-color")||"rgb(0,0,0)"),n||(n=t.getAttribute("stop-opacity")),i=(e=new r.Color(e)).getAlpha(),n=isNaN(parseFloat(n))?1:parseFloat(n),n*=i,{offset:a,color:e.toRgb(),opacity:n}}var e=r.util.object.clone;function i(t,e,i){var r,n=0,s=1,o="";for(var a in e)"Infinity"===e[a]?e[a]=1:"-Infinity"===e[a]&&(e[a]=0),r=parseFloat(e[a],10),s="string"==typeof e[a]&&/^(\d+\.\d+)%|(\d+)%$/.test(e[a])?.01:1,"x1"===a||"x2"===a||"r2"===a?(s*="objectBoundingBox"===i?t.width:1,n="objectBoundingBox"===i&&t.left||0):"y1"!==a&&"y2"!==a||(s*="objectBoundingBox"===i?t.height:1,n="objectBoundingBox"===i&&t.top||0),e[a]=r*s+n;if("ellipse"===t.type&&null!==e.r2&&"objectBoundingBox"===i&&t.rx!==t.ry){var h=t.ry/t.rx;o=" scale(1, "+h+")",e.y1&&(e.y1/=h),e.y2&&(e.y2/=h)}return o}r.Gradient=r.util.createClass({offsetX:0,offsetY:0,initialize:function(t){t||(t={});var e={};this.id=r.Object.__uid++,this.type=t.type||"linear",e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},"radial"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.colorStops=t.colorStops.slice(),t.gradientTransform&&(this.gradientTransform=t.gradientTransform),this.offsetX=t.offsetX||this.offsetX,this.offsetY=t.offsetY||this.offsetY},addColorStop:function(t){for(var e in t){var i=new r.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,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return r.util.populateWithProperties(this,e,t),e},toSVG:function(t,i){var n,s,o,a,h=e(this.coords,!0),c=(i=i||{},e(this.colorStops,!0)),l=h.r1>h.r2,u=this.gradientTransform?this.gradientTransform.concat():r.iMatrix.concat(),f=t.width/2-this.offsetX,d=t.height/2-this.offsetY,g=!!i.additionalTransform;if(c.sort(function(t,e){return t.offset-e.offset}),"path"===t.type&&(f-=t.pathOffset.x,d-=t.pathOffset.y),u[4]-=f,u[5]-=d,a='id="SVGID_'+this.id+'" gradientUnits="userSpaceOnUse"',a+=' gradientTransform="'+(g?i.additionalTransform+" ":"")+r.util.matrixToSVG(u)+'" ',"linear"===this.type?o=["\n']:"radial"===this.type&&(o=["\n']),"radial"===this.type){if(l)for((c=c.concat()).reverse(),n=0,s=c.length;n0){var v=p/Math.max(h.r1,h.r2);for(n=0,s=c.length;n\n')}return o.push("linear"===this.type?" \n":"\n"),o.join("")},toLive:function(t){var e,i,n,s=r.util.object.clone(this.coords);if(this.type){for("linear"===this.type?e=t.createLinearGradient(s.x1,s.y1,s.x2,s.y2):"radial"===this.type&&(e=t.createRadialGradient(s.x1,s.y1,s.r1,s.x2,s.y2,s.r2)),i=0,n=this.colorStops.length;i\n \n\n'},setOptions:function(t){for(var e in t)this[e]=t[e]},toLive:function(t){var e="function"==typeof this.source?this.source():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(),r=e.Shadow.reOffsetsAndBlur.exec(i)||[];return{color:(i.replace(e.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)").trim(),offsetX:parseInt(r[1],10)||0,offsetY:parseInt(r[2],10)||0,blur:parseInt(r[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(t){var r=40,n=40,s=e.Object.NUM_FRACTION_DIGITS,o=e.util.rotateVector({x:this.offsetX,y:this.offsetY},e.util.degreesToRadians(-t.angle)),a=new e.Color(this.color);return t.width&&t.height&&(r=100*i((Math.abs(o.x)+this.blur)/t.width,s)+20,n=100*i((Math.abs(o.y)+this.blur)/t.height,s)+20),t.flipX&&(o.x*=-1),t.flipY&&(o.y*=-1),'\n\t \n\t \n\t \n\t \n\t\n\t\t \n\t\t \n\t \n \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+(?:px)?(?:\s?|$))?(-?\d+(?:px)?(?:\s?|$))?(\d+(?:px)?)?(?:\s?|$)(?:$|\s)/)}(e),function(){"use strict";if(r.StaticCanvas)r.warn("fabric.StaticCanvas is already defined.");else{var t=r.util.object.extend,e=r.util.getElementOffset,i=r.util.removeFromArray,n=r.util.toFixed,s=r.util.transformPoint,o=r.util.invertTransform,a=r.util.getNodeCanvas,h=r.util.createCanvasElement,c=new Error("Could not initialize `canvas` element");r.StaticCanvas=r.util.createClass(r.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,clipTo:null,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:r.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,onBeforeScaleRotate:function(){},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._setImageSmoothing(),this.interactive||this._initRetinaScaling(),e.overlayImage&&this.setOverlayImage(e.overlayImage,i),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,i),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,i),e.overlayColor&&this.setOverlayColor(e.overlayColor,i),this.calcOffset()},_isRetinaScaling:function(){return 1!==r.devicePixelRatio&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?r.devicePixelRatio:1},_initRetinaScaling:function(){this._isRetinaScaling()&&(this.lowerCanvasEl.setAttribute("width",this.width*r.devicePixelRatio),this.lowerCanvasEl.setAttribute("height",this.height*r.devicePixelRatio),this.contextContainer.scale(r.devicePixelRatio,r.devicePixelRatio))},calcOffset:function(){return this._offset=e(this.lowerCanvasEl),this},setOverlayImage:function(t,e,i){return this.__setBgOverlayImage("overlayImage",t,e,i)},setBackgroundImage:function(t,e,i){return this.__setBgOverlayImage("backgroundImage",t,e,i)},setOverlayColor:function(t,e){return this.__setBgOverlayColor("overlayColor",t,e)},setBackgroundColor:function(t,e){return this.__setBgOverlayColor("backgroundColor",t,e)},_setImageSmoothing:function(){var t=this.getContext();t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=this.imageSmoothingEnabled},__setBgOverlayImage:function(t,e,i,n){return"string"==typeof e?r.util.loadImage(e,function(e){if(e){var s=new r.Image(e,n);this[t]=s,s.canvas=this}i&&i(e)},this,n&&n.crossOrigin):(n&&e.setOptions(n),this[t]=e,e&&(e.canvas=this),i&&i(e)),this},__setBgOverlayColor:function(t,e,i){return this[t]=e,this._initGradient(e,t),this._initPattern(e,t,i),this},_createCanvasElement:function(){var t=h();if(!t)throw c;if(t.style||(t.style={}),void 0===t.getContext)throw c;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=r.util.getById(t)||this._createCanvasElement(),r.util.addClass(this.lowerCanvasEl,"lower-canvas"),this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var i;for(var r in e=e||{},t)i=t[r],e.cssOnly||(this._setBackstoreDimension(r,t[r]),i+="px",this.hasLostContext=!0),e.backstoreOnly||this._setCssDimension(r,i);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(),this._initRetinaScaling(),this._setImageSmoothing(),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,r,n=this._activeObject;for(this.viewportTransform=t,i=0,r=this._objects.length;i\n'),this._setSVGBgOverlayColor(i,"background"),this._setSVGBgOverlayImage(i,"backgroundImage",e),this._setSVGObjects(i,e),this.clipPath&&i.push("\n"),this._setSVGBgOverlayColor(i,"overlay"),this._setSVGBgOverlayImage(i,"overlayImage",e),i.push(""),i.join("")},_setSVGPreamble:function(t,e){e.suppressPreamble||t.push('\n','\n')},_setSVGHeader:function(t,e){var i,s=e.width||this.width,o=e.height||this.height,a='viewBox="0 0 '+this.width+" "+this.height+'" ',h=r.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],h)+" "+n(-i[5]/i[3],h)+" "+n(this.width/i[0],h)+" "+n(this.height/i[3],h)+'" '),t.push("