paper 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +252 -0
- package/README.md +3 -1
- package/dist/docs/assets/js/paper.js +6997 -1658
- package/dist/docs/classes/AreaText.html +8658 -0
- package/dist/docs/classes/ChangeFlag.html +2 -1
- package/dist/docs/classes/Color.html +2 -1
- package/dist/docs/classes/CompoundPath.html +152 -67
- package/dist/docs/classes/Curve.html +2 -1
- package/dist/docs/classes/CurveLocation.html +2 -1
- package/dist/docs/classes/Event.html +5 -4
- package/dist/docs/classes/Gradient.html +2 -1
- package/dist/docs/classes/GradientStop.html +2 -1
- package/dist/docs/classes/Group.html +117 -15
- package/dist/docs/classes/HitResult.html +2 -1
- package/dist/docs/classes/HostItem.html +80 -15
- package/dist/docs/classes/Item.html +137 -15
- package/dist/docs/classes/Key.html +2 -1
- package/dist/docs/classes/KeyEvent.html +5 -4
- package/dist/docs/classes/Layer.html +114 -15
- package/dist/docs/classes/Matrix.html +2 -1
- package/dist/docs/classes/MouseEvent.html +5 -4
- package/dist/docs/classes/PaperScope.html +4 -2
- package/dist/docs/classes/PaperScript.html +5 -2
- package/dist/docs/classes/Path.html +126 -67
- package/dist/docs/classes/PathItem.html +270 -185
- package/dist/docs/classes/PathText.html +8528 -0
- package/dist/docs/classes/Point.html +13 -2
- package/dist/docs/classes/PointText.html +1346 -59
- package/dist/docs/classes/Project.html +40 -7
- package/dist/docs/classes/Raster.html +80 -15
- package/dist/docs/classes/Rectangle.html +3 -2
- package/dist/docs/classes/Segment.html +2 -1
- package/dist/docs/classes/Shape.html +80 -15
- package/dist/docs/classes/Size.html +4 -2
- package/dist/docs/classes/Style.html +767 -14
- package/dist/docs/classes/SymbolDefinition.html +2 -1
- package/dist/docs/classes/SymbolItem.html +80 -15
- package/dist/docs/classes/TextItem.html +1469 -179
- package/dist/docs/classes/TextRange.html +186 -0
- package/dist/docs/classes/TextStory.html +355 -0
- package/dist/docs/classes/Tool.html +2 -1
- package/dist/docs/classes/ToolEvent.html +57 -4
- package/dist/docs/classes/Tween.html +17 -1
- package/dist/docs/classes/View.html +9 -8
- package/dist/docs/classes/global.html +2 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/paper-core.js +6832 -1637
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +6997 -1658
- package/dist/paper-full.min.js +3 -3
- package/dist/{paper-sourced.js → paper-hosted.js} +7109 -1682
- package/dist/paper.d.ts +1727 -163
- package/examples/Scripts/AreaText.html +65 -0
- package/examples/Scripts/PathText.html +48 -0
- package/examples/Scripts/TextRanges.html +51 -0
- package/package.json +3 -2
package/dist/paper-core.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Paper.js v0.
|
|
2
|
+
* Paper.js v0.15.0 - The Swiss Army Knife of Vector Graphics Scripting.
|
|
3
3
|
* http://paperjs.org/
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* All rights reserved.
|
|
11
11
|
*
|
|
12
|
-
* Date:
|
|
12
|
+
* Date: Wed Oct 21 15:44:40 2026 +0200
|
|
13
13
|
*
|
|
14
14
|
***
|
|
15
15
|
*
|
|
@@ -29,4 +29,4 @@
|
|
|
29
29
|
* created by Marijn Haverbeke and released under an MIT license.
|
|
30
30
|
*
|
|
31
31
|
*/
|
|
32
|
-
var paper=function(u,j){var f=(u=u||require("./node/self.js")).window,k=u.document;f&&!k.createElement("canvas").getContext("2d")&&(f=null);var D=new function(){function n(t,e,n){var i;return t&&((i=d(t,"length"))&&"number"==typeof i.value?s:function(t,e){for(var n in this)this.hasOwnProperty(n)&&t.call(e,this[n],n,this)}).call(t,e,n=n||t),n}var r=/^(statics|enumerable|beans|preserve)$/,t=[],i=t.slice,a=Object.create,d=Object.getOwnPropertyDescriptor,f=Object.defineProperty,s=t.forEach||function(t,e){for(var n=0,i=this.length;n<i;n++)t.call(e,this[n],n,this)},o=Object.assign||function(t){for(var e=1,n=arguments.length;e<n;e++){var i,r=arguments[e];for(i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}return t};function h(a,o,h,u,l){var c={};function t(t,e){var n,i="function"==typeof(e="string"==typeof(e=e||(e=d(o,t))&&(e.get?e:e.value))&&"#"===e[0]?a[e.substring(1)]||e:e),r=e,s=l||i&&!e.base?e&&e.get?t in a:a[t]:null;l&&s||(i&&s&&(e.base=s),i&&!1!==u&&(n=t.match(/^([gs]et|is)(([A-Z])(.*))$/))&&(c[n[3].toLowerCase()+n[4]]=n[2]),r&&!i&&r.get&&"function"==typeof r.get&&_.isPlainObject(r)||(r={value:r,writable:!0}),(d(a,t)||{configurable:!0}).configurable&&(r.configurable=!0,r.enumerable=null!=h?h:!n),f(a,t,r))}if(o){for(var e in o)o.hasOwnProperty(e)&&!r.test(e)&&t(e);for(var e in c){var n=c[e],i=a["set"+n],n=a["get"+n]||i&&a["is"+n];!n||!0!==u&&0!==n.length||t(e,{get:n,set:i})}}return a}function _(){for(var t=0,e=arguments.length;t<e;t++){var n=arguments[t];n&&o(this,n)}return this}return h(_,{inject:function(t){var e,n,i;t&&(e=!0===t.statics?t:t.statics,n=t.beans,i=t.preserve,e!==t&&h(this.prototype,t,t.enumerable,n,i),h(this,e,null,n,i));for(var r=1,s=arguments.length;r<s;r++)this.inject(arguments[r]);return this},extend:function(){for(var t,e,n,i=this,r=0,s=arguments.length;r<s&&(!t||!e);r++)n=arguments[r],t=t||n.initialize,e=e||n.prototype;return e=(t=t||function(){i.apply(this,arguments)}).prototype=e||a(this.prototype),f(e,"constructor",{value:t,writable:!0,configurable:!0}),h(t,this),arguments.length&&this.inject.apply(t,arguments),t.base=i,t}}).inject({enumerable:!1,initialize:_,set:_,inject:function(){for(var t=0,e=arguments.length;t<e;t++){var n=arguments[t];n&&h(this,n,n.enumerable,n.beans,n.preserve)}return this},extend:function(){var t=a(this);return t.inject.apply(t,arguments)},each:function(t,e){return n(this,t,e)},clone:function(){return new this.constructor(this)},statics:{set:o,each:n,create:a,define:f,describe:d,clone:function(t){return o(new t.constructor,t)},isPlainObject:function(t){t=null!=t&&t.constructor;return t&&(t===Object||t===_||"Object"===t.name)},pick:function(t,e){return t!==j?t:e},slice:function(t,e,n){return i.call(t,e,n)}}})};"undefined"!=typeof module&&(module.exports=D),D.inject({enumerable:!1,toString:function(){return null!=this._id?(this._class||"Object")+(this._name?" '"+this._name+"'":" @"+this._id):"{ "+D.each(this,function(t,e){/^_/.test(e)||this.push(e+": "+("number"==(e=typeof t)?x.instance.number(t):"string"==e?"'"+t+"'":t))},[]).join(", ")+" }"},getClassName:function(){return this._class||""},importJSON:function(t){return D.importJSON(t,this)},exportJSON:function(t){return D.exportJSON(this,t)},toJSON:function(){return D.serialize(this)},set:function(t,e){return t&&D.filter(this,t,e,this._prioritize),this}},{beans:!1,statics:{exports:{},extend:function t(){var e=t.base.apply(this,arguments),n=e.prototype._class;return n&&!D.exports[n]&&(D.exports[n]=e),e},equals:function(t,e){if(t===e)return!0;if(t&&t.equals)return t.equals(e);if(e&&e.equals)return e.equals(t);if(t&&e&&"object"==typeof t&&"object"==typeof e){if(Array.isArray(t)&&Array.isArray(e)){if((n=t.length)!==e.length)return!1;for(;n--;)if(!D.equals(t[n],e[n]))return!1}else{var n,i=Object.keys(t);if((n=i.length)!==Object.keys(e).length)return!1;for(;n--;){var r=i[n];if(!e.hasOwnProperty(r)||!D.equals(t[r],e[r]))return!1}}return!0}return!1},read:function(t,e,n,i){if(this===D){var r=this.peek(t,e);return t.__index++,r}var s=this.prototype,a=s._readIndex,o=e||a&&t.__index||0,r=t.length,e=t[o];return i=i||r-o,e instanceof this||n&&n.readNull&&null==e&&i<=1?(a&&(t.__index=o+1),e&&n&&n.clone?e.clone():e):(e=D.create(s),a&&(e.__read=!0),e=e.initialize.apply(e,0<o||o+i<r?D.slice(t,o,o+i):t)||e,a&&(t.__index=o+e.__read,(o=e.__filtered)&&(t.__filtered=o,e.__filtered=j),e.__read=j),e)},peek:function(t,e){return t[t.__index=e||t.__index||0]},remain:function(t){return t.length-(t.__index||0)},readList:function(t,e,n,i){for(var r,s=[],e=e||0,a=i?e+i:t.length,o=e;o<a;o++)s.push(Array.isArray(r=t[o])?this.read(r,0,n):this.read(t,o,n,1));return s},readNamed:function(t,e,n,i,r){var s,a,o=this.getNamed(t,e),h=o!==j;return h&&((a=t.__filtered)||(s=this.getSource(t),(a=t.__filtered=D.create(s)).__unfiltered=s),a[e]=j),this.read(h?[o]:t,n,i,r)},readSupported:function(n,i){var t=this.getSource(n),r=this,s=!1;return t&&Object.keys(t).forEach(function(t){var e;t in i&&((e=r.readNamed(n,t))!==j&&(i[t]=e),s=!0)}),s},getSource:function(t){var e,n=t.__source;return n===j&&(e=1===t.length&&t[0],n=t.__source=e&&D.isPlainObject(e)?e:null),n},getNamed:function(t,e){var n=this.getSource(t);if(n)return e?n[e]:t.__filtered||n},hasNamed:function(t,e){return!!this.getNamed(t,e)},filter:function(n,i,r,t){var s;function e(t){var e;r&&t in r||s&&t in s||(e=i[t])!==j&&(n[t]=e)}if(t){for(var a,o={},h=0,u=t.length;h<u;h++)(a=t[h])in i&&(e(a),o[a]=!0);s=o}return Object.keys(i.__unfiltered||i).forEach(e),n},isPlainValue:function(t,e){return D.isPlainObject(t)||Array.isArray(t)||e&&"string"==typeof t},serialize:function(t,e,n,i){e=e||{};var r=!i;if(r&&(e.formatter=new x(e.precision),i={length:0,definitions:{},references:{},add:function(t,e){var n="#"+t._id,i=this.references[n];return i||(this.length++,e=e.call(t),(t=t._class)&&e[0]!==t&&e.unshift(t),this.definitions[n]=e,i=this.references[n]=[n]),i}}),t&&t._serialize){var s=t._serialize(e,i),a=t._class;!a||t._compactSerialize||!r&&n||s[0]===a||s.unshift(a)}else if(Array.isArray(t)){s=[];for(var o=0,h=t.length;o<h;o++)s[o]=D.serialize(t[o],e,n,i)}else if(D.isPlainObject(t)){s={};for(var u=Object.keys(t),o=0,h=u.length;o<h;o++){var l=u[o];s[l]=D.serialize(t[l],e,n,i)}}else s="number"==typeof t?e.formatter.number(t,e.precision):t;return r&&0<i.length?[["dictionary",i.definitions],s]:s},deserialize:function(t,e,n,i,r){var s=t,a=!n,o=a&&t&&t.length&&"dictionary"===t[0][0];if(n=n||{},Array.isArray(t)){var h=t[0],u="dictionary"===h;if(1==t.length&&/^#/.test(h))return n.dictionary[h];s=[];for(var l,c=(h=D.exports[h])?1:0,d=t.length;c<d;c++)s.push(D.deserialize(t[c],e,n,u,o));h&&(l=s,s=e?e(h,l,a||r):new h(l))}else if(D.isPlainObject(t))for(var f in s={},i&&(n.dictionary=s),t)s[f]=D.deserialize(t[f],e,n);return o?s[1]:s},exportJSON:function(t,e){t=D.serialize(t,e);return e&&0==e.asString?t:JSON.stringify(t)},importJSON:function(t,s){return D.deserialize("string"==typeof t?JSON.parse(t):t,function(t,e,n){var i=n&&s&&s.constructor===t,r=i?s:D.create(t.prototype);return!(1===e.length&&r instanceof V)||!i&&r instanceof a||(n=e[0],D.isPlainObject(n)&&(n.insert=!1,i&&(e=e.concat([V.INSERT])))),(i?r.set:t).apply(r,e),i&&(s=null),r})},push:function(t,e){var n=e.length;if(n<4096)t.push.apply(t,e);else{var i=t.length;t.length+=n;for(var r=0;r<n;r++)t[i+r]=e[r]}return t},splice:function(t,e,n,i){var r=e&&e.length,s=n===j;(n=s?t.length:n)>t.length&&(n=t.length);for(var a=0;a<r;a++)e[a]._index=n+a;if(s)return D.push(t,e),[];i=[n,i];e&&D.push(i,e);for(var o=t.splice.apply(t,i),a=0,h=o.length;a<h;a++)o[a]._index=j;for(a=n+r,h=t.length;a<h;a++)t[a]._index=a;return o},capitalize:function(t){return t.replace(/\b[a-z]/g,function(t){return t.toUpperCase()})},camelize:function(t){return t.replace(/-(.)/g,function(t,e){return e.toUpperCase()})},hyphenate:function(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}}});var t={on:function(t,e){var n,i;return"string"!=typeof t?D.each(t,function(t,e){this.on(e,t)},this):(n=(i=this._eventTypes)&&i[t],-1===(i=(i=this._callbacks=this._callbacks||{})[t]=i[t]||[]).indexOf(e)&&(i.push(e),n&&n.install&&1===i.length&&n.install.call(this,t))),this},off:function(t,e){if("string"==typeof t){var n,i=this._eventTypes,r=i&&i[t],i=this._callbacks&&this._callbacks[t];return i&&(!e||-1!==(n=i.indexOf(e))&&1===i.length?(r&&r.uninstall&&r.uninstall.call(this,t),delete this._callbacks[t]):-1!==n&&i.splice(n,1)),this}D.each(t,function(t,e){this.off(e,t)},this)},once:function(e,n){return this.on(e,function t(){n.apply(this,arguments),this.off(e,t)})},emit:function(t,e){if(!(r=this._callbacks&&this._callbacks[t]))return!1;var n=D.slice(arguments,1),i=e&&e.target&&!e.currentTarget,r=r.slice();i&&(e.currentTarget=this);for(var s=0,a=r.length;s<a;s++)if(0==r[s].apply(this,n)){e&&e.stop&&e.stop();break}return i&&delete e.currentTarget,!0},responds:function(t){return!(!this._callbacks||!this._callbacks[t])},attach:"#on",detach:"#off",fire:"#emit",_installEvents:function(t){var e,n=this._eventTypes,i=this._callbacks,r=t?"install":"uninstall";if(n)for(var s in i)0<i[s].length&&((e=(e=n[s])&&e[r])&&e.call(this,s))},statics:{inject:function t(s){var a,e=s._events;return e&&(a={},D.each(e,function(t,e){var n="string"==typeof t,i=n?t:e,e=D.capitalize(i),r=i.substring(2).toLowerCase();a[r]=n?{}:t,i="_"+i,s["get"+e]=function(){return this[i]},s["set"+e]=function(t){var e=this[i];e&&this.off(r,e),t&&this.on(r,t),this[i]=t}}),s._eventTypes=a),t.base.apply(this,arguments)}}},l=D.extend({_class:"PaperScope",initialize:function t(){(Wt=this).settings=new D({applyMatrix:!0,insertItems:!0,handleSize:4,hitTolerance:0,scaleStrokes:!1}),this.project=null,this.projects=[],this.tools=[],this._id=t._id++,t._scopes[this._id]=this;var e,n,s,i=t.prototype;this.support||(n=_t.getContext(1,1)||{},i.support={nativeDash:"setLineDash"in n||"mozDash"in n,nativeBlendModes:gt.nativeModes},_t.release(n)),this.agent||(e=u.navigator.userAgent.toLowerCase(),n=(/(darwin|win|mac|linux|freebsd|sunos)/.exec(e)||[])[0],s=i.agent=i.browser={platform:n="darwin"===n?"mac":n},n&&(s[n]=!0),e.replace(/(opera|chrome|safari|webkit|firefox|msie|trident|atom|node|jsdom)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv\:v?([.\d]+))?/g,function(t,e,n,i,r){s.chrome||(n="opera"===e?i:/^(node|trident)$/.test(e)?r:n,s.version=n,s.versionNumber=parseFloat(n),s.name=e={trident:"msie",jsdom:"node"}[e]||e,s[e]=!0)}),s.chrome&&delete s.webkit,s.atom&&delete s.chrome)},version:"0.14.0",getView:function(){var t=this.project;return t&&t._view},getPaper:function(){return this},execute:function(t,e){},install:function(e){var t,n=this;for(t in D.each(["project","view","tool"],function(t){D.define(e,t,{configurable:!0,get:function(){return n[t]}})}),this)/^_/.test(t)||!this[t]||t in e||(e[t]=this[t])},setup:function(t){return(Wt=this).project=new s(t),this},createCanvas:function(t,e){return _t.getCanvas(t,e)},activate:function(){Wt=this},clear:function(){for(var t=this.projects,e=this.tools,n=t.length-1;0<=n;n--)t[n].remove();for(n=e.length-1;0<=n;n--)e[n].remove()},remove:function(){this.clear(),delete l._scopes[this._id]},statics:new function(){function t(n){return n+="Attribute",function(t,e){return t[n](e)||t[n]("data-paper-"+e)}}return{_scopes:{},_id:0,get:function(t){return this._scopes[t]||null},getAttribute:t("get"),hasAttribute:t("has")}}}),e=D.extend(t,{initialize:function(t){this._scope=Wt,this._index=this._scope[this._list].push(this)-1,!t&&this._scope[this._reference]||this.activate()},activate:function(){if(!this._scope)return!1;var t=this._scope[this._reference];return t&&t!==this&&t.emit("deactivate"),(this._scope[this._reference]=this).emit("activate",t),!0},isActive:function(){return this._scope[this._reference]===this},getScope:function(){return this._scope},remove:function(){return null!=this._index&&(D.splice(this._scope[this._list],null,this._index,1),this._scope[this._reference]==this&&(this._scope[this._reference]=null),!(this._scope=null))},getView:function(){return this._scope.getView()}}),R={findItemBoundsCollisions:function(t,e,n){function i(t){for(var e=new Array(t.length),n=0;n<t.length;n++){var i=t[n].getBounds();e[n]=[i.left,i.top,i.right,i.bottom]}return e}var r=i(t),e=e&&e!==t?i(e):r;return this.findBoundsCollisions(r,e,n||0)},findCurveBoundsCollisions:function(t,e,n,i){function r(t){for(var e=Math.min,n=Math.max,i=new Array(t.length),r=0;r<t.length;r++){var s=t[r];i[r]=[e(s[0],s[2],s[4],s[6]),e(s[1],s[3],s[5],s[7]),n(s[0],s[2],s[4],s[6]),n(s[1],s[3],s[5],s[7])]}return i}var s=r(t),e=e&&e!==t?r(e):s;if(i){for(var a=this.findBoundsCollisions(s,e,n||0,!1,!0),o=this.findBoundsCollisions(s,e,n||0,!0,!0),h=[],u=0,l=a.length;u<l;u++)h[u]={hor:a[u],ver:o[u]};return h}return this.findBoundsCollisions(s,e,n||0)},findBoundsCollisions:function(t,e,n,i,r){var s=!e||t===e,a=s?t:t.concat(e),o=t.length,h=a.length;function u(t,e,n){for(var i=0,r=t.length;i<r;){var s=r+i>>>1;a[t[s]][e]<n?i=1+s:r=s}return i-1}for(var l=i?1:0,c=2+l,d=i?0:1,f=2+d,_=new Array(h),g=0;g<h;g++)_[g]=g;_.sort(function(t,e){return a[t][l]-a[e][l]});for(var p=[],v=new Array(o),g=0;g<h;g++){var m=_[g],y=a[m],w=s?m:m-o,x=m<o,b=s||!x,S=x?[]:null;if(p.length){var C=u(p,c,y[l]-n)+1;if(p.splice(0,C),s&&r)for(var S=S.concat(p),I=0;I<p.length;I++)v[T=p[I]].push(w);else for(var M=y[f],P=y[d],I=0;I<p.length;I++){var T=p[I],k=a[T],O=T<o,z=s||o<=T;(r||(x&&z||b&&O)&&M>=k[d]-n&&P<=k[f]+n)&&(x&&z&&S.push(s?T:T-o),b&&O&&v[T].push(w))}}x&&(t===e&&S.push(m),v[m]=S),p.length?(y=u(p,c,y[c]),p.splice(y+1,0,m)):p.push(m)}for(g=0;g<v.length;g++){var A=v[g];A&&A.sort(function(t,e){return t-e})}return v}},x=D.extend({initialize:function(t){this.precision=D.pick(t,5),this.multiplier=Math.pow(10,this.precision)},number:function(t){return this.precision<16?Math.round(t*this.multiplier)/this.multiplier:t},pair:function(t,e,n){return this.number(t)+(n||",")+this.number(e)},point:function(t,e){return this.number(t.x)+(e||",")+this.number(t.y)},size:function(t,e){return this.number(t.width)+(e||",")+this.number(t.height)},rectangle:function(t,e){return this.point(t,e)+(e||",")+this.size(t,e)}});x.instance=new x;var q=new function(){var d=[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],f=[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]],m=Math.abs,y=Math.sqrt,w=Math.pow,e=Math.log2||function(t){return Math.log(t)*Math.LOG2E},x=1e-12,b=112e-18;function S(t,e,n){return t<e?e:n<t?n:t}function _(t,e,n){function i(t){var e=134217729*t,e=t-e+e;return[e,t-e]}var r,s,a=e*e-t*n,o=e*e+t*n;return 3*m(a)<o&&(r=i(t),s=i(e),o=i(n),a=(e=e*e)-(n=t*n)+(s[0]*s[0]-e+2*s[0]*s[1]+s[1]*s[1]-(r[0]*o[0]-n+r[0]*o[1]+r[1]*o[0]+r[1]*o[1]))),a}function C(){var t=Math.max.apply(Math,arguments);return t&&(t<1e-8||1e8<t)?w(2,-Math.round(e(t))):0}return{EPSILON:x,MACHINE_EPSILON:b,CURVETIME_EPSILON:1e-8,GEOMETRIC_EPSILON:1e-7,TRIGONOMETRIC_EPSILON:1e-8,ANGULAR_EPSILON:1e-5,KAPPA:4*(y(2)-1)/3,isZero:function(t){return-x<=t&&t<=x},isMachineZero:function(t){return-b<=t&&t<=b},clamp:S,integrate:function(t,e,n,i){for(var r=d[i-2],s=f[i-2],a=.5*(n-e),o=a+e,h=0,u=i+1>>1,l=1&i?s[h++]*t(o):0;h<u;){var c=a*r[h];l+=s[h++]*(t(o+c)+t(o-c))}return a*l},findRoot:function(t,e,n,i,r,s,a){for(var o=0;o<s;o++){var h=t(n),u=h/e(n),l=n-u;if(m(u)<a){n=l;break}n=0<h?(r=n,l<=i?.5*(i+r):l):(i=n,r<=l?.5*(i+r):l)}return S(n,i,r)},solveQuadratic:function(t,e,n,i,r,s){var a,o=1/0;if(m(t)<x){if(m(e)<x)return m(n)<x?-1:0;a=-n/e}else{var h,u=_(t,e*=-.5,n);u&&m(u)<b&&((h=C(m(t),m(e),m(n)))&&(u=_(t*=h,e*=h,n*=h))),-b<=u&&(l=u<0?0:y(u),o=0===(c=e+(e<0?-l:l))?-(a=n/t):(a=c/t,n/c))}var l=0,t=null==r,n=r-x,c=s+x;return isFinite(a)&&(t||n<a&&a<c)&&(i[l++]=t?a:S(a,r,s)),o!==a&&isFinite(o)&&(t||n<o&&o<c)&&(i[l++]=t?o:S(o,r,s)),l},solveCubic:function(e,n,i,r,t,s,a){var o,h,u,l,c,d=C(m(e),m(n),m(i),m(r));function f(t){t=e*(o=t);l=(t+(h=t+n))*o+(u=h*o+i),c=u*o+r}if(d&&(e*=d,n*=d,i*=d,r*=d),m(e)<x)e=n,h=i,u=r,o=1/0;else if(m(r)<x)h=n,u=i,o=0;else{f(-n/e/3);var _=c/e,g=w(m(_),1/3),p=_<0?-1:1,_=-l/e,_=0<_?1.324717957244746*Math.max(g,y(_)):g,v=o-p*_;if(v!==o){for(;f(v),v=0===l?o:o-c/l/(1+b),p*o<p*v;);m(e)*o*o>m(r/o)&&(h=((u=-r/o)-i)/o)}}g=q.solveQuadratic(e,h,u,t,s,a),_=null==s;return isFinite(o)&&(0===g||0<g&&o!==t[0]&&o!==t[1])&&(_||s-x<o&&o<a+x)&&(t[g++]=_?o:S(o,s,a)),g}}},o={_id:1,_pools:{},get:function(t){if(t){var e=this._pools[t];return(e=e||(this._pools[t]={_id:1}))._id++}return this._id++}},L=D.extend({_class:"Point",_readIndex:!0,initialize:function(t,e){var n,i=typeof t,r=this.__read,s=0;return"number"==i?(this._set(t,(n="number"==typeof e)?e:t),r&&(s=n?2:1)):"undefined"==i||null===t?(this._set(0,0),r&&(s=null===t?1:0)):(t="string"==i?t.split(/[\s,]+/)||[]:t,s=1,Array.isArray(t)?this._set(+t[0],+(1<t.length?t[1]:t[0])):"x"in t?this._set(t.x||0,t.y||0):"width"in t?this._set(t.width||0,t.height||0):"angle"in t?(this._set(t.length||0,0),this.setAngle(t.angle||0)):(this._set(0,0),s=0)),r&&(this.__read=s),this},set:"#initialize",_set:function(t,e){return this.x=t,this.y=e,this},equals:function(t){return this===t||t&&(this.x===t.x&&this.y===t.y||Array.isArray(t)&&this.x===t[0]&&this.y===t[1])||!1},clone:function(){return new L(this.x,this.y)},toString:function(){var t=x.instance;return"{ x: "+t.number(this.x)+", y: "+t.number(this.y)+" }"},_serialize:function(t){t=t.formatter;return[t.number(this.x),t.number(this.y)]},getLength:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setLength:function(t){var e;this.isZero()?(e=this._angle||0,this._set(Math.cos(e)*t,Math.sin(e)*t)):(t=t/this.getLength(),q.isZero(t)&&this.getAngle(),this._set(this.x*t,this.y*t))},getAngle:function(){return 180*this.getAngleInRadians.apply(this,arguments)/Math.PI},setAngle:function(t){this.setAngleInRadians.call(this,t*Math.PI/180)},getAngleInDegrees:"#getAngle",setAngleInDegrees:"#setAngle",getAngleInRadians:function(){if(arguments.length){var t=L.read(arguments),e=this.getLength()*t.getLength();if(q.isZero(e))return NaN;e=this.dot(t)/e;return Math.acos(e<-1?-1:1<e?1:e)}return this.isZero()?this._angle||0:this._angle=Math.atan2(this.y,this.x)},setAngleInRadians:function(t){var e;this._angle=t,this.isZero()||(e=this.getLength(),this._set(Math.cos(t)*e,Math.sin(t)*e))},getQuadrant:function(){return 0<=this.x?0<=this.y?1:4:0<=this.y?2:3}},{beans:!1,getDirectedAngle:function(){var t=L.read(arguments);return 180*Math.atan2(this.cross(t),this.dot(t))/Math.PI},getDistance:function(){var t=arguments,e=L.read(t),n=e.x-this.x,e=e.y-this.y,e=n*n+e*e;return D.read(t)?e:Math.sqrt(e)},normalize:function(t){t===j&&(t=1);var e=this.getLength(),t=0!==e?t/e:0,e=new L(this.x*t,this.y*t);return 0<=t&&(e._angle=this._angle),e},rotate:function(t,e){if(0===t)return this.clone();t=t*Math.PI/180;var n=e?this.subtract(e):this,i=Math.sin(t),t=Math.cos(t),n=new L(n.x*t-n.y*i,n.x*i+n.y*t);return e?n.add(e):n},transform:function(t){return t?t._transformPoint(this):this},add:function(){var t=L.read(arguments);return new L(this.x+t.x,this.y+t.y)},subtract:function(){var t=L.read(arguments);return new L(this.x-t.x,this.y-t.y)},multiply:function(){var t=L.read(arguments);return new L(this.x*t.x,this.y*t.y)},divide:function(){var t=L.read(arguments);return new L(this.x/t.x,this.y/t.y)},modulo:function(){var t=L.read(arguments);return new L(this.x%t.x,this.y%t.y)},negate:function(){return new L(-this.x,-this.y)},isInside:function(){return b.read(arguments).contains(this)},isClose:function(){var t=arguments,e=L.read(t),t=D.read(t);return this.getDistance(e)<=t},isCollinear:function(){var t=L.read(arguments);return L.isCollinear(this.x,this.y,t.x,t.y)},isColinear:"#isCollinear",isOrthogonal:function(){var t=L.read(arguments);return L.isOrthogonal(this.x,this.y,t.x,t.y)},isZero:function(){var t=q.isZero;return t(this.x)&&t(this.y)},isNaN:function(){return isNaN(this.x)||isNaN(this.y)},isInQuadrant:function(t){return 0<=this.x*(1<t&&t<4?-1:1)&&0<=this.y*(2<t?-1:1)},dot:function(){var t=L.read(arguments);return this.x*t.x+this.y*t.y},cross:function(){var t=L.read(arguments);return this.x*t.y-this.y*t.x},project:function(){var t=L.read(arguments),e=t.isZero()?0:this.dot(t)/t.dot(t);return new L(t.x*e,t.y*e)},clamp:function(){var t=arguments,e=L.read(t),t=L.read(t);return new L(q.clamp(this.x,e.x,t.x),q.clamp(this.y,e.y,t.y))},statics:{min:function(){var t=arguments,e=L.read(t),t=L.read(t);return new L(Math.min(e.x,t.x),Math.min(e.y,t.y))},max:function(){var t=arguments,e=L.read(t),t=L.read(t);return new L(Math.max(e.x,t.x),Math.max(e.y,t.y))},random:function(){return new L(Math.random(),Math.random())},isCollinear:function(t,e,n,i){return Math.abs(t*i-e*n)<=1e-8*Math.sqrt((t*t+e*e)*(n*n+i*i))},isOrthogonal:function(t,e,n,i){return Math.abs(t*n+e*i)<=1e-8*Math.sqrt((t*t+e*e)*(n*n+i*i))}}},D.each(["round","ceil","floor","abs"],function(t){var e=Math[t];this[t]=function(){return new L(e(this.x),e(this.y))}},{})),c=L.extend({initialize:function(t,e,n,i){this._x=t,this._y=e,this._owner=n,this._setter=i},_set:function(t,e,n){return this._x=t,this._y=e,n||this._owner[this._setter](this),this},getX:function(){return this._x},setX:function(t){this._x=t,this._owner[this._setter](this)},getY:function(){return this._y},setY:function(t){this._y=t,this._owner[this._setter](this)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(t){this._owner._changeSelection(this._getSelection(),t)},_getSelection:function(){return"setPosition"===this._setter?4:0}}),z=D.extend({_class:"Size",_readIndex:!0,initialize:function(t,e){var n,i=typeof t,r=this.__read,s=0;return"number"==i?(this._set(t,(n="number"==typeof e)?e:t),r&&(s=n?2:1)):"undefined"==i||null===t?(this._set(0,0),r&&(s=null===t?1:0)):(t="string"==i?t.split(/[\s,]+/)||[]:t,s=1,Array.isArray(t)?this._set(+t[0],+(1<t.length?t[1]:t[0])):"width"in t?this._set(t.width||0,t.height||0):"x"in t?this._set(t.x||0,t.y||0):(this._set(0,0),s=0)),r&&(this.__read=s),this},set:"#initialize",_set:function(t,e){return this.width=t,this.height=e,this},equals:function(t){return t===this||t&&(this.width===t.width&&this.height===t.height||Array.isArray(t)&&this.width===t[0]&&this.height===t[1])||!1},clone:function(){return new z(this.width,this.height)},toString:function(){var t=x.instance;return"{ width: "+t.number(this.width)+", height: "+t.number(this.height)+" }"},_serialize:function(t){t=t.formatter;return[t.number(this.width),t.number(this.height)]},add:function(){var t=z.read(arguments);return new z(this.width+t.width,this.height+t.height)},subtract:function(){var t=z.read(arguments);return new z(this.width-t.width,this.height-t.height)},multiply:function(){var t=z.read(arguments);return new z(this.width*t.width,this.height*t.height)},divide:function(){var t=z.read(arguments);return new z(this.width/t.width,this.height/t.height)},modulo:function(){var t=z.read(arguments);return new z(this.width%t.width,this.height%t.height)},negate:function(){return new z(-this.width,-this.height)},isZero:function(){var t=q.isZero;return t(this.width)&&t(this.height)},isNaN:function(){return isNaN(this.width)||isNaN(this.height)},statics:{min:function(t,e){return new z(Math.min(t.width,e.width),Math.min(t.height,e.height))},max:function(t,e){return new z(Math.max(t.width,e.width),Math.max(t.height,e.height))},random:function(){return new z(Math.random(),Math.random())}}},D.each(["round","ceil","floor","abs"],function(t){var e=Math[t];this[t]=function(){return new z(e(this.width),e(this.height))}},{})),n=z.extend({initialize:function(t,e,n,i){this._width=t,this._height=e,this._owner=n,this._setter=i},_set:function(t,e,n){return this._width=t,this._height=e,n||this._owner[this._setter](this),this},getWidth:function(){return this._width},setWidth:function(t){this._width=t,this._owner[this._setter](this)},getHeight:function(){return this._height},setHeight:function(t){this._height=t,this._owner[this._setter](this)}}),b=D.extend({_class:"Rectangle",_readIndex:!0,beans:!0,initialize:function(t,e,n,i){var r,s,a,o,h,u,l=arguments,c=typeof t;"number"==c?(this._set(t,e,n,i),r=4):"undefined"==c||null===t?(this._set(0,0,0,0),r=null===t?1:0):(1===l.length||Array.isArray(t)&&4===t.length||t.x!==j&&t.width!==j)&&(Array.isArray(t)?(this._set.apply(this,t),r=1):t.x!==j||t.width!==j?(this._set(t.x||0,t.y||0,t.width||0,t.height||0),r=1):t.from===j&&t.to===j&&(s=new d,D.readSupported(l,s)&&(r=1),this._set(s.x,s.y,s.width,s.height))),r===j&&(a=L.readNamed(l,"from"),c=D.peek(l),s=a.x,a=a.y,c&&c.x!==j||D.hasNamed(l,"to")?(o=(u=L.readNamed(l,"to")).x-s,h=u.y-a,o<0&&(s=u.x,o=-o),h<0&&(a=u.y,h=-h)):(o=(u=z.read(l)).width,h=u.height),this._set(s,a,o,h),r=l.__index);l=l.__filtered;return l&&(this.__filtered=l),this.__read&&(this.__read=r),this},set:"#initialize",_set:function(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this},clone:function(){return new b(this.x,this.y,this.width,this.height)},equals:function(t){var e=D.isPlainValue(t)?b.read(arguments):t;return e===this||e&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height||!1},toString:function(){var t=x.instance;return"{ x: "+t.number(this.x)+", y: "+t.number(this.y)+", width: "+t.number(this.width)+", height: "+t.number(this.height)+" }"},_serialize:function(t){t=t.formatter;return[t.number(this.x),t.number(this.y),t.number(this.width),t.number(this.height)]},getPoint:function(t){return new(t?L:c)(this.x,this.y,this,"setPoint")},setPoint:function(){var t=L.read(arguments);this.x=t.x,this.y=t.y},getSize:function(t){return new(t?z:n)(this.width,this.height,this,"setSize")},setSize:function(){var t=z.read(arguments);this.width=t.width,this.height=t.height},getLeft:function(){return this.x},setLeft:function(t){this.width-=t-this.x,this.x=t},getTop:function(){return this.y},setTop:function(t){this.height-=t-this.y,this.y=t},getRight:function(){return this.x+this.width},setRight:function(t){this.width=t-this.x},getBottom:function(){return this.y+this.height},setBottom:function(t){this.height=t-this.y},getCenterX:function(){return this.x+this.width/2},setCenterX:function(t){this.x=t-this.width/2},getCenterY:function(){return this.y+this.height/2},setCenterY:function(t){this.y=t-this.height/2},getCenter:function(t){return new(t?L:c)(this.getCenterX(),this.getCenterY(),this,"setCenter")},setCenter:function(){var t=L.read(arguments);return this.setCenterX(t.x),this.setCenterY(t.y),this},getArea:function(){return this.width*this.height},isEmpty:function(){return 0===this.width||0===this.height},contains:function(t){return t&&t.width!==j||4===(Array.isArray(t)?t:arguments).length?this._containsRectangle(b.read(arguments)):this._containsPoint(L.read(arguments))},_containsPoint:function(t){var e=t.x,t=t.y;return e>=this.x&&t>=this.y&&e<=this.x+this.width&&t<=this.y+this.height},_containsRectangle:function(t){var e=t.x,n=t.y;return e>=this.x&&n>=this.y&&e+t.width<=this.x+this.width&&n+t.height<=this.y+this.height},intersects:function(){var t=b.read(arguments),e=D.read(arguments)||0;return t.x+t.width>this.x-e&&t.y+t.height>this.y-e&&t.x<this.x+this.width+e&&t.y<this.y+this.height+e},intersect:function(){var t=b.read(arguments),e=Math.max(this.x,t.x),n=Math.max(this.y,t.y),i=Math.min(this.x+this.width,t.x+t.width),t=Math.min(this.y+this.height,t.y+t.height);return new b(e,n,i-e,t-n)},unite:function(){var t=b.read(arguments),e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width),t=Math.max(this.y+this.height,t.y+t.height);return new b(e,n,i-e,t-n)},include:function(){var t=L.read(arguments),e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x),t=Math.max(this.y+this.height,t.y);return new b(e,n,i-e,t-n)},expand:function(){var t=z.read(arguments),e=t.width,t=t.height;return new b(this.x-e/2,this.y-t/2,this.width+e,this.height+t)},scale:function(t,e){return this.expand(this.width*t-this.width,this.height*(e===j?t:e)-this.height)}},D.each([["Top","Left"],["Top","Right"],["Bottom","Left"],["Bottom","Right"],["Left","Center"],["Top","Center"],["Right","Center"],["Bottom","Center"]],function(t,e){var n=t.join(""),i=/^[RL]/.test(n);4<=e&&(t[1]+=i?"Y":"X");var e=t[i?0:1],i=t[i?1:0],r="get"+e,s="get"+i,a="set"+e,o="set"+i,h="set"+n;this["get"+n]=function(t){return new(t?L:c)(this[r](),this[s](),this,h)},this[h]=function(){var t=L.read(arguments);this[a](t.x),this[o](t.y)}},{beans:!0})),r=b.extend({initialize:function(t,e,n,i,r,s){this._set(t,e,n,i,!0),this._owner=r,this._setter=s},_set:function(t,e,n,i,r){return this._x=t,this._y=e,this._width=n,this._height=i,r||this._owner[this._setter](this),this}},new function(){var n=b.prototype;return D.each(["x","y","width","height"],function(t){var e=D.capitalize(t),n="_"+t;this["get"+e]=function(){return this[n]},this["set"+e]=function(t){this[n]=t,this._dontNotify||this._owner[this._setter](this)}},D.each(["Point","Size","Center","Left","Top","Right","Bottom","CenterX","CenterY","TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],function(t){var e="set"+t;this[e]=function(){this._dontNotify=!0,n[e].apply(this,arguments),this._dontNotify=!1,this._owner[this._setter](this)}},{isSelected:function(){return!!(2&this._owner._selection)},setSelected:function(t){var e=this._owner;e._changeSelection&&e._changeSelection(2,t)}}))}),d=b.extend({beans:!0,_fw:1,_fh:1,setSize:function(){var t=z.read(arguments),e=this._sx,n=this._sy,i=t.width,t=t.height;e&&(this.x+=(this.width-i)*e),n&&(this.y+=(this.height-t)*n),this.width=i,this.height=t,this._fw=this._fh=1},setLeft:function(t){var e;this._fw||(e=t-this.x,this.width-=.5===this._sx?2*e:e),this.x=t,this._sx=this._fw=0},setTop:function(t){var e;this._fh||(e=t-this.y,this.height-=.5===this._sy?2*e:e),this.y=t,this._sy=this._fh=0},setRight:function(t){var e;this._fw||(e=t-this.x,this.width=.5===this._sx?2*e:e),this.x=t-this.width,this._sx=1,this._fw=0},setBottom:function(t){var e;this._fh||(e=t-this.y,this.height=.5===this._sy?2*e:e),this.y=t-this.height,this._sy=1,this._fh=0},setCenterX:function(t){this._fw||.5===this._sx?this.x=t-this.width/2:(this._sx&&(this.x+=2*(t-this.x)*this._sx),this.width=2*(t-this.x)),this._sx=.5,this._fw=0},setCenterY:function(t){this._fh||.5===this._sy?this.y=t-this.height/2:(this._sy&&(this.y+=2*(t-this.y)*this._sy),this.height=2*(t-this.y)),this._sy=.5,this._fh=0}}),A=D.extend({_class:"Matrix",initialize:function t(e,n){var i=arguments,r=i.length,s=!0;if(6<=r?this._set.apply(this,i):1===r||2===r?e instanceof t?this._set(e._a,e._b,e._c,e._d,e._tx,e._ty,n):Array.isArray(e)?this._set.apply(this,n?e.concat([n]):e):s=!1:r?s=!1:this.reset(),!s)throw new Error("Unsupported matrix parameters");return this},set:"#initialize",_set:function(t,e,n,i,r,s,a){return this._a=t,this._b=e,this._c=n,this._d=i,this._tx=r,this._ty=s,a||this._changed(),this},_serialize:function(t,e){return D.serialize(this.getValues(),t,!0,e)},_changed:function(){var t=this._owner;t&&(t._applyMatrix?t.transform(null,!0):t._changed(25))},clone:function(){return new A(this._a,this._b,this._c,this._d,this._tx,this._ty)},equals:function(t){return t===this||t&&this._a===t._a&&this._b===t._b&&this._c===t._c&&this._d===t._d&&this._tx===t._tx&&this._ty===t._ty},toString:function(){var t=x.instance;return"[["+[t.number(this._a),t.number(this._c),t.number(this._tx)].join(", ")+"], ["+[t.number(this._b),t.number(this._d),t.number(this._ty)].join(", ")+"]]"},reset:function(t){return this._a=this._d=1,this._b=this._c=this._tx=this._ty=0,t||this._changed(),this},apply:function(t,e){var n=this._owner;return!!n&&(n.transform(null,D.pick(t,!0),e),this.isIdentity())},translate:function(){var t=L.read(arguments),e=t.x,t=t.y;return this._tx+=e*this._a+t*this._c,this._ty+=e*this._b+t*this._d,this._changed(),this},scale:function(){var t=arguments,e=L.read(t),t=L.read(t,0,{readNull:!0});return t&&this.translate(t),this._a*=e.x,this._b*=e.x,this._c*=e.y,this._d*=e.y,t&&this.translate(t.negate()),this._changed(),this},rotate:function(t){t*=Math.PI/180;var e=L.read(arguments,1),n=e.x,i=e.y,r=Math.cos(t),s=Math.sin(t),a=n-n*r+i*s,o=i-n*s-i*r,h=this._a,e=this._b,n=this._c,i=this._d;return this._a=r*h+s*n,this._b=r*e+s*i,this._c=-s*h+r*n,this._d=-s*e+r*i,this._tx+=a*h+o*n,this._ty+=a*e+o*i,this._changed(),this},shear:function(){var t=arguments,e=L.read(t),n=L.read(t,0,{readNull:!0});n&&this.translate(n);var i=this._a,t=this._b;return this._a+=e.y*this._c,this._b+=e.y*this._d,this._c+=e.x*i,this._d+=e.x*t,n&&this.translate(n.negate()),this._changed(),this},skew:function(){var t=arguments,e=L.read(t),n=L.read(t,0,{readNull:!0}),t=Math.PI/180,t=new L(Math.tan(e.x*t),Math.tan(e.y*t));return this.shear(t,n)},append:function(t,e){var n,i,r,s,a,o,h,u,l;return t&&(n=this._a,i=this._b,r=this._c,s=this._d,a=t._a,o=t._c,h=t._b,u=t._d,l=t._tx,t=t._ty,this._a=a*n+h*r,this._c=o*n+u*r,this._b=a*i+h*s,this._d=o*i+u*s,this._tx+=l*n+t*r,this._ty+=l*i+t*s,e||this._changed()),this},prepend:function(t,e){var n,i,r,s,a,o,h,u,l,c,d;return t&&(n=this._a,i=this._b,r=this._c,s=this._d,a=this._tx,o=this._ty,h=t._a,u=t._c,l=t._b,c=t._d,d=t._tx,t=t._ty,this._a=h*n+u*i,this._c=h*r+u*s,this._b=l*n+c*i,this._d=l*r+c*s,this._tx=h*a+u*o+d,this._ty=l*a+c*o+t,e||this._changed()),this},appended:function(t){return this.clone().append(t)},prepended:function(t){return this.clone().prepend(t)},invert:function(){var t=this._a,e=this._b,n=this._c,i=this._d,r=this._tx,s=this._ty,a=t*i-e*n,o=null;return a&&!isNaN(a)&&isFinite(r)&&isFinite(s)&&(this._a=i/a,this._b=-e/a,this._c=-n/a,this._d=t/a,this._tx=(n*s-i*r)/a,this._ty=(e*r-t*s)/a,o=this),o},inverted:function(){return this.clone().invert()},concatenate:"#append",preConcatenate:"#prepend",chain:"#appended",_shiftless:function(){return new A(this._a,this._b,this._c,this._d,0,0)},_orNullIfIdentity:function(){return this.isIdentity()?null:this},isIdentity:function(){return 1===this._a&&0===this._b&&0===this._c&&1===this._d&&0===this._tx&&0===this._ty},isInvertible:function(){var t=this._a*this._d-this._c*this._b;return t&&!isNaN(t)&&isFinite(this._tx)&&isFinite(this._ty)},_getMeanScale:function(){return Math.sqrt(Math.abs(this._a*this._d-this._b*this._c))},isSingular:function(){return!this.isInvertible()},transform:function(t,e,n){return arguments.length<3?this._transformPoint(L.read(arguments)):this._transformCoordinates(t,e,n)},_transformPoint:function(t,e,n){var i=t.x,t=t.y;return(e=e||new L)._set(i*this._a+t*this._c+this._tx,i*this._b+t*this._d+this._ty,n)},_transformCoordinates:function(t,e,n){for(var i=0,r=2*n;i<r;i+=2){var s=t[i],a=t[i+1];e[i]=s*this._a+a*this._c+this._tx,e[i+1]=s*this._b+a*this._d+this._ty}return e},_transformCorners:function(t){var e=t.x,n=t.y,i=e+t.width,t=n+t.height,t=[e,n,i,n,i,t,e,t];return this._transformCoordinates(t,t,4)},_transformBounds:function(t,e,n){for(var i=this._transformCorners(t),r=i.slice(0,2),s=r.slice(),a=2;a<8;a++){var o=i[a],h=1&a;o<r[h]?r[h]=o:o>s[h]&&(s[h]=o)}return(e=e||new b)._set(r[0],r[1],s[0]-r[0],s[1]-r[1],n)},inverseTransform:function(){return this._inverseTransform(L.read(arguments))},_inverseTransform:function(t,e,n){var i=this._a,r=this._b,s=this._c,a=this._d,o=this._tx,h=this._ty,u=i*a-r*s,l=null;return u&&!isNaN(u)&&isFinite(o)&&isFinite(h)&&(h=t.x-this._tx,t=t.y-this._ty,l=(e=e||new L)._set((h*a-t*s)/u,(t*i-h*r)/u,n)),l},decompose:function(){var t,e,n,i,r=this._a,s=this._b,a=this._c,o=this._d,h=r*o-s*a,u=Math.sqrt,l=Math.atan2,c=180/Math.PI;return i=0!==r||0!==s?(t=u(r*r+s*s),e=Math.acos(r/t)*(0<s?1:-1),n=[t,h/t],[l(r*a+s*o,t*t),0]):0!==a||0!==o?(i=u(a*a+o*o),e=Math.asin(a/i)*(0<o?1:-1),n=[h/i,i],[0,l(r*a+s*o,i*i)]):n=[e=0,0],{translation:this.getTranslation(),rotation:e*c,scaling:new L(n),skewing:new L(i[0]*c,i[1]*c)}},getValues:function(){return[this._a,this._b,this._c,this._d,this._tx,this._ty]},getTranslation:function(){return new L(this._tx,this._ty)},getScaling:function(){return this.decompose().scaling},getRotation:function(){return this.decompose().rotation},applyToContext:function(t){this.isIdentity()||t.transform(this._a,this._b,this._c,this._d,this._tx,this._ty)}},D.each(["a","b","c","d","tx","ty"],function(t){var e=D.capitalize(t),n="_"+t;this["get"+e]=function(){return this[n]},this["set"+e]=function(t){this[n]=t,this._changed()}},{})),N=D.extend({_class:"Line",initialize:function(t,e,n,i,r){(4<=arguments.length?(this._px=t,this._py=e,this._vx=n,this._vy=i,r):(this._px=t.x,this._py=t.y,this._vx=e.x,this._vy=e.y,n))||(this._vx-=this._px,this._vy-=this._py)},getPoint:function(){return new L(this._px,this._py)},getVector:function(){return new L(this._vx,this._vy)},getLength:function(){return this.getVector().getLength()},intersect:function(t,e){return N.intersect(this._px,this._py,this._vx,this._vy,t._px,t._py,t._vx,t._vy,!0,e)},getSide:function(t,e){return N.getSide(this._px,this._py,this._vx,this._vy,t.x,t.y,!0,e)},getDistance:function(t){return Math.abs(this.getSignedDistance(t))},getSignedDistance:function(t){return N.getSignedDistance(this._px,this._py,this._vx,this._vy,t.x,t.y,!0)},isCollinear:function(t){return L.isCollinear(this._vx,this._vy,t._vx,t._vy)},isOrthogonal:function(t){return L.isOrthogonal(this._vx,this._vy,t._vx,t._vy)},statics:{intersect:function(t,e,n,i,r,s,a,o,h,u){h||(n-=t,i-=e,a-=r,o-=s);h=n*o-i*a;if(!q.isMachineZero(h)){r=t-r,s=e-s,o=(a*s-o*r)/h,h=(n*s-i*r)/h;if(u||-1e-12<o&&o<1+1e-12&&-1e-12<h&&h<1+1e-12)return new L(t+(o=!u?o<=0?0:1<=o?1:o:o)*n,e+o*i)}},getSide:function(t,e,n,i,r,s,a,o){a||(n-=t,i-=e);t=r-t,e=t*i-(s-e)*n;return(e=!o&&q.isMachineZero(e)&&0<=(e=(t*n+t*n)/(n*n+i*i))&&e<=1?0:e)<0?-1:0<e?1:0},getSignedDistance:function(t,e,n,i,r,s,a){return a||(n-=t,i-=e),0===n?0<i?r-t:t-r:0===i?n<0?s-e:e-s:((r-t)*i-(s-e)*n)/(n<i?Math.abs(i)*Math.sqrt(1+n*n/(i*i)):Math.abs(n)*Math.sqrt(1+i*i/(n*n)))},getDistance:function(t,e,n,i,r,s,a){return Math.abs(N.getSignedDistance(t,e,n,i,r,s,a))}}}),i={APPEARANCE:1,CHILDREN:2,INSERTION:4,GEOMETRY:8,MATRIX:16,SEGMENTS:32,STROKE:64,STYLE:128,ATTRIBUTE:256,CONTENT:512,PIXELS:1024,CLIPPING:2048,VIEW:4096},s=e.extend({_class:"Project",_list:"projects",_reference:"project",_compactSerialize:!0,initialize:function(t){e.call(this,!0),this._children=[],this._namedChildren={},this._activeLayer=null,this._currentStyle=new E(null,null,this),this._view=st.create(this,t||_t.getCanvas(1,1)),this._selectionItems={},this._selectionCount=0,this._updateVersion=0},_serialize:function(t,e){return D.serialize(this._children,t,!0,e)},_changed:function(t,e){1&t&&((r=this._view)&&(r._needsUpdate=!0,!r._requested&&r._autoUpdate&&r.requestUpdate()));var n,i,r,s=this._changes;s&&e&&e.isInserted()&&((r=(n=this._changesById)[i=e._id])?r.flags|=t:s.push(n[i]={item:e,flags:t}))},getTrackChanges:function(){return!!this._changes},setTrackChanges:function(t){!this._changes^!t&&(this._changes=t?[]:null,this._changesById=t?{}:null)},takeChanges:function(){var t=this._changes;return t&&(this._changes=[],this._changesById={}),t||null},clear:function(){for(var t=this._children,e=t.length-1;0<=e;e--)t[e].remove()},isEmpty:function(){return!this._children.length},remove:function t(){return!!t.base.call(this)&&(this._view&&this._view.remove(),!0)},getView:function(){return this._view},getCurrentStyle:function(){return this._currentStyle},setCurrentStyle:function(t){this._currentStyle.set(t)},getIndex:function(){return this._index},getOptions:function(){return this._scope.settings},getLayers:function(){return this._children},getActiveLayer:function(){return this._activeLayer||new a({project:this,insert:!0})},getSymbolDefinitions:function(){var n=[],i={};return this.getItems({class:h,match:function(t){var e=t._definition,t=e._id;return i[t]||(i[t]=!0,n.push(e)),!1}}),n},getSymbols:"getSymbolDefinitions",getSelectedItems:function(){var t,e=this._selectionItems,n=[];for(t in e){var i=e[t],r=i._selection;1&r&&i.isInserted()?n.push(i):r||this._updateSelection(i)}return n},_updateSelection:function(t,e){var n=t._id,i=this._selectionItems;t._selection&&!e&&t.isInserted()?i[n]!==t&&(this._selectionCount++,i[n]=t):i[n]===t&&(this._selectionCount--,delete i[n])},selectAll:function(){for(var t=this._children,e=0,n=t.length;e<n;e++)t[e].setFullySelected(!0)},deselectAll:function(){var t,e=this._selectionItems;for(t in e)e[t].setFullySelected(!1)},addLayer:function(t){return this.insertLayer(j,t)},insertLayer:function(t,e){return e instanceof a?(e._remove(!1,!0),D.splice(this._children,[e],t,0),e._setProject(this,!0),(t=e._name)&&e.setName(t),this._changes&&e._changed(5),this._activeLayer||(this._activeLayer=e)):e=null,e},_insertItem:function(t,e,n){return e=this.insertLayer(t,e)||(this._activeLayer||this._insertItem(j,new a(V.NO_INSERT),!0)).insertChild(t,e),n&&e.activate&&e.activate(),e},getItems:function(t){return V._getItems(this,t)},getItem:function(t){return V._getItems(this,t,null,null,!0)[0]||null},importJSON:function(t){this.activate();var e=this._activeLayer;return D.importJSON(t,e&&e.isEmpty()&&e)},removeOn:function(t){var e=this._removeSets;if(e){"mouseup"===t&&(e.mousedrag=null);var n=e[t];if(n){for(var i in n){var r,s=n[i];for(r in e){var a=e[r];a&&a!=n&&delete a[s._id]}s.remove()}e[t]=null}}},draw:function(t,e,n){this._updateVersion++,t.save(),e.applyToContext(t);for(var i=this._children,r=new D({offset:new L(0,0),pixelRatio:n,viewMatrix:e.isIdentity()?null:e,matrices:[new A],updateMatrix:!0}),s=0,a=i.length;s<a;s++)i[s].draw(t,r);if(t.restore(),0<this._selectionCount){t.save(),t.lineWidth=1;var o,h=this._selectionItems,u=this._scope.settings.handleSize,l=this._updateVersion;for(o in h)h[o]._drawSelection(t,e,u,h,l);t.restore()}}}),V=D.extend(t,{statics:{extend:function t(e){return e._serializeFields&&(e._serializeFields=D.set({},this.prototype._serializeFields,e._serializeFields)),t.base.apply(this,arguments)},INSERT:{insert:!0},NO_INSERT:{insert:!1}},_class:"Item",_name:null,_applyMatrix:!0,_canApplyMatrix:!0,_canScaleStroke:!1,_pivot:null,_visible:!0,_blendMode:"normal",_opacity:1,_locked:!1,_guide:!1,_clipMask:!1,_selection:0,_selectBounds:!0,_selectChildren:!1,_serializeFields:{name:null,applyMatrix:null,matrix:new A,pivot:null,visible:!0,blendMode:"normal",opacity:1,locked:!1,guide:!1,clipMask:!1,selected:!1,data:{}},_prioritize:["applyMatrix"]},new function(){var t=["onMouseDown","onMouseUp","onMouseDrag","onClick","onDoubleClick","onMouseMove","onMouseEnter","onMouseLeave"];return D.each(t,function(t){this._events[t]={install:function(t){this.isInserted()&&this.getView()._countItemEvent(t,1)},uninstall:function(t){this.isInserted()&&this.getView()._countItemEvent(t,-1)}}},{_events:{onFrame:{install:function(){this.getView()._animateItem(this,!0)},uninstall:function(){this.getView()._animateItem(this,!1)}},onLoad:{},onError:{}},statics:{_itemHandlers:t}})},{initialize:function(){},_initialize:function(t,e){var n=t&&D.isPlainObject(t),i=n&&!0===t.internal,r=this._matrix=new A,s=n&&t.project||Wt.project,a=Wt.settings;if(!s)throw new Error("Unable to create an item without a project. Call paper.setup() or create a Project first.");return this._id=i?null:o.get(),this._parent=this._index=null,this._applyMatrix=this._canApplyMatrix&&a.applyMatrix,e&&r.translate(e),(r._owner=this)._style=new E(s._currentStyle,this,s),i||n&&0==t.insert||!a.insertItems&&(!n||1!=t.insert)?this._setProject(s):(n&&t.parent||s)._insertItem(j,this,!0),n&&t!==V.NO_INSERT&&t!==V.INSERT&&this.set(t,{internal:!0,insert:!0,project:!0,parent:!0}),n},_serialize:function(i,r){var s={},a=this;function t(t){for(var e in t){var n=a[e];D.equals(n,"leading"===e?1.2*t.fontSize:t[e])||(s[e]=D.serialize(n,i,"data"!==e,r))}}return t(this._serializeFields),this instanceof v||t(this._style._defaults),[this._class,s]},_changed:function(t){var e=this._symbol,n=this._parent||e,i=this._project;8&t&&(this._bounds=this._position=this._decomposed=j),16&t&&(this._globalMatrix=j),n&&72&t&&V._clearBoundsCache(n),2&t&&V._clearBoundsCache(this),i&&i._changed(t,this),e&&e._changed(t)},getId:function(){return this._id},getName:function(){return this._name},setName:function(t){if(this._name&&this._removeNamed(),t===+t+"")throw new Error("Names consisting only of numbers are not supported.");var e,n=this._getOwner();t&&n&&(e=n._children,((n=n._namedChildren)[t]=n[t]||[]).push(this),t in e||(e[t]=this)),this._name=t||j,this._changed(256)},getStyle:function(){return this._style},setStyle:function(t){this.getStyle().set(t)}},D.each(["locked","visible","blendMode","opacity","guide"],function(e){var t=D.capitalize(e),n="_"+e,i={locked:256,visible:265};this["get"+t]=function(){return this[n]},this["set"+t]=function(t){t!=this[n]&&(this[n]=t,this._changed(i[e]||257))}},{}),{beans:!0,getSelection:function(){return this._selection},setSelection:function(t){t!==this._selection&&(this._selection=t,(t=this._project)&&(t._updateSelection(this),this._changed(257)))},_changeSelection:function(t,e){var n=this._selection;this.setSelection(e?n|t:n&~t)},isSelected:function(){if(this._selectChildren)for(var t=this._children,e=0,n=t.length;e<n;e++)if(t[e].isSelected())return!0;return!!(1&this._selection)},setSelected:function(t){if(this._selectChildren)for(var e=this._children,n=0,i=e.length;n<i;n++)e[n].setSelected(t);this._changeSelection(1,t)},isFullySelected:function(){var t=this._children,e=!!(1&this._selection);if(t&&e){for(var n=0,i=t.length;n<i;n++)if(!t[n].isFullySelected())return!1;return!0}return e},setFullySelected:function(t){var e=this._children;if(e)for(var n=0,i=e.length;n<i;n++)e[n].setFullySelected(t);this._changeSelection(1,t)},isClipMask:function(){return this._clipMask},setClipMask:function(t){this._clipMask!=(t=!!t)&&((this._clipMask=t)&&(this.setFillColor(null),this.setStrokeColor(null)),this._changed(257),this._parent&&this._parent._changed(2048))},getData:function(){return this._data||(this._data={}),this._data},setData:function(t){this._data=t},getPosition:function(t){var e=t?L:c,t=this._position||(this._position=this._getPositionFromBounds());return new e(t.x,t.y,this,"setPosition")},setPosition:function(){this.translate(L.read(arguments).subtract(this.getPosition(!0)))},_getPositionFromBounds:function(t){return this._pivot?this._matrix._transformPoint(this._pivot):(t||this.getBounds()).getCenter(!0)},getPivot:function(){var t=this._pivot;return t?new c(t.x,t.y,this,"setPivot"):null},setPivot:function(){this._pivot=L.read(arguments,0,{clone:!0,readNull:!0}),this._position=j}},D.each({getStrokeBounds:{stroke:!0},getHandleBounds:{handle:!0},getInternalBounds:{internal:!0}},function(e,t){this[t]=function(t){return this.getBounds(t,e)}},{beans:!0,getBounds:function(t,e){var n=e||t instanceof A,i=D.set({},n?e:t,this._boundsOptions);i.stroke&&!this.getStrokeScaling()||(i.cacheItem=this);i=this._getCachedBounds(n&&t,i).rect;return arguments.length?i:new r(i.x,i.y,i.width,i.height,this,"setBounds")},setBounds:function(){var t=b.read(arguments),e=this.getBounds(),n=this._matrix,i=new A,r=t.getCenter();i.translate(r),t.width==e.width&&t.height==e.height||(n.isInvertible()||(n.set(n._backup||(new A).translate(n.getTranslation())),e=this.getBounds()),i.scale(0!==e.width?t.width/e.width:1,0!==e.height?t.height/e.height:1)),r=e.getCenter(),i.translate(-r.x,-r.y),this.transform(i)},_getBounds:function(t,e){var n=this._children;return n&&n.length?(V._updateBoundsCache(this,e.cacheItem),V._getBounds(n,t,e)):new b},_getBoundsCacheKey:function(t,e){return[t.stroke?1:0,t.handle?1:0,e?1:0].join("")},_getCachedBounds:function(t,e,n){var i=e.internal&&!n,r=e.cacheItem,s=i?null:this._matrix._orNullIfIdentity();t=t?t._orNullIfIdentity():s;var a=r&&(t?t.equals(s):!s)&&this._getBoundsCacheKey(e,i),n=a&&r!==this&&(this._children||this._definition),s=this._bounds;if(V._updateBoundsCache(this._parent||this._symbol,r),n&&V._updateBoundsCache(this,r),a&&s&&a in s)return{rect:(o=s[a]).rect.clone(),nonscaling:o.nonscaling};var o,t=this._getBounds(t,n?D.set({},e,{cacheItem:this}):e),n=t.rect||t,e=this._style,e=t.nonscaling||e.hasStroke()&&!e.getStrokeScaling();return a&&(s||(this._bounds=s={}),o=s[a]={rect:n.clone(),nonscaling:e,internal:i}),{rect:n,nonscaling:e}},_getStrokeMatrix:function(t,e){e=this.getStrokeScaling()?null:e&&e.internal?this:this._parent||this._symbol&&this._symbol._item,t=e?e.getViewMatrix().invert():t;return t&&t._shiftless()},statics:{_updateBoundsCache:function(t,e){var n;t&&e&&(n=e._id,(t=t._boundsCache=t._boundsCache||{ids:{},list:[]}).ids[n]||(t.list.push(e),t.ids[n]=e))},_clearBoundsCache:function(t){var e=t._boundsCache;if(e){t._bounds=t._position=t._boundsCache=j;for(var n=0,i=e.list,r=i.length;n<r;n++){var s=i[n];s!==t&&(s._bounds=s._position=j,s._boundsCache&&V._clearBoundsCache(s))}}},_getBounds:function(t,e,n){var i=u=1/0,r=l=-u,s=!1;n=n||{};for(var a=0,o=t.length;a<o;a++){var h,u,l,c=t[a];c._visible&&!c.isEmpty(!0)&&(c=(h=c._getCachedBounds(e&&e.appended(c._matrix),n,!0)).rect,u=Math.min(c.x,u),i=Math.min(c.y,i),l=Math.max(c.x+c.width,l),r=Math.max(c.y+c.height,r),h.nonscaling&&(s=!0))}return{rect:isFinite(u)?new b(u,i,l-u,r-i):new b,nonscaling:s}}}}),{beans:!0,_decompose:function(){return this._applyMatrix?null:this._decomposed||(this._decomposed=this._matrix.decompose())},getRotation:function(){var t=this._decompose();return t?t.rotation:0},setRotation:function(t){var e,n=this.getRotation();null!=n&&null!=t&&(e=this._decomposed,this.rotate(t-n),e&&(e.rotation=t,this._decomposed=e))},getScaling:function(){var t=this._decompose(),t=t&&t.scaling;return new c(t?t.x:1,t?t.y:1,this,"setScaling")},setScaling:function(){var t,e,n,i,r=this.getScaling(),s=L.read(arguments,0,{clone:!0,readNull:!0});r&&s&&!r.equals(s)&&(t=this.getRotation(),e=this._decomposed,n=new A,(i=q.isZero)(r.x)||i(r.y)?(n.translate(e.translation),t&&n.rotate(t),n.scale(s.x,s.y),this._matrix.set(n)):(i=this.getPosition(!0),n.translate(i),t&&n.rotate(t),n.scale(s.x/r.x,s.y/r.y),t&&n.rotate(-t),n.translate(i.negate()),this.transform(n)),e&&(e.scaling=s,this._decomposed=e))},getMatrix:function(){return this._matrix},setMatrix:function(){var t=this._matrix;t.set.apply(t,arguments)},getGlobalMatrix:function(t){var e=this._parent,n=e&&e.getGlobalMatrix(!0),e=this._globalMatrix;return e&&this._parentGlobalMatrix===n||(e=this._globalMatrix=this._matrix.clone(),n&&e.prepend(n),this._parentGlobalMatrix=n),t?e:e.clone()},getViewMatrix:function(){return this.getGlobalMatrix().prepend(this.getView()._matrix)},getApplyMatrix:function(){return this._applyMatrix},setApplyMatrix:function(t){(this._applyMatrix=this._canApplyMatrix&&!!t)&&this.transform(null,!0)},getTransformContent:"#getApplyMatrix",setTransformContent:"#setApplyMatrix"},{getProject:function(){return this._project},_setProject:function(t,e){if(this._project!==t){this._project=t;for(var n=this._children,i=0,r=n&&n.length;i<r;i++)n[i]._setProject(t)}e&&this._installEvents(!0)},getView:function(){return this._project._view},getScope:function(){return this._project._scope},_installEvents:function t(e){t.base.call(this,e),this._selection&&this._project._updateSelection(this,!e);for(var n=this._children,i=0,r=n&&n.length;i<r;i++)n[i]._installEvents(e)},getLayer:function(){for(var t=this;t=t._parent;)if(t instanceof a)return t;return null},getParent:function(){return this._parent},setParent:function(t){return t.addChild(this)},_getOwner:"#getParent",getChildren:function(){return this._children},setChildren:function(t){this.removeChildren(),this.addChildren(t)},getFirstChild:function(){return this._children&&this._children[0]||null},getLastChild:function(){return this._children&&this._children[this._children.length-1]||null},getNextSibling:function(){var t=this._getOwner();return t&&t._children[this._index+1]||null},getPreviousSibling:function(){var t=this._getOwner();return t&&t._children[this._index-1]||null},getIndex:function(){return this._index},setIndex:function(t){var e=this._parent,n=e&&e._children;n&&e.insertChildren(t in n?t:j,[this])},equals:function(t){return t===this||t&&this._class===t._class&&this._style.equals(t._style)&&this._matrix.equals(t._matrix)&&this._locked===t._locked&&this._visible===t._visible&&this._blendMode===t._blendMode&&this._opacity===t._opacity&&this._clipMask===t._clipMask&&this._guide===t._guide&&this._equals(t)||!1},_equals:function(t){return D.equals(this._children,t._children)},clone:function(t){var e=new this.constructor(V.NO_INSERT),n=this._children,i=D.pick(t?t.insert:j,"boolean"==typeof t?t:Wt.settings.insertItems),t=D.pick(t?t.deep:j,!0);n&&e.copyAttributes(this),n&&!t||e.copyContent(this),n||e.copyAttributes(this),i&&e.insertAbove(this);var r=this._name,i=this._parent;if(r&&i){for(var n=i._children,s=r,a=1;n[r];)r=s+" "+a++;r!==s&&e.setName(r)}return e},copyContent:function(t){for(var e=t._children,n=0,i=e&&e.length;n<i;n++)this.addChild(e[n].clone(!1),!0)},copyAttributes:function(t,e){this.setStyle(t._style);for(var n=["_locked","_visible","_blendMode","_opacity","_clipMask","_guide"],i=0,r=n.length;i<r;i++){var s=n[i];t.hasOwnProperty(s)&&(this[s]=t[s])}e||this._matrix.set(t._matrix,!0),this.setApplyMatrix(t._applyMatrix),this.setPivot(t._pivot),this.setSelection(t._selection);var a=t._data,e=t._name;this._data=a?D.clone(a):null,e&&this.setName(e)},rasterize:function(t,e){var n;D.isPlainObject(t)?(a=t.resolution,n=t.insert,i=t.raster):(a=t,n=e);var i=i||new _(V.NO_INSERT),r=this.getStrokeBounds(),s=(a||this.getView().getResolution())/72,t=r.getTopLeft().floor(),e=r.getBottomRight().ceil(),a=new z(e.subtract(t)),r=a.multiply(s);return i.setSize(r,!0),r.isZero()||(e=i.getContext(!0),r=(new A).scale(s).translate(t.negate()),e.save(),r.applyToContext(e),this.draw(e,new D({matrices:[r]})),e.restore()),i._matrix.set((new A).translate(t.add(a.divide(2))).scale(1/s)),D.pick(n,Wt.settings.insertItems)&&i.insertAbove(this),i},contains:function(){var t=this._matrix;return t.isInvertible()&&!!this._contains(t._inverseTransform(L.read(arguments)))},_contains:function(t){var e=this._children;if(e){for(var n=e.length-1;0<=n;n--)if(e[n].contains(t))return!0;return!1}return t.isInside(this.getInternalBounds())},isInside:function(){return b.read(arguments).contains(this.getBounds())},_asPathItem:function(){return new U.Rectangle({rectangle:this.getInternalBounds(),applyMatrix:!1,matrix:this._matrix,insert:!1})},intersects:function(t,e){return t instanceof V&&0<this._asPathItem().getIntersections(t._asPathItem(),null,e,!0).length}},new function(){function t(){var t=arguments;return this._hitTest(L.read(t),O.getOptions(t))}function e(){var t=arguments,e=L.read(t),n=O.getOptions(t),t=[];return this._hitTest(e,new D({all:t},n)),t}function n(t,e,n,i){var r=this._children;if(r)for(var s=r.length-1;0<=s;s--){var a=r[s],a=a!==i&&a._hitTest(t,e,n);if(a&&!e.all)return a}return null}return s.inject({hitTest:t,hitTestAll:e,_hitTest:n}),{hitTest:t,hitTestAll:e,_hitTestChildren:n}},{_hitTest:function(i,s,t){if(this._locked||!this._visible||this._guide&&!s.guides||!this._shell&&this.isEmpty())return null;var e=this._matrix,n=t?e:this.getGlobalMatrix(),r=t?t.appended(e):n.prepended(this.getView()._matrix),a=Math.max(s.tolerance,1e-12),o=s._tolerancePadding=new z(U._getStrokePadding(a,r.prepended(this.getView()._matrix.inverted())._shiftless().invert()));if(!(i=n._inverseTransform(i))||(this._shell||!this._children)&&!this.getBounds({internal:!0,stroke:!0,handle:!0}).expand(o.multiply(2))._containsPoint(i))return null;var h,u,l=!(s.guides&&!this._guide||s.selected&&!this.isSelected()||s.type&&s.type!==D.hyphenate(this._class)||s.class&&!(this instanceof s.class)),c=s.match,d=this;function f(t){if(Array.isArray(t)){for(var e=null,n=0,i=t.length;n<i;n++)var r=f(t[n]),e=e||r;return e}return(t=t&&c&&!c(t)?null:t)&&s.all&&(t.point&&(t.point=d.getGlobalMatrix().transform(t.point)),s.all.push(t)),t}function _(t,e){var n=e?h["get"+e]():d.getPosition();if(i.subtract(n).divide(o).length<=1)return new O(t,d,{name:e?D.hyphenate(e):t,point:n})}t=s.position,e=s.center,a=s.bounds;if(l&&this._parent&&(t||e||a)){if((e||a)&&(h=this.getInternalBounds()),!(u=t&&_("position")||e&&_("center","Center"))&&a)for(var g=["TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],p=0;p<8&&!u;p++)u=_("bounds",g[p]);u=f(u)}return(u=u||(this._hitTestChildren(i,s,r)||l&&f(this._hitTestSelf(i,s,r,this.getStrokeScaling()?null:r._shiftless().invert()))||null))&&u.point&&!s.all&&(u.point=n.transform(u.point)),u},_hitTestSelf:function(t,e){if(e.fill&&this.getFillColor()&&this._contains(t))return new O("fill",this)},matches:function(t,e){var n=typeof t;if("object"==n){for(var i in t)if(t.hasOwnProperty(i)&&!this.matches(i,t[i]))return!1;return!0}if("function"==n)return t(this);if("match"===t)return e(this);n=/^(empty|editable)$/.test(t)?this["is"+D.capitalize(t)]():"type"===t?D.hyphenate(this._class):this[t];if("class"===t){if("function"==typeof e)return this instanceof e;n=this._class}if("function"==typeof e)return!!e(n);if(e){if(e.test)return e.test(n);if(D.isPlainObject(e))return function t(e,n){for(var i in e)if(e.hasOwnProperty(i)){var r=e[i],i=n[i];if(D.isPlainObject(r)&&D.isPlainObject(i)){if(!t(r,i))return!1}else if(!D.equals(r,i))return!1}return!0}(e,n)}return D.equals(n,e)},getItems:function(t){return V._getItems(this,t,this._matrix)},getItem:function(t){return V._getItems(this,t,this._matrix,null,!0)[0]||null},statics:{_getItems:function t(e,n,i,r,s){var a,o,h;r||(o=(a="object"==typeof n&&n)&&a.overlapping,h=a&&a.inside,u=(v=o||h)&&b.read([v]),r={items:[],recursive:!a||!1!==a.recursive,inside:!!h,overlapping:!!o,rect:u,path:o&&new U.Rectangle({rectangle:u,insert:!1})},a&&(n=D.filter({},n,{recursive:!0,inside:!0,overlapping:!0})));var u,l=e._children,c=r.items;i=(u=r.rect)&&(i||new A);for(var d=0,f=l&&l.length;d<f;d++){var _=l[d],g=i&&i.appended(_._matrix),p=!0;if(u){var v=_.getBounds(g);if(!u.intersects(v))continue;u.contains(v)||r.overlapping&&(v.contains(u)||r.path.intersects(_,g))||(p=!1)}if(p&&_.matches(n)&&(c.push(_),s))break;if(!1!==r.recursive&&t(_,n,g,r,s),s&&0<c.length)break}return c}}},{importJSON:function(t){var e=(t="string"==typeof t?JSON.parse(t):t)&&t[0]===this._class&&t[1];if(D.isPlainObject(e)){var n,i=new this.constructor(V.NO_INSERT),r={};for(n in D.set({},this._serializeFields,this instanceof v?null:this._style._defaults))n in e||D.equals(this[n],i[n])||(r[n]=i[n]);this.set(r)}t=D.importJSON(t,this);return t!==this?this.addChild(t):t},addChild:function(t){return this.insertChild(j,t)},insertChild:function(t,e){e=e?this.insertChildren(t,[e]):null;return e&&e[0]},addChildren:function(t){return this.insertChildren(this._children.length,t)},insertChildren:function(t,e){var n=this._children;if(n&&e&&0<e.length){for(var i={},r=(e=D.slice(e)).length-1;0<=r;r--){var s=(u=e[r])&&u._id;!u||i[s]?e.splice(r,1):(u._remove(!1,!0),i[s]=!0)}D.splice(n,e,t,0);for(var a=this._project,o=a._changes,r=0,h=e.length;r<h;r++){var u,l=(u=e[r])._name;u._parent=this,u._setProject(a,!0),l&&u.setName(l),o&&u._changed(5)}this._changed(11)}else e=null;return e},_insertItem:"#insertChild",_insertAt:function(t,e){var n=t&&t._getOwner(),i=t!==this&&n?this:null;return i&&(i._remove(!1,!0),n._insertItem(t._index+e,i)),i},insertAbove:function(t){return this._insertAt(t,1)},insertBelow:function(t){return this._insertAt(t,0)},sendToBack:function(){var t=this._getOwner();return t?t._insertItem(0,this):null},bringToFront:function(){var t=this._getOwner();return t?t._insertItem(j,this):null},appendTop:"#addChild",appendBottom:function(t){return this.insertChild(0,t)},moveAbove:"#insertAbove",moveBelow:"#insertBelow",addTo:function(t){return t._insertItem(j,this)},copyTo:function(t){return this.clone(!1).addTo(t)},reduce:function(t){var e=this._children;if(e&&1===e.length){t=e[0].reduce(t);return this._parent?(t.insertAbove(this),this.remove()):t.remove(),t}return this},_removeNamed:function(){var t,e,n,i,r=this._getOwner();r&&(t=r._children,-1!==(r=(i=(e=r._namedChildren)[n=this._name])?i.indexOf(this):-1)&&(t[n]==this&&delete t[n],i.splice(r,1),i.length?t[n]=i[0]:delete e[n]))},_remove:function(t,e){var n=this._getOwner(),i=this._project,r=this._index;return this._style&&this._style._dispose(),!!n&&(this._name&&this._removeNamed(),this._installEvents(!1),t&&i._changes&&this._changed(5),null!=r&&(i._activeLayer===this&&(i._activeLayer=this.getNextSibling()||this.getPreviousSibling()),D.splice(n._children,null,r,1)),e&&n._changed(11,this),!(this._parent=null))},remove:function(){return this._remove(!0,!0)},replaceWith:function(t){t=t&&t.insertBelow(this);return t&&this.remove(),t},removeChildren:function(t,e){if(!this._children)return null;t=t||0,e=D.pick(e,this._children.length);for(var n=D.splice(this._children,null,t,e-t),i=n.length-1;0<=i;i--)n[i]._remove(!0,!1);return 0<n.length&&this._changed(11),n},clear:"#removeChildren",reverseChildren:function(){if(this._children){this._children.reverse();for(var t=0,e=this._children.length;t<e;t++)this._children[t]._index=t;this._changed(11)}},isEmpty:function(t){var e=this._children,n=e?e.length:0;if(t){for(var i=0;i<n;i++)if(!e[i].isEmpty(t))return!1;return!0}return!n},isEditable:function(){for(var t=this;t;){if(!t._visible||t._locked)return!1;t=t._parent}return!0},hasFill:function(){return this.getStyle().hasFill()},hasStroke:function(){return this.getStyle().hasStroke()},hasShadow:function(){return this.getStyle().hasShadow()},_getOrder:function(t){function e(t){for(var e=[];e.unshift(t),t=t._parent;);return e}for(var n=e(this),i=e(t),r=0,s=Math.min(n.length,i.length);r<s;r++)if(n[r]!=i[r])return n[r]._index<i[r]._index?1:-1;return 0},hasChildren:function(){return this._children&&0<this._children.length},isInserted:function(){return!!this._parent&&this._parent.isInserted()},isAbove:function(t){return-1===this._getOrder(t)},isBelow:function(t){return 1===this._getOrder(t)},isParent:function(t){return this._parent===t},isChild:function(t){return t&&t._parent===this},isDescendant:function(t){for(var e=this;e=e._parent;)if(e===t)return!0;return!1},isAncestor:function(t){return!!t&&t.isDescendant(this)},isSibling:function(t){return this._parent===t._parent},isGroupedWith:function(t){for(var e=this._parent;e;){if(e._parent&&/^(Group|Layer|CompoundPath)$/.test(e._class)&&t.isDescendant(e))return!0;e=e._parent}return!1}},D.each(["rotate","scale","shear","skew"],function(n){var i="rotate"===n;this[n]=function(){var t=arguments,e=(i?D:L).read(t),t=L.read(t,0,{readNull:!0});return this.transform((new A)[n](e,t||this.getPosition(!0)))}},{translate:function(){var t=new A;return this.transform(t.translate.apply(t,arguments))},transform:function(t,e,n){var i,r,s=this._matrix,a=t&&!t.isIdentity(),o=n&&this._canApplyMatrix||this._applyMatrix&&(a||!s.isIdentity()||e&&this._children);if(!a&&!o)return this;a&&(!t.isInvertible()&&s.isInvertible()&&(s._backup=s.getValues()),s.prepend(t,!0),i=(r=this._style).getFillColor(!0),r=r.getStrokeColor(!0),i&&i.transform(t),r&&r.transform(t)),(o=o&&this._transformContent(s,e,n))&&((e=this._pivot)&&s._transformPoint(e,e,!0),s.reset(!0),n&&this._canApplyMatrix&&(this._applyMatrix=!0));var h=this._bounds,s=this._position;(a||o)&&this._changed(25);n=a&&h&&t.decompose();if(n&&n.skewing.isZero()&&n.rotation%90==0){for(var u in h){var l=h[u];l.nonscaling?delete h[u]:!o&&l.internal||(l=l.rect,t._transformBounds(l,l))}n=(this._bounds=h)[this._getBoundsCacheKey(this._boundsOptions||{})];n&&(this._position=this._getPositionFromBounds(n.rect))}else a&&s&&this._pivot&&(this._position=t._transformPoint(s,s));return this},_transformContent:function(t,e,n){var i=this._children;if(i){for(var r=0,s=i.length;r<s;r++)i[r].transform(t,e,n);return!0}},globalToLocal:function(){return this.getGlobalMatrix(!0)._inverseTransform(L.read(arguments))},localToGlobal:function(){return this.getGlobalMatrix(!0)._transformPoint(L.read(arguments))},parentToLocal:function(){return this._matrix._inverseTransform(L.read(arguments))},localToParent:function(){return this._matrix._transformPoint(L.read(arguments))},fitBounds:function(t,e){t=b.read(arguments),!0===(e=D.read(arguments))&&(e="cover");var n,i=this.getBounds(),r=t.width/i.width,s=t.height/i.height;function a(t){return 0<t&&isFinite(t)}n="fill"===e?new z((a(r)?t:i).width,(a(s)?t:i).height):(n=(n=[r,s].filter(a)).length?("cover"===e?Math.max:Math.min).apply(Math,n):1,i.getSize().multiply(n)),this.setBounds(new b(new L,n).setCenter(t.getCenter()))}}),{_setStyles:function(t,e,n,i){var r,s=this._style,a=this._matrix;s.hasFill()&&(t.fillStyle=s.getFillColor().toCanvasStyle(t,a,i)),s.hasStroke()&&(t.strokeStyle=s.getStrokeColor().toCanvasStyle(t,a,i),t.lineWidth=s.getStrokeWidth(),r=s.getStrokeJoin(),a=s.getStrokeCap(),i=s.getMiterLimit(),r&&(t.lineJoin=r),a&&(t.lineCap=a),i&&(t.miterLimit=i),Wt.support.nativeDash&&(a=s.getDashArray(),i=s.getDashOffset(),a&&a.length&&("setLineDash"in t?(t.setLineDash(a),t.lineDashOffset=i):(t.mozDash=a,t.mozDashOffset=i)))),s.hasShadow()&&(e=e.pixelRatio||1,e=(n=n._shiftless().prepend((new A).scale(e,e))).transform(new L(s.getShadowBlur(),0)),n=n.transform(this.getShadowOffset()),t.shadowColor=s.getShadowColor().toCanvasStyle(t),t.shadowBlur=e.getLength(),t.shadowOffsetX=n.x,t.shadowOffsetY=n.y)},draw:function(t,e,n){this._updateVersion=this._project._updateVersion;if(this._visible&&0!==this._opacity){var i=e.matrices,r=e.viewMatrix,s=this._matrix,a=i[i.length-1],o=a.appended(s);if(o.isInvertible()){r=r?r.appended(o):o,i.push(o),e.updateMatrix&&(this._globalMatrix=o,this._parentGlobalMatrix=this._parent&&a);var h=this._blendMode,u=q.clamp(this._opacity,0,1),l="normal"===h,c=gt.nativeModes[h],o=l&&1===u&&!this._isolated||e.dontStart||e.clip||(c||l&&u<1)&&this._canComposite(),l=e.pixelRatio||1;if(!o){var d,f,_=this.getStrokeBounds(r),g=this._style;g.getShadowColor(!0)&&(f=(d=r._shiftless()).transform(new L(g.getShadowBlur(!0),0)),v=d.transform(g.getShadowOffset(!0)),_=_.unite(new b(_.getPoint().add(v),_.getSize()).expand(3*f.getLength())));var p=t.canvas;if((_=_.intersect(new b(new L(e.offset),new z(p.width,p.height).divide(l)))).width<=0||_.height<=0)return void i.pop();d=e.offset,g=e.offset=_.getTopLeft().floor(),f=t,t=_t.getContext(_.getSize().ceil().add(1).multiply(l)),1!==l&&t.scale(l,l)}t.save();var v,p=n?n.appended(s):this._canScaleStroke&&!this.getStrokeScaling(!0)&&r,_=!o&&e.clipItem,n=!p||_;o?(t.globalAlpha=u,c&&(t.globalCompositeOperation=h)):n&&t.translate(-g.x,-g.y),_?((e.viewMatrix?e.viewMatrix.appended(a):a).applyToContext(t),e.clipItem.draw(t,e.extend({clip:!0,matrices:i.slice(0,-1)})),s.applyToContext(t)):n&&(o?s:r).applyToContext(t),p&&(t.setTransform(l,0,0,l,0,0),(v=e.offset)&&t.translate(-v.x,-v.y)),this._draw(t,e,r,p),t.restore(),i.pop(),e.clip&&!e.dontFinish&&t.clip(this.getFillRule()),o||(gt.process(h,t,f,u,g.subtract(d).multiply(l)),_t.release(t),e.offset=d)}}},_isUpdated:function(t){var e=this._parent;if(e instanceof G)return e._isUpdated(t);var n=this._updateVersion===t;return!n&&e&&e._visible&&e._isUpdated(t)&&(this._updateVersion=t,n=!0),n},_drawSelection:function(t,e,n,i,r){var s=this._selection,a=1&s,o=2&s||a&&this._selectBounds,s=4&s;if(((a=!this._drawSelected?!1:a)||o||s)&&this._isUpdated(r)&&this.isInserted()){var h=this.getSelectedColor(!0)||(h=this.getLayer())&&h.getSelectedColor(!0),e=e.appended(this.getGlobalMatrix(!0)),u=n/2;if(t.strokeStyle=t.fillStyle=h?h.toCanvasStyle(t):"#009dec",a&&this._drawSelected(t,e,i),s){var i=this.getPosition(!0),s=this._parent,i=s?s.localToGlobal(i):i,l=i.x,c=i.y;t.beginPath(),t.arc(l,c,u,0,2*Math.PI,!0),t.stroke();for(var d=[[0,-1],[1,0],[0,1],[-1,0]],f=u,_=n+1,g=0;g<4;g++){var p=d[g],v=p[0],p=p[1];t.moveTo(l+v*f,c+p*f),t.lineTo(l+v*_,c+p*_),t.stroke()}}if(o){var m=e._transformCorners(this.getInternalBounds());t.beginPath();for(g=0;g<8;g++)t[g?"lineTo":"moveTo"](m[g],m[++g]);t.closePath(),t.stroke();for(g=0;g<8;g++)t.fillRect(m[g]-u,m[++g]-u,n,n)}}},_canComposite:function(){return!1}},D.each(["down","drag","up","move"],function(e){this["removeOn"+D.capitalize(e)]=function(){var t={};return t[e]=!0,this.removeOn(t)}},{removeOn:function(t){for(var e in t){var n;t[e]&&(n="mouse"+e,(e=(e=this._project)._removeSets=e._removeSets||{})[n]=e[n]||{},e[n][this._id]=this)}return this}}),{tween:function(t,e,n){n||(n=e,e=t,t=null,n||(n=e,e=null));var i=n&&n.easing,r=n&&n.start,n=null!=n&&("number"==typeof n?n:n.duration),s=new dt(this,t,e,n,i,r);return n&&this.on("frame",function t(e){s._handleFrame(1e3*e.time),s.running||this.off("frame",t)}),s},tweenTo:function(t,e){return this.tween(null,t,e)},tweenFrom:function(t,e){return this.tween(t,null,e)}}),v=V.extend({_class:"Group",_selectBounds:!1,_selectChildren:!0,_serializeFields:{isolated:!1,children:[]},_isolated:!1,initialize:function(t){this._children=[],this._namedChildren={},this._initialize(t)||this.addChildren(Array.isArray(t)?t:arguments)},_changed:function t(e){t.base.call(this,e),2050&e&&(this._clipItem=j)},_getClipItem:function(){if((t=this._clipItem)===j){for(var t=null,e=this._children,n=0,i=e.length;n<i;n++)if(e[n]._clipMask){t=e[n];break}this._clipItem=t}return t},isClipped:function(){return!!this._getClipItem()},setClipped:function(t){var e=this.getFirstChild();e&&e.setClipMask(t)},isIsolated:function(){return this._isolated},setIsolated:function(t){this._isolated=!!t,this._changed(257)},_getBounds:function t(e,n){var i=this._getClipItem();return i?i._getCachedBounds(i._matrix.prepended(e),D.set({},n,{stroke:!1})):t.base.call(this,e,n)},_hitTestChildren:function t(e,n,i){var r=this._getClipItem();return(!r||r.contains(e))&&t.base.call(this,e,n,i,r)},_hitTestSelf:function(t,e,n){if(e.match||e.class||e.type||e.all){n=this._hitTestChildren(t,e.extend({all:null,match:null,class:null,type:null}),n);return n&&(n.item=this),n}},_draw:function(t,e){var n=e.clip,i=this._getClipItem();e=e.extend({clipItem:!n&&i,clip:!1}),n?(t.beginPath(),e.dontStart=e.dontFinish=!0):i&&i.draw(t,e.extend({clip:!0}));for(var r=this._children,s=0,a=r.length;s<a;s++){var o=r[s];o!==i&&o.draw(t,e)}}}),a=v.extend({_class:"Layer",initialize:function(){v.apply(this,arguments)},_getOwner:function(){return this._parent||null!=this._index&&this._project},isInserted:function t(){return this._parent?t.base.call(this):null!=this._index},activate:function(){this._project._activeLayer=this},_hitTestSelf:function(){}}),g=V.extend({_class:"Shape",_applyMatrix:!1,_canApplyMatrix:!1,_canScaleStroke:!0,_serializeFields:{type:null,size:null,radius:null},_prioritize:["type"],initialize:function(t,e){this._initialize(t,e)},_equals:function(t){return this._type===t._type&&this._size.equals(t._size)&&D.equals(this._radius,t._radius)},copyContent:function(t){this.setType(t._type),this.setSize(t._size),this.setRadius(t._radius)},getType:function(){return this._type},setType:function(t){this._type=t},getShape:"#getType",setShape:"#setType",getSize:function(){var t=this._size;return new n(t.width,t.height,this,"setSize")},setSize:function(){var t,e,n,i=z.read(arguments);this._size?this._size.equals(i)||(t=this._type,e=i.width,n=i.height,"rectangle"===t?this._radius.set(z.min(this._radius,i.divide(2).abs())):"circle"===t?(e=n=(e+n)/2,this._radius=e/2):"ellipse"===t&&this._radius._set(e/2,n/2),this._size._set(e,n),this._changed(9)):this._size=i.clone()},getRadius:function(){var t=this._radius;return"circle"===this._type?t:new n(t.width,t.height,this,"setRadius")},setRadius:function(t){var e=this._type;if("circle"===e){if(t===this._radius)return;var n=2*t;this._radius=t,this._size?this._size._set(n,n):this._size=new z(n,n)}else if(t=z.read(arguments),this._radius){if(this._radius.equals(t))return;this._radius.set(t),"rectangle"===e?(n=z.max(this._size,t.multiply(2)),this._size.set(n)):"ellipse"===e&&this._size._set(2*t.width,2*t.height)}else this._radius=t.clone();this._changed(9)},isEmpty:function(){return!1},toPath:function(t){var e=this._asPathItem();return Wt.settings.applyMatrix&&e.setApplyMatrix(!0),D.pick(t,Wt.settings.insertItems)&&e.insertAbove(this),e},toShape:"#clone",_asPathItem:function(){var t=new U[D.capitalize(this._type)]({center:new L,size:this._size,radius:this._radius,insert:!1});return t.copyAttributes(this),t},_draw:function(t,e,n,i){var r,s,a,o,h,u=this._style,l=u.hasFill(),c=u.hasStroke(),d=e.dontFinish||e.clip,f=!i;(l||c||d)&&(a=this._type,o=this._radius,h="circle"===a,e.dontStart||t.beginPath(),f&&h?t.arc(0,0,o,0,2*Math.PI,!0):(r=h?o:o.width,s=h?o:o.height,o=(h=this._size).width,h=h.height,f&&"rectangle"===a&&0===r&&0===s?t.rect(-o/2,-h/2,o,h):(h=[-(f=o/2),-(a=h/2)+s,-f,(h=s*(o=.44771525016920644))-a,(o=r*o)-f,-a,-f+r,-a,f-r,-a,f-o,-a,f,h-a,f,-a+s,f,a-s,f,a-h,f-o,a,f-r,a,-f+r,a,o-f,a,-f,a-h,-f,a-s],i&&i.transform(h,h,32),t.moveTo(h[0],h[1]),t.bezierCurveTo(h[2],h[3],h[4],h[5],h[6],h[7]),f!==r&&t.lineTo(h[8],h[9]),t.bezierCurveTo(h[10],h[11],h[12],h[13],h[14],h[15]),a!==s&&t.lineTo(h[16],h[17]),t.bezierCurveTo(h[18],h[19],h[20],h[21],h[22],h[23]),f!==r&&t.lineTo(h[24],h[25]),t.bezierCurveTo(h[26],h[27],h[28],h[29],h[30],h[31]))),t.closePath()),d||!l&&!c||(this._setStyles(t,e,n,i),l&&(t.fill(u.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),c&&t.stroke())},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_getBounds:function(t,e){var n,i=this._size,r=new b(i).setCenter(0,0),s=this._style,a=e.stroke&&s.hasStroke()&&s.getStrokeWidth();return t&&(r="rectangle"===this._type?t._transformBounds(r):(n=i.width/2,s=i.height/2,i=Math.sqrt(Math.pow(t._a*n,2)+Math.pow(t._c*s,2)),s=Math.sqrt(Math.pow(t._b*n,2)+Math.pow(t._d*s,2)),new b(t._tx-i,t._ty-s,2*i,2*s))),a?r.expand(U._getStrokePadding(a,this._getStrokeMatrix(t,e))):r}},new function(){function d(t,e,n){var i=t._radius;if(!i.isZero())for(var r=t._size.divide(2),s=1;s<=4;s++){var a=new L(1<s&&s<4?-1:1,2<s?-1:1),o=a.multiply(r),h=o.subtract(a.multiply(i));if(new b(n?o.add(a.multiply(n)):o,h).contains(e))return{point:h,quadrant:s}}}function f(t,e,n,i){t=t.divide(e);return(!i||t.isInQuadrant(i))&&t.subtract(t.normalize()).multiply(e).divide(n).length<=1}return{_contains:function t(e){if("rectangle"!==this._type)return e.divide(this.size).getLength()<=.5;var n=d(this,e);return n?e.subtract(n.point).divide(this._radius).getLength()<=1:t.base.call(this,e)},_hitTestSelf:function t(e,n,i,r){var s,a,o,h=!1,u=this._style,l=n.stroke&&u.hasStroke(),c=n.fill&&!!u.getFillColor();return(l||c)&&(a=this._type,s=this._radius,o=l?u.getStrokeWidth()/2:0,c=n._tolerancePadding.add(U._getStrokePadding(o,!u.getStrokeScaling()&&r)),h="rectangle"===a?(u=d(this,e,o=c.multiply(2)))?f(e.subtract(u.point),s,c,u.quadrant):(u=(a=new b(this._size).setCenter(0,0)).expand(o),o=a.expand(o.negate()),u._containsPoint(e)&&!o._containsPoint(e)):f(e,s,c)),h?new O(l?"stroke":"fill",this):t.base.apply(this,arguments)}}},{statics:new function(){function i(t,e,n,i,r){var s=D.create(g.prototype);return s._type=t,s._size=n,s._radius=i,s._initialize(D.getNamed(r),e),s}return{Circle:function(){var t=arguments,e=L.readNamed(t,"center"),n=D.readNamed(t,"radius");return i("circle",e,new z(2*n),n,t)},Rectangle:function(){var t=arguments,e=b.readNamed(t,"rectangle"),n=z.min(z.readNamed(t,"radius"),e.getSize(!0).divide(2));return i("rectangle",e.getCenter(!0),e.getSize(!0),n,t)},Ellipse:function(){var t=arguments,e=g._readEllipse(t),n=e.radius;return i("ellipse",e.center,n.multiply(2),n,t)},_readEllipse:function(t){var e,n;return n=D.hasNamed(t,"radius")?(e=L.readNamed(t,"center"),z.readNamed(t,"radius")):(e=(n=b.readNamed(t,"rectangle")).getCenter(!0),n.getSize(!0).divide(2)),{center:e,radius:n}}}}}),_=V.extend({_class:"Raster",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!1,handle:!1},_serializeFields:{crossOrigin:null,size:new z,source:null},_prioritize:["crossOrigin"],_smoothing:"low",beans:!0,initialize:function(t,e){var n,i;this._initialize(t,e!==j&&L.read([e]))||((i="string"==(i=typeof t)?k.getElementById(t):"object"==i?t:null)&&i!==V.NO_INSERT&&(i.getContext||null!=i.naturalHeight?n=i:i&&((i=z.read(arguments)).isZero()||(n=_t.getCanvas(i)))),n?this.setImage(n):this.setSource(t)),this._size||(this._size=new z,this._loaded=!1)},_equals:function(t){return this.getSource()===t.getSource()},copyContent:function(t){var e=t._image,n=t._canvas;e?this._setImage(e):n&&((e=_t.getCanvas(t._size)).getContext("2d").drawImage(n,0,0),this._setImage(e)),this._crossOrigin=t._crossOrigin},getSize:function(){var t=this._size;return new n(t?t.width:0,t?t.height:0,this,"setSize")},setSize:function(t,e){var n,i=z.read(arguments);i.equals(this._size)?e&&this.clear():0<i.width&&0<i.height?(n=!e&&this.getElement(),this._setImage(_t.getCanvas(i)),n&&this.getContext(!0).drawImage(n,0,0,i.width,i.height)):(this._canvas&&_t.release(this._canvas),this._size=i.clone())},getWidth:function(){return this._size?this._size.width:0},setWidth:function(t){this.setSize(t,this.getHeight())},getHeight:function(){return this._size?this._size.height:0},setHeight:function(t){this.setSize(this.getWidth(),t)},getLoaded:function(){return this._loaded},isEmpty:function(){var t=this._size;return!t||0===t.width&&0===t.height},getResolution:function(){var t=this._matrix,e=new L(0,0).transform(t),n=new L(1,0).transform(t).subtract(e),e=new L(0,1).transform(t).subtract(e);return new z(72/n.getLength(),72/e.getLength())},getPpi:"#getResolution",getImage:function(){return this._image},setImage:function(e){var i=this;function n(t){var e=i.getView(),n=t&&t.type||"load";e&&i.responds(n)&&(Wt=e._scope,i.emit(n,new ot(t)))}this._setImage(e),this._loaded?setTimeout(n,0):e&&F.add(e,{load:function(t){i._setImage(e),n(t)},error:n})},set:function t(e,n){return e&&e.source&&e.size&&(this._size=new z(e.size),n=D.set({size:!0},n)),t.base.call(this,e,n)},_setImage:function(t){this._canvas&&_t.release(this._canvas),t&&t.getContext?(this._image=null,this._canvas=t,this._loaded=!0):(this._image=t,this._canvas=null,this._loaded=!!(t&&t.src&&t.complete)),this._size=t&&!this._loaded?this._size||new z:new z(t?t.naturalWidth||t.width:0,t?t.naturalHeight||t.height:0),this._context=null,this._changed(1033)},getCanvas:function(){if(!this._canvas){var e=_t.getContext(this._size);try{this._image&&e.drawImage(this._image,0,0),this._canvas=e.canvas}catch(t){_t.release(e)}}return this._canvas},setCanvas:"#setImage",getContext:function(t){return this._context||(this._context=this.getCanvas().getContext("2d")),t&&(this._image=null,this._changed(1025)),this._context},setContext:function(t){this._context=t},getSource:function(){var t=this._image;return t&&t.src||this.toDataURL()},setSource:function(t){var e=new u.Image,n=this._crossOrigin;n&&(e.crossOrigin=n),t&&(e.src=t),this.setImage(e)},getCrossOrigin:function(){var t=this._image;return t&&t.crossOrigin||this._crossOrigin||""},setCrossOrigin:function(t){this._crossOrigin=t;var e=this._image;e&&(e.crossOrigin=t)},getSmoothing:function(){return this._smoothing},setSmoothing:function(t){this._smoothing="string"==typeof t?t:t?"low":"off",this._changed(257)},getElement:function(){return this._canvas||this._loaded&&this._image}},{beans:!1,getSubCanvas:function(){var t=b.read(arguments),e=_t.getContext(t.getSize());return e.drawImage(this.getCanvas(),t.x,t.y,t.width,t.height,0,0,t.width,t.height),e.canvas},getSubRaster:function(){var t=b.read(arguments),e=new _(V.NO_INSERT);return e._setImage(this.getSubCanvas(t)),e.translate(t.getCenter().subtract(this.getSize().divide(2))),e._matrix.prepend(this._matrix),e.insertAbove(this),e},toDataURL:function(){var t=this._image,t=t&&t.src;if(/^data:/.test(t))return t;t=this.getCanvas();return t?t.toDataURL.apply(t,arguments):null},drawImage:function(t){var e=L.read(arguments,1);this.getContext(!0).drawImage(t,e.x,e.y)},getAverageColor:function(t){if(t?t instanceof y?i=(r=t).getBounds():"object"==typeof t&&("width"in t?i=new b(t):"x"in t&&(i=new b(t.x-.5,t.y-.5,1,1))):i=this.getBounds(),!i)return null;var e=Math.min(i.width,32),n=Math.min(i.height,32),t=_._sampleContext;t?t.clearRect(0,0,33,33):t=_._sampleContext=_t.getContext(new z(32)),t.save();var i=(new A).scale(e/i.width,n/i.height).translate(-i.x,-i.y);i.applyToContext(t),r&&r.draw(t,new D({clip:!0,matrices:[i]})),this._matrix.applyToContext(t);var r=this.getElement(),i=this._size;r&&t.drawImage(r,-i.width/2,-i.height/2),t.restore();for(var s=t.getImageData(.5,.5,Math.ceil(e),Math.ceil(n)).data,a=[0,0,0],o=0,h=0,u=s.length;h<u;h+=4){var l=s[h+3];o+=l,l/=255,a[0]+=s[h]*l,a[1]+=s[h+1]*l,a[2]+=s[h+2]*l}for(h=0;h<3;h++)a[h]/=o;return o?M.read(a):null},getPixel:function(){var t=L.read(arguments),t=this.getContext().getImageData(t.x,t.y,1,1).data;return new M("rgb",[t[0]/255,t[1]/255,t[2]/255],t[3]/255)},setPixel:function(){var t=arguments,e=L.read(t),n=M.read(t),i=n._convert("rgb"),r=n._alpha,s=this.getContext(!0),t=s.createImageData(1,1),n=t.data;n[0]=255*i[0],n[1]=255*i[1],n[2]=255*i[2],n[3]=null!=r?255*r:255,s.putImageData(t,e.x,e.y)},clear:function(){var t=this._size;this.getContext(!0).clearRect(0,0,t.width+1,t.height+1)},createImageData:function(){var t=z.read(arguments);return this.getContext().createImageData(t.width,t.height)},getImageData:function(){var t=b.read(arguments);return t.isEmpty()&&(t=new b(this._size)),this.getContext().getImageData(t.x,t.y,t.width,t.height)},putImageData:function(t){var e=L.read(arguments,1);this.getContext(!0).putImageData(t,e.x,e.y)},setImageData:function(t){this.setSize(t),this.getContext(!0).putImageData(t,0,0)},_getBounds:function(t,e){var n=new b(this._size).setCenter(0,0);return t?t._transformBounds(n):n},_hitTestSelf:function(t){if(this._contains(t)){var e=this;return new O("pixel",e,{offset:t.add(e._size.divide(2)).round(),color:{get:function(){return e.getPixel(this.offset)}}})}},_draw:function(t,e,n){var i,r=this.getElement();e.dontFinish||e.clip?(i=this.getInternalBounds(),e.dontStart||t.beginPath(),t.rect(i.x,i.y,i.width,i.height)):r&&0<r.width&&0<r.height&&(t.globalAlpha=q.clamp(this._opacity,0,1),this._setStyles(t,e,n),e=this._smoothing,B.setPrefixed(t,(n="off"===e)?"imageSmoothingEnabled":"imageSmoothingQuality",!n&&e),t.drawImage(r,-this._size.width/2,-this._size.height/2))},_canComposite:function(){return!0}}),h=V.extend({_class:"SymbolItem",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!0},_serializeFields:{symbol:null},initialize:function(t,e){this._initialize(t,e!==j&&L.read(arguments,1))||this.setDefinition(t instanceof m?t:new m(t))},_equals:function(t){return this._definition===t._definition},copyContent:function(t){this.setDefinition(t._definition)},getDefinition:function(){return this._definition},setDefinition:function(t){this._definition=t,this._changed(9)},getSymbol:"#getDefinition",setSymbol:"#setDefinition",isEmpty:function(){return this._definition._item.isEmpty()},_getBounds:function(t,e){var n=this._definition._item;return n._getCachedBounds(n._matrix.prepended(t),e)},_hitTestSelf:function(t,e,n){e=e.extend({all:!1,match:null,class:null,type:null}),n=this._definition._item._hitTest(t,e,n);return n&&(n.item=this),n},_draw:function(t,e){this._definition._item.draw(t,e.extend({updateMatrix:!1}))}}),m=D.extend({_class:"SymbolDefinition",initialize:function(t,e){this._id=o.get(),this.project=Wt.project,t&&this.setItem(t,e)},_serialize:function(t,e){return e.add(this,function(){return D.serialize([this._class,this._item],t,!1,e)})},_changed:function(t){8&t&&V._clearBoundsCache(this),1&t&&this.project._changed(t)},getItem:function(){return this._item},setItem:function(t,e){t._symbol&&(t=t.clone()),this._item&&(this._item._symbol=null),(this._item=t).remove(),t.setSelected(!1),e||t.setPosition(new L),(t._symbol=this)._changed(9)},getDefinition:"#getItem",setDefinition:"#setItem",place:function(t){return new h(this,t)},clone:function(){return new m(this._item.clone(!1))},equals:function(t){return t===this||t&&this._item.equals(t._item)||!1}}),O=D.extend({_class:"HitResult",initialize:function(t,e,n){this.type=t,this.item=e,n&&this.inject(n)},statics:{getOptions:function(t){t=t&&D.read(t);return new D({type:null,tolerance:Wt.settings.hitTolerance,fill:!t,stroke:!t,segments:!t,handles:!1,ends:!1,position:!1,center:!1,bounds:!1,guides:!1,selected:!1},t)}}}),H=D.extend({_class:"Segment",beans:!0,_selection:0,initialize:function(t,e,n,i,r,s){var a,o,h,u,l=arguments.length;0<l&&(null==t||"object"==typeof t?u=1===l&&t&&"point"in t?(a=t.point,o=t.handleIn,h=t.handleOut,t.selection):(a=t,o=e,h=n,i):(a=[t,e],o=n!==j?[n,i]:null,h=r!==j?[r,s]:null)),new p(a,this,"_point"),new p(o,this,"_handleIn"),new p(h,this,"_handleOut"),u&&this.setSelection(u)},_serialize:function(t,e){var n=this._point,i=this._selection,n=i||this.hasHandles()?[n,this._handleIn,this._handleOut]:n;return i&&n.push(i),D.serialize(n,t,!0,e)},_changed:function(t){var e,n,i,r=this._path;r&&(e=r._curves,n=this._index,e&&(t&&t!==this._point&&t!==this._handleIn||!(i=0<n?e[n-1]:r._closed?e[e.length-1]:null)||i._changed(),t&&t!==this._point&&t!==this._handleOut||!(i=e[n])||i._changed()),r._changed(41))},getPoint:function(){return this._point},setPoint:function(){this._point.set(L.read(arguments))},getHandleIn:function(){return this._handleIn},setHandleIn:function(){this._handleIn.set(L.read(arguments))},getHandleOut:function(){return this._handleOut},setHandleOut:function(){this._handleOut.set(L.read(arguments))},hasHandles:function(){return!this._handleIn.isZero()||!this._handleOut.isZero()},isSmooth:function(){var t=this._handleIn,e=this._handleOut;return!t.isZero()&&!e.isZero()&&t.isCollinear(e)},clearHandles:function(){this._handleIn._set(0,0),this._handleOut._set(0,0)},getSelection:function(){return this._selection},setSelection:function(t){var e=this._selection,n=this._path;this._selection=t=t||0,n&&t!==e&&(n._updateSelection(this,e,t),n._changed(257))},_changeSelection:function(t,e){var n=this._selection;this.setSelection(e?n|t:n&~t)},isSelected:function(){return!!(7&this._selection)},setSelected:function(t){this._changeSelection(7,t)},getIndex:function(){return this._index!==j?this._index:null},getPath:function(){return this._path||null},getCurve:function(){var t=this._path,e=this._index;return t?(0<e&&!t._closed&&e===t._segments.length-1&&e--,t.getCurves()[e]||null):null},getLocation:function(){var t=this.getCurve();return t?new W(t,this===t._segment1?0:1):null},getNext:function(){var t=this._path&&this._path._segments;return t&&(t[this._index+1]||this._path._closed&&t[0])||null},smooth:function(t,e,n){var i=t||{},r=i.type,s=i.factor,a=this.getPrevious(),o=this.getNext(),h=(a||this)._point,u=this._point,l=(o||this)._point,c=h.getDistance(u),t=u.getDistance(l);if(r&&"catmull-rom"!==r){if("geometric"!==r)throw new Error("Smoothing method '"+r+"' not supported.");a&&o&&(i=h.subtract(l),r=(_=s===j?.4:s)*c/(c+t),e||this.setHandleIn(i.multiply(r)),n||this.setHandleOut(i.multiply(r-_)))}else{var d,f,_=s===j?.5:s,s=Math.pow(c,_),c=s*s,t=Math.pow(t,_),_=t*t;!e&&a&&(d=2*_+3*t*s+c,this.setHandleIn(0!==(f=3*t*(t+s))?new L((_*h._x+d*u._x-c*l._x)/f-u._x,(_*h._y+d*u._y-c*l._y)/f-u._y):new L)),!n&&o&&(d=2*c+3*s*t+_,this.setHandleOut(0!==(f=3*s*(s+t))?new L((c*l._x+d*u._x-_*h._x)/f-u._x,(c*l._y+d*u._y-_*h._y)/f-u._y):new L))}},getPrevious:function(){var t=this._path&&this._path._segments;return t&&(t[this._index-1]||this._path._closed&&t[t.length-1])||null},isFirst:function(){return!this._index},isLast:function(){var t=this._path;return t&&this._index===t._segments.length-1||!1},reverse:function(){var t=this._handleIn,e=this._handleOut,n=t.clone();t.set(e),e.set(n)},reversed:function(){return new H(this._point,this._handleOut,this._handleIn)},remove:function(){return!!this._path&&!!this._path.removeSegment(this._index)},clone:function(){return new H(this._point,this._handleIn,this._handleOut)},equals:function(t){return t===this||t&&this._class===t._class&&this._point.equals(t._point)&&this._handleIn.equals(t._handleIn)&&this._handleOut.equals(t._handleOut)||!1},toString:function(){var t=["point: "+this._point];return this._handleIn.isZero()||t.push("handleIn: "+this._handleIn),this._handleOut.isZero()||t.push("handleOut: "+this._handleOut),"{ "+t.join(", ")+" }"},transform:function(t){this._transformCoordinates(t,new Array(6),!0),this._changed()},interpolate:function(t,e,n){var i=1-n,r=n,s=t._point,a=e._point,o=t._handleIn,n=e._handleIn,e=e._handleOut,t=t._handleOut;this._point._set(i*s._x+r*a._x,i*s._y+r*a._y,!0),this._handleIn._set(i*o._x+r*n._x,i*o._y+r*n._y,!0),this._handleOut._set(i*t._x+r*e._x,i*t._y+r*e._y,!0),this._changed()},_transformCoordinates:function(t,e,n){var i=this._point,r=n&&this._handleIn.isZero()?null:this._handleIn,s=n&&this._handleOut.isZero()?null:this._handleOut,a=i._x,o=i._y,h=2;return e[0]=a,e[1]=o,r&&(e[h++]=r._x+a,e[h++]=r._y+o),s&&(e[h++]=s._x+a,e[h++]=s._y+o),t&&(t._transformCoordinates(e,e,h/2),a=e[0],o=e[1],n?(i._x=a,i._y=o,h=2,r&&(r._x=e[h++]-a,r._y=e[h++]-o),s&&(s._x=e[h++]-a,s._y=e[h++]-o)):(r||(e[h++]=a,e[h++]=o),s||(e[h++]=a,e[h++]=o))),e}}),p=L.extend({initialize:function(t,e,n){var i,r,s;t?(i=t[0])!==j?r=t[1]:((i=(s=t).x)===j&&(i=(s=L.read(arguments)).x),r=s.y,s=s.selected):i=r=0,this._x=i,this._y=r,(this._owner=e)[n]=this,s&&this.setSelected(!0)},_set:function(t,e){return this._x=t,this._y=e,this._owner._changed(this),this},getX:function(){return this._x},setX:function(t){this._x=t,this._owner._changed(this)},getY:function(){return this._y},setY:function(t){this._y=t,this._owner._changed(this)},isZero:function(){var t=q.isZero;return t(this._x)&&t(this._y)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(t){this._owner._changeSelection(this._getSelection(),t)},_getSelection:function(){var t=this._owner;return this===t._point?1:this===t._handleIn?2:this===t._handleOut?4:0}}),Z=D.extend({_class:"Curve",beans:!0,initialize:function(t,e,n,i,r,s,a,o){var h,u,l,c,d,f,_=arguments.length;3===_?(this._path=t,h=e,u=n):_?1===_?"segment1"in t?(h=new H(t.segment1),u=new H(t.segment2)):"point1"in t?(l=t.point1,d=t.handle1,f=t.handle2,c=t.point2):Array.isArray(t)&&(l=[t[0],t[1]],c=[t[6],t[7]],d=[t[2]-t[0],t[3]-t[1]],f=[t[4]-t[6],t[5]-t[7]]):2===_?(h=new H(t),u=new H(e)):4===_?(l=t,d=e,f=n,c=i):8===_&&(l=[t,e],c=[a,o],d=[n-t,i-e],f=[r-a,s-o]):(h=new H,u=new H),this._segment1=h||new H(l,null,d),this._segment2=u||new H(c,f,null)},_serialize:function(t,e){return D.serialize(this.hasHandles()?[this.getPoint1(),this.getHandle1(),this.getHandle2(),this.getPoint2()]:[this.getPoint1(),this.getPoint2()],t,!0,e)},_changed:function(){this._length=this._bounds=j},clone:function(){return new Z(this._segment1,this._segment2)},toString:function(){var t=["point1: "+this._segment1._point];return this._segment1._handleOut.isZero()||t.push("handle1: "+this._segment1._handleOut),this._segment2._handleIn.isZero()||t.push("handle2: "+this._segment2._handleIn),t.push("point2: "+this._segment2._point),"{ "+t.join(", ")+" }"},classify:function(){return Z.classify(this.getValues())},remove:function(){var t,e,n=!1;return this._path&&(e=(t=this._segment2)._handleOut,(n=t.remove())&&this._segment1._handleOut.set(e)),n},getPoint1:function(){return this._segment1._point},setPoint1:function(){this._segment1._point.set(L.read(arguments))},getPoint2:function(){return this._segment2._point},setPoint2:function(){this._segment2._point.set(L.read(arguments))},getHandle1:function(){return this._segment1._handleOut},setHandle1:function(){this._segment1._handleOut.set(L.read(arguments))},getHandle2:function(){return this._segment2._handleIn},setHandle2:function(){this._segment2._handleIn.set(L.read(arguments))},getSegment1:function(){return this._segment1},getSegment2:function(){return this._segment2},getPath:function(){return this._path},getIndex:function(){return this._segment1._index},getNext:function(){var t=this._path&&this._path._curves;return t&&(t[this._segment1._index+1]||this._path._closed&&t[0])||null},getPrevious:function(){var t=this._path&&this._path._curves;return t&&(t[this._segment1._index-1]||this._path._closed&&t[t.length-1])||null},isFirst:function(){return!this._segment1._index},isLast:function(){var t=this._path;return t&&this._segment1._index===t._curves.length-1||!1},isSelected:function(){return this.getPoint1().isSelected()&&this.getHandle1().isSelected()&&this.getHandle2().isSelected()&&this.getPoint2().isSelected()},setSelected:function(t){this.getPoint1().setSelected(t),this.getHandle1().setSelected(t),this.getHandle2().setSelected(t),this.getPoint2().setSelected(t)},getValues:function(t){return Z.getValues(this._segment1,this._segment2,t)},getPoints:function(){for(var t=this.getValues(),e=[],n=0;n<8;n+=2)e.push(new L(t[n],t[n+1]));return e}},{getLength:function(){return null==this._length&&(this._length=Z.getLength(this.getValues(),0,1)),this._length},getArea:function(){return Z.getArea(this.getValues())},getLine:function(){return new N(this._segment1._point,this._segment2._point)},getPart:function(t,e){return new Z(Z.getPart(this.getValues(),t,e))},getPartLength:function(t,e){return Z.getLength(this.getValues(),t,e)},divideAt:function(t){return this.divideAtTime(t&&t.curve===this?t.time:this.getTimeAt(t))},divideAtTime:function(t,e){var n,i,r,s,a,o,h=null;return 1e-8<=t&&t<=1-1e-8&&(n=(o=Z.subdivide(this.getValues(),t))[0],i=o[1],r=e||this.hasHandles(),s=this._segment1,a=this._segment2,t=this._path,r&&(s._handleOut._set(n[2]-n[0],n[3]-n[1]),a._handleIn._set(i[4]-i[6],i[5]-i[7])),o=n[6],e=n[7],e=new H(new L(o,e),r&&new L(n[4]-o,n[5]-e),r&&new L(i[2]-o,i[3]-e)),h=t?(t.insert(s._index+1,e),this.getNext()):(this._segment2=e,this._changed(),new Z(e,a))),h},splitAt:function(t){var e=this._path;return e?e.splitAt(t):null},splitAtTime:function(t){return this.splitAt(this.getLocationAtTime(t))},divide:function(t,e){return this.divideAtTime(t===j?.5:e?t:this.getTimeAt(t))},split:function(t,e){return this.splitAtTime(t===j?.5:e?t:this.getTimeAt(t))},reversed:function(){return new Z(this._segment2.reversed(),this._segment1.reversed())},clearHandles:function(){this._segment1._handleOut._set(0,0),this._segment2._handleIn._set(0,0)},statics:{getValues:function(t,e,n,i){var r=t._point,s=t._handleOut,a=e._handleIn,o=e._point,t=r.x,e=r.y,r=o.x,o=o.y,o=i?[t,e,t,e,r,o,r,o]:[t,e,t+s._x,e+s._y,r+a._x,o+a._y,r,o];return n&&n._transformCoordinates(o,o,4),o},subdivide:function(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],h=t[6],u=t[7],l=1-(e=e===j?.5:e),c=l*n+e*r,d=l*i+e*s,f=l*r+e*a,_=l*s+e*o,t=l*a+e*h,r=l*o+e*u,s=l*c+e*f,a=l*d+e*_,o=l*f+e*t,f=l*_+e*r,_=l*s+e*o,e=l*a+e*f;return[[n,i,c,d,s,a,_,e],[_,e,o,f,t,r,h,u]]},getMonoCurves:function(t,e){var n,i,r=[],s=e?0:1,a=t[0+s],o=t[2+s],e=t[4+s],s=t[6+s];return!(o<=a==e<=o&&e<=o==s<=e||Z.isStraight(t))&&(i=q.solveQuadratic(3*(o-e)-a+s,2*(a+e)-4*o,o-a,n=[],1e-8,1-1e-8))?(n.sort(),o=n[0],a=Z.subdivide(t,o),r.push(a[0]),1<i&&(o=(n[1]-o)/(1-o),a=Z.subdivide(a[1],o),r.push(a[0])),r.push(a[1])):r.push(t),r},solveCubic:function(t,e,n,i,r,s){var a=t[e],o=t[e+2],h=t[e+4],t=t[e+6],e=0;return e=!(a<n&&t<n&&o<n&&h<n||n<a&&n<t&&n<o&&n<h)?q.solveCubic(t-a-(t=3*(o-a))-(o=3*(h-o)-t),o,t,a-n,i,r,s):e},getTimeOf:function(t,e){var n=new L(t[0],t[1]),i=new L(t[6],t[7]);if(null===(e.isClose(n,1e-12)?0:e.isClose(i,1e-12)?1:null))for(var r=[e.x,e.y],s=[],a=0;a<2;a++)for(var o=Z.solveCubic(t,a,r[a],s,0,1),h=0;h<o;h++){var u=s[h];if(e.isClose(Z.getPoint(t,u),1e-7))return u}return e.isClose(n,1e-7)?0:e.isClose(i,1e-7)?1:null},getNearestTime:function(n,i){if(Z.isStraight(n)){var t=n[0],e=n[1],r=n[6]-t,s=n[7]-e,a=r*r+s*s;if(0==a)return 0;a=((i.x-t)*r+(i.y-e)*s)/a;return a<1e-12?0:.999999999999<a?1:Z.getTimeOf(n,new L(t+a*r,e+a*s))}var o=1/0,h=0;function u(t){if(0<=t&&t<=1){var e=i.getDistance(Z.getPoint(n,t),!0);return e<o?(o=e,h=t,1):void 0}}for(var l=0;l<=100;l++)u(l/100);for(var c=.005;1e-8<c;)u(h-c)||u(h+c)||(c/=2);return h},getPart:function(t,e,n){var i,r=n<e;return r&&(i=e,e=n,n=i),0<e&&(t=Z.subdivide(t,e)[1]),n<1&&(t=Z.subdivide(t,(n-e)/(1-e))[0]),r?[t[6],t[7],t[4],t[5],t[2],t[3],t[0],t[1]]:t},isFlatEnough:function(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],h=t[6],t=t[7],r=3*r-2*n-h,s=3*s-2*i-t,n=3*a-2*h-n,i=3*o-2*t-i;return Math.max(r*r,n*n)+Math.max(s*s,i*i)<=16*e*e},getArea:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],t=t[7];return 3*((t-n)*(i+s)-(o-e)*(r+a)+r*(e-s)-i*(n-a)+t*(s+e/3)-o*(a+n/3))/20},getBounds:function(t){for(var e=t.slice(0,2),n=e.slice(),i=[0,0],r=0;r<2;r++)Z._addBounds(t[r],t[r+2],t[r+4],t[r+6],r,0,e,n,i);return new b(e[0],e[1],n[0]-e[0],n[1]-e[1])},_addBounds:function(t,e,n,i,r,s,a,o,h){function u(t,e){var n=t-e,e=t+e;n<a[r]&&(a[r]=n),e>o[r]&&(o[r]=e)}var l=a[r]+(s/=2),c=o[r]-s;if(t<l||e<l||n<l||i<l||c<t||c<e||c<n||c<i)if(e<t!=e<i&&n<t!=n<i)u(t,0),u(i,0);else{var d=q.solveQuadratic(3*(e-n)-t+i,2*(t+n)-4*e,e-t,h);u(i,0);for(var f=0;f<d;f++){var _=h[f],g=1-_;1e-8<=_&&_<=1-1e-8&&u(g*g*g*t+3*g*g*_*e+3*g*_*_*n+_*_*_*i,s)}}}}},D.each(["getBounds","getStrokeBounds"],function(t){this[t]=function(){return this._bounds||(this._bounds={}),(this._bounds[t]||(this._bounds[t]=U[t]([this._segment1,this._segment2],!1,this._path))).clone()}},{getHandleBounds:function(){var t=this.getValues(),e=Math.min(t[0],t[2],t[4],t[6]),n=Math.min(t[1],t[3],t[5],t[7]),i=Math.max(t[0],t[2],t[4],t[6]),t=Math.max(t[1],t[3],t[5],t[7]);return new b(e,n,i-e,t-n)}}),D.each({isStraight:function(t,e,n,i){if(e.isZero()&&n.isZero())return!0;var r=i.subtract(t);if(r.isZero())return!1;if(r.isCollinear(e)&&r.isCollinear(n)){var s=new N(t,i);if(s.getDistance(t.add(e))<1e-7&&s.getDistance(i.add(n))<1e-7){i=r.dot(r),e=r.dot(e)/i,i=r.dot(n)/i;return 0<=e&&e<=1&&i<=0&&-1<=i}}return!1},isLinear:function(t,e,n,i){t=i.subtract(t).divide(3);return e.equals(t)&&n.negate().equals(t)}},function(a,t){this[t]=function(t){var e=this._segment1,n=this._segment2;return a(e._point,e._handleOut,n._handleIn,n._point,t)},this.statics[t]=function(t,e){var n=t[0],i=t[1],r=t[6],s=t[7];return a(new L(n,i),new L(t[2]-n,t[3]-i),new L(t[4]-r,t[5]-s),new L(r,s),e)}},{statics:{},hasHandles:function(){return!this._segment1._handleOut.isZero()||!this._segment2._handleIn.isZero()},hasLength:function(t){return(!this.getPoint1().equals(this.getPoint2())||this.hasHandles())&&this.getLength()>(t||0)},isCollinear:function(t){return t&&this.isStraight()&&t.isStraight()&&this.getLine().isCollinear(t.getLine())},isHorizontal:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).y)<1e-8},isVertical:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).x)<1e-8}}),{beans:!1,getLocationAt:function(t,e){return this.getLocationAtTime(e?t:this.getTimeAt(t))},getLocationAtTime:function(t){return null!=t&&0<=t&&t<=1?new W(this,t):null},getTimeAt:function(t,e){return Z.getTimeAt(this.getValues(),t,e)},getParameterAt:"#getTimeAt",getTimesWithTangent:function(){var t=L.read(arguments);return t.isZero()?[]:Z.getTimesWithTangent(this.getValues(),t)},getOffsetAtTime:function(t){return this.getPartLength(0,t)},getLocationOf:function(){return this.getLocationAtTime(this.getTimeOf(L.read(arguments)))},getOffsetOf:function(){var t=this.getLocationOf.apply(this,arguments);return t?t.getOffset():null},getTimeOf:function(){return Z.getTimeOf(this.getValues(),L.read(arguments))},getParameterOf:"#getTimeOf",getNearestLocation:function(){var t=L.read(arguments),e=this.getValues(),n=Z.getNearestTime(e,t),e=Z.getPoint(e,n);return new W(this,n,e,null,t.getDistance(e))},getNearestPoint:function(){var t=this.getNearestLocation.apply(this,arguments);return t&&t.getPoint()}},new function(){var t=["getPoint","getTangent","getNormal","getWeightedTangent","getWeightedNormal","getCurvature"];return D.each(t,function(i){this[i+"At"]=function(t,e){var n=this.getValues();return Z[i](n,e?t:Z.getTimeAt(n,t))},this[i+"AtTime"]=function(t){return Z[i](this.getValues(),t)}},{statics:{_evaluateMethods:t}})},new function(){function l(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],t=t[7],h=9*(i-s)+3*(o-e),u=6*(e+s)-12*i,l=3*(i-e),c=9*(r-a)+3*(t-n),d=6*(n+a)-12*r,f=3*(r-n);return function(t){var e=(h*t+u)*t+l,t=(c*t+d)*t+f;return Math.sqrt(e*e+t*t)}}function c(t,e){return Math.max(2,Math.min(16,Math.ceil(32*Math.abs(e-t))))}function n(t,e,n,i){if(null==e||e<0||1<e)return null;var r=t[0],s=t[1],a=t[2],o=t[3],h=t[4],u=t[5],l=t[6],c=t[7],d=q.isZero;d(a-r)&&d(o-s)&&(a=r,o=s),d(h-l)&&d(u-c)&&(h=l,u=c);var f,_,g=3*(a-r),p=3*(h-a)-g,v=l-r-g-p,m=3*(o-s),t=3*(u-o)-m,d=c-s-m-t;return 0===n?(f=0===e?r:1===e?l:((v*e+p)*e+g)*e+r,_=0===e?s:1===e?c:((d*e+t)*e+m)*e+s):(0,_=e<1e-8?(f=g,m):1-1e-8<e?(f=3*(l-h),3*(c-u)):(f=(3*v*e+2*p)*e+g,(3*d*e+2*t)*e+m),i&&(0===f&&0===_&&(e<1e-8||1-1e-8<e)&&(f=h-a,_=u-o),(o=Math.sqrt(f*f+_*_))&&(f/=o,_/=o)),3===n&&(h=6*v*e+2*p,u=6*d*e+2*t,f=0!==(t=Math.pow(f*f+_*_,1.5))?(f*u-_*h)/t:0,_=0)),2===n?new L(_,-f):new L(f,_)}return{statics:{classify:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],h=t[7],t=i*(n-h)+r*(o-e)+e*h-n*o,i=3*(s*(r-n)+a*(e-i)+i*n-r*e),r=i-t,o=r-t+(e*(h-a)+n*(s-o)+o*a-h*s),a=Math.sqrt(o*o+r*r+i*i),h=0!==a?1/a:0,s=q.isZero,a="serpentine";function u(t,e,n){var i=e!==j,r=i&&0<e&&e<1,s=i&&0<n&&n<1;return!i||(r||s)&&("loop"!==t||r&&s)||(r=s=!(t="arch")),{type:t,roots:r||s?r&&s?e<n?[e,n]:[n,e]:[r?e:n]:null}}if(r*=h,i*=h,s(o*=h))return s(r)?u(s(i)?"line":"quadratic"):u(a,i/(3*r));i=3*r*r-4*o*i;if(s(i))return u("cusp",r/(2*o));s=0<i?Math.sqrt(i/3):Math.sqrt(-i),o*=2;return u(0<i?a:"loop",(r+s)/o,(r-s)/o)},getLength:function(t,e,n,i){if(e===j&&(e=0),n===j&&(n=1),Z.isStraight(t)){var r=t;n<1&&(r=Z.subdivide(r,n)[0],e/=n);var s=(r=0<e?Z.subdivide(r,e)[1]:r)[6]-r[0],r=r[7]-r[1];return Math.sqrt(s*s+r*r)}return q.integrate(i||l(t),e,n,c(e,n))},getTimeAt:function(t,e,n){if(n===j&&(n=e<0?1:0),0===e)return n;var i=Math.abs,r=0<e,s=r?n:0,a=r?1:n,o=l(t),h=Z.getLength(t,s,a,o),t=i(e)-h;if(i(t)<1e-12)return r?a:s;if(1e-12<t)return null;var u=0;return q.findRoot(function(t){return u+=q.integrate(o,n,t,c(n,t)),n=t,u-e},o,n+e/h,s,a,32,1e-12)},getPoint:function(t,e){return n(t,e,0,!1)},getTangent:function(t,e){return n(t,e,1,!0)},getWeightedTangent:function(t,e){return n(t,e,1,!1)},getNormal:function(t,e){return n(t,e,2,!0)},getWeightedNormal:function(t,e){return n(t,e,2,!1)},getCurvature:function(t,e){return n(t,e,3,!1).x},getPeaks:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=3*i-e-3*s+t[6],s=3*e-6*i+3*s,i=-3*e+3*i,t=3*r-n-3*a+t[7],a=3*n-6*r+3*a,n=-3*n+3*r,r=[];return q.solveCubic(9*(o*o+t*t),9*(o*s+a*t),2*(s*s+a*a)+3*(i*o+n*t),i*s+a*n,r,1e-8,1-1e-8),r.sort()}}}},new function(){function O(t,e,n,i,r,s,a){var o=!a&&n.getPrevious()===r,h=!a&&n!==r&&n.getNext()===r;null!==i&&(o?1e-8:0)<=i&&i<=(h?1-1e-8:1)&&null!==s&&(h?1e-8:0)<=s&&s<=(o?1-1e-8:1)&&(i=new W(n,i,null,a),a=new W(r,s,null,a),(i._intersection=a)._intersection=i,e&&!e(i)||W.insert(t,i,!0))}function z(t,e,n,i,r,s,a,o,h,u,l,c,d){if(4096<=++h||40<=++o)return h;var f,_,g=e[0],p=e[1],v=e[6],m=e[7],y=N.getSignedDistance,w=y(g,p,v,m,e[2],e[3]),x=y(g,p,v,m,e[4],e[5]),b=0<w*x?.75:4/9,S=b*Math.min(0,w,x),C=b*Math.max(0,w,x),I=y(g,p,v,m,t[0],t[1]),M=y(g,p,v,m,t[2],t[3]),b=y(g,p,v,m,t[4],t[5]),p=y(g,p,v,m,t[6],t[7]),v=function(t,e,n,i){var r=[0,t],s=[1/3,e],a=[2/3,n],o=[1,i],e=e-(2*t+i)/3,t=n-(t+2*i)/3;o=e*t<0?[[r,s,o],[r,a,o]]:[2<=(i=e/t)?[r,s,o]:i<=.5?[r,a,o]:[r,s,a,o],[r,o]];return(e||t)<0?o.reverse():o}(I,M,b,p),m=v[0],v=v[1];if(0===w&&0===x&&0===I&&0===M&&0===b&&0===p||null==(f=A(m,v,S,C))||null==(_=A(m.reverse(),v.reverse(),S,C)))return h;var P,T,k,C=u+(l-u)*f,l=u+(l-u)*_;return Math.max(d-c,l-C)<1e-9?(P=(C+l)/2,k=(c+d)/2,O(r,s,a?i:n,a?k:P,a?n:i,a?P:k)):(t=Z.getPart(t,f,_),u=d-c,h=.8<_-f?u<l-C?(h=z(e,(T=Z.subdivide(t,.5))[0],i,n,r,s,!a,o,h,c,d,C,P=(C+l)/2),z(e,T[1],i,n,r,s,!a,o,h,c,d,P,l)):(h=z((T=Z.subdivide(e,.5))[0],t,i,n,r,s,!a,o,h,c,k=(c+d)/2,C,l),z(T[1],t,i,n,r,s,!a,o,h,k,d,C,l)):0==u||1e-9<=u?z(e,t,i,n,r,s,!a,o,h,c,d,C,l):z(t,e,n,i,r,s,a,o,h,C,l,c,d)),h}function A(t,e,n,i){return t[0][1]<n?r(t,!0,n):e[0][1]>i?r(e,!1,i):t[0][0]}function r(t,e,n){for(var i=t[0][0],r=t[0][1],s=1,a=t.length;s<a;s++){var o=t[s][0],h=t[s][1];if(e?n<=h:h<=n)return h===n?o:i+(n-r)*(o-i)/(h-r);i=o,r=h}return null}function y(t,e,n,i,r){var s=q.isZero;if(s(i)&&s(r)){s=Z.getTimeOf(t,new L(e,n));return null===s?[]:[s]}for(var i=Math.atan2(-r,i),a=Math.sin(i),o=Math.cos(i),h=[],i=[],u=0;u<8;u+=2){var l=t[u]-e,c=t[u+1]-n;h.push(l*o-c*a,l*a+c*o)}return Z.solveCubic(h,1,0,i,0,1),i}function x(t,e,n,i,r,s){var a=1e-12,o=Math.min,h=Math.max;if(h(t[0],t[2],t[4],t[6])+a>o(e[0],e[2],e[4],e[6])&&o(t[0],t[2],t[4],t[6])-a<h(e[0],e[2],e[4],e[6])&&h(t[1],t[3],t[5],t[7])+a>o(e[1],e[3],e[5],e[7])&&o(t[1],t[3],t[5],t[7])-a<h(e[1],e[3],e[5],e[7])){var u=w(t,e);if(u)for(var l=0;l<2;l++){var c=u[l];O(r,s,n,c[0],i,c[1],!0)}else{var d=Z.isStraight(t),f=Z.isStraight(e),_=d&&f,o=d&&!f,h=r.length;if((_?function(t,e,n,i,r,s){var a=N.intersect(t[0],t[1],t[6],t[7],e[0],e[1],e[6],e[7]);a&&O(r,s,n,Z.getTimeOf(t,a),i,Z.getTimeOf(e,a))}:d||f?function(t,e,n,i,r,s,a){for(var o=e[0],h=e[1],u=y(t,o,h,e[6]-o,e[7]-h),l=0,c=u.length;l<c;l++){var d=u[l],f=Z.getPoint(t,d),f=Z.getTimeOf(e,f);null!==f&&O(r,s,a?i:n,a?f:d,a?n:i,a?d:f)}}:z)(o?e:t,o?t:e,o?i:n,o?n:i,r,s,o,0,0,0,1,0,1),!_||r.length===h)for(l=0;l<4;l++){var g=l>>1,p=1&l,v=6*g,m=6*p,v=new L(t[v],t[1+v]),m=new L(e[m],e[1+m]);v.isClose(m,a)&&O(r,s,n,g,i,p)}}}return r}function b(t,e,n,i){t=Z.classify(t);return"loop"===t.type&&O(n,i,e,(t=t.roots)[0],e,t[1]),n}function w(t,e){function n(t){var e=t[6]-t[0],t=t[7]-t[1];return e*e+t*t}var i=Math.abs,r=N.getDistance,s=1e-7,a=Z.isStraight(t),o=Z.isStraight(e),h=a&&o,u=n(t)<n(e),l=u?e:t,c=u?t:e,d=l[0],f=l[1],_=l[6]-d,u=l[7]-f;if(r(d,f,_,u,c[0],c[1],!0)<s&&r(d,f,_,u,c[6],c[7],!0)<s)!h&&r(d,f,_,u,l[2],l[3],!0)<s&&r(d,f,_,u,l[4],l[5],!0)<s&&r(d,f,_,u,c[2],c[3],!0)<s&&r(d,f,_,u,c[4],c[5],!0)<s&&(a=o=h=!0);else if(h)return null;if(a^o)return null;for(var g=[t,e],p=[],v=0;v<4&&p.length<2;v++){var m=1&v,y=1^m,w=v>>1,y=Z.getTimeOf(g[m],new L(g[y][w?6:0],g[y][w?7:1]));if(null!=y&&(w=m?[w,y]:[y,w],(!p.length||1e-8<i(w[0]-p[0][0])&&1e-8<i(w[1]-p[0][1]))&&p.push(w)),2<v&&!p.length)break}return 2!==p.length?p=null:h||(t=Z.getPart(t,p[0][0],p[1][0]),(i((e=Z.getPart(e,p[0][1],p[1][1]))[2]-t[2])>s||i(e[3]-t[3])>s||i(e[4]-t[4])>s||i(e[5]-t[5])>s)&&(p=null)),p}return{getIntersections:function(t){var e=this.getValues(),n=t&&t!==this&&t.getValues();return n?x(e,n,this,t,[]):b(e,this,[])},statics:{getOverlaps:w,getIntersections:function(t,e,n,i,r,s){for(var a=!e,o=t.length,h=(e=a?t:e).length,u=new Array(o),l=a?u:new Array(h),c=[],d=0;d<o;d++)u[d]=t[d].getValues(i);if(!a)for(d=0;d<h;d++)l[d]=e[d].getValues(r);for(var f=R.findCurveBoundsCollisions(u,l,1e-7),_=0;_<o;_++){var g=t[_],p=u[_];a&&b(p,g,c,n);var v=f[_];if(v)for(var m=0;m<v.length;m++){if(s&&c.length)return c;var y,w=v[m];(!a||_<w)&&(y=e[w],x(p,l[w],g,y,c,n))}}return c},getCurveLineIntersections:y,getTimesWithTangent:function(t,e){var n,i=t[0],r=t[1],s=t[2],a=t[3],o=t[4],h=t[5],u=t[6],l=t[7],e=(t=e.normalize()).x,t=t.y,u=3*u-9*o+9*s-3*i,l=3*l-9*h+9*a-3*r,o=6*o-12*s+6*i,h=6*h-12*a+6*r,s=3*s-3*i,i=3*a-3*r,a=2*u*t-2*l*e,r=[];return Math.abs(a)<q.CURVETIME_EPSILON?0==(a=o*t-h*e)||0<=(n=-(s*t-i*e)/a)&&n<=1&&r.push(n):(n=o*t-h*e,0<=(i=(o*o-4*u*s)*t*t+(-2*o*h+4*l*s+4*u*i)*e*t+(h*h-4*l*i)*e*e)&&0!=a&&(i=(-n+(e=Math.sqrt(i)))/a,0<=(a=-(n+e)/a)&&a<=1&&r.push(a),0<=i&&i<=1&&r.push(i))),r}}}}),W=D.extend({_class:"CurveLocation",initialize:function(t,e,n,i,r){var s;.99999999<=e&&((s=t.getNext())&&(e=0,t=s)),this._setCurve(t),this._time=e,this._point=n||t.getPointAtTime(e),this._overlap=i,this._distance=r,this._intersection=this._next=this._previous=null},_setPath:function(t){this._path=t,this._version=t?t._version:0},_setCurve:function(t){this._setPath(t._path),this._curve=t,this._segment=null,this._segment1=t._segment1,this._segment2=t._segment2},_setSegment:function(t){var e=t.getCurve();e?this._setCurve(e):(this._setPath(t._path),this._segment1=t,this._segment2=null),this._segment=t,this._time=t===this._segment1?0:1,this._point=t._point.clone()},getSegment:function(){var t,e,n=this._segment;return n||(t=this.getCurve(),0===(e=this.getTime())?n=t._segment1:1===e?n=t._segment2:null!=e&&(n=t.getPartLength(0,e)<t.getPartLength(e,1)?t._segment1:t._segment2),this._segment=n),n},getCurve:function(){var t=this._path,e=this;function n(t){t=t&&t.getCurve();if(t&&null!=(e._time=t.getTimeOf(e._point)))return e._setCurve(t),t}return t&&t._version!==this._version&&(this._time=this._offset=this._curveOffset=this._curve=null),this._curve||n(this._segment)||n(this._segment1)||n(this._segment2.getPrevious())},getPath:function(){var t=this.getCurve();return t&&t._path},getIndex:function(){var t=this.getCurve();return t&&t.getIndex()},getTime:function(){var t=this.getCurve(),e=this._time;return t&&null==e?this._time=t.getTimeOf(this._point):e},getParameter:"#getTime",getPoint:function(){return this._point},getOffset:function(){if(null==(t=this._offset)){var t=0,e=this.getPath(),n=this.getIndex();if(e&&null!=n)for(var i=e.getCurves(),r=0;r<n;r++)t+=i[r].getLength();this._offset=t+=this.getCurveOffset()}return t},getCurveOffset:function(){var t,e,n=this._curveOffset;return null==n&&(t=this.getCurve(),e=this.getTime(),this._curveOffset=n=null!=e&&t&&t.getPartLength(0,e)),n},getIntersection:function(){return this._intersection},getDistance:function(){return this._distance},divide:function(){var t=this.getCurve(),t=t&&t.divideAtTime(this.getTime());return t&&this._setSegment(t._segment1),t},split:function(){var t=this.getCurve(),e=t._path,t=t&&t.splitAtTime(this.getTime());return t&&this._setSegment(e.getLastSegment()),t},equals:function(t,e){var n,i,r,s,a=this===t;return!a&&t instanceof W&&(r=this.getCurve(),s=t.getCurve(),(n=r._path)===s._path&&(r=(i=Math.abs)(this.getOffset()-t.getOffset()),s=!e&&this._intersection,t=!e&&t._intersection,a=(r<1e-7||n&&i(n.getLength()-r)<1e-7)&&(!s&&!t||s&&t&&s.equals(t,!0)))),a},toString:function(){var t=[],e=this.getPoint(),n=x.instance;e&&t.push("point: "+e);e=this.getIndex();null!=e&&t.push("index: "+e);e=this.getTime();return null!=e&&t.push("time: "+n.number(e)),null!=this._distance&&t.push("distance: "+n.number(this._distance)),"{ "+t.join(", ")+" }"},isTouching:function(){var t=this._intersection;if(t&&this.getTangent().isCollinear(t.getTangent())){var e=this.getCurve(),t=t.getCurve();return!(e.isStraight()&&t.isStraight()&&e.getLine().intersect(t.getLine()))}return!1},isCrossing:function(){var t=this._intersection;if(!t)return!1;var e=this.getTime(),n=t.getTime(),i=1e-8,r=1-i,s=i<=e&&e<=r,a=i<=n&&n<=r;if(s&&a)return!this.isTouching();var o=this.getCurve(),h=o&&e<i?o.getPrevious():o,u=t.getCurve(),t=u&&n<i?u.getPrevious():u;if(r<e&&(o=o.getNext()),r<n&&(u=u.getNext()),!(h&&o&&t&&u))return!1;var l=[];function c(t,e){var n=t.getValues(),i=Z.classify(n).roots||Z.getPeaks(n),t=i.length,i=Z.getLength(n,e&&t?i[t-1]:0,!e&&t?i[0]:1);l.push(t?i:i/32)}function d(t,e,n){return e<n?e<t&&t<n:e<t||t<n}s||(c(h,!0),c(o,!1)),a||(c(t,!0),c(u,!1));i=this.getPoint(),r=Math.min.apply(Math,l),o=s?o.getTangentAtTime(e):o.getPointAt(r).subtract(i),h=s?o.negate():h.getPointAt(-r).subtract(i),u=a?u.getTangentAtTime(n):u.getPointAt(r).subtract(i),i=a?u.negate():t.getPointAt(-r).subtract(i),h=h.getAngle(),o=o.getAngle(),i=i.getAngle(),u=u.getAngle();return!!(s?d(h,i,u)^d(o,i,u)&&d(h,u,i)^d(o,u,i):d(i,h,o)^d(u,h,o)&&d(i,o,h)^d(u,o,h))},hasOverlap:function(){return!!this._overlap}},D.each(Z._evaluateMethods,function(t){var n=t+"At";this[t]=function(){var t=this.getCurve(),e=this.getTime();return null!=e&&t&&t[n](e,!0)}},{preserve:!0}),new function(){function i(r,s,t){var a=r.length,e=0,n=a-1;function i(t,e){for(var n=t+e;-1<=n&&n<=a;n+=e){var i=r[(n%a+a)%a];if(!s.getPoint().isClose(i.getPoint(),1e-7))break;if(s.equals(i))return i}return null}for(;e<=n;){var o,h=e+n>>>1,u=r[h];if(t&&(o=s.equals(u)?u:i(h,-1)||i(h,1)))return s._overlap&&(o._overlap=o._intersection._overlap=!0),o;var l=s.getPath(),c=u.getPath();(l!==c?l._id-c._id:s.getIndex()+s.getTime()-(u.getIndex()+u.getTime()))<0?n=h-1:e=1+h}return r.splice(e,0,s),s}return{statics:{insert:i,expand:function(t){for(var e=t.slice(),n=t.length-1;0<=n;n--)i(e,t[n]._intersection,!1);return e}}}}),y=V.extend({_class:"PathItem",_selectBounds:!1,_canScaleStroke:!0,beans:!0,initialize:function(){},_scaleStroke:function(t){var e=this._style;this._project._scope.settings.scaleStrokes&&e.getStrokeScaling()&&e.setStrokeWidth(e.getStrokeWidth()*t._getMeanScale())},statics:{create:function(t){var e,n,i;return D.isPlainObject(t)?(n=t.segments,e=t.pathData):Array.isArray(t)?n=t:"string"==typeof t&&(e=t),n?i=(i=n[0])&&Array.isArray(i[0]):e&&(i=1<(e.match(/m/gi)||[]).length||/z\s*\S+/i.test(e)),new(i?G:U)(t)}},_asPathItem:function(){return this},isClockwise:function(){return 0<=this.getArea()},setClockwise:function(t){this.isClockwise()!=(t=!!t)&&this.reverse()},setPathData:function(t){var e,n,i=t&&t.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi),r=!1,s=new L,a=new L,o="([+-]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][+-]?\\d+)?)",h=new RegExp(o,"g"),t="([01])",u=new RegExp([o,o,o,t,t,o,o].join("[\\s,]*"),"g");function l(t,e){t=+_[t];return r&&(t+=s[e]),t}function c(t){return new L(l(t,"x"),l(t+1,"y"))}this.clear();for(var d=0,f=i&&i.length;d<f;d++){var _,g=i[d],p=g[0],v=p.toLowerCase(),m=(_=g.match(h))&&_.length,r=p===v;switch("z"!==e||/[mz]/.test(v)||this.moveTo(s),v){case"m":case"l":for(var y="m"===v,w=0;w<m;w+=2)this[y?"moveTo":"lineTo"](s=c(w)),y&&(a=s,y=!1);n=s;break;case"h":case"v":for(var x="h"===v?"x":"y",s=s.clone(),w=0;w<m;w++)s[x]=l(w,x),this.lineTo(s);n=s;break;case"c":for(w=0;w<m;w+=6)this.cubicCurveTo(c(w),n=c(w+2),s=c(w+4));break;case"s":for(w=0;w<m;w+=4)this.cubicCurveTo(/[cs]/.test(e)?s.multiply(2).subtract(n):s,n=c(w),s=c(w+2)),e=v;break;case"q":for(w=0;w<m;w+=4)this.quadraticCurveTo(n=c(w),s=c(w+2));break;case"t":for(w=0;w<m;w+=2)this.quadraticCurveTo(n=/[qt]/.test(e)?s.multiply(2).subtract(n):s,s=c(w)),e=v;break;case"a":for(;_=u.exec(g);)this.arcTo(s=c(6),new z(+_[1],+_[2]),+_[3],+_[5],+_[4]);break;case"z":this.closePath(1e-12),s=a}e=v}},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_contains:function(t){t=t.isInside(this.getBounds({internal:!0,handle:!0}))?this._getWinding(t):{};return t.onPath||!!("evenodd"===this.getFillRule()?1&t.windingL||1&t.windingR:t.winding)},getIntersections:function(t,e,n,i){var r=this===t||!t,s=this._matrix._orNullIfIdentity(),n=r?s:(n||t._matrix)._orNullIfIdentity();return r||this.getBounds(s).intersects(t.getBounds(n),1e-12)?Z.getIntersections(this.getCurves(),!r&&t.getCurves(),e,s,n,i):[]},getCrossings:function(t){return this.getIntersections(t,function(t){return t.isCrossing()})},getNearestLocation:function(){for(var t=L.read(arguments),e=this.getCurves(),n=1/0,i=null,r=0,s=e.length;r<s;r++){var a=e[r].getNearestLocation(t);a._distance<n&&(n=a._distance,i=a)}return i},getNearestPoint:function(){var t=this.getNearestLocation.apply(this,arguments);return t&&t.getPoint()},interpolate:function(t,e,n){var i=!this._children,r=i?"_segments":"_children",s=t[r],a=e[r],o=this[r];if(!s||!a||s.length!==a.length)throw new Error("Invalid operands in interpolate() call: "+t+", "+e);var e=o.length,h=a.length;if(e<h)for(var u=i?H:U,l=e;l<h;l++)this.add(new u);else h<e&&this[i?"removeSegments":"removeChildren"](h,e);for(l=0;l<h;l++)o[l].interpolate(s[l],a[l],n);i&&(this.setClosed(t._closed),this._changed(9))},compare:function(t){var e=!1;if(t){var n=this._children||[this],i=t._children?t._children.slice():[t],r=n.length,t=i.length,s=[],a=0;e=!0;for(var o=R.findItemBoundsCollisions(n,i,q.GEOMETRIC_EPSILON),h=r-1;0<=h&&e;h--){var u=n[h],e=!1,l=o[h];if(l)for(var c=l.length-1;0<=c&&!e;c--)u.compare(i[l[c]])&&(s[l[c]]||(s[l[c]]=!0,a++),e=!0)}e=e&&a===t}return e}}),U=y.extend({_class:"Path",_serializeFields:{segments:[],closed:!1},initialize:function(t){this._closed=!1,this._segments=[],this._version=0;var e=arguments,e=Array.isArray(t)?"object"==typeof t[0]?t:e:!t||t.size!==j||t.x===j&&t.point===j?null:e;e&&0<e.length?this.setSegments(e):(this._curves=j,this._segmentSelection=0,e||"string"!=typeof t||(this.setPathData(t),t=null)),this._initialize(!e&&t)},_equals:function(t){return this._closed===t._closed&&D.equals(this._segments,t._segments)},copyContent:function(t){this.setSegments(t._segments),this._closed=t._closed},_changed:function t(e){if(t.base.call(this,e),8&e){if(this._length=this._area=j,32&e)this._version++;else if(this._curves)for(var n=0,i=this._curves.length;n<i;n++)this._curves[n]._changed()}else 64&e&&(this._bounds=j)},getStyle:function(){var t=this._parent;return(t instanceof G?t:this)._style},getSegments:function(){return this._segments},setSegments:function(t){var e,n=this.isFullySelected(),i=t&&t.length;this._segments.length=0,this._segmentSelection=0,this._curves=j,i&&("boolean"==typeof(e=t[i-1])&&(this.setClosed(e),i--),this._add(H.readList(t,0,{},i))),n&&this.setFullySelected(!0)},getFirstSegment:function(){return this._segments[0]},getLastSegment:function(){return this._segments[this._segments.length-1]},getCurves:function(){var t=this._curves,e=this._segments;if(!t)for(var n=this._countCurves(),t=this._curves=new Array(n),i=0;i<n;i++)t[i]=new Z(this,e[i],e[i+1]||e[0]);return t},getFirstCurve:function(){return this.getCurves()[0]},getLastCurve:function(){var t=this.getCurves();return t[t.length-1]},isClosed:function(){return this._closed},setClosed:function(t){var e;this._closed!=(t=!!t)&&(this._closed=t,this._curves&&(e=this._curves.length=this._countCurves(),t&&(this._curves[e-1]=new Z(this,this._segments[e-1],this._segments[0]))),this._changed(41))}},{beans:!0,getPathData:function(n,t){var i,r,s,a,o,h,u,l,e=this._segments,c=e.length,d=new x(t),f=new Array(6),_=!0,g=[];function p(t,e){t._transformCoordinates(n,f),i=f[0],r=f[1],_?(g.push("M"+d.pair(i,r)),_=!1):(o=f[2],h=f[3],o===i&&h===r&&u===s&&l===a?e||(t=r-a,g.push(0==(e=i-s)?"v"+d.number(t):0==t?"h"+d.number(e):"l"+d.pair(e,t))):g.push("c"+d.pair(u-s,l-a)+" "+d.pair(o-s,h-a)+" "+d.pair(i-s,r-a))),s=i,a=r,u=f[4],l=f[5]}if(!c)return"";for(var v=0;v<c;v++)p(e[v]);return this._closed&&0<c&&(p(e[0],!0),g.push("z")),g.join("")},isEmpty:function(){return!this._segments.length},_transformContent:function(t){for(var e=this._segments,n=new Array(6),i=0,r=e.length;i<r;i++)e[i]._transformCoordinates(t,n,!0);return this._scaleStroke(t),!0},_add:function(t,e){for(var n=this._segments,i=this._curves,r=t.length,s=null==e,e=s?n.length:e,a=0;a<r;a++){var o=t[a];(o=o._path?t[a]=o.clone():o)._path=this,o._index=e+a,o._selection&&this._updateSelection(o,0,o._selection)}if(s)D.push(n,t);else{n.splice.apply(n,[e,0].concat(t));for(var a=e+r,h=n.length;a<h;a++)n[a]._index=a}if(i){var u=this._countCurves(),l=0<e&&e+r-1===u?e-1:e,s=l,c=Math.min(l+r,u);t._curves&&(i.splice.apply(i,[l,0].concat(t._curves)),s+=t._curves.length);for(a=s;a<c;a++)i.splice(a,0,new Z(this,null,null));this._adjustCurves(l,c)}return this._changed(41),t},_adjustCurves:function(t,e){for(var n,i=this._segments,r=this._curves,s=t;s<e;s++)(n=r[s])._path=this,n._segment1=i[s],n._segment2=i[s+1]||i[0],n._changed();(n=r[this._closed&&!t?i.length-1:t-1])&&(n._segment2=i[t]||i[0],n._changed()),(n=r[e])&&(n._segment1=i[e],n._changed())},_countCurves:function(){var t=this._segments.length;return!this._closed&&0<t?t-1:t},add:function(t){var e=arguments;return 1<e.length&&"number"!=typeof t?this._add(H.readList(e)):this._add([H.read(e)])[0]},insert:function(t,e){var n=arguments;return 2<n.length&&"number"!=typeof e?this._add(H.readList(n,1),t):this._add([H.read(n,1)],t)[0]},addSegment:function(){return this._add([H.read(arguments)])[0]},insertSegment:function(t){return this._add([H.read(arguments,1)],t)[0]},addSegments:function(t){return this._add(H.readList(t))},insertSegments:function(t,e){return this._add(H.readList(e),t)},removeSegment:function(t){return this.removeSegments(t,t+1)[0]||null},removeSegments:function(t,e,n){if(t=t||0,(e=D.pick(e,this._segments.length))<t&&this._closed)return this.removeSegments(t).concat(this.removeSegments(0,e));var i=this._segments,r=this._curves,s=i.length,a=i.splice(t,e-t),o=a.length;if(!o)return a;for(var h=0;h<o;h++){var u=a[h];u._selection&&this._updateSelection(u,u._selection,0),u._index=u._path=null}for(var h=t,l=i.length;h<l;h++)i[h]._index=h;if(r){for(t=0<t&&e===s+(this._closed?1:0)?t-1:t,h=(r=r.splice(t,o)).length-1;0<=h;h--)r[h]._path=null;n&&(a._curves=r.slice(1)),this._adjustCurves(t,t)}return this._changed(41),a},clear:"#removeSegments",hasHandles:function(){for(var t=this._segments,e=0,n=t.length;e<n;e++)if(t[e].hasHandles())return!0;return!1},clearHandles:function(){for(var t=this._segments,e=0,n=t.length;e<n;e++)t[e].clearHandles()},getLength:function(){if(null==this._length){for(var t=this.getCurves(),e=0,n=0,i=t.length;n<i;n++)e+=t[n].getLength();this._length=e}return this._length},getArea:function(){if(null==(n=this._area)){for(var t=this._segments,e=this._closed,n=0,i=0,r=t.length;i<r;i++){var s=i+1===r;n+=Z.getArea(Z.getValues(t[i],t[s?0:i+1],null,s&&!e))}this._area=n}return n},isFullySelected:function(){var t=this._segments.length;return this.isSelected()&&0<t&&this._segmentSelection===7*t},setFullySelected:function(t){t&&this._selectSegments(!0),this.setSelected(t)},setSelection:function t(e){1&e||this._selectSegments(!1),t.base.call(this,e)},_selectSegments:function(t){var e=this._segments,n=e.length,i=t?7:0;this._segmentSelection=i*n;for(var r=0;r<n;r++)e[r]._selection=i},_updateSelection:function(t,e,n){t._selection=n,0<(this._segmentSelection+=n-e)&&this.setSelected(!0)},divideAt:function(t){var e,t=this.getLocationAt(t);return t&&(e=t.getCurve().divideAt(t.getCurveOffset()))?e._segment1:null},splitAt:function(t){var e=this.getLocationAt(t),n=e&&e.index,i=e&&e.time;1-1e-8<i&&(n++,i=0);t=this.getCurves();if(e&&n<t.length){1e-8<=i&&t[n++].divideAtTime(i);var r,n=this.removeSegments(n,this._segments.length,!0);return this._closed?(this.setClosed(!1),r=this):((r=new U(V.NO_INSERT)).insertAbove(this),r.copyAttributes(this)),r._add(n,0),this.addSegment(n[0]),r}return null},split:function(t,e){e=e===j?t:(t=this.getCurves()[t])&&t.getLocationAtTime(e);return null!=e?this.splitAt(e):null},join:function(t,e){var n=e||0;if(t&&t!==this){var i=t._segments,r=this.getLastSegment(),s=t.getLastSegment();if(!s)return this;r&&r._point.isClose(s._point,n)&&t.reverse();e=t.getFirstSegment();r&&r._point.isClose(e._point,n)?(r.setHandleOut(e._handleOut),this._add(i.slice(1))):((r=this.getFirstSegment())&&r._point.isClose(e._point,n)&&t.reverse(),s=t.getLastSegment(),r&&r._point.isClose(s._point,n)?(r.setHandleIn(s._handleIn),this._add(i.slice(0,i.length-1),0)):this._add(i.slice())),t._closed&&this._add([i[0]]),t.remove()}i=this.getFirstSegment(),t=this.getLastSegment();return i!==t&&i._point.isClose(t._point,n)&&(i.setHandleIn(t._handleIn),t.remove(),this.setClosed(!0)),this},reduce:function(t){for(var e=this.getCurves(),n=t&&t.simplify,i=n?1e-7:0,r=e.length-1;0<=r;r--){var s=e[r];!s.hasHandles()&&(!s.hasLength(i)||n&&s.isCollinear(s.getNext()))&&s.remove()}return this},reverse:function(){this._segments.reverse();for(var t=0,e=this._segments.length;t<e;t++){var n=this._segments[t],i=n._handleIn;n._handleIn=n._handleOut,n._handleOut=i,n._index=t}this._curves=null,this._changed(9)},flatten:function(t){for(var e=new w(this,t||.25,256,!0).parts,n=e.length,i=[],r=0;r<n;r++)i.push(new H(e[r].curve.slice(0,2)));!this._closed&&0<n&&i.push(new H(e[n-1].curve.slice(6))),this.setSegments(i)},simplify:function(t){t=new S(this).fit(t||2.5);return t&&this.setSegments(t),!!t},smooth:function(t){var r=this,e=t||{},t=e.type||"asymmetric",n=this._segments,s=n.length,a=this._closed;function i(t,e){var n=t&&t.index;if(null!=n){var i=t.path;if(i&&i!==r)throw new Error(t._class+" "+n+" of "+i+" is not part of "+r);e&&t instanceof Z&&n++}else n="number"==typeof t?t:e;return Math.min(n<0&&a?n%s:n<0?n+s:n,s-1)}var o=a&&e.from===j&&e.to===j,h=i(e.from,0),u=i(e.to,s-1);if(u<h&&(a?h-=s:(c=h,h=u,u=c)),/^(?:asymmetric|continuous)$/.test(t)){var l="asymmetric"===t,c=Math.min,t=u-h+1,d=t-1,t=o?c(t,4):1,f=t,t=t,_=[];if(a||(f=c(1,h),t=c(1,s-u-1)),!((d+=f+t)<=1)){for(var g=0,p=h-f;g<=d;g++,p++)_[g]=n[(p<0?p+s:p)%s]._point;for(var v=d-1,m=[T=_[0]._x+2*_[1]._x],y=[k=_[0]._y+2*_[1]._y],w=[P=2],x=[],b=[],g=1;g<d;g++)var S=g<v,C=S?4:l?3:8,I=S?2:l?0:1,M=(S||l?1:2)/P,P=w[g]=(S?4:l?2:7)-M,T=m[g]=C*_[g]._x+I*_[g+1]._x-M*T,k=y[g]=C*_[g]._y+I*_[g+1]._y-M*k;x[v]=m[v]/w[v],b[v]=y[v]/w[v];for(g=d-2;0<=g;g--)x[g]=(m[g]-x[g+1])/w[g],b[g]=(y[g]-b[g+1])/w[g];x[d]=(3*_[d]._x-x[v])/2,b[d]=(3*_[d]._y-b[v])/2;for(var g=f,O=d-t,p=h;g<=O;g++,p++){var z=n[p<0?p+s:p],A=z._point,L=x[g]-A._x,A=b[g]-A._y;(o||g<O)&&z.setHandleOut(L,A),(o||f<g)&&z.setHandleIn(-L,-A)}}}else for(g=h;g<=u;g++)n[g<0?g+s:g].smooth(e,!o&&g===h,!o&&g===u)},toShape:function(t){if(!this._closed)return null;var e,n,i,r,s,a,o=this._segments;function h(t,e){var n=o[t],i=n.getNext(),t=o[e],e=t.getNext();return n._handleOut.isZero()&&i._handleIn.isZero()&&t._handleOut.isZero()&&e._handleIn.isZero()&&i._point.subtract(n._point).isCollinear(e._point.subtract(t._point))}function u(t){var e=o[t],n=e.getNext(),i=e._handleOut,r=n._handleIn,s=.5522847498307936;if(i.isOrthogonal(r)){t=e._point,e=n._point,n=new N(t,i,!0).intersect(new N(e,r,!0),!0);return n&&q.isZero(i.getLength()/n.subtract(t).getLength()-s)&&q.isZero(r.getLength()/n.subtract(e).getLength()-s)}}function l(t,e){return o[t]._point.getDistance(o[e]._point)}if(!this.hasHandles()&&4===o.length&&h(0,2)&&h(1,3)&&(s=o[r=1],a=s.getPrevious(),r=s.getNext(),a._handleOut.isZero()&&s._handleIn.isZero()&&s._handleOut.isZero()&&r._handleIn.isZero()&&s._point.subtract(a._point).isOrthogonal(r._point.subtract(s._point)))?(e=g.Rectangle,n=new z(l(0,3),l(0,1)),i=o[1]._point.add(o[2]._point).divide(2)):8===o.length&&u(0)&&u(2)&&u(4)&&u(6)&&h(1,5)&&h(3,7)?(e=g.Rectangle,d=(n=new z(l(1,6),l(0,3))).subtract(new z(l(0,7),l(1,2))).divide(2),i=o[3]._point.add(o[4]._point).divide(2)):4===o.length&&u(0)&&u(1)&&u(2)&&u(3)&&(d=q.isZero(l(0,2)-l(1,3))?(e=g.Circle,l(0,2)/2):(e=g.Ellipse,new z(l(2,0)/2,l(3,1)/2)),i=o[1]._point),e){var c=this.getPosition(!0),d=new e({center:c,size:n,radius:d,insert:!1});return d.copyAttributes(this,!0),d._matrix.prepend(this._matrix),d.rotate(i.subtract(c).getAngle()+90),D.pick(t,Wt.settings.insertItems)&&d.insertAbove(this),d}return null},toPath:"#clone",compare:function t(e){if(!e||e instanceof G)return t.base.call(this,e);var n=this.getCurves(),i=e.getCurves(),r=n.length,s=i.length;if(!r||!s)return r==s;for(var a,o,h=n[0].getValues(),u=[],l=0,c=0,d=0;d<s;d++){var f=i[d].getValues();if(u.push(f),p=Z.getOverlaps(h,f)){a=!d&&0<p[0][0]?s-1:d,o=p[0][1];break}}for(var _,g=Math.abs,f=u[a];h&&f;){var p=Z.getOverlaps(h,f);if(p)if(g(p[0][0]-c)<1e-8){1===(c=p[1][0])&&(h=++l<r?n[l].getValues():null,c=0);var v=p[0][1];if(g(v-o)<1e-8){if(_=_||[a,v],1===(o=p[1][1])&&(f=u[a=++a>=s?0:a]||i[a].getValues(),o=0),!h)return _[0]===a&&_[1]===o;continue}}break}return!1},_hitTestSelf:function(n,r,t,i){var s,a,o,h,e,u,l=this,c=this.getStyle(),d=this._segments,f=d.length,_=this._closed,g=r._tolerancePadding,p=g,v=r.all&&[],m=r.stroke&&c.hasStroke(),y=r.fill&&!!c.getFillColor(),w=r.curves,x=m?c.getStrokeWidth()/2:y&&0<r.tolerance||w?0:null;function b(t,e){return n.subtract(t).divide(e).length<=1}function S(t,e,n){if(!r.selected||e.isSelected()){var i=t._point;if(b(e=e!==i?e.add(i):e,p)){e=new O(n,l,{segment:t,point:e});if(!v)return e;v.push(e)}}}function C(t,e){return(e||r.segments)&&S(t,t._point,"segment")||!e&&r.handles&&(S(t,t._handleIn,"handle-in")||S(t,t._handleOut,"handle-out"))}function I(t){h.add(t)}function M(t){var e=_||0<t._index&&t._index<f-1;return"round"===(e?s:a)?b(t._point,p):(h=new U({internal:!0,closed:!0}),e?t.isSmooth()||U._addBevelJoin(t,s,x,o,null,i,I,!0):U._addSquareCap(t,a,x,null,i,I,!0),!h.isEmpty()&&(h.contains(n)||(t=h.getNearestLocation(n))&&b(t.getPoint(),g)))}if(null!==x&&(0<x?(s=c.getStrokeJoin(),a=c.getStrokeCap(),o=c.getMiterLimit(),p=p.add(U._getStrokePadding(x,i))):s=a="round"),!r.ends||r.segments||_){if(r.segments||r.handles)for(var P=0;P<f;P++)if(e=C(d[P]))return e}else if(e=C(d[0],!0)||C(d[f-1],!0))return e;if(null!==x&&((u=this.getNearestLocation(n))&&(0===(c=u.getTime())||1===c&&1<f?M(u.getSegment())||(u=null):b(u.getPoint(),p)||(u=null)),!u&&"miter"===s&&1<f))for(P=0;P<f;P++){var T=d[P];if(n.getDistance(T._point)<=o*x&&M(T)){u=T.getLocation();break}}return e=!u&&y&&this._contains(n)||u&&!m&&!w?new O("fill",this):u?new O(m?"stroke":"curve",this,{location:u,point:u.getPoint()}):null,v?(v.sort(function(t,e){return t.point.getDistance(n)-e.point.getDistance(n)}),e&&v.push(e),v):e}},D.each(Z._evaluateMethods,function(e){this[e+"At"]=function(t){t=this.getLocationAt(t);return t&&t[e]()}},{beans:!1,getLocationOf:function(){for(var t=L.read(arguments),e=this.getCurves(),n=0,i=e.length;n<i;n++){var r=e[n].getLocationOf(t);if(r)return r}return null},getOffsetOf:function(){var t=this.getLocationOf.apply(this,arguments);return t?t.getOffset():null},getLocationAt:function(t){if("number"==typeof t){for(var e=this.getCurves(),n=0,i=0,r=e.length;i<r;i++){var s=n,a=e[i];if(t<(n+=a.getLength()))return a.getLocationAt(t-s)}if(0<e.length&&t<=this.getLength())return new W(e[e.length-1],1)}else if(t&&t.getPath&&t.getPath()===this)return t;return null},getOffsetsWithTangent:function(){var t=L.read(arguments);if(t.isZero())return[];for(var e=[],n=0,i=this.getCurves(),r=0,s=i.length;r<s;r++){for(var a=i[r],o=a.getTimesWithTangent(t),h=0,u=o.length;h<u;h++){var l=n+a.getOffsetAtTime(o[h]);e.indexOf(l)<0&&e.push(l)}n+=a.length}return e}}),new function(){function v(i,t,r){var s,a,o,h,u,l,c,d,e=t._segments,n=e.length,f=new Array(6),_=!0;function g(t){var e,n;a=r?(t._transformCoordinates(r,f),s=f[0],f[1]):(e=t._point,s=e._x,e._y),_?(i.moveTo(s,a),_=!1):(l=r?(u=f[2],f[3]):(n=t._handleIn,u=s+n._x,a+n._y),u===s&&l===a&&c===o&&d===h?i.lineTo(s,a):i.bezierCurveTo(c,d,u,l,s,a)),o=s,h=a,d=r?(c=f[4],f[5]):(n=t._handleOut,c=o+n._x,h+n._y)}for(var p=0;p<n;p++)g(e[p]);t._closed&&0<n&&g(e[0])}return{_draw:function(t,e,n,i){var r=e.dontStart,s=e.dontFinish||e.clip,a=this.getStyle(),o=a.hasFill(),h=a.hasStroke(),u=a.getDashArray(),l=!Wt.support.nativeDash&&h&&u&&u.length;function c(t){return u[(t%l+l)%l]}if(r||t.beginPath(),(o||h&&!l||s)&&(v(t,this,i),this._closed&&t.closePath()),!s&&(o||h)&&(this._setStyles(t,e,n,i),o&&(t.fill(a.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),h)){if(l){r||t.beginPath();for(var d,f=new w(this,.25,32,!1,i),_=f.length,g=-a.getDashOffset(),p=0;0<g;)g-=c(p--)+c(p--);for(;g<_;)d=g+c(p++),(0<g||0<d)&&f.drawPart(t,Math.max(g,0),Math.max(d,0)),g=d+c(p++)}t.stroke()}},_drawSelected:function(t,e){t.beginPath(),v(t,this,e),t.stroke(),function(n,t,e,i){if(!(i<=0))for(var r,s,a=i/2,o=i-2,h=a-1,u=new Array(6),l=0,c=t.length;l<c;l++){var d=t[l],f=d._selection;d._transformCoordinates(e,u),r=u[0],s=u[1],2&f&&_(2),4&f&&_(4),n.fillRect(r-a,s-a,i,i),0<o&&!(1&f)&&(f=n.fillStyle,n.fillStyle="#ffffff",n.fillRect(r-h,s-h,o,o),n.fillStyle=f)}function _(t){var e=u[t],t=u[t+1];r==e&&s==t||(n.beginPath(),n.moveTo(r,s),n.lineTo(e,t),n.stroke(),n.beginPath(),n.arc(e,t,a,0,2*Math.PI,!0),n.fill())}}(t,this._segments,e,Wt.settings.handleSize)}}},new function(){function O(t){t=t._segments;if(!t.length)throw new Error("Use a moveTo() command first");return t[t.length-1]}return{moveTo:function(){var t=this._segments;1===t.length&&this.removeSegment(0),t.length||this._add([new H(L.read(arguments))])},moveBy:function(){throw new Error("moveBy() is unsupported on Path items.")},lineTo:function(){this._add([new H(L.read(arguments))])},cubicCurveTo:function(){var t=arguments,e=L.read(t),n=L.read(t),i=L.read(t),t=O(this);t.setHandleOut(e.subtract(t._point)),this._add([new H(i,n.subtract(i))])},quadraticCurveTo:function(){var t=arguments,e=L.read(t),n=L.read(t),t=O(this)._point;this.cubicCurveTo(e.add(t.subtract(e).multiply(1/3)),e.add(n.subtract(e).multiply(1/3)),n)},curveTo:function(){var t=arguments,e=L.read(t),n=L.read(t),i=D.pick(D.read(t),.5),r=1-i,t=O(this)._point,r=e.subtract(t.multiply(r*r)).subtract(n.multiply(i*i)).divide(2*i*r);if(r.isNaN())throw new Error("Cannot put a curve through points with parameter = "+i);this.quadraticCurveTo(r,n)},arcTo:function(){var t,e=arguments,n=Math.abs,i=Math.sqrt,r=O(this),s=r._point,a=L.read(e),o=D.peek(e);if("boolean"==typeof(d=D.pick(o,!0)))var h=(_=s.add(a).divide(2)).add(_.subtract(s).rotate(d?-90:90));else if(D.remain(e)<=2)h=a,a=L.read(e);else if(!s.equals(a)){var u=z.read(e),l=q.isZero;if(l(u.width)||l(u.height))return this.lineTo(a);var c=D.read(e),d=!!D.read(e),f=!!D.read(e),_=s.add(a).divide(2),g=(T=s.subtract(_).rotate(-c)).x,p=T.y,v=n(u.width),m=n(u.height),y=v*v,o=m*m,l=g*g,e=p*p,u=i(l/y+e/o);if(1<u&&(y=(v*=u)*v,o=(m*=u)*m),(u=n(u=(y*o-y*e-o*l)/(y*e+o*l))<1e-12?0:u)<0)throw new Error("Cannot create an arc with the given arguments");w=new L(v*p/m,-m*g/v).multiply((f===d?-1:1)*i(u)).rotate(c).add(_),c=(x=(t=(new A).translate(w).rotate(c).scale(v,m))._inverseTransform(s)).getDirectedAngle(t._inverseTransform(a)),!d&&0<c?c-=360:d&&c<0&&(c+=360)}if(h){var w,v=new N(s.add(h).divide(2),h.subtract(s).rotate(90),!0),m=new N(h.add(a).divide(2),a.subtract(h).rotate(90),!0),d=new N(s,a),h=d.getSide(h);if(!(w=v.intersect(m,!0))){if(!h)return this.lineTo(a);throw new Error("Cannot create an arc with the given arguments")}var x,c=(x=s.subtract(w)).getDirectedAngle(a.subtract(w)),d=d.getSide(w,!0);0===d?c=h*n(c):h===d&&(c+=c<0?360:-360)}if(c){for(var n=n(c),b=360<=n?4:Math.ceil((n-1e-5)/90),S=c/b,c=S*Math.PI/360,C=4/3*Math.sin(c)/(1+Math.cos(c)),I=[],M=0;M<=b;M++){var P,T=a,k=null;M<b&&(k=x.rotate(90).multiply(C),t?(T=t._transformPoint(x),k=t._transformPoint(x.add(k)).subtract(T)):T=w.add(x)),M?(P=x.rotate(-90).multiply(C),t&&(P=t._transformPoint(x.add(P)).subtract(T)),I.push(new H(T,P,k))):r.setHandleOut(k),x=x.rotate(S)}this._add(I)}},lineBy:function(){var t=L.read(arguments),e=O(this)._point;this.lineTo(e.add(t))},curveBy:function(){var t=arguments,e=L.read(t),n=L.read(t),i=D.read(t),t=O(this)._point;this.curveTo(t.add(e),t.add(n),i)},cubicCurveBy:function(){var t=arguments,e=L.read(t),n=L.read(t),i=L.read(t),t=O(this)._point;this.cubicCurveTo(t.add(e),t.add(n),t.add(i))},quadraticCurveBy:function(){var t=arguments,e=L.read(t),n=L.read(t),t=O(this)._point;this.quadraticCurveTo(t.add(e),t.add(n))},arcBy:function(){var t=arguments,e=O(this)._point,n=e.add(L.read(t)),i=D.pick(D.peek(t),!0);"boolean"==typeof i?this.arcTo(n,i):this.arcTo(n,e.add(L.read(t)))},closePath:function(t){this.setClosed(!0),this.join(this,t)}}},{_getBounds:function(t,e){var n=e.handle?"getHandleBounds":e.stroke?"getStrokeBounds":"getBounds";return U[n](this._segments,this._closed,this,t,e)},statics:{getBounds:function(t,e,n,i,r,s){var a=t[0];if(!a)return new b;var o=new Array(6),h=a._transformCoordinates(i,new Array(6)),u=h.slice(0,2),l=u.slice(),c=new Array(2);function d(t){t._transformCoordinates(i,o);for(var e=0;e<2;e++)Z._addBounds(h[e],h[e+4],o[e+2],o[e],e,s?s[e]:0,u,l,c);t=h;h=o,o=t}for(var f=1,_=t.length;f<_;f++)d(t[f]);return e&&d(a),new b(u[0],u[1],l[0]-u[0],l[1]-u[1])},getStrokeBounds:function(t,e,n,i,r){var s=n.getStyle(),a=s.hasStroke(),o=s.getStrokeWidth(),h=a&&n._getStrokeMatrix(i,r),u=a&&U._getStrokePadding(o,h),l=U.getBounds(t,e,n,i,r,u);if(!a)return l;var c=o/2,d=s.getStrokeJoin(),o=s.getStrokeCap(),f=s.getMiterLimit(),_=new b(new z(u));function g(t){l=l.include(t)}function p(t){l=l.unite(_.setCenter(t._point.transform(i)))}function v(t,e){"round"===e||t.isSmooth()?p(t):U._addBevelJoin(t,e,c,f,i,h,g)}function m(t,e){"round"===e?p(t):U._addSquareCap(t,e,c,i,h,g)}var y=t.length-(e?0:1);if(0<y){for(var w=1;w<y;w++)v(t[w],d);e?v(t[0],d):(m(t[0],o),m(t[t.length-1],o))}return l},_getStrokePadding:function(t,e){if(!e)return[t,t];var n=e._a,i=e._b,r=e._c,e=e._d;return[t*Math.sqrt(n*n+r*r),t*Math.sqrt(i*i+e*e)]},_addBevelJoin:function(t,e,n,i,r,s,a,o){var h=t.getCurve(),u=h.getPrevious(),t=h.getPoint1().transform(r),r=u.getNormalAtTime(1).multiply(n),u=h.getNormalAtTime(0).multiply(n),h=r.getDirectedAngle(u);(h<0||180<=h)&&(r=r.negate(),u=u.negate()),o&&a(t),a(t.add(r.transform(s))),"miter"!==e||(r=new N(r,new L(-r.y,r.x),!0).intersect(new N(u,new L(-u.y,u.x),!0),!0))&&r.getLength()<=i*n&&a(t.add(r.transform(s))),a(t.add(u.transform(s)))},_addSquareCap:function(t,e,n,i,r,s,a){i=t._point.transform(i),t=t.getLocation(),t=t.getNormal().multiply(0===t.getTime()?n:-n),n=t.transform(r);"square"===e&&(a&&(s(i.subtract(n)),s(i.add(n))),i=i.add(t.rotate(-90).transform(r))),s(i.add(n)),s(i.subtract(n))},getHandleBounds:function(t,e,n,i,r){var s,a,o,h=n.getStyle();r.stroke&&h.hasStroke()&&(o=n._getStrokeMatrix(i,r),r=n=h.getStrokeWidth()/2,"miter"===h.getStrokeJoin()&&(r=n*h.getMiterLimit()),"square"===h.getStrokeCap()&&(r=Math.max(r,n*Math.SQRT2)),s=U._getStrokePadding(n,o),a=U._getStrokePadding(r,o));for(var u=new Array(6),l=1/0,c=-l,d=l,f=c,_=0,g=t.length;_<g;_++){t[_]._transformCoordinates(i,u);for(var p=0;p<6;p+=2){var v=p?s:a,m=v?v[0]:0,y=v?v[1]:0,w=u[p],x=u[p+1],v=w-m,w=w+m,m=x-y,y=x+y;v<l&&(l=v),c<w&&(c=w),m<d&&(d=m),f<y&&(f=y)}}return new b(l,d,c-l,f-d)}}});U.inject({statics:new function(){var u=.5522847498307936,a=[new H([-1,0],[0,u],[0,-u]),new H([0,-1],[-u,0],[u,0]),new H([1,0],[0,-u],[0,u]),new H([0,1],[u,0],[-u,0])];function l(t,e,n){var i=D.getNamed(n),n=new U(i&&{insert:i.insert,project:i.project,parent:i.parent});return n._add(t),n._closed=e,n.set(i,{insert:!0,project:!0,parent:!0})}function i(t,e,n){for(var i=new Array(4),r=0;r<4;r++){var s=a[r];i[r]=new H(s._point.multiply(e).add(t),s._handleIn.multiply(e),s._handleOut.multiply(e))}return l(i,!0,n)}return{Line:function(){var t=arguments;return l([new H(L.readNamed(t,"from")),new H(L.readNamed(t,"to"))],!1,t)},Circle:function(){var t=arguments,e=L.readNamed(t,"center"),n=D.readNamed(t,"radius");return i(e,new z(n),t)},Rectangle:function(){var t,e,n=arguments,i=b.readNamed(n,"rectangle"),r=z.readNamed(n,"radius",0,{readNull:!0}),s=i.getBottomLeft(!0),a=i.getTopLeft(!0),o=i.getTopRight(!0),h=i.getBottomRight(!0);return l(!r||r.isZero()?[new H(s),new H(a),new H(o),new H(h)]:(t=(r=z.min(r,i.getSize(!0).divide(2))).width,e=r.height,i=t*u,r=e*u,[new H(s.add(t,0),null,[-i,0]),new H(s.subtract(0,e),[0,r]),new H(a.add(0,e),null,[0,-r]),new H(a.add(t,0),[-i,0],null),new H(o.subtract(t,0),null,[i,0]),new H(o.add(0,e),[0,-r],null),new H(h.subtract(0,e),null,[0,r]),new H(h.subtract(t,0),[i,0])]),!0,n)},RoundRectangle:"#Rectangle",Ellipse:function(){var t=arguments,e=g._readEllipse(t);return i(e.center,e.radius,t)},Oval:"#Ellipse",Arc:function(){var t=arguments,e=L.readNamed(t,"from"),n=L.readNamed(t,"through"),i=L.readNamed(t,"to"),r=new U(V.NO_INSERT);return r.moveTo(e),r.arcTo(n,i),l(r._segments,!1,t)},RegularPolygon:function(){for(var t=arguments,e=L.readNamed(t,"center"),n=D.readNamed(t,"sides"),i=D.readNamed(t,"radius"),r=-360/n,s=n%2?0:-.5,a=new L(0,-i),o=new Array(n),h=0;h<n;h++)o[h]=new H(e.add(a.rotate((h+s)*r)));return l(o,!0,t)},Star:function(){for(var t=arguments,e=L.readNamed(t,"center"),n=2*D.readNamed(t,"points"),i=D.readNamed(t,"radius1"),r=D.readNamed(t,"radius2"),s=360/n,a=new L(0,-1),o=new Array(n),h=0;h<n;h++)o[h]=new H(e.add(a.rotate(s*h).multiply(h%2?r:i)));return l(o,!0,t)}}}});var G=y.extend({_class:"CompoundPath",_serializeFields:{children:[]},beans:!0,initialize:function(t){this._children=[],this._namedChildren={},this._initialize(t)||("string"==typeof t?this.setPathData(t):this.addChildren(Array.isArray(t)?t:arguments))},_transformContent:function t(e){return this._scaleStroke(e),t.base.apply(this,arguments)},insertChildren:function t(e,n){var i=n,r=i[0];r&&"number"==typeof r[0]&&(i=[i]);for(var s=n.length-1;0<=s;s--){var a=i[s];i!==n||a instanceof U||(i=D.slice(i)),Array.isArray(a)?i[s]=new U({segments:a,insert:!1}):a instanceof G&&(i.splice.apply(i,[s,1].concat(a.removeChildren())),a.remove())}return t.base.call(this,e,i)},reduce:function t(e){for(var n,i=this._children,r=i.length-1;0<=r;r--)(n=i[r].reduce(e)).isEmpty()&&n.remove();return i.length?t.base.call(this):((n=new U(V.NO_INSERT)).copyAttributes(this),n.insertAbove(this),this.remove(),n)},isClosed:function(){for(var t=this._children,e=0,n=t.length;e<n;e++)if(!t[e]._closed)return!1;return!0},setClosed:function(t){for(var e=this._children,n=0,i=e.length;n<i;n++)e[n].setClosed(t)},getFirstSegment:function(){var t=this.getFirstChild();return t&&t.getFirstSegment()},getLastSegment:function(){var t=this.getLastChild();return t&&t.getLastSegment()},getCurves:function(){for(var t=this._children,e=[],n=0,i=t.length;n<i;n++)D.push(e,t[n].getCurves());return e},getFirstCurve:function(){var t=this.getFirstChild();return t&&t.getFirstCurve()},getLastCurve:function(){var t=this.getLastChild();return t&&t.getLastCurve()},getArea:function(){for(var t=this._children,e=0,n=0,i=t.length;n<i;n++)e+=t[n].getArea();return e},getLength:function(){for(var t=this._children,e=0,n=0,i=t.length;n<i;n++)e+=t[n].getLength();return e},getPathData:function(t,e){for(var n=this._children,i=[],r=0,s=n.length;r<s;r++){var a=n[r],o=a._matrix;i.push(a.getPathData(t&&!o.isIdentity()?t.appended(o):t,e))}return i.join("")},_hitTestChildren:function t(e,n,i){return t.base.call(this,e,n.class===U||"path"===n.type?n:D.set({},n,{fill:!1}),i)},_draw:function(t,e,n,i){var r=this._children;if(r.length){e=e.extend({dontStart:!0,dontFinish:!0}),t.beginPath();for(var s=0,a=r.length;s<a;s++)r[s].draw(t,e,i);e.clip||(this._setStyles(t,e,n,i),(n=this._style).hasFill()&&(t.fill(n.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),n.hasStroke()&&t.stroke())}},_drawSelected:function(t,e,n){for(var i=this._children,r=0,s=i.length;r<s;r++){var a=i[r],o=a._matrix;n[a._id]||a._drawSelected(t,o.isIdentity()?e:e.appended(o))}}},new function(){function n(t,e){t=t._children;if(e&&!t.length)throw new Error("Use a moveTo() command first");return t[t.length-1]}return D.each(["lineTo","cubicCurveTo","quadraticCurveTo","curveTo","arcTo","lineBy","cubicCurveBy","quadraticCurveBy","curveBy","arcBy"],function(e){this[e]=function(){var t=n(this,!0);t[e].apply(t,arguments)}},{moveTo:function(){var t=n(this),e=t&&t.isEmpty()?t:new U(V.NO_INSERT);e!==t&&this.addChild(e),e.moveTo.apply(e,arguments)},moveBy:function(){var t=n(this,!0),e=t&&t.getLastSegment(),t=L.read(arguments);this.moveTo(e?t.add(e._point):t)},closePath:function(t){n(this,!0).closePath(t)}})},D.each(["reverse","flatten","simplify","smooth"],function(s){this[s]=function(t){for(var e,n=this._children,i=0,r=n.length;i<r;i++)e=n[i][s](t)||e;return e}},{}));y.inject(new function(){var A=Math.min,L=Math.max,N=Math.abs,S={unite:{1:!0,2:!0},intersect:{2:!0},subtract:{1:!0},exclude:{1:!0,"-1":!0}};function C(t){return t._children||[t]}function I(t,e){var n=t.clone(!1).reduce({simplify:!0}).transform(null,!0,!0);if(e){for(var i=C(n),r=0,s=i.length;r<s;r++)(t=i[r])._closed||t.isEmpty()||(t.closePath(1e-12),t.getFirstSegment().setHandleIn(0,0),t.getLastSegment().setHandleOut(0,0));n=n.resolveCrossings().reorient("nonzero"===n.getFillRule(),!0)}return n}function M(t,e,n,i,r){var s=new G(V.NO_INSERT);return s.addChildren(t,!0),s=s.reduce({simplify:e}),D.pick(r&&r.insert,Wt.settings.insertItems)&&s.insertAbove(i&&n.isSibling(i)&&n.getIndex()<i.getIndex()?i:n),s.copyAttributes(n,!0),s}function P(t){return t.hasOverlap()||t.isCrossing()}function n(t,e,n,i){if(i&&(0==i.trace||i.stroke)&&/^(subtract|intersect)$/.test(n))return T(t,e,n,i);var r=I(t,!0),s=e&&t!==e&&I(e,!0),a=S[n];a[n]=!0,s&&(a.subtract||a.exclude)^(s.isClockwise()^r.isClockwise())&&s.reverse();var o,h=z(W.expand(r.getIntersections(s,P))),u=C(r),n=s&&C(s),l=[],c=[];function d(t){for(var e=0,n=t.length;e<n;e++){var i=t[e];D.push(l,i._segments),D.push(c,i.getCurves()),i._overlapsOnly=!0}}function f(t){for(var e=[],n=0,i=t&&t.length;n<i;n++)e.push(c[t[n]]);return e}if(h.length){d(u),n&&d(n);for(var _=new Array(c.length),g=0,p=c.length;g<p;g++)_[g]=c[g].getValues();for(var v=R.findCurveBoundsCollisions(_,_,0,!0),m={},g=0;g<c.length;g++){var y=c[g],w=y._path._id;(m[w]=m[w]||{})[y.getIndex()]={hor:f(v[g].hor),ver:f(v[g].ver)}}for(g=0,p=h.length;g<p;g++)B(h[g]._segment,r,s,m,a);for(g=0,p=l.length;g<p;g++){var x=l[g],b=x._intersection;x._winding||B(x,r,s,m,a),b&&b._overlap||(x._path._overlapsOnly=!1)}o=F(l,a)}else o=O(n?u.concat(n):u.slice(),function(t){return!!a[t]});return M(o,!0,t,e,i)}function T(t,e,n,i){var r=I(t),s=I(e),a=r.getIntersections(s,P),o="subtract"===n,h="divide"===n,u={},l=[];function c(t){return!u[t._id]&&(h||s.contains(t.getPointAt(t.getLength()/2))^o)&&(l.unshift(t),u[t._id]=!0)}for(var d=a.length-1;0<=d;d--){var f=a[d].split();f&&(c(f)&&f.getFirstSegment().setHandleIn(0,0),r.getLastSegment().setHandleOut(0,0))}return c(r),M(l,!1,t,e,i)}function b(t,e){for(var n=t;n;){if(n===e)return;n=n._previous}for(;t._next&&t._next!==e;)t=t._next;if(!t._next){for(;e._previous;)e=e._previous;(t._next=e)._previous=t}}function k(t){for(var e=t.length-1;0<=e;e--)t[e].clearHandles()}function O(t,e,n){var i=t&&t.length;if(i){var r=D.each(t,function(t,e){this[t._id]={container:null,winding:t.isClockwise()?1:-1,index:e}},{}),s=t.slice().sort(function(t,e){return N(e.getArea())-N(t.getArea())}),a=s[0],o=R.findItemBoundsCollisions(s,null,q.GEOMETRIC_EPSILON);null==n&&(n=a.isClockwise());for(var h=0;h<i;h++){var u,l=s[h],c=r[l._id],d=0,f=o[h];if(f)for(var _=null,g=f.length-1;0<=g;g--)if(f[g]<h){var _=_||l.getInteriorPoint(),p=s[f[g]];if(p.contains(_)){var v=r[p._id],d=v.winding;c.winding+=d,c.container=v.exclude?v.container:p;break}}e(c.winding)===e(d)?(c.exclude=!0,t[c.index]=null):(u=c.container,l.setClockwise(u?!u.isClockwise():n))}}return t}function z(t,e,n){var i,r,s,a=e&&[],o=!1,h=n||[],u=n&&{};function l(t){return t._path._id+"."+t._segment1._index}for(var c=(n&&n.length)-1;0<=c;c--)(d=n[c])._path&&(u[l(d)]=!0);for(c=t.length-1;0<=c;c--){var d,f=t[c],_=f._time,g=_,p=e&&!e(f);if((d=f._curve)&&(d!==r?(o=!d.hasHandles()||u&&u[l(d)],i=[],s=null,r=d):1e-8<=s&&(_/=s)),p)i&&i.push(f);else{if(e&&a.unshift(f),s=g,_<1e-8)v=d._segment1;else if(1-1e-8<_)v=d._segment2;else{g=d.divideAtTime(_,!0);o&&h.push(d,g);for(var v=g._segment1,m=i.length-1;0<=m;m--){var y=i[m];y._time=(y._time-_)/(1-_)}}f._setSegment(v);var w=v._intersection,f=f._intersection;if(w){b(w,f);for(var x=w;x;)b(x._intersection,w),x=x._next}else v._intersection=f}}return n||k(h),a||t}function E(u,l,c,d,f){var t,e=Array.isArray(l)?l:l[c?"hor":"ver"],_=c?1:0,g=1^_,n=[u.x,u.y],p=n[_],v=n[g],m=1e-6,y=p-1e-9,w=p+1e-9,i=0,r=0,x=0,b=0,S=!1,s=!1,C=1,I=[];function a(t){var e=t[g+0],n=t[g+2],i=t[g+4],r=t[g+6];if(v<=L(e,n,i,r)&&v>=A(e,n,i,r))for(var s,e=t[_+0],n=t[_+2],i=t[_+4],r=t[_+6],a=y>L(e,n,i,r)||w<A(e,n,i,r)?[t]:Z.getMonoCurves(t,c),o=0,h=a.length;o<h;o++)if(s=function(t){var e=t[g+0],n=t[g+6];if(!(v<A(e,n)||v>L(e,n))){var i=t[_+0],r=t[_+2],s=t[_+4],a=t[_+6];if(e!==n){var o=v===e?0:v!==n&&!(y>L(i,r,s,a)||w<A(i,r,s,a))&&0<Z.solveCubic(t,g,v,I,0,1)?I[0]:1,h=0===o?i:1===o?a:Z.getPoint(t,o)[c?"y":"x"],r=n<e?1:-1,s=k[g]>k[g+6]?1:-1,n=k[_+6];return v!==e?(h<y?x+=r:w<h?b+=r:S=!0,p-m<h&&h<p+m&&(C/=2)):(r!=s?i<y?x+=r:w<i&&(b+=r):i!=n&&(n<w&&w<h?(b+=r,S=!0):y<n&&h<y&&(x+=r,S=!0)),C/=4),k=t,!f&&y<h&&h<w&&0===Z.getTangent(t,o)[c?"x":"y"]&&E(u,l,!c,d,!0)}(i<w&&y<a||a<w&&y<i)&&(S=!0)}}(a[o]))return s}for(var o=0,h=e.length;o<h;o++){var M=e[o],P=M._path,T=M.getValues();if(!(o&&e[o-1]._path===P||(k=null,P._closed||(t=Z.getValues(P.getLastCurve().getSegment2(),M.getSegment1(),null,!d))[g]!==t[g+6]&&(k=t),k)))for(var k=T,O=P.getLastCurve();O&&O!==M;){var z=O.getValues();if(z[g]!==z[g+6]){k=z;break}O=O.getPrevious()}if(T=a(T))return T;if(o+1===h||e[o+1]._path!==P){if(t&&(T=a(t)))return T;i+=x=S&&!x&&!b?b=P.isClockwise(d)^c?1:-1:x,r+=b,x=b=0,S=S&&!(s=!0),t=null}}return i=N(i),r=N(r),{winding:L(i,r),windingL:i,windingR:r,quality:C,onPath:s}}function B(t,e,n,i,r){var s=[],a=t,o=0;do{}while((p=t.getCurve())&&(c=p.getLength(),s.push({segment:t,curve:p,length:c}),o+=c),(t=t.getNext())&&!t._intersection&&t!==a);for(var h=[.5,.25,.75],u={winding:0,quality:-1},l=0;l<h.length&&u.quality<.5;l++)for(var c=o*h[l],d=0,f=s.length;d<f;d++){var _=s[d],g=_.length;if(c<=g){var p,v=(p=_.curve)._path,m=v._parent,y=m instanceof G?m:v,w=q.clamp(p.getTimeAt(c),.001,.999),x=p.getPointAtTime(w),_=N(p.getTangentAtTime(w).y)<Math.SQRT1_2,m=null;if(r.subtract&&n){w=(y===e?n:e)._getWinding(x,_,!0);if(y===e&&w.winding||y===n&&!w.winding){if(w.quality<1)continue;m={winding:0,quality:1}}}(m=m||E(x,i[v._id][p.getIndex()],_,!0)).quality>u.quality&&(u=m);break}c-=g}for(d=s.length-1;0<=d;d--)s[d].segment._winding=u}function F(t,e){var h,n=[];function u(t){return!(!t||t._visited||e&&(!e[(t=t._winding||{}).winding]||e.unite&&2===t.winding&&t.windingL&&t.windingR))}function l(t){if(t)for(var e=0,n=h.length;e<n;e++)if(t===h[e])return!0;return!1}function i(t){for(var e=t._segments,n=0,i=e.length;n<i;n++)e[n]._visited=!0}t.sort(function(t,e){var n=t._intersection,i=e._intersection,r=!(!n||!n._overlap),s=!(!i||!i._overlap),a=t._path,o=e._path;return r^s?r?1:-1:!n^!i?n?1:-1:a!==o?a._id-o._id:t._index-e._index});for(var r=0,s=t.length;r<s;r++){var a,o,c,d,f,_=t[r],g=u(_),p=null,v=!1,m=!0,y=[];for(g&&_._path._overlapsOnly&&(d=_._path,f=_._intersection._segment._path,d.compare(f)&&(d.getArea()&&n.push(d.clone(!1)),i(d),i(f),g=!1));g;){var w=!p,x=function(s,a){var t=s._intersection,e=t,o=[];function n(t,e){for(;t&&t!==e;){var n,i=t._segment,r=i&&i._path;r&&(r=(n=i.getNext()||r.getFirstSegment())._intersection,i!==s&&(l(i)||l(n)||n&&u(i)&&(u(n)||r&&u(r._segment)))&&o.push(i),a&&h.push(i)),t=t._next}}if(a&&(h=[s]),t){for(n(t);t&&t._previous;)t=t._previous;n(t,e)}return o}(_,w),b=x.shift(),S=!(v=!w&&(l(_)||l(b)))&&b;if(w&&(p=new U(V.NO_INSERT),a=null),v){(_.isFirst()||_.isLast())&&(m=_._path._closed),_._visited=!0;break}if(S&&a&&(y.push(a),a=null),a||(S&&x.push(_),a={start:p._segments.length,crossings:x,visited:o=[],handleIn:c}),!u(_=S?b:_)){p.removeSegments(a.start);for(var C=0,I=o.length;C<I;C++)o[C]._visited=!1;for(o.length=0;(_=a&&a.crossings.shift())&&_._path||(_=null,(a=y.pop())&&(o=a.visited,c=a.handleIn)),a&&!u(_););if(!_)break}b=_.getNext();p.add(new H(_._point,c,b&&_._handleOut)),_._visited=!0,o.push(_),_=b||_._path.getFirstSegment(),c=b&&b._handleIn}v&&(m&&(p.getFirstSegment().setHandleIn(c),p.setClosed(m)),0!==p.getArea()&&n.push(p))}return n}return{_getWinding:function(t,e,n){return E(t,this.getCurves(),e,n)},unite:function(t,e){return n(this,t,"unite",e)},intersect:function(t,e){return n(this,t,"intersect",e)},subtract:function(t,e){return n(this,t,"subtract",e)},exclude:function(t,e){return n(this,t,"exclude",e)},divide:function(t,e){return e&&(0==e.trace||e.stroke)?T(this,t,"divide",e):M([this.subtract(t,e),this.intersect(t,e)],!0,this,t,e)},resolveCrossings:function(){var t=this._children,e=t||[this];function n(t,e){t=t&&t._intersection;return t&&t._overlap&&t._path===e}var i=!1,r=!1,s=this.getIntersections(null,function(t){return t.hasOverlap()?i=!0:t.isCrossing()&&(r=!0)}),a=i&&r&&[],s=W.expand(s);if(i)for(var o=z(s,function(t){return t.hasOverlap()},a),h=o.length-1;0<=h;h--){var u=o[h],l=u._path,c=u._segment,d=c.getPrevious(),u=c.getNext();n(d,l)&&n(u,l)&&(c.remove(),d._handleOut._set(0,0),u._handleIn._set(0,0),d===c||d.getCurve().hasLength()||(u._handleIn.set(d._handleIn),d.remove()))}r&&(z(s,i&&function(t){var e=t.getCurve(),n=t.getSegment(),i=t._intersection,t=i._curve,i=i._segment;if(e&&t&&e._path&&t._path)return!0;n&&(n._intersection=null),i&&(i._intersection=null)},a),a&&k(a),e=F(D.each(e,function(t){D.push(this,t._segments)},[])));var f,a=e.length;return 1<a&&t?(e!==t&&this.setChildren(e),f=this):1!==a||t||(e[0]!==this&&this.setSegments(e[0].removeSegments()),f=this),f||((f=new G(V.NO_INSERT)).addChildren(e),(f=f.reduce()).copyAttributes(this),this.replaceWith(f)),f},reorient:function(e,t){var n=this._children;return n&&n.length?this.setChildren(O(this.removeChildren(),function(t){return!!(e?t:1&t)},t)):t!==j&&this.setClockwise(t),this},getInteriorPoint:function(){var t=this.getBounds().getCenter(!0);if(!this.contains(t)){for(var e=this.getCurves(),n=t.y,i=[],r=[],s=0,a=e.length;s<a;s++){var o=e[s].getValues(),h=o[1],u=o[3],l=o[5],c=o[7];if(n>=A(h,u,l,c)&&n<=L(h,u,l,c))for(var d=Z.getMonoCurves(o),f=0,_=d.length;f<_;f++){var g=d[f],p=g[1],v=g[7];p!==v&&(p<=n&&n<=v||v<=n&&n<=p)&&(g=n===p?g[0]:n===v?g[6]:1===Z.solveCubic(g,1,n,r,0,1)?Z.getPoint(g,r[0]).x:(g[0]+g[6])/2,i.push(g))}}1<i.length&&(i.sort(function(t,e){return t-e}),t.x=(i[0]+i[1])/2)}return t}}});var w=D.extend({_class:"PathFlattener",initialize:function(t,o,e,h,n){var i,r=[],u=[],l=0,c=1/(e||32),s=t._segments,a=s[0];function d(t,e){e=Z.getValues(t,e,n);r.push(e),function t(e,n,i,r){{var s,a;!(c<r-i)||h&&Z.isStraight(e)||Z.isFlatEnough(e,o||.25)?(s=e[6]-e[0],a=e[7]-e[1],0<(a=Math.sqrt(s*s+a*a))&&(l+=a,u.push({offset:l,curve:e,index:n,time:r}))):(a=Z.subdivide(e,.5),e=(i+r)/2,t(a[0],n,i,e),t(a[1],n,e,r))}}(e,t._index,0,1)}for(var f=1,_=s.length;f<_;f++)d(a,i=s[f]),a=i;t._closed&&d(i||a,s[0]),this.curves=r,this.parts=u,this.length=l,this.index=0},_get:function(t){for(var e,n=this.parts,i=n.length,r=this.index;(e=r)&&!(n[--r].offset<t););for(;e<i;e++){var s=n[e];if(s.offset>=t){var a=n[(this.index=e)-1],o=a&&a.index===s.index?a.time:0,a=a?a.offset:0;return{index:s.index,time:o+(s.time-o)*(t-a)/(s.offset-a)}}}return{index:n[i-1].index,time:1}},drawPart:function(t,e,n){for(var i=this._get(e),r=this._get(n),s=i.index,a=r.index;s<=a;s++){var o=Z.getPart(this.curves[s],s===i.index?i.time:0,s===r.index?r.time:1);s===i.index&&t.moveTo(o[0],o[1]),t.bezierCurveTo.apply(t,o.slice(2))}}},D.each(Z._evaluateMethods,function(e){this[e+"At"]=function(t){t=this._get(t);return Z[e](this.curves[t.index],t.time)}},{})),S=D.extend({initialize:function(t){for(var e,n=this.points=[],i=t._segments,t=t._closed,r=0,s=i.length;r<s;r++){var a=i[r].point;e&&e.equals(a)||n.push(e=a.clone())}t&&(n.unshift(n[n.length-1]),n.push(n[1])),this.closed=t},fit:function(t){var e=this.points,n=e.length,i=null;return 0<n&&(i=[new H(e[0])],1<n&&(this.fitCubic(i,t,0,n-1,e[1].subtract(e[0]),e[n-2].subtract(e[n-1])),this.closed&&(i.shift(),i.pop()))),i},fitCubic:function(t,e,n,i,r,s){var a=this.points;if(i-n!=1){for(var o,h=this.chordLengthParameterize(n,i),u=Math.max(e,e*e),l=!0,c=0;c<=4;c++){var d=this.generateBezier(n,i,h,r,s),f=this.findMaxError(n,i,d,h);if(f.error<e&&l)return void this.addCurve(t,d);if(o=f.index,f.error>=u)break;l=this.reparameterize(n,i,h,d),u=f.error}var _=a[o-1].subtract(a[o+1]);this.fitCubic(t,e,n,o,r,_),this.fitCubic(t,e,o,i,_.negate(),s)}else{var g=a[n],_=a[i],a=g.getDistance(_)/3;this.addCurve(t,[g,g.add(r.normalize(a)),_.add(s.normalize(a)),_])}},addCurve:function(t,e){t[t.length-1].setHandleOut(e[1].subtract(e[0])),t.push(new H(e[3],e[2].subtract(e[3])))},generateBezier:function(t,e,n,i,r){for(var s=Math.abs,a=this.points,o=a[t],h=a[e],u=[[0,0],[0,0]],l=[0,0],c=0,d=e-t+1;c<d;c++){var f=n[c],_=1-f,g=3*f*_,p=_*_*_,v=g*_,m=g*f,_=f*f*f,g=i.normalize(v),f=r.normalize(m),_=a[t+c].subtract(o.multiply(p+v)).subtract(h.multiply(m+_));u[0][0]+=g.dot(g),u[0][1]+=g.dot(f),u[1][0]=u[0][1],u[1][1]+=f.dot(f),l[0]+=g.dot(_),l[1]+=f.dot(_)}var y,w,e=u[0][0]*u[1][1]-u[1][0]*u[0][1];1e-12<s(e)?(w=u[0][0]*l[1]-u[1][0]*l[0],y=(l[0]*u[1][1]-l[1]*u[0][1])/e,w=w/e):(e=u[0][0]+u[0][1],S=u[1][0]+u[1][1],y=w=1e-12<s(e)?l[0]/e:1e-12<s(S)?l[1]/S:0);var x,b,s=h.getDistance(o),S=1e-12*s;return y<S||w<S?y=w=s/3:(S=h.subtract(o),x=i.normalize(y),b=r.normalize(w),x.dot(S)-b.dot(S)>s*s&&(y=w=s/3,x=b=null)),[o,o.add(x||i.normalize(y)),h.add(b||r.normalize(w)),h]},reparameterize:function(t,e,n,i){for(var r=t;r<=e;r++)n[r-t]=this.findRoot(i,this.points[r],n[r-t]);for(var r=1,s=n.length;r<s;r++)if(n[r]<=n[r-1])return!1;return!0},findRoot:function(t,e,n){for(var i=[],r=[],s=0;s<=2;s++)i[s]=t[s+1].subtract(t[s]).multiply(3);for(s=0;s<=1;s++)r[s]=i[s+1].subtract(i[s]).multiply(2);var a=this.evaluate(3,t,n),o=this.evaluate(2,i,n),h=this.evaluate(1,r,n),e=a.subtract(e),h=o.dot(o)+e.dot(h);return q.isMachineZero(h)?n:n-e.dot(o)/h},evaluate:function(t,e,n){for(var i=e.slice(),r=1;r<=t;r++)for(var s=0;s<=t-r;s++)i[s]=i[s].multiply(1-n).add(i[s+1].multiply(n));return i[0]},chordLengthParameterize:function(t,e){for(var n=[0],i=t+1;i<=e;i++)n[i-t]=n[i-t-1]+this.points[i].getDistance(this.points[i-1]);for(var i=1,r=e-t;i<=r;i++)n[i]/=n[r];return n},findMaxError:function(t,e,n,i){for(var r=Math.floor((e-t+1)/2),s=0,a=t+1;a<e;a++){var o=this.evaluate(3,n,i[a-t]).subtract(this.points[a]),o=o.x*o.x+o.y*o.y;s<=o&&(s=o,r=a)}return{error:s,index:r}}}),C=V.extend({_class:"TextItem",_applyMatrix:!1,_canApplyMatrix:!1,_serializeFields:{content:null},_boundsOptions:{handle:!1},initialize:function(t){this._content="",this._lines=[];var e=t&&D.isPlainObject(t)&&t.x===j&&t.y===j;this._initialize(e&&t,!e&&L.read(arguments))},_equals:function(t){return this._content===t._content},copyContent:function(t){this.setContent(t._content)},getContent:function(){return this._content},setContent:function(t){this._content=""+t,this._lines=this._content.split(/\r\n|\n|\r/gm),this._changed(521)},isEmpty:function(){return!this._content},getCharacterStyle:"#getStyle",setCharacterStyle:"#setStyle",getParagraphStyle:"#getStyle",setParagraphStyle:"#setStyle"}),I=C.extend({_class:"PointText",initialize:function(){C.apply(this,arguments)},getPoint:function(){var t=this._matrix.getTranslation();return new c(t.x,t.y,this,"setPoint")},setPoint:function(){var t=L.read(arguments);this.translate(t.subtract(this._matrix.getTranslation()))},_draw:function(t,e,n){if(e.dontFinish||e.clip){var i=this.getInternalBounds();e.dontStart||t.beginPath(),t.rect(i.x,i.y,i.width,i.height)}else if(this._content){this._setStyles(t,e,n);var r,s=this._lines,e=this._style,a=e.hasFill(),o=e.hasStroke(),h=e.getLeading(),u=t.shadowColor;o&&!e.getStrokeScaling()&&(r=n._getMeanScale(),t.lineWidth/=r,"setLineDash"in t&&(t.setLineDash(t.getLineDash().map(function(t){return t/r})),t.lineDashOffset/=r)),t.font=e.getFontStyle(),t.textAlign=e.getJustification(),t.letterSpacing=e.getTrackingStyle();for(var l=0,c=s.length;l<c;l++){t.shadowColor=u;var d=s[l];a&&(t.fillText(d,0,0),t.shadowColor="rgba(0,0,0,0)"),o&&t.strokeText(d,0,0),t.translate(0,h)}}},_getBounds:function(t,e){var n=this._style,i=this._lines,r=i.length,s=n.getJustification(),a=n.getLeading(),o=this.getView().getTextWidth(n.getFontStyle(),i,n.getTrackingStyle()),i=0;"left"!==s&&(i-=o/("center"===s?2:1));a=new b(i,r?-.75*a:0,o,r*a);return e.stroke&&n.hasStroke()&&(a=a.expand(n.getStrokeWidth())),t?t._transformBounds(a,a):a},_hitTestSelf:function(t,e){if(e.fill&&this.getFillColor()){var n=this.getInternalBounds(),n=t.clamp(n.getTopLeft(!0),n.getBottomRight(!0));if(t.subtract(n).divide(e._tolerancePadding).getLength()<=1)return new O("fill",this)}}}),M=D.extend(new function(){var v,m={gray:["gray"],rgb:["red","green","blue"],hsb:["hue","saturation","brightness"],hsl:["hue","saturation","lightness"],gradient:["gradient","origin","destination","highlight"]},y={},w={transparent:[0,0,0,0]};var r=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],n={"rgb-hsb":function(t,e,n){var i=Math.max(t,e,n),r=i-Math.min(t,e,n);return[0==r?0:60*(i==t?(e-n)/r+(e<n?6:0):i==e?(n-t)/r+2:(t-e)/r+4),0===i?0:r/i,i]},"hsb-rgb":function(t,e,n){t=(t/60%6+6)%6;var i=Math.floor(t),t=t-i,t=[n,n*(1-e),n*(1-e*t),n*(1-e*(1-t))];return[t[(i=r[i])[0]],t[i[1]],t[i[2]]]},"rgb-hsl":function(t,e,n){var i=Math.max(t,e,n),r=Math.min(t,e,n),s=i-r,a=0==s,o=(i+r)/2;return[a?0:60*(i==t?(e-n)/s+(e<n?6:0):i==e?(n-t)/s+2:(t-e)/s+4),a?0:o<.5?s/(i+r):s/(2-i-r),o]},"hsl-rgb":function(t,e,n){if(0===e)return[n,n,n];for(var i=[(t=(t/360%1+1)%1)+1/3,t,t-1/3],r=n<.5?n*(1+e):n+e-n*e,s=2*n-r,a=[],o=0;o<3;o++){var h=i[o];h<0&&(h+=1),1<h&&--h,a[o]=6*h<1?s+6*(r-s)*h:2*h<1?r:3*h<2?s+(r-s)*(2/3-h)*6:s}return a},"rgb-gray":function(t,e,n){return[.2989*t+.587*e+.114*n]},"gray-rgb":function(t){return[t,t,t]},"gray-hsb":function(t){return[0,0,t]},"gray-hsl":function(t){return[0,0,t]},"gradient-rgb":function(){return[]},"rgb-gradient":function(){return[]}};return D.each(m,function(t,s){y[s]=[],D.each(t,function(t,e){var n=D.capitalize(t),i=/^(hue|saturation)$/.test(t),r=y[s][e]="gradient"===s?"gradient"===t?function(t){var e=this._components[0];return e!==(t=P.read(Array.isArray(t)?t:arguments,0,{readNull:!0}))&&(e&&e._removeOwner(this),t&&t._addOwner(this)),t}:function(){return L.read(arguments,0,{readNull:"highlight"===t,clone:!0})}:function(t){return null==t||isNaN(t)?0:+t};this["get"+n]=function(){return(this._type===s||i&&/^hs[bl]$/.test(this._type)?this._components:this._convert(s))[e]},this["set"+n]=function(t){this._type===s||i&&/^hs[bl]$/.test(this._type)||(this._components=this._convert(s),this._properties=m[s],this._type=s),this._components[e]=r.call(this,t),this._changed()}},this)},{_class:"Color",_readIndex:!0,initialize:function t(e){var n,i,r=arguments,s=this.__read,a=0,o=null!=(e=Array.isArray(e)?(r=e)[0]:e)&&typeof e;if("string"===o&&e in m&&(h=e,e=r[1],Array.isArray(e)?(n=e,l=r[2]):(s&&(a=1),r=D.slice(r,1),o=typeof e)),!n){if(i="number"===o?r:"object"===o&&null!=e.length?e:null){var h=h||(3<=i.length?"rgb":"gray"),u=m[h].length,l=i[u];s&&(a+=i===arguments?u+(null!=l?1:0):1),i.length>u&&(i=D.slice(i,0,u))}else if("string"===o){u=function(t){var e=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i)||t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i),n="rgb";if(e)for(var i=e[4]?4:3,r=new Array(i),s=0;s<i;s++){var a=e[s+1];r[s]=parseInt(1==a.length?a+a:a,16)/255}else if(e=t.match(/^(rgb|hsl)a?\((.*)\)$/)){n=e[1],r=e[2].trim().split(/[,\s]+/g);for(var o="hsl"===n,s=0,h=Math.min(r.length,4);s<h;s++){var u,l=r[s],a=parseFloat(l);o?0===s?(u=l.match(/([a-z]*)$/)[1],a*={turn:360,rad:180/Math.PI,grad:.9}[u]||1):s<3&&(a/=100):s<3&&(a/=/%$/.test(l)?100:255),r[s]=a}}else{var c,d=w[t];d||(v||(v=_t.getContext(1,1,{willReadFrequently:!0}))&&(v.globalCompositeOperation="copy"),d=v?(v.fillStyle="rgba(0,0,0,0)",v.fillStyle=t,v.fillRect(0,0,1,1),c=v.getImageData(0,0,1,1).data,w[t]=[c[0]/255,c[1]/255,c[2]/255]):[0,0,0]),r=d.slice()}return[n,r]}(e);h=u[0],4===(n=u[1]).length&&(l=n[3],n.length--)}else if("object"===o)if(e.constructor===t){if(h=e._type,n=e._components.slice(),l=e._alpha,"gradient"===h)for(var c=1,d=n.length;c<d;c++){var f=n[c];f&&(n[c]=f.clone())}}else if(e.constructor===P)h="gradient",i=r;else{h="hue"in e?"lightness"in e?"hsl":"hsb":"gradient"in e||"stops"in e||"radial"in e?"gradient":"gray"in e?"gray":"rgb";var _=m[h],g=y[h];this._components=n=[];for(c=0,d=_.length;c<d;c++)null==(p=e[_[c]])&&!c&&"gradient"===h&&"stops"in e&&(p={stops:e.stops,radial:e.radial}),null!=(p=g[c].call(this,p))&&(n[c]=p);l=e.alpha}s&&h&&(a=1)}if(this._type=h||"rgb",!n){this._components=n=[];for(var p,c=0,d=(g=y[this._type]).length;c<d;c++)null!=(p=g[c].call(this,i&&i[c]))&&(n[c]=p)}return this._components=n,this._properties=m[this._type],this._alpha=l,s&&(this.__read=a),this},set:"#initialize",_serialize:function(t,e){var n=this.getComponents();return D.serialize(/^(gray|rgb)$/.test(this._type)?n:[this._type].concat(n),t,!0,e)},_changed:function(){this._canvasStyle=null,this._owner&&(this._setter?this._owner[this._setter](this):this._owner._changed(129))},_convert:function(t){var e;return this._type===t?this._components.slice():(e=n[this._type+"-"+t])?e.apply(this,this._components):n["rgb-"+t].apply(this,n[this._type+"-rgb"].apply(this,this._components))},convert:function(t){return new M(t,this._convert(t),this._alpha)},getType:function(){return this._type},setType:function(t){this._components=this._convert(t),this._properties=m[t],this._type=t},getComponents:function(){var t=this._components.slice();return null!=this._alpha&&t.push(this._alpha),t},getAlpha:function(){return null!=this._alpha?this._alpha:1},setAlpha:function(t){this._alpha=null==t?null:Math.min(Math.max(t,0),1),this._changed()},hasAlpha:function(){return null!=this._alpha},equals:function(t){var e=D.isPlainValue(t,!0)?M.read(arguments):t;return e===this||e&&this._class===e._class&&this._type===e._type&&this.getAlpha()===e.getAlpha()&&D.equals(this._components,e._components)||!1},toString:function(){for(var t=this._properties,e=[],n="gradient"===this._type,i=x.instance,r=0,s=t.length;r<s;r++){var a=this._components[r];null!=a&&e.push(t[r]+": "+(n?a:i.number(a)))}return null!=this._alpha&&e.push("alpha: "+i.number(this._alpha)),"{ "+e.join(", ")+" }"},toCSS:function(t){var e=this._convert("rgb"),n=t||null==this._alpha?1:this._alpha;function i(t){return Math.round(255*(t<0?0:1<t?1:t))}return e=[i(e[0]),i(e[1]),i(e[2])],n<1&&e.push(n<0?0:n),t?"#"+((1<<24)+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1):(4==e.length?"rgba(":"rgb(")+e.join(",")+")"},toCanvasStyle:function(t,e,n){var i=!("gradient"===this._type&&n);if(this._canvasStyle&&i)return this._canvasStyle;if("gradient"!==this._type)return this._canvasStyle=this.toCSS();var r,s=this._components,a=s[0],o=a._stops,h=s[1],u=s[2],s=s[3],e=e&&e.inverted();e&&(h=e._transformPoint(h),u=e._transformPoint(u),s=s&&e._transformPoint(s)),n&&(h=n._transformPoint(h),u=n._transformPoint(u),s=s&&n._transformPoint(s)),r=a._radial?(n=u.getDistance(h),!s||(a=s.subtract(h)).getLength()>n&&(s=h.add(a.normalize(n-.1))),t.createRadialGradient((s=s||h).x,s.y,0,h.x,h.y,n)):t.createLinearGradient(h.x,h.y,u.x,u.y);for(var l=0,c=o.length;l<c;l++){var d=o[l],f=d._offset;r.addColorStop(null==f?l/(c-1):f,d._color.toCanvasStyle())}return i&&(this._canvasStyle=r),r},transform:function(t){if("gradient"===this._type){for(var e=this._components,n=1,i=e.length;n<i;n++){var r=e[n];t._transformPoint(r,r,!0)}this._changed()}},statics:{_types:m,random:function(){var t=Math.random;return new M(t(),t(),t())},_setOwner:function(t,e,n){return t&&!(t=t._owner&&e&&t._owner!==e?t.clone():t)._owner^!e&&(t._owner=e||null,t._setter=n||null),t}}})},new function(){return D.each({add:function(t,e){return t+e},subtract:function(t,e){return t-e},multiply:function(t,e){return t*e},divide:function(t,e){return t/e}},function(a,t){this[t]=function(t){t=M.read(arguments);for(var e=this._type,n=this._components,i=t._convert(e),r=0,s=n.length;r<s;r++)i[r]=a(n[r],i[r]);return new M(e,i,null!=this._alpha?a(this._alpha,t.getAlpha()):null)}},{})}),P=D.extend({_class:"Gradient",initialize:function(t,e){this._id=o.get(),t&&D.isPlainObject(t)&&(this.set(t),t=e=null),null==this._stops&&this.setStops(t||["white","black"]),null==this._radial&&this.setRadial("string"==typeof e&&"radial"===e||e||!1)},_serialize:function(t,e){return e.add(this,function(){return D.serialize([this._stops,this._radial],t,!0,e)})},_changed:function(){for(var t=0,e=this._owners&&this._owners.length;t<e;t++)this._owners[t]._changed()},_addOwner:function(t){this._owners||(this._owners=[]),this._owners.push(t)},_removeOwner:function(t){t=this._owners?this._owners.indexOf(t):-1;-1!=t&&(this._owners.splice(t,1),this._owners.length||(this._owners=j))},clone:function(){for(var t=[],e=0,n=this._stops.length;e<n;e++)t[e]=this._stops[e].clone();return new P(t,this._radial)},getStops:function(){return this._stops},setStops:function(t){if(t.length<2)throw new Error("Gradient stop list needs to contain at least two stops.");var e=this._stops;if(e)for(var n=0,i=e.length;n<i;n++)e[n]._owner=j;for(n=0,i=(e=this._stops=T.readList(t,0,{clone:!0})).length;n<i;n++)e[n]._owner=this;this._changed()},getRadial:function(){return this._radial},setRadial:function(t){this._radial=t,this._changed()},equals:function(t){if(t===this)return!0;if(t&&this._class===t._class){var e=this._stops,n=t._stops,i=e.length;if(i===n.length){for(var r=0;r<i;r++)if(!e[r].equals(n[r]))return!1;return!0}}return!1}}),T=D.extend({_class:"GradientStop",initialize:function(t,e){var n=t,i=e;"object"==typeof t&&e===j&&(Array.isArray(t)&&"number"!=typeof t[0]?(n=t[0],i=t[1]):("color"in t||"offset"in t||"rampPoint"in t)&&(n=t.color,i=t.offset||t.rampPoint||0)),this.setColor(n),this.setOffset(i)},clone:function(){return new T(this._color.clone(),this._offset)},_serialize:function(t,e){var n=this._color,i=this._offset;return D.serialize(null==i?[n]:[n,i],t,!0,e)},_changed:function(){this._owner&&this._owner._changed(129)},getOffset:function(){return this._offset},setOffset:function(t){this._offset=t,this._changed()},getRampPoint:"#getOffset",setRampPoint:"#setOffset",getColor:function(){return this._color},setColor:function(){M._setOwner(this._color,null),this._color=M._setOwner(M.read(arguments,0),this,"setColor"),this._changed()},equals:function(t){return t===this||t&&this._class===t._class&&this._color.equals(t._color)&&this._offset==t._offset||!1}}),E=D.extend(new function(){var i={fillColor:null,fillRule:"nonzero",strokeColor:null,strokeWidth:1,strokeCap:"butt",strokeJoin:"miter",strokeScaling:!0,miterLimit:10,dashOffset:0,dashArray:[],shadowColor:null,shadowBlur:0,shadowOffset:new L,selectedColor:null},r=D.set({},i,{fontFamily:"sans-serif",fontWeight:"normal",fontSize:12,leading:null,tracking:0,justification:"left"}),s=D.set({},r,{fillColor:new M}),n={strokeWidth:193,strokeCap:193,strokeJoin:193,strokeScaling:201,miterLimit:193,fontFamily:9,fontWeight:9,fontSize:9,font:9,leading:9,tracking:9,justification:9},a={beans:!0},f={_class:"Style",beans:!0,initialize:function(t,e,n){this._values={},this._owner=e,this._project=e&&e._project||n||Wt.project,this._defaults=!e||e instanceof v?r:e instanceof C?s:i,t&&this.set(t)}};return D.each(r,function(t,h){var u=/Color$/.test(h),l="shadowOffset"===h,e=D.capitalize(h),o=n[h],c="set"+e,d="get"+e;f[c]=function(t){var e,n=this._owner,i=n&&n._children,r=i&&0<i.length&&!(n instanceof G);if(r)for(var s=0,a=i.length;s<a;s++)i[s]._style[c](t);"selectedColor"!==h&&r||!(h in this._defaults)||(e=this._values[h])!==t&&(u&&(e&&e.constructor===M&&(M._setOwner(e,null),e._canvasStyle=null),t&&t.constructor===M&&(t=M._setOwner(t,n,r&&c))),this._values[h]=t,n&&n._changed(o||129))},f[d]=function(t){var e,n=this._owner,i=n&&n._children,r=i&&0<i.length&&!(n instanceof G);if(r&&!t)for(var s=0,a=i.length;s<a;s++){var o=i[s]._style[d]();if(s){if(!D.equals(e,o))return j}else e=o}else h in this._defaults&&((e=this._values[h])===j?(e=this._defaults[h])&&e.clone&&(e=e.clone()):!(t=u?M:l?L:null)||e&&e.constructor===t||(this._values[h]=e=t.read([e],0,{readNull:!0,clone:!0})));return e=e&&u?M._setOwner(e,n,r&&c):e},a[d]=function(t){return this._style[d](t)},a[c]=function(t){this._style[c](t)}}),D.each({Font:"FontFamily",WindingRule:"FillRule"},function(t,e){var n="get"+e,e="set"+e;f[n]=a[n]="#get"+t,f[e]=a[e]="#set"+t}),V.inject(a),f},{set:function(t){var e,n=t instanceof E,i=n?t._values:t;if(i)for(var r in i)r in this._defaults&&(e=i[r],this[r]=e&&n&&e.clone?e.clone():e)},equals:function(t){function e(t,e,n){var i,r=t._values,s=e._values,a=e._defaults;for(i in r){var o=r[i],h=s[i];if(!(n&&i in s||D.equals(o,h===j?a[i]:h)))return!1}return!0}return t===this||t&&this._class===t._class&&e(this,t)&&e(t,this,!0)||!1},_dispose:function(){var t=this.getFillColor();t&&(t._canvasStyle=null),(t=this.getStrokeColor())&&(t._canvasStyle=null),(t=this.getShadowColor())&&(t._canvasStyle=null)},hasFill:function(){var t=this.getFillColor();return!!t&&0<t.alpha},hasStroke:function(){var t=this.getStrokeColor();return!!t&&0<t.alpha&&0<this.getStrokeWidth()},hasShadow:function(){var t=this.getShadowColor();return!!t&&0<t.alpha&&(0<this.getShadowBlur()||!this.getShadowOffset().isZero())},getView:function(){return this._project._view},getFontStyle:function(){var t=this.getFontSize();return this.getFontWeight()+" "+t+(/[a-z]/i.test(t+"")?" ":"px ")+this.getFontFamily()},getTrackingStyle:function(){return this.getTracking()/1e3+"em"},getFont:"#getFontFamily",setFont:"#setFontFamily",getLeading:function t(){var e=t.base.call(this),n=this.getFontSize();return/pt|em|%|px/.test(n)&&(n=this.getView().getPixelSize(n)),null!=e?e:1.2*n}}),B=new function(){function r(t,e,n,i){for(var r=["","webkit","moz","Moz","ms","o"],s=e[0].toUpperCase()+e.substring(1),a=0;a<6;a++){var o=r[a],o=o?o+s:e;if(o in t){if(!n)return t[o];t[o]=i;break}}}return{getStyles:function(t){var e=t&&9!==t.nodeType?t.ownerDocument:t,e=e&&e.defaultView;return e&&e.getComputedStyle(t,"")},getBounds:function(t,e){var n,i=t.ownerDocument,r=i.body,s=i.documentElement;try{n=t.getBoundingClientRect()}catch(t){n={left:0,top:0,width:0,height:0}}var a=n.left-(s.clientLeft||r.clientLeft||0),t=n.top-(s.clientTop||r.clientTop||0);return e||(a+=(i=i.defaultView).pageXOffset||s.scrollLeft||r.scrollLeft,t+=i.pageYOffset||s.scrollTop||r.scrollTop),new b(a,t,n.width,n.height)},getViewportBounds:function(t){var e=t.ownerDocument,t=e.defaultView,e=e.documentElement;return new b(0,0,t.innerWidth||e.clientWidth,t.innerHeight||e.clientHeight)},getOffset:function(t,e){return B.getBounds(t,e).getPoint()},getSize:function(t){return B.getBounds(t,!0).getSize()},getInsets:function(t,e){var n=B.getStyles(t);function i(t){return parseFloat(n["padding"+t])+parseFloat(n["border"+t+"Width"])}return e?new z(i("Left"),i("Top")):new z(i("Left")+i("Right"),i("Top")+i("Bottom"))},isInvisible:function(t){return B.getSize(t).equals(new z(0,0))},isInView:function(t){return!B.isInvisible(t)&&B.getViewportBounds(t).intersects(B.getBounds(t,!0))},isInserted:function(t){return k.body.contains(t)},getPrefixed:function(t,e){return t&&r(t,e)},setPrefixed:function(t,e,n){if("object"==typeof e)for(var i in e)r(t,i,!0,e[i]);else r(t,e,!0,n)}}},F={add:function(t,e){if(t)for(var n in e)for(var i=e[n],r=n.split(/[\s,]+/g),s=0,a=r.length;s<a;s++){var o=r[s];t.addEventListener(o,i,t===k&&("touchstart"===o||"touchmove"===o)&&{passive:!1})}},remove:function(t,e){if(t)for(var n in e)for(var i=e[n],r=n.split(/[\s,]+/g),s=0,a=r.length;s<a;s++)t.removeEventListener(r[s],i,!1)},getPoint:function(t,i){function e(t){for(var e=0,n=t.length;e<n;e++)if(t[e].target===i)return t[e]}var n=t.targetTouches,r=t;return n&&(r=e(t.touches)||e(t.changedTouches)||(n.length?n:t.changedTouches)[0]),new L(r.pageX||r.clientX+k.documentElement.scrollLeft,r.pageY||r.clientY+k.documentElement.scrollTop)},getTarget:function(t){return t.target||t.srcElement},getRelatedTarget:function(t){return t.relatedTarget||t.toElement},getOffset:function(t,e){return e=e||F.getTarget(t),F.getPoint(t,e).subtract(B.getOffset(e))}};F.requestAnimationFrame=new function(){var i,r=B.getPrefixed(f,"requestAnimationFrame"),s=!1,a=[];function o(){var t=a;a=[];for(var e=0,n=t.length;e<n;e++)t[e]();(s=r&&a.length)?r(o):i&&!a.length&&(clearInterval(i),i=null)}return function(t){a.push(t),r?s||(r(o),s=!0):i=i||setInterval(o,1e3/60)}};var $,J,K,X,Y,Q,tt,et,nt,it,rt,st=D.extend(t,{_class:"View",initialize:function t(e,n){function i(t){return n[t]||parseInt(n.getAttribute(t),10)}function r(){var t=new z(n.offsetWidth,n.offsetHeight);return t.isNaN()||t.isZero()?new z(i("width"),i("height")):t.subtract(B.getInsets(n))}var s,a,o,h,u;f&&n?(this._id=n.getAttribute("id"),null==this._id&&n.setAttribute("id",this._id="paper-view-"+t._id++),F.add(n,this._viewEvents),B.setPrefixed(n.style,{userDrag:u="none",userSelect:u,touchCallout:u,contentZooming:u,tapHighlightColor:"rgba(0,0,0,0)"}),l.hasAttribute(n,"resize")&&F.add(f,(a=this)._windowEvents={resize:function(){a.setViewSize(r())}}),s=r(),l.hasAttribute(n,"stats")&&"undefined"!=typeof Stats&&(this._stats=new Stats,h=(o=this._stats.domElement).style,u=B.getOffset(n),h.position="absolute",h.left=u.x+"px",h.top=u.y+"px",k.body.appendChild(o))):(s=new z(n),n=null),this._project=e,this._scope=e._scope,this._element=n,this._pixelRatio||(this._pixelRatio=f&&f.devicePixelRatio||1),this._setElementSize(s.width,s.height),this._viewSize=s,t._views.push(this),((t._viewsById[this._id]=this)._matrix=new A)._owner=this,t._focused||(t._focused=this),this._frameItems={},this._frameItemCount=0,this._itemEvents={native:{},virtual:{}},this._autoUpdate=!Wt.agent.node,this._needsUpdate=!1},remove:function(){if(!this._project)return!1;st._focused===this&&(st._focused=null),st._views.splice(st._views.indexOf(this),1),delete st._viewsById[this._id];var t=this._project;return t._view===this&&(t._view=null),F.remove(this._element,this._viewEvents),F.remove(f,this._windowEvents),this._element=this._project=null,this.off("frame"),this._animate=!1,this._frameItems={},!0},_events:D.each(V._itemHandlers.concat(["onResize","onKeyDown","onKeyUp"]),function(t){this[t]={}},{onFrame:{install:function(){this.play()},uninstall:function(){this.pause()}}}),_animate:!1,_time:0,_count:0,getAutoUpdate:function(){return this._autoUpdate},setAutoUpdate:function(t){(this._autoUpdate=t)&&this.requestUpdate()},update:function(t){},draw:function(){this.update()},requestUpdate:function(){var e;this._requested||(e=this,F.requestAnimationFrame(function(){var t;e._requested=!1,e._animate&&(e.requestUpdate(),(t=e._element)&&(B.getPrefixed(k,"hidden")&&"true"!==l.getAttribute(t,"keepalive")||!B.isInView(t))||e._handleFrame()),e._autoUpdate&&e.update()}),this._requested=!0)},play:function(){this._animate=!0,this.requestUpdate()},pause:function(){this._animate=!1},_handleFrame:function(){Wt=this._scope;var t=Date.now()/1e3,e=this._last?t-this._last:0;this._last=t,this.emit("frame",new D({delta:e,time:this._time+=e,count:this._count++})),this._stats&&this._stats.update()},_animateItem:function(t,e){var n=this._frameItems;e?(n[t._id]={item:t,time:0,count:0},1==++this._frameItemCount&&this.on("frame",this._handleFrameItems)):(delete n[t._id],0==--this._frameItemCount&&this.off("frame",this._handleFrameItems))},_handleFrameItems:function(t){for(var e in this._frameItems){e=this._frameItems[e];e.item.emit("frame",new D(t,{time:e.time+=t.delta,count:e.count++}))}},_changed:function(){this._project._changed(4097),this._bounds=this._decomposed=j},getElement:function(){return this._element},getProject:function(){return this._project},getScope:function(){return this._scope},getPixelRatio:function(){return this._pixelRatio},getResolution:function(){return 72*this._pixelRatio},getViewSize:function(){var t=this._viewSize;return new n(t.width,t.height,this,"setViewSize")},setViewSize:function(){var t=z.read(arguments),e=t.subtract(this._viewSize);e.isZero()||(this._setElementSize(t.width,t.height),this._viewSize.set(t),this._changed(),this.emit("resize",{size:t,delta:e}),this._autoUpdate&&this.update())},_setElementSize:function(t,e){var n=this._element;n&&(n.width!==t&&(n.width=t),n.height!==e&&(n.height=e))},getBounds:function(){return this._bounds||(this._bounds=this._matrix.inverted()._transformBounds(new b(new L,this._viewSize))),this._bounds},getSize:function(){return this.getBounds().getSize()},isVisible:function(){return B.isInView(this._element)},isInserted:function(){return B.isInserted(this._element)},getPixelSize:function(t){var e,n,i=this._element;return i?(n=i.parentNode,(i=k.createElement("div")).style.fontSize=t,n.appendChild(i),e=parseFloat(B.getStyles(i).fontSize),n.removeChild(i)):e=parseFloat(t),e},getTextWidth:function(t,e){return 0}},D.each(["rotate","scale","shear","skew"],function(n){var i="rotate"===n;this[n]=function(){var t=arguments,e=(i?D:L).read(t),t=L.read(t,0,{readNull:!0});return this.transform((new A)[n](e,t||this.getCenter(!0)))}},{_decompose:function(){return this._decomposed||(this._decomposed=this._matrix.decompose())},translate:function(){var t=new A;return this.transform(t.translate.apply(t,arguments))},getCenter:function(){return this.getBounds().getCenter()},setCenter:function(){var t=L.read(arguments);this.translate(this.getCenter().subtract(t))},getZoom:function(){var t=this._decompose().scaling;return(Math.abs(t.x)+Math.abs(t.y))/2},setZoom:function(t){0<t&&isFinite(t)&&this.transform((new A).scale(t/this.getZoom(),this.getCenter()))},getRotation:function(){return this._decompose().rotation},setRotation:function(t){var e=this.getRotation();null!=e&&null!=t&&this._matrix.prepend((new A).rotate(t-e,this.projectToView(this.getCenter())))},getScaling:function(){var t=this._decompose().scaling;return new c(t.x,t.y,this,"setScaling")},setScaling:function(){var t=this.getScaling(),e=L.read(arguments,0,{clone:!0,readNull:!0});t&&e&&this.scale(e.x/t.x,e.y/t.y)},getMatrix:function(){return this._matrix},setMatrix:function(){var t=this._matrix;t.set.apply(t,arguments)},transform:function(t){this._matrix.append(t)},fitBounds:function(t,e){t=b.read(arguments),e=D.read(arguments);var n=this._matrix,i=this._viewSize,r=n._transformBounds(t),s=new L(n._a,n._c).getLength(),a=new L(n._b,n._d).getLength(),r=[i.width/r.width*s,i.height/r.height*a].filter(function(t){return 0<t&&isFinite(t)});this.setCenter(t.getCenter()),r.length&&(r=("cover"===e?Math.max:Math.min).apply(Math,r),n.prepend((new A).scale(new L(r/s,r/a),i.divide(2))))},scrollBy:function(){this.translate(L.read(arguments).negate())}}),{projectToView:function(){return this._matrix._transformPoint(L.read(arguments))},viewToProject:function(){return this._matrix._inverseTransform(L.read(arguments))},getEventPoint:function(t){var e=this._element,n=F.getOffset(t,e),i=B.getSize(e);return i.isZero()||(t=new z(e.offsetWidth,e.offsetHeight),n=n.multiply(t.divide(i)).subtract(B.getInsets(e,!0)).multiply(this.getViewSize().divide(t.subtract(B.getInsets(e))))),this.viewToProject(n)}},{statics:{_views:[],_viewsById:{},_id:0,create:function(t,e){return k&&"string"==typeof e&&(e=k.getElementById(e)),new(f?at:st)(t,e)}}},new function(){var i,r,_=!1,s=!1;function a(t){t=F.getTarget(t);return t.getAttribute&&st._viewsById[t.getAttribute("id")]}function o(){var t=st._focused;if(!t||!t.isVisible())for(var e=0,n=st._views.length;e<n;e++)if((t=st._views[e]).isVisible()){st._focused=r=t;break}}function h(t,e,n){t._handleMouseEvent("mousemove",e,n)}var t,e,n,u,l={};f&&((u=f.navigator).pointerEnabled||u.msPointerEnabled?(t="pointerdown MSPointerDown",e="pointermove MSPointerMove",n="pointerup pointercancel MSPointerUp MSPointerCancel"):(t="touchstart",e="touchmove",n="touchend touchcancel","ontouchstart"in f&&u.userAgent.match(/mobile|tablet|ip(ad|hone|od)|android|silk/i)||(t+=" mousedown",e+=" mousemove",n+=" mouseup")),u={mouseout:function(t){var e=st._focused,n=F.getRelatedTarget(t);!e||n&&"HTML"!==n.nodeName||h(e,t)},scroll:o},l[t]=function(t){var e=st._focused=a(t);_||(_=!0,e._handleMouseEvent("mousedown",t))},u[e]=function(t){var e,n=st._focused;s||((e=a(t))?n!==e&&(n&&h(n,t),i=i||n,n=st._focused=r=e):r&&r===n&&(i&&!i.isInserted()&&(i=null),n=st._focused=i,i=null,o())),n&&h(n,t)},u[t]=function(){s=!0},u[n]=function(t){var e=st._focused;e&&_&&e._handleMouseEvent("mouseup",t),s=_=!1},F.add(k,u),F.add(f,{load:o}));var g,p,v,m,y,w,x,b,S=!1,C=!1,c={doubleclick:"click",mousedrag:"mousemove"},I=!1;function M(t,i,e,r,s,a,n){var o,h=!1;for(;t&&t!==n&&!function t(e,n){if(e.responds(n)){if(o=o||new lt(n,r,s,i||e,a?s.subtract(a):null),e.emit(n,o)&&(S=!0,o.prevented&&(C=!0),o.stopped))return h=!0}else if(n=c[n])return t(e,n)}(t,e);)t=t._parent;return h}function P(t,e,n,i,r,s){return t._project.removeOn(n),C=S=!1,y&&M(y,null,n,i,r,s)||e&&e!==y&&!e.isDescendant(y)&&M(e,null,"mousedrag"===n?"mousemove":n,i,r,s,y)||M(t,y||e||t,n,i,r,s)}function d(t,e){return e.modifiers&&ut.modifiers.set(e.modifiers),{type:t,timeStamp:null!=e.timeStamp?e.timeStamp:Date.now(),button:e.button||0,cancelable:!0,defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0},stopPropagation:function(){}}}var T={mousedown:{mousedown:1,mouseup:1,mousedrag:1,click:1,doubleclick:1},mouseup:{mouseup:1,mousedrag:1,click:1,doubleclick:1},mousemove:{mousedrag:1,mousemove:1,mouseenter:1,mouseleave:1}};return{_viewEvents:l,dispatchMouseEvent:function(t,e,n){if(!/^mouse(down|move|up)$/.test(t))throw new Error("Unknown mouse event type: '"+t+"'.");n=d(t,n||{});return"mousedown"===t&&(st._focused=this,s=_=!0),this._handleMouseEvent(t,n,new L(e)),"mouseup"===t&&(s=_=!1),n.defaultPrevented},dispatchKeyEvent:function(t,e,n){if(!/^key(down|up)$/.test(t))throw new Error("Unknown key event type: '"+t+"'.");ut._handleKey("keydown"===t,e,(n=n||{}).character,d(t,n),this)},_handleMouseEvent:function(t,e,n){var i,r=this._itemEvents,s=r.native[t],a="mousemove"===t,o=this._scope.tool,h=this;e.shiftKey!==j&&ut.modifiers.set({shift:e.shiftKey,control:e.ctrlKey,alt:e.altKey,meta:e.metaKey}),a&&_&&(i="mousedrag",r.virtual[i]||h.responds(i)||o&&o.responds(i))&&(t="mousedrag"),n=n||this.getEventPoint(e);var u=F.getTarget(e),l=!(a&&!_&&u&&1===u.nodeType&&!u.contains(this._element))&&this.getBounds().contains(n),c=s&&l&&h._project.hitTest(n,{tolerance:0,fill:!0,stroke:!0}),d=c&&c.item||null,u=!1,c={};if(c[t.substr(5)]=!0,s&&d!==m&&(m&&M(m,null,"mouseleave",e,n),d&&M(d,null,"mouseenter",e,n),m=d),I^l&&(M(this,null,l?"mouseenter":"mouseleave",e,n),u=!0),!l&&!c.drag||n.equals(p)||(P(this,d,a?t:"mousemove",e,n,p),u=!0),I=l,c.down&&l||c.up&&g){if(P(this,d,t,e,n,g),c.down){l=Date.now();if(b=!b&&d===w&&l-x<300&&n.getDistance(g)<3,v=w=d,x=l,!C&&d){for(var f=d;f&&!f.responds("mousedrag");)f=f._parent;f&&(y=d)}g=n}else c.up&&(C||d!==v||P(this,d,b?"doubleclick":"click",e,n,g),v=y=null);u=!(I=!1)}p=n,u&&o&&(S=o._handleMouseEvent(t,e,n,c)||S),!1!==e.cancelable&&(S&&!c.move||c.down&&function(t){if(h.responds("mouseup")||o&&o.responds("mouseup"))return 1;for(var e=t;e;e=e._parent)for(var n in T.mouseup)if(e.responds(n))return 1}(d))&&e.preventDefault()},_handleKeyEvent:function(e,n,i,r){var s,a=this._scope,t=a.tool;function o(t){t.responds(e)&&(Wt=a,t.emit(e,s=s||new ht(e,n,i,r)))}o(this),t&&t.responds(e)&&o(t)},_countItemEvent:function(t,e){var n,i=this._itemEvents,r=i.native,i=i.virtual;for(n in T)r[n]=(r[n]||0)+(T[n][t]||0)*e;i[t]=(i[t]||0)+e},statics:{updateFocus:o,_resetState:function(){_=s=S=I=!1,i=r=g=p=v=m=y=w=x=b=null}}}}),at=st.extend({_class:"CanvasView",initialize:function(t,e){if(!(e instanceof f.HTMLCanvasElement)){var n=z.read(arguments,1);if(n.isZero())throw new Error("Cannot create CanvasView with the provided argument: "+D.slice(arguments,1));e=_t.getCanvas(n)}var i=this._context=e.getContext("2d");i.save(),this._pixelRatio=1,/^off|false$/.test(l.getAttribute(e,"hidpi"))||(n=f.devicePixelRatio||1,i=B.getPrefixed(i,"backingStorePixelRatio")||1,this._pixelRatio=n/i),st.call(this,t,e),this._needsUpdate=!0},remove:function t(){return this._context.restore(),t.base.call(this)},_setElementSize:function t(e,n){var i,r,s=this._pixelRatio,a=this._element;t.base.call(this,e*s,n*s),l.hasAttribute(a,"resize")||(i=a.style,r="border-box"===B.getStyles(a).boxSizing?B.getInsets(a):new z,i.width=e+r.width+"px",i.height=n+r.height+"px"),1!==s&&((r=this._context).restore(),r.save(),r.scale(s,s))},getContext:function(){return this._context},getPixelSize:function t(e){var n,i,r=Wt.agent;return r&&r.firefox?n=t.base.call(this,e):(r=(i=this._context).font,i.font=e+" serif",n=parseFloat(i.font),i.font=r),n},getTextWidth:function(t,e,n){var i=this._context,r=i.font,s=i.letterSpacing,a=0;i.font=t,i.letterSpacing=n;for(var o=0,h=e.length;o<h;o++)a=Math.max(a,i.measureText(e[o]).width);return i.font=r,i.letterSpacing=s,a},update:function(t){if(!this._needsUpdate&&!t)return!1;var e=this._project,n=this._context,t=this._viewSize;return n.clearRect(0,0,t.width+1,t.height+1),e&&e.draw(n,this._matrix,this._pixelRatio),!(this._needsUpdate=!1)}}),ot=D.extend({_class:"Event",initialize:function(t){this.event=t,this.type=t&&t.type},prevented:!1,stopped:!1,preventDefault:function(){this.prevented=!0,this.event.preventDefault()},stopPropagation:function(){this.stopped=!0,this.event.stopPropagation()},stop:function(){this.stopPropagation(),this.preventDefault()},getTimeStamp:function(){return this.event.timeStamp},getModifiers:function(){return ut.modifiers}}),ht=ot.extend({_class:"KeyEvent",initialize:function(t,e,n,i){this.type=t,this.event=e,this.key=n,this.character=i},toString:function(){return"{ type: '"+this.type+"', key: '"+this.key+"', character: '"+this.character+"', modifiers: "+this.getModifiers()+" }"}}),ut=new function(){var h,i,n={"\t":"tab"," ":"space","\xa0":"space","\b":"backspace","\x7f":"delete",Spacebar:"space",Del:"delete",Win:"meta",Esc:"escape"},r={tab:"\t",space:" ",enter:"\r"},u={},l={},c=new D({shift:!1,control:!1,alt:!1,meta:!1,capsLock:!1,space:!1}).inject({option:{get:function(){return this.alt}},command:{get:function(){var t=Wt&&Wt.agent;return t&&t.mac?this.meta:this.control}}});function s(t){var e=t.key||t.keyIdentifier,e=/^U\+/.test(e)?String.fromCharCode(parseInt(e.substr(2),16)):/^Arrow[A-Z]/.test(e)?e.substr(5):"Unidentified"===e||e===j?String.fromCharCode(t.keyCode):e;return n[e]||(1<e.length?D.hyphenate(e):e.toLowerCase())}function d(t,e,n,i,r){var s;if(r||(st.updateFocus(),(r=st._focused)&&!r.isVisible()&&(r=null)),null==n&&(n=t?1<e.length?"":e:l[e]||""),(u[e]=t)?l[e]=n:delete l[e],1<e.length&&(s=D.camelize(e))in c){c[s]=t;var a=Wt&&Wt.agent;if("meta"===s&&a&&a.mac)if(t)h={};else{for(var o in h)o in l&&d(!1,o,h[o],i,r);h=null}}else t&&h&&(h[e]=n);r&&r._handleKeyEvent(t?"keydown":"keyup",i,e,n)}return F.add(k,{keydown:function(t){var e=s(t);1<e.length||t.ctrlKey||t.altKey||t.metaKey?d(!0,e,r[e]||(1<e.length?"":e),t):i=e},keypress:function(t){var e,n;i&&(e=s(t),n=32<=(n=t.charCode)?String.fromCharCode(n):1<e.length?"":e,d(!0,e=e!==i?n.toLowerCase():e,n,t),i=null)},keyup:function(t){var e=s(t);e in l&&d(!1,e,l[e],t)}}),F.add(f,{blur:function(t){for(var e in l)d(!1,e,l[e],t)}}),{_handleKey:d,modifiers:c,isDown:function(t){return!!u[t]}}},lt=ot.extend({_class:"MouseEvent",initialize:function(t,e,n,i,r){this.type=t,this.event=e,this.point=n,this.target=i,this.delta=r},toString:function(){return"{ type: '"+this.type+"', point: "+this.point+", target: "+this.target+(this.delta?", delta: "+this.delta:"")+", modifiers: "+this.getModifiers()+" }"}}),ct=ot.extend({_class:"ToolEvent",_item:null,initialize:function(t,e,n){this.tool=t,this.type=e,this.event=n},_choosePoint:function(t,e){return t||(e?e.clone():null)},getPoint:function(){return this._choosePoint(this._point,this.tool._point)},setPoint:function(t){this._point=t},getLastPoint:function(){return this._choosePoint(this._lastPoint,this.tool._lastPoint)},setLastPoint:function(t){this._lastPoint=t},getDownPoint:function(){return this._choosePoint(this._downPoint,this.tool._downPoint)},setDownPoint:function(t){this._downPoint=t},getMiddlePoint:function(){return!this._middlePoint&&this.tool._lastPoint?this.tool._point.add(this.tool._lastPoint).divide(2):this._middlePoint},setMiddlePoint:function(t){this._middlePoint=t},getDelta:function(){return!this._delta&&this.tool._lastPoint?this.tool._point.subtract(this.tool._lastPoint):this._delta},setDelta:function(t){this._delta=t},getCount:function(){return this.tool[/^mouse(down|up)$/.test(this.type)?"_downCount":"_moveCount"]},setCount:function(t){this.tool[/^mouse(down|up)$/.test(this.type)?"_downCount":"_moveCount"]=t},getItem:function(){if(!this._item){var t=this.tool._scope.project.hitTest(this.getPoint());if(t){for(var e=t.item,n=e._parent;/^(Group|CompoundPath)$/.test(n._class);)n=(e=n)._parent;this._item=e}}return this._item},setItem:function(t){this._item=t},toString:function(){return"{ type: "+this.type+", point: "+this.getPoint()+", count: "+this.getCount()+", modifiers: "+this.getModifiers()+" }"}}),dt=(e.extend({_class:"Tool",_list:"tools",_reference:"tool",_events:["onMouseDown","onMouseUp","onMouseDrag","onMouseMove","onActivate","onDeactivate","onEditOptions","onKeyDown","onKeyUp"],initialize:function(t){e.call(this),this._moveCount=-1,this._downCount=-1,this.set(t)},getMinDistance:function(){return this._minDistance},setMinDistance:function(t){null!=(this._minDistance=t)&&null!=this._maxDistance&&t>this._maxDistance&&(this._maxDistance=t)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(t){this._maxDistance=t,null!=this._minDistance&&null!=t&&t<this._minDistance&&(this._minDistance=t)},getEventInterval:function(){return this._eventInterval},setEventInterval:function(t){this._eventInterval=t},getFixedDistance:function(){return this._minDistance==this._maxDistance?this._minDistance:null},setFixedDistance:function(t){this._minDistance=this._maxDistance=t},_handleMouseEvent:function(t,e,a,o){Wt=this._scope,o.drag&&!this.responds(t)&&(t="mousemove");var h=o.move||o.drag,n=this.responds(t),i=!1,u=this;function r(t,e){var n=a,i=h?u._point:u._downPoint||n;if(h){if(0<=u._moveCount&&n.equals(i))return;if(i&&(null!=t||null!=e)){var r=n.subtract(i),s=r.getLength();if(s<(t||0))return;e&&(n=i.add(r.normalize(Math.min(s,e))))}u._moveCount++}return u._point=n,u._lastPoint=i||n,o.down&&(u._moveCount=-1,u._downPoint=n,u._downCount++),1}function s(){n&&(i=u.emit(t,new ct(u,t,e))||i)}if(o.down)r(),s(),0<this._eventInterval&&(clearInterval(this._timer),this._timer=setInterval(function(){u.isActive()?(Wt=u._scope,u._lastPoint=u._point,u._moveCount++,u.responds("mousedrag")&&u.emit("mousedrag",new ct(u,"mousedrag",e))):clearInterval(u._timer)},this._eventInterval));else if(o.up)clearInterval(this._timer),r(null,this._maxDistance),s();else if(n)for(;r(this._minDistance,this._maxDistance);)s();return i}}),D.extend(t,{_class:"Tween",statics:{easings:new D({linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:2*(2-t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t},easeInSine:function(t){return 1-Math.cos(t*Math.PI/2)},easeOutSine:function(t){return Math.sin(t*Math.PI/2)},easeInOutSine:function(t){return(1-Math.cos(t*Math.PI))/2},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*t-10)},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t||1===t?t:t<.5?Math.pow(2,20*t-10)/2:1-Math.pow(2,10-20*t)/2},easeInCirc:function(t){return 1-Math.sqrt(1-t*t)},easeOutCirc:function(t){return Math.sqrt(1- --t*t)},easeInOutCirc:function(t){return t<.5?(1-Math.sqrt(1-4*t*t))/2:(1+Math.sqrt(1-4*--t*t))/2}})},initialize:function t(e,n,i,r,s,a){this.object=e;var o=typeof s,e="function"==o;this.type=e?o:"string"==o?s:"linear",this.easing=e?s:t.easings[this.type],this.duration=r,this.running=!1,this._then=null,this._startTime=null;r=n||i;this._keys=r?Object.keys(r):[],this._parsedKeys=this._parseKeys(this._keys),this._from=r&&this._getState(n),this._to=r&&this._getState(i),!1!==a&&this.start()},then:function(t){return this._then=t,this},start:function(){return this._startTime=null,this.running=!0,this},stop:function(){return this.running=!1,this},update:function(e){if(this.running){1<=e&&(this.running=!(e=1));function t(t){return"function"==typeof t?t(n,e):t}for(var n=this.easing(e),i=this._keys,r=0,s=i&&i.length;r<s;r++){var a=i[r],o=t(this._from[a]),h=t(this._to[a]),o=o&&h&&o.multiply&&h.multiply?h.subtract(o).multiply(n).add(o):(h-o)*n+o;this._setProperty(this._parsedKeys[a],o)}this.responds("update")&&this.emit("update",new D({progress:e,factor:n})),!this.running&&this._then&&this._then(this.object)}return this},_events:{onUpdate:{}},_handleFrame:function(t){var e=this._startTime,n=e?(t-e)/this.duration:0;e||(this._startTime=t),this.update(n)},_getState:function(t){for(var e=this._keys,n={},i=0,r=e.length;i<r;i++){var s,a=e[i],o=this._parsedKeys[a],h=this._getProperty(o);t?(s=this._resolveValue(h,t[a]),this._setProperty(o,s),s=(s=this._getProperty(o))&&s.clone?s.clone():s,this._setProperty(o,h)):s=h&&h.clone?h.clone():h,n[a]=s}return n},_resolveValue:function(t,e){if(e){if(Array.isArray(e)&&2===e.length){var n=e[0];return n&&n.match&&n.match(/^[+\-\*\/]=/)?this._calculate(t,n[0],e[1]):e}if("string"==typeof e){n=e.match(/^[+\-*/]=(.*)/);if(n){n=JSON.parse(n[1].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,'"$2": '));return this._calculate(t,e[0],n)}}}return e},_calculate:function(t,e,n){var i={"+":"add","-":"subtract","*":"multiply","/":"divide"}[e];if(t&&t[i])return t[i](n);switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n}},_parseKeys:function(t){for(var e={},n=0,i=t.length;n<i;n++){var r=t[n],s=r.replace(/\.([^.]*)/g,"/$1").replace(/\[['"]?([^'"\]]*)['"]?\]/g,"/$1");e[r]=s.split("/")}return e},_getProperty:function(t,e){for(var n=this.object,i=0,r=t.length-(e||0);i<r&&n;i++)n=n[t[i]];return n},_setProperty:function(t,e){var n=this._getProperty(t,1);n&&(n[t[t.length-1]]=e)}})),ft=function(n){var i=new u.XMLHttpRequest;return i.open((n.method||"get").toUpperCase(),n.url,D.pick(n.async,!0)),n.mimeType&&i.overrideMimeType(n.mimeType),i.onload=function(){var t=i.status;0===t||200===t?n.onLoad&&n.onLoad.call(i,i.responseText):i.onerror()},i.onerror=function(){var t=i.status,e='Could not load "'+n.url+'" (Status: '+t+")";if(!n.onError)throw new Error(e);n.onError(e,t)},i.send(null)},_t=D.exports.CanvasProvider={canvases:[],getCanvas:function(t,e,n){if(!f&&!u.OffscreenCanvas)return null;var i,r=!0;"object"==typeof t&&(e=t.height,t=t.width),this.canvases.length?i=this.canvases.pop():(i=f?k.createElement("canvas"):new u.OffscreenCanvas(t,e),r=!1);n=i.getContext("2d",n||{});if(!n)throw new Error("Canvas "+i+" is unable to provide a 2D context.");return i.width===t&&i.height===e?r&&n.clearRect(0,0,t+1,e+1):(i.width=t,i.height=e),n.save(),i},getContext:function(t,e,n){e=this.getCanvas(t,e,n);return e?e.getContext("2d",n||{}):null},release:function(t){t=t&&t.canvas?t.canvas:t;t&&t.getContext&&(t.width=t.height=0,this.canvases.length<8&&this.canvases.push(t))}},gt=new function(){var _,g,p,v,m,y,w,x,b,S,C,a=Math.min,o=Math.max,t=Math.abs;function h(t,e,n){return.2989*t+.587*e+.114*n}function e(t,e,n,i){var r,s=i-h(t,e,n),i=h(b=t+s,S=e+s,C=n+s),n=a(b,S,C),s=o(b,S,C);n<0&&(b=i+(b-i)*i/(r=i-n),S=i+(S-i)*i/r,C=i+(C-i)*i/r),255<s&&(b=i+(b-i)*(r=255-i)/(s=s-i),S=i+(S-i)*r/s,C=i+(C-i)*r/s)}function n(t,e,n){return o(t,e,n)-a(t,e,n)}function i(t,e,n,i){var r=[t,e,n],s=o(t,e,n),n=a(t,e,n),e=0===a(n=n===t?0:n===e?1:2,s=s===t?0:s===e?1:2)?1===o(n,s)?2:1:0;r[s]>r[n]?(r[e]=(r[e]-r[n])*i/(r[s]-r[n]),r[s]=i):r[e]=r[s]=0,r[n]=0,b=r[0],S=r[1],C=r[2]}var I={multiply:function(){b=m*_/255,S=y*g/255,C=w*p/255},screen:function(){b=m+_-m*_/255,S=y+g-y*g/255,C=w+p-w*p/255},overlay:function(){b=m<128?2*m*_/255:255-2*(255-m)*(255-_)/255,S=y<128?2*y*g/255:255-2*(255-y)*(255-g)/255,C=w<128?2*w*p/255:255-2*(255-w)*(255-p)/255},"soft-light":function(){var t=_*m/255;b=t+m*(255-(255-m)*(255-_)/255-t)/255,S=(t=g*y/255)+y*(255-(255-y)*(255-g)/255-t)/255,C=(t=p*w/255)+w*(255-(255-w)*(255-p)/255-t)/255},"hard-light":function(){b=_<128?2*_*m/255:255-2*(255-_)*(255-m)/255,S=g<128?2*g*y/255:255-2*(255-g)*(255-y)/255,C=p<128?2*p*w/255:255-2*(255-p)*(255-w)/255},"color-dodge":function(){b=0===m?0:255===_?255:a(255,255*m/(255-_)),S=0===y?0:255===g?255:a(255,255*y/(255-g)),C=0===w?0:255===p?255:a(255,255*w/(255-p))},"color-burn":function(){b=255===m?255:0===_?0:o(0,255-255*(255-m)/_),S=255===y?255:0===g?0:o(0,255-255*(255-y)/g),C=255===w?255:0===p?0:o(0,255-255*(255-w)/p)},darken:function(){b=m<_?m:_,S=y<g?y:g,C=w<p?w:p},lighten:function(){b=_<m?m:_,S=g<y?y:g,C=p<w?w:p},difference:function(){(b=m-_)<0&&(b=-b),(S=y-g)<0&&(S=-S),(C=w-p)<0&&(C=-C)},exclusion:function(){b=m+_*(255-m-m)/255,S=y+g*(255-y-y)/255,C=w+p*(255-w-w)/255},hue:function(){i(_,g,p,n(m,y,w)),e(b,S,C,h(m,y,w))},saturation:function(){i(m,y,w,n(_,g,p)),e(b,S,C,h(m,y,w))},luminosity:function(){e(m,y,w,h(_,g,p))},color:function(){e(_,g,p,h(m,y,w))},add:function(){b=a(m+_,255),S=a(y+g,255),C=a(w+p,255)},subtract:function(){b=o(m-_,0),S=o(y-g,0),C=o(w-p,0)},average:function(){b=(m+_)/2,S=(y+g)/2,C=(w+p)/2},"pin-light":function(){b=_<128?a(m,2*_):o(m,2*_-255),S=g<128?a(y,2*g):o(y,2*g-255),C=p<128?a(w,2*p):o(w,2*p-255)},negation:function(){b=255-t(255-_-m),S=255-t(255-g-y),C=255-t(255-p-w)}},M=this.nativeModes=D.each(["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","lighter","darker","copy","xor"],function(t){this[t]=!0},{}),r=_t.getContext(1,1,{willReadFrequently:!0});r&&(D.each(I,function(t,e){var n="darken"===e,i=!1;r.save();try{r.fillStyle=n?"#300":"#a00",r.fillRect(0,0,1,1),r.globalCompositeOperation=e,r.globalCompositeOperation===e&&(r.fillStyle=n?"#a00":"#300",r.fillRect(0,0,1,1),i=r.getImageData(0,0,1,1).data[0]!==n?170:51)}catch(t){}r.restore(),M[e]=i}),_t.release(r)),this.process=function(t,e,n,i,r){var s=e.canvas,a="normal"===t;if(a||M[t])n.save(),n.setTransform(1,0,0,1,0,0),n.globalAlpha=i,a||(n.globalCompositeOperation=t),n.drawImage(s,r.x,r.y),n.restore();else{var o=I[t];if(o){for(var t=n.getImageData(r.x,r.y,s.width,s.height),h=t.data,u=e.getImageData(0,0,s.width,s.height).data,l=0,c=h.length;l<c;l+=4){_=u[l],m=h[l],g=u[l+1],y=h[l+1],p=u[l+2],w=h[l+2],v=u[l+3],x=h[l+3],o();var d=v*i/255,f=1-d;h[l]=d*b+f*m,h[l+1]=d*S+f*y,h[l+2]=d*C+f*w,h[l+3]=v*i+f*x}n.putImageData(t,r.x,r.y)}}}},pt=new function(){var i="http://www.w3.org/2000/svg",t="http://www.w3.org/2000/xmlns",e="http://www.w3.org/1999/xlink",a={href:e,xlink:t,xmlns:t+"/","xmlns:xlink":t+"/"};function r(t,e,n){for(var i in e){var r=e[i],s=a[i];"number"==typeof r&&n&&(r=n.number(r)),s?t.setAttributeNS(s,i,r):t.setAttribute(i,r)}return t}return{svg:i,xmlns:t,xlink:e,create:function(t,e,n){return r(k.createElementNS(i,t),e,n)},get:function(t,e){var n=a[e];return"null"===(e=n?t.getAttribute(e)||t.getAttributeNS(n,e):t.getAttribute(e))?null:e},set:r}},vt=D.each({fillColor:["fill","color"],fillRule:["fill-rule","string"],strokeColor:["stroke","color"],strokeWidth:["stroke-width","number"],strokeCap:["stroke-linecap","string"],strokeJoin:["stroke-linejoin","string"],strokeScaling:["vector-effect","lookup",{true:"none",false:"non-scaling-stroke"},function(t,e){return!e&&(t instanceof y||t instanceof g||t instanceof C)}],miterLimit:["stroke-miterlimit","number"],dashArray:["stroke-dasharray","array"],dashOffset:["stroke-dashoffset","number"],fontFamily:["font-family","string"],fontWeight:["font-weight","font"],fontSize:["font-size","number"],tracking:["letter-spacing","tracking"],justification:["text-anchor","lookup",{left:"start",center:"middle",right:"end"}],opacity:["opacity","number"],blendMode:["mix-blend-mode","style"]},function(t,e){var n=D.capitalize(e),i=t[2];this[e]={type:t[1],property:e,attribute:t[0],toSVG:i,fromSVG:i&&D.each(i,function(t,e){this[t]=e},{}),exportFilter:t[3],get:"get"+n,set:"set"+n}},{});function mt(t,e,n){var i,r,s=new D,a=t.getTranslation();return e&&(t.isInvertible()?(i=(t=t._shiftless())._inverseTransform(a),a=null):i=new L,s[n?"cx":"x"]=i.x,s[n?"cy":"y"]=i.y),t.isIdentity()||((r=t.decompose())?(e=[],n=r.rotation,i=r.scaling,r=r.skewing,a&&!a.isZero()&&e.push("translate("+$.point(a)+")"),n&&e.push("rotate("+$.number(n)+")"),q.isZero(i.x-1)&&q.isZero(i.y-1)||e.push("scale("+$.point(i)+")"),r.x&&e.push("skewX("+$.number(r.x)+")"),r.y&&e.push("skewY("+$.number(r.y)+")"),s.transform=e.join(" ")):s.transform="matrix("+t.getValues().join(",")+")"),s}function yt(t,e){for(var n=mt(t._matrix),i=t._children,r=pt.create("g",n,$),s=0,a=i.length;s<a;s++){var o,h=i[s];h.isClipMask()?(St(h,o=function(t,s){var a=pt.create("clipPath");t instanceof v&&(t=t.clone({insert:!1})).matrix.apply(!0,!0);return function t(e){if(e instanceof v)for(var n=e._children,i=0,r=n.length;i<r;i++)n[i]._clipMask||t(n[i]);else(e=Mt(e,s))&&a.appendChild(e)}(t),a}(h,e),"clip",e),pt.set(r,{"clip-path":"url(#"+o.id+")"})):(h=Mt(h,e))&&r.appendChild(h)}return r}function wt(t){var e,n=t._type,i=t._radius,r=mt(t._matrix,!0,"rectangle"!==n);return"rectangle"===n&&(n="rect",t=(e=t._size).width,e=e.height,r.x-=t/2,r.y-=e/2,r.width=t,r.height=e,i.isZero()&&(i=null)),i&&("circle"===n?r.r=i:(r.rx=i.width,r.ry=i.height)),pt.create(n,r,$)}function xt(s,t,a,e){var o={},h=!e&&s.getParent(),u=h&&(J[h._id]=J[h._id]||{}),l=[];return null!=s._name&&(o.id=s._name),D.each(vt,function(t){var e,n=t.get,i=t.type,r=s[n]();!h||n in u||(u[n]=h[n]()),r===j||(t.exportFilter?!t.exportFilter(s,r):0!=a.reduceAttributes&&h&&D.equals(u[n],r))||("color"!==i||null==r||(e=r.getAlpha())<1&&(o[t.attribute+"-opacity"]=e),"style"===i?Y[r]?l.push(t.attribute+": "+r):o["data-paper-blend-mode"]=r:"font"===i?(e=(""+r).match(/^(.*?)\s*\b(italic|oblique)\b\s*(.*)$/i),o[t.attribute]=e?(e[1]+" "+e[3]).trim()||"normal":r,e&&(o["font-style"]=e[2].toLowerCase())):o[t.attribute]=null==r?"none":"color"===i?r.gradient?function(t,e){if(!(h=bt(t,"color"))){var n,i,r=t.getGradient(),s=r._radial,a=t.getOrigin(),o=t.getDestination();s?(n={cx:a.x,cy:a.y,r:a.getDistance(o)},(i=t.getHighlight())&&(n.fx=i.x,n.fy=i.y)):n={x1:a.x,y1:a.y,x2:o.x,y2:o.y},n.gradientUnits="userSpaceOnUse";for(var h=pt.create((s?"radial":"linear")+"Gradient",n,$),u=r._stops,l=0,c=u.length;l<c;l++){var d=u[l],f=d._color,_=f.getAlpha(),d=d._offset;n={offset:null==d?l/(c-1):d},f&&(n["stop-color"]=f.toCSS(!0)),_<1&&(n["stop-opacity"]=_),h.appendChild(pt.create("stop",n,$))}St(t,h,"color",e)}return"url(#"+h.id+")"}(r,a):r.toCSS(!0):"array"===i?r.join(","):"lookup"===i?t.toSVG[r]:"tracking"===i?r&&r/1e3+"em":r)}),l.length&&(o.style=l.join(";")),1===o.opacity&&delete o.opacity,s._visible||(o.visibility="hidden"),pt.set(t,o,$)}function bt(t,e){return K=K||{ids:{},svgs:{}},t&&K.svgs[Ct(t,e)]}function St(t,e,n,i){K||bt();var r=K.ids[n]=(K.ids[n]||0)+1;e.id=(i.idPrefix||"")+n+"-"+r,K.svgs[Ct(t,n)]=e}function Ct(t,e){return e+"-"+("string"==typeof t?t:t._id||t.__id||(t.__id=o.get("svg")))}function It(t,e){var n=t,i=null;if(K){for(var r in n="svg"===t.nodeName.toLowerCase()&&t,K.svgs)i||(n||(n=pt.create("svg")).appendChild(t),i=n.insertBefore(pt.create("defs"),n.firstChild)),i.appendChild(K.svgs[r]);K=null}return J=null,e.asString?(new u.XMLSerializer).serializeToString(n):n}function Mt(t,e,n){var i=X[t._class],r=i&&i(t,e);return r&&((i=e.onExport)&&(r=i(t,r,e)||r),(i=JSON.stringify(t._data))&&"{}"!==i&&"null"!==i&&r.setAttribute("data-paper-data",i)),r&&xt(t,r,e,n)}function Pt(t){return $=new x((t=t||{}).precision),J={},t}function Tt(t){var e=/(in|pt|pc|cm|mm)\s*$/.exec(t);return parseFloat(t)*(e?et[e[1]]:1)}function kt(t,e,n,i,r,s){s=pt.get(t,e)||s,n=null==s?i?null:n?"":0:n?s:Tt(s);return/%\s*$/.test(s)?n/100*(r?1:Q[/x|^width/.test(e)?"width":"height"]):n}function Ot(t,e,n,i,r,s,a){return e=kt(t,e||"x",!1,i,r,s),n=kt(t,n||"y",!1,i,r,a),!i||null!=e&&null!=n?new L(e,n):null}function zt(t,e,n,i,r){return e=kt(t,e||"width",!1,i,r),n=kt(t,n||"height",!1,i,r),!i||null!=e&&null!=n?new z(e,n):null}function At(t,e,n,i){return"none"===t?null:"number"===e?Tt(t):"array"===e?t?t.split(/[\s,]+/g).map(Tt):[]:"color"===e?qt(t,i)||t:"lookup"===e?n[t]:t}function Lt(t,e,n,i){var r=t.childNodes,s="clippath"===e,a="defs"===e,o=new v,h=o._project,u=h._currentStyle,l=Q,c=[];if(s||a||(o=Dt(o,t,n,i),h._currentStyle=o._style.clone()),"svg"!==e||i||(Q=new z(kt(t,"width",!1,!1,!1,"100%"),kt(t,"height",!1,!1,!1,"100%"))),i)for(var d=t.querySelectorAll("defs"),f=0,_=d.length;f<_;f++)Ht(d[f],n,!1);for(f=0,_=r.length;f<_;f++){var g,p=r[f];1!==p.nodeType||/^defs$/i.test(p.nodeName)||!(g=Ht(p,n,!1))||g instanceof m||c.push(g)}return o.addChildren(c),s&&(o=Dt(o.reduce(),t,n,i)),h._currentStyle=u,Q=l,(s||a)&&(o.remove(),o=null),o}function Nt(t,e){for(var n=t.getAttribute("points").match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g),i=[],r=0,s=n.length;r<s;r+=2)i.push(new L(parseFloat(n[r]),parseFloat(n[r+1])));t=new U(i);return"polygon"===e&&t.closePath(),t}function Et(t,e,n){var i,r=Rt((kt(t,"href",!0)||"").substring(1),n),e="radialgradient"===e;if(r)(i=r.getGradient())._radial^e&&((i=i.clone())._radial=e);else{for(var s=t.childNodes,a=[],o=0,h=s.length;o<h;o++){var u=s[o];1===u.nodeType&&a.push(Dt(new T,u,n))}i=new P(a,e)}var l,c,d,r="userSpaceOnUse"!==kt(t,"gradientUnits",!0);return e?(c=(l=Ot(t,"cx","cy",!1,r,"50%","50%")).add(kt(t,"r",!1,!1,r,"50%"),0),d=Ot(t,"fx","fy",!0,r)):(l=Ot(t,"x1","y1",!1,r,"0%","0%"),c=Ot(t,"x2","y2",!1,r,"100%","0%")),Dt(new M(i,l,c,d),t,n)._scaleToBounds=r,null}function Bt(t,e,n,i){if(t.transform){for(var r=(i.getAttribute(n)||"").split(/\)\s*/g),s=new A,a=0,o=r.length;a<o;a++){var h=r[a];if(!h)break;for(var u=h.split(/\(\s*/),h=u[0].trim(),l=u[1].split(/[\s,]+/g),c=0,d=l.length;c<d;c++)l[c]=parseFloat(l[c]);switch(h){case"matrix":s.append(new A(l[0],l[1],l[2],l[3],l[4],l[5]));break;case"rotate":s.rotate(l[0],l[1]||0,l[2]||0);break;case"translate":s.translate(l[0],l[1]||0);break;case"scale":s.scale(l);break;case"skewX":s.skew(l[0],0);break;case"skewY":s.skew(0,l[0])}}t.transform(s)}}function Ft(t,e,n){n="fill-opacity"===n?"getFillColor":"getStrokeColor",n=t[n]&&t[n]();n&&n.setAlpha(parseFloat(e))}function jt(t,e,n){var i=D.camelize(e),r=t.style&&t.style[i];return r||!(r=(e=t.attributes[e])&&e.value)&&t.style&&n.node[i]!==n.parent[i]&&(r=n.node[i]),r?"none"===r?null:r:j}function Dt(i,r,s,t){var e=r.parentNode,a={node:B.getStyles(r)||{},parent:!t&&!/^defs$/i.test(e.tagName)&&B.getStyles(e)||{}};return t&&!a.node.fill&&i.setFillColor&&i.setFillColor("black"),D.each(rt,function(t,e){var n=jt(r,e,a);i=n!==j&&t(i,n,e,r,a,s)||i}),i}function Rt(t,e){var n;return!t||tt[t]||(n=Vt().ownerDocument.getElementById(t))&&Ht(n,e,!1),tt[t]}function qt(t,e){t=t&&t.match(/\((?:["'#]*)([^"')]+)/),t=t&&t[1],e=t&&Rt(f?t.replace(f.location.href.split("#")[0]+"#",""):t,e);return e&&e._scaleToBounds&&((e=e.clone())._scaleToBounds=!0),e}function Vt(){var t,e;return it&&it.contentDocument||((it=k.createElement("iframe")).setAttribute("sandbox","allow-same-origin"),it.style.cssText="position: absolute; visibility: hidden; width: 0; height: 0; border: 0",k.body.appendChild(it),(e=(t=it.contentDocument).createElement("meta")).httpEquiv="Content-Security-Policy",e.content="default-src 'none'; style-src 'unsafe-inline'",t.head.appendChild(e)),it.contentDocument.body}function Ht(t,e,n){var i,r,s,a=t.nodeName.toLowerCase(),o="#document"!==a;n&&o&&(Q=Wt.getView().getSize(),Q=zt(t,null,null,!0)||Q,i=pt.create("svg",{style:"stroke-width: 1px; stroke-miterlimit: 10"}),r=t.parentNode,s=t.nextSibling,i.appendChild(t),Vt().appendChild(i));var h,u,l,c=Wt.settings,d=c.applyMatrix,f=c.insertItems,_=nt[a];try{c.applyMatrix=!1,c.insertItems=!1;try{h=_&&_(t,a,e,n)||null}finally{c.insertItems=f,c.applyMatrix=d}h&&(o&&_!==Lt&&(h=Dt(h,t,e,n)),u=e.onImport,l=o&&t.getAttribute("data-paper-data"),u&&(h=u(t,h,e)||h),e.expandShapes&&h instanceof g&&(h.remove(),h=h.toPath()),l&&(h._data=JSON.parse(l)))}finally{i&&(i.parentNode.removeChild(i),r&&(s?r.insertBefore(t,s):r.appendChild(t))),n&&(tt={})}return n&&h&&D.pick(e.applyMatrix,d)&&h.matrix.apply(!0,!0),h}function Zt(i,r,s){if(!i)return null;r="function"==typeof r?{onLoad:r}:r||{};var a=Wt,o=null;function t(t){try{var e="object"==typeof t?t:(new u.DOMParser).parseFromString(t.trim(),"image/svg+xml");if(!e.nodeName)throw e=null,new Error("Unsupported SVG source: "+i);Wt=a,o=Ht(e,r,!0),r&&!1===r.insert||s._insertItem(j,o);var n=r.onLoad;n&&n(o,t)}catch(t){h(t)}}function h(t,e){var n=r.onError;if(!n)throw new Error(t);n(t,e)}if("string"!=typeof i||/^[\s\S]*</.test(i)){if("undefined"!=typeof File&&i instanceof File){var e=new FileReader;return e.onload=function(){t(e.result)},e.onerror=function(){h(e.error)},e.readAsText(i)}t(i)}else{var n=k.getElementById(i);n?t(n):ft({url:i,async:!0,onLoad:t,onError:h})}return o}X={Group:yt,Layer:yt,Raster:function(t,e){var n=mt(t._matrix,!0),i=t.getSize(),r=t.getImage(),r=0==e.embedImages&&r&&r.src||t.toDataURL();if(n.x-=i.width/2,n.y-=i.height/2,e.reuseImages){t=bt(r,"image");return t||St(r,t=pt.create("image",{width:i.width,height:i.height,href:r},$),"image",e),n.href="#"+t.id,pt.create("use",n,$)}return n.width=i.width,n.height=i.height,n.href=r,pt.create("image",n,$)},Path:function(t,e){var n=e.matchShapes;if(n){var i=t.toShape(!1);if(i)return wt(i)}var r=t._segments,s=r.length,a=mt(t._matrix);if(n&&2<=s&&!t.hasHandles())if(2<s){for(var o=t._closed?"polygon":"polyline",h=[],u=0;u<s;u++)h.push($.point(r[u]._point));a.points=h.join(" ")}else{o="line";i=r[0]._point,n=r[1]._point;a.set({x1:i.x,y1:i.y,x2:n.x,y2:n.y})}else o="path",a.d=t.getPathData(null,e.precision);return pt.create(o,a,$)},Shape:wt,CompoundPath:function(t,e){var n=mt(t._matrix);return(e=t.getPathData(null,e.precision))&&(n.d=e),pt.create("path",n,$)},SymbolItem:function(t,e){var n=mt(t._matrix,!0),i=t._definition,r=bt(i,"symbol"),s=i._item,t=s.getStrokeBounds();return r||((r=pt.create("symbol",{viewBox:$.rectangle(t)})).appendChild(Mt(s,e)),St(i,r,"symbol",e)),n.href="#"+r.id,n.x+=t.x,n.y+=t.y,n.width=t.width,n.height=t.height,n.overflow="visible",pt.create("use",n,$)},PointText:function(t){var e=mt(t._matrix,!0),n=pt.create("text",e,$),i=t._lines;if(1<i.length)for(var r=t._style.getLeading(),s=0,a=i.length;s<a;s++){var o=pt.create("tspan",{x:e.x,y:e.y+s*r},$);o.textContent=i[s],n.appendChild(o)}else n.textContent=t._content;return n}},Y=D.each(["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],function(t){this[t]=!0},{}),V.inject({exportSVG:function(t){return It(Mt(this,t=Pt(t),!0),t)}}),s.inject({exportSVG:function(t){t=Pt(t);var e=this._children,n=this.getView(),i=D.pick(t.bounds,"view"),r=t.matrix||"view"===i&&n._matrix,r=r&&A.read([r]),n="view"===i?new b([0,0],n.getViewSize()):"content"===i?V._getBounds(e,r,{stroke:!0}).rect:b.read([i],0,{readNull:!0}),i={version:"1.1",xmlns:pt.svg,"xmlns:xlink":pt.xlink};n&&(i.width=n.width,i.height=n.height,(n.x||0===n.x||n.y||0===n.y)&&(i.viewBox=$.rectangle(n)));var i=pt.create("svg",i,$),s=i;r&&!r.isIdentity()&&(s=i.appendChild(pt.create("g",mt(r),$)));for(var a=0,o=e.length;a<o;a++)s.appendChild(Mt(e[a],t,!0));return It(i,t)}}),tt={},et={in:96,pt:96/72,pc:16,cm:96/2.54,mm:96/25.4},nt={"#document":function(t,e,n,i){for(var r=t.childNodes,s=0,a=r.length;s<a;s++){var o=r[s];if(1===o.nodeType)return Ht(o,n,i)}},g:Lt,svg:Lt,clippath:Lt,polygon:Nt,polyline:Nt,path:function(t){return y.create(t.getAttribute("d"))},lineargradient:Et,radialgradient:Et,image:function(s,t,e){var e=new _({crossOrigin:e.crossOrigin,source:kt(s,"href",!0)}),a=/none|x(Min|Mid|Max)Y(Min|Mid|Max)/.exec(kt(s,"preserveAspectRatio",!0))||[null,"Mid","Mid"];return e.on("load",function(){var t,e,n=this.getSize(),i=zt(s,null,null,!0)||n,r=Ot(s);"none"!==a[0]&&(t={Min:0,Mid:.5,Max:1},e=n.multiply(Math.min(i.width/n.width,i.height/n.height)),r=r.add(i.subtract(e).multiply([t[a[1]],t[a[2]]])),i=e);r=r.add(i.divide(2));this._matrix.append((new A).translate(r).scale(i.divide(n)))}),e},symbol:function(t,e,n,i){return new m(Lt(t,e,n,i),!0)},defs:Lt,use:function(t,e,n){var i=(kt(t,"href",!0)||"").substring(1),r=Rt(i,n),t=Ot(t);return r?r instanceof m?r.place(t):(r instanceof _?Ht(Vt().ownerDocument.getElementById(i),n,!1):r.clone()).translate(t):null},circle:function(t){return new g.Circle(Ot(t,"cx","cy"),kt(t,"r"))},ellipse:function(t){return new g.Ellipse({center:Ot(t,"cx","cy"),radius:zt(t,"rx","ry")})},rect:function(t){var e=kt(t,"rx",!1,!0),n=kt(t,"ry",!1,!0);return new g.Rectangle(new b(Ot(t),zt(t)),new z(null==e?n||0:e,null==n?e||0:n))},line:function(t){return new U.Line(Ot(t,"x1","y1"),Ot(t,"x2","y2"))},text:function(t){var e=new I(Ot(t).add(Ot(t,"dx","dy"))),n=D.each(t.childNodes,function(t){/^tspan$/i.test(t.nodeName)&&t.hasAttribute("y")&&this.push(t.textContent.trim())},[]);return e.setContent(1<n.length?n.join("\n"):t.textContent.trim()),e},switch:Lt},rt=D.set(D.each(vt,function(a){this[a.attribute]=function(t,e,n,i,r,s){t[a.set]&&(t[a.set](At(e,a.type,a.fromSVG,s)),"color"!==a.type||(s=t[a.get]())&&s._scaleToBounds&&(t=t.getBounds(),s.transform((new A).translate(t.getPoint()).scale(t.getSize()))))}},{}),{id:function(t,e){(tt[e]=t).setName&&e!==+e+""&&t.setName(e)},"clip-path":function(t,e,n,i,r,s){s=qt(e,s);if(s){if((s=s.clone()).setClipMask(!0),!(t instanceof v))return new v(s,t);t.insertChild(0,s)}},gradientTransform:Bt,transform:Bt,"fill-opacity":Ft,"stroke-opacity":Ft,visibility:function(t,e){t.setVisible&&t.setVisible("visible"===e)},display:function(t,e){t.setVisible&&t.setVisible(null!==e)},"data-paper-blend-mode":function(t,e){t.setBlendMode&&t.setBlendMode(e)},"font-style":function(t,e){var n;t.setFontWeight&&/^(italic|oblique)$/.test(e)&&(n=(""+t.getFontWeight()).replace(/\s*\b(italic|oblique)\b/gi,""),t.setFontWeight(/^(normal|400)$/.test(n)?e:n+" "+e))},"letter-spacing":function(t,e){var n;t.setTracking&&(n=parseFloat(e)||0,t.setTracking(1e3*(/em$/.test(e)?n:n/parseFloat(t.getFontSize()))))},"stop-color":function(t,e){t.setColor&&t.setColor(e)},"stop-opacity":function(t,e){t._color&&t._color.setAlpha(parseFloat(e))},offset:function(t,e){var n;t.setOffset&&(n=e.match(/(.*)%$/),t.setOffset(n?n[1]/100:parseFloat(e)))},viewBox:function(t,e,n,i,r){var s,a,o=new b(At(e,"array")),e=zt(i,null,null,!0);t instanceof v?(a=e?e.divide(o.getSize()):1,s=(new A).scale(a).translate(o.getPoint().negate()),a=t):t instanceof m&&(e&&o.setSize(e),a=t._item),a&&("visible"!==jt(i,"overflow",r)&&((o=new g.Rectangle(o)).setClipMask(!0),a.addChild(o)),s&&a.transform(s))}}),V.inject({importSVG:function(t,e){return Zt(t,e,this)}}),s.inject({importSVG:function(t,e){return this.activate(),Zt(t,e,this)}});var Wt=new(l.inject(D.exports,{Base:D,Numerical:q,ChangeFlag:i,Key:ut,DomEvent:F,DomElement:B,document:k,window:f,PlacedSymbol:h,Symbol:m}));return Wt.agent.node&&require("./node/extend.js")(Wt),"function"==typeof define&&define.amd?define("paper",Wt):"object"==typeof module&&module&&(module.exports=Wt),Wt}("object"==typeof self?self:null);
|
|
32
|
+
var paper=function(u,Wt){var k=(u=u||require("./node/self.js")).window,z=u.document;k&&!z.createElement("canvas").getContext("2d")&&(k=null);var O=new function(){function n(t,e,n){var i;return t&&((i=f(t,"length"))&&"number"==typeof i.value?s:function(t,e){for(var n in this)this.hasOwnProperty(n)&&t.call(e,this[n],n,this)}).call(t,e,n=n||t),n}var r=/^(statics|enumerable|beans|preserve)$/,t=[],i=t.slice,a=Object.create,f=Object.getOwnPropertyDescriptor,d=Object.defineProperty,s=t.forEach||function(t,e){for(var n=0,i=this.length;n<i;n++)t.call(e,this[n],n,this)},o=Object.assign||function(t){for(var e=1,n=arguments.length;e<n;e++){var i,r=arguments[e];for(i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}return t};function h(a,o,h,u,l){var c={};function t(t,e){var n,i="function"==typeof(e="string"==typeof(e=e||(e=f(o,t))&&(e.get?e:e.value))&&"#"===e[0]?a[e.substring(1)]||e:e),r=e,s=l||i&&!e.base?e&&e.get?t in a:a[t]:null;l&&s||(i&&s&&(e.base=s),i&&!1!==u&&(n=t.match(/^([gs]et|is)(([A-Z])(.*))$/))&&(c[n[3].toLowerCase()+n[4]]=n[2]),r&&!i&&r.get&&"function"==typeof r.get&&g.isPlainObject(r)||(r={value:r,writable:!0}),(f(a,t)||{configurable:!0}).configurable&&(r.configurable=!0,r.enumerable=null!=h?h:!n),d(a,t,r))}if(o){for(var e in o)o.hasOwnProperty(e)&&!r.test(e)&&t(e);for(var e in c){var n=c[e],i=a["set"+n],n=a["get"+n]||i&&a["is"+n];!n||!0!==u&&0!==n.length||t(e,{get:n,set:i})}}return a}function g(){for(var t=0,e=arguments.length;t<e;t++){var n=arguments[t];n&&o(this,n)}return this}return h(g,{inject:function(t){var e,n,i;t&&(e=!0===t.statics?t:t.statics,n=t.beans,i=t.preserve,e!==t&&h(this.prototype,t,t.enumerable,n,i),h(this,e,null,n,i));for(var r=1,s=arguments.length;r<s;r++)this.inject(arguments[r]);return this},extend:function(){for(var t,e,n,i=this,r=0,s=arguments.length;r<s&&(!t||!e);r++)n=arguments[r],t=t||n.initialize,e=e||n.prototype;return e=(t=t||function(){i.apply(this,arguments)}).prototype=e||a(this.prototype),d(e,"constructor",{value:t,writable:!0,configurable:!0}),h(t,this),arguments.length&&this.inject.apply(t,arguments),t.base=i,t}}).inject({enumerable:!1,initialize:g,set:g,inject:function(){for(var t=0,e=arguments.length;t<e;t++){var n=arguments[t];n&&h(this,n,n.enumerable,n.beans,n.preserve)}return this},extend:function(){var t=a(this);return t.inject.apply(t,arguments)},each:function(t,e){return n(this,t,e)},clone:function(){return new this.constructor(this)},statics:{set:o,each:n,create:a,define:d,describe:f,clone:function(t){return o(new t.constructor,t)},isPlainObject:function(t){t=null!=t&&t.constructor;return t&&(t===Object||t===g||"Object"===t.name)},pick:function(t,e){return t!==Wt?t:e},slice:function(t,e,n){return i.call(t,e,n)}}})};"undefined"!=typeof module&&(module.exports=O),O.inject({enumerable:!1,toString:function(){return null!=this._id?(this._class||"Object")+(this._name?" '"+this._name+"'":" @"+this._id):"{ "+O.each(this,function(t,e){/^_/.test(e)||this.push(e+": "+("number"==(e=typeof t)?x.instance.number(t):"string"==e?"'"+t+"'":t))},[]).join(", ")+" }"},getClassName:function(){return this._class||""},importJSON:function(t){return O.importJSON(t,this)},exportJSON:function(t){return O.exportJSON(this,t)},toJSON:function(){return O.serialize(this)},set:function(t,e){return t&&O.filter(this,t,e,this._prioritize),this}},{beans:!1,statics:{exports:{},extend:function t(){var e=t.base.apply(this,arguments),n=e.prototype._class;return n&&!O.exports[n]&&(O.exports[n]=e),e},equals:function(t,e){if(t===e)return!0;if(t&&t.equals)return t.equals(e);if(e&&e.equals)return e.equals(t);if(t&&e&&"object"==typeof t&&"object"==typeof e){if(Array.isArray(t)&&Array.isArray(e)){if((n=t.length)!==e.length)return!1;for(;n--;)if(!O.equals(t[n],e[n]))return!1}else{var n,i=Object.keys(t);if((n=i.length)!==Object.keys(e).length)return!1;for(;n--;){var r=i[n];if(!e.hasOwnProperty(r)||!O.equals(t[r],e[r]))return!1}}return!0}return!1},read:function(t,e,n,i){if(this===O){var r=this.peek(t,e);return t.__index++,r}var s=this.prototype,a=s._readIndex,o=e||a&&t.__index||0,r=t.length,e=t[o];return i=i||r-o,e instanceof this||n&&n.readNull&&null==e&&i<=1?(a&&(t.__index=o+1),e&&n&&n.clone?e.clone():e):(e=O.create(s),a&&(e.__read=!0),e=e.initialize.apply(e,0<o||o+i<r?O.slice(t,o,o+i):t)||e,a&&(t.__index=o+e.__read,(o=e.__filtered)&&(t.__filtered=o,e.__filtered=Wt),e.__read=Wt),e)},peek:function(t,e){return t[t.__index=e||t.__index||0]},remain:function(t){return t.length-(t.__index||0)},readList:function(t,e,n,i){for(var r,s=[],e=e||0,a=i?e+i:t.length,o=e;o<a;o++)s.push(Array.isArray(r=t[o])?this.read(r,0,n):this.read(t,o,n,1));return s},readNamed:function(t,e,n,i,r){var s,a,o=this.getNamed(t,e),h=o!==Wt;return h&&((a=t.__filtered)||(s=this.getSource(t),(a=t.__filtered=O.create(s)).__unfiltered=s),a[e]=Wt),this.read(h?[o]:t,n,i,r)},readSupported:function(n,i){var t=this.getSource(n),r=this,s=!1;return t&&Object.keys(t).forEach(function(t){var e;t in i&&((e=r.readNamed(n,t))!==Wt&&(i[t]=e),s=!0)}),s},getSource:function(t){var e,n=t.__source;return n===Wt&&(e=1===t.length&&t[0],n=t.__source=e&&O.isPlainObject(e)?e:null),n},getNamed:function(t,e){var n=this.getSource(t);if(n)return e?n[e]:t.__filtered||n},hasNamed:function(t,e){return!!this.getNamed(t,e)},filter:function(n,i,r,t){var s;function e(t){var e;r&&t in r||s&&t in s||(e=i[t])!==Wt&&(n[t]=e)}if(t){for(var a,o={},h=0,u=t.length;h<u;h++)(a=t[h])in i&&(e(a),o[a]=!0);s=o}return Object.keys(i.__unfiltered||i).forEach(e),n},isPlainValue:function(t,e){return O.isPlainObject(t)||Array.isArray(t)||e&&"string"==typeof t},serialize:function(t,e,n,i){e=e||{};var r=!i;if(r&&(e.formatter=new x(e.precision),i={length:0,definitions:{},references:{},add:function(t,e){var n="#"+t._id,i=this.references[n];return i||(this.length++,e=e.call(t),(t=t._class)&&e[0]!==t&&e.unshift(t),this.definitions[n]=e,i=this.references[n]=[n]),i}}),t&&t._serialize){var s=t._serialize(e,i),a=t._class;!a||t._compactSerialize||!r&&n||s[0]===a||s.unshift(a)}else if(Array.isArray(t)){s=[];for(var o=0,h=t.length;o<h;o++)s[o]=O.serialize(t[o],e,n,i)}else if(O.isPlainObject(t)){s={};for(var u=Object.keys(t),o=0,h=u.length;o<h;o++){var l=u[o];s[l]=O.serialize(t[l],e,n,i)}}else s="number"==typeof t?e.formatter.number(t,e.precision):t;return r&&0<i.length?[["dictionary",i.definitions],s]:s},deserialize:function(t,e,n,i,r){var s=t,a=!n,o=a&&t&&t.length&&"dictionary"===t[0][0];if(n=n||{},Array.isArray(t)){var h=t[0],u="dictionary"===h;if(1==t.length&&/^#/.test(h))return n.dictionary[h];s=[];for(var l,c=(h=O.exports[h])?1:0,f=t.length;c<f;c++)s.push(O.deserialize(t[c],e,n,u,o));h&&(l=s,s=e?e(h,l,a||r):new h(l))}else if(O.isPlainObject(t))for(var d in s={},i&&(n.dictionary=s),t)s[d]=O.deserialize(t[d],e,n);return o?s[1]:s},exportJSON:function(t,e){t=O.serialize(t,e);return e&&0==e.asString?t:JSON.stringify(t)},importJSON:function(t,s){return O.deserialize("string"==typeof t?JSON.parse(t):t,function(t,e,n){var i=n&&s&&s.constructor===t,r=i?s:O.create(t.prototype);return!(1===e.length&&r instanceof A)||!i&&r instanceof a||(n=e[0],O.isPlainObject(n)&&(n.insert=!1,i&&(e=e.concat([A.INSERT])))),(i?r.set:t).apply(r,e),i&&(s=null),r})},push:function(t,e){var n=e.length;if(n<4096)t.push.apply(t,e);else{var i=t.length;t.length+=n;for(var r=0;r<n;r++)t[i+r]=e[r]}return t},splice:function(t,e,n,i){var r=e&&e.length,s=n===Wt;(n=s?t.length:n)>t.length&&(n=t.length);for(var a=0;a<r;a++)e[a]._index=n+a;if(s)return O.push(t,e),[];i=[n,i];e&&O.push(i,e);for(var o=t.splice.apply(t,i),a=0,h=o.length;a<h;a++)o[a]._index=Wt;for(a=n+r,h=t.length;a<h;a++)t[a]._index=a;return o},capitalize:function(t){return t.replace(/\b[a-z]/g,function(t){return t.toUpperCase()})},camelize:function(t){return t.replace(/-(.)/g,function(t,e){return e.toUpperCase()})},hyphenate:function(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}}});var t={on:function(t,e){var n,i;return"string"!=typeof t?O.each(t,function(t,e){this.on(e,t)},this):(n=(i=this._eventTypes)&&i[t],-1===(i=(i=this._callbacks=this._callbacks||{})[t]=i[t]||[]).indexOf(e)&&(i.push(e),n&&n.install&&1===i.length&&n.install.call(this,t))),this},off:function(t,e){if("string"==typeof t){var n,i=this._eventTypes,r=i&&i[t],i=this._callbacks&&this._callbacks[t];return i&&(!e||-1!==(n=i.indexOf(e))&&1===i.length?(r&&r.uninstall&&r.uninstall.call(this,t),delete this._callbacks[t]):-1!==n&&i.splice(n,1)),this}O.each(t,function(t,e){this.off(e,t)},this)},once:function(e,n){return this.on(e,function t(){n.apply(this,arguments),this.off(e,t)})},emit:function(t,e){if(!(r=this._callbacks&&this._callbacks[t]))return!1;var n=O.slice(arguments,1),i=e&&e.target&&!e.currentTarget,r=r.slice();i&&(e.currentTarget=this);for(var s=0,a=r.length;s<a;s++)if(0==r[s].apply(this,n)){e&&e.stop&&e.stop();break}return i&&delete e.currentTarget,!0},responds:function(t){return!(!this._callbacks||!this._callbacks[t])},attach:"#on",detach:"#off",fire:"#emit",_installEvents:function(t){var e,n=this._eventTypes,i=this._callbacks,r=t?"install":"uninstall";if(n)for(var s in i)0<i[s].length&&((e=(e=n[s])&&e[r])&&e.call(this,s))},statics:{inject:function t(s){var a,e=s._events;return e&&(a={},O.each(e,function(t,e){var n="string"==typeof t,i=n?t:e,e=O.capitalize(i),r=i.substring(2).toLowerCase();a[r]=n?{}:t,i="_"+i,s["get"+e]=function(){return this[i]},s["set"+e]=function(t){var e=this[i];e&&this.off(r,e),t&&this.on(r,t),this[i]=t}}),s._eventTypes=a),t.base.apply(this,arguments)}}},l=O.extend({_class:"PaperScope",initialize:function t(){(te=this).settings=new O({applyMatrix:!0,insertItems:!0,handleSize:4,segmentSize:null,hitTolerance:0,scaleStrokes:!1}),this.project=null,this.projects=[],this.tools=[],this._id=t._id++,t._scopes[this._id]=this;var e,n,s,i=t.prototype;this.support||(i.support={nativeBlendModes:dt.nativeModes}),this.agent||(e=u.navigator.userAgent.toLowerCase(),n=(/(darwin|win|mac|linux|freebsd|sunos)/.exec(e)||[])[0],s=i.agent=i.browser={platform:n="darwin"===n?"mac":n},n&&(s[n]=!0),e.replace(/(opera|chrome|safari|webkit|firefox|msie|trident|atom|node|jsdom)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv\:v?([.\d]+))?/g,function(t,e,n,i,r){s.chrome||(n="opera"===e?i:/^(node|trident)$/.test(e)?r:n,s.version=n,s.versionNumber=parseFloat(n),s.name=e={trident:"msie",jsdom:"node"}[e]||e,s[e]=!0)}),s.chrome&&delete s.webkit,s.atom&&delete s.chrome)},version:"0.15.0",getView:function(){var t=this.project;return t&&t._view},getPaper:function(){return this},execute:function(t,e){},install:function(e){var t,n=this;for(t in O.each(["project","view","tool"],function(t){O.define(e,t,{configurable:!0,get:function(){return n[t]}})}),this)/^_/.test(t)||!this[t]||t in e||(e[t]=this[t])},setup:function(t){return(te=this).project=new s(t),this},createCanvas:function(t,e){return ft.getCanvas(t,e)},activate:function(){te=this},clear:function(){for(var t=this.projects,e=this.tools,n=t.length-1;0<=n;n--)t[n].remove();for(n=e.length-1;0<=n;n--)e[n].remove()},remove:function(){this.clear(),delete l._scopes[this._id]},statics:new function(){function t(n){return n+="Attribute",function(t,e){return t[n](e)||t[n]("data-paper-"+e)}}return{_scopes:{},_id:0,get:function(t){return this._scopes[t]||null},getAttribute:t("get"),hasAttribute:t("has")}}}),e=O.extend(t,{initialize:function(t){this._scope=te,this._index=this._scope[this._list].push(this)-1,!t&&this._scope[this._reference]||this.activate()},activate:function(){if(!this._scope)return!1;var t=this._scope[this._reference];return t&&t!==this&&t.emit("deactivate"),(this._scope[this._reference]=this).emit("activate",t),!0},isActive:function(){return this._scope[this._reference]===this},getScope:function(){return this._scope},remove:function(){return null!=this._index&&(O.splice(this._scope[this._list],null,this._index,1),this._scope[this._reference]==this&&(this._scope[this._reference]=null),!(this._scope=null))},getView:function(){return this._scope.getView()}}),Zt={findItemBoundsCollisions:function(t,e,n){function i(t){for(var e=new Array(t.length),n=0;n<t.length;n++){var i=t[n].getBounds();e[n]=[i.left,i.top,i.right,i.bottom]}return e}var r=i(t),e=e&&e!==t?i(e):r;return this.findBoundsCollisions(r,e,n||0)},findCurveBoundsCollisions:function(t,e,n){function i(t){for(var e=Math.min,n=Math.max,i=new Array(t.length),r=0;r<t.length;r++){var s=t[r];i[r]=[e(s[0],s[2],s[4],s[6]),e(s[1],s[3],s[5],s[7]),n(s[0],s[2],s[4],s[6]),n(s[1],s[3],s[5],s[7])]}return i}var r=i(t),e=e&&e!==t?i(e):r;return this.findBoundsCollisions(r,e,n||0)},findBoundsCollisions:function(t,e,n,i){var r=!e||t===e,a=r?t:t.concat(e),s=t.length,o=a.length;function h(t,e,n){for(var i=0,r=t.length;i<r;){var s=r+i>>>1;a[t[s]][e]<n?i=1+s:r=s}return i-1}for(var u=i?1:0,l=2+u,c=i?0:1,f=2+c,d=new Array(o),g=0;g<o;g++)d[g]=g;d.sort(function(t,e){return a[t][u]-a[e][u]});for(var _=[],p=new Array(s),g=0;g<o;g++){var v=d[g],m=a[v],y=r?v:v-s,w=v<s,x=r||!w,b=w?[]:null;if(_.length){var S=h(_,l,m[u]-n)+1;_.splice(0,S);for(var C=m[f],M=m[c],I=0;I<_.length;I++){var P=_[I],T=a[P],k=P<s,z=r||s<=P;(w&&z||x&&k)&&C>=T[c]-n&&M<=T[f]+n&&(w&&z&&b.push(r?P:P-s),x&&k&&p[P].push(y))}}w&&(t===e&&b.push(v),p[v]=b),_.length?(m=h(_,l,m[l]),_.splice(m+1,0,v)):_.push(v)}for(g=0;g<p.length;g++){var O=p[g];O&&O.sort(function(t,e){return t-e})}return p}},x=O.extend({initialize:function(t){this.precision=O.pick(t,5),this.multiplier=Math.pow(10,this.precision)},number:function(t){return this.precision<16?Math.round(t*this.multiplier)/this.multiplier:t},pair:function(t,e,n){return this.number(t)+(n||",")+this.number(e)},point:function(t,e){return this.number(t.x)+(e||",")+this.number(t.y)},size:function(t,e){return this.number(t.width)+(e||",")+this.number(t.height)},rectangle:function(t,e){return this.point(t,e)+(e||",")+this.size(t,e)}});x.instance=new x;var Ut=new function(){var f=[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],d=[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]],w=Math.abs,m=Math.sqrt,y=Math.pow,e=Math.log2||function(t){return Math.log(t)*Math.LOG2E},x=1e-12,b=112e-18;function S(t,e,n){return t<e?e:n<t?n:t}function g(t,e,n){function i(t){var e=134217729*t,e=t-e+e;return[e,t-e]}var r,s,a=e*e-t*n,o=e*e+t*n;return 3*w(a)<o&&(r=i(t),s=i(e),o=i(n),a=(e=e*e)-(n=t*n)+(s[0]*s[0]-e+2*s[0]*s[1]+s[1]*s[1]-(r[0]*o[0]-n+r[0]*o[1]+r[1]*o[0]+r[1]*o[1]))),a}function C(){var t=Math.max.apply(Math,arguments);return t&&(t<1e-8||1e8<t)?y(2,-Math.round(e(t))):0}return{EPSILON:x,MACHINE_EPSILON:b,CURVETIME_EPSILON:1e-8,GEOMETRIC_EPSILON:1e-7,TRIGONOMETRIC_EPSILON:1e-8,ANGULAR_EPSILON:1e-5,KAPPA:4*(m(2)-1)/3,getEpsilon:function(t,e){return Math.max(x,4*t*b,e||0)},isZero:function(t){return-x<=t&&t<=x},isMachineZero:function(t){return-b<=t&&t<=b},clamp:S,integrate:function(t,e,n,i){for(var r=f[i-2],s=d[i-2],a=.5*(n-e),o=a+e,h=0,u=i+1>>1,l=1&i?s[h++]*t(o):0;h<u;){var c=a*r[h];l+=s[h++]*(t(o+c)+t(o-c))}return a*l},findRoot:function(t,e,n,i,r,s,a){for(var o=0;o<s;o++){var h=t(n),u=h/e(n),l=n-u;if(w(u)<a){n=l;break}n=0<h?(r=n,l<=i?.5*(i+r):l):(i=n,r<=l?.5*(i+r):l)}return S(n,i,r)},solveQuadratic:function(t,e,n,i,r,s){var a,o=1/0;if(w(t)<x){if(w(e)<x)return w(n)<x?-1:0;a=-n/e}else{var h,u=g(t,e*=-.5,n);u&&w(u)<b&&((h=C(w(t),w(e),w(n)))&&(u=g(t*=h,e*=h,n*=h))),-b<=u&&(l=u<0?0:m(u),o=0===(c=e+(e<0?-l:l))?-(a=n/t):(a=c/t,n/c))}var l=0,t=null==r,n=r-x,c=s+x;return isFinite(a)&&(t||n<a&&a<c)&&(i[l++]=t?a:S(a,r,s)),o!==a&&isFinite(o)&&(t||n<o&&o<c)&&(i[l++]=t?o:S(o,r,s)),l},solveCubic:function(e,n,i,r,t,s,a){var o,h,u,l,c,f=C(w(e),w(n),w(i),w(r));function d(t){t=e*(o=t);l=(t+(h=t+n))*o+(u=h*o+i),c=u*o+r}if(f&&(e*=f,n*=f,i*=f,r*=f),w(e)<x)e=n,h=i,u=r,o=1/0;else if(w(r)<x)h=n,u=i,o=0;else{d(-n/e/3);var g=c/e,_=y(w(g),1/3),p=g<0?-1:1,g=-l/e,g=0<g?1.324717957244746*Math.max(_,m(g)):_,v=o-p*g;if(v!==o){for(;d(v),v=0===l?o:o-c/l/(1+b),p*o<p*v;);w(e)*o*o>w(r/o)&&(h=((u=-r/o)-i)/o)}}_=Ut.solveQuadratic(e,h,u,t,s,a),g=null==s;return isFinite(o)&&(0===_||0<_&&o!==t[0]&&o!==t[1])&&(g||s-x<o&&o<a+x)&&(t[_++]=g?o:S(o,s,a)),_},solveBernstein:function(t,e,v,m){var y=0;return function t(e,n,i,r){for(var s,a,o=0,h=0,u=0,l=0,c=e.length;l<c;l++){var f=e[l];w(f)<=n[l]?h++:(f=0<f?1:-1,u&&f!==u&&o++,u=f)}if(h===e.length||(o||h)&&r-i<=m)v[y++]=(i+r)/2;else if(1!==o||h)(o||h)&&(t((s=function(t,e){for(var n=[],i=[],r=[],s=[],a=t.slice(),o=e.slice(),h=a.length;0<h;h--){n.push(a[0]),i.unshift(a[h-1]),r.push(o[0]),s.unshift(o[h-1]);for(var u=0;u<h-1;u++)a[u]=(a[u]+a[u+1])/2,o[u]=(o[u]+o[u+1])/2+b*w(a[u])}return[n,i,r,s]}(e,n))[0],s[2],i,a=(i+r)/2),t(s[1],s[3],a,r));else{for(var d=0,g=1,_=e[0]<0;i+(r-i)*d<i+(r-i)*g&&d<(d+g)/2&&(d+g)/2<g;){var p=(d+g)/2;(function(t,e){for(var n=t.slice(),i=n.length-1;0<i;i--)for(var r=0;r<i;r++)n[r]=n[r]+(n[r+1]-n[r])*e;return n[0]})(e,p)<0==_?d=p:g=p}v[y++]=i+(r-i)*(d+g)/2}}(t,e,0,1),y}}},o={_id:1,_pools:{},get:function(t){if(t){var e=this._pools[t];return(e=e||(this._pools[t]={_id:1}))._id++}return this._id++}},Gt=O.extend({_class:"Point",_readIndex:!0,initialize:function(t,e){var n,i=typeof t,r=this.__read,s=0;return"number"==i?(this._set(t,(n="number"==typeof e)?e:t),r&&(s=n?2:1)):"undefined"==i||null===t?(this._set(0,0),r&&(s=null===t?1:0)):(t="string"==i?t.split(/[\s,]+/)||[]:t,s=1,Array.isArray(t)?this._set(+t[0],+(1<t.length?t[1]:t[0])):"x"in t?this._set(t.x||0,t.y||0):"width"in t?this._set(t.width||0,t.height||0):"angle"in t?(this._set(t.length||0,0),this.setAngle(t.angle||0)):"angleInRadians"in t?(this._set(t.length||0,0),this.setAngleInRadians(t.angleInRadians||0)):(this._set(0,0),s=0)),r&&(this.__read=s),this},set:"#initialize",_set:function(t,e){return this.x=t,this.y=e,this},equals:function(t){return this===t||t&&(this.x===t.x&&this.y===t.y||Array.isArray(t)&&this.x===t[0]&&this.y===t[1])||!1},clone:function(){return new Gt(this.x,this.y)},toString:function(){var t=x.instance;return"{ x: "+t.number(this.x)+", y: "+t.number(this.y)+" }"},_serialize:function(t){t=t.formatter;return[t.number(this.x),t.number(this.y)]},getLength:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setLength:function(t){var e;this.isZero()?(e=this._angle||0,this._set(Math.cos(e)*t,Math.sin(e)*t)):(t=t/this.getLength(),Ut.isZero(t)&&this.getAngle(),this._set(this.x*t,this.y*t))},getAngle:function(){return 180*this.getAngleInRadians.apply(this,arguments)/Math.PI},setAngle:function(t){this.setAngleInRadians.call(this,t*Math.PI/180)},getAngleInDegrees:"#getAngle",setAngleInDegrees:"#setAngle",getAngleInRadians:function(){if(arguments.length){var t=Gt.read(arguments),e=this.getLength()*t.getLength();if(Ut.isZero(e))return NaN;e=this.dot(t)/e;return Math.acos(e<-1?-1:1<e?1:e)}return this.isZero()?this._angle||0:this._angle=Math.atan2(this.y,this.x)},setAngleInRadians:function(t){var e;this._angle=t,this.isZero()||(e=this.getLength(),this._set(Math.cos(t)*e,Math.sin(t)*e))},getQuadrant:function(){return 0<=this.x?0<=this.y?1:4:0<=this.y?2:3}},{beans:!1,getDirectedAngle:function(){var t=Gt.read(arguments);return 180*Math.atan2(this.cross(t),this.dot(t))/Math.PI},getDistance:function(){var t=arguments,e=Gt.read(t),n=e.x-this.x,e=e.y-this.y,e=n*n+e*e;return O.read(t)?e:Math.sqrt(e)},normalize:function(t){t===Wt&&(t=1);var e=this.getLength(),t=0!==e?t/e:0,e=new Gt(this.x*t,this.y*t);return 0<=t&&(e._angle=this._angle),e},rotate:function(t,e){if(0===t)return this.clone();t=t*Math.PI/180;var n=e?this.subtract(e):this,i=Math.sin(t),t=Math.cos(t),n=new Gt(n.x*t-n.y*i,n.x*i+n.y*t);return e?n.add(e):n},transform:function(t){return t?t._transformPoint(this):this},add:function(){var t=Gt.read(arguments);return new Gt(this.x+t.x,this.y+t.y)},subtract:function(){var t=Gt.read(arguments);return new Gt(this.x-t.x,this.y-t.y)},multiply:function(){var t=Gt.read(arguments);return new Gt(this.x*t.x,this.y*t.y)},divide:function(){var t=Gt.read(arguments);return new Gt(this.x/t.x,this.y/t.y)},modulo:function(){var t=Gt.read(arguments);return new Gt(this.x%t.x,this.y%t.y)},negate:function(){return new Gt(-this.x,-this.y)},isInside:function(){return C.read(arguments).contains(this)},isClose:function(){var t=arguments,e=Gt.read(t),t=O.read(t);return this.getDistance(e)<=t},isCollinear:function(){var t=Gt.read(arguments);return Gt.isCollinear(this.x,this.y,t.x,t.y)},isColinear:"#isCollinear",isOrthogonal:function(){var t=Gt.read(arguments);return Gt.isOrthogonal(this.x,this.y,t.x,t.y)},isZero:function(){var t=Ut.isZero;return t(this.x)&&t(this.y)},isNaN:function(){return isNaN(this.x)||isNaN(this.y)},isInQuadrant:function(t){return 0<=this.x*(1<t&&t<4?-1:1)&&0<=this.y*(2<t?-1:1)},dot:function(){var t=Gt.read(arguments);return this.x*t.x+this.y*t.y},cross:function(){var t=Gt.read(arguments);return this.x*t.y-this.y*t.x},project:function(){var t=Gt.read(arguments),e=t.isZero()?0:this.dot(t)/t.dot(t);return new Gt(t.x*e,t.y*e)},clamp:function(){var t=arguments,e=Gt.read(t),t=Gt.read(t);return new Gt(Ut.clamp(this.x,e.x,t.x),Ut.clamp(this.y,e.y,t.y))},statics:{min:function(){var t=arguments,e=Gt.read(t),t=Gt.read(t);return new Gt(Math.min(e.x,t.x),Math.min(e.y,t.y))},max:function(){var t=arguments,e=Gt.read(t),t=Gt.read(t);return new Gt(Math.max(e.x,t.x),Math.max(e.y,t.y))},random:function(){return new Gt(Math.random(),Math.random())},isCollinear:function(t,e,n,i){return Math.abs(t*i-e*n)<=1e-8*Math.sqrt((t*t+e*e)*(n*n+i*i))},isOrthogonal:function(t,e,n,i){return Math.abs(t*n+e*i)<=1e-8*Math.sqrt((t*t+e*e)*(n*n+i*i))}}},O.each(["round","ceil","floor","abs"],function(t){var e=Math[t];this[t]=function(){return new Gt(e(this.x),e(this.y))}},{})),c=Gt.extend({initialize:function(t,e,n,i){this._x=t,this._y=e,this._owner=n,this._setter=i},_set:function(t,e,n){return this._x=t,this._y=e,n||this._owner[this._setter](this),this},getX:function(){return this._x},setX:function(t){this._x=t,this._owner[this._setter](this)},getY:function(){return this._y},setY:function(t){this._y=t,this._owner[this._setter](this)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(t){this._owner._changeSelection(this._getSelection(),t)},_getSelection:function(){return"setPosition"===this._setter?4:0}}),j=O.extend({_class:"Size",_readIndex:!0,initialize:function(t,e){var n,i=typeof t,r=this.__read,s=0;return"number"==i?(this._set(t,(n="number"==typeof e)?e:t),r&&(s=n?2:1)):"undefined"==i||null===t?(this._set(0,0),r&&(s=null===t?1:0)):(t="string"==i?t.split(/[\s,]+/)||[]:t,s=1,Array.isArray(t)?this._set(+t[0],+(1<t.length?t[1]:t[0])):"width"in t?this._set(t.width||0,t.height||0):"x"in t?this._set(t.x||0,t.y||0):(this._set(0,0),s=0)),r&&(this.__read=s),this},set:"#initialize",_set:function(t,e){return this.width=t,this.height=e,this},equals:function(t){return t===this||t&&(this.width===t.width&&this.height===t.height||Array.isArray(t)&&this.width===t[0]&&this.height===t[1])||!1},clone:function(){return new j(this.width,this.height)},toString:function(){var t=x.instance;return"{ width: "+t.number(this.width)+", height: "+t.number(this.height)+" }"},_serialize:function(t){t=t.formatter;return[t.number(this.width),t.number(this.height)]},add:function(){var t=j.read(arguments);return new j(this.width+t.width,this.height+t.height)},subtract:function(){var t=j.read(arguments);return new j(this.width-t.width,this.height-t.height)},multiply:function(){var t=j.read(arguments);return new j(this.width*t.width,this.height*t.height)},divide:function(){var t=j.read(arguments);return new j(this.width/t.width,this.height/t.height)},modulo:function(){var t=j.read(arguments);return new j(this.width%t.width,this.height%t.height)},negate:function(){return new j(-this.width,-this.height)},isZero:function(){var t=Ut.isZero;return t(this.width)&&t(this.height)},isNaN:function(){return isNaN(this.width)||isNaN(this.height)},statics:{min:function(t,e){return new j(Math.min(t.width,e.width),Math.min(t.height,e.height))},max:function(t,e){return new j(Math.max(t.width,e.width),Math.max(t.height,e.height))},random:function(){return new j(Math.random(),Math.random())}}},O.each(["round","ceil","floor","abs"],function(t){var e=Math[t];this[t]=function(){return new j(e(this.width),e(this.height))}},{})),n=j.extend({initialize:function(t,e,n,i){this._width=t,this._height=e,this._owner=n,this._setter=i},_set:function(t,e,n){return this._width=t,this._height=e,n||this._owner[this._setter](this),this},getWidth:function(){return this._width},setWidth:function(t){this._width=t,this._owner[this._setter](this)},getHeight:function(){return this._height},setHeight:function(t){this._height=t,this._owner[this._setter](this)}}),C=O.extend({_class:"Rectangle",_readIndex:!0,beans:!0,initialize:function(t,e,n,i){var r,s,a,o,h,u,l=arguments,c=typeof t;"number"==c?(this._set(t,e,n,i),r=4):"undefined"==c||null===t?(this._set(0,0,0,0),r=null===t?1:0):(1===l.length||Array.isArray(t)&&4===t.length||t.x!==Wt&&t.width!==Wt)&&(Array.isArray(t)?(this._set.apply(this,t),r=1):t.x!==Wt||t.width!==Wt?(this._set(t.x||0,t.y||0,t.width||0,t.height||0),r=1):t.from===Wt&&t.to===Wt&&(s=new f,O.readSupported(l,s)&&(r=1),this._set(s.x,s.y,s.width,s.height))),r===Wt&&(a=Gt.readNamed(l,"from"),c=O.peek(l),s=a.x,a=a.y,c&&c.x!==Wt||O.hasNamed(l,"to")?(o=(u=Gt.readNamed(l,"to")).x-s,h=u.y-a,o<0&&(s=u.x,o=-o),h<0&&(a=u.y,h=-h)):(o=(u=j.read(l)).width,h=u.height),this._set(s,a,o,h),r=l.__index);l=l.__filtered;return l&&(this.__filtered=l),this.__read&&(this.__read=r),this},set:"#initialize",_set:function(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this},clone:function(){return new C(this.x,this.y,this.width,this.height)},equals:function(t){var e=O.isPlainValue(t)?C.read(arguments):t;return e===this||e&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height||!1},toString:function(){var t=x.instance;return"{ x: "+t.number(this.x)+", y: "+t.number(this.y)+", width: "+t.number(this.width)+", height: "+t.number(this.height)+" }"},_serialize:function(t){t=t.formatter;return[t.number(this.x),t.number(this.y),t.number(this.width),t.number(this.height)]},getPoint:function(t){return new(t?Gt:c)(this.x,this.y,this,"setPoint")},setPoint:function(){var t=Gt.read(arguments);this.x=t.x,this.y=t.y},getSize:function(t){return new(t?j:n)(this.width,this.height,this,"setSize")},setSize:function(){var t=j.read(arguments);this.width=t.width,this.height=t.height},getLeft:function(){return this.x},setLeft:function(t){this.width-=t-this.x,this.x=t},getTop:function(){return this.y},setTop:function(t){this.height-=t-this.y,this.y=t},getRight:function(){return this.x+this.width},setRight:function(t){this.width=t-this.x},getBottom:function(){return this.y+this.height},setBottom:function(t){this.height=t-this.y},getCenterX:function(){return this.x+this.width/2},setCenterX:function(t){this.x=t-this.width/2},getCenterY:function(){return this.y+this.height/2},setCenterY:function(t){this.y=t-this.height/2},getCenter:function(t){return new(t?Gt:c)(this.getCenterX(),this.getCenterY(),this,"setCenter")},setCenter:function(){var t=Gt.read(arguments);return this.setCenterX(t.x),this.setCenterY(t.y),this},getArea:function(){return this.width*this.height},isEmpty:function(){return 0===this.width||0===this.height},contains:function(t){return t&&t.width!==Wt||4===(Array.isArray(t)?t:arguments).length?this._containsRectangle(C.read(arguments)):this._containsPoint(Gt.read(arguments))},_containsPoint:function(t){var e=t.x,t=t.y;return e>=this.x&&t>=this.y&&e<=this.x+this.width&&t<=this.y+this.height},_containsRectangle:function(t){var e=t.x,n=t.y;return e>=this.x&&n>=this.y&&e+t.width<=this.x+this.width&&n+t.height<=this.y+this.height},intersects:function(){var t=C.read(arguments),e=O.read(arguments)||0;return t.x+t.width>this.x-e&&t.y+t.height>this.y-e&&t.x<this.x+this.width+e&&t.y<this.y+this.height+e},intersect:function(){var t=C.read(arguments),e=Math.max(this.x,t.x),n=Math.max(this.y,t.y),i=Math.min(this.x+this.width,t.x+t.width),t=Math.min(this.y+this.height,t.y+t.height);return new C(e,n,i-e,t-n)},unite:function(){var t=C.read(arguments),e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width),t=Math.max(this.y+this.height,t.y+t.height);return new C(e,n,i-e,t-n)},include:function(){var t=Gt.read(arguments),e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x),t=Math.max(this.y+this.height,t.y);return new C(e,n,i-e,t-n)},expand:function(){var t=j.read(arguments),e=t.width,t=t.height;return new C(this.x-e/2,this.y-t/2,this.width+e,this.height+t)},scale:function(t,e){return this.expand(this.width*t-this.width,this.height*(e===Wt?t:e)-this.height)}},O.each([["Top","Left"],["Top","Right"],["Bottom","Left"],["Bottom","Right"],["Left","Center"],["Top","Center"],["Right","Center"],["Bottom","Center"]],function(t,e){var n=t.join(""),i=/^[RL]/.test(n);4<=e&&(t[1]+=i?"Y":"X");var e=t[i?0:1],i=t[i?1:0],r="get"+e,s="get"+i,a="set"+e,o="set"+i,h="set"+n;this["get"+n]=function(t){return new(t?Gt:c)(this[r](),this[s](),this,h)},this[h]=function(){var t=Gt.read(arguments);this[a](t.x),this[o](t.y)}},{beans:!0})),r=C.extend({initialize:function(t,e,n,i,r,s){this._set(t,e,n,i,!0),this._owner=r,this._setter=s},_set:function(t,e,n,i,r){return this._x=t,this._y=e,this._width=n,this._height=i,r||this._owner[this._setter](this),this}},new function(){var n=C.prototype;return O.each(["x","y","width","height"],function(t){var e=O.capitalize(t),n="_"+t;this["get"+e]=function(){return this[n]},this["set"+e]=function(t){this[n]=t,this._dontNotify||this._owner[this._setter](this)}},O.each(["Point","Size","Center","Left","Top","Right","Bottom","CenterX","CenterY","TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],function(t){var e="set"+t;this[e]=function(){this._dontNotify=!0,n[e].apply(this,arguments),this._dontNotify=!1,this._owner[this._setter](this)}},{isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(t){var e=this._owner;e._changeSelection&&e._changeSelection(this._getSelection(),t)},_getSelection:function(){return"setStrokeBounds"===this._setter?8:2}}))}),f=C.extend({beans:!0,_fw:1,_fh:1,setSize:function(){var t=j.read(arguments),e=this._sx,n=this._sy,i=t.width,t=t.height;e&&(this.x+=(this.width-i)*e),n&&(this.y+=(this.height-t)*n),this.width=i,this.height=t,this._fw=this._fh=1},setLeft:function(t){var e;this._fw||(e=t-this.x,this.width-=.5===this._sx?2*e:e),this.x=t,this._sx=this._fw=0},setTop:function(t){var e;this._fh||(e=t-this.y,this.height-=.5===this._sy?2*e:e),this.y=t,this._sy=this._fh=0},setRight:function(t){var e;this._fw||(e=t-this.x,this.width=.5===this._sx?2*e:e),this.x=t-this.width,this._sx=1,this._fw=0},setBottom:function(t){var e;this._fh||(e=t-this.y,this.height=.5===this._sy?2*e:e),this.y=t-this.height,this._sy=1,this._fh=0},setCenterX:function(t){this._fw||.5===this._sx?this.x=t-this.width/2:(this._sx&&(this.x+=2*(t-this.x)*this._sx),this.width=2*(t-this.x)),this._sx=.5,this._fw=0},setCenterY:function(t){this._fh||.5===this._sy?this.y=t-this.height/2:(this._sy&&(this.y+=2*(t-this.y)*this._sy),this.height=2*(t-this.y)),this._sy=.5,this._fh=0}}),F=O.extend({_class:"Matrix",initialize:function t(e,n){var i=arguments,r=i.length,s=!0;if(6<=r?this._set.apply(this,i):1===r||2===r?e instanceof t?this._set(e._a,e._b,e._c,e._d,e._tx,e._ty,n):Array.isArray(e)?this._set.apply(this,n?e.concat([n]):e):s=!1:r?s=!1:this.reset(),!s)throw new Error("Unsupported matrix parameters");return this},set:"#initialize",_set:function(t,e,n,i,r,s,a){return this._a=t,this._b=e,this._c=n,this._d=i,this._tx=r,this._ty=s,a||this._changed(),this},_serialize:function(t,e){return O.serialize(this.getValues(),t,!0,e)},_changed:function(){var t=this._owner;t&&(t._applyMatrix?t.transform(null,!0):t._changed(25))},clone:function(){return new F(this._a,this._b,this._c,this._d,this._tx,this._ty)},equals:function(t){return t===this||t&&this._a===t._a&&this._b===t._b&&this._c===t._c&&this._d===t._d&&this._tx===t._tx&&this._ty===t._ty},toString:function(){var t=x.instance;return"[["+[t.number(this._a),t.number(this._c),t.number(this._tx)].join(", ")+"], ["+[t.number(this._b),t.number(this._d),t.number(this._ty)].join(", ")+"]]"},reset:function(t){return this._a=this._d=1,this._b=this._c=this._tx=this._ty=0,t||this._changed(),this},apply:function(t,e){var n=this._owner;return!!n&&(n.transform(null,O.pick(t,!0),e),this.isIdentity())},translate:function(){var t=Gt.read(arguments),e=t.x,t=t.y;return this._tx+=e*this._a+t*this._c,this._ty+=e*this._b+t*this._d,this._changed(),this},scale:function(){var t=arguments,e=Gt.read(t),t=Gt.read(t,0,{readNull:!0});return t&&this.translate(t),this._a*=e.x,this._b*=e.x,this._c*=e.y,this._d*=e.y,t&&this.translate(t.negate()),this._changed(),this},rotate:function(t){t*=Math.PI/180;var e=Gt.read(arguments,1),n=e.x,i=e.y,r=Math.cos(t),s=Math.sin(t),a=n-n*r+i*s,o=i-n*s-i*r,h=this._a,e=this._b,n=this._c,i=this._d;return this._a=r*h+s*n,this._b=r*e+s*i,this._c=-s*h+r*n,this._d=-s*e+r*i,this._tx+=a*h+o*n,this._ty+=a*e+o*i,this._changed(),this},shear:function(){var t=arguments,e=Gt.read(t),n=Gt.read(t,0,{readNull:!0});n&&this.translate(n);var i=this._a,t=this._b;return this._a+=e.y*this._c,this._b+=e.y*this._d,this._c+=e.x*i,this._d+=e.x*t,n&&this.translate(n.negate()),this._changed(),this},skew:function(){var t=arguments,e=Gt.read(t),n=Gt.read(t,0,{readNull:!0}),t=Math.PI/180,t=new Gt(Math.tan(e.x*t),Math.tan(e.y*t));return this.shear(t,n)},append:function(t,e){var n,i,r,s,a,o,h,u,l;return t&&(n=this._a,i=this._b,r=this._c,s=this._d,a=t._a,o=t._c,h=t._b,u=t._d,l=t._tx,t=t._ty,this._a=a*n+h*r,this._c=o*n+u*r,this._b=a*i+h*s,this._d=o*i+u*s,this._tx+=l*n+t*r,this._ty+=l*i+t*s,e||this._changed()),this},prepend:function(t,e){var n,i,r,s,a,o,h,u,l,c,f;return t&&(n=this._a,i=this._b,r=this._c,s=this._d,a=this._tx,o=this._ty,h=t._a,u=t._c,l=t._b,c=t._d,f=t._tx,t=t._ty,this._a=h*n+u*i,this._c=h*r+u*s,this._b=l*n+c*i,this._d=l*r+c*s,this._tx=h*a+u*o+f,this._ty=l*a+c*o+t,e||this._changed()),this},appended:function(t){return this.clone().append(t)},prepended:function(t){return this.clone().prepend(t)},invert:function(){var t,e,n,i,r,s,a,o=null;return this.isInvertible()&&(t=this._a,e=this._b,n=this._c,i=this._d,r=this._tx,s=this._ty,this._a=i/(a=t*i-e*n),this._b=-e/a,this._c=-n/a,this._d=t/a,this._tx=(n*s-i*r)/a,this._ty=(e*r-t*s)/a,o=this),o},inverted:function(){return this.clone().invert()},concatenate:"#append",preConcatenate:"#prepend",chain:"#appended",_shiftless:function(){return new F(this._a,this._b,this._c,this._d,0,0)},_orNullIfIdentity:function(){return this.isIdentity()?null:this},isIdentity:function(){return 1===this._a&&0===this._b&&0===this._c&&1===this._d&&0===this._tx&&0===this._ty},isInvertible:function(){var t=this._a*this._d-this._c*this._b;return t&&!isNaN(t)&&isFinite(this._tx)&&isFinite(this._ty)},_getMeanScale:function(){return Math.sqrt(Math.abs(this._a*this._d-this._b*this._c))},isSingular:function(){return!this.isInvertible()},transform:function(t,e,n){return arguments.length<3?this._transformPoint(Gt.read(arguments)):this._transformCoordinates(t,e,n)},_transformPoint:function(t,e,n){var i=t.x,t=t.y;return(e=e||new Gt)._set(i*this._a+t*this._c+this._tx,i*this._b+t*this._d+this._ty,n)},_transformCoordinates:function(t,e,n){for(var i=0,r=2*n;i<r;i+=2){var s=t[i],a=t[i+1];e[i]=s*this._a+a*this._c+this._tx,e[i+1]=s*this._b+a*this._d+this._ty}return e},_transformCorners:function(t){var e=t.x,n=t.y,i=e+t.width,t=n+t.height,t=[e,n,i,n,i,t,e,t];return this._transformCoordinates(t,t,4)},_transformBounds:function(t,e){for(var n=this._transformCorners(t),i=n.slice(0,2),r=i.slice(),s=2;s<8;s++){var a=n[s],o=1&s;a<i[o]?i[o]=a:a>r[o]&&(r[o]=a)}return(e=e||new C)._set(i[0],i[1],r[0]-i[0],r[1]-i[1])},inverseTransform:function(){return this._inverseTransform(Gt.read(arguments))},_inverseTransform:function(t){var e,n,i,r,s,a=null;return this.isInvertible()&&(e=this._a,n=this._b,r=this._c,i=this._d,s=t.x-this._tx,t=t.y-this._ty,a=new Gt((s*i-t*r)/(r=e*i-n*r),(t*e-s*n)/r)),a},decompose:function(){var t,e,n,i,r=this._a,s=this._b,a=this._c,o=this._d,h=r*o-s*a,u=Math.sqrt,l=Math.atan2,c=180/Math.PI;return i=0!==r||0!==s?(t=u(r*r+s*s),e=Math.acos(r/t)*(0<s?1:-1),n=[t,h/t],[l(r*a+s*o,t*t),0]):0!==a||0!==o?(i=u(a*a+o*o),e=Math.asin(a/i)*(0<o?1:-1),n=[h/i,i],[0,l(r*a+s*o,i*i)]):n=[e=0,0],{translation:this.getTranslation(),rotation:e*c,scaling:new Gt(n),skewing:new Gt(i[0]*c,i[1]*c)}},getValues:function(){return[this._a,this._b,this._c,this._d,this._tx,this._ty]},getTranslation:function(){return new Gt(this._tx,this._ty)},getScaling:function(){return this.decompose().scaling},getRotation:function(){return this.decompose().rotation},applyToContext:function(t){this.isIdentity()||t.transform(this._a,this._b,this._c,this._d,this._tx,this._ty)},statics:{_getCircleExtents:function(t,e){if(!e)return[t,t];var n=e._a,i=e._b,r=e._c,e=e._d;return[t*Math.sqrt(n*n+r*r),t*Math.sqrt(i*i+e*e)]}}},O.each(["a","b","c","d","tx","ty"],function(t){var e=O.capitalize(t),n="_"+t;this["get"+e]=function(){return this[n]},this["set"+e]=function(t){this[n]=t,this._changed()}},{})),D=O.extend({_class:"Line",initialize:function(t,e,n,i,r){(4<=arguments.length?(this._px=t,this._py=e,this._vx=n,this._vy=i,r):(this._px=t.x,this._py=t.y,this._vx=e.x,this._vy=e.y,n))||(this._vx-=this._px,this._vy-=this._py)},getPoint:function(){return new Gt(this._px,this._py)},getVector:function(){return new Gt(this._vx,this._vy)},getLength:function(){return this.getVector().getLength()},intersect:function(t,e){return D.intersect(this._px,this._py,this._vx,this._vy,t._px,t._py,t._vx,t._vy,!0,e)},getSide:function(t,e){return D.getSide(this._px,this._py,this._vx,this._vy,t.x,t.y,!0,e)},getDistance:function(t){return Math.abs(this.getSignedDistance(t))},getSignedDistance:function(t){return D.getSignedDistance(this._px,this._py,this._vx,this._vy,t.x,t.y,!0)},isCollinear:function(t){return Gt.isCollinear(this._vx,this._vy,t._vx,t._vy)},isOrthogonal:function(t){return Gt.isOrthogonal(this._vx,this._vy,t._vx,t._vy)},statics:{intersect:function(t,e,n,i,r,s,a,o,h,u){h||(n-=t,i-=e,a-=r,o-=s);h=n*o-i*a;if(!Ut.isMachineZero(h)){r=t-r,s=e-s,o=(a*s-o*r)/h,h=(n*s-i*r)/h;if(u||-1e-12<o&&o<1+1e-12&&-1e-12<h&&h<1+1e-12)return new Gt(t+(o=!u?o<=0?0:1<=o?1:o:o)*n,e+o*i)}},getSide:function(t,e,n,i,r,s,a,o){a||(n-=t,i-=e);t=r-t,e=t*i-(s-e)*n;return(e=!o&&Ut.isMachineZero(e)&&0<=(e=(t*n+t*n)/(n*n+i*i))&&e<=1?0:e)<0?-1:0<e?1:0},getSignedDistance:function(t,e,n,i,r,s,a){return a||(n-=t,i-=e),0===n?0<i?r-t:t-r:0===i?n<0?s-e:e-s:((r-t)*i-(s-e)*n)/(n<i?Math.abs(i)*Math.sqrt(1+n*n/(i*i)):Math.abs(n)*Math.sqrt(1+i*i/(n*n)))},getDistance:function(t,e,n,i,r,s,a){return Math.abs(D.getSignedDistance(t,e,n,i,r,s,a))}}}),i={APPEARANCE:1,CHILDREN:2,INSERTION:4,GEOMETRY:8,MATRIX:16,SEGMENTS:32,STROKE:64,STYLE:128,ATTRIBUTE:256,CONTENT:512,PIXELS:1024,CLIPPING:2048,VIEW:4096},s=e.extend({_class:"Project",_list:"projects",_reference:"project",_compactSerialize:!0,initialize:function(t){e.call(this,!0),this._children=[],this._namedChildren={},this._activeLayer=null,this._currentStyle=new E(null,null,this),this._view=it.create(this,t||ft.getCanvas(1,1)),this._selectionItems={},this._selectionCount=0,this._updateVersion=0},_serialize:function(t,e){return O.serialize(this._children,t,!0,e)},_changed:function(t,e){1&t&&((r=this._view)&&(r._needsUpdate=!0,!r._requested&&r._autoUpdate&&r.requestUpdate()));var n,i,r,s=this._changes;s&&e&&e.isInserted()&&((r=(n=this._changesById)[i=e._id])?r.flags|=t:s.push(n[i]={item:e,flags:t}))},getTrackChanges:function(){return!!this._changes},setTrackChanges:function(t){!this._changes^!t&&(this._changes=t?[]:null,this._changesById=t?{}:null)},takeChanges:function(){var t=this._changes;return t&&(this._changes=[],this._changesById={}),t||null},hasChanges:function(){return!(!this._changes||!this._changes.length)},clear:function(){for(var t=this._children,e=t.length-1;0<=e;e--)t[e].remove()},isEmpty:function(){return!this._children.length},remove:function t(){return!!t.base.call(this)&&(this._view&&this._view.remove(),!0)},getView:function(){return this._view},getCurrentStyle:function(){return this._currentStyle},setCurrentStyle:function(t){this._currentStyle.set(t)},getIndex:function(){return this._index},getOptions:function(){return this._scope.settings},getLayers:function(){return this._children},getActiveLayer:function(){return this._activeLayer||new a({project:this,insert:!0})},getSymbolDefinitions:function(){var n=[],i={};return this.getItems({class:h,match:function(t){var e=t._definition,t=e._id;return i[t]||(i[t]=!0,n.push(e)),!1}}),n},getSymbols:"getSymbolDefinitions",getSelectedItems:function(){var t,e=this._selectionItems,n=[];for(t in e){var i=e[t],r=i._selection;1&r&&i.isInserted()?n.push(i):r||this._updateSelection(i)}return n},_updateSelection:function(t,e){var n=t._id,i=this._selectionItems;t._selection&&!e&&t.isInserted()?i[n]!==t&&(this._selectionCount++,i[n]=t):i[n]===t&&(this._selectionCount--,delete i[n])},selectAll:function(){for(var t=this._children,e=0,n=t.length;e<n;e++)t[e].setFullySelected(!0)},deselectAll:function(){var t,e=this._selectionItems;for(t in e)e[t].setFullySelected(!1)},addLayer:function(t){return this.insertLayer(Wt,t)},insertLayer:function(t,e){return e instanceof a?(e._remove(!1,!0),O.splice(this._children,[e],t,0),e._setProject(this,!0),(t=e._name)&&e.setName(t),this._changes&&e._changed(5),this._activeLayer||(this._activeLayer=e)):e=null,e},_insertItem:function(t,e,n){return e=this.insertLayer(t,e)||(this._activeLayer||this._insertItem(Wt,new a(A.NO_INSERT),!0)).insertChild(t,e),n&&e.activate&&e.activate(),e},getItems:function(t){return A._getItems(this,t)},getItem:function(t){return A._getItems(this,t,null,null,!0)[0]||null},importJSON:function(t){this.activate();var e=this._activeLayer;return O.importJSON(t,e&&e.isEmpty()&&e)},removeOn:function(t){var e=this._removeSets;if(e){"mouseup"===t&&(e.mousedrag=null);var n=e[t];if(n){for(var i in n){var r,s=n[i];for(r in e){var a=e[r];a&&a!=n&&delete a[s._id]}s.remove()}e[t]=null}}},draw:function(t,e,n){this._updateVersion++,t.save(),e.applyToContext(t);for(var i=this._children,r=new O({offset:new Gt(0,0),pixelRatio:n,viewMatrix:e.isIdentity()?null:e,matrices:[new F],updateMatrix:!0}),s=0,a=i.length;s<a;s++)i[s].draw(t,r);if(t.restore(),0<this._selectionCount){t.save(),t.lineWidth=1;var o,h=this._selectionItems,u=this._scope.settings.handleSize,l=this._updateVersion;for(o in h)h[o]._drawSelection(t,e,u,h,l);t.restore()}}}),A=O.extend(t,{statics:{extend:function t(e){return e._serializeFields&&(e._serializeFields=O.set({},this.prototype._serializeFields,e._serializeFields)),t.base.apply(this,arguments)},INSERT:{insert:!0},NO_INSERT:{insert:!1}},_class:"Item",_name:null,_applyMatrix:!0,_canApplyMatrix:!0,_canScaleStroke:!1,_pivot:null,_visible:!0,_blendMode:"normal",_opacity:1,_locked:!1,_guide:!1,_textWrap:null,_clipMask:!1,_selection:0,_selectBounds:!0,_selectChildren:!1,_serializeFields:{name:null,applyMatrix:null,matrix:new F,pivot:null,visible:!0,blendMode:"normal",opacity:1,locked:!1,guide:!1,clipMask:!1,textWrap:null,selected:!1,data:{}},_prioritize:["applyMatrix"]},new function(){var t=["onMouseDown","onMouseUp","onMouseDrag","onClick","onDoubleClick","onMouseMove","onMouseEnter","onMouseLeave"];return O.each(t,function(t){this._events[t]={install:function(t){this.isInserted()&&this.getView()._countItemEvent(t,1)},uninstall:function(t){this.isInserted()&&this.getView()._countItemEvent(t,-1)}}},{_events:{onFrame:{install:function(){this.getView()._animateItem(this,!0)},uninstall:function(){this.getView()._animateItem(this,!1)}},onLoad:{},onError:{}},statics:{_itemHandlers:t}})},{initialize:function(){},_initialize:function(t,e){var n=t&&O.isPlainObject(t),i=n&&!0===t.internal,r=this._matrix=new F,s=n&&t.project||te.project,a=te.settings;if(!s)throw new Error("Unable to create an item without a project. Call paper.setup() or create a Project first.");return this._id=i?null:o.get(),this._parent=this._index=null,this._applyMatrix=this._canApplyMatrix&&a.applyMatrix,e&&r.translate(e),(r._owner=this)._style=new E(s._currentStyle,this,s),i||n&&0==t.insert||!a.insertItems&&(!n||1!=t.insert)?this._setProject(s):(n&&t.parent||s)._insertItem(Wt,this,!0),n&&t!==A.NO_INSERT&&t!==A.INSERT&&this.set(t,{internal:!0,insert:!0,project:!0,parent:!0}),n},_serialize:function(i,r){var s={},a=this;function t(t){for(var e in t){var n=a[e];O.equals(n,t[e])||(s[e]=O.serialize(n,i,"data"!==e,r))}}return t(this._serializeFields),this instanceof v||t(this._style._defaults),[this._class,s]},_changed:function(t){var e=this._symbol,n=this._parent||e,i=this._project;8&t?this._bounds=this._position=this._decomposed=Wt:64&t&&(this._bounds=Wt),16&t&&(this._globalMatrix=Wt),n&&72&t&&A._clearBoundsCache(n),2&t&&A._clearBoundsCache(this);for(var r=this;r&&!(r instanceof a);r=r._parent)if(r._textWrap){var s=r.getLayer();s&&s._textWrapVersion++;break}n=this._parent,n=n&&!n.getChildren()&&n;i&&i._changed(t,n?null:this),n&&n._changed(t),e&&e._changed(t)},getId:function(){return this._id},getName:function(){return this._name},setName:function(t){if(this._name&&this._removeNamed(),t===+t+"")throw new Error("Names consisting only of numbers are not supported.");var e,n=this._getOwner();t&&n&&(e=n._children,((n=n._namedChildren)[t]=n[t]||[]).push(this),t in e||(e[t]=this)),this._name=t||Wt,this._changed(256)},getStyle:function(){return this._style},setStyle:function(t){this.getStyle().set(t)},_getStyles:function(){}},O.each(["locked","visible","blendMode","opacity","guide"],function(e){var t=O.capitalize(e),n="_"+e,i={locked:256,visible:265};this["get"+t]=function(){return this[n]},this["set"+t]=function(t){t!=this[n]&&(this[n]=t,this._changed(i[e]||257))}},{}),{beans:!0,getTextWrap:function(){var t=this._textWrap;return t&&O.set({},t)},setTextWrap:function(t){(t||this._textWrap)&&(this._textWrap=t?O.set({offset:6,invert:!1},O.isPlainObject(t)?t:null):null,this._updateTextWrap(),this._changed(257))},_updateTextWrap:function(t){var e,n=this.getLayer();n&&(e=n._textWrapItems||(n._textWrapItems={}),this._textWrap&&!t?e[this._id]=this:delete e[this._id],n._textWrapVersion++)},getSelection:function(){return this._selection},setSelection:function(t){t!==this._selection&&(this._selection=t,(t=this._project)&&(t._updateSelection(this),this._changed(257)))},_changeSelection:function(t,e){var n=this._selection;this.setSelection(e?n|t:n&~t)},isSelected:function(){if(this._selectChildren)for(var t=this._children,e=0,n=t.length;e<n;e++)if(t[e].isSelected())return!0;return!!(1&this._selection)},setSelected:function(t){if(this._selectChildren)for(var e=this._children,n=0,i=e.length;n<i;n++)e[n].setSelected(t);this._changeSelection(1,t)},isFullySelected:function(){var t=this._children,e=!!(1&this._selection);if(t&&e){for(var n=0,i=t.length;n<i;n++)if(!t[n].isFullySelected())return!1;return!0}return e},setFullySelected:function(t){var e=this._children;if(e)for(var n=0,i=e.length;n<i;n++)e[n].setFullySelected(t);this._changeSelection(1,t)},isClipMask:function(){return this._clipMask},setClipMask:function(t){this._clipMask!=(t=!!t)&&((this._clipMask=t)&&(this.setFillColor(null),this.setStrokeColor(null)),this._changed(257),this._parent&&this._parent._changed(2048))},getData:function(){return this._data||(this._data={}),this._data},setData:function(t){this._data=t},getPosition:function(t){var e=t?Gt:c,t=this._position||(this._position=this._getPositionFromBounds());return new e(t.x,t.y,this,"setPosition")},setPosition:function(){this.translate(Gt.read(arguments).subtract(this.getPosition(!0)))},_getPositionFromBounds:function(t){return this._pivot?this._matrix._transformPoint(this._pivot):(t||this.getBounds()).getCenter(!0)},getPivot:function(){var t=this._pivot;return t?new c(t.x,t.y,this,"setPivot"):null},setPivot:function(){this._pivot=Gt.read(arguments,0,{clone:!0,readNull:!0}),this._position=Wt}},O.each({getHandleBounds:{handle:!0},getInternalBounds:{internal:!0}},function(e,t){this[t]=function(t){return this.getBounds(t,e)}},{beans:!0,getBounds:function(t,e){var n=e||t instanceof F,i=O.set({},n?e:t,this._boundsOptions);i.stroke&&!this.getStrokeScaling()||(i.cacheItem=this);i=this._getCachedBounds(n&&t,i).rect;return arguments.length?i:new r(i.x,i.y,i.width,i.height,this,"setBounds")},getStrokeBounds:function(t){var e=this.getBounds(t,{stroke:!0});return arguments.length?e:new r(e.x,e.y,e.width,e.height,this,"setStrokeBounds")},setBounds:function(){var t=C.read(arguments),e=this.getBounds(),n=this._matrix,i=new F,r=t.getCenter();i.translate(r),t.width==e.width&&t.height==e.height||(n.isInvertible()||(n.set(n._backup||(new F).translate(n.getTranslation())),e=this.getBounds()),i.scale(0!==e.width?t.width/e.width:1,0!==e.height?t.height/e.height:1)),r=e.getCenter(),i.translate(-r.x,-r.y),this.transform(i)},setStrokeBounds:function(){var t=C.read(arguments),n=this,e=this.getBounds(),i=e.getCenter(),r=t.width<0?-1:1,s=t.height<0?-1:1,a=Math.abs(t.width),o=Math.abs(t.height),h=!!e.width,u=!!e.height,l=1,c=1;function f(t,e){return(new F).scale(r*t,s*e,i)}function d(t,e){e=f(t,e);return n.getBounds(e.appended(n._matrix),{stroke:!0,transform:{matrix:e,item:n}})}for(var g=0;g<16;g++){var _=d(l,c).getSize(),p=h?_.width-a:0,v=u?_.height-o:0;if(Math.abs(p)<1e-7&&Math.abs(v)<1e-7)break;var m=1e-6*Math.max(l,1),y=1e-6*Math.max(c,1),w=d(l+m,c).getSize(),x=d(l,c+y).getSize(),b=h?(w.width-_.width)/m:1,S=h&&u?(x.width-_.width)/y:0,m=h&&u?(w.height-_.height)/m:0,_=u?(x.height-_.height)/y:1,y=b*_-S*m;if(!y)break;S=Math.max(l-(p*_-v*S)/y,1e-12),y=Math.max(c-(v*b-p*m)/y,1e-12);if(S===l&&y===c)break;l=S,c=y}this.transform((new F).translate(t.getCenter().subtract(d(l,c).getCenter())).append(f(l,c)))},_getBounds:function(t,e){var n=this._children;return n&&n.length?(A._updateBoundsCache(this,e.cacheItem),A._getBounds(n,t,e)):new C},_getBoundsCacheKey:function(t,e){return[t.stroke?1:0,t.handle?1:0,e?1:0].join("")},_getCachedBounds:function(t,e,n){var i=e.internal&&!n,r=e.cacheItem,s=i?null:this._matrix._orNullIfIdentity();t=t?t._orNullIfIdentity():s;var a=r&&(t?t.equals(s):!s)&&this._getBoundsCacheKey(e,i),n=a&&r!==this&&(this._children||this._definition),s=this._bounds;if(A._updateBoundsCache(this._parent||this._symbol,r),n&&A._updateBoundsCache(this,r),a&&s&&a in s)return{rect:(o=s[a]).rect.clone(),nonscaling:o.nonscaling};var o,r=this._getBounds(t,n?O.set({},e,{cacheItem:this}):e),t=r.rect||r,n=this._style,n=r.nonscaling||n.hasStroke()&&!n.getStrokeScaling();return a&&(s||(this._bounds=s={}),o=s[a]={rect:t.clone(),nonscaling:n,stroke:e.stroke,internal:i}),{rect:t,nonscaling:n}},_getStrokeMatrix:function(t,e){var n=this.getStrokeScaling()?null:e&&e.internal?this:this._parent||this._symbol&&this._symbol._item,i=n?n.getViewMatrix().invert():t,r=!n&&e&&e.transform;if(r)for(var s=this;s&&s._applyMatrix;s=s._parent)if(s===r.item){i=r.matrix.inverted().appended(i);break}return i&&i._shiftless()},statics:{_updateBoundsCache:function(t,e){var n;t&&e&&(n=e._id,(t=t._boundsCache=t._boundsCache||{ids:{},list:[]}).ids[n]||(t.list.push(e),t.ids[n]=e))},_clearBoundsCache:function(t){var e=t._boundsCache;if(e){t._bounds=t._position=t._boundsCache=Wt;for(var n=0,i=e.list,r=i.length;n<r;n++){var s=i[n];s!==t&&(s._bounds=s._position=Wt,s._boundsCache&&A._clearBoundsCache(s))}}},getBounds:function(t,e){return A._getBounds(t,null,e,!0).rect},_getBounds:function(t,e,n,i){var r=l=1/0,s=c=-l,a=!1;n=n||{};for(var o=0,h=t.length;o<h;o++){var u,l,c,f=t[o];f._visible&&!f.isEmpty(!0)&&(f=(u=f._getCachedBounds(i?f.getGlobalMatrix(!0):e&&e.appended(f._matrix),n,!0)).rect,l=Math.min(f.x,l),r=Math.min(f.y,r),c=Math.max(f.x+f.width,c),s=Math.max(f.y+f.height,s),u.nonscaling&&(a=!0))}return{rect:isFinite(l)?new C(l,r,c-l,s-r):new C,nonscaling:a}}}}),{beans:!0,_decompose:function(){return this._applyMatrix?null:this._decomposed||(this._decomposed=this._matrix.decompose())},getRotation:function(){var t=this._decompose();return t?t.rotation:0},setRotation:function(t){var e,n=this.getRotation();null!=n&&null!=t&&(e=this._decomposed,this.rotate(t-n),e&&(e.rotation=t,this._decomposed=e))},getScaling:function(){var t=this._decompose(),t=t&&t.scaling;return new c(t?t.x:1,t?t.y:1,this,"setScaling")},setScaling:function(){var t,e,n,i,r=this.getScaling(),s=Gt.read(arguments,0,{clone:!0,readNull:!0});r&&s&&!r.equals(s)&&(t=this.getRotation(),e=this._decomposed,n=new F,(i=Ut.isZero)(r.x)||i(r.y)?(n.translate(e.translation),t&&n.rotate(t),n.scale(s.x,s.y),this._matrix.set(n)):(i=this.getPosition(!0),n.translate(i),t&&n.rotate(t),n.scale(s.x/r.x,s.y/r.y),t&&n.rotate(-t),n.translate(i.negate()),this.transform(n)),e&&(e.scaling=s,this._decomposed=e))},getMatrix:function(){return this._matrix},setMatrix:function(){var t=this._matrix;t.set.apply(t,arguments)},getGlobalMatrix:function(t){var e=this._parent,n=e&&e.getGlobalMatrix(!0),e=this._globalMatrix;return e&&this._parentGlobalMatrix===n||(e=this._globalMatrix=this._matrix.clone(),n&&e.prepend(n),this._parentGlobalMatrix=n),t?e:e.clone()},getViewMatrix:function(){return this.getGlobalMatrix().prepend(this.getView()._matrix)},getApplyMatrix:function(){return this._applyMatrix},setApplyMatrix:function(t){(this._applyMatrix=this._canApplyMatrix&&!!t)&&this.transform(null,!0)},getTransformContent:"#getApplyMatrix",setTransformContent:"#setApplyMatrix"},{getProject:function(){return this._project},_setProject:function(t,e){if(this._project!==t){this._project=t;for(var n=this._children,i=0,r=n&&n.length;i<r;i++)n[i]._setProject(t)}e&&this._installEvents(!0)},getView:function(){return this._project._view},getScope:function(){return this._project._scope},_installEvents:function t(e){t.base.call(this,e),this._selection&&this._project._updateSelection(this,!e),this._textWrap&&this._updateTextWrap(!e);for(var n=this._children,i=0,r=n&&n.length;i<r;i++)n[i]._installEvents(e)},getLayer:function(){for(var t=this;t=t._parent;)if(t instanceof a)return t;return null},getParent:function(){return this._parent},setParent:function(t){return t.addChild(this)},_getOwner:"#getParent",getChildren:function(){return this._children},setChildren:function(t){this.removeChildren(),this.addChildren(t)},getFirstChild:function(){return this._children&&this._children[0]||null},getLastChild:function(){return this._children&&this._children[this._children.length-1]||null},getNextSibling:function(){var t=this._getOwner();return t&&t._children[this._index+1]||null},getPreviousSibling:function(){var t=this._getOwner();return t&&t._children[this._index-1]||null},getIndex:function(){return this._index},setIndex:function(t){var e=this._parent,n=e&&e._children;n&&e.insertChildren(t in n?t:Wt,[this])},equals:function(t){return t===this||t&&this._class===t._class&&this._style.equals(t._style)&&this._matrix.equals(t._matrix)&&this._locked===t._locked&&this._visible===t._visible&&this._blendMode===t._blendMode&&this._opacity===t._opacity&&this._clipMask===t._clipMask&&this._guide===t._guide&&O.equals(this._textWrap,t._textWrap)&&this._equals(t)||!1},_equals:function(t){return O.equals(this._children,t._children)},clone:function(t){var e=new this.constructor(A.NO_INSERT),n=this._children,i=O.pick(t?t.insert:Wt,"boolean"==typeof t?t:te.settings.insertItems),t=O.pick(t?t.deep:Wt,!0);n&&e.copyAttributes(this),n&&!t||e.copyContent(this),n||e.copyAttributes(this),i&&e.insertAbove(this);var r=this._name,i=this._parent;if(r&&i){for(var n=i._children,s=r,a=1;n[r];)r=s+" "+a++;r!==s&&e.setName(r)}return e},copyContent:function(t){for(var e=t._children,n=0,i=e&&e.length;n<i;n++)this.addChild(e[n].clone(!1),!0)},copyAttributes:function(t,e){this.setStyle(t._style);for(var n=["_locked","_visible","_blendMode","_opacity","_clipMask","_guide","_textWrap"],i=0,r=n.length;i<r;i++){var s=n[i];t.hasOwnProperty(s)&&(this[s]=t[s])}e||this._matrix.set(t._matrix,!0),this.setApplyMatrix(t._applyMatrix),this.setPivot(t._pivot),this.setSelection(t._selection);var a=t._data,e=t._name;this._data=a?O.clone(a):null,e&&this.setName(e)},rasterize:function(t,e){var n;O.isPlainObject(t)?(a=t.resolution,n=t.insert,i=t.raster):(a=t,n=e);var i=i||new d(A.NO_INSERT),r=this.getStrokeBounds(),s=(a||this.getView().getResolution())/72,t=r.getTopLeft().floor(),e=r.getBottomRight().ceil(),a=new j(e.subtract(t)),r=a.multiply(s);return i.setSize(r,!0),r.isZero()||(e=i.getContext(!0),r=(new F).scale(s).translate(t.negate()),e.save(),r.applyToContext(e),this.draw(e,new O({matrices:[r]})),e.restore()),i._matrix.set((new F).translate(t.add(a.divide(2))).scale(1/s)),O.pick(n,te.settings.insertItems)&&i.insertAbove(this),i},contains:function(){var t=this._matrix;return t.isInvertible()&&!!this._contains(t._inverseTransform(Gt.read(arguments)))},_contains:function(t){var e=this._children;if(e){for(var n=e.length-1;0<=n;n--)if(e[n].contains(t))return!0;return!1}return t.isInside(this.getInternalBounds())},isInside:function(){return C.read(arguments).contains(this.getBounds())},_asPathItem:function(){return new V.Rectangle({rectangle:this.getInternalBounds(),applyMatrix:!1,matrix:this._matrix,insert:!1})},intersects:function(t,e){if(!(t instanceof A))return!1;var n=this._asPathItem(),i=t._asPathItem(),r=n._matrix,t=e||i._matrix;function s(t,e,n,i){for(var r=t._children||[t],s=0,a=r.length;s<a;s++){var o=r[s]._segments[0],o=o&&i._inverseTransform(e._transformPoint(o._point));if(o&&n._contains(o))return!0}return!1}return 0<n.getIntersections(i,null,e,!0).length||s(i,t,n,r)||s(n,r,i,t)}},new function(){function t(){var t=arguments;return this._hitTest(Gt.read(t),q.getOptions(t))}function e(){var t=arguments,e=Gt.read(t),n=q.getOptions(t),t=[];return this._hitTest(e,new O({all:t},n)),t}function n(t,e,n,i){var r=this._children;if(r)for(var s=r.length-1;0<=s;s--){var a=r[s],a=a!==i&&a._hitTest(t,e,n);if(a&&!e.all)return a}return null}return s.inject({hitTest:t,hitTestAll:e,_hitTest:n}),{hitTest:t,hitTestAll:e,_hitTestChildren:n}},{_hitTest:function(i,s,t){if(this._locked||!this._visible||this._guide&&!s.guides||!this._shell&&this.isEmpty())return null;var e=this._matrix,n=t?e:this.getGlobalMatrix(),r=t?t.appended(e):n.prepended(this.getView()._matrix),a=Math.max(s.tolerance,1e-12),o=s._tolerancePadding=new j(F._getCircleExtents(a,r.prepended(this.getView()._matrix.inverted())._shiftless().invert()));if(!(i=n._inverseTransform(i))||(this._shell||!this._children)&&!this.getBounds({internal:!0,stroke:!0,handle:!0}).expand(o.multiply(2))._containsPoint(i))return null;var h,u,l=!(s.guides&&!this._guide||s.selected&&!this.isSelected()||s.type&&s.type!==O.hyphenate(this._class)||s.class&&!(this instanceof s.class)),c=s.match,f=this;function d(t){if(Array.isArray(t)){for(var e=null,n=0,i=t.length;n<i;n++)var r=d(t[n]),e=e||r;return e}return(t=t&&c&&!c(t)?null:t)&&s.all&&(t.point&&(t.point=f.getGlobalMatrix().transform(t.point)),s.all.push(t)),t}function g(t,e){var n=e?h["get"+e]():f.getPosition();if(i.subtract(n).divide(o).length<=1)return new q(t,f,{name:e?O.hyphenate(e):t,point:n})}t=s.position,e=s.center,a=s.bounds;if(l&&this._parent&&(t||e||a)){if((e||a)&&(h=this.getInternalBounds()),!(u=t&&g("position")||e&&g("center","Center"))&&a)for(var _=["TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],p=0;p<8&&!u;p++)u=g("bounds",_[p]);u=d(u)}return(u=u||(this._hitTestChildren(i,s,r)||l&&d(this._hitTestSelf(i,s,r,this.getStrokeScaling()?null:r._shiftless().invert()))||null))&&u.point&&!s.all&&(u.point=n.transform(u.point)),u},_hitTestSelf:function(t,e){if(e.fill&&this.getFillColor()&&this._contains(t))return new q("fill",this)},matches:function(t,e){var n=typeof t;if("object"==n){for(var i in t)if(t.hasOwnProperty(i)&&!this.matches(i,t[i]))return!1;return!0}if("function"==n)return t(this);if("match"===t)return e(this);n=/^(empty|editable)$/.test(t)?this["is"+O.capitalize(t)]():"type"===t?O.hyphenate(this._class):this[t];if("class"===t){if("function"==typeof e)return this instanceof e;n=this._class}if("function"==typeof e)return!!e(n);if(e){if(e.test)return e.test(n);if(O.isPlainObject(e))return function t(e,n){for(var i in e)if(e.hasOwnProperty(i)){var r=e[i],i=n[i];if(O.isPlainObject(r)&&O.isPlainObject(i)){if(!t(r,i))return!1}else if(!O.equals(r,i))return!1}return!0}(e,n)}return O.equals(n,e)},getItems:function(t){return A._getItems(this,t,this._matrix)},getItem:function(t){return A._getItems(this,t,this._matrix,null,!0)[0]||null},statics:{_getItems:function t(e,n,i,r,s){var a,o,h;r||(o=(a="object"==typeof n&&n)&&a.overlapping,h=a&&a.inside,u=(v=o||h)&&C.read([v]),r={items:[],recursive:!a||!1!==a.recursive,inside:!!h,overlapping:!!o,rect:u,path:o&&new V.Rectangle({rectangle:u,insert:!1})},a&&(n=O.filter({},n,{recursive:!0,inside:!0,overlapping:!0})));var u,l=e._children,c=r.items;i=(u=r.rect)&&(i||new F);for(var f=0,d=l&&l.length;f<d;f++){var g=l[f],_=i&&i.appended(g._matrix),p=!0;if(u){var v=g.getBounds(_);if(!u.intersects(v))continue;u.contains(v)||r.overlapping&&r.path.intersects(g,_)||(p=!1)}if(p&&g.matches(n)&&(c.push(g),s))break;if(!1!==r.recursive&&g.getChildren()&&t(g,n,_,r,s),s&&0<c.length)break}return c}}},{importJSON:function(t){var e=(t="string"==typeof t?JSON.parse(t):t)&&t[0]===this._class&&t[1];if(O.isPlainObject(e)){var n,i=new this.constructor(A.NO_INSERT),r={};for(n in O.set({},this._serializeFields,this instanceof v?null:this._style._defaults))n in e||O.equals(this[n],i[n])||(r[n]=i[n]);this.set(r)}t=O.importJSON(t,this);return t!==this?this.addChild(t):t},addChild:function(t){return this.insertChild(Wt,t)},insertChild:function(t,e){e=e?this.insertChildren(t,[e]):null;return e&&e[0]},addChildren:function(t){return this.insertChildren(this._children.length,t)},insertChildren:function(t,e){var n=this._children;if(n&&e&&0<e.length){for(var i={},r=(e=O.slice(e)).length-1;0<=r;r--){var s=(u=e[r])&&u._id;!u||i[s]?e.splice(r,1):(u._remove(!1,!0),i[s]=!0)}O.splice(n,e,t,0);for(var a=this._project,o=a._changes,r=0,h=e.length;r<h;r++){var u,l=(u=e[r])._name;u._parent=this,u._setProject(a,!0),l&&u.setName(l),o&&u._changed(5)}this._changed(11)}else e=null;return e},_insertItem:"#insertChild",_insertAt:function(t,e){var n=t&&t._getOwner(),i=t!==this&&n?this:null;return i&&(i._remove(!1,!0),n._insertItem(t._index+e,i)),i},insertAbove:function(t){return this._insertAt(t,1)},insertBelow:function(t){return this._insertAt(t,0)},sendToBack:function(){var t=this._getOwner();return t?t._insertItem(0,this):null},bringToFront:function(){var t=this._getOwner();return t?t._insertItem(Wt,this):null},appendTop:"#addChild",appendBottom:function(t){return this.insertChild(0,t)},moveAbove:"#insertAbove",moveBelow:"#insertBelow",addTo:function(t){return t._insertItem(Wt,this)},copyTo:function(t){return this.clone(!1).addTo(t)},reduce:function(t){var e=this._children;if(e&&1===e.length){t=e[0].reduce(t);return this._parent?(t.insertAbove(this),this.remove()):t.remove(),t}return this},_removeNamed:function(){var t,e,n,i,r=this._getOwner();r&&(t=r._children,-1!==(r=(i=(e=r._namedChildren)[n=this._name])?i.indexOf(this):-1)&&(t[n]==this&&delete t[n],i.splice(r,1),i.length?t[n]=i[0]:delete e[n]))},_remove:function(t,e){var n=this._getOwner(),i=this._project,r=this._index;return this._style&&this._style._dispose(),!!n&&(this._name&&this._removeNamed(),this._installEvents(!1),t&&i._changes&&this._changed(5),null!=r&&(i._activeLayer===this&&(i._activeLayer=this.getNextSibling()||this.getPreviousSibling()),O.splice(n._children,null,r,1)),e&&n._changed(11,this),!(this._parent=null))},remove:function(){return this._remove(!0,!0)},replaceWith:function(t){for(var e=t,n=0,i=arguments.length;n<i&&e;n++)e=arguments[n]&&arguments[n].insertBelow(this);return e&&this.remove(),e&&t},removeChildren:function(t,e){if(!this._children)return null;t=t||0,e=O.pick(e,this._children.length);for(var n=O.splice(this._children,null,t,e-t),i=n.length-1;0<=i;i--)n[i]._remove(!0,!1);return 0<n.length&&this._changed(11),n},clear:"#removeChildren",reverseChildren:function(){if(this._children){this._children.reverse();for(var t=0,e=this._children.length;t<e;t++)this._children[t]._index=t;this._changed(11)}},isEmpty:function(t){var e=this._children,n=e?e.length:0;if(t){for(var i=0;i<n;i++)if(!e[i].isEmpty(t))return!1;return!0}return!n},isEditable:function(){for(var t=this;t;){if(!t._visible||t._locked)return!1;t=t._parent}return!0},hasFill:function(){return this.getStyle().hasFill()},hasStroke:function(){return this.getStyle().hasStroke()},hasShadow:function(){return this.getStyle().hasShadow()},_getOrder:function(t){function e(t){for(var e=[];e.unshift(t),t=t._parent;);return e}for(var n=e(this),i=e(t),r=0,s=Math.min(n.length,i.length);r<s;r++)if(n[r]!=i[r])return n[r]._index<i[r]._index?1:-1;return 0},hasChildren:function(){return this._children&&0<this._children.length},isInserted:function(){return!!this._parent&&this._parent.isInserted()},isAbove:function(t){return-1===this._getOrder(t)},isBelow:function(t){return 1===this._getOrder(t)},isParent:function(t){return this._parent===t},isChild:function(t){return t&&t._parent===this},isDescendant:function(t){for(var e=this;e=e._parent;)if(e===t)return!0;return!1},isAncestor:function(t){return!!t&&t.isDescendant(this)},isSibling:function(t){return this._parent===t._parent},isGroupedWith:function(t){for(var e=this._parent;e;){if(e._parent&&/^(Group|Layer|CompoundPath)$/.test(e._class)&&t.isDescendant(e))return!0;e=e._parent}return!1}},O.each(["rotate","scale","shear","skew"],function(n){var i="rotate"===n;this[n]=function(){var t=arguments,e=(i?O:Gt).read(t),t=Gt.read(t,0,{readNull:!0});return this.transform((new F)[n](e,t||this.getPosition(!0)))}},{translate:function(){var t=new F;return this.transform(t.translate.apply(t,arguments))},transform:function(t,e,n){var i,r,s=this._matrix,a=t&&!t.isIdentity(),o=n&&this._canApplyMatrix||this._applyMatrix&&(a||!s.isIdentity()||e&&this._children);if(!a&&!o)return this;a&&(!t.isInvertible()&&s.isInvertible()&&(s._backup=s.getValues()),s.prepend(t,!0),i=(r=this._style).getFillColor(!0),r=r.getStrokeColor(!0),i&&i.transform(t),r&&r.transform(t)),(o=o&&this._transformContent(s,e,n))&&((e=this._pivot)&&s._transformPoint(e,e,!0),s.reset(!0),n&&this._canApplyMatrix&&(this._applyMatrix=!0));var h=this._bounds,s=this._position;(a||o)&&this._changed(25);var u=a&&h&&t.decompose();if(u&&u.skewing.isZero()&&u.rotation%90==0){for(var l in h){var c=h[l];c.nonscaling||o&&c.stroke&&!u.scaling.abs().equals([1,1])?delete h[l]:!o&&c.internal||(c=c.rect,t._transformBounds(c,c))}n=(this._bounds=h)[this._getBoundsCacheKey(this._boundsOptions||{})];n&&(this._position=this._getPositionFromBounds(n.rect))}else a&&s&&this._pivot&&(this._position=t._transformPoint(s,s));return this},_transformContent:function(t,e,n){var i=this._children;if(i){for(var r=0,s=i.length;r<s;r++)i[r].transform(t,e,n);return!0}},globalToLocal:function(){return this.getGlobalMatrix(!0)._inverseTransform(Gt.read(arguments))},localToGlobal:function(){return this.getGlobalMatrix(!0)._transformPoint(Gt.read(arguments))},parentToLocal:function(){return this._matrix._inverseTransform(Gt.read(arguments))},localToParent:function(){return this._matrix._transformPoint(Gt.read(arguments))},fitBounds:function(t,e){t=C.read(arguments),!0===(e=O.read(arguments))&&(e="cover");var n,i=this.getBounds(),r=t.width/i.width,s=t.height/i.height;function a(t){return 0<t&&isFinite(t)}n="fill"===e?new j((a(r)?t:i).width,(a(s)?t:i).height):(n=(n=[r,s].filter(a)).length?("cover"===e?Math.max:Math.min).apply(Math,n):1,i.getSize().multiply(n)),this.setBounds(new C(new Gt,n).setCenter(t.getCenter()))}}),{_setStyles:function(t,e,n,i,r){var s,a=this._matrix;(r=r||this._style).hasFill()&&(t.fillStyle=r.getFillColor().toCanvasStyle(t,a,i)),r.hasStroke()&&(t.strokeStyle=r.getStrokeColor().toCanvasStyle(t,a,i),t.lineWidth=r.getStrokeWidth(),s=r.getStrokeJoin(),a=r.getStrokeCap(),i=r.getMiterLimit(),s&&(t.lineJoin=s),a&&(t.lineCap=a),i&&(t.miterLimit=i),(i=r.getDashArray())&&i.length&&(t.setLineDash(i),t.lineDashOffset=r.getDashOffset())),this._style.hasShadow()&&!e.dontShadow&&this._setShadow(t,e,n)},_paint:function(t,e,n,i){var r=this._style,s=r.hasFill(),a=r.hasStroke();(s||a)&&(this._setStyles(t,e,n,i),s&&(t.fill(r.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),a&&t.stroke())},_setShadow:function(t,e,n){var i=this._style,e=e.pixelRatio||1,n=n._shiftless().prepend((new F).scale(e,e)),e=n.transform(new Gt(i.getShadowBlur(),0)),n=n.transform(this.getShadowOffset());t.shadowColor=i.getShadowColor().toCanvasStyle(t),t.shadowBlur=e.getLength(),t.shadowOffsetX=n.x,t.shadowOffsetY=n.y},draw:function(t,e,n){this._updateVersion=this._project._updateVersion;if(this._visible&&0!==this._opacity){var i=e.matrices,r=e.viewMatrix,s=this._matrix,a=i[i.length-1],o=a.appended(s);if(o.isInvertible()){r=r?r.appended(o):o,i.push(o),e.updateMatrix&&(this._globalMatrix=o,this._parentGlobalMatrix=this._parent&&a);var h,u=this._blendMode,l=Ut.clamp(this._opacity,0,1),c="normal"===u,f=dt.nativeModes[u],d=this._style,g=(c||f)&&d.getShadowColor(!0)&&d.hasShadow()&&d.hasFill()&&d.hasStroke(),o=!g&&(c&&1===l&&!this._isolated||(f||c&&l<1)&&this._canComposite())||e.dontStart||e.clip,c=e.pixelRatio||1;if(!o){var _,p,v=this.getStrokeBounds(r);d.getShadowColor(!0)&&(p=(_=r._shiftless()).transform(new Gt(d.getShadowBlur(!0),0)),y=_.transform(d.getShadowOffset(!0)),v=v.unite(new C(v.getPoint().add(y),v.getSize()).expand(3*p.getLength())));var m=t.canvas;if((v=v.intersect(new C(new Gt(e.offset),new j(m.width,m.height).divide(c)))).width<=0||v.height<=0)return void i.pop();h=e.offset,_=e.offset=v.getTopLeft().floor(),p=t,t=ft.getContext(v.getSize().ceil().add(1).multiply(c)),1!==c&&t.scale(c,c)}t.save();var y,m=n?n.appended(s):this._canScaleStroke&&!this.getStrokeScaling(!0)&&r,v=!o&&e.clipItem,n=!m||v;o?(t.globalAlpha=l,f&&(t.globalCompositeOperation=u)):n&&t.translate(-_.x,-_.y),v?((e.viewMatrix?e.viewMatrix.appended(a):a).applyToContext(t),e.clipItem.draw(t,e.extend({clip:!0,matrices:i.slice(0,-1)})),s.applyToContext(t)):n&&(o?s:r).applyToContext(t),m&&(t.setTransform(c,0,0,c,0,0),(y=e.offset)&&t.translate(-y.x,-y.y)),this._draw(t,g&&!o?e.extend({dontShadow:!0}):e,r,m),t.restore(),i.pop(),e.clip&&!e.dontFinish&&t.clip(this.getFillRule()),o||(g&&(p.save(),this._setShadow(p,e,r)),dt.process(u,t,p,l,_.subtract(h).multiply(c)),g&&p.restore(),ft.release(t),e.offset=h)}}},_isUpdated:function(t){var e=this._parent;if(e instanceof b)return e._isUpdated(t);var n=this._updateVersion===t;return!n&&e&&e._visible&&e._isUpdated(t)&&(this._updateVersion=t,n=!0),n},_drawSelection:function(i,t,r,e,n){var s=this._selection,a=1&s,o=2&s||a&&this._selectBounds,h=8&s,s=4&s;if(((a=!this._drawSelected?!1:a)||o||h||s)&&this._isUpdated(n)&&this.isInserted()){var u=this.getSelectedColor(!0)||(u=this.getLayer())&&u.getSelectedColor(!0),l=t.appended(this.getGlobalMatrix(!0)),c=r/2;if(i.strokeStyle=i.fillStyle=u?u.toCanvasStyle(i):"#009dec",a&&this._drawSelected(i,l,e),s){var f=this.getPosition(!0),s=this._parent,f=s?s.localToGlobal(f):f,d=f.x,g=f.y;i.beginPath(),i.arc(d,g,c,0,2*Math.PI,!0),i.stroke();for(var _=[[0,-1],[1,0],[0,1],[-1,0]],p=c,v=r+1,m=0;m<4;m++){var y=_[m],w=y[0],y=y[1];i.moveTo(d+w*p,g+y*p),i.lineTo(d+w*v,g+y*v),i.stroke()}}f=function(t){var e=l._transformCorners(t);i.beginPath();for(var n=0;n<8;n++)i[n?"lineTo":"moveTo"](e[n],e[++n]);i.closePath(),i.stroke();for(n=0;n<8;n++)i.fillRect(e[n]-c,e[++n]-c,r,r)};o&&f(this.getInternalBounds()),h&&f(this.getBounds({internal:!0,stroke:!0}))}},_canComposite:function(){return!1}},O.each(["down","drag","up","move"],function(e){this["removeOn"+O.capitalize(e)]=function(){var t={};return t[e]=!0,this.removeOn(t)}},{removeOn:function(t){for(var e in t){var n;t[e]&&(n="mouse"+e,(e=(e=this._project)._removeSets=e._removeSets||{})[n]=e[n]||{},e[n][this._id]=this)}return this}}),{tween:function(t,e,n){n||(n=e,e=t,t=null,n||(n=e,e=null));var i=n&&n.easing,r=n&&n.start,n=null!=n&&("number"==typeof n?n:n.duration),s=new lt(this,t,e,n,i,r);return n&&this.on("frame",function t(e){s._handleFrame(1e3*e.time),s.running||this.off("frame",t)}),s},tweenTo:function(t,e){return this.tween(null,t,e)},tweenFrom:function(t,e){return this.tween(t,null,e)}}),v=A.extend({_class:"Group",_selectBounds:!1,_selectChildren:!0,_serializeFields:{isolated:!1,children:[]},_isolated:!1,initialize:function(t){this._children=[],this._namedChildren={},this._initialize(t)||this.addChildren(Array.isArray(t)?t:arguments)},_getStyles:function(){var t=this._children;return 0<t.length?t.map(function(t){return t._style}):null},_changed:function t(e){t.base.call(this,e),2050&e&&(this._clipItem=Wt)},_getClipItem:function(){if((t=this._clipItem)===Wt){for(var t=null,e=this._children,n=0,i=e.length;n<i;n++)if(e[n]._clipMask){t=e[n];break}this._clipItem=t}return t},isClipped:function(){return!!this._getClipItem()},setClipped:function(t){var e=this.getFirstChild();e&&e.setClipMask(t)},ungroup:function(){if(!this._parent)return null;var t=this._children.slice(),e=this._getClipItem(),n=this._matrix;if(e&&e.setClipMask(!1),!n.isIdentity())for(var i=0,r=t.length;i<r;i++)t[i].transform(n);return this.replaceWith.apply(this,t)?t:null},isIsolated:function(){return this._isolated},setIsolated:function(t){this._isolated=!!t,this._changed(257)},_getBounds:function t(e,n){var i=this._getClipItem();return i?i._getCachedBounds(i._matrix.prepended(e),O.set({},n,{stroke:!1})):t.base.call(this,e,n)},_hitTestChildren:function t(e,n,i){var r=this._getClipItem();return(!r||r.contains(e))&&t.base.call(this,e,n,i,r)},_hitTestSelf:function(t,e,n){if(e.match||e.class||e.type||e.all){n=this._hitTestChildren(t,e.extend({all:null,match:null,class:null,type:null}),n);return n&&(n.item=this),n}},_draw:function(t,e){var n=e.clip,i=this._getClipItem();e=e.extend({clipItem:!n&&i,clip:!1}),n?(t.beginPath(),e.dontStart=e.dontFinish=!0):i&&i.draw(t,e.extend({clip:!0}));for(var r=this._children,s=0,a=r.length;s<a;s++){var o=r[s];o!==i&&o.draw(t,e)}}}),a=v.extend({_class:"Layer",_textWrapVersion:0,initialize:function(){v.apply(this,arguments)},_getOwner:function(){return this._parent||null!=this._index&&this._project},isInserted:function t(){return this._parent?t.base.call(this):null!=this._index},activate:function(){this._project._activeLayer=this},_hitTestSelf:function(){}}),m=A.extend({_class:"Shape",_applyMatrix:!1,_canApplyMatrix:!1,_canScaleStroke:!0,_serializeFields:{type:null,size:null,radius:null},_prioritize:["type"],initialize:function(t,e){this._initialize(t,e)},_equals:function(t){return this._type===t._type&&this._size.equals(t._size)&&O.equals(this._radius,t._radius)},copyContent:function(t){this.setType(t._type),this.setSize(t._size),this.setRadius(t._radius)},getType:function(){return this._type},setType:function(t){this._type=t},getShape:"#getType",setShape:"#setType",getSize:function(){var t=this._size;return new n(t.width,t.height,this,"setSize")},setSize:function(){var t,e,n,i=j.read(arguments);this._size?this._size.equals(i)||(t=this._type,e=i.width,n=i.height,"rectangle"===t?this._radius.set(j.min(this._radius,i.divide(2).abs())):"circle"===t?(e=n=(e+n)/2,this._radius=e/2):"ellipse"===t&&this._radius._set(e/2,n/2),this._size._set(e,n),this._changed(9)):this._size=i.clone()},getRadius:function(){var t=this._radius;return"circle"===this._type?t:new n(t.width,t.height,this,"setRadius")},setRadius:function(t){var e=this._type;if("circle"===e){if(t===this._radius)return;var n=2*t;this._radius=t,this._size?this._size._set(n,n):this._size=new j(n,n)}else if(t=j.read(arguments),this._radius){if(this._radius.equals(t))return;this._radius.set(t),"rectangle"===e?(n=j.max(this._size,t.multiply(2)),this._size.set(n)):"ellipse"===e&&this._size._set(2*t.width,2*t.height)}else this._radius=t.clone();this._changed(9)},isEmpty:function(){return!1},toPath:function(t){var e=this._asPathItem();return te.settings.applyMatrix&&e.setApplyMatrix(!0),O.pick(t,te.settings.insertItems)&&e.insertAbove(this),e},toShape:"#clone",_asPathItem:function(){var t=new V[O.capitalize(this._type)]({center:new Gt,size:this._size,radius:this._radius,insert:!1});return t.copyAttributes(this),t},_draw:function(t,e,n,i){var r,s,a=this._style,o=a.hasFill(),h=a.hasStroke(),u=e.dontFinish||e.clip,l=!i;(o||h||u)&&(r=this._type,s=this._radius,a="circle"===r,e.dontStart||t.beginPath(),l&&a?t.arc(0,0,s,0,2*Math.PI,!0):(o=a?s:s.width,h=a?s:s.height,s=(a=this._size).width,a=a.height,l&&"rectangle"===r&&0===o&&0===h?t.rect(-s/2,-a/2,s,a):(a=[-(l=s/2),-(r=a/2)+h,-l,(a=h*(s=.44771525016920644))-r,(s=o*s)-l,-r,-l+o,-r,l-o,-r,l-s,-r,l,a-r,l,-r+h,l,r-h,l,r-a,l-s,r,l-o,r,-l+o,r,s-l,r,-l,r-a,-l,r-h],i&&i.transform(a,a,32),t.moveTo(a[0],a[1]),t.bezierCurveTo(a[2],a[3],a[4],a[5],a[6],a[7]),l!==o&&t.lineTo(a[8],a[9]),t.bezierCurveTo(a[10],a[11],a[12],a[13],a[14],a[15]),r!==h&&t.lineTo(a[16],a[17]),t.bezierCurveTo(a[18],a[19],a[20],a[21],a[22],a[23]),l!==o&&t.lineTo(a[24],a[25]),t.bezierCurveTo(a[26],a[27],a[28],a[29],a[30],a[31]))),t.closePath()),u||this._paint(t,e,n,i)},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_getBounds:function(t,e){var n=this._size,i=new C(n).setCenter(0,0),r=this._style,r=e.stroke&&r.hasStroke()&&r.getStrokeWidth()/2;return t&&(i="rectangle"===this._type?t._transformBounds(i):(n=F._getCircleExtents(1,t.clone().scale(n.width/2,n.height/2)),new C(new j(n).multiply(2)).setCenter(t._tx,t._ty))),r?i.expand(new j(F._getCircleExtents(r,this._getStrokeMatrix(t,e))).multiply(2)):i}},new function(){function f(t,e,n){var i=t._radius;if(!i.isZero())for(var r=t._size.divide(2),s=1;s<=4;s++){var a=new Gt(1<s&&s<4?-1:1,2<s?-1:1),o=a.multiply(r),h=o.subtract(a.multiply(i));if(new C(n?o.add(a.multiply(n)):o,h).contains(e))return{point:h,quadrant:s}}}function d(t,e,n,i){t=t.divide(e);return(!i||t.isInQuadrant(i))&&t.subtract(t.normalize()).multiply(e).divide(n).length<=1}return{_contains:function t(e){if("rectangle"!==this._type)return e.divide(this.size).getLength()<=.5;var n=f(this,e);return n?e.subtract(n.point).divide(this._radius).getLength()<=1:t.base.call(this,e)},_hitTestSelf:function t(e,n,i,r){var s,a,o,h=!1,u=this._style,l=n.stroke&&u.hasStroke(),c=n.fill&&!!u.getFillColor();return(l||c)&&(a=this._type,s=this._radius,o=l?u.getStrokeWidth()/2:0,c=n._tolerancePadding.add(F._getCircleExtents(o,!u.getStrokeScaling()&&r)),h="rectangle"===a?(u=f(this,e,o=c.multiply(2)))?d(e.subtract(u.point),s,c,u.quadrant):(u=(a=new C(this._size).setCenter(0,0)).expand(o),o=a.expand(o.negate()),u._containsPoint(e)&&!o._containsPoint(e)):d(e,s,c)),h?new q(l?"stroke":"fill",this):t.base.apply(this,arguments)}}},{statics:new function(){function i(t,e,n,i,r){var s=O.create(m.prototype);return s._type=t,s._size=n,s._radius=i,s._initialize(O.getNamed(r),e),s}return{Circle:function(){var t=arguments,e=Gt.readNamed(t,"center"),n=O.readNamed(t,"radius");return i("circle",e,new j(2*n),n,t)},Rectangle:function(){var t=arguments,e=C.readNamed(t,"rectangle"),n=j.min(j.readNamed(t,"radius"),e.getSize(!0).divide(2));return i("rectangle",e.getCenter(!0),e.getSize(!0),n,t)},Ellipse:function(){var t=arguments,e=m._readEllipse(t),n=e.radius;return i("ellipse",e.center,n.multiply(2),n,t)},_readEllipse:function(t){var e,n;return n=O.hasNamed(t,"radius")?(e=Gt.readNamed(t,"center"),j.readNamed(t,"radius")):(e=(n=C.readNamed(t,"rectangle")).getCenter(!0),n.getSize(!0).divide(2)),{center:e,radius:n}}}}}),d=A.extend({_class:"Raster",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!1,handle:!1},_serializeFields:{crossOrigin:null,size:new j,source:null},_prioritize:["crossOrigin"],_smoothing:"low",beans:!0,initialize:function(t,e){var n,i;this._initialize(t,e!==Wt&&Gt.read([e]))||((i="string"==(i=typeof t)?z.getElementById(t):"object"==i?t:null)&&i!==A.NO_INSERT&&(i.getContext||null!=i.naturalHeight?n=i:i&&((i=j.read(arguments)).isZero()||(n=ft.getCanvas(i)))),n?this.setImage(n):this.setSource(t)),this._size||(this._size=new j,this._loaded=!1)},_equals:function(t){return this.getSource()===t.getSource()},copyContent:function(t){var e=t._image,n=t._canvas;e?this._setImage(e):n&&((e=ft.getCanvas(t._size)).getContext("2d").drawImage(n,0,0),this._setImage(e)),this._crossOrigin=t._crossOrigin},getSize:function(){var t=this._size;return new n(t?t.width:0,t?t.height:0,this,"setSize")},setSize:function(t,e){var n,i=j.read(arguments);i.equals(this._size)?e&&this.clear():0<i.width&&0<i.height?(n=!e&&this.getElement(),this._setImage(ft.getCanvas(i)),n&&this.getContext(!0).drawImage(n,0,0,i.width,i.height)):(this._canvas&&ft.release(this._canvas),this._size=i.clone())},getWidth:function(){return this._size?this._size.width:0},setWidth:function(t){this.setSize(t,this.getHeight())},getHeight:function(){return this._size?this._size.height:0},setHeight:function(t){this.setSize(this.getWidth(),t)},getLoaded:function(){return this._loaded},isEmpty:function(){var t=this._size;return!t||0===t.width&&0===t.height},getResolution:function(){var t=this._matrix,e=new Gt(0,0).transform(t),n=new Gt(1,0).transform(t).subtract(e),e=new Gt(0,1).transform(t).subtract(e);return new j(72/n.getLength(),72/e.getLength())},getPpi:"#getResolution",getImage:function(){return this._image},setImage:function(e){var i=this;function n(t){var e=i.getView(),n=t&&t.type||"load";e&&i.responds(n)&&(te=e._scope,i.emit(n,new st(t)))}this._setImage(e),this._loaded?setTimeout(n,0):e&&H.add(e,{load:function(t){i._setImage(e),n(t)},error:n})},set:function t(e,n){return e&&e.source&&e.size&&(this._size=new j(e.size),n=O.set({size:!0},n)),t.base.call(this,e,n)},_setImage:function(t){this._canvas&&ft.release(this._canvas),t&&t.getContext?(this._image=null,this._canvas=t,this._loaded=!0):(this._image=t,this._canvas=null,this._loaded=!!(t&&t.src&&t.complete)),this._size=t&&!this._loaded?this._size||new j:new j(t?t.naturalWidth||t.width:0,t?t.naturalHeight||t.height:0),this._context=null,this._changed(1033)},getCanvas:function(){if(!this._canvas){var e=ft.getContext(this._size);try{this._image&&e.drawImage(this._image,0,0),this._canvas=e.canvas}catch(t){ft.release(e)}}return this._canvas},setCanvas:"#setImage",getContext:function(t){return this._context||(this._context=this.getCanvas().getContext("2d")),t&&(this._image=null,this._changed(1025)),this._context},setContext:function(t){this._context=t},getSource:function(){var t=this._image;return t&&t.src||this.toDataURL()},setSource:function(t){var e=new u.Image,n=this._crossOrigin;n&&(e.crossOrigin=n),t&&(e.src=t),this.setImage(e)},getCrossOrigin:function(){var t=this._image;return t&&t.crossOrigin||this._crossOrigin||""},setCrossOrigin:function(t){this._crossOrigin=t;var e=this._image;e&&(e.crossOrigin=t)},getSmoothing:function(){return this._smoothing},setSmoothing:function(t){this._smoothing="string"==typeof t?t:t?"low":"off",this._changed(257)},getElement:function(){return this._canvas||this._loaded&&this._image}},{beans:!1,getSubCanvas:function(){var t=C.read(arguments),e=ft.getContext(t.getSize());return e.drawImage(this.getCanvas(),t.x,t.y,t.width,t.height,0,0,t.width,t.height),e.canvas},getSubRaster:function(){var t=C.read(arguments),e=new d(A.NO_INSERT);return e._setImage(this.getSubCanvas(t)),e.translate(t.getCenter().subtract(this.getSize().divide(2))),e._matrix.prepend(this._matrix),e.insertAbove(this),e},toDataURL:function(){var t=this._image,t=t&&t.src;if(/^data:/.test(t))return t;t=this.getCanvas();return t?t.toDataURL.apply(t,arguments):null},drawImage:function(t){var e=Gt.read(arguments,1);this.getContext(!0).drawImage(t,e.x,e.y)},getAverageColor:function(t){if(t?t instanceof w?i=(r=t).getBounds():"object"==typeof t&&("width"in t?i=new C(t):"x"in t&&(i=new C(t.x-.5,t.y-.5,1,1))):i=this.getBounds(),!i)return null;var e=Math.min(i.width,32),n=Math.min(i.height,32),t=d._sampleContext;t?t.clearRect(0,0,33,33):t=d._sampleContext=ft.getContext(new j(32)),t.save();var i=(new F).scale(e/i.width,n/i.height).translate(-i.x,-i.y);i.applyToContext(t),r&&r.draw(t,new O({clip:!0,matrices:[i]})),this._matrix.applyToContext(t);var r=this.getElement(),i=this._size;r&&t.drawImage(r,-i.width/2,-i.height/2),t.restore();for(var s=t.getImageData(.5,.5,Math.ceil(e),Math.ceil(n)).data,a=[0,0,0],o=0,h=0,u=s.length;h<u;h+=4){var l=s[h+3];o+=l,l/=255,a[0]+=s[h]*l,a[1]+=s[h+1]*l,a[2]+=s[h+2]*l}for(h=0;h<3;h++)a[h]/=o;return o?T.read(a):null},getPixel:function(){var t=Gt.read(arguments),t=this.getContext().getImageData(t.x,t.y,1,1).data;return new T("rgb",[t[0]/255,t[1]/255,t[2]/255],t[3]/255)},setPixel:function(){var t=arguments,e=Gt.read(t),n=T.read(t),i=n._convert("rgb"),r=n._alpha,s=this.getContext(!0),t=s.createImageData(1,1),n=t.data;n[0]=255*i[0],n[1]=255*i[1],n[2]=255*i[2],n[3]=null!=r?255*r:255,s.putImageData(t,e.x,e.y)},clear:function(){var t=this._size;this.getContext(!0).clearRect(0,0,t.width+1,t.height+1)},createImageData:function(){var t=j.read(arguments);return this.getContext().createImageData(t.width,t.height)},getImageData:function(){var t=C.read(arguments);return t.isEmpty()&&(t=new C(this._size)),this.getContext().getImageData(t.x,t.y,t.width,t.height)},putImageData:function(t){var e=Gt.read(arguments,1);this.getContext(!0).putImageData(t,e.x,e.y)},setImageData:function(t){this.setSize(t),this.getContext(!0).putImageData(t,0,0)},_getBounds:function(t,e){var n=new C(this._size).setCenter(0,0);return t?t._transformBounds(n):n},_hitTestSelf:function(t){if(this._contains(t)){var e=this;return new q("pixel",e,{offset:t.add(e._size.divide(2)).round(),color:{get:function(){return e.getPixel(this.offset)}}})}},_draw:function(t,e,n){var i,r=this.getElement();e.dontFinish||e.clip?(i=this.getInternalBounds(),e.dontStart||t.beginPath(),t.rect(i.x,i.y,i.width,i.height)):r&&0<r.width&&0<r.height&&(t.globalAlpha=Ut.clamp(this._opacity,0,1),this._setStyles(t,e,n),e=this._smoothing,R.setPrefixed(t,(n="off"===e)?"imageSmoothingEnabled":"imageSmoothingQuality",!n&&e),t.drawImage(r,-this._size.width/2,-this._size.height/2))},_canComposite:function(){return!0}}),h=A.extend({_class:"SymbolItem",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!0},_serializeFields:{symbol:null},initialize:function(t,e){this._initialize(t,e!==Wt&&Gt.read(arguments,1))||this.setDefinition(t instanceof y?t:new y(t))},_equals:function(t){return this._definition===t._definition},copyContent:function(t){this.setDefinition(t._definition)},getDefinition:function(){return this._definition},setDefinition:function(t){this._definition=t,this._changed(9)},getSymbol:"#getDefinition",setSymbol:"#setDefinition",isEmpty:function(){return this._definition._item.isEmpty()},_getBounds:function(t,e){var n=this._definition._item;return n._getCachedBounds(n._matrix.prepended(t),e)},_hitTestSelf:function(t,e,n){e=e.extend({all:!1,match:null,class:null,type:null}),n=this._definition._item._hitTest(t,e,n);return n&&(n.item=this),n},_draw:function(t,e){this._definition._item.draw(t,e.extend({updateMatrix:!1}))}}),y=O.extend({_class:"SymbolDefinition",initialize:function(t,e){this._id=o.get(),this.project=te.project,t&&this.setItem(t,e)},_serialize:function(t,e){return e.add(this,function(){return O.serialize([this._class,this._item],t,!1,e)})},_changed:function(t){8&t&&A._clearBoundsCache(this),1&t&&this.project._changed(t)},getItem:function(){return this._item},setItem:function(t,e){t._symbol&&(t=t.clone()),this._item&&(this._item._symbol=null),(this._item=t).remove(),t.setSelected(!1),e||t.setPosition(new Gt),(t._symbol=this)._changed(9)},getDefinition:"#getItem",setDefinition:"#setItem",place:function(t){return new h(this,t)},clone:function(){return new y(this._item.clone(!1))},equals:function(t){return t===this||t&&this._item.equals(t._item)||!1}}),q=O.extend({_class:"HitResult",initialize:function(t,e,n){this.type=t,this.item=e,n&&this.inject(n)},statics:{getOptions:function(t){t=t&&O.read(t);return new O({type:null,tolerance:te.settings.hitTolerance,fill:!t,stroke:!t,segments:!t,handles:!1,ends:!1,position:!1,center:!1,bounds:!1,guides:!1,selected:!1},t)}}}),L=O.extend({_class:"Segment",beans:!0,_selection:0,initialize:function(t,e,n,i,r,s){var a,o,h,u,l=arguments.length;0<l&&(null==t||"object"==typeof t?u=1===l&&t&&"point"in t?(a=t.point,o=t.handleIn,h=t.handleOut,t.selection):(a=t,o=e,h=n,i):(a=[t,e],o=n!==Wt?[n,i]:null,h=r!==Wt?[r,s]:null)),new g(a,this,"_point"),new g(o,this,"_handleIn"),new g(h,this,"_handleOut"),u&&this.setSelection(u)},_serialize:function(t,e){var n=this._point,i=this._selection,n=i||this.hasHandles()?[n,this._handleIn,this._handleOut]:n;return i&&n.push(i),O.serialize(n,t,!0,e)},_changed:function(t){var e,n,i,r=this._path;r&&(e=r._curves,n=this._index,e&&(t&&t!==this._point&&t!==this._handleIn||!(i=0<n?e[n-1]:r._closed?e[e.length-1]:null)||i._changed(),t&&t!==this._point&&t!==this._handleOut||!(i=e[n])||i._changed()),r._changed(41))},getPoint:function(){return this._point},setPoint:function(){this._point.set(Gt.read(arguments))},getHandleIn:function(){return this._handleIn},setHandleIn:function(){this._handleIn.set(Gt.read(arguments))},getHandleOut:function(){return this._handleOut},setHandleOut:function(){this._handleOut.set(Gt.read(arguments))},hasHandles:function(){return!this._handleIn.isZero()||!this._handleOut.isZero()},isSmooth:function(){var t=this._handleIn,e=this._handleOut;return!t.isZero()&&!e.isZero()&&t.isCollinear(e)},clearHandles:function(){this._handleIn._set(0,0),this._handleOut._set(0,0)},getSelection:function(){return this._selection},setSelection:function(t){var e=this._selection,n=this._path;this._selection=t=t||0,n&&t!==e&&(n._updateSelection(this,e,t),n._changed(257))},_changeSelection:function(t,e){var n=this._selection;this.setSelection(e?n|t:n&~t)},isSelected:function(){return!!(7&this._selection)},setSelected:function(t){this._changeSelection(7,t)},getIndex:function(){return this._index!==Wt?this._index:null},getPath:function(){return this._path||null},getCurve:function(){var t=this._path,e=this._index;return t?(0<e&&!t._closed&&e===t._segments.length-1&&e--,t.getCurves()[e]||null):null},getLocation:function(){var t=this.getCurve();return t?new Kt(t,this===t._segment1?0:1):null},getNext:function(){var t=this._path&&this._path._segments;return t&&(t[this._index+1]||this._path._closed&&t[0])||null},smooth:function(t,e,n){var i=t||{},r=i.type,s=i.factor,a=this.getPrevious(),o=this.getNext(),h=(a||this)._point,u=this._point,l=(o||this)._point,c=h.getDistance(u),t=u.getDistance(l);if(r&&"catmull-rom"!==r){if("geometric"!==r)throw new Error("Smoothing method '"+r+"' not supported.");a&&o&&(i=h.subtract(l),r=(g=s===Wt?.4:s)*c/(c+t),e||this.setHandleIn(i.multiply(r)),n||this.setHandleOut(i.multiply(r-g)))}else{var f,d,g=s===Wt?.5:s,s=Math.pow(c,g),c=s*s,t=Math.pow(t,g),g=t*t;!e&&a&&(f=2*g+3*t*s+c,this.setHandleIn(0!==(d=3*t*(t+s))?new Gt((g*h._x+f*u._x-c*l._x)/d-u._x,(g*h._y+f*u._y-c*l._y)/d-u._y):new Gt)),!n&&o&&(f=2*c+3*s*t+g,this.setHandleOut(0!==(d=3*s*(s+t))?new Gt((c*l._x+f*u._x-g*h._x)/d-u._x,(c*l._y+f*u._y-g*h._y)/d-u._y):new Gt))}},getPrevious:function(){var t=this._path&&this._path._segments;return t&&(t[this._index-1]||this._path._closed&&t[t.length-1])||null},isFirst:function(){return!this._index},isLast:function(){var t=this._path;return t&&this._index===t._segments.length-1||!1},reverse:function(){var t=this._handleIn,e=this._handleOut,n=t.clone();t.set(e),e.set(n)},reversed:function(){return new L(this._point,this._handleOut,this._handleIn)},remove:function(){return!!this._path&&!!this._path.removeSegment(this._index)},clone:function(){return new L(this._point,this._handleIn,this._handleOut)},equals:function(t){return t===this||t&&this._class===t._class&&this._point.equals(t._point)&&this._handleIn.equals(t._handleIn)&&this._handleOut.equals(t._handleOut)||!1},toString:function(){var t=["point: "+this._point];return this._handleIn.isZero()||t.push("handleIn: "+this._handleIn),this._handleOut.isZero()||t.push("handleOut: "+this._handleOut),"{ "+t.join(", ")+" }"},transform:function(t){this._transformCoordinates(t,new Array(6),!0),this._changed()},interpolate:function(t,e,n){var i=1-n,r=n,s=t._point,a=e._point,o=t._handleIn,n=e._handleIn,e=e._handleOut,t=t._handleOut;this._point._set(i*s._x+r*a._x,i*s._y+r*a._y,!0),this._handleIn._set(i*o._x+r*n._x,i*o._y+r*n._y,!0),this._handleOut._set(i*t._x+r*e._x,i*t._y+r*e._y,!0),this._changed()},_transformCoordinates:function(t,e,n){var i=this._point,r=n&&this._handleIn.isZero()?null:this._handleIn,s=n&&this._handleOut.isZero()?null:this._handleOut,a=i._x,o=i._y,h=2;return e[0]=a,e[1]=o,r&&(e[h++]=r._x+a,e[h++]=r._y+o),s&&(e[h++]=s._x+a,e[h++]=s._y+o),t&&(t._transformCoordinates(e,e,h/2),a=e[0],o=e[1],n?(i._x=a,i._y=o,h=2,r&&(r._x=e[h++]-a,r._y=e[h++]-o),s&&(s._x=e[h++]-a,s._y=e[h++]-o)):(r||(e[h++]=a,e[h++]=o),s||(e[h++]=a,e[h++]=o))),e}}),g=Gt.extend({initialize:function(t,e,n){var i,r,s;t?(i=t[0])!==Wt?r=t[1]:((i=(s=t).x)===Wt&&(i=(s=Gt.read(arguments)).x),r=s.y,s=s.selected):i=r=0,this._x=i,this._y=r,(this._owner=e)[n]=this,s&&this.setSelected(!0)},_set:function(t,e){return this._x=t,this._y=e,this._owner._changed(this),this},getX:function(){return this._x},setX:function(t){this._x=t,this._owner._changed(this)},getY:function(){return this._y},setY:function(t){this._y=t,this._owner._changed(this)},isZero:function(){var t=Ut.isZero;return t(this._x)&&t(this._y)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(t){this._owner._changeSelection(this._getSelection(),t)},_getSelection:function(){var t=this._owner;return this===t._point?1:this===t._handleIn?2:this===t._handleOut?4:0}}),$t=O.extend({_class:"Curve",beans:!0,initialize:function(t,e,n,i,r,s,a,o){var h,u,l,c,f,d,g=arguments.length;3===g?(this._path=t,h=e,u=n):g?1===g?"segment1"in t?(h=new L(t.segment1),u=new L(t.segment2)):"point1"in t?(l=t.point1,f=t.handle1,d=t.handle2,c=t.point2):Array.isArray(t)&&(l=[t[0],t[1]],c=[t[6],t[7]],f=[t[2]-t[0],t[3]-t[1]],d=[t[4]-t[6],t[5]-t[7]]):2===g?(h=new L(t),u=new L(e)):4===g?(l=t,f=e,d=n,c=i):8===g&&(l=[t,e],c=[a,o],f=[n-t,i-e],d=[r-a,s-o]):(h=new L,u=new L),this._segment1=h||new L(l,null,f),this._segment2=u||new L(c,d,null)},_serialize:function(t,e){return O.serialize(this.hasHandles()?[this.getPoint1(),this.getHandle1(),this.getHandle2(),this.getPoint2()]:[this.getPoint1(),this.getPoint2()],t,!0,e)},_changed:function(){this._length=this._bounds=Wt},clone:function(){return new $t(this._segment1,this._segment2)},toString:function(){var t=["point1: "+this._segment1._point];return this._segment1._handleOut.isZero()||t.push("handle1: "+this._segment1._handleOut),this._segment2._handleIn.isZero()||t.push("handle2: "+this._segment2._handleIn),t.push("point2: "+this._segment2._point),"{ "+t.join(", ")+" }"},classify:function(){return $t.classify(this.getValues())},remove:function(){var t,e,n=!1;return this._path&&(e=(t=this._segment2)._handleOut,(n=t.remove())&&this._segment1._handleOut.set(e)),n},getPoint1:function(){return this._segment1._point},setPoint1:function(){this._segment1._point.set(Gt.read(arguments))},getPoint2:function(){return this._segment2._point},setPoint2:function(){this._segment2._point.set(Gt.read(arguments))},getHandle1:function(){return this._segment1._handleOut},setHandle1:function(){this._segment1._handleOut.set(Gt.read(arguments))},getHandle2:function(){return this._segment2._handleIn},setHandle2:function(){this._segment2._handleIn.set(Gt.read(arguments))},getSegment1:function(){return this._segment1},getSegment2:function(){return this._segment2},getPath:function(){return this._path},getIndex:function(){return this._segment1._index},getNext:function(){var t=this._path&&this._path._curves;return t&&(t[this._segment1._index+1]||this._path._closed&&t[0])||null},getPrevious:function(){var t=this._path&&this._path._curves;return t&&(t[this._segment1._index-1]||this._path._closed&&t[t.length-1])||null},isFirst:function(){return!this._segment1._index},isLast:function(){var t=this._path;return t&&this._segment1._index===t._curves.length-1||!1},isSelected:function(){return this.getPoint1().isSelected()&&this.getHandle1().isSelected()&&this.getHandle2().isSelected()&&this.getPoint2().isSelected()},setSelected:function(t){this.getPoint1().setSelected(t),this.getHandle1().setSelected(t),this.getHandle2().setSelected(t),this.getPoint2().setSelected(t)},getValues:function(t){return $t.getValues(this._segment1,this._segment2,t)},getPoints:function(){for(var t=this.getValues(),e=[],n=0;n<8;n+=2)e.push(new Gt(t[n],t[n+1]));return e}},{getLength:function(){return null==this._length&&(this._length=$t.getLength(this.getValues(),0,1)),this._length},getArea:function(){return $t.getArea(this.getValues())},getLine:function(){return new D(this._segment1._point,this._segment2._point)},getPart:function(t,e){return new $t($t.getPart(this.getValues(),t,e))},getPartLength:function(t,e){return $t.getLength(this.getValues(),t,e)},divideAt:function(t){return this.divideAtTime(t&&t.curve===this?t.time:this.getTimeAt(t))},divideAtTime:function(t){var e,n,i,r,s,a,o,h=null;return 1e-8<=t&&t<=1-1e-8&&(e=(o=$t.subdivide(this.getValues(),t))[0],n=o[1],i=this.hasHandles(),r=this._segment1,s=this._segment2,a=this._path,i&&(r._handleOut._set(e[2]-e[0],e[3]-e[1]),s._handleIn._set(n[4]-n[6],n[5]-n[7])),t=e[6],o=e[7],o=new L(new Gt(t,o),i&&new Gt(e[4]-t,e[5]-o),i&&new Gt(n[2]-t,n[3]-o)),h=a?(a.insert(r._index+1,o),this.getNext()):(this._segment2=o,this._changed(),new $t(o,s))),h},splitAt:function(t){var e=this._path;return e?e.splitAt(t):null},splitAtTime:function(t){return this.splitAt(this.getLocationAtTime(t))},divide:function(t,e){return this.divideAtTime(t===Wt?.5:e?t:this.getTimeAt(t))},split:function(t,e){return this.splitAtTime(t===Wt?.5:e?t:this.getTimeAt(t))},reversed:function(){return new $t(this._segment2.reversed(),this._segment1.reversed())},clearHandles:function(){this._segment1._handleOut._set(0,0),this._segment2._handleIn._set(0,0)},statics:{getValues:function(t,e,n,i){var r=t._point,s=t._handleOut,a=e._handleIn,o=e._point,t=r.x,e=r.y,r=o.x,o=o.y,o=i?[t,e,t,e,r,o,r,o]:[t,e,t+s._x,e+s._y,r+a._x,o+a._y,r,o];return n&&n._transformCoordinates(o,o,4),o},subdivide:function(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],h=t[6],u=t[7],l=1-(e=e===Wt?.5:e),c=l*n+e*r,f=l*i+e*s,d=l*r+e*a,g=l*s+e*o,t=l*a+e*h,r=l*o+e*u,s=l*c+e*d,a=l*f+e*g,o=l*d+e*t,d=l*g+e*r,g=l*s+e*o,e=l*a+e*d;return[[n,i,c,f,s,a,g,e],[g,e,o,d,t,r,h,u]]},getMonoCurves:function(t,e){var n,i,r=[],s=e?0:1,a=t[0+s],o=t[2+s],e=t[4+s],s=t[6+s];return!(o<=a==e<=o&&e<=o==s<=e||$t.isStraight(t))&&(i=Ut.solveQuadratic(3*(o-e)-a+s,2*(a+e)-4*o,o-a,n=[],1e-8,1-1e-8))?(n.sort(),o=n[0],a=$t.subdivide(t,o),r.push(a[0]),1<i&&(o=(n[1]-o)/(1-o),a=$t.subdivide(a[1],o),r.push(a[0])),r.push(a[1])):r.push(t),r},solveCubic:function(t,e,n,i,r,s){var a=t[e],o=t[e+2],h=t[e+4],t=t[e+6],e=0;return e=!(a<n&&t<n&&o<n&&h<n||n<a&&n<t&&n<o&&n<h)?Ut.solveCubic(t-a-(t=3*(o-a))-(o=3*(h-o)-t),o,t,a-n,i,r,s):e},getPart:function(t,e,n){var i,r=n<e;return r&&(i=e,e=n,n=i),0<e&&(t=$t.subdivide(t,e)[1]),n<1&&(t=$t.subdivide(t,(n-e)/(1-e))[0]),r?[t[6],t[7],t[4],t[5],t[2],t[3],t[0],t[1]]:t},isFlatEnough:function(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],h=t[6],t=t[7],r=3*r-2*n-h,s=3*s-2*i-t,n=3*a-2*h-n,i=3*o-2*t-i;return Math.max(r*r,n*n)+Math.max(s*s,i*i)<=16*e*e},getArea:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],t=t[7];return 3*((t-n)*(i+s)-(o-e)*(r+a)+r*(e-s)-i*(n-a)+t*(s+e/3)-o*(a+n/3))/20},_addBounds:function(t,e,n,i,r,s,a,o,h){function u(t,e){var n=t-e,e=t+e;n<a[r]&&(a[r]=n),e>o[r]&&(o[r]=e)}var l=a[r]+s,c=o[r]-s;if(t<l||e<l||n<l||i<l||c<t||c<e||c<n||c<i)if(e<t!=e<i&&n<t!=n<i)u(t,0),u(i,0);else{var f=Ut.solveQuadratic(3*(e-n)-t+i,2*(t+n)-4*e,e-t,h);u(i,0);for(var d=0;d<f;d++){var g=h[d],_=1-g;1e-8<=g&&g<=1-1e-8&&u(_*_*_*t+3*_*_*g*e+3*_*g*g*n+g*g*g*i,s)}}}}},O.each(["getBounds","getStrokeBounds"],function(n){this[n]=function(){this._bounds||(this._bounds={});var t,e=this._bounds[n];return e||(t=this._path,e=this._bounds[n]=V[t?n:"getBounds"]([this._segment1,this._segment2],!1,t)),e.clone()}},{getHandleBounds:function(){var t=this.getValues(),e=Math.min(t[0],t[2],t[4],t[6]),n=Math.min(t[1],t[3],t[5],t[7]),i=Math.max(t[0],t[2],t[4],t[6]),t=Math.max(t[1],t[3],t[5],t[7]);return new C(e,n,i-e,t-n)}}),O.each({isStraight:function(t,e,n,i,r,s,a,o){var h=Ut.isZero;if(h(n)&&h(i)&&h(r)&&h(s))return!0;var u=Gt.isCollinear,l=a-t,c=o-e;if(h(l)&&h(c))return!1;if(u(l,c,n,i)&&u(l,c,r,s)){u=D.getDistance;if(u(t,e,l,c,t+n,e+i,!0)<1e-7&&u(t,e,l,c,a+r,o+s,!0)<1e-7){o=l*l+c*c,i=(l*n+c*i)/o,o=(l*r+c*s)/o;return 0<=i&&i<=1&&o<=0&&-1<=o}}return!1},isLinear:function(t,e,n,i,r,s,a,o){t=(a-t)/3,e=(o-e)/3;return n===t&&i===e&&-r==t&&-s==e}},function(a,t){this[t]=function(t){var e=this._segment1._point,n=this._segment1._handleOut,i=this._segment2._handleIn,r=this._segment2._point;return a(e._x,e._y,n._x,n._y,i._x,i._y,r._x,r._y,t)},this.statics[t]=function(t,e){var n=t[0],i=t[1],r=t[6],s=t[7];return a(n,i,t[2]-n,t[3]-i,t[4]-r,t[5]-s,r,s,e)}},{statics:{},hasHandles:function(){return!this._segment1._handleOut.isZero()||!this._segment2._handleIn.isZero()},hasLength:function(t){return(!this.getPoint1().equals(this.getPoint2())||this.hasHandles())&&this.getLength()>(t||0)},isCollinear:function(t){return t&&this.isStraight()&&t.isStraight()&&this.getLine().isCollinear(t.getLine())},isHorizontal:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).y)<1e-8},isVertical:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).x)<1e-8}}),{beans:!1,getLocationAt:function(t,e){return this.getLocationAtTime(e?t:this.getTimeAt(t))},getLocationAtTime:function(t){return null!=t&&0<=t&&t<=1?new Kt(this,t):null},getTimeAt:function(t,e){return $t.getTimeAt(this.getValues(),t,e)},getParameterAt:"#getTimeAt",getTimesWithTangent:function(){var t=Gt.read(arguments);return t.isZero()?[]:$t.getTimesWithTangent(this.getValues(),t)},getOffsetAtTime:function(t){return this.getPartLength(0,t)},getLocationOf:function(){return this.getLocationAtTime(this.getTimeOf(Gt.read(arguments)))},getOffsetOf:function(){var t=this.getLocationOf.apply(this,arguments);return t?t.getOffset():null},getTimeOf:function(){return $t.getTimeOf(this.getValues(),Gt.read(arguments))},getParameterOf:"#getTimeOf",getNearestLocation:function(){var t=Gt.read(arguments),e=this.getValues(),n=$t.getNearestTime(e,t),e=$t.getPoint(e,n);return new Kt(this,n,e,null,t.getDistance(e))},getNearestPoint:function(){var t=this.getNearestLocation.apply(this,arguments);return t&&t.getPoint()}},new function(){var t=["getPoint","getTangent","getNormal","getWeightedTangent","getWeightedNormal","getCurvature"];return O.each(t,function(i){this[i+"At"]=function(t,e){var n=this.getValues();return $t[i](n,e?t:$t.getTimeAt(n,t))},this[i+"AtTime"]=function(t){return $t[i](this.getValues(),t)}},{statics:{_evaluateMethods:t}})},new function(){function l(t){var t=S(t),n=3*t[0],i=2*t[1],r=t[2],s=3*t[3],a=2*t[4],o=t[5];return function(t){var e=(n*t+i)*t+r,t=(s*t+a)*t+o;return Math.sqrt(e*e+t*t)}}function c(t,e){return Math.max(2,Math.min(16,Math.ceil(32*Math.abs(e-t))))}function S(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],h=t[7],u=Ut.isZero;u(i-e)&&u(r-n)&&(i=e,r=n),u(s-o)&&u(a-h)&&(s=o,a=h);var l=3*(i-e),c=3*(s-i)-l,t=3*(r-n),u=3*(a-r)-t;return[o-e-l-c,c,l,h-n-t-u,u,t,i,r,s,a]}function C(t,e,n,i,r,s){return 0===s?t:1===s?e:((n*s+i)*s+r)*s+t}function n(t,e,n,i){if(null==e||e<0||1<e)return null;var r,s,a=t[0],o=t[1],h=t[6],u=t[7],l=S(t),c=l[0],f=l[1],d=l[2],g=l[3],_=l[4],p=l[5],v=l[6],m=l[7],t=l[8],l=l[9];return 0===n?(r=C(a,h,c,f,d,e),s=C(o,u,g,_,p,e)):(0,s=e<1e-8?(r=d,p):1-1e-8<e?(r=3*(h-t),3*(u-l)):(r=(3*c*e+2*f)*e+d,(3*g*e+2*_)*e+p),i&&(0===r&&0===s&&(e<1e-8||1-1e-8<e)&&(r=t-v,s=l-m),(m=Math.sqrt(r*r+s*s))&&(r/=m,s/=m)),3===n&&(t=6*c*e+2*f,l=6*g*e+2*_,r=0!==(_=Math.pow(r*r+s*s,1.5))?(r*l-s*t)/_:0,s=0)),2===n?new Gt(s,-r):new Gt(r,s)}return{statics:{classify:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],h=t[7],u=i*(n-h)+r*(o-e)+e*h-n*o,l=3*(s*(r-n)+a*(e-i)+i*n-r*e),c=l-u,t=c-u+(e*(h-a)+n*(s-o)+o*a-h*s),u=Math.sqrt(t*t+c*c+l*l),o=Math.max(Math.abs(e),Math.abs(n),Math.abs(i),Math.abs(r),Math.abs(s),Math.abs(a),Math.abs(o),Math.abs(h)),h=u>o*Ut.getEpsilon(o)?1/u:0,o=Ut.isZero,u="serpentine";function f(t,e,n){var i=e!==Wt,r=i&&1e-8<e&&e<1-1e-8,s=i&&1e-8<n&&n<1-1e-8;return!i||(r||s)&&("loop"!==t||r&&s)||(r=s=!(t="arch")),{type:t,roots:r||s?r&&s?e<n?[e,n]:[n,e]:[r?e:n]:null}}if(c*=h,l*=h,o(t*=h))return o(c)?f(o(l)?"line":"quadratic"):f(u,l/(3*c));l=3*c*c-4*t*l;if(o(l))return f("cusp",c/(2*t));o=0<l?Math.sqrt(l/3):Math.sqrt(-l),t*=2;return f(0<l?u:"loop",(c+o)/t,(c-o)/t)},getLength:function(t,e,n,i){if(e===Wt&&(e=0),n===Wt&&(n=1),$t.isStraight(t)){var r=t;n<1&&(r=$t.subdivide(r,n)[0],e/=n);var s=(r=0<e?$t.subdivide(r,e)[1]:r)[6]-r[0],r=r[7]-r[1];return Math.sqrt(s*s+r*r)}return Ut.integrate(i||l(t),e,n,c(e,n))},getTimeAt:function(t,e,n){if(n===Wt&&(n=e<0?1:0),0===e)return n;var i=Math.abs,r=0<e,s=r?n:0,a=r?1:n,o=l(t),h=$t.getLength(t,s,a,o),t=i(e)-h;if(i(t)<1e-12)return r?a:s;if(1e-12<t)return null;var u=0;return Ut.findRoot(function(t){return u+=Ut.integrate(o,n,t,c(n,t)),n=t,u-e},o,n+e/h,s,a,32,1e-12)},getTimeOf:function(t,e,n){var i=Math.abs,r=t[0],s=t[1],a=t[6],o=t[7],h=e.x,u=e.y,l=n||Ut.getEpsilon(Math.max(i(r),i(s),i(t[2]),i(t[3]),i(t[4]),i(t[5]),i(a),i(o)),1e-7);function c(t,e){t-=h,e-=u;return Math.sqrt(t*t+e*e)<=l}if(c(r,s))return 0;if(c(a,o))return 1;for(var i=S(t),f=i[0],d=i[1],g=i[2],_=i[3],p=i[4],v=i[5],m=[],y=0;y<2;y++)for(var w=$t.solveCubic(t,y,y?u:h,m,0,1),x=0;x<w;x++){var b=m[x];if(c(C(r,a,f,d,g,b),C(s,o,_,p,v,b)))return b}return null},getNearestTime:function(t,e){var i=t[0],r=t[1],s=t[6],a=t[7],o=e.x,h=e.y;if($t.isStraight(t)){var n=s-i,u=a-r,e=n*n+u*u;if(0==e)return 0;e=((o-i)*n+(h-r)*u)/e;return e<1e-12?0:.999999999999<e?1:$t.getTimeOf(t,new Gt(i+e*n,r+e*u))}var t=S(t),l=t[0],c=t[1],f=t[2],d=t[3],g=t[4],_=t[5],p=1/0,v=0;function m(t){if(0<=t&&t<=1){var e=C(i,s,l,c,f,t)-o,n=C(r,a,d,g,_,t)-h,n=e*e+n*n;return n<p?(p=n,v=t,1):void 0}}for(var y=0;y<=100;y++)m(y/100);for(var w=.005;1e-8<w;)m(v-w)||m(v+w)||(w/=2);return v},getPoint:function(t,e){return n(t,e,0,!1)},getTangent:function(t,e){return n(t,e,1,!0)},getWeightedTangent:function(t,e){return n(t,e,1,!1)},getNormal:function(t,e){return n(t,e,2,!0)},getWeightedNormal:function(t,e){return n(t,e,2,!1)},getCurvature:function(t,e){return n(t,e,3,!1).x},getPeaks:function(t){var e=S(t),n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],t=e[5],e=[];return Ut.solveCubic(9*(n*n+s*s),9*(n*i+a*s),2*(i*i+a*a)+3*(r*n+t*s),r*i+a*t,e,1e-8,1-1e-8),e.sort()},getTimesWithTangent:function(t,e){var n,i=S(t),r=3*i[0],s=2*i[1],a=i[2],o=3*i[3],h=2*i[4],u=i[5],l=e.normalize(),t=l.x,i=l.y,e=2*r*i-2*o*t,l=[];return Math.abs(e)<Ut.CURVETIME_EPSILON?0==(e=s*i-h*t)||0<=(n=-(a*i-u*t)/e)&&n<=1&&l.push(n):(n=s*i-h*t,0<=(u=(s*s-4*r*a)*i*i+(-2*s*h+4*o*a+4*r*u)*t*i+(h*h-4*o*u)*t*t)&&0!=e&&(u=(-n+(t=Math.sqrt(u)))/e,0<=(e=-(n+t)/e)&&e<=1&&l.push(e),0<=u&&u<=1&&l.push(u))),l}}}},new function(){function O(t,e,n,i,r,s,a){var o=!a&&n.getPrevious()===r,h=!a&&n!==r&&n.getNext()===r;null!==i&&(o?1e-8:0)<=i&&i<=(h?1-1e-8:1)&&null!==s&&(h?1e-8:0)<=s&&s<=(o?1-1e-8:1)&&(i=new Kt(n,i,null,a),a=new Kt(r,s,null,a),(i._intersection=a)._intersection=i,e&&!e(i)||Kt.insert(t,i,!0))}function A(t,e,n,i,r,s,a,o,h,u,l,c,f,d){if(4096<=++h||40<=++o)return h;var g=e[0],_=e[1],p=e[6],v=e[7],m=D.getSignedDistance,y=m(g,_,p,v,e[2],e[3]),w=m(g,_,p,v,e[4],e[5]),x=0<y*w?.75:4/9,b=x*Math.min(0,y,w),S=x*Math.max(0,y,w),C=m(g,_,p,v,t[0],t[1]),M=m(g,_,p,v,t[2],t[3]),x=m(g,_,p,v,t[4],t[5]),_=m(g,_,p,v,t[6],t[7]),p=function(t,e,n,i){var r=[0,t],s=[1/3,e],a=[2/3,n],o=[1,i],e=e-(2*t+i)/3,t=n-(t+2*i)/3;o=e*t<0?[[r,s,o],[r,a,o]]:[2<=(i=e/t)?[r,s,o]:i<=.5?[r,a,o]:[r,s,a,o],[r,o]];return(e||t)<0?o.reverse():o}(C,M,x,_),v=p[0],p=p[1];if(0===y&&0===w&&0===C&&0===M&&0===x&&0===_||null==(P=R(v,p,b,S))||null==(I=R(v.reverse(),p.reverse(),b,S)))return h;var I,P,T,k,z,b=u+(l-u)*P,S=u+(l-u)*I;return Math.max(f-c,S-b)<1e-9?(T=(b+S)/2,z=(c+f)/2,O(r,s,a?i:n,a?z:T,a?n:i,a?T:z)):(t=$t.getPart(t,P,I),l=f-c,.8<I-P?(u=d&&1===S&&0===c&&n.getNext()===i,I=d&&!u&&0===b&&1===f&&n.getPrevious()===i,u||I?(I=$t.getTimeAt(t,-(P=u?d:-d)),P=$t.getTimeAt(e,P),null!==I&&null!==P&&(T=b+(S-b)*I,z=c+(f-c)*P,u?(t=$t.getPart(t,0,I),e=$t.getPart(e,P,1),S=T,c=z):(t=$t.getPart(t,I,1),e=$t.getPart(e,0,P),b=T,f=z),h=A(t,e,n,i,r,s,a,o,h,b,S,c,f,d))):d&&function(t,e,n,i,r,s,a,o,h,u,l,c){for(var f=e[0],d=e[1],g=0,_=0;_<8;_+=2)g=Math.max(g,Math.abs(t[_]-f),Math.abs(t[_+1]-d),Math.abs(e[_]-f),Math.abs(e[_+1]-d));if(g){for(var p=L(t,f,d,g),v=L(e,f,d,g),m=e[6]-3*(e[4]-e[2])-f,y=e[7]-3*(e[5]-e[3])-d,w=4/27*Math.sqrt(m*m+y*y)<=c?function(t,e){var n=B(t,e,2,1,2),i=B(t,e,2,0,1),e=B(t,e,1,0,2);return E(N(n,e),N(i,i),-1)}(p,[v[0],function(t){var e=(3*t[1].x-t[0].x)/2,n=(3*t[1].y-t[0].y)/2;return{x:e,y:n,ex:(3*t[1].ex+t[0].ex)/2+224e-18*Math.abs(e),ey:(3*t[1].ey+t[0].ey)/2+224e-18*Math.abs(n)}}(v),v[3]]):function(t,e){var n=B(t,e,3,2,3),i=B(t,e,3,1,3),r=B(t,e,3,0,1),s=B(t,e,2,1,9),a=B(t,e,2,0,3),e=B(t,e,1,0,3),s=E(r,s,1);return E(E(N(n,E(N(s,e),N(a,a),-1)),N(i,E(N(i,e),N(a,r),-1)),-1),N(r,E(N(i,a),N(s,r),-1)),1)}(p,v),x=[],b=0,_=0;_<6;_+=2)b=Math.max(b,3*Math.sqrt(Math.pow(t[_+2]-t[_],2)+Math.pow(t[_+3]-t[_+1],2)));if(w.coefficients.every(function(t,e){return Math.abs(t)<=w.errors[e]}))return!1;for(var S=Ut.solveBernstein(w.coefficients,w.errors,x,b?c/b:1),_=0;_<S;_++){var C=x[_],M=$t.getTimeOf(e,$t.getPoint(t,C),c);null!==M&&(C=o+(h-o)*C,M=u+(l-u)*M,O(r,s,a?i:n,a?M:C,a?n:i,a?C:M))}return!0}return!1}(t,e,n,i,r,s,a,b,S,c,f,d)||(h=l<S-b?(h=A(e,(k=$t.subdivide(t,.5))[0],i,n,r,s,!a,o,h,c,f,b,T=(b+S)/2,d),A(e,k[1],i,n,r,s,!a,o,h,c,f,T,S,d)):(h=A((k=$t.subdivide(e,.5))[0],t,i,n,r,s,!a,o,h,c,z=(c+f)/2,b,S,d),A(k[1],t,i,n,r,s,!a,o,h,z,f,b,S,d)))):h=0==l||1e-9<=l?A(e,t,i,n,r,s,!a,o,h,c,f,b,S,d):A(t,e,n,i,r,s,a,o,h,b,S,c,f,d)),h}function L(t,e,n,i){for(var r=[],s=0;s<8;s+=2){var a=(t[s]-e)/i,o=(t[s+1]-n)/i;r.push({x:a,y:o,ex:224e-18*Math.abs(a),ey:224e-18*Math.abs(o)})}return r}function _(t,e,n,i){return Math.abs(t)*i+Math.abs(n)*e+e*i+112e-18*Math.abs(t*n)}function B(t,e,n,i,r){for(var s=112e-18,a=[],o=[],h=0;h<4;h++){var u=t[h],l=e[n].x-u.x,c=e[i].y-u.y,f=e[i].x-u.x,d=e[n].y-u.y,g=_(l,e[n].ex+u.ex+s*Math.abs(l),c,e[i].ey+u.ey+s*Math.abs(c)),u=_(f,e[i].ex+u.ex+s*Math.abs(f),d,e[n].ey+u.ey+s*Math.abs(d)),f=l*c-f*d,d=r*f;a.push(d),o.push(r*(g+u+s*Math.abs(f))+s*Math.abs(d))}return{coefficients:a,errors:o}}for(var p=[[1]],t=1;t<=9;t++){for(var e=[1],n=1;n<t;n++)e.push(p[t-1][n-1]+p[t-1][n]);e.push(1),p.push(e)}function N(t,e){for(var n=t.coefficients.length-1,i=e.coefficients.length-1,r=[],s=[],a=0;a<=n+i;a++){for(var o=0,h=0,u=Math.max(0,a-i),l=Math.min(n,a);u<=l;u++){var c=p[n][u]*p[i][a-u]/p[n+i][a],f=t.coefficients[u],d=e.coefficients[a-u],g=f*d*c;o+=g,h+=c*_(f,t.errors[u],d,e.errors[a-u])+112e-18*(2*Math.abs(g)+Math.abs(o))}r.push(o),s.push(h)}return{coefficients:r,errors:s}}function E(t,e,n){for(var i=[],r=[],s=0,a=t.coefficients.length;s<a;s++){var o=t.coefficients[s]+n*e.coefficients[s];i.push(o),r.push(t.errors[s]+e.errors[s]+112e-18*Math.abs(o))}return{coefficients:i,errors:r}}function R(t,e,n,i){return t[0][1]<n?r(t,!0,n):e[0][1]>i?r(e,!1,i):t[0][0]}function r(t,e,n){for(var i=t[0][0],r=t[0][1],s=1,a=t.length;s<a;s++){var o=t[s][0],h=t[s][1];if(e?n<=h:h<=n)return h===n?o:i+(n-r)*(o-i)/(h-r);i=o,r=h}return null}function k(t,e,n,i,r,s,a){for(var o=e[0],h=e[1],u=function(t,e,n,i,r){var s=Ut.isZero;if(s(i)&&s(r)){s=$t.getTimeOf(t,new Gt(e,n));return null===s?[]:[s]}for(var i=Math.atan2(-r,i),a=Math.sin(i),o=Math.cos(i),h=[],i=[],u=0;u<8;u+=2){var l=t[u]-e,c=t[u+1]-n;h.push(l*o-c*a,l*a+c*o)}return $t.solveCubic(h,1,0,i,0,1),Math.abs(h[1])<1e-7&&i.push(0),Math.abs(h[7])<1e-7&&i.push(1),i}(t,o,h,e[6]-o,e[7]-h),l=0,c=u.length;l<c;l++){var f=u[l],d=$t.getPoint(t,f),d=$t.getTimeOf(e,d);null!==d&&O(r,s,a?i:n,a?d:f,a?n:i,a?f:d)}}function S(t,e,n,i,r,s,a){var o=Math.min,h=Math.max,u=Math.abs,l=o(t[0],t[2],t[4],t[6]),c=h(t[0],t[2],t[4],t[6]),f=o(t[1],t[3],t[5],t[7]),d=h(t[1],t[3],t[5],t[7]),g=o(e[0],e[2],e[4],e[6]),_=h(e[0],e[2],e[4],e[6]),p=o(e[1],e[3],e[5],e[7]),v=h(e[1],e[3],e[5],e[7]),m=Ut.getEpsilon(h(u(l),u(c),u(f),u(d),u(g),u(_),u(p),u(v))),y=h(m,a||1e-7);if(g<c+y&&l-y<_&&p<d+y&&f-y<v){var w=z(t,e,a);if(w)for(var x=0;x<2;x++){var b=w[x];O(r,s,n,b[0],i,b[1],!0)}else{var S=$t.isStraight(t),o=$t.isStraight(e),u=S&&o,h=S&&!o,y=r.length;if((u?function(t,e,n,i,r,s){var a=D.intersect(t[0],t[1],t[6],t[7],e[0],e[1],e[6],e[7]);a&&O(r,s,n,$t.getTimeOf(t,a),i,$t.getTimeOf(e,a))}:S||o?k:A)(h?e:t,h?t:e,h?i:n,h?n:i,r,s,h,0,0,0,1,0,1,a),!u||r.length===y)for(var C=a||m,x=0;x<4;x++){var M=x>>1,I=1&x,P=M?e:t,T=P[6*I],P=P[6*I+1];!(M?l-C<=T&&T<=c+C&&f-C<=P&&P<=d+C:g-C<=T&&T<=_+C&&p-C<=P&&P<=v+C)||null!==(P=$t.getTimeOf(M?t:e,new Gt(T,P),C))&&O(r,s,n,M?P:I,i,M?I:P)}}}return r}function C(t,e,n,i){t=$t.classify(t);return"loop"===t.type&&O(n,i,e,(t=t.roots)[0],e,t[1]),n}function z(t,e,n){function i(t){var e=t[6]-t[0],t=t[7]-t[1];return e*e+t*t}var r=Math.abs,s=D.getDistance,a=n||1e-7,o=$t.isStraight(t),h=$t.isStraight(e),u=o&&h,l=i(t)<i(e),c=l?e:t,f=l?t:e,d=c[0],g=c[1],n=c[6]-d,l=c[7]-g;if(s(d,g,n,l,f[0],f[1],!0)<a&&s(d,g,n,l,f[6],f[7],!0)<a)!u&&s(d,g,n,l,c[2],c[3],!0)<a&&s(d,g,n,l,c[4],c[5],!0)<a&&s(d,g,n,l,f[2],f[3],!0)<a&&s(d,g,n,l,f[4],f[5],!0)<a&&(o=h=u=!0);else if(u)return null;if(o^h)return null;for(var _=[t,e],p=[],v=0;v<4&&p.length<2;v++){var m=1&v,y=1^m,w=v>>1,y=$t.getTimeOf(_[m],new Gt(_[y][w?6:0],_[y][w?7:1]),a);if(null!=y&&(w=m?[w,y]:[y,w],(!p.length||1e-8<r(w[0]-p[0][0])&&1e-8<r(w[1]-p[0][1]))&&p.push(w)),2<v&&!p.length)break}return 2!==p.length?p=null:u||(t=$t.getPart(t,p[0][0],p[1][0]),(r((e=$t.getPart(e,p[0][1],p[1][1]))[2]-t[2])>a||r(e[3]-t[3])>a||r(e[4]-t[4])>a||r(e[5]-t[5])>a)&&(p=null)),p}return{getIntersections:function(t){var e=this.getValues(),n=t&&t!==this&&t.getValues();return n?S(e,n,this,t,[]):C(e,this,[])},statics:{getOverlaps:z,getIntersections:function(t,e,n,i,r,s,a,o){for(var h=!e,u=t.length,l=(e=h?t:e).length,c=new Array(u),f=h?c:new Array(l),d=[],g=0;g<u;g++)c[g]=t[g].getValues(i);if(!h)for(g=0;g<l;g++)f[g]=e[g].getValues(r);for(var _=o||Zt.findCurveBoundsCollisions(c,f,a||1e-7),p=0;p<u;p++){var v=t[p],m=c[p];h&&C(m,v,d,n);var y=_[p];if(y)for(var w=0;w<y.length;w++){if(s&&d.length)return d;var x,b=y[w];(!h||p<b)&&(x=e[b],S(m,f[b],v,x,d,n,a))}}return d}}}}),Kt=O.extend({_class:"CurveLocation",initialize:function(t,e,n,i,r){var s;.99999999<=e&&((s=t.getNext())&&(e=0,t=s)),this._setCurve(t),this._time=e,this._point=n||t.getPointAtTime(e),this._overlap=i,this._distance=r,this._intersection=null},_setPath:function(t){this._path=t,this._version=t?t._version:0},_setCurve:function(t){this._setPath(t._path),this._curve=t,this._segment=null,this._segment1=t._segment1,this._segment2=t._segment2},_setSegment:function(t){var e=t.getCurve();e?this._setCurve(e):(this._setPath(t._path),this._segment1=t,this._segment2=null),this._segment=t,this._time=t===this._segment1?0:1,this._point=t._point.clone()},getSegment:function(){var t,e,n=this._segment;return n||(t=this.getCurve(),0===(e=this.getTime())?n=t._segment1:1===e?n=t._segment2:null!=e&&(n=t.getPartLength(0,e)<t.getPartLength(e,1)?t._segment1:t._segment2),this._segment=n),n},getCurve:function(){var t=this._path,e=this;function n(t){t=t&&t.getCurve();if(t&&null!=(e._time=t.getTimeOf(e._point)))return e._setCurve(t),t}return t&&t._version!==this._version&&(this._time=this._offset=this._curveOffset=this._curve=null),this._curve||n(this._segment)||n(this._segment1)||n(this._segment2.getPrevious())},getPath:function(){var t=this.getCurve();return t&&t._path},getIndex:function(){var t=this.getCurve();return t&&t.getIndex()},getTime:function(){var t=this.getCurve(),e=this._time;return t&&null==e?this._time=t.getTimeOf(this._point):e},getParameter:"#getTime",getPoint:function(){return this._point},getOffset:function(){if(null==(t=this._offset)){var t=0,e=this.getPath(),n=this.getIndex();if(e&&null!=n)for(var i=e.getCurves(),r=0;r<n;r++)t+=i[r].getLength();this._offset=t+=this.getCurveOffset()}return t},getCurveOffset:function(){var t,e,n=this._curveOffset;return null==n&&(t=this.getCurve(),e=this.getTime(),this._curveOffset=n=null!=e&&t&&t.getPartLength(0,e)),n},getIntersection:function(){return this._intersection},getDistance:function(){return this._distance},divide:function(){var t=this.getCurve(),t=t&&t.divideAtTime(this.getTime());return t&&this._setSegment(t._segment1),t},split:function(){var t=this.getCurve(),e=t._path,t=t&&t.splitAtTime(this.getTime());return t&&this._setSegment(e.getLastSegment()),t},equals:function(t,e){var n,i,r,s,a=this===t;return!a&&t instanceof Kt&&(r=this.getCurve(),s=t.getCurve(),(n=r._path)===s._path&&(r=(i=Math.abs)(this.getOffset()-t.getOffset()),s=!e&&this._intersection,t=!e&&t._intersection,a=(r<1e-7||n&&i(n.getLength()-r)<1e-7)&&(!s&&!t||s&&t&&s.equals(t,!0)))),a},toString:function(){var t=[],e=this.getPoint(),n=x.instance;e&&t.push("point: "+e);e=this.getIndex();null!=e&&t.push("index: "+e);e=this.getTime();return null!=e&&t.push("time: "+n.number(e)),null!=this._distance&&t.push("distance: "+n.number(this._distance)),"{ "+t.join(", ")+" }"},isTouching:function(){var t=this._intersection;if(t&&this.getTangent().isCollinear(t.getTangent())){var e=this.getCurve(),t=t.getCurve();return!(e.isStraight()&&t.isStraight()&&e.getLine().intersect(t.getLine()))}return!1},isCrossing:function(){var t=this._intersection;if(!t)return!1;var e=this.getTime(),n=t.getTime(),i=1e-8,r=1-i,s=i<=e&&e<=r,a=i<=n&&n<=r;if(s&&a)return!this.isTouching();var o=this.getCurve(),h=o&&e<i?o.getPrevious():o,u=t.getCurve(),t=u&&n<i?u.getPrevious():u;if(r<e&&(o=o.getNext()),r<n&&(u=u.getNext()),!(h&&o&&t&&u))return!1;var l=[];function c(t,e){var n=t.getValues(),i=$t.classify(n).roots||$t.getPeaks(n),t=i.length,i=$t.getLength(n,e&&t?i[t-1]:0,!e&&t?i[0]:1);l.push(t?i:i/32)}function f(t,e,n){return e<n?e<t&&t<n:e<t||t<n}s||(c(h,!0),c(o,!1)),a||(c(t,!0),c(u,!1));i=this.getPoint(),r=Math.min.apply(Math,l),o=s?o.getTangentAtTime(e):o.getPointAt(r).subtract(i),h=s?o.negate():h.getPointAt(-r).subtract(i),u=a?u.getTangentAtTime(n):u.getPointAt(r).subtract(i),i=a?u.negate():t.getPointAt(-r).subtract(i),h=h.getAngle(),o=o.getAngle(),i=i.getAngle(),u=u.getAngle();return!!(s?f(h,i,u)^f(o,i,u)&&f(h,u,i)^f(o,u,i):f(i,h,o)^f(u,h,o)&&f(i,o,h)^f(u,o,h))},hasOverlap:function(){return!!this._overlap}},O.each($t._evaluateMethods,function(t){var n=t+"At";this[t]=function(){var t=this.getCurve(),e=this.getTime();return null!=e&&t&&t[n](e,!0)}},{preserve:!0}),new function(){function i(r,s,t){var a=r.length,e=0,n=a-1;function i(t,e){for(var n=t+e;-1<=n&&n<=a;n+=e){var i=r[(n%a+a)%a];if(!s.getPoint().isClose(i.getPoint(),1e-7))break;if(s.equals(i))return i}return null}for(;e<=n;){var o,h=e+n>>>1,u=r[h];if(t&&(o=s.equals(u)?u:i(h,-1)||i(h,1)))return s._overlap&&(o._overlap=o._intersection._overlap=!0),o;var l=s.getPath(),c=u.getPath();(l!==c?l._id-c._id:s.getIndex()+s.getTime()-(u.getIndex()+u.getTime()))<0?n=h-1:e=1+h}return r.splice(e,0,s),s}return{statics:{insert:i,expand:function(t){for(var e=t.slice(),n=t.length-1;0<=n;n--)i(e,t[n]._intersection,!1);return e}}}}),w=A.extend({_class:"PathItem",_selectBounds:!1,_canScaleStroke:!0,beans:!0,initialize:function(){},_scaleStroke:function(t){var e=this._style;this._project._scope.settings.scaleStrokes&&e.getStrokeScaling()&&e.setStrokeWidth(e.getStrokeWidth()*t._getMeanScale())},statics:{create:function(t){var e,n,i;return O.isPlainObject(t)?(n=t.segments,e=t.pathData):Array.isArray(t)?n=t:"string"==typeof t&&(e=t),n?i=(i=n[0])&&Array.isArray(i[0]):e&&(i=1<(e.match(/m/gi)||[]).length||/z\s*\S+/i.test(e)),new(i?b:V)(t)}},_asPathItem:function(){return this},isClockwise:function(){return 0<=this.getArea()},setClockwise:function(t){this.isClockwise()!=(t=!!t)&&this.reverse()},setPathData:function(t){var e,n,i=t&&t.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi),r=!1,s=new Gt,a=new Gt,o="([+-]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][+-]?\\d+)?)",h=new RegExp(o,"g"),t="([01])",u=new RegExp([o,o,o,t,t,o,o].join("[\\s,]*"),"g");function l(t,e){t=+g[t];return r&&(t+=s[e]),t}function c(t){return new Gt(l(t,"x"),l(t+1,"y"))}this.clear();for(var f=0,d=i&&i.length;f<d;f++){var g,_=i[f],p=_[0],v=p.toLowerCase(),m=(g=_.match(h))&&g.length,r=p===v;switch("z"!==e||/[mz]/.test(v)||this.moveTo(s),v){case"m":case"l":for(var y="m"===v,w=0;w<m;w+=2)this[y?"moveTo":"lineTo"](s=c(w)),y&&(a=s,y=!1);n=s;break;case"h":case"v":for(var x="h"===v?"x":"y",s=s.clone(),w=0;w<m;w++)s[x]=l(w,x),this.lineTo(s);n=s;break;case"c":for(w=0;w<m;w+=6)this.cubicCurveTo(c(w),n=c(w+2),s=c(w+4));break;case"s":for(w=0;w<m;w+=4)this.cubicCurveTo(/[cs]/.test(e)?s.multiply(2).subtract(n):s,n=c(w),s=c(w+2)),e=v;break;case"q":for(w=0;w<m;w+=4)this.quadraticCurveTo(n=c(w),s=c(w+2));break;case"t":for(w=0;w<m;w+=2)this.quadraticCurveTo(n=/[qt]/.test(e)?s.multiply(2).subtract(n):s,s=c(w)),e=v;break;case"a":for(;g=u.exec(_);)this.arcTo(s=c(6),new j(+g[1],+g[2]),+g[3],+g[5],+g[4]);break;case"z":this.closePath(1e-12),s=a}e=v}},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_contains:function(t){t=t.isInside(this.getBounds({internal:!0,handle:!0}))?this._getWinding(t):{};return t.onPath||!!("evenodd"===this.getFillRule()?1&t.windingL||1&t.windingR:t.winding)},getIntersections:function(t,e,n,i){var r=this===t||!t,s=this._matrix._orNullIfIdentity(),a=r?s:(n||t._matrix)._orNullIfIdentity(),o=!r&&this.getBounds(s),h=!r&&t.getBounds(a),n=Math.abs;return r||o.intersects(h,Ut.getEpsilon(Math.max(n(o.left),n(o.right),n(o.top),n(o.bottom),n(h.left),n(h.right),n(h.top),n(h.bottom))))?$t.getIntersections(this.getCurves(),!r&&t.getCurves(),e,s,a,i):[]},getCrossings:function(t){return this.getIntersections(t,function(t){return t.isCrossing()})},getNearestLocation:function(){for(var t=Gt.read(arguments),e=this.getCurves(),n=1/0,i=null,r=0,s=e.length;r<s;r++){var a=e[r].getNearestLocation(t);a._distance<n&&(n=a._distance,i=a)}return i},getNearestPoint:function(){var t=this.getNearestLocation.apply(this,arguments);return t&&t.getPoint()},interpolate:function(t,e,n){var i=!this._children,r=i?"_segments":"_children",s=t[r],a=e[r],o=this[r];if(!s||!a||s.length!==a.length)throw new Error("Invalid operands in interpolate() call: "+t+", "+e);var e=o.length,h=a.length;if(e<h)for(var u=i?L:V,l=e;l<h;l++)this.add(new u);else h<e&&this[i?"removeSegments":"removeChildren"](h,e);for(l=0;l<h;l++)o[l].interpolate(s[l],a[l],n);i&&(this.setClosed(t._closed),this._changed(9))},compare:function(t){var e=!1;if(t){var n=this._children||[this],i=t._children?t._children.slice():[t],r=n.length,t=i.length,s=[],a=0;e=!0;for(var o=Zt.findItemBoundsCollisions(n,i,Ut.GEOMETRIC_EPSILON),h=r-1;0<=h&&e;h--){var u=n[h],e=!1,l=o[h];if(l)for(var c=l.length-1;0<=c&&!e;c--)u.compare(i[l[c]])&&(s[l[c]]||(s[l[c]]=!0,a++),e=!0)}e=e&&a===t}return e}}),V=w.extend({_class:"Path",_serializeFields:{segments:[],closed:!1},initialize:function(t){this._closed=!1,this._segments=[],this._version=0;var e=arguments,e=Array.isArray(t)?"object"==typeof t[0]?t:e:!t||t.size!==Wt||t.x===Wt&&t.point===Wt?null:e;e&&0<e.length?this.setSegments(e):(this._curves=Wt,this._segmentSelection=0,e||"string"!=typeof t||(this.setPathData(t),t=null)),this._initialize(!e&&t)},_equals:function(t){return this._closed===t._closed&&O.equals(this._segments,t._segments)},copyContent:function(t){this.setSegments(t._segments),this._closed=t._closed},_changed:function t(e){if(t.base.call(this,e),8&e)if(this._length=this._area=Wt,32&e)this._version++;else if(this._curves)for(var n=0,i=this._curves.length;n<i;n++)this._curves[n]._changed()},getStyle:function(){var t=this._parent;return(t instanceof b?t:this)._style},getSegments:function(){return this._segments},setSegments:function(t){var e,n=this.isFullySelected(),i=t&&t.length;this._segments.length=0,this._segmentSelection=0,this._curves=Wt,i&&("boolean"==typeof(e=t[i-1])&&(this.setClosed(e),i--),this._add(L.readList(t,0,{},i))),n&&this.setFullySelected(!0)},getFirstSegment:function(){return this._segments[0]},getLastSegment:function(){return this._segments[this._segments.length-1]},getCurves:function(){var t=this._curves,e=this._segments;if(!t)for(var n=this._countCurves(),t=this._curves=new Array(n),i=0;i<n;i++)t[i]=new $t(this,e[i],e[i+1]||e[0]);return t},getFirstCurve:function(){return this.getCurves()[0]},getLastCurve:function(){var t=this.getCurves();return t[t.length-1]},isClosed:function(){return this._closed},setClosed:function(t){var e;this._closed!=(t=!!t)&&(this._closed=t,this._curves&&(e=this._curves.length=this._countCurves(),t&&(this._curves[e-1]=new $t(this,this._segments[e-1],this._segments[0]))),this._changed(41))}},{beans:!0,getPathData:function(n,t){var i,r,s,a,o,h,u,l,e=this._segments,c=e.length,f=new x(t),d=new Array(6),g=!0,_=[];function p(t,e){t._transformCoordinates(n,d),i=d[0],r=d[1],g?(_.push("M"+f.pair(i,r)),g=!1):(o=d[2],h=d[3],o===i&&h===r&&u===s&&l===a?e||(t=r-a,_.push(0==(e=i-s)?"v"+f.number(t):0==t?"h"+f.number(e):"l"+f.pair(e,t))):_.push("c"+f.pair(u-s,l-a)+" "+f.pair(o-s,h-a)+" "+f.pair(i-s,r-a))),s=i,a=r,u=d[4],l=d[5]}if(!c)return"";for(var v=0;v<c;v++)p(e[v]);return this._closed&&0<c&&(p(e[0],!0),_.push("z")),_.join("")},isEmpty:function(){return!this._segments.length},_transformContent:function(t){for(var e=this._segments,n=new Array(6),i=0,r=e.length;i<r;i++)e[i]._transformCoordinates(t,n,!0);return this._scaleStroke(t),!0},_add:function(t,e){for(var n=this._segments,i=this._curves,r=t.length,s=null==e,e=s?n.length:e,a=0;a<r;a++){var o=t[a];(o=o._path?t[a]=o.clone():o)._path=this,o._index=e+a,o._selection&&this._updateSelection(o,0,o._selection)}if(s)O.push(n,t);else{n.splice.apply(n,[e,0].concat(t));for(var a=e+r,h=n.length;a<h;a++)n[a]._index=a}if(i){var u=this._countCurves(),l=0<e&&e+r-1===u?e-1:e,s=l,c=Math.min(l+r,u);t._curves&&(i.splice.apply(i,[l,0].concat(t._curves)),s+=t._curves.length);for(a=s;a<c;a++)i.splice(a,0,new $t(this,null,null));this._adjustCurves(l,c)}return this._changed(41),t},_adjustCurves:function(t,e){for(var n,i=this._segments,r=this._curves,s=t;s<e;s++)(n=r[s])._path=this,n._segment1=i[s],n._segment2=i[s+1]||i[0],n._changed();(n=r[this._closed&&!t?i.length-1:t-1])&&(n._segment2=i[t]||i[0],n._changed()),(n=r[e])&&(n._segment1=i[e],n._changed())},_countCurves:function(){var t=this._segments.length;return!this._closed&&0<t?t-1:t},add:function(t){var e=arguments;return 1<e.length&&"number"!=typeof t?this._add(L.readList(e)):this._add([L.read(e)])[0]},insert:function(t,e){var n=arguments;return 2<n.length&&"number"!=typeof e?this._add(L.readList(n,1),t):this._add([L.read(n,1)],t)[0]},addSegment:function(){return this._add([L.read(arguments)])[0]},insertSegment:function(t){return this._add([L.read(arguments,1)],t)[0]},addSegments:function(t){return this._add(L.readList(t))},insertSegments:function(t,e){return this._add(L.readList(e),t)},removeSegment:function(t){return this.removeSegments(t,t+1)[0]||null},removeSegments:function(t,e,n){if(t=t||0,(e=O.pick(e,this._segments.length))<t&&this._closed)return this.removeSegments(t).concat(this.removeSegments(0,e));var i=this._segments,r=this._curves,s=i.length,a=i.splice(t,e-t),o=a.length;if(!o)return a;for(var h=0;h<o;h++){var u=a[h];u._selection&&this._updateSelection(u,u._selection,0),u._index=u._path=null}for(var h=t,l=i.length;h<l;h++)i[h]._index=h;if(r){for(t=0<t&&e===s+(this._closed?1:0)?t-1:t,h=(r=r.splice(t,o)).length-1;0<=h;h--)r[h]._path=null;n&&(a._curves=r.slice(1)),this._adjustCurves(t,t)}return this._changed(41),a},clear:"#removeSegments",hasHandles:function(){for(var t=this._segments,e=0,n=t.length;e<n;e++)if(t[e].hasHandles())return!0;return!1},clearHandles:function(){for(var t=this._segments,e=0,n=t.length;e<n;e++)t[e].clearHandles()},getLength:function(){if(null==this._length){for(var t=this.getCurves(),e=0,n=0,i=t.length;n<i;n++)e+=t[n].getLength();this._length=e}return this._length},getArea:function(){if(null==(n=this._area)){for(var t=this._segments,e=this._closed,n=0,i=0,r=t.length;i<r;i++){var s=i+1===r;n+=$t.getArea($t.getValues(t[i],t[s?0:i+1],null,s&&!e))}this._area=n}return n},isFullySelected:function(){var t=this._segments.length;return this.isSelected()&&0<t&&this._segmentSelection===7*t},setFullySelected:function(t){t&&this._selectSegments(!0),this.setSelected(t)},setSelection:function t(e){1&e||this._selectSegments(!1),t.base.call(this,e)},_selectSegments:function(t){var e=this._segments,n=e.length,i=t?7:0;this._segmentSelection=i*n;for(var r=0;r<n;r++)e[r]._selection=i},_updateSelection:function(t,e,n){t._selection=n,0<(this._segmentSelection+=n-e)&&this.setSelected(!0)},divideAt:function(t){var e,t=this.getLocationAt(t);return t&&(e=t.getCurve().divideAt(t.getCurveOffset()))?e._segment1:null},splitAt:function(t){var e=this.getLocationAt(t),n=e&&e.index,i=e&&e.time;1-1e-8<i&&(n++,i=0);t=this.getCurves();if(e&&n<t.length){1e-8<=i&&t[n++].divideAtTime(i);var r,n=this.removeSegments(n,this._segments.length,!0);return this._closed?(this.setClosed(!1),r=this):((r=new V(A.NO_INSERT)).insertAbove(this),r.copyAttributes(this)),r._add(n,0),this.addSegment(n[0]),r}return null},split:function(t,e){e=e===Wt?t:(t=this.getCurves()[t])&&t.getLocationAtTime(e);return null!=e?this.splitAt(e):null},join:function(t,e){var n=e||0;if(t&&t!==this){var i=t._segments,r=this.getLastSegment(),s=t.getLastSegment();if(!s)return this;r&&r._point.isClose(s._point,n)&&t.reverse();e=t.getFirstSegment();r&&r._point.isClose(e._point,n)?(r.setHandleOut(e._handleOut),this._add(i.slice(1))):((r=this.getFirstSegment())&&r._point.isClose(e._point,n)&&t.reverse(),s=t.getLastSegment(),r&&r._point.isClose(s._point,n)?(r.setHandleIn(s._handleIn),this._add(i.slice(0,i.length-1),0)):this._add(i.slice())),t._closed&&this._add([i[0]]),t.remove()}i=this.getFirstSegment(),t=this.getLastSegment();return i!==t&&i._point.isClose(t._point,n)&&(i.setHandleIn(t._handleIn),t.remove(),this.setClosed(!0)),this},reduce:function(t){for(var e=this.getCurves(),n=t&&t.simplify,i=n?1e-7:0,r=e.length-1;0<=r;r--){var s=e[r];!s.hasHandles()&&(!s.hasLength(i)||n&&s.isCollinear(s.getNext()))&&s.remove()}return this},reverse:function(){this._segments.reverse();for(var t=0,e=this._segments.length;t<e;t++){var n=this._segments[t],i=n._handleIn;n._handleIn=n._handleOut,n._handleOut=i,n._index=t}this._curves=null,this._changed(9)},flatten:function(t){for(var e=new S(this,t||.25,256,!0).parts,n=e.length,i=[],r=0;r<n;r++)i.push(new L(e[r].curve.slice(0,2)));!this._closed&&0<n&&i.push(new L(e[n-1].curve.slice(6))),this.setSegments(i)},simplify:function(t){t=new _(this).fit(t||2.5);return t&&this.setSegments(t),!!t},smooth:function(t){var r=this,e=t||{},t=e.type||"asymmetric",n=this._segments,s=n.length,a=this._closed;function i(t,e){var n=t&&t.index;if(null!=n){var i=t.path;if(i&&i!==r)throw new Error(t._class+" "+n+" of "+i+" is not part of "+r);e&&t instanceof $t&&n++}else n="number"==typeof t?t:e;return Math.min(n<0&&a?n%s:n<0?n+s:n,s-1)}var o=a&&e.from===Wt&&e.to===Wt,h=i(e.from,0),u=i(e.to,s-1);if(u<h&&(a?h-=s:(c=h,h=u,u=c)),/^(?:asymmetric|continuous)$/.test(t)){var l="asymmetric"===t,c=Math.min,t=u-h+1,f=t-1,t=o?c(t,4):1,d=t,t=t,g=[];if(a||(d=c(1,h),t=c(1,s-u-1)),!((f+=d+t)<=1)){for(var _=0,p=h-d;_<=f;_++,p++)g[_]=n[(p<0?p+s:p)%s]._point;for(var v=f-1,m=[T=g[0]._x+2*g[1]._x],y=[k=g[0]._y+2*g[1]._y],w=[P=2],x=[],b=[],_=1;_<f;_++)var S=_<v,C=S?4:l?3:8,M=S?2:l?0:1,I=(S||l?1:2)/P,P=w[_]=(S?4:l?2:7)-I,T=m[_]=C*g[_]._x+M*g[_+1]._x-I*T,k=y[_]=C*g[_]._y+M*g[_+1]._y-I*k;x[v]=m[v]/w[v],b[v]=y[v]/w[v];for(_=f-2;0<=_;_--)x[_]=(m[_]-x[_+1])/w[_],b[_]=(y[_]-b[_+1])/w[_];x[f]=(3*g[f]._x-x[v])/2,b[f]=(3*g[f]._y-b[v])/2;for(var _=d,z=f-t,p=h;_<=z;_++,p++){var O=n[p<0?p+s:p],A=O._point,L=x[_]-A._x,A=b[_]-A._y;(o||_<z)&&O.setHandleOut(L,A),(o||d<_)&&O.setHandleIn(-L,-A)}}}else for(_=h;_<=u;_++)n[_<0?_+s:_].smooth(e,!o&&_===h,!o&&_===u)},toShape:function(t){if(!this._closed)return null;var e,n,i,r,s,a,o=this._segments;function h(t,e){var n=o[t],i=n.getNext(),t=o[e],e=t.getNext();return n._handleOut.isZero()&&i._handleIn.isZero()&&t._handleOut.isZero()&&e._handleIn.isZero()&&i._point.subtract(n._point).isCollinear(e._point.subtract(t._point))}function u(t){var e=o[t],n=e.getNext(),i=e._handleOut,r=n._handleIn,s=.5522847498307936;if(i.isOrthogonal(r)){t=e._point,e=n._point,n=new D(t,i,!0).intersect(new D(e,r,!0),!0);return n&&Ut.isZero(i.getLength()/n.subtract(t).getLength()-s)&&Ut.isZero(r.getLength()/n.subtract(e).getLength()-s)}}function l(t,e){return o[t]._point.getDistance(o[e]._point)}if(!this.hasHandles()&&4===o.length&&h(0,2)&&h(1,3)&&(s=o[r=1],a=s.getPrevious(),r=s.getNext(),a._handleOut.isZero()&&s._handleIn.isZero()&&s._handleOut.isZero()&&r._handleIn.isZero()&&s._point.subtract(a._point).isOrthogonal(r._point.subtract(s._point)))?(e=m.Rectangle,n=new j(l(0,3),l(0,1)),i=o[1]._point.add(o[2]._point).divide(2)):8===o.length&&u(0)&&u(2)&&u(4)&&u(6)&&h(1,5)&&h(3,7)?(e=m.Rectangle,f=(n=new j(l(1,6),l(0,3))).subtract(new j(l(0,7),l(1,2))).divide(2),i=o[3]._point.add(o[4]._point).divide(2)):4===o.length&&u(0)&&u(1)&&u(2)&&u(3)&&(f=Ut.isZero(l(0,2)-l(1,3))?(e=m.Circle,l(0,2)/2):(e=m.Ellipse,new j(l(2,0)/2,l(3,1)/2)),i=o[1]._point),e){var c=this.getPosition(!0),f=new e({center:c,size:n,radius:f,insert:!1});return f.copyAttributes(this,!0),f._matrix.prepend(this._matrix),f.rotate(i.subtract(c).getAngle()+90),O.pick(t,te.settings.insertItems)&&f.insertAbove(this),f}return null},toPath:"#clone",compare:function t(e){if(!e||e instanceof b)return t.base.call(this,e);var n=this.getCurves(),i=e.getCurves(),r=n.length,s=i.length;if(!r||!s)return r==s;for(var a,o,h=n[0].getValues(),u=[],l=0,c=0,f=0;f<s;f++){var d=i[f].getValues();if(u.push(d),p=$t.getOverlaps(h,d)){a=!f&&0<p[0][0]?s-1:f,o=p[0][1];break}}for(var g,_=Math.abs,d=u[a];h&&d;){var p=$t.getOverlaps(h,d);if(p)if(_(p[0][0]-c)<1e-8){1===(c=p[1][0])&&(h=++l<r?n[l].getValues():null,c=0);var v=p[0][1];if(_(v-o)<1e-8){if(g=g||[a,v],1===(o=p[1][1])&&(d=u[a=++a>=s?0:a]||i[a].getValues(),o=0),!h)return g[0]===a&&g[1]===o;continue}}break}return!1},_hitTestSelf:function(n,r,t,e){var s,a,o,h,i,u,l=this,c=this.getStyle(),f=this._segments,d=f.length,g=this._closed,_=e&&e.inverted(),p=n.transform(_),v=_?new j(F._getCircleExtents(Math.max(r.tolerance,1e-12),this.getView()._matrix._shiftless())):r._tolerancePadding,m=v,y=r.all&&[],w=r.stroke&&c.hasStroke(),x=r.fill&&!!c.getFillColor(),e=r.curves,b=w?c.getStrokeWidth()/2:x&&0<r.tolerance||e?0:null;function S(t,e){return p.subtract(t).divide(e).length<=1}function C(t,e,n){if(!r.selected||e.isSelected()){var i=t._point;if(S((e=e!==i?e.add(i):e).transform(_),m)){e=new q(n,l,{segment:t,point:e});if(!y)return e;y.push(e)}}}function M(t,e){return(e||r.segments)&&C(t,t._point,"segment")||!e&&r.handles&&(C(t,t._handleIn,"handle-in")||C(t,t._handleOut,"handle-out"))}function I(t){h.add(t)}function P(t,e){for(var n=0;t&&n<d;n++){if(t.hasLength())return t.getTangentAtTime(e?0:1);t=e?t.getNext():t.getPrevious()}}function T(t){var e,n,i=g||0<t._index&&t._index<d-1;return i&&(t.isSmooth()||(e=P((n=(e=t).getCurve()).getPrevious(),!1),n=P(n,!0),e&&n&&e.isCollinear(n)&&0<e.dot(n)))||"round"===(i?s:a)?S(t._point.transform(_),m):(h=new V({internal:!0,closed:!0}),i?V._addBevelJoin(t,s,b,o,_,null,I,!0):V._addSquareCap(t,a,b,_,null,I,!0),!h.isEmpty()&&(h.contains(p)||(t=h.getNearestLocation(p))&&S(t.getPoint(),v)))}if(null!==b&&(0<b?(s=c.getStrokeJoin(),a=c.getStrokeCap(),o=c.getMiterLimit(),m=m.add(b)):s=a="round"),!r.ends||r.segments||g){if(r.segments||r.handles)for(var k=0;k<d;k++)if(u=M(f[k]))return u}else if(u=M(f[0],!0)||M(f[d-1],!0))return u;if(null!==b){for(var z,O=this.getCurves(),A=1/0,k=0,L=O.length;k<L;k++){var B=O[k].getValues(_),N=$t.getNearestTime(B,p),E=$t.getPoint(B,N),B=E.getDistance(p);B<A&&(A=B,i=new Kt(O[k],N),z=E)}if(i&&(0===(c=i.getTime())||1===c&&1<d?T(i.getSegment())||(i=null):S(z,m)||(i=null)),!i&&"miter"===s&&1<d)for(k=0;k<d;k++){var R=f[k];if(p.getDistance(R._point.transform(_))<=o*b&&T(R)){i=R.getLocation();break}}}return u=!i&&x&&this._contains(n)||i&&!w&&!e?new q("fill",this):i?new q(w?"stroke":"curve",this,{location:i,point:i.getPoint()}):null,y?(y.sort(function(t,e){return t.point.getDistance(n)-e.point.getDistance(n)}),u&&y.push(u),y):u}},O.each($t._evaluateMethods,function(e){this[e+"At"]=function(t){t=this.getLocationAt(t);return t&&t[e]()}},{beans:!1,getLocationOf:function(){for(var t=Gt.read(arguments),e=this.getCurves(),n=0,i=e.length;n<i;n++){var r=e[n].getLocationOf(t);if(r)return r}return null},getOffsetOf:function(){var t=this.getLocationOf.apply(this,arguments);return t?t.getOffset():null},getLocationAt:function(t){if("number"==typeof t){for(var e=this.getCurves(),n=0,i=0,r=e.length;i<r;i++){var s=n,a=e[i];if(t<(n+=a.getLength()))return a.getLocationAt(t-s)}if(0<e.length&&t<=this.getLength())return new Kt(e[e.length-1],1)}else if(t&&t.getPath&&t.getPath()===this)return t;return null},getOffsetsWithTangent:function(){var t=Gt.read(arguments);if(t.isZero())return[];for(var e=[],n=0,i=this.getCurves(),r=0,s=i.length;r<s;r++){for(var a=i[r],o=a.getTimesWithTangent(t),h=0,u=o.length;h<u;h++){var l=n+a.getOffsetAtTime(o[h]);e.indexOf(l)<0&&e.push(l)}n+=a.length}return e}}),new function(){function s(i,t,r){var s,a,o,h,u,l,c,f,e=t._segments,n=e.length,d=new Array(6),g=!0;function _(t){var e,n;a=r?(t._transformCoordinates(r,d),s=d[0],d[1]):(e=t._point,s=e._x,e._y),g?(i.moveTo(s,a),g=!1):(l=r?(u=d[2],d[3]):(n=t._handleIn,u=s+n._x,a+n._y),u===s&&l===a&&c===o&&f===h?i.lineTo(s,a):i.bezierCurveTo(c,f,u,l,s,a)),o=s,h=a,f=r?(c=d[4],d[5]):(n=t._handleOut,c=o+n._x,h+n._y)}for(var p=0;p<n;p++)_(e[p]);t._closed&&0<n&&_(e[0])}return{_draw:function(t,e,n,i){var r=e.dontFinish||e.clip;e.dontStart||t.beginPath(),(this.hasFill()||this.hasStroke()||r)&&(s(t,this,i),this._closed&&t.closePath()),r||this._paint(t,e,n,i)},_drawSelected:function(t,e){t.beginPath(),s(t,this,e),t.stroke();var n=te.settings;!function(n,t,e,i,r){var s,a,o=i/2,h=r/2,u=r-2,l=h-1,c=new Array(6);function f(t){var e=c[t],t=c[t+1];0<i&&(s!=e||a!=t)&&(n.beginPath(),n.moveTo(s,a),n.lineTo(e,t),n.stroke(),n.beginPath(),n.arc(e,t,o,0,2*Math.PI,!0),n.fill())}for(var d=0,g=t.length;d<g;d++){var _=t[d],p=_._selection;_._transformCoordinates(e,c),s=c[0],a=c[1],2&p&&f(2),4&p&&f(4),r<=0||(n.fillRect(s-h,a-h,r,r),0<u&&!(1&p)&&(p=n.fillStyle,n.fillStyle="#ffffff",n.fillRect(s-l,a-l,u,u),n.fillStyle=p))}}(t,this._segments,e,n.handleSize,O.pick(n.segmentSize,n.handleSize))}}},new function(){function z(t){t=t._segments;if(!t.length)throw new Error("Use a moveTo() command first");return t[t.length-1]}return{moveTo:function(){var t=this._segments;1===t.length&&this.removeSegment(0),t.length||this._add([new L(Gt.read(arguments))])},moveBy:function(){throw new Error("moveBy() is unsupported on Path items.")},lineTo:function(){this._add([new L(Gt.read(arguments))])},cubicCurveTo:function(){var t=arguments,e=Gt.read(t),n=Gt.read(t),i=Gt.read(t),t=z(this);t.setHandleOut(e.subtract(t._point)),this._add([new L(i,n.subtract(i))])},quadraticCurveTo:function(){var t=arguments,e=Gt.read(t),n=Gt.read(t),t=z(this)._point;this.cubicCurveTo(e.add(t.subtract(e).multiply(1/3)),e.add(n.subtract(e).multiply(1/3)),n)},curveTo:function(){var t=arguments,e=Gt.read(t),n=Gt.read(t),i=O.pick(O.read(t),.5),r=1-i,t=z(this)._point,r=e.subtract(t.multiply(r*r)).subtract(n.multiply(i*i)).divide(2*i*r);if(r.isNaN())throw new Error("Cannot put a curve through points with parameter = "+i);this.quadraticCurveTo(r,n)},arcTo:function(){var t,e=arguments,n=Math.abs,i=Math.sqrt,r=z(this),s=r._point,a=Gt.read(e),o=O.peek(e);if("boolean"==typeof(f=O.pick(o,!0)))var h=(g=s.add(a).divide(2)).add(g.subtract(s).rotate(f?-90:90));else if(O.remain(e)<=2)h=a,a=Gt.read(e);else if(!s.equals(a)){var u=j.read(e),l=Ut.isZero;if(l(u.width)||l(u.height))return this.lineTo(a);var c=O.read(e),f=!!O.read(e),d=!!O.read(e),g=s.add(a).divide(2),_=(T=s.subtract(g).rotate(-c)).x,p=T.y,v=n(u.width),m=n(u.height),y=v*v,o=m*m,l=_*_,e=p*p,u=i(l/y+e/o);if(1<u&&(y=(v*=u)*v,o=(m*=u)*m),(u=n(u=(y*o-y*e-o*l)/(y*e+o*l))<1e-12?0:u)<0)throw new Error("Cannot create an arc with the given arguments");w=new Gt(v*p/m,-m*_/v).multiply((d===f?-1:1)*i(u)).rotate(c).add(g),c=(x=(t=(new F).translate(w).rotate(c).scale(v,m))._inverseTransform(s)).getDirectedAngle(t._inverseTransform(a)),!f&&0<c?c-=360:f&&c<0&&(c+=360)}if(h){var w,v=new D(s.add(h).divide(2),h.subtract(s).rotate(90),!0),m=new D(h.add(a).divide(2),a.subtract(h).rotate(90),!0),f=new D(s,a),h=f.getSide(h);if(!(w=v.intersect(m,!0))){if(!h)return this.lineTo(a);throw new Error("Cannot create an arc with the given arguments")}var x,c=(x=s.subtract(w)).getDirectedAngle(a.subtract(w)),f=f.getSide(w,!0);0===f?c=h*n(c):h===f&&(c+=c<0?360:-360)}if(c){for(var n=n(c),b=360<=n?4:Math.ceil((n-1e-5)/90),S=c/b,c=S*Math.PI/360,C=4/3*Math.sin(c)/(1+Math.cos(c)),M=[],I=0;I<=b;I++){var P,T=a,k=null;I<b&&(k=x.rotate(90).multiply(C),t?(T=t._transformPoint(x),k=t._transformPoint(x.add(k)).subtract(T)):T=w.add(x)),I?(P=x.rotate(-90).multiply(C),t&&(P=t._transformPoint(x.add(P)).subtract(T)),M.push(new L(T,P,k))):r.setHandleOut(k),x=x.rotate(S)}this._add(M)}},lineBy:function(){var t=Gt.read(arguments),e=z(this)._point;this.lineTo(e.add(t))},curveBy:function(){var t=arguments,e=Gt.read(t),n=Gt.read(t),i=O.read(t),t=z(this)._point;this.curveTo(t.add(e),t.add(n),i)},cubicCurveBy:function(){var t=arguments,e=Gt.read(t),n=Gt.read(t),i=Gt.read(t),t=z(this)._point;this.cubicCurveTo(t.add(e),t.add(n),t.add(i))},quadraticCurveBy:function(){var t=arguments,e=Gt.read(t),n=Gt.read(t),t=z(this)._point;this.quadraticCurveTo(t.add(e),t.add(n))},arcBy:function(){var t=arguments,e=z(this)._point,n=e.add(Gt.read(t)),i=O.pick(O.peek(t),!0);"boolean"==typeof i?this.arcTo(n,i):this.arcTo(n,e.add(Gt.read(t)))},closePath:function(t){this.setClosed(!0),this.join(this,t)}}},{_getBounds:function(t,e){var n=e.handle?"getHandleBounds":e.stroke?"getStrokeBounds":"getBounds";return V[n](this._segments,this._closed,this,t,e)},statics:{getBounds:function(t,e,n,i,r,s){var a=t[0];if(!a)return new C;var o=new Array(6),h=a._transformCoordinates(i,new Array(6)),u=h.slice(0,2),l=u.slice(),c=new Array(2);function f(t){t._transformCoordinates(i,o);for(var e=0;e<2;e++)$t._addBounds(h[e],h[e+4],o[e+2],o[e],e,s?s[e]:0,u,l,c);t=h;h=o,o=t}for(var d=1,g=t.length;d<g;d++)f(t[d]);return e&&f(a),new C(u[0],u[1],l[0]-u[0],l[1]-u[1])},getStrokeBounds:function(t,e,n,i,r){var s=n.getStyle(),a=s.hasStroke(),o=s.getStrokeWidth()/2,h=a&&n._getStrokeMatrix(i,r),u=a&&F._getCircleExtents(o,h),l=V.getBounds(t,e,n,i,r,u);if(!a)return l;var c=s.getStrokeJoin(),a=s.getStrokeCap(),f=s.getMiterLimit(),d=new C(new j(u).multiply(2));function g(t){l=l.include(t)}function _(t){l=l.unite(d.setCenter(t._point.transform(i)))}function p(t,e){"round"===e||t.isSmooth()?_(t):V._addBevelJoin(t,e,o,f,i,h,g)}function v(t,e){"round"===e?_(t):V._addSquareCap(t,e,o,i,h,g)}var m=t.length-(e?0:1);if(0<m){for(var y=1;y<m;y++)p(t[y],c);e?p(t[0],c):(v(t[0],a),v(t[t.length-1],a))}return l},_getStrokeNormal:function(t,e,n,i,r){i=i?i._shiftless():new F,r=r&&r.inverted(),i=t.getTangentAtTime(e).transform(r?r.append(i):i);return new Gt(i.y,-i.x).normalize(n)},_addBevelJoin:function(t,e,n,i,r,s,a,o){var h=t.getCurve(),u=h.getPrevious(),t=h.getPoint1().transform(r),u=V._getStrokeNormal(u,1,n,r,s),h=V._getStrokeNormal(h,0,n,r,s),r=u.getDirectedAngle(h);(r<0||180<=r)&&(u=u.negate(),h=h.negate()),o&&a(t),a(t.add(u.transform(s))),"miter"!==e||(u=new D(u,new Gt(-u.y,u.x),!0).intersect(new D(h,new Gt(-h.y,h.x),!0),!0))&&u.getLength()<=i*n&&a(t.add(u.transform(s))),a(t.add(h.transform(s)))},_addSquareCap:function(t,e,n,i,r,s,a){var o=t._point.transform(i),h=t.getLocation(),t=h.getTime(),n=V._getStrokeNormal(h.getCurve(),t,0===t?n:-n,i,r),i=n.transform(r);"square"===e&&(a&&(s(o.subtract(i)),s(o.add(i))),o=o.add(n.rotate(-90).transform(r))),s(o.add(i)),s(o.subtract(i))},getHandleBounds:function(t,e,n,i,r){if(!t.length)return new C;var s,a,o,h=n.getStyle();r.stroke&&h.hasStroke()&&(o=n._getStrokeMatrix(i,r),r=n=h.getStrokeWidth()/2,"miter"===h.getStrokeJoin()&&(r=n*h.getMiterLimit()),"square"===h.getStrokeCap()&&(r=Math.max(r,n*Math.SQRT2)),s=F._getCircleExtents(n,o),a=F._getCircleExtents(r,o));for(var u=new Array(6),l=1/0,c=-l,f=l,d=c,g=0,_=t.length;g<_;g++){t[g]._transformCoordinates(i,u);for(var p=0;p<6;p+=2){var v=p?s:a,m=v?v[0]:0,y=v?v[1]:0,w=u[p],x=u[p+1],v=w-m,w=w+m,m=x-y,y=x+y;v<l&&(l=v),c<w&&(c=w),m<f&&(f=m),d<y&&(d=y)}}return new C(l,f,c-l,d-f)}}});V.inject({statics:new function(){var u=.5522847498307936,a=[new L([-1,0],[0,u],[0,-u]),new L([0,-1],[-u,0],[u,0]),new L([1,0],[0,-u],[0,u]),new L([0,1],[u,0],[-u,0])];function l(t,e,n){var i=O.getNamed(n),n=new V(i&&{insert:i.insert,project:i.project,parent:i.parent});return n._add(t),n._closed=e,n.set(i,{insert:!0,project:!0,parent:!0})}function i(t,e,n){for(var i=new Array(4),r=0;r<4;r++){var s=a[r];i[r]=new L(s._point.multiply(e).add(t),s._handleIn.multiply(e),s._handleOut.multiply(e))}return l(i,!0,n)}return{Line:function(){var t=arguments;return l([new L(Gt.readNamed(t,"from")),new L(Gt.readNamed(t,"to"))],!1,t)},Circle:function(){var t=arguments,e=Gt.readNamed(t,"center"),n=O.readNamed(t,"radius");return i(e,new j(n),t)},Rectangle:function(){var t,e,n=arguments,i=C.readNamed(n,"rectangle"),r=j.readNamed(n,"radius",0,{readNull:!0}),s=i.getBottomLeft(!0),a=i.getTopLeft(!0),o=i.getTopRight(!0),h=i.getBottomRight(!0);return l(!r||r.isZero()?[new L(s),new L(a),new L(o),new L(h)]:(t=(r=j.min(r,i.getSize(!0).divide(2))).width,e=r.height,i=t*u,r=e*u,[new L(s.add(t,0),null,[-i,0]),new L(s.subtract(0,e),[0,r]),new L(a.add(0,e),null,[0,-r]),new L(a.add(t,0),[-i,0],null),new L(o.subtract(t,0),null,[i,0]),new L(o.add(0,e),[0,-r],null),new L(h.subtract(0,e),null,[0,r]),new L(h.subtract(t,0),[i,0])]),!0,n)},RoundRectangle:"#Rectangle",Ellipse:function(){var t=arguments,e=m._readEllipse(t);return i(e.center,e.radius,t)},Oval:"#Ellipse",Arc:function(){var t=arguments,e=Gt.readNamed(t,"from"),n=Gt.readNamed(t,"through"),i=Gt.readNamed(t,"to"),r=new V(A.NO_INSERT);return r.moveTo(e),r.arcTo(n,i),l(r._segments,!1,t)},RegularPolygon:function(){for(var t=arguments,e=Gt.readNamed(t,"center"),n=O.readNamed(t,"sides"),i=O.readNamed(t,"radius"),r=-360/n,s=n%2?0:-.5,a=new Gt(0,-i),o=new Array(n),h=0;h<n;h++)o[h]=new L(e.add(a.rotate((h+s)*r)));return l(o,!0,t)},Star:function(){for(var t=arguments,e=Gt.readNamed(t,"center"),n=2*O.readNamed(t,"points"),i=O.readNamed(t,"radius1"),r=O.readNamed(t,"radius2"),s=360/n,a=new Gt(0,-1),o=new Array(n),h=0;h<n;h++)o[h]=new L(e.add(a.rotate(s*h).multiply(h%2?r:i)));return l(o,!0,t)}}}});var b=w.extend({_class:"CompoundPath",_serializeFields:{children:[]},beans:!0,initialize:function(t){this._children=[],this._namedChildren={},this._initialize(t)||("string"==typeof t?this.setPathData(t):this.addChildren(Array.isArray(t)?t:arguments))},_transformContent:function t(e){return this._scaleStroke(e),t.base.apply(this,arguments)},insertChildren:function t(e,n){var i=n,r=i[0];r&&"number"==typeof r[0]&&(i=[i]);for(var s=n.length-1;0<=s;s--){var a=i[s];i!==n||a instanceof V||(i=O.slice(i)),Array.isArray(a)?i[s]=new V({segments:a,insert:!1}):a instanceof b&&(i.splice.apply(i,[s,1].concat(a.removeChildren())),a.remove())}return t.base.call(this,e,i)},reduce:function t(e){for(var n,i=this._children,r=i.length-1;0<=r;r--)(n=i[r].reduce(e)).isEmpty()&&n.remove();return i.length?t.base.call(this):((n=new V(A.NO_INSERT)).copyAttributes(this),n.insertAbove(this),this.remove(),n)},isClosed:function(){for(var t=this._children,e=0,n=t.length;e<n;e++)if(!t[e]._closed)return!1;return!0},setClosed:function(t){for(var e=this._children,n=0,i=e.length;n<i;n++)e[n].setClosed(t)},getFirstSegment:function(){var t=this.getFirstChild();return t&&t.getFirstSegment()},getLastSegment:function(){var t=this.getLastChild();return t&&t.getLastSegment()},getCurves:function(){for(var t=this._children,e=[],n=0,i=t.length;n<i;n++)O.push(e,t[n].getCurves());return e},getFirstCurve:function(){var t=this.getFirstChild();return t&&t.getFirstCurve()},getLastCurve:function(){var t=this.getLastChild();return t&&t.getLastCurve()},getArea:function(){for(var t=this._children,e=0,n=0,i=t.length;n<i;n++)e+=t[n].getArea();return e},getLength:function(){for(var t=this._children,e=0,n=0,i=t.length;n<i;n++)e+=t[n].getLength();return e},getPathData:function(t,e){for(var n=this._children,i=[],r=0,s=n.length;r<s;r++){var a=n[r],o=a._matrix;i.push(a.getPathData(t&&!o.isIdentity()?t.appended(o):t,e))}return i.join("")},_hitTestChildren:function t(e,n,i){return t.base.call(this,e,n.class===V||"path"===n.type?n:O.set({},n,{fill:!1}),i)},_draw:function(t,e,n,i){var r=this._children;if(r.length){e=e.extend({dontStart:!0,dontFinish:!0}),t.beginPath();for(var s=0,a=r.length;s<a;s++)r[s].draw(t,e,i);e.clip||this._paint(t,e,n,i)}},_drawSelected:function(t,e,n){for(var i=this._children,r=0,s=i.length;r<s;r++){var a=i[r],o=a._matrix;n[a._id]||a._drawSelected(t,o.isIdentity()?e:e.appended(o))}}},new function(){function n(t,e){t=t._children;if(e&&!t.length)throw new Error("Use a moveTo() command first");return t[t.length-1]}return O.each(["lineTo","cubicCurveTo","quadraticCurveTo","curveTo","arcTo","lineBy","cubicCurveBy","quadraticCurveBy","curveBy","arcBy"],function(e){this[e]=function(){var t=n(this,!0);t[e].apply(t,arguments)}},{moveTo:function(){var t=n(this),e=t&&t.isEmpty()?t:new V(A.NO_INSERT);e!==t&&this.addChild(e),e.moveTo.apply(e,arguments)},moveBy:function(){var t=n(this,!0),e=t&&t.getLastSegment(),t=Gt.read(arguments);this.moveTo(e?t.add(e._point):t)},closePath:function(t){n(this,!0).closePath(t)}})},O.each(["reverse","flatten","simplify","smooth"],function(s){this[s]=function(t){for(var e,n=this._children,i=0,r=n.length;i<r;i++)e=n[i][s](t)||e;return e}},{}));w.inject(new function(){var jt=Math.min,Ft=Math.max,Dt=Math.abs,u={unite:function(t,e){return t||e},intersect:function(t,e){return t&&e},subtract:function(t,e){return t&&!e},exclude:function(t,e){return t!==e}};function qt(t){return t._children||[t]}function v(t,e){t=t.clone(!1).reduce({simplify:!0}).transform(null,!0,!0);return e?r(t):t}function r(t){for(var e=qt(t),n=0,i=e.length;n<i;n++){var r,s=e[n];s._closed||s.isEmpty()||(r=s._segments.length,s.closePath(1e-12),s._segments.length===r&&(s.getFirstSegment().setHandleIn(0,0),s.getLastSegment().setHandleOut(0,0)))}return t}function m(t,e,n,i,r){var s=new b(A.NO_INSERT);if(s.addChildren(t,!0),s=s.reduce({simplify:e}),O.pick(r&&r.insert,te.settings.insertItems)){for(var a=n,o=[].concat(i||[]),h=0,u=o.length;h<u;h++){var l=o[h];n.isSibling(l)&&l.getIndex()>a.getIndex()&&(a=l)}s.insertAbove(a)}return s.copyAttributes(n,!0),s}function y(t){return t.hasOverlap()||t.isCrossing()}function l(t,e,n,i){if(i&&(0==i.trace||i.stroke)&&/^(subtract|intersect)$/.test(n))return c(t,e,n,i);var r;if("exclude"===n&&Array.isArray(e)&&1<e.length){var s=[t].concat(e),a=new b(A.NO_INSERT);a.setFillRule("evenodd");for(var o=0,h=s.length;o<h;o++)a.addChildren(f([v(s[o],!0)],u.unite));r=f([a],u.unite)}else r=f(d(t,w(e,n)),u[n]);return m(r,!0,t,e,i)}function w(t,o){var h="unite"===o||"subtract"===o;t=[].concat(t||[]).map(function(t){var e=t.getBounds();return{path:t,bounds:e,center:e.getCenter()}});return t.length?function t(e){if(1<e.length){if(h){for(var n=e[0].bounds,i=1,r=e.length;i<r;i++)n=n.unite(e[i].bounds);var s=n.width>n.height?"x":"y";e.sort(function(t,e){return t.center[s]-e.center[s]})}var a=e.length>>1;return l(t(e.slice(0,a)),t(e.slice(a)),h?"unite":o,{insert:!1})}return e[0].path}(t):null}function c(t,e,n,i){for(var r=v(t),s=v(w(e,n)),a=r.getIntersections(s,y),o="subtract"===n,h="divide"===n,u=[],l=[],c=a.length-1;0<=c;c--){var f=a[c],d=f.getPath(),f=f.split();f&&(f.getFirstSegment().setHandleIn(0,0),d.getLastSegment().setHandleOut(0,0),-1===u.indexOf(f)&&u.push(f))}for(var g=r._children||[r],c=0,_=g.length;c<_;c++)-1===u.indexOf(g[c])&&u.push(g[c]);for(c=0,_=u.length;c<_;c++){var p=u[c];(h||s.contains(p.getPointAt(p.getLength()/2))^o)&&l.unshift(p)}return m(l,!1,t,e,i)}function Vt(t,e){var n=0,i=t.x,r=t.y;if(r>=jt(e[1],e[3],e[5],e[7])&&r<=Ft(e[1],e[3],e[5],e[7])&&i<Ft(e[0],e[2],e[4],e[6]))for(var s=$t.getMonoCurves(e),a=[],o=0,h=s.length;o<h;o++){var u=s[o],l=u[1],c=u[7],f=l<c?1:c<l?-1:0;f&&r>=jt(l,c)&&r<Ft(l,c)&&i<(0<$t.solveCubic(u,1,r,a,0,1)?$t.getPoint(u,a[0]).x:Dt(r-l)<Dt(r-c)?u[0]:u[6])&&(n+=f)}return n}function T(u,l,c,f){var t,d=c?1:0,g=1^d,e=[u.x,u.y],n=e[d],_=e[g],p=n-1e-9,v=n+1e-9,i=0,r=0,m=0,y=0,w=!1,s=!1,x=[];function a(t){var e=t[g+0],n=t[g+2],i=t[g+4],r=t[g+6];if(_<=Ft(e,n,i,r)&&_>=jt(e,n,i,r))for(var s,e=t[d+0],n=t[d+2],i=t[d+4],r=t[d+6],a=p>Ft(e,n,i,r)||v<jt(e,n,i,r)?[t]:$t.getMonoCurves(t,c),o=0,h=a.length;o<h;o++)if(s=function(t){var e=t[g+0],n=t[g+6];if(!(_<jt(e,n)||_>Ft(e,n))){var i=t[d+0],r=t[d+2],s=t[d+4],a=t[d+6];if(e!==n){var o=_===e?0:_!==n&&!(p>Ft(i,r,s,a)||v<jt(i,r,s,a))&&0<$t.solveCubic(t,g,_,x,0,1)?x[0]:1,h=0===o?i:1===o?a:$t.getPoint(t,o)[c?"y":"x"],r=n<e?1:-1,s=M[g]>M[g+6]?1:-1,n=M[d+6];return _!==e?h<p?m+=r:v<h?y+=r:w=!0:r!=s?i<p?m+=r:v<i&&(y+=r):i!=n&&(n<v&&v<h?(y+=r,w=!0):p<n&&h<p&&(m+=r,w=!0)),M=t,!f&&p<h&&h<v&&0===$t.getTangent(t,o)[c?"x":"y"]&&T(u,l,!c,!0)}(i<v&&p<a||a<v&&p<i)&&(w=!0)}}(a[o]))return s}for(var o=0,h=l.length;o<h;o++){var b=l[o],S=b._path,C=b.getValues();if(!(o&&l[o-1]._path===S||(M=null,S._closed||(t=$t.getValues(S.getLastCurve().getSegment2(),b.getSegment1(),null,!0))[g]!==t[g+6]&&(M=t),M)))for(var M=C,I=S.getLastCurve();I&&I!==b;){var P=I.getValues();if(P[g]!==P[g+6]){M=P;break}I=I.getPrevious()}if(C=a(C))return C;if(o+1===h||l[o+1]._path!==S){if(t&&(C=a(t)))return C;i+=m=w&&!m&&!y?y=S.isClockwise()^c?1:-1:m,r+=y,m=y=0,w=w&&!(s=!0),t=null}}return i=Dt(i),r=Dt(r),{winding:Ft(i,r),windingL:i,windingR:r,onPath:s}}function Ht(t,e,n,i,r,s){var a;return e?(a=$t.getPart(t,n,i).slice(),e=r.x-a[0],t=r.y-a[1],n=s.x-a[6],i=s.y-a[7],a[0]+=e,a[1]+=t,a[2]+=e,a[3]+=t,a[4]+=n,a[5]+=i,a[6]+=n,a[7]+=i):a=[r.x,r.y,r.x,r.y,s.x,s.y,s.x,s.y],a}function P(t){for(var i=[],e=[],n={},r=[],s=null,a=0,o=t.length;a<o;a++){var h=t[a],u=qt(h);r.push("nonzero"===h.getFillRule()),s=s?s.unite(h.getBounds()):h.getBounds();for(var l=0,c=u.length;l<c;l++){var f=u[l].getCurves();n[u[l]._id]=i.length;for(var d=0,g=f.length;d<g;d++)i.push(f[d]),e.push(a)}}var _=Ut.getEpsilon(Ft(Dt(s.left),Dt(s.right),Dt(s.top),Dt(s.bottom)),1e-7*s.getTopLeft().getDistance(s.getBottomRight())),p=[],v=[],m=[],y=[],w=[];function x(t,e,n,i){v[t].push({time:e,point:m.length}),m.push(n.x),y.push(n.y),w.push(i)}for(a=0,o=i.length;a<o;a++){var b=i[a];p.push(b.getValues()),v.push([]),x(a,0,b._segment1._point,!0),x(a,1,b._segment2._point,!0)}for(var S=Zt.findCurveBoundsCollisions(p,p,2*_),C=Kt.expand($t.getIntersections(i,null,null,null,null,!1,_,S)),a=0,o=C.length;a<o;a++){var M=C[a];x(n[(b=M.getCurve())._path._id]+b.getIndex(),M.getTime(),M.getPoint(),!1)}for(var I=m.length,P=new Array(I),T=new Array(I),a=0;a<I;a++)P[a]=T[a]=a;function k(t){for(;P[t]!==t;)t=P[t]=P[P[t]];return t}T.sort(function(t,e){return m[t]-m[e]});for(var z,O,a=0;a<I;a++)for(var A=T[a],l=a+1;l<I&&m[T[l]]-m[A]<=_;l++){var L=T[l],B=m[L]-m[A],N=y[L]-y[A];B*B+N*N<=_*_&&(P[k(A)]=k(L))}function E(){z={},O=[];for(var t=0;t<I;t++){var e=k(t),n=z[e];n===Wt?(n=z[e]=O.length,O.push({x:m[t],y:y[t],isEnd:w[t],point:t,outgoing:[]})):w[t]&&!O[n].isEnd&&(O[n]={x:m[t],y:y[t],isEnd:!0,point:t,outgoing:[]})}}function R(t){return z[k(t)]}function j(t,e,n){return Ht(p[t],i[t].hasHandles(),e.time,n.time,O[R(e.point)],O[R(n.point)])}function F(t){return t.sort(function(t,e){return t.time-e.time})}E();var D=new Array(O.length);function q(t,e,n,i){t.push({values:j(e,n,i),cut1:n,cut2:i})}for(var V,H,W,Z,U,a=0,o=i.length;a<o;a++){var G=function(t){for(var e=p[t],n=jt(e[0],e[2],e[4],e[6])-2*_,i=jt(e[1],e[3],e[5],e[7])-2*_,r=Ft(e[0],e[2],e[4],e[6])+2*_,s=Ft(e[1],e[3],e[5],e[7])+2*_,a=S[t],o=[],h=0,u=a.length;h<u;h++)for(var l=v[a[h]],c=0,f=l.length;c<f;c++){var d,g=R(l[c].point);D[g]!==t&&(d=O[g],D[g]=t,d.x>=n&&d.x<=r&&d.y>=i&&d.y<=s&&o.push(g))}return o.sort(function(t,e){return t-e})}(a);if(G.length){for(var $=[],l=1,c=(ht=F(v[a])).length;l<c;l++)q($,a,ht[l-1],ht[l]);for(;$.length;)for(var K=$.pop(),l=0,c=G.length;l<c;l++){var J=G[l],X=O[J];if(H=J,W=X,U=Z=void 0,Z=(V=K).values,U=W.x,W=W.y,R(V.cut1.point)!==H&&R(V.cut2.point)!==H&&U>=jt(Z[0],Z[2],Z[4],Z[6])-_&&U<=Ft(Z[0],Z[2],Z[4],Z[6])+_&&W>=jt(Z[1],Z[3],Z[5],Z[7])-_&&W<=Ft(Z[1],Z[3],Z[5],Z[7])+_){var Y=new Gt(X.x,X.y),Q=$t.getNearestTime(K.values,Y);if(0<Q&&Q<1&&Y.isClose($t.getPoint(K.values,Q),_)){var tt=K.cut1,et=K.cut2,nt={time:i[a].hasHandles()?tt.time+(et.time-tt.time)*Q:$t.getNearestTime(p[a],Y),point:X.point};v[a].push(nt),q($,a,tt,nt),q($,a,nt,et);break}}}}}for($=[],a=0,o=i.length;a<o;a++)for(l=1,c=(ht=F(v[a])).length;l<c;l++){tt=ht[l-1],et=ht[l];R(tt.point)!==R(et.point)&&$t.getLength(j(a,tt,et))<4*_&&$.push([tt.point,et.point])}if($.length){for(a=0,o=$.length;a<o;a++){var it=k($[a][0]),rt=k($[a][1]);it!==rt&&(P[it]=rt)}E()}var st=[],at=[];function ot(t){for(var e=jt(t.from,t.to),n=Ft(t.from,t.to),i=at[e]||(at[e]=[]),r=0,s=i.length;r<s;r++){var a=i[r],o=Ft(a.from,a.to)===n&&function(t,e){for(var n=t.values,i=e.values,r=[],s=1;s<=3;s++){var a=$t.getPoint(i,s/4),o=$t.getNearestTime(n,a);if(!a.isClose($t.getPoint(n,o),_))return 0;r.push(o)}return r[0]<r[2]?1:-1}(a,t);if(o){for(var h=0;h<2;h++)a.windings[h]+=o*t.windings[h];return}}i.push(t),st.push(t)}for(a=0,o=i.length;a<o;a++)for(var ht=v[a],ut=!i[a].hasHandles(),lt=ht[0],l=1,c=ht.length;l<c;l++){var nt=ht[l],ct=R(lt.point),ft=R(nt.point),dt=j(a,lt,nt);(ct!==ft||$t.getLength(dt)>=4*_)&&((At=[0,0])[e[a]]=1,ot({values:dt,from:ct,to:ft,isStraight:ut,windings:At,curve:a,time1:lt.time,time2:nt.time})),lt=nt}var gt=[];function _t(t){for(var e=1/0,n=0,i=t.length;n<i;n++){var r=gt[t[n]],s=r.values;if(r.directions=function(t){for(var e=[],n=0;n<6;n+=2){var i=t[n+2]-t[n],r=t[n+3]-t[n+1];(i||r)&&e.push(Math.atan2(r,i))}for(var s=e[0],a=0,o=0,n=1,h=e.length;n<h;n++)var u=(e[n]-s+3*Math.PI)%(2*Math.PI)-Math.PI,a=jt(a,u),o=Ft(o,u);return o-a<Math.PI?{start:(s+a+2*Math.PI)%(2*Math.PI),width:o-a}:null}(s),!r.directions)return;e=jt(e,Math.sqrt((s[6]-s[0])*(s[6]-s[0])+(s[7]-s[1])*(s[7]-s[1]))/2)}for(var a=t.slice().sort(function(t,e){return gt[t].directions.start-gt[e].directions.start}),o=1/0,h=0,n=0,i=a.length;n<i;n++)var u=gt[a[n]].directions,l=gt[a[(n+1)%i]].directions,o=jt(o,l.start-u.start-u.width+(n+1<i?0:2*Math.PI)),h=Ft(h,u.width);if(0<o&&e*Math.cos(h/2)*Math.sin(jt(o,Math.PI/2))>2*_){for(n=0,i=a.length;n<i;n++)t[n]=a[n];return 1}}for(a=0,o=st.length;a<o;a++){var pt=(Lt=st[a]).values;Lt.reversed=[pt[6],pt[7],pt[4],pt[5],pt[2],pt[3],pt[0],pt[1]],gt.push({edge:Lt,values:pt,from:Lt.from,to:Lt.to},{edge:Lt,values:Lt.reversed,from:Lt.to,to:Lt.from}),O[Lt.from].outgoing.push(2*a),O[Lt.to].outgoing.push(2*a+1)}for(a=0,o=O.length;a<o;a++){if(2<(bt=(X=O[a]).outgoing).length&&!_t(bt)){for(var vt=1/0,l=0,c=bt.length;l<c;l++)(Lt=gt[bt[l]].edge).length=Lt.length||$t.getLength(Lt.values),vt=jt(vt,Lt.length/2);for(l=0,c=bt.length;l<c;l++){pt=(Mt=gt[bt[l]]).values,Y=$t.getPoint(pt,Mt.edge.isStraight?vt/Mt.edge.length:$t.getTimeAt(pt,vt));Mt.point=Y,Mt.angle=Math.atan2(Y.y-X.y,Y.x-X.x)}bt.sort(function(t,e){return gt[t].angle-gt[e].angle});for(var mt=-Math.PI,yt=0,l=0,c=bt.length;l<c;l++){var wt=gt[bt[l]].angle,xt=(wt-gt[bt[(l||c)-1]].angle+2*Math.PI)%(2*Math.PI)||2*Math.PI;yt<xt&&(yt=xt,mt=wt)}for(l=0,c=bt.length;l<c;l++)(Mt=gt[bt[l]]).angle=(Mt.angle-mt+2*Math.PI)%(2*Math.PI);bt.sort(function(t,e){var n,i,r=gt[t],s=gt[e];return r.point.isClose(s.point,_)&&(i=s,t=(n=r).values,e=i.values,i=i.edge,n=jt(n.edge.length,i.length)/2,e=$t.getPoint(e,i.isStraight?n/i.length:$t.getTimeAt(e,n)),0<(n=$t.getNearestTime(t,e))&&n<1?0<$t.getTangent(t,n).cross(e.subtract($t.getPoint(t,n)))?-1:1:0)||r.angle-s.angle})}for(l=0,c=bt.length;l<c;l++)gt[bt[l]].position=l}for(a=0,o=gt.length;a<o;a++){var bt=O[gt[a].to].outgoing,St=gt[1^a].position;gt[a].next=bt[(St||bt.length)-1]}for(var Ct=[],a=0,o=gt.length;a<o;a++)if(gt[a].face===Wt){var Mt,It={halfEdges:[],area:0,windings:null,component:null},J=a;do{}while(((Mt=gt[J]).face=It).halfEdges.push(J),It.area+=$t.getArea(Mt.values),(J=Mt.next)!==a);Ct.push(It)}for(var Pt=[],Tt=[],s=[],a=0,o=Ct.length;a<o;a++)if(!(It=Ct[a]).component){ht=[It];It.component=zt={edges:[],bounds:[1/0,1/0,-1/0,-1/0],outside:It};for(l=0;l<ht.length;l++){var kt=ht[l].halfEdges;ht[l].area<zt.outside.area&&(zt.outside=ht[l]);for(c=0,g=kt.length;c<g;c++)(Et=gt[1^kt[c]].face).component||(Et.component=zt,ht.push(Et))}X=O[gt[zt.outside.halfEdges[0]].from];Pt.push(zt),Tt.push([X.x,X.y,1/0,X.y]),s.push(zt.bounds)}for(a=0,o=st.length;a<o;a++){var zt,pt=(Lt=st[a]).values,L=(zt=gt[2*a].face.component).bounds;zt.edges.push(Lt),L[0]=jt(L[0],pt[0],pt[2],pt[4],pt[6]),L[1]=jt(L[1],pt[1],pt[3],pt[5],pt[7]),L[2]=Ft(L[2],pt[0],pt[2],pt[4],pt[6]),L[3]=Ft(L[3],pt[1],pt[3],pt[5],pt[7])}for(S=Zt.findBoundsCollisions(Tt,s,0,!0),a=0,o=Pt.length;a<o;a++){for(var Ot=Pt[a].outside,Y=new Gt(Tt[a][0],Tt[a][1]),At=[0,0],l=0,c=(kt=S[a]).length;l<c;l++)if(kt[l]!==a)for(d=0,g=(ht=Pt[kt[l]].edges).length;d<g;d++){var Lt,Bt=Vt(Y,(Lt=ht[d]).values);At[0]+=Bt*Lt.windings[0],At[1]+=Bt*Lt.windings[1]}Ot.windings=At;for(var Nt=[Ot],l=0;l<Nt.length;l++)for(c=0,g=(kt=(It=Nt[l]).halfEdges).length;c<g;c++){var Et,Rt,J=kt[c];(Et=gt[1^J].face).windings||(At=gt[J].edge.windings,Et.windings=[It.windings[0]-(Rt=1&J?-1:1)*At[0],It.windings[1]-Rt*At[1]],Nt.push(Et))}}return{curves:i,values:p,vertices:O,edges:st,halfEdges:gt,faces:Ct,nonZeros:r,epsilon:_}}function f(t,e){for(var n=P(t),i=n.halfEdges,r=n.faces,s=n.nonZeros,a=0,o=r.length;a<o;a++){var h=r[a],u=h.windings;h.isInside=!!e(s[0]?!!u[0]:!!(1&u[0]),s[1]?!!u[1]:!!(1&u[1]))}function l(t){return i[t].face.isInside&&!i[1^t].face.isInside}function c(t){var e=i[t].edge;return 1&t?[e.time2,e.time1]:[e.time1,e.time2]}function f(t,e){return i[t].edge.curve===i[e].edge.curve&&c(t)[1]===c(e)[0]}for(var d=[],g=[],a=0,o=i.length;a<o;a++)if(!g[a]&&l(a)){var _=[],p=a;do{for(g[p]=!0,_.push(p),p=i[p].next;!l(p);)p=i[1^p].next}while(p!==a);for(var v=_.length,m=0;m<v&&f(_[(m||v)-1],_[m]);)m++;for(var y=[],w=null,x=0;x<v;){for(var b=_[(m+x)%v],S=b;++x<v&&f(S,_[(m+x)%v]);)S=_[(m+x)%v];var C=i[b].edge,M=C.isStraight,b=b===S?i[b].values:Ht(n.values[C.curve],!M,c(b)[0],c(S)[1],n.vertices[i[b].from],n.vertices[i[S].to]);y.push(new L(new Gt(b[0],b[1]),w,!M&&new Gt(b[2]-b[0],b[3]-b[1]))),w=!M&&new Gt(b[4]-b[6],b[5]-b[7])}w&&y[0].setHandleIn(w);var I=new V(A.NO_INSERT);I.setSegments(y),I.setClosed(!0),0!==I.getArea()&&d.push(I)}return d}function d(t,e){t=[v(t,!0)];return e&&t.push(v(e,!0)),t}return{statics:{_createGraph:function(t,e){return P(d(t,e))}},_getWinding:function(t){return T(t,this.getCurves())},unite:function(t,e){return l(this,t,"unite",e)},intersect:function(t,e){return l(this,t,"intersect",e)},subtract:function(t,e){return l(this,t,"subtract",e)},exclude:function(t,e){return l(this,t,"exclude",e)},divide:function(t,e){return e&&(0==e.trace||e.stroke)?c(this,t,"divide",e):m([this.subtract(t,e),this.intersect(t,e)],!0,this,t,e)},resolveCrossings:function(){var t,e=this._children,n=f([r(this.clone(!1))],function(t){return t}),i=n.length;return 1<i&&e?(n!==e&&this.setChildren(n),t=this):1!==i||e||(n[0]!==this&&this.setSegments(n[0].removeSegments()),t=this),t||((t=new b(A.NO_INSERT)).addChildren(n),(t=t.reduce()).copyAttributes(this),this.replaceWith(t)),t},reorient:function(e,t){var n=this._children;return n&&n.length?this.setChildren(function(t,e,n){var i=t&&t.length;if(i){var r=O.each(t,function(t,e){this[t._id]={container:null,winding:t.isClockwise()?1:-1,index:e}},{}),s=t.slice().sort(function(t,e){return Dt(e.getArea())-Dt(t.getArea())}),a=s[0],o=Zt.findItemBoundsCollisions(s,null,Ut.GEOMETRIC_EPSILON);null==n&&(n=a.isClockwise());for(var h=0;h<i;h++){var u,l=s[h],c=r[l._id],f=0,d=o[h];if(d)for(var g=null,_=d.length-1;0<=_;_--)if(d[_]<h){for(var g=g||l.getInteriorPoint(),p=s[d[_]],v=p.getCurves(),m=0,y=0,w=v.length;y<w;y++)m+=Vt(g,v[y].getValues());if(m){var x=r[p._id],f=x.winding;c.winding+=f,c.container=x.exclude?x.container:p;break}}e(c.winding)===e(f)?(c.exclude=!0,t[c.index]=null):(u=c.container,l.setClockwise(u?!u.isClockwise():n))}}return t}(this.removeChildren(),function(t){return!!(e?t:1&t)},t)):t!==Wt&&this.setClockwise(t),this},getInteriorPoint:function(){var t=this.getBounds().getCenter(!0);if(!this.contains(t)||this.getNearestPoint(t).isClose(t,1e-7)){for(var e=this.getCurves(),n=[],i=[],r=[],s=[],a=0,o=e.length;a<o;a++)O.push(n,$t.getMonoCurves(e[a].getValues()));for(a=0,o=n.length;a<o;a++)i.push(n[a][1],n[a][7]);i.sort(function(t,e){return t-e});for(var h=l=t.y,u=l,a=0,o=i.length;a<o&&u===l;a++)i[a]<=l?h=i[a]:u=i[a];for(var l=t.y=(h+u)/2,a=0,o=n.length;a<o;a++){var c=n[a],f=c[1],d=c[7];l>jt(f,d)&&l<Ft(f,d)&&r.push(1===$t.solveCubic(c,1,l,s,0,1)?$t.getPoint(c,s[0]).x:(c[0]+c[6])/2)}1<r.length&&(r.sort(function(t,e){return t-e}),t.x=(r[0]+r[1])/2)}return t}}});var S=O.extend({_class:"PathFlattener",initialize:function(t,o,e,h,n){var i,r=[],u=[],l=0,c=1/(e||32),s=t._segments,a=s[0];function f(t,e){e=$t.getValues(t,e,n);r.push(e),function t(e,n,i,r){{var s,a;!(c<r-i)||h&&$t.isStraight(e)||$t.isFlatEnough(e,o||.25)?(s=e[6]-e[0],a=e[7]-e[1],0<(a=Math.sqrt(s*s+a*a))&&(l+=a,u.push({offset:l,curve:e,index:n,time:r,isStraight:$t.isStraight(e)}))):(a=$t.subdivide(e,.5),e=(i+r)/2,t(a[0],n,i,e),t(a[1],n,e,r))}}(e,t._index,0,1)}for(var d=1,g=s.length;d<g;d++)f(a,i=s[d]),a=i;t._closed&&f(i||a,s[0]),this.curves=r,this.parts=u,this.length=l,this.index=0},_get:function(t){for(var e,n=this.parts,i=n.length,r=this.index;(e=r)&&!(n[--r].offset<t););for(;e<i;e++){var s=n[e];if(s.offset>=t){var a=n[(this.index=e)-1],o=a&&a.index===s.index?a.time:0,h=a?a.offset:0,a=(t-h)/(s.offset-h);return s.isStraight&&(h=s.curve,a=$t.getTimeOf(h,new Gt(h[0]+(h[6]-h[0])*a,h[1]+(h[7]-h[1])*a))),{index:s.index,time:o+(s.time-o)*a}}}return{index:n[i-1].index,time:1}}},O.each($t._evaluateMethods,function(e){this[e+"At"]=function(t){t=this._get(t);return $t[e](this.curves[t.index],t.time)}},{})),_=O.extend({initialize:function(t){for(var e,n=this.points=[],i=t._segments,t=t._closed,r=0,s=i.length;r<s;r++){var a=i[r].point;e&&e.equals(a)||n.push(e=a.clone())}t&&(n.unshift(n[n.length-1]),n.push(n[1])),this.closed=t},fit:function(t){var e=this.points,n=e.length,i=null;return 0<n&&(i=[new L(e[0])],1<n&&(this.fitCubic(i,t,0,n-1,e[1].subtract(e[0]),e[n-2].subtract(e[n-1])),this.closed&&(i.shift(),i.pop()))),i},fitCubic:function(t,e,n,i,r,s){var a=this.points;if(i-n!=1){for(var o,h=this.chordLengthParameterize(n,i),u=Math.max(e,e*e),l=!0,c=0;c<=4;c++){var f=this.generateBezier(n,i,h,r,s),d=this.findMaxError(n,i,f,h);if(d.error<e&&l)return void this.addCurve(t,f);if(o=d.index,d.error>=u)break;l=this.reparameterize(n,i,h,f),u=d.error}var g=a[o-1].subtract(a[o+1]);this.fitCubic(t,e,n,o,r,g),this.fitCubic(t,e,o,i,g.negate(),s)}else{var _=a[n],g=a[i],a=_.getDistance(g)/3;this.addCurve(t,[_,_.add(r.normalize(a)),g.add(s.normalize(a)),g])}},addCurve:function(t,e){t[t.length-1].setHandleOut(e[1].subtract(e[0])),t.push(new L(e[3],e[2].subtract(e[3])))},generateBezier:function(t,e,n,i,r){for(var s=Math.abs,a=this.points,o=a[t],h=a[e],u=[[0,0],[0,0]],l=[0,0],c=0,f=e-t+1;c<f;c++){var d=n[c],g=1-d,_=3*d*g,p=g*g*g,v=_*g,m=_*d,g=d*d*d,_=i.normalize(v),d=r.normalize(m),g=a[t+c].subtract(o.multiply(p+v)).subtract(h.multiply(m+g));u[0][0]+=_.dot(_),u[0][1]+=_.dot(d),u[1][0]=u[0][1],u[1][1]+=d.dot(d),l[0]+=_.dot(g),l[1]+=d.dot(g)}var y,w,e=u[0][0]*u[1][1]-u[1][0]*u[0][1];1e-12<s(e)?(w=u[0][0]*l[1]-u[1][0]*l[0],y=(l[0]*u[1][1]-l[1]*u[0][1])/e,w=w/e):(e=u[0][0]+u[0][1],S=u[1][0]+u[1][1],y=w=1e-12<s(e)?l[0]/e:1e-12<s(S)?l[1]/S:0);var x,b,s=h.getDistance(o),S=1e-12*s;return y<S||w<S?y=w=s/3:(S=h.subtract(o),x=i.normalize(y),b=r.normalize(w),x.dot(S)-b.dot(S)>s*s&&(y=w=s/3,x=b=null)),[o,o.add(x||i.normalize(y)),h.add(b||r.normalize(w)),h]},reparameterize:function(t,e,n,i){for(var r=t;r<=e;r++)n[r-t]=this.findRoot(i,this.points[r],n[r-t]);for(var r=1,s=n.length;r<s;r++)if(n[r]<=n[r-1])return!1;return!0},findRoot:function(t,e,n){for(var i=[],r=[],s=0;s<=2;s++)i[s]=t[s+1].subtract(t[s]).multiply(3);for(s=0;s<=1;s++)r[s]=i[s+1].subtract(i[s]).multiply(2);var a=this.evaluate(3,t,n),o=this.evaluate(2,i,n),h=this.evaluate(1,r,n),e=a.subtract(e),h=o.dot(o)+e.dot(h);return Ut.isMachineZero(h)?n:n-e.dot(o)/h},evaluate:function(t,e,n){for(var i=e.slice(),r=1;r<=t;r++)for(var s=0;s<=t-r;s++)i[s]=i[s].multiply(1-n).add(i[s+1].multiply(n));return i[0]},chordLengthParameterize:function(t,e){for(var n=[0],i=t+1;i<=e;i++)n[i-t]=n[i-t-1]+this.points[i].getDistance(this.points[i-1]);for(var i=1,r=e-t;i<=r;i++)n[i]/=n[r];return n},findMaxError:function(t,e,n,i){for(var r=Math.floor((e-t+1)/2),s=0,a=t+1;a<e;a++){var o=this.evaluate(3,n,i[a-t]).subtract(this.points[a]),o=o.x*o.x+o.y*o.y;s<=o&&(s=o,r=a)}return{error:s,index:r}}}),p=A.extend({_class:"TextItem",_applyMatrix:!1,_canApplyMatrix:!1,_serializeFields:{content:null,orientation:"horizontal"},_prioritize:["applyMatrix","content","runs"],_orientation:"horizontal",_boundsOptions:{handle:!1},initialize:function(t){this._story=new I([this]);var e=t&&O.isPlainObject(t)&&t.x===Wt&&t.y===Wt;this._initialize(e&&t,!e&&Gt.read(arguments))},_serialize:function t(r,s){var e=t.base.call(this,r,s),n=e[1],i=this._story,a=i._content,o=i._getRuns(),h=i._paragraphs,u=i._paragraphKeys,l=i._itemKeys;function c(t,e,n){var i=e[n];i===Wt||O.equals(i,e._defaults[n])||(t[n]=O.serialize(i,r,!1,s))}return 1<o.length&&(n.runs=o.map(function(t){var e,n=t.style,i=n._values,r={content:a.slice(t.start,t.end)};for(e in n._defaults)e in i&&!(e in u||e in l)&&c(r,n,e);return r}),delete n.content),h.some(function(t){return!t.equals(h[0])})&&(n.paragraphs=h.map(function(t){var e,n={};for(e in u)c(n,t,e);return n})),e},_equals:function(t){var e=this._story,n=t._story,i=e._getRuns(),r=n._getRuns(),t=e._paragraphs,s=n._paragraphs;return e._content===n._content&&i.length===r.length&&i.every(function(t,e){e=r[e];return t.end===e.end&&t.style.equals(e.style)})&&t.length===s.length&&t.every(function(t,e){return t.equals(s[e])})},_changed:function t(e){t.base.call(this,e),136&e&&(this._layout=this._fontMetrics=null,(e=this.getNextTextItem())&&e._changed(9))},copyContent:function t(e){t.base.call(this,e),this._story=e._story._clone([this]),this._orientation=e._orientation,this._changed(521)},_getStyles:function(t,e){var n=this._story;return e in n._itemKeys?null:e in n._paragraphKeys?n._paragraphs:n._runs.map(function(t){return t.style})},getOrientation:function(){return this._orientation},setOrientation:function(t){t!==this._orientation&&(this._orientation=t,this._changed(9))},getTextPath:function(){return this._children&&this._children[0]||null},setTextPath:function(t){this.removeChildren(),t&&this.addChild(t),this._changed(9)},getChildren:function(){return null},getFirstChild:function(){return null},getLastChild:function(){return null},_hitTestChildren:function(){return null},getStory:function(){return this._story},link:function(t){var e=this._story,n=t._story;if(n===e)return!1;var t=e._items,i=n._items;e._append(n),t.splice.apply(t,[t.indexOf(this)+1,0].concat(i));for(var r=0,s=i.length;r<s;r++)i[r]._story=e;return e._changed(521),!0},isLinked:function(){return 1<this._story._items.length},unlink:function(t){var e=this._story,n=e._items,i=n.indexOf(this);if(t=t||"both",1<n.length&&!("before"===t&&0===i||"after"===t&&i===n.length-1)){if("both"===t){var r=this.getVisibleRange()._start,s=new I([this]);s._runs[0].style=new E(e._getRangeStyles("fontSize",r,r)[0],s),n.splice(i,1),this._story=s,e._changed(521),this._changed(521)}else{for(var i="before"===t?i:i+1,r=n[i].getVisibleRange()._start,a=n.splice(i,n.length-i),o=e._extract(r,a),h=0,u=a.length;h<u;h++)a[h]._story=o;e._changed(521),o._changed(521)}return!0}return!1},getNextTextItem:function(){var t=this._story._items;return t[t.indexOf(this)+1]||null},getPreviousTextItem:function(){var t=this._story._items;return t[t.indexOf(this)-1]||null},getVisibleRange:function(){var t=this._getVisibleRange();return new P(this._story,t[0],t[1])},_getVisibleRange:function(){return this._getLayout(),[this._getStart(),this._visibleEnd]},_getLayout:function(){return this._layout||(this._layout=this._layOut())},_layOut:function(){},_getStart:function(){var t=this.getPreviousTextItem();return t?t._getVisibleRange()[1]:0},isEmpty:function(){return!this._story._content},_measure:function(t,e,n){var s=this.getView(),i=this._story,r=i._content,a=i._runs,o=null,h=0,u=[],l=0,c=0,f=0,d=0,g="",_=0,p=null;function v(t,e,n,i,r){e=t.capitals?e.toUpperCase():e,r=function(t,e){p&&p.font===t.font&&p.tracking===t.tracking&&p.scale.equals(t.scale)&&p.y===t.y||(g="",_=0);var n=_;return g+=e,(_=s.getTextWidth(t.font,[g],t.tracking)*t.scale.x)-n}(t,e)+r;u.push(p=O.set({},t,{content:e,start:n,end:i,x:l,width:r})),l+=r}for(var m=0,y=a.length,w=0;m<y;m++){var x=a[m],b=w+x.length,S=Math.max(w,t),C=Math.min(b,e);if(S<C||t===e&&S===C&&!c){var x=x.style,M=this._getPiece(x),I=x.getLetterKerning();if(n||null!=I||M.rotation)for(o=o||i._getLetters();h<o.length&&o[h]._start<C;){var P=o[h++];P._start>=S&&(null!=I&&(p=null),v(M,P.getContent(),P._start,P._end,(I||0)/1e3*M.size))}else v(M,r.slice(S,C),S,C,0);c=Math.max(c,M.lineHeight),f=Math.max(f,M.ascent-M.y),d=Math.max(d,M.descent+M.y)}w=b}return{pieces:u,start:t,end:e,x:0,y:0,width:l,lineHeight:c,ascent:f,descent:d}},getLines:function(){var n=this,i=this._story;return this._getLayout().map(function(t){var e=new P(i,t.start,t.end);return e.baseline=new D(new Gt(t.x,t.y),new Gt(t.x+t.width,t.y)),e.bounds=n._getBox(t,t.x,t.y),e})},_getPiece:function(t){var e=t._getFontSize(),n=t._getCanvasFont(),i=t.getBaselinePosition(),r=Gt.read([t.getLetterScaling()]),s=this._fontMetrics||(this._fontMetrics={}),s=s[n]||(s[n]=this.getView().getFontMetrics(n)||{ascent:.75*e,descent:.25*e});return{style:t,font:n,tracking:t._getCanvasLetterSpacing(),size:e,ascent:s.ascent*r.y,descent:s.descent*r.y,lineHeight:t._getLineHeight(),y:-t.getBaselineShift()-("superscript"===i?1:"subscript"===i?-1:0)*e*t._scriptShift,scale:r,rotation:t.getLetterRotation(),capitals:"all"===t.getCapitals()}},_getBox:function(t,e,n){var i=(t.lineHeight-t.ascent-t.descent)/2;return new C(e,n-t.ascent-i,t.width,t.lineHeight)},_indent:function(t,e,n,i){var r="rtl"===t.getDirection(),e=t.getStartIndent()+(e?t.getFirstLineIndent():0),t=t.getEndIndent();return[n+(r?t:e),i-(r?e:t)]},_place:function(t,e,n,i){var r=e.getJustification(),s=e.getJustifyLast(),r=this._getSide("justify"===r&&n&&"all"!==s?s:r,e.getDirection()),e=i[0],i=i[1];"justify"===r||"all"===r?(this._justify(t,i-e),this._shift(t,e,0)):this._shift(t,"right"===r?i-t.width:"center"===r?(e+i-t.width)/2:e,0)},_justify:function(t,e){var n=t.pieces,i=(this._story._content.slice(n.length?n[0].start:0,n.length?n[n.length-1].end:0).match(/\s+/g)||[]).length;if(i&&e>t.width){for(var r=(e-t.width)/i,s=0,a=[],o=0,h=n.length;o<h;o++){var u=n[o],l=u.content.split(/(\s+)/),c=u.start,f=u.x;if(1===l.length)a.push(O.set({},u,{x:f+s}));else for(var d=0,g=l.length;d<g;d++){var _,p=l[d];p&&(_=this._measure(c,c+p.length).width,/^\s+$/.test(p)?s+=r:a.push(O.set({},u,{content:p,start:c,end:c+p.length,x:f+s,width:_})),f+=_,c+=p.length)}}t.pieces=a,t.width=e}},_shift:function(t,e,n){var i=t.pieces;t.x=(t.x||0)+e,t.y+=n;for(var r=0,s=i.length;r<s;r++)i[r].x+=e},_getSide:function(t,e){e="rtl"===e;return"start"===t?e?"right":"left":"end"===t?e?"left":"right":t},_draw:function(t,e,n){if(e.dontFinish||e.clip){var i=this.getInternalBounds();e.dontStart||t.beginPath(),t.rect(i.x,i.y,i.width,i.height)}else if(this._story._content){var r=this._getLayout(),s=!this._style.getStrokeScaling()&&n._getMeanScale();t.textAlign="left";for(var a=0,o=r.length;a<o;a++)for(var h=r[a],u=h.pieces,l=0,c=u.length;l<c;l++){var f,d=u[l],g=d.style,_=g.hasFill(),p=g.hasStroke(),v=d.size,m=d.dx||0;this._setStyles(t,e,n,null,g),p&&s&&(t.lineWidth/=s,t.setLineDash(t.getLineDash().map(function(t){return t/s})),t.lineDashOffset/=s),t.save(),t.translate(d.x,h.y+d.y),d.rotation&&t.rotate(d.rotation*Math.PI/180),_&&(f=v/15,g.getUnderline()&&t.fillRect(m,v/8,d.width,f),g.getStrikethrough()&&t.fillRect(m,.3*-v,d.width,f)),t.scale(d.scale.x,d.scale.y),m/=d.scale.x,t.font=d.font,t.letterSpacing=d.tracking,_&&(t.fillText(d.content,m,0),t.shadowColor="rgba(0,0,0,0)"),p&&t.strokeText(d.content,m,0),t.restore()}}},_hitTestSelf:function(t,e){if(e.fill)for(var n=this._getLayout(),i=0,r=n.length;i<r;i++)for(var s=n[i],a=s.pieces,o=0,h=a.length;o<h;o++){var u=a[o],l=t.subtract(u.x,s.y+u.y).rotate(-u.rotation),c=this._getBox(u,u.dx||0,0),c=l.clamp(c.getTopLeft(!0),c.getBottomRight(!0));if(u.style.getFillColor()&&l.subtract(c).divide(e._tolerancePadding).getLength()<=1)return new q("fill",this)}},getCharacterStyle:"#getStyle",setCharacterStyle:"#setStyle",getParagraphStyle:"#getStyle",setParagraphStyle:"#setStyle"});p.inject(O.each(["getContent","setContent","replace","range","getRuns","setRuns","getParagraphs","setParagraphs","getWords","getLetters"],function(e){this[e]=function(){var t=this._story;return t[e].apply(t,arguments)}},{beans:!0}));var M=p.extend({_class:"PointText",initialize:function(){p.apply(this,arguments)},getPoint:function(){var t=this._matrix.getTranslation();return new c(t.x,t.y,this,"setPoint")},setPoint:function(){var t=Gt.read(arguments);this.translate(t.subtract(this._matrix.getTranslation()))},_layOut:function(){for(var t=this._story,e=t._content.length,n=new P(t,this._getStart(),e).getParagraphs(),i=[],r=0,s=0,a=0,o=n.length;a<o;a++){var h=n[a],u=t._getParagraph(h._start).style,h=this._measure(h._start,h._end);0<a&&(r+=h.lineHeight+Math.max(s,u.getSpaceBefore())),s=u.getSpaceAfter(),h.y=r,this._place(h,u,!0,this._indent(u,!0,0,0)),i.push(h)}return this._visibleEnd=e,i},_getBounds:function(t,e){for(var n=this._getLayout(),i=new C,r=0,s=0,a=n.length;s<a;s++)for(var o=n[s],h=this._getBox(o,o.x,o.y),i=s?i.unite(h):h,u=0,l=o.pieces.length;u<l;u++){var c=o.pieces[u].style;c.hasStroke()&&(r=Math.max(r,c.getStrokeWidth()))}return e.stroke&&r&&(i=i.expand(r)),t?t._transformBounds(i,i):i}}),I=(p.extend(new function(){var i={startOffset:0,endOffset:null,alignment:"baseline",spacing:0};return O.each(i,function(t,e){var n=O.capitalize(e),i="_"+e;this[i]=t,this["get"+n]=function(){return this[i]},this["set"+n]=function(t){this[i]=t,this._changed(9)}},{_class:"PathText",_serializeFields:O.set({textPath:null},i),copyContent:function t(e){for(var n in t.base.call(this,e),i){n="_"+n;this[n]=e[n]}}})},{initialize:function(t,e){var n=O.isPlainObject(t);this._children=[],p.call(this,n?t:null),n||(this.setTextPath(t),e&&this.setOrientation(e))},_layOut:function(){for(var e=this.getTextPath(),t=this._story,n=this._getStart(),i=(e?e._children||[e]:[]).map(function(t){return new S(t,.25,32,!1,t===e?e._matrix:e._matrix.appended(t._matrix))}),r=i.map(function(t){return t.length}),s=r.reduce(function(t,e){return t+e},0),a=Math.max(0,Math.min(this._startOffset,s)),o=null==this._endOffset?s:Math.max(a,Math.min(this._endOffset,s)),h=this._spacing,s=this._measure(n,t._content.length,!0),u=s.pieces,l=[],c=0,f=0,d=u.length;f<d;f++){if(c+(p=u[f]).width>o-a)break;p.x=c,l.push(p),c+=p.width+h}c-=l.length?h:0;for(var t=t._getParagraph(n).style,t=this._getSide(t.getJustification(),t.getDirection()),g="right"===t?o-c:"center"===t?a+(o-a-c)/2:a,t=this._alignment,_="ascender"===t?s.ascent:"descender"===t?-s.descent:"center"===t?(s.ascent-s.descent)/2:0,f=0,d=l.length;f<d;f++){for(var p,v=g+(p=l[f]).x+p.width/2,m=0;m<r.length-1&&v>r[m];)v-=r[m],m++;var y=i[m],w=y.getTangentAt(v).normalize(),y=y.getPointAt(v).add(w.rotate(90).multiply(_+p.y));p.x=y.x,p.y=y.y,p.dx=-p.width/2,p.rotation+=w.getAngle()}t=l[l.length-1];return this._visibleEnd=t?t.end:n,[O.set(s,{pieces:l,end:this._visibleEnd,width:c})]},_getBounds:function(t,e){for(var n=this._getLayout()[0].pieces,i=null,r=0,s=n.length;r<s;r++){var a=n[r],o=this._getBox(a,a.dx,0),a=(new F).translate(a.x,a.y).rotate(a.rotation);t&&a.prepend(t),o=a._transformBounds(o,o),i=i?i.unite(o):o}return i||new C}}),p.extend(new function(){var i={columns:1,rows:1,gutter:18,inset:0,verticalAlign:"top"};return O.each(i,function(t,e){var n=O.capitalize(e),i="_"+e;this[i]=t,this["get"+n]=function(){return this[i]},this["set"+n]=function(t){this[i]=t,this._changed(9)}},{_class:"AreaText",_serializeFields:O.set({textPath:null},i),copyContent:function t(e){for(var n in t.base.call(this,e),i){n="_"+n;this[n]=e[n]}}})},{initialize:function(t,e){var n=O.isPlainObject(t)&&t.width===Wt;this._children=[],p.call(this,n?t:null),n||(this.setTextPath(t instanceof w?t:new V.Rectangle({rectangle:C.read([t]),insert:!1})),e&&this.setOrientation(e))},_installEvents:function t(e){t.base.call(this,e),this._layout=null},fitHeight:function(){var e=this,n=this.getTextPath();if(n){var t=n.getBounds();t.height||(n=new V.Rectangle({rectangle:new C(t.x,t.y,t.width,1),insert:!1}),this.setTextPath(n));function i(t){return n.scale(1,t/n.getBounds().height,r),e._getVisibleRange()[1]===e._story._content.length}for(var r=t.getTopCenter(),s=0,a=n.getBounds().height,o=0;!i(a)&&o++<32;)s=a,a*=2;if(o<=32){for(;.01<a-s;){var h=(s+a)/2;i(h)?a=h:s=h}i(a)}else i(t.height||1)}return this},_getLayout:function t(){var e=this.getLayer(),e=e&&e._textWrapVersion;return this._textWrapVersion!==e&&(this._textWrapVersion=e,this._layout=null),t.base.call(this)},_layOut:function(){function s(t){for(var e=p.pos,n=p.region,i=p.y,r=m._getParagraph(e),s=r.style,a=e===r.start&&null!==i?Math.max(p.spaceAfter,s.getSpaceBefore()):0,o=[],h=!1;y[n];){var u=y[n],l=v._measure(e,Math.min(e+1,r.end)),c=null===i?u.top+x[n]+l.ascent:i+l.lineHeight+a;if(!l.lineHeight||l.lineHeight<0)break;if(c+l.descent>u.bottom)n++,i=null;else{var f=v._getSpans(u,c,l,w);"rtl"===s.getDirection()&&f.reverse();for(var d=0,g=f.length;d<g&&!h;d++){var _=f[d],_=v._breakLine(e,r,e===r.start,_,t?t(o.length):0,_[1]-_[0]>=u.width-1e-7);_&&(_.y=c,_.region=n,o.push(_),h=(e=_.end)===r.end)}if(i=c,a=0,h)break}}return{lines:o,paragraph:s,isComplete:h,state:{pos:e,region:n,y:i,spaceAfter:s.getSpaceAfter()}}}function e(t,e,n){for(var i=0;e<t-i;){var r=(i+t)/2;n(r)?t=r:i=r}return[i,t]}function a(n,i){function r(e){return function(t){return i<=t?e:0}}var t=y.reduce(function(t,e){return Math.max(t,e.width)},0);return 0<(t=e(t,.5,function(t){return e=s(r(t)),t=n,!e.isComplete||e.lines.length!==t;var e})[0])&&s(r(t))}function n(){var t=[];p={pos:v._getStart(),region:0,y:null,spaceAfter:0};do{var e,n=(e=s()).lines,i=n.length,r=e.paragraph.getLineWrap()}while(e.isComplete&&1<i&&("balance"===r?e=a(i,0)||e:"pretty"===r&&n[i-1].width<n[i-2].width/3&&(e=a(i,Math.max(0,i-4))||e)),t.push.apply(t,e.lines),p=e.state,(e=e.isComplete&&/^(\r\n|\n|\r)/.exec(o.slice(p.pos)))&&(p.pos+=e[0].length),e);return t}function i(t,e){for(var n=t.length-1;0<=n;n--){var i=t[n];if(i.region===e)return{line:i,free:y[e].bottom-i.y-i.descent}}return null}var p,v=this,m=this._story,o=m._content,y=this._getRegions(),w=this._getTextWraps(),x=y.map(function(){return 0}),t=n(),r=this._verticalAlign;if("top"!==r)for(var h=0,u=y.length;h<u;h++){var l,c,f,d=i(t,h);d&&0<d.free&&(l=d.line.end,(null===(f=(c=function(t){x[h]=t;var e=i(n(),h);return e&&e.line.end===l?e.free-("center"===r?t:0):null})("center"===r?d.free/2:d.free))||.01<Math.abs(f))&&(x[h]=e(d.free,.01,function(t){t=c(t);return null===t||t<0})[0]),t=n())}return this._visibleEnd=p.pos,t},_getRegions:function(){var t=this.getTextPath(),e=[];if(t)for(var n=t.getBounds().expand(-2*this._inset),i=this._gutter,r=Math.max(1,this._rows),s=Math.max(1,this._columns),a=(n.width-i*(s-1))/s,o=(n.height-i*(r-1))/r,h=0;h<r;h++)for(var u=0;u<s;u++)e.push(new C(n.x+u*(a+i),n.y+h*(o+i),a,o));return e},_getSpans:function(t,e,n,i){function u(t,e){for(var n=t.concat(e).sort(function(t,e){return t[0]-e[0]}),i=[],r=0,s=n.length;r<s;r++){var a=i[i.length-1],o=n[r];a&&o[0]<=a[1]?a[1]=Math.max(a[1],o[1]):i.push(o.slice())}return i}function r(t,e){for(var n=[],i=0,r=t.length;i<r;i++)for(var s=0,a=e.length;s<a;s++){var o=Math.max(t[i][0],e[s][0]),h=Math.min(t[i][1],e[s][1]);o<h&&n.push([o,h])}return n}function s(t,e){for(var n=[],i=0,r=t.length;i<r;i++)for(var s=t[i],a=s.getBounds(),o=s.getIntersections(new V.Line({from:[a.left-1,e],to:[a.right+1,e],insert:!1})).map(function(t){return t.point.x}).sort(function(t,e){return t-e}),h=0;h+1<o.length;h+=2)n.push([o[h],o[h+1]]);return u(n,[])}for(var a,o,h=this,l=e-n.ascent,c=e+n.descent,f=(l+c)/2,d=[l,f,c].reduce(function(t,e){return r(t,s([h.getTextPath()],e))},[[t.left,t.right]]),g=0,_=i.length;g<_;g++)var p=i[g],v=p.offset,m=p.invert,y=[l-v,l,f,c,c+v].reduce(function(t,e){e=s(p.paths,e);return t?(m?r:u)(t,e):e},null).map(function(t){return m?[t[0]+v,t[1]-v]:[t[0]-v,t[1]+v]}),d=m?r(d,y):(a=d,o=u(y,[]),r(a,o.reduce(function(t,e){var n=t.pop();return t.concat([[n[0],e[0]],[e[1],n[1]]])},[[-1/0,1/0]])));return d},_getTextWraps:function(){var t,e=this.getLayer(),n=e&&e._textWrapItems,o=this.getGlobalMatrix(!0).inverted(),i=[],h=function(t,e){var n=o.appended(t._parent.getGlobalMatrix(!0));if(t instanceof w){var i=t.clone({insert:!1,deep:!0});i.transform(n),e.push(i)}else if(t instanceof v)for(var i=t._getClipItem(),r=i?[i]:t._children,s=0,a=r.length;s<a;s++)r[s]._visible&&h(r[s],e);else e.push(new V.Rectangle({rectangle:t.getBounds(n),insert:!1}));return e};for(t in n){var r=n[t];r!==this&&r.isAbove(this)&&function(t){for(;t!==e;t=t._parent)if(!t._visible)return!1;return!0}(r)&&i.push(O.set({paths:h(r,[])},r._textWrap))}return i},_breakLine:function(r,t,e,n,i,s){function a(t){var e,n,i=h._measure(r,r+u.slice(r,t).replace(/\s+$/,"").length);return"\xad"===u[t-1]&&(e=i.pieces[i.pieces.length-1],n=h.getView().getTextWidth(e.font,["-"],e.tracking)*e.scale.x,i.pieces.push(O.set({},e,{content:"-",start:t,end:t,x:e.x+e.width,width:n})),i.width+=n),i}for(var o,h=this,u=this._story._content,l=t.style,n=this._indent(l,e,n[0],n[1]),c=/[^\s\u00ad]*\u00ad|\S+\s*|\s+/g,f=u.slice(r,t.end),d=[];o=c.exec(f);)d.push(r+o.index+o[0].length);function g(t){return a(d[t]).width<=_}for(var _=n[1]-n[0]-i,p=-1,v=0;v<d.length&&g(v);)v=2*(p=v)+1;for(v=Math.min(v,d.length);1<v-p;){var m=p+v>>1;g(m)?p=m:v=m}i=0<=p?d[p]:r;if(i===r&&d.length){if(!s)return null;i=d[0]}s=a(i);return this._place(s,l,i===t.end,n),s.end=i,s}}),O.extend({_class:"TextStory",beans:!0,_paragraphKeys:{justification:!0,justifyLast:!0,justifySpacing:!0,startIndent:!0,endIndent:!0,firstLineIndent:!0,spaceBefore:!0,spaceAfter:!0,hyphenation:!0,composer:!0,lineWrap:!0,tabs:!0,direction:!0},_itemKeys:{fillRule:!0,strokeScaling:!0,shadowColor:!0,shadowBlur:!0,shadowOffset:!0,selectedColor:!0},initialize:function(t){this._content="",this._runs=[{length:0,style:new E(null,this)}],this._paragraphs=[new E(null,this)],this._items=t||[]},getTextItems:function(){return this._items.slice()},_clone:function(t){var e=new I(t);return e._content=this._content,e._runs=this._runs.map(function(t){return{length:t.length,style:new E(t.style,e)}}),e._paragraphs=this._paragraphs.map(function(t){return new E(t,e)}),e},_append:function(t){var e=this,n=t._runs.map(function(t){return{length:t.length,style:new E(t.style,e)}});this._content+=t._content,this._runs=this._runs.concat(n).filter(function(t){return 0<t.length}),this._runs.length||(this._runs=[n[0]]),this._paragraphs=this._paragraphs.concat(t._paragraphs.slice(1).map(function(t){return new E(t,e)}))},_extract:function(t,e){var n=this._clone(e),i=this._content,e=this._paragraphs[this._countBreaks(i.slice(0,t))];return n.replace("",0,t),n._paragraphs[0]=new E(e,n),this.replace("",t,i.length),n},_getStyles:function(){},_changed:function(t){for(var e=this._items,n=0,i=e.length;n<i;n++)e[n]._changed(t)},getContent:function(){return this._content},setContent:function(t){this.replace(t,0,this._content.length)},replace:function(t,e,n){e&&e.start!==Wt&&(n=e.end,e=e.start);var i=this._content,r=i.length,s=this._runs,a=this._paragraphs;t=""+t,e=Math.max(0,Math.min(e,r)),n=Math.max(e,Math.min(n,r));var o=this._split(e),h=this._split(n),r=(!(o<h)&&s[o-1]||s[o]).style;s.splice(o,h-o,{length:t.length,style:new E(r,this)}),this._runs=s.filter(function(t){return 0<t.length}),this._runs.length||(this._runs=[s[o]]);for(var s=this._countBreaks(i.slice(0,e)),o=this._countBreaks(i.slice(e,n)),u=this._countBreaks(t),l=a[s],c=[],f=0;f<u;f++)c.push(new E(l,this));a.splice.apply(a,[s+1,o].concat(c)),this._content=i.slice(0,e)+t+i.slice(n),this._changed(521)},_getParagraph:function(t){var e=this._content,n=e.slice(0,t),i=/(\r\n|\n|\r)[^\r\n]*$/.exec(n),r=/\r\n|\n|\r/.exec(e.slice(t));return{style:this._paragraphs[this._countBreaks(n)],start:i?i.index+i[1].length:0,end:r?t+r.index:e.length}},_countBreaks:function(t){t=t.match(/\r\n|\n|\r/g);return t?t.length:0},_split:function(t){for(var e=this._runs,n=0,i=e.length,r=0;n<i;n++){var s=e[n];if(r===t)return n;if(t<r+s.length)return e.splice(n+1,0,{length:r+s.length-t,style:new E(s.style,this)}),s.length=t-r,n+1;r+=s.length}return e.length},_getRangeStyles:function(t,e,n,i){var r=this._runs;if(t in this._itemKeys)return[];if(t in this._paragraphKeys){var s=this._content,t=this._countBreaks(s.slice(0,e)),s=this._countBreaks(s.slice(0,Math.max(e,n-1)));return this._paragraphs.slice(t,s+1)}if(i){var a=this._split(e);return r.slice(a,this._split(n)).map(function(t){return t.style})}for(var o=e<n?e:Math.max(0,e-1),h=e<n?n:o+1,u=[],a=0,l=r.length,c=0;a<l;a++){var f=r[a],d=c+f.length;o<d&&c<h&&u.push(f.style),c=d}return u.length?u:[r[0].style]},range:function(t,e){return new P(this,t,e)},getRuns:function(){var e=this;return this._getRuns().map(function(t){return new P(e,t.start,t.end)})},_getRuns:function(){for(var t=this._runs,e=[],n=0,i=t.length,r=0,s=0;n<i;n++){var a=t[n],o=t[n+1];s+=a.length,o&&a.style.equals(o.style)||(e.push({start:r,end:s,style:a.style}),r=s)}return e},setRuns:function(t){var n=this,e=(t=t.map(function(t){return t instanceof P?t.toJSON():t})).map(function(t){return t.content||""}).join("");this.setContent(e),this._runs=t.map(function(t){var e=new E(n._runs[0].style,n);return e.set(t),{length:(t.content||"").length,style:e}}).filter(function(t){return 0<t.length}),this._runs.length||(this._runs=[{length:0,style:new E(null,this)}]),this._changed(521)},getParagraphs:function(){for(var t,e=[],n=/\r\n|\n|\r/g,i=this._content,r=0;t=n.exec(i);)e.push(new P(this,r,t.index)),r=t.index+t[0].length;return e.push(new P(this,r,i.length)),e},setParagraphs:function(t){for(var e=this._paragraphs,n=this._paragraphKeys,i=0,r=Math.min(t.length,e.length);i<r;i++){var s,a=t[i],o=e[i];for(s in n){var h=a[s];h!==Wt&&(o[s]=h)}}},getWords:function(){return this._segment("word",/\S+/g)},getLetters:function(){return this._segment("grapheme",/[\s\S]/g)},_getLetters:function(){return this._lettersOf!==this._content&&(this._letters=this.getLetters(),this._lettersOf=this._content),this._letters},_segment:function(t,e){var n,i=this._content,r=[],s="undefined"!=typeof Intl&&Intl.Segmenter;if(s)for(var a=new s(Wt,{granularity:t}).segment(i)[Symbol.iterator]();!(o=a.next()).done;){var o=o.value;"word"===t&&!o.isWordLike||r.push(new P(this,o.index,o.index+o.segment.length))}else for(;n=e.exec(i);)r.push(new P(this,n.index,n.index+n[0].length));return r}})),P=O.extend({_class:"TextRange",beans:!0,initialize:function(t,e,n){var i=t._content.length;this._story=t,this._start=Math.max(0,Math.min(e,i)),this._end=Math.max(this._start,Math.min(n,i)),this._style=new E(null,this)},getStory:function(){return this._story},getStart:function(){return this._start},getEnd:function(){return this._end},getContent:function(){return this._story._content.slice(this._start,this._end)},getStyle:function(){return this._style},setStyle:function(t){this._style.set(t)},_getStyles:function(t,e,n){return this._story._getRangeStyles(e,this._start,this._end,n)},_changed:function(t){this._story._changed(t)},toJSON:function(){var t,e=this._style,n=e._defaults,i={start:this._start,end:this._end,content:this.getContent()};for(t in n){var r=e[t];r===Wt||O.equals(r,n[t])||(i[t]=O.serialize(r))}return i},toString:function(){return this.getContent()}},O.each(["Runs","Paragraphs","Words","Letters"],function(t){var r="get"+t;this[r]=function(){var e=this._story,n=this._start,i=this._end;return e[r]().filter(function(t){return t._start<i&&t._end>n||t._start===t._end&&t._start>=n&&t._start<=i}).map(function(t){return new P(e,Math.max(t._start,n),Math.min(t._end,i))})}},{beans:!0})),T=O.extend(new function(){var v,m={gray:["gray"],rgb:["red","green","blue"],hsb:["hue","saturation","brightness"],hsl:["hue","saturation","lightness"],gradient:["gradient","origin","destination","highlight"]},y={},w={transparent:[0,0,0,0]};var r=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],n={"rgb-hsb":function(t,e,n){var i=Math.max(t,e,n),r=i-Math.min(t,e,n);return[0==r?0:60*(i==t?(e-n)/r+(e<n?6:0):i==e?(n-t)/r+2:(t-e)/r+4),0===i?0:r/i,i]},"hsb-rgb":function(t,e,n){t=(t/60%6+6)%6;var i=Math.floor(t),t=t-i,t=[n,n*(1-e),n*(1-e*t),n*(1-e*(1-t))];return[t[(i=r[i])[0]],t[i[1]],t[i[2]]]},"rgb-hsl":function(t,e,n){var i=Math.max(t,e,n),r=Math.min(t,e,n),s=i-r,a=0==s,o=(i+r)/2;return[a?0:60*(i==t?(e-n)/s+(e<n?6:0):i==e?(n-t)/s+2:(t-e)/s+4),a?0:o<.5?s/(i+r):s/(2-i-r),o]},"hsl-rgb":function(t,e,n){if(0===e)return[n,n,n];for(var i=[(t=(t/360%1+1)%1)+1/3,t,t-1/3],r=n<.5?n*(1+e):n+e-n*e,s=2*n-r,a=[],o=0;o<3;o++){var h=i[o];h<0&&(h+=1),1<h&&--h,a[o]=6*h<1?s+6*(r-s)*h:2*h<1?r:3*h<2?s+(r-s)*(2/3-h)*6:s}return a},"rgb-gray":function(t,e,n){return[.2989*t+.587*e+.114*n]},"gray-rgb":function(t){return[t,t,t]},"gray-hsb":function(t){return[0,0,t]},"gray-hsl":function(t){return[0,0,t]},"gradient-rgb":function(){return[]},"rgb-gradient":function(){return[]}};return O.each(m,function(t,s){y[s]=[],O.each(t,function(t,e){var n=O.capitalize(t),i=/^(hue|saturation)$/.test(t),r=y[s][e]="gradient"===s?"gradient"===t?function(t){var e=this._components[0];return e!==(t=B.read(Array.isArray(t)?t:arguments,0,{readNull:!0}))&&(e&&e._removeOwner(this),t&&t._addOwner(this)),t}:function(){return Gt.read(arguments,0,{readNull:"highlight"===t,clone:!0})}:function(t){return null==t||isNaN(t)?0:+t};this["get"+n]=function(){return(this._type===s||i&&/^hs[bl]$/.test(this._type)?this._components:this._convert(s))[e]},this["set"+n]=function(t){this._type===s||i&&/^hs[bl]$/.test(this._type)||(this._components=this._convert(s),this._properties=m[s],this._type=s),this._components[e]=r.call(this,t),this._changed()}},this)},{_class:"Color",_readIndex:!0,initialize:function t(e){var n,i,r=arguments,s=this.__read,a=0,o=null!=(e=Array.isArray(e)?(r=e)[0]:e)&&typeof e;if("string"===o&&e in m&&(h=e,e=r[1],Array.isArray(e)?(n=e,l=r[2]):(s&&(a=1),r=O.slice(r,1),o=typeof e)),!n){if(i="number"===o?r:"object"===o&&null!=e.length?e:null){var h=h||(3<=i.length?"rgb":"gray"),u=m[h].length,l=i[u];s&&(a+=i===arguments?u+(null!=l?1:0):1),i.length>u&&(i=O.slice(i,0,u))}else if("string"===o){u=function(t){var e=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i)||t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i),n="rgb";if(e)for(var i=e[4]?4:3,r=new Array(i),s=0;s<i;s++){var a=e[s+1];r[s]=parseInt(1==a.length?a+a:a,16)/255}else if(e=t.match(/^(rgb|hsl)a?\((.*)\)$/)){n=e[1],r=e[2].trim().split(/[,\s]+/g);for(var o="hsl"===n,s=0,h=Math.min(r.length,4);s<h;s++){var u,l=r[s],a=parseFloat(l);o?0===s?(u=l.match(/([a-z]*)$/)[1],a*={turn:360,rad:180/Math.PI,grad:.9}[u]||1):s<3&&(a/=100):s<3&&(a/=/%$/.test(l)?100:255),r[s]=a}}else{var c,f=w[t];f||(v||(v=ft.getContext(1,1,{willReadFrequently:!0}))&&(v.globalCompositeOperation="copy"),f=v?(v.fillStyle="rgba(0,0,0,0)",v.fillStyle=t,v.fillRect(0,0,1,1),c=v.getImageData(0,0,1,1).data,w[t]=[c[0]/255,c[1]/255,c[2]/255]):[0,0,0]),r=f.slice()}return[n,r]}(e);h=u[0],4===(n=u[1]).length&&(l=n[3],n.length--)}else if("object"===o)if(e.constructor===t){if(h=e._type,n=e._components.slice(),l=e._alpha,"gradient"===h)for(var c=1,f=n.length;c<f;c++){var d=n[c];d&&(n[c]=d.clone())}}else if(e.constructor===B)h="gradient",i=r;else{h="hue"in e?"lightness"in e?"hsl":"hsb":"gradient"in e||"stops"in e||"radial"in e?"gradient":"gray"in e?"gray":"rgb";var g=m[h],_=y[h];this._components=n=[];for(c=0,f=g.length;c<f;c++)null==(p=e[g[c]])&&!c&&"gradient"===h&&"stops"in e&&(p={stops:e.stops,radial:e.radial}),null!=(p=_[c].call(this,p))&&(n[c]=p);l=e.alpha}s&&h&&(a=1)}if(this._type=h||"rgb",!n){this._components=n=[];for(var p,c=0,f=(_=y[this._type]).length;c<f;c++)null!=(p=_[c].call(this,i&&i[c]))&&(n[c]=p)}return this._components=n,this._properties=m[this._type],this._alpha=l,s&&(this.__read=a),this},set:"#initialize",_serialize:function(t,e){var n=this.getComponents();return O.serialize(/^(gray|rgb)$/.test(this._type)?n:[this._type].concat(n),t,!0,e)},_changed:function(){this._canvasStyle=null,this._owner&&(this._setter?this._owner[this._setter](this):this._owner._changed(129))},_convert:function(t){var e;return this._type===t?this._components.slice():(e=n[this._type+"-"+t])?e.apply(this,this._components):n["rgb-"+t].apply(this,n[this._type+"-rgb"].apply(this,this._components))},convert:function(t){return new T(t,this._convert(t),this._alpha)},getType:function(){return this._type},setType:function(t){this._components=this._convert(t),this._properties=m[t],this._type=t},getComponents:function(){var t=this._components.slice();return null!=this._alpha&&t.push(this._alpha),t},getAlpha:function(){return null!=this._alpha?this._alpha:1},setAlpha:function(t){this._alpha=null==t?null:Math.min(Math.max(t,0),1),this._changed()},hasAlpha:function(){return null!=this._alpha},equals:function(t){var e=O.isPlainValue(t,!0)?T.read(arguments):t;return e===this||e&&this._class===e._class&&this._type===e._type&&this.getAlpha()===e.getAlpha()&&O.equals(this._components,e._components)||!1},toString:function(){for(var t=this._properties,e=[],n="gradient"===this._type,i=x.instance,r=0,s=t.length;r<s;r++){var a=this._components[r];null!=a&&e.push(t[r]+": "+(n?a:i.number(a)))}return null!=this._alpha&&e.push("alpha: "+i.number(this._alpha)),"{ "+e.join(", ")+" }"},toCSS:function(t){var e=this._convert("rgb"),n=t||null==this._alpha?1:this._alpha;function i(t){return Math.round(255*(t<0?0:1<t?1:t))}return e=[i(e[0]),i(e[1]),i(e[2])],n<1&&e.push(n<0?0:n),t?"#"+((1<<24)+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1):(4==e.length?"rgba(":"rgb(")+e.join(",")+")"},toCanvasStyle:function(t,e,n){var i=!("gradient"===this._type&&n);if(this._canvasStyle&&i)return this._canvasStyle;if("gradient"!==this._type)return this._canvasStyle=this.toCSS();var r,s=this._components,a=s[0],o=a._stops,h=s[1],u=s[2],s=s[3],e=e&&e.inverted(),e=n&&e?n.appended(e):n||e;e&&(h=e._transformPoint(h),u=e._transformPoint(u),s=s&&e._transformPoint(s)),r=a._radial?(e=u.getDistance(h),!s||(a=s.subtract(h)).getLength()>e&&(s=h.add(a.normalize(e-.1))),t.createRadialGradient((s=s||h).x,s.y,0,h.x,h.y,e)):t.createLinearGradient(h.x,h.y,u.x,u.y);for(var l=0,c=o.length;l<c;l++){var f=o[l],d=f._offset;r.addColorStop(null==d?l/(c-1):d,f._color.toCanvasStyle())}return i&&(this._canvasStyle=r),r},transform:function(t){if("gradient"===this._type){for(var e=this._components,n=1,i=e.length;n<i;n++){var r=e[n];t._transformPoint(r,r,!0)}this._changed()}},statics:{_types:m,random:function(){var t=Math.random;return new T(t(),t(),t())},_setOwner:function(t,e,n){return t&&!(t=t._owner&&e&&t._owner!==e?t.clone():t)._owner^!e&&(t._owner=e||null,t._setter=n||null),t}}})},new function(){return O.each({add:function(t,e){return t+e},subtract:function(t,e){return t-e},multiply:function(t,e){return t*e},divide:function(t,e){return t/e}},function(a,t){this[t]=function(t){t=T.read(arguments);for(var e=this._type,n=this._components,i=t._convert(e),r=0,s=n.length;r<s;r++)i[r]=a(n[r],i[r]);return new T(e,i,null!=this._alpha?a(this._alpha,t.getAlpha()):null)}},{})}),B=O.extend({_class:"Gradient",initialize:function(t,e){this._id=o.get(),t&&O.isPlainObject(t)&&(this.set(t),t=e=null),null==this._stops&&this.setStops(t||["white","black"]),null==this._radial&&this.setRadial("string"==typeof e&&"radial"===e||e||!1)},_serialize:function(t,e){return e.add(this,function(){return O.serialize([this._stops,this._radial],t,!0,e)})},_changed:function(){for(var t=0,e=this._owners&&this._owners.length;t<e;t++)this._owners[t]._changed()},_addOwner:function(t){this._owners||(this._owners=[]),this._owners.push(t)},_removeOwner:function(t){t=this._owners?this._owners.indexOf(t):-1;-1!=t&&(this._owners.splice(t,1),this._owners.length||(this._owners=Wt))},clone:function(){for(var t=[],e=0,n=this._stops.length;e<n;e++)t[e]=this._stops[e].clone();return new B(t,this._radial)},getStops:function(){return this._stops},setStops:function(t){if(t.length<2)throw new Error("Gradient stop list needs to contain at least two stops.");var e=this._stops;if(e)for(var n=0,i=e.length;n<i;n++)e[n]._owner=Wt;for(n=0,i=(e=this._stops=N.readList(t,0,{clone:!0})).length;n<i;n++)e[n]._owner=this;this._changed()},getRadial:function(){return this._radial},setRadial:function(t){this._radial=t,this._changed()},equals:function(t){if(t===this)return!0;if(t&&this._class===t._class){var e=this._stops,n=t._stops,i=e.length;if(i===n.length){for(var r=0;r<i;r++)if(!e[r].equals(n[r]))return!1;return!0}}return!1}}),N=O.extend({_class:"GradientStop",initialize:function(t,e){var n=t,i=e;"object"==typeof t&&e===Wt&&(Array.isArray(t)&&"number"!=typeof t[0]?(n=t[0],i=t[1]):("color"in t||"offset"in t||"rampPoint"in t)&&(n=t.color,i=t.offset||t.rampPoint||0)),this.setColor(n),this.setOffset(i)},clone:function(){return new N(this._color.clone(),this._offset)},_serialize:function(t,e){var n=this._color,i=this._offset;return O.serialize(null==i?[n]:[n,i],t,!0,e)},_changed:function(){this._owner&&this._owner._changed(129)},getOffset:function(){return this._offset},setOffset:function(t){this._offset=t,this._changed()},getRampPoint:"#getOffset",setRampPoint:"#setOffset",getColor:function(){return this._color},setColor:function(){T._setOwner(this._color,null),this._color=T._setOwner(T.read(arguments,0),this,"setColor"),this._changed()},equals:function(t){return t===this||t&&this._class===t._class&&this._color.equals(t._color)&&this._offset==t._offset||!1}}),E=O.extend(new function(){var i={fillColor:null,fillRule:"nonzero",strokeColor:null,strokeWidth:1,strokeCap:"butt",strokeJoin:"miter",strokeScaling:!0,miterLimit:10,dashOffset:0,dashArray:[],shadowColor:null,shadowBlur:0,shadowOffset:new Gt,selectedColor:null},r=O.set({},i,{fontFamily:"sans-serif",fontWeight:"normal",fontStyle:"normal",fontSize:12,fontVariations:null,lineHeight:"auto",letterTracking:0,letterKerning:null,baselineShift:0,baselinePosition:"normal",letterScaling:1,letterRotation:0,capitals:"normal",underline:!1,strikethrough:!1,features:null,justification:"left",justifyLast:"left",justifySpacing:null,startIndent:0,endIndent:0,firstLineIndent:0,spaceBefore:0,spaceAfter:0,hyphenation:!1,composer:"paragraph",lineWrap:"normal",tabs:null,direction:null}),s=O.set({},r,{fillColor:new T}),u={strokeWidth:193,strokeCap:193,strokeJoin:193,strokeScaling:201,miterLimit:193},l={beans:!0},c={_class:"Style",beans:!0,initialize:function(t,e,n){this._values={},this._owner=e,this._project=e&&e._project||n||te.project,this._defaults=!e||e instanceof v?r:e instanceof p||e instanceof I||e instanceof P?s:i,t&&this.set(t)}};return O.each(r,function(t,r){var s=/Color$/.test(r),a="shadowOffset"===r,e=O.capitalize(r),o=r in i||"underline"===r||"strikethrough"===r?u[r]:9,h="set"+e,n="get"+e;c[h]=function(t){var e,n=this._owner,i=n&&n._getStyles(this,r,!0);i&&E.apply(i,r,t),"selectedColor"!==r&&i||!(r in this._defaults)||(e=this._values[r])!==t&&(s&&(e&&e.constructor===T&&(T._setOwner(e,null),e._canvasStyle=null),t&&t.constructor===T&&(t=T._setOwner(t,n,i&&h))),this._values[r]=t,n&&n._changed(o||129))},c[n]=function(t){var e,n=this._owner,i=n&&n._getStyles(this,r);return i&&!t?e=E.merge(i,r):r in this._defaults&&((e=this._values[r])===Wt?(e=this._defaults[r])&&e.clone&&(e=e.clone()):!(t=s?T:a?Gt:null)||e&&e.constructor===t||(this._values[r]=e=t.read([e],0,{readNull:!0,clone:!0}))),e=e&&s?T._setOwner(e,n,i&&h):e},l[n]=function(t){return this._style[n](t)},l[h]=function(t){this._style[h](t)}}),O.each({Font:"FontFamily",WindingRule:"FillRule"},function(t,e){var n="get"+e,e="set"+e;c[n]=l[n]="#get"+t,c[e]=l[e]="#set"+t}),c.getTracking=l.getTracking="#getLetterTracking",c.setTracking=l.setTracking="#setLetterTracking",l.getLeading=function(){return this._style.getLeading()},l.setLeading=function(t){this._style.setLeading(t)},A.inject(l),P.inject(l),c},{statics:{merge:function(t,e){for(var n,i="get"+O.capitalize(e),r=0,s=t.length;r<s;r++){var a=t[r][i]();if(r){if(!O.equals(n,a))return Wt}else n=a}return n},apply:function(t,e,n){for(var i="set"+O.capitalize(e),r=0,s=t.length;r<s;r++)t[r][i](n)}},set:function(t){var e,n=t instanceof E,i=n?t._values:t;if(i)for(var r in i)(r in this._defaults||r in this._formerNames)&&(e=i[r],this[r]=e&&n&&e.clone?e.clone():e)},equals:function(t){function e(t,e,n){var i,r=t._values,s=e._values,a=e._defaults;for(i in r){var o=r[i],h=s[i];if(!(n&&i in s||O.equals(o,h===Wt?a[i]:h)))return!1}return!0}return t===this||t&&this._class===t._class&&e(this,t)&&e(t,this,!0)||!1},_dispose:function(){for(var t=[this.getFillColor(),this.getStrokeColor(),this.getShadowColor()],e=0;e<3;e++)t[e]&&(t[e]._canvasStyle=null)},hasFill:function(){var t=this.getFillColor();return!!t&&0<t.alpha},hasStroke:function(){var t=this.getStrokeColor();return!!t&&0<t.alpha&&0<this.getStrokeWidth()},hasShadow:function(){var t=this.getShadowColor();return!!t&&0<t.alpha&&(0<this.getShadowBlur()||!this.getShadowOffset().isZero())},getView:function(){return this._project._view},_getCanvasFont:function(){var t=this.getFontSize(),e=this.getFontStyle(),n=this.getFontFamily().split(",").map(function(t){return t=t.trim(),/^(["'].*|[a-z-]+)$/i.test(t)?t:'"'+t.replace(/["\\]/g,"\\$&")+'"'});return"normal"===this.getBaselinePosition()||isNaN(t)||(t*=this._scriptSize),("normal"!==e?e+" ":"")+("small"===this.getCapitals()?"small-caps ":"")+this.getFontWeight()+" "+t+(/[a-z]/i.test(t+"")?" ":"px ")+n.join(", ")},_scriptSize:.583,_scriptShift:.333,_formerNames:{tracking:!0,leading:!0},_getCanvasLetterSpacing:function(){return this.getLetterTracking()/1e3+"em"},_getFontSize:function(){var t=this.getFontSize();return/pt|em|%|px/.test(t)?this.getView().getPixelSize(t):t},_getLineHeight:function(){var t=this.getLineHeight();return"auto"===t?1.2*this._getFontSize():"string"==typeof t?this.getView().getPixelSize(t):t*this._getFontSize()},getLeading:function(){return this.getLineHeight()===Wt?Wt:this._getLineHeight()},setLeading:function(t){this.setLineHeight(null==t?"auto":"number"==typeof t?t+"px":t)}}),R=new function(){function r(t,e,n,i){for(var r=["","webkit","moz","Moz","ms","o"],s=e[0].toUpperCase()+e.substring(1),a=0;a<6;a++){var o=r[a],o=o?o+s:e;if(o in t){if(!n)return t[o];t[o]=i;break}}}return{getStyles:function(t){var e=t&&9!==t.nodeType?t.ownerDocument:t,e=e&&e.defaultView;return e&&e.getComputedStyle(t,"")},getBounds:function(t,e){var n=t.ownerDocument,i=n.body,r=n.documentElement,s=t.getBoundingClientRect(),a=s.left-(r.clientLeft||i.clientLeft||0),t=s.top-(r.clientTop||i.clientTop||0);return e||(a+=(n=n.defaultView).pageXOffset||r.scrollLeft||i.scrollLeft,t+=n.pageYOffset||r.scrollTop||i.scrollTop),new C(a,t,s.width,s.height)},getViewportBounds:function(t){var e=t.ownerDocument,t=e.defaultView,e=e.documentElement;return new C(0,0,t.innerWidth||e.clientWidth,t.innerHeight||e.clientHeight)},getOffset:function(t,e){return R.getBounds(t,e).getPoint()},getSize:function(t){return R.getBounds(t,!0).getSize()},getInsets:function(t,e){var n=R.getStyles(t);function i(t){return parseFloat(n["padding"+t])+parseFloat(n["border"+t+"Width"])}return e?new j(i("Left"),i("Top")):new j(i("Left")+i("Right"),i("Top")+i("Bottom"))},isInvisible:function(t){return R.getSize(t).equals(new j(0,0))},isInView:function(t){return!R.isInvisible(t)&&R.getViewportBounds(t).intersects(R.getBounds(t,!0))},isInserted:function(t){return z.body.contains(t)},getPrefixed:function(t,e){return t&&r(t,e)},setPrefixed:function(t,e,n){if("object"==typeof e)for(var i in e)r(t,i,!0,e[i]);else r(t,e,!0,n)}}},H={add:function(t,e){if(t)for(var n in e)for(var i=e[n],r=n.split(/[\s,]+/g),s=0,a=r.length;s<a;s++){var o=r[s];t.addEventListener(o,i,t===z&&("touchstart"===o||"touchmove"===o)&&{passive:!1})}},remove:function(t,e){if(t)for(var n in e)for(var i=e[n],r=n.split(/[\s,]+/g),s=0,a=r.length;s<a;s++)t.removeEventListener(r[s],i,!1)},getPoint:function(t,i){function e(t){for(var e=0,n=t.length;e<n;e++)if(t[e].target===i)return t[e]}var n=t.targetTouches,r=t;return n&&(r=e(t.touches)||e(t.changedTouches)||(n.length?n:t.changedTouches)[0]),new Gt(r.pageX||r.clientX+z.documentElement.scrollLeft,r.pageY||r.clientY+z.documentElement.scrollTop)},getTarget:function(t){return t.target},getRelatedTarget:function(t){return t.relatedTarget},getOffset:function(t,e){return e=e||H.getTarget(t),H.getPoint(t,e).subtract(R.getOffset(e))}};H.requestAnimationFrame=new function(){var i,r=R.getPrefixed(k,"requestAnimationFrame"),s=!1,a=[];function o(){var t=a;a=[];for(var e=0,n=t.length;e<n;e++)t[e]();(s=r&&a.length)?r(o):i&&!a.length&&(clearInterval(i),i=null)}return function(t){a.push(t),r?s||(r(o),s=!0):i=i||setInterval(o,1e3/60)}};var W,Z,U,G,$,K,J,X,Y,Q,tt,et,nt,it=O.extend(t,{_class:"View",initialize:function t(e,n){function i(t){return n[t]||parseInt(n.getAttribute(t),10)}function r(){var t=new j(n.offsetWidth,n.offsetHeight);return t.isNaN()||t.isZero()?new j(i("width"),i("height")):t.subtract(R.getInsets(n))}var s,a,o,h,u;k&&n?(this._id=n.getAttribute("id"),null==this._id&&n.setAttribute("id",this._id="paper-view-"+t._id++),H.add(n,this._viewEvents),R.setPrefixed(n.style,{userDrag:u="none",userSelect:u,touchCallout:u,contentZooming:u,tapHighlightColor:"rgba(0,0,0,0)"}),l.hasAttribute(n,"resize")&&H.add(k,(a=this)._windowEvents={resize:function(){a.setViewSize(r())}}),s=r(),l.hasAttribute(n,"stats")&&"undefined"!=typeof Stats&&(this._stats=new Stats,h=(o=this._stats.domElement).style,u=R.getOffset(n),h.position="absolute",h.left=u.x+"px",h.top=u.y+"px",z.body.appendChild(o))):(s=new j(n),n=null),this._project=e,this._scope=e._scope,this._element=n,this._pixelRatio||(this._pixelRatio=k&&k.devicePixelRatio||1),this._setElementSize(s.width,s.height),this._viewSize=s,t._views.push(this),((t._viewsById[this._id]=this)._matrix=new F)._owner=this,t._focused||(t._focused=this),this._frameItems={},this._frameItemCount=0,this._itemEvents={native:{},virtual:{}},this._autoUpdate=!te.agent.node,this._needsUpdate=!1},remove:function(){if(!this._project)return!1;it._focused===this&&(it._focused=null),it._views.splice(it._views.indexOf(this),1),delete it._viewsById[this._id];var t=this._project;return t._view===this&&(t._view=null),H.remove(this._element,this._viewEvents),H.remove(k,this._windowEvents),this._element=this._project=null,this.off("frame"),this._animate=!1,this._frameItems={},!0},_events:O.each(A._itemHandlers.concat(["onResize","onKeyDown","onKeyUp"]),function(t){this[t]={}},{onFrame:{install:function(){this.play()},uninstall:function(){this.pause()}}}),_animate:!1,_time:0,_count:0,getAutoUpdate:function(){return this._autoUpdate},setAutoUpdate:function(t){(this._autoUpdate=t)&&this.requestUpdate()},update:function(t){},draw:function(){this.update()},requestUpdate:function(){var e;this._requested||(e=this,H.requestAnimationFrame(function(){var t;e._requested=!1,e._animate&&(e.requestUpdate(),(t=e._element)&&(R.getPrefixed(z,"hidden")&&"true"!==l.getAttribute(t,"keepalive")||!R.isInView(t))||e._handleFrame()),e._autoUpdate&&e.update()}),this._requested=!0)},play:function(){this._animate=!0,this.requestUpdate()},pause:function(){this._animate=!1},_handleFrame:function(){te=this._scope;var t=Date.now()/1e3,e=this._last?t-this._last:0;this._last=t,this.emit("frame",new O({delta:e,time:this._time+=e,count:this._count++})),this._stats&&this._stats.update()},_animateItem:function(t,e){var n=this._frameItems;e?(n[t._id]={item:t,time:0,count:0},1==++this._frameItemCount&&this.on("frame",this._handleFrameItems)):(delete n[t._id],0==--this._frameItemCount&&this.off("frame",this._handleFrameItems))},_handleFrameItems:function(t){for(var e in this._frameItems){e=this._frameItems[e];e.item.emit("frame",new O(t,{time:e.time+=t.delta,count:e.count++}))}},_changed:function(){this._project._changed(4097),this._bounds=this._decomposed=Wt},getElement:function(){return this._element},getProject:function(){return this._project},getScope:function(){return this._scope},getPixelRatio:function(){return this._pixelRatio},getResolution:function(){return 72*this._pixelRatio},getViewSize:function(){var t=this._viewSize;return new n(t.width,t.height,this,"setViewSize")},setViewSize:function(){var t=j.read(arguments),e=t.subtract(this._viewSize);e.isZero()||(this._setElementSize(t.width,t.height),this._viewSize.set(t),this._changed(),this.emit("resize",{size:t,delta:e}),this._autoUpdate&&this.update())},_setElementSize:function(t,e){var n=this._element;n&&(n.width!==t&&(n.width=t),n.height!==e&&(n.height=e))},getBounds:function(){return this._bounds||(this._bounds=this._matrix.inverted()._transformBounds(new C(new Gt,this._viewSize))),this._bounds},setBounds:function(){this.fitBounds(C.read(arguments))},getSize:function(){return this.getBounds().getSize()},isVisible:function(){return R.isInView(this._element)},isInserted:function(){return R.isInserted(this._element)},getPixelSize:function(t){var e,n,i,r=te.agent,s=this._element;return s&&r&&r.firefox?(n=s.parentNode,(i=z.createElement("div")).style.fontSize=t,n.appendChild(i),e=parseFloat(R.getStyles(i).fontSize),n.removeChild(i)):(n=this._context||ft.getContext(1,1))?(i=n.font,n.font=t+" serif",e=parseFloat(n.font),n.font=i,n!==this._context&&ft.release(n)):e=parseFloat(t),e},getTextWidth:function(t,e,n){var i=this._context||ft.getContext(1,1),r=0;if(i){var s=i.font,a=i.letterSpacing;i.font=t,i.letterSpacing=n;for(var o=0,h=e.length;o<h;o++)r=Math.max(r,i.measureText(e[o]).width);i.font=s,i.letterSpacing=a,i!==this._context&&ft.release(i)}return r},getFontMetrics:function(t){var e,n,i,r=this._context||ft.getContext(1,1),s=null;return r&&(e=r.font,r.font=t,i=(n=r.measureText("H")).fontBoundingBoxAscent,t=n.fontBoundingBoxDescent,i===Wt&&(i=n.emHeightAscent,t=n.emHeightDescent),i!==Wt&&(s={ascent:i,descent:t}),r.font=e,r!==this._context&&ft.release(r)),s}},O.each(["rotate","scale","shear","skew"],function(n){var i="rotate"===n;this[n]=function(){var t=arguments,e=(i?O:Gt).read(t),t=Gt.read(t,0,{readNull:!0});return this.transform((new F)[n](e,t||this.getCenter(!0)))}},{_decompose:function(){return this._decomposed||(this._decomposed=this._matrix.decompose())},translate:function(){var t=new F;return this.transform(t.translate.apply(t,arguments))},getCenter:function(){return this.getBounds().getCenter()},setCenter:function(){var t=Gt.read(arguments);this.translate(this.getCenter().subtract(t))},getZoom:function(){var t=this._decompose().scaling;return(Math.abs(t.x)+Math.abs(t.y))/2},setZoom:function(t){0<t&&isFinite(t)&&this.transform((new F).scale(t/this.getZoom(),this.getCenter()))},getRotation:function(){return this._decompose().rotation},setRotation:function(t){var e=this.getRotation();null!=e&&null!=t&&this._matrix.prepend((new F).rotate(t-e,this.projectToView(this.getCenter())))},getScaling:function(){var t=this._decompose().scaling;return new c(t.x,t.y,this,"setScaling")},setScaling:function(){var t=this.getScaling(),e=Gt.read(arguments,0,{clone:!0,readNull:!0});t&&e&&this.scale(e.x/t.x,e.y/t.y)},getMatrix:function(){return this._matrix},setMatrix:function(){var t=this._matrix;t.set.apply(t,arguments)},transform:function(t){this._matrix.append(t)},fitBounds:function(t,e){t=C.read(arguments),e=O.read(arguments);var n=this._matrix,i=this._viewSize,r=n._transformBounds(t),s=new Gt(n._a,n._c).getLength(),a=new Gt(n._b,n._d).getLength(),r=[i.width/r.width*s,i.height/r.height*a].filter(function(t){return 0<t&&isFinite(t)});this.setCenter(t.getCenter()),r.length&&(r=("cover"===e?Math.max:Math.min).apply(Math,r),n.prepend((new F).scale(new Gt(r/s,r/a),i.divide(2))))},scrollBy:function(){this.translate(Gt.read(arguments).negate())}}),{projectToView:function(){return this._matrix._transformPoint(Gt.read(arguments))},viewToProject:function(){return this._matrix._inverseTransform(Gt.read(arguments))},getEventPoint:function(t){var e=this._element,n=H.getOffset(t,e),i=R.getSize(e);return i.isZero()||(t=new j(e.offsetWidth,e.offsetHeight),n=n.multiply(t.divide(i)).subtract(R.getInsets(e,!0)).multiply(this.getViewSize().divide(t.subtract(R.getInsets(e))))),this.viewToProject(n)}},{statics:{_views:[],_viewsById:{},_id:0,create:function(t,e){return z&&"string"==typeof e&&(e=z.getElementById(e)),new(k?rt:it)(t,e)}}},new function(){var i,r,g=!1,s=!1;function a(t){t=H.getTarget(t);return t.getAttribute&&it._viewsById[t.getAttribute("id")]}function o(){var t=it._focused;if(!t||!t.isVisible())for(var e=0,n=it._views.length;e<n;e++)if((t=it._views[e]).isVisible()){it._focused=r=t;break}}function h(t,e,n){t._handleMouseEvent("mousemove",e,n)}var t,e,n,u,l={};k&&(t="touchstart",e="touchmove",n="touchend touchcancel","ontouchstart"in k&&k.navigator.userAgent.match(/mobile|tablet|ip(ad|hone|od)|android|silk/i)||(t+=" mousedown",e+=" mousemove",n+=" mouseup"),u={mouseout:function(t){var e=it._focused,n=H.getRelatedTarget(t);!e||n&&"HTML"!==n.nodeName||h(e,t)},scroll:o},l[t]=function(t){var e=it._focused=a(t);g||(g=!0,e._handleMouseEvent("mousedown",t))},u[e]=function(t){var e,n=it._focused;s||((e=a(t))?n!==e&&(n&&h(n,t),i=i||n,n=it._focused=r=e):r&&r===n&&(i&&!i.isInserted()&&(i=null),n=it._focused=i,i=null,o())),n&&h(n,t)},u[t]=function(){s=!0},u[n]=function(t){var e=it._focused;e&&g&&e._handleMouseEvent("mouseup",t),s=g=!1},H.add(z,u),H.add(k,{load:o}));var _,p,v,m,y,w,x,b,S=!1,C=!1,c={doubleclick:"click",mousedrag:"mousemove"},M=!1;function I(t,i,e,r,s,a,n){var o,h=!1;for(;t&&t!==n&&!function t(e,n){if(e.responds(n)){if(o=o||new ht(n,r,s,i||e,a?s.subtract(a):null),e.emit(n,o)&&(S=!0,o.prevented&&(C=!0),o.stopped))return h=!0}else if(n=c[n])return t(e,n)}(t,e);)t=t._parent;return h}function P(t,e,n,i,r,s){return t._project.removeOn(n),C=S=!1,y&&I(y,null,n,i,r,s)||e&&e!==y&&!e.isDescendant(y)&&I(e,null,"mousedrag"===n?"mousemove":n,i,r,s,y)||I(t,y||e||t,n,i,r,s)}function f(t,e){return e.modifiers&&ot.modifiers.set(e.modifiers),{type:t,timeStamp:null!=e.time?1e3*e.time:null!=e.timeStamp?e.timeStamp:Date.now(),button:e.button||0,cancelable:!0,defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0},stopPropagation:function(){}}}var T={mousedown:{mousedown:1,mouseup:1,mousedrag:1,click:1,doubleclick:1},mouseup:{mouseup:1,mousedrag:1,click:1,doubleclick:1},mousemove:{mousedrag:1,mousemove:1,mouseenter:1,mouseleave:1}};return{_viewEvents:l,dispatchMouseEvent:function(t,e,n){if(!/^mouse(down|move|up)$/.test(t))throw new Error("Unknown mouse event type: '"+t+"'.");n=f(t,n||{});return"mousedown"===t&&(it._focused=this,s=g=!0),this._handleMouseEvent(t,n,new Gt(e),!0),"mouseup"===t&&(s=g=!1),n.defaultPrevented},dispatchKeyEvent:function(t,e,n){if(!/^key(down|up)$/.test(t))throw new Error("Unknown key event type: '"+t+"'.");ot._handleKey("keydown"===t,e,(n=n||{}).character,f(t,n),this)},_handleMouseEvent:function(t,e,n,i){var r,s=this._itemEvents,a=s.native[t],o="mousemove"===t,h=this._scope.tool,u=this;e.shiftKey!==Wt&&ot.modifiers.set({shift:e.shiftKey,control:e.ctrlKey,alt:e.altKey,meta:e.metaKey}),o&&g&&(r="mousedrag",s.virtual[r]||u.responds(r)||h&&h.responds(r))&&(t="mousedrag"),n=n||this.getEventPoint(e);var l=H.getTarget(e),c=o&&!g&&l&&1===l.nodeType&&!l.contains(this._element),f=i||!c&&this.getBounds().contains(n),l=a&&f&&u._project.hitTest(n,{tolerance:u._scope.settings.hitTolerance,fill:!0,stroke:!0}),i=l&&l.item||null,c=!1,l={};if(l[t.substr(5)]=!0,a&&i!==m&&(m&&I(m,null,"mouseleave",e,n),i&&I(i,null,"mouseenter",e,n),m=i),M^f&&(I(this,null,f?"mouseenter":"mouseleave",e,n),c=!0),!f&&!l.drag||n.equals(p)||(P(this,i,o?t:"mousemove",e,n,p),c=!0),M=f,l.down&&f||l.up&&_){if(P(this,i,t,e,n,_),l.down){f=Date.now();if(b=!b&&i===w&&f-x<300&&n.getDistance(_)<3,v=w=i,x=f,!C&&i){for(var d=i;d&&!d.responds("mousedrag");)d=d._parent;d&&(y=i)}_=n}else l.up&&(C||i!==v||P(this,i,b?"doubleclick":"click",e,n,_),v=y=null);c=!(M=!1)}p=n,c&&h&&(S=h._handleMouseEvent(t,e,n,l)||S),!1!==e.cancelable&&(S&&!l.move||l.down&&function(t){if(u.responds("mouseup")||h&&h.responds("mouseup"))return 1;for(var e=t;e;e=e._parent)for(var n in T.mouseup)if(e.responds(n))return 1}(i))&&e.preventDefault()},_handleKeyEvent:function(e,n,i,r){var s,a=this._scope,t=a.tool;function o(t){t.responds(e)&&(te=a,t.emit(e,s=s||new at(e,n,i,r)))}o(this),t&&t.responds(e)&&o(t)},_countItemEvent:function(t,e){var n,i=this._itemEvents,r=i.native,i=i.virtual;for(n in T)r[n]=(r[n]||0)+(T[n][t]||0)*e;i[t]=(i[t]||0)+e},statics:{updateFocus:o,_resetState:function(){g=s=S=M=!1,i=r=_=p=v=m=y=w=x=b=null}}}}),rt=it.extend({_class:"CanvasView",initialize:function(t,e){if(!(e instanceof k.HTMLCanvasElement)){var n=j.read(arguments,1);if(n.isZero())throw new Error("Cannot create CanvasView with the provided argument: "+O.slice(arguments,1));e=ft.getCanvas(n)}(this._context=e.getContext("2d")).save(),this._pixelRatio=1,/^off|false$/.test(l.getAttribute(e,"hidpi"))||(this._pixelRatio=k.devicePixelRatio||1),it.call(this,t,e),this._needsUpdate=!0},remove:function t(){return this._context.restore(),t.base.call(this)},_setElementSize:function t(e,n){var i,r,s=this._pixelRatio,a=this._element;t.base.call(this,e*s,n*s),l.hasAttribute(a,"resize")||(i=a.style,r="border-box"===R.getStyles(a).boxSizing?R.getInsets(a):new j,i.width=e+r.width+"px",i.height=n+r.height+"px"),1!==s&&((r=this._context).restore(),r.save(),r.scale(s,s))},getContext:function(){return this._context},update:function(t){if(!this._needsUpdate&&!t)return!1;var e=this._project,n=this._context,t=this._viewSize;return n.clearRect(0,0,t.width+1,t.height+1),e&&e.draw(n,this._matrix,this._pixelRatio),!(this._needsUpdate=!1)}}),st=O.extend({_class:"Event",initialize:function(t){this.event=t,this.type=t&&t.type},prevented:!1,stopped:!1,preventDefault:function(){this.prevented=!0,this.event.preventDefault()},stopPropagation:function(){this.stopped=!0,this.event.stopPropagation()},stop:function(){this.stopPropagation(),this.preventDefault()},getTime:function(){return this.event.timeStamp/1e3},getTimeStamp:function(){return this.event.timeStamp},getModifiers:function(){return ot.modifiers}}),at=st.extend({_class:"KeyEvent",initialize:function(t,e,n,i){this.type=t,this.event=e,this.key=n,this.character=i},toString:function(){return"{ type: '"+this.type+"', key: '"+this.key+"', character: '"+this.character+"', modifiers: "+this.getModifiers()+" }"}}),ot=new function(){var h,i,n={"\t":"tab"," ":"space","\xa0":"space","\b":"backspace","\x7f":"delete",Spacebar:"space",Del:"delete",Win:"meta",Esc:"escape"},u={tab:"\t",space:" ",enter:"\r"},l={},c={},f=new O({shift:!1,control:!1,alt:!1,meta:!1,capsLock:!1,space:!1}).inject({option:{get:function(){return this.alt}},command:{get:function(){var t=te&&te.agent;return t&&t.mac?this.meta:this.control}}});function r(t){var e=t.key,e=/^Arrow[A-Z]/.test(e)?e.substr(5):"Unidentified"===e||e===Wt?String.fromCharCode(t.keyCode):e;return n[e]||(1<e.length?O.hyphenate(e):e.toLowerCase())}function d(t,e,n,i,r){var s;if(r||(it.updateFocus(),(r=it._focused)&&!r.isVisible()&&(r=null)),null==n&&(n=t?u[e]||(1<e.length?"":e):c[e]||""),(l[e]=t)?c[e]=n:delete c[e],1<e.length&&(s=O.camelize(e))in f){f[s]=t;var a=te&&te.agent;if("meta"===s&&a&&a.mac)if(t)h={};else{for(var o in h)o in c&&d(!1,o,h[o],i,r);h=null}}else t&&h&&(h[e]=n);r&&r._handleKeyEvent(t?"keydown":"keyup",i,e,n)}return H.add(z,{keydown:function(t){var e=r(t);1<e.length||t.ctrlKey||t.altKey||t.metaKey?d(!0,e,null,t):i=e},keypress:function(t){var e,n;i&&(e=r(t),n=32<=(n=t.charCode)?String.fromCharCode(n):1<e.length?"":e,d(!0,e=e!==i?n.toLowerCase():e,n,t),i=null)},keyup:function(t){var e=r(t);e in c&&d(!1,e,c[e],t)}}),H.add(k,{blur:function(t){for(var e in c)d(!1,e,c[e],t)}}),{_handleKey:d,modifiers:f,isDown:function(t){return!!l[t]}}},ht=st.extend({_class:"MouseEvent",initialize:function(t,e,n,i,r){this.type=t,this.event=e,this.point=n,this.target=i,this.delta=r},toString:function(){return"{ type: '"+this.type+"', point: "+this.point+", target: "+this.target+(this.delta?", delta: "+this.delta:"")+", modifiers: "+this.getModifiers()+" }"}}),ut=st.extend({_class:"ToolEvent",_item:null,initialize:function(t,e,n){this.tool=t,this.type=e,this.event=n},_choosePoint:function(t,e){return t||(e?e.clone():null)},getPoint:function(){return this._choosePoint(this._point,this.tool._point)},setPoint:function(t){this._point=t},getLastPoint:function(){return this._choosePoint(this._lastPoint,this.tool._lastPoint)},setLastPoint:function(t){this._lastPoint=t},getDownPoint:function(){return this._choosePoint(this._downPoint,this.tool._downPoint)},setDownPoint:function(t){this._downPoint=t},getMiddlePoint:function(){return!this._middlePoint&&this.tool._lastPoint?this.tool._point.add(this.tool._lastPoint).divide(2):this._middlePoint},setMiddlePoint:function(t){this._middlePoint=t},getDelta:function(){return!this._delta&&this.tool._lastPoint?this.tool._point.subtract(this.tool._lastPoint):this._delta},setDelta:function(t){this._delta=t},getVelocity:function(){return this._velocity||this.tool._velocity.clone()},setVelocity:function(t){this._velocity=t},getElapsed:function(){return(null!=this._elapsed?this:this.tool)._elapsed},setElapsed:function(t){this._elapsed=t},getCount:function(){return this.tool[this._getCountName()]},setCount:function(t){this.tool[this._getCountName()]=t},_getCountName:function(){return/^mouse(down|up)$/.test(this.type)?"_downCount":"_moveCount"},getItem:function(){if(!this._item){var t=this.tool._scope.project.hitTest(this.getPoint());if(t){for(var e=t.item,n=e._parent;/^(Group|CompoundPath)$/.test(n._class);)n=(e=n)._parent;this._item=e}}return this._item},setItem:function(t){this._item=t},toString:function(){return"{ type: "+this.type+", point: "+this.getPoint()+", count: "+this.getCount()+", modifiers: "+this.getModifiers()+" }"}}),lt=(e.extend({_class:"Tool",_list:"tools",_reference:"tool",_events:["onMouseDown","onMouseUp","onMouseDrag","onMouseMove","onActivate","onDeactivate","onEditOptions","onKeyDown","onKeyUp"],initialize:function(t){e.call(this),this._moveCount=-1,this._downCount=-1,this.set(t)},getMinDistance:function(){return this._minDistance},setMinDistance:function(t){null!=(this._minDistance=t)&&null!=this._maxDistance&&t>this._maxDistance&&(this._maxDistance=t)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(t){this._maxDistance=t,null!=this._minDistance&&null!=t&&t<this._minDistance&&(this._minDistance=t)},getEventInterval:function(){return this._eventInterval},setEventInterval:function(t){this._eventInterval=t},getFixedDistance:function(){return this._minDistance==this._maxDistance?this._minDistance:null},setFixedDistance:function(t){this._minDistance=this._maxDistance=t},_handleMouseEvent:function(t,e,a,o){te=this._scope,o.drag&&!this.responds(t)&&(t="mousemove");var h=o.move||o.drag,n=this.responds(t),i=!1,u=this,l=e.timeStamp/1e3,c=null!=this._time?l-this._time:0,f=!o.down&&this._point&&0<c?a.subtract(this._point).divide(c):new Gt;function r(t,e){var n=a,i=h?u._point:u._downPoint||n;if(h){if(0<=u._moveCount&&n.equals(i))return;if(i&&(null!=t||null!=e)){var r=n.subtract(i),s=r.getLength();if(s<(t||0))return;e&&(n=i.add(r.normalize(Math.min(s,e))))}u._moveCount++}return u._point=n,u._lastPoint=i||n,u._velocity=f,u._elapsed=c,u._time=l,o.down&&(u._moveCount=-1,u._downPoint=n,u._downCount++),1}function s(){n&&(i=u.emit(t,new ut(u,t,e))||i)}if(o.down)r(),s(),0<this._eventInterval&&(clearInterval(this._timer),this._timer=setInterval(function(){u.isActive()?(te=u._scope,u._lastPoint=u._point,u._velocity=new Gt,u._elapsed=u._eventInterval/1e3,u._moveCount++,u.responds("mousedrag")&&u.emit("mousedrag",new ut(u,"mousedrag",e))):clearInterval(u._timer)},this._eventInterval));else if(o.up)clearInterval(this._timer),r(null,this._maxDistance),s();else if(n)for(;r(this._minDistance,this._maxDistance);)s();return i}}),O.extend(t,{_class:"Tween",statics:{easings:new O({linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:2*(2-t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t},easeInSine:function(t){return 1-Math.cos(t*Math.PI/2)},easeOutSine:function(t){return Math.sin(t*Math.PI/2)},easeInOutSine:function(t){return(1-Math.cos(t*Math.PI))/2},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*t-10)},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t||1===t?t:t<.5?Math.pow(2,20*t-10)/2:1-Math.pow(2,10-20*t)/2},easeInCirc:function(t){return 1-Math.sqrt(1-t*t)},easeOutCirc:function(t){return Math.sqrt(1- --t*t)},easeInOutCirc:function(t){return t<.5?(1-Math.sqrt(1-4*t*t))/2:(1+Math.sqrt(1-4*--t*t))/2}})},initialize:function t(e,n,i,r,s,a){this.object=e;var o=typeof s,e="function"==o;this.type=e?o:"string"==o?s:"linear",this.easing=e?s:t.easings[this.type],this.duration=r,this.running=!1,this._then=null,this._startTime=null;r=n||i;this._keys=r?Object.keys(r):[],this._parsedKeys=this._parseKeys(this._keys),this._from=r&&this._getState(n),this._to=r&&this._getState(i),!1!==a&&this.start()},then:function(t){return this._then=t,this},start:function(){return this._startTime=null,this.running=!0,this},stop:function(){return this.running=!1,this},update:function(e){if(this.running){1<=e&&(this.running=!(e=1));function t(t){return"function"==typeof t?t(n,e):t}for(var n=this.easing(e),i=this._keys,r=0,s=i&&i.length;r<s;r++){var a=i[r],o=t(this._from[a]),h=t(this._to[a]),o=o&&h&&o.multiply&&h.multiply?h.subtract(o).multiply(n).add(o):(h-o)*n+o;this._setProperty(this._parsedKeys[a],o)}this.responds("update")&&this.emit("update",new O({progress:e,factor:n})),!this.running&&this._then&&this._then(this.object)}return this},_events:{onUpdate:{}},_handleFrame:function(t){var e=this._startTime,n=e?(t-e)/this.duration:0;e||(this._startTime=t),this.update(n)},_getState:function(t){for(var e=this._keys,n={},i=0,r=e.length;i<r;i++){var s,a=e[i],o=this._parsedKeys[a],h=this._getProperty(o);t?(s=this._resolveValue(h,t[a]),this._setProperty(o,s),s=(s=this._getProperty(o))&&s.clone?s.clone():s,this._setProperty(o,h)):s=h&&h.clone?h.clone():h,n[a]=s}return n},_resolveValue:function(t,e){if(e){if(Array.isArray(e)&&2===e.length){var n=e[0];return n&&n.match&&n.match(/^[+\-\*\/]=/)?this._calculate(t,n[0],e[1]):e}if("string"==typeof e){n=e.match(/^[+\-*/]=(.*)/);if(n){n=JSON.parse(n[1].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,'"$2": '));return this._calculate(t,e[0],n)}}}return e},_calculate:function(t,e,n){var i={"+":"add","-":"subtract","*":"multiply","/":"divide"}[e];if(t&&t[i])return t[i](n);switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n}},_parseKeys:function(t){for(var e={},n=0,i=t.length;n<i;n++){var r=t[n],s=r.replace(/\.([^.]*)/g,"/$1").replace(/\[['"]?([^'"\]]*)['"]?\]/g,"/$1");e[r]=s.split("/")}return e},_getProperty:function(t,e){for(var n=this.object,i=0,r=t.length-(e||0);i<r&&n;i++)n=n[t[i]];return n},_setProperty:function(t,e){var n=this._getProperty(t,1);n&&(n[t[t.length-1]]=e)}})),ct=function(n){var i=new u.XMLHttpRequest;return i.open((n.method||"get").toUpperCase(),n.url,O.pick(n.async,!0)),n.mimeType&&i.overrideMimeType(n.mimeType),i.onload=function(){var t=i.status;0===t||200===t?n.onLoad&&n.onLoad.call(i,i.responseText):i.onerror()},i.onerror=function(){var t=i.status,e='Could not load "'+n.url+'" (Status: '+t+")";if(!n.onError)throw new Error(e);n.onError(e,t)},i.send(null)},ft=O.exports.CanvasProvider={canvases:[],getCanvas:function(t,e,n){if(!k&&!u.OffscreenCanvas)return null;var i;if("object"==typeof t&&(e=t.height,t=t.width),!(i=this.canvases.length?this.canvases.pop():k?z.createElement("canvas"):new u.OffscreenCanvas(t,e)).getContext("2d",n||{}))throw new Error("Canvas "+i+" is unable to provide a 2D context.");return i.width===t&&i.height===e||(i.width=t,i.height=e),i},getContext:function(t,e,n){e=this.getCanvas(t,e,n);return e?e.getContext("2d",n||{}):null},release:function(t){t=t&&t.canvas?t.canvas:t;t&&t.getContext&&(t.width=t.height=0,this.canvases.length<8&&this.canvases.push(t))}},dt=new function(){var _,p,v,m,y,w,x,b,S,C,M,t=Math.min,e=Math.max,n=Math.abs,I={add:function(){S=t(y+_,255),C=t(w+p,255),M=t(x+v,255)},subtract:function(){S=e(y-_,0),C=e(w-p,0),M=e(x-v,0)},average:function(){S=(y+_)/2,C=(w+p)/2,M=(x+v)/2},"pin-light":function(){S=_<128?t(y,2*_):e(y,2*_-255),C=p<128?t(w,2*p):e(w,2*p-255),M=v<128?t(x,2*v):e(x,2*v-255)},negation:function(){S=255-n(255-_-y),C=255-n(255-p-w),M=255-n(255-v-x)}};this.nativeModes=O.each(["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","lighter","darker","copy","xor","multiply","screen","overlay","soft-light","hard-light","color-dodge","color-burn","darken","lighten","difference","exclusion","hue","saturation","luminosity","color"],function(t){this[t]=!0},O.each(I,function(t,e){this[e]=!1},{})),this.process=function(t,e,n,i,r){var s=e.canvas,a="normal"===t,o=I[t];if(o){for(var h=n.getImageData(r.x,r.y,s.width,s.height),u=h.data,l=e.getImageData(0,0,s.width,s.height).data,c=0,f=u.length;c<f;c+=4){_=l[c],y=u[c],p=l[c+1],w=u[c+1],v=l[c+2],x=u[c+2],m=l[c+3],b=u[c+3],o();var d=m*i/255,g=1-d;u[c]=d*S+g*y,u[c+1]=d*C+g*w,u[c+2]=d*M+g*x,u[c+3]=m*i+g*b}n.putImageData(h,r.x,r.y)}else n.save(),n.setTransform(1,0,0,1,0,0),n.globalAlpha=i,a||(n.globalCompositeOperation=t),n.drawImage(s,r.x,r.y),n.restore()}},gt=new function(){var i="http://www.w3.org/2000/svg",t="http://www.w3.org/2000/xmlns",e="http://www.w3.org/1999/xlink",a={href:e,xlink:t,xmlns:t+"/","xmlns:xlink":t+"/"};function r(t,e,n){for(var i in e){var r=e[i],s=a[i];"number"==typeof r&&n&&(r=n.number(r)),s?t.setAttributeNS(s,i,r):t.setAttribute(i,r)}return t}return{svg:i,xmlns:t,xlink:e,create:function(t,e,n){return r(z.createElementNS(i,t),e,n)},get:function(t,e){var n=a[e];return"null"===(e=n?t.getAttribute(e)||t.getAttributeNS(n,e):t.getAttribute(e))?null:e},set:r}},_t=O.each({fillColor:["fill","color"],fillRule:["fill-rule","string"],strokeColor:["stroke","color"],strokeWidth:["stroke-width","number"],strokeCap:["stroke-linecap","string"],strokeJoin:["stroke-linejoin","string"],strokeScaling:["vector-effect","lookup",{true:"none",false:"non-scaling-stroke"},function(t,e){return!e&&(t instanceof w||t instanceof m||t instanceof p)}],miterLimit:["stroke-miterlimit","number"],dashArray:["stroke-dasharray","array"],dashOffset:["stroke-dashoffset","number"],fontFamily:["font-family","string"],fontWeight:["font-weight","font"],fontSize:["font-size","number"],letterTracking:["letter-spacing","tracking"],justification:["text-anchor","lookup",{justify:"start",start:"start",end:"end",left:"start",center:"middle",right:"end"}],opacity:["opacity","number",null,function(t,e){return 1!==e}],blendMode:["mix-blend-mode","style",null,function(t,e){return"normal"!==e}]},function(t,e){var n=O.capitalize(e),i=t[2];this[e]={type:t[1],property:e,attribute:t[0],toSVG:i,fromSVG:i&&O.each(i,function(t,e){this[t]=e},{}),exportFilter:t[3],get:"get"+n,set:"set"+n}},{});function pt(t,e,n){var i,r,s=new O,a=t.getTranslation();return e&&(t.isInvertible()?(i=(t=t._shiftless())._inverseTransform(a),a=null):i=new Gt,s[n?"cx":"x"]=i.x,s[n?"cy":"y"]=i.y),t.isIdentity()||((r=t.decompose())?(e=[],n=r.rotation,i=r.scaling,r=r.skewing,a&&!a.isZero()&&e.push("translate("+W.point(a)+")"),n&&e.push("rotate("+W.number(n)+")"),Ut.isZero(i.x-1)&&Ut.isZero(i.y-1)||e.push("scale("+W.point(i)+")"),r.x&&e.push("skewX("+W.number(r.x)+")"),r.y&&e.push("skewY("+W.number(r.y)+")"),s.transform=e.join(" ")):s.transform="matrix("+t.getValues().join(",")+")"),s}function vt(t,e){for(var n=pt(t._matrix),i=t._children,r=gt.create("g",n,W),s=0,a=i.length;s<a;s++){var o,h=i[s];h.isClipMask()?(St(h,o=function(t,s){var a=gt.create("clipPath");t instanceof v&&(t=t.clone({insert:!1})).matrix.apply(!0,!0);return function t(e){if(e instanceof v)for(var n=e._children,i=0,r=n.length;i<r;i++)n[i]._clipMask||t(n[i]);else(e=It(e,s))&&a.appendChild(e)}(t),a}(h,e),"clip",e),gt.set(r,{"clip-path":"url(#"+o.id+")"})):(h=It(h,e))&&r.appendChild(h)}return r}function mt(t){var e,n=t._type,i=t._radius,r=pt(t._matrix,!0,"rectangle"!==n);return"rectangle"===n&&(n="rect",t=(e=t._size).width,e=e.height,r.x-=t/2,r.y-=e/2,r.width=t,r.height=e,i.isZero()&&(i=null)),i&&("circle"===n?r.r=i:(r.rx=i.width,r.ry=i.height)),gt.create(n,r,W)}function yt(s,a){var t=pt(s._matrix,!0),e=gt.create("text",t,W),o=s._story,n=s._getLayout();function h(t,n,i,r){i=O.set({},i),O.each(_t,function(t){var e;t.property in o._paragraphKeys!==r||s[t.get]()!==Wt||(e=n[t.get]())!==Wt&&wt(i,[],t,e,a)});var e=gt.create("tspan",i,W);return null!=t&&(e.textContent=t),e}function i(t,e){for(var n=e.pieces,i=[],r=0,s=n.length;r<s;r++){var a=n[r],o=i[i.length-1];o&&o.style.equals(a.style)?o.content+=a.content:i.push({content:a.content,style:a.style})}if(i.some(function(t){return 0<h(null,t.style,null,!1).attributes.length}))for(r=0,s=i.length;r<s;r++)t.appendChild(h(i[r].content,i[r].style,null,!1));else t.textContent=i.map(function(t){return t.content}).join("")}if(s instanceof M)if(1<n.length)for(var r=0,u=n.length;r<u;r++){var l=n[r],c=o._getParagraph(l.start).style,f=s._getSide(c.getJustification(),c.getDirection());i(p=h(null,c,{x:t.x+l.x+("right"===f?l.width:"center"===f?l.width/2:0),y:t.y+l.y},!0),l),e.appendChild(p)}else n.length&&i(e,n[0]);else for(var d=s.getJustification(),g=d&&"left"!==d&&{"text-anchor":"start"},r=0,u=n.length;r<u;r++){for(var _=(l=n[r]).pieces,p=gt.create("tspan",O.set({x:t.x+l.x,y:t.y+l.y},g),W),v=0,m=_.length;v<m;v++){var y=_[v],w=y.rotation,x=new Gt(y.dx||0,0).rotate(w).add(y.x,l.y+y.y),x={x:t.x+x.x,y:t.y+x.y};w&&(x.rotate=w),p.appendChild(h(y.content,y.style,x,!1))}e.appendChild(p)}return e}function wt(t,e,n,i,r){var s,a=n.type;"color"!==a||null==i||(s=i.getAlpha())<1&&(t[n.attribute+"-opacity"]=s),"style"===a?$[i]?e.push(n.attribute+": "+i):t["data-paper-blend-mode"]=i:"font"===a?(e=(""+i).match(/^(.*?)\s*\b(italic|oblique)\b\s*(.*)$/i),t[n.attribute]=e?(e[1]+" "+e[3]).trim()||"normal":i,e&&(t["font-style"]=e[2].toLowerCase())):t[n.attribute]=null==i?"none":"color"===a?i.gradient?function(t,e){if(!(h=bt(t,"color"))){var n,i,r=t.getGradient(),s=r._radial,a=t.getOrigin(),o=t.getDestination();s?(n={cx:a.x,cy:a.y,r:a.getDistance(o)},(i=t.getHighlight())&&(n.fx=i.x,n.fy=i.y)):n={x1:a.x,y1:a.y,x2:o.x,y2:o.y},n.gradientUnits="userSpaceOnUse";for(var h=gt.create((s?"radial":"linear")+"Gradient",n,W),u=r._stops,l=0,c=u.length;l<c;l++){var f=u[l],d=f._color,g=d.getAlpha(),f=f._offset;n={offset:null==f?l/(c-1):f},d&&(n["stop-color"]=d.toCSS(!0)),g<1&&(n["stop-opacity"]=g),h.appendChild(gt.create("stop",n,W))}St(t,h,"color",e)}return"url(#"+h.id+")"}(i,r):i.toCSS(!0):"array"===a?i.join(","):"lookup"===a?n.toSVG[i]:"tracking"===a?i&&i/1e3+"em":i}function xt(i,t,r,e){var s={},a=!e&&i.getParent(),o=a&&(Z[a._id]=Z[a._id]||{}),h=[];null!=i._name&&(s.id=i._name),O.each(_t,function(t){var e=t.get,n=i[e]();!a||e in o||(o[e]=a[e]()),n===Wt||(t.exportFilter?!t.exportFilter(i,n):0!=r.reduceAttributes&&a&&O.equals(o[e],n))||wt(s,h,t,n,r)});e=i._style.getShadowColor(!0)&&i.hasShadow()&&function(t,e){var n=t.getInternalBounds();if(!n.width||!n.height)return null;var i=(a=t._style).getShadowColor(),r=a.getShadowOffset(),s=a.getShadowBlur()/2,a=(a=t.getStrokeBounds(new F)).unite(new C(a.getPoint().add(r),a.getSize())).expand(6*s),o=(new F).scale(100/n.width,100/n.height).translate(n.getPoint().negate())._transformBounds(a),h=gt.create("filter");function u(t,e){h.appendChild(gt.create(t,e,W))}return O.each(["x","y","width","height"],function(t){h.setAttribute(t,W.number(o[t])+"%")}),0<s&&u("feGaussianBlur",{in:"SourceAlpha",stdDeviation:s,result:"blur"}),u("feOffset",{in:0<s?"blur":"SourceAlpha",dx:r.x,dy:r.y,result:"offset"}),u("feFlood",{"flood-color":i.toCSS(!0),"flood-opacity":i.getAlpha(),result:"color"}),u("feComposite",{in:"color",in2:"offset",operator:"in",result:"shadow"}),u("feComposite",{in:"SourceGraphic",in2:"shadow",operator:"over"}),St(t,h,"filter",e),"url(#"+h.id+")"}(i,r);return e&&(s.filter=e),h.length&&(s.style=h.join(";")),i._visible||(s.visibility="hidden"),gt.set(t,s,W)}function bt(t,e){return U=U||{ids:{},svgs:{}},t&&U.svgs[Ct(t,e)]}function St(t,e,n,i){U||bt();var r=U.ids[n]=(U.ids[n]||0)+1;e.id=(i.idPrefix||"")+n+"-"+r,U.svgs[Ct(t,n)]=e}function Ct(t,e){return e+"-"+("string"==typeof t?t:t._id||t.__id||(t.__id=o.get("svg")))}function Mt(t,e){var n=t,i=null;if(U){for(var r in n="svg"===t.nodeName.toLowerCase()&&t,U.svgs)i||(n||(n=gt.create("svg")).appendChild(t),i=n.insertBefore(gt.create("defs"),n.firstChild)),i.appendChild(U.svgs[r]);U=null}return Z=null,e.asString?(new u.XMLSerializer).serializeToString(n).replace(/<defs>|<\/filter>|<\/defs>/g,"$&\n"):n}function It(t,e,n){var i=G[t._class],r=i&&i(t,e);return r&&((i=e.onExport)&&(r=i(t,r,e)||r),(i=JSON.stringify(t._data))&&"{}"!==i&&"null"!==i&&r.setAttribute("data-paper-data",i)),r&&xt(t,r,e,n)}function Pt(t){return W=new x((t=t||{}).precision),Z={},t}function Tt(t){var e=/(in|pt|pc|cm|mm)\s*$/.exec(t);return parseFloat(t)*(e?Y[e[1]]:1)}function kt(t,e,n,i,r,s){s=gt.get(t,e)||s,n=null==s?i?null:n?"":0:n?s:Tt(s);return/%\s*$/.test(s)?n/100*(r?1:K[/x|^width/.test(e)?"width":"height"]):n}function zt(t,e,n,i,r,s,a){return e=kt(t,e||"x",!1,i,r,s),n=kt(t,n||"y",!1,i,r,a),!i||null!=e&&null!=n?new Gt(e,n):null}function Ot(t,e,n,i,r){return e=kt(t,e||"width",!1,i,r),n=kt(t,n||"height",!1,i,r),!i||null!=e&&null!=n?new j(e,n):null}function At(t,e,n,i){return"none"===t?null:"number"===e?Tt(t):"array"===e?t?t.split(/[\s,]+/g).map(Tt):[]:"color"===e?Ht(t,i)||t:"lookup"===e?n[t]:t}function Lt(t,e,n,i){var r=t.childNodes,s="clippath"===e||"mask"===e,a="defs"===e,o=new v,h=o._project,u=h._currentStyle,l=K,c=[];if(s||a||(o=Dt(o,t,n,i),h._currentStyle=o._style.clone()),"svg"!==e||i||(K=new j(kt(t,"width",!1,!1,!1,"100%"),kt(t,"height",!1,!1,!1,"100%"))),i)for(var f=t.querySelectorAll("defs"),d=0,g=f.length;d<g;d++)Yt(f[d],n,!1);for(d=0,g=r.length;d<g;d++){var _,p=r[d];1!==p.nodeType||/^defs$/i.test(p.nodeName)||!(_=Yt(p,n,!1))||_ instanceof y||c.push(_)}return o.addChildren(c),s&&(o=Dt(o.reduce(),t,n,i),"mask"!==e||function e(t,n){if(1!==t.getOpacity())return!1;if(t instanceof v)return t._children.every(function(t){return e(t,n)});var i=t.getFillColor();return(t instanceof w||t instanceof m)&&!t.hasStroke()&&!!i&&!i.gradient&&1===i.getAlpha()&&(n||1===i.getBrightness()&&0===i.getSaturation())}(o,"alpha"===gt.get(t,"mask-type"))||console.warn("Approximating SVG mask '"+t.id+"' as a clipping mask.")),h._currentStyle=u,K=l,(s||a)&&(o.remove(),o=null),o}function Bt(t,e){for(var n=t.getAttribute("points").match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g),i=[],r=0,s=n.length;r<s;r+=2)i.push(new Gt(parseFloat(n[r]),parseFloat(n[r+1])));t=new V(i);return"polygon"===e&&t.closePath(),t}function Nt(t,e,n){var i,r=qt((kt(t,"href",!0)||"").substring(1),n),e="radialgradient"===e;if(r)(i=r.getGradient())._radial^e&&((i=i.clone())._radial=e);else{for(var s=t.childNodes,a=[],o=0,h=s.length;o<h;o++){var u=s[o];1===u.nodeType&&a.push(Dt(new N,u,n))}i=new B(a,e)}var l,c,f,r="userSpaceOnUse"!==kt(t,"gradientUnits",!0);return e?(c=(l=zt(t,"cx","cy",!1,r,"50%","50%")).add(kt(t,"r",!1,!1,r,"50%"),0),f=zt(t,"fx","fy",!0,r)):(l=zt(t,"x1","y1",!1,r,"0%","0%"),c=zt(t,"x2","y2",!1,r,"100%","0%")),Dt(new T(i,l,c,f),t,n)._scaleToBounds=r,null}function Et(t,e,n,i){if(t.transform){for(var r=(i.getAttribute(n)||"").split(/\)\s*/g),s=new F,a=0,o=r.length;a<o;a++){var h=r[a];if(!h)break;for(var u=h.split(/\(\s*/),h=u[0].trim(),l=u[1].split(/[\s,]+/g),c=0,f=l.length;c<f;c++)l[c]=parseFloat(l[c]);switch(h){case"matrix":s.append(new F(l[0],l[1],l[2],l[3],l[4],l[5]));break;case"rotate":s.rotate(l[0],l[1]||0,l[2]||0);break;case"translate":s.translate(l[0],l[1]||0);break;case"scale":s.scale(l);break;case"skewX":s.skew(l[0],0);break;case"skewY":s.skew(0,l[0])}}t.transform(s)}}function Rt(t,e,n,i,r,s){s=Ht(e,s);if(s){if((s=s.clone()).setClipMask(!0),!(t instanceof v))return new v(s,t);t.insertChild(0,s)}}function jt(t,e,n){n="fill-opacity"===n?"getFillColor":"getStrokeColor",n=t[n]&&t[n]();n&&n.setAlpha(parseFloat(e))}function Ft(t,e,n){var i=O.camelize(e),r=t.style&&t.style[i];return r||!(r=(e=t.attributes[e])&&e.value)&&t.style&&n.node[i]!==n.parent[i]&&(r=n.node[i]),r?"none"===r?null:r:Wt}function Dt(i,r,s,t){var e=r.parentNode,a={node:R.getStyles(r)||{},parent:!t&&R.getStyles(e)||{}};return t&&!a.node.fill&&i.setFillColor&&i.setFillColor("black"),O.each(nt,function(t,e){var n=Ft(r,e,a);i=n!==Wt&&t(i,n,e,r,a,s)||i}),i}function qt(t,e){var n;return!t||J[t]||(n=Xt(t))&&Yt(n,e,!1),J[t]}function Vt(t){t=t&&t.match(/\((?:["'#]*)([^"')]+)/),t=t&&t[1];return t&&k?t.replace(k.location.href.split("#")[0]+"#",""):t}function Ht(t,e){t=Vt(t),e=t&&qt(t,e);return e&&e._scaleToBounds&&((e=e.clone())._scaleToBounds=!0),e}function Jt(){var t,e;return et&&et.contentDocument||((et=z.createElement("iframe")).setAttribute("sandbox","allow-same-origin"),et.style.cssText="position: absolute; visibility: hidden; width: 0; height: 0; border: 0",z.body.appendChild(et),(e=(t=et.contentDocument).createElement("meta")).httpEquiv="Content-Security-Policy",e.content="default-src 'none'; style-src 'unsafe-inline'",t.head.appendChild(e)),et.contentDocument.body}function Xt(t){return Jt().ownerDocument.getElementById(t)}function Yt(t,e,n){var i,r,s,a=t.nodeName.toLowerCase(),o="#document"!==a;n&&o&&(K=te.getView().getSize(),K=Ot(t,null,null,!0)||K,i=gt.create("svg",{style:"stroke-width: 1px; stroke-miterlimit: 10"}),r=t.parentNode,s=t.nextSibling,i.appendChild(t),Jt().appendChild(i));var h,u,l,c=te.settings,f=c.applyMatrix,d=c.insertItems,g=Q[a];try{c.applyMatrix=!1,c.insertItems=!1;try{h=g&&g(t,a,e,n)||null}finally{c.insertItems=d,c.applyMatrix=f}h&&(o&&g!==Lt&&(h=Dt(h,t,e,n)),u=e.onImport,l=o&&function(t){for(var e=null,n=t.attributes,t=t.getAttribute("data-paper-data"),i=0,r=n.length;i<r;i++){var s=n[i].name.match(/^data-(?!paper-)(.+)$/);s&&((e=e||{})[O.camelize(s[1])]=n[i].value)}return t?O.set(e||{},JSON.parse(t)):e}(t),u&&(h=u(t,h,e)||h),e.expandShapes&&h instanceof m&&(h.remove(),h=h.toPath()),l&&(h._data=l))}finally{i&&(i.parentNode.removeChild(i),r&&(s?r.insertBefore(t,s):r.appendChild(t))),n&&(J={})}return n&&h&&O.pick(e.applyMatrix,f)&&h.matrix.apply(!0,!0),h}function Qt(i,r,s){if(!i)return null;r="function"==typeof r?{onLoad:r}:r||{};var a=te,o=null;function t(t){try{var e="object"==typeof t?t:(new u.DOMParser).parseFromString(t.trim(),"image/svg+xml");if(!e.nodeName)throw e=null,new Error("Unsupported SVG source: "+i);te=a,o=Yt(e,r,!0),r&&!1===r.insert||s._insertItem(Wt,o);var n=r.onLoad;n&&n(o,t)}catch(t){h(t)}}function h(t,e){var n=r.onError;if(!n)throw new Error(t);n(t,e)}if("string"!=typeof i||/^[\s\S]*</.test(i)){if("undefined"!=typeof File&&i instanceof File){var e=new FileReader;return e.onload=function(){t(e.result)},e.onerror=function(){h(e.error)},e.readAsText(i)}t(i)}else{var n=z.getElementById(i);n?t(n):ct({url:i,async:!0,onLoad:t,onError:h})}return o}G={Group:vt,Layer:vt,Raster:function(t,e){var n=pt(t._matrix,!0),i=t.getSize(),r=t.getImage(),r=0==e.embedImages&&r&&r.src||t.toDataURL();if(n.x-=i.width/2,n.y-=i.height/2,e.reuseImages){t=bt(r,"image");return t||St(r,t=gt.create("image",{width:i.width,height:i.height,href:r},W),"image",e),n.href="#"+t.id,gt.create("use",n,W)}return n.width=i.width,n.height=i.height,n.href=r,gt.create("image",n,W)},Path:function(t,e){var n=e.matchShapes;if(n){var i=t.toShape(!1);if(i)return mt(i)}var r=t._segments,s=r.length,a=pt(t._matrix);if(n&&2<=s&&!t.hasHandles())if(2<s){for(var o=t._closed?"polygon":"polyline",h=[],u=0;u<s;u++)h.push(W.point(r[u]._point));a.points=h.join(" ")}else{o="line";i=r[0]._point,n=r[1]._point;a.set({x1:i.x,y1:i.y,x2:n.x,y2:n.y})}else o="path",a.d=t.getPathData(null,e.precision);return gt.create(o,a,W)},Shape:mt,CompoundPath:function(t,e){var n=pt(t._matrix);return(e=t.getPathData(null,e.precision))&&(n.d=e),gt.create("path",n,W)},SymbolItem:function(t,e){var n=pt(t._matrix,!0),i=t._definition,r=bt(i,"symbol"),s=i._item,t=s.getStrokeBounds();return r||((r=gt.create("symbol",{viewBox:W.rectangle(t)})).appendChild(It(s,e)),St(i,r,"symbol",e)),n.href="#"+r.id,n.x+=t.x,n.y+=t.y,n.width=t.width,n.height=t.height,n.overflow="visible",gt.create("use",n,W)},PointText:yt,PathText:yt,AreaText:yt},$=O.each(["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],function(t){this[t]=!0},{}),A.inject({exportSVG:function(t){return Mt(It(this,t=Pt(t),!0),t)}}),s.inject({exportSVG:function(t){t=Pt(t);var e=this._children,n=this.getView(),i=O.pick(t.bounds,"view"),r=t.matrix||"view"===i&&n._matrix,r=r&&F.read([r]),n="view"===i?new C([0,0],n.getViewSize()):"content"===i?A._getBounds(e,r,{stroke:!0}).rect:C.read([i],0,{readNull:!0}),i={version:"1.1",xmlns:gt.svg,"xmlns:xlink":gt.xlink};n&&(i.width=n.width,i.height=n.height,(n.x||0===n.x||n.y||0===n.y)&&(i.viewBox=W.rectangle(n)));var i=gt.create("svg",i,W),s=i;r&&!r.isIdentity()&&(s=i.appendChild(gt.create("g",pt(r),W)));for(var a=0,o=e.length;a<o;a++)s.appendChild(It(e[a],t,!0));return Mt(i,t)}}),J={},X={},Y={in:96,pt:96/72,pc:16,cm:96/2.54,mm:96/25.4},Q={"#document":function(t,e,n,i){for(var r=t.childNodes,s=0,a=r.length;s<a;s++){var o=r[s];if(1===o.nodeType)return Yt(o,n,i)}},g:Lt,svg:Lt,clippath:Lt,mask:Lt,polygon:Bt,polyline:Bt,path:function(t){return w.create(t.getAttribute("d"))},lineargradient:Nt,radialgradient:Nt,image:function(s,t,e){var e=new d({crossOrigin:e.crossOrigin,source:kt(s,"href",!0)}),a=/none|x(Min|Mid|Max)Y(Min|Mid|Max)/.exec(kt(s,"preserveAspectRatio",!0))||[null,"Mid","Mid"];return e.on("load",function(){var t,e,n=this.getSize(),i=Ot(s,null,null,!0)||n,r=zt(s);"none"!==a[0]&&(t={Min:0,Mid:.5,Max:1},e=n.multiply(Math.min(i.width/n.width,i.height/n.height)),r=r.add(i.subtract(e).multiply([t[a[1]],t[a[2]]])),i=e);r=r.add(i.divide(2));this._matrix.append((new F).translate(r).scale(i.divide(n)))}),e},symbol:function(t,e,n,i){return new y(Lt(t,e,n,i),!0)},defs:Lt,use:function(t,e,n){var i=(kt(t,"href",!0)||"").substring(1),r=qt(i,n),s=zt(t),t=null;if(r instanceof y)t=r.place(s);else if(r&&!X[i]){X[i]=!0;try{t=Yt(Xt(i),n,!1).translate(s)}finally{delete X[i]}}return t},circle:function(t){return new m.Circle(zt(t,"cx","cy"),kt(t,"r"))},ellipse:function(t){return new m.Ellipse({center:zt(t,"cx","cy"),radius:Ot(t,"rx","ry")})},rect:function(t){var e=kt(t,"rx",!1,!0),n=kt(t,"ry",!1,!0);return new m.Rectangle(new C(zt(t),Ot(t)),new j(null==e?n||0:e,null==n?e||0:n))},line:function(t){return new V.Line(zt(t,"x1","y1"),zt(t,"x2","y2"))},text:function(t){var e=new M(zt(t).add(zt(t,"dx","dy"))),n=O.each(t.childNodes,function(t){/^tspan$/i.test(t.nodeName)&&t.hasAttribute("y")&&this.push(t.textContent.trim())},[]);return e.setContent(1<n.length?n.join("\n"):t.textContent.trim()),e},switch:Lt},tt="feOffset,feFlood,feComposite,feComposite",nt=O.set(O.each(_t,function(a){this[a.attribute]=function(t,e,n,i,r,s){t[a.set]&&(t[a.set](At(e,a.type,a.fromSVG,s)),"color"!==a.type||(s=t[a.get]())&&s._scaleToBounds&&(t=t.getBounds(),s.transform((new F).translate(t.getPoint()).scale(t.getSize()))))}},{}),{id:function(t,e){(J[e]=t).setName&&e!==+e+""&&t.setName(e)},"clip-path":Rt,mask:Rt,gradientTransform:Et,transform:Et,"fill-opacity":jt,"stroke-opacity":jt,visibility:function(t,e){t.setVisible&&t.setVisible("visible"===e)},display:function(t,e){t.setVisible&&t.setVisible(null!==e)},filter:function(t,e){var n,i,r,s,a,n=e&&!(t instanceof v)&&t.setShadowColor&&(/^url\(/.test(e)?(i=Xt(Vt(e)),r=O.slice(i&&i.children||[]),s=r.map(function(t){return t.nodeName}).join(),(a=s==="feGaussianBlur,"+tt&&r.shift())||s===tt?(i=r[0],s=r[1],r=new T(s.getAttribute("flood-color")||"black"),(s=s.getAttribute("flood-opacity"))&&r.setAlpha(r.getAlpha()*parseFloat(s)),{color:r,blur:a?2*parseFloat(a.getAttribute("stdDeviation")):0,offset:new Gt(parseFloat(i.getAttribute("dx"))||0,parseFloat(i.getAttribute("dy"))||0)}):null):(e=(n=(e=e).match(/^\s*drop-shadow\((.*)\)\s*$/))&&n[1].match(/(?:rgba?|hsla?)\([^)]*\)|#[0-9a-f]+|\b[a-z]+\b/i),(n=n&&n[1].replace(e&&e[0],"").match(/-?[\d.]+/g))&&2<=n.length?{color:new T(e?e[0]:"black"),blur:parseFloat(n[2])||0,offset:new Gt(parseFloat(n[0]),parseFloat(n[1]))}:null));n&&(t.setShadowColor(n.color),t.setShadowBlur(n.blur),t.setShadowOffset(n.offset))},"data-paper-blend-mode":function(t,e){t.setBlendMode&&t.setBlendMode(e)},"font-style":function(t,e){var n;t.setFontWeight&&/^(italic|oblique)$/.test(e)&&(n=(""+t.getFontWeight()).replace(/\s*\b(italic|oblique)\b/gi,""),t.setFontWeight(/^(normal|400)$/.test(n)?e:n+" "+e))},"letter-spacing":function(t,e){var n;t.setLetterTracking&&(n=parseFloat(e)||0,t.setLetterTracking(1e3*(/em$/.test(e)?n:n/parseFloat(t.getFontSize()))))},"stop-color":function(t,e){t.setColor&&t.setColor(e)},"stop-opacity":function(t,e){t._color&&t._color.setAlpha(parseFloat(e))},offset:function(t,e){var n;t.setOffset&&(n=e.match(/(.*)%$/),t.setOffset(n?n[1]/100:parseFloat(e)))},viewBox:function(t,e,n,i,r){var s,a,o=new C(At(e,"array")),e=Ot(i,null,null,!0);t instanceof v?(a=e?e.divide(o.getSize()):1,s=(new F).scale(a).translate(o.getPoint().negate()),a=t):t instanceof y&&(e&&o.setSize(e),a=t._item),a&&("visible"!==Ft(i,"overflow",r)&&((o=new m.Rectangle(o)).setClipMask(!0),a.addChild(o)),s&&a.transform(s))}}),A.inject({importSVG:function(t,e){return Qt(t,e,this)}}),s.inject({importSVG:function(t,e){return this.activate(),Qt(t,e,this)}});var te=new(l.inject(O.exports,{Base:O,Numerical:Ut,ChangeFlag:i,Key:ot,DomEvent:H,DomElement:R,document:z,window:k,PlacedSymbol:h,Symbol:y}));return te.agent.node&&require("./node/extend.js")(te),"function"==typeof define&&define.amd?define("paper",te):"object"==typeof module&&module&&(module.exports=te),te}("object"==typeof self?self:null);
|