-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjcanvas.min.js
69 lines (69 loc) · 31.7 KB
/
jcanvas.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
jCanvas v14.05.10
Copyright 2014 Caleb Evans
Released under the MIT license
*/
(function(g,wa,xa,Va,da,fa,na,l,y,h,s){function K(d){var c;if(N.future.inheritance)for(c in d)d.hasOwnProperty(c)&&(this[c]=d[c]);else X(this,d)}function N(d){var c;if(d)X(aa,d);else for(c in aa)aa.hasOwnProperty(c)&&delete aa[c];na&&na.warn&&!ya.jCanvas&&(ya.jCanvas=l,na.warn("The jCanvas() method has been deprecated and will be removed in a future release."));return this}function za(){}function ka(d){return"string"===ba(d)}function J(d){return d&&d.getContext?d.getContext("2d"):h}function la(d){d=
X({},d);d.masks=d.masks.slice(0);return d}function ga(d,c){var a;d.save();a=la(c.transforms);c.savedTransforms.push(a)}function Aa(d,c,a,b){a[b]&&(ea(a[b])?c[b]=a[b].call(d,a):c[b]=a[b])}function T(d,c,a){Aa(d,c,a,"fillStyle");Aa(d,c,a,"strokeStyle");c.lineWidth=a.strokeWidth;a.rounded?c.lineCap=c.lineJoin="round":(c.lineCap=a.strokeCap,c.lineJoin=a.strokeJoin,c.miterLimit=a.miterLimit);a.strokeDash||(a.strokeDash=[0]);c.setLineDash&&c.setLineDash(a.strokeDash);c.webkitLineDash=c.mozDash=a.strokeDash;
c.lineDashOffset=c.webkitLineDashOffset=c.mozDashOffset=a.strokeDashOffset;c.shadowOffsetX=a.shadowX;c.shadowOffsetY=a.shadowY;c.shadowBlur=a.shadowBlur;c.shadowColor=a.shadowColor;c.globalAlpha=a.opacity;c.globalCompositeOperation=a.compositing;a.imageSmoothing&&(c.webkitImageSmoothingEnabled=c.mozImageSmoothingEnabled=a.imageSmoothing)}function Ba(d,c,a){a.mask&&(a.autosave&&ga(d,c),d.clip(),c.transforms.masks.push(a._args))}function Y(d,c,a){a.closed&&c.closePath();a.shadowStroke&&0!==a.strokeWidth?
(c.stroke(),c.fill(),c.shadowColor="transparent",c.shadowBlur=0,c.stroke()):(c.fill(),"transparent"!==a.fillStyle&&(c.shadowColor="transparent"),0!==a.strokeWidth&&c.stroke());a.closed||c.closePath();a._transformed&&c.restore();a.mask&&(d=L(d),Ba(c,d,a))}function R(d,c,a,b,f){a._toRad=a.inDegrees?E/180:1;a._transformed=l;c.save();a.fromCenter||a._centered||b===s||(f===s&&(f=b),a.x+=b/2,a.y+=f/2,a._centered=l);a.rotate&&Ca(c,a,h);1===a.scale&&1===a.scaleX&&1===a.scaleY||Da(c,a,h);(a.translate||a.translateX||
a.translateY)&&Ea(c,a,h)}function L(d){var c=ca.dataCache,a;c._canvas===d&&c._data?a=c._data:(a=g.data(d,"jCanvas"),a||(a={canvas:d,layers:[],layer:{names:{},groups:{}},eventHooks:{},intersecting:[],lastIntersected:h,cursor:g(d).css("cursor"),drag:{layer:h,dragging:y},event:{type:h,x:h,y:h},events:{},transforms:la(oa),savedTransforms:[],animating:y,animated:h,pixelRatio:1,scaled:y},g.data(d,"jCanvas",a)),c._canvas=d,c._data=a);return a}function Fa(d,c,a){for(var b in N.events)N.events.hasOwnProperty(b)&&
(a[b]||a.cursors&&a.cursors[b])&&Ga(d,c,a,b)}function Ga(d,c,a,b){N.events[b](d,c);a._event=l}function Ha(d,c,a){var b,f,e;if(a.draggable||a.cursors){b=["mousedown","mousemove","mouseup"];for(e=0;e<b.length;e+=1)f=b[e],Ga(d,c,a,f);c.events.mouseoutdrag||(d.bind("mouseout.jCanvas",function(){var a=c.drag.layer;a&&(c.drag={},Q(d,c,a,"dragcancel"),d.drawLayers())}),c.events.mouseoutdrag=l);a._event=l}}function pa(d,c,a,b){d=c.layer.names;b?b.name!==s&&ka(a.name)&&a.name!==b.name&&delete d[a.name]:b=
a;ka(b.name)&&(d[b.name]=a)}function qa(d,c,a,b){d=c.layer.groups;var f,e,k,F;if(!b)b=a;else if(b.groups!==s&&a.groups!==h)for(e=0;e<a.groups.length;e+=1)if(f=a.groups[e],c=d[f]){for(F=0;F<c.length;F+=1)if(c[F]===a){k=F;c.splice(F,1);break}0===c.length&&delete d[f]}if(b.groups!==s&&b.groups!==h)for(e=0;e<b.groups.length;e+=1)f=b.groups[e],c=d[f],c||(c=d[f]=[],c.name=f),k===s&&(k=c.length),c.splice(k,0,a)}function ra(d,c,a,b,f){b[a]&&c._running&&!c._running[a]&&(c._running[a]=l,b[a].call(d[0],c,f),
c._running[a]=y)}function Q(d,c,a,b,f){if(!a.disableEvents){if("mouseout"!==b){var e;a.cursors&&(e=a.cursors[b]);-1!==g.inArray(e,W.cursors)&&(e=W.prefix+e);e&&d.css({cursor:e})}ra(d,a,b,a,f);ra(d,a,b,c.eventHooks,f);ra(d,a,b,N.eventHooks,f)}}function O(d,c,a,b){var f,e=c._layer?a:c;c._args=a;if(c.draggable||c.dragGroups)c.layer=l,c.draggable=l;c._method=b?b:c.method?g.fn[c.method]:c.type?g.fn[Z.drawings[c.type]]:function(){};c.layer&&!c._layer&&(a=g(d),b=L(d),f=b.layers,e.name===h||ka(e.name)&&b.layer.names[e.name]===
s)&&(e=new K(c),e.canvas=d,e.$canvas=g(d),e.layer=l,e._layer=l,e._running={},e.data=e.data!==h?X({},e.data):{},e.groups=e.groups!==h?e.groups.slice(0):[],pa(a,b,e),qa(a,b,e),Fa(a,b,e),Ha(a,b,e),c._event=e._event,e._method===g.fn.drawText&&a.measureText(e),e.index===h&&(e.index=f.length),f.splice(e.index,0,e),c._args=e,Q(a,b,e,"add"));return e}function Ia(d,c){var a,b;for(b=0;b<W.props.length;b+=1)a=W.props[b],d[a]!==s&&(d["_"+a]=d[a],W.propsObj[a]=l,c&&delete d[a])}function Wa(d,c,a){var b,f,e,k;
for(b in a)if(a.hasOwnProperty(b)&&(f=a[b],ea(f)&&(a[b]=f.call(d,c,b)),"object"===ba(f)&&Ja(f))){for(e in f)f.hasOwnProperty(e)&&(k=f[e],c[b]!==s&&(c[b+"."+e]=c[b][e],a[b+"."+e]=k));delete a[b]}return a}function Ka(d){var c,a,b=[],f=1;d.match(/^([a-z]+|#[0-9a-f]+)$/gi)&&("transparent"===d&&(d="rgba( 0,0,0,0 )"),a=wa.head,c=a.style.color,a.style.color=d,d=g.css(a,"color"),a.style.color=c);d.match(/^rgb/gi)&&(b=d.match(/(\d+(\.\d+)?)/gi),d.match(/%/gi)&&(f=2.55),b[0]*=f,b[1]*=f,b[2]*=f,b[3]=b[3]!==
s?fa(b[3]):1);return b}function Xa(d){var c=3,a;"array"!==ba(d.start)&&(d.start=Ka(d.start),d.end=Ka(d.end));d.now=[];if(1!==d.start[3]||1!==d.end[3])c=4;for(a=0;a<c;a+=1)d.now[a]=d.start[a]+(d.end[a]-d.start[a])*d.pos,3>a&&(d.now[a]=Ya(d.now[a]));1!==d.start[3]||1!==d.end[3]?d.now="rgba( "+d.now.join(",")+" )":(d.now.slice(0,3),d.now="rgb( "+d.now.join(",")+" )");d.elem.nodeName?d.elem.style[d.prop]=d.now:d.elem[d.prop]=d.now}function Za(d){Z.touchEvents[d]&&(d=Z.touchEvents[d]);return d}function $a(d){N.events[d]=
function(c,a){function b(a){k.x=a.offsetX;k.y=a.offsetY;k.type=f;k.event=a;c.drawLayers({resetFire:l});a.preventDefault()}var f,e,k;k=a.event;f="mouseover"===d||"mouseout"===d?"mousemove":d;e=Za(f);a.events[f]||(e!==f?c.bind(f+".jCanvas "+e+".jCanvas",b):c.bind(f+".jCanvas",b),a.events[f]=l)}}function U(d,c,a){var b,f,e,k;if(a=a._args)d=L(d),b=d.event,b.x!==h&&b.y!==h&&(e=b.x*d.pixelRatio,k=b.y*d.pixelRatio,f=c.isPointInPath(e,k)||c.isPointInStroke&&c.isPointInStroke(e,k)),c=d.transforms,a.eventX=
a.mouseX=b.x,a.eventY=a.mouseY=b.y,a.event=b.event,b=d.transforms.rotate,e=a.eventX,k=a.eventY,0!==b?(a._eventX=e*P(-b)-k*V(-b),a._eventY=k*P(-b)+e*V(-b)):(a._eventX=e,a._eventY=k),a._eventX/=c.scaleX,a._eventY/=c.scaleY,f&&d.intersecting.push(a),a.intersects=f}function Ca(d,c,a){c._toRad=c.inDegrees?E/180:1;d.translate(c.x,c.y);d.rotate(c.rotate*c._toRad);d.translate(-c.x,-c.y);a&&(a.rotate+=c.rotate*c._toRad)}function Da(d,c,a){1!==c.scale&&(c.scaleX=c.scaleY=c.scale);d.translate(c.x,c.y);d.scale(c.scaleX,
c.scaleY);d.translate(-c.x,-c.y);a&&(a.scaleX*=c.scaleX,a.scaleY*=c.scaleY)}function Ea(d,c,a){c.translate&&(c.translateX=c.translateY=c.translate);d.translate(c.translateX,c.translateY);a&&(a.translateX+=c.translateX,a.translateY+=c.translateY)}function La(d){for(;0>d;)d+=2*E;return d}function Ma(d,c,a,b){var f,e,k,g,C,u,h;a===b?h=u=0:(u=a.x,h=a.y);b.inDegrees||360!==b.end||(b.end=2*E);b.start*=a._toRad;b.end*=a._toRad;b.start-=E/2;b.end-=E/2;C=E/180*1;b.ccw&&(C*=-1);f=b.x+b.radius*P(b.start+C);
e=b.y+b.radius*V(b.start+C);k=b.x+b.radius*P(b.start);g=b.y+b.radius*V(b.start);ha(d,c,a,b,f,e,k,g);c.arc(b.x+u,b.y+h,b.radius,b.start,b.end,b.ccw);f=b.x+b.radius*P(b.end+C);C=b.y+b.radius*V(b.end+C);e=b.x+b.radius*P(b.end);k=b.y+b.radius*V(b.end);ia(d,c,a,b,e,k,f,C)}function Na(d,c,a,b,f,e,k,g){var C,u;b.arrowRadius&&!a.closed&&(u=ab(g-e,k-f),u-=E,d=a.strokeWidth*P(u),C=a.strokeWidth*V(u),a=k+b.arrowRadius*P(u+b.arrowAngle/2),f=g+b.arrowRadius*V(u+b.arrowAngle/2),e=k+b.arrowRadius*P(u-b.arrowAngle/
2),b=g+b.arrowRadius*V(u-b.arrowAngle/2),c.moveTo(a-d,f-C),c.lineTo(k-d,g-C),c.lineTo(e-d,b-C),c.moveTo(k-d,g-C),c.lineTo(k+d,g+C),c.moveTo(k,g))}function ha(d,c,a,b,f,e,k,g){b._arrowAngleConverted||(b.arrowAngle*=a._toRad,b._arrowAngleConverted=l);b.startArrow&&Na(d,c,a,b,f,e,k,g)}function ia(d,c,a,b,f,e,k,g){b._arrowAngleConverted||(b.arrowAngle*=a._toRad,b._arrowAngleConverted=l);b.endArrow&&Na(d,c,a,b,f,e,k,g)}function Oa(d,c,a,b){var f,e,k;f=2;ha(d,c,a,b,b.x2+a.x,b.y2+a.y,b.x1+a.x,b.y1+a.y);
for(b.x1!==s&&b.y1!==s&&c.moveTo(b.x1+a.x,b.y1+a.y);l;)if(e=b["x"+f],k=b["y"+f],e!==s&&k!==s)c.lineTo(e+a.x,k+a.y),f+=1;else break;f-=1;ia(d,c,a,b,b["x"+(f-1)]+a.x,b["y"+(f-1)]+a.y,b["x"+f]+a.x,b["y"+f]+a.y)}function Pa(d,c,a,b){var f,e,k,g,C;f=2;ha(d,c,a,b,b.cx1+a.x,b.cy1+a.y,b.x1+a.x,b.y1+a.y);for(b.x1!==s&&b.y1!==s&&c.moveTo(b.x1+a.x,b.y1+a.y);l;)if(e=b["x"+f],k=b["y"+f],g=b["cx"+(f-1)],C=b["cy"+(f-1)],e!==s&&k!==s&&g!==s&&C!==s)c.quadraticCurveTo(g+a.x,C+a.y,e+a.x,k+a.y),f+=1;else break;f-=1;
ia(d,c,a,b,b["cx"+(f-1)]+a.x,b["cy"+(f-1)]+a.y,b["x"+f]+a.x,b["y"+f]+a.y)}function Qa(d,c,a,b){var f,e,k,g,C,u,h,B;f=2;e=1;ha(d,c,a,b,b.cx1+a.x,b.cy1+a.y,b.x1+a.x,b.y1+a.y);for(b.x1!==s&&b.y1!==s&&c.moveTo(b.x1+a.x,b.y1+a.y);l;)if(k=b["x"+f],g=b["y"+f],C=b["cx"+e],u=b["cy"+e],h=b["cx"+(e+1)],B=b["cy"+(e+1)],k!==s&&g!==s&&C!==s&&u!==s&&h!==s&&B!==s)c.bezierCurveTo(C+a.x,u+a.y,h+a.x,B+a.y,k+a.x,g+a.y),f+=1,e+=2;else break;f-=1;e-=2;ia(d,c,a,b,b["cx"+(e+1)]+a.x,b["cy"+(e+1)]+a.y,b["x"+f]+a.x,b["y"+f]+
a.y)}function Ra(d,c,a){c*=d._toRad;c-=E/2;return a*P(c)}function Sa(d,c,a){c*=d._toRad;c-=E/2;return a*V(c)}function Ta(d,c,a,b){var f,e,k,g,h,u,$;a===b?h=g=0:(g=a.x,h=a.y);f=1;e=g=u=b.x+g;k=h=$=b.y+h;ha(d,c,a,b,e+Ra(a,b.a1,b.l1),k+Sa(a,b.a1,b.l1),e,k);for(b.x!==s&&b.y!==s&&c.moveTo(e,k);l;)if(e=b["a"+f],k=b["l"+f],e!==s&&k!==s)g=u,h=$,u+=Ra(a,e,k),$+=Sa(a,e,k),c.lineTo(u,$),f+=1;else break;ia(d,c,a,b,g,h,u,$)}function sa(d,c,a){isNaN(Number(a.fontSize))||(a.fontSize+="px");c.font=a.fontStyle+" "+
a.fontSize+" "+a.fontFamily}function ta(d,c,a,b){var f,e;f=ca.propCache;if(f.text===a.text&&f.fontStyle===a.fontStyle&&f.fontSize===a.fontSize&&f.fontFamily===a.fontFamily&&f.maxWidth===a.maxWidth&&f.lineHeight===a.lineHeight)a.width=f.width,a.height=f.height;else{a.width=c.measureText(b[0]).width;for(e=1;e<b.length;e+=1)f=c.measureText(b[e]).width,f>a.width&&(a.width=f);c=d.style.fontSize;d.style.fontSize=a.fontSize;a.height=fa(g.css(d,"fontSize"))*b.length*a.lineHeight;d.style.fontSize=c}}function Ua(d,
c){var a=c.maxWidth,b=c.text.split("\n"),f=[],e,k,g,h,u;for(g=0;g<b.length;g+=1){h=b[g];u=h.split(" ");e=[];k="";if(1===u.length||d.measureText(h).width<a)e=[h];else{for(h=0;h<u.length;h+=1)d.measureText(k+u[h]).width>a&&(""!==k&&e.push(k),k=""),k+=u[h],h!==u.length-1&&(k+=" ");e.push(k)}f=f.concat(e.join("\n").replace(/( (\n))|( $)/gi,"$2").split("\n"))}return f}var ma,aa,X=g.extend,ja=g.inArray,ba=g.type,ea=g.isFunction,Ja=g.isPlainObject,E=da.PI,Ya=da.round,bb=da.abs,V=da.sin,P=da.cos,ab=da.atan2,
ua=Va.prototype.slice,cb=g.event.fix,Z={},ca={dataCache:{},propCache:{},imageCache:{}},oa={rotate:0,scaleX:1,scaleY:1,translateX:0,translateY:0,masks:[]},ya={jCanvas:y},W={};g.fn.jCanvas=N;N.events={};N.eventHooks={};N.future={inheritance:!1};ma=new function(){X(this,{align:"center",arrowAngle:90,arrowRadius:0,autosave:l,baseline:"middle",bringToFront:y,ccw:y,closed:y,compositing:"source-over",concavity:0,cornerRadius:0,count:1,cropFromCenter:l,crossOrigin:"",cursors:h,disableEvents:y,draggable:y,
dragGroups:h,groups:h,data:h,dx:h,dy:h,end:360,eventX:h,eventY:h,fillStyle:"transparent",fontStyle:"normal",fontSize:"12pt",fontFamily:"sans-serif",fromCenter:l,height:h,imageSmoothing:l,inDegrees:l,index:h,lineHeight:1,layer:y,mask:y,maxWidth:h,miterLimit:10,name:h,opacity:1,r1:h,r2:h,radius:0,repeat:"repeat",respectAlign:y,rotate:0,rounded:y,scale:1,scaleX:1,scaleY:1,shadowBlur:0,shadowColor:"transparent",shadowStroke:y,shadowX:0,shadowY:0,sHeight:h,sides:0,source:"",letterSpacing:h,spread:0,start:0,
strokeCap:"butt",strokeDash:h,strokeDashOffset:0,strokeJoin:"miter",strokeStyle:"transparent",strokeWidth:1,sWidth:h,sx:h,sy:h,text:"",translate:0,translateX:0,translateY:0,type:h,visible:l,width:h,x:0,y:0})};za.prototype=ma;aa=new za;K.prototype=aa;N.extend=function(d){d.name&&(d.props&&X(ma,d.props),g.fn[d.name]=function a(b){var f,e,k,g;for(e=0;e<this.length;e+=1)if(f=this[e],k=J(f))g=new K(b),O(f,g,b,a),T(f,k,g),d.fn.call(f,k,g);return this},d.type&&(Z.drawings[d.type]=d.name));return g.fn[d.name]};
g.fn.getEventHooks=function(){var d;d={};0!==this.length&&(d=this[0],d=L(d),d=d.eventHooks);return d};g.fn.setEventHooks=function(d){var c,a;for(c=0;c<this.length;c+=1)g(this[c]),a=L(this[c]),X(a.eventHooks,d);return this};g.fn.getLayers=function(d){var c,a,b,f,e=[];if(0!==this.length)if(c=this[0],a=L(c),a=a.layers,ea(d))for(f=0;f<a.length;f+=1)b=a[f],d.call(c,b)&&e.push(b);else e=a;return e};g.fn.getLayer=function(d){var c,a,b,f;if(0!==this.length)if(c=this[0],a=L(c),c=a.layers,f=ba(d),d&&d.layer)b=
d;else if("number"===f)0>d&&(d=c.length+d),b=c[d];else if("regexp"===f)for(a=0;a<c.length;a+=1){if(ka(c[a].name)&&c[a].name.match(d)){b=c[a];break}}else b=a.layer.names[d];return b};g.fn.getLayerGroup=function(d){var c,a,b,f=ba(d);if(0!==this.length)if(c=this[0],"array"===f)b=d;else if("regexp"===f)for(a in c=L(c),c=c.layer.groups,c){if(a.match(d)){b=c[a];break}}else c=L(c),b=c.layer.groups[d];return b};g.fn.getLayerIndex=function(d){var c=this.getLayers();d=this.getLayer(d);return ja(d,c)};g.fn.setLayer=
function(d,c){var a,b,f,e,k,h,C;for(b=0;b<this.length;b+=1)if(a=g(this[b]),f=L(this[b]),e=g(this[b]).getLayer(d)){pa(a,f,e,c);qa(a,f,e,c);for(k in c)c.hasOwnProperty(k)&&(h=c[k],C=ba(h),"object"===C&&Ja(h)?e[k]=X({},h):"array"===C?e[k]=h.slice(0):"string"===C?0===h.indexOf("+=")?e[k]+=fa(h.substr(2)):0===h.indexOf("-=")?e[k]-=fa(h.substr(2)):e[k]=h:e[k]=h);Fa(a,f,e);Ha(a,f,e);g.isEmptyObject(c)===y&&Q(a,f,e,"change",c)}return this};g.fn.setLayers=function(d,c){var a,b,f,e;for(b=0;b<this.length;b+=
1)for(a=g(this[b]),f=a.getLayers(c),e=0;e<f.length;e+=1)a.setLayer(f[e],d);return this};g.fn.setLayerGroup=function(d,c){var a,b,f,e;for(b=0;b<this.length;b+=1)if(a=g(this[b]),f=a.getLayerGroup(d))for(e=0;e<f.length;e+=1)a.setLayer(f[e],c);return this};g.fn.moveLayer=function(d,c){var a,b,f,e,k;for(b=0;b<this.length;b+=1)if(a=g(this[b]),f=L(this[b]),e=f.layers,k=a.getLayer(d))k.index=ja(k,e),e.splice(k.index,1),e.splice(c,0,k),0>c&&(c=e.length+c),k.index=c,Q(a,f,k,"move");return this};g.fn.removeLayer=
function(d){var c,a,b,f,e;for(a=0;a<this.length;a+=1)if(c=g(this[a]),b=L(this[a]),f=c.getLayers(),e=c.getLayer(d))e.index=ja(e,f),f.splice(e.index,1),pa(c,b,e,{name:h}),qa(c,b,e,{groups:h}),Q(c,b,e,"remove");return this};g.fn.removeLayers=function(d){var c,a,b,f,e,k;for(a=0;a<this.length;a+=1){c=g(this[a]);b=L(this[a]);f=c.getLayers(d);for(k=0;k<f.length;k+=1)e=f[k],c.removeLayer(e),k-=1;b.layer.names={};b.layer.groups={}}return this};g.fn.removeLayerGroup=function(d){var c,a,b,f;if(d!==s)for(a=0;a<
this.length;a+=1)if(c=g(this[a]),L(this[a]),c.getLayers(),b=c.getLayerGroup(d))for(b=b.slice(0),f=0;f<b.length;f+=1)c.removeLayer(b[f]);return this};g.fn.addLayerToGroup=function(d,c){var a,b,f,e=[c];for(b=0;b<this.length;b+=1)a=g(this[b]),f=a.getLayer(d),f.groups&&(e=f.groups.slice(0),-1===ja(c,f.groups)&&e.push(c)),a.setLayer(f,{groups:e});return this};g.fn.removeLayerFromGroup=function(d,c){var a,b,f,e=[],k;for(b=0;b<this.length;b+=1)a=g(this[b]),f=a.getLayer(d),f.groups&&(k=ja(c,f.groups),-1!==
k&&(e=f.groups.slice(0),e.splice(k,1),a.setLayer(f,{groups:e})));return this};W.cursors=["grab","grabbing","zoom-in","zoom-out"];W.prefix=function(){var d=getComputedStyle(wa.documentElement,"");return"-"+(ua.call(d).join("").match(/-( moz|webkit|ms )-/)||""===d.OLink&&["","o"])[1]+"-"}();g.fn.triggerLayerEvent=function(d,c){var a,b,f;for(b=0;b<this.length;b+=1)a=g(this[b]),f=L(this[b]),(d=a.getLayer(d))&&Q(a,f,d,c);return this};g.fn.drawLayer=function(d){var c,a,b;for(c=0;c<this.length;c+=1)a=g(this[c]),
J(this[c]),(b=a.getLayer(d))&&b.visible&&b._method&&(b._next=h,b._method.call(a,b));return this};g.fn.drawLayers=function(d){var c,a,b=X({},d),f,e,k,F,C,u,$;b.index||(b.index=0);for(c=0;c<this.length;c+=1)if(d=g(this[c]),a=J(this[c])){F=L(this[c]);b.clear!==y&&d.clearCanvas();a=F.layers;for(k=b.index;k<a.length;k+=1)if(f=a[k],f.index=k,b.resetFire&&(f._fired=y),C=d,u=f,e=k+1,u&&u.visible&&u._method&&(u._next=e?e:h,u._method.call(C,u)),f._masks=F.transforms.masks.slice(0),f._method===g.fn.drawImage&&
f.visible){$=!0;break}if($)break;f=F;var B=e=u=C=void 0;C=h;for(u=f.intersecting.length-1;0<=u;u-=1)if(C=f.intersecting[u],C._masks){for(B=C._masks.length-1;0<=B;B-=1)if(e=C._masks[B],!e.intersects){C.intersects=y;break}if(C.intersects)break}f=C;C=F.event;u=C.type;if(F.drag.layer){e=d;var B=F,z=u,A=void 0,n=void 0,v=void 0,q=v=void 0,x=void 0,v=A=A=v=void 0,v=B.drag,q=(n=v.layer)&&n.dragGroups||[],A=B.layers;if("mousemove"===z||"touchmove"===z){if(v.dragging||(v.dragging=l,n.dragging=l,n.bringToFront&&
(A.splice(n.index,1),n.index=A.push(n)),n._startX=n.x,n._startY=n.y,n._endX=n._eventX,n._endY=n._eventY,Q(e,B,n,"dragstart")),v.dragging)for(A=n._eventX-(n._endX-n._startX),v=n._eventY-(n._endY-n._startY),n.dx=A-n.x,n.dy=v-n.y,n.x=A,n.y=v,Q(e,B,n,"drag"),A=0;A<q.length;A+=1)if(v=q[A],x=B.layer.groups[v],n.groups&&x)for(v=0;v<x.length;v+=1)x[v]!==n&&(x[v].x+=n.dx,x[v].y+=n.dy)}else if("mouseup"===z||"touchend"===z)v.dragging&&(n.dragging=y,v.dragging=y,Q(e,B,n,"dragstop")),B.drag={}}e=F.lastIntersected;
e===h||f===e||!e._hovered||e._fired||F.drag.dragging||(F.lastIntersected=h,e._fired=l,e._hovered=y,Q(d,F,e,"mouseout"),d.css({cursor:F.cursor}));f&&(f[u]||Z.mouseEvents[u]&&(u=Z.mouseEvents[u]),f._event&&f.intersects&&(F.lastIntersected=f,!(f.mouseover||f.mouseout||f.cursors)||F.drag.dragging||f._hovered||f._fired||(f._fired=l,f._hovered=l,Q(d,F,f,"mouseover")),f._fired||(f._fired=l,C.type=h,Q(d,F,f,u)),!f.draggable||f.disableEvents||"mousedown"!==u&&"touchstart"!==u||(F.drag.layer=f)));f!==h||F.drag.dragging||
d.css({cursor:F.cursor});k===a.length&&(F.intersecting.length=0,F.transforms=la(oa),F.savedTransforms.length=0)}return this};g.fn.addLayer=function(d){var c,a;for(c=0;c<this.length;c+=1)if(a=J(this[c]))a=new K(d),a.layer=l,O(this[c],a,d);return this};W.props=["width","height","opacity","lineHeight"];W.propsObj={};g.fn.animateLayer=function(){function d(a,b,c){return function(){var d,f;for(f=0;f<W.props.length;f+=1)d=W.props[f],c[d]=c["_"+d];for(var k in c)c.hasOwnProperty(k)&&-1!==k.indexOf(".")&&
delete c[k];b.animating&&b.animated!==c||a.drawLayers();c._animating=y;b.animating=y;b.animated=h;e[4]&&e[4].call(a[0],c);Q(a,b,c,"animateend")}}function c(a,b,c){return function(d,f){var k,g,h=!1;"_"===f.prop[0]&&(h=!0,f.prop=f.prop.replace("_",""),c[f.prop]=c["_"+f.prop]);-1!==f.prop.indexOf(".")&&(k=f.prop.split("."),g=k[0],k=k[1],c[g]&&(c[g][k]=f.now));c._pos!==f.pos&&(c._pos=f.pos,c._animating||b.animating||(c._animating=l,b.animating=l,b.animated=c),b.animating&&b.animated!==c||a.drawLayers());
e[5]&&e[5].call(a[0],d,f,c);Q(a,b,c,"animate",f);h&&(f.prop="_"+f.prop)}}var a,b,f,e=ua.call(arguments,0),k,F;"object"===ba(e[2])?(e.splice(2,0,e[2].duration||h),e.splice(3,0,e[3].easing||h),e.splice(4,0,e[4].complete||h),e.splice(5,0,e[5].step||h)):(e[2]===s?(e.splice(2,0,h),e.splice(3,0,h),e.splice(4,0,h)):ea(e[2])&&(e.splice(2,0,h),e.splice(3,0,h)),e[3]===s?(e[3]=h,e.splice(4,0,h)):ea(e[3])&&e.splice(3,0,h));for(b=0;b<this.length;b+=1)if(a=g(this[b]),f=J(this[b]))f=L(this[b]),(k=a.getLayer(e[0]))&&
k._method!==g.fn.draw&&(F=X({},e[1]),F=Wa(this[b],k,F),Ia(F,l),Ia(k),k.style=W.propsObj,g(k).animate(F,{duration:e[2],easing:g.easing[e[3]]?e[3]:h,complete:d(a,f,k),step:c(a,f,k)}),Q(a,f,k,"animatestart"));return this};g.fn.animateLayerGroup=function(d){var c,a,b=ua.call(arguments,0),f,e;for(a=0;a<this.length;a+=1)if(c=g(this[a]),f=c.getLayerGroup(d))for(e=0;e<f.length;e+=1)b[0]=f[e],c.animateLayer.apply(c,b);return this};g.fn.delayLayer=function(d,c){var a,b,f,e;c=c||0;for(b=0;b<this.length;b+=1)if(a=
g(this[b]),f=L(this[b]),e=a.getLayer(d))g(e).delay(c),Q(a,f,e,"delay");return this};g.fn.delayLayerGroup=function(d,c){var a,b,f,e,k;c=c||0;for(b=0;b<this.length;b+=1)if(a=g(this[b]),f=a.getLayerGroup(d))for(k=0;k<f.length;k+=1)e=f[k],a.delayLayer(e,c);return this};g.fn.stopLayer=function(d,c){var a,b,f,e;for(b=0;b<this.length;b+=1)if(a=g(this[b]),f=L(this[b]),e=a.getLayer(d))g(e).stop(c),Q(a,f,e,"stop");return this};g.fn.stopLayerGroup=function(d,c){var a,b,f,e,k;for(b=0;b<this.length;b+=1)if(a=
g(this[b]),f=a.getLayerGroup(d))for(k=0;k<f.length;k+=1)e=f[k],a.stopLayer(e,c);return this};(function(d){var c;for(c=0;c<d.length;c+=1)g.fx.step[d[c]]=Xa})("color backgroundColor borderColor borderTopColor borderRightColor borderBottomColor borderLeftColor fillStyle outlineColor strokeStyle shadowColor".split(" "));Z.touchEvents={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"};Z.mouseEvents={touchstart:"mousedown",touchend:"mouseup",touchmove:"mousemove"};(function(d){var c;for(c=
0;c<d.length;c+=1)$a(d[c])})("click dblclick mousedown mouseup mousemove mouseover mouseout touchstart touchmove touchend".split(" "));g.event.fix=function(d){var c,a;d=cb.call(g.event,d);if(c=d.originalEvent)if(a=c.changedTouches,d.pageX!==s&&d.offsetX===s){if(c=g(d.currentTarget).offset())d.offsetX=d.pageX-c.left,d.offsetY=d.pageY-c.top}else a&&(c=g(d.currentTarget).offset())&&(d.offsetX=a[0].pageX-c.left,d.offsetY=a[0].pageY-c.top);return d};Z.drawings={arc:"drawArc",bezier:"drawBezier",ellipse:"drawEllipse",
"function":"draw",image:"drawImage",line:"drawLine",path:"drawPath",polygon:"drawPolygon",slice:"drawSlice",quadratic:"drawQuadratic",rectangle:"drawRect",text:"drawText",vector:"drawVector",save:"saveCanvas",restore:"restoreCanvas",rotate:"rotateCanvas",scale:"scaleCanvas",translate:"translateCanvas"};g.fn.draw=function c(a){var b,f,e=new K(a);if(Z.drawings[e.type]&&"function"!==e.type)this[Z.drawings[e.type]](a);else for(b=0;b<this.length;b+=1)if(g(this[b]),f=J(this[b]))e=new K(a),O(this[b],e,a,
c),e.visible&&e.fn&&e.fn.call(this[b],f,e);return this};g.fn.clearCanvas=function a(b){var f,e,k=new K(b);for(f=0;f<this.length;f+=1)if(e=J(this[f]))k.width===h||k.height===h?(e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,this[f].width,this[f].height),e.restore()):(O(this[f],k,b,a),R(this[f],e,k,k.width,k.height),e.clearRect(k.x-k.width/2,k.y-k.height/2,k.width,k.height),k._transformed&&e.restore());return this};g.fn.saveCanvas=function b(f){var e,k,g,h,u;for(e=0;e<this.length;e+=1)if(k=J(this[e]))for(h=
L(this[e]),g=new K(f),O(this[e],g,f,b),u=0;u<g.count;u+=1)ga(k,h);return this};g.fn.restoreCanvas=function f(e){var k,g,h,u,l;for(k=0;k<this.length;k+=1)if(g=J(this[k]))for(u=L(this[k]),h=new K(e),O(this[k],h,e,f),l=0;l<h.count;l+=1){var B=g,z=u;0===z.savedTransforms.length?z.transforms=la(oa):(B.restore(),z.transforms=z.savedTransforms.pop())}return this};g.fn.rotateCanvas=function e(k){var g,h,u,l;for(g=0;g<this.length;g+=1)if(h=J(this[g]))l=L(this[g]),u=new K(k),O(this[g],u,k,e),u.autosave&&ga(h,
l),Ca(h,u,l.transforms);return this};g.fn.scaleCanvas=function k(g){var h,u,l,B;for(h=0;h<this.length;h+=1)if(u=J(this[h]))B=L(this[h]),l=new K(g),O(this[h],l,g,k),l.autosave&&ga(u,B),Da(u,l,B.transforms);return this};g.fn.translateCanvas=function F(g){var h,l,B,z;for(h=0;h<this.length;h+=1)if(l=J(this[h]))z=L(this[h]),B=new K(g),O(this[h],B,g,F),B.autosave&&ga(l,z),Ea(l,B,z.transforms);return this};g.fn.drawRect=function C(g){var h,B,z,A,n,v,q,x,S;for(h=0;h<this.length;h+=1)if(B=J(this[h]))z=new K(g),
O(this[h],z,g,C),z.visible&&(T(this[h],B,z),R(this[h],B,z,z.width,z.height),B.beginPath(),z.width&&z.height&&(A=z.x-z.width/2,n=z.y-z.height/2,(x=bb(z.cornerRadius))?(v=z.x+z.width/2,q=z.y+z.height/2,0>z.width&&(S=A,A=v,v=S),0>z.height&&(S=n,n=q,q=S),0>v-A-2*x&&(x=(v-A)/2),0>q-n-2*x&&(x=(q-n)/2),B.moveTo(A+x,n),B.lineTo(v-x,n),B.arc(v-x,n+x,x,3*E/2,2*E,y),B.lineTo(v,q-x),B.arc(v-x,q-x,x,0,E/2,y),B.lineTo(A+x,q),B.arc(A+x,q-x,x,E/2,E,y),B.lineTo(A,n+x),B.arc(A+x,n+x,x,E,3*E/2,y),z.closed=l):B.rect(A,
n,z.width,z.height)),U(this[h],B,z),Y(this[h],B,z));return this};g.fn.drawArc=function u(g){var h,z,A;for(h=0;h<this.length;h+=1)if(z=J(this[h]))A=new K(g),O(this[h],A,g,u),A.visible&&(T(this[h],z,A),R(this[h],z,A,2*A.radius),z.beginPath(),Ma(this[h],z,A,A),U(this[h],z,A),Y(this[h],z,A));return this};g.fn.drawEllipse=function $(g){var h,A,n,v,q;for(h=0;h<this.length;h+=1)if(A=J(this[h]))n=new K(g),O(this[h],n,g,$),n.visible&&(T(this[h],A,n),R(this[h],A,n,n.width,n.height),v=4/3*n.width,q=n.height,
A.beginPath(),A.moveTo(n.x,n.y-q/2),A.bezierCurveTo(n.x-v/2,n.y-q/2,n.x-v/2,n.y+q/2,n.x,n.y+q/2),A.bezierCurveTo(n.x+v/2,n.y+q/2,n.x+v/2,n.y-q/2,n.x,n.y-q/2),U(this[h],A,n),n.closed=l,Y(this[h],A,n));return this};g.fn.drawPolygon=function B(h){var g,n,v,q,x,S,M,I,p,m;for(g=0;g<this.length;g+=1)if(n=J(this[g]))if(v=new K(h),O(this[g],v,h,B),v.visible){T(this[g],n,v);R(this[g],n,v,2*v.radius);x=2*E/v.sides;S=x/2;q=S+E/2;M=v.radius*P(S);n.beginPath();for(m=0;m<v.sides;m+=1)I=v.x+v.radius*P(q),p=v.y+
v.radius*V(q),n.lineTo(I,p),v.concavity&&(I=v.x+(M+-M*v.concavity)*P(q+S),p=v.y+(M+-M*v.concavity)*V(q+S),n.lineTo(I,p)),q+=x;U(this[g],n,v);v.closed=l;Y(this[g],n,v)}return this};g.fn.drawSlice=function z(h){var n,v,q,x,S;for(n=0;n<this.length;n+=1)if(g(this[n]),v=J(this[n]))q=new K(h),O(this[n],q,h,z),q.visible&&(T(this[n],v,q),R(this[n],v,q,2*q.radius),q.start*=q._toRad,q.end*=q._toRad,q.start-=E/2,q.end-=E/2,q.start=La(q.start),q.end=La(q.end),q.end<q.start&&(q.end+=2*E),x=(q.start+q.end)/2,S=
q.radius*q.spread*P(x),x=q.radius*q.spread*V(x),q.x+=S,q.y+=x,v.beginPath(),v.arc(q.x,q.y,q.radius,q.start,q.end,q.ccw),v.lineTo(q.x,q.y),U(this[n],v,q),q.closed=l,Y(this[n],v,q));return this};g.fn.drawLine=function A(h){var g,q,x;for(g=0;g<this.length;g+=1)if(q=J(this[g]))x=new K(h),O(this[g],x,h,A),x.visible&&(T(this[g],q,x),R(this[g],q,x),q.beginPath(),Oa(this[g],q,x,x),U(this[g],q,x),Y(this[g],q,x));return this};g.fn.drawQuadratic=function n(g){var h,x,l;for(h=0;h<this.length;h+=1)if(x=J(this[h]))l=
new K(g),O(this[h],l,g,n),l.visible&&(T(this[h],x,l),R(this[h],x,l),x.beginPath(),Pa(this[h],x,l,l),U(this[h],x,l),Y(this[h],x,l));return this};g.fn.drawBezier=function v(h){var g,l,M;for(g=0;g<this.length;g+=1)if(l=J(this[g]))M=new K(h),O(this[g],M,h,v),M.visible&&(T(this[g],l,M),R(this[g],l,M),l.beginPath(),Qa(this[g],l,M,M),U(this[g],l,M),Y(this[g],l,M));return this};g.fn.drawVector=function q(g){var h,M,l;for(h=0;h<this.length;h+=1)if(M=J(this[h]))l=new K(g),O(this[h],l,g,q),l.visible&&(T(this[h],
M,l),R(this[h],M,l),M.beginPath(),Ta(this[h],M,l,l),U(this[h],M,l),Y(this[h],M,l));return this};g.fn.drawPath=function x(h){var g,I,p,m,w;for(g=0;g<this.length;g+=1)if(I=J(this[g]))if(p=new K(h),O(this[g],p,h,x),p.visible){T(this[g],I,p);R(this[g],I,p);I.beginPath();for(m=1;l;)if(w=p["p"+m],w!==s)w=new K(w),"line"===w.type?Oa(this[g],I,p,w):"quadratic"===w.type?Pa(this[g],I,p,w):"bezier"===w.type?Qa(this[g],I,p,w):"vector"===w.type?Ta(this[g],I,p,w):"arc"===w.type&&Ma(this[g],I,p,w),m+=1;else break;
U(this[g],I,p);Y(this[g],I,p)}return this};g.fn.drawText=function S(l){var I,p,m,w,H,t,D,s,G,y;for(I=0;I<this.length;I+=1)if(g(this[I]),p=J(this[I]))if(m=new K(l),w=O(this[I],m,l,S),m.visible){T(this[I],p,m);p.textBaseline=m.baseline;p.textAlign=m.align;sa(this[I],p,m);H=m.maxWidth!==h?Ua(p,m):m.text.toString().split("\n");ta(this[I],p,m,H);w&&(w.width=m.width,w.height=m.height);R(this[I],p,m,m.width,m.height);D=m.x;"left"===m.align?m.respectAlign?m.x+=m.width/2:D-=m.width/2:"right"===m.align&&(m.respectAlign?
m.x-=m.width/2:D+=m.width/2);if(m.radius)for(D=fa(m.fontSize),m.letterSpacing===h&&(m.letterSpacing=D/500),t=0;t<H.length;t+=1){p.save();p.translate(m.x,m.y);w=H[t];s=w.length;p.rotate(-(E*m.letterSpacing*(s-1))/2);for(y=0;y<s;y+=1)G=w[y],0!==y&&p.rotate(E*m.letterSpacing),p.save(),p.translate(0,-m.radius),p.fillText(G,0,0),p.restore();m.radius-=D;m.letterSpacing+=D/(1E3*E);p.restore()}else for(t=0;t<H.length;t+=1)w=H[t],s=m.y+t*m.height/H.length-(H.length-1)*m.height/H.length/2,p.shadowColor=m.shadowColor,
p.fillText(w,D,s),"transparent"!==m.fillStyle&&(p.shadowColor="transparent"),p.strokeText(w,D,s);s=0;"top"===m.baseline?s+=m.height/2:"bottom"===m.baseline&&(s-=m.height/2);m._event&&(p.beginPath(),p.rect(m.x-m.width/2,m.y-m.height/2+s,m.width,m.height),U(this[I],p,m),p.closePath());m._transformed&&p.restore()}ca.propCache=m;return this};g.fn.measureText=function(g){var h,l;h=this.getLayer(g);if(!h||h&&!h._layer)h=new K(g);if(g=J(this[0]))sa(this[0],g,h),l=Ua(g,h),ta(this[0],g,h,l);return h};g.fn.drawImage=
function M(s){function p(m,p,t,r,w){return function(){var M=g(m);T(m,p,r);r.width===h&&r.sWidth===h&&(r.width=r.sWidth=G.width);r.height===h&&r.sHeight===h&&(r.height=r.sHeight=G.height);w&&(w.width=r.width,w.height=r.height);r.sWidth!==h&&r.sHeight!==h&&r.sx!==h&&r.sy!==h?(r.width===h&&(r.width=r.sWidth),r.height===h&&(r.height=r.sHeight),r.cropFromCenter||(r.sx+=r.sWidth/2,r.sy+=r.sHeight/2),0>r.sy-r.sHeight/2&&(r.sy=r.sHeight/2),r.sy+r.sHeight/2>G.height&&(r.sy=G.height-r.sHeight/2),0>r.sx-r.sWidth/
2&&(r.sx=r.sWidth/2),r.sx+r.sWidth/2>G.width&&(r.sx=G.width-r.sWidth/2),R(m,p,r,r.width,r.height),p.drawImage(G,r.sx-r.sWidth/2,r.sy-r.sHeight/2,r.sWidth,r.sHeight,r.x-r.width/2,r.y-r.height/2,r.width,r.height)):(R(m,p,r,r.width,r.height),p.drawImage(G,r.x-r.width/2,r.y-r.height/2,r.width,r.height));p.beginPath();p.rect(r.x-r.width/2,r.y-r.height/2,r.width,r.height);U(m,p,r);p.closePath();r._transformed&&p.restore();Ba(p,t,r);r.layer?Q(M,t,w,"load"):r.load&&r.load.call(M[0],w);r.layer&&(w._masks=
t.transforms.masks.slice(0),r._next&&M.drawLayers({clear:y,resetFire:l,index:r._next}))}}var m,w,H,t,D,E,G,va,N,P=ca.imageCache;for(w=0;w<this.length;w+=1)if(m=this[w],H=J(this[w]))t=L(this[w]),D=new K(s),E=O(this[w],D,s,M),D.visible&&(N=D.source,va=N.getContext,N.src||va?G=N:N&&(P[N]&&P[N].complete?G=P[N]:(G=new xa,G.crossOrigin=D.crossOrigin,G.src=N,P[N]=G)),G&&(G.complete||va?p(m,H,t,D,E)():(G.onload=p(m,H,t,D,E),G.src=G.src)));return this};g.fn.createPattern=function(l){function s(){t=m.createPattern(H,
w.repeat);w.load&&w.load.call(p[0],t)}var p=this,m,w,H,t,D;(m=J(p[0]))?(w=new K(l),D=w.source,ea(D)?(H=g("<canvas />")[0],H.width=w.width,H.height=w.height,l=J(H),D.call(H,l),s()):(l=D.getContext,D.src||l?H=D:(H=new xa,H.crossOrigin=w.crossOrigin,H.src=D),H.complete||l?s():(H.onload=s(),H.src=H.src))):t=h;return t};g.fn.createGradient=function(g){var l,p=[],m,w,H,t,D,y,G;g=new K(g);if(l=J(this[0])){g.x1=g.x1||0;g.y1=g.y1||0;g.x2=g.x2||0;g.y2=g.y2||0;l=g.r1!==h&&g.r2!==h?l.createRadialGradient(g.x1,
g.y1,g.r1,g.x2,g.y2,g.r2):l.createLinearGradient(g.x1,g.y1,g.x2,g.y2);for(t=1;g["c"+t]!==s;t+=1)g["s"+t]!==s?p.push(g["s"+t]):p.push(h);m=p.length;p[0]===h&&(p[0]=0);p[m-1]===h&&(p[m-1]=1);for(t=0;t<m;t+=1){if(p[t]!==h){y=1;G=0;w=p[t];for(D=t+1;D<m;D+=1)if(p[D]!==h){H=p[D];break}else y+=1;w>H&&(p[D]=p[t])}else p[t]===h&&(G+=1,p[t]=w+(H-w)/y*G);l.addColorStop(p[t],g["c"+(t+1)])}}else l=h;return l};g.fn.setPixels=function I(g){var l,w,s,t,D,y,G,E,L;for(w=0;w<this.length;w+=1)if(l=this[w],s=J(l)){t=
new K(g);O(l,t,g,I);R(this[w],s,t,t.width,t.height);if(t.width===h||t.height===h)t.width=l.width,t.height=l.height,t.x=t.width/2,t.y=t.height/2;if(0!==t.width&&0!==t.height){y=s.getImageData(t.x-t.width/2,t.y-t.height/2,t.width,t.height);G=y.data;L=G.length;if(t.each)for(E=0;E<L;E+=4)D={r:G[E],g:G[E+1],b:G[E+2],a:G[E+3]},t.each.call(l,D,t),G[E]=D.r,G[E+1]=D.g,G[E+2]=D.b,G[E+3]=D.a;s.putImageData(y,t.x-t.width/2,t.y-t.height/2);s.restore()}}return this};g.fn.getCanvasImage=function(g,l){var m,w=h;
0!==this.length&&(m=this[0],m.toDataURL&&(l===s&&(l=1),w=m.toDataURL("image/"+g,l)));return w};g.fn.detectPixelRatio=function(h){var p,m,w,s,t,D,y;for(m=0;m<this.length;m+=1)p=this[m],g(this[m]),w=J(p),y=L(this[m]),y.scaled||(s=window.devicePixelRatio||1,t=w.webkitBackingStorePixelRatio||w.mozBackingStorePixelRatio||w.msBackingStorePixelRatio||w.oBackingStorePixelRatio||w.backingStorePixelRatio||1,s/=t,1!==s&&(t=p.width,D=p.height,p.width=t*s,p.height=D*s,p.style.width=t+"px",p.style.height=D+"px",
w.scale(s,s)),y.pixelRatio=s,y.scaled=l,h&&h.call(p,s));return this};N.clearCache=function(){for(var g in ca)ca.hasOwnProperty(g)&&(ca[g]={})};g.support.canvas=g("<canvas />")[0].getContext!==s;X(N,{defaults:ma,prefs:aa,setGlobalProps:T,transformShape:R,detectEvents:U,closePath:Y,setCanvasFont:sa,measureText:ta});g.jCanvas=N})(jQuery,document,Image,Array,Math,parseFloat,console,!0,!1,null);