| 12 |
- /*! For license information please see mapbox-gl-export.js.LICENSE.txt */
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("mapboxgl"));else if("function"==typeof define&&define.amd)define(["mapboxgl"],e);else{var i="object"==typeof exports?e(require("mapboxgl")):e(t.mapboxgl);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(self,(t=>(()=>{var e,i,n,r,o={2702:function(t,e,i){t.exports=function(){"use strict";function t(t){return"function"==typeof t}var e=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,r=void 0,o=void 0,s=function(t,e){d[n]=t,d[n+1]=e,2===(n+=2)&&(o?o(p):b())};var a="undefined"!=typeof window?window:void 0,h=a||{},c=h.MutationObserver||h.WebKitMutationObserver,l="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),u="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function f(){var t=setTimeout;return function(){return t(p,1)}}var d=new Array(1e3);function p(){for(var t=0;t<n;t+=2)(0,d[t])(d[t+1]),d[t]=void 0,d[t+1]=void 0;n=0}var g,m,v,y,b=void 0;function w(t,e){var i=this,n=new this.constructor(S);void 0===n[_]&&M(n);var r=i._state;if(r){var o=arguments[r-1];s((function(){return E(r,n,o,i._result)}))}else j(i,n,t,e);return n}function x(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(S);return T(e,t),e}b=l?function(){return process.nextTick(p)}:c?(m=0,v=new c(p),y=document.createTextNode(""),v.observe(y,{characterData:!0}),function(){y.data=m=++m%2}):u?((g=new MessageChannel).port1.onmessage=p,function(){return g.port2.postMessage(0)}):void 0===a?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(p)}:f()}catch(t){return f()}}():f();var _=Math.random().toString(36).substring(2);function S(){}var C=void 0,A=1,L=2;function P(e,i,n){i.constructor===e.constructor&&n===w&&i.constructor.resolve===x?function(t,e){e._state===A?k(t,e._result):e._state===L?N(t,e._result):j(e,void 0,(function(e){return T(t,e)}),(function(e){return N(t,e)}))}(e,i):void 0===n?k(e,i):t(n)?function(t,e,i){s((function(t){var n=!1,r=function(t,e,i,n){try{t.call(e,i,n)}catch(t){return t}}(i,e,(function(i){n||(n=!0,e!==i?T(t,i):k(t,i))}),(function(e){n||(n=!0,N(t,e))}),t._label);!n&&r&&(n=!0,N(t,r))}),t)}(e,i,n):k(e,i)}function T(t,e){if(t===e)N(t,new TypeError("You cannot resolve a promise with itself"));else if(r=typeof(n=e),null===n||"object"!==r&&"function"!==r)k(t,e);else{var i=void 0;try{i=e.then}catch(e){return void N(t,e)}P(t,e,i)}var n,r}function O(t){t._onerror&&t._onerror(t._result),F(t)}function k(t,e){t._state===C&&(t._result=e,t._state=A,0!==t._subscribers.length&&s(F,t))}function N(t,e){t._state===C&&(t._state=L,t._result=e,s(O,t))}function j(t,e,i,n){var r=t._subscribers,o=r.length;t._onerror=null,r[o]=e,r[o+A]=i,r[o+L]=n,0===o&&t._state&&s(F,t)}function F(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var n=void 0,r=void 0,o=t._result,s=0;s<e.length;s+=3)n=e[s],r=e[s+i],n?E(i,n,r,o):r(o);t._subscribers.length=0}}function E(e,i,n,r){var o=t(n),s=void 0,a=void 0,h=!0;if(o){try{s=n(r)}catch(t){h=!1,a=t}if(i===s)return void N(i,new TypeError("A promises callback cannot return that same promise."))}else s=r;i._state!==C||(o&&h?T(i,s):!1===h?N(i,a):e===A?k(i,s):e===L&&N(i,s))}var I=0;function M(t){t[_]=I++,t._state=void 0,t._result=void 0,t._subscribers=[]}var D=function(){function t(t,i){this._instanceConstructor=t,this.promise=new t(S),this.promise[_]||M(this.promise),e(i)?(this.length=i.length,this._remaining=i.length,this._result=new Array(this.length),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(i),0===this._remaining&&k(this.promise,this._result))):N(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===C&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var i=this._instanceConstructor,n=i.resolve;if(n===x){var r=void 0,o=void 0,s=!1;try{r=t.then}catch(t){s=!0,o=t}if(r===w&&t._state!==C)this._settledAt(t._state,e,t._result);else if("function"!=typeof r)this._remaining--,this._result[e]=t;else if(i===B){var a=new i(S);s?N(a,o):P(a,t,r),this._willSettleAt(a,e)}else this._willSettleAt(new i((function(e){return e(t)})),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,i){var n=this.promise;n._state===C&&(this._remaining--,t===L?N(n,i):this._result[e]=i),0===this._remaining&&k(n,this._result)},t.prototype._willSettleAt=function(t,e){var i=this;j(t,void 0,(function(t){return i._settledAt(A,e,t)}),(function(t){return i._settledAt(L,e,t)}))},t}();var B=function(){function e(t){this[_]=I++,this._result=this._state=void 0,this._subscribers=[],S!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e((function(e){T(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var i=this,n=i.constructor;return t(e)?i.then((function(t){return n.resolve(e()).then((function(){return t}))}),(function(t){return n.resolve(e()).then((function(){throw t}))})):i.then(e,e)},e}();return B.prototype.then=w,B.all=function(t){return new D(this,t).promise},B.race=function(t){var i=this;return e(t)?new i((function(e,n){for(var r=t.length,o=0;o<r;o++)i.resolve(t[o]).then(e,n)})):new i((function(t,e){return e(new TypeError("You must pass an array to race."))}))},B.resolve=x,B.reject=function(t){var e=new this(S);return N(e,t),e},B._setScheduler=function(t){o=t},B._setAsap=function(t){s=t},B._asap=s,B.polyfill=function(){var t=void 0;if(void 0!==i.g)t=i.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=B},B.Promise=B,B}()},2777:(t,e,i)=>{var n,r,o,s,a,h,c,l,u,f,d,p,g,m,v,y,b,w,x,_,S,C,A=A||{version:"5.3.0"};if(e.fabric=A,"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?A.document=document:A.document=document.implementation.createHTMLDocument(""),A.window=window;else{var L=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;A.document=L.document,A.jsdomImplForWrapper=i(6759).implForWrapper,A.nodeCanvas=i(6272).Canvas,A.window=L,DOMParser=A.window.DOMParser}function P(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,s=new Uint8Array(this.imageBuffer,0,o),a=new Uint8ClampedArray(this.imageBuffer,0,o);t.readPixels(0,0,n,r,t.RGBA,t.UNSIGNED_BYTE,s);var h=new ImageData(a,n,r);i.putImageData(h,0,0)}A.isTouchSupported="ontouchstart"in A.window||"ontouchstart"in A.document||A.window&&A.window.navigator&&A.window.navigator.maxTouchPoints>0,A.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,A.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"],A.DPI=96,A.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",A.commaWsp="(?:\\s+,?\\s*|,\\s*)",A.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,A.reNonWord=/[ \n\.,;!\?\-]/,A.fontPaths={},A.iMatrix=[1,0,0,1,0,0],A.svgNS="http://www.w3.org/2000/svg",A.perfLimitSizeTotal=2097152,A.maxCacheSideLimit=4096,A.minCacheSideLimit=256,A.charWidthsCache={},A.textureSize=2048,A.disableStyleCopyPaste=!1,A.enableGLFiltering=!0,A.devicePixelRatio=A.window.devicePixelRatio||A.window.webkitDevicePixelRatio||A.window.mozDevicePixelRatio||1,A.browserShadowBlurConstant=1,A.arcToSegmentsCache={},A.boundsOfCurveCache={},A.cachesBoundsOfCurve=!0,A.forceGLPutImageData=!1,A.initFilterBackend=function(){return A.enableGLFiltering&&A.isWebglSupported&&A.isWebglSupported(A.textureSize)?(console.log("max texture size: "+A.maxTextureSize),new A.WebglFilterBackend({tileSize:A.textureSize})):A.Canvas2dFilterBackend?new A.Canvas2dFilterBackend:void 0},"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=A),function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:A.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)}A.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}}}(),A.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)}},A.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof A.Gradient||this.set(e,new A.Gradient(t))},_initPattern:function(t,e,i){!t||!t.source||t instanceof A.Pattern?i&&i():this.set(e,new A.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,s=Math.pow,a=Math.PI/180,h=Math.PI/2,A.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/h){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/h){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*a},radiansToDegrees:function(t){return t/a},rotatePoint:function(t,e,i){var n=new A.Point(t.x-e.x,t.y-e.y),r=A.util.rotateVector(n,i);return new A.Point(r.x,r.y).addEquals(e)},rotateVector:function(t,e){var i=A.util.sin(e),n=A.util.cos(e);return{x:t.x*n-t.y*i,y:t.x*i+t.y*n}},createVector:function(t,e){return new A.Point(e.x-t.x,e.y-t.y)},calcAngleBetweenVectors:function(t,e){return Math.acos((t.x*e.x+t.y*e.y)/(Math.hypot(t.x,t.y)*Math.hypot(e.x,e.y)))},getHatVector:function(t){return new A.Point(t.x,t.y).multiply(1/Math.hypot(t.x,t.y))},getBisector:function(t,e,i){var n=A.util.createVector(t,e),r=A.util.createVector(t,i),o=A.util.calcAngleBetweenVectors(n,r),s=o*(0===A.util.calcAngleBetweenVectors(A.util.rotateVector(n,o),r)?1:-1)/2;return{vector:A.util.getHatVector(A.util.rotateVector(n,s)),angle:o}},projectStrokeOnPoints:function(t,e,i){var n=[],r=e.strokeWidth/2,o=e.strokeUniform?new A.Point(1/e.scaleX,1/e.scaleY):new A.Point(1,1),s=function(t){var e=r/Math.hypot(t.x,t.y);return new A.Point(t.x*e*o.x,t.y*e*o.y)};return t.length<=1||t.forEach((function(a,h){var c,l,u=new A.Point(a.x,a.y);0===h?(l=t[h+1],c=i?s(A.util.createVector(l,u)).addEquals(u):t[t.length-1]):h===t.length-1?(c=t[h-1],l=i?s(A.util.createVector(c,u)).addEquals(u):t[0]):(c=t[h-1],l=t[h+1]);var f,d,p=A.util.getBisector(u,c,l),g=p.vector,m=p.angle;if("miter"===e.strokeLineJoin&&(f=-r/Math.sin(m/2),d=new A.Point(g.x*f*o.x,g.y*f*o.y),Math.hypot(d.x,d.y)/r<=e.strokeMiterLimit))return n.push(u.add(d)),void n.push(u.subtract(d));f=-r*Math.SQRT2,d=new A.Point(g.x*f*o.x,g.y*f*o.y),n.push(u.add(d)),n.push(u.subtract(d))})),n},transformPoint:function(t,e,i){return i?new A.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new A.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]=A.util.transformPoint(t[i],e);var n=[t[0].x,t[1].x,t[2].x,t[3].x],r=A.util.array.min(n),o=A.util.array.max(n)-r,s=[t[0].y,t[1].y,t[2].y,t[3].y],a=A.util.array.min(s);return{left:r,top:a,width:o,height:A.util.array.max(s)-a}},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=A.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=A.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case"mm":return n*A.DPI/25.4;case"cm":return n*A.DPI/2.54;case"in":return n*A.DPI;case"pt":return n*A.DPI/72;case"pc":return n*A.DPI/72*12;case"em":return n*e;default:return n}},falseFunction:function(){return!1},getKlass:function(t,e){return t=A.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),A.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(t){if(!t)return A;var e,i=t.split("."),r=i.length,o=n||A.window;for(e=0;e<r;++e)o=o[i[e]];return o},loadImage:function(t,e,i,n){if(t){var r=A.util.createImage(),o=function(){e&&e.call(i,r,!1),r=r.onload=r.onerror=null};r.onload=o,r.onerror=function(){A.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,A.util.loadImageInDom(r,o)),r.src=t}else e&&e.call(i,t)},loadImageInDom:function(t,e){var i=A.document.createElement("div");i.style.width=i.style.height="1px",i.style.left=i.style.top="-100%",i.style.position="absolute",i.appendChild(t),A.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,s=(t=t||[]).length;function a(){++o===s&&e&&e(r.filter((function(t){return t})))}s?t.forEach((function(t,e){t&&t.type?A.util.getKlass(t.type,i).fromObject(t,(function(i,o){o||(r[e]=i),n&&n(t,i,o),a()})):a()})):e&&e(r)},enlivenObjectEnlivables:function(t,e,i){var n=A.Object.ENLIVEN_PROPS.filter((function(e){return!!t[e]}));A.util.enlivenObjects(n.map((function(e){return t[e]})),(function(t){var r={};n.forEach((function(i,n){r[i]=t[n],e&&(e[i]=t[n])})),i&&i(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 A.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?(void 0!==i&&(t[0].sourcePath=i),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 A.Group(t,e),void 0!==i&&(n.sourcePath=i),n)},populateWithProperties:function(t,e,i){if(i&&Array.isArray(i))for(var n=0,r=i.length;n<r;n++)i[n]in t&&(e[i[n]]=t[i[n]])},createCanvasElement:function(){return A.document.createElement("canvas")},copyCanvasElement:function(t){var e=A.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 A.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=s(t[0],2)+s(t[1],2),n=r(i),h=(t[0]*t[3]-t[2]*t[1])/n,c=o(t[0]*t[2]+t[1]*t[3],i);return{angle:e/a,scaleX:n,scaleY:h,skewX:c/a,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return A.iMatrix.concat();var e=A.util.degreesToRadians(t.angle),i=A.util.cos(e),n=A.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=A.util.multiplyTransformMatrices,o=A.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=A.util.multiplyTransformMatrices;return t.angle&&(e=i(e,A.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=i(e,A.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,s=t.getImageData(e,i,2*n||1,2*n||1),a=s.data.length;for(r=3;r<a&&0!=(o=s.data[r]<=0);r+=4);return s=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())?A.charWidthsCache[t]&&delete A.charWidthsCache[t]:A.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 A.util.toFixed(t,A.Object.NUM_FRACTION_DIGITS)})).join(" ")+")"},removeTransformFromObject:function(t,e){var i=A.util.invertTransform(e),n=A.util.multiplyTransformMatrices(i,t.calcOwnMatrix());A.util.applyTransformToObject(t,n)},addTransformToObject:function(t,e){A.util.applyTransformToObject(t,A.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var i=A.util.qrDecompose(e),n=new A.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}],s=A.util.calcDimensionsMatrix(i),a=A.util.makeBoundingBoxFromPoints(o,s);return{x:a.width,y:a.height}},mergeClipPaths:function(t,e){var i=t,n=e;i.inverted&&!n.inverted&&(i=e,n=t),A.util.applyTransformToObject(n,A.util.multiplyTransformMatrices(A.util.invertTransform(i.calcTransformMatrix()),n.calcTransformMatrix()));var r=i.inverted&&n.inverted;return r&&(i.inverted=n.inverted=!1),new A.Group([i],{clipPath:n,inverted:r})},hasStyleChanged:function(t,e,i){return i=i||!1,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.textBackgroundColor!==e.textBackgroundColor||t.deltaY!==e.deltaY||i&&(t.overline!==e.overline||t.underline!==e.underline||t.linethrough!==e.linethrough)},stylesToArray:function(t,e){t=A.util.object.clone(t,!0);for(var i=e.split("\n"),n=-1,r={},o=[],s=0;s<i.length;s++)if(t[s])for(var a=0;a<i[s].length;a++){n++;var h=t[s][a];h&&Object.keys(h).length>0&&(A.util.hasStyleChanged(r,h,!0)?o.push({start:n,end:n+1,style:h}):o[o.length-1].end++),r=h||{}}else n+=i[s].length;return o},stylesFromArray:function(t,e){if(!Array.isArray(t))return t;for(var i=e.split("\n"),n=-1,r=0,o={},s=0;s<i.length;s++)for(var a=0;a<i[s].length;a++)n++,t[r]&&t[r].start<=n&&n<t[r].end&&(o[s]=o[s]||{},o[s][a]=Object.assign({},t[r].style),n===t[r].end-1&&r++);return o}},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,s,a,h,c,l){var u=A.util.cos(t),f=A.util.sin(t),d=A.util.cos(e),p=A.util.sin(e),g=i*r*d-n*o*p+s,m=n*r*d+i*o*p+a;return["C",c+h*(-i*r*f-n*o*u),l+h*(-n*r*f+i*o*u),g+h*(i*r*p+n*o*d),m+h*(n*r*p-i*o*d),g,m]}function r(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 o(t,e,i){for(var o=i[1],s=i[2],a=i[3],h=i[4],c=i[5],l=function(t,e,i,o,s,a,h){var c=Math.PI,l=h*c/180,u=A.util.sin(l),f=A.util.cos(l),d=0,p=0,g=-f*t*.5-u*e*.5,m=-f*e*.5+u*t*.5,v=(i=Math.abs(i))*i,y=(o=Math.abs(o))*o,b=m*m,w=g*g,x=v*y-v*b-y*w,_=0;if(x<0){var S=Math.sqrt(1-x/(v*y));i*=S,o*=S}else _=(s===a?-1:1)*Math.sqrt(x/(v*b+y*w));var C=_*i*m/o,L=-_*o*g/i,P=f*C-u*L+.5*t,T=u*C+f*L+.5*e,O=r(1,0,(g-C)/i,(m-L)/o),k=r((g-C)/i,(m-L)/o,(-g-C)/i,(-m-L)/o);0===a&&k>0?k-=2*c:1===a&&k<0&&(k+=2*c);for(var N=Math.ceil(Math.abs(k/c*2)),j=[],F=k/N,E=8/3*Math.sin(F/4)*Math.sin(F/4)/Math.sin(F/2),I=O+F,M=0;M<N;M++)j[M]=n(O,I,f,u,i,o,P,T,E,d,p),d=j[M][5],p=j[M][6],O=I,I+=F;return j}(i[6]-t,i[7]-e,o,s,h,c,a),u=0,f=l.length;u<f;u++)l[u][1]+=t,l[u][2]+=e,l[u][3]+=t,l[u][4]+=e,l[u][5]+=t,l[u][6]+=e;return l}function s(t,e,i,n){return Math.sqrt((i-t)*(i-t)+(n-e)*(n-e))}function a(t,e,i,n,r,o,s,a){return function(h){var c,l=(c=h)*c*c,u=function(t){return 3*t*t*(1-t)}(h),f=function(t){return 3*t*(1-t)*(1-t)}(h),d=function(t){return(1-t)*(1-t)*(1-t)}(h);return{x:s*l+r*u+i*f+t*d,y:a*l+o*u+n*f+e*d}}}function h(t,e,i,n,r,o,s,a){return function(h){var c=1-h,l=3*c*c*(i-t)+6*c*h*(r-i)+3*h*h*(s-r),u=3*c*c*(n-e)+6*c*h*(o-n)+3*h*h*(a-o);return Math.atan2(u,l)}}function c(t,e,i,n,r,o){return function(s){var a,h=(a=s)*a,c=function(t){return 2*t*(1-t)}(s),l=function(t){return(1-t)*(1-t)}(s);return{x:r*h+i*c+t*l,y:o*h+n*c+e*l}}}function l(t,e,i,n,r,o){return function(s){var a=1-s,h=2*a*(i-t)+2*s*(r-i),c=2*a*(n-e)+2*s*(o-n);return Math.atan2(c,h)}}function u(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+=s(o.x,o.y,n.x,n.y),o=n;return a}function f(t){for(var e,i,n,r,o=0,f=t.length,d=0,p=0,g=0,m=0,v=[],y=0;y<f;y++){switch(n={x:d,y:p,command:(e=t[y])[0]},e[0]){case"M":n.length=0,g=d=e[1],m=p=e[2];break;case"L":n.length=s(d,p,e[1],e[2]),d=e[1],p=e[2];break;case"C":i=a(d,p,e[1],e[2],e[3],e[4],e[5],e[6]),r=h(d,p,e[1],e[2],e[3],e[4],e[5],e[6]),n.iterator=i,n.angleFinder=r,n.length=u(i,d,p),d=e[5],p=e[6];break;case"Q":i=c(d,p,e[1],e[2],e[3],e[4]),r=l(d,p,e[1],e[2],e[3],e[4]),n.iterator=i,n.angleFinder=r,n.length=u(i,d,p),d=e[3],p=e[4];break;case"Z":case"z":n.destX=g,n.destY=m,n.length=s(d,p,g,m),d=g,p=m}o+=n.length,v.push(n)}return v.push({length:o,x:d,y:p}),v}A.util.joinPath=function(t){return t.map((function(t){return t.join(" ")})).join(" ")},A.util.parsePath=function(t){var n,r,o,s,a,h=[],c=[],l=A.rePathCommand,u="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",f="("+u+")"+A.commaWsp,d="([01])"+A.commaWsp+"?",p=new RegExp(f+"?"+f+"?"+f+d+d+f+"?("+u+")","g");if(!t||!t.match)return h;for(var g,m=0,v=(a=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;m<v;m++){s=(n=a[m]).slice(1).trim(),c.length=0;var y=n.charAt(0);if(g=[y],"a"===y.toLowerCase())for(var b;b=p.exec(s);)for(var w=1;w<b.length;w++)c.push(b[w]);else for(;o=l.exec(s);)c.push(o[0]);w=0;for(var x=c.length;w<x;w++)r=parseFloat(c[w]),isNaN(r)||g.push(r);var _=e[y.toLowerCase()],S=i[y]||y;if(g.length-1>_)for(var C=1,L=g.length;C<L;C+=_)h.push([y].concat(g.slice(C,C+_))),y=S;else h.push(g)}return h},A.util.makePathSimpler=function(t){var e,i,n,r,s,a,h=0,c=0,l=t.length,u=0,f=0,d=[];for(i=0;i<l;++i){switch(n=!1,(e=t[i].slice(0))[0]){case"l":e[0]="L",e[1]+=h,e[2]+=c;case"L":h=e[1],c=e[2];break;case"h":e[1]+=h;case"H":e[0]="L",e[2]=c,h=e[1];break;case"v":e[1]+=c;case"V":e[0]="L",c=e[1],e[1]=h,e[2]=c;break;case"m":e[0]="M",e[1]+=h,e[2]+=c;case"M":h=e[1],c=e[2],u=e[1],f=e[2];break;case"c":e[0]="C",e[1]+=h,e[2]+=c,e[3]+=h,e[4]+=c,e[5]+=h,e[6]+=c;case"C":s=e[3],a=e[4],h=e[5],c=e[6];break;case"s":e[0]="S",e[1]+=h,e[2]+=c,e[3]+=h,e[4]+=c;case"S":"C"===r?(s=2*h-s,a=2*c-a):(s=h,a=c),h=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]=s,e[2]=a,s=e[3],a=e[4];break;case"q":e[0]="Q",e[1]+=h,e[2]+=c,e[3]+=h,e[4]+=c;case"Q":s=e[1],a=e[2],h=e[3],c=e[4];break;case"t":e[0]="T",e[1]+=h,e[2]+=c;case"T":"Q"===r?(s=2*h-s,a=2*c-a):(s=h,a=c),e[0]="Q",h=e[1],c=e[2],e[1]=s,e[2]=a,e[3]=h,e[4]=c;break;case"a":e[0]="A",e[6]+=h,e[7]+=c;case"A":n=!0,d=d.concat(o(h,c,e)),h=e[6],c=e[7];break;case"z":case"Z":h=u,c=f}n||d.push(e),r=e[0]}return d},A.util.getSmoothPathFromPoints=function(t,e){var i,n=[],r=new A.Point(t[0].x,t[0].y),o=new A.Point(t[1].x,t[1].y),s=t.length,a=1,h=0,c=s>2;for(e=e||0,c&&(a=t[2].x<o.x?-1:t[2].x===o.x?0:1,h=t[2].y<o.y?-1:t[2].y===o.y?0:1),n.push(["M",r.x-a*e,r.y-h*e]),i=1;i<s;i++){if(!r.eq(o)){var l=r.midPointFrom(o);n.push(["Q",r.x,r.y,l.x,l.y])}r=t[i],i+1<t.length&&(o=t[i+1])}return c&&(a=r.x>t[i-2].x?1:r.x===t[i-2].x?0:-1,h=r.y>t[i-2].y?1:r.y===t[i-2].y?0:-1),n.push(["L",r.x+a*e,r.y+h*e]),n},A.util.getPathSegmentsInfo=f,A.util.getBoundsOfCurve=function(e,i,n,r,o,s,a,h){var c;if(A.cachesBoundsOfCurve&&(c=t.call(arguments),A.boundsOfCurveCache[c]))return A.boundsOfCurveCache[c];var l,u,f,d,p,g,m,v,y=Math.sqrt,b=Math.min,w=Math.max,x=Math.abs,_=[],S=[[],[]];u=6*e-12*n+6*o,l=-3*e+9*n-9*o+3*a,f=3*n-3*e;for(var C=0;C<2;++C)if(C>0&&(u=6*i-12*r+6*s,l=-3*i+9*r-9*s+3*h,f=3*r-3*i),x(l)<1e-12){if(x(u)<1e-12)continue;0<(d=-f/u)&&d<1&&_.push(d)}else(m=u*u-4*f*l)<0||(0<(p=(-u+(v=y(m)))/(2*l))&&p<1&&_.push(p),0<(g=(-u-v)/(2*l))&&g<1&&_.push(g));for(var L,P,T,O=_.length,k=O;O--;)L=(T=1-(d=_[O]))*T*T*e+3*T*T*d*n+3*T*d*d*o+d*d*d*a,S[0][O]=L,P=T*T*T*i+3*T*T*d*r+3*T*d*d*s+d*d*d*h,S[1][O]=P;S[0][k]=e,S[1][k]=i,S[0][k+1]=a,S[1][k+1]=h;var N=[{x:b.apply(null,S[0]),y:b.apply(null,S[1])},{x:w.apply(null,S[0]),y:w.apply(null,S[1])}];return A.cachesBoundsOfCurve&&(A.boundsOfCurveCache[c]=N),N},A.util.getPointOnPath=function(t,e,i){i||(i=f(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,h=o.command,c=t[n];switch(h){case"M":return{x:o.x,y:o.y,angle:0};case"Z":case"z":return(r=new A.Point(o.x,o.y).lerp(new A.Point(o.destX,o.destY),a)).angle=Math.atan2(o.destY-o.y,o.destX-o.x),r;case"L":return(r=new A.Point(o.x,o.y).lerp(new A.Point(c[1],c[2]),a)).angle=Math.atan2(c[2]-o.y,c[1]-o.x),r;case"C":case"Q":return function(t,e){for(var i,n,r,o=0,a=0,h=t.iterator,c={x:t.x,y:t.y},l=.01,u=t.angleFinder;a<e&&l>1e-4;)i=h(o),r=o,(n=s(c.x,c.y,i.x,i.y))+a>e?(o-=l,l/=2):(c=i,o+=l,a+=n);return i.angle=u(r),i}(o,e)}},A.util.transformPath=function(t,e,i){return i&&(e=A.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=A.util.transformPoint(n,e),i[r]=n.x,i[r+1]=n.y;return i}))}}(),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}}A.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,s=e.length;o<s;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(!A.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 s in i)"canvas"===s||"group"===s?e[s]=null:i.hasOwnProperty(s)&&(e[s]=t({},i[s],n));else e=i;else for(var s in i)e[s]=i[s];return e}A.util.object={extend:t,clone:function(e,i){return t({},e,i)}},A.util.object.extend(A.util,A.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}A.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,"<").replace(/>/g,">")},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}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)}A.util.createClass=function(){var i=null,s=t.call(arguments,0);function a(){this.initialize.apply(this,arguments)}"function"==typeof s[0]&&(i=s.shift()),a.superclass=i,a.subclasses=[],i&&(r.prototype=i.prototype,a.prototype=new r,i.subclasses.push(a));for(var h=0,c=s.length;h<c;h++)n(a,s[h],i);return a.prototype.initialize||(a.prototype.initialize=e),a.prototype.constructor=a,a.prototype.callSuper=o,a}}(),c=!!A.document.createElement("div").attachEvent,l=["touchstart","touchmove","touchend"],A.util.addListener=function(t,e,i,n){t&&t.addEventListener(e,i,!c&&n)},A.util.removeListener=function(t,e,i,n){t&&t.removeEventListener(e,i,!c&&n)},A.util.getPointer=function(t){var e=t.target,i=A.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}},A.util.isTouchEvent=function(t){return l.indexOf(t.type)>-1||"touch"===t.pointerType},f="string"==typeof(u=A.document.createElement("div")).style.opacity,d="string"==typeof u.style.filter,p=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,g=function(t){return t},f?g=function(t,e){return t.style.opacity=e,t}:d&&(g=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),p.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(p,e)):i.filter+=" alpha(opacity="+100*e+")",t}),A.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?g(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var n in e)if("opacity"===n)g(t,e[n]);else{var r="float"===n||"cssFloat"===n?void 0===i.styleFloat?"cssFloat":"styleFloat":n;i.setProperty(r,e[n])}return t},function(){var t,e,i,n,r=Array.prototype.slice,o=function(t){return r.call(t,0)};try{t=o(A.document.childNodes)instanceof Array}catch(t){}function s(t,e){var i=A.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 a(t){for(var e=0,i=0,n=A.document.documentElement,r=A.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===A.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}}t||(o=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e}),e=A.document.defaultView&&A.document.defaultView.getComputedStyle?function(t,e){var i=A.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},i=A.document.documentElement.style,n="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"",A.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=A.util.falseFunction),n?t.style[n]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},A.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),n?t.style[n]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},A.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},A.util.getById=function(t){return"string"==typeof t?A.document.getElementById(t):t},A.util.toArray=o,A.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},A.util.makeElement=s,A.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},A.util.getScrollLeftTop=a,A.util.getElementOffset=function(t){var i,n,r=t&&t.ownerDocument,o={left:0,top:0},s={left:0,top:0},h={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!r)return s;for(var c in h)s[h[c]]+=parseInt(e(t,c),10)||0;return i=r.documentElement,void 0!==t.getBoundingClientRect&&(o=t.getBoundingClientRect()),n=a(t),{left:o.left+n.left-(i.clientLeft||0)+s.left,top:o.top+n.top-(i.clientTop||0)+s.top}},A.util.getNodeCanvas=function(t){var e=A.jsdomImplForWrapper(t);return e._canvas||e._image},A.util.cleanUpJsdomNode=function(t){if(A.isLikelyNode){var e=A.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}A.util.request=function(e,i){i||(i={});var n=i.method?i.method.toUpperCase():"GET",r=i.onComplete||function(){},o=new A.window.XMLHttpRequest,s=i.body||i.parameters;return o.onreadystatechange=function(){4===o.readyState&&(r(o),o.onreadystatechange=t)},"GET"===n&&(s=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(s),o}}(),A.log=console.log,A.warn=console.warn,function(){var t=A.util.object.extend,e=A.util.object.clone,i=[];function n(){return!1}function r(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e}A.util.object.extend(i,{cancelAll:function(){var t=this.splice(0);return t.forEach((function(t){t.cancel()})),t},cancelByCanvas:function(t){if(!t)return[];var e=this.filter((function(e){return"object"==typeof e.target&&e.target.canvas===t}));return e.forEach((function(t){t.cancel()})),e},cancelByTarget:function(t){var e=this.findAnimationsByTarget(t);return e.forEach((function(t){t.cancel()})),e},findAnimationIndex:function(t){return this.indexOf(this.findAnimation(t))},findAnimation:function(t){return this.find((function(e){return e.cancel===t}))},findAnimationsByTarget:function(t){return t?this.filter((function(e){return e.target===t})):[]}});var o=A.window.requestAnimationFrame||A.window.webkitRequestAnimationFrame||A.window.mozRequestAnimationFrame||A.window.oRequestAnimationFrame||A.window.msRequestAnimationFrame||function(t){return A.window.setTimeout(t,1e3/60)},s=A.window.cancelAnimationFrame||A.window.clearTimeout;function a(){return o.apply(A.window,arguments)}A.util.animate=function(i){i||(i={});var o,s=!1,h=function(){var t=A.runningAnimations.indexOf(o);return t>-1&&A.runningAnimations.splice(t,1)[0]};return o=t(e(i),{cancel:function(){return s=!0,h()},currentValue:"startValue"in i?i.startValue:0,completionRate:0,durationRate:0}),A.runningAnimations.push(o),a((function(t){var e,c=t||+new Date,l=i.duration||500,u=c+l,f=i.onChange||n,d=i.abort||n,p=i.onComplete||n,g=i.easing||r,m="startValue"in i&&i.startValue.length>0,v="startValue"in i?i.startValue:0,y="endValue"in i?i.endValue:100,b=i.byValue||(m?v.map((function(t,e){return y[e]-v[e]})):y-v);i.onStart&&i.onStart(),function t(i){var n=(e=i||+new Date)>u?l:e-c,r=n/l,w=m?v.map((function(t,e){return g(n,v[e],b[e],l)})):g(n,v,b,l),x=m?Math.abs((w[0]-v[0])/b[0]):Math.abs((w-v)/b);if(o.currentValue=m?w.slice():w,o.completionRate=x,o.durationRate=r,!s){if(!d(w,x,r))return e>u?(o.currentValue=m?y.slice():y,o.completionRate=1,o.durationRate=1,f(m?y.slice():y,1,1),p(y,1,1),void h()):(f(w,x,r),void a(t));h()}}(c)})),o.cancel},A.util.requestAnimFrame=a,A.util.cancelAnimFrame=function(){return s.apply(A.window,arguments)},A.runningAnimations=i}(),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))+")"}A.util.animateColor=function(e,i,n,r){var o=new A.Color(e).getSource(),s=new A.Color(i).getSource(),a=r.onComplete,h=r.onChange;return r=r||{},A.util.animate(A.util.object.extend(r,{duration:n||500,startValue:o,endValue:s,byValue:s,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(a)return a(t(s,s,0),i,n)},onChange:function(e,i,n){if(h){if(Array.isArray(e))return h(t(e,e,0),i,n);h(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}A.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 s=0;return 0===i?n:1==(i/=o)?n+r:(s||(s=.3*o),-e(t(r,r,s,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 s=t(n,n,o,1.70158);return s.a*Math.pow(2,-10*e)*Math.sin((e*r-s.s)*(2*Math.PI)/s.p)+s.c+i},easeInOutElastic:function(i,n,r,o){var s=0;if(0===i)return n;if(2==(i/=o/2))return n+r;s||(s=o*(.3*1.5));var a=t(r,r,s,1.70158);return i<1?-.5*e(a,i,o)+n:a.a*Math.pow(2,-10*(i-=1))*Math.sin((i*o-a.s)*(2*Math.PI)/a.p)*.5+a.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,s=e.util.multiplyTransformMatrices,a={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"},h={stroke:"strokeOpacity",fill:"fillOpacity"},c="font-size",l="clip-path";function u(t){return t in a?a[t]:t}function f(t,i,n,r){var a,h=Array.isArray(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?s(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)a=o(i,r)/r*1e3;else if("paintFirst"===t){var c=i.indexOf("fill"),l=i.indexOf("stroke");i="fill",(c>-1&&l>-1&&l<c||-1===c&&l>-1)&&(i="stroke")}else{if("href"===t||"xlink:href"===t||"font"===t)return i;if("imageSmoothing"===t)return"optimizeQuality"===i;a=h?i.map(o):o(i,r)}}else i="";return!h&&isNaN(a)?i:a}function d(t){return new RegExp("^("+t.join("|")+")\\b","i")}function p(t,e){var i,n,r,o,s=[];for(r=0,o=e.length;r<o;r++)i=e[r],n=t.getElementsByTagName(i),s=s.concat(Array.prototype.slice.call(n));return s}function g(t,e){var i,n=!0;return(i=m(t,e.pop()))&&e.length&&(n=function(t,e){for(var i,n=!0;t.parentNode&&1===t.parentNode.nodeType&&e.length;)n&&(i=e.pop()),n=m(t=t.parentNode,i);return 0===e.length}(t,e)),i&&n&&0===e.length}function m(t,e){var i,n,r=t.nodeName,o=t.getAttribute("class"),s=t.getAttribute("id");if(i=new RegExp("^"+r,"i"),e=e.replace(i,""),s&&e.length&&(i=new RegExp("#"+s+"(?![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 v(t,e){var i;if(t.getElementById&&(i=t.getElementById(e)),i)return i;var n,r,o,s=t.getElementsByTagName("*");for(r=0,o=s.length;r<o;r++)if(e===(n=s[r]).getAttribute("id"))return n}e.svgValidTagNamesRegEx=d(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),e.svgViewBoxElementsRegEx=d(["symbol","image","marker","pattern","view","svg"]),e.svgInvalidAncestorsRegEx=d(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),e.svgValidParentsRegEx=d(["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*\\)))",s=new RegExp("^\\s*(?:(?:"+o+"(?:"+r+"*"+o+")*)?)\\s*$"),a=new RegExp(o,"g");return function(n){var r=i.concat(),h=[];if(!n||n&&!s.test(n))return r;n.replace(a,(function(n){var s=new RegExp(o).exec(n).filter((function(t){return!!t})),a=s[1],c=s.slice(2).map(parseFloat);switch(a){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,s=0;3===i.length&&(o=i[1],s=i[2]),t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=o-(n*o-r*s),t[5]=s-(r*o+n*s)}(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}h.push(r.concat()),r=i.concat()}));for(var c=h[0];h.length>1;)h.shift(),c=e.util.multiplyTransformMatrices(c,h[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,s,a,h,c=t.getAttribute("viewBox"),l=1,u=1,f=t.getAttribute("width"),d=t.getAttribute("height"),p=t.getAttribute("x")||0,g=t.getAttribute("y")||0,m=t.getAttribute("preserveAspectRatio")||"",v=!c||!(c=c.match(y)),b=!f||!d||"100%"===f||"100%"===d,w=v&&b,x={},_="",S=0,C=0;if(x.width=0,x.height=0,x.toBeParsed=w,v&&(p||g)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(_=" translate("+o(p)+" "+o(g)+") ",a=(t.getAttribute("transform")||"")+_,t.setAttribute("transform",a),t.removeAttribute("x"),t.removeAttribute("y")),w)return x;if(v)return x.width=o(f),x.height=o(d),x;if(i=-parseFloat(c[1]),n=-parseFloat(c[2]),r=parseFloat(c[3]),s=parseFloat(c[4]),x.minX=i,x.minY=n,x.viewBoxWidth=r,x.viewBoxHeight=s,b?(x.width=r,x.height=s):(x.width=o(f),x.height=o(d),l=x.width/r,u=x.height/s),"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),S=x.width-r*l,C=x.height-s*l,"Mid"===m.alignX&&(S/=2),"Mid"===m.alignY&&(C/=2),"Min"===m.alignX&&(S=0),"Min"===m.alignY&&(C=0)),1===l&&1===u&&0===i&&0===n&&0===p&&0===g)return x;if((p||g)&&"#document"!==t.parentNode.nodeName&&(_=" translate("+o(p)+" "+o(g)+") "),a=_+" matrix("+l+" 0 0 "+u+" "+(i*l+S)+" "+(n*u+C)+") ","svg"===t.nodeName){for(h=t.ownerDocument.createElementNS(e.svgNS,"g");t.firstChild;)h.appendChild(t.firstChild);t.appendChild(h)}else(h=t).removeAttribute("x"),h.removeAttribute("y"),a=h.getAttribute("transform")+a;return h.setAttribute("transform",a),x}function w(t,e){var i="xlink:href",n=v(t,e.getAttribute(i).slice(1));if(n&&n.getAttribute(i)&&w(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=p(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 s,a,h,c,l=o.slice(1),u=r.getAttribute("x")||0,f=r.getAttribute("y")||0,d=v(t,l).cloneNode(!0),g=(d.getAttribute("transform")||"")+" translate("+u+", "+f+")",m=i.length,y=e.svgNS;if(b(d),/^svg$/i.test(d.nodeName)){var w=d.ownerDocument.createElementNS(y,"g");for(a=0,c=(h=d.attributes).length;a<c;a++)s=h.item(a),w.setAttributeNS(y,s.nodeName,s.nodeValue);for(;d.firstChild;)w.appendChild(d.firstChild);d=w}for(a=0,c=(h=r.attributes).length;a<c;a++)"x"!==(s=h.item(a)).nodeName&&"y"!==s.nodeName&&"xlink:href"!==s.nodeName&&"href"!==s.nodeName&&("transform"===s.nodeName?g=s.nodeValue+" "+g:d.setAttribute(s.nodeName,s.nodeValue));d.setAttribute("transform",g),d.setAttribute("instantiated_by_use","1"),d.removeAttribute("id"),r.parentNode.replaceChild(d,r),i.length===m&&n++}}(t);var s,a,h=e.Object.__uid++,c=b(t),l=e.util.toArray(t.getElementsByTagName("*"));if(c.crossOrigin=o&&o.crossOrigin,c.svgUid=h,0===l.length&&e.isLikelyNode){var u=[];for(s=0,a=(l=t.selectNodes('//*[name(.)!="svg"]')).length;s<a;s++)u[s]=l[s];l=u}var f=l.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 d={};l.filter((function(t){return"clipPath"===t.nodeName.replace("svg:","")})).forEach((function(t){var i=t.getAttribute("id");d[i]=e.util.toArray(t.getElementsByTagName("*")).filter((function(t){return e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))}))})),e.gradientDefs[h]=e.getGradientDefs(t),e.cssRules[h]=e.getCSSRules(t),e.clipPaths[h]=d,e.parseElements(f,(function(t,n){i&&(i(t,c,n,l),delete e.gradientDefs[h],delete e.cssRules[h],delete e.clipPaths[h])}),n(c),r,o)}}};var x=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(x);if(i){var n=i[1],r=i[3],s=i[4],a=i[5],h=i[6];n&&(e.fontStyle=n),r&&(e.fontWeight=isNaN(parseFloat(r))?r:parseFloat(r)),s&&(e.fontSize=o(s)),h&&(e.fontFamily=h),a&&(e.lineHeight="normal"===a?1:a)}},getGradientDefs:function(t){var e,i=p(t,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),n=0,r={};for(n=i.length;n--;)(e=i[n]).getAttribute("xlink:href")&&w(t,e),r[e.getAttribute("id")]=e;return r},parseAttributes:function(t,n,s){if(t){var a,d,p,m={};void 0===s&&(s=t.getAttribute("svgUid")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(m=e.parseAttributes(t.parentNode,n,s));var v=n.reduce((function(e,i){return(a=t.getAttribute(i))&&(e[i]=a),e}),{}),y=i(function(t,i){var n={};for(var r in e.cssRules[i])if(g(t,r.split(" ")))for(var o in e.cssRules[i][r])n[o]=e.cssRules[i][r][o];return n}(t,s),e.parseStyleAttribute(t));v=i(v,y),y[l]&&t.setAttribute(l,y[l]),d=p=m.fontSize||e.Text.DEFAULT_SVG_FONT_SIZE,v[c]&&(v[c]=d=o(v[c],p));var b,w,x={};for(var _ in v)w=f(b=u(_),v[_],m,d),x[b]=w;x&&x.font&&e.parseFontDeclaration(x.font,x);var S=i(m,x);return e.svgValidParentsRegEx.test(t.nodeName)?S:function(t){for(var i in h)if(void 0!==t[h[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[h[i]],2)).toRgba()}}return t}(S)}},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 s=r[i].textContent;""!==(s=s.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&s.split("}").filter((function(t){return t.trim()})).forEach((function(t){var r=t.split("{"),s={},a=r[1].trim().split(";").filter((function(t){return t.trim()}));for(i=0,n=a.length;i<n;i++){var h=a[i].split(":"),c=h[0].trim(),l=h[1].trim();s[c]=l}(t=r[0].trim()).split(",").forEach((function(t){""!==(t=t.replace(/^svg/i,"").trim())&&(o[t]?e.util.object.extend(o[t],s):o[t]=e.util.object.clone(s))}))}))}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),A.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},(m=A.ElementsParser.prototype).parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},m.createObjects=function(){var t=this;this.elements.forEach((function(e,i){e.setAttribute("svgUid",t.svgUid),t.createObject(e,i)}))},m.findTag=function(t){return A[A.util.string.capitalize(t.tagName.replace("svg:",""))]},m.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){A.log(t)}else this.checkIfDone()},m.createCallback=function(t,e){var i=this;return function(n){var r;i.resolveGradient(n,e,"fill"),i.resolveGradient(n,e,"stroke"),n instanceof A.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()}},m.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,A[i][this.svgUid][o]}},m.resolveGradient=function(t,e,i){var n=this.extractPropertyDefinition(t,i,"gradientDefs");if(n){var r=e.getAttribute(i+"-opacity"),o=A.Gradient.fromElement(n,t,r,this.options);t.set(i,o)}},m.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},m.resolveClipPath=function(t,e){var i,n,r,o,s=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(s){r=[],n=A.util.invertTransform(t.calcTransformMatrix());for(var a=s[0].parentNode,h=e;h.parentNode&&h.getAttribute("clip-path")!==t.clipPath;)h=h.parentNode;h.parentNode.appendChild(a);for(var c=0;c<s.length;c++)i=s[c],this.findTag(i).fromElement(i,this.createClipPathCallback(t,r),this.options);s=1===r.length?r[0]:new A.Group(r),o=A.util.multiplyTransformMatrices(n,s.calcTransformMatrix()),s.clipPath&&this.resolveClipPath(s,h);var l=A.util.qrDecompose(o);s.flipX=!1,s.flipY=!1,s.set("scaleX",l.scaleX),s.set("scaleY",l.scaleY),s.angle=l.angle,s.skewX=l.skewX,s.skewY=0,s.setPositionByOrigin({x:l.translateX,y:l.translateY},"center","center"),t.clipPath=s}else delete t.clipPath},m.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 s,a=(o.x-r.x)*(t.y-r.y)-(o.y-r.y)*(t.x-r.x),h=(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 l=a/c,u=h/c;0<=l&&l<=1&&0<=u&&u<=1?(s=new i("Intersection")).appendPoint(new e.Point(t.x+l*(n.x-t.x),t.y+l*(n.y-t.y))):s=new i}else s=new i(0===a||0===h?"Coincident":"Parallel");return s},e.Intersection.intersectLinePolygon=function(t,e,n){var r,o,s,a,h=new i,c=n.length;for(a=0;a<c;a++)r=n[a],o=n[(a+1)%c],s=i.intersectLineLine(t,e,r,o),h.appendPoints(s.points);return h.points.length>0&&(h.status="Intersection"),h},e.Intersection.intersectPolygonPolygon=function(t,e){var n,r=new i,o=t.length;for(n=0;n<o;n++){var s=t[n],a=t[(n+1)%o],h=i.intersectLinePolygon(s,a,e);r.appendPoints(h.points)}return r.points.length>0&&(r.status="Intersection"),r},e.Intersection.intersectPolygonRectangle=function(t,n,r){var o=n.min(r),s=n.max(r),a=new e.Point(s.x,o.y),h=new e.Point(o.x,s.y),c=i.intersectLinePolygon(o,a,t),l=i.intersectLinePolygon(a,s,t),u=i.intersectLinePolygon(s,h,t),f=i.intersectLinePolygon(h,o,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 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,s,a=e.util.array.max([t,i,n]),h=e.util.array.min([t,i,n]);if(s=(a+h)/2,a===h)r=o=0;else{var c=a-h;switch(o=s>.5?c/(2-a-h):c/(a+h),a){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}r/=6}return[Math.round(360*r),Math.round(100*o),Math.round(100*s)]},getSource:function(){return this._source},setSource:function(t){this._source=t},toRgb:function(){var t=this.getSource();return"rgb("+t[0]+","+t[1]+","+t[2]+")"},toRgba:function(){var t=this.getSource();return"rgba("+t[0]+","+t[1]+","+t[2]+","+t[3]+")"},toHsl:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsl("+e[0]+","+e[1]+"%,"+e[2]+"%)"},toHsla:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsla("+e[0]+","+e[1]+"%,"+e[2]+"%,"+t[3]+")"},toHex:function(){var t,e,i,n=this.getSource();return t=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(),s=t.getSource();for(e=0;e<3;e++)n.push(Math.round(.5*o[e]+.5*s[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,s,a=(parseFloat(e[1])%360+360)%360/360,h=parseFloat(e[2])/(/%$/.test(e[2])?100:1),c=parseFloat(e[3])/(/%$/.test(e[3])?100:1);if(0===h)r=o=s=c;else{var l=c<=.5?c*(h+1):c+h-c*h,u=2*c-l;r=n(u,l,a+1/3),o=n(u,l,a),s=n(u,l,a-1/3)}return[Math.round(255*r),Math.round(255*o),Math.round(255*s),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),s=n?e.charAt(1)+e.charAt(1):e.substring(2,4),a=n?e.charAt(2)+e.charAt(2):e.substring(4,6),h=r?n?e.charAt(3)+e.charAt(3):e.substring(6,8):"FF";return[parseInt(o,16),parseInt(s,16),parseInt(a,16),parseFloat((parseInt(h,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",s="top",a="right",h="bottom",c="center",l={top:h,bottom:s,left:a,right:o,center:c},u=e.util.radiansToDegrees,f=Math.sign||function(t){return(t>0)-(t<0)||+t};function d(t,e){var i=t.angle+u(Math.atan2(e.y,e.x))+360;return Math.round(i%360/45)}function p(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 g(t,e){var i=e.canvas,n=t[i.uniScaleKey];return i.uniformScaling&&!n||!i.uniformScaling&&n}function m(t){return t.originX===c&&t.originY===c}function v(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,s=o.getCenterPoint(),a=o.translateToOriginPoint(s,i.originX,i.originY),h=t(e,i,n,r);return o.setPositionByOrigin(a,i.originX,i.originY),h}}function w(t,e){return function(i,n,r,o){var s=e(i,n,r,o);return s&&p(t,y(i,n,r,o)),s}}function x(t,i,n,r,o){var s=t.target,a=s.controls[t.corner],h=s.canvas.getZoom(),c=s.padding/h,l=s.toLocalPoint(new e.Point(r,o),i,n);return l.x>=c&&(l.x-=c),l.x<=-c&&(l.x+=c),l.y>=c&&(l.y-=c),l.y<=c&&(l.y+=c),l.x-=a.offsetX,l.y-=a.offsetY,l}function _(t){return t.flipX!==t.flipY}function S(t,e,i,n,r){if(0!==t[e]){var o=r/t._getTransformedDimensions()[n]*t[i];t.set(i,o)}}function C(t,e,i,n){var r,c=e.target,l=c._getTransformedDimensions(0,c.skewY),f=x(e,e.originX,e.originY,i,n),d=Math.abs(2*f.x)-l.x,p=c.skewX;d<2?r=0:(r=u(Math.atan2(d/c.scaleX,l.y/c.scaleY)),e.originX===o&&e.originY===h&&(r=-r),e.originX===a&&e.originY===s&&(r=-r),_(c)&&(r=-r));var g=p!==r;if(g){var m=c._getTransformedDimensions().y;c.set("skewX",r),S(c,"skewY","scaleY","y",m)}return g}function A(t,e,i,n){var r,c=e.target,l=c._getTransformedDimensions(c.skewX,0),f=x(e,e.originX,e.originY,i,n),d=Math.abs(2*f.y)-l.y,p=c.skewY;d<2?r=0:(r=u(Math.atan2(d/c.scaleY,l.x/c.scaleX)),e.originX===o&&e.originY===h&&(r=-r),e.originX===a&&e.originY===s&&(r=-r),_(c)&&(r=-r));var g=p!==r;if(g){var m=c._getTransformedDimensions().x;c.set("skewY",r),S(c,"skewX","scaleX","x",m)}return g}function L(t,e,i,n,r){r=r||{};var o,s,a,h,c,u,d=e.target,p=d.lockScalingX,y=d.lockScalingY,b=r.by,w=g(t,d),_=v(d,b,w),S=e.gestureScale;if(_)return!1;if(S)s=e.scaleX*S,a=e.scaleY*S;else{if(o=x(e,e.originX,e.originY,i,n),c="y"!==b?f(o.x):1,u="x"!==b?f(o.y):1,e.signX||(e.signX=c),e.signY||(e.signY=u),d.lockScalingFlip&&(e.signX!==c||e.signY!==u))return!1;if(h=d._getTransformedDimensions(),w&&!b){var C=Math.abs(o.x)+Math.abs(o.y),A=e.original,L=C/(Math.abs(h.x*A.scaleX/d.scaleX)+Math.abs(h.y*A.scaleY/d.scaleY));s=A.scaleX*L,a=A.scaleY*L}else s=Math.abs(o.x*d.scaleX/h.x),a=Math.abs(o.y*d.scaleY/h.y);m(e)&&(s*=2,a*=2),e.signX!==c&&"y"!==b&&(e.originX=l[e.originX],s*=-1,e.signX=c),e.signY!==u&&"x"!==b&&(e.originY=l[e.originY],a*=-1,e.signY=u)}var P=d.scaleX,T=d.scaleY;return b?("x"===b&&d.set("scaleX",s),"y"===b&&d.set("scaleY",a)):(!p&&d.set("scaleX",s),!y&&d.set("scaleY",a)),P!==d.scaleX||T!==d.scaleY}r.scaleCursorStyleHandler=function(t,e,n){var r=g(t,n),o="";if(0!==e.x&&0===e.y?o="x":0===e.x&&0!==e.y&&(o="y"),v(n,o,r))return"not-allowed";var s=d(n,e);return i[s]+"-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=d(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=w("rotating",b((function(t,e,i,n){var r=e,o=r.target,s=o.translateToOriginPoint(o.getCenterPoint(),r.originX,r.originY);if(o.lockRotation)return!1;var a,h=Math.atan2(r.ey-s.y,r.ex-s.x),c=Math.atan2(n-s.y,i-s.x),l=u(c-h+r.theta);if(o.snapAngle>0){var f=o.snapAngle,d=o.snapThreshold||f,p=Math.ceil(l/f)*f,g=Math.floor(l/f)*f;Math.abs(l-g)<d?l=g:Math.abs(l-p)<d&&(l=p)}return l<0&&(l=360+l),l%=360,a=o.angle!==l,o.angle=l,a}))),r.scalingEqually=w("scaling",b((function(t,e,i,n){return L(t,e,i,n)}))),r.scalingX=w("scaling",b((function(t,e,i,n){return L(t,e,i,n,{by:"x"})}))),r.scalingY=w("scaling",b((function(t,e,i,n){return L(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=w("resizing",b((function(t,e,i,n){var r=e.target,o=x(e,e.originX,e.originY,i,n),s=r.strokeWidth/(r.strokeUniform?r.scaleX:1),a=m(e)?2:1,h=r.width,c=Math.abs(o.x*a/r.scaleX)-s;return r.set("width",Math.max(c,0)),h!==c}))),r.skewHandlerX=function(t,e,i,n){var r,h=e.target,l=h.skewX,u=e.originY;return!h.lockSkewingX&&(0===l?r=x(e,c,c,i,n).x>0?o:a:(l>0&&(r=u===s?o:a),l<0&&(r=u===s?a:o),_(h)&&(r=r===o?a:o)),e.originX=r,w("skewing",b(C))(t,e,i,n))},r.skewHandlerY=function(t,e,i,n){var r,a=e.target,l=a.skewY,u=e.originX;return!a.lockSkewingY&&(0===l?r=x(e,c,c,i,n).y>0?s:h:(l>0&&(r=u===o?s:h),l<0&&(r=u===o?h:s),_(a)&&(r=r===s?h:s)),e.originY=r,w("skewing",b(A))(t,e,i,n))},r.dragHandler=function(t,e,i,n){var r=e.target,o=i-e.offsetX,s=n-e.offsetY,a=!r.get("lockMovementX")&&r.left!==o,h=!r.get("lockMovementY")&&r.top!==s;return a&&r.set("left",o),h&&r.set("top",s),(a||h)&&p("moving",y(t,e,i,n)),a||h},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=p,r.wrapWithFixedAnchor=b,r.wrapWithFireEvent=w,r.getLocalPoint=x,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,s=this.sizeX||n.cornerSize||r.cornerSize,a=this.sizeY||n.cornerSize||r.cornerSize,h=void 0!==n.transparentCorners?n.transparentCorners:r.transparentCorners,c=h?"stroke":"fill",l=!h&&(n.cornerStrokeColor||r.cornerStrokeColor),u=e,f=i;t.save(),t.fillStyle=n.cornerColor||r.cornerColor,t.strokeStyle=n.cornerStrokeColor||r.cornerStrokeColor,s>a?(o=s,t.scale(1,a/s),f=i*s/a):a>s?(o=a,t.scale(s/a,1),u=e*a/s):o=s,t.lineWidth=1,t.beginPath(),t.arc(u,f,o/2,0,2*Math.PI,!1),t[c](),l&&t.stroke(),t.restore()},n.renderSquareControl=function(t,e,n,r,o){r=r||{};var s=this.sizeX||r.cornerSize||o.cornerSize,a=this.sizeY||r.cornerSize||o.cornerSize,h=void 0!==r.transparentCorners?r.transparentCorners:o.transparentCorners,c=h?"stroke":"fill",l=!h&&(r.cornerStrokeColor||o.cornerStrokeColor),u=s/2,f=a/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"](-u,-f,s,a),l&&t.strokeRect(-u,-f,s,a),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 s,a,h,c,l=o?this.touchSizeX:this.sizeX,u=o?this.touchSizeY:this.sizeY;if(l&&u&&l!==u){var f=Math.atan2(u,l),d=Math.sqrt(l*l+u*u)/2,p=f-e.util.degreesToRadians(t),g=Math.PI/2-f-e.util.degreesToRadians(t);s=d*e.util.cos(p),a=d*e.util.sin(p),h=d*e.util.cos(g),c=d*e.util.sin(g)}else d=.7071067812*(l&&u?l:i),p=e.util.degreesToRadians(45-t),s=h=d*e.util.cos(p),a=c=d*e.util.sin(p);return{tl:{x:n-c,y:r-h},tr:{x:n+s,y:r-a},bl:{x:n-s,y:r+a},br:{x:n+c,y:r+h}}},render:function(t,i,n,r,o){"circle"===((r=r||{}).cornerStyle||o.cornerStyle)?e.controlsUtils.renderCircleControl.call(this,t,i,n,r,o):e.controlsUtils.renderSquareControl.call(this,t,i,n,r,o)}}}(e),function(){function t(t,e){var i,n,r,o,s=t.getAttribute("style"),a=t.getAttribute("offset")||0;if(a=(a=parseFloat(a)/(/%$/.test(a)?100:1))<0?0:a>1?1:a,s){var h=s.split(/\s*;\s*/);for(""===h[h.length-1]&&h.pop(),o=h.length;o--;){var c=h[o].split(/\s*:\s*/),l=c[0].trim(),u=c[1].trim();"stop-color"===l?i=u:"stop-opacity"===l&&(r=u)}}return i||(i=t.getAttribute("stop-color")||"rgb(0,0,0)"),r||(r=t.getAttribute("stop-opacity")),n=(i=new A.Color(i)).getAlpha(),r=isNaN(parseFloat(r))?1:parseFloat(r),r*=n*e,{offset:a,color:i.toRgb(),opacity:r}}var e=A.util.object.clone;A.Gradient=A.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+="_"+A.Object.__uid++:this.id=A.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 A.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 A.util.populateWithProperties(this,e,t),e},toSVG:function(t,i){var n,r,o,s,a=e(this.coords,!0),h=(i=i||{},e(this.colorStops,!0)),c=a.r1>a.r2,l=this.gradientTransform?this.gradientTransform.concat():A.iMatrix.concat(),u=-this.offsetX,f=-this.offsetY,d=!!i.additionalTransform,p="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(h.sort((function(t,e){return t.offset-e.offset})),"objectBoundingBox"===p?(u/=t.width,f/=t.height):(u+=t.width/2,f+=t.height/2),"path"===t.type&&"percentage"!==this.gradientUnits&&(u-=t.pathOffset.x,f-=t.pathOffset.y),l[4]-=u,l[5]-=f,s='id="SVGID_'+this.id+'" gradientUnits="'+p+'"',s+=' gradientTransform="'+(d?i.additionalTransform+" ":"")+A.util.matrixToSVG(l)+'" ',"linear"===this.type?o=["<linearGradient ",s,' x1="',a.x1,'" y1="',a.y1,'" x2="',a.x2,'" y2="',a.y2,'">\n']:"radial"===this.type&&(o=["<radialGradient ",s,' cx="',c?a.x1:a.x2,'" cy="',c?a.y1:a.y2,'" r="',c?a.r1:a.r2,'" fx="',c?a.x2:a.x1,'" fy="',c?a.y2:a.y1,'">\n']),"radial"===this.type){if(c)for((h=h.concat()).reverse(),n=0,r=h.length;n<r;n++)h[n].offset=1-h[n].offset;var g=Math.min(a.r1,a.r2);if(g>0){var m=g/Math.max(a.r1,a.r2);for(n=0,r=h.length;n<r;n++)h[n].offset+=m*(1-h[n].offset)}}for(n=0,r=h.length;n<r;n++){var v=h[n];o.push("<stop ",'offset="',100*v.offset+"%",'" style="stop-color:',v.color,void 0!==v.opacity?";stop-opacity: "+v.opacity:";",'"/>\n')}return o.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),o.join("")},toLive:function(t){var e,i,n,r=A.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,s=this.colorStops[i].opacity,a=this.colorStops[i].offset;void 0!==s&&(o=new A.Color(o).setAlpha(s).toRgba()),e.addColorStop(a,o)}return e}}}),A.util.object.extend(A.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 s,a,h,c,l=e.getElementsByTagName("stop"),u="userSpaceOnUse"===e.getAttribute("gradientUnits")?"pixels":"percentage",f=e.getAttribute("gradientTransform")||"",d=[],p=0,g=0;for("linearGradient"===e.nodeName||"LINEARGRADIENT"===e.nodeName?(s="linear",a=function(t){return{x1:t.getAttribute("x1")||0,y1:t.getAttribute("y1")||0,x2:t.getAttribute("x2")||"100%",y2:t.getAttribute("y2")||0}}(e)):(s="radial",a=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)),h=l.length;h--;)d.push(t(l[h],o));return c=A.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,a,r,u),"pixels"===u&&(p=-i.left,g=-i.top),new A.Gradient({id:e.getAttribute("id"),type:s,coords:a,colorStops:d,gradientUnits:u,gradientTransform:c,offsetX:p,offsetY:g})}})}(),function(){"use strict";var t=A.util.toFixed;A.Pattern=A.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(t,e){if(t||(t={}),this.id=A.Object.__uid++,this.setOptions(t),!t.source||t.source&&"string"!=typeof t.source)e&&e(this);else{var i=this;this.source=A.util.createImage(),A.util.loadImage(t.source,(function(t,n){i.source=t,e&&e(i,n)}),null,this.crossOrigin)}},toObject:function(e){var i,n,r=A.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},A.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,s="";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?s=e.src:e.toDataURL&&(s=e.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+r+'" y="'+o+'" width="'+i+'" height="'+n+'">\n<image x="0" y="0" width="'+e.width+'" height="'+e.height+'" xlink:href="'+s+'"></image>\n</pattern>\n'},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,s=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&&(n=100*i((Math.abs(s.x)+this.blur)/t.width,o)+20,r=100*i((Math.abs(s.y)+this.blur)/t.height,o)+20),t.flipX&&(s.x*=-1),t.flipY&&(s.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+r+'%" height="'+(100+2*r)+'%" x="-'+n+'%" width="'+(100+2*n)+'%" >\n\t<feGaussianBlur in="SourceAlpha" stdDeviation="'+i(this.blur?this.blur/2:0,o)+'"></feGaussianBlur>\n\t<feOffset dx="'+i(s.x,o)+'" dy="'+i(s.y,o)+'" result="oBlur" ></feOffset>\n\t<feFlood flood-color="'+a.toRgb()+'" flood-opacity="'+a.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(A.StaticCanvas)A.warn("fabric.StaticCanvas is already defined.");else{var t=A.util.object.extend,e=A.util.getElementOffset,i=A.util.removeFromArray,n=A.util.toFixed,r=A.util.transformPoint,o=A.util.invertTransform,s=A.util.getNodeCanvas,a=A.util.createCanvasElement,h=new Error("Could not initialize `canvas` element");A.StaticCanvas=A.util.createClass(A.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:A.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 A.devicePixelRatio>1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,A.devicePixelRatio):1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var t=A.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?A.util.loadImage(e,(function(e,r){if(e){var o=new A.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=a();if(!t)throw h;if(t.style||(t.style={}),void 0===t.getContext)throw h;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=A.util.getById(t)||this._createCanvasElement(),A.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.contextTop),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,s=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),s&&s.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 s=r(t,n);return n[4]+=i.x-s.x,n[5]+=i.y-s.y,this.setViewportTransform(n)},setZoom:function(t){return this.zoomToPoint(new A.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 A.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=A.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 A.Point(t.br.x,t.tl.y),t.bl=new A.Point(t.tl.x,t.br.y),this.vptCoords=t,t},cancelRequestedRender:function(){this.isRendering&&(A.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),A.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 s=i.gradientTransform||i.patternTransform;s&&t.transform(s[0],s[1],s[2],s[3],s[4],s[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}},getCenterPoint:function(){return new A.Point(this.width/2,this.height/2)},centerObjectH:function(t){return this._centerObject(t,new A.Point(this.getCenterPoint().x,t.getCenterPoint().y))},centerObjectV:function(t){return this._centerObject(t,new A.Point(t.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(t){var e=this.getCenterPoint();return this._centerObject(t,e)},viewportCenterObject:function(t){var e=this.getVpCenter();return this._centerObject(t,e)},viewportCenterObjectH:function(t){var e=this.getVpCenter();return this._centerObject(t,new A.Point(e.x,t.getCenterPoint().y)),this},viewportCenterObjectV:function(t){var e=this.getVpCenter();return this._centerObject(t,new A.Point(t.getCenterPoint().x,e.y))},getVpCenter:function(){var t=this.getCenterPoint(),e=o(this.viewportTransform);return r(t,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:A.version,objects:this._toObjects(e,i)};return n&&!n.excludeFromExport&&(r.clipPath=this._toObject(this.clipPath,e,i)),t(r,this.__serializeBgOverlay(e,i)),A.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,s=this.overlayColor;return o&&o.toObject?o.excludeFromExport||(i.background=o.toObject(e)):o&&(i.background=o),s&&s.toObject?s.excludeFromExport||(i.overlay=s.toObject(e)):s&&(i.overlay=s),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,s='viewBox="0 0 '+this.width+" "+this.height+'" ',a=A.Object.NUM_FRACTION_DIGITS;e.viewBox?s='viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':this.svgViewportTransformation&&(i=this.viewportTransform,s='viewBox="'+n(-i[4]/i[0],a)+" "+n(-i[5]/i[3],a)+" "+n(this.width/i[0],a)+" "+n(this.height/i[3],a)+'" '),t.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',r,'" ','height="',o,'" ',s,'xml:space="preserve">\n',"<desc>Created with Fabric.js ",A.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_"+A.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?A.util.matrixToSVG(r):""})}})).join("")},createSVGFontFacesMarkup:function(){var t,e,i,n,r,o,s,a,h="",c={},l=A.fontPaths,u=[];for(this._objects.forEach((function t(e){u.push(e),e._objects&&e._objects.forEach(t)})),s=0,a=u.length;s<a;s++)if(e=(t=u[s]).fontFamily,-1!==t.type.indexOf("text")&&!c[e]&&l[e]&&(c[e]=!0,t.styles))for(r in i=t.styles)for(o in n=i[r])!c[e=n[o].fontFamily]&&l[e]&&(c[e]=!0);for(var f in c)h+=["\t\t@font-face {\n","\t\t\tfont-family: '",f,"';\n","\t\t\tsrc: url('",l[f],"');\n","\t\t}\n"].join("");return h&&(h=['\t<style type="text/css">',"<![CDATA[\n",h,"]]>","</style>\n"].join("")),h},_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 s=i.repeat,a=A.util.invertTransform(n),h=this[e+"Vpt"]?A.util.matrixToSVG(a):"";t.push('<rect transform="'+h+" translate(",r/2,",",o/2,')"',' x="',i.offsetX-r/2,'" y="',i.offsetY-o/2,'" ','width="',"repeat-y"===s||"no-repeat"===s?i.source.width:r,'" height="',"repeat-x"===s||"no-repeat"===s?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,s,a,h=this._activeObject,c=0;if(t===h&&"activeSelection"===t.type)for(a=h._objects,n=0;n<a.length;n++)r=a[n],(o=this._objects.indexOf(r))>0+c&&(s=o-1,i(this._objects,r),this._objects.splice(s,0,r)),c++;else 0!==(o=this._objects.indexOf(t))&&(s=this._findNewLowerIndex(t,o,e),i(this._objects,t),this._objects.splice(s,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,s,a,h=this._activeObject,c=0;if(t===h&&"activeSelection"===t.type)for(n=(a=h._objects).length;n--;)r=a[n],(o=this._objects.indexOf(r))<this._objects.length-1-c&&(s=o+1,i(this._objects,r),this._objects.splice(s,0,r)),c++;else(o=this._objects.indexOf(t))!==this._objects.length-1&&(s=this._findNewUpperIndex(t,o,e),i(this._objects,t),this._objects.splice(s,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&&(A.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"),A.util.setStyle(this.lowerCanvasEl,this._originalCanvasStyle),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),A.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),t(A.StaticCanvas.prototype,A.Observable),t(A.StaticCanvas.prototype,A.Collection),t(A.StaticCanvas.prototype,A.DataURLExporter),t(A.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=a();if(!e||!e.getContext)return null;var i=e.getContext("2d");return i&&"setLineDash"===t?void 0!==i.setLineDash:null}}),A.StaticCanvas.prototype.toJSON=A.StaticCanvas.prototype.toObject,A.isLikelyNode&&(A.StaticCanvas.prototype.createPNGStream=function(){var t=s(this.lowerCanvasEl);return t&&t.createPNGStream()},A.StaticCanvas.prototype.createJPEGStream=function(t){var e=s(this.lowerCanvasEl);return e&&e.createJPEGStream(t)})}}(),A.BaseBrush=A.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(t){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*=A.devicePixelRatio),i.shadowColor=e.color,i.shadowBlur=e.blur*n,i.shadowOffsetX=e.offsetX*n,i.shadowOffsetY=e.offsetY*n}},needsFullRender:function(){return new A.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()}}),A.PencilBrush=A.util.createClass(A.BaseBrush,{decimate:.4,drawStraightLine:!1,straightLineKey:"shiftKey",initialize:function(t){this.canvas=t,this._points=[]},needsFullRender:function(){return this.callSuper("needsFullRender")||this._hasStraightLine},_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.drawStraightLine=e.e[this.straightLineKey],this._prepareForDrawing(t),this._captureDrawingPath(t),this._render())},onMouseMove:function(t,e){if(this.canvas._isMainEvent(e.e)&&(this.drawStraightLine=e.e[this.straightLineKey],(!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.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(t){var e=new A.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.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(t),0))},_reset:function(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1},_captureDrawingPath:function(t){var e=new A.Point(t.x,t.y);return this._addPoint(e)},_render:function(t){var e,i,n=this._points[0],r=this._points[1];if(t=t||this.canvas.contextTop,this._saveAndTransform(t),t.beginPath(),2===this._points.length&&n.x===r.x&&n.y===r.y){var o=this.width/1e3;n=new A.Point(n.x,n.y),r=new A.Point(r.x,r.y),n.x-=o,r.x+=o}for(t.moveTo(n.x,n.y),e=1,i=this._points.length;e<i;e++)this._drawSegment(t,n,r),n=this._points[e],r=this._points[e+1];t.lineTo(n.x,n.y),t.stroke(),t.restore()},convertPointsToSVGPath:function(t){var e=this.width/1e3;return A.util.getSmoothPathFromPoints(t,e)},_isEmptySVGPath:function(t){return"M 0 0 Q 0 0 0 0 L 0 0"===A.util.joinPath(t)},createPath:function(t){var e=new A.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 A.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,s=t[0],a=[s];for(i=1;i<o-1;i++)Math.pow(s.x-t[i].x,2)+Math.pow(s.y-t[i].y,2)>=r&&(s=t[i],a.push(s));return a.push(t[o]),a},_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})}}}),A.CircleBrush=A.util.createClass(A.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 A.Circle({radius:r.radius,left:r.x,top:r.y,originX:"center",originY:"center",fill:r.fill});this.shadow&&(o.shadow=new A.Shadow(this.shadow)),n.push(o)}var s=new A.Group(n);s.canvas=this.canvas,this.canvas.fire("before:path:created",{path:s}),this.canvas.add(s),this.canvas.fire("path:created",{path:s}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=i,this.canvas.requestRenderAll()},addPoint:function(t){var e=new A.Point(t.x,t.y),i=A.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,n=new A.Color(this.color).setAlpha(A.util.getRandomInt(0,100)/100).toRgba();return e.radius=i,e.fill=n,this.points.push(e),e}}),A.SprayBrush=A.util.createClass(A.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,s=r.length;o<s;o++){var a=new A.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(a)}this.optimizeOverlapping&&(e=this._getOptimizedRects(e));var h=new A.Group(e);this.shadow&&h.set("shadow",new A.Shadow(this.shadow)),this.canvas.fire("before:path:created",{path:h}),this.canvas.add(h),this.canvas.fire("path:created",{path:h}),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=A.util.getRandomInt(t.x-o,t.x+o),i=A.util.getRandomInt(t.y-o,t.y+o),n=this.dotWidthVariance?A.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var s=new A.Point(e,i);s.width=n,this.randomOpacity&&(s.opacity=A.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(s)}this.sprayChunks.push(this.sprayChunkPoints)}}),A.PatternBrush=A.util.createClass(A.PencilBrush,{getPatternSrc:function(){var t=A.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(t){return t.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(t){this.callSuper("_setBrushStyles",t),t.strokeStyle=this.getPattern(t)},createPath:function(t){var e=this.callSuper("createPath",t),i=e._getLeftTopCoords().scalarAdd(e.strokeWidth/2);return e.stroke=new A.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-i.x,offsetY:-i.y}),e}}),function(){var t=A.util.getPointer,e=A.util.degreesToRadians,i=A.util.isTouchEvent;for(var n in A.Canvas=A.util.createClass(A.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",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:[],enablePointerEvents:!1,_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=A.PencilBrush&&new A.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),this.hasLostContext=!1);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=A.util.invertTransform(i),r=this.restorePointerVpt(e);return A.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 A.util.isTransparent(t._cacheContext,Math.round(r),Math.round(o),this.targetFindTolerance)}var s=this.contextCache,a=t.selectionBackgroundColor,h=this.viewportTransform;return t.selectionBackgroundColor="",this.clearContext(s),s.save(),s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),t.render(s),s.restore(),t.selectionBackgroundColor=a,A.util.isTransparent(s,e,i,this.targetFindTolerance)},_isSelectionKeyPressed:function(t){return Array.isArray(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,s=i.controls[o],a=n&&o?s.getActionHandler(t,i,s):A.controlsUtils.dragHandler,h=this._getActionFromCorner(n,o,t,i),c=this._getOriginFromCorner(i,o),l=t[this.centeredKey],u={target:i,action:h,actionHandler:a,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:l,original:A.util.saveObjectTransform(i)};this._shouldCenterTransform(i,h,l)&&(u.originX="center",u.originY="center"),u.original.originX=c.x,u.original.originY=c.y,this._currentTransform=u,this._beforeTransform(t)}},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_drawSelection:function(t){var e=this._groupSelector,i=new A.Point(e.ex,e.ey),n=A.util.transformPoint(i,this.viewportTransform),r=new A.Point(e.ex+e.left,e.ey+e.top),o=A.util.transformPoint(r,this.viewportTransform),s=Math.min(n.x,o.x),a=Math.min(n.y,o.y),h=Math.max(n.x,o.x),c=Math.max(n.y,o.y),l=this.selectionLineWidth/2;this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(s,a,h-s,c-a)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,s+=l,a+=l,h-=l,c-=l,A.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(s,a,h-s,c-a))},findTarget:function(t,e){if(!this.skipTargetFind){var n,r,o=this.getPointer(t,!0),s=this._activeObject,a=this.getActiveObjects(),h=i(t),c=a.length>1&&!e||1===a.length;if(this.targets=[],c&&s._findTargetCorner(o,h))return s;if(a.length>1&&!e&&s===this._searchPossibleTargets([s],o))return s;if(1===a.length&&s===this._searchPossibleTargets([s],o)){if(!this.preserveObjectStacking)return s;n=s,r=this.targets,this.targets=[]}var l=this._searchPossibleTargets(this._objects,o);return t[this.altSelectionKey]&&l&&n&&l!==n&&(l=n,this.targets=r),l}},_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],s=o.group?this._normalizePointer(o.group,e):e;if(this._checkTarget(s,o,e)){(i=t[r]).subTargetCheck&&i instanceof A.Group&&(n=this._searchPossibleTargets(i._objects,e))&&this.targets.push(n);break}}return i},restorePointerVpt:function(t){return A.util.transformPoint(t,A.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,s=o.getBoundingClientRect(),a=s.width||0,h=s.height||0;a&&h||("top"in s&&"bottom"in s&&(h=Math.abs(s.top-s.bottom)),"right"in s&&"left"in s&&(a=Math.abs(s.right-s.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===a||0===h?{width:1,height:1}:{width:o.width/a,height:o.height/h},{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),A.util.addClass(i,"upper-canvas "+t),this.wrapperEl.appendChild(i),this._copyCanvasStyle(e,i),this._applyCanvasStyle(i),this.contextTop=i.getContext("2d")},getTopContext:function(){return this.contextTop},_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=A.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),A.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),A.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.width||t.width,i=this.height||t.height;A.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,A.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,target:t}),o.push(t))})),n.forEach((function(n){-1===t.indexOf(n)&&(i=!0,n.fire("selected",{e,target:n}),r.push(n))})),t.length>0&&n.length>0?i&&this.fire("selection:updated",{e,selected:r,deselected:o}):n.length>0?this.fire("selection:created",{e,selected:r}):t.length>0&&this.fire("selection:cleared",{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})&&(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){A.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this)),t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,A.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]})),A.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(),A.StaticCanvas.prototype.setViewportTransform.call(this,t)}}),A.StaticCanvas)"prototype"!==n&&(A.Canvas[n]=A.StaticCanvas[n])}(),function(){var t=A.util.addListener,e=A.util.removeListener,i={passive:!1};function n(t,e){return t.button&&t.button===e-1}A.util.object.extend(A.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(A.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(A.document,t+"up",this._onMouseUp),e(A.document,"touchend",this._onTouchEnd,i),e(A.document,t+"move",this._onMouseMove,i),e(A.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._onDrop.bind(this),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=[]},_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)},_onDrop:function(t){return this._simpleEventHandler("drop:before",t),this._simpleEventHandler("drop",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(A.document,"touchend",this._onTouchEnd,i),t(A.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(A.document,o+"up",this._onMouseUp),t(A.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(A.document,"touchend",this._onTouchEnd,i),e(A.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(A.document,o+"up",this._onMouseUp),e(A.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,s=!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,s);else{if(n(t,2))return this.fireMiddleClick&&this._handleEvent(t,"up",2,s),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(t);else if(this._isMainEvent(t)){if(i&&(this._finalizeCurrentTransform(t),o=i.actionPerformed),!s){var a=e===this._activeObject;this._maybeGroupObjects(t),o||(o=this._shouldRender(e)||!a&&e===this._activeObject)}var h,c;if(e){if(h=e._findTargetCorner(this.getPointer(t,!0),A.util.isTouchEvent(t)),e.selectable&&e!==this._activeObject&&"up"===e.activeOn)this.setActiveObject(e,t),o=!0;else{var l=e.controls[h],u=l&&l.getMouseUpHandler(t,e,l);u&&u(t,i,(c=this.getPointer(t)).x,c.y)}e.isMoving=!1}if(i&&(i.target!==e||i.corner!==h)){var f=i.target&&i.target.controls[i.corner],d=f&&f.getMouseUpHandler(t,e,l);c=c||this.getPointer(t),d&&d(t,i,c.x,c.y)}this._setCursorFromEvent(t,e),this._handleEvent(t,"up",1,s),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),o?this.requestRenderAll():s||this.renderTop()}}},_simpleEventHandler:function(t,e){var i=this.findTarget(e),n=this.targets,r={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||[],s={e:t,target:r,subTargets:o,button:i||1,isClick:n||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};"up"===e&&(s.currentTarget=this.findTarget(t),s.currentSubTargets=this.targets),this.fire("mouse:"+e,s),r&&r.fire("mouse"+e,s);for(var a=0;a<o.length;a++)o[a].fire("mouse"+e,s)},_finalizeCurrentTransform:function(t){var e=this._currentTransform,i=e.target,n={e:t,target:i,transform:e,action:e.action};i._scaling&&(i._scaling=!1),i.setCoords(),(e.actionPerformed||this.stateful&&i.hasStateChanged())&&this._fire("modified",n)},_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 s=e===this._activeObject;e.selectable&&"down"===e.activeOn&&this.setActiveObject(e,t);var a=e._findTargetCorner(this.getPointer(t,!0),A.util.isTouchEvent(t));if(e.__corner=a,e===this._activeObject&&(a||!o)){this._setupCurrentTransform(t,e,s);var h=e.controls[a],c=(i=this.getPointer(t),h&&h.getMouseDownHandler(t,e,h));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 s=0;s<o;s++)this.fireSyntheticInOutEvents(r[s],e,{oldTarget:n[s],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 s=0;s<o;s++)this.fireSyntheticInOutEvents(r[s],e,{oldTarget:n[s],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=t},fireSyntheticInOutEvents:function(t,e,i){var n,r,o,s=i.oldTarget,a=s!==t,h=i.canvasEvtIn,c=i.canvasEvtOut;a&&(n={e,target:t,previousTarget:s},r={e,target:s,nextTarget:t}),o=t&&a,s&&a&&(c&&this.fire(c,r),s.fire(i.evtOut,r)),o&&(h&&this.fire(h,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,s=!1,a=e.actionHandler;a&&(s=a(t,e,n,r)),"drag"===o&&s&&(e.target.isMoving=!0,this.setCursor(e.target.moveCursor||this.moveCursor)),e.actionPerformed=e.actionPerformed||s},_fire:A.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)}})}(),v=Math.min,y=Math.max,A.util.object.extend(A.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 A.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 A.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,s=r+this._groupSelector.top,a=new A.Point(v(n,o),v(r,s)),h=new A.Point(y(n,o),y(r,s)),c=!this.selectionFullyContained,l=n===o&&r===s,u=this._objects.length;u--&&!((e=this._objects[u])&&e.selectable&&e.visible&&(c&&e.intersectsWithRect(a,h,!0)||e.isContainedWithinRect(a,h,!0)||c&&e.containsPoint(a,null,!0)||c&&e.containsPoint(h,null,!0))&&(i.push(e),l)););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}}),A.util.object.extend(A.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 A.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,s=this.height,a=r*t,h=this.viewportTransform,c=(h[4]-(e.left||0))*t,l=(h[5]-(e.top||0))*t,u=this.interactive,f=[a,0,0,a,c,l],d=this.enableRetinaScaling,p=A.util.createCanvasElement(),g=this.contextTop;return p.width=i,p.height=n,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=f,this.width=i,this.height=n,this.calcViewportBoundaries(),this.renderCanvas(p.getContext("2d"),this._objects),this.viewportTransform=h,this.width=o,this.height=s,this.calcViewportBoundaries(),this.interactive=u,this.enableRetinaScaling=d,this.contextTop=g,p}}),A.util.object.extend(A.StaticCanvas.prototype,{loadFromJSON:function(t,e,i){if(t){var n="string"==typeof t?JSON.parse(t):A.util.object.clone(t),r=this,o=n.clipPath,s=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,s,e)})):r.__setupCanvas.call(r,n,t,s,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?A.util.enlivenObjects([e],(function(e){r[t]=e[0],i[t]=!0,n&&n()})):this["set"+A.util.string.capitalize(t,!0)](e,(function(){i[t]=!0,n&&n()}))},_enlivenObjects:function(t,e,i){t&&0!==t.length?A.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=A.util.createCanvasElement();e.width=this.width,e.height=this.height;var i=new A.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,s=e.util.degreesToRadians,a=!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:a,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,s=e.minCacheSideLimit;if(n<=o&&r<=o&&n*r<=i)return n<s&&(t.width=s),r<s&&(t.height=s),t;var a=n/r,h=e.util.limitDimsByArea(a,i),c=e.util.capValue,l=c(s,h.x,o),u=c(s,h.y,o);return n>l&&(t.zoomX/=n/l,t.width=l,t.capped=!0),r>u&&(t.zoomY/=r/u,t.height=u,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,s=this._cacheCanvas,a=this._limitCacheSize(this._getCacheCanvasDimensions()),h=e.minCacheSideLimit,c=a.width,l=a.height,u=a.zoomX,f=a.zoomY,d=c!==this.cacheWidth||l!==this.cacheHeight,p=this.zoomX!==u||this.zoomY!==f,g=d||p,m=0,v=0,y=!1;if(d){var b=this._cacheCanvas.width,w=this._cacheCanvas.height,x=c>b||l>w;y=x||(c<.9*b||l<.9*w)&&b>h&&w>h,x&&!a.capped&&(c>h||l>h)&&(m=.1*c,v=.1*l)}return this instanceof e.Text&&this.path&&(g=!0,y=!0,m+=this.getHeightOfLine(0)*this.zoomX,v+=this.getHeightOfLine(0)*this.zoomY),!!g&&(y?(s.width=Math.ceil(c+m),s.height=Math.ceil(l+v)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,s.width,s.height)),r=a.x/2,o=a.y/2,this.cacheTranslationX=Math.round(s.width/2-r)+r,this.cacheTranslationY=Math.round(s.height/2-o)+o,this.cacheWidth=c,this.cacheHeight=l,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(u,f),this.zoomX=u,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],Array.isArray(t[e])&&Array.isArray(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._cacheContext||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._cacheContext=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,i){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.clipPath),this.fill=i,this.stroke=n},_drawClipPath:function(t,e){e&&(e.canvas=this.canvas,e.shouldCache(),e._transformDone=!0,e.renderCache({forClipping:!0}),this.drawClipPathOnCache(t,e))},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&&this._cacheContext&&!t&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&this._cacheContext&&!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,a=this.getViewportTransform(),h=this.calcTransformMatrix();r=void 0!==(i=i||{}).hasBorders?i.hasBorders:this.hasBorders,o=void 0!==i.hasControls?i.hasControls:this.hasControls,h=e.util.multiplyTransformMatrices(a,h),n=e.util.qrDecompose(h),t.save(),t.translate(n.translateX,n.translateY),t.lineWidth=1*this.borderScaleFactor,this.group||(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(n.angle-=180),t.rotate(s(this.group?n.angle:this.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,s=r&&r.viewportTransform[3]||1;i=n.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),r&&r._isRetinaScaling()&&(o*=e.devicePixelRatio,s*=e.devicePixelRatio),t.shadowColor=n.color,t.shadowBlur=n.blur*e.browserShadowBlurConstant*(o+s)*(i.scaleX+i.scaleY)/4,t.shadowOffsetX=n.offsetX*o*i.scaleX,t.shadowOffsetY=n.offsetY*s*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(),s=this.canvas.getRetinaScaling(),a=r.x/this.scaleX/s,h=r.y/this.scaleY/s;o.width=a,o.height=h,(n=o.getContext("2d")).beginPath(),n.moveTo(0,0),n.lineTo(a,0),n.lineTo(a,h),n.lineTo(0,h),n.closePath(),n.translate(a/2,h/2),n.scale(r.zoomX/this.scaleX/s,r.zoomY/this.scaleY/s),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(s*this.scaleX/r.zoomX,s*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,s=Math.abs,a=(t.multiplier||1)*(t.enableRetinaScaling?e.devicePixelRatio:1);delete this.group,t.withoutTransform&&i.resetObjectTransform(this),t.withoutShadow&&(this.shadow=null);var h,c,l,u,f=e.util.createCanvasElement(),d=this.getBoundingRect(!0,!0),p=this.shadow,g={x:0,y:0};p&&(c=p.blur,h=p.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),g.x=2*Math.round(s(p.offsetX)+c)*s(h.scaleX),g.y=2*Math.round(s(p.offsetY)+c)*s(h.scaleY)),l=d.width+g.x,u=d.height+g.y,f.width=Math.ceil(l),f.height=Math.ceil(u);var m=new e.StaticCanvas(f,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});"jpeg"===t.format&&(m.backgroundColor="#fff"),this.setPositionByOrigin(new e.Point(m.width/2,m.height/2),"center","center");var v=this.canvas;m.add(this);var y=m.toCanvasElement(a||1,t);return this.shadow=o,this.set("canvas",v),r&&(this.group=r),this.set(n).setCoords(),m._objects=[],m.dispose(),m=null,y},toDataURL:function(t){return t||(t={}),e.util.toDataURL(this.toCanvasElement(t),t.format||"png",t.quality||1)},isType:function(t){return arguments.length>1?Array.from(arguments).includes(this.type):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,s(-this.angle))),{x:n.x-r.x,y:n.y-r.y}},_setupCompositeOperation:function(t){this.globalCompositeOperation&&(t.globalCompositeOperation=this.globalCompositeOperation)},dispose:function(){e.runningAnimations&&e.runningAnimations.cancelByTarget(this)}}),e.util.createAccessors&&e.util.createAccessors(e.Object),i(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object.ENLIVEN_PROPS=["clipPath"],e.Object._fromObject=function(t,i,r,o){var s=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.enlivenObjectEnlivables(i,i,(function(){var t=o?new s(i[o],i):new s(i);r&&r(t)}))}))},e.Object.__uid=0)}(e),b=A.util.degreesToRadians,w={left:-.5,center:0,right:.5},x={top:-.5,center:0,bottom:.5},A.util.object.extend(A.Object.prototype,{translateToGivenOrigin:function(t,e,i,n,r){var o,s,a,h=t.x,c=t.y;return"string"==typeof e?e=w[e]:e-=.5,"string"==typeof n?n=w[n]:n-=.5,"string"==typeof i?i=x[i]:i-=.5,"string"==typeof r?r=x[r]:r-=.5,s=r-i,((o=n-e)||s)&&(a=this._getTransformedDimensions(),h=t.x+o*a.x,c=t.y+s*a.y),new A.Point(h,c)},translateToCenterPoint:function(t,e,i){var n=this.translateToGivenOrigin(t,e,i,"center","center");return this.angle?A.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?A.util.rotatePoint(n,t,b(this.angle)):n},getCenterPoint:function(){var t=new A.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 A.Point(this.left,this.top),r=new A.Point(t.x,t.y),this.angle&&(r=A.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=A.util.cos(n)*r,s=A.util.sin(n)*r;e="string"==typeof this.originX?w[this.originX]:this.originX-.5,i="string"==typeof t?w[t]:t-.5,this.left+=o*(i-e),this.top+=s*(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=A.util,e=t.degreesToRadians,i=t.multiplyTransformMatrices,n=t.transformPoint;t.object.extend(A.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 A.Point(i.tl.x,i.tl.y),new A.Point(i.tr.x,i.tr.y),new A.Point(i.br.x,i.br.y),new A.Point(i.bl.x,i.bl.y)];var i},intersectsWithRect:function(t,e,i,n){var r=this.getCoords(i,n);return"Intersection"===A.Intersection.intersectPolygonRectangle(r,t,e).status},intersectsWithObject:function(t,e,i){return"Intersection"===A.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,s=t._getImageLines(r);o<4;o++)if(!t.containsPoint(n[o],s))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 s in e)if(!((r=e[s]).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:(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)},calcLineCoords:function(){var i=this.getViewportTransform(),r=this.padding,o=e(this.angle),s=t.cos(o)*r,a=t.sin(o)*r,h=s+a,c=s-a,l=this.calcACoords(),u={tl:n(l.tl,i),tr:n(l.tr,i),bl:n(l.bl,i),br:n(l.br,i)};return r&&(u.tl.x-=c,u.tl.y-=h,u.tr.x+=h,u.tr.y-=c,u.bl.x-=h,u.bl.y+=c,u.br.x+=c,u.br.y+=h),u},calcOCoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),n=this.getViewportTransform(),r=i(n,e),o=i(r,t),s=(o=i(o,[1/n[0],0,0,1/n[3],0,0]),this._calculateCurrentDimensions()),a={};return this.forEachControl((function(t,e,i){a[e]=t.positionHandler(s,o,i)})),a},calcACoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),r=i(e,t),o=this._getTransformedDimensions(),s=o.x/2,a=o.y/2;return{tl:n({x:-s,y:-a},r),tr:n({x:s,y:-a},r),bl:n({x:-s,y:a},r),br:n({x:s,y:a},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},_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,s=0===e&&0===i;if(this.strokeUniform?(r=this.width,o=this.height):(r=(n=this._getNonTransformedDimensions()).x,o=n.y),s)return this._finalizeDimensions(r*this.scaleX,o*this.scaleY);var a=t.sizeAfterTransform(r,o,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:e,skewY:i});return this._finalizeDimensions(a.x,a.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)}})}(),A.util.object.extend(A.Object.prototype,{sendToBack:function(){return this.group?A.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?A.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?A.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas&&this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?A.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?A.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 A.Color(e),n=t+": "+i.toRgb()+"; ",r=i.getAlpha();return 1!==r&&(n+=t+"-opacity: "+r.toString()+"; "),n}return t+": none; "}var e=A.util.toFixed;A.util.object.extend(A.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",s=this.strokeLineCap?this.strokeLineCap:"butt",a=this.strokeLineJoin?this.strokeLineJoin:"miter",h=this.strokeMiterLimit?this.strokeMiterLimit:"4",c=void 0!==this.opacity?this.opacity:"1",l=this.visible?"":" visibility: hidden;",u=e?"":this.getSvgFilter(),f=t("fill",this.fill);return[t("stroke",this.stroke),"stroke-width: ",n,"; ","stroke-dasharray: ",r,"; ","stroke-linecap: ",s,"; ","stroke-dashoffset: ",o,"; ","stroke-linejoin: ",a,"; ","stroke-miterlimit: ",h,"; ",f,"fill-rule: ",i,"; ","opacity: ",c,";",u,l].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:"",s=e.fontSize?"font-size: "+e.fontSize+"px"+n:"",a=e.fontStyle?"font-style: "+e.fontStyle+n:"",h=e.fontWeight?"font-weight: "+e.fontWeight+n:"",c=e.fill?t("fill",e.fill):"",l=e.stroke?t("stroke",e.stroke):"",u=this.getSvgTextDecoration(e);return u&&(u="text-decoration: "+u+n),[l,o,r,s,a,h,u,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="'+A.util.matrixToSVG(i)+(e||"")+'" '},_setSVGBg:function(t){if(this.backgroundColor){var i=A.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,s=r?"":'style="'+this.getSvgStyles()+'" ',a=e.withShadow?'style="'+this.getSvgFilter()+'" ':"",h=this.clipPath,c=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",l=h&&h.absolutePositioned,u=this.stroke,f=this.fill,d=this.shadow,p=[],g=t.indexOf("COMMON_PARTS"),m=e.additionalTransform;return h&&(h.clipPathId="CLIPPATH_"+A.Object.__uid++,n='<clipPath id="'+h.clipPathId+'" >\n'+h.toClipPathSVG(o)+"</clipPath>\n"),l&&p.push("<g ",a,this.getSvgCommons()," >\n"),p.push("<g ",this.getSvgTransform(!1),l?"":a+this.getSvgCommons()," >\n"),i=[s,c,r?"":this.addPaintOrder()," ",m?'transform="'+m+'" ':""].join(""),t[g]=i,f&&f.toLive&&p.push(f.toSVG(this)),u&&u.toLive&&p.push(u.toSVG(this)),d&&p.push(d.toSVG(this)),h&&p.push(n),p.push(t.join("")),p.push("</g>\n"),l&&p.push("</g>\n"),o?o(p.join("")):p.join("")},addPaintOrder:function(){return"fill"!==this.paintFirst?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var t=A.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 s,a=Object.keys(t);if(!e||"object"!=typeof e||!i&&a.length!==Object.keys(e).length)return!1;for(r=0,o=a.length;r<o;r++)if("canvas"!==(s=a[r])&&"group"!==s&&!n(t[s],e[s]))return!1;return!0}}A.util.object.extend(A.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=A.util.degreesToRadians;A.util.object.extend(A.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,s=t.y,a=Object.keys(this.oCoords),h=a.length-1;for(this.__corner=0;h>=0;h--)if(r=a[h],this.isControlVisible(r)&&(n=this._getImageLines(e?this.oCoords[r].touchCorner:this.oCoords[r].corner),0!==(i=this._findCrossPoints({x:o,y:s},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,s=void 0!==e.hasControls?e.hasControls:this.hasControls,a=!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),s&&(t.beginPath(),this.forEachControl((function(e,i,n){e.withConnection&&e.getVisibility(n,i)&&(a=!0,t.moveTo(e.x*r,e.y*o),t.lineTo(e.x*r+e.offsetX,e.y*o+e.offsetY))})),a&&t.stroke()),t.restore(),this},drawBordersInGroup:function(t,e,i){i=i||{};var n=A.util.sizeAfterTransform(this.width,this.height,e),r=this.strokeWidth,o=this.strokeUniform,s=this.borderScaleFactor,a=n.x+r*(o?this.canvas.getZoom():e.scaleX)+s,h=n.y+r*(o?this.canvas.getZoom():e.scaleY)+s;return t.save(),this._setLineDash(t,i.borderDashArray||this.borderDashArray),t.strokeStyle=i.borderColor||this.borderColor,t.strokeRect(-a/2,-h/2,a,h),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,s){n=s.oCoords[o],r.getVisibility(s,o)&&(i&&(n=A.util.transformPoint(n,i)),r.render(t,n.x,n.y,e,s))})),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(){}})}(),A.util.object.extend(A.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return A.util.animate({target:this,startValue:t.left,endValue:this.getCenterPoint().x,duration:this.FX_DURATION,onChange:function(e){t.set("left",e),o.requestRenderAll(),r()},onComplete:function(){t.setCoords(),n()}})},fxCenterObjectV:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return A.util.animate({target:this,startValue:t.top,endValue:this.getCenterPoint().y,duration:this.FX_DURATION,onChange:function(e){t.set("top",e),o.requestRenderAll(),r()},onComplete:function(){t.setCoords(),n()}})},fxRemove:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return A.util.animate({target:this,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()}})}}),A.util.object.extend(A.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var t,e,i=[],n=[];for(t in arguments[0])i.push(t);for(var r=0,o=i.length;r<o;r++)t=i[r],e=r!==o-1,n.push(this._animate(t,arguments[0][t],arguments[1],e));return n}return this._animate.apply(this,arguments)},_animate:function(t,e,i,n){var r,o=this;e=e.toString(),i=i?A.util.object.clone(i):{},~t.indexOf(".")&&(r=t.split("."));var s=o.colorProperties.indexOf(t)>-1||r&&o.colorProperties.indexOf(r[1])>-1,a=r?this.get(r[0])[r[1]]:this.get(t);"from"in i||(i.from=a),s||(e=~e.indexOf("=")?a+parseFloat(e.replace("=","")):parseFloat(e));var h={target:this,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,s,a){r?o[r[0]][r[1]]=e:o.set(t,e),n||i.onChange&&i.onChange(e,s,a)},onComplete:function(t,e,r){n||(o.setCoords(),i.onComplete&&i.onComplete(t,e,r))}};return s?A.util.animateColor(h.startValue,h.endValue,h.duration,h):A.util.animate(h)}}),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,s=e.nearest,a=e.center,h=e.farthest;return function(){switch(this.get(i)){case s:return Math.min(this.get(n),this.get(r));case a:return Math.min(this.get(n),this.get(r))+.5*this.get(o);case h: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),s=[o.x1||0,o.y1||0,o.x2||0,o.y2||0];n(new e.Line(s,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=e.util.degreesToRadians;e.Circle?e.warn("fabric.Circle is already defined."):(e.Circle=e.util.createClass(e.Object,{type:"circle",radius:0,startAngle:0,endAngle:360,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)%360;if(0===n)t=["<circle ","COMMON_PARTS",'cx="0" cy="0" ','r="',this.radius,'" />\n'];else{var r=i(this.startAngle),o=i(this.endAngle),s=this.radius;t=['<path d="M '+e.util.cos(r)*s+" "+e.util.sin(r)*s," A "+s+" "+s," 0 ",+(n>180?"1":"0")+" 1"," "+e.util.cos(o)*s+" "+e.util.sin(o)*s,'" ',"COMMON_PARTS"," />\n"]}return t},_render:function(t){t.beginPath(),t.arc(0,0,this.radius,i(this.startAngle),i(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)}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,s=-this.height/2,a=0!==e||0!==i,h=.4477152502;t.beginPath(),t.moveTo(o+e,s),t.lineTo(o+n-e,s),a&&t.bezierCurveTo(o+n-h*e,s,o+n,s+h*i,o+n,s+i),t.lineTo(o+n,s+r-i),a&&t.bezierCurveTo(o+n,s+r-h*i,o+n-h*e,s+r,o+n-e,s+r),t.lineTo(o+e,s+r),a&&t.bezierCurveTo(o+h*e,s+r,o,s+r-h*i,o,s+r-i),t.lineTo(o,s+i),a&&t.bezierCurveTo(o,s+h*i,o+h*e,s,o+e,s),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 s=new e.Rect(i(r?e.util.object.clone(r):{},o));s.visible=s.visible&&s.width>0&&s.height>0,n(s)},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,s=e.util.projectStrokeOnPoints;e.Polyline?e.warn("fabric.Polyline is already defined"):(e.Polyline=e.util.createClass(e.Object,{type:"polyline",points:null,exactBoundingBox:!1,cacheProperties:e.Object.prototype.cacheProperties.concat("points"),initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper("initialize",e),this._setPositionDimensions(e)},_projectStrokeOnPoints:function(){return s(this.points,this,!0)},_setPositionDimensions:function(t){var e,i=this._calcDimensions(t),n=this.exactBoundingBox?this.strokeWidth:0;this.width=i.width-n,this.height=i.height-n,t.fromSVG||(e=this.translateToGivenOrigin({x:i.left-this.strokeWidth/2+n/2,y:i.top-this.strokeWidth/2+n/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+n/2,y:i.top+this.height/2+n/2}},_calcDimensions:function(){var t=this.exactBoundingBox?this._projectStrokeOnPoints():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,s=0,a=this.points.length;s<a;s++)t.push(o(this.points[s].x-i,r),",",o(this.points[s].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 s=e.parsePointsAttribute(n.getAttribute("points")),a=e.parseAttributes(n,e[t].ATTRIBUTE_NAMES);a.fromSVG=!0,r(new e[t](s,i(a,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={}),i=e.util.projectStrokeOnPoints;e.Polygon?e.warn("fabric.Polygon is already defined"):(e.Polygon=e.util.createClass(e.Polyline,{type:"polygon",_projectStrokeOnPoints:function(){return i(this.points,this)},_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=e.util.object.clone,s=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,e){delete(e=o(e||{})).path,this.callSuper("initialize",e),this._setPath(t||[],e)},_setPath:function(t,i){this.path=e.util.makePathSimpler(Array.isArray(t)?t:e.util.parsePath(t)),e.Polyline.prototype._setPositionDimensions.call(this,i||{})},_renderPathCommands:function(t){var e,i=0,n=0,r=0,o=0,s=0,a=0,h=-this.pathOffset.x,c=-this.pathOffset.y;t.beginPath();for(var l=0,u=this.path.length;l<u;++l)switch((e=this.path[l])[0]){case"L":r=e[1],o=e[2],t.lineTo(r+h,o+c);break;case"M":i=r=e[1],n=o=e[2],t.moveTo(r+h,o+c);break;case"C":r=e[5],o=e[6],s=e[3],a=e[4],t.bezierCurveTo(e[1]+h,e[2]+c,s+h,a+c,r+h,o+c);break;case"Q":t.quadraticCurveTo(e[1]+h,e[2]+c,e[3]+h,e[4]+c),r=e[3],o=e[4],s=e[1],a=e[2];break;case"z":case"Z":r=i,o=n,t.closePath()}},_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("+s(-this.pathOffset.x,t)+", "+s(-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=[],s=[],a=0,h=0,c=0,l=0,u=0,f=this.path.length;u<f;++u){switch((t=this.path[u])[0]){case"L":c=t[1],l=t[2],r=[];break;case"M":a=c=t[1],h=l=t[2],r=[];break;case"C":r=e.util.getBoundsOfCurve(c,l,t[1],t[2],t[3],t[4],t[5],t[6]),c=t[5],l=t[6];break;case"Q":r=e.util.getBoundsOfCurve(c,l,t[1],t[2],t[1],t[2],t[3],t[4]),c=t[3],l=t[4];break;case"z":case"Z":c=a,l=h}r.forEach((function(t){o.push(t.x),s.push(t.y)})),o.push(c),s.push(l)}var d=i(o)||0,p=i(s)||0;return{left:d,top:p,width:(n(o)||0)-d,height:(n(s)||0)-p}}}),e.Path.fromObject=function(t,i){if("string"==typeof t.sourcePath){var n=t.sourcePath;e.loadSVGFromURL(n,(function(n){var r=n[0];r.setOptions(t),t.clipPath?e.util.enlivenObjects([t.clipPath],(function(t){r.clipPath=t[0],i&&i(r)})):i&&i(r)}))}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(!0)},_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,this.clipPath)},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},destroy:function(){return this._objects.forEach((function(t){t.set("dirty",!0)})),this._restoreObjectsState()},dispose:function(){this.callSuper("dispose"),this.forEachObject((function(t){t.dispose&&t.dispose()})),this._objects=[]},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(!0)})),this},_calcBounds:function(t){for(var e,i,n,r,o=[],s=[],a=["tr","br","bl","tl"],h=0,c=this._objects.length,l=a.length;h<c;++h){for(n=(e=this._objects[h]).calcACoords(),r=0;r<l;r++)i=a[r],o.push(n[i].x),s.push(n[i].y);e.aCoords=n}this._getBounds(o,s,t)},_getBounds:function(t,r,o){var s=new e.Point(i(t),i(r)),a=new e.Point(n(t),n(r)),h=s.y||0,c=s.x||0,l=a.x-s.x||0,u=a.y-s.y||0;this.width=l,this.height=u,o||this.setPositionByOrigin({x:c,y:h},"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.enlivenObjectEnlivables(t,r,(function(){i&&i(new e.Group(n,r,!0))}))})):e.loadSVGFromURL(n,(function(o){var s=e.util.groupSVGElements(o,t,n),a=r.clipPath;delete r.clipPath,s.set(r),a?e.util.enlivenObjects([a],(function(t){s.clipPath=t[0],i&&i(s)})):i&&i(s)}))})}(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=A.util.object.extend;t.fabric||(t.fabric={}),t.fabric.Image?A.warn("fabric.Image is already defined."):(A.Image=A.util.createClass(A.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:A.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:A.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(t,e){e||(e={}),this.filters=[],this.cacheKey="texture"+A.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=A.filterBackend;e&&e.evictCachesForKey&&e.evictCachesForKey(t)},dispose:function(){this.callSuper("dispose"),this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(t){A.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,s="",a="";if(!n)return[];if(this.hasCrop()){var h=A.Object.__uid++;e.push('<clipPath id="imageCrop_'+h+'">\n','\t<rect x="'+r+'" y="'+o+'" width="'+this.width+'" height="'+this.height+'" />\n',"</clipPath>\n"),s=' clip-path="url(#imageCrop_'+h+')" '}if(this.imageSmoothing||(a='" 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,a,'"',s,"></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"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 A.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);A.filterBackend||(A.filterBackend=A.initFilterBackend());var s=A.util.createCanvasElement(),a=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,h=o.width,c=o.height;s.width=h,s.height=c,this._element=s,this._lastScaleX=t.scaleX=n,this._lastScaleY=t.scaleY=r,A.filterBackend.applyFilters([t],o,h,c,this._element,a),this._filterScalingX=s.width/this._originalElement.width,this._filterScalingY=s.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=A.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 A.filterBackend||(A.filterBackend=A.initFilterBackend()),A.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){A.util.setImageSmoothing(t,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)},drawCacheOnCanvas:function(t){A.util.setImageSmoothing(t,this.imageSmoothing),A.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,s=Math.min,a=Math.max,h=a(this.cropX,0),c=a(this.cropY,0),l=e.naturalWidth||e.width,u=e.naturalHeight||e.height,f=h*i,d=c*n,p=s(r*i,l-f),g=s(o*n,u-d),m=-r/2,v=-o/2,y=s(r,l/i-h),b=s(o,u/n-c);e&&t.drawImage(e,f,d,p,g,m,v,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(A.util.getById(t),e),A.util.addClass(this.getElement(),A.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t)},_initFilters:function(t,e){t&&t.length?A.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=A.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),i=this._element.width,n=this._element.height,r=1,o=1,s=0,a=0,h=0,c=0,l=this.width,u=this.height,f={width:l,height:u};return!e||"none"===e.alignX&&"none"===e.alignY?(r=l/i,o=u/n):("meet"===e.meetOrSlice&&(t=(l-i*(r=o=A.util.findScaleToFit(this._element,f)))/2,"Min"===e.alignX&&(s=-t),"Max"===e.alignX&&(s=t),t=(u-n*o)/2,"Min"===e.alignY&&(a=-t),"Max"===e.alignY&&(a=t)),"slice"===e.meetOrSlice&&(t=i-l/(r=o=A.util.findScaleToCover(this._element,f)),"Mid"===e.alignX&&(h=t/2),"Max"===e.alignX&&(h=t),t=n-u/o,"Mid"===e.alignY&&(c=t/2),"Max"===e.alignY&&(c=t),i=l/r,n=u/o)),{width:i,height:n,scaleX:r,scaleY:o,offsetLeft:s,offsetTop:a,cropX:h,cropY:c}}}),A.Image.CSS_CANVAS="canvas-img",A.Image.prototype.getSvgSrc=A.Image.prototype.getSrc,A.Image.fromObject=function(t,e){var i=A.util.object.clone(t);A.util.loadImage(i.src,(function(t,n){n?e&&e(null,!0):A.Image.prototype._initFilters.call(i,i.filters,(function(n){i.filters=n||[],A.Image.prototype._initFilters.call(i,[i.resizeFilter],(function(n){i.resizeFilter=n[0],A.util.enlivenObjectEnlivables(i,i,(function(){var n=new A.Image(t,i);e(n,!1)}))}))}))}),null,i.crossOrigin)},A.Image.fromURL=function(t,e,i){A.util.loadImage(t,(function(t,n){e&&e(new A.Image(t,i),n)}),null,i&&i.crossOrigin)},A.Image.ATTRIBUTE_NAMES=A.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),A.Image.fromElement=function(t,i,n){var r=A.parseAttributes(t,A.Image.ATTRIBUTE_NAMES);A.Image.fromURL(r["xlink:href"],i,e(n?A.util.object.clone(n):{},r))})}(e),A.util.object.extend(A.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())},fxStraighten:function(t){var e=function(){},i=(t=t||{}).onComplete||e,n=t.onChange||e,r=this;return A.util.animate({target:this,startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){r.rotate(t),n()},onComplete:function(){r.setCoords(),i()}})}}),A.util.object.extend(A.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.requestRenderAllBound})}}),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()}A.isWebglSupported=function(e){if(A.isLikelyNode)return!1;e=e||A.WebglFilterBackend.prototype.tileSize;var i=document.createElement("canvas"),n=i.getContext("webgl")||i.getContext("experimental-webgl"),r=!1;if(n){A.maxTextureSize=n.getParameter(n.MAX_TEXTURE_SIZE),r=A.maxTextureSize>=e;for(var o=["highp","mediump","lowp"],s=0;s<3;s++)if(t(n,o[s])){A.webGlPrecision=o[s];break}}return this.isSupported=r,r},A.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 s=A.util.createCanvasElement(),a=new ArrayBuffer(t*e*4);if(A.forceGLPutImageData)return this.imageBuffer=a,void(this.copyGLTo2D=T);var h,c,l={imageBuffer:a,destinationWidth:t,destinationHeight:e,targetCanvas:s};s.width=t,s.height=e,h=window.performance.now(),P.call(l,this.gl,l),c=window.performance.now()-h,h=window.performance.now(),T.call(l,this.gl,l),c>window.performance.now()-h?(this.imageBuffer=a,this.copyGLTo2D=T):this.copyGLTo2D=P}},createWebGLCanvas:function(t,e){var i=A.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 s,a=this.gl;o&&(s=this.getCachedTexture(o,e));var h={originalWidth:e.width||e.originalWidth,originalHeight:e.height||e.originalHeight,sourceWidth:i,sourceHeight:n,destinationWidth:i,destinationHeight:n,context:a,sourceTexture:this.createTexture(a,i,n,!s&&e),targetTexture:this.createTexture(a,i,n),originalTexture:s||this.createTexture(a,i,n,!s&&e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:r},c=a.createFramebuffer();return a.bindFramebuffer(a.FRAMEBUFFER,c),t.forEach((function(t){t&&t.applyTo(h)})),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)}(h),this.copyGLTo2D(a,h),a.bindTexture(a.TEXTURE_2D,null),a.deleteTexture(h.sourceTexture),a.deleteTexture(h.targetTexture),a.deleteFramebuffer(c),r.getContext("2d").setTransform(1,0,0,1,0,0),h},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(t,e,i,n,r){var o=t.createTexture();return t.bindTexture(t.TEXTURE_2D,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r||t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,r||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),o},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:P,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(){}A.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 s={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(s)})),s.imageData.width===i&&s.imageData.height===n||(r.width=s.imageData.width,r.height=s.imageData.height),o.putImageData(s.imageData,0,0),s}}}(),A.Image=A.Image||{},A.Image.filters=A.Image.filters||{},A.Image.filters.BaseFilter=A.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"!==A.webGlPrecision&&(e=e.replace(/precision highp float/g,"precision "+A.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 s=this.getAttributeLocations(t,o),a=this.getUniformLocations(t,o)||{};return a.uStepW=t.getUniformLocation(o,"uStepW"),a.uStepH=t.getUniformLocation(o,"uStepH"),{program:o,attributeLocations:s,uniformLocations:a}},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=A.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()}}),A.Image.filters.BaseFilter.fromObject=function(t,e){var i=new A.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,s=t.imageData.data,a=s.length,h=this.matrix,c=this.colorsOnly;for(o=0;o<a;o+=4)e=s[o],i=s[o+1],n=s[o+2],c?(s[o]=e*h[0]+i*h[1]+n*h[2]+255*h[4],s[o+1]=e*h[5]+i*h[6]+n*h[7]+255*h[9],s[o+2]=e*h[10]+i*h[11]+n*h[12]+255*h[14]):(r=s[o+3],s[o]=e*h[0]+i*h[1]+n*h[2]+r*h[3]+255*h[4],s[o+1]=e*h[5]+i*h[6]+n*h[7]+r*h[8]+255*h[9],s[o+2]=e*h[10]+i*h[11]+n*h[12]+r*h[13]+255*h[14],s[o+3]=e*h[15]+i*h[16]+n*h[17]+r*h[18]+255*h[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,s,a,h,c,l,u,f,d,p=t.imageData,g=p.data,m=this.matrix,v=Math.round(Math.sqrt(m.length)),y=Math.floor(v/2),b=p.width,w=p.height,x=t.ctx.createImageData(b,w),_=x.data,S=this.opaque?1:0;for(u=0;u<w;u++)for(l=0;l<b;l++){for(o=4*(u*b+l),e=0,i=0,n=0,r=0,d=0;d<v;d++)for(f=0;f<v;f++)s=l+f-y,(a=u+d-y)<0||a>=w||s<0||s>=b||(h=4*(a*b+s),c=m[d*v+f],e+=g[h]*c,i+=g[h+1]*c,n+=g[h+2]*c,S||(r+=g[h+3]*c));_[o]=e,_[o+1]=i,_[o+2]=n,_[o+3]=S?g[o+3]:r}t.imageData=x},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,s,a,h,c,l,u,f=t.imageData,d=f.data,p=f.height,g=f.width;for(i=0;i<p;i+=this.blocksize)for(n=0;n<g;n+=this.blocksize)for(r=d[e=4*i*g+4*n],o=d[e+1],s=d[e+2],a=d[e+3],l=Math.min(i+this.blocksize,p),u=Math.min(n+this.blocksize,g),h=i;h<l;h++)for(c=n;c<u;c++)d[e=4*h*g+4*c]=r,d[e+1]=o,d[e+2]=s,d[e+3]=a},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,s=t.imageData.data,a=255*this.distance,h=new e.Color(this.color).getSource(),c=[h[0]-a,h[1]-a,h[2]-a],l=[h[0]+a,h[1]+a,h[2]+a];for(i=0;i<s.length;i+=4)n=s[i],r=s[i+1],o=s[i+2],n>c[0]&&r>c[1]&&o>c[2]&&n<l[0]&&r<l[1]&&o<l[2]&&(s[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],s=[n[0]/255+r,n[1]/255+r,n[2]/255+r,1];t.uniform4fv(i.uLow,o),t.uniform4fv(i.uHigh,s)},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,s,a,h,c=t.imageData.data,l=c.length,u=1-this.alpha;i=(h=new e.Color(this.color).getSource())[0]*this.alpha,n=h[1]*this.alpha,r=h[2]*this.alpha;for(var f=0;f<l;f+=4)switch(o=c[f],s=c[f+1],a=c[f+2],this.mode){case"multiply":c[f]=o*i/255,c[f+1]=s*n/255,c[f+2]=a*r/255;break;case"screen":c[f]=255-(255-o)*(255-i)/255,c[f+1]=255-(255-s)*(255-n)/255,c[f+2]=255-(255-a)*(255-r)/255;break;case"add":c[f]=o+i,c[f+1]=s+n,c[f+2]=a+r;break;case"diff":case"difference":c[f]=Math.abs(o-i),c[f+1]=Math.abs(s-n),c[f+2]=Math.abs(a-r);break;case"subtract":c[f]=o-i,c[f+1]=s-n,c[f+2]=a-r;break;case"darken":c[f]=Math.min(o,i),c[f+1]=Math.min(s,n),c[f+2]=Math.min(a,r);break;case"lighten":c[f]=Math.max(o,i),c[f+1]=Math.max(s,n),c[f+2]=Math.max(a,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*s*n/255:255-2*(255-s)*(255-n)/255,c[f+2]=r<128?2*a*r/255:255-2*(255-a)*(255-r)/255;break;case"exclusion":c[f]=i+o-2*i*o/255,c[f+1]=n+s-2*n*s/255,c[f+2]=r+a-2*r*a/255;break;case"tint":c[f]=i+o*u,c[f+1]=n+s*u,c[f+2]=r+a*u}},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,s,a,h,c,l,u,f,d=t.imageData,p=t.filterBackend.resources,g=d.data,m=g.length,v=d.width,y=d.height,b=this.image;p.blendImage||(p.blendImage=e.util.createCanvasElement()),u=(l=p.blendImage).getContext("2d"),l.width!==v||l.height!==y?(l.width=v,l.height=y):u.clearRect(0,0,v,y),u.setTransform(b.scaleX,0,0,b.scaleY,b.left,b.top),u.drawImage(b._element,0,0,v,y),f=u.getImageData(0,0,v,y).data;for(var w=0;w<m;w+=4)switch(s=g[w],a=g[w+1],h=g[w+2],c=g[w+3],i=f[w],n=f[w+1],r=f[w+2],o=f[w+3],this.mode){case"multiply":g[w]=s*i/255,g[w+1]=a*n/255,g[w+2]=h*r/255,g[w+3]=c*o/255;break;case"mask":g[w+3]=o}},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,s=Math.round,a=Math.sin,h=Math.ceil,c=e.Image.filters,l=e.util.createClass;c.Resize=l(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 a(e)/e*a(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,a=e.height,h=s(o*i),c=s(a*n);"sliceHack"===this.resizeType?r=this.sliceByTwo(t,o,a,h,c):"hermite"===this.resizeType?r=this.hermiteFastResize(t,o,a,h,c):"bilinear"===this.resizeType?r=this.bilinearFiltering(t,o,a,h,c):"lanczos"===this.resizeType&&(r=this.lanczosResize(t,o,a,h,c)),t.imageData=r},sliceByTwo:function(t,i,r,o,s){var a,h,c=t.imageData,l=.5,u=!1,f=!1,d=i*l,p=r*l,g=e.filterBackend.resources,m=0,v=0,y=i,b=0;for(g.sliceByTwo||(g.sliceByTwo=document.createElement("canvas")),((a=g.sliceByTwo).width<1.5*i||a.height<r)&&(a.width=1.5*i,a.height=r),(h=a.getContext("2d")).clearRect(0,0,1.5*i,r),h.putImageData(c,0,0),o=n(o),s=n(s);!u||!f;)i=d,r=p,o<n(d*l)?d=n(d*l):(d=o,u=!0),s<n(p*l)?p=n(p*l):(p=s,f=!0),h.drawImage(a,m,v,i,r,y,b,d,p),m=y,v=b,b+=p;return h.getImageData(m,v,o,s)},lanczosResize:function(t,e,s,a,c){var l=t.imageData.data,u=t.ctx.createImageData(a,c),f=u.data,d=this.lanczosCreate(this.lanczosLobes),p=this.rcpScaleX,g=this.rcpScaleY,m=2/this.rcpScaleX,v=2/this.rcpScaleY,y=h(p*this.lanczosLobes/2),b=h(g*this.lanczosLobes/2),w={},x={},_={};return function t(h){var S,C,A,L,P,T,O,k,N,j,F;for(x.x=(h+.5)*p,_.x=n(x.x),S=0;S<c;S++){for(x.y=(S+.5)*g,_.y=n(x.y),P=0,T=0,O=0,k=0,N=0,C=_.x-y;C<=_.x+y;C++)if(!(C<0||C>=e)){j=n(1e3*o(C-x.x)),w[j]||(w[j]={});for(var E=_.y-b;E<=_.y+b;E++)E<0||E>=s||(F=n(1e3*o(E-x.y)),w[j][F]||(w[j][F]=d(r(i(j*m,2)+i(F*v,2))/1e3)),(A=w[j][F])>0&&(P+=A,T+=A*l[L=4*(E*e+C)],O+=A*l[L+1],k+=A*l[L+2],N+=A*l[L+3]))}f[L=4*(S*a+h)]=T/P,f[L+1]=O/P,f[L+2]=k/P,f[L+3]=N/P}return++h<a?t(h):u}(0)},bilinearFiltering:function(t,e,i,r,o){var s,a,h,c,l,u,f,d,p,g=0,m=this.rcpScaleX,v=this.rcpScaleY,y=4*(e-1),b=t.imageData.data,w=t.ctx.createImageData(r,o),x=w.data;for(h=0;h<o;h++)for(c=0;c<r;c++)for(l=m*c-(s=n(m*c)),u=v*h-(a=n(v*h)),p=4*(a*e+s),f=0;f<4;f++)d=b[p+f]*(1-l)*(1-u)+b[p+4+f]*l*(1-u)+b[p+y+f]*u*(1-l)+b[p+y+4+f]*l*u,x[g++]=d;return w},hermiteFastResize:function(t,e,i,s,a){for(var c=this.rcpScaleX,l=this.rcpScaleY,u=h(c/2),f=h(l/2),d=t.imageData.data,p=t.ctx.createImageData(s,a),g=p.data,m=0;m<a;m++)for(var v=0;v<s;v++){for(var y=4*(v+m*s),b=0,w=0,x=0,_=0,S=0,C=0,A=0,L=(m+.5)*l,P=n(m*l);P<(m+1)*l;P++)for(var T=o(L-(P+.5))/f,O=(v+.5)*c,k=T*T,N=n(v*c);N<(v+1)*c;N++){var j=o(O-(N+.5))/u,F=r(k+j*j);F>1&&F<-1||(b=2*F*F*F-3*F*F+1)>0&&(A+=b*d[3+(j=4*(N+P*e))],x+=b,d[j+3]<255&&(b=b*d[j+3]/250),_+=b*d[j],S+=b*d[j+1],C+=b*d[j+2],w+=b)}g[y]=_/w,g[y+1]=S/w,g[y+2]=C/w,g[y+3]=A/x}return p},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,s=o.length,a=-this.vibrance;for(e=0;e<s;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*a,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,s=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===s||(n.width=i.width=o,n.height=i.height=s);var a,h,c,l,u=i.getContext("2d"),f=n.getContext("2d"),d=.06*this.blur*.5;for(u.putImageData(t.imageData,0,0),f.clearRect(0,0,o,s),l=-15;l<=15;l++)c=d*(h=l/15)*o+(a=(Math.random()-.5)/4),f.globalAlpha=1-Math.abs(h),f.drawImage(i,c,a),u.drawImage(n,0,0),f.globalAlpha=1,f.clearRect(0,0,n.width,n.height);for(l=-15;l<=15;l++)c=d*(h=l/15)*s+(a=(Math.random()-.5)/4),f.globalAlpha=1-Math.abs(h),f.drawImage(i,a,c),u.drawImage(n,0,0),f.globalAlpha=1,f.clearRect(0,0,n.width,n.height);t.ctx.drawImage(i,0,0);var p=t.ctx.getImageData(0,0,i.width,i.height);return u.globalAlpha=1,u.clearRect(0,0,i.width,i.height),p},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],s=1/n[1],a=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,s),this.bVals[e]=255*Math.pow(e/255,a);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,s=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+s/3,this.matrix[1]=r*s-o,this.matrix[2]=r*s+o,this.matrix[5]=r*s+o,this.matrix[6]=i+r*s,this.matrix[7]=r*s-o,this.matrix[10]=r*s-o,this.matrix[11]=r*s+o,this.matrix[12]=i+r*s},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 pathAlign".split(" ");e.Text=e.util.createClass(e.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide","pathAlign"],_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",pathAlign:"baseline",_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,s,a=0,h=this._textLines.length;a<h;a++)if(("justify"===this.textAlign||a!==h-1&&!this.isEndOfWrapping(a))&&(n=0,r=this._textLines[a],(e=this.getLineWidth(a))<this.width&&(s=this.textLines[a].match(this._reSpacesAndTabs)))){i=s.length,t=(this.width-e)/i;for(var c=0,l=r.length;c<=l;c++)o=this.__charBounds[a][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){if(t.textBaseline="alphabetical",this.path)switch(this.pathAlign){case"center":t.textBaseline="middle";break;case"ascender":t.textBaseline="top";break;case"descender":t.textBaseline="bottom"}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,s,a,h=t.fillStyle,c=this._getLeftOffset(),l=this._getTopOffset(),u=0,f=0,d=this.path,p=0,g=this._textLines.length;p<g;p++)if(e=this.getHeightOfLine(p),this.textBackgroundColor||this.styleHas("textBackgroundColor",p)){n=this._textLines[p],i=this._getLineLeftOffset(p),f=0,u=0,r=this.getValueOfPropertyAt(p,0,"textBackgroundColor");for(var m=0,v=n.length;m<v;m++)o=this.__charBounds[p][m],s=this.getValueOfPropertyAt(p,m,"textBackgroundColor"),d?(t.save(),t.translate(o.renderLeft,o.renderTop),t.rotate(o.angle),t.fillStyle=s,s&&t.fillRect(-o.width/2,-e/this.lineHeight*(1-this._fontSizeFraction),o.width,e/this.lineHeight),t.restore()):s!==r?(a=c+i+u,"rtl"===this.direction&&(a=this.width-a-f),t.fillStyle=r,r&&t.fillRect(a,l,f,e/this.lineHeight),u=o.left,f=o.width,r=s):f+=o.kernedWidth;s&&!d&&(a=c+i+u,"rtl"===this.direction&&(a=this.width-a-f),t.fillStyle=s,t.fillRect(a,l,f,e/this.lineHeight)),l+=e}else l+=e;t.fillStyle=h,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,s,a,h=this.getFontCache(e),c=i+t,l=this._getFontDeclaration(e)===this._getFontDeclaration(n),u=e.fontSize/this.CACHE_FONT_SIZE;if(i&&void 0!==h[i]&&(s=h[i]),void 0!==h[t]&&(a=r=h[t]),l&&void 0!==h[c]&&(a=(o=h[c])-s),void 0===r||void 0===s||void 0===o){var f=this.getMeasuringContext();this._setTextStyles(f,e,!0)}return void 0===r&&(a=r=f.measureText(t).width,h[t]=r),void 0===s&&l&&i&&(s=f.measureText(i).width,h[i]=s),l&&void 0===o&&(o=f.measureText(c).width,h[c]=o,a=o-s),{width:r*u,kernedWidth:a*u}},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,s,a,h=0,c=this._textLines[t],l=new Array(c.length),u=0,f=this.path,d="right"===this.pathSide;for(this.__charBounds[t]=l,i=0;i<c.length;i++)n=c[i],o=this._getGraphemeBox(n,t,i,r),l[i]=o,h+=o.kernedWidth,r=n;if(l[i]={left:o?o.left+o.width:0,width:0,kernedWidth:0,height:this.fontSize},f){switch(a=f.segmentsInfo[f.segmentsInfo.length-1].length,(s=e.util.getPointOnPath(f.path,0,f.segmentsInfo)).x+=f.pathOffset.x,s.y+=f.pathOffset.y,this.textAlign){case"left":u=d?a-h:0;break;case"center":u=(a-h)/2;break;case"right":u=d?0:a-h}for(u+=this.pathStartOffset*(d?-1:1),i=d?c.length-1:0;d?i>=0:i<c.length;d?i--:i++)o=l[i],u>a?u%=a:u<0&&(u+=a),this._setGraphemeOnPath(u,o,s),u+=o.kernedWidth}return{width:h,numOfSpaces:0}},_setGraphemeOnPath:function(t,i,n){var r=t+i.kernedWidth/2,o=this.path,s=e.util.getPointOnPath(o.path,r,o.segmentsInfo);i.renderLeft=s.x-n.x,i.renderTop=s.y-n.y,i.angle=s.angle+("right"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(t,e,i,n,r){var o,s=this.getCompleteStyleDeclaration(e,i),a=n?this.getCompleteStyleDeclaration(e,i-1):{},h=this._measureChar(t,s,n,a),c=h.kernedWidth,l=h.width;0!==this.charSpacing&&(l+=o=this._getWidthOfCharSpacing(),c+=o);var u={width:l,left:0,height:s.fontSize,kernedWidth:c,deltaY:s.deltaY};if(i>0&&!r){var f=this.__charBounds[e][i-1];u.left=f.left+f.width+h.kernedWidth-h.width}return u},getHeightOfLine:function(t){if(this.__lineHeights[t])return this.__lineHeights[t];for(var e=this._textLines[t],i=this.getHeightOfChar(t,0),n=1,r=e.length;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,s=this._textLines.length;o<s;o++){var a=this.getHeightOfLine(o),h=a/this.lineHeight,c=this._getLineLeftOffset(o);this._renderTextLine(e,t,this._textLines[o],n+c,r+i+h,o),i+=a}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,i,n,r,o,s){var a,h,c,l,u,f=this.getHeightOfLine(s),d=-1!==this.textAlign.indexOf("justify"),p="",g=0,m=this.path,v=!d&&0===this.charSpacing&&this.isEmptyStyles(s)&&!m,y="ltr"===this.direction,b="ltr"===this.direction?1:-1,w=i.canvas.getAttribute("dir");if(i.save(),w!==this.direction&&(i.canvas.setAttribute("dir",y?"ltr":"rtl"),i.direction=y?"ltr":"rtl",i.textAlign=y?"left":"right"),o-=f*this._fontSizeFraction/this.lineHeight,v)return this._renderChar(t,i,s,0,n.join(""),r,o,f),void i.restore();for(var x=0,_=n.length-1;x<=_;x++)l=x===_||this.charSpacing||m,p+=n[x],c=this.__charBounds[s][x],0===g?(r+=b*(c.kernedWidth-c.width),g+=c.width):g+=c.kernedWidth,d&&!l&&this._reSpaceAndTab.test(n[x])&&(l=!0),l||(a=a||this.getCompleteStyleDeclaration(s,x),h=this.getCompleteStyleDeclaration(s,x+1),l=e.util.hasStyleChanged(a,h,!1)),l&&(m?(i.save(),i.translate(c.renderLeft,c.renderTop),i.rotate(c.angle),this._renderChar(t,i,s,x,p,-g/2,0,f),i.restore()):(u=r,this._renderChar(t,i,s,x,p,u,o,f)),p="",a=h,r+=b*g,g=0);i.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,s){var a,h,c=this._getStyleDeclaration(i,n),l=this.getCompleteStyleDeclaration(i,n),u="fillText"===t&&l.fill,f="strokeText"===t&&l.stroke&&l.strokeWidth;(f||u)&&(e.save(),u&&(a=this._setFillStyles(e,l)),f&&(h=this._setStrokeStyles(e,l)),e.font=this._getFontDeclaration(l),c&&c.textBackgroundColor&&this._removeShadow(e),c&&c.deltaY&&(s+=c.deltaY),u&&e.fillText(r,o-a.offsetX,s-a.offsetY),f&&e.strokeText(r,o-h.offsetX,s-h.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"),s={fontSize:r*i.size,deltaY:o+r*i.baseline};return this.setSelectionStyles(s,t,e),this},_getLineLeftOffset:function(t){var e=this.getLineWidth(t),i=this.width-e,n=this.textAlign,r=this.direction,o=0,s=this.isEndOfWrapping(t);return"justify"===n||"justify-center"===n&&!s||"justify-right"===n&&!s||"justify-left"===n&&!s?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){if(void 0!==this.__lineWidths[t])return this.__lineWidths[t];var e=this.measureLine(t).width;return this.__lineWidths[t]=e,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,s,a,h,c,l,u,f,d,p,g,m,v,y=this._getLeftOffset(),b=this._getTopOffset(),w=this.path,x=this._getWidthOfCharSpacing(),_=this.offsets[e],S=0,C=this._textLines.length;S<C;S++)if(i=this.getHeightOfLine(S),this[e]||this.styleHas(e,S)){h=this._textLines[S],g=i/this.lineHeight,o=this._getLineLeftOffset(S),u=0,f=0,c=this.getValueOfPropertyAt(S,0,e),v=this.getValueOfPropertyAt(S,0,"fill"),l=b+g*(1-this._fontSizeFraction),n=this.getHeightOfChar(S,0),s=this.getValueOfPropertyAt(S,0,"deltaY");for(var A=0,L=h.length;A<L;A++)if(d=this.__charBounds[S][A],p=this.getValueOfPropertyAt(S,A,e),m=this.getValueOfPropertyAt(S,A,"fill"),r=this.getHeightOfChar(S,A),a=this.getValueOfPropertyAt(S,A,"deltaY"),w&&p&&m)t.save(),t.fillStyle=v,t.translate(d.renderLeft,d.renderTop),t.rotate(d.angle),t.fillRect(-d.kernedWidth/2,_*r+a,d.kernedWidth,this.fontSize/15),t.restore();else if((p!==c||m!==v||r!==n||a!==s)&&f>0){var P=y+o+u;"rtl"===this.direction&&(P=this.width-P-f),c&&v&&(t.fillStyle=v,t.fillRect(P,l+_*n+s,f,this.fontSize/15)),u=d.left,f=d.width,c=p,v=m,n=r,s=a}else f+=d.kernedWidth;P=y+o+u,"rtl"===this.direction&&(P=this.width-P-f),t.fillStyle=m,p&&m&&t.fillRect(P,l+_*n+s,f-x,this.fontSize/15),b+=i}else b+=i;this._removeShadow(t)}},_getFontDeclaration:function(t,i){var n=t||this,r=this.fontFamily,o=e.Text.genericFonts.indexOf(r.toLowerCase())>-1,s=void 0===r||r.indexOf("'")>-1||r.indexOf(",")>-1||r.indexOf('"')>-1||o?n.fontFamily:'"'+n.fontFamily+'"';return[e.isLikelyNode?n.fontWeight:n.fontStyle,e.isLikelyNode?n.fontStyle:n.fontWeight,i?this.CACHE_FONT_SIZE+"px":n.fontSize+"px",s].join(" ")},render:function(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",t)))},_splitTextIntoLines:function(t){for(var i=t.split(this._reNewline),n=new Array(i.length),r=["\n"],o=[],s=0;s<i.length;s++)n[s]=e.util.string.graphemeSplit(i[s]),o=o.concat(n[s],r);return o.pop(),{_unwrappedLines:n,lines:i,graphemeText:o,graphemeLines:n}},toObject:function(t){var i=n.concat(t),r=this.callSuper("toObject",i);return r.styles=e.util.stylesToArray(this.styles,this.text),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),s=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 a=o.textDecoration;-1!==a.indexOf("underline")&&(r.underline=!0),-1!==a.indexOf("overline")&&(r.overline=!0),-1!==a.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 h="";"textContent"in t?h=t.textContent:"firstChild"in t&&null!==t.firstChild&&"data"in t.firstChild&&null!==t.firstChild.data&&(h=t.firstChild.data),h=h.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var c=r.strokeWidth;r.strokeWidth=0;var l=new e.Text(h,r),u=l.getScaledHeight()/l.height,f=((l.height+l.strokeWidth)*l.lineHeight-l.height)*u,d=l.getScaledHeight()+f,p=0;"center"===s&&(p=l.getScaledWidth()/2),"right"===s&&(p=l.getScaledWidth()),l.set({left:l.left-p,top:l.top-(d-l.fontSize*(.07+l._fontSizeFraction))/l.lineHeight,strokeWidth:void 0!==c?c:1}),n(l)},e.Text.fromObject=function(t,n){var r=i(t),o=t.path;return delete r.path,e.Object._fromObject("Text",r,(function(i){i.styles=e.util.stylesFromArray(t.styles,t.text),o?e.Object._fromObject("Path",o,(function(t){i.set("path",t),n(i)}),"path"):n(i)}),"text")},e.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],e.util.createAccessors&&e.util.createAccessors(e.Text)}}(e),A.util.object.extend(A.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,s=0;for(var a in n){for(var h in e=0,n[a]){var c;r++,(c=n[a][h]).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[a][h]}0===e&&delete n[a]}for(var l=0;l<this._textLines.length;l++)s+=this._textLines[l].length;o&&r===s&&(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,{}),A.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)}A.IText=A.util.createClass(A.Text,A.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,s=0,a=this.get2DCursorLocation(t);n=a.charIndex,i=a.lineIndex;for(var h=0;h<i;h++)o+=this.getHeightOfLine(h);e=this._getLineLeftOffset(i);var c=this.__charBounds[i][n];return c&&(s=c.left),0!==this.charSpacing&&n===this._textLines[i].length&&(s-=this._getWidthOfCharSpacing()),r={top:o,left:e+(s>0?s: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"),s=this.scaleX*this.canvas.getZoom(),a=this.cursorWidth/s,h=t.topOffset,c=this.getValueOfPropertyAt(n,r,"deltaY");h+=(1-this._fontSizeFraction)*this.getHeightOfLine(n)/this.lineHeight-o*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(t,e),e.fillStyle=this.cursorColor||this.getValueOfPropertyAt(n,r,"fill"),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+t.leftOffset-a/2,h+t.top+c,a,o)},renderSelection:function(t,e){for(var i=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,n=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,r=-1!==this.textAlign.indexOf("justify"),o=this.get2DCursorLocation(i),s=this.get2DCursorLocation(n),a=o.lineIndex,h=s.lineIndex,c=o.charIndex<0?0:o.charIndex,l=s.charIndex<0?0:s.charIndex,u=a;u<=h;u++){var f,d=this._getLineLeftOffset(u)||0,p=this.getHeightOfLine(u),g=0,m=0;if(u===a&&(g=this.__charBounds[a][c].left),u>=a&&u<h)m=r&&!this.isEndOfWrapping(u)?this.width:this.getLineWidth(u)||5;else if(u===h)if(0===l)m=this.__charBounds[h][l].left;else{var v=this._getWidthOfCharSpacing();m=this.__charBounds[h][l-1].left+this.__charBounds[h][l-1].width-v}f=p,(this.lineHeight<1||u===h&&this.lineHeight>1)&&(p/=this.lineHeight);var y=t.left+d+g,b=m-g,w=p,x=0;this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",w=1,x=p):e.fillStyle=this.selectionColor,"rtl"===this.direction&&(y=this.width-y-b),e.fillRect(y,t.top+t.topOffset+x,b,w),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}}}),A.IText.fromObject=function(e,i){var n=A.util.stylesFromArray(e.styles,e.text),r=Object.assign({},e,{styles:n});if(t(r),r.styles)for(var o in r.styles)for(var s in r.styles[o])t(r.styles[o][s]);A.Object._fromObject("IText",r,i,"text")}}(),_=A.util.object.clone,A.util.object.extend(A.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||[],A.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=A.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){document.activeElement!==this.hiddenTextarea&&this.hiddenTextarea.focus();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=A.util.string.graphemeSplit(n).length;if(t===e)return{selectionStart:r,selectionEnd:r};var o=i.slice(t,e);return{selectionStart:r,selectionEnd:r+A.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,s=e.leftOffset,a=this.calcTransformMatrix(),h={x:e.left+s,y:e.top+e.topOffset+o},c=this.canvas.getRetinaScaling(),l=this.canvas.upperCanvasEl,u=l.width/c,f=l.height/c,d=u-o,p=f-o,g=l.clientWidth/u,m=l.clientHeight/f;return h=A.util.transformPoint(h,a),(h=A.util.transformPoint(h,this.canvas.viewportTransform)).x*=g,h.y*=m,h.x<0&&(h.x=0),h.x>d&&(h.x=d),h.y<0&&(h.y=0),h.y>p&&(h.y=p),h.x+=this.canvas._offset.left,h.y+=this.canvas._offset.top,{left:h.x+"px",top:h.y+"px",fontSize:o+"px",charHeight:o}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var t=this._textBeforeEdit!==this.text,e=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,e&&(e.blur&&e.blur(),e.parentNode&&e.parentNode.removeChild(e)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),t&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var t in this.styles)this._textLines[t]||delete this.styles[t]},removeStyleFromTo:function(t,e){var i,n,r=this.get2DCursorLocation(t,!0),o=this.get2DCursorLocation(e,!0),s=r.lineIndex,a=r.charIndex,h=o.lineIndex,c=o.charIndex;if(s!==h){if(this.styles[s])for(i=a;i<this._unwrappedTextLines[s].length;i++)delete this.styles[s][i];if(this.styles[h])for(i=c;i<this._unwrappedTextLines[h].length;i++)(n=this.styles[h][i])&&(this.styles[s]||(this.styles[s]={}),this.styles[s][a+i-c]=n);for(i=s+1;i<=h;i++)delete this.styles[i];this.shiftLineStyles(h,s-h)}else if(this.styles[s]){n=this.styles[s];var l,u,f=c-a;for(i=a;i<c;i++)delete n[i];for(u in this.styles[s])(l=parseInt(u,10))>=c&&(n[l-f]=n[u],delete n[u])}},shiftLineStyles:function(t,e){var 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={},s=!1,a=this._unwrappedTextLines[t].length===e;for(var h 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(h,10);c>=e&&(s=!0,o[c-e]=this.styles[t][h],a&&0===e||delete this.styles[t][h])}var l=!1;for(s&&!a&&(this.styles[t+i]=o,l=!0),l&&i--;i>0;)n&&n[i-1]?this.styles[t+i]={0:_(n[i-1])}:r?this.styles[t+i]={0:_(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?_(r):{};for(var s in i||(i=1),o){var a=parseInt(s,10);a>=e&&(r[a+i]=o[a],o[a-i]||delete r[a])}if(this._forceClearCache=!0,n)for(;i--;)Object.keys(n[i]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][e+i]=_(n[i]));else if(r)for(var h=r[e?e-1:1];h&&i--;)this.styles[t][e+i]=_(h)},insertNewStyleBlock:function(t,e,i){for(var n=this.get2DCursorLocation(e,!0),r=[0],o=0,s=0;s<t.length;s++)"\n"===t[s]?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),s=1;s<o;s++)r[s]>0?this.insertCharStyleObject(n.lineIndex+s,0,r[s],i):i&&this.styles[n.lineIndex+s]&&i[0]&&(this.styles[n.lineIndex+s][0]=i[0]),i=i&&i.slice(r[s]+1);r[s]>0&&this.insertCharStyleObject(n.lineIndex+s,0,r[s],i)},setSelectionStartEndWithShift:function(t,e,i){i<=t?(e===t?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=t),this.selectionStart=i):i>t&&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)}}),A.util.object.extend(A.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(t){if(this.canvas){this.__newClickTime=+new Date;var e=t.pointer;this.isTripleClick(e)&&(this.fire("tripleclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(t){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(t.e))},tripleClickHandler:function(t){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(t.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(t.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(t){if(this.__isMousedown=!1,!(!this.editable||this.group||t.transform&&t.transform.actionPerformed||t.e.button&&1!==t.e.button)){if(this.canvas){var e=this.canvas._activeObject;if(e&&e!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(t.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t),i=this.selectionStart,n=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(i,n,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(t){for(var e,i=this.getLocalPointer(t),n=0,r=0,o=0,s=0,a=0,h=0,c=this._textLines.length;h<c&&o<=i.y;h++)o+=this.getHeightOfLine(h)*this.scaleY,a=h,h>0&&(s+=this._textLines[h-1].length+this.missingNewlineOffset(h-1));r=this._getLineLeftOffset(a)*this.scaleX,e=this._textLines[a],"rtl"===this.direction&&(i.x=this.width*this.scaleX-i.x+r);for(var l=0,u=e.length;l<u&&(n=r,(r+=this.__charBounds[a][l].kernedWidth*this.scaleX)<=i.x);l++)s++;return this._getNewSelectionStartFromOffset(i,n,r,s,u)},_getNewSelectionStartFromOffset:function(t,e,i,n,r){var o=t.x-e,s=i-t.x,a=n+(s>o||s<0?0:1);return this.flipX&&(a=r-a),a>this._text.length&&(a=this._text.length),a}}),A.util.object.extend(A.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=A.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):A.document.body.appendChild(this.hiddenTextarea),A.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),A.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),A.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),A.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),A.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),A.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),A.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),A.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),A.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(A.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,s,a=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,h=this._text.length,c=a.length,l=c-h,u=this.selectionStart,f=this.selectionEnd,d=u!==f;if(""===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire("changed"),void(this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll()));var p=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),g=u>p.selectionStart;d?(i=this._text.slice(u,f),l+=f-u):c<h&&(i=g?this._text.slice(f+l,f):this._text.slice(u,u-l)),n=a.slice(p.selectionEnd-l,p.selectionEnd),i&&i.length&&(n.length&&(r=this.getSelectionStyles(u,u+1,!1),r=n.map((function(){return r[0]}))),d?(o=u,s=f):g?(o=f-i.length,s=f):(o=f,s=f+i.length),this.removeStyleFromTo(o,s)),n.length&&(e&&n.join("")===A.copiedText&&!A.disableStyleCopyPaste&&(r=A.copiedTextStyle),this.insertNewStyleBlock(n,u,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&&(A.copiedText=this.getSelectedText(),A.disableStyleCopyPaste?A.copiedTextStyle=null:A.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(t){return t&&t.clipboardData||A.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,s=this._getWidthBeforeCursor(r,o),a=this._getIndexOnLine(r+1,s);return this._textLines[r].slice(o).length+a+1+this.missingNewlineOffset(r)},_getSelectionForOffset:function(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),n=this.get2DCursorLocation(i),r=n.lineIndex;if(0===r||t.metaKey||33===t.keyCode)return-i;var o=n.charIndex,s=this._getWidthBeforeCursor(r,o),a=this._getIndexOnLine(r-1,s),h=this._textLines[r].slice(0,o),c=this.missingNewlineOffset(r-1);return-this._textLines[r-1].length+a-h.length+(1-c)},_getIndexOnLine:function(t,e){for(var i,n,r=this._textLines[t],o=this._getLineLeftOffset(t),s=0,a=0,h=r.length;a<h;a++)if((o+=i=this.__charBounds[t][a].width)>e){n=!0;var c=o-i,l=o,u=Math.abs(c-e);s=Math.abs(l-e)<u?a:a-1;break}return n||(s=r.length-1),s},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!==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=A.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=A.util.toFixed,C=/ +/g,A.util.object.extend(A.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 s=0,a=this._textLines.length;s<a;s++)i=this._getLineLeftOffset(s),(this.textBackgroundColor||this.styleHas("textBackgroundColor",s))&&this._setSVGTextLineBg(r,s,e+i,o),this._setSVGTextLineText(n,s,e+i,o),o+=this.getHeightOfLine(s);return{textSpans:n,textBgRects:r}},_createTextCharSpan:function(t,e,i,n){var r=t!==t.trim()||t.match(C),o=this.getSvgSpanStyles(e,r),s=o?'style="'+o+'"':"",a=e.deltaY,h="",c=A.Object.NUM_FRACTION_DIGITS;return a&&(h=' dy="'+S(a,c)+'" '),['<tspan x="',S(i,c),'" y="',S(n,c),'" ',h,s,">",A.util.string.escapeXml(t),"</tspan>"].join("")},_setSVGTextLineText:function(t,e,i,n){var r,o,s,a,h,c=this.getHeightOfLine(e),l=-1!==this.textAlign.indexOf("justify"),u="",f=0,d=this._textLines[e];n+=c*(1-this._fontSizeFraction)/this.lineHeight;for(var p=0,g=d.length-1;p<=g;p++)h=p===g||this.charSpacing,u+=d[p],s=this.__charBounds[e][p],0===f?(i+=s.kernedWidth-s.width,f+=s.width):f+=s.kernedWidth,l&&!h&&this._reSpaceAndTab.test(d[p])&&(h=!0),h||(r=r||this.getCompleteStyleDeclaration(e,p),o=this.getCompleteStyleDeclaration(e,p+1),h=A.util.hasStyleChanged(r,o,!0)),h&&(a=this._getStyleDeclaration(e,p)||{},t.push(this._createTextCharSpan(u,a,i,n)),u="",r=o,i+=f,f=0)},_pushTextBgRect:function(t,e,i,n,r,o){var s=A.Object.NUM_FRACTION_DIGITS;t.push("\t\t<rect ",this._getFillAttributes(e),' x="',S(i,s),'" y="',S(n,s),'" width="',S(r,s),'" height="',S(o,s),'"></rect>\n')},_setSVGTextLineBg:function(t,e,i,n){for(var r,o,s=this._textLines[e],a=this.getHeightOfLine(e)/this.lineHeight,h=0,c=0,l=this.getValueOfPropertyAt(e,0,"textBackgroundColor"),u=0,f=s.length;u<f;u++)r=this.__charBounds[e][u],(o=this.getValueOfPropertyAt(e,u,"textBackgroundColor"))!==l?(l&&this._pushTextBgRect(t,l,i+c,n,h,a),c=r.left,h=r.width,l=o):h+=r.kernedWidth;o&&this._pushTextBgRect(t,o,i+c,n,h,a)},_getFillAttributes:function(t){var e=t&&"string"==typeof t?new A.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 A.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],s=this._styleMap[t+1];for(var a in o&&(t=o.line,n=o.offset),s&&(r=s.line===t,e=s.offset),i=void 0===t?this.styles:{line:this.styles[t]})for(var h in i[a])if(h>=n&&(!r||h<e))for(var c in i[a][h])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,s=t.length;o<s;o++)r+=this._getGraphemeBox(t[o],e,o+i,n,!0).kernedWidth,n=t[o];return r},_wrapLine:function(t,i,n,r){var o=0,s=this.splitByGrapheme,a=[],h=[],c=s?e.util.string.graphemeSplit(t):t.split(this._wordJoiners),l="",u=0,f=s?"":" ",d=0,p=0,g=0,m=!0,v=this._getWidthOfCharSpacing();r=r||0,0===c.length&&c.push([]),n-=r;for(var y=0;y<c.length;y++)l=s?c[y]:e.util.string.graphemeSplit(c[y]),d=this._measureWord(l,i,u),u+=l.length,(o+=p+d-v)>n&&!m?(a.push(h),h=[],o=d,m=!0):o+=v,m||s||h.push(f),h=h.concat(l),p=s?0:this._measureWord([f],i,u),u++,m=!1,d>g&&(g=d);return y&&a.push(h),g+r>this.dynamicMinWidth&&(this.dynamicMinWidth=g-v+r),a},isEndOfWrapping:function(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line},missingNewlineOffset:function(t){return this.splitByGrapheme?this.isEndOfWrapping(t)?1:0:1},_splitTextIntoLines:function(t){for(var i=e.Text.prototype._splitTextIntoLines.call(this,t),n=this._wrapText(i.lines,this.width),r=new Array(n.length),o=0;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){var n=e.util.stylesFromArray(t.styles,t.text),r=Object.assign({},t,{styles:n});return e.Object._fromObject("Textbox",r,i,"text")}}(e),function(){var t=A.controlsUtils,e=t.scaleSkewCursorStyleHandler,i=t.scaleCursorStyleHandler,n=t.scalingEqually,r=t.scalingYOrSkewingX,o=t.scalingXOrSkewingY,s=t.scaleOrSkewActionName,a=A.Object.prototype.controls;if(a.ml=new A.Control({x:-.5,y:0,cursorStyleHandler:e,actionHandler:o,getActionName:s}),a.mr=new A.Control({x:.5,y:0,cursorStyleHandler:e,actionHandler:o,getActionName:s}),a.mb=new A.Control({x:0,y:.5,cursorStyleHandler:e,actionHandler:r,getActionName:s}),a.mt=new A.Control({x:0,y:-.5,cursorStyleHandler:e,actionHandler:r,getActionName:s}),a.tl=new A.Control({x:-.5,y:-.5,cursorStyleHandler:i,actionHandler:n}),a.tr=new A.Control({x:.5,y:-.5,cursorStyleHandler:i,actionHandler:n}),a.bl=new A.Control({x:-.5,y:.5,cursorStyleHandler:i,actionHandler:n}),a.br=new A.Control({x:.5,y:.5,cursorStyleHandler:i,actionHandler:n}),a.mtr=new A.Control({x:0,y:-.5,actionHandler:t.rotationWithSnapping,cursorStyleHandler:t.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),A.Textbox){var h=A.Textbox.prototype.controls={};h.mtr=a.mtr,h.tr=a.tr,h.br=a.br,h.tl=a.tl,h.bl=a.bl,h.mt=a.mt,h.mb=a.mb,h.mr=new A.Control({x:.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"}),h.ml=new A.Control({x:-.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"})}}()},3162:function(t,e,i){var n,r;void 0===(r="function"==typeof(n=function(){"use strict";function e(t,e,i){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){a(n.response,e,i)},n.onerror=function(){console.error("could not download file")},n.send()}function n(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function r(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(i){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof i.g&&i.g.global===i.g?i.g:void 0,s=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!s?function(t,i,s){var a=o.URL||o.webkitURL,h=document.createElement("a");i=i||t.name||"download",h.download=i,h.rel="noopener","string"==typeof t?(h.href=t,h.origin===location.origin?r(h):n(h.href)?e(t,i,s):r(h,h.target="_blank")):(h.href=a.createObjectURL(t),setTimeout((function(){a.revokeObjectURL(h.href)}),4e4),setTimeout((function(){r(h)}),0))}:"msSaveOrOpenBlob"in navigator?function(t,i,o){if(i=i||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}(t,o),i);else if(n(t))e(t,i,o);else{var s=document.createElement("a");s.href=t,s.target="_blank",setTimeout((function(){r(s)}))}}:function(t,i,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof t)return e(t,i,n);var a="application/octet-stream"===t.type,h=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||a&&h||s)&&"undefined"!=typeof FileReader){var l=new FileReader;l.onloadend=function(){var t=l.result;t=c?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=t:location=t,r=null},l.readAsDataURL(t)}else{var u=o.URL||o.webkitURL,f=u.createObjectURL(t);r?r.location=f:location.href=f,r=null,setTimeout((function(){u.revokeObjectURL(f)}),4e4)}});o.saveAs=a.saveAs=a,t.exports=a})?n.apply(e,[]):n)||(t.exports=r)},4245:()=>{!function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){t.exports=i(1)},function(t,e){var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options={overlayBackgroundColor:"#666666",overlayOpacity:.6,spinnerIcon:"ball-circus",spinnerColor:"#000",spinnerSize:"3x",overlayIDName:"overlay",spinnerIDName:"spinner",offsetY:0,offsetX:0,lockScroll:!1,containerID:null,spinnerZIndex:99999,overlayZIndex:99998},this.stylesheetBaseURL="https://cdn.jsdelivr.net/npm/load-awesome@1.1.0/css/",this.spinner=null,this.spinnerStylesheetURL=null,this.numberOfEmptyDivForSpinner={"ball-8bits":16,"ball-atom":4,"ball-beat":3,"ball-circus":5,"ball-climbing-dot":1,"ball-clip-rotate":1,"ball-clip-rotate-multiple":2,"ball-clip-rotate-pulse":2,"ball-elastic-dots":5,"ball-fall":3,"ball-fussion":4,"ball-grid-beat":9,"ball-grid-pulse":9,"ball-newton-cradle":4,"ball-pulse":3,"ball-pulse-rise":5,"ball-pulse-sync":3,"ball-rotate":1,"ball-running-dots":5,"ball-scale":1,"ball-scale-multiple":3,"ball-scale-pulse":2,"ball-scale-ripple":1,"ball-scale-ripple-multiple":3,"ball-spin":8,"ball-spin-clockwise":8,"ball-spin-clockwise-fade":8,"ball-spin-clockwise-fade-rotating":8,"ball-spin-fade":8,"ball-spin-fade-rotating":8,"ball-spin-rotate":2,"ball-square-clockwise-spin":8,"ball-square-spin":8,"ball-triangle-path":3,"ball-zig-zag":2,"ball-zig-zag-deflect":2,cog:1,"cube-transition":2,fire:3,"line-scale":5,"line-scale-party":5,"line-scale-pulse-out":5,"line-scale-pulse-out-rapid":5,"line-spin-clockwise-fade":8,"line-spin-clockwise-fade-rotating":8,"line-spin-fade":8,"line-spin-fade-rotating":8,pacman:6,"square-jelly-box":2,"square-loader":1,"square-spin":1,timer:1,"triangle-skew-spin":1}}var e;return(e=[{key:"show",value:function(t){this.setOptions(t),this.addSpinnerStylesheet(),this.generateSpinnerElement(),this.options.lockScroll&&(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden"),this.generateAndAddOverlayElement()}},{key:"hide",value:function(){this.options.lockScroll&&(document.body.style.overflow="",document.documentElement.style.overflow="");var t=document.getElementById("loading-overlay-stylesheet");t&&(t.disabled=!0,t.parentNode.removeChild(t),document.getElementById(this.options.overlayIDName).remove(),document.getElementById(this.options.spinnerIDName).remove())}},{key:"setOptions",value:function(t){if(void 0!==t)for(var e in t)this.options[e]=t[e]}},{key:"generateAndAddOverlayElement",value:function(){var t="50%";0!==this.options.offsetX&&(t="calc(50% + "+this.options.offsetX+")");var e="50%";if(0!==this.options.offsetY&&(e="calc(50% + "+this.options.offsetY+")"),this.options.containerID&&document.body.contains(document.getElementById(this.options.containerID))){var i='<div id="'.concat(this.options.overlayIDName,'" style="display: block !important; position: absolute; top: 0; left: 0; overflow: auto; opacity: ').concat(this.options.overlayOpacity,"; background: ").concat(this.options.overlayBackgroundColor,'; z-index: 50; width: 100%; height: 100%;"></div><div id="').concat(this.options.spinnerIDName,'" style="display: block !important; position: absolute; top: ').concat(e,"; left: ").concat(t,'; -webkit-transform: translate(-50%); -ms-transform: translate(-50%); transform: translate(-50%); z-index: 9999;">').concat(this.spinner,"</div>"),n=document.getElementById(this.options.containerID);return n.style.position="relative",void n.insertAdjacentHTML("beforeend",i)}var r='<div id="'.concat(this.options.overlayIDName,'" style="display: block !important; position: fixed; top: 0; left: 0; overflow: auto; opacity: ').concat(this.options.overlayOpacity,"; background: ").concat(this.options.overlayBackgroundColor,"; z-index: ").concat(this.options.overlayZIndex,'; width: 100%; height: 100%;"></div><div id="').concat(this.options.spinnerIDName,'" style="display: block !important; position: fixed; top: ').concat(e,"; left: ").concat(t,"; -webkit-transform: translate(-50%); -ms-transform: translate(-50%); transform: translate(-50%); z-index: ").concat(this.options.spinnerZIndex,';">').concat(this.spinner,"</div>");document.body.insertAdjacentHTML("beforeend",r)}},{key:"generateSpinnerElement",value:function(){var t=this,e=Object.keys(this.numberOfEmptyDivForSpinner).find((function(e){return e===t.options.spinnerIcon})),i=this.generateEmptyDivElement(this.numberOfEmptyDivForSpinner[e]);this.spinner='<div style="color: '.concat(this.options.spinnerColor,'" class="la-').concat(this.options.spinnerIcon," la-").concat(this.options.spinnerSize,'">').concat(i,"</div>")}},{key:"addSpinnerStylesheet",value:function(){this.setSpinnerStylesheetURL();var t=document.createElement("link");t.setAttribute("id","loading-overlay-stylesheet"),t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",this.spinnerStylesheetURL),document.getElementsByTagName("head")[0].appendChild(t)}},{key:"setSpinnerStylesheetURL",value:function(){this.spinnerStylesheetURL=this.stylesheetBaseURL+this.options.spinnerIcon+".min.css"}},{key:"generateEmptyDivElement",value:function(t){for(var e="",i=1;i<=t;i++)e+="<div></div>";return e}}])&&function(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}();window.JsLoadingOverlay=new i,t.exports=JsLoadingOverlay}])},1168:(t,e,i)=>{"use strict";i.r(e),i.d(e,{AcroForm:()=>ye,AcroFormAppearance:()=>pe,AcroFormButton:()=>ae,AcroFormCheckBox:()=>ue,AcroFormChoiceField:()=>ne,AcroFormComboBox:()=>oe,AcroFormEditBox:()=>se,AcroFormListBox:()=>re,AcroFormPasswordField:()=>de,AcroFormPushButton:()=>he,AcroFormRadioButton:()=>ce,AcroFormTextField:()=>fe,GState:()=>At,ShadingPattern:()=>Pt,TilingPattern:()=>Tt,default:()=>gi,jsPDF:()=>Ot});var n=i(1002),r=Uint8Array,o=Uint16Array,s=Uint32Array,a=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),h=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(t,e){for(var i=new o(31),n=0;n<31;++n)i[n]=e+=1<<t[n-1];var r=new s(i[30]);for(n=1;n<30;++n)for(var a=i[n];a<i[n+1];++a)r[a]=a-i[n]<<5|n;return[i,r]},u=l(a,2),f=u[0],d=u[1];f[28]=258,d[258]=28;for(var p=l(h,0),g=p[0],m=p[1],v=new o(32768),y=0;y<32768;++y){var b=(43690&y)>>>1|(21845&y)<<1;b=(61680&(b=(52428&b)>>>2|(13107&b)<<2))>>>4|(3855&b)<<4,v[y]=((65280&b)>>>8|(255&b)<<8)>>>1}var w=function(t,e,i){for(var n=t.length,r=0,s=new o(e);r<n;++r)++s[t[r]-1];var a,h=new o(e);for(r=0;r<e;++r)h[r]=h[r-1]+s[r-1]<<1;if(i){a=new o(1<<e);var c=15-e;for(r=0;r<n;++r)if(t[r])for(var l=r<<4|t[r],u=e-t[r],f=h[t[r]-1]++<<u,d=f|(1<<u)-1;f<=d;++f)a[v[f]>>>c]=l}else for(a=new o(n),r=0;r<n;++r)a[r]=v[h[t[r]-1]++]>>>15-t[r];return a},x=new r(288);for(y=0;y<144;++y)x[y]=8;for(y=144;y<256;++y)x[y]=9;for(y=256;y<280;++y)x[y]=7;for(y=280;y<288;++y)x[y]=8;var _=new r(32);for(y=0;y<32;++y)_[y]=5;var S=w(x,9,0),C=w(x,9,1),A=w(_,5,0),L=w(_,5,1),P=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},T=function(t,e,i){var n=e/8>>0;return(t[n]|t[n+1]<<8)>>>(7&e)&i},O=function(t,e){var i=e/8>>0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>>(7&e)},k=function(t){return(t/8>>0)+(7&t&&1)},N=function(t,e,i){(null==e||e<0)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof o?o:t instanceof s?s:r)(i-e);return n.set(t.subarray(e,i)),n},j=function(t,e,i){var n=t.length,o=!e||i,s=!i||i.i;i||(i={}),e||(e=new r(3*n));var l=function(t){var i=e.length;if(t>i){var n=new r(Math.max(2*i,t));n.set(e),e=n}},u=i.f||0,d=i.p||0,p=i.b||0,m=i.l,v=i.d,y=i.m,b=i.n,x=8*n;do{if(!m){i.f=u=T(t,d,1);var _=T(t,d+1,3);if(d+=3,!_){var S=t[(q=k(d)+4)-4]|t[q-3]<<8,A=q+S;if(A>n){if(s)throw"unexpected EOF";break}o&&l(p+S),e.set(t.subarray(q,A),p),i.b=p+=S,i.p=d=8*A;continue}if(1==_)m=C,v=L,y=9,b=5;else{if(2!=_)throw"invalid block type";var j=T(t,d,31)+257,F=T(t,d+10,15)+4,E=j+T(t,d+5,31)+1;d+=14;for(var I=new r(E),M=new r(19),D=0;D<F;++D)M[c[D]]=T(t,d+3*D,7);d+=3*F;var B=P(M),R=(1<<B)-1;if(!s&&d+E*(B+7)>x)break;var z=w(M,B,1);for(D=0;D<E;){var q,U=z[T(t,d,R)];if(d+=15&U,(q=U>>>4)<16)I[D++]=q;else{var W=0,H=0;for(16==q?(H=3+T(t,d,3),d+=2,W=I[D-1]):17==q?(H=3+T(t,d,7),d+=3):18==q&&(H=11+T(t,d,127),d+=7);H--;)I[D++]=W}}var V=I.subarray(0,j),G=I.subarray(j);y=P(V),b=P(G),m=w(V,y,1),v=w(G,b,1)}if(d>x)throw"unexpected EOF"}o&&l(p+131072);for(var X=(1<<y)-1,Y=(1<<b)-1,K=y+b+18;s||d+K<x;){var J=(W=m[O(t,d)&X])>>>4;if((d+=15&W)>x)throw"unexpected EOF";if(!W)throw"invalid length/literal";if(J<256)e[p++]=J;else{if(256==J){m=null;break}var Z=J-254;if(J>264){var $=a[D=J-257];Z=T(t,d,(1<<$)-1)+f[D],d+=$}var Q=v[O(t,d)&Y],tt=Q>>>4;if(!Q)throw"invalid distance";if(d+=15&Q,G=g[tt],tt>3&&($=h[tt],G+=O(t,d)&(1<<$)-1,d+=$),d>x)throw"unexpected EOF";o&&l(p+131072);for(var et=p+Z;p<et;p+=4)e[p]=e[p-G],e[p+1]=e[p+1-G],e[p+2]=e[p+2-G],e[p+3]=e[p+3-G];p=et}}i.l=m,i.p=d,i.b=p,m&&(u=1,i.m=y,i.d=v,i.n=b)}while(!u);return p==e.length?e:N(e,0,p)},F=function(t,e,i){i<<=7&e;var n=e/8>>0;t[n]|=i,t[n+1]|=i>>>8},E=function(t,e,i){i<<=7&e;var n=e/8>>0;t[n]|=i,t[n+1]|=i>>>8,t[n+2]|=i>>>16},I=function(t,e){for(var i=[],n=0;n<t.length;++n)t[n]&&i.push({s:n,f:t[n]});var s=i.length,a=i.slice();if(!s)return[new r(0),0];if(1==s){var h=new r(i[0].s+1);return h[i[0].s]=1,[h,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var c=i[0],l=i[1],u=0,f=1,d=2;for(i[0]={s:-1,f:c.f+l.f,l:c,r:l};f!=s-1;)c=i[i[u].f<i[d].f?u++:d++],l=i[u!=f&&i[u].f<i[d].f?u++:d++],i[f++]={s:-1,f:c.f+l.f,l:c,r:l};var p=a[0].s;for(n=1;n<s;++n)a[n].s>p&&(p=a[n].s);var g=new o(p+1),m=M(i[f-1],g,0);if(m>e){n=0;var v=0,y=m-e,b=1<<y;for(a.sort((function(t,e){return g[e.s]-g[t.s]||t.f-e.f}));n<s;++n){var w=a[n].s;if(!(g[w]>e))break;v+=b-(1<<m-g[w]),g[w]=e}for(v>>>=y;v>0;){var x=a[n].s;g[x]<e?v-=1<<e-g[x]++-1:++n}for(;n>=0&&v;--n){var _=a[n].s;g[_]==e&&(--g[_],++v)}m=e}return[new r(g),m]},M=function(t,e,i){return-1==t.s?Math.max(M(t.l,e,i+1),M(t.r,e,i+1)):e[t.s]=i},D=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new o(++e),n=0,r=t[0],s=1,a=function(t){i[n++]=t},h=1;h<=e;++h)if(t[h]==r&&h!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(r),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(r);s=1,r=t[h]}return[i.subarray(0,n),e]},B=function(t,e){for(var i=0,n=0;n<e.length;++n)i+=t[n]*e[n];return i},R=function(t,e,i){var n=i.length,r=k(e+2);t[r]=255&n,t[r+1]=n>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var o=0;o<n;++o)t[r+o+4]=i[o];return 8*(r+4+n)},z=function(t,e,i,n,r,s,l,u,f,d,p){F(e,p++,i),++r[256];for(var g=I(r,15),m=g[0],v=g[1],y=I(s,15),b=y[0],C=y[1],L=D(m),P=L[0],T=L[1],O=D(b),k=O[0],N=O[1],j=new o(19),M=0;M<P.length;++M)j[31&P[M]]++;for(M=0;M<k.length;++M)j[31&k[M]]++;for(var z=I(j,7),q=z[0],U=z[1],W=19;W>4&&!q[c[W-1]];--W);var H,V,G,X,Y=d+5<<3,K=B(r,x)+B(s,_)+l,J=B(r,m)+B(s,b)+l+14+3*W+B(j,q)+(2*j[16]+3*j[17]+7*j[18]);if(Y<=K&&Y<=J)return R(e,p,t.subarray(f,f+d));if(F(e,p,1+(J<K)),p+=2,J<K){H=w(m,v,0),V=m,G=w(b,C,0),X=b;var Z=w(q,U,0);for(F(e,p,T-257),F(e,p+5,N-1),F(e,p+10,W-4),p+=14,M=0;M<W;++M)F(e,p+3*M,q[c[M]]);p+=3*W;for(var $=[P,k],Q=0;Q<2;++Q){var tt=$[Q];for(M=0;M<tt.length;++M){var et=31&tt[M];F(e,p,Z[et]),p+=q[et],et>15&&(F(e,p,tt[M]>>>5&127),p+=tt[M]>>>12)}}}else H=S,V=x,G=A,X=_;for(M=0;M<u;++M)if(n[M]>255){et=n[M]>>>18&31,E(e,p,H[et+257]),p+=V[et+257],et>7&&(F(e,p,n[M]>>>23&31),p+=a[et]);var it=31&n[M];E(e,p,G[it]),p+=X[it],it>3&&(E(e,p,n[M]>>>5&8191),p+=h[it])}else E(e,p,H[n[M]]),p+=V[n[M]];return E(e,p,H[256]),p+V[256]},q=new s([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),U=new r(0),W=function(){var t=1,e=0;return{p:function(i){for(var n=t,r=e,o=i.length,s=0;s!=o;){for(var a=Math.min(s+5552,o);s<a;++s)r+=n+=i[s];n%=65521,r%=65521}t=n,e=r},d:function(){return(t>>>8<<16|(255&e)<<8|e>>>8)+2*((255&t)<<23)}}},H=function(t,e,i,n,c){return function(t,e,i,n,c,l){var u=t.length,f=new r(n+u+5*(1+Math.floor(u/7e3))+c),p=f.subarray(n,f.length-c),g=0;if(!e||u<8)for(var v=0;v<=u;v+=65535){var y=v+65535;y<u?g=R(p,g,t.subarray(v,y)):(p[v]=l,g=R(p,g,t.subarray(v,u)))}else{for(var b=q[e-1],w=b>>>13,x=8191&b,_=(1<<i)-1,S=new o(32768),C=new o(_+1),A=Math.ceil(i/3),L=2*A,P=function(e){return(t[e]^t[e+1]<<A^t[e+2]<<L)&_},T=new s(25e3),O=new o(288),j=new o(32),F=0,E=0,I=(v=0,0),M=0,D=0;v<u;++v){var B=P(v),W=32767&v,H=C[B];if(S[W]=H,C[B]=W,M<=v){var V=u-v;if((F>7e3||I>24576)&&V>423){g=z(t,p,0,T,O,j,E,I,D,v-D,g),I=F=E=0,D=v;for(var G=0;G<286;++G)O[G]=0;for(G=0;G<30;++G)j[G]=0}var X=2,Y=0,K=x,J=W-H&32767;if(V>2&&B==P(v-J))for(var Z=Math.min(w,V)-1,$=Math.min(32767,v),Q=Math.min(258,V);J<=$&&--K&&W!=H;){if(t[v+X]==t[v+X-J]){for(var tt=0;tt<Q&&t[v+tt]==t[v+tt-J];++tt);if(tt>X){if(X=tt,Y=J,tt>Z)break;var et=Math.min(J,tt-2),it=0;for(G=0;G<et;++G){var nt=v-J+G+32768&32767,rt=nt-S[nt]+32768&32767;rt>it&&(it=rt,H=nt)}}}J+=(W=H)-(H=S[W])+32768&32767}if(Y){T[I++]=268435456|d[X]<<18|m[Y];var ot=31&d[X],st=31&m[Y];E+=a[ot]+h[st],++O[257+ot],++j[st],M=v+X,++F}else T[I++]=t[v],++O[t[v]]}}g=z(t,p,l,T,O,j,E,I,D,v-D,g),l||(g=R(p,g,U))}return N(f,0,n+k(g)+c)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,i,n,!c)},V=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8},G=function(t,e){var i=e.level,n=0==i?0:i<6?1:9==i?3:2;t[0]=120,t[1]=n<<6|(n?32-2*n:1)},X=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function Y(t,e){void 0===e&&(e={});var i=W();i.p(t);var n=H(t,e,2,4);return G(n,e),V(n,n.length-4,i.d()),n}var K=i(2702),J=function(){return"undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self?self:this}();function Z(){J.console&&"function"==typeof J.console.log&&J.console.log.apply(J.console,arguments)}var $={log:Z,warn:function(t){J.console&&("function"==typeof J.console.warn?J.console.warn.apply(J.console,arguments):Z.call(null,arguments))},error:function(t){J.console&&("function"==typeof J.console.error?J.console.error.apply(J.console,arguments):Z(t))}};function Q(t,e,i){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){rt(n.response,e,i)},n.onerror=function(){$.error("could not download file")},n.send()}function tt(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return e.status>=200&&e.status<=299}function et(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(i){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var it,nt,rt=J.saveAs||("object"!==("undefined"==typeof window?"undefined":(0,n.Z)(window))||window!==J?function(){}:"undefined"!=typeof HTMLAnchorElement&&"download"in HTMLAnchorElement.prototype?function(t,e,i){var n=J.URL||J.webkitURL,r=document.createElement("a");e=e||t.name||"download",r.download=e,r.rel="noopener","string"==typeof t?(r.href=t,r.origin!==location.origin?tt(r.href)?Q(t,e,i):et(r,r.target="_blank"):et(r)):(r.href=n.createObjectURL(t),setTimeout((function(){n.revokeObjectURL(r.href)}),4e4),setTimeout((function(){et(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(t,e,i){if(e=e||t.name||"download","string"==typeof t)if(tt(t))Q(t,e,i);else{var r=document.createElement("a");r.href=t,r.target="_blank",setTimeout((function(){et(r)}))}else navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:!1}:"object"!==(0,n.Z)(e)&&($.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t}(t,i),e)}:function(t,e,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof t)return Q(t,e,i);var o="application/octet-stream"===t.type,s=/constructor/i.test(J.HTMLElement)||J.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||o&&s)&&"object"===("undefined"==typeof FileReader?"undefined":(0,n.Z)(FileReader))){var h=new FileReader;h.onloadend=function(){var t=h.result;t=a?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=t:location=t,r=null},h.readAsDataURL(t)}else{var c=J.URL||J.webkitURL,l=c.createObjectURL(t);r?r.location=l:location.href=l,r=null,setTimeout((function(){c.revokeObjectURL(l)}),4e4)}});function ot(t){var e;t=t||"",this.ok=!1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t={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",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"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",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",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:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",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",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[t=(t=t.replace(/ /g,"")).toLowerCase()]||t;for(var i=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],n=0;n<i.length;n++){var r=i[n].re,o=i[n].process,s=r.exec(t);s&&(e=o(s),this.r=e[0],this.g=e[1],this.b=e[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i}}function st(t,e){var i=t[0],n=t[1],r=t[2],o=t[3];i=ht(i,n,r,o,e[0],7,-680876936),o=ht(o,i,n,r,e[1],12,-389564586),r=ht(r,o,i,n,e[2],17,606105819),n=ht(n,r,o,i,e[3],22,-1044525330),i=ht(i,n,r,o,e[4],7,-176418897),o=ht(o,i,n,r,e[5],12,1200080426),r=ht(r,o,i,n,e[6],17,-1473231341),n=ht(n,r,o,i,e[7],22,-45705983),i=ht(i,n,r,o,e[8],7,1770035416),o=ht(o,i,n,r,e[9],12,-1958414417),r=ht(r,o,i,n,e[10],17,-42063),n=ht(n,r,o,i,e[11],22,-1990404162),i=ht(i,n,r,o,e[12],7,1804603682),o=ht(o,i,n,r,e[13],12,-40341101),r=ht(r,o,i,n,e[14],17,-1502002290),i=ct(i,n=ht(n,r,o,i,e[15],22,1236535329),r,o,e[1],5,-165796510),o=ct(o,i,n,r,e[6],9,-1069501632),r=ct(r,o,i,n,e[11],14,643717713),n=ct(n,r,o,i,e[0],20,-373897302),i=ct(i,n,r,o,e[5],5,-701558691),o=ct(o,i,n,r,e[10],9,38016083),r=ct(r,o,i,n,e[15],14,-660478335),n=ct(n,r,o,i,e[4],20,-405537848),i=ct(i,n,r,o,e[9],5,568446438),o=ct(o,i,n,r,e[14],9,-1019803690),r=ct(r,o,i,n,e[3],14,-187363961),n=ct(n,r,o,i,e[8],20,1163531501),i=ct(i,n,r,o,e[13],5,-1444681467),o=ct(o,i,n,r,e[2],9,-51403784),r=ct(r,o,i,n,e[7],14,1735328473),i=lt(i,n=ct(n,r,o,i,e[12],20,-1926607734),r,o,e[5],4,-378558),o=lt(o,i,n,r,e[8],11,-2022574463),r=lt(r,o,i,n,e[11],16,1839030562),n=lt(n,r,o,i,e[14],23,-35309556),i=lt(i,n,r,o,e[1],4,-1530992060),o=lt(o,i,n,r,e[4],11,1272893353),r=lt(r,o,i,n,e[7],16,-155497632),n=lt(n,r,o,i,e[10],23,-1094730640),i=lt(i,n,r,o,e[13],4,681279174),o=lt(o,i,n,r,e[0],11,-358537222),r=lt(r,o,i,n,e[3],16,-722521979),n=lt(n,r,o,i,e[6],23,76029189),i=lt(i,n,r,o,e[9],4,-640364487),o=lt(o,i,n,r,e[12],11,-421815835),r=lt(r,o,i,n,e[15],16,530742520),i=ut(i,n=lt(n,r,o,i,e[2],23,-995338651),r,o,e[0],6,-198630844),o=ut(o,i,n,r,e[7],10,1126891415),r=ut(r,o,i,n,e[14],15,-1416354905),n=ut(n,r,o,i,e[5],21,-57434055),i=ut(i,n,r,o,e[12],6,1700485571),o=ut(o,i,n,r,e[3],10,-1894986606),r=ut(r,o,i,n,e[10],15,-1051523),n=ut(n,r,o,i,e[1],21,-2054922799),i=ut(i,n,r,o,e[8],6,1873313359),o=ut(o,i,n,r,e[15],10,-30611744),r=ut(r,o,i,n,e[6],15,-1560198380),n=ut(n,r,o,i,e[13],21,1309151649),i=ut(i,n,r,o,e[4],6,-145523070),o=ut(o,i,n,r,e[11],10,-1120210379),r=ut(r,o,i,n,e[2],15,718787259),n=ut(n,r,o,i,e[9],21,-343485551),t[0]=bt(i,t[0]),t[1]=bt(n,t[1]),t[2]=bt(r,t[2]),t[3]=bt(o,t[3])}function at(t,e,i,n,r,o){return e=bt(bt(e,t),bt(n,o)),bt(e<<r|e>>>32-r,i)}function ht(t,e,i,n,r,o,s){return at(e&i|~e&n,t,e,r,o,s)}function ct(t,e,i,n,r,o,s){return at(e&n|i&~n,t,e,r,o,s)}function lt(t,e,i,n,r,o,s){return at(e^i^n,t,e,r,o,s)}function ut(t,e,i,n,r,o,s){return at(i^(e|~n),t,e,r,o,s)}function ft(t){var e,i=t.length,n=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=t.length;e+=64)st(n,dt(t.substring(e-64,e)));t=t.substring(e-64);var r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<t.length;e++)r[e>>2]|=t.charCodeAt(e)<<(e%4<<3);if(r[e>>2]|=128<<(e%4<<3),e>55)for(st(n,r),e=0;e<16;e++)r[e]=0;return r[14]=8*i,st(n,r),n}function dt(t){var e,i=[];for(e=0;e<64;e+=4)i[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return i}it=J.atob.bind(J),nt=J.btoa.bind(J);var pt="0123456789abcdef".split("");function gt(t){for(var e="",i=0;i<4;i++)e+=pt[t>>8*i+4&15]+pt[t>>8*i&15];return e}function mt(t){return String.fromCharCode((255&t)>>0,(65280&t)>>8,(16711680&t)>>16,(4278190080&t)>>24)}function vt(t){return ft(t).map(mt).join("")}var yt="5d41402abc4b2a76b9719d911017c592"!=function(t){for(var e=0;e<t.length;e++)t[e]=gt(t[e]);return t.join("")}(ft("hello"));function bt(t,e){if(yt){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}return t+e&4294967295}function wt(t,e){var i,n,r,o;if(t!==i){for(var s=(r=t,o=1+(256/t.length>>0),new Array(o+1).join(r)),a=[],h=0;h<256;h++)a[h]=h;var c=0;for(h=0;h<256;h++){var l=a[h];c=(c+l+s.charCodeAt(h))%256,a[h]=a[c],a[c]=l}i=t,n=a}else a=n;var u=e.length,f=0,d=0,p="";for(h=0;h<u;h++)d=(d+(l=a[f=(f+1)%256]))%256,a[f]=a[d],a[d]=l,s=a[(a[f]+a[d])%256],p+=String.fromCharCode(e.charCodeAt(h)^s);return p}var xt={print:4,modify:8,copy:16,"annot-forms":32};function _t(t,e,i,n){this.v=1,this.r=2;var r=192;t.forEach((function(t){if(void 0!==xt.perm)throw new Error("Invalid permission: "+t);r+=xt[t]})),this.padding="(¿N^NuAd\0NVÿú\b..\0¶Ðh>/\f©þdSiz";var o=(e+this.padding).substr(0,32),s=(i+this.padding).substr(0,32);this.O=this.processOwnerPassword(o,s),this.P=-(1+(255^r)),this.encryptionKey=vt(o+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(n)).substr(0,5),this.U=wt(this.encryptionKey,this.padding)}function St(t){if(/[^\u0000-\u00ff]/.test(t))throw new Error("Invalid PDF Name Object: "+t+", Only accept ASCII characters.");for(var e="",i=t.length,n=0;n<i;n++){var r=t.charCodeAt(n);e+=r<33||35===r||37===r||40===r||41===r||47===r||60===r||62===r||91===r||93===r||123===r||125===r||r>126?"#"+("0"+r.toString(16)).slice(-2):t[n]}return e}function Ct(t){if("object"!==(0,n.Z)(t))throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var e={};this.subscribe=function(t,i,n){if(n=n||!1,"string"!=typeof t||"function"!=typeof i||"boolean"!=typeof n)throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");e.hasOwnProperty(t)||(e[t]={});var r=Math.random().toString(35);return e[t][r]=[i,!!n],r},this.unsubscribe=function(t){for(var i in e)if(e[i][t])return delete e[i][t],0===Object.keys(e[i]).length&&delete e[i],!0;return!1},this.publish=function(i){if(e.hasOwnProperty(i)){var n=Array.prototype.slice.call(arguments,1),r=[];for(var o in e[i]){var s=e[i][o];try{s[0].apply(t,n)}catch(i){J.console&&$.error("jsPDF PubSub Error",i.message,i)}s[1]&&r.push(o)}r.length&&r.forEach(this.unsubscribe)}},this.getTopics=function(){return e}}function At(t){if(!(this instanceof At))return new At(t);var e="opacity,stroke-opacity".split(",");for(var i in t)t.hasOwnProperty(i)&&e.indexOf(i)>=0&&(this[i]=t[i]);this.id="",this.objectNumber=-1}function Lt(t,e){this.gState=t,this.matrix=e,this.id="",this.objectNumber=-1}function Pt(t,e,i,n,r){if(!(this instanceof Pt))return new Pt(t,e,i,n,r);this.type="axial"===t?2:3,this.coords=e,this.colors=i,Lt.call(this,n,r)}function Tt(t,e,i,n,r){if(!(this instanceof Tt))return new Tt(t,e,i,n,r);this.boundingBox=t,this.xStep=e,this.yStep=i,this.stream="",this.cloneIndex=0,Lt.call(this,n,r)}function Ot(t){var e,i="string"==typeof arguments[0]?arguments[0]:"p",r=arguments[1],o=arguments[2],s=arguments[3],a=[],h=1,c=16,l="S",u=null;"object"===(0,n.Z)(t=t||{})&&(i=t.orientation,r=t.unit||r,o=t.format||o,s=t.compress||t.compressPdf||s,null!==(u=t.encryption||null)&&(u.userPassword=u.userPassword||"",u.ownerPassword=u.ownerPassword||"",u.userPermissions=u.userPermissions||[]),h="number"==typeof t.userUnit?Math.abs(t.userUnit):1,void 0!==t.precision&&(e=t.precision),void 0!==t.floatPrecision&&(c=t.floatPrecision),l=t.defaultPathOperation||"S"),a=t.filters||(!0===s?["FlateEncode"]:a),r=r||"mm",i=(""+(i||"P")).toLowerCase();var f=t.putOnlyUsedFonts||!1,d={},p={internal:{},__private__:{}};p.__private__.PubSub=Ct;var g="1.3",m=p.__private__.getPdfVersion=function(){return g};p.__private__.setPdfVersion=function(t){g=t};var v={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};p.__private__.getPageFormats=function(){return v};var y=p.__private__.getPageFormat=function(t){return v[t]};o=o||"a4";var b={COMPAT:"compat",ADVANCED:"advanced"},w=b.COMPAT;function x(){this.saveGraphicsState(),tt(new Ht(yt,0,0,-yt,0,xi()*yt).toString()+" cm"),this.setFontSize(this.getFontSize()/yt),l="n",w=b.ADVANCED}function _(){this.restoreGraphicsState(),l="S",w=b.COMPAT}var S=p.__private__.combineFontStyleAndFontWeight=function(t,e){if("bold"==t&&"normal"==e||"bold"==t&&400==e||"normal"==t&&"italic"==e||"bold"==t&&"italic"==e)throw new Error("Invalid Combination of fontweight and fontstyle");return e&&(t=400==e||"normal"===e?"italic"===t?"italic":"normal":700!=e&&"bold"!==e||"normal"!==t?(700==e?"bold":e)+""+t:"bold"),t};p.advancedAPI=function(t){var e=w===b.COMPAT;return e&&x.call(this),"function"!=typeof t||(t(this),e&&_.call(this)),this},p.compatAPI=function(t){var e=w===b.ADVANCED;return e&&_.call(this),"function"!=typeof t||(t(this),e&&x.call(this)),this},p.isAdvancedAPI=function(){return w===b.ADVANCED};var C,A=function(t){if(w!==b.ADVANCED)throw new Error(t+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},L=p.roundToPrecision=p.__private__.roundToPrecision=function(t,i){var n=e||i;if(isNaN(t)||isNaN(n))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return t.toFixed(n).replace(/0+$/,"")};C=p.hpf=p.__private__.hpf="number"==typeof c?function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.hpf");return L(t,c)}:"smart"===c?function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.hpf");return L(t,t>-1&&t<1?16:5)}:function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.hpf");return L(t,16)};var P=p.f2=p.__private__.f2=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.f2");return L(t,2)},T=p.__private__.f3=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.f3");return L(t,3)},O=p.scale=p.__private__.scale=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.scale");return w===b.COMPAT?t*yt:w===b.ADVANCED?t:void 0},k=function(t){return O(function(t){return w===b.COMPAT?xi()-t:w===b.ADVANCED?t:void 0}(t))};p.__private__.setPrecision=p.setPrecision=function(t){"number"==typeof parseInt(t,10)&&(e=parseInt(t,10))};var N,j="00000000000000000000000000000000",F=p.__private__.getFileId=function(){return j},E=p.__private__.setFileId=function(t){return j=void 0!==t&&/^[a-fA-F0-9]{32}$/.test(t)?t.toUpperCase():j.split("").map((function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))})).join(""),null!==u&&(Ne=new _t(u.userPermissions,u.userPassword,u.ownerPassword,j)),j};p.setFileId=function(t){return E(t),this},p.getFileId=function(){return F()};var I=p.__private__.convertDateToPDFDate=function(t){var e=t.getTimezoneOffset(),i=e<0?"+":"-",n=Math.floor(Math.abs(e/60)),r=Math.abs(e%60),o=[i,z(n),"'",z(r),"'"].join("");return["D:",t.getFullYear(),z(t.getMonth()+1),z(t.getDate()),z(t.getHours()),z(t.getMinutes()),z(t.getSeconds()),o].join("")},M=p.__private__.convertPDFDateToDate=function(t){var e=parseInt(t.substr(2,4),10),i=parseInt(t.substr(6,2),10)-1,n=parseInt(t.substr(8,2),10),r=parseInt(t.substr(10,2),10),o=parseInt(t.substr(12,2),10),s=parseInt(t.substr(14,2),10);return new Date(e,i,n,r,o,s,0)},D=p.__private__.setCreationDate=function(t){var e;if(void 0===t&&(t=new Date),t instanceof Date)e=I(t);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(t))throw new Error("Invalid argument passed to jsPDF.setCreationDate");e=t}return N=e},B=p.__private__.getCreationDate=function(t){var e=N;return"jsDate"===t&&(e=M(N)),e};p.setCreationDate=function(t){return D(t),this},p.getCreationDate=function(t){return B(t)};var R,z=p.__private__.padd2=function(t){return("0"+parseInt(t)).slice(-2)},q=p.__private__.padd2Hex=function(t){return("00"+(t=t.toString())).substr(t.length)},U=0,W=[],H=[],V=0,G=[],X=[],Y=!1,Z=H;p.__private__.setCustomOutputDestination=function(t){Y=!0,Z=t};var Q=function(t){Y||(Z=t)};p.__private__.resetCustomOutputDestination=function(){Y=!1,Z=H};var tt=p.__private__.out=function(t){return t=t.toString(),V+=t.length+1,Z.push(t),Z},et=p.__private__.write=function(t){return tt(1===arguments.length?t.toString():Array.prototype.join.call(arguments," "))},it=p.__private__.getArrayBuffer=function(t){for(var e=t.length,i=new ArrayBuffer(e),n=new Uint8Array(i);e--;)n[e]=t.charCodeAt(e);return i},st=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];p.__private__.getStandardFonts=function(){return st};var at=t.fontSize||16;p.__private__.setFontSize=p.setFontSize=function(t){return at=w===b.ADVANCED?t/yt:t,this};var ht,ct=p.__private__.getFontSize=p.getFontSize=function(){return w===b.COMPAT?at:at*yt},lt=t.R2L||!1;p.__private__.setR2L=p.setR2L=function(t){return lt=t,this},p.__private__.getR2L=p.getR2L=function(){return lt};var ut,ft=p.__private__.setZoomMode=function(t){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(t))ht=t;else if(isNaN(t)){if(-1===[void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(t))throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+t+'" is not recognized.');ht=t}else ht=parseInt(t,10)};p.__private__.getZoomMode=function(){return ht};var dt,pt=p.__private__.setPageMode=function(t){if(-1==[void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(t))throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+t+'" is not recognized.');ut=t};p.__private__.getPageMode=function(){return ut};var gt=p.__private__.setLayoutMode=function(t){if(-1==[void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(t))throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+t+'" is not recognized.');dt=t};p.__private__.getLayoutMode=function(){return dt},p.__private__.setDisplayMode=p.setDisplayMode=function(t,e,i){return ft(t),gt(e),pt(i),this};var mt={title:"",subject:"",author:"",keywords:"",creator:""};p.__private__.getDocumentProperty=function(t){if(-1===Object.keys(mt).indexOf(t))throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return mt[t]},p.__private__.getDocumentProperties=function(){return mt},p.__private__.setDocumentProperties=p.setProperties=p.setDocumentProperties=function(t){for(var e in mt)mt.hasOwnProperty(e)&&t[e]&&(mt[e]=t[e]);return this},p.__private__.setDocumentProperty=function(t,e){if(-1===Object.keys(mt).indexOf(t))throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return mt[t]=e};var vt,yt,bt,wt,xt,Lt={},kt={},Nt=[],jt={},Ft={},Et={},It={},Mt=null,Dt=0,Bt=[],Rt=new Ct(p),zt=t.hotfixes||[],qt={},Ut={},Wt=[],Ht=function t(e,i,n,r,o,s){if(!(this instanceof t))return new t(e,i,n,r,o,s);isNaN(e)&&(e=1),isNaN(i)&&(i=0),isNaN(n)&&(n=0),isNaN(r)&&(r=1),isNaN(o)&&(o=0),isNaN(s)&&(s=0),this._matrix=[e,i,n,r,o,s]};Object.defineProperty(Ht.prototype,"sx",{get:function(){return this._matrix[0]},set:function(t){this._matrix[0]=t}}),Object.defineProperty(Ht.prototype,"shy",{get:function(){return this._matrix[1]},set:function(t){this._matrix[1]=t}}),Object.defineProperty(Ht.prototype,"shx",{get:function(){return this._matrix[2]},set:function(t){this._matrix[2]=t}}),Object.defineProperty(Ht.prototype,"sy",{get:function(){return this._matrix[3]},set:function(t){this._matrix[3]=t}}),Object.defineProperty(Ht.prototype,"tx",{get:function(){return this._matrix[4]},set:function(t){this._matrix[4]=t}}),Object.defineProperty(Ht.prototype,"ty",{get:function(){return this._matrix[5]},set:function(t){this._matrix[5]=t}}),Object.defineProperty(Ht.prototype,"a",{get:function(){return this._matrix[0]},set:function(t){this._matrix[0]=t}}),Object.defineProperty(Ht.prototype,"b",{get:function(){return this._matrix[1]},set:function(t){this._matrix[1]=t}}),Object.defineProperty(Ht.prototype,"c",{get:function(){return this._matrix[2]},set:function(t){this._matrix[2]=t}}),Object.defineProperty(Ht.prototype,"d",{get:function(){return this._matrix[3]},set:function(t){this._matrix[3]=t}}),Object.defineProperty(Ht.prototype,"e",{get:function(){return this._matrix[4]},set:function(t){this._matrix[4]=t}}),Object.defineProperty(Ht.prototype,"f",{get:function(){return this._matrix[5]},set:function(t){this._matrix[5]=t}}),Object.defineProperty(Ht.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Ht.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Ht.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Ht.prototype,"isIdentity",{get:function(){return 1===this.sx&&0===this.shy&&0===this.shx&&1===this.sy&&0===this.tx&&0===this.ty}}),Ht.prototype.join=function(t){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(C).join(t)},Ht.prototype.multiply=function(t){var e=t.sx*this.sx+t.shy*this.shx,i=t.sx*this.shy+t.shy*this.sy,n=t.shx*this.sx+t.sy*this.shx,r=t.shx*this.shy+t.sy*this.sy,o=t.tx*this.sx+t.ty*this.shx+this.tx,s=t.tx*this.shy+t.ty*this.sy+this.ty;return new Ht(e,i,n,r,o,s)},Ht.prototype.decompose=function(){var t=this.sx,e=this.shy,i=this.shx,n=this.sy,r=this.tx,o=this.ty,s=Math.sqrt(t*t+e*e),a=(t/=s)*i+(e/=s)*n;i-=t*a,n-=e*a;var h=Math.sqrt(i*i+n*n);return a/=h,t*(n/=h)<e*(i/=h)&&(t=-t,e=-e,a=-a,s=-s),{scale:new Ht(s,0,0,h,0,0),translate:new Ht(1,0,0,1,r,o),rotate:new Ht(t,e,-e,t,0,0),skew:new Ht(1,0,a,1,0,0)}},Ht.prototype.toString=function(t){return this.join(" ")},Ht.prototype.inversed=function(){var t=this.sx,e=this.shy,i=this.shx,n=this.sy,r=this.tx,o=this.ty,s=1/(t*n-e*i),a=n*s,h=-e*s,c=-i*s,l=t*s;return new Ht(a,h,c,l,-a*r-c*o,-h*r-l*o)},Ht.prototype.applyToPoint=function(t){var e=t.x*this.sx+t.y*this.shx+this.tx,i=t.x*this.shy+t.y*this.sy+this.ty;return new pi(e,i)},Ht.prototype.applyToRectangle=function(t){var e=this.applyToPoint(t),i=this.applyToPoint(new pi(t.x+t.w,t.y+t.h));return new gi(e.x,e.y,i.x-e.x,i.y-e.y)},Ht.prototype.clone=function(){var t=this.sx,e=this.shy,i=this.shx,n=this.sy,r=this.tx,o=this.ty;return new Ht(t,e,i,n,r,o)},p.Matrix=Ht;var Vt=p.matrixMult=function(t,e){return e.multiply(t)},Gt=new Ht(1,0,0,1,0,0);p.unitMatrix=p.identityMatrix=Gt;var Xt=function(t,e){if(!Ft[t]){var i=(e instanceof Pt?"Sh":"P")+(Object.keys(jt).length+1).toString(10);e.id=i,Ft[t]=i,jt[i]=e,Rt.publish("addPattern",e)}};p.ShadingPattern=Pt,p.TilingPattern=Tt,p.addShadingPattern=function(t,e){return A("addShadingPattern()"),Xt(t,e),this},p.beginTilingPattern=function(t){A("beginTilingPattern()"),vi(t.boundingBox[0],t.boundingBox[1],t.boundingBox[2]-t.boundingBox[0],t.boundingBox[3]-t.boundingBox[1],t.matrix)},p.endTilingPattern=function(t,e){A("endTilingPattern()"),e.stream=X[R].join("\n"),Xt(t,e),Rt.publish("endTilingPattern",e),Wt.pop().restore()};var Yt,Kt=p.__private__.newObject=function(){var t=Jt();return Zt(t,!0),t},Jt=p.__private__.newObjectDeferred=function(){return U++,W[U]=function(){return V},U},Zt=function(t,e){return e="boolean"==typeof e&&e,W[t]=V,e&&tt(t+" 0 obj"),t},$t=p.__private__.newAdditionalObject=function(){var t={objId:Jt(),content:""};return G.push(t),t},Qt=Jt(),te=Jt(),ee=p.__private__.decodeColorString=function(t){var e=t.split(" ");if(2!==e.length||"g"!==e[1]&&"G"!==e[1])5!==e.length||"k"!==e[4]&&"K"!==e[4]||(e=[(1-e[0])*(1-e[3]),(1-e[1])*(1-e[3]),(1-e[2])*(1-e[3]),"r"]);else{var i=parseFloat(e[0]);e=[i,i,i,"r"]}for(var n="#",r=0;r<3;r++)n+=("0"+Math.floor(255*parseFloat(e[r])).toString(16)).slice(-2);return n},ie=p.__private__.encodeColorString=function(t){var e;"string"==typeof t&&(t={ch1:t});var i=t.ch1,r=t.ch2,o=t.ch3,s=t.ch4,a="draw"===t.pdfColorType?["G","RG","K"]:["g","rg","k"];if("string"==typeof i&&"#"!==i.charAt(0)){var h=new ot(i);if(h.ok)i=h.toHex();else if(!/^\d*\.?\d*$/.test(i))throw new Error('Invalid color "'+i+'" passed to jsPDF.encodeColorString.')}if("string"==typeof i&&/^#[0-9A-Fa-f]{3}$/.test(i)&&(i="#"+i[1]+i[1]+i[2]+i[2]+i[3]+i[3]),"string"==typeof i&&/^#[0-9A-Fa-f]{6}$/.test(i)){var c=parseInt(i.substr(1),16);i=c>>16&255,r=c>>8&255,o=255&c}if(void 0===r||void 0===s&&i===r&&r===o)e="string"==typeof i?i+" "+a[0]:2===t.precision?P(i/255)+" "+a[0]:T(i/255)+" "+a[0];else if(void 0===s||"object"===(0,n.Z)(s)){if(s&&!isNaN(s.a)&&0===s.a)return["1.","1.","1.",a[1]].join(" ");e="string"==typeof i?[i,r,o,a[1]].join(" "):2===t.precision?[P(i/255),P(r/255),P(o/255),a[1]].join(" "):[T(i/255),T(r/255),T(o/255),a[1]].join(" ")}else e="string"==typeof i?[i,r,o,s,a[2]].join(" "):2===t.precision?[P(i),P(r),P(o),P(s),a[2]].join(" "):[T(i),T(r),T(o),T(s),a[2]].join(" ");return e},ne=p.__private__.getFilters=function(){return a},re=p.__private__.putStream=function(t){var e=(t=t||{}).data||"",i=t.filters||ne(),n=t.alreadyAppliedFilters||[],r=t.addLength1||!1,o=e.length,s=t.objectId,a=function(t){return t};if(null!==u&&void 0===s)throw new Error("ObjectId must be passed to putStream for file encryption");null!==u&&(a=Ne.encryptor(s,0));var h={};!0===i&&(i=["FlateEncode"]);var c=t.additionalKeyValues||[],l=(h=void 0!==Ot.API.processDataByFilters?Ot.API.processDataByFilters(e,i):{data:e,reverseChain:[]}).reverseChain+(Array.isArray(n)?n.join(" "):n.toString());if(0!==h.data.length&&(c.push({key:"Length",value:h.data.length}),!0===r&&c.push({key:"Length1",value:o})),0!=l.length)if(l.split("/").length-1==1)c.push({key:"Filter",value:l});else{c.push({key:"Filter",value:"["+l+"]"});for(var f=0;f<c.length;f+=1)if("DecodeParms"===c[f].key){for(var d=[],p=0;p<h.reverseChain.split("/").length-1;p+=1)d.push("null");d.push(c[f].value),c[f].value="["+d.join(" ")+"]"}}tt("<<");for(var g=0;g<c.length;g++)tt("/"+c[g].key+" "+c[g].value);tt(">>"),0!==h.data.length&&(tt("stream"),tt(a(h.data)),tt("endstream"))},oe=p.__private__.putPage=function(t){var e=t.number,i=t.data,n=t.objId,r=t.contentsObjId;Zt(n,!0),tt("<</Type /Page"),tt("/Parent "+t.rootDictionaryObjId+" 0 R"),tt("/Resources "+t.resourceDictionaryObjId+" 0 R"),tt("/MediaBox ["+parseFloat(C(t.mediaBox.bottomLeftX))+" "+parseFloat(C(t.mediaBox.bottomLeftY))+" "+C(t.mediaBox.topRightX)+" "+C(t.mediaBox.topRightY)+"]"),null!==t.cropBox&&tt("/CropBox ["+C(t.cropBox.bottomLeftX)+" "+C(t.cropBox.bottomLeftY)+" "+C(t.cropBox.topRightX)+" "+C(t.cropBox.topRightY)+"]"),null!==t.bleedBox&&tt("/BleedBox ["+C(t.bleedBox.bottomLeftX)+" "+C(t.bleedBox.bottomLeftY)+" "+C(t.bleedBox.topRightX)+" "+C(t.bleedBox.topRightY)+"]"),null!==t.trimBox&&tt("/TrimBox ["+C(t.trimBox.bottomLeftX)+" "+C(t.trimBox.bottomLeftY)+" "+C(t.trimBox.topRightX)+" "+C(t.trimBox.topRightY)+"]"),null!==t.artBox&&tt("/ArtBox ["+C(t.artBox.bottomLeftX)+" "+C(t.artBox.bottomLeftY)+" "+C(t.artBox.topRightX)+" "+C(t.artBox.topRightY)+"]"),"number"==typeof t.userUnit&&1!==t.userUnit&&tt("/UserUnit "+t.userUnit),Rt.publish("putPage",{objId:n,pageContext:Bt[e],pageNumber:e,page:i}),tt("/Contents "+r+" 0 R"),tt(">>"),tt("endobj");var o=i.join("\n");return w===b.ADVANCED&&(o+="\nQ"),Zt(r,!0),re({data:o,filters:ne(),objectId:r}),tt("endobj"),n},se=p.__private__.putPages=function(){var t,e,i=[];for(t=1;t<=Dt;t++)Bt[t].objId=Jt(),Bt[t].contentsObjId=Jt();for(t=1;t<=Dt;t++)i.push(oe({number:t,data:X[t],objId:Bt[t].objId,contentsObjId:Bt[t].contentsObjId,mediaBox:Bt[t].mediaBox,cropBox:Bt[t].cropBox,bleedBox:Bt[t].bleedBox,trimBox:Bt[t].trimBox,artBox:Bt[t].artBox,userUnit:Bt[t].userUnit,rootDictionaryObjId:Qt,resourceDictionaryObjId:te}));Zt(Qt,!0),tt("<</Type /Pages");var n="/Kids [";for(e=0;e<Dt;e++)n+=i[e]+" 0 R ";tt(n+"]"),tt("/Count "+Dt),tt(">>"),tt("endobj"),Rt.publish("postPutPages")},ae=function(t){Rt.publish("putFont",{font:t,out:tt,newObject:Kt,putStream:re}),!0!==t.isAlreadyPutted&&(t.objectNumber=Kt(),tt("<<"),tt("/Type /Font"),tt("/BaseFont /"+St(t.postScriptName)),tt("/Subtype /Type1"),"string"==typeof t.encoding&&tt("/Encoding /"+t.encoding),tt("/FirstChar 32"),tt("/LastChar 255"),tt(">>"),tt("endobj"))},he=function(t){t.objectNumber=Kt();var e=[];e.push({key:"Type",value:"/XObject"}),e.push({key:"Subtype",value:"/Form"}),e.push({key:"BBox",value:"["+[C(t.x),C(t.y),C(t.x+t.width),C(t.y+t.height)].join(" ")+"]"}),e.push({key:"Matrix",value:"["+t.matrix.toString()+"]"});var i=t.pages[1].join("\n");re({data:i,additionalKeyValues:e,objectId:t.objectNumber}),tt("endobj")},ce=function(t,e){e||(e=21);var i=Kt(),n=function(t,e){var i,n=[],r=1/(e-1);for(i=0;i<1;i+=r)n.push(i);if(n.push(1),0!=t[0].offset){var o={offset:0,color:t[0].color};t.unshift(o)}if(1!=t[t.length-1].offset){var s={offset:1,color:t[t.length-1].color};t.push(s)}for(var a="",h=0,c=0;c<n.length;c++){for(i=n[c];i>t[h+1].offset;)h++;var l=t[h].offset,u=(i-l)/(t[h+1].offset-l),f=t[h].color,d=t[h+1].color;a+=q(Math.round((1-u)*f[0]+u*d[0]).toString(16))+q(Math.round((1-u)*f[1]+u*d[1]).toString(16))+q(Math.round((1-u)*f[2]+u*d[2]).toString(16))}return a.trim()}(t.colors,e),r=[];r.push({key:"FunctionType",value:"0"}),r.push({key:"Domain",value:"[0.0 1.0]"}),r.push({key:"Size",value:"["+e+"]"}),r.push({key:"BitsPerSample",value:"8"}),r.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),r.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),re({data:n,additionalKeyValues:r,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:i}),tt("endobj"),t.objectNumber=Kt(),tt("<< /ShadingType "+t.type),tt("/ColorSpace /DeviceRGB");var o="/Coords ["+C(parseFloat(t.coords[0]))+" "+C(parseFloat(t.coords[1]))+" ";2===t.type?o+=C(parseFloat(t.coords[2]))+" "+C(parseFloat(t.coords[3])):o+=C(parseFloat(t.coords[2]))+" "+C(parseFloat(t.coords[3]))+" "+C(parseFloat(t.coords[4]))+" "+C(parseFloat(t.coords[5])),tt(o+="]"),t.matrix&&tt("/Matrix ["+t.matrix.toString()+"]"),tt("/Function "+i+" 0 R"),tt("/Extend [true true]"),tt(">>"),tt("endobj")},le=function(t,e){var i=Jt(),n=Kt();e.push({resourcesOid:i,objectOid:n}),t.objectNumber=n;var r=[];r.push({key:"Type",value:"/Pattern"}),r.push({key:"PatternType",value:"1"}),r.push({key:"PaintType",value:"1"}),r.push({key:"TilingType",value:"1"}),r.push({key:"BBox",value:"["+t.boundingBox.map(C).join(" ")+"]"}),r.push({key:"XStep",value:C(t.xStep)}),r.push({key:"YStep",value:C(t.yStep)}),r.push({key:"Resources",value:i+" 0 R"}),t.matrix&&r.push({key:"Matrix",value:"["+t.matrix.toString()+"]"}),re({data:t.stream,additionalKeyValues:r,objectId:t.objectNumber}),tt("endobj")},ue=function(t){for(var e in t.objectNumber=Kt(),tt("<<"),t)switch(e){case"opacity":tt("/ca "+P(t[e]));break;case"stroke-opacity":tt("/CA "+P(t[e]))}tt(">>"),tt("endobj")},fe=function(t){Zt(t.resourcesOid,!0),tt("<<"),tt("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var t in tt("/Font <<"),Lt)Lt.hasOwnProperty(t)&&(!1===f||!0===f&&d.hasOwnProperty(t))&&tt("/"+t+" "+Lt[t].objectNumber+" 0 R");tt(">>")}(),function(){if(Object.keys(jt).length>0){for(var t in tt("/Shading <<"),jt)jt.hasOwnProperty(t)&&jt[t]instanceof Pt&&jt[t].objectNumber>=0&&tt("/"+t+" "+jt[t].objectNumber+" 0 R");Rt.publish("putShadingPatternDict"),tt(">>")}}(),function(t){if(Object.keys(jt).length>0){for(var e in tt("/Pattern <<"),jt)jt.hasOwnProperty(e)&&jt[e]instanceof p.TilingPattern&&jt[e].objectNumber>=0&&jt[e].objectNumber<t&&tt("/"+e+" "+jt[e].objectNumber+" 0 R");Rt.publish("putTilingPatternDict"),tt(">>")}}(t.objectOid),function(){if(Object.keys(Et).length>0){var t;for(t in tt("/ExtGState <<"),Et)Et.hasOwnProperty(t)&&Et[t].objectNumber>=0&&tt("/"+t+" "+Et[t].objectNumber+" 0 R");Rt.publish("putGStateDict"),tt(">>")}}(),function(){for(var t in tt("/XObject <<"),qt)qt.hasOwnProperty(t)&&qt[t].objectNumber>=0&&tt("/"+t+" "+qt[t].objectNumber+" 0 R");Rt.publish("putXobjectDict"),tt(">>")}(),tt(">>"),tt("endobj")},de=function(t){kt[t.fontName]=kt[t.fontName]||{},kt[t.fontName][t.fontStyle]=t.id},pe=function(t,e,i,n,r){var o={id:"F"+(Object.keys(Lt).length+1).toString(10),postScriptName:t,fontName:e,fontStyle:i,encoding:n,isStandardFont:r||!1,metadata:{}};return Rt.publish("addFont",{font:o,instance:this}),Lt[o.id]=o,de(o),o.id},ge=p.__private__.pdfEscape=p.pdfEscape=function(t,e){return function(t,e){var i,n,r,o,s,a,h,c,l;if(r=(e=e||{}).sourceEncoding||"Unicode",s=e.outputEncoding,(e.autoencode||s)&&Lt[vt].metadata&&Lt[vt].metadata[r]&&Lt[vt].metadata[r].encoding&&(o=Lt[vt].metadata[r].encoding,!s&&Lt[vt].encoding&&(s=Lt[vt].encoding),!s&&o.codePages&&(s=o.codePages[0]),"string"==typeof s&&(s=o[s]),s)){for(h=!1,a=[],i=0,n=t.length;i<n;i++)(c=s[t.charCodeAt(i)])?a.push(String.fromCharCode(c)):a.push(t[i]),a[i].charCodeAt(0)>>8&&(h=!0);t=a.join("")}for(i=t.length;void 0===h&&0!==i;)t.charCodeAt(i-1)>>8&&(h=!0),i--;if(!h)return t;for(a=e.noBOM?[]:[254,255],i=0,n=t.length;i<n;i++){if((l=(c=t.charCodeAt(i))>>8)>>8)throw new Error("Character at position "+i+" of string '"+t+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");a.push(l),a.push(c-(l<<8))}return String.fromCharCode.apply(void 0,a)}(t,e).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},me=p.__private__.beginPage=function(t){X[++Dt]=[],Bt[Dt]={objId:0,contentsObjId:0,userUnit:Number(h),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(t[0]),topRightY:Number(t[1])}},be(Dt),Q(X[R])},ve=function(t,e){var n,r,s;switch(i=e||i,"string"==typeof t&&(n=y(t.toLowerCase()),Array.isArray(n)&&(r=n[0],s=n[1])),Array.isArray(t)&&(r=t[0]*yt,s=t[1]*yt),isNaN(r)&&(r=o[0],s=o[1]),(r>14400||s>14400)&&($.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),r=Math.min(14400,r),s=Math.min(14400,s)),o=[r,s],i.substr(0,1)){case"l":s>r&&(o=[s,r]);break;case"p":r>s&&(o=[s,r])}me(o),Ze(Ke),tt(oi),0!==ui&&tt(ui+" J"),0!==fi&&tt(fi+" j"),Rt.publish("addPage",{pageNumber:Dt})},ye=function(t){t>0&&t<=Dt&&(X.splice(t,1),Bt.splice(t,1),Dt--,R>Dt&&(R=Dt),this.setPage(R))},be=function(t){t>0&&t<=Dt&&(R=t)},we=p.__private__.getNumberOfPages=p.getNumberOfPages=function(){return X.length-1},xe=function(t,e,i){var n,r=void 0;return i=i||{},t=void 0!==t?t:Lt[vt].fontName,e=void 0!==e?e:Lt[vt].fontStyle,n=t.toLowerCase(),void 0!==kt[n]&&void 0!==kt[n][e]?r=kt[n][e]:void 0!==kt[t]&&void 0!==kt[t][e]?r=kt[t][e]:!1===i.disableWarning&&$.warn("Unable to look up font label for font '"+t+"', '"+e+"'. Refer to getFontList() for available fonts."),r||i.noFallback||null==(r=kt.times[e])&&(r=kt.times.normal),r},_e=p.__private__.putInfo=function(){var t=Kt(),e=function(t){return t};for(var i in null!==u&&(e=Ne.encryptor(t,0)),tt("<<"),tt("/Producer ("+ge(e("jsPDF "+Ot.version))+")"),mt)mt.hasOwnProperty(i)&&mt[i]&&tt("/"+i.substr(0,1).toUpperCase()+i.substr(1)+" ("+ge(e(mt[i]))+")");tt("/CreationDate ("+ge(e(N))+")"),tt(">>"),tt("endobj")},Se=p.__private__.putCatalog=function(t){var e=(t=t||{}).rootDictionaryObjId||Qt;switch(Kt(),tt("<<"),tt("/Type /Catalog"),tt("/Pages "+e+" 0 R"),ht||(ht="fullwidth"),ht){case"fullwidth":tt("/OpenAction [3 0 R /FitH null]");break;case"fullheight":tt("/OpenAction [3 0 R /FitV null]");break;case"fullpage":tt("/OpenAction [3 0 R /Fit]");break;case"original":tt("/OpenAction [3 0 R /XYZ null null 1]");break;default:var i=""+ht;"%"===i.substr(i.length-1)&&(ht=parseInt(ht)/100),"number"==typeof ht&&tt("/OpenAction [3 0 R /XYZ null null "+P(ht)+"]")}switch(dt||(dt="continuous"),dt){case"continuous":tt("/PageLayout /OneColumn");break;case"single":tt("/PageLayout /SinglePage");break;case"two":case"twoleft":tt("/PageLayout /TwoColumnLeft");break;case"tworight":tt("/PageLayout /TwoColumnRight")}ut&&tt("/PageMode /"+ut),Rt.publish("putCatalog"),tt(">>"),tt("endobj")},Ce=p.__private__.putTrailer=function(){tt("trailer"),tt("<<"),tt("/Size "+(U+1)),tt("/Root "+U+" 0 R"),tt("/Info "+(U-1)+" 0 R"),null!==u&&tt("/Encrypt "+Ne.oid+" 0 R"),tt("/ID [ <"+j+"> <"+j+"> ]"),tt(">>")},Ae=p.__private__.putHeader=function(){tt("%PDF-"+g),tt("%ºß¬à")},Le=p.__private__.putXRef=function(){var t="0000000000";tt("xref"),tt("0 "+(U+1)),tt("0000000000 65535 f ");for(var e=1;e<=U;e++)"function"==typeof W[e]?tt((t+W[e]()).slice(-10)+" 00000 n "):void 0!==W[e]?tt((t+W[e]).slice(-10)+" 00000 n "):tt("0000000000 00000 n ")},Pe=p.__private__.buildDocument=function(){U=0,V=0,H=[],W=[],G=[],Qt=Jt(),te=Jt(),Q(H),Rt.publish("buildDocument"),Ae(),se(),function(){Rt.publish("putAdditionalObjects");for(var t=0;t<G.length;t++){var e=G[t];Zt(e.objId,!0),tt(e.content),tt("endobj")}Rt.publish("postPutAdditionalObjects")}(),function(){var t=[];(function(){for(var t in Lt)Lt.hasOwnProperty(t)&&(!1===f||!0===f&&d.hasOwnProperty(t))&&ae(Lt[t])})(),function(){var t;for(t in Et)Et.hasOwnProperty(t)&&ue(Et[t])}(),function(){for(var t in qt)qt.hasOwnProperty(t)&&he(qt[t])}(),function(t){var e;for(e in jt)jt.hasOwnProperty(e)&&(jt[e]instanceof Pt?ce(jt[e]):jt[e]instanceof Tt&&le(jt[e],t))}(t),Rt.publish("putResources"),t.forEach(fe),fe({resourcesOid:te,objectOid:Number.MAX_SAFE_INTEGER}),Rt.publish("postPutResources")}(),null!==u&&(Ne.oid=Kt(),tt("<<"),tt("/Filter /Standard"),tt("/V "+Ne.v),tt("/R "+Ne.r),tt("/U <"+Ne.toHexString(Ne.U)+">"),tt("/O <"+Ne.toHexString(Ne.O)+">"),tt("/P "+Ne.P),tt(">>"),tt("endobj")),_e(),Se();var t=V;return Le(),Ce(),tt("startxref"),tt(""+t),tt("%%EOF"),Q(X[R]),H.join("\n")},Te=p.__private__.getBlob=function(t){return new Blob([it(t)],{type:"application/pdf"})},Oe=p.output=p.__private__.output=(Yt=function(t,e){switch("string"==typeof(e=e||{})?e={filename:e}:e.filename=e.filename||"generated.pdf",t){case void 0:return Pe();case"save":p.save(e.filename);break;case"arraybuffer":return it(Pe());case"blob":return Te(Pe());case"bloburi":case"bloburl":if(void 0!==J.URL&&"function"==typeof J.URL.createObjectURL)return J.URL&&J.URL.createObjectURL(Te(Pe()))||void 0;$.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var i="",n=Pe();try{i=nt(n)}catch(t){i=nt(unescape(encodeURIComponent(n)))}return"data:application/pdf;filename="+e.filename+";base64,"+i;case"pdfobjectnewwindow":if("[object Window]"===Object.prototype.toString.call(J)){var r="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",o=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';e.pdfObjectUrl&&(r=e.pdfObjectUrl,o="");var s='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><script src="'+r+'"'+o+'><\/script><script >PDFObject.embed("'+this.output("dataurlstring")+'", '+JSON.stringify(e)+");<\/script></body></html>",a=J.open();return null!==a&&a.document.write(s),a}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if("[object Window]"===Object.prototype.toString.call(J)){var h='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe id="pdfViewer" src="'+(e.pdfJsUrl||"examples/PDF.js/web/viewer.html")+"?file=&downloadName="+e.filename+'" width="500px" height="400px" /></body></html>',c=J.open();if(null!==c){c.document.write(h);var l=this;c.document.documentElement.querySelector("#pdfViewer").onload=function(){c.document.title=e.filename,c.document.documentElement.querySelector("#pdfViewer").contentWindow.PDFViewerApplication.open(l.output("bloburl"))}}return c}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if("[object Window]"!==Object.prototype.toString.call(J))throw new Error("The option dataurlnewwindow just works in a browser-environment.");var u='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe src="'+this.output("datauristring",e)+'"></iframe></body></html>',f=J.open();if(null!==f&&(f.document.write(u),f.document.title=e.filename),f||"undefined"==typeof safari)return f;break;case"datauri":case"dataurl":return J.document.location.href=this.output("datauristring",e);default:return null}},Yt.foo=function(){try{return Yt.apply(this,arguments)}catch(i){var t=i.stack||"";~t.indexOf(" at ")&&(t=t.split(" at ")[1]);var e="Error in function "+t.split("\n")[0].split("<")[0]+": "+i.message;if(!J.console)throw new Error(e);J.console.error(e,i),J.alert&&alert(e)}},Yt.foo.bar=Yt,Yt.foo),ke=function(t){return!0===Array.isArray(zt)&&zt.indexOf(t)>-1};switch(r){case"pt":yt=1;break;case"mm":yt=72/25.4;break;case"cm":yt=72/2.54;break;case"in":yt=72;break;case"px":yt=1==ke("px_scaling")?.75:96/72;break;case"pc":case"em":yt=12;break;case"ex":yt=6;break;default:if("number"!=typeof r)throw new Error("Invalid unit: "+r);yt=r}var Ne=null;D(),E();var je=p.__private__.getPageInfo=p.getPageInfo=function(t){if(isNaN(t)||t%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Bt[t].objId,pageNumber:t,pageContext:Bt[t]}},Fe=p.__private__.getPageInfoByObjId=function(t){if(isNaN(t)||t%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var e in Bt)if(Bt[e].objId===t)break;return je(e)},Ee=p.__private__.getCurrentPageInfo=p.getCurrentPageInfo=function(){return{objId:Bt[R].objId,pageNumber:R,pageContext:Bt[R]}};p.addPage=function(){return ve.apply(this,arguments),this},p.setPage=function(){return be.apply(this,arguments),Q.call(this,X[R]),this},p.insertPage=function(t){return this.addPage(),this.movePage(R,t),this},p.movePage=function(t,e){var i,n;if(t>e){i=X[t],n=Bt[t];for(var r=t;r>e;r--)X[r]=X[r-1],Bt[r]=Bt[r-1];X[e]=i,Bt[e]=n,this.setPage(e)}else if(t<e){i=X[t],n=Bt[t];for(var o=t;o<e;o++)X[o]=X[o+1],Bt[o]=Bt[o+1];X[e]=i,Bt[e]=n,this.setPage(e)}return this},p.deletePage=function(){return ye.apply(this,arguments),this},p.__private__.text=p.text=function(t,e,i,r,o){var s,a,h,c,l,u,f,p,g,m=(r=r||{}).scope||this;if("number"==typeof t&&"number"==typeof e&&("string"==typeof i||Array.isArray(i))){var v=i;i=e,e=t,t=v}if(arguments[3]instanceof Ht==0?(h=arguments[4],c=arguments[5],"object"===(0,n.Z)(f=arguments[3])&&null!==f||("string"==typeof h&&(c=h,h=null),"string"==typeof f&&(c=f,f=null),"number"==typeof f&&(h=f,f=null),r={flags:f,angle:h,align:c})):(A("The transform parameter of text() with a Matrix value"),g=o),isNaN(e)||isNaN(i)||null==t)throw new Error("Invalid arguments passed to jsPDF.text");if(0===t.length)return m;var y,x="",_="number"==typeof r.lineHeightFactor?r.lineHeightFactor:Ye,S=m.internal.scaleFactor;function L(t){return t=t.split("\t").join(Array(r.TabLen||9).join(" ")),ge(t,f)}function P(t){for(var e,i=t.concat(),n=[],r=i.length;r--;)"string"==typeof(e=i.shift())?n.push(e):Array.isArray(t)&&(1===e.length||void 0===e[1]&&void 0===e[2])?n.push(e[0]):n.push([e[0],e[1],e[2]]);return n}function T(t,e){var i;if("string"==typeof t)i=e(t)[0];else if(Array.isArray(t)){for(var n,r,o=t.concat(),s=[],a=o.length;a--;)"string"==typeof(n=o.shift())?s.push(e(n)[0]):Array.isArray(n)&&"string"==typeof n[0]&&(r=e(n[0],n[1],n[2]),s.push([r[0],r[1],r[2]]));i=s}return i}var k=!1,N=!0;if("string"==typeof t)k=!0;else if(Array.isArray(t)){var j=t.concat();a=[];for(var F,E=j.length;E--;)("string"!=typeof(F=j.shift())||Array.isArray(F)&&"string"!=typeof F[0])&&(N=!1);k=N}if(!1===k)throw new Error('Type of text must be string or Array. "'+t+'" is not recognized.');"string"==typeof t&&(t=t.match(/[\r?\n]/)?t.split(/\r\n|\r|\n/g):[t]);var I=at/m.internal.scaleFactor,M=I*(_-1);switch(r.baseline){case"bottom":i-=M;break;case"top":i+=I-M;break;case"hanging":i+=I-2*M;break;case"middle":i+=I/2-M}if((u=r.maxWidth||0)>0&&("string"==typeof t?t=m.splitTextToSize(t,u):"[object Array]"===Object.prototype.toString.call(t)&&(t=t.reduce((function(t,e){return t.concat(m.splitTextToSize(e,u))}),[]))),s={text:t,x:e,y:i,options:r,mutex:{pdfEscape:ge,activeFontKey:vt,fonts:Lt,activeFontSize:at}},Rt.publish("preProcessText",s),t=s.text,h=(r=s.options).angle,g instanceof Ht==0&&h&&"number"==typeof h){h*=Math.PI/180,0===r.rotationDirection&&(h=-h),w===b.ADVANCED&&(h=-h);var D=Math.cos(h),B=Math.sin(h);g=new Ht(D,B,-B,D,0,0)}else h&&h instanceof Ht&&(g=h);w!==b.ADVANCED||g||(g=Gt),void 0!==(l=r.charSpace||ci)&&(x+=C(O(l))+" Tc\n",this.setCharSpace(this.getCharSpace()||0)),void 0!==(p=r.horizontalScale)&&(x+=C(100*p)+" Tz\n"),r.lang;var R=-1,z=void 0!==r.renderingMode?r.renderingMode:r.stroke,q=m.internal.getCurrentPageInfo().pageContext;switch(z){case 0:case!1:case"fill":R=0;break;case 1:case!0:case"stroke":R=1;break;case 2:case"fillThenStroke":R=2;break;case 3:case"invisible":R=3;break;case 4:case"fillAndAddForClipping":R=4;break;case 5:case"strokeAndAddPathForClipping":R=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":R=6;break;case 7:case"addToPathForClipping":R=7}var U=void 0!==q.usedRenderingMode?q.usedRenderingMode:-1;-1!==R?x+=R+" Tr\n":-1!==U&&(x+="0 Tr\n"),-1!==R&&(q.usedRenderingMode=R),c=r.align||"left";var W,H=at*_,V=m.internal.pageSize.getWidth(),G=Lt[vt];l=r.charSpace||ci,u=r.maxWidth||0,f=Object.assign({autoencode:!0,noBOM:!0},r.flags);var X=[];if("[object Array]"===Object.prototype.toString.call(t)){var Y;a=P(t),"left"!==c&&(W=a.map((function(t){return m.getStringUnitWidth(t,{font:G,charSpace:l,fontSize:at,doKerning:!1})*at/S})));var K,J=0;if("right"===c){e-=W[0],t=[],E=a.length;for(var Z=0;Z<E;Z++)0===Z?(K=ei(e),Y=ii(i)):(K=O(J-W[Z]),Y=-H),t.push([a[Z],K,Y]),J=W[Z]}else if("center"===c){e-=W[0]/2,t=[],E=a.length;for(var $=0;$<E;$++)0===$?(K=ei(e),Y=ii(i)):(K=O((J-W[$])/2),Y=-H),t.push([a[$],K,Y]),J=W[$]}else if("left"===c){t=[],E=a.length;for(var Q=0;Q<E;Q++)t.push(a[Q])}else{if("justify"!==c)throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');t=[],E=a.length,u=0!==u?u:V;for(var et=0;et<E;et++)Y=0===et?ii(i):-H,K=0===et?ei(e):0,et<E-1?X.push(C(O((u-W[et])/(a[et].split(" ").length-1)))):X.push(0),t.push([a[et],K,Y])}}!0===("boolean"==typeof r.R2L?r.R2L:lt)&&(t=T(t,(function(t,e,i){return[t.split("").reverse().join(""),e,i]}))),s={text:t,x:e,y:i,options:r,mutex:{pdfEscape:ge,activeFontKey:vt,fonts:Lt,activeFontSize:at}},Rt.publish("postProcessText",s),t=s.text,y=s.mutex.isHex||!1;var it=Lt[vt].encoding;"WinAnsiEncoding"!==it&&"StandardEncoding"!==it||(t=T(t,(function(t,e,i){return[L(t),e,i]}))),a=P(t),t=[];for(var nt,rt,ot,st=Array.isArray(a[0])?1:0,ht="",ct=function(t,e,i){var n="";return i instanceof Ht?(i="number"==typeof r.angle?Vt(i,new Ht(1,0,0,1,t,e)):Vt(new Ht(1,0,0,1,t,e),i),w===b.ADVANCED&&(i=Vt(new Ht(1,0,0,-1,0,0),i)),n=i.join(" ")+" Tm\n"):n=C(t)+" "+C(e)+" Td\n",n},ut=0;ut<a.length;ut++){switch(ht="",st){case 1:ot=(y?"<":"(")+a[ut][0]+(y?">":")"),nt=parseFloat(a[ut][1]),rt=parseFloat(a[ut][2]);break;case 0:ot=(y?"<":"(")+a[ut]+(y?">":")"),nt=ei(e),rt=ii(i)}void 0!==X&&void 0!==X[ut]&&(ht=X[ut]+" Tw\n"),0===ut?t.push(ht+ct(nt,rt,g)+ot):0===st?t.push(ht+ot):1===st&&t.push(ht+ct(nt,rt,g)+ot)}t=0===st?t.join(" Tj\nT* "):t.join(" Tj\n"),t+=" Tj\n";var ft="BT\n/";return ft+=vt+" "+at+" Tf\n",ft+=C(at*_)+" TL\n",ft+=ai+"\n",ft+=x,ft+=t,tt(ft+="ET"),d[vt]=!0,m};var Ie=p.__private__.clip=p.clip=function(t){return tt("evenodd"===t?"W*":"W"),this};p.clipEvenOdd=function(){return Ie("evenodd")},p.__private__.discardPath=p.discardPath=function(){return tt("n"),this};var Me=p.__private__.isValidStyle=function(t){var e=!1;return-1!==[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(t)&&(e=!0),e};p.__private__.setDefaultPathOperation=p.setDefaultPathOperation=function(t){return Me(t)&&(l=t),this};var De=p.__private__.getStyle=p.getStyle=function(t){var e=l;switch(t){case"D":case"S":e="S";break;case"F":e="f";break;case"FD":case"DF":e="B";break;case"f":case"f*":case"B":case"B*":e=t}return e},Be=p.close=function(){return tt("h"),this};p.stroke=function(){return tt("S"),this},p.fill=function(t){return Re("f",t),this},p.fillEvenOdd=function(t){return Re("f*",t),this},p.fillStroke=function(t){return Re("B",t),this},p.fillStrokeEvenOdd=function(t){return Re("B*",t),this};var Re=function(t,e){"object"===(0,n.Z)(e)?Ue(e,t):tt(t)},ze=function(t){null===t||w===b.ADVANCED&&void 0===t||(t=De(t),tt(t))};function qe(t,e,i,n,r){var o=new Tt(e||this.boundingBox,i||this.xStep,n||this.yStep,this.gState,r||this.matrix);o.stream=this.stream;var s=t+"$$"+this.cloneIndex+++"$$";return Xt(s,o),o}var Ue=function(t,e){var i=Ft[t.key],n=jt[i];if(n instanceof Pt)tt("q"),tt(We(e)),n.gState&&p.setGState(n.gState),tt(t.matrix.toString()+" cm"),tt("/"+i+" sh"),tt("Q");else if(n instanceof Tt){var r=new Ht(1,0,0,-1,0,xi());t.matrix&&(r=r.multiply(t.matrix||Gt),i=qe.call(n,t.key,t.boundingBox,t.xStep,t.yStep,r).id),tt("q"),tt("/Pattern cs"),tt("/"+i+" scn"),n.gState&&p.setGState(n.gState),tt(e),tt("Q")}},We=function(t){switch(t){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},He=p.moveTo=function(t,e){return tt(C(O(t))+" "+C(k(e))+" m"),this},Ve=p.lineTo=function(t,e){return tt(C(O(t))+" "+C(k(e))+" l"),this},Ge=p.curveTo=function(t,e,i,n,r,o){return tt([C(O(t)),C(k(e)),C(O(i)),C(k(n)),C(O(r)),C(k(o)),"c"].join(" ")),this};p.__private__.line=p.line=function(t,e,i,n,r){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n)||!Me(r))throw new Error("Invalid arguments passed to jsPDF.line");return w===b.COMPAT?this.lines([[i-t,n-e]],t,e,[1,1],r||"S"):this.lines([[i-t,n-e]],t,e,[1,1]).stroke()},p.__private__.lines=p.lines=function(t,e,i,n,r,o){var s,a,h,c,l,u,f,d,p,g,m,v;if("number"==typeof t&&(v=i,i=e,e=t,t=v),n=n||[1,1],o=o||!1,isNaN(e)||isNaN(i)||!Array.isArray(t)||!Array.isArray(n)||!Me(r)||"boolean"!=typeof o)throw new Error("Invalid arguments passed to jsPDF.lines");for(He(e,i),s=n[0],a=n[1],c=t.length,g=e,m=i,h=0;h<c;h++)2===(l=t[h]).length?(g=l[0]*s+g,m=l[1]*a+m,Ve(g,m)):(u=l[0]*s+g,f=l[1]*a+m,d=l[2]*s+g,p=l[3]*a+m,g=l[4]*s+g,m=l[5]*a+m,Ge(u,f,d,p,g,m));return o&&Be(),ze(r),this},p.path=function(t){for(var e=0;e<t.length;e++){var i=t[e],n=i.c;switch(i.op){case"m":He(n[0],n[1]);break;case"l":Ve(n[0],n[1]);break;case"c":Ge.apply(this,n);break;case"h":Be()}}return this},p.__private__.rect=p.rect=function(t,e,i,n,r){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n)||!Me(r))throw new Error("Invalid arguments passed to jsPDF.rect");return w===b.COMPAT&&(n=-n),tt([C(O(t)),C(k(e)),C(O(i)),C(O(n)),"re"].join(" ")),ze(r),this},p.__private__.triangle=p.triangle=function(t,e,i,n,r,o,s){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n)||isNaN(r)||isNaN(o)||!Me(s))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[i-t,n-e],[r-i,o-n],[t-r,e-o]],t,e,[1,1],s,!0),this},p.__private__.roundedRect=p.roundedRect=function(t,e,i,n,r,o,s){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n)||isNaN(r)||isNaN(o)||!Me(s))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var a=4/3*(Math.SQRT2-1);return r=Math.min(r,.5*i),o=Math.min(o,.5*n),this.lines([[i-2*r,0],[r*a,0,r,o-o*a,r,o],[0,n-2*o],[0,o*a,-r*a,o,-r,o],[2*r-i,0],[-r*a,0,-r,-o*a,-r,-o],[0,2*o-n],[0,-o*a,r*a,-o,r,-o]],t+r,e,[1,1],s,!0),this},p.__private__.ellipse=p.ellipse=function(t,e,i,n,r){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n)||!Me(r))throw new Error("Invalid arguments passed to jsPDF.ellipse");var o=4/3*(Math.SQRT2-1)*i,s=4/3*(Math.SQRT2-1)*n;return He(t+i,e),Ge(t+i,e-s,t+o,e-n,t,e-n),Ge(t-o,e-n,t-i,e-s,t-i,e),Ge(t-i,e+s,t-o,e+n,t,e+n),Ge(t+o,e+n,t+i,e+s,t+i,e),ze(r),this},p.__private__.circle=p.circle=function(t,e,i,n){if(isNaN(t)||isNaN(e)||isNaN(i)||!Me(n))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(t,e,i,i,n)},p.setFont=function(t,e,i){return i&&(e=S(e,i)),vt=xe(t,e,{disableWarning:!1}),this};var Xe=p.__private__.getFont=p.getFont=function(){return Lt[xe.apply(p,arguments)]};p.__private__.getFontList=p.getFontList=function(){var t,e,i={};for(t in kt)if(kt.hasOwnProperty(t))for(e in i[t]=[],kt[t])kt[t].hasOwnProperty(e)&&i[t].push(e);return i},p.addFont=function(t,e,i,n,r){var o=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&-1!==o.indexOf(arguments[3])?r=arguments[3]:arguments[3]&&-1==o.indexOf(arguments[3])&&(i=S(i,n)),r=r||"Identity-H",pe.call(this,t,e,i,r)};var Ye,Ke=t.lineWidth||.200025,Je=p.__private__.getLineWidth=p.getLineWidth=function(){return Ke},Ze=p.__private__.setLineWidth=p.setLineWidth=function(t){return Ke=t,tt(C(O(t))+" w"),this};p.__private__.setLineDash=Ot.API.setLineDash=Ot.API.setLineDashPattern=function(t,e){if(t=t||[],e=e||0,isNaN(e)||!Array.isArray(t))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return t=t.map((function(t){return C(O(t))})).join(" "),e=C(O(e)),tt("["+t+"] "+e+" d"),this};var $e=p.__private__.getLineHeight=p.getLineHeight=function(){return at*Ye};p.__private__.getLineHeight=p.getLineHeight=function(){return at*Ye};var Qe=p.__private__.setLineHeightFactor=p.setLineHeightFactor=function(t){return"number"==typeof(t=t||1.15)&&(Ye=t),this},ti=p.__private__.getLineHeightFactor=p.getLineHeightFactor=function(){return Ye};Qe(t.lineHeight);var ei=p.__private__.getHorizontalCoordinate=function(t){return O(t)},ii=p.__private__.getVerticalCoordinate=function(t){return w===b.ADVANCED?t:Bt[R].mediaBox.topRightY-Bt[R].mediaBox.bottomLeftY-O(t)},ni=p.__private__.getHorizontalCoordinateString=p.getHorizontalCoordinateString=function(t){return C(ei(t))},ri=p.__private__.getVerticalCoordinateString=p.getVerticalCoordinateString=function(t){return C(ii(t))},oi=t.strokeColor||"0 G";p.__private__.getStrokeColor=p.getDrawColor=function(){return ee(oi)},p.__private__.setStrokeColor=p.setDrawColor=function(t,e,i,n){return oi=ie({ch1:t,ch2:e,ch3:i,ch4:n,pdfColorType:"draw",precision:2}),tt(oi),this};var si=t.fillColor||"0 g";p.__private__.getFillColor=p.getFillColor=function(){return ee(si)},p.__private__.setFillColor=p.setFillColor=function(t,e,i,n){return si=ie({ch1:t,ch2:e,ch3:i,ch4:n,pdfColorType:"fill",precision:2}),tt(si),this};var ai=t.textColor||"0 g",hi=p.__private__.getTextColor=p.getTextColor=function(){return ee(ai)};p.__private__.setTextColor=p.setTextColor=function(t,e,i,n){return ai=ie({ch1:t,ch2:e,ch3:i,ch4:n,pdfColorType:"text",precision:3}),this};var ci=t.charSpace,li=p.__private__.getCharSpace=p.getCharSpace=function(){return parseFloat(ci||0)};p.__private__.setCharSpace=p.setCharSpace=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return ci=t,this};var ui=0;p.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},p.__private__.setLineCap=p.setLineCap=function(t){var e=p.CapJoinStyles[t];if(void 0===e)throw new Error("Line cap style of '"+t+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return ui=e,tt(e+" J"),this};var fi=0;p.__private__.setLineJoin=p.setLineJoin=function(t){var e=p.CapJoinStyles[t];if(void 0===e)throw new Error("Line join style of '"+t+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return fi=e,tt(e+" j"),this},p.__private__.setLineMiterLimit=p.__private__.setMiterLimit=p.setLineMiterLimit=p.setMiterLimit=function(t){if(t=t||0,isNaN(t))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return tt(C(O(t))+" M"),this},p.GState=At,p.setGState=function(t){(t="string"==typeof t?Et[It[t]]:di(null,t)).equals(Mt)||(tt("/"+t.id+" gs"),Mt=t)};var di=function(t,e){if(!t||!It[t]){var i=!1;for(var n in Et)if(Et.hasOwnProperty(n)&&Et[n].equals(e)){i=!0;break}if(i)e=Et[n];else{var r="GS"+(Object.keys(Et).length+1).toString(10);Et[r]=e,e.id=r}return t&&(It[t]=e.id),Rt.publish("addGState",e),e}};p.addGState=function(t,e){return di(t,e),this},p.saveGraphicsState=function(){return tt("q"),Nt.push({key:vt,size:at,color:ai}),this},p.restoreGraphicsState=function(){tt("Q");var t=Nt.pop();return vt=t.key,at=t.size,ai=t.color,Mt=null,this},p.setCurrentTransformationMatrix=function(t){return tt(t.toString()+" cm"),this},p.comment=function(t){return tt("#"+t),this};var pi=function(t,e){var i=t||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return i},set:function(t){isNaN(t)||(i=parseFloat(t))}});var n=e||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return n},set:function(t){isNaN(t)||(n=parseFloat(t))}});var r="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return r},set:function(t){r=t.toString()}}),this},gi=function(t,e,i,n){pi.call(this,t,e),this.type="rect";var r=i||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return r},set:function(t){isNaN(t)||(r=parseFloat(t))}});var o=n||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return o},set:function(t){isNaN(t)||(o=parseFloat(t))}}),this},mi=function(){this.page=Dt,this.currentPage=R,this.pages=X.slice(0),this.pagesContext=Bt.slice(0),this.x=bt,this.y=wt,this.matrix=xt,this.width=bi(R),this.height=xi(R),this.outputDestination=Z,this.id="",this.objectNumber=-1};mi.prototype.restore=function(){Dt=this.page,R=this.currentPage,Bt=this.pagesContext,X=this.pages,bt=this.x,wt=this.y,xt=this.matrix,wi(R,this.width),_i(R,this.height),Z=this.outputDestination};var vi=function(t,e,i,n,r){Wt.push(new mi),Dt=R=0,X=[],bt=t,wt=e,xt=r,me([i,n])};for(var yi in p.beginFormObject=function(t,e,i,n,r){return vi(t,e,i,n,r),this},p.endFormObject=function(t){return function(t){if(Ut[t])Wt.pop().restore();else{var e=new mi,i="Xo"+(Object.keys(qt).length+1).toString(10);e.id=i,Ut[t]=i,qt[i]=e,Rt.publish("addFormObject",e),Wt.pop().restore()}}(t),this},p.doFormObject=function(t,e){var i=qt[Ut[t]];return tt("q"),tt(e.toString()+" cm"),tt("/"+i.id+" Do"),tt("Q"),this},p.getFormObject=function(t){var e=qt[Ut[t]];return{x:e.x,y:e.y,width:e.width,height:e.height,matrix:e.matrix}},p.save=function(t,e){return t=t||"generated.pdf",(e=e||{}).returnPromise=e.returnPromise||!1,!1===e.returnPromise?(rt(Te(Pe()),t),"function"==typeof rt.unload&&J.setTimeout&&setTimeout(rt.unload,911),this):new K((function(e,i){try{var n=rt(Te(Pe()),t);"function"==typeof rt.unload&&J.setTimeout&&setTimeout(rt.unload,911),e(n)}catch(t){i(t.message)}}))},Ot.API)Ot.API.hasOwnProperty(yi)&&("events"===yi&&Ot.API.events.length?function(t,e){var i,n,r;for(r=e.length-1;-1!==r;r--)i=e[r][0],n=e[r][1],t.subscribe.apply(t,[i].concat("function"==typeof n?[n]:n))}(Rt,Ot.API.events):p[yi]=Ot.API[yi]);var bi=p.getPageWidth=function(t){return(Bt[t=t||R].mediaBox.topRightX-Bt[t].mediaBox.bottomLeftX)/yt},wi=p.setPageWidth=function(t,e){Bt[t].mediaBox.topRightX=e*yt+Bt[t].mediaBox.bottomLeftX},xi=p.getPageHeight=function(t){return(Bt[t=t||R].mediaBox.topRightY-Bt[t].mediaBox.bottomLeftY)/yt},_i=p.setPageHeight=function(t,e){Bt[t].mediaBox.topRightY=e*yt+Bt[t].mediaBox.bottomLeftY};return p.internal={pdfEscape:ge,getStyle:De,getFont:Xe,getFontSize:ct,getCharSpace:li,getTextColor:hi,getLineHeight:$e,getLineHeightFactor:ti,getLineWidth:Je,write:et,getHorizontalCoordinate:ei,getVerticalCoordinate:ii,getCoordinateString:ni,getVerticalCoordinateString:ri,collections:{},newObject:Kt,newAdditionalObject:$t,newObjectDeferred:Jt,newObjectDeferredBegin:Zt,getFilters:ne,putStream:re,events:Rt,scaleFactor:yt,pageSize:{getWidth:function(){return bi(R)},setWidth:function(t){wi(R,t)},getHeight:function(){return xi(R)},setHeight:function(t){_i(R,t)}},encryptionOptions:u,encryption:Ne,getEncryptor:function(t){return null!==u?Ne.encryptor(t,0):function(t){return t}},output:Oe,getNumberOfPages:we,pages:X,out:tt,f2:P,f3:T,getPageInfo:je,getPageInfoByObjId:Fe,getCurrentPageInfo:Ee,getPDFVersion:m,Point:pi,Rectangle:gi,Matrix:Ht,hasHotfix:ke},Object.defineProperty(p.internal.pageSize,"width",{get:function(){return bi(R)},set:function(t){wi(R,t)},enumerable:!0,configurable:!0}),Object.defineProperty(p.internal.pageSize,"height",{get:function(){return xi(R)},set:function(t){_i(R,t)},enumerable:!0,configurable:!0}),function(t){for(var e=0,i=st.length;e<i;e++){var n=pe.call(this,t[e][0],t[e][1],t[e][2],st[e][3],!0);!1===f&&(d[n]=!0);var r=t[e][0].split("-");de({id:n,fontName:r[0],fontStyle:r[1]||""})}Rt.publish("addFonts",{fonts:Lt,dictionary:kt})}.call(p,st),vt="F1",ve(o,i),Rt.publish("initialized"),p}_t.prototype.lsbFirstWord=function(t){return String.fromCharCode(t>>0&255,t>>8&255,t>>16&255,t>>24&255)},_t.prototype.toHexString=function(t){return t.split("").map((function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)})).join("")},_t.prototype.hexToBytes=function(t){for(var e=[],i=0;i<t.length;i+=2)e.push(String.fromCharCode(parseInt(t.substr(i,2),16)));return e.join("")},_t.prototype.processOwnerPassword=function(t,e){return wt(vt(e).substr(0,5),t)},_t.prototype.encryptor=function(t,e){var i=vt(this.encryptionKey+String.fromCharCode(255&t,t>>8&255,t>>16&255,255&e,e>>8&255)).substr(0,10);return function(t){return wt(i,t)}},At.prototype.equals=function(t){var e,i="id,objectNumber,equals";if(!t||(0,n.Z)(t)!==(0,n.Z)(this))return!1;var r=0;for(e in this)if(!(i.indexOf(e)>=0)){if(this.hasOwnProperty(e)&&!t.hasOwnProperty(e))return!1;if(this[e]!==t[e])return!1;r++}for(e in t)t.hasOwnProperty(e)&&i.indexOf(e)<0&&r--;return 0===r},Ot.API={events:[]},Ot.version="2.5.1";var kt=Ot.API,Nt=1,jt=function(t){return t.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Ft=function(t){return t.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Et=function(t){return t.toFixed(2)},It=function(t){return t.toFixed(5)};kt.__acroform__={};var Mt=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t},Dt=function(t){return t*Nt},Bt=function(t){var e=new te,i=pe.internal.getHeight(t)||0,n=pe.internal.getWidth(t)||0;return e.BBox=[0,0,Number(Et(n)),Number(Et(i))],e},Rt=kt.__acroform__.setBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return t|1<<e},zt=kt.__acroform__.clearBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return t&~(1<<e)},qt=kt.__acroform__.getBit=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return 0==(t&1<<e)?0:1},Ut=kt.__acroform__.getBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return qt(t,e-1)},Wt=kt.__acroform__.setBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return Rt(t,e-1)},Ht=kt.__acroform__.clearBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return zt(t,e-1)},Vt=kt.__acroform__.calculateCoordinates=function(t,e){var i=e.internal.getHorizontalCoordinate,n=e.internal.getVerticalCoordinate,r=t[0],o=t[1],s=t[2],a=t[3],h={};return h.lowerLeft_X=i(r)||0,h.lowerLeft_Y=n(o+a)||0,h.upperRight_X=i(r+s)||0,h.upperRight_Y=n(o)||0,[Number(Et(h.lowerLeft_X)),Number(Et(h.lowerLeft_Y)),Number(Et(h.upperRight_X)),Number(Et(h.upperRight_Y))]},Gt=function(t){if(t.appearanceStreamContent)return t.appearanceStreamContent;if(t.V||t.DV){var e=[],i=t._V||t.DV,n=Xt(t,i),r=t.scope.internal.getFont(t.fontName,t.fontStyle).id;e.push("/Tx BMC"),e.push("q"),e.push("BT"),e.push(t.scope.__private__.encodeColorString(t.color)),e.push("/"+r+" "+Et(n.fontSize)+" Tf"),e.push("1 0 0 1 0 0 Tm"),e.push(n.text),e.push("ET"),e.push("Q"),e.push("EMC");var o=Bt(t);return o.scope=t.scope,o.stream=e.join("\n"),o}},Xt=function(t,e){var i=0===t.fontSize?t.maxFontSize:t.fontSize,n={text:"",fontSize:""},r=(e=")"==(e="("==e.substr(0,1)?e.substr(1):e).substr(e.length-1)?e.substr(0,e.length-1):e).split(" ");r=t.multiline?r.map((function(t){return t.split("\n")})):r.map((function(t){return[t]}));var o=i,s=pe.internal.getHeight(t)||0;s=s<0?-s:s;var a=pe.internal.getWidth(t)||0;a=a<0?-a:a;var h=function(e,i,n){if(e+1<r.length){var o=i+" "+r[e+1][0];return Yt(o,t,n).width<=a-4}return!1};o++;t:for(;o>0;){e="",o--;var c,l,u=Yt("3",t,o).height,f=t.multiline?s-o:(s-u)/2,d=f+=2,p=0,g=0,m=0;if(o<=0){e="(...) Tj\n",e+="% Width of Text: "+Yt(e,t,o=12).width+", FieldWidth:"+a+"\n";break}for(var v="",y=0,b=0;b<r.length;b++)if(r.hasOwnProperty(b)){var w=!1;if(1!==r[b].length&&m!==r[b].length-1){if((u+2)*(y+2)+2>s)continue t;v+=r[b][m],w=!0,g=b,b--}else{v=" "==(v+=r[b][m]+" ").substr(v.length-1)?v.substr(0,v.length-1):v;var x=parseInt(b),_=h(x,v,o),S=b>=r.length-1;if(_&&!S){v+=" ",m=0;continue}if(_||S){if(S)g=x;else if(t.multiline&&(u+2)*(y+2)+2>s)continue t}else{if(!t.multiline)continue t;if((u+2)*(y+2)+2>s)continue t;g=x}}for(var C="",A=p;A<=g;A++){var L=r[A];if(t.multiline){if(A===g){C+=L[m]+" ",m=(m+1)%L.length;continue}if(A===p){C+=L[L.length-1]+" ";continue}}C+=L[0]+" "}switch(C=" "==C.substr(C.length-1)?C.substr(0,C.length-1):C,l=Yt(C,t,o).width,t.textAlign){case"right":c=a-l-2;break;case"center":c=(a-l)/2;break;default:c=2}e+=Et(c)+" "+Et(d)+" Td\n",e+="("+jt(C)+") Tj\n",e+=-Et(c)+" 0 Td\n",d=-(o+2),l=0,p=w?g:g+1,y++,v=""}break}return n.text=e,n.fontSize=o,n},Yt=function(t,e,i){var n=e.scope.internal.getFont(e.fontName,e.fontStyle),r=e.scope.getStringUnitWidth(t,{font:n,fontSize:parseFloat(i),charSpace:0})*parseFloat(i);return{height:e.scope.getStringUnitWidth("3",{font:n,fontSize:parseFloat(i),charSpace:0})*parseFloat(i)*1.5,width:r}},Kt={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},Jt=function(t,e){var i={type:"reference",object:t};void 0===e.internal.getPageInfo(t.page).pageContext.annotations.find((function(t){return t.type===i.type&&t.object===i.object}))&&e.internal.getPageInfo(t.page).pageContext.annotations.push(i)},Zt=kt.__acroform__.arrayToPdfArray=function(t,e,i){var r=function(t){return t};if(Array.isArray(t)){for(var o="[",s=0;s<t.length;s++)switch(0!==s&&(o+=" "),(0,n.Z)(t[s])){case"boolean":case"number":case"object":o+=t[s].toString();break;case"string":"/"!==t[s].substr(0,1)?(void 0!==e&&i&&(r=i.internal.getEncryptor(e)),o+="("+jt(r(t[s].toString()))+")"):o+=t[s].toString()}return o+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},$t=function(t,e,i){var n=function(t){return t};return void 0!==e&&i&&(n=i.internal.getEncryptor(e)),(t=t||"").toString(),"("+jt(n(t))+")"},Qt=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(void 0===this._objId){if(void 0===this.scope)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(t){this._objId=t}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};Qt.prototype.toString=function(){return this.objId+" 0 R"},Qt.prototype.putStream=function(){var t=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:t,objectId:this.objId}),this.scope.internal.out("endobj")},Qt.prototype.getKeyValueListForStream=function(){var t=[],e=Object.getOwnPropertyNames(this).filter((function(t){return"content"!=t&&"appearanceStreamContent"!=t&&"scope"!=t&&"objId"!=t&&"_"!=t.substring(0,1)}));for(var i in e)if(!1===Object.getOwnPropertyDescriptor(this,e[i]).configurable){var n=e[i],r=this[n];r&&(Array.isArray(r)?t.push({key:n,value:Zt(r,this.objId,this.scope)}):r instanceof Qt?(r.scope=this.scope,t.push({key:n,value:r.objId+" 0 R"})):"function"!=typeof r&&t.push({key:n,value:r}))}return t};var te=function(){Qt.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var t,e=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(e){t=e.trim()},get:function(){return t||null}})};Mt(te,Qt);var ee=function(){Qt.call(this);var t,e=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return e.length>0?e:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return e}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(t){var e=function(t){return t};return this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),"("+jt(e(t))+")"}},set:function(e){t=e}})};Mt(ee,Qt);var ie=function t(){Qt.call(this);var e=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return e},set:function(t){if(isNaN(t))throw new Error('Invalid value "'+t+'" for attribute F supplied.');e=t}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(e,3))},set:function(t){!0===Boolean(t)?this.F=Wt(e,3):this.F=Ht(e,3)}});var i=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return i},set:function(t){if(isNaN(t))throw new Error('Invalid value "'+t+'" for attribute Ff supplied.');i=t}});var n=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(0!==n.length)return n},set:function(t){n=void 0!==t?t:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[0])?0:n[0]},set:function(t){n[0]=t}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[1])?0:n[1]},set:function(t){n[1]=t}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[2])?0:n[2]},set:function(t){n[2]=t}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[3])?0:n[3]},set:function(t){n[3]=t}});var r="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return r},set:function(t){switch(t){case"/Btn":case"/Tx":case"/Ch":case"/Sig":r=t;break;default:throw new Error('Invalid value "'+t+'" for attribute FT supplied.')}}});var o=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!o||o.length<1){if(this instanceof le)return;o="FieldObject"+t.FieldNum++}var e=function(t){return t};return this.scope&&(e=this.scope.internal.getEncryptor(this.objId)),"("+jt(e(o))+")"},set:function(t){o=t.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return o},set:function(t){o=t}});var s="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return s},set:function(t){s=t}});var a="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return a},set:function(t){a=t}});var h=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return h},set:function(t){h=t}});var c=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return void 0===c?50/Nt:c},set:function(t){c=t}});var l="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return l},set:function(t){l=t}});var u="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!u||this instanceof le||this instanceof fe))return $t(u,this.objId,this.scope)},set:function(t){t=t.toString(),u=t}});var f=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(f)return this instanceof ae==0?$t(f,this.objId,this.scope):f},set:function(t){t=t.toString(),f=this instanceof ae==0?"("===t.substr(0,1)?Ft(t.substr(1,t.length-2)):Ft(t):t}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof ae==1?Ft(f.substr(1,f.length-1)):f},set:function(t){t=t.toString(),f=this instanceof ae==1?"/"+t:t}});var d=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(d)return d},set:function(t){this.V=t}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(d)return this instanceof ae==0?$t(d,this.objId,this.scope):d},set:function(t){t=t.toString(),d=this instanceof ae==0?"("===t.substr(0,1)?Ft(t.substr(1,t.length-2)):Ft(t):t}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof ae==1?Ft(d.substr(1,d.length-1)):d},set:function(t){t=t.toString(),d=this instanceof ae==1?"/"+t:t}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var p,g=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return g},set:function(t){t=Boolean(t),g=t}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(p)return p},set:function(t){p=t}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,1))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,1):this.Ff=Ht(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,2))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,2):this.Ff=Ht(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,3))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,3):this.Ff=Ht(this.Ff,3)}});var m=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(null!==m)return m},set:function(t){if(-1===[0,1,2].indexOf(t))throw new Error('Invalid value "'+t+'" for attribute Q supplied.');m=t}}),Object.defineProperty(this,"textAlign",{get:function(){var t;switch(m){case 0:default:t="left";break;case 1:t="center";break;case 2:t="right"}return t},configurable:!0,enumerable:!0,set:function(t){switch(t){case"right":case 2:m=2;break;case"center":case 1:m=1;break;default:m=0}}})};Mt(ie,Qt);var ne=function(){ie.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var t=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return t},set:function(e){t=e}});var e=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return Zt(e,this.objId,this.scope)},set:function(t){var i,n;n=[],"string"==typeof(i=t)&&(n=function(t,e,i){i||(i=1);for(var n,r=[];n=e.exec(t);)r.push(n[i]);return r}(i,/\((.*?)\)/g)),e=n}}),this.getOptions=function(){return e},this.setOptions=function(t){e=t,this.sort&&e.sort()},this.addOption=function(t){t=(t=t||"").toString(),e.push(t),this.sort&&e.sort()},this.removeOption=function(t,i){for(i=i||!1,t=(t=t||"").toString();-1!==e.indexOf(t)&&(e.splice(e.indexOf(t),1),!1!==i););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,18))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,18):this.Ff=Ht(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,19))},set:function(t){!0===this.combo&&(!0===Boolean(t)?this.Ff=Wt(this.Ff,19):this.Ff=Ht(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,20))},set:function(t){!0===Boolean(t)?(this.Ff=Wt(this.Ff,20),e.sort()):this.Ff=Ht(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,22))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,22):this.Ff=Ht(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,23))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,23):this.Ff=Ht(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,27))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,27):this.Ff=Ht(this.Ff,27)}}),this.hasAppearanceStream=!1};Mt(ne,ie);var re=function(){ne.call(this),this.fontName="helvetica",this.combo=!1};Mt(re,ne);var oe=function(){re.call(this),this.combo=!0};Mt(oe,re);var se=function(){oe.call(this),this.edit=!0};Mt(se,oe);var ae=function(){ie.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,15))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,15):this.Ff=Ht(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,16))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,16):this.Ff=Ht(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,17))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,17):this.Ff=Ht(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,26))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,26):this.Ff=Ht(this.Ff,26)}});var t,e={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var t=function(t){return t};if(this.scope&&(t=this.scope.internal.getEncryptor(this.objId)),0!==Object.keys(e).length){var i,n=[];for(i in n.push("<<"),e)n.push("/"+i+" ("+jt(t(e[i]))+")");return n.push(">>"),n.join("\n")}},set:function(t){"object"===(0,n.Z)(t)&&(e=t)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return e.CA||""},set:function(t){"string"==typeof t&&(e.CA=t)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return t.substr(1,t.length-1)},set:function(e){t="/"+e}})};Mt(ae,ie);var he=function(){ae.call(this),this.pushButton=!0};Mt(he,ae);var ce=function(){ae.call(this),this.radio=!0,this.pushButton=!1;var t=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=void 0!==e?e:[]}})};Mt(ce,ae);var le=function(){var t,e;ie.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return e},set:function(t){e=t}});var i,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var t=function(t){return t};this.scope&&(t=this.scope.internal.getEncryptor(this.objId));var e,i=[];for(e in i.push("<<"),r)i.push("/"+e+" ("+jt(t(r[e]))+")");return i.push(">>"),i.join("\n")},set:function(t){"object"===(0,n.Z)(t)&&(r=t)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||""},set:function(t){"string"==typeof t&&(r.CA=t)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return i},set:function(t){i=t}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return i.substr(1,i.length-1)},set:function(t){i="/"+t}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=pe.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};Mt(le,ie),ce.prototype.setAppearance=function(t){if(!("createAppearanceStream"in t)||!("getCA"in t))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var e in this.Kids)if(this.Kids.hasOwnProperty(e)){var i=this.Kids[e];i.appearanceStreamContent=t.createAppearanceStream(i.optionName),i.caption=t.getCA()}},ce.prototype.createOption=function(t){var e=new le;return e.Parent=this,e.optionName=t,this.Kids.push(e),ge.call(this.scope,e),e};var ue=function(){ae.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=pe.CheckBox.createAppearanceStream()};Mt(ue,ae);var fe=function(){ie.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,13))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,13):this.Ff=Ht(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,21))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,21):this.Ff=Ht(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,23))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,23):this.Ff=Ht(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,24))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,24):this.Ff=Ht(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,25))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,25):this.Ff=Ht(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,26))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,26):this.Ff=Ht(this.Ff,26)}});var t=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return t},set:function(e){Number.isInteger(e)&&(t=e)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};Mt(fe,ie);var de=function(){fe.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return Boolean(Ut(this.Ff,14))},set:function(t){!0===Boolean(t)?this.Ff=Wt(this.Ff,14):this.Ff=Ht(this.Ff,14)}}),this.password=!0};Mt(de,fe);var pe={CheckBox:{createAppearanceStream:function(){return{N:{On:pe.CheckBox.YesNormal},D:{On:pe.CheckBox.YesPushDown,Off:pe.CheckBox.OffPushDown}}},YesPushDown:function(t){var e=Bt(t);e.scope=t.scope;var i=[],n=t.scope.internal.getFont(t.fontName,t.fontStyle).id,r=t.scope.__private__.encodeColorString(t.color),o=Xt(t,t.caption);return i.push("0.749023 g"),i.push("0 0 "+Et(pe.internal.getWidth(t))+" "+Et(pe.internal.getHeight(t))+" re"),i.push("f"),i.push("BMC"),i.push("q"),i.push("0 0 1 rg"),i.push("/"+n+" "+Et(o.fontSize)+" Tf "+r),i.push("BT"),i.push(o.text),i.push("ET"),i.push("Q"),i.push("EMC"),e.stream=i.join("\n"),e},YesNormal:function(t){var e=Bt(t);e.scope=t.scope;var i=t.scope.internal.getFont(t.fontName,t.fontStyle).id,n=t.scope.__private__.encodeColorString(t.color),r=[],o=pe.internal.getHeight(t),s=pe.internal.getWidth(t),a=Xt(t,t.caption);return r.push("1 g"),r.push("0 0 "+Et(s)+" "+Et(o)+" re"),r.push("f"),r.push("q"),r.push("0 0 1 rg"),r.push("0 0 "+Et(s-1)+" "+Et(o-1)+" re"),r.push("W"),r.push("n"),r.push("0 g"),r.push("BT"),r.push("/"+i+" "+Et(a.fontSize)+" Tf "+n),r.push(a.text),r.push("ET"),r.push("Q"),e.stream=r.join("\n"),e},OffPushDown:function(t){var e=Bt(t);e.scope=t.scope;var i=[];return i.push("0.749023 g"),i.push("0 0 "+Et(pe.internal.getWidth(t))+" "+Et(pe.internal.getHeight(t))+" re"),i.push("f"),e.stream=i.join("\n"),e}},RadioButton:{Circle:{createAppearanceStream:function(t){var e={D:{Off:pe.RadioButton.Circle.OffPushDown},N:{}};return e.N[t]=pe.RadioButton.Circle.YesNormal,e.D[t]=pe.RadioButton.Circle.YesPushDown,e},getCA:function(){return"l"},YesNormal:function(t){var e=Bt(t);e.scope=t.scope;var i=[],n=pe.internal.getWidth(t)<=pe.internal.getHeight(t)?pe.internal.getWidth(t)/4:pe.internal.getHeight(t)/4;n=Number((.9*n).toFixed(5));var r=pe.internal.Bezier_C,o=Number((n*r).toFixed(5));return i.push("q"),i.push("1 0 0 1 "+It(pe.internal.getWidth(t)/2)+" "+It(pe.internal.getHeight(t)/2)+" cm"),i.push(n+" 0 m"),i.push(n+" "+o+" "+o+" "+n+" 0 "+n+" c"),i.push("-"+o+" "+n+" -"+n+" "+o+" -"+n+" 0 c"),i.push("-"+n+" -"+o+" -"+o+" -"+n+" 0 -"+n+" c"),i.push(o+" -"+n+" "+n+" -"+o+" "+n+" 0 c"),i.push("f"),i.push("Q"),e.stream=i.join("\n"),e},YesPushDown:function(t){var e=Bt(t);e.scope=t.scope;var i=[],n=pe.internal.getWidth(t)<=pe.internal.getHeight(t)?pe.internal.getWidth(t)/4:pe.internal.getHeight(t)/4;n=Number((.9*n).toFixed(5));var r=Number((2*n).toFixed(5)),o=Number((r*pe.internal.Bezier_C).toFixed(5)),s=Number((n*pe.internal.Bezier_C).toFixed(5));return i.push("0.749023 g"),i.push("q"),i.push("1 0 0 1 "+It(pe.internal.getWidth(t)/2)+" "+It(pe.internal.getHeight(t)/2)+" cm"),i.push(r+" 0 m"),i.push(r+" "+o+" "+o+" "+r+" 0 "+r+" c"),i.push("-"+o+" "+r+" -"+r+" "+o+" -"+r+" 0 c"),i.push("-"+r+" -"+o+" -"+o+" -"+r+" 0 -"+r+" c"),i.push(o+" -"+r+" "+r+" -"+o+" "+r+" 0 c"),i.push("f"),i.push("Q"),i.push("0 g"),i.push("q"),i.push("1 0 0 1 "+It(pe.internal.getWidth(t)/2)+" "+It(pe.internal.getHeight(t)/2)+" cm"),i.push(n+" 0 m"),i.push(n+" "+s+" "+s+" "+n+" 0 "+n+" c"),i.push("-"+s+" "+n+" -"+n+" "+s+" -"+n+" 0 c"),i.push("-"+n+" -"+s+" -"+s+" -"+n+" 0 -"+n+" c"),i.push(s+" -"+n+" "+n+" -"+s+" "+n+" 0 c"),i.push("f"),i.push("Q"),e.stream=i.join("\n"),e},OffPushDown:function(t){var e=Bt(t);e.scope=t.scope;var i=[],n=pe.internal.getWidth(t)<=pe.internal.getHeight(t)?pe.internal.getWidth(t)/4:pe.internal.getHeight(t)/4;n=Number((.9*n).toFixed(5));var r=Number((2*n).toFixed(5)),o=Number((r*pe.internal.Bezier_C).toFixed(5));return i.push("0.749023 g"),i.push("q"),i.push("1 0 0 1 "+It(pe.internal.getWidth(t)/2)+" "+It(pe.internal.getHeight(t)/2)+" cm"),i.push(r+" 0 m"),i.push(r+" "+o+" "+o+" "+r+" 0 "+r+" c"),i.push("-"+o+" "+r+" -"+r+" "+o+" -"+r+" 0 c"),i.push("-"+r+" -"+o+" -"+o+" -"+r+" 0 -"+r+" c"),i.push(o+" -"+r+" "+r+" -"+o+" "+r+" 0 c"),i.push("f"),i.push("Q"),e.stream=i.join("\n"),e}},Cross:{createAppearanceStream:function(t){var e={D:{Off:pe.RadioButton.Cross.OffPushDown},N:{}};return e.N[t]=pe.RadioButton.Cross.YesNormal,e.D[t]=pe.RadioButton.Cross.YesPushDown,e},getCA:function(){return"8"},YesNormal:function(t){var e=Bt(t);e.scope=t.scope;var i=[],n=pe.internal.calculateCross(t);return i.push("q"),i.push("1 1 "+Et(pe.internal.getWidth(t)-2)+" "+Et(pe.internal.getHeight(t)-2)+" re"),i.push("W"),i.push("n"),i.push(Et(n.x1.x)+" "+Et(n.x1.y)+" m"),i.push(Et(n.x2.x)+" "+Et(n.x2.y)+" l"),i.push(Et(n.x4.x)+" "+Et(n.x4.y)+" m"),i.push(Et(n.x3.x)+" "+Et(n.x3.y)+" l"),i.push("s"),i.push("Q"),e.stream=i.join("\n"),e},YesPushDown:function(t){var e=Bt(t);e.scope=t.scope;var i=pe.internal.calculateCross(t),n=[];return n.push("0.749023 g"),n.push("0 0 "+Et(pe.internal.getWidth(t))+" "+Et(pe.internal.getHeight(t))+" re"),n.push("f"),n.push("q"),n.push("1 1 "+Et(pe.internal.getWidth(t)-2)+" "+Et(pe.internal.getHeight(t)-2)+" re"),n.push("W"),n.push("n"),n.push(Et(i.x1.x)+" "+Et(i.x1.y)+" m"),n.push(Et(i.x2.x)+" "+Et(i.x2.y)+" l"),n.push(Et(i.x4.x)+" "+Et(i.x4.y)+" m"),n.push(Et(i.x3.x)+" "+Et(i.x3.y)+" l"),n.push("s"),n.push("Q"),e.stream=n.join("\n"),e},OffPushDown:function(t){var e=Bt(t);e.scope=t.scope;var i=[];return i.push("0.749023 g"),i.push("0 0 "+Et(pe.internal.getWidth(t))+" "+Et(pe.internal.getHeight(t))+" re"),i.push("f"),e.stream=i.join("\n"),e}}},createDefaultAppearanceStream:function(t){var e=t.scope.internal.getFont(t.fontName,t.fontStyle).id,i=t.scope.__private__.encodeColorString(t.color);return"/"+e+" "+t.fontSize+" Tf "+i}};pe.internal={Bezier_C:.551915024494,calculateCross:function(t){var e=pe.internal.getWidth(t),i=pe.internal.getHeight(t),n=Math.min(e,i);return{x1:{x:(e-n)/2,y:(i-n)/2+n},x2:{x:(e-n)/2+n,y:(i-n)/2},x3:{x:(e-n)/2,y:(i-n)/2},x4:{x:(e-n)/2+n,y:(i-n)/2+n}}}},pe.internal.getWidth=function(t){var e=0;return"object"===(0,n.Z)(t)&&(e=Dt(t.Rect[2])),e},pe.internal.getHeight=function(t){var e=0;return"object"===(0,n.Z)(t)&&(e=Dt(t.Rect[3])),e};var ge=kt.addField=function(t){if(function(t,e){if(e.scope=t,void 0!==t.internal&&(void 0===t.internal.acroformPlugin||!1===t.internal.acroformPlugin.isInitialized)){if(ie.FieldNum=0,t.internal.acroformPlugin=JSON.parse(JSON.stringify(Kt)),t.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");Nt=t.internal.scaleFactor,t.internal.acroformPlugin.acroFormDictionaryRoot=new ee,t.internal.acroformPlugin.acroFormDictionaryRoot.scope=t,t.internal.acroformPlugin.acroFormDictionaryRoot._eventID=t.internal.events.subscribe("postPutResources",(function(){var e;(e=t).internal.events.unsubscribe(e.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete e.internal.acroformPlugin.acroFormDictionaryRoot._eventID,e.internal.acroformPlugin.printedOut=!0})),t.internal.events.subscribe("buildDocument",(function(){!function(t){t.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var e=t.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];n.objId=void 0,n.hasAnnotation&&Jt(n,t)}}(t)})),t.internal.events.subscribe("putCatalog",(function(){!function(t){if(void 0===t.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("putCatalogCallback: Root missing.");t.internal.write("/AcroForm "+t.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")}(t)})),t.internal.events.subscribe("postPutPages",(function(e){!function(t,e){var i=!t;for(var r in t||(e.internal.newObjectDeferredBegin(e.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),e.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),t=t||e.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(t.hasOwnProperty(r)){var o=t[r],s=[],a=o.Rect;if(o.Rect&&(o.Rect=Vt(o.Rect,e)),e.internal.newObjectDeferredBegin(o.objId,!0),o.DA=pe.createDefaultAppearanceStream(o),"object"===(0,n.Z)(o)&&"function"==typeof o.getKeyValueListForStream&&(s=o.getKeyValueListForStream()),o.Rect=a,o.hasAppearanceStream&&!o.appearanceStreamContent){var h=Gt(o);s.push({key:"AP",value:"<</N "+h+">>"}),e.internal.acroformPlugin.xForms.push(h)}if(o.appearanceStreamContent){var c="";for(var l in o.appearanceStreamContent)if(o.appearanceStreamContent.hasOwnProperty(l)){var u=o.appearanceStreamContent[l];if(c+="/"+l+" ",c+="<<",Object.keys(u).length>=1||Array.isArray(u)){for(var r in u)if(u.hasOwnProperty(r)){var f=u[r];"function"==typeof f&&(f=f.call(e,o)),c+="/"+r+" "+f+" ",e.internal.acroformPlugin.xForms.indexOf(f)>=0||e.internal.acroformPlugin.xForms.push(f)}}else"function"==typeof(f=u)&&(f=f.call(e,o)),c+="/"+r+" "+f,e.internal.acroformPlugin.xForms.indexOf(f)>=0||e.internal.acroformPlugin.xForms.push(f);c+=">>"}s.push({key:"AP",value:"<<\n"+c+">>"})}e.internal.putStream({additionalKeyValues:s,objectId:o.objId}),e.internal.out("endobj")}i&&function(t,e){for(var i in t)if(t.hasOwnProperty(i)){var r=i,o=t[i];e.internal.newObjectDeferredBegin(o.objId,!0),"object"===(0,n.Z)(o)&&"function"==typeof o.putStream&&o.putStream(),delete t[r]}}(e.internal.acroformPlugin.xForms,e)}(e,t)})),t.internal.acroformPlugin.isInitialized=!0}}(this,t),!(t instanceof ie))throw new Error("Invalid argument passed to jsPDF.addField.");var e;return(e=t).scope.internal.acroformPlugin.printedOut&&(e.scope.internal.acroformPlugin.printedOut=!1,e.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),e.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(e),t.page=t.scope.internal.getCurrentPageInfo().pageNumber,this};kt.AcroFormChoiceField=ne,kt.AcroFormListBox=re,kt.AcroFormComboBox=oe,kt.AcroFormEditBox=se,kt.AcroFormButton=ae,kt.AcroFormPushButton=he,kt.AcroFormRadioButton=ce,kt.AcroFormCheckBox=ue,kt.AcroFormTextField=fe,kt.AcroFormPasswordField=de,kt.AcroFormAppearance=pe,kt.AcroForm={ChoiceField:ne,ListBox:re,ComboBox:oe,EditBox:se,Button:ae,PushButton:he,RadioButton:ce,CheckBox:ue,TextField:fe,PasswordField:de,Appearance:pe},Ot.AcroForm={ChoiceField:ne,ListBox:re,ComboBox:oe,EditBox:se,Button:ae,PushButton:he,RadioButton:ce,CheckBox:ue,TextField:fe,PasswordField:de,Appearance:pe};var me,ve,ye=Ot.AcroForm;function be(t){return t.reduce((function(t,e,i){return t[e]=i,t}),{})}!function(t){t.__addimage__={};var e="UNKNOWN",i={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},r=t.__addimage__.getImageFileTypeByImageData=function(t,n){var r,o,s,a,h,c=e;if("RGBA"===(n=n||e)||void 0!==t.data&&t.data instanceof Uint8ClampedArray&&"height"in t&&"width"in t)return"RGBA";if(S(t))for(h in i)for(s=i[h],r=0;r<s.length;r+=1){for(a=!0,o=0;o<s[r].length;o+=1)if(void 0!==s[r][o]&&s[r][o]!==t[o]){a=!1;break}if(!0===a){c=h;break}}else for(h in i)for(s=i[h],r=0;r<s.length;r+=1){for(a=!0,o=0;o<s[r].length;o+=1)if(void 0!==s[r][o]&&s[r][o]!==t.charCodeAt(o)){a=!1;break}if(!0===a){c=h;break}}return c===e&&n!==e&&(c=n),c},o=function t(e){for(var i=this.internal.write,n=this.internal.putStream,r=(0,this.internal.getFilters)();-1!==r.indexOf("FlateEncode");)r.splice(r.indexOf("FlateEncode"),1);e.objectId=this.internal.newObject();var o=[];if(o.push({key:"Type",value:"/XObject"}),o.push({key:"Subtype",value:"/Image"}),o.push({key:"Width",value:e.width}),o.push({key:"Height",value:e.height}),e.colorSpace===v.INDEXED?o.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(e.palette.length/3-1)+" "+("sMask"in e&&void 0!==e.sMask?e.objectId+2:e.objectId+1)+" 0 R]"}):(o.push({key:"ColorSpace",value:"/"+e.colorSpace}),e.colorSpace===v.DEVICE_CMYK&&o.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),o.push({key:"BitsPerComponent",value:e.bitsPerComponent}),"decodeParameters"in e&&void 0!==e.decodeParameters&&o.push({key:"DecodeParms",value:"<<"+e.decodeParameters+">>"}),"transparency"in e&&Array.isArray(e.transparency)){for(var s="",a=0,h=e.transparency.length;a<h;a++)s+=e.transparency[a]+" "+e.transparency[a]+" ";o.push({key:"Mask",value:"["+s+"]"})}void 0!==e.sMask&&o.push({key:"SMask",value:e.objectId+1+" 0 R"});var c=void 0!==e.filter?["/"+e.filter]:void 0;if(n({data:e.data,additionalKeyValues:o,alreadyAppliedFilters:c,objectId:e.objectId}),i("endobj"),"sMask"in e&&void 0!==e.sMask){var l="/Predictor "+e.predictor+" /Colors 1 /BitsPerComponent "+e.bitsPerComponent+" /Columns "+e.width,u={width:e.width,height:e.height,colorSpace:"DeviceGray",bitsPerComponent:e.bitsPerComponent,decodeParameters:l,data:e.sMask};"filter"in e&&(u.filter=e.filter),t.call(this,u)}if(e.colorSpace===v.INDEXED){var f=this.internal.newObject();n({data:A(new Uint8Array(e.palette)),objectId:f}),i("endobj")}},s=function(){var t=this.internal.collections.addImage_images;for(var e in t)o.call(this,t[e])},a=function(){var t,e=this.internal.collections.addImage_images,i=this.internal.write;for(var n in e)i("/I"+(t=e[n]).index,t.objectId,"0","R")},h=function(){this.internal.collections.addImage_images||(this.internal.collections.addImage_images={},this.internal.events.subscribe("putResources",s),this.internal.events.subscribe("putXobjectDict",a))},c=function(){var t=this.internal.collections.addImage_images;return h.call(this),t},l=function(){return Object.keys(this.internal.collections.addImage_images).length},u=function(e){return"function"==typeof t["process"+e.toUpperCase()]},f=function(t){return"object"===(0,n.Z)(t)&&1===t.nodeType},d=function(e,i){if("IMG"===e.nodeName&&e.hasAttribute("src")){var n=""+e.getAttribute("src");if(0===n.indexOf("data:image/"))return it(unescape(n).split("base64,").pop());var r=t.loadFile(n,!0);if(void 0!==r)return r}if("CANVAS"===e.nodeName){if(0===e.width||0===e.height)throw new Error("Given canvas must have data. Canvas width: "+e.width+", height: "+e.height);var o;switch(i){case"PNG":o="image/png";break;case"WEBP":o="image/webp";break;default:o="image/jpeg"}return it(e.toDataURL(o,1).split("base64,").pop())}},p=function(t){var e=this.internal.collections.addImage_images;if(e)for(var i in e)if(t===e[i].alias)return e[i]},g=function(t,e,i){return t||e||(t=-96,e=-96),t<0&&(t=-1*i.width*72/t/this.internal.scaleFactor),e<0&&(e=-1*i.height*72/e/this.internal.scaleFactor),0===t&&(t=e*i.width/i.height),0===e&&(e=t*i.height/i.width),[t,e]},m=function(t,e,i,n,r,o){var s=g.call(this,i,n,r),a=this.internal.getCoordinateString,h=this.internal.getVerticalCoordinateString,l=c.call(this);if(i=s[0],n=s[1],l[r.index]=r,o){o*=Math.PI/180;var u=Math.cos(o),f=Math.sin(o),d=function(t){return t.toFixed(4)},p=[d(u),d(f),d(-1*f),d(u),0,0,"cm"]}this.internal.write("q"),o?(this.internal.write([1,"0","0",1,a(t),h(e+n),"cm"].join(" ")),this.internal.write(p.join(" ")),this.internal.write([a(i),"0","0",a(n),"0","0","cm"].join(" "))):this.internal.write([a(i),"0","0",a(n),a(t),h(e+n),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+r.index+" Do"),this.internal.write("Q")},v=t.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};t.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var y=t.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},b=t.__addimage__.sHashCode=function(t){var e,i,n=0;if("string"==typeof t)for(i=t.length,e=0;e<i;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;else if(S(t))for(i=t.byteLength/2,e=0;e<i;e++)n=(n<<5)-n+t[e],n|=0;return n},w=t.__addimage__.validateStringAsBase64=function(t){(t=t||"").toString().trim();var e=!0;return 0===t.length&&(e=!1),t.length%4!=0&&(e=!1),!1===/^[A-Za-z0-9+/]+$/.test(t.substr(0,t.length-2))&&(e=!1),!1===/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(t.substr(-2))&&(e=!1),e},x=t.__addimage__.extractImageFromDataUrl=function(t){var e=(t=t||"").split("base64,"),i=null;if(2===e.length){var n=/^data:(\w*\/\w*);*(charset=(?!charset=)[\w=-]*)*;*$/.exec(e[0]);Array.isArray(n)&&(i={mimeType:n[1],charset:n[2],data:e[1]})}return i},_=t.__addimage__.supportsArrayBuffer=function(){return"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array};t.__addimage__.isArrayBuffer=function(t){return _()&&t instanceof ArrayBuffer};var S=t.__addimage__.isArrayBufferView=function(t){return _()&&"undefined"!=typeof Uint32Array&&(t instanceof Int8Array||t instanceof Uint8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)},C=t.__addimage__.binaryStringToUint8Array=function(t){for(var e=t.length,i=new Uint8Array(e),n=0;n<e;n++)i[n]=t.charCodeAt(n);return i},A=t.__addimage__.arrayBufferToBinaryString=function(t){for(var e="",i=S(t)?t:new Uint8Array(t),n=0;n<i.length;n+=8192)e+=String.fromCharCode.apply(null,i.subarray(n,n+8192));return e};t.addImage=function(){var t,i,r,o,s,a,c,l,u;if("number"==typeof arguments[1]?(i=e,r=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],c=arguments[5],l=arguments[6],u=arguments[7]):(i=arguments[1],r=arguments[2],o=arguments[3],s=arguments[4],a=arguments[5],c=arguments[6],l=arguments[7],u=arguments[8]),"object"===(0,n.Z)(t=arguments[0])&&!f(t)&&"imageData"in t){var d=t;t=d.imageData,i=d.format||i||e,r=d.x||r||0,o=d.y||o||0,s=d.w||d.width||s,a=d.h||d.height||a,c=d.alias||c,l=d.compression||l,u=d.rotation||d.angle||u}var p=this.internal.getFilters();if(void 0===l&&-1!==p.indexOf("FlateEncode")&&(l="SLOW"),isNaN(r)||isNaN(o))throw new Error("Invalid coordinates passed to jsPDF.addImage");h.call(this);var g=L.call(this,t,i,c,l);return m.call(this,r,o,s,a,g,u),this};var L=function(i,n,o,s){var a,h,c;if("string"==typeof i&&r(i)===e){i=unescape(i);var g=P(i,!1);(""!==g||void 0!==(g=t.loadFile(i,!0)))&&(i=g)}if(f(i)&&(i=d(i,n)),n=r(i,n),!u(n))throw new Error("addImage does not support files of type '"+n+"', please ensure that a plugin for '"+n+"' support is added.");if((null==(c=o)||0===c.length)&&(o=function(t){return"string"==typeof t||S(t)?b(t):S(t.data)?b(t.data):null}(i)),(a=p.call(this,o))||(_()&&(i instanceof Uint8Array||"RGBA"===n||(h=i,i=C(i))),a=this["process"+n.toUpperCase()](i,l.call(this),o,function(e){return e&&"string"==typeof e&&(e=e.toUpperCase()),e in t.image_compression?e:y.NONE}(s),h)),!a)throw new Error("An unknown error occurred whilst processing the image.");return a},P=t.__addimage__.convertBase64ToBinaryString=function(t,e){var i;e="boolean"!=typeof e||e;var n,r="";if("string"==typeof t){n=null!==(i=x(t))?i.data:t;try{r=it(n)}catch(t){if(e)throw w(n)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+t.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return r};t.getImageProperties=function(i){var n,o,s="";if(f(i)&&(i=d(i)),"string"==typeof i&&r(i)===e&&(""===(s=P(i,!1))&&(s=t.loadFile(i)||""),i=s),o=r(i),!u(o))throw new Error("addImage does not support files of type '"+o+"', please ensure that a plugin for '"+o+"' support is added.");if(!_()||i instanceof Uint8Array||(i=C(i)),!(n=this["process"+o.toUpperCase()](i)))throw new Error("An unknown error occurred whilst processing the image");return n.fileType=o,n}}(Ot.API),me=Ot.API,ve=function(t){if(void 0!==t&&""!=t)return!0},Ot.API.events.push(["addPage",function(t){this.internal.getPageInfo(t.pageNumber).pageContext.annotations=[]}]),me.events.push(["putPage",function(t){for(var e,i,n,r=this.internal.getCoordinateString,o=this.internal.getVerticalCoordinateString,s=this.internal.getPageInfoByObjId(t.objId),a=t.pageContext.annotations,h=!1,c=0;c<a.length&&!h;c++)switch((e=a[c]).type){case"link":(ve(e.options.url)||ve(e.options.pageNumber))&&(h=!0);break;case"reference":case"text":case"freetext":h=!0}if(0!=h){this.internal.write("/Annots [");for(var l=0;l<a.length;l++){e=a[l];var u=this.internal.pdfEscape,f=this.internal.getEncryptor(t.objId);switch(e.type){case"reference":this.internal.write(" "+e.object.objId+" 0 R ");break;case"text":var d=this.internal.newAdditionalObject(),p=this.internal.newAdditionalObject(),g=this.internal.getEncryptor(d.objId),m=e.title||"Note";n="<</Type /Annot /Subtype /Text "+(i="/Rect ["+r(e.bounds.x)+" "+o(e.bounds.y+e.bounds.h)+" "+r(e.bounds.x+e.bounds.w)+" "+o(e.bounds.y)+"] ")+"/Contents ("+u(g(e.contents))+")",n+=" /Popup "+p.objId+" 0 R",n+=" /P "+s.objId+" 0 R",n+=" /T ("+u(g(m))+") >>",d.content=n;var v=d.objId+" 0 R";n="<</Type /Annot /Subtype /Popup "+(i="/Rect ["+r(e.bounds.x+30)+" "+o(e.bounds.y+e.bounds.h)+" "+r(e.bounds.x+e.bounds.w+30)+" "+o(e.bounds.y)+"] ")+" /Parent "+v,e.open&&(n+=" /Open true"),n+=" >>",p.content=n,this.internal.write(d.objId,"0 R",p.objId,"0 R");break;case"freetext":i="/Rect ["+r(e.bounds.x)+" "+o(e.bounds.y)+" "+r(e.bounds.x+e.bounds.w)+" "+o(e.bounds.y+e.bounds.h)+"] ";var y=e.color||"#000000";n="<</Type /Annot /Subtype /FreeText "+i+"/Contents ("+u(f(e.contents))+")",n+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+y+")",n+=" /Border [0 0 0]",n+=" >>",this.internal.write(n);break;case"link":if(e.options.name){var b=this.annotations._nameMap[e.options.name];e.options.pageNumber=b.page,e.options.top=b.y}else e.options.top||(e.options.top=0);if(i="/Rect ["+e.finalBounds.x+" "+e.finalBounds.y+" "+e.finalBounds.w+" "+e.finalBounds.h+"] ",n="",e.options.url)n="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /A <</S /URI /URI ("+u(f(e.options.url))+") >>";else if(e.options.pageNumber)switch(n="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(e.options.pageNumber).objId+" 0 R",e.options.magFactor=e.options.magFactor||"XYZ",e.options.magFactor){case"Fit":n+=" /Fit]";break;case"FitH":n+=" /FitH "+e.options.top+"]";break;case"FitV":e.options.left=e.options.left||0,n+=" /FitV "+e.options.left+"]";break;default:var w=o(e.options.top);e.options.left=e.options.left||0,void 0===e.options.zoom&&(e.options.zoom=0),n+=" /XYZ "+e.options.left+" "+w+" "+e.options.zoom+"]"}""!=n&&(n+=" >>",this.internal.write(n))}}this.internal.write("]")}}]),me.createAnnotation=function(t){var e=this.internal.getCurrentPageInfo();switch(t.type){case"link":this.link(t.bounds.x,t.bounds.y,t.bounds.w,t.bounds.h,t);break;case"text":case"freetext":e.pageContext.annotations.push(t)}},me.link=function(t,e,i,n,r){var o=this.internal.getCurrentPageInfo(),s=this.internal.getCoordinateString,a=this.internal.getVerticalCoordinateString;o.pageContext.annotations.push({finalBounds:{x:s(t),y:a(e),w:s(t+i),h:a(e+n)},options:r,type:"link"})},me.textWithLink=function(t,e,i,n){var r,o,s=this.getTextWidth(t),a=this.internal.getLineHeight()/this.internal.scaleFactor;if(void 0!==n.maxWidth){o=n.maxWidth;var h=this.splitTextToSize(t,o).length;r=Math.ceil(a*h)}else o=s,r=a;return this.text(t,e,i,n),i+=.2*a,"center"===n.align&&(e-=s/2),"right"===n.align&&(e-=s),this.link(e,i-a,o,r,n),s},me.getTextWidth=function(t){var e=this.internal.getFontSize();return this.getStringUnitWidth(t)*e/this.internal.scaleFactor},function(t){var e={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},i={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},n={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},r=[1570,1571,1573,1575];t.__arabicParser__={};var o=t.__arabicParser__.isInArabicSubstitutionA=function(t){return void 0!==e[t.charCodeAt(0)]},s=t.__arabicParser__.isArabicLetter=function(t){return"string"==typeof t&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(t)},a=t.__arabicParser__.isArabicEndLetter=function(t){return s(t)&&o(t)&&e[t.charCodeAt(0)].length<=2},h=t.__arabicParser__.isArabicAlfLetter=function(t){return s(t)&&r.indexOf(t.charCodeAt(0))>=0};t.__arabicParser__.arabicLetterHasIsolatedForm=function(t){return s(t)&&o(t)&&e[t.charCodeAt(0)].length>=1};var c=t.__arabicParser__.arabicLetterHasFinalForm=function(t){return s(t)&&o(t)&&e[t.charCodeAt(0)].length>=2};t.__arabicParser__.arabicLetterHasInitialForm=function(t){return s(t)&&o(t)&&e[t.charCodeAt(0)].length>=3};var l=t.__arabicParser__.arabicLetterHasMedialForm=function(t){return s(t)&&o(t)&&4==e[t.charCodeAt(0)].length},u=t.__arabicParser__.resolveLigatures=function(t){var e=0,n=i,r="",o=0;for(e=0;e<t.length;e+=1)void 0!==n[t.charCodeAt(e)]?(o++,"number"==typeof(n=n[t.charCodeAt(e)])&&(r+=String.fromCharCode(n),n=i,o=0),e===t.length-1&&(n=i,r+=t.charAt(e-(o-1)),e-=o-1,o=0)):(n=i,r+=t.charAt(e-o),e-=o,o=0);return r};t.__arabicParser__.isArabicDiacritic=function(t){return void 0!==t&&void 0!==n[t.charCodeAt(0)]};var f=t.__arabicParser__.getCorrectForm=function(t,e,i){return s(t)?!1===o(t)?-1:!c(t)||!s(e)&&!s(i)||!s(i)&&a(e)||a(t)&&!s(e)||a(t)&&h(e)||a(t)&&a(e)?0:l(t)&&s(e)&&!a(e)&&s(i)&&c(i)?3:a(t)||!s(i)?1:2:-1},d=function(t){var i=0,n=0,r=0,o="",a="",h="",c=(t=t||"").split("\\s+"),l=[];for(i=0;i<c.length;i+=1){for(l.push(""),n=0;n<c[i].length;n+=1)o=c[i][n],a=c[i][n-1],h=c[i][n+1],s(o)?(r=f(o,a,h),l[i]+=-1!==r?String.fromCharCode(e[o.charCodeAt(0)][r]):o):l[i]+=o;l[i]=u(l[i])}return l.join(" ")},p=t.__arabicParser__.processArabic=t.processArabic=function(){var t,e="string"==typeof arguments[0]?arguments[0]:arguments[0].text,i=[];if(Array.isArray(e)){var n=0;for(i=[],n=0;n<e.length;n+=1)Array.isArray(e[n])?i.push([d(e[n][0]),e[n][1],e[n][2]]):i.push([d(e[n])]);t=i}else t=d(e);return"string"==typeof arguments[0]?t:(arguments[0].text=t,arguments[0])};t.events.push(["preProcessText",p])}(Ot.API),Ot.API.autoPrint=function(t){var e;return"javascript"===((t=t||{}).variant=t.variant||"non-conform",t.variant)?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",(function(){e=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")})),this.internal.events.subscribe("putCatalog",(function(){this.internal.out("/OpenAction "+e+" 0 R")}))),this},function(t){var e=function(){var t=void 0;Object.defineProperty(this,"pdf",{get:function(){return t},set:function(e){t=e}});var e=150;Object.defineProperty(this,"width",{get:function(){return e},set:function(t){e=isNaN(t)||!1===Number.isInteger(t)||t<0?150:t,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=e+1)}});var i=300;Object.defineProperty(this,"height",{get:function(){return i},set:function(t){i=isNaN(t)||!1===Number.isInteger(t)||t<0?300:t,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=i+1)}});var n=[];Object.defineProperty(this,"childNodes",{get:function(){return n},set:function(t){n=t}});var r={};Object.defineProperty(this,"style",{get:function(){return r},set:function(t){r=t}}),Object.defineProperty(this,"parentNode",{})};e.prototype.getContext=function(t,e){var i;if("2d"!==(t=t||"2d"))return null;for(i in e)this.pdf.context2d.hasOwnProperty(i)&&(this.pdf.context2d[i]=e[i]);return this.pdf.context2d._canvas=this,this.pdf.context2d},e.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},t.events.push(["initialized",function(){this.canvas=new e,this.canvas.pdf=this}])}(Ot.API),function(t){var e={left:0,top:0,bottom:0,right:0},i=!1,r=function(){void 0===this.internal.__cell__&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},e),this.internal.__cell__.margins.width=this.getPageWidth(),o.call(this))},o=function(){this.internal.__cell__.lastCell=new s,this.internal.__cell__.pages=1},s=function(){var t=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return t},set:function(e){t=e}});var e=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return e},set:function(t){e=t}});var i=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return i},set:function(t){i=t}});var n=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return n},set:function(t){n=t}});var r=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return r},set:function(t){r=t}});var o=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return o},set:function(t){o=t}});var s=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return s},set:function(t){s=t}}),this};s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},s.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},t.setHeaderFunction=function(t){return r.call(this),this.internal.__cell__.headerFunction="function"==typeof t?t:void 0,this},t.getTextDimensions=function(t,e){r.call(this);var i=(e=e||{}).fontSize||this.getFontSize(),n=e.font||this.getFont(),o=e.scaleFactor||this.internal.scaleFactor,s=0,a=0,h=0,c=this;if(!Array.isArray(t)&&"string"!=typeof t){if("number"!=typeof t)throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");t=String(t)}var l=e.maxWidth;l>0?"string"==typeof t?t=this.splitTextToSize(t,l):"[object Array]"===Object.prototype.toString.call(t)&&(t=t.reduce((function(t,e){return t.concat(c.splitTextToSize(e,l))}),[])):t=Array.isArray(t)?t:[t];for(var u=0;u<t.length;u++)s<(h=this.getStringUnitWidth(t[u],{font:n})*i)&&(s=h);return 0!==s&&(a=t.length),{w:s/=o,h:Math.max((a*i*this.getLineHeightFactor()-i*(this.getLineHeightFactor()-1))/o,0)}},t.cellAddPage=function(){r.call(this),this.addPage();var t=this.internal.__cell__.margins||e;return this.internal.__cell__.lastCell=new s(t.left,t.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var a=t.cell=function(){var t;t=arguments[0]instanceof s?arguments[0]:new s(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]),r.call(this);var n=this.internal.__cell__.lastCell,o=this.internal.__cell__.padding,a=this.internal.__cell__.margins||e,h=this.internal.__cell__.tableHeaderRow,c=this.internal.__cell__.printHeaders;return void 0!==n.lineNumber&&(n.lineNumber===t.lineNumber?(t.x=(n.x||0)+(n.width||0),t.y=n.y||0):n.y+n.height+t.height+a.bottom>this.getPageHeight()?(this.cellAddPage(),t.y=a.top,c&&h&&(this.printHeaderRow(t.lineNumber,!0),t.y+=h[0].height)):t.y=n.y+n.height||t.y),void 0!==t.text[0]&&(this.rect(t.x,t.y,t.width,t.height,!0===i?"FD":void 0),"right"===t.align?this.text(t.text,t.x+t.width-o,t.y+o,{align:"right",baseline:"top"}):"center"===t.align?this.text(t.text,t.x+t.width/2,t.y+o,{align:"center",baseline:"top",maxWidth:t.width-o-o}):this.text(t.text,t.x+o,t.y+o,{align:"left",baseline:"top",maxWidth:t.width-o-o})),this.internal.__cell__.lastCell=t,this};t.table=function(t,i,c,l,u){if(r.call(this),!c)throw new Error("No data for PDF table.");var f,d,p,g,m=[],v=[],y=[],b={},w={},x=[],_=[],S=(u=u||{}).autoSize||!1,C=!1!==u.printHeaders,A=u.css&&void 0!==u.css["font-size"]?16*u.css["font-size"]:u.fontSize||12,L=u.margins||Object.assign({width:this.getPageWidth()},e),P="number"==typeof u.padding?u.padding:3,T=u.headerBackgroundColor||"#c8c8c8",O=u.headerTextColor||"#000";if(o.call(this),this.internal.__cell__.printHeaders=C,this.internal.__cell__.margins=L,this.internal.__cell__.table_font_size=A,this.internal.__cell__.padding=P,this.internal.__cell__.headerBackgroundColor=T,this.internal.__cell__.headerTextColor=O,this.setFontSize(A),null==l)v=m=Object.keys(c[0]),y=m.map((function(){return"left"}));else if(Array.isArray(l)&&"object"===(0,n.Z)(l[0]))for(m=l.map((function(t){return t.name})),v=l.map((function(t){return t.prompt||t.name||""})),y=l.map((function(t){return t.align||"left"})),f=0;f<l.length;f+=1)w[l[f].name]=l[f].width*(19.049976/25.4);else Array.isArray(l)&&"string"==typeof l[0]&&(v=m=l,y=m.map((function(){return"left"})));if(S||Array.isArray(l)&&"string"==typeof l[0])for(f=0;f<m.length;f+=1){for(b[g=m[f]]=c.map((function(t){return t[g]})),this.setFont(void 0,"bold"),x.push(this.getTextDimensions(v[f],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),d=b[g],this.setFont(void 0,"normal"),p=0;p<d.length;p+=1)x.push(this.getTextDimensions(d[p],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);w[g]=Math.max.apply(null,x)+P+P,x=[]}if(C){var k={};for(f=0;f<m.length;f+=1)k[m[f]]={},k[m[f]].text=v[f],k[m[f]].align=y[f];var N=h.call(this,k,w);_=m.map((function(e){return new s(t,i,w[e],N,k[e].text,void 0,k[e].align)})),this.setTableHeaderRow(_),this.printHeaderRow(1,!1)}var j=l.reduce((function(t,e){return t[e.name]=e.align,t}),{});for(f=0;f<c.length;f+=1){"rowStart"in u&&u.rowStart instanceof Function&&u.rowStart({row:f,data:c[f]},this);var F=h.call(this,c[f],w);for(p=0;p<m.length;p+=1){var E=c[f][m[p]];"cellStart"in u&&u.cellStart instanceof Function&&u.cellStart({row:f,col:p,data:E},this),a.call(this,new s(t,i,w[m[p]],F,E,f+2,j[m[p]]))}}return this.internal.__cell__.table_x=t,this.internal.__cell__.table_y=i,this};var h=function(t,e){var i=this.internal.__cell__.padding,n=this.internal.__cell__.table_font_size,r=this.internal.scaleFactor;return Object.keys(t).map((function(n){var r=t[n];return this.splitTextToSize(r.hasOwnProperty("text")?r.text:r,e[n]-i-i)}),this).map((function(t){return this.getLineHeightFactor()*t.length*n/r+i+i}),this).reduce((function(t,e){return Math.max(t,e)}),0)};t.setTableHeaderRow=function(t){r.call(this),this.internal.__cell__.tableHeaderRow=t},t.printHeaderRow=function(t,e){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var n;if(i=!0,"function"==typeof this.internal.__cell__.headerFunction){var o=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new s(o[0],o[1],o[2],o[3],void 0,-1)}this.setFont(void 0,"bold");for(var h=[],c=0;c<this.internal.__cell__.tableHeaderRow.length;c+=1){n=this.internal.__cell__.tableHeaderRow[c].clone(),e&&(n.y=this.internal.__cell__.margins.top||0,h.push(n)),n.lineNumber=t;var l=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),a.call(this,n),this.setTextColor(l)}h.length>0&&this.setTableHeaderRow(h),this.setFont(void 0,"normal"),i=!1}}(Ot.API);var we={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},xe=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],_e=be(xe),Se=[100,200,300,400,500,600,700,800,900],Ce=be(Se);function Ae(t){var e=t.family.replace(/"|'/g,"").toLowerCase(),i=function(t){return we[t=t||"normal"]?t:"normal"}(t.style),n=function(t){return t?"number"==typeof t?t>=100&&t<=900&&t%100==0?t:400:/^\d00$/.test(t)?parseInt(t):"bold"===t?700:400:400}(t.weight),r=function(t){return"number"==typeof _e[t=t||"normal"]?t:"normal"}(t.stretch);return{family:e,style:i,weight:n,stretch:r,src:t.src||[],ref:t.ref||{name:e,style:[r,i,n].join(" ")}}}function Le(t,e,i,n){var r;for(r=i;r>=0&&r<e.length;r+=n)if(t[e[r]])return t[e[r]];for(r=i;r>=0&&r<e.length;r-=n)if(t[e[r]])return t[e[r]]}var Pe={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},Te={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function Oe(t){return[t.stretch,t.style,t.weight,t.family].join(" ")}function ke(t){return t.trimLeft()}function Ne(t,e){for(var i=0;i<t.length;){if(t.charAt(i)===e)return[t.substring(0,i),t.substring(i+1)];i+=1}return null}function je(t){var e=t.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return null===e?null:[e[0],t.substring(e[0].length)]}var Fe,Ee,Ie,Me=["times"];!function(t){var e,i,r,o,s,a,h,c,l,u=function(t){return t=t||{},this.isStrokeTransparent=t.isStrokeTransparent||!1,this.strokeOpacity=t.strokeOpacity||1,this.strokeStyle=t.strokeStyle||"#000000",this.fillStyle=t.fillStyle||"#000000",this.isFillTransparent=t.isFillTransparent||!1,this.fillOpacity=t.fillOpacity||1,this.font=t.font||"10px sans-serif",this.textBaseline=t.textBaseline||"alphabetic",this.textAlign=t.textAlign||"left",this.lineWidth=t.lineWidth||1,this.lineJoin=t.lineJoin||"miter",this.lineCap=t.lineCap||"butt",this.path=t.path||[],this.transform=void 0!==t.transform?t.transform.clone():new c,this.globalCompositeOperation=t.globalCompositeOperation||"normal",this.globalAlpha=t.globalAlpha||1,this.clip_path=t.clip_path||[],this.currentPoint=t.currentPoint||new a,this.miterLimit=t.miterLimit||10,this.lastPoint=t.lastPoint||new a,this.lineDashOffset=t.lineDashOffset||0,this.lineDash=t.lineDash||[],this.margin=t.margin||[0,0,0,0],this.prevPageLastElemOffset=t.prevPageLastElemOffset||0,this.ignoreClearRect="boolean"!=typeof t.ignoreClearRect||t.ignoreClearRect,this};t.events.push(["initialized",function(){this.context2d=new f(this),e=this.internal.f2,i=this.internal.getCoordinateString,r=this.internal.getVerticalCoordinateString,o=this.internal.getHorizontalCoordinate,s=this.internal.getVerticalCoordinate,a=this.internal.Point,h=this.internal.Rectangle,c=this.internal.Matrix,l=new u}]);var f=function(t){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var e=t;Object.defineProperty(this,"pdf",{get:function(){return e}});var i=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return i},set:function(t){i=Boolean(t)}});var n=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return n},set:function(t){n=Boolean(t)}});var r=0;Object.defineProperty(this,"posX",{get:function(){return r},set:function(t){isNaN(t)||(r=t)}});var o=0;Object.defineProperty(this,"posY",{get:function(){return o},set:function(t){isNaN(t)||(o=t)}}),Object.defineProperty(this,"margin",{get:function(){return l.margin},set:function(t){var e;"number"==typeof t?e=[t,t,t,t]:((e=new Array(4))[0]=t[0],e[1]=t.length>=2?t[1]:e[0],e[2]=t.length>=3?t[2]:e[0],e[3]=t.length>=4?t[3]:e[1]),l.margin=e}});var s=!1;Object.defineProperty(this,"autoPaging",{get:function(){return s},set:function(t){s=t}});var a=0;Object.defineProperty(this,"lastBreak",{get:function(){return a},set:function(t){a=t}});var h=[];Object.defineProperty(this,"pageBreaks",{get:function(){return h},set:function(t){h=t}}),Object.defineProperty(this,"ctx",{get:function(){return l},set:function(t){t instanceof u&&(l=t)}}),Object.defineProperty(this,"path",{get:function(){return l.path},set:function(t){l.path=t}});var c=[];Object.defineProperty(this,"ctxStack",{get:function(){return c},set:function(t){c=t}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(t){var e;e=d(t),this.ctx.fillStyle=e.style,this.ctx.isFillTransparent=0===e.a,this.ctx.fillOpacity=e.a,this.pdf.setFillColor(e.r,e.g,e.b,{a:e.a}),this.pdf.setTextColor(e.r,e.g,e.b,{a:e.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(t){var e=d(t);this.ctx.strokeStyle=e.style,this.ctx.isStrokeTransparent=0===e.a,this.ctx.strokeOpacity=e.a,0===e.a?this.pdf.setDrawColor(255,255,255):(e.a,this.pdf.setDrawColor(e.r,e.g,e.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(t){-1!==["butt","round","square"].indexOf(t)&&(this.ctx.lineCap=t,this.pdf.setLineCap(t))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(t){isNaN(t)||(this.ctx.lineWidth=t,this.pdf.setLineWidth(t))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(t){-1!==["bevel","round","miter"].indexOf(t)&&(this.ctx.lineJoin=t,this.pdf.setLineJoin(t))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(t){isNaN(t)||(this.ctx.miterLimit=t,this.pdf.setMiterLimit(t))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(t){this.ctx.textBaseline=t}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(t){-1!==["right","end","center","left","start"].indexOf(t)&&(this.ctx.textAlign=t)}});var f=null;function p(t,e){if(null===f){var i=function(t){var e=[];return Object.keys(t).forEach((function(i){t[i].forEach((function(t){var n=null;switch(t){case"bold":n={family:i,weight:"bold"};break;case"italic":n={family:i,style:"italic"};break;case"bolditalic":n={family:i,weight:"bold",style:"italic"};break;case"":case"normal":n={family:i}}null!==n&&(n.ref={name:i,style:t},e.push(n))}))})),e}(t.getFontList());f=function(t){for(var e={},i=0;i<t.length;++i){var n=Ae(t[i]),r=n.family,o=n.stretch,s=n.style,a=n.weight;e[r]=e[r]||{},e[r][o]=e[r][o]||{},e[r][o][s]=e[r][o][s]||{},e[r][o][s][a]=n}return e}(i.concat(e))}return f}var g=null;Object.defineProperty(this,"fontFaces",{get:function(){return g},set:function(t){f=null,g=t}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(t){var e;if(this.ctx.font=t,null!==(e=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z]+?)\s*$/i.exec(t))){var i=e[1],n=(e[2],e[3]),r=e[4],o=(e[5],e[6]),s=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(r)[2];r="px"===s?Math.floor(parseFloat(r)*this.pdf.internal.scaleFactor):"em"===s?Math.floor(parseFloat(r)*this.pdf.getFontSize()):Math.floor(parseFloat(r)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(r);var a=function(t){var e,i,n=[],r=t.trim();if(""===r)return Me;if(r in Te)return[Te[r]];for(;""!==r;){switch(i=null,e=(r=ke(r)).charAt(0)){case'"':case"'":i=Ne(r.substring(1),e);break;default:i=je(r)}if(null===i)return Me;if(n.push(i[0]),""!==(r=ke(i[1]))&&","!==r.charAt(0))return Me;r=r.replace(/^,/,"")}return n}(o);if(this.fontFaces){var h=function(t,e,i){for(var n=(i=i||{}).defaultFontFamily||"times",r=Object.assign({},Pe,i.genericFontFamilies||{}),o=null,s=null,a=0;a<e.length;++a)if(r[(o=Ae(e[a])).family]&&(o.family=r[o.family]),t.hasOwnProperty(o.family)){s=t[o.family];break}if(!(s=s||t[n]))throw new Error("Could not find a font-family for the rule '"+Oe(o)+"' and default family '"+n+"'.");if(s=function(t,e){if(e[t])return e[t];var i=_e[t],n=i<=_e.normal?-1:1,r=Le(e,xe,i,n);if(!r)throw new Error("Could not find a matching font-stretch value for "+t);return r}(o.stretch,s),s=function(t,e){if(e[t])return e[t];for(var i=we[t],n=0;n<i.length;++n)if(e[i[n]])return e[i[n]];throw new Error("Could not find a matching font-style for "+t)}(o.style,s),!(s=function(t,e){if(e[t])return e[t];if(400===t&&e[500])return e[500];if(500===t&&e[400])return e[400];var i=Ce[t],n=Le(e,Se,i,t<400?-1:1);if(!n)throw new Error("Could not find a matching font-weight for value "+t);return n}(o.weight,s)))throw new Error("Failed to resolve a font for the rule '"+Oe(o)+"'.");return s}(p(this.pdf,this.fontFaces),a.map((function(t){return{family:t,stretch:"normal",weight:n,style:i}})));this.pdf.setFont(h.ref.name,h.ref.style)}else{var c="";("bold"===n||parseInt(n,10)>=700||"bold"===i)&&(c="bold"),"italic"===i&&(c+="italic"),0===c.length&&(c="normal");for(var l="",u={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},f=0;f<a.length;f++){if(void 0!==this.pdf.internal.getFont(a[f],c,{noFallback:!0,disableWarning:!0})){l=a[f];break}if("bolditalic"===c&&void 0!==this.pdf.internal.getFont(a[f],"bold",{noFallback:!0,disableWarning:!0}))l=a[f],c="bold";else if(void 0!==this.pdf.internal.getFont(a[f],"normal",{noFallback:!0,disableWarning:!0})){l=a[f],c="normal";break}}if(""===l)for(var d=0;d<a.length;d++)if(u[a[d]]){l=u[a[d]];break}l=""===l?"Times":l,this.pdf.setFont(l,c)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(t){this.ctx.globalCompositeOperation=t}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(t){this.ctx.globalAlpha=t}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(t){this.ctx.lineDashOffset=t,B.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(t){this.ctx.lineDash=t,B.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(t){this.ctx.ignoreClearRect=Boolean(t)}})};f.prototype.setLineDash=function(t){this.lineDash=t},f.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},f.prototype.fill=function(){x.call(this,"fill",!1)},f.prototype.stroke=function(){x.call(this,"stroke",!1)},f.prototype.beginPath=function(){this.path=[{type:"begin"}]},f.prototype.moveTo=function(t,e){if(isNaN(t)||isNaN(e))throw $.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var i=this.ctx.transform.applyToPoint(new a(t,e));this.path.push({type:"mt",x:i.x,y:i.y}),this.ctx.lastPoint=new a(t,e)},f.prototype.closePath=function(){var t=new a(0,0),e=0;for(e=this.path.length-1;-1!==e;e--)if("begin"===this.path[e].type&&"object"===(0,n.Z)(this.path[e+1])&&"number"==typeof this.path[e+1].x){t=new a(this.path[e+1].x,this.path[e+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new a(t.x,t.y)},f.prototype.lineTo=function(t,e){if(isNaN(t)||isNaN(e))throw $.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var i=this.ctx.transform.applyToPoint(new a(t,e));this.path.push({type:"lt",x:i.x,y:i.y}),this.ctx.lastPoint=new a(i.x,i.y)},f.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),x.call(this,null,!0)},f.prototype.quadraticCurveTo=function(t,e,i,n){if(isNaN(i)||isNaN(n)||isNaN(t)||isNaN(e))throw $.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var r=this.ctx.transform.applyToPoint(new a(i,n)),o=this.ctx.transform.applyToPoint(new a(t,e));this.path.push({type:"qct",x1:o.x,y1:o.y,x:r.x,y:r.y}),this.ctx.lastPoint=new a(r.x,r.y)},f.prototype.bezierCurveTo=function(t,e,i,n,r,o){if(isNaN(r)||isNaN(o)||isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n))throw $.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var s=this.ctx.transform.applyToPoint(new a(r,o)),h=this.ctx.transform.applyToPoint(new a(t,e)),c=this.ctx.transform.applyToPoint(new a(i,n));this.path.push({type:"bct",x1:h.x,y1:h.y,x2:c.x,y2:c.y,x:s.x,y:s.y}),this.ctx.lastPoint=new a(s.x,s.y)},f.prototype.arc=function(t,e,i,n,r,o){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n)||isNaN(r))throw $.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(o=Boolean(o),!this.ctx.transform.isIdentity){var s=this.ctx.transform.applyToPoint(new a(t,e));t=s.x,e=s.y;var h=this.ctx.transform.applyToPoint(new a(0,i)),c=this.ctx.transform.applyToPoint(new a(0,0));i=Math.sqrt(Math.pow(h.x-c.x,2)+Math.pow(h.y-c.y,2))}Math.abs(r-n)>=2*Math.PI&&(n=0,r=2*Math.PI),this.path.push({type:"arc",x:t,y:e,radius:i,startAngle:n,endAngle:r,counterclockwise:o})},f.prototype.arcTo=function(t,e,i,n,r){throw new Error("arcTo not implemented.")},f.prototype.rect=function(t,e,i,n){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n))throw $.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.lineTo(t,e),this.lineTo(t+i,e),this.lineTo(t,e)},f.prototype.fillRect=function(t,e,i,n){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n))throw $.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!p.call(this)){var r={};"butt"!==this.lineCap&&(r.lineCap=this.lineCap,this.lineCap="butt"),"miter"!==this.lineJoin&&(r.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(t,e,i,n),this.fill(),r.hasOwnProperty("lineCap")&&(this.lineCap=r.lineCap),r.hasOwnProperty("lineJoin")&&(this.lineJoin=r.lineJoin)}},f.prototype.strokeRect=function(t,e,i,n){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n))throw $.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");g.call(this)||(this.beginPath(),this.rect(t,e,i,n),this.stroke())},f.prototype.clearRect=function(t,e,i,n){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n))throw $.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(t,e,i,n))},f.prototype.save=function(t){t="boolean"!=typeof t||t;for(var e=this.pdf.internal.getCurrentPageInfo().pageNumber,i=0;i<this.pdf.internal.getNumberOfPages();i++)this.pdf.setPage(i+1),this.pdf.internal.out("q");if(this.pdf.setPage(e),t){this.ctx.fontSize=this.pdf.internal.getFontSize();var n=new u(this.ctx);this.ctxStack.push(this.ctx),this.ctx=n}},f.prototype.restore=function(t){t="boolean"!=typeof t||t;for(var e=this.pdf.internal.getCurrentPageInfo().pageNumber,i=0;i<this.pdf.internal.getNumberOfPages();i++)this.pdf.setPage(i+1),this.pdf.internal.out("Q");this.pdf.setPage(e),t&&0!==this.ctxStack.length&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},f.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var d=function(t){var e,i,n,r;if(!0===t.isCanvasGradient&&(t=t.getColor()),!t)return{r:0,g:0,b:0,a:0,style:t};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(t))e=0,i=0,n=0,r=0;else{var o=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(t);if(null!==o)e=parseInt(o[1]),i=parseInt(o[2]),n=parseInt(o[3]),r=1;else if(null!==(o=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(t)))e=parseInt(o[1]),i=parseInt(o[2]),n=parseInt(o[3]),r=parseFloat(o[4]);else{if(r=1,"string"==typeof t&&"#"!==t.charAt(0)){var s=new ot(t);t=s.ok?s.toHex():"#000000"}4===t.length?(e=t.substring(1,2),e+=e,i=t.substring(2,3),i+=i,n=t.substring(3,4),n+=n):(e=t.substring(1,3),i=t.substring(3,5),n=t.substring(5,7)),e=parseInt(e,16),i=parseInt(i,16),n=parseInt(n,16)}}return{r:e,g:i,b:n,a:r,style:t}},p=function(){return this.ctx.isFillTransparent||0==this.globalAlpha},g=function(){return Boolean(this.ctx.isStrokeTransparent||0==this.globalAlpha)};f.prototype.fillText=function(t,e,i,n){if(isNaN(e)||isNaN(i)||"string"!=typeof t)throw $.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(n=isNaN(n)?void 0:n,!p.call(this)){var r=I(this.ctx.transform.rotation),o=this.ctx.transform.scaleX;O.call(this,{text:t,x:e,y:i,scale:o,angle:r,align:this.textAlign,maxWidth:n})}},f.prototype.strokeText=function(t,e,i,n){if(isNaN(e)||isNaN(i)||"string"!=typeof t)throw $.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!g.call(this)){n=isNaN(n)?void 0:n;var r=I(this.ctx.transform.rotation),o=this.ctx.transform.scaleX;O.call(this,{text:t,x:e,y:i,scale:o,renderingMode:"stroke",angle:r,align:this.textAlign,maxWidth:n})}},f.prototype.measureText=function(t){if("string"!=typeof t)throw $.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var e=this.pdf,i=this.pdf.internal.scaleFactor,n=e.internal.getFontSize(),r=e.getStringUnitWidth(t)*n/e.internal.scaleFactor;return new function(t){var e=(t=t||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return e}}),this}({width:r*=Math.round(96*i/72*1e4)/1e4})},f.prototype.scale=function(t,e){if(isNaN(t)||isNaN(e))throw $.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var i=new c(t,0,0,e,0,0);this.ctx.transform=this.ctx.transform.multiply(i)},f.prototype.rotate=function(t){if(isNaN(t))throw $.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var e=new c(Math.cos(t),Math.sin(t),-Math.sin(t),Math.cos(t),0,0);this.ctx.transform=this.ctx.transform.multiply(e)},f.prototype.translate=function(t,e){if(isNaN(t)||isNaN(e))throw $.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var i=new c(1,0,0,1,t,e);this.ctx.transform=this.ctx.transform.multiply(i)},f.prototype.transform=function(t,e,i,n,r,o){if(isNaN(t)||isNaN(e)||isNaN(i)||isNaN(n)||isNaN(r)||isNaN(o))throw $.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var s=new c(t,e,i,n,r,o);this.ctx.transform=this.ctx.transform.multiply(s)},f.prototype.setTransform=function(t,e,i,n,r,o){t=isNaN(t)?1:t,e=isNaN(e)?0:e,i=isNaN(i)?0:i,n=isNaN(n)?1:n,r=isNaN(r)?0:r,o=isNaN(o)?0:o,this.ctx.transform=new c(t,e,i,n,r,o)};var m=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};f.prototype.drawImage=function(t,e,i,n,r,o,s,a,l){var u=this.pdf.getImageProperties(t),f=1,d=1,p=1,g=1;void 0!==n&&void 0!==a&&(p=a/n,g=l/r,f=u.width/n*a/n,d=u.height/r*l/r),void 0===o&&(o=e,s=i,e=0,i=0),void 0!==n&&void 0===a&&(a=n,l=r),void 0===n&&void 0===a&&(a=u.width,l=u.height);for(var y,x=this.ctx.transform.decompose(),S=I(x.rotate.shx),C=new c,A=(C=(C=(C=C.multiply(x.translate)).multiply(x.skew)).multiply(x.scale)).applyToRectangle(new h(o-e*p,s-i*g,n*f,r*d)),L=v.call(this,A),P=[],T=0;T<L.length;T+=1)-1===P.indexOf(L[T])&&P.push(L[T]);if(w(P),this.autoPaging)for(var O=P[0],k=P[P.length-1],N=O;N<k+1;N++){this.pdf.setPage(N);var j=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],F=1===N?this.posY+this.margin[0]:this.margin[0],E=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],M=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],D=1===N?0:E+(N-2)*M;if(0!==this.ctx.clip_path.length){var B=this.path;y=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(y,this.posX+this.margin[3],-D+F+this.ctx.prevPageLastElemOffset),_.call(this,"fill",!0),this.path=B}var R=JSON.parse(JSON.stringify(A));R=b([R],this.posX+this.margin[3],-D+F+this.ctx.prevPageLastElemOffset)[0];var z=(N>O||N<k)&&m.call(this);z&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],j,M,null).clip().discardPath()),this.pdf.addImage(t,"JPEG",R.x,R.y,R.w,R.h,null,null,S),z&&this.pdf.restoreGraphicsState()}else this.pdf.addImage(t,"JPEG",A.x,A.y,A.w,A.h,null,null,S)};var v=function(t,e,i){var n=[];e=e||this.pdf.internal.pageSize.width,i=i||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var r=this.posY+this.ctx.prevPageLastElemOffset;switch(t.type){default:case"mt":case"lt":n.push(Math.floor((t.y+r)/i)+1);break;case"arc":n.push(Math.floor((t.y+r-t.radius)/i)+1),n.push(Math.floor((t.y+r+t.radius)/i)+1);break;case"qct":var o=M(this.ctx.lastPoint.x,this.ctx.lastPoint.y,t.x1,t.y1,t.x,t.y);n.push(Math.floor((o.y+r)/i)+1),n.push(Math.floor((o.y+o.h+r)/i)+1);break;case"bct":var s=D(this.ctx.lastPoint.x,this.ctx.lastPoint.y,t.x1,t.y1,t.x2,t.y2,t.x,t.y);n.push(Math.floor((s.y+r)/i)+1),n.push(Math.floor((s.y+s.h+r)/i)+1);break;case"rect":n.push(Math.floor((t.y+r)/i)+1),n.push(Math.floor((t.y+t.h+r)/i)+1)}for(var a=0;a<n.length;a+=1)for(;this.pdf.internal.getNumberOfPages()<n[a];)y.call(this);return n},y=function(){var t=this.fillStyle,e=this.strokeStyle,i=this.font,n=this.lineCap,r=this.lineWidth,o=this.lineJoin;this.pdf.addPage(),this.fillStyle=t,this.strokeStyle=e,this.font=i,this.lineCap=n,this.lineWidth=r,this.lineJoin=o},b=function(t,e,i){for(var n=0;n<t.length;n++)switch(t[n].type){case"bct":t[n].x2+=e,t[n].y2+=i;case"qct":t[n].x1+=e,t[n].y1+=i;default:t[n].x+=e,t[n].y+=i}return t},w=function(t){return t.sort((function(t,e){return t-e}))},x=function(t,e){for(var i,n,r=this.fillStyle,o=this.strokeStyle,s=this.lineCap,a=this.lineWidth,h=Math.abs(a*this.ctx.transform.scaleX),c=this.lineJoin,l=JSON.parse(JSON.stringify(this.path)),u=JSON.parse(JSON.stringify(this.path)),f=[],d=0;d<u.length;d++)if(void 0!==u[d].x)for(var p=v.call(this,u[d]),g=0;g<p.length;g+=1)-1===f.indexOf(p[g])&&f.push(p[g]);for(var x=0;x<f.length;x++)for(;this.pdf.internal.getNumberOfPages()<f[x];)y.call(this);if(w(f),this.autoPaging)for(var S=f[0],C=f[f.length-1],A=S;A<C+1;A++){this.pdf.setPage(A),this.fillStyle=r,this.strokeStyle=o,this.lineCap=s,this.lineWidth=h,this.lineJoin=c;var L=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],P=1===A?this.posY+this.margin[0]:this.margin[0],T=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],O=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],k=1===A?0:T+(A-2)*O;if(0!==this.ctx.clip_path.length){var N=this.path;i=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(i,this.posX+this.margin[3],-k+P+this.ctx.prevPageLastElemOffset),_.call(this,t,!0),this.path=N}if(n=JSON.parse(JSON.stringify(l)),this.path=b(n,this.posX+this.margin[3],-k+P+this.ctx.prevPageLastElemOffset),!1===e||0===A){var j=(A>S||A<C)&&m.call(this);j&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],L,O,null).clip().discardPath()),_.call(this,t,e),j&&this.pdf.restoreGraphicsState()}this.lineWidth=a}else this.lineWidth=h,_.call(this,t,e),this.lineWidth=a;this.path=l},_=function(t,e){if(("stroke"!==t||e||!g.call(this))&&("stroke"===t||e||!p.call(this))){for(var i,n,r=[],o=this.path,s=0;s<o.length;s++){var a=o[s];switch(a.type){case"begin":r.push({begin:!0});break;case"close":r.push({close:!0});break;case"mt":r.push({start:a,deltas:[],abs:[]});break;case"lt":var h=r.length;if(o[s-1]&&!isNaN(o[s-1].x)&&(i=[a.x-o[s-1].x,a.y-o[s-1].y],h>0))for(;h>=0;h--)if(!0!==r[h-1].close&&!0!==r[h-1].begin){r[h-1].deltas.push(i),r[h-1].abs.push(a);break}break;case"bct":i=[a.x1-o[s-1].x,a.y1-o[s-1].y,a.x2-o[s-1].x,a.y2-o[s-1].y,a.x-o[s-1].x,a.y-o[s-1].y],r[r.length-1].deltas.push(i);break;case"qct":var c=o[s-1].x+2/3*(a.x1-o[s-1].x),l=o[s-1].y+2/3*(a.y1-o[s-1].y),u=a.x+2/3*(a.x1-a.x),f=a.y+2/3*(a.y1-a.y),d=a.x,m=a.y;i=[c-o[s-1].x,l-o[s-1].y,u-o[s-1].x,f-o[s-1].y,d-o[s-1].x,m-o[s-1].y],r[r.length-1].deltas.push(i);break;case"arc":r.push({deltas:[],abs:[],arc:!0}),Array.isArray(r[r.length-1].abs)&&r[r.length-1].abs.push(a)}}n=e?null:"stroke"===t?"stroke":"fill";for(var v=!1,y=0;y<r.length;y++)if(r[y].arc)for(var b=r[y].abs,w=0;w<b.length;w++){var x=b[w];"arc"===x.type?A.call(this,x.x,x.y,x.radius,x.startAngle,x.endAngle,x.counterclockwise,void 0,e,!v):k.call(this,x.x,x.y),v=!0}else if(!0===r[y].close)this.pdf.internal.out("h"),v=!1;else if(!0!==r[y].begin){var _=r[y].start.x,S=r[y].start.y;N.call(this,r[y].deltas,_,S),v=!0}n&&L.call(this,n),e&&P.call(this)}},S=function(t){var e=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,i=e*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return t-i;case"top":return t+e-i;case"hanging":return t+e-2*i;case"middle":return t+e/2-i;default:return t}},C=function(t){return t+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};f.prototype.createLinearGradient=function(){var t=function(){};return t.colorStops=[],t.addColorStop=function(t,e){this.colorStops.push([t,e])},t.getColor=function(){return 0===this.colorStops.length?"#000000":this.colorStops[0][1]},t.isCanvasGradient=!0,t},f.prototype.createPattern=function(){return this.createLinearGradient()},f.prototype.createRadialGradient=function(){return this.createLinearGradient()};var A=function(t,e,i,n,r,o,s,a,h){for(var c=F.call(this,i,n,r,o),l=0;l<c.length;l++){var u=c[l];0===l&&(h?T.call(this,u.x1+t,u.y1+e):k.call(this,u.x1+t,u.y1+e)),j.call(this,t,e,u.x2,u.y2,u.x3,u.y3,u.x4,u.y4)}a?P.call(this):L.call(this,s)},L=function(t){switch(t){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},P=function(){this.pdf.clip(),this.pdf.discardPath()},T=function(t,e){this.pdf.internal.out(i(t)+" "+r(e)+" m")},O=function(t){var e;switch(t.align){case"right":case"end":e="right";break;case"center":e="center";break;default:e="left"}var i=this.pdf.getTextDimensions(t.text),n=S.call(this,t.y),r=C.call(this,n)-i.h,o=this.ctx.transform.applyToPoint(new a(t.x,n)),s=this.ctx.transform.decompose(),l=new c;l=(l=(l=l.multiply(s.translate)).multiply(s.skew)).multiply(s.scale);for(var u,f,d,p=this.ctx.transform.applyToRectangle(new h(t.x,n,i.w,i.h)),g=l.applyToRectangle(new h(t.x,r,i.w,i.h)),y=v.call(this,g),x=[],A=0;A<y.length;A+=1)-1===x.indexOf(y[A])&&x.push(y[A]);if(w(x),this.autoPaging)for(var L=x[0],P=x[x.length-1],T=L;T<P+1;T++){this.pdf.setPage(T);var O=1===T?this.posY+this.margin[0]:this.margin[0],k=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],N=this.pdf.internal.pageSize.height-this.margin[2],j=N-this.margin[0],F=this.pdf.internal.pageSize.width-this.margin[1],E=F-this.margin[3],I=1===T?0:k+(T-2)*j;if(0!==this.ctx.clip_path.length){var M=this.path;u=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(u,this.posX+this.margin[3],-1*I+O),_.call(this,"fill",!0),this.path=M}var D=b([JSON.parse(JSON.stringify(g))],this.posX+this.margin[3],-I+O+this.ctx.prevPageLastElemOffset)[0];t.scale>=.01&&(f=this.pdf.internal.getFontSize(),this.pdf.setFontSize(f*t.scale),d=this.lineWidth,this.lineWidth=d*t.scale);var B="text"!==this.autoPaging;if(B||D.y+D.h<=N){if(B||D.y>=O&&D.x<=F){var R=B?t.text:this.pdf.splitTextToSize(t.text,t.maxWidth||F-D.x)[0],z=b([JSON.parse(JSON.stringify(p))],this.posX+this.margin[3],-I+O+this.ctx.prevPageLastElemOffset)[0],q=B&&(T>L||T<P)&&m.call(this);q&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],E,j,null).clip().discardPath()),this.pdf.text(R,z.x,z.y,{angle:t.angle,align:e,renderingMode:t.renderingMode}),q&&this.pdf.restoreGraphicsState()}}else D.y<N&&(this.ctx.prevPageLastElemOffset+=N-D.y);t.scale>=.01&&(this.pdf.setFontSize(f),this.lineWidth=d)}else t.scale>=.01&&(f=this.pdf.internal.getFontSize(),this.pdf.setFontSize(f*t.scale),d=this.lineWidth,this.lineWidth=d*t.scale),this.pdf.text(t.text,o.x+this.posX,o.y+this.posY,{angle:t.angle,align:e,renderingMode:t.renderingMode,maxWidth:t.maxWidth}),t.scale>=.01&&(this.pdf.setFontSize(f),this.lineWidth=d)},k=function(t,e,n,o){n=n||0,o=o||0,this.pdf.internal.out(i(t+n)+" "+r(e+o)+" l")},N=function(t,e,i){return this.pdf.lines(t,e,i,null,null)},j=function(t,i,n,r,a,h,c,l){this.pdf.internal.out([e(o(n+t)),e(s(r+i)),e(o(a+t)),e(s(h+i)),e(o(c+t)),e(s(l+i)),"c"].join(" "))},F=function(t,e,i,n){for(var r=2*Math.PI,o=Math.PI/2;e>i;)e-=r;var s=Math.abs(i-e);s<r&&n&&(s=r-s);for(var a=[],h=n?-1:1,c=e;s>1e-5;){var l=c+h*Math.min(s,o);a.push(E.call(this,t,c,l)),s-=Math.abs(l-c),c=l}return a},E=function(t,e,i){var n=(i-e)/2,r=t*Math.cos(n),o=t*Math.sin(n),s=r,a=-o,h=s*s+a*a,c=h+s*r+a*o,l=4/3*(Math.sqrt(2*h*c)-c)/(s*o-a*r),u=s-l*a,f=a+l*s,d=u,p=-f,g=n+e,m=Math.cos(g),v=Math.sin(g);return{x1:t*Math.cos(e),y1:t*Math.sin(e),x2:u*m-f*v,y2:u*v+f*m,x3:d*m-p*v,y3:d*v+p*m,x4:t*Math.cos(i),y4:t*Math.sin(i)}},I=function(t){return 180*t/Math.PI},M=function(t,e,i,n,r,o){var s=t+.5*(i-t),a=e+.5*(n-e),c=r+.5*(i-r),l=o+.5*(n-o),u=Math.min(t,r,s,c),f=Math.max(t,r,s,c),d=Math.min(e,o,a,l),p=Math.max(e,o,a,l);return new h(u,d,f-u,p-d)},D=function(t,e,i,n,r,o,s,a){var c,l,u,f,d,p,g,m,v,y,b,w,x,_,S=i-t,C=n-e,A=r-i,L=o-n,P=s-r,T=a-o;for(l=0;l<41;l++)v=(g=(u=t+(c=l/40)*S)+c*((d=i+c*A)-u))+c*(d+c*(r+c*P-d)-g),y=(m=(f=e+c*C)+c*((p=n+c*L)-f))+c*(p+c*(o+c*T-p)-m),0==l?(b=v,w=y,x=v,_=y):(b=Math.min(b,v),w=Math.min(w,y),x=Math.max(x,v),_=Math.max(_,y));return new h(Math.round(b),Math.round(w),Math.round(x-b),Math.round(_-w))},B=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var t,e,i=(t=this.ctx.lineDash,e=this.ctx.lineDashOffset,JSON.stringify({lineDash:t,lineDashOffset:e}));this.prevLineDash!==i&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=i)}}}(Ot.API),function(t){var e=function(t){var e,i,n,r,o,s,a,h,c,l;for(/[^\x00-\xFF]/.test(t),i=[],n=0,r=(t+=e="\0\0\0\0".slice(t.length%4||4)).length;r>n;n+=4)0!==(o=(t.charCodeAt(n)<<24)+(t.charCodeAt(n+1)<<16)+(t.charCodeAt(n+2)<<8)+t.charCodeAt(n+3))?(s=(o=((o=((o=((o=(o-(l=o%85))/85)-(c=o%85))/85)-(h=o%85))/85)-(a=o%85))/85)%85,i.push(s+33,a+33,h+33,c+33,l+33)):i.push(122);return function(t,e){for(var i=e;i>0;i--)t.pop()}(i,e.length),String.fromCharCode.apply(String,i)+"~>"},i=function(t){var e,i,n,r,o,s=String,a="length",h=255,c="charCodeAt",l="slice",u="replace";for(t[l](-2),t=t[l](0,-2)[u](/\s/g,"")[u]("z","!!!!!"),n=[],r=0,o=(t+=e="uuuuu"[l](t[a]%5||5))[a];o>r;r+=5)i=52200625*(t[c](r)-33)+614125*(t[c](r+1)-33)+7225*(t[c](r+2)-33)+85*(t[c](r+3)-33)+(t[c](r+4)-33),n.push(h&i>>24,h&i>>16,h&i>>8,h&i);return function(t,e){for(var i=e;i>0;i--)t.pop()}(n,e[a]),s.fromCharCode.apply(s,n)},n=function(t){var e=new RegExp(/^([0-9A-Fa-f]{2})+$/);if(-1!==(t=t.replace(/\s/g,"")).indexOf(">")&&(t=t.substr(0,t.indexOf(">"))),t.length%2&&(t+="0"),!1===e.test(t))return"";for(var i="",n=0;n<t.length;n+=2)i+=String.fromCharCode("0x"+(t[n]+t[n+1]));return i},r=function(t){for(var e=new Uint8Array(t.length),i=t.length;i--;)e[i]=t.charCodeAt(i);return(e=Y(e)).reduce((function(t,e){return t+String.fromCharCode(e)}),"")};t.processDataByFilters=function(t,o){var s=0,a=t||"",h=[];for("string"==typeof(o=o||[])&&(o=[o]),s=0;s<o.length;s+=1)switch(o[s]){case"ASCII85Decode":case"/ASCII85Decode":a=i(a),h.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":a=e(a),h.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":a=n(a),h.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":a=a.split("").map((function(t){return("0"+t.charCodeAt().toString(16)).slice(-2)})).join("")+">",h.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":a=r(a),h.push("/FlateDecode");break;default:throw new Error('The filter: "'+o[s]+'" is not implemented')}return{data:a,reverseChain:h.reverse().join(" ")}}}(Ot.API),function(t){t.loadFile=function(t,e,i){return function(t,e,i){e=!1!==e,i="function"==typeof i?i:function(){};var n=void 0;try{n=function(t,e,i){var n=new XMLHttpRequest,r=0,o=function(t){var e=t.length,i=[],n=String.fromCharCode;for(r=0;r<e;r+=1)i.push(n(255&t.charCodeAt(r)));return i.join("")};if(n.open("GET",t,!e),n.overrideMimeType("text/plain; charset=x-user-defined"),!1===e&&(n.onload=function(){200===n.status?i(o(this.responseText)):i(void 0)}),n.send(null),e&&200===n.status)return o(n.responseText)}(t,e,i)}catch(t){}return n}(t,e,i)},t.loadImageFile=t.loadFile}(Ot.API),function(t){function e(){return(J.html2canvas?K.resolve(J.html2canvas):i.e(120).then(i.t.bind(i,1120,23))).catch((function(t){return K.reject(new Error("Could not load html2canvas: "+t))})).then((function(t){return t.default?t.default:t}))}function r(){return(J.DOMPurify?K.resolve(J.DOMPurify):i.e(856).then(i.t.bind(i,7856,23))).catch((function(t){return K.reject(new Error("Could not load dompurify: "+t))})).then((function(t){return t.default?t.default:t}))}var o=function(t){var e=(0,n.Z)(t);return"undefined"===e?"undefined":"string"===e||t instanceof String?"string":"number"===e||t instanceof Number?"number":"function"===e||t instanceof Function?"function":t&&t.constructor===Array?"array":t&&1===t.nodeType?"element":"object"===e?"object":"unknown"},s=function(t,e){var i=document.createElement(t);for(var n in e.className&&(i.className=e.className),e.innerHTML&&e.dompurify&&(i.innerHTML=e.dompurify.sanitize(e.innerHTML)),e.style)i.style[n]=e.style[n];return i},a=function t(e){var i=Object.assign(t.convert(K.resolve()),JSON.parse(JSON.stringify(t.template))),n=t.convert(K.resolve(),i);return(n=n.setProgress(1,t,1,[t])).set(e)};(a.prototype=Object.create(K.prototype)).constructor=a,a.convert=function(t,e){return t.__proto__=e||a.prototype,t},a.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},a.prototype.from=function(t,e){return this.then((function(){switch(e=e||function(t){switch(o(t)){case"string":return"string";case"element":return"canvas"===t.nodeName.toLowerCase()?"canvas":"element";default:return"unknown"}}(t)){case"string":return this.then(r).then((function(e){return this.set({src:s("div",{innerHTML:t,dompurify:e})})}));case"element":return this.set({src:t});case"canvas":return this.set({canvas:t});case"img":return this.set({img:t});default:return this.error("Unknown source type.")}}))},a.prototype.to=function(t){switch(t){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},a.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then((function(){var t={position:"relative",display:"inline-block",width:("number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},e=function t(e,i){for(var n=3===e.nodeType?document.createTextNode(e.nodeValue):e.cloneNode(!1),r=e.firstChild;r;r=r.nextSibling)!0!==i&&1===r.nodeType&&"SCRIPT"===r.nodeName||n.appendChild(t(r,i));return 1===e.nodeType&&("CANVAS"===e.nodeName?(n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0)):"TEXTAREA"!==e.nodeName&&"SELECT"!==e.nodeName||(n.value=e.value),n.addEventListener("load",(function(){n.scrollTop=e.scrollTop,n.scrollLeft=e.scrollLeft}),!0)),n}(this.prop.src,this.opt.html2canvas.javascriptEnabled);"BODY"===e.tagName&&(t.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=s("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=s("div",{className:"html2pdf__container",style:t}),this.prop.container.appendChild(e),this.prop.container.firstChild.appendChild(s("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"}))},a.prototype.toCanvas=function(){var t=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(t).then(e).then((function(t){var e=Object.assign({},this.opt.html2canvas);return delete e.onrendered,t(this.prop.container,e)})).then((function(t){(this.opt.html2canvas.onrendered||function(){})(t),this.prop.canvas=t,document.body.removeChild(this.prop.overlay)}))},a.prototype.toContext2d=function(){var t=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(t).then(e).then((function(t){var e=this.opt.jsPDF,i=this.opt.fontFaces,n="number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,r=Object.assign({async:!0,allowTaint:!0,scale:n,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete r.onrendered,e.context2d.autoPaging=void 0===this.opt.autoPaging||this.opt.autoPaging,e.context2d.posX=this.opt.x,e.context2d.posY=this.opt.y,e.context2d.margin=this.opt.margin,e.context2d.fontFaces=i,i)for(var o=0;o<i.length;++o){var s=i[o],a=s.src.find((function(t){return"truetype"===t.format}));a&&e.addFont(a.url,s.ref.name,s.ref.style)}return r.windowHeight=r.windowHeight||0,r.windowHeight=0==r.windowHeight?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):r.windowHeight,e.context2d.save(!0),t(this.prop.container,r)})).then((function(t){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(t),this.prop.canvas=t,document.body.removeChild(this.prop.overlay)}))},a.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then((function(){var t=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=t}))},a.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then((function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF}))},a.prototype.output=function(t,e,i){return"img"===(i=i||"pdf").toLowerCase()||"image"===i.toLowerCase()?this.outputImg(t,e):this.outputPdf(t,e)},a.prototype.outputPdf=function(t,e){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){return this.prop.pdf.output(t,e)}))},a.prototype.outputImg=function(t){return this.thenList([function(){return this.prop.img||this.toImg()}]).then((function(){switch(t){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+t+'" is not supported.'}}))},a.prototype.save=function(t){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(t?{filename:t}:null).then((function(){this.prop.pdf.save(this.opt.filename)}))},a.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){this.prop.callback(this.prop.pdf)}))},a.prototype.set=function(t){if("object"!==o(t))return this;var e=Object.keys(t||{}).map((function(e){if(e in a.template.prop)return function(){this.prop[e]=t[e]};switch(e){case"margin":return this.setMargin.bind(this,t.margin);case"jsPDF":return function(){return this.opt.jsPDF=t.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,t.pageSize);default:return function(){this.opt[e]=t[e]}}}),this);return this.then((function(){return this.thenList(e)}))},a.prototype.get=function(t,e){return this.then((function(){var i=t in a.template.prop?this.prop[t]:this.opt[t];return e?e(i):i}))},a.prototype.setMargin=function(t){return this.then((function(){switch(o(t)){case"number":t=[t,t,t,t];case"array":if(2===t.length&&(t=[t[0],t[1],t[0],t[1]]),4===t.length)break;default:return this.error("Invalid margin array.")}this.opt.margin=t})).then(this.setPageSize)},a.prototype.setPageSize=function(t){function e(t,e){return Math.floor(t*e/72*96)}return this.then((function(){(t=t||Ot.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(t.inner={width:t.width-this.opt.margin[1]-this.opt.margin[3],height:t.height-this.opt.margin[0]-this.opt.margin[2]},t.inner.px={width:e(t.inner.width,t.k),height:e(t.inner.height,t.k)},t.inner.ratio=t.inner.height/t.inner.width),this.prop.pageSize=t}))},a.prototype.setProgress=function(t,e,i,n){return null!=t&&(this.progress.val=t),null!=e&&(this.progress.state=e),null!=i&&(this.progress.n=i),null!=n&&(this.progress.stack=n),this.progress.ratio=this.progress.val/this.progress.state,this},a.prototype.updateProgress=function(t,e,i,n){return this.setProgress(t?this.progress.val+t:null,e||null,i?this.progress.n+i:null,n?this.progress.stack.concat(n):null)},a.prototype.then=function(t,e){var i=this;return this.thenCore(t,e,(function(t,e){return i.updateProgress(null,null,1,[t]),K.prototype.then.call(this,(function(e){return i.updateProgress(null,t),e})).then(t,e).then((function(t){return i.updateProgress(1),t}))}))},a.prototype.thenCore=function(t,e,i){i=i||K.prototype.then,t&&(t=t.bind(this)),e&&(e=e.bind(this));var n=-1!==K.toString().indexOf("[native code]")&&"Promise"===K.name?this:a.convert(Object.assign({},this),K.prototype),r=i.call(n,t,e);return a.convert(r,this.__proto__)},a.prototype.thenExternal=function(t,e){return K.prototype.then.call(this,t,e)},a.prototype.thenList=function(t){var e=this;return t.forEach((function(t){e=e.thenCore(t)})),e},a.prototype.catch=function(t){t&&(t=t.bind(this));var e=K.prototype.catch.call(this,t);return a.convert(e,this)},a.prototype.catchExternal=function(t){return K.prototype.catch.call(this,t)},a.prototype.error=function(t){return this.then((function(){throw new Error(t)}))},a.prototype.using=a.prototype.set,a.prototype.saveAs=a.prototype.save,a.prototype.export=a.prototype.output,a.prototype.run=a.prototype.then,Ot.getPageSize=function(t,e,i){if("object"===(0,n.Z)(t)){var r=t;t=r.orientation,e=r.unit||e,i=r.format||i}e=e||"mm",i=i||"a4",t=(""+(t||"P")).toLowerCase();var o,s=(""+i).toLowerCase(),a={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(e){case"pt":o=1;break;case"mm":o=72/25.4;break;case"cm":o=72/2.54;break;case"in":o=72;break;case"px":o=.75;break;case"pc":case"em":o=12;break;case"ex":o=6;break;default:throw"Invalid unit: "+e}var h,c=0,l=0;if(a.hasOwnProperty(s))c=a[s][1]/o,l=a[s][0]/o;else try{c=i[1],l=i[0]}catch(t){throw new Error("Invalid format: "+i)}if("p"===t||"portrait"===t)t="p",l>c&&(h=l,l=c,c=h);else{if("l"!==t&&"landscape"!==t)throw"Invalid orientation: "+t;t="l",c>l&&(h=l,l=c,c=h)}return{width:l,height:c,unit:e,k:o,orientation:t}},t.html=function(t,e){(e=e||{}).callback=e.callback||function(){},e.html2canvas=e.html2canvas||{},e.html2canvas.canvas=e.html2canvas.canvas||this.canvas,e.jsPDF=e.jsPDF||this,e.fontFaces=e.fontFaces?e.fontFaces.map(Ae):null;var i=new a(e);return e.worker?i:i.from(t).doCallback()}}(Ot.API),Ot.API.addJS=function(t){return Ie=t,this.internal.events.subscribe("postPutResources",(function(){Fe=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(Fe+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),Ee=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+Ie+")"),this.internal.out(">>"),this.internal.out("endobj")})),this.internal.events.subscribe("putCatalog",(function(){void 0!==Fe&&void 0!==Ee&&this.internal.out("/Names <</JavaScript "+Fe+" 0 R>>")})),this},function(t){var e;t.events.push(["postPutResources",function(){var t=this,i=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var n=t.outline.render().split(/\r\n/),r=0;r<n.length;r++){var o=n[r],s=i.exec(o);if(null!=s){var a=s[1];t.internal.newObjectDeferredBegin(a,!1)}t.internal.write(o)}if(this.outline.createNamedDestinations){var h=this.internal.pages.length,c=[];for(r=0;r<h;r++){var l=t.internal.newObject();c.push(l);var u=t.internal.getPageInfo(r+1);t.internal.write("<< /D["+u.objId+" 0 R /XYZ null null null]>> endobj")}var f=t.internal.newObject();for(t.internal.write("<< /Names [ "),r=0;r<c.length;r++)t.internal.write("(page_"+(r+1)+")"+c[r]+" 0 R");t.internal.write(" ] >>","endobj"),e=t.internal.newObject(),t.internal.write("<< /Dests "+f+" 0 R"),t.internal.write(">>","endobj")}}]),t.events.push(["putCatalog",function(){this.outline.root.children.length>0&&(this.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&this.internal.write("/Names "+e+" 0 R"))}]),t.events.push(["initialized",function(){var t=this;t.outline={createNamedDestinations:!1,root:{children:[]}},t.outline.add=function(t,e,i){var n={title:e,options:i,children:[]};return null==t&&(t=this.root),t.children.push(n),n},t.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=t,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},t.outline.genIds_r=function(e){e.id=t.internal.newObjectDeferred();for(var i=0;i<e.children.length;i++)this.genIds_r(e.children[i])},t.outline.renderRoot=function(t){this.objStart(t),this.line("/Type /Outlines"),t.children.length>0&&(this.line("/First "+this.makeRef(t.children[0])),this.line("/Last "+this.makeRef(t.children[t.children.length-1]))),this.line("/Count "+this.count_r({count:0},t)),this.objEnd()},t.outline.renderItems=function(e){for(var i=this.ctx.pdf.internal.getVerticalCoordinateString,n=0;n<e.children.length;n++){var r=e.children[n];this.objStart(r),this.line("/Title "+this.makeString(r.title)),this.line("/Parent "+this.makeRef(e)),n>0&&this.line("/Prev "+this.makeRef(e.children[n-1])),n<e.children.length-1&&this.line("/Next "+this.makeRef(e.children[n+1])),r.children.length>0&&(this.line("/First "+this.makeRef(r.children[0])),this.line("/Last "+this.makeRef(r.children[r.children.length-1])));var o=this.count=this.count_r({count:0},r);if(o>0&&this.line("/Count "+o),r.options&&r.options.pageNumber){var s=t.internal.getPageInfo(r.options.pageNumber);this.line("/Dest ["+s.objId+" 0 R /XYZ 0 "+i(0)+" 0]")}this.objEnd()}for(var a=0;a<e.children.length;a++)this.renderItems(e.children[a])},t.outline.line=function(t){this.ctx.val+=t+"\r\n"},t.outline.makeRef=function(t){return t.id+" 0 R"},t.outline.makeString=function(e){return"("+t.internal.pdfEscape(e)+")"},t.outline.objStart=function(t){this.ctx.val+="\r\n"+t.id+" 0 obj\r\n<<\r\n"},t.outline.objEnd=function(){this.ctx.val+=">> \r\nendobj\r\n"},t.outline.count_r=function(t,e){for(var i=0;i<e.children.length;i++)t.count++,this.count_r(t,e.children[i]);return t.count}}])}(Ot.API),function(t){var e=[192,193,194,195,196,197,198,199];t.processJPEG=function(t,i,n,r,o,s){var a,h=this.decode.DCT_DECODE,c=null;if("string"==typeof t||this.__addimage__.isArrayBuffer(t)||this.__addimage__.isArrayBufferView(t)){switch(t=o||t,t=this.__addimage__.isArrayBuffer(t)?new Uint8Array(t):t,(a=function(t){for(var i,n=256*t.charCodeAt(4)+t.charCodeAt(5),r=t.length,o={width:0,height:0,numcomponents:1},s=4;s<r;s+=2){if(s+=n,-1!==e.indexOf(t.charCodeAt(s+1))){i=256*t.charCodeAt(s+5)+t.charCodeAt(s+6),o={width:256*t.charCodeAt(s+7)+t.charCodeAt(s+8),height:i,numcomponents:t.charCodeAt(s+9)};break}n=256*t.charCodeAt(s+2)+t.charCodeAt(s+3)}return o}(t=this.__addimage__.isArrayBufferView(t)?this.__addimage__.arrayBufferToBinaryString(t):t)).numcomponents){case 1:s=this.color_spaces.DEVICE_GRAY;break;case 4:s=this.color_spaces.DEVICE_CMYK;break;case 3:s=this.color_spaces.DEVICE_RGB}c={data:t,width:a.width,height:a.height,colorSpace:s,bitsPerComponent:8,filter:h,index:i,alias:n}}return c}}(Ot.API);var De,Be,Re,ze,qe,Ue=function(){var t,e,i;function n(t){var e,i,n,r,o,s,a,h,c,l,u,f,d,p;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},s=null;;){switch(e=this.readUInt32(),c=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join("")){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":s&&this.animation.frames.push(s),this.pos+=4,s={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},o=this.readUInt16(),r=this.readUInt16()||100,s.delay=1e3*o/r,s.disposeOp=this.data[this.pos++],s.blendOp=this.data[this.pos++],s.data=[];break;case"IDAT":case"fdAT":for("fdAT"===c&&(this.pos+=4,e-=4),t=(null!=s?s.data:void 0)||this.imgData,f=0;0<=e?f<e:f>e;0<=e?++f:--f)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(n=this.palette.length/3,this.transparency.indexed=this.read(e),this.transparency.indexed.length>n)throw new Error("More transparent colors than palette size");if((l=n-this.transparency.indexed.length)>0)for(d=0;0<=l?d<l:d>l;0<=l?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":a=(u=this.read(e)).indexOf(0),h=String.fromCharCode.apply(String,u.slice(0,a)),this.text[h]=String.fromCharCode.apply(String,u.slice(a+1));break;case"IEND":return s&&this.animation.frames.push(s),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(p=this.colorType)||6===p,i=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*i,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}n.prototype.read=function(t){var e,i;for(i=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)i.push(this.data[this.pos++]);return i},n.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},n.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},n.prototype.decodePixels=function(t){var e,i,n=this.pixelBitlength/8,r=new Uint8Array(this.width*this.height*n),o=0,s=this;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);function a(e,i,a,h){var c,l,u,f,d,p,g,m,v,y,b,w,x,_,S,C,A,L,P,T,O,k=Math.ceil((s.width-e)/a),N=Math.ceil((s.height-i)/h),j=s.width==k&&s.height==N;for(_=n*k,w=j?r:new Uint8Array(_*N),p=t.length,x=0,l=0;x<N&&o<p;){switch(t[o++]){case 0:for(f=A=0;A<_;f=A+=1)w[l++]=t[o++];break;case 1:for(f=L=0;L<_;f=L+=1)c=t[o++],d=f<n?0:w[l-n],w[l++]=(c+d)%256;break;case 2:for(f=P=0;P<_;f=P+=1)c=t[o++],u=(f-f%n)/n,S=x&&w[(x-1)*_+u*n+f%n],w[l++]=(S+c)%256;break;case 3:for(f=T=0;T<_;f=T+=1)c=t[o++],u=(f-f%n)/n,d=f<n?0:w[l-n],S=x&&w[(x-1)*_+u*n+f%n],w[l++]=(c+Math.floor((d+S)/2))%256;break;case 4:for(f=O=0;O<_;f=O+=1)c=t[o++],u=(f-f%n)/n,d=f<n?0:w[l-n],0===x?S=C=0:(S=w[(x-1)*_+u*n+f%n],C=u&&w[(x-1)*_+(u-1)*n+f%n]),g=d+S-C,m=Math.abs(g-d),y=Math.abs(g-S),b=Math.abs(g-C),v=m<=y&&m<=b?d:y<=b?S:C,w[l++]=(c+v)%256;break;default:throw new Error("Invalid filter algorithm: "+t[o-1])}if(!j){var F=((i+x*h)*s.width+e)*n,E=x*_;for(f=0;f<k;f+=1){for(var I=0;I<n;I+=1)r[F++]=w[E++];F+=(a-1)*n}}x++}}return t=j((X(e=t),e.subarray(2,-4)),i),1==s.interlaceMethod?(a(0,0,8,8),a(4,0,8,8),a(0,4,4,8),a(2,0,4,4),a(0,2,2,4),a(1,0,2,2),a(0,1,1,2)):a(0,0,1,1),r},n.prototype.decodePalette=function(){var t,e,i,n,r,o,s,a,h;for(i=this.palette,o=this.transparency.indexed||[],r=new Uint8Array((o.length||0)+i.length),n=0,t=0,e=s=0,a=i.length;s<a;e=s+=3)r[n++]=i[e],r[n++]=i[e+1],r[n++]=i[e+2],r[n++]=null!=(h=o[t++])?h:255;return r},n.prototype.copyToImageData=function(t,e){var i,n,r,o,s,a,h,c,l,u,f;if(n=this.colors,l=null,i=this.hasAlphaChannel,this.palette.length&&(l=null!=(f=this._decodedPalette)?f:this._decodedPalette=this.decodePalette(),n=4,i=!0),c=(r=t.data||t).length,s=l||e,o=a=0,1===n)for(;o<c;)h=l?4*e[o/4]:a,u=s[h++],r[o++]=u,r[o++]=u,r[o++]=u,r[o++]=i?s[h++]:255,a=h;else for(;o<c;)h=l?4*e[o/4]:a,r[o++]=s[h++],r[o++]=s[h++],r[o++]=s[h++],r[o++]=i?s[h++]:255,a=h},n.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t};var r=function(){if("[object Window]"===Object.prototype.toString.call(J)){try{e=J.document.createElement("canvas"),i=e.getContext("2d")}catch(t){return!1}return!0}return!1};return r(),t=function(t){var n;if(!0===r())return i.width=t.width,i.height=t.height,i.clearRect(0,0,t.width,t.height),i.putImageData(t,0,0),(n=new Image).src=e.toDataURL(),n;throw new Error("This method requires a Browser with Canvas-capability.")},n.prototype.decodeFrames=function(e){var i,n,r,o,s,a,h,c;if(this.animation){for(c=[],n=s=0,a=(h=this.animation.frames).length;s<a;n=++s)i=h[n],r=e.createImageData(i.width,i.height),o=this.decodePixels(new Uint8Array(i.data)),this.copyToImageData(r,o),i.imageData=r,c.push(i.image=t(r));return c}},n.prototype.renderFrame=function(t,e){var i,n,r;return i=(n=this.animation.frames)[e],r=n[e-1],0===e&&t.clearRect(0,0,this.width,this.height),1===(null!=r?r.disposeOp:void 0)?t.clearRect(r.xOffset,r.yOffset,r.width,r.height):2===(null!=r?r.disposeOp:void 0)&&t.putImageData(r.imageData,r.xOffset,r.yOffset),0===i.blendOp&&t.clearRect(i.xOffset,i.yOffset,i.width,i.height),t.drawImage(i.image,i.xOffset,i.yOffset)},n.prototype.animate=function(t){var e,i,n,r,o,s,a=this;return i=0,s=this.animation,r=s.numFrames,n=s.frames,o=s.numPlays,(e=function(){var s,h;if(s=i++%r,h=n[s],a.renderFrame(t,s),r>1&&i/r<o)return a.animation._timeout=setTimeout(e,h.delay)})()},n.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},n.prototype.render=function(t){var e,i;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(i=e.createImageData(this.width,this.height),this.copyToImageData(i,this.decodePixels()),e.putImageData(i,0,0))},n}();function We(t){var e=0;if(71!==t[e++]||73!==t[e++]||70!==t[e++]||56!==t[e++]||56!=(t[e++]+1&253)||97!==t[e++])throw new Error("Invalid GIF 87a/89a header.");var i=t[e++]|t[e++]<<8,n=t[e++]|t[e++]<<8,r=t[e++],o=r>>7,s=1<<1+(7&r);t[e++],t[e++];var a=null,h=null;o&&(a=e,h=s,e+=3*s);var c=!0,l=[],u=0,f=null,d=0,p=null;for(this.width=i,this.height=n;c&&e<t.length;)switch(t[e++]){case 33:switch(t[e++]){case 255:if(11!==t[e]||78==t[e+1]&&69==t[e+2]&&84==t[e+3]&&83==t[e+4]&&67==t[e+5]&&65==t[e+6]&&80==t[e+7]&&69==t[e+8]&&50==t[e+9]&&46==t[e+10]&&48==t[e+11]&&3==t[e+12]&&1==t[e+13]&&0==t[e+16])e+=14,p=t[e++]|t[e++]<<8,e++;else for(e+=12;;){if(!((P=t[e++])>=0))throw Error("Invalid block size");if(0===P)break;e+=P}break;case 249:if(4!==t[e++]||0!==t[e+4])throw new Error("Invalid graphics extension block.");var g=t[e++];u=t[e++]|t[e++]<<8,f=t[e++],0==(1&g)&&(f=null),d=g>>2&7,e++;break;case 254:for(;;){if(!((P=t[e++])>=0))throw Error("Invalid block size");if(0===P)break;e+=P}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var m=t[e++]|t[e++]<<8,v=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,b=t[e++]|t[e++]<<8,w=t[e++],x=w>>6&1,_=1<<1+(7&w),S=a,C=h,A=!1;w>>7&&(A=!0,S=e,C=_,e+=3*_);var L=e;for(e++;;){var P;if(!((P=t[e++])>=0))throw Error("Invalid block size");if(0===P)break;e+=P}l.push({x:m,y:v,width:y,height:b,has_local_palette:A,palette_offset:S,palette_size:C,data_offset:L,data_length:e-L,transparent_index:f,interlaced:!!x,delay:u,disposal:d});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return l.length},this.loopCount=function(){return p},this.frameInfo=function(t){if(t<0||t>=l.length)throw new Error("Frame index out of range.");return l[t]},this.decodeAndBlitFrameBGRA=function(e,n){var r=this.frameInfo(e),o=r.width*r.height,s=new Uint8Array(o);He(t,r.data_offset,s,o);var a=r.palette_offset,h=r.transparent_index;null===h&&(h=256);var c=r.width,l=i-c,u=c,f=4*(r.y*i+r.x),d=4*((r.y+r.height)*i+r.x),p=f,g=4*l;!0===r.interlaced&&(g+=4*i*7);for(var m=8,v=0,y=s.length;v<y;++v){var b=s[v];if(0===u&&(u=c,(p+=g)>=d&&(g=4*l+4*i*(m-1),p=f+(c+l)*(m<<1),m>>=1)),b===h)p+=4;else{var w=t[a+3*b],x=t[a+3*b+1],_=t[a+3*b+2];n[p++]=_,n[p++]=x,n[p++]=w,n[p++]=255}--u}},this.decodeAndBlitFrameRGBA=function(e,n){var r=this.frameInfo(e),o=r.width*r.height,s=new Uint8Array(o);He(t,r.data_offset,s,o);var a=r.palette_offset,h=r.transparent_index;null===h&&(h=256);var c=r.width,l=i-c,u=c,f=4*(r.y*i+r.x),d=4*((r.y+r.height)*i+r.x),p=f,g=4*l;!0===r.interlaced&&(g+=4*i*7);for(var m=8,v=0,y=s.length;v<y;++v){var b=s[v];if(0===u&&(u=c,(p+=g)>=d&&(g=4*l+4*i*(m-1),p=f+(c+l)*(m<<1),m>>=1)),b===h)p+=4;else{var w=t[a+3*b],x=t[a+3*b+1],_=t[a+3*b+2];n[p++]=w,n[p++]=x,n[p++]=_,n[p++]=255}--u}}}function He(t,e,i,n){for(var r=t[e++],o=1<<r,s=o+1,a=s+1,h=r+1,c=(1<<h)-1,l=0,u=0,f=0,d=t[e++],p=new Int32Array(4096),g=null;;){for(;l<16&&0!==d;)u|=t[e++]<<l,l+=8,1===d?d=t[e++]:--d;if(l<h)break;var m=u&c;if(u>>=h,l-=h,m!==o){if(m===s)break;for(var v=m<a?m:g,y=0,b=v;b>o;)b=p[b]>>8,++y;var w=b;if(f+y+(v!==m?1:0)>n)return void $.log("Warning, gif stream longer than expected.");i[f++]=w;var x=f+=y;for(v!==m&&(i[f++]=w),b=v;y--;)b=p[b],i[--x]=255&b,b>>=8;null!==g&&a<4096&&(p[a++]=g<<8|w,a>=c+1&&h<12&&(++h,c=c<<1|1)),g=m}else a=s+1,c=(1<<(h=r+1))-1,g=null}return f!==n&&$.log("Warning, gif stream shorter than expected."),i}function Ve(t){var e,i,n,r,o,s=Math.floor,a=new Array(64),h=new Array(64),c=new Array(64),l=new Array(64),u=new Array(65535),f=new Array(65535),d=new Array(64),p=new Array(64),g=[],m=0,v=7,y=new Array(64),b=new Array(64),w=new Array(64),x=new Array(256),_=new Array(2048),S=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],C=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],A=[0,1,2,3,4,5,6,7,8,9,10,11],L=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],P=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],T=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],O=[0,1,2,3,4,5,6,7,8,9,10,11],k=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],N=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function j(t,e){for(var i=0,n=0,r=new Array,o=1;o<=16;o++){for(var s=1;s<=t[o];s++)r[e[n]]=[],r[e[n]][0]=i,r[e[n]][1]=o,n++,i++;i*=2}return r}function F(t){for(var e=t[0],i=t[1]-1;i>=0;)e&1<<i&&(m|=1<<v),i--,--v<0&&(255==m?(E(255),E(0)):E(m),v=7,m=0)}function E(t){g.push(t)}function I(t){E(t>>8&255),E(255&t)}function M(t,e,i,n,r){for(var o,s=r[0],a=r[240],h=function(t,e){var i,n,r,o,s,a,h,c,l,u,f=0;for(l=0;l<8;++l){i=t[f],n=t[f+1],r=t[f+2],o=t[f+3],s=t[f+4],a=t[f+5],h=t[f+6];var p=i+(c=t[f+7]),g=i-c,m=n+h,v=n-h,y=r+a,b=r-a,w=o+s,x=o-s,_=p+w,S=p-w,C=m+y,A=m-y;t[f]=_+C,t[f+4]=_-C;var L=.707106781*(A+S);t[f+2]=S+L,t[f+6]=S-L;var P=.382683433*((_=x+b)-(A=v+g)),T=.5411961*_+P,O=1.306562965*A+P,k=.707106781*(C=b+v),N=g+k,j=g-k;t[f+5]=j+T,t[f+3]=j-T,t[f+1]=N+O,t[f+7]=N-O,f+=8}for(f=0,l=0;l<8;++l){i=t[f],n=t[f+8],r=t[f+16],o=t[f+24],s=t[f+32],a=t[f+40],h=t[f+48];var F=i+(c=t[f+56]),E=i-c,I=n+h,M=n-h,D=r+a,B=r-a,R=o+s,z=o-s,q=F+R,U=F-R,W=I+D,H=I-D;t[f]=q+W,t[f+32]=q-W;var V=.707106781*(H+U);t[f+16]=U+V,t[f+48]=U-V;var G=.382683433*((q=z+B)-(H=M+E)),X=.5411961*q+G,Y=1.306562965*H+G,K=.707106781*(W=B+M),J=E+K,Z=E-K;t[f+40]=Z+X,t[f+24]=Z-X,t[f+8]=J+Y,t[f+56]=J-Y,f++}for(l=0;l<64;++l)u=t[l]*e[l],d[l]=u>0?u+.5|0:u-.5|0;return d}(t,e),c=0;c<64;++c)p[S[c]]=h[c];var l=p[0]-i;i=p[0],0==l?F(n[0]):(F(n[f[o=32767+l]]),F(u[o]));for(var g=63;g>0&&0==p[g];)g--;if(0==g)return F(s),i;for(var m,v=1;v<=g;){for(var y=v;0==p[v]&&v<=g;)++v;var b=v-y;if(b>=16){m=b>>4;for(var w=1;w<=m;++w)F(a);b&=15}o=32767+p[v],F(r[(b<<4)+f[o]]),F(u[o]),v++}return 63!=g&&F(s),i}function D(t){t=Math.min(Math.max(t,1),100),o!=t&&(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],i=0;i<64;i++){var n=s((e[i]*t+50)/100);n=Math.min(Math.max(n,1),255),a[S[i]]=n}for(var r=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var u=s((r[o]*t+50)/100);u=Math.min(Math.max(u,1),255),h[S[o]]=u}for(var f=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],d=0,p=0;p<8;p++)for(var g=0;g<8;g++)c[d]=1/(a[S[d]]*f[p]*f[g]*8),l[d]=1/(h[S[d]]*f[p]*f[g]*8),d++}(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),o=t)}this.encode=function(t,o){o&&D(o),g=new Array,m=0,v=7,I(65496),I(65504),I(16),E(74),E(70),E(73),E(70),E(0),E(1),E(1),E(0),I(1),I(1),E(0),E(0),function(){I(65499),I(132),E(0);for(var t=0;t<64;t++)E(a[t]);E(1);for(var e=0;e<64;e++)E(h[e])}(),function(t,e){I(65472),I(17),E(8),I(e),I(t),E(3),E(1),E(17),E(0),E(2),E(17),E(1),E(3),E(17),E(1)}(t.width,t.height),function(){I(65476),I(418),E(0);for(var t=0;t<16;t++)E(C[t+1]);for(var e=0;e<=11;e++)E(A[e]);E(16);for(var i=0;i<16;i++)E(L[i+1]);for(var n=0;n<=161;n++)E(P[n]);E(1);for(var r=0;r<16;r++)E(T[r+1]);for(var o=0;o<=11;o++)E(O[o]);E(17);for(var s=0;s<16;s++)E(k[s+1]);for(var a=0;a<=161;a++)E(N[a])}(),I(65498),I(12),E(3),E(1),E(0),E(2),E(17),E(3),E(17),E(0),E(63),E(0);var s=0,u=0,f=0;m=0,v=7,this.encode.displayName="_encode_";for(var d,p,x,S,j,B,R,z,q,U=t.data,W=t.width,H=t.height,V=4*W,G=0;G<H;){for(d=0;d<V;){for(j=V*G+d,R=-1,z=0,q=0;q<64;q++)B=j+(z=q>>3)*V+(R=4*(7&q)),G+z>=H&&(B-=V*(G+1+z-H)),d+R>=V&&(B-=d+R-V+4),p=U[B++],x=U[B++],S=U[B++],y[q]=(_[p]+_[x+256>>0]+_[S+512>>0]>>16)-128,b[q]=(_[p+768>>0]+_[x+1024>>0]+_[S+1280>>0]>>16)-128,w[q]=(_[p+1280>>0]+_[x+1536>>0]+_[S+1792>>0]>>16)-128;s=M(y,c,s,e,n),u=M(b,l,u,i,r),f=M(w,l,f,i,r),d+=32}G+=8}if(v>=0){var X=[];X[1]=v+1,X[0]=(1<<v+1)-1,F(X)}return I(65497),new Uint8Array(g)},t=t||50,function(){for(var t=String.fromCharCode,e=0;e<256;e++)x[e]=t(e)}(),e=j(C,A),i=j(T,O),n=j(L,P),r=j(k,N),function(){for(var t=1,e=2,i=1;i<=15;i++){for(var n=t;n<e;n++)f[32767+n]=i,u[32767+n]=[],u[32767+n][1]=i,u[32767+n][0]=n;for(var r=-(e-1);r<=-t;r++)f[32767+r]=i,u[32767+r]=[],u[32767+r][1]=i,u[32767+r][0]=e-1+r;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)_[t]=19595*t,_[t+256>>0]=38470*t,_[t+512>>0]=7471*t+32768,_[t+768>>0]=-11059*t,_[t+1024>>0]=-21709*t,_[t+1280>>0]=32768*t+8421375,_[t+1536>>0]=-27439*t,_[t+1792>>0]=-5329*t}(),D(t)}function Ge(t,e){if(this.pos=0,this.buffer=t,this.datav=new DataView(t.buffer),this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,-1===["BM","BA","CI","CP","IC","PT"].indexOf(this.flag))throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function Xe(t){function e(t){if(!t)throw Error("assert :P")}function i(t,e,i){for(var n=0;4>n;n++)if(t[e+n]!=i.charCodeAt(n))return!0;return!1}function n(t,e,i,n,r){for(var o=0;o<r;o++)t[e+o]=i[n+o]}function r(t,e,i,n){for(var r=0;r<n;r++)t[e+r]=i}function o(t){return new Int32Array(t)}function s(t,e){for(var i=[],n=0;n<t;n++)i.push(new e);return i}function a(t,e){var i=[];return function t(i,n,r){for(var o=r[n],s=0;s<o&&(i.push(r.length>n+1?[]:new e),!(r.length<n+1));s++)t(i[s],n+1,r)}(i,0,t),i}var h=function(){var t=this;function h(t,e){for(var i=1<<e-1>>>0;t&i;)i>>>=1;return i?(t&i-1)+i:t}function c(t,i,n,r,o){e(!(r%n));do{t[i+(r-=n)]=o}while(0<r)}function l(t,i,n,r,s){if(e(2328>=s),512>=s)var a=o(512);else if(null==(a=o(s)))return 0;return function(t,i,n,r,s,a){var l,f,d=i,p=1<<n,g=o(16),m=o(16);for(e(0!=s),e(null!=r),e(null!=t),e(0<n),f=0;f<s;++f){if(15<r[f])return 0;++g[r[f]]}if(g[0]==s)return 0;for(m[1]=0,l=1;15>l;++l){if(g[l]>1<<l)return 0;m[l+1]=m[l]+g[l]}for(f=0;f<s;++f)l=r[f],0<r[f]&&(a[m[l]++]=f);if(1==m[15])return(r=new u).g=0,r.value=a[0],c(t,d,1,p,r),p;var v,y=-1,b=p-1,w=0,x=1,_=1,S=1<<n;for(f=0,l=1,s=2;l<=n;++l,s<<=1){if(x+=_<<=1,0>(_-=g[l]))return 0;for(;0<g[l];--g[l])(r=new u).g=l,r.value=a[f++],c(t,d+w,s,S,r),w=h(w,l)}for(l=n+1,s=2;15>=l;++l,s<<=1){if(x+=_<<=1,0>(_-=g[l]))return 0;for(;0<g[l];--g[l]){if(r=new u,(w&b)!=y){for(d+=S,v=1<<(y=l)-n;15>y&&!(0>=(v-=g[y]));)++y,v<<=1;p+=S=1<<(v=y-n),t[i+(y=w&b)].g=v+n,t[i+y].value=d-i-y}r.g=l-n,r.value=a[f++],c(t,d+(w>>n),s,S,r),w=h(w,l)}}return x!=2*m[15]-1?0:p}(t,i,n,r,s,a)}function u(){this.value=this.g=0}function f(){this.value=this.g=0}function d(){this.G=s(5,u),this.H=o(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=s(Bi,f)}function p(t,i,n,r){e(null!=t),e(null!=i),e(2147483648>r),t.Ca=254,t.I=0,t.b=-8,t.Ka=0,t.oa=i,t.pa=n,t.Jd=i,t.Yc=n+r,t.Zc=4<=r?n+r-4+1:n,L(t)}function g(t,e){for(var i=0;0<e--;)i|=T(t,128)<<e;return i}function m(t,e){var i=g(t,e);return P(t)?-i:i}function v(t,i,n,r){var o,s=0;for(e(null!=t),e(null!=i),e(4294967288>r),t.Sb=r,t.Ra=0,t.u=0,t.h=0,4<r&&(r=4),o=0;o<r;++o)s+=i[n+o]<<8*o;t.Ra=s,t.bb=r,t.oa=i,t.pa=n}function y(t){for(;8<=t.u&&t.bb<t.Sb;)t.Ra>>>=8,t.Ra+=t.oa[t.pa+t.bb]<<qi-8>>>0,++t.bb,t.u-=8;S(t)&&(t.h=1,t.u=0)}function b(t,i){if(e(0<=i),!t.h&&i<=zi){var n=_(t)&Ri[i];return t.u+=i,y(t),n}return t.h=1,t.u=0}function w(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function x(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function _(t){return t.Ra>>>(t.u&qi-1)>>>0}function S(t){return e(t.bb<=t.Sb),t.h||t.bb==t.Sb&&t.u>qi}function C(t,e){t.u=e,t.h=S(t)}function A(t){t.u>=Ui&&(e(t.u>=Ui),y(t))}function L(t){e(null!=t&&null!=t.oa),t.pa<t.Zc?(t.I=(t.oa[t.pa++]|t.I<<8)>>>0,t.b+=8):(e(null!=t&&null!=t.oa),t.pa<t.Yc?(t.b+=8,t.I=t.oa[t.pa++]|t.I<<8):t.Ka?t.b=0:(t.I<<=8,t.b+=8,t.Ka=1))}function P(t){return g(t,1)}function T(t,e){var i=t.Ca;0>t.b&&L(t);var n=t.b,r=i*e>>>8,o=(t.I>>>n>r)+0;for(o?(i-=r,t.I-=r+1<<n>>>0):i=r+1,n=i,r=0;256<=n;)r+=8,n>>=8;return n=7^r+Wi[n],t.b-=n,t.Ca=(i<<n)-1,o}function O(t,e,i){t[e+0]=i>>24&255,t[e+1]=i>>16&255,t[e+2]=i>>8&255,t[e+3]=i>>0&255}function k(t,e){return t[e+0]<<0|t[e+1]<<8}function N(t,e){return k(t,e)|t[e+2]<<16}function j(t,e){return k(t,e)|k(t,e+2)<<16}function F(t,i){var n=1<<i;return e(null!=t),e(0<i),t.X=o(n),null==t.X?0:(t.Mb=32-i,t.Xa=i,1)}function E(t,i){e(null!=t),e(null!=i),e(t.Xa==i.Xa),n(i.X,0,t.X,0,1<<i.Xa)}function I(){this.X=[],this.Xa=this.Mb=0}function M(t,i,n,r){e(null!=n),e(null!=r);var o=n[0],s=r[0];return 0==o&&(o=(t*s+i/2)/i),0==s&&(s=(i*o+t/2)/t),0>=o||0>=s?0:(n[0]=o,r[0]=s,1)}function D(t,e){return t+(1<<e)-1>>>e}function B(t,e){return((4278255360&t)+(4278255360&e)>>>0&4278255360)+((16711935&t)+(16711935&e)>>>0&16711935)>>>0}function R(e,i){t[i]=function(i,n,r,o,s,a,h){var c;for(c=0;c<s;++c){var l=t[e](a[h+c-1],r,o+c);a[h+c]=B(i[n+c],l)}}}function z(){this.ud=this.hd=this.jd=0}function q(t,e){return((4278124286&(t^e))>>>1)+(t&e)>>>0}function U(t){return 0<=t&&256>t?t:0>t?0:255<t?255:void 0}function W(t,e){return U(t+(t-e+.5>>1))}function H(t,e,i){return Math.abs(e-i)-Math.abs(t-i)}function V(t,e,i,n,r,o,s){for(n=o[s-1],i=0;i<r;++i)o[s+i]=n=B(t[e+i],n)}function G(t,e,i,n,r){var o;for(o=0;o<i;++o){var s=t[e+o],a=s>>8&255,h=16711935&(h=(h=16711935&s)+((a<<16)+a));n[r+o]=(4278255360&s)+h>>>0}}function X(t,e){e.jd=t>>0&255,e.hd=t>>8&255,e.ud=t>>16&255}function Y(t,e,i,n,r,o){var s;for(s=0;s<n;++s){var a=e[i+s],h=a>>>8,c=a,l=255&(l=(l=a>>>16)+((t.jd<<24>>24)*(h<<24>>24)>>>5));c=255&(c=(c+=(t.hd<<24>>24)*(h<<24>>24)>>>5)+((t.ud<<24>>24)*(l<<24>>24)>>>5)),r[o+s]=(4278255360&a)+(l<<16)+c}}function K(e,i,n,r,o){t[i]=function(t,e,i,n,s,a,h,c,l){for(n=h;n<c;++n)for(h=0;h<l;++h)s[a++]=o(i[r(t[e++])])},t[e]=function(e,i,s,a,h,c,l){var u=8>>e.b,f=e.Ea,d=e.K[0],p=e.w;if(8>u)for(e=(1<<e.b)-1,p=(1<<u)-1;i<s;++i){var g,m=0;for(g=0;g<f;++g)g&e||(m=r(a[h++])),c[l++]=o(d[m&p]),m>>=u}else t["VP8LMapColor"+n](a,h,d,p,c,l,i,s,f)}}function J(t,e,i,n,r){for(i=e+i;e<i;){var o=t[e++];n[r++]=o>>16&255,n[r++]=o>>8&255,n[r++]=o>>0&255}}function Z(t,e,i,n,r){for(i=e+i;e<i;){var o=t[e++];n[r++]=o>>16&255,n[r++]=o>>8&255,n[r++]=o>>0&255,n[r++]=o>>24&255}}function $(t,e,i,n,r){for(i=e+i;e<i;){var o=(s=t[e++])>>16&240|s>>12&15,s=s>>0&240|s>>28&15;n[r++]=o,n[r++]=s}}function Q(t,e,i,n,r){for(i=e+i;e<i;){var o=(s=t[e++])>>16&248|s>>13&7,s=s>>5&224|s>>3&31;n[r++]=o,n[r++]=s}}function tt(t,e,i,n,r){for(i=e+i;e<i;){var o=t[e++];n[r++]=o>>0&255,n[r++]=o>>8&255,n[r++]=o>>16&255}}function et(t,e,i,r,o,s){if(0==s)for(i=e+i;e<i;)O(r,((s=t[e++])[0]>>24|s[1]>>8&65280|s[2]<<8&16711680|s[3]<<24)>>>0),o+=32;else n(r,o,t,e,i)}function it(e,i){t[i][0]=t[e+"0"],t[i][1]=t[e+"1"],t[i][2]=t[e+"2"],t[i][3]=t[e+"3"],t[i][4]=t[e+"4"],t[i][5]=t[e+"5"],t[i][6]=t[e+"6"],t[i][7]=t[e+"7"],t[i][8]=t[e+"8"],t[i][9]=t[e+"9"],t[i][10]=t[e+"10"],t[i][11]=t[e+"11"],t[i][12]=t[e+"12"],t[i][13]=t[e+"13"],t[i][14]=t[e+"0"],t[i][15]=t[e+"0"]}function nt(t){return t==Wn||t==Hn||t==Vn||t==Gn}function rt(){this.eb=[],this.size=this.A=this.fb=0}function ot(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function st(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new rt,this.f.kb=new ot,this.sd=null}function at(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function ht(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function ct(t){return alert("todo:WebPSamplerProcessPlane"),t.T}function lt(t,e){var i=t.T,r=e.ba.f.RGBA,o=r.eb,s=r.fb+t.ka*r.A,a=vr[e.ba.S],h=t.y,c=t.O,l=t.f,u=t.N,f=t.ea,d=t.W,p=e.cc,g=e.dc,m=e.Mc,v=e.Nc,y=t.ka,b=t.ka+t.T,w=t.U,x=w+1>>1;for(0==y?a(h,c,null,null,l,u,f,d,l,u,f,d,o,s,null,null,w):(a(e.ec,e.fc,h,c,p,g,m,v,l,u,f,d,o,s-r.A,o,s,w),++i);y+2<b;y+=2)p=l,g=u,m=f,v=d,u+=t.Rc,d+=t.Rc,s+=2*r.A,a(h,(c+=2*t.fa)-t.fa,h,c,p,g,m,v,l,u,f,d,o,s-r.A,o,s,w);return c+=t.fa,t.j+b<t.o?(n(e.ec,e.fc,h,c,w),n(e.cc,e.dc,l,u,x),n(e.Mc,e.Nc,f,d,x),i--):1&b||a(h,c,null,null,l,u,f,d,l,u,f,d,o,s+r.A,null,null,w),i}function ut(t,i,n){var r=t.F,o=[t.J];if(null!=r){var s=t.U,a=i.ba.S,h=a==zn||a==Vn;i=i.ba.f.RGBA;var c=[0],l=t.ka;c[0]=t.T,t.Kb&&(0==l?--c[0]:(--l,o[0]-=t.width),t.j+t.ka+t.T==t.o&&(c[0]=t.o-t.j-l));var u=i.eb;l=i.fb+l*i.A,t=An(r,o[0],t.width,s,c,u,l+(h?0:3),i.A),e(n==c),t&&nt(a)&&Sn(u,l,h,s,c,i.A)}return 0}function ft(t){var e=t.ma,i=e.ba.S,n=11>i,r=i==Dn||i==Rn||i==zn||i==qn||12==i||nt(i);if(e.memory=null,e.Ib=null,e.Jb=null,e.Nd=null,!Ii(e.Oa,t,r?11:12))return 0;if(r&&nt(i)&&yi(),t.da)alert("todo:use_scaling");else{if(n){if(e.Ib=ct,t.Kb){if(i=t.U+1>>1,e.memory=o(t.U+2*i),null==e.memory)return 0;e.ec=e.memory,e.fc=0,e.cc=e.ec,e.dc=e.fc+t.U,e.Mc=e.cc,e.Nc=e.dc+i,e.Ib=lt,yi()}}else alert("todo:EmitYUV");r&&(e.Jb=ut,n&&mi())}if(n&&!Nr){for(t=0;256>t;++t)jr[t]=89858*(t-128)+Lr>>Ar,Ir[t]=-22014*(t-128)+Lr,Er[t]=-45773*(t-128),Fr[t]=113618*(t-128)+Lr>>Ar;for(t=Pr;t<Tr;++t)e=76283*(t-16)+Lr>>Ar,Mr[t-Pr]=Vt(e,255),Dr[t-Pr]=Vt(e+8>>4,15);Nr=1}return 1}function dt(t){var i=t.ma,n=t.U,r=t.T;return e(!(1&t.ka)),0>=n||0>=r?0:(n=i.Ib(t,i),null!=i.Jb&&i.Jb(t,i,n),i.Dc+=n,1)}function pt(t){t.ma.memory=null}function gt(t,e,i,n){return 47!=b(t,8)?0:(e[0]=b(t,14)+1,i[0]=b(t,14)+1,n[0]=b(t,1),0!=b(t,3)?0:!t.h)}function mt(t,e){if(4>t)return t+1;var i=t-2>>1;return(2+(1&t)<<i)+b(e,i)+1}function vt(t,e){return 120<e?e-120:1<=(i=((i=$n[e-1])>>4)*t+(8-(15&i)))?i:1;var i}function yt(t,e,i){var n=_(i),r=t[e+=255&n].g-8;return 0<r&&(C(i,i.u+8),n=_(i),e+=t[e].value,e+=n&(1<<r)-1),C(i,i.u+t[e].g),t[e].value}function bt(t,i,n){return n.g+=t.g,n.value+=t.value<<i>>>0,e(8>=n.g),t.g}function wt(t,i,n){var r=t.xc;return e((i=0==r?0:t.vc[t.md*(n>>r)+(i>>r)])<t.Wb),t.Ya[i]}function xt(t,i,r,o){var s=t.ab,a=t.c*i,h=t.C;i=h+i;var c=r,l=o;for(o=t.Ta,r=t.Ua;0<s--;){var u=t.gc[s],f=h,d=i,p=c,g=l,m=(l=o,c=r,u.Ea);switch(e(f<d),e(d<=u.nc),u.hc){case 2:Gi(p,g,(d-f)*m,l,c);break;case 0:var v=f,y=d,b=l,w=c,x=(L=u).Ea;0==v&&(Hi(p,g,null,null,1,b,w),V(p,g+1,0,0,x-1,b,w+1),g+=x,w+=x,++v);for(var _=1<<L.b,S=_-1,C=D(x,L.b),A=L.K,L=L.w+(v>>L.b)*C;v<y;){var P=A,T=L,O=1;for(Vi(p,g,b,w-x,1,b,w);O<x;){var k=(O&~S)+_;k>x&&(k=x),(0,Zi[P[T++]>>8&15])(p,g+ +O,b,w+O-x,k-O,b,w+O),O=k}g+=x,w+=x,++v&S||(L+=C)}d!=u.nc&&n(l,c-m,l,c+(d-f-1)*m,m);break;case 1:for(m=p,y=g,x=(p=u.Ea)-(w=p&~(b=(g=1<<u.b)-1)),v=D(p,u.b),_=u.K,u=u.w+(f>>u.b)*v;f<d;){for(S=_,C=u,A=new z,L=y+w,P=y+p;y<L;)X(S[C++],A),$i(A,m,y,g,l,c),y+=g,c+=g;y<P&&(X(S[C++],A),$i(A,m,y,x,l,c),y+=x,c+=x),++f&b||(u+=v)}break;case 3:if(p==l&&g==c&&0<u.b){for(y=l,p=m=c+(d-f)*m-(w=(d-f)*D(u.Ea,u.b)),g=l,b=c,v=[],w=(x=w)-1;0<=w;--w)v[w]=g[b+w];for(w=x-1;0<=w;--w)y[p+w]=v[w];Xi(u,f,d,l,m,l,c)}else Xi(u,f,d,p,g,l,c)}c=o,l=r}l!=r&&n(o,r,c,l,a)}function _t(t,i){var n=t.V,r=t.Ba+t.c*t.C,o=i-t.C;if(e(i<=t.l.o),e(16>=o),0<o){var s=t.l,a=t.Ta,h=t.Ua,c=s.width;if(xt(t,o,n,r),o=h=[h],e((n=t.C)<(r=i)),e(s.v<s.va),r>s.o&&(r=s.o),n<s.j){var l=s.j-n;n=s.j,o[0]+=l*c}if(n>=r?n=0:(o[0]+=4*s.v,s.ka=n-s.j,s.U=s.va-s.v,s.T=r-n,n=1),n){if(h=h[0],11>(n=t.ca).S){var u=n.f.RGBA,f=(r=n.S,o=s.U,s=s.T,l=u.eb,u.A),d=s;for(u=u.fb+t.Ma*u.A;0<d--;){var p=a,g=h,m=o,v=l,y=u;switch(r){case Mn:Qi(p,g,m,v,y);break;case Dn:tn(p,g,m,v,y);break;case Wn:tn(p,g,m,v,y),Sn(v,y,0,m,1,0);break;case Bn:rn(p,g,m,v,y);break;case Rn:et(p,g,m,v,y,1);break;case Hn:et(p,g,m,v,y,1),Sn(v,y,0,m,1,0);break;case zn:et(p,g,m,v,y,0);break;case Vn:et(p,g,m,v,y,0),Sn(v,y,1,m,1,0);break;case qn:en(p,g,m,v,y);break;case Gn:en(p,g,m,v,y),Cn(v,y,m,1,0);break;case Un:nn(p,g,m,v,y);break;default:e(0)}h+=c,u+=f}t.Ma+=s}else alert("todo:EmitRescaledRowsYUVA");e(t.Ma<=n.height)}}t.C=i,e(t.C<=t.i)}function St(t){var e;if(0<t.ua)return 0;for(e=0;e<t.Wb;++e){var i=t.Ya[e].G,n=t.Ya[e].H;if(0<i[1][n[1]+0].g||0<i[2][n[2]+0].g||0<i[3][n[3]+0].g)return 0}return 1}function Ct(t,i,n,r,o,s){if(0!=t.Z){var a=t.qd,h=t.rd;for(e(null!=mr[t.Z]);i<n;++i)mr[t.Z](a,h,r,o,r,o,s),a=r,h=o,o+=s;t.qd=a,t.rd=h}}function At(t,i){var n=t.l.ma,r=0==n.Z||1==n.Z?t.l.j:t.C;if(r=t.C<r?r:t.C,e(i<=t.l.o),i>r){var o=t.l.width,s=n.ca,a=n.tb+o*r,h=t.V,c=t.Ba+t.c*r,l=t.gc;e(1==t.ab),e(3==l[0].hc),Ki(l[0],r,i,h,c,s,a),Ct(n,r,i,s,a,o)}t.C=t.Ma=i}function Lt(t,i,n,r,o,s,a){var h=t.$/r,c=t.$%r,l=t.m,u=t.s,f=n+t.$,d=f;o=n+r*o;var p=n+r*s,g=280+u.ua,m=t.Pb?h:16777216,v=0<u.ua?u.Wa:null,y=u.wc,b=f<p?wt(u,c,h):null;e(t.C<s),e(p<=o);var w=!1;t:for(;;){for(;w||f<p;){var x=0;if(h>=m){var L=f-n;e((m=t).Pb),m.wd=m.m,m.xd=L,0<m.s.ua&&E(m.s.Wa,m.s.vb),m=h+tr}if(c&y||(b=wt(u,c,h)),e(null!=b),b.Qb&&(i[f]=b.qb,w=!0),!w)if(A(l),b.jc){x=l,L=i;var P=f,T=b.pd[_(x)&Bi-1];e(b.jc),256>T.g?(C(x,x.u+T.g),L[P]=T.value,x=0):(C(x,x.u+T.g-256),e(256<=T.value),x=T.value),0==x&&(w=!0)}else x=yt(b.G[0],b.H[0],l);if(l.h)break;if(w||256>x){if(!w)if(b.nd)i[f]=(b.qb|x<<8)>>>0;else{if(A(l),w=yt(b.G[1],b.H[1],l),A(l),L=yt(b.G[2],b.H[2],l),P=yt(b.G[3],b.H[3],l),l.h)break;i[f]=(P<<24|w<<16|x<<8|L)>>>0}if(w=!1,++f,++c>=r&&(c=0,++h,null!=a&&h<=s&&!(h%16)&&a(t,h),null!=v))for(;d<f;)x=i[d++],v.X[(506832829*x&4294967295)>>>v.Mb]=x}else if(280>x){if(x=mt(x-256,l),L=yt(b.G[4],b.H[4],l),A(l),L=vt(r,L=mt(L,l)),l.h)break;if(f-n<L||o-f<x)break t;for(P=0;P<x;++P)i[f+P]=i[f+P-L];for(f+=x,c+=x;c>=r;)c-=r,++h,null!=a&&h<=s&&!(h%16)&&a(t,h);if(e(f<=o),c&y&&(b=wt(u,c,h)),null!=v)for(;d<f;)x=i[d++],v.X[(506832829*x&4294967295)>>>v.Mb]=x}else{if(!(x<g))break t;for(w=x-280,e(null!=v);d<f;)x=i[d++],v.X[(506832829*x&4294967295)>>>v.Mb]=x;x=f,e(!(w>>>(L=v).Xa)),i[x]=L.X[w],w=!0}w||e(l.h==S(l))}if(t.Pb&&l.h&&f<o)e(t.m.h),t.a=5,t.m=t.wd,t.$=t.xd,0<t.s.ua&&E(t.s.vb,t.s.Wa);else{if(l.h)break t;null!=a&&a(t,h>s?s:h),t.a=0,t.$=f-n}return 1}return t.a=3,0}function Pt(t){e(null!=t),t.vc=null,t.yc=null,t.Ya=null;var i=t.Wa;null!=i&&(i.X=null),t.vb=null,e(null!=t)}function Tt(){var e=new si;return null==e?null:(e.a=0,e.xb=gr,it("Predictor","VP8LPredictors"),it("Predictor","VP8LPredictors_C"),it("PredictorAdd","VP8LPredictorsAdd"),it("PredictorAdd","VP8LPredictorsAdd_C"),Gi=G,$i=Y,Qi=J,tn=Z,en=$,nn=Q,rn=tt,t.VP8LMapColor32b=Yi,t.VP8LMapColor8b=Ji,e)}function Ot(t,i,n,a,h){var c=1,f=[t],p=[i],g=a.m,m=a.s,v=null,y=0;t:for(;;){if(n)for(;c&&b(g,1);){var w=f,x=p,S=a,L=1,P=S.m,T=S.gc[S.ab],O=b(P,2);if(S.Oc&1<<O)c=0;else{switch(S.Oc|=1<<O,T.hc=O,T.Ea=w[0],T.nc=x[0],T.K=[null],++S.ab,e(4>=S.ab),O){case 0:case 1:T.b=b(P,3)+2,L=Ot(D(T.Ea,T.b),D(T.nc,T.b),0,S,T.K),T.K=T.K[0];break;case 3:var k,N=b(P,8)+1,j=16<N?0:4<N?1:2<N?2:3;if(w[0]=D(T.Ea,j),T.b=j,k=L=Ot(N,1,0,S,T.K)){var E,I=N,M=T,R=1<<(8>>M.b),z=o(R);if(null==z)k=0;else{var q=M.K[0],U=M.w;for(z[0]=M.K[0][0],E=1;E<1*I;++E)z[E]=B(q[U+E],z[E-1]);for(;E<4*R;++E)z[E]=0;M.K[0]=null,M.K[0]=z,k=1}}L=k;break;case 2:break;default:e(0)}c=L}}if(f=f[0],p=p[0],c&&b(g,1)&&!(c=1<=(y=b(g,4))&&11>=y)){a.a=3;break t}var W;if(W=c)e:{var H,V,G,X=a,Y=f,K=p,J=y,Z=n,$=X.m,Q=X.s,tt=[null],et=1,it=0,nt=Qn[J];i:for(;;){if(Z&&b($,1)){var rt=b($,3)+2,ot=D(Y,rt),st=D(K,rt),at=ot*st;if(!Ot(ot,st,0,X,tt))break i;for(tt=tt[0],Q.xc=rt,H=0;H<at;++H){var ht=tt[H]>>8&65535;tt[H]=ht,ht>=et&&(et=ht+1)}}if($.h)break i;for(V=0;5>V;++V){var ct=Kn[V];!V&&0<J&&(ct+=1<<J),it<ct&&(it=ct)}var lt=s(et*nt,u),ut=et,ft=s(ut,d);if(null==ft)var dt=null;else e(65536>=ut),dt=ft;var pt=o(it);if(null==dt||null==pt||null==lt){X.a=1;break i}var gt=lt;for(H=G=0;H<et;++H){var mt=dt[H],vt=mt.G,yt=mt.H,wt=0,xt=1,_t=0;for(V=0;5>V;++V){ct=Kn[V],vt[V]=gt,yt[V]=G,!V&&0<J&&(ct+=1<<J);n:{var St,Ct=ct,At=X,Tt=pt,kt=gt,Nt=G,jt=0,Ft=At.m,Et=b(Ft,1);if(r(Tt,0,0,Ct),Et){var It=b(Ft,1)+1,Mt=b(Ft,1),Dt=b(Ft,0==Mt?1:8);Tt[Dt]=1,2==It&&(Tt[Dt=b(Ft,8)]=1);var Bt=1}else{var Rt=o(19),zt=b(Ft,4)+4;if(19<zt){At.a=3;var qt=0;break n}for(St=0;St<zt;++St)Rt[Zn[St]]=b(Ft,3);var Ut=void 0,Wt=void 0,Ht=At,Vt=Rt,Gt=Ct,Xt=Tt,Yt=0,Kt=Ht.m,Jt=8,Zt=s(128,u);r:for(;l(Zt,0,7,Vt,19);){if(b(Kt,1)){var $t=2+2*b(Kt,3);if((Ut=2+b(Kt,$t))>Gt)break r}else Ut=Gt;for(Wt=0;Wt<Gt&&Ut--;){A(Kt);var Qt=Zt[0+(127&_(Kt))];C(Kt,Kt.u+Qt.g);var te=Qt.value;if(16>te)Xt[Wt++]=te,0!=te&&(Jt=te);else{var ee=16==te,ie=te-16,ne=Yn[ie],re=b(Kt,Xn[ie])+ne;if(Wt+re>Gt)break r;for(var oe=ee?Jt:0;0<re--;)Xt[Wt++]=oe}}Yt=1;break r}Yt||(Ht.a=3),Bt=Yt}(Bt=Bt&&!Ft.h)&&(jt=l(kt,Nt,8,Tt,Ct)),Bt&&0!=jt?qt=jt:(At.a=3,qt=0)}if(0==qt)break i;if(xt&&1==Jn[V]&&(xt=0==gt[G].g),wt+=gt[G].g,G+=qt,3>=V){var se,ae=pt[0];for(se=1;se<ct;++se)pt[se]>ae&&(ae=pt[se]);_t+=ae}}if(mt.nd=xt,mt.Qb=0,xt&&(mt.qb=(vt[3][yt[3]+0].value<<24|vt[1][yt[1]+0].value<<16|vt[2][yt[2]+0].value)>>>0,0==wt&&256>vt[0][yt[0]+0].value&&(mt.Qb=1,mt.qb+=vt[0][yt[0]+0].value<<8)),mt.jc=!mt.Qb&&6>_t,mt.jc){var he,ce=mt;for(he=0;he<Bi;++he){var le=he,ue=ce.pd[le],fe=ce.G[0][ce.H[0]+le];256<=fe.value?(ue.g=fe.g+256,ue.value=fe.value):(ue.g=0,ue.value=0,le>>=bt(fe,8,ue),le>>=bt(ce.G[1][ce.H[1]+le],16,ue),le>>=bt(ce.G[2][ce.H[2]+le],0,ue),bt(ce.G[3][ce.H[3]+le],24,ue))}}}Q.vc=tt,Q.Wb=et,Q.Ya=dt,Q.yc=lt,W=1;break e}W=0}if(!(c=W)){a.a=3;break t}if(0<y){if(m.ua=1<<y,!F(m.Wa,y)){a.a=1,c=0;break t}}else m.ua=0;var de=a,pe=f,ge=p,me=de.s,ve=me.xc;if(de.c=pe,de.i=ge,me.md=D(pe,ve),me.wc=0==ve?-1:(1<<ve)-1,n){a.xb=pr;break t}if(null==(v=o(f*p))){a.a=1,c=0;break t}c=(c=Lt(a,v,0,f,p,p,null))&&!g.h;break t}return c?(null!=h?h[0]=v:(e(null==v),e(n)),a.$=0,n||Pt(m)):Pt(m),c}function kt(t,i){var n=t.c*t.i,r=n+i+16*i;return e(t.c<=i),t.V=o(r),null==t.V?(t.Ta=null,t.Ua=0,t.a=1,0):(t.Ta=t.V,t.Ua=t.Ba+n+i,1)}function Nt(t,i){var n=t.C,r=i-n,o=t.V,s=t.Ba+t.c*n;for(e(i<=t.l.o);0<r;){var a=16<r?16:r,h=t.l.ma,c=t.l.width,l=c*a,u=h.ca,f=h.tb+c*n,d=t.Ta,p=t.Ua;xt(t,a,o,s),Ln(d,p,u,f,l),Ct(h,n,n+a,u,f,c),r-=a,o+=a*t.c,n+=a}e(n==i),t.C=t.Ma=i}function jt(){this.ub=this.yd=this.td=this.Rb=0}function Ft(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Et(){this.Fb=this.Bb=this.Cb=0,this.Zb=o(4),this.Lb=o(4)}function It(){this.Yb=function(){var t=[];return function t(e,i,n){for(var r=n[i],o=0;o<r&&(e.push(n.length>i+1?[]:0),!(n.length<i+1));o++)t(e[o],i+1,n)}(t,0,[3,11]),t}()}function Mt(){this.jb=o(3),this.Wc=a([4,8],It),this.Xc=a([4,17],It)}function Dt(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new o(4),this.od=new o(4)}function Bt(){this.ld=this.La=this.dd=this.tc=0}function Rt(){this.Na=this.la=0}function zt(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function qt(){this.ad=o(384),this.Za=0,this.Ob=o(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function Ut(){this.uc=this.M=this.Nb=0,this.wa=Array(new Bt),this.Y=0,this.ya=Array(new qt),this.aa=0,this.l=new Gt}function Wt(){this.y=o(16),this.f=o(8),this.ea=o(8)}function Ht(){this.cb=this.a=0,this.sc="",this.m=new w,this.Od=new jt,this.Kc=new Ft,this.ed=new Dt,this.Qa=new Et,this.Ic=this.$c=this.Aa=0,this.D=new Ut,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=s(8,w),this.ia=0,this.pb=s(4,zt),this.Pa=new Mt,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Wt),this.Hd=0,this.rb=Array(new Rt),this.sb=0,this.wa=Array(new Bt),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new qt),this.L=this.aa=0,this.gd=a([4,2],Bt),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Vt(t,e){return 0>t?0:t>e?e:t}function Gt(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Xt(){var t=new Ht;return null!=t&&(t.a=0,t.sc="OK",t.cb=0,t.Xb=0,nr||(nr=Zt)),t}function Yt(t,e,i){return 0==t.a&&(t.a=e,t.sc=i,t.cb=0),0}function Kt(t,e,i){return 3<=i&&157==t[e+0]&&1==t[e+1]&&42==t[e+2]}function Jt(t,i){if(null==t)return 0;if(t.a=0,t.sc="OK",null==i)return Yt(t,2,"null VP8Io passed to VP8GetHeaders()");var n=i.data,o=i.w,s=i.ha;if(4>s)return Yt(t,7,"Truncated header.");var a=n[o+0]|n[o+1]<<8|n[o+2]<<16,h=t.Od;if(h.Rb=!(1&a),h.td=a>>1&7,h.yd=a>>4&1,h.ub=a>>5,3<h.td)return Yt(t,3,"Incorrect keyframe parameters.");if(!h.yd)return Yt(t,4,"Frame not displayable.");o+=3,s-=3;var c=t.Kc;if(h.Rb){if(7>s)return Yt(t,7,"cannot parse picture header");if(!Kt(n,o,s))return Yt(t,3,"Bad code word");c.c=16383&(n[o+4]<<8|n[o+3]),c.Td=n[o+4]>>6,c.i=16383&(n[o+6]<<8|n[o+5]),c.Ud=n[o+6]>>6,o+=7,s-=7,t.za=c.c+15>>4,t.Ub=c.i+15>>4,i.width=c.c,i.height=c.i,i.Da=0,i.j=0,i.v=0,i.va=i.width,i.o=i.height,i.da=0,i.ib=i.width,i.hb=i.height,i.U=i.width,i.T=i.height,r((a=t.Pa).jb,0,255,a.jb.length),e(null!=(a=t.Qa)),a.Cb=0,a.Bb=0,a.Fb=1,r(a.Zb,0,0,a.Zb.length),r(a.Lb,0,0,a.Lb)}if(h.ub>s)return Yt(t,7,"bad partition length");p(a=t.m,n,o,h.ub),o+=h.ub,s-=h.ub,h.Rb&&(c.Ld=P(a),c.Kd=P(a)),c=t.Qa;var l,u=t.Pa;if(e(null!=a),e(null!=c),c.Cb=P(a),c.Cb){if(c.Bb=P(a),P(a)){for(c.Fb=P(a),l=0;4>l;++l)c.Zb[l]=P(a)?m(a,7):0;for(l=0;4>l;++l)c.Lb[l]=P(a)?m(a,6):0}if(c.Bb)for(l=0;3>l;++l)u.jb[l]=P(a)?g(a,8):255}else c.Bb=0;if(a.Ka)return Yt(t,3,"cannot parse segment header");if((c=t.ed).zd=P(a),c.Tb=g(a,6),c.wb=g(a,3),c.Pc=P(a),c.Pc&&P(a)){for(u=0;4>u;++u)P(a)&&(c.vd[u]=m(a,6));for(u=0;4>u;++u)P(a)&&(c.od[u]=m(a,6))}if(t.L=0==c.Tb?0:c.zd?1:2,a.Ka)return Yt(t,3,"cannot parse filter header");var f=s;if(s=l=o,o=l+f,c=f,t.Xb=(1<<g(t.m,2))-1,f<3*(u=t.Xb))n=7;else{for(l+=3*u,c-=3*u,f=0;f<u;++f){var d=n[s+0]|n[s+1]<<8|n[s+2]<<16;d>c&&(d=c),p(t.Jc[+f],n,l,d),l+=d,c-=d,s+=3}p(t.Jc[+u],n,l,c),n=l<o?0:5}if(0!=n)return Yt(t,n,"cannot parse partitions");for(n=g(l=t.m,7),s=P(l)?m(l,4):0,o=P(l)?m(l,4):0,c=P(l)?m(l,4):0,u=P(l)?m(l,4):0,l=P(l)?m(l,4):0,f=t.Qa,d=0;4>d;++d){if(f.Cb){var v=f.Zb[d];f.Fb||(v+=n)}else{if(0<d){t.pb[d]=t.pb[0];continue}v=n}var y=t.pb[d];y.Sc[0]=er[Vt(v+s,127)],y.Sc[1]=ir[Vt(v+0,127)],y.Eb[0]=2*er[Vt(v+o,127)],y.Eb[1]=101581*ir[Vt(v+c,127)]>>16,8>y.Eb[1]&&(y.Eb[1]=8),y.Qc[0]=er[Vt(v+u,117)],y.Qc[1]=ir[Vt(v+l,127)],y.lc=v+l}if(!h.Rb)return Yt(t,4,"Not a key frame.");for(P(a),h=t.Pa,n=0;4>n;++n){for(s=0;8>s;++s)for(o=0;3>o;++o)for(c=0;11>c;++c)u=T(a,cr[n][s][o][c])?g(a,8):ar[n][s][o][c],h.Wc[n][s].Yb[o][c]=u;for(s=0;17>s;++s)h.Xc[n][s]=h.Wc[n][lr[s]]}return t.kc=P(a),t.kc&&(t.Bd=g(a,8)),t.cb=1}function Zt(t,e,i,n,r,o,s){var a=e[r].Yb[i];for(i=0;16>r;++r){if(!T(t,a[i+0]))return r;for(;!T(t,a[i+1]);)if(a=e[++r].Yb[0],i=0,16==r)return 16;var h=e[r+1].Yb;if(T(t,a[i+2])){var c=t,l=0;if(T(c,(f=a)[(u=i)+3]))if(T(c,f[u+6])){for(a=0,u=2*(l=T(c,f[u+8]))+(f=T(c,f[u+9+l])),l=0,f=rr[u];f[a];++a)l+=l+T(c,f[a]);l+=3+(8<<u)}else T(c,f[u+7])?(l=7+2*T(c,165),l+=T(c,145)):l=5+T(c,159);else l=T(c,f[u+4])?3+T(c,f[u+5]):2;a=h[2]}else l=1,a=h[1];h=s+or[r],0>(c=t).b&&L(c);var u,f=c.b,d=(u=c.Ca>>1)-(c.I>>f)>>31;--c.b,c.Ca+=d,c.Ca|=1,c.I-=(u+1&d)<<f,o[h]=((l^d)-d)*n[(0<r)+0]}return 16}function $t(t){var e=t.rb[t.sb-1];e.la=0,e.Na=0,r(t.zc,0,0,t.zc.length),t.ja=0}function Qt(t,i){if(null==t)return 0;if(null==i)return Yt(t,2,"NULL VP8Io parameter in VP8Decode().");if(!t.cb&&!Jt(t,i))return 0;if(e(t.cb),null==i.ac||i.ac(i)){i.ob&&(t.L=0);var a=Rr[t.L];if(2==t.L?(t.yb=0,t.zb=0):(t.yb=i.v-a>>4,t.zb=i.j-a>>4,0>t.yb&&(t.yb=0),0>t.zb&&(t.zb=0)),t.Va=i.o+15+a>>4,t.Hb=i.va+15+a>>4,t.Hb>t.za&&(t.Hb=t.za),t.Va>t.Ub&&(t.Va=t.Ub),0<t.L){var h=t.ed;for(a=0;4>a;++a){var c;if(t.Qa.Cb){var l=t.Qa.Lb[a];t.Qa.Fb||(l+=h.Tb)}else l=h.Tb;for(c=0;1>=c;++c){var u=t.gd[a][c],f=l;if(h.Pc&&(f+=h.vd[0],c&&(f+=h.od[0])),0<(f=0>f?0:63<f?63:f)){var d=f;0<h.wb&&(d=4<h.wb?d>>2:d>>1)>9-h.wb&&(d=9-h.wb),1>d&&(d=1),u.dd=d,u.tc=2*f+d,u.ld=40<=f?2:15<=f?1:0}else u.tc=0;u.La=c}}}a=0}else Yt(t,6,"Frame setup failed"),a=t.a;if(a=0==a){if(a){t.$c=0,0<t.Aa||(t.Ic=qr);t:{a=t.Ic,h=4*(d=t.za);var p=32*d,g=d+1,m=0<t.L?d*(0<t.Aa?2:1):0,v=(2==t.Aa?2:1)*d;if((u=h+832+(c=3*(16*a+Rr[t.L])/2*p)+(l=null!=t.Fa&&0<t.Fa.length?t.Kc.c*t.Kc.i:0))!=u)a=0;else{if(u>t.Vb){if(t.Vb=0,t.Ec=o(u),t.Fc=0,null==t.Ec){a=Yt(t,1,"no memory during frame initialization.");break t}t.Vb=u}u=t.Ec,f=t.Fc,t.Ac=u,t.Bc=f,f+=h,t.Gd=s(p,Wt),t.Hd=0,t.rb=s(g+1,Rt),t.sb=1,t.wa=m?s(m,Bt):null,t.Y=0,t.D.Nb=0,t.D.wa=t.wa,t.D.Y=t.Y,0<t.Aa&&(t.D.Y+=d),e(!0),t.oc=u,t.pc=f,f+=832,t.ya=s(v,qt),t.aa=0,t.D.ya=t.ya,t.D.aa=t.aa,2==t.Aa&&(t.D.aa+=d),t.R=16*d,t.B=8*d,d=(p=Rr[t.L])*t.R,p=p/2*t.B,t.sa=u,t.ta=f+d,t.qa=t.sa,t.ra=t.ta+16*a*t.R+p,t.Ha=t.qa,t.Ia=t.ra+8*a*t.B+p,t.$c=0,f+=c,t.mb=l?u:null,t.nb=l?f:null,e(f+l<=t.Fc+t.Vb),$t(t),r(t.Ac,t.Bc,0,h),a=1}}if(a){if(i.ka=0,i.y=t.sa,i.O=t.ta,i.f=t.qa,i.N=t.ra,i.ea=t.Ha,i.Vd=t.Ia,i.fa=t.R,i.Rc=t.B,i.F=null,i.J=0,!Nn){for(a=-255;255>=a;++a)Pn[255+a]=0>a?-a:a;for(a=-1020;1020>=a;++a)Tn[1020+a]=-128>a?-128:127<a?127:a;for(a=-112;112>=a;++a)On[112+a]=-16>a?-16:15<a?15:a;for(a=-255;510>=a;++a)kn[255+a]=0>a?0:255<a?255:a;Nn=1}on=ce,sn=oe,hn=se,cn=ae,ln=he,an=re,un=Ye,fn=Ke,dn=$e,pn=Qe,gn=Je,mn=Ze,vn=ti,yn=ei,bn=Ue,wn=We,xn=He,_n=Ve,fr[0]=Ce,fr[1]=ue,fr[2]=_e,fr[3]=Se,fr[4]=Ae,fr[5]=Pe,fr[6]=Le,fr[7]=Te,fr[8]=ke,fr[9]=Oe,ur[0]=ve,ur[1]=de,ur[2]=pe,ur[3]=ge,ur[4]=ye,ur[5]=be,ur[6]=we,dr[0]=Ee,dr[1]=fe,dr[2]=Ne,dr[3]=je,dr[4]=Me,dr[5]=Ie,dr[6]=De,a=1}else a=0}a&&(a=function(t,i){for(t.M=0;t.M<t.Va;++t.M){var s,a=t.Jc[t.M&t.Xb],h=t.m,c=t;for(s=0;s<c.za;++s){var l=h,u=c,f=u.Ac,d=u.Bc+4*s,p=u.zc,g=u.ya[u.aa+s];if(u.Qa.Bb?g.$b=T(l,u.Pa.jb[0])?2+T(l,u.Pa.jb[2]):T(l,u.Pa.jb[1]):g.$b=0,u.kc&&(g.Ad=T(l,u.Bd)),g.Za=!T(l,145)+0,g.Za){var m=g.Ob,v=0;for(u=0;4>u;++u){var y,b=p[0+u];for(y=0;4>y;++y){b=hr[f[d+y]][b];for(var w=sr[T(l,b[0])];0<w;)w=sr[2*w+T(l,b[w])];b=-w,f[d+y]=b}n(m,v,f,d,4),v+=4,p[0+u]=b}}else b=T(l,156)?T(l,128)?1:3:T(l,163)?2:0,g.Ob[0]=b,r(f,d,b,4),r(p,0,b,4);g.Dd=T(l,142)?T(l,114)?T(l,183)?1:3:2:0}if(c.m.Ka)return Yt(t,7,"Premature end-of-partition0 encountered.");for(;t.ja<t.za;++t.ja){if(c=a,l=(h=t).rb[h.sb-1],f=h.rb[h.sb+h.ja],s=h.ya[h.aa+h.ja],d=h.kc?s.Ad:0)l.la=f.la=0,s.Za||(l.Na=f.Na=0),s.Hc=0,s.Gc=0,s.ia=0;else{var x,_;if(l=f,f=c,d=h.Pa.Xc,p=h.ya[h.aa+h.ja],g=h.pb[p.$b],u=p.ad,m=0,v=h.rb[h.sb-1],b=y=0,r(u,m,0,384),p.Za)var S=0,C=d[3];else{w=o(16);var A=l.Na+v.Na;if(A=nr(f,d[1],A,g.Eb,0,w,0),l.Na=v.Na=(0<A)+0,1<A)on(w,0,u,m);else{var L=w[0]+3>>3;for(w=0;256>w;w+=16)u[m+w]=L}S=1,C=d[0]}var P=15&l.la,O=15&v.la;for(w=0;4>w;++w){var k=1&O;for(L=_=0;4>L;++L)P=P>>1|(k=(A=nr(f,C,A=k+(1&P),g.Sc,S,u,m))>S)<<7,_=_<<2|(3<A?3:1<A?2:0!=u[m+0]),m+=16;P>>=4,O=O>>1|k<<7,y=(y<<8|_)>>>0}for(C=P,S=O>>4,x=0;4>x;x+=2){for(_=0,P=l.la>>4+x,O=v.la>>4+x,w=0;2>w;++w){for(k=1&O,L=0;2>L;++L)A=k+(1&P),P=P>>1|(k=0<(A=nr(f,d[2],A,g.Qc,0,u,m)))<<3,_=_<<2|(3<A?3:1<A?2:0!=u[m+0]),m+=16;P>>=2,O=O>>1|k<<5}b|=_<<4*x,C|=P<<4<<x,S|=(240&O)<<x}l.la=C,v.la=S,p.Hc=y,p.Gc=b,p.ia=43690&b?0:g.ia,d=!(y|b)}if(0<h.L&&(h.wa[h.Y+h.ja]=h.gd[s.$b][s.Za],h.wa[h.Y+h.ja].La|=!d),c.Ka)return Yt(t,7,"Premature end-of-file encountered.")}if($t(t),h=i,c=1,s=(a=t).D,l=0<a.L&&a.M>=a.zb&&a.M<=a.Va,0==a.Aa)t:{if(s.M=a.M,s.uc=l,Fi(a,s),c=1,s=(_=a.D).Nb,l=(b=Rr[a.L])*a.R,f=b/2*a.B,w=16*s*a.R,L=8*s*a.B,d=a.sa,p=a.ta-l+w,g=a.qa,u=a.ra-f+L,m=a.Ha,v=a.Ia-f+L,O=0==(P=_.M),y=P>=a.Va-1,2==a.Aa&&Fi(a,_),_.uc)for(k=(A=a).D.M,e(A.D.uc),_=A.yb;_<A.Hb;++_){S=_,C=k;var N=(j=(q=A).D).Nb;x=q.R;var j=j.wa[j.Y+S],F=q.sa,E=q.ta+16*N*x+16*S,I=j.dd,M=j.tc;if(0!=M)if(e(3<=M),1==q.L)0<S&&wn(F,E,x,M+4),j.La&&_n(F,E,x,M),0<C&&bn(F,E,x,M+4),j.La&&xn(F,E,x,M);else{var D=q.B,B=q.qa,R=q.ra+8*N*D+8*S,z=q.Ha,q=q.Ia+8*N*D+8*S;N=j.ld,0<S&&(fn(F,E,x,M+4,I,N),pn(B,R,z,q,D,M+4,I,N)),j.La&&(mn(F,E,x,M,I,N),yn(B,R,z,q,D,M,I,N)),0<C&&(un(F,E,x,M+4,I,N),dn(B,R,z,q,D,M+4,I,N)),j.La&&(gn(F,E,x,M,I,N),vn(B,R,z,q,D,M,I,N))}}if(a.ia&&alert("todo:DitherRow"),null!=h.put){if(_=16*P,P=16*(P+1),O?(h.y=a.sa,h.O=a.ta+w,h.f=a.qa,h.N=a.ra+L,h.ea=a.Ha,h.W=a.Ia+L):(_-=b,h.y=d,h.O=p,h.f=g,h.N=u,h.ea=m,h.W=v),y||(P-=b),P>h.o&&(P=h.o),h.F=null,h.J=null,null!=a.Fa&&0<a.Fa.length&&_<P&&(h.J=ui(a,h,_,P-_),h.F=a.mb,null==h.F&&0==h.F.length)){c=Yt(a,3,"Could not decode alpha data.");break t}_<h.j&&(b=h.j-_,_=h.j,e(!(1&b)),h.O+=a.R*b,h.N+=a.B*(b>>1),h.W+=a.B*(b>>1),null!=h.F&&(h.J+=h.width*b)),_<P&&(h.O+=h.v,h.N+=h.v>>1,h.W+=h.v>>1,null!=h.F&&(h.J+=h.v),h.ka=_-h.j,h.U=h.va-h.v,h.T=P-_,c=h.put(h))}s+1!=a.Ic||y||(n(a.sa,a.ta-l,d,p+16*a.R,l),n(a.qa,a.ra-f,g,u+8*a.B,f),n(a.Ha,a.Ia-f,m,v+8*a.B,f))}if(!c)return Yt(t,6,"Output aborted.")}return 1}(t,i)),null!=i.bc&&i.bc(i),a&=1}return a?(t.cb=0,a):0}function te(t,e,i,n,r){r=t[e+i+32*n]+(r>>3),t[e+i+32*n]=-256&r?0>r?0:255:r}function ee(t,e,i,n,r,o){te(t,e,0,i,n+r),te(t,e,1,i,n+o),te(t,e,2,i,n-o),te(t,e,3,i,n-r)}function ie(t){return(20091*t>>16)+t}function ne(t,e,i,n){var r,s=0,a=o(16);for(r=0;4>r;++r){var h=t[e+0]+t[e+8],c=t[e+0]-t[e+8],l=(35468*t[e+4]>>16)-ie(t[e+12]),u=ie(t[e+4])+(35468*t[e+12]>>16);a[s+0]=h+u,a[s+1]=c+l,a[s+2]=c-l,a[s+3]=h-u,s+=4,e++}for(r=s=0;4>r;++r)h=(t=a[s+0]+4)+a[s+8],c=t-a[s+8],l=(35468*a[s+4]>>16)-ie(a[s+12]),te(i,n,0,0,h+(u=ie(a[s+4])+(35468*a[s+12]>>16))),te(i,n,1,0,c+l),te(i,n,2,0,c-l),te(i,n,3,0,h-u),s++,n+=32}function re(t,e,i,n){var r=t[e+0]+4,o=35468*t[e+4]>>16,s=ie(t[e+4]),a=35468*t[e+1]>>16;ee(i,n,0,r+s,t=ie(t[e+1]),a),ee(i,n,1,r+o,t,a),ee(i,n,2,r-o,t,a),ee(i,n,3,r-s,t,a)}function oe(t,e,i,n,r){ne(t,e,i,n),r&&ne(t,e+16,i,n+4)}function se(t,e,i,n){sn(t,e+0,i,n,1),sn(t,e+32,i,n+128,1)}function ae(t,e,i,n){var r;for(t=t[e+0]+4,r=0;4>r;++r)for(e=0;4>e;++e)te(i,n,e,r,t)}function he(t,e,i,n){t[e+0]&&cn(t,e+0,i,n),t[e+16]&&cn(t,e+16,i,n+4),t[e+32]&&cn(t,e+32,i,n+128),t[e+48]&&cn(t,e+48,i,n+128+4)}function ce(t,e,i,n){var r,s=o(16);for(r=0;4>r;++r){var a=t[e+0+r]+t[e+12+r],h=t[e+4+r]+t[e+8+r],c=t[e+4+r]-t[e+8+r],l=t[e+0+r]-t[e+12+r];s[0+r]=a+h,s[8+r]=a-h,s[4+r]=l+c,s[12+r]=l-c}for(r=0;4>r;++r)a=(t=s[0+4*r]+3)+s[3+4*r],h=s[1+4*r]+s[2+4*r],c=s[1+4*r]-s[2+4*r],l=t-s[3+4*r],i[n+0]=a+h>>3,i[n+16]=l+c>>3,i[n+32]=a-h>>3,i[n+48]=l-c>>3,n+=64}function le(t,e,i){var n,r=e-32,o=En,s=255-t[r-1];for(n=0;n<i;++n){var a,h=o,c=s+t[e-1];for(a=0;a<i;++a)t[e+a]=h[c+t[r+a]];e+=32}}function ue(t,e){le(t,e,4)}function fe(t,e){le(t,e,8)}function de(t,e){le(t,e,16)}function pe(t,e){var i;for(i=0;16>i;++i)n(t,e+32*i,t,e-32,16)}function ge(t,e){var i;for(i=16;0<i;--i)r(t,e,t[e-1],16),e+=32}function me(t,e,i){var n;for(n=0;16>n;++n)r(e,i+32*n,t,16)}function ve(t,e){var i,n=16;for(i=0;16>i;++i)n+=t[e-1+32*i]+t[e+i-32];me(n>>5,t,e)}function ye(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e-1+32*i];me(n>>4,t,e)}function be(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e+i-32];me(n>>4,t,e)}function we(t,e){me(128,t,e)}function xe(t,e,i){return t+2*e+i+2>>2}function _e(t,e){var i,r=e-32;for(r=new Uint8Array([xe(t[r-1],t[r+0],t[r+1]),xe(t[r+0],t[r+1],t[r+2]),xe(t[r+1],t[r+2],t[r+3]),xe(t[r+2],t[r+3],t[r+4])]),i=0;4>i;++i)n(t,e+32*i,r,0,r.length)}function Se(t,e){var i=t[e-1],n=t[e-1+32],r=t[e-1+64],o=t[e-1+96];O(t,e+0,16843009*xe(t[e-1-32],i,n)),O(t,e+32,16843009*xe(i,n,r)),O(t,e+64,16843009*xe(n,r,o)),O(t,e+96,16843009*xe(r,o,o))}function Ce(t,e){var i,n=4;for(i=0;4>i;++i)n+=t[e+i-32]+t[e-1+32*i];for(n>>=3,i=0;4>i;++i)r(t,e+32*i,n,4)}function Ae(t,e){var i=t[e-1+0],n=t[e-1+32],r=t[e-1+64],o=t[e-1-32],s=t[e+0-32],a=t[e+1-32],h=t[e+2-32],c=t[e+3-32];t[e+0+96]=xe(n,r,t[e-1+96]),t[e+1+96]=t[e+0+64]=xe(i,n,r),t[e+2+96]=t[e+1+64]=t[e+0+32]=xe(o,i,n),t[e+3+96]=t[e+2+64]=t[e+1+32]=t[e+0+0]=xe(s,o,i),t[e+3+64]=t[e+2+32]=t[e+1+0]=xe(a,s,o),t[e+3+32]=t[e+2+0]=xe(h,a,s),t[e+3+0]=xe(c,h,a)}function Le(t,e){var i=t[e+1-32],n=t[e+2-32],r=t[e+3-32],o=t[e+4-32],s=t[e+5-32],a=t[e+6-32],h=t[e+7-32];t[e+0+0]=xe(t[e+0-32],i,n),t[e+1+0]=t[e+0+32]=xe(i,n,r),t[e+2+0]=t[e+1+32]=t[e+0+64]=xe(n,r,o),t[e+3+0]=t[e+2+32]=t[e+1+64]=t[e+0+96]=xe(r,o,s),t[e+3+32]=t[e+2+64]=t[e+1+96]=xe(o,s,a),t[e+3+64]=t[e+2+96]=xe(s,a,h),t[e+3+96]=xe(a,h,h)}function Pe(t,e){var i=t[e-1+0],n=t[e-1+32],r=t[e-1+64],o=t[e-1-32],s=t[e+0-32],a=t[e+1-32],h=t[e+2-32],c=t[e+3-32];t[e+0+0]=t[e+1+64]=o+s+1>>1,t[e+1+0]=t[e+2+64]=s+a+1>>1,t[e+2+0]=t[e+3+64]=a+h+1>>1,t[e+3+0]=h+c+1>>1,t[e+0+96]=xe(r,n,i),t[e+0+64]=xe(n,i,o),t[e+0+32]=t[e+1+96]=xe(i,o,s),t[e+1+32]=t[e+2+96]=xe(o,s,a),t[e+2+32]=t[e+3+96]=xe(s,a,h),t[e+3+32]=xe(a,h,c)}function Te(t,e){var i=t[e+0-32],n=t[e+1-32],r=t[e+2-32],o=t[e+3-32],s=t[e+4-32],a=t[e+5-32],h=t[e+6-32],c=t[e+7-32];t[e+0+0]=i+n+1>>1,t[e+1+0]=t[e+0+64]=n+r+1>>1,t[e+2+0]=t[e+1+64]=r+o+1>>1,t[e+3+0]=t[e+2+64]=o+s+1>>1,t[e+0+32]=xe(i,n,r),t[e+1+32]=t[e+0+96]=xe(n,r,o),t[e+2+32]=t[e+1+96]=xe(r,o,s),t[e+3+32]=t[e+2+96]=xe(o,s,a),t[e+3+64]=xe(s,a,h),t[e+3+96]=xe(a,h,c)}function Oe(t,e){var i=t[e-1+0],n=t[e-1+32],r=t[e-1+64],o=t[e-1+96];t[e+0+0]=i+n+1>>1,t[e+2+0]=t[e+0+32]=n+r+1>>1,t[e+2+32]=t[e+0+64]=r+o+1>>1,t[e+1+0]=xe(i,n,r),t[e+3+0]=t[e+1+32]=xe(n,r,o),t[e+3+32]=t[e+1+64]=xe(r,o,o),t[e+3+64]=t[e+2+64]=t[e+0+96]=t[e+1+96]=t[e+2+96]=t[e+3+96]=o}function ke(t,e){var i=t[e-1+0],n=t[e-1+32],r=t[e-1+64],o=t[e-1+96],s=t[e-1-32],a=t[e+0-32],h=t[e+1-32],c=t[e+2-32];t[e+0+0]=t[e+2+32]=i+s+1>>1,t[e+0+32]=t[e+2+64]=n+i+1>>1,t[e+0+64]=t[e+2+96]=r+n+1>>1,t[e+0+96]=o+r+1>>1,t[e+3+0]=xe(a,h,c),t[e+2+0]=xe(s,a,h),t[e+1+0]=t[e+3+32]=xe(i,s,a),t[e+1+32]=t[e+3+64]=xe(n,i,s),t[e+1+64]=t[e+3+96]=xe(r,n,i),t[e+1+96]=xe(o,r,n)}function Ne(t,e){var i;for(i=0;8>i;++i)n(t,e+32*i,t,e-32,8)}function je(t,e){var i;for(i=0;8>i;++i)r(t,e,t[e-1],8),e+=32}function Fe(t,e,i){var n;for(n=0;8>n;++n)r(e,i+32*n,t,8)}function Ee(t,e){var i,n=8;for(i=0;8>i;++i)n+=t[e+i-32]+t[e-1+32*i];Fe(n>>4,t,e)}function Ie(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e+i-32];Fe(n>>3,t,e)}function Me(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e-1+32*i];Fe(n>>3,t,e)}function De(t,e){Fe(128,t,e)}function Be(t,e,i){var n=t[e-i],r=t[e+0],o=3*(r-n)+jn[1020+t[e-2*i]-t[e+i]],s=Fn[112+(o+4>>3)];t[e-i]=En[255+n+Fn[112+(o+3>>3)]],t[e+0]=En[255+r-s]}function Re(t,e,i,n){var r=t[e+0],o=t[e+i];return In[255+t[e-2*i]-t[e-i]]>n||In[255+o-r]>n}function ze(t,e,i,n){return 4*In[255+t[e-i]-t[e+0]]+In[255+t[e-2*i]-t[e+i]]<=n}function qe(t,e,i,n,r){var o=t[e-3*i],s=t[e-2*i],a=t[e-i],h=t[e+0],c=t[e+i],l=t[e+2*i],u=t[e+3*i];return 4*In[255+a-h]+In[255+s-c]>n?0:In[255+t[e-4*i]-o]<=r&&In[255+o-s]<=r&&In[255+s-a]<=r&&In[255+u-l]<=r&&In[255+l-c]<=r&&In[255+c-h]<=r}function Ue(t,e,i,n){var r=2*n+1;for(n=0;16>n;++n)ze(t,e+n,i,r)&&Be(t,e+n,i)}function We(t,e,i,n){var r=2*n+1;for(n=0;16>n;++n)ze(t,e+n*i,1,r)&&Be(t,e+n*i,1)}function He(t,e,i,n){var r;for(r=3;0<r;--r)Ue(t,e+=4*i,i,n)}function Ve(t,e,i,n){var r;for(r=3;0<r;--r)We(t,e+=4,i,n)}function Ge(t,e,i,n,r,o,s,a){for(o=2*o+1;0<r--;){if(qe(t,e,i,o,s))if(Re(t,e,i,a))Be(t,e,i);else{var h=t,c=e,l=i,u=h[c-2*l],f=h[c-l],d=h[c+0],p=h[c+l],g=h[c+2*l],m=27*(y=jn[1020+3*(d-f)+jn[1020+u-p]])+63>>7,v=18*y+63>>7,y=9*y+63>>7;h[c-3*l]=En[255+h[c-3*l]+y],h[c-2*l]=En[255+u+v],h[c-l]=En[255+f+m],h[c+0]=En[255+d-m],h[c+l]=En[255+p-v],h[c+2*l]=En[255+g-y]}e+=n}}function Xe(t,e,i,n,r,o,s,a){for(o=2*o+1;0<r--;){if(qe(t,e,i,o,s))if(Re(t,e,i,a))Be(t,e,i);else{var h=t,c=e,l=i,u=h[c-l],f=h[c+0],d=h[c+l],p=Fn[112+(4+(g=3*(f-u))>>3)],g=Fn[112+(g+3>>3)],m=p+1>>1;h[c-2*l]=En[255+h[c-2*l]+m],h[c-l]=En[255+u+g],h[c+0]=En[255+f-p],h[c+l]=En[255+d-m]}e+=n}}function Ye(t,e,i,n,r,o){Ge(t,e,i,1,16,n,r,o)}function Ke(t,e,i,n,r,o){Ge(t,e,1,i,16,n,r,o)}function Je(t,e,i,n,r,o){var s;for(s=3;0<s;--s)Xe(t,e+=4*i,i,1,16,n,r,o)}function Ze(t,e,i,n,r,o){var s;for(s=3;0<s;--s)Xe(t,e+=4,1,i,16,n,r,o)}function $e(t,e,i,n,r,o,s,a){Ge(t,e,r,1,8,o,s,a),Ge(i,n,r,1,8,o,s,a)}function Qe(t,e,i,n,r,o,s,a){Ge(t,e,1,r,8,o,s,a),Ge(i,n,1,r,8,o,s,a)}function ti(t,e,i,n,r,o,s,a){Xe(t,e+4*r,r,1,8,o,s,a),Xe(i,n+4*r,r,1,8,o,s,a)}function ei(t,e,i,n,r,o,s,a){Xe(t,e+4,1,r,8,o,s,a),Xe(i,n+4,1,r,8,o,s,a)}function ii(){this.ba=new st,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ht,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function ni(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function ri(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function oi(){this.ua=0,this.Wa=new I,this.vb=new I,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new d,this.yc=new u}function si(){this.xb=this.a=0,this.l=new Gt,this.ca=new st,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new x,this.Pb=0,this.wd=new x,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new oi,this.ab=0,this.gc=s(4,ri),this.Oc=0}function ai(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Gt,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function hi(t,e,i,n,r,o,s){for(t=null==t?0:t[e+0],e=0;e<s;++e)r[o+e]=t+i[n+e]&255,t=r[o+e]}function ci(t,e,i,n,r,o,s){var a;if(null==t)hi(null,null,i,n,r,o,s);else for(a=0;a<s;++a)r[o+a]=t[e+a]+i[n+a]&255}function li(t,e,i,n,r,o,s){if(null==t)hi(null,null,i,n,r,o,s);else{var a,h=t[e+0],c=h,l=h;for(a=0;a<s;++a)c=l+(h=t[e+a])-c,l=i[n+a]+(-256&c?0>c?0:255:c)&255,c=h,r[o+a]=l}}function ui(t,i,r,s){var a=i.width,h=i.o;if(e(null!=t&&null!=i),0>r||0>=s||r+s>h)return null;if(!t.Cc){if(null==t.ga){var c;if(t.ga=new ai,(c=null==t.ga)||(c=i.width*i.o,e(0==t.Gb.length),t.Gb=o(c),t.Uc=0,null==t.Gb?c=0:(t.mb=t.Gb,t.nb=t.Uc,t.rc=null,c=1),c=!c),!c){c=t.ga;var l=t.Fa,u=t.P,f=t.qc,d=t.mb,p=t.nb,g=u+1,m=f-1,y=c.l;if(e(null!=l&&null!=d&&null!=i),mr[0]=null,mr[1]=hi,mr[2]=ci,mr[3]=li,c.ca=d,c.tb=p,c.c=i.width,c.i=i.height,e(0<c.c&&0<c.i),1>=f)i=0;else if(c.$a=l[u+0]>>0&3,c.Z=l[u+0]>>2&3,c.Lc=l[u+0]>>4&3,u=l[u+0]>>6&3,0>c.$a||1<c.$a||4<=c.Z||1<c.Lc||u)i=0;else if(y.put=dt,y.ac=ft,y.bc=pt,y.ma=c,y.width=i.width,y.height=i.height,y.Da=i.Da,y.v=i.v,y.va=i.va,y.j=i.j,y.o=i.o,c.$a)t:{e(1==c.$a),i=Tt();e:for(;;){if(null==i){i=0;break t}if(e(null!=c),c.mc=i,i.c=c.c,i.i=c.i,i.l=c.l,i.l.ma=c,i.l.width=c.c,i.l.height=c.i,i.a=0,v(i.m,l,g,m),!Ot(c.c,c.i,1,i,null))break e;if(1==i.ab&&3==i.gc[0].hc&&St(i.s)?(c.ic=1,l=i.c*i.i,i.Ta=null,i.Ua=0,i.V=o(l),i.Ba=0,null==i.V?(i.a=1,i=0):i=1):(c.ic=0,i=kt(i,c.c)),!i)break e;i=1;break t}c.mc=null,i=0}else i=m>=c.c*c.i;c=!i}if(c)return null;1!=t.ga.Lc?t.Ga=0:s=h-r}e(null!=t.ga),e(r+s<=h);t:{if(i=(l=t.ga).c,h=l.l.o,0==l.$a){if(g=t.rc,m=t.Vc,y=t.Fa,u=t.P+1+r*i,f=t.mb,d=t.nb+r*i,e(u<=t.P+t.qc),0!=l.Z)for(e(null!=mr[l.Z]),c=0;c<s;++c)mr[l.Z](g,m,y,u,f,d,i),g=f,m=d,d+=i,u+=i;else for(c=0;c<s;++c)n(f,d,y,u,i),g=f,m=d,d+=i,u+=i;t.rc=g,t.Vc=m}else{if(e(null!=l.mc),i=r+s,e(null!=(c=l.mc)),e(i<=c.i),c.C>=i)i=1;else if(l.ic||mi(),l.ic){l=c.V,g=c.Ba,m=c.c;var b=c.i,w=(y=1,u=c.$/m,f=c.$%m,d=c.m,p=c.s,c.$),x=m*b,_=m*i,C=p.wc,L=w<_?wt(p,f,u):null;e(w<=x),e(i<=b),e(St(p));e:for(;;){for(;!d.h&&w<_;){if(f&C||(L=wt(p,f,u)),e(null!=L),A(d),256>(b=yt(L.G[0],L.H[0],d)))l[g+w]=b,++w,++f>=m&&(f=0,++u<=i&&!(u%16)&&At(c,u));else{if(!(280>b)){y=0;break e}b=mt(b-256,d);var P,T=yt(L.G[4],L.H[4],d);if(A(d),!(w>=(T=vt(m,T=mt(T,d)))&&x-w>=b)){y=0;break e}for(P=0;P<b;++P)l[g+w+P]=l[g+w+P-T];for(w+=b,f+=b;f>=m;)f-=m,++u<=i&&!(u%16)&&At(c,u);w<_&&f&C&&(L=wt(p,f,u))}e(d.h==S(d))}At(c,u>i?i:u);break e}!y||d.h&&w<x?(y=0,c.a=d.h?5:3):c.$=w,i=y}else i=Lt(c,c.V,c.Ba,c.c,c.i,i,Nt);if(!i){s=0;break t}}r+s>=h&&(t.Cc=1),s=1}if(!s)return null;if(t.Cc&&(null!=(s=t.ga)&&(s.mc=null),t.ga=null,0<t.Ga))return alert("todo:WebPDequantizeLevels"),null}return t.nb+r*a}function fi(t,e,i,n,r,o){for(;0<r--;){var s,a=t,h=e+(i?1:0),c=t,l=e+(i?0:3);for(s=0;s<n;++s){var u=c[l+4*s];255!=u&&(u*=32897,a[h+4*s+0]=a[h+4*s+0]*u>>23,a[h+4*s+1]=a[h+4*s+1]*u>>23,a[h+4*s+2]=a[h+4*s+2]*u>>23)}e+=o}}function di(t,e,i,n,r){for(;0<n--;){var o;for(o=0;o<i;++o){var s=t[e+2*o+0],a=15&(c=t[e+2*o+1]),h=4369*a,c=(240&c|c>>4)*h>>16;t[e+2*o+0]=(240&s|s>>4)*h>>16&240|(15&s|s<<4)*h>>16>>4&15,t[e+2*o+1]=240&c|a}e+=r}}function pi(t,e,i,n,r,o,s,a){var h,c,l=255;for(c=0;c<r;++c){for(h=0;h<n;++h){var u=t[e+h];o[s+4*h]=u,l&=u}e+=i,s+=a}return 255!=l}function gi(t,e,i,n,r){var o;for(o=0;o<r;++o)i[n+o]=t[e+o]>>8}function mi(){Sn=fi,Cn=di,An=pi,Ln=gi}function vi(i,n,r){t[i]=function(t,i,o,s,a,h,c,l,u,f,d,p,g,m,v,y,b){var w,x=b-1>>1,_=a[h+0]|c[l+0]<<16,S=u[f+0]|d[p+0]<<16;e(null!=t);var C=3*_+S+131074>>2;for(n(t[i+0],255&C,C>>16,g,m),null!=o&&(C=3*S+_+131074>>2,n(o[s+0],255&C,C>>16,v,y)),w=1;w<=x;++w){var A=a[h+w]|c[l+w]<<16,L=u[f+w]|d[p+w]<<16,P=_+A+S+L+524296,T=P+2*(A+S)>>3;C=T+_>>1,_=(P=P+2*(_+L)>>3)+A>>1,n(t[i+2*w-1],255&C,C>>16,g,m+(2*w-1)*r),n(t[i+2*w-0],255&_,_>>16,g,m+(2*w-0)*r),null!=o&&(C=P+S>>1,_=T+L>>1,n(o[s+2*w-1],255&C,C>>16,v,y+(2*w-1)*r),n(o[s+2*w+0],255&_,_>>16,v,y+(2*w+0)*r)),_=A,S=L}1&b||(C=3*_+S+131074>>2,n(t[i+b-1],255&C,C>>16,g,m+(b-1)*r),null!=o&&(C=3*S+_+131074>>2,n(o[s+b-1],255&C,C>>16,v,y+(b-1)*r)))}}function yi(){vr[Mn]=yr,vr[Dn]=wr,vr[Bn]=br,vr[Rn]=xr,vr[zn]=_r,vr[qn]=Sr,vr[Un]=Cr,vr[Wn]=wr,vr[Hn]=xr,vr[Vn]=_r,vr[Gn]=Sr}function bi(t){return t&~kr?0>t?0:255:t>>Or}function wi(t,e){return bi((19077*t>>8)+(26149*e>>8)-14234)}function xi(t,e,i){return bi((19077*t>>8)-(6419*e>>8)-(13320*i>>8)+8708)}function _i(t,e){return bi((19077*t>>8)+(33050*e>>8)-17685)}function Si(t,e,i,n,r){n[r+0]=wi(t,i),n[r+1]=xi(t,e,i),n[r+2]=_i(t,e)}function Ci(t,e,i,n,r){n[r+0]=_i(t,e),n[r+1]=xi(t,e,i),n[r+2]=wi(t,i)}function Ai(t,e,i,n,r){var o=xi(t,e,i);e=o<<3&224|_i(t,e)>>3,n[r+0]=248&wi(t,i)|o>>5,n[r+1]=e}function Li(t,e,i,n,r){var o=240&_i(t,e)|15;n[r+0]=240&wi(t,i)|xi(t,e,i)>>4,n[r+1]=o}function Pi(t,e,i,n,r){n[r+0]=255,Si(t,e,i,n,r+1)}function Ti(t,e,i,n,r){Ci(t,e,i,n,r),n[r+3]=255}function Oi(t,e,i,n,r){Si(t,e,i,n,r),n[r+3]=255}function Vt(t,e){return 0>t?0:t>e?e:t}function ki(e,i,n){t[e]=function(t,e,r,o,s,a,h,c,l){for(var u=c+(-2&l)*n;c!=u;)i(t[e+0],r[o+0],s[a+0],h,c),i(t[e+1],r[o+0],s[a+0],h,c+n),e+=2,++o,++a,c+=2*n;1&l&&i(t[e+0],r[o+0],s[a+0],h,c)}}function Ni(t,e,i){return 0==i?0==t?0==e?6:5:0==e?4:0:i}function ji(t,e,i,n,r){switch(t>>>30){case 3:sn(e,i,n,r,0);break;case 2:an(e,i,n,r);break;case 1:cn(e,i,n,r)}}function Fi(t,e){var i,o,s=e.M,a=e.Nb,h=t.oc,c=t.pc+40,l=t.oc,u=t.pc+584,f=t.oc,d=t.pc+600;for(i=0;16>i;++i)h[c+32*i-1]=129;for(i=0;8>i;++i)l[u+32*i-1]=129,f[d+32*i-1]=129;for(0<s?h[c-1-32]=l[u-1-32]=f[d-1-32]=129:(r(h,c-32-1,127,21),r(l,u-32-1,127,9),r(f,d-32-1,127,9)),o=0;o<t.za;++o){var p=e.ya[e.aa+o];if(0<o){for(i=-1;16>i;++i)n(h,c+32*i-4,h,c+32*i+12,4);for(i=-1;8>i;++i)n(l,u+32*i-4,l,u+32*i+4,4),n(f,d+32*i-4,f,d+32*i+4,4)}var g=t.Gd,m=t.Hd+o,v=p.ad,y=p.Hc;if(0<s&&(n(h,c-32,g[m].y,0,16),n(l,u-32,g[m].f,0,8),n(f,d-32,g[m].ea,0,8)),p.Za){var b=h,w=c-32+16;for(0<s&&(o>=t.za-1?r(b,w,g[m].y[15],4):n(b,w,g[m+1].y,0,4)),i=0;4>i;i++)b[w+128+i]=b[w+256+i]=b[w+384+i]=b[w+0+i];for(i=0;16>i;++i,y<<=2)b=h,w=c+Br[i],fr[p.Ob[i]](b,w),ji(y,v,16*+i,b,w)}else if(b=Ni(o,s,p.Ob[0]),ur[b](h,c),0!=y)for(i=0;16>i;++i,y<<=2)ji(y,v,16*+i,h,c+Br[i]);for(i=p.Gc,b=Ni(o,s,p.Dd),dr[b](l,u),dr[b](f,d),y=v,b=l,w=u,255&(p=i>>0)&&(170&p?hn(y,256,b,w):ln(y,256,b,w)),p=f,y=d,255&(i>>=8)&&(170&i?hn(v,320,p,y):ln(v,320,p,y)),s<t.Ub-1&&(n(g[m].y,0,h,c+480,16),n(g[m].f,0,l,u+224,8),n(g[m].ea,0,f,d+224,8)),i=8*a*t.B,g=t.sa,m=t.ta+16*o+16*a*t.R,v=t.qa,p=t.ra+8*o+i,y=t.Ha,b=t.Ia+8*o+i,i=0;16>i;++i)n(g,m+i*t.R,h,c+32*i,16);for(i=0;8>i;++i)n(v,p+i*t.B,l,u+32*i,8),n(y,b+i*t.B,f,d+32*i,8)}}function Ei(t,n,r,o,s,a,h,c,l){var u=[0],f=[0],d=0,p=null!=l?l.kd:0,g=null!=l?l:new ni;if(null==t||12>r)return 7;g.data=t,g.w=n,g.ha=r,n=[n],r=[r],g.gb=[g.gb];t:{var m=n,y=r,b=g.gb;if(e(null!=t),e(null!=y),e(null!=b),b[0]=0,12<=y[0]&&!i(t,m[0],"RIFF")){if(i(t,m[0]+8,"WEBP")){b=3;break t}var w=j(t,m[0]+4);if(12>w||4294967286<w){b=3;break t}if(p&&w>y[0]-8){b=7;break t}b[0]=w,m[0]+=12,y[0]-=12}b=0}if(0!=b)return b;for(w=0<g.gb[0],r=r[0];;){t:{var _=t;y=n,b=r;var S=u,C=f,A=m=[0];if((T=d=[d])[0]=0,8>b[0])b=7;else{if(!i(_,y[0],"VP8X")){if(10!=j(_,y[0]+4)){b=3;break t}if(18>b[0]){b=7;break t}var L=j(_,y[0]+8),P=1+N(_,y[0]+12);if(2147483648<=P*(_=1+N(_,y[0]+15))){b=3;break t}null!=A&&(A[0]=L),null!=S&&(S[0]=P),null!=C&&(C[0]=_),y[0]+=18,b[0]-=18,T[0]=1}b=0}}if(d=d[0],m=m[0],0!=b)return b;if(y=!!(2&m),!w&&d)return 3;if(null!=a&&(a[0]=!!(16&m)),null!=h&&(h[0]=y),null!=c&&(c[0]=0),h=u[0],m=f[0],d&&y&&null==l){b=0;break}if(4>r){b=7;break}if(w&&d||!w&&!d&&!i(t,n[0],"ALPH")){r=[r],g.na=[g.na],g.P=[g.P],g.Sa=[g.Sa];t:{L=t,b=n,w=r;var T=g.gb;S=g.na,C=g.P,A=g.Sa,P=22,e(null!=L),e(null!=w),_=b[0];var O=w[0];for(e(null!=S),e(null!=A),S[0]=null,C[0]=null,A[0]=0;;){if(b[0]=_,w[0]=O,8>O){b=7;break t}var k=j(L,_+4);if(4294967286<k){b=3;break t}var F=8+k+1&-2;if(P+=F,0<T&&P>T){b=3;break t}if(!i(L,_,"VP8 ")||!i(L,_,"VP8L")){b=0;break t}if(O[0]<F){b=7;break t}i(L,_,"ALPH")||(S[0]=L,C[0]=_+8,A[0]=k),_+=F,O-=F}}if(r=r[0],g.na=g.na[0],g.P=g.P[0],g.Sa=g.Sa[0],0!=b)break}r=[r],g.Ja=[g.Ja],g.xa=[g.xa];t:if(T=t,b=n,w=r,S=g.gb[0],C=g.Ja,A=g.xa,L=b[0],_=!i(T,L,"VP8 "),P=!i(T,L,"VP8L"),e(null!=T),e(null!=w),e(null!=C),e(null!=A),8>w[0])b=7;else{if(_||P){if(T=j(T,L+4),12<=S&&T>S-12){b=3;break t}if(p&&T>w[0]-8){b=7;break t}C[0]=T,b[0]+=8,w[0]-=8,A[0]=P}else A[0]=5<=w[0]&&47==T[L+0]&&!(T[L+4]>>5),C[0]=w[0];b=0}if(r=r[0],g.Ja=g.Ja[0],g.xa=g.xa[0],n=n[0],0!=b)break;if(4294967286<g.Ja)return 3;if(null==c||y||(c[0]=g.xa?2:1),h=[h],m=[m],g.xa){if(5>r){b=7;break}c=h,p=m,y=a,null==t||5>r?t=0:5<=r&&47==t[n+0]&&!(t[n+4]>>5)?(w=[0],T=[0],S=[0],v(C=new x,t,n,r),gt(C,w,T,S)?(null!=c&&(c[0]=w[0]),null!=p&&(p[0]=T[0]),null!=y&&(y[0]=S[0]),t=1):t=0):t=0}else{if(10>r){b=7;break}c=m,null==t||10>r||!Kt(t,n+3,r-3)?t=0:(p=t[n+0]|t[n+1]<<8|t[n+2]<<16,y=16383&(t[n+7]<<8|t[n+6]),t=16383&(t[n+9]<<8|t[n+8]),1&p||3<(p>>1&7)||!(p>>4&1)||p>>5>=g.Ja||!y||!t?t=0:(h&&(h[0]=y),c&&(c[0]=t),t=1))}if(!t)return 3;if(h=h[0],m=m[0],d&&(u[0]!=h||f[0]!=m))return 3;null!=l&&(l[0]=g,l.offset=n-l.w,e(4294967286>n-l.w),e(l.offset==l.ha-r));break}return 0==b||7==b&&d&&null==l?(null!=a&&(a[0]|=null!=g.na&&0<g.na.length),null!=o&&(o[0]=h),null!=s&&(s[0]=m),0):b}function Ii(t,e,i){var n=e.width,r=e.height,o=0,s=0,a=n,h=r;if(e.Da=null!=t&&0<t.Da,e.Da&&(a=t.cd,h=t.bd,o=t.v,s=t.j,11>i||(o&=-2,s&=-2),0>o||0>s||0>=a||0>=h||o+a>n||s+h>r))return 0;if(e.v=o,e.j=s,e.va=o+a,e.o=s+h,e.U=a,e.T=h,e.da=null!=t&&0<t.da,e.da){if(!M(a,h,i=[t.ib],o=[t.hb]))return 0;e.ib=i[0],e.hb=o[0]}return e.ob=null!=t&&t.ob,e.Kb=null==t||!t.Sd,e.da&&(e.ob=e.ib<3*n/4&&e.hb<3*r/4,e.Kb=0),1}function Mi(t){if(null==t)return 2;if(11>t.S){var e=t.f.RGBA;e.fb+=(t.height-1)*e.A,e.A=-e.A}else e=t.f.kb,t=t.height,e.O+=(t-1)*e.fa,e.fa=-e.fa,e.N+=(t-1>>1)*e.Ab,e.Ab=-e.Ab,e.W+=(t-1>>1)*e.Db,e.Db=-e.Db,null!=e.F&&(e.J+=(t-1)*e.lb,e.lb=-e.lb);return 0}function Di(t,e,i,n){if(null==n||0>=t||0>=e)return 2;if(null!=i){if(i.Da){var r=i.cd,s=i.bd,a=-2&i.v,h=-2&i.j;if(0>a||0>h||0>=r||0>=s||a+r>t||h+s>e)return 2;t=r,e=s}if(i.da){if(!M(t,e,r=[i.ib],s=[i.hb]))return 2;t=r[0],e=s[0]}}n.width=t,n.height=e;t:{var c=n.width,l=n.height;if(t=n.S,0>=c||0>=l||!(t>=Mn&&13>t))t=2;else{if(0>=n.Rd&&null==n.sd){a=s=r=e=0;var u=(h=c*Ur[t])*l;if(11>t||(s=(l+1)/2*(e=(c+1)/2),12==t&&(a=(r=c)*l)),null==(l=o(u+2*s+a))){t=1;break t}n.sd=l,11>t?((c=n.f.RGBA).eb=l,c.fb=0,c.A=h,c.size=u):((c=n.f.kb).y=l,c.O=0,c.fa=h,c.Fd=u,c.f=l,c.N=0+u,c.Ab=e,c.Cd=s,c.ea=l,c.W=0+u+s,c.Db=e,c.Ed=s,12==t&&(c.F=l,c.J=0+u+2*s),c.Tc=a,c.lb=r)}if(e=1,r=n.S,s=n.width,a=n.height,r>=Mn&&13>r)if(11>r)t=n.f.RGBA,e&=(h=Math.abs(t.A))*(a-1)+s<=t.size,e&=h>=s*Ur[r],e&=null!=t.eb;else{t=n.f.kb,h=(s+1)/2,u=(a+1)/2,c=Math.abs(t.fa),l=Math.abs(t.Ab);var f=Math.abs(t.Db),d=Math.abs(t.lb),p=d*(a-1)+s;e&=c*(a-1)+s<=t.Fd,e&=l*(u-1)+h<=t.Cd,e=(e&=f*(u-1)+h<=t.Ed)&c>=s&l>=h&f>=h,e&=null!=t.y,e&=null!=t.f,e&=null!=t.ea,12==r&&(e&=d>=s,e&=p<=t.Tc,e&=null!=t.F)}else e=0;t=e?0:2}}return 0!=t||null!=i&&i.fd&&(t=Mi(n)),t}var Bi=64,Ri=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],zi=24,qi=32,Ui=8,Wi=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];R("Predictor0","PredictorAdd0"),t.Predictor0=function(){return 4278190080},t.Predictor1=function(t){return t},t.Predictor2=function(t,e,i){return e[i+0]},t.Predictor3=function(t,e,i){return e[i+1]},t.Predictor4=function(t,e,i){return e[i-1]},t.Predictor5=function(t,e,i){return q(q(t,e[i+1]),e[i+0])},t.Predictor6=function(t,e,i){return q(t,e[i-1])},t.Predictor7=function(t,e,i){return q(t,e[i+0])},t.Predictor8=function(t,e,i){return q(e[i-1],e[i+0])},t.Predictor9=function(t,e,i){return q(e[i+0],e[i+1])},t.Predictor10=function(t,e,i){return q(q(t,e[i-1]),q(e[i+0],e[i+1]))},t.Predictor11=function(t,e,i){var n=e[i+0];return 0>=H(n>>24&255,t>>24&255,(e=e[i-1])>>24&255)+H(n>>16&255,t>>16&255,e>>16&255)+H(n>>8&255,t>>8&255,e>>8&255)+H(255&n,255&t,255&e)?n:t},t.Predictor12=function(t,e,i){var n=e[i+0];return(U((t>>24&255)+(n>>24&255)-((e=e[i-1])>>24&255))<<24|U((t>>16&255)+(n>>16&255)-(e>>16&255))<<16|U((t>>8&255)+(n>>8&255)-(e>>8&255))<<8|U((255&t)+(255&n)-(255&e)))>>>0},t.Predictor13=function(t,e,i){var n=e[i-1];return(W((t=q(t,e[i+0]))>>24&255,n>>24&255)<<24|W(t>>16&255,n>>16&255)<<16|W(t>>8&255,n>>8&255)<<8|W(t>>0&255,n>>0&255))>>>0};var Hi=t.PredictorAdd0;t.PredictorAdd1=V,R("Predictor2","PredictorAdd2"),R("Predictor3","PredictorAdd3"),R("Predictor4","PredictorAdd4"),R("Predictor5","PredictorAdd5"),R("Predictor6","PredictorAdd6"),R("Predictor7","PredictorAdd7"),R("Predictor8","PredictorAdd8"),R("Predictor9","PredictorAdd9"),R("Predictor10","PredictorAdd10"),R("Predictor11","PredictorAdd11"),R("Predictor12","PredictorAdd12"),R("Predictor13","PredictorAdd13");var Vi=t.PredictorAdd2;K("ColorIndexInverseTransform","MapARGB","32b",(function(t){return t>>8&255}),(function(t){return t})),K("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(t){return t}),(function(t){return t>>8&255}));var Gi,Xi=t.ColorIndexInverseTransform,Yi=t.MapARGB,Ki=t.VP8LColorIndexInverseTransformAlpha,Ji=t.MapAlpha,Zi=t.VP8LPredictorsAdd=[];Zi.length=16,(t.VP8LPredictors=[]).length=16,(t.VP8LPredictorsAdd_C=[]).length=16,(t.VP8LPredictors_C=[]).length=16;var $i,Qi,tn,en,nn,rn,on,sn,an,hn,cn,ln,un,fn,dn,pn,gn,mn,vn,yn,bn,wn,xn,_n,Sn,Cn,An,Ln,Pn=o(511),Tn=o(2041),On=o(225),kn=o(767),Nn=0,jn=Tn,Fn=On,En=kn,In=Pn,Mn=0,Dn=1,Bn=2,Rn=3,zn=4,qn=5,Un=6,Wn=7,Hn=8,Vn=9,Gn=10,Xn=[2,3,7],Yn=[3,3,11],Kn=[280,256,256,256,40],Jn=[0,1,1,1,0],Zn=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],$n=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],Qn=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],tr=8,er=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],ir=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],nr=null,rr=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],or=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],sr=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],ar=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],hr=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],cr=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],lr=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],ur=[],fr=[],dr=[],pr=1,gr=2,mr=[],vr=[];vi("UpsampleRgbLinePair",Si,3),vi("UpsampleBgrLinePair",Ci,3),vi("UpsampleRgbaLinePair",Oi,4),vi("UpsampleBgraLinePair",Ti,4),vi("UpsampleArgbLinePair",Pi,4),vi("UpsampleRgba4444LinePair",Li,2),vi("UpsampleRgb565LinePair",Ai,2);var yr=t.UpsampleRgbLinePair,br=t.UpsampleBgrLinePair,wr=t.UpsampleRgbaLinePair,xr=t.UpsampleBgraLinePair,_r=t.UpsampleArgbLinePair,Sr=t.UpsampleRgba4444LinePair,Cr=t.UpsampleRgb565LinePair,Ar=16,Lr=1<<Ar-1,Pr=-227,Tr=482,Or=6,kr=(256<<Or)-1,Nr=0,jr=o(256),Fr=o(256),Er=o(256),Ir=o(256),Mr=o(Tr-Pr),Dr=o(Tr-Pr);ki("YuvToRgbRow",Si,3),ki("YuvToBgrRow",Ci,3),ki("YuvToRgbaRow",Oi,4),ki("YuvToBgraRow",Ti,4),ki("YuvToArgbRow",Pi,4),ki("YuvToRgba4444Row",Li,2),ki("YuvToRgb565Row",Ai,2);var Br=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Rr=[0,2,8],zr=[8,7,6,4,4,2,2,2,1,1,1,1],qr=1;this.WebPDecodeRGBA=function(t,i,n,r,o){var s=Dn,a=new ii,h=new st;a.ba=h,h.S=s,h.width=[h.width],h.height=[h.height];var c=h.width,l=h.height,u=new at;if(null==u||null==t)var f=2;else e(null!=u),f=Ei(t,i,n,u.width,u.height,u.Pd,u.Qd,u.format,null);if(0!=f?c=0:(null!=c&&(c[0]=u.width[0]),null!=l&&(l[0]=u.height[0]),c=1),c){h.width=h.width[0],h.height=h.height[0],null!=r&&(r[0]=h.width),null!=o&&(o[0]=h.height);t:{if(r=new Gt,(o=new ni).data=t,o.w=i,o.ha=n,o.kd=1,i=[0],e(null!=o),(0==(t=Ei(o.data,o.w,o.ha,null,null,null,i,null,o))||7==t)&&i[0]&&(t=4),0==(i=t)){if(e(null!=a),r.data=o.data,r.w=o.w+o.offset,r.ha=o.ha-o.offset,r.put=dt,r.ac=ft,r.bc=pt,r.ma=a,o.xa){if(null==(t=Tt())){a=1;break t}if(function(t,i){var n=[0],r=[0],o=[0];e:for(;;){if(null==t)return 0;if(null==i)return t.a=2,0;if(t.l=i,t.a=0,v(t.m,i.data,i.w,i.ha),!gt(t.m,n,r,o)){t.a=3;break e}if(t.xb=gr,i.width=n[0],i.height=r[0],!Ot(n[0],r[0],1,t,null))break e;return 1}return e(0!=t.a),0}(t,r)){if(r=0==(i=Di(r.width,r.height,a.Oa,a.ba))){e:{r=t;i:for(;;){if(null==r){r=0;break e}if(e(null!=r.s.yc),e(null!=r.s.Ya),e(0<r.s.Wb),e(null!=(n=r.l)),e(null!=(o=n.ma)),0!=r.xb){if(r.ca=o.ba,r.tb=o.tb,e(null!=r.ca),!Ii(o.Oa,n,Rn)){r.a=2;break i}if(!kt(r,n.width))break i;if(n.da)break i;if((n.da||nt(r.ca.S))&&mi(),11>r.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=r.ca.f.kb.F&&mi()),r.Pb&&0<r.s.ua&&null==r.s.vb.X&&!F(r.s.vb,r.s.Wa.Xa)){r.a=1;break i}r.xb=0}if(!Lt(r,r.V,r.Ba,r.c,r.i,n.o,_t))break i;o.Dc=r.Ma,r=1;break e}e(0!=r.a),r=0}r=!r}r&&(i=t.a)}else i=t.a}else{if(null==(t=new Xt)){a=1;break t}if(t.Fa=o.na,t.P=o.P,t.qc=o.Sa,Jt(t,r)){if(0==(i=Di(r.width,r.height,a.Oa,a.ba))){if(t.Aa=0,n=a.Oa,e(null!=(o=t)),null!=n){if(0<(c=0>(c=n.Md)?0:100<c?255:255*c/100)){for(l=u=0;4>l;++l)12>(f=o.pb[l]).lc&&(f.ia=c*zr[0>f.lc?0:f.lc]>>3),u|=f.ia;u&&(alert("todo:VP8InitRandom"),o.ia=1)}o.Ga=n.Id,100<o.Ga?o.Ga=100:0>o.Ga&&(o.Ga=0)}Qt(t,r)||(i=t.a)}}else i=t.a}0==i&&null!=a.Oa&&a.Oa.fd&&(i=Mi(a.ba))}a=i}s=0!=a?null:11>s?h.f.RGBA.eb:h.f.kb.y}else s=null;return s};var Ur=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function c(t,e){for(var i="",n=0;n<4;n++)i+=String.fromCharCode(t[e++]);return i}function l(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16)>>>0}function u(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}new h;var f=[0],d=[0],p=[],g=new h,m=t,v=function(t,e){var i={},n=0,r=!1,o=0,s=0;if(i.frames=[],!function(t,e,i,n){for(var r=0;r<4;r++)if(t[e+r]!="RIFF".charCodeAt(r))return!0;return!1}(t,e)){var a,h;for(u(t,e+=4),e+=8;e<t.length;){var f=c(t,e),d=u(t,e+=4);e+=4;var p=d+(1&d);switch(f){case"VP8 ":case"VP8L":void 0===i.frames[n]&&(i.frames[n]={}),(v=i.frames[n]).src_off=r?s:e-8,v.src_size=o+d+8,n++,r&&(r=!1,o=0,s=0);break;case"VP8X":(v=i.header={}).feature_flags=t[e];var g=e+4;v.canvas_width=1+l(t,g),g+=3,v.canvas_height=1+l(t,g),g+=3;break;case"ALPH":r=!0,o=p+8,s=e-8;break;case"ANIM":(v=i.header).bgcolor=u(t,e),g=e+4,v.loop_count=(a=t)[(h=g)+0]<<0|a[h+1]<<8,g+=2;break;case"ANMF":var m,v;(v=i.frames[n]={}).offset_x=2*l(t,e),e+=3,v.offset_y=2*l(t,e),e+=3,v.width=1+l(t,e),e+=3,v.height=1+l(t,e),e+=3,v.duration=l(t,e),e+=3,m=t[e++],v.dispose=1&m,v.blend=m>>1&1}"ANMF"!=f&&(e+=p)}return i}}(m,0);v.response=m,v.rgbaoutput=!0,v.dataurl=!1;var y=v.header?v.header:null,b=v.frames?v.frames:null;if(y){y.loop_counter=y.loop_count,f=[y.canvas_height],d=[y.canvas_width];for(var w=0;w<b.length&&0!=b[w].blend;w++);}var x=b[0],_=g.WebPDecodeRGBA(m,x.src_off,x.src_size,d,f);x.rgba=_,x.imgwidth=d[0],x.imgheight=f[0];for(var S=0;S<d[0]*f[0]*4;S++)p[S]=_[S];return this.width=d,this.height=f,this.data=p,this}!function(t){var e=function(e,n,h,c){var l=4,u=o;switch(c){case t.image_compression.FAST:l=1,u=r;break;case t.image_compression.MEDIUM:l=6,u=s;break;case t.image_compression.SLOW:l=9,u=a}var f=Y(e=i(e,n,h,u),{level:l});return t.__addimage__.arrayBufferToBinaryString(f)},i=function(t,e,i,n){for(var r,o,s,a=t.length/e,h=new Uint8Array(t.length+a),u=c(),f=0;f<a;f+=1){if(s=f*e,r=t.subarray(s,s+e),n)h.set(n(r,i,o),s+f);else{for(var d,p=u.length,g=[];d<p;d+=1)g[d]=u[d](r,i,o);var m=l(g.concat());h.set(g[m],s+f)}o=r}return h},n=function(t){var e=Array.apply([],t);return e.unshift(0),e},r=function(t,e){var i,n=[],r=t.length;n[0]=1;for(var o=0;o<r;o+=1)i=t[o-e]||0,n[o+1]=t[o]-i+256&255;return n},o=function(t,e,i){var n,r=[],o=t.length;r[0]=2;for(var s=0;s<o;s+=1)n=i&&i[s]||0,r[s+1]=t[s]-n+256&255;return r},s=function(t,e,i){var n,r,o=[],s=t.length;o[0]=3;for(var a=0;a<s;a+=1)n=t[a-e]||0,r=i&&i[a]||0,o[a+1]=t[a]+256-(n+r>>>1)&255;return o},a=function(t,e,i){var n,r,o,s,a=[],c=t.length;a[0]=4;for(var l=0;l<c;l+=1)n=t[l-e]||0,r=i&&i[l]||0,o=i&&i[l-e]||0,s=h(n,r,o),a[l+1]=t[l]-s+256&255;return a},h=function(t,e,i){if(t===e&&e===i)return t;var n=Math.abs(e-i),r=Math.abs(t-i),o=Math.abs(t+e-i-i);return n<=r&&n<=o?t:r<=o?e:i},c=function(){return[n,r,o,s,a]},l=function(t){var e=t.map((function(t){return t.reduce((function(t,e){return t+Math.abs(e)}),0)}));return e.indexOf(Math.min.apply(null,e))};t.processPNG=function(i,n,r,o){var s,a,h,c,l,u,f,d,p,g,m,v,y,b,w,x=this.decode.FLATE_DECODE,_="";if(this.__addimage__.isArrayBuffer(i)&&(i=new Uint8Array(i)),this.__addimage__.isArrayBufferView(i)){if(i=(h=new Ue(i)).imgData,a=h.bits,s=h.colorSpace,l=h.colors,-1!==[4,6].indexOf(h.colorType)){if(8===h.bits){p=(d=32==h.pixelBitlength?new Uint32Array(h.decodePixels().buffer):16==h.pixelBitlength?new Uint16Array(h.decodePixels().buffer):new Uint8Array(h.decodePixels().buffer)).length,m=new Uint8Array(p*h.colors),g=new Uint8Array(p);var S,C=h.pixelBitlength-h.bits;for(b=0,w=0;b<p;b++){for(y=d[b],S=0;S<C;)m[w++]=y>>>S&255,S+=h.bits;g[b]=y>>>S&255}}if(16===h.bits){p=(d=new Uint32Array(h.decodePixels().buffer)).length,m=new Uint8Array(p*(32/h.pixelBitlength)*h.colors),g=new Uint8Array(p*(32/h.pixelBitlength)),v=h.colors>1,b=0,w=0;for(var A=0;b<p;)y=d[b++],m[w++]=y>>>0&255,v&&(m[w++]=y>>>16&255,y=d[b++],m[w++]=y>>>0&255),g[A++]=y>>>16&255;a=8}o!==t.image_compression.NONE?(i=e(m,h.width*h.colors,h.colors,o),f=e(g,h.width,1,o)):(i=m,f=g,x=void 0)}if(3===h.colorType&&(s=this.color_spaces.INDEXED,u=h.palette,h.transparency.indexed)){var L=h.transparency.indexed,P=0;for(b=0,p=L.length;b<p;++b)P+=L[b];if((P/=255)==p-1&&-1!==L.indexOf(0))c=[L.indexOf(0)];else if(P!==p){for(d=h.decodePixels(),g=new Uint8Array(d.length),b=0,p=d.length;b<p;b++)g[b]=L[d[b]];f=e(g,h.width,1)}}var T=function(e){var i;switch(e){case t.image_compression.FAST:i=11;break;case t.image_compression.MEDIUM:i=13;break;case t.image_compression.SLOW:i=14;break;default:i=12}return i}(o);return x===this.decode.FLATE_DECODE&&(_="/Predictor "+T+" "),_+="/Colors "+l+" /BitsPerComponent "+a+" /Columns "+h.width,(this.__addimage__.isArrayBuffer(i)||this.__addimage__.isArrayBufferView(i))&&(i=this.__addimage__.arrayBufferToBinaryString(i)),(f&&this.__addimage__.isArrayBuffer(f)||this.__addimage__.isArrayBufferView(f))&&(f=this.__addimage__.arrayBufferToBinaryString(f)),{alias:r,data:i,index:n,filter:x,decodeParameters:_,transparency:c,palette:u,sMask:f,predictor:T,width:h.width,height:h.height,bitsPerComponent:a,colorSpace:s}}}}(Ot.API),function(t){t.processGIF89A=function(e,i,n,r){var o=new We(e),s=o.width,a=o.height,h=[];o.decodeAndBlitFrameRGBA(0,h);var c={data:h,width:s,height:a},l=new Ve(100).encode(c,100);return t.processJPEG.call(this,l,i,n,r)},t.processGIF87A=t.processGIF89A}(Ot.API),Ge.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var i=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0);this.palette[e]={red:r,green:n,blue:i,quad:o}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},Ge.prototype.parseBGR=function(){this.pos=this.offset;try{var t="bit"+this.bitPP,e=this.width*this.height*4;this.data=new Uint8Array(e),this[t]()}catch(t){$.log("bit decode error:"+t)}},Ge.prototype.bit1=function(){var t,e=Math.ceil(this.width/8),i=e%4;for(t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,r=0;r<e;r++)for(var o=this.datav.getUint8(this.pos++,!0),s=n*this.width*4+8*r*4,a=0;a<8&&8*r+a<this.width;a++){var h=this.palette[o>>7-a&1];this.data[s+4*a]=h.blue,this.data[s+4*a+1]=h.green,this.data[s+4*a+2]=h.red,this.data[s+4*a+3]=255}0!==i&&(this.pos+=4-i)}},Ge.prototype.bit4=function(){for(var t=Math.ceil(this.width/2),e=t%4,i=this.height-1;i>=0;i--){for(var n=this.bottom_up?i:this.height-1-i,r=0;r<t;r++){var o=this.datav.getUint8(this.pos++,!0),s=n*this.width*4+2*r*4,a=o>>4,h=15&o,c=this.palette[a];if(this.data[s]=c.blue,this.data[s+1]=c.green,this.data[s+2]=c.red,this.data[s+3]=255,2*r+1>=this.width)break;c=this.palette[h],this.data[s+4]=c.blue,this.data[s+4+1]=c.green,this.data[s+4+2]=c.red,this.data[s+4+3]=255}0!==e&&(this.pos+=4-e)}},Ge.prototype.bit8=function(){for(var t=this.width%4,e=this.height-1;e>=0;e--){for(var i=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),o=i*this.width*4+4*n;if(r<this.palette.length){var s=this.palette[r];this.data[o]=s.red,this.data[o+1]=s.green,this.data[o+2]=s.blue,this.data[o+3]=255}else this.data[o]=255,this.data[o+1]=255,this.data[o+2]=255,this.data[o+3]=255}0!==t&&(this.pos+=4-t)}},Ge.prototype.bit15=function(){for(var t=this.width%3,e=parseInt("11111",2),i=this.height-1;i>=0;i--){for(var n=this.bottom_up?i:this.height-1-i,r=0;r<this.width;r++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var s=(o&e)/e*255|0,a=(o>>5&e)/e*255|0,h=(o>>10&e)/e*255|0,c=o>>15?255:0,l=n*this.width*4+4*r;this.data[l]=h,this.data[l+1]=a,this.data[l+2]=s,this.data[l+3]=c}this.pos+=t}},Ge.prototype.bit16=function(){for(var t=this.width%3,e=parseInt("11111",2),i=parseInt("111111",2),n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,o=0;o<this.width;o++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var a=(s&e)/e*255|0,h=(s>>5&i)/i*255|0,c=(s>>11)/e*255|0,l=r*this.width*4+4*o;this.data[l]=c,this.data[l+1]=h,this.data[l+2]=a,this.data[l+3]=255}this.pos+=t}},Ge.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,i=0;i<this.width;i++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),s=e*this.width*4+4*i;this.data[s]=o,this.data[s+1]=r,this.data[s+2]=n,this.data[s+3]=255}this.pos+=this.width%4}},Ge.prototype.bit32=function(){for(var t=this.height-1;t>=0;t--)for(var e=this.bottom_up?t:this.height-1-t,i=0;i<this.width;i++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=e*this.width*4+4*i;this.data[a]=o,this.data[a+1]=r,this.data[a+2]=n,this.data[a+3]=s}},Ge.prototype.getData=function(){return this.data},function(t){t.processBMP=function(e,i,n,r){var o=new Ge(e,!1),s=o.width,a=o.height,h={data:o.getData(),width:s,height:a},c=new Ve(100).encode(h,100);return t.processJPEG.call(this,c,i,n,r)}}(Ot.API),Xe.prototype.getData=function(){return this.data},function(t){t.processWEBP=function(e,i,n,r){var o=new Xe(e,!1),s=o.width,a=o.height,h={data:o.getData(),width:s,height:a},c=new Ve(100).encode(h,100);return t.processJPEG.call(this,c,i,n,r)}}(Ot.API),Ot.API.processRGBA=function(t,e,i){for(var n=t.data,r=n.length,o=new Uint8Array(r/4*3),s=new Uint8Array(r/4),a=0,h=0,c=0;c<r;c+=4){var l=n[c],u=n[c+1],f=n[c+2],d=n[c+3];o[a++]=l,o[a++]=u,o[a++]=f,s[h++]=d}var p=this.__addimage__.arrayBufferToBinaryString(o);return{alpha:this.__addimage__.arrayBufferToBinaryString(s),data:p,index:e,alias:i,colorSpace:"DeviceRGB",bitsPerComponent:8,width:t.width,height:t.height}},Ot.API.setLanguage=function(t){return void 0===this.internal.languageSettings&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),void 0!=={af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[t]&&(this.internal.languageSettings.languageCode=t,!1===this.internal.languageSettings.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")})),this.internal.languageSettings.isSubscribed=!0)),this},De=Ot.API,Be=De.getCharWidthsArray=function(t,e){var i,r,o=(e=e||{}).font||this.internal.getFont(),s=e.fontSize||this.internal.getFontSize(),a=e.charSpace||this.internal.getCharSpace(),h=e.widths?e.widths:o.metadata.Unicode.widths,c=h.fof?h.fof:1,l=e.kerning?e.kerning:o.metadata.Unicode.kerning,u=l.fof?l.fof:1,f=!1!==e.doKerning,d=0,p=t.length,g=0,m=h[0]||c,v=[];for(i=0;i<p;i++)r=t.charCodeAt(i),"function"==typeof o.metadata.widthOfString?v.push((o.metadata.widthOfGlyph(o.metadata.characterToGlyph(r))+a*(1e3/s)||0)/1e3):(d=f&&"object"===(0,n.Z)(l[r])&&!isNaN(parseInt(l[r][g],10))?l[r][g]/u:0,v.push((h[r]||m)/c+d)),g=r;return v},Re=De.getStringUnitWidth=function(t,e){var i=(e=e||{}).fontSize||this.internal.getFontSize(),n=e.font||this.internal.getFont(),r=e.charSpace||this.internal.getCharSpace();return De.processArabic&&(t=De.processArabic(t)),"function"==typeof n.metadata.widthOfString?n.metadata.widthOfString(t,i,r)/i:Be.apply(this,arguments).reduce((function(t,e){return t+e}),0)},ze=function(t,e,i,n){for(var r=[],o=0,s=t.length,a=0;o!==s&&a+e[o]<i;)a+=e[o],o++;r.push(t.slice(0,o));var h=o;for(a=0;o!==s;)a+e[o]>n&&(r.push(t.slice(h,o)),a=0,h=o),a+=e[o],o++;return h!==o&&r.push(t.slice(h,o)),r},qe=function(t,e,i){i||(i={});var n,r,o,s,a,h,c,l=[],u=[l],f=i.textIndent||0,d=0,p=0,g=t.split(" "),m=Be.apply(this,[" ",i])[0];if(h=-1===i.lineIndent?g[0].length+2:i.lineIndent||0){var v=Array(h).join(" "),y=[];g.map((function(t){(t=t.split(/\s*\n/)).length>1?y=y.concat(t.map((function(t,e){return(e&&t.length?"\n":"")+t}))):y.push(t[0])})),g=y,h=Re.apply(this,[v,i])}for(o=0,s=g.length;o<s;o++){var b=0;if(n=g[o],h&&"\n"==n[0]&&(n=n.substr(1),b=1),f+d+(p=(r=Be.apply(this,[n,i])).reduce((function(t,e){return t+e}),0))>e||b){if(p>e){for(a=ze.apply(this,[n,r,e-(f+d),e]),l.push(a.shift()),l=[a.pop()];a.length;)u.push([a.shift()]);p=r.slice(n.length-(l[0]?l[0].length:0)).reduce((function(t,e){return t+e}),0)}else l=[n];u.push(l),f=p+h,d=m}else l.push(n),f+=d+p,d=m}return c=h?function(t,e){return(e?v:"")+t.join(" ")}:function(t){return t.join(" ")},u.map(c)},De.splitTextToSize=function(t,e,i){var n,r=(i=i||{}).fontSize||this.internal.getFontSize(),o=function(t){if(t.widths&&t.kerning)return{widths:t.widths,kerning:t.kerning};var e=this.internal.getFont(t.fontName,t.fontStyle);return e.metadata.Unicode?{widths:e.metadata.Unicode.widths||{0:1},kerning:e.metadata.Unicode.kerning||{}}:{font:e.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}.call(this,i);n=Array.isArray(t)?t:String(t).split(/\r?\n/);var s=1*this.internal.scaleFactor*e/r;o.textIndent=i.textIndent?1*i.textIndent*this.internal.scaleFactor/r:0,o.lineIndent=i.lineIndent;var a,h,c=[];for(a=0,h=n.length;a<h;a++)c=c.concat(qe.apply(this,[n[a],s,o]));return c},function(t){t.__fontmetrics__=t.__fontmetrics__||{};for(var e="klmnopqrstuvwxyz",i={},r={},o=0;o<e.length;o++)i[e[o]]="0123456789abcdef"[o],r["0123456789abcdef"[o]]=e[o];var s=function(t){return"0x"+parseInt(t,10).toString(16)},a=t.__fontmetrics__.compress=function(t){var e,i,o,h,c=["{"];for(var l in t){if(e=t[l],isNaN(parseInt(l,10))?i="'"+l+"'":(l=parseInt(l,10),i=(i=s(l).slice(2)).slice(0,-1)+r[i.slice(-1)]),"number"==typeof e)e<0?(o=s(e).slice(3),h="-"):(o=s(e).slice(2),h=""),o=h+o.slice(0,-1)+r[o.slice(-1)];else{if("object"!==(0,n.Z)(e))throw new Error("Don't know what to do with value type "+(0,n.Z)(e)+".");o=a(e)}c.push(i+o)}return c.push("}"),c.join("")},h=t.__fontmetrics__.uncompress=function(t){if("string"!=typeof t)throw new Error("Invalid argument passed to uncompress.");for(var e,n,r,o,s={},a=1,h=s,c=[],l="",u="",f=t.length-1,d=1;d<f;d+=1)"'"==(o=t[d])?e?(r=e.join(""),e=void 0):e=[]:e?e.push(o):"{"==o?(c.push([h,r]),h={},r=void 0):"}"==o?((n=c.pop())[0][n[1]]=h,r=void 0,h=n[0]):"-"==o?a=-1:void 0===r?i.hasOwnProperty(o)?(l+=i[o],r=parseInt(l,16)*a,a=1,l=""):l+=o:i.hasOwnProperty(o)?(u+=i[o],h[r]=parseInt(u,16)*a,a=1,r=void 0,u=""):u+=o;return s},c={codePages:["WinAnsiEncoding"],WinAnsiEncoding:h("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},l={Unicode:{Courier:c,"Courier-Bold":c,"Courier-BoldOblique":c,"Courier-Oblique":c,Helvetica:c,"Helvetica-Bold":c,"Helvetica-BoldOblique":c,"Helvetica-Oblique":c,"Times-Roman":c,"Times-Bold":c,"Times-BoldItalic":c,"Times-Italic":c}},u={Unicode:{"Courier-Oblique":h("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":h("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":h("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:h("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":h("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":h("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:h("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:h("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":h("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:h("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":h("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":h("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":h("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":h("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};t.events.push(["addFont",function(t){var e=t.font,i=u.Unicode[e.postScriptName];i&&(e.metadata.Unicode={},e.metadata.Unicode.widths=i.widths,e.metadata.Unicode.kerning=i.kerning);var n=l.Unicode[e.postScriptName];n&&(e.metadata.Unicode.encoding=n,e.encoding=n.codePages[0])}])}(Ot.API),function(t){var e=function(t){for(var e=t.length,i=new Uint8Array(e),n=0;n<e;n++)i[n]=t.charCodeAt(n);return i};t.API.events.push(["addFont",function(i){var n=void 0,r=i.font,o=i.instance;if(!r.isStandardFont){if(void 0===o)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+r.postScriptName+"').");if("string"!=typeof(n=!1===o.existsFileInVFS(r.postScriptName)?o.loadFile(r.postScriptName):o.getFileFromVFS(r.postScriptName)))throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+r.postScriptName+"').");!function(i,n){n=/^\x00\x01\x00\x00/.test(n)?e(n):e(it(n)),i.metadata=t.API.TTFFont.open(n),i.metadata.Unicode=i.metadata.Unicode||{encoding:{},kerning:{},widths:[]},i.metadata.glyIdsUsed=[0]}(r,n)}}])}(Ot),function(t){function e(){return(J.canvg?K.resolve(J.canvg):i.e(392).then(i.bind(i,8392))).catch((function(t){return K.reject(new Error("Could not load canvg: "+t))})).then((function(t){return t.default?t.default:t}))}Ot.API.addSvgAsImage=function(t,i,n,r,o,s,a,h){if(isNaN(i)||isNaN(n))throw $.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(r)||isNaN(o))throw $.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=r,c.height=o;var l=c.getContext("2d");l.fillStyle="#fff",l.fillRect(0,0,c.width,c.height);var u={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},f=this;return e().then((function(e){return e.fromString(l,t,u)}),(function(){return K.reject(new Error("Could not load canvg."))})).then((function(t){return t.render(u)})).then((function(){f.addImage(c.toDataURL("image/jpeg",1),i,n,r,o,a,h)}))}}(),Ot.API.putTotalPages=function(t){var e,i=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),i=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),i=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var r=0;r<this.internal.pages[n].length;r++)this.internal.pages[n][r]=this.internal.pages[n][r].replace(e,i);return this},Ot.API.viewerPreferences=function(t,e){var i;t=t||{},e=e||!1;var r,o,s,a={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},h=Object.keys(a),c=[],l=0,u=0,f=0;function d(t,e){var i,n=!1;for(i=0;i<t.length;i+=1)t[i]===e&&(n=!0);return n}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(a)),this.internal.viewerpreferences.isSubscribed=!1),i=this.internal.viewerpreferences.configuration,"reset"===t||!0===e){var p=h.length;for(f=0;f<p;f+=1)i[h[f]].value=i[h[f]].defaultValue,i[h[f]].explicitSet=!1}if("object"===(0,n.Z)(t))for(o in t)if(s=t[o],d(h,o)&&void 0!==s){if("boolean"===i[o].type&&"boolean"==typeof s)i[o].value=s;else if("name"===i[o].type&&d(i[o].valueSet,s))i[o].value=s;else if("integer"===i[o].type&&Number.isInteger(s))i[o].value=s;else if("array"===i[o].type){for(l=0;l<s.length;l+=1)if(r=!0,1===s[l].length&&"number"==typeof s[l][0])c.push(String(s[l]-1));else if(s[l].length>1){for(u=0;u<s[l].length;u+=1)"number"!=typeof s[l][u]&&(r=!1);!0===r&&c.push([s[l][0]-1,s[l][1]-1].join(" "))}i[o].value="["+c.join(" ")+"]"}else i[o].value=i[o].defaultValue;i[o].explicitSet=!0}return!1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var t,e=[];for(t in i)!0===i[t].explicitSet&&("name"===i[t].type?e.push("/"+t+" /"+i[t].value):e.push("/"+t+" "+i[t].value));0!==e.length&&this.internal.write("/ViewerPreferences\n<<\n"+e.join("\n")+"\n>>")})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=i,this},function(t){var e=function(){var t='<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceuri+'"><jspdf:metadata>',e=unescape(encodeURIComponent('<x:xmpmeta xmlns:x="adobe:ns:meta/">')),i=unescape(encodeURIComponent(t)),n=unescape(encodeURIComponent(this.internal.__metadata__.metadata)),r=unescape(encodeURIComponent("</jspdf:metadata></rdf:Description></rdf:RDF>")),o=unescape(encodeURIComponent("</x:xmpmeta>")),s=i.length+n.length+r.length+e.length+o.length;this.internal.__metadata__.metadata_object_number=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+s+" >>"),this.internal.write("stream"),this.internal.write(e+i+n+r+o),this.internal.write("endstream"),this.internal.write("endobj")},i=function(){this.internal.__metadata__.metadata_object_number&&this.internal.write("/Metadata "+this.internal.__metadata__.metadata_object_number+" 0 R")};t.addMetadata=function(t,n){return void 0===this.internal.__metadata__&&(this.internal.__metadata__={metadata:t,namespaceuri:n||"http://jspdf.default.namespaceuri/"},this.internal.events.subscribe("putCatalog",i),this.internal.events.subscribe("postPutResources",e)),this}}(Ot.API),function(t){var e=t.API,i=e.pdfEscape16=function(t,e){for(var i,n=e.metadata.Unicode.widths,r=["","0","00","000","0000"],o=[""],s=0,a=t.length;s<a;++s){if(i=e.metadata.characterToGlyph(t.charCodeAt(s)),e.metadata.glyIdsUsed.push(i),e.metadata.toUnicode[i]=t.charCodeAt(s),-1==n.indexOf(i)&&(n.push(i),n.push([parseInt(e.metadata.widthOfGlyph(i),10)])),"0"==i)return o.join("");i=i.toString(16),o.push(r[4-i.length],i)}return o.join("")},n=function(t){var e,i,n,r,o,s,a;for(o="/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo <<\n /Registry (Adobe)\n /Ordering (UCS)\n /Supplement 0\n>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 begincodespacerange\n<0000><ffff>\nendcodespacerange",n=[],s=0,a=(i=Object.keys(t).sort((function(t,e){return t-e}))).length;s<a;s++)e=i[s],n.length>=100&&(o+="\n"+n.length+" beginbfchar\n"+n.join("\n")+"\nendbfchar",n=[]),void 0!==t[e]&&null!==t[e]&&"function"==typeof t[e].toString&&(r=("0000"+t[e].toString(16)).slice(-4),e=("0000"+(+e).toString(16)).slice(-4),n.push("<"+e+"><"+r+">"));return n.length&&(o+="\n"+n.length+" beginbfchar\n"+n.join("\n")+"\nendbfchar\n"),o+"endcmap\nCMapName currentdict /CMap defineresource pop\nend\nend"};e.events.push(["putFont",function(e){!function(e){var i=e.font,r=e.out,o=e.newObject,s=e.putStream;if(i.metadata instanceof t.API.TTFFont&&"Identity-H"===i.encoding){for(var a=i.metadata.Unicode.widths,h=i.metadata.subset.encode(i.metadata.glyIdsUsed,1),c="",l=0;l<h.length;l++)c+=String.fromCharCode(h[l]);var u=o();s({data:c,addLength1:!0,objectId:u}),r("endobj");var f=o();s({data:n(i.metadata.toUnicode),addLength1:!0,objectId:f}),r("endobj");var d=o();r("<<"),r("/Type /FontDescriptor"),r("/FontName /"+St(i.fontName)),r("/FontFile2 "+u+" 0 R"),r("/FontBBox "+t.API.PDFObject.convert(i.metadata.bbox)),r("/Flags "+i.metadata.flags),r("/StemV "+i.metadata.stemV),r("/ItalicAngle "+i.metadata.italicAngle),r("/Ascent "+i.metadata.ascender),r("/Descent "+i.metadata.decender),r("/CapHeight "+i.metadata.capHeight),r(">>"),r("endobj");var p=o();r("<<"),r("/Type /Font"),r("/BaseFont /"+St(i.fontName)),r("/FontDescriptor "+d+" 0 R"),r("/W "+t.API.PDFObject.convert(a)),r("/CIDToGIDMap /Identity"),r("/DW 1000"),r("/Subtype /CIDFontType2"),r("/CIDSystemInfo"),r("<<"),r("/Supplement 0"),r("/Registry (Adobe)"),r("/Ordering ("+i.encoding+")"),r(">>"),r(">>"),r("endobj"),i.objectNumber=o(),r("<<"),r("/Type /Font"),r("/Subtype /Type0"),r("/ToUnicode "+f+" 0 R"),r("/BaseFont /"+St(i.fontName)),r("/Encoding /"+i.encoding),r("/DescendantFonts ["+p+" 0 R]"),r(">>"),r("endobj"),i.isAlreadyPutted=!0}}(e)}]),e.events.push(["putFont",function(e){!function(e){var i=e.font,r=e.out,o=e.newObject,s=e.putStream;if(i.metadata instanceof t.API.TTFFont&&"WinAnsiEncoding"===i.encoding){for(var a=i.metadata.rawData,h="",c=0;c<a.length;c++)h+=String.fromCharCode(a[c]);var l=o();s({data:h,addLength1:!0,objectId:l}),r("endobj");var u=o();s({data:n(i.metadata.toUnicode),addLength1:!0,objectId:u}),r("endobj");var f=o();r("<<"),r("/Descent "+i.metadata.decender),r("/CapHeight "+i.metadata.capHeight),r("/StemV "+i.metadata.stemV),r("/Type /FontDescriptor"),r("/FontFile2 "+l+" 0 R"),r("/Flags 96"),r("/FontBBox "+t.API.PDFObject.convert(i.metadata.bbox)),r("/FontName /"+St(i.fontName)),r("/ItalicAngle "+i.metadata.italicAngle),r("/Ascent "+i.metadata.ascender),r(">>"),r("endobj"),i.objectNumber=o();for(var d=0;d<i.metadata.hmtx.widths.length;d++)i.metadata.hmtx.widths[d]=parseInt(i.metadata.hmtx.widths[d]*(1e3/i.metadata.head.unitsPerEm));r("<</Subtype/TrueType/Type/Font/ToUnicode "+u+" 0 R/BaseFont/"+St(i.fontName)+"/FontDescriptor "+f+" 0 R/Encoding/"+i.encoding+" /FirstChar 29 /LastChar 255 /Widths "+t.API.PDFObject.convert(i.metadata.hmtx.widths)+">>"),r("endobj"),i.isAlreadyPutted=!0}}(e)}]);var r=function(t){var e,n=t.text||"",r=t.x,o=t.y,s=t.options||{},a=t.mutex||{},h=a.pdfEscape,c=a.activeFontKey,l=a.fonts,u=c,f="",d=0,p="",g=l[u].encoding;if("Identity-H"!==l[u].encoding)return{text:n,x:r,y:o,options:s,mutex:a};for(p=n,u=c,Array.isArray(n)&&(p=n[0]),d=0;d<p.length;d+=1)l[u].metadata.hasOwnProperty("cmap")&&(e=l[u].metadata.cmap.unicode.codeMap[p[d].charCodeAt(0)]),e||p[d].charCodeAt(0)<256&&l[u].metadata.hasOwnProperty("Unicode")?f+=p[d]:f+="";var m="";return parseInt(u.slice(1))<14||"WinAnsiEncoding"===g?m=h(f,u).split("").map((function(t){return t.charCodeAt(0).toString(16)})).join(""):"Identity-H"===g&&(m=i(f,l[u])),a.isHex=!0,{text:m,x:r,y:o,options:s,mutex:a}};e.events.push(["postProcessText",function(t){var e=t.text||"",i=[],n={text:e,x:t.x,y:t.y,options:t.options,mutex:t.mutex};if(Array.isArray(e)){var o=0;for(o=0;o<e.length;o+=1)Array.isArray(e[o])&&3===e[o].length?i.push([r(Object.assign({},n,{text:e[o][0]})).text,e[o][1],e[o][2]]):i.push(r(Object.assign({},n,{text:e[o]})).text);t.text=i}else t.text=r(Object.assign({},n,{text:e})).text}])}(Ot),function(t){var e=function(){return void 0===this.internal.vFS&&(this.internal.vFS={}),!0};t.existsFileInVFS=function(t){return e.call(this),void 0!==this.internal.vFS[t]},t.addFileToVFS=function(t,i){return e.call(this),this.internal.vFS[t]=i,this},t.getFileFromVFS=function(t){return e.call(this),void 0!==this.internal.vFS[t]?this.internal.vFS[t]:null}}(Ot.API),function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(t){var i,n,r,o,s,a,h,c=e,l=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],u=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],f={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},d={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},p=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],g=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),m=!1,v=0;this.__bidiEngine__={};var y=function(t){var e=t.charCodeAt(),i=e>>8,n=d[i];return void 0!==n?c[256*n+(255&e)]:252===i||253===i?"AL":g.test(i)?"L":8===i?"R":"N"},b=function(t){for(var e,i=0;i<t.length;i++){if("L"===(e=y(t.charAt(i))))return!1;if("R"===e)return!0}return!1},w=function(t,e,s,a){var h,c,l,u,f=e[a];switch(f){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":m=!1;break;case"N":case"AN":break;case"EN":m&&(f="AN");break;case"AL":m=!0,f="R";break;case"WS":case"BN":f="N";break;case"CS":a<1||a+1>=e.length||"EN"!==(h=s[a-1])&&"AN"!==h||"EN"!==(c=e[a+1])&&"AN"!==c?f="N":m&&(c="AN"),f=c===h?c:"N";break;case"ES":f="EN"===(h=a>0?s[a-1]:"B")&&a+1<e.length&&"EN"===e[a+1]?"EN":"N";break;case"ET":if(a>0&&"EN"===s[a-1]){f="EN";break}if(m){f="N";break}for(l=a+1,u=e.length;l<u&&"ET"===e[l];)l++;f=l<u&&"EN"===e[l]?"EN":"N";break;case"NSM":if(r&&!o){for(u=e.length,l=a+1;l<u&&"NSM"===e[l];)l++;if(l<u){var d=t[a],p=d>=1425&&d<=2303||64286===d;if(h=e[l],p&&("R"===h||"AL"===h)){f="R";break}}}f=a<1||"B"===(h=e[a-1])?"N":s[a-1];break;case"B":m=!1,i=!0,f=v;break;case"S":n=!0,f="N"}return f},x=function(t,e,i){var n=t.split("");return i&&_(n,i,{hiLevel:v}),n.reverse(),e&&e.reverse(),n.join("")},_=function(t,e,r){var o,s,a,h,c,d=-1,p=t.length,g=0,b=[],x=v?u:l,_=[];for(m=!1,i=!1,n=!1,s=0;s<p;s++)_[s]=y(t[s]);for(a=0;a<p;a++){if(c=g,b[a]=w(t,_,b,a),o=240&(g=x[c][f[b[a]]]),g&=15,e[a]=h=x[g][5],o>0)if(16===o){for(s=d;s<a;s++)e[s]=1;d=-1}else d=-1;if(x[g][6])-1===d&&(d=a);else if(d>-1){for(s=d;s<a;s++)e[s]=h;d=-1}"B"===_[a]&&(e[a]=0),r.hiLevel|=h}n&&function(t,e,i){for(var n=0;n<i;n++)if("S"===t[n]){e[n]=v;for(var r=n-1;r>=0&&"WS"===t[r];r--)e[r]=v}}(_,e,p)},S=function(t,e,n,r,o){if(!(o.hiLevel<t)){if(1===t&&1===v&&!i)return e.reverse(),void(n&&n.reverse());for(var s,a,h,c,l=e.length,u=0;u<l;){if(r[u]>=t){for(h=u+1;h<l&&r[h]>=t;)h++;for(c=u,a=h-1;c<a;c++,a--)s=e[c],e[c]=e[a],e[a]=s,n&&(s=n[c],n[c]=n[a],n[a]=s);u=h}u++}}},C=function(t,e,i){var n=t.split(""),r={hiLevel:v};return i||(i=[]),_(n,i,r),function(t,e,i){if(0!==i.hiLevel&&h)for(var n,r=0;r<t.length;r++)1===e[r]&&(n=p.indexOf(t[r]))>=0&&(t[r]=p[n+1])}(n,i,r),S(2,n,e,i,r),S(1,n,e,i,r),n.join("")};return this.__bidiEngine__.doBidiReorder=function(t,e,i){if(function(t,e){if(e)for(var i=0;i<t.length;i++)e[i]=i;void 0===o&&(o=b(t)),void 0===a&&(a=b(t))}(t,e),r||!s||a)if(r&&s&&o^a)v=o?1:0,t=x(t,e,i);else if(!r&&s&&a)v=o?1:0,t=C(t,e,i),t=x(t,e);else if(!r||o||s||a){if(r&&!s&&o^a)t=x(t,e),o?(v=0,t=C(t,e,i)):(v=1,t=C(t,e,i),t=x(t,e));else if(r&&o&&!s&&a)v=1,t=C(t,e,i),t=x(t,e);else if(!r&&!s&&o^a){var n=h;o?(v=1,t=C(t,e,i),v=0,h=!1,t=C(t,e,i),h=n):(v=0,t=C(t,e,i),t=x(t,e),v=1,h=!1,t=C(t,e,i),h=n,t=x(t,e))}}else v=0,t=C(t,e,i);else v=o?1:0,t=C(t,e,i);return t},this.__bidiEngine__.setOptions=function(t){t&&(r=t.isInputVisual,s=t.isOutputVisual,o=t.isInputRtl,a=t.isOutputRtl,h=t.isSymmetricSwapping)},this.__bidiEngine__.setOptions(t),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],i=new t.__bidiEngine__({isInputVisual:!0});t.API.events.push(["postProcessText",function(t){var e=t.text,n=(t.x,t.y,t.options||{}),r=(t.mutex,n.lang,[]);if(n.isInputVisual="boolean"!=typeof n.isInputVisual||n.isInputVisual,i.setOptions(n),"[object Array]"===Object.prototype.toString.call(e)){var o=0;for(r=[],o=0;o<e.length;o+=1)"[object Array]"===Object.prototype.toString.call(e[o])?r.push([i.doBidiReorder(e[o][0]),e[o][1],e[o][2]]):r.push([i.doBidiReorder(e[o])]);t.text=r}else t.text=i.doBidiReorder(e);i.setOptions({isInputVisual:!0})}])}(Ot),Ot.API.TTFFont=function(){function t(t){var e;if(this.rawData=t,e=this.contents=new Ke(t),this.contents.pos=4,"ttcf"===e.readString(4))throw new Error("TTCF not supported.");e.pos=0,this.parse(),this.subset=new pi(this),this.registerTTF()}return t.open=function(e){return new t(e)},t.prototype.parse=function(){return this.directory=new Je(this.contents),this.head=new Qe(this),this.name=new si(this),this.cmap=new ei(this),this.toUnicode={},this.hhea=new ii(this),this.maxp=new ai(this),this.hmtx=new hi(this),this.post=new ri(this),this.os2=new ni(this),this.loca=new di(this),this.glyf=new li(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},t.prototype.registerTTF=function(){var t,e,i,n,r;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=function(){var e,i,n,r;for(r=[],e=0,i=(n=this.bbox).length;e<i;e++)t=n[e],r.push(Math.round(t*this.scaleFactor));return r}.call(this),this.stemV=0,this.post.exists?(i=255&(n=this.post.italic_angle),0!=(32768&(e=n>>16))&&(e=-(1+(65535^e))),this.italicAngle=+(e+"."+i)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=1===(r=this.familyClass)||2===r||3===r||4===r||5===r||7===r,this.isScript=10===this.familyClass,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),0!==this.italicAngle&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},t.prototype.characterToGlyph=function(t){var e;return(null!=(e=this.cmap.unicode)?e.codeMap[t]:void 0)||0},t.prototype.widthOfGlyph=function(t){var e;return e=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*e},t.prototype.widthOfString=function(t,e,i){var n,r,o,s;for(o=0,r=0,s=(t=""+t).length;0<=s?r<s:r>s;r=0<=s?++r:--r)n=t.charCodeAt(r),o+=this.widthOfGlyph(this.characterToGlyph(n))+i*(1e3/e)||0;return o*(e/1e3)},t.prototype.lineHeight=function(t,e){var i;return null==e&&(e=!1),i=e?this.lineGap:0,(this.ascender+i-this.decender)/1e3*t},t}();var Ye,Ke=function(){function t(t){this.data=null!=t?t:[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(t){return this.data[this.pos++]=t},t.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},t.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},t.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},t.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},t.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},t.prototype.readString=function(t){var e,i;for(i=[],e=0;0<=t?e<t:e>t;e=0<=t?++e:--e)i[e]=String.fromCharCode(this.readByte());return i.join("")},t.prototype.writeString=function(t){var e,i,n;for(n=[],e=0,i=t.length;0<=i?e<i:e>i;e=0<=i?++e:--e)n.push(this.writeByte(t.charCodeAt(e)));return n},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(t){return this.writeInt16(t)},t.prototype.readLongLong=function(){var t,e,i,n,r,o,s,a;return t=this.readByte(),e=this.readByte(),i=this.readByte(),n=this.readByte(),r=this.readByte(),o=this.readByte(),s=this.readByte(),a=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^e)+1099511627776*(255^i)+4294967296*(255^n)+16777216*(255^r)+65536*(255^o)+256*(255^s)+(255^a)+1):72057594037927940*t+281474976710656*e+1099511627776*i+4294967296*n+16777216*r+65536*o+256*s+a},t.prototype.writeLongLong=function(t){var e,i;return e=Math.floor(t/4294967296),i=4294967295&t,this.writeByte(e>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e),this.writeByte(i>>24&255),this.writeByte(i>>16&255),this.writeByte(i>>8&255),this.writeByte(255&i)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(t){return this.writeInt32(t)},t.prototype.read=function(t){var e,i;for(e=[],i=0;0<=t?i<t:i>t;i=0<=t?++i:--i)e.push(this.readByte());return e},t.prototype.write=function(t){var e,i,n,r;for(r=[],i=0,n=t.length;i<n;i++)e=t[i],r.push(this.writeByte(e));return r},t}(),Je=function(){var t;function e(t){var e,i,n;for(this.scalarType=t.readInt(),this.tableCount=t.readShort(),this.searchRange=t.readShort(),this.entrySelector=t.readShort(),this.rangeShift=t.readShort(),this.tables={},i=0,n=this.tableCount;0<=n?i<n:i>n;i=0<=n?++i:--i)e={tag:t.readString(4),checksum:t.readInt(),offset:t.readInt(),length:t.readInt()},this.tables[e.tag]=e}return e.prototype.encode=function(e){var i,n,r,o,s,a,h,c,l,u,f,d,p;for(p in f=Object.keys(e).length,a=Math.log(2),l=16*Math.floor(Math.log(f)/a),o=Math.floor(l/a),c=16*f-l,(n=new Ke).writeInt(this.scalarType),n.writeShort(f),n.writeShort(l),n.writeShort(o),n.writeShort(c),r=16*f,h=n.pos+r,s=null,d=[],e)for(u=e[p],n.writeString(p),n.writeInt(t(u)),n.writeInt(h),n.writeInt(u.length),d=d.concat(u),"head"===p&&(s=h),h+=u.length;h%4;)d.push(0),h++;return n.write(d),i=2981146554-t(n.data),n.pos=s+8,n.writeUInt32(i),n.data},t=function(t){var e,i,n,r;for(t=ci.call(t);t.length%4;)t.push(0);for(n=new Ke(t),i=0,e=0,r=t.length;e<r;e=e+=4)i+=n.readUInt32();return 4294967295&i},e}(),Ze={}.hasOwnProperty,$e=function(t,e){for(var i in e)Ze.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};Ye=function(){function t(t){var e;this.file=t,e=this.file.directory.tables[this.tag],this.exists=!!e,e&&(this.offset=e.offset,this.length=e.length,this.parse(this.file.contents))}return t.prototype.parse=function(){},t.prototype.encode=function(){},t.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},t}();var Qe=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="head",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},e.prototype.encode=function(t){var e;return(e=new Ke).writeInt(this.version),e.writeInt(this.revision),e.writeInt(this.checkSumAdjustment),e.writeInt(this.magicNumber),e.writeShort(this.flags),e.writeShort(this.unitsPerEm),e.writeLongLong(this.created),e.writeLongLong(this.modified),e.writeShort(this.xMin),e.writeShort(this.yMin),e.writeShort(this.xMax),e.writeShort(this.yMax),e.writeShort(this.macStyle),e.writeShort(this.lowestRecPPEM),e.writeShort(this.fontDirectionHint),e.writeShort(t),e.writeShort(this.glyphDataFormat),e.data},e}(),ti=function(){function t(t,e){var i,n,r,o,s,a,h,c,l,u,f,d,p,g,m,v,y;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=e+t.readInt(),l=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=3===this.platformID&&1===this.encodingID&&4===this.format||0===this.platformID&&4===this.format,this.codeMap={},this.format){case 0:for(a=0;a<256;++a)this.codeMap[a]=t.readByte();break;case 4:for(f=t.readUInt16(),u=f/2,t.pos+=6,r=function(){var e,i;for(i=[],a=e=0;0<=u?e<u:e>u;a=0<=u?++e:--e)i.push(t.readUInt16());return i}(),t.pos+=2,p=function(){var e,i;for(i=[],a=e=0;0<=u?e<u:e>u;a=0<=u?++e:--e)i.push(t.readUInt16());return i}(),h=function(){var e,i;for(i=[],a=e=0;0<=u?e<u:e>u;a=0<=u?++e:--e)i.push(t.readUInt16());return i}(),c=function(){var e,i;for(i=[],a=e=0;0<=u?e<u:e>u;a=0<=u?++e:--e)i.push(t.readUInt16());return i}(),n=(this.length-t.pos+this.offset)/2,s=function(){var e,i;for(i=[],a=e=0;0<=n?e<n:e>n;a=0<=n?++e:--e)i.push(t.readUInt16());return i}(),a=m=0,y=r.length;m<y;a=++m)for(g=r[a],i=v=d=p[a];d<=g?v<=g:v>=g;i=d<=g?++v:--v)0===c[a]?o=i+h[a]:0!==(o=s[c[a]/2+(i-d)-(u-a)]||0)&&(o+=h[a]),this.codeMap[i]=65535&o}t.pos=l}return t.encode=function(t,e){var i,n,r,o,s,a,h,c,l,u,f,d,p,g,m,v,y,b,w,x,_,S,C,A,L,P,T,O,k,N,j,F,E,I,M,D,B,R,z,q,U,W,H,V,G,X;switch(O=new Ke,o=Object.keys(t).sort((function(t,e){return t-e})),e){case"macroman":for(p=0,g=function(){var t=[];for(d=0;d<256;++d)t.push(0);return t}(),v={0:0},r={},k=0,E=o.length;k<E;k++)null==v[H=t[n=o[k]]]&&(v[H]=++p),r[n]={old:t[n],new:v[t[n]]},g[n]=v[t[n]];return O.writeUInt16(1),O.writeUInt16(0),O.writeUInt32(12),O.writeUInt16(0),O.writeUInt16(262),O.writeUInt16(0),O.write(g),{charMap:r,subtable:O.data,maxGlyphID:p+1};case"unicode":for(P=[],l=[],y=0,v={},i={},m=h=null,N=0,I=o.length;N<I;N++)null==v[w=t[n=o[N]]]&&(v[w]=++y),i[n]={old:w,new:v[w]},s=v[w]-n,null!=m&&s===h||(m&&l.push(m),P.push(n),h=s),m=n;for(m&&l.push(m),l.push(65535),P.push(65535),A=2*(C=P.length),S=2*Math.pow(Math.log(C)/Math.LN2,2),u=Math.log(S/2)/Math.LN2,_=2*C-S,a=[],x=[],f=[],d=j=0,M=P.length;j<M;d=++j){if(L=P[d],c=l[d],65535===L){a.push(0),x.push(0);break}if(L-(T=i[L].new)>=32768)for(a.push(0),x.push(2*(f.length+C-d)),n=F=L;L<=c?F<=c:F>=c;n=L<=c?++F:--F)f.push(i[n].new);else a.push(T-L),x.push(0)}for(O.writeUInt16(3),O.writeUInt16(1),O.writeUInt32(12),O.writeUInt16(4),O.writeUInt16(16+8*C+2*f.length),O.writeUInt16(0),O.writeUInt16(A),O.writeUInt16(S),O.writeUInt16(u),O.writeUInt16(_),U=0,D=l.length;U<D;U++)n=l[U],O.writeUInt16(n);for(O.writeUInt16(0),W=0,B=P.length;W<B;W++)n=P[W],O.writeUInt16(n);for(V=0,R=a.length;V<R;V++)s=a[V],O.writeUInt16(s);for(G=0,z=x.length;G<z;G++)b=x[G],O.writeUInt16(b);for(X=0,q=f.length;X<q;X++)p=f[X],O.writeUInt16(p);return{charMap:i,subtable:O.data,maxGlyphID:y+1}}},t}(),ei=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="cmap",e.prototype.parse=function(t){var e,i,n;for(t.pos=this.offset,this.version=t.readUInt16(),n=t.readUInt16(),this.tables=[],this.unicode=null,i=0;0<=n?i<n:i>n;i=0<=n?++i:--i)e=new ti(t,this.offset),this.tables.push(e),e.isUnicode&&null==this.unicode&&(this.unicode=e);return!0},e.encode=function(t,e){var i,n;return null==e&&(e="macroman"),i=ti.encode(t,e),(n=new Ke).writeUInt16(0),n.writeUInt16(1),i.table=n.data.concat(i.subtable),i},e}(),ii=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="hhea",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},e}(),ni=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="OS/2",e.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=function(){var e,i;for(i=[],e=0;e<10;++e)i.push(t.readByte());return i}(),this.charRange=function(){var e,i;for(i=[],e=0;e<4;++e)i.push(t.readInt());return i}(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=function(){var e,i;for(i=[],e=0;e<2;e=++e)i.push(t.readInt());return i}(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},e}(),ri=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="post",e.prototype.parse=function(t){var e,i,n;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:var r;for(i=t.readUInt16(),this.glyphNameIndex=[],r=0;0<=i?r<i:r>i;r=0<=i?++r:--r)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],n=[];t.pos<this.offset+this.length;)e=t.readByte(),n.push(this.names.push(t.readString(e)));return n;case 151552:return i=t.readUInt16(),this.offsets=t.read(i);case 262144:return this.map=function(){var e,i,n;for(n=[],r=e=0,i=this.file.maxp.numGlyphs;0<=i?e<i:e>i;r=0<=i?++e:--e)n.push(t.readUInt32());return n}.call(this)}},e}(),oi=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},si=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="name",e.prototype.parse=function(t){var e,i,n,r,o,s,a,h,c,l,u;for(t.pos=this.offset,t.readShort(),e=t.readShort(),s=t.readShort(),i=[],r=0;0<=e?r<e:r>e;r=0<=e?++r:--r)i.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+s+t.readShort()});for(a={},r=c=0,l=i.length;c<l;r=++c)n=i[r],t.pos=n.offset,h=t.readString(n.length),o=new oi(h,n),null==a[u=n.nameID]&&(a[u]=[]),a[n.nameID].push(o);this.strings=a,this.copyright=a[0],this.fontFamily=a[1],this.fontSubfamily=a[2],this.uniqueSubfamily=a[3],this.fontName=a[4],this.version=a[5];try{this.postscriptName=a[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch(t){this.postscriptName=a[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=a[7],this.manufacturer=a[8],this.designer=a[9],this.description=a[10],this.vendorUrl=a[11],this.designerUrl=a[12],this.license=a[13],this.licenseUrl=a[14],this.preferredFamily=a[15],this.preferredSubfamily=a[17],this.compatibleFull=a[18],this.sampleText=a[19]},e}(),ai=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="maxp",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.numGlyphs=t.readUInt16(),this.maxPoints=t.readUInt16(),this.maxContours=t.readUInt16(),this.maxCompositePoints=t.readUInt16(),this.maxComponentContours=t.readUInt16(),this.maxZones=t.readUInt16(),this.maxTwilightPoints=t.readUInt16(),this.maxStorage=t.readUInt16(),this.maxFunctionDefs=t.readUInt16(),this.maxInstructionDefs=t.readUInt16(),this.maxStackElements=t.readUInt16(),this.maxSizeOfInstructions=t.readUInt16(),this.maxComponentElements=t.readUInt16(),this.maxComponentDepth=t.readUInt16()},e}(),hi=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="hmtx",e.prototype.parse=function(t){var e,i,n,r,o,s,a;for(t.pos=this.offset,this.metrics=[],e=0,s=this.file.hhea.numberOfMetrics;0<=s?e<s:e>s;e=0<=s?++e:--e)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(n=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var i,r;for(r=[],e=i=0;0<=n?i<n:i>n;e=0<=n?++i:--i)r.push(t.readInt16());return r}(),this.widths=function(){var t,e,i,n;for(n=[],t=0,e=(i=this.metrics).length;t<e;t++)r=i[t],n.push(r.advance);return n}.call(this),i=this.widths[this.widths.length-1],a=[],e=o=0;0<=n?o<n:o>n;e=0<=n?++o:--o)a.push(this.widths.push(i));return a},e.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},e}(),ci=[].slice,li=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var e,i,n,r,o,s,a,h,c,l;return t in this.cache?this.cache[t]:(r=this.file.loca,e=this.file.contents,i=r.indexOf(t),0===(n=r.lengthOf(t))?this.cache[t]=null:(e.pos=this.offset+i,o=(s=new Ke(e.read(n))).readShort(),h=s.readShort(),l=s.readShort(),a=s.readShort(),c=s.readShort(),this.cache[t]=-1===o?new fi(s,h,l,a,c):new ui(s,o,h,l,a,c),this.cache[t]))},e.prototype.encode=function(t,e,i){var n,r,o,s,a;for(o=[],r=[],s=0,a=e.length;s<a;s++)n=t[e[s]],r.push(o.length),n&&(o=o.concat(n.encode(i)));return r.push(o.length),{table:o,offsets:r}},e}(),ui=function(){function t(t,e,i,n,r,o){this.raw=t,this.numberOfContours=e,this.xMin=i,this.yMin=n,this.xMax=r,this.yMax=o,this.compound=!1}return t.prototype.encode=function(){return this.raw.data},t}(),fi=function(){function t(t,e,i,n,r){var o,s;for(this.raw=t,this.xMin=e,this.yMin=i,this.xMax=n,this.yMax=r,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;s=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&s;)o.pos+=1&s?4:2,128&s?o.pos+=8:64&s?o.pos+=4:8&s&&(o.pos+=2)}return t.prototype.encode=function(){var t,e,i;for(e=new Ke(ci.call(this.raw.data)),t=0,i=this.glyphIDs.length;t<i;++t)e.pos=this.glyphOffsets[t];return e.data},t}(),di=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return $e(e,Ye),e.prototype.tag="loca",e.prototype.parse=function(t){var e,i;return t.pos=this.offset,e=this.file.head.indexToLocFormat,this.offsets=0===e?function(){var e,n;for(n=[],i=0,e=this.length;i<e;i+=2)n.push(2*t.readUInt16());return n}.call(this):function(){var e,n;for(n=[],i=0,e=this.length;i<e;i+=4)n.push(t.readUInt32());return n}.call(this)},e.prototype.indexOf=function(t){return this.offsets[t]},e.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},e.prototype.encode=function(t,e){for(var i=new Uint32Array(this.offsets.length),n=0,r=0,o=0;o<i.length;++o)if(i[o]=n,r<e.length&&e[r]==o){++r,i[o]=n;var s=this.offsets[o],a=this.offsets[o+1]-s;a>0&&(n+=a)}for(var h=new Array(4*i.length),c=0;c<i.length;++c)h[4*c+3]=255&i[c],h[4*c+2]=(65280&i[c])>>8,h[4*c+1]=(16711680&i[c])>>16,h[4*c]=(4278190080&i[c])>>24;return h},e}(),pi=function(){function t(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var t,e,i,n,r;for(e in n=this.font.cmap.tables[0].codeMap,t={},r=this.subset)i=r[e],t[e]=n[i];return t},t.prototype.glyphsFor=function(t){var e,i,n,r,o,s,a;for(n={},o=0,s=t.length;o<s;o++)n[r=t[o]]=this.font.glyf.glyphFor(r);for(r in e=[],n)(null!=(i=n[r])?i.compound:void 0)&&e.push.apply(e,i.glyphIDs);if(e.length>0)for(r in a=this.glyphsFor(e))i=a[r],n[r]=i;return n},t.prototype.encode=function(t,e){var i,n,r,o,s,a,h,c,l,u,f,d,p,g,m;for(n in i=ei.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(t),f={0:0},m=i.charMap)f[(a=m[n]).old]=a.new;for(d in u=i.maxGlyphID,o)d in f||(f[d]=u++);return c=function(t){var e,i;for(e in i={},t)i[t[e]]=e;return i}(f),l=Object.keys(c).sort((function(t,e){return t-e})),p=function(){var t,e,i;for(i=[],t=0,e=l.length;t<e;t++)s=l[t],i.push(c[s]);return i}(),r=this.font.glyf.encode(o,p,f),h=this.font.loca.encode(r.offsets,p),g={cmap:this.font.cmap.raw(),glyf:r.table,loca:h,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(e)},this.font.os2.exists&&(g["OS/2"]=this.font.os2.raw()),this.font.directory.encode(g)},t}();Ot.API.PDFObject=function(){var t;function e(){}return t=function(t,e){return(Array(e+1).join("0")+t).slice(-e)},e.convert=function(i){var n,r,o,s;if(Array.isArray(i))return"["+function(){var t,r,o;for(o=[],t=0,r=i.length;t<r;t++)n=i[t],o.push(e.convert(n));return o}().join(" ")+"]";if("string"==typeof i)return"/"+i;if(null!=i?i.isString:void 0)return"("+i+")";if(i instanceof Date)return"(D:"+t(i.getUTCFullYear(),4)+t(i.getUTCMonth(),2)+t(i.getUTCDate(),2)+t(i.getUTCHours(),2)+t(i.getUTCMinutes(),2)+t(i.getUTCSeconds(),2)+"Z)";if("[object Object]"==={}.toString.call(i)){for(r in o=["<<"],i)s=i[r],o.push("/"+r+" "+e.convert(s));return o.push(">>"),o.join("\n")}return""+i},e}();const gi=Ot},722:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(t){this.color="#535353",this.map=t,this.mapResize=this.mapResize.bind(this)}create(){this.updateValues(),void 0!==this.map?(this.map.on("resize",this.mapResize),this.createCanvas(this.map.getCanvasContainer())):console.error("map object is null")}updateValues(){var t,e;this.width=null===(t=this.map)||void 0===t?void 0:t.getCanvas().clientWidth,this.height=null===(e=this.map)||void 0===e?void 0:e.getCanvas().clientHeight}mapResize(){this.updateValues(),this.updateCanvas()}updateCanvas(){if(void 0!==this.svgCanvas&&void 0!==this.yLine&&void 0!==this.xLine&&void 0!==this.width&&void 0!==this.height){this.svgCanvas.setAttribute("width",`${this.width}px`),this.svgCanvas.setAttribute("height",`${this.height}px`);const t=this.width/2,e=this.height/2;this.yLine.setAttribute("x1",`${t}px`),this.yLine.setAttribute("y1","0px"),this.yLine.setAttribute("x2",`${t}px`),this.yLine.setAttribute("y2",`${this.height}px`),this.xLine.setAttribute("x1","0px"),this.xLine.setAttribute("y1",`${e}px`),this.xLine.setAttribute("x2",`${this.width}px`),this.xLine.setAttribute("y2",`${e}px`)}else console.error("element value is null")}createCanvas(t){if(void 0!==this.width&&void 0!==this.height){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.style.position="relative",e.setAttribute("width",`${this.width}px`),e.setAttribute("height",`${this.height}px`);const i=this.width/2,n=this.height/2;this.yLine=e.appendChild(this.createLine(i,0,i,this.height,this.color,"2px")),this.xLine=e.appendChild(this.createLine(0,n,this.width,n,this.color,"2px")),null==t||t.appendChild(e),this.svgCanvas=e}}createLine(t,e,i,n,r,o){const s=document.createElementNS("http://www.w3.org/2000/svg","line");return s.setAttribute("x1",t),s.setAttribute("y1",e),s.setAttribute("x2",i),s.setAttribute("y2",n),s.setAttribute("stroke-dasharray","5,5"),s.setAttribute("stroke",r),s.setAttribute("stroke-width",o),s}destroy(){void 0!==this.xLine&&(this.xLine.remove(),this.xLine=void 0),void 0!==this.yLine&&(this.yLine.remove(),this.yLine=void 0),void 0!==this.svgCanvas&&(this.svgCanvas.remove(),this.svgCanvas=void 0),void 0!==this.map&&(this.map.off("resize",this.mapResize),this.map=void 0)}}},2337:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(722),r=i(8098),o=i(7476),s=i(3927);e.default=class{constructor(t){this.options={PageSize:s.Size.A4,PageOrientation:s.PageOrientation.Landscape,Format:s.Format.PDF,DPI:s.DPI[300],Crosshair:!1,PrintableArea:!1,accessToken:void 0},t&&(this.options=Object.assign(this.options,t)),this.onDocumentClick=this.onDocumentClick.bind(this)}getDefaultPosition(){return"top-right"}getTranslation(){switch(this.options.Local){case"de":return o.german;case"en":default:return o.english;case"fr":return o.french;case"fi":return o.finnish;case"sv":return o.swedish;case"vi":return o.vietnam;case"uk":return o.ukranian;case"zhHans":return o.zhHans;case"zhHant":return o.zhHant}}onAdd(t){this.map=t,this.controlContainer=document.createElement("div"),this.controlContainer.classList.add("mapboxgl-ctrl"),this.controlContainer.classList.add("mapboxgl-ctrl-group"),this.exportContainer=document.createElement("div"),this.exportContainer.classList.add("mapboxgl-export-list"),this.exportButton=document.createElement("button"),this.exportButton.classList.add("mapboxgl-ctrl-icon"),this.exportButton.classList.add("mapboxgl-export-control"),this.exportButton.type="button",this.exportButton.addEventListener("click",(()=>{this.exportButton.style.display="none",this.exportContainer.style.display="block",this.toggleCrosshair(!0),this.togglePrintableArea(!0)})),document.addEventListener("click",this.onDocumentClick),this.controlContainer.appendChild(this.exportButton),this.controlContainer.appendChild(this.exportContainer);const e=document.createElement("TABLE");e.className="print-table";const i=this.createSelection(s.Size,this.getTranslation().PageSize,"page-size",this.options.PageSize,((t,e)=>JSON.stringify(t[e])));e.appendChild(i);const n=this.createSelection(s.PageOrientation,this.getTranslation().PageOrientation,"page-orientaiton",this.options.PageOrientation,((t,e)=>t[e]));e.appendChild(n);const r=this.createSelection(s.Format,this.getTranslation().Format,"format-type",this.options.Format,((t,e)=>t[e]));e.appendChild(r);const o=this.createSelection(s.DPI,this.getTranslation().DPI,"dpi-type",this.options.DPI,((t,e)=>t[e]));e.appendChild(o),this.exportContainer.appendChild(e);const a=document.createElement("button");return a.type="button",a.textContent=this.getTranslation().Generate,a.classList.add("generate-button"),a.addEventListener("click",(()=>{const e=document.getElementById("mapbox-gl-export-page-size"),i=document.getElementById("mapbox-gl-export-page-orientaiton"),n=document.getElementById("mapbox-gl-export-format-type"),r=document.getElementById("mapbox-gl-export-dpi-type"),o=i.value;let a=JSON.parse(e.value);o===s.PageOrientation.Portrait&&(a=a.reverse()),new s.default(t,a,Number(r.value),n.value,s.Unit.mm,this.options.accessToken).generate()})),this.exportContainer.appendChild(a),this.controlContainer}createSelection(t,e,i,n,r){const o=document.createElement("label");o.textContent=e;const s=document.createElement("select");s.setAttribute("id",`mapbox-gl-export-${i}`),s.style.width="100%",Object.keys(t).forEach((e=>{const o=document.createElement("option");o.setAttribute("value",r(t,e)),o.appendChild(document.createTextNode(e)),o.setAttribute("name",i),n===t[e]&&(o.selected=!0),s.appendChild(o)})),s.addEventListener("change",(()=>{this.updatePrintableArea()}));const a=document.createElement("TR"),h=document.createElement("TD"),c=document.createElement("TD");return h.appendChild(o),c.appendChild(s),a.appendChild(h),a.appendChild(c),a}onRemove(){this.controlContainer&&this.controlContainer.parentNode&&this.map&&this.exportButton&&(this.exportButton.removeEventListener("click",this.onDocumentClick),this.controlContainer.parentNode.removeChild(this.controlContainer),document.removeEventListener("click",this.onDocumentClick),void 0!==this.crosshair&&(this.crosshair.destroy(),this.crosshair=void 0),this.map=void 0)}onDocumentClick(t){this.controlContainer&&!this.controlContainer.contains(t.target)&&this.exportContainer&&this.exportButton&&(this.exportContainer.style.display="none",this.exportButton.style.display="block",this.toggleCrosshair(!1),this.togglePrintableArea(!1))}toggleCrosshair(t){!0===this.options.Crosshair&&(!1===t?void 0!==this.crosshair&&(this.crosshair.destroy(),this.crosshair=void 0):(this.crosshair=new n.default(this.map),this.crosshair.create()))}togglePrintableArea(t){!0===this.options.PrintableArea&&(!1===t?void 0!==this.printableArea&&(this.printableArea.destroy(),this.printableArea=void 0):(this.printableArea=new r.default(this.map),this.updatePrintableArea()))}updatePrintableArea(){if(void 0===this.printableArea)return;const t=document.getElementById("mapbox-gl-export-page-size"),e=document.getElementById("mapbox-gl-export-page-orientaiton").value;let i=JSON.parse(t.value);e===s.PageOrientation.Portrait&&(i=i.reverse()),this.printableArea.updateArea(i[0],i[1])}}},2868:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"Papierformat",PageOrientation:"Papierausrichtung",Format:"Dateiformat",DPI:"Druckauflösung",Generate:"Erstellen"}},8261:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"Page Size",PageOrientation:"Page Orientation",Format:"Format",DPI:"DPI",Generate:"Generate"}},497:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"Sivukoko",PageOrientation:"Sivun suunta",Format:"Muoto",DPI:"DPI",Generate:"Generoi"}},3722:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"Taille de page",PageOrientation:"Orientation de la page",Format:"Format",DPI:"DPI",Generate:"Générer"}},7476:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.zhHant=e.zhHans=e.ukranian=e.vietnam=e.swedish=e.german=e.finnish=e.french=e.english=void 0;const n=i(8261);e.english=n.default;const r=i(3722);e.french=r.default;const o=i(497);e.finnish=o.default;const s=i(2868);e.german=s.default;const a=i(2822);e.swedish=a.default;const h=i(6167);e.vietnam=h.default;const c=i(44);e.ukranian=c.default;const l=i(7039);e.zhHans=l.default;const u=i(7441);e.zhHant=u.default},2822:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"Sidstorlek",PageOrientation:"Sidorientering",Format:"Format",DPI:"DPI",Generate:"Generera"}},44:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"Розмір сторінки",PageOrientation:"Орієнтація сторінки",Format:"Формат",DPI:"DPI",Generate:"Згенерувати"}},6167:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"Kích thước trang",PageOrientation:"Loại trang",Format:"Định dạng",DPI:"Mật độ điểm ảnh (DPI)",Generate:"Tạo"}},7039:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"页面大小",PageOrientation:"页面方向",Format:"格式",DPI:"像素",Generate:"导出"}},7441:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={PageSize:"頁面大小",PageOrientation:"頁面方向",Format:"格式",DPI:"像素",Generate:"導出"}},3927:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DPI=e.PageOrientation=e.Size=e.Unit=e.Format=void 0;const n=i(1168),r=i(3162),o=i(6640);i(4245);const s=i(2777);e.Format={JPEG:"jpg",PNG:"png",PDF:"pdf",SVG:"svg"},e.Unit={in:"in",mm:"mm"},e.Size={LETTER:[279,216],A2:[594,420],A3:[420,297],A4:[297,210],A5:[210,148],A6:[148,105],B2:[707,500],B3:[500,353],B4:[353,250],B5:[250,176],B6:[176,125]},e.PageOrientation={Landscape:"landscape",Portrait:"portrait"},e.DPI={72:72,96:96,200:200,300:300,400:400},e.default=class{constructor(t,i=e.Size.A4,n=300,r=e.Format.PNG.toString(),o=e.Unit.mm,s){this.map=t,this.width=i[0],this.height=i[1],this.dpi=n,this.format=r,this.unit=o,this.accesstoken=s}generate(){const t=this;JsLoadingOverlay.show({overlayBackgroundColor:"#5D5959",overlayOpacity:"0.6",spinnerIcon:"ball-spin",spinnerColor:"#2400FD",spinnerSize:"2x",overlayIDName:"overlay",spinnerIDName:"spinner",offsetX:0,offsetY:0,containerID:null,lockScroll:!1,overlayZIndex:9998,spinnerZIndex:9999});const i=window.devicePixelRatio;Object.defineProperty(window,"devicePixelRatio",{get:()=>t.dpi/96});const n=document.createElement("div");n.className="hidden-map",document.body.appendChild(n);const r=document.createElement("div");r.style.width=this.toPixels(this.width),r.style.height=this.toPixels(this.height),n.appendChild(r);const s=this.map.getStyle();if(s&&s.sources){const t=s.sources;Object.keys(t).forEach((e=>{const i=t[e];Object.keys(i).forEach((t=>{i[t]||delete i[t]}))}))}const a=new o.Map({accessToken:this.accesstoken||o.accessToken,container:r,style:s,center:this.map.getCenter(),zoom:this.map.getZoom(),bearing:this.map.getBearing(),pitch:this.map.getPitch(),interactive:!1,preserveDrawingBuffer:!0,fadeDuration:0,attributionControl:!1,transformRequest:this.map._requestManager._transformRequestFn}),h=(this.map.style.imageManager||{}).images||[];Object.keys(h).forEach((t=>{a.addImage(t,h[t].data)})),a.once("idle",(()=>{var r;const o=a.getCanvas(),s=`map.${t.format}`;switch(t.format){case e.Format.PNG:t.toPNG(o,s);break;case e.Format.JPEG:t.toJPEG(o,s);break;case e.Format.PDF:t.toPDF(a,s);break;case e.Format.SVG:t.toSVG(o,s);break;default:console.error(`Invalid file format: ${t.format}`)}a.remove(),null===(r=n.parentNode)||void 0===r||r.removeChild(n),Object.defineProperty(window,"devicePixelRatio",{get:()=>i}),JsLoadingOverlay.hide()}))}toPNG(t,e){t.toBlob((t=>{(0,r.saveAs)(t,e)}))}toJPEG(t,e){const i=t.toDataURL("image/jpeg",.85),n=document.createElement("a");n.href=i,n.download=e,n.click(),n.remove()}toPDF(t,e){const i=t.getCanvas(),r=new n.jsPDF({orientation:this.width>this.height?"l":"p",unit:this.unit,compress:!0,format:[this.width,this.height]});r.addImage(i.toDataURL("image/png"),"png",0,0,this.width,this.height,void 0,"FAST");const{lng:o,lat:s}=t.getCenter();r.setProperties({title:t.getStyle().name,subject:`center: [${o}, ${s}], zoom: ${t.getZoom()}`,creator:"Mapbox GL Export Plugin",author:"(c)Mapbox, (c)OpenStreetMap"}),r.save(e)}toSVG(t,e){const i=t.toDataURL("image/png");s.fabric.Image.fromURL(i,(t=>{const i=new s.fabric.Canvas("canvas"),n=Number(this.toPixels(this.width,this.dpi).replace("px","")),r=Number(this.toPixels(this.height,this.dpi).replace("px",""));t.scaleToWidth(n),t.scaleToHeight(r),i.add(t);const o=i.toSVG({x:0,y:0,width:n,height:r,viewBox:{x:0,y:0,width:n,height:r}}),a=document.createElement("a");a.href=`data:application/xml,${encodeURIComponent(o)}`,a.download=e,a.click(),a.remove()}))}toPixels(t,i=96){return this.unit===e.Unit.mm&&(i/=25.4),i*t+"px"}}},8098:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(3927);e.default=class{constructor(t){var e,i,n;if(this.map=t,void 0===this.map)return;this.mapResize=this.mapResize.bind(this),this.map.on("resize",this.mapResize);const r=null===(e=this.map)||void 0===e?void 0:e.getCanvas().clientWidth,o=null===(i=this.map)||void 0===i?void 0:i.getCanvas().clientHeight,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.style.position="absolute",s.style.top="0px",s.style.left="0px",s.setAttribute("width",`${r}px`),s.setAttribute("height",`${o}px`);const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("style","fill:#888888;stroke-width:0"),a.setAttribute("fill-opacity","0.5"),s.append(a),null===(n=this.map)||void 0===n||n.getCanvasContainer().appendChild(s),this.svgCanvas=s,this.svgPath=a}mapResize(){this.generateCutOut()}updateArea(t,e){this.width=t,this.height=e,this.unit=n.Unit.mm,this.generateCutOut()}generateCutOut(){var t,e;if(void 0===this.map||void 0===this.svgCanvas||void 0===this.svgPath)return;const i=this.toPixels(this.width),n=this.toPixels(this.height),r=null===(t=this.map)||void 0===t?void 0:t.getCanvas().clientWidth,o=null===(e=this.map)||void 0===e?void 0:e.getCanvas().clientHeight,s=r/2-i/2,a=s+i,h=o/2-n/2,c=h+n;this.svgCanvas.setAttribute("width",`${r}px`),this.svgCanvas.setAttribute("height",`${o}px`),this.svgPath.setAttribute("d",`M 0 0 L ${r} 0 L ${r} ${o} L 0 ${o} M ${s} ${h} L ${s} ${c} L ${a} ${c} L ${a} ${h}`)}destroy(){void 0!==this.svgCanvas&&(this.svgCanvas.remove(),this.svgCanvas=void 0),void 0!==this.map&&(this.map=void 0)}toPixels(t,e=96){return this.unit===n.Unit.mm&&(e/=25.4),e*t}}},6640:e=>{"use strict";e.exports=t},4960:()=>{},6759:()=>{},6272:()=>{},1002:(t,e,i)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}i.d(e,{Z:()=>n})}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var i=s[t]={exports:{}};return o[t].call(i.exports,i,i.exports,a),i.exports}a.m=o,i=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var r=Object.create(null);a.r(r);var o={};e=e||[null,i({}),i([]),i(i)];for(var s=2&n&&t;"object"==typeof s&&!~e.indexOf(s);s=i(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,a.d(r,o),r},a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,i)=>(a.f[i](t,e),e)),[])),a.u=t=>t+".mapbox-gl-export.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n={},r="@watergis/mapbox-gl-export:",a.l=(t,e,i,o)=>{if(n[t])n[t].push(e);else{var s,h;if(void 0!==i)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var u=c[l];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==r+i){s=u;break}}s||(h=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",r+i),s.src=t),n[t]=[e];var f=(e,i)=>{s.onerror=s.onload=null,clearTimeout(d);var r=n[t];if(delete n[t],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach((t=>t(i))),e)return e(i)},d=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.bind(null,s.onload),h&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");i.length&&(t=i[i.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={179:0};a.f.j=(e,i)=>{var n=a.o(t,e)?t[e]:void 0;if(0!==n)if(n)i.push(n[2]);else{var r=new Promise(((i,r)=>n=t[e]=[i,r]));i.push(n[2]=r);var o=a.p+a.u(e),s=new Error;a.l(o,(i=>{if(a.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var r=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;s.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",s.name="ChunkLoadError",s.type=r,s.request=o,n[1](s)}}),"chunk-"+e,e)}};var e=(e,i)=>{var n,r,[o,s,h]=i,c=0;if(o.some((e=>0!==t[e]))){for(n in s)a.o(s,n)&&(a.m[n]=s[n]);h&&h(a)}for(e&&e(i);c<o.length;c++)r=o[c],a.o(t,r)&&t[r]&&t[r][0](),t[r]=0},i=self.webpackChunk_watergis_mapbox_gl_export=self.webpackChunk_watergis_mapbox_gl_export||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})();var h={};return(()=>{"use strict";var t=h;Object.defineProperty(t,"__esModule",{value:!0}),t.DPI=t.Format=t.PageOrientation=t.Size=t.MapboxExportControl=void 0;var e=a(2337);Object.defineProperty(t,"MapboxExportControl",{enumerable:!0,get:function(){return e.default}});var i=a(3927);Object.defineProperty(t,"Size",{enumerable:!0,get:function(){return i.Size}}),Object.defineProperty(t,"PageOrientation",{enumerable:!0,get:function(){return i.PageOrientation}}),Object.defineProperty(t,"Format",{enumerable:!0,get:function(){return i.Format}}),Object.defineProperty(t,"DPI",{enumerable:!0,get:function(){return i.DPI}})})(),h})()));
|