2013-06-26 22:42:24 -04:00
/ * !
2013-12-02 04:00:44 -05:00
* Paper . js v0 . 9.15 - The Swiss Army Knife of Vector Graphics Scripting .
2013-06-26 22:42:24 -04:00
* http : //paperjs.org/
*
* Copyright ( c ) 2011 - 2013 , Juerg Lehni & Jonathan Puckey
* http : //lehni.org/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license . See LICENSE file for details .
*
* All rights reserved .
*
2013-12-02 04:00:44 -05:00
* Date : Sun Dec 1 23 : 54 : 52 2013 + 0100
2013-06-26 22:42:24 -04:00
*
* * *
*
* straps . js - Class inheritance library with support for bean - style accessors
*
* Copyright ( c ) 2006 - 2013 Juerg Lehni
* http : //lehni.org/
*
* Distributed under the MIT license .
*
* * *
*
* acorn . js
* http : //marijnhaverbeke.nl/acorn/
*
* Acorn is a tiny , fast JavaScript parser written in JavaScript ,
* created by Marijn Haverbeke and released under an MIT license .
*
* /
2013-12-02 04:00:44 -05:00
var paper = new function ( t ) { var e = new function ( ) { function n ( e , n , i , r , o , h ) { function u ( r , s , h , u ) { var s = s || ( s = l ( n , r ) ) && ( s . get ? s : s . value ) ; "string" == typeof s && "#" === s [ 0 ] && ( s = e [ s . substring ( 1 ) ] || s ) ; var f , _ = "function" == typeof s , g = s , p = o || _ ? s && s . get ? r in e : e [ r ] : null ; ! ( h || s !== t && n . hasOwnProperty ( r ) ) || o && p || ( _ && p && ( s . base = p ) , _ && c && 0 === s . length && ( f = r . match ( /^(get|is)(([A-Z])(.*))$/ ) ) && c . push ( [ f [ 3 ] . toLowerCase ( ) + f [ 4 ] , f [ 2 ] ] ) , g && ! _ && g . get && "function" == typeof g . get && 0 === g . get . length || ( g = { value : g , writable : ! 0 } ) , ( l ( e , r ) || { configurable : ! 0 } ) . configurable && ( g . configurable = ! 0 , g . enumerable = i ) , d ( e , r , g ) ) , ! u || ! _ || o && u [ r ] || ( u [ r ] = function ( t ) { return t && e [ r ] . apply ( t , a . call ( arguments , 1 ) ) } ) } var c ; if ( n ) { c = [ ] ; for ( var f in n ) n . hasOwnProperty ( f ) && ! s . test ( f ) && u ( f , null , ! 0 , h ) ; u ( "toString" ) , u ( "valueOf" ) ; for ( var _ = 0 , g = c . length ; g > _ ; _ ++ ) { var p = c [ _ ] , v = p [ 1 ] ; u ( p [ 0 ] , { get : e [ "get" + v ] || e [ "is" + v ] , set : e [ "set" + v ] } , ! 0 ) } } return e } function i ( t , e , n ) { return t && ( "length" in t && ! t . getLength && "number" == typeof t . length ? o : h ) . call ( t , e , n = n || t ) , n } function r ( t , e ) { for ( var n in e ) e . hasOwnProperty ( n ) && ( t [ n ] = e [ n ] ) ; return t } var s = /^(statics|generics|preserve|enumerable|prototype|toString|valueOf)$/ , a = [ ] . slice , o = [ ] . forEach || function ( t , e ) { for ( var n = 0 , i = this . length ; i > n ; n ++ ) t . call ( e , this [ n ] , n , this ) } , h = function ( t , e ) { for ( var n in this ) this . hasOwnProperty ( n ) && t . call ( e , this [ n ] , n , this ) } , u = Object . create || function ( t ) { return { _ _proto _ _ : t } } , l = Object . getOwnPropertyDescriptor || function ( t , e ) { var n = t . _ _lookupGetter _ _ && t . _ _lookupGetter _ _ ( e ) ; return n ? { get : n , set : t . _ _lookupSetter _ _ ( e ) , enumerable : ! 0 , configurable : ! 0 } : t . hasOwnProperty ( e ) ? { value : t [ e ] , enumerable : ! 0 , configurable : ! 0 , writable : ! 0 } : null } , c = Object . defineProperty || function ( t , e , n ) { return ( n . get || n . set ) && t . _ _defineGetter _ _ ? ( n . get && t . _ _defineGetter _ _ ( e , n . get ) , n . set && t . _ _defineSetter _ _ ( e , n . set ) ) : t [ e ] = n . value , t } , d = function ( t , e , n ) { return delete t [ e ] , c ( t , e , n ) } ; return n ( function ( ) { for ( var t = 0 , e = arguments . length ; e > t ; t ++ ) r ( this , arguments [ t ] ) } , { inject : function ( t ) { if ( t ) { var e = this . prototype , i = Object . getPrototypeOf ( e ) . constructor , r = t . statics === ! 0 ? t : t . statics ; r != t && n ( e , t , t . enumerable , i && i . prototype , t . preserve , t . generics && this ) , n ( this , r , ! 0 , i , t . preserve ) } for ( var s = 1 , a = arguments . length ; a > s ; s ++ ) this . inject ( arguments [ s ] ) ; return this } , extend : function ( ) { for ( var t , e = this , i = 0 , r = arguments . length ; r > i && ! ( t = arguments [ i ] . initialize ) ; i ++ ) ; return t = t || function ( ) { e . apply ( this , arguments ) } , t . prototype = u ( this . prototype ) , d ( t . prototype , "constructor" , { value : t , writable : ! 0 , configurable : ! 0 } ) , n ( t , this , ! 0 ) , arguments . length ? this . inject . apply ( t , arguments ) : t } } , ! 0 ) . inject ( { inject : function ( ) { for ( var t = 0 , e = arguments . length ; e > t ; t ++ ) n ( this , arguments [ t ] , arguments [ t ] . enumerable ) ; return this } , extend : function ( ) { var t = u ( this ) ; return t . inject . apply ( t , arguments ) } , each : function ( t , e ) { return i ( this , t , e ) } , clone : function ( ) { return new this . constructor ( this ) } , statics : { each : i , create : u , define : d , describe : l , copy : r , clone : function ( t ) { return r ( new t . constructor , t ) } , isPlainObject : function ( t ) { var n = null != t && t . constructor ; return n && ( n === Object || n === e || "Object" === n . name ) } , pick : function ( ) { for ( var e = 0 , n = arguments . length ; n > e ; e ++ ) if ( arguments [ e ] !== t ) return arguments [ e ] ; return null } } } ) } ; "undefined" != typeof module && ( module . exports = e ) , e . inject ( { generics : ! 0 , toString : function ( ) { return null != this . _id ? ( this . _class || "Object" ) + ( this . _name ? " '" + this . _name + "'" : " @" + this . _id ) : "{ " + e . each ( this , function ( t , e ) { if ( ! /^_/ . test ( e ) ) { var n = typeof t ; this . push ( e + ": " + ( "number" === n ? a . instance . number ( t ) : "string" === n ? "'" + t + "'" : t ) ) } } , [ ] ) . join ( ", " ) + " }" } , exportJSON : function ( t ) { return e . exportJSON ( this , t ) } , toJSON : function ( ) { return e . serialize ( this ) } , _set : function ( n , i ) { if ( n && e . isPlainObject ( n ) ) { var r = n . _filtering || n ; for ( var s in r ) if ( s in this && r . hasOwnProperty ( s ) && ( ! i || ! i [ s ] ) ) { var a = n [ s ] ; a !== t && ( this [ s ] = a ) } return ! 0 } } , statics : { exports : { } , extend : function ie ( ) { var t = ie . base . apply ( this , arguments ) , n = t . prototype . _class ; return n && ! e . exports [ n ] && ( e . exports [ n ] = t ) , t } , equals : function ( t , n ) { function i ( t , e ) { for ( var n in t ) if ( t . hasOwnProperty ( n ) && ! e . hasOwnProperty ( n ) ) return ! 1 ; return ! 0 } if ( t === n ) return ! 0 ; if ( t && t . equals ) return t . equals ( n ) ; if ( n && n . equals ) return n . equals ( t ) ; if ( Array . isArray
if ( ! i ) return null ; var r = t . x - this . _tx , s = t . y - this . _ty ; return e || ( e = new h ) , e . set ( ( r * this . _d - s * this . _b ) / i , ( s * this . _a - r * this . _c ) / i , n ) } , decompose : function ( ) { var t = this . _a , e = this . _b , n = this . _c , i = this . _d ; if ( o . isZero ( t * i - e * n ) ) return null ; var r = Math . sqrt ( t * t + e * e ) ; t /= r , e /= r ; var s = t * n + e * i ; n -= t * s , i -= e * s ; var a = Math . sqrt ( n * n + i * i ) ; return n /= a , i /= a , s /= a , e * n > t * i && ( t = - t , e = - e , s = - s , r = - r ) , { translation : this . getTranslation ( ) , scaling : new h ( r , a ) , rotation : 180 * - Math . atan2 ( e , t ) / Math . PI , shearing : s } } , getValues : function ( ) { return [ this . _a , this . _c , this . _b , this . _d , this . _tx , this . _ty ] } , getTranslation : function ( ) { return new h ( this . _tx , this . _ty ) } , setTranslation : function ( ) { var t = h . read ( arguments ) ; this . _tx = t . x , this . _ty = t . y , this . _changed ( ) } , getScaling : function ( ) { return ( this . decompose ( ) || { } ) . scaling } , setScaling : function ( ) { var t = this . getScaling ( ) ; if ( null != t ) { var e = h . read ( arguments ) ; ( this . _owner || this ) . scale ( e . x / t . x , e . y / t . y ) } } , getRotation : function ( ) { return ( this . decompose ( ) || { } ) . rotation } , setRotation : function ( t ) { var e = this . getRotation ( ) ; null != e && ( this . _owner || this ) . rotate ( t - e ) } , inverted : function ( ) { var t = this . _getDeterminant ( ) ; return t && new g ( this . _d / t , - this . _c / t , - this . _b / t , this . _a / t , ( this . _b * this . _ty - this . _d * this . _tx ) / t , ( this . _c * this . _tx - this . _a * this . _ty ) / t ) } , shiftless : function ( ) { return new g ( this . _a , this . _c , this . _b , this . _d , 0 , 0 ) } , applyToContext : function ( t ) { t . transform ( this . _a , this . _c , this . _b , this . _d , this . _tx , this . _ty ) } } , new function ( ) { return e . each ( { scaleX : "_a" , scaleY : "_d" , translateX : "_tx" , translateY : "_ty" , shearX : "_b" , shearY : "_c" } , function ( t , n ) { n = e . capitalize ( n ) , this [ "get" + n ] = function ( ) { return this [ t ] } , this [ "set" + n ] = function ( e ) { this [ t ] = e , this . _changed ( ) } } , { } ) } ) , p = e . extend ( { _class : "Line" , initialize : function ( t , e , n , i , r ) { var s = ! 1 ; arguments . length >= 4 ? ( this . _px = t , this . _py = e , this . _vx = n , this . _vy = i , s = r ) : ( this . _px = t . x , this . _py = t . y , this . _vx = e . x , this . _vy = e . y , s = n ) , s || ( this . _vx -= this . _px , this . _vy -= this . _py ) } , getPoint : function ( ) { return new h ( this . _px , this . _py ) } , getVector : function ( ) { return new h ( this . _vx , this . _vy ) } , getLength : function ( ) { return this . getVector ( ) . getLength ( ) } , intersect : function ( t , e ) { return p . intersect ( this . _px , this . _py , this . _vx , this . _vy , t . _px , t . _py , t . _vx , t . _vy , ! 0 , e ) } , getSide : function ( t ) { return p . getSide ( this . _px , this . _py , this . _vx , this . _vy , t . x , t . y , ! 0 ) } , getDistance : function ( t ) { return Math . abs ( p . getSignedDistance ( this . _px , this . _py , this . _vx , this . _vy , t . x , t . y , ! 0 ) ) } , statics : { intersect : function ( t , e , n , i , r , s , a , u , l , c ) { l || ( n -= t , i -= e , a -= r , u -= s ) ; var d = u * n - a * i ; if ( ! o . isZero ( d ) ) { var f = t - r , _ = e - s , g = ( a * _ - u * f ) / d , p = ( n * _ - i * f ) / d ; if ( ( c || g >= 0 && 1 >= g ) && ( c || p >= 0 && 1 >= p ) ) return new h ( t + g * n , e + g * i ) } } , getSide : function ( t , e , n , i , r , s , a ) { a || ( n -= t , i -= e ) ; var o = r - t , h = s - e , u = o * i - h * n ; return 0 === u && ( u = o * n + h * i , u > 0 && ( o -= n , h -= i , u = o * n + h * i , 0 > u && ( u = 0 ) ) ) , 0 > u ? - 1 : u > 0 ? 1 : 0 } , getSignedDistance : function ( t , e , n , i , r , s , a ) { a || ( n -= t , i -= e ) ; var o = i / n , h = e - o * t ; return ( s - o * r - h ) / Math . sqrt ( o * o + 1 ) } } } ) , v = s . extend ( { _class : "Project" , _list : "projects" , _reference : "project" , initialize : function ( t ) { s . call ( this , ! 0 ) , this . layers = [ ] , this . symbols = [ ] , this . _currentStyle = new R , this . activeLayer = new x , t && ( this . view = t instanceof Z ? t : Z . create ( t ) ) , this . _selectedItems = { } , this . _selectedItemCount = 0 , this . _drawCount = 0 , this . options = { } } , _serialize : function ( t , n ) { return e . serialize ( this . layers , t , ! 0 , n ) } , clear : function ( ) { for ( var t = this . layers . length - 1 ; t >= 0 ; t -- ) this . layers [ t ] . remove ( ) ; this . symbols = [ ] } , isEmpty : function ( ) { return this . layers . length <= 1 && ( ! this . activeLayer || this . activeLayer . isEmpty ( ) ) } , remove : function oe ( ) { return oe . base . call ( this ) ? ( this . view && this . view . remove ( ) , ! 0 ) : ! 1 } , getCurrentStyle : function ( ) { return this . _currentStyle } , setCurrentStyle : function ( t ) { this . _currentStyle . initialize ( t ) } , getIndex : function ( ) { return this . _index } , addChild : function ( t ) { return t instanceof x ? ( e . splice ( this . layers , [ t ] ) , this . activeLayer || ( this . activeLayer = t ) ) : t instanceof y ? ( this . activeLayer || this . addChild ( new x ( { insert : ! 1 } ) ) ) . addChild ( t ) : t = null , t } , getSelectedItems : function ( ) { var t = [ ] ; for ( var e in this . _selectedItems ) { var n = this . _selectedItems [ e ] ; n . isInserted ( ) && t . push ( n ) } return t } , _updateSelection : function ( t ) { var e = t . _id , n = this . _selectedItems ; t . _selected ? n [ e ] !== t && ( this . _selectedItemCount ++ , n [
} , getCanvas : function ( ) { if ( ! this . _canvas ) { var t = Q . getContext ( this . _size ) ; try { this . _image && t . drawImage ( this . _image , 0 , 0 ) , this . _canvas = t . canvas } catch ( e ) { Q . release ( t ) } } return this . _canvas } , setCanvas : "#setImage" , getContext : function ( ) { return this . _context || ( this . _context = this . getCanvas ( ) . getContext ( "2d" ) ) , arguments [ 0 ] && ( this . _image = null , this . _changed ( 129 ) ) , this . _context } , setContext : function ( t ) { this . _context = t } , getSource : function ( ) { return this . _image && this . _image . src || this . toDataURL ( ) } , setSource : function ( t ) { function e ( ) { var t = n . _project . view ; t && ( paper = t . _scope ) , n . fire ( "load" ) , t && t . draw ( ! 0 ) } var n = this , i = document . getElementById ( t ) || new Image ; i . naturalWidth && i . naturalHeight ? setTimeout ( e , 0 ) : ( V . add ( i , { load : function ( ) { n . setImage ( i ) , e ( ) } } ) , i . src || ( i . src = t ) ) , this . setImage ( i ) } , getElement : function ( ) { return this . _canvas || this . _image } , getSubCanvas : function ( t ) { t = f . read ( arguments ) ; var e = Q . 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 ( t ) { t = f . read ( arguments ) ; var e = new C ( { canvas : this . getSubCanvas ( t ) , insert : ! 1 } ) ; return e . translate ( t . getCenter ( ) . subtract ( this . getSize ( ) . divide ( 2 ) ) ) , e . _matrix . preConcatenate ( this . _matrix ) , e . insertAbove ( this ) , e } , toDataURL : function ( ) { var t = this . _image && this . _image . src ; if ( /^data:/ . test ( t ) ) return t ; var e = this . getCanvas ( ) ; return e ? e . toDataURL ( ) : null } , drawImage : function ( t , e ) { e = h . read ( arguments , 1 ) , this . getContext ( ! 0 ) . drawImage ( t , e . x , e . y ) } , getAverageColor : function ( t ) { var n , i ; t ? t instanceof I ? ( i = t , n = t . getBounds ( ) ) : t . width ? n = new f ( t ) : t . x && ( n = new f ( t . x - . 5 , t . y - . 5 , 1 , 1 ) ) : n = this . getBounds ( ) ; var r = 32 , s = Math . min ( n . width , r ) , a = Math . min ( n . height , r ) , o = C . _sampleContext ; o ? o . clearRect ( 0 , 0 , r + 1 , r + 1 ) : o = C . _sampleContext = Q . getContext ( new c ( r ) ) , o . save ( ) ; var h = ( new g ) . scale ( s / n . width , a / n . height ) . translate ( - n . x , - n . y ) ; h . applyToContext ( o ) , i && i . draw ( o , new e ( { clip : ! 0 , transforms : [ h ] } ) ) , this . _matrix . applyToContext ( o ) , o . drawImage ( this . getElement ( ) , - this . _size . width / 2 , - this . _size . height / 2 ) , o . restore ( ) ; for ( var u = o . getImageData ( . 5 , . 5 , Math . ceil ( s ) , Math . ceil ( a ) ) . data , l = [ 0 , 0 , 0 ] , d = 0 , _ = 0 , p = u . length ; p > _ ; _ += 4 ) { var v = u [ _ + 3 ] ; d += v , v /= 255 , l [ 0 ] += u [ _ ] * v , l [ 1 ] += u [ _ + 1 ] * v , l [ 2 ] += u [ _ + 2 ] * v } for ( var _ = 0 ; 3 > _ ; _ ++ ) l [ _ ] /= d ; return d ? D . read ( l ) : null } , getPixel : function ( t ) { t = h . read ( arguments ) ; var e = this . getContext ( ) . getImageData ( t . x , t . y , 1 , 1 ) . data ; return new D ( "rgb" , [ e [ 0 ] / 255 , e [ 1 ] / 255 , e [ 2 ] / 255 ] , e [ 3 ] / 255 ) } , setPixel : function ( ) { var t = h . read ( arguments ) , e = D . read ( arguments ) , n = e . _convert ( "rgb" ) , i = e . _alpha , r = this . getContext ( ! 0 ) , s = r . createImageData ( 1 , 1 ) , a = s . data ; a [ 0 ] = 255 * n [ 0 ] , a [ 1 ] = 255 * n [ 1 ] , a [ 2 ] = 255 * n [ 2 ] , a [ 3 ] = null != i ? 255 * i : 255 , r . putImageData ( s , t . x , t . y ) } , createImageData : function ( t ) { return t = c . read ( arguments ) , this . getContext ( ) . createImageData ( t . width , t . height ) } , getImageData : function ( t ) { return t = f . read ( arguments ) , t . isEmpty ( ) && ( t = new f ( this . _size ) ) , this . getContext ( ) . getImageData ( t . x , t . y , t . width , t . height ) } , setImageData : function ( t , e ) { e = h . read ( arguments , 1 ) , this . getContext ( ! 0 ) . putImageData ( t , e . x , e . y ) } , _getBounds : function ( t , e ) { var n = new f ( this . _size ) . setCenter ( 0 , 0 ) ; return e ? e . _transformBounds ( n ) : n } , _hitTest : function ( t ) { if ( this . _contains ( t ) ) { var e = this ; return new P ( "pixel" , e , { offset : t . add ( e . _size . divide ( 2 ) ) . round ( ) , color : { get : function ( ) { return e . getPixel ( this . offset ) } } } ) } } , _draw : function ( t ) { var e = this . getElement ( ) ; e && ( t . globalAlpha = this . _opacity , t . drawImage ( e , - this . _size . width / 2 , - this . _size . height / 2 ) ) } , _canComposite : function ( ) { return ! 0 } } ) , S = y . extend ( { _class : "PlacedSymbol" , _transformContent : ! 1 , _boundsGetter : { getBounds : "getStrokeBounds" } , _boundsSelected : ! 0 , _serializeFields : { symbol : null } , initialize : function ( e , n ) { this . _initialize ( e , n !== t && h . read ( arguments , 1 ) ) || this . setSymbol ( e instanceof m ? e : new m ( e ) ) } , _equals : function ( t ) { return this . _symbol === t . _symbol } , getSymbol : function ( ) { return this . _symbol } , setSymbol : function ( t ) { this . _symbol && delete this . _symbol . _instances [ this . _id ] , this . _symbol = t , t . _instances [ this . _id ] = this } , clone : function ( t ) { return this . _clone ( new S ( { symbol : this . symbol , insert : ! 1 } ) , t ) } , isEmpty : function ( ) { return this . _symbol . _definition . isEmpty ( ) } , _getBounds : function ( t , e ) { return this . symbol . _definition . _getCachedBou
return n . _point . equals ( s . _point ) ? ( n . setHandleOut ( s . _handleOut ) , this . _add ( e . slice ( 1 ) ) ) : ( r = this . getFirstSegment ( ) , r . _point . equals ( s . _point ) && t . reverse ( ) , i = t . getLastSegment ( ) , r . _point . equals ( i . _point ) ? ( r . setHandleIn ( i . _handleIn ) , this . _add ( e . slice ( 0 , e . length - 1 ) , 0 ) ) : this . _add ( e . slice ( ) ) ) , t . closed && this . _add ( [ e [ 0 ] ] ) , t . remove ( ) , r = this . getFirstSegment ( ) , n = this . getLastSegment ( ) , n . _point . equals ( r . _point ) && ( r . setHandleIn ( n . _handleIn ) , n . remove ( ) , this . setClosed ( ! 0 ) ) , this . _changed ( 5 ) , ! 0 } return ! 1 } , getLength : function ( ) { if ( null == this . _length ) { var t = this . getCurves ( ) ; this . _length = 0 ; for ( var e = 0 , n = t . length ; n > e ; e ++ ) this . _length += t [ e ] . getLength ( ) } return this . _length } , getArea : function ( ) { for ( var t = this . getCurves ( ) , e = 0 , n = 0 , i = t . length ; i > n ; n ++ ) e += t [ n ] . getArea ( ) ; return e } , _getOffset : function ( t ) { var e = t && t . getIndex ( ) ; if ( null != e ) { for ( var n = this . getCurves ( ) , i = 0 , r = 0 ; e > r ; r ++ ) i += n [ r ] . getLength ( ) ; var s = n [ e ] ; return i + s . getLength ( 0 , t . getParameter ( ) ) } return null } , getLocationOf : function ( t ) { t = h . read ( arguments ) ; for ( var e = this . getCurves ( ) , n = 0 , i = e . length ; i > n ; n ++ ) { var r = e [ n ] . getLocationOf ( t ) ; if ( r ) return r } return null } , getLocationAt : function ( t , e ) { var n = this . getCurves ( ) , i = 0 ; if ( e ) { var r = ~ ~ t ; return n [ r ] . getLocationAt ( t - r , ! 0 ) } for ( var s = 0 , a = n . length ; a > s ; s ++ ) { var o = i , h = n [ s ] ; if ( i += h . getLength ( ) , i >= t ) return h . getLocationAt ( t - o ) } return t <= this . getLength ( ) ? new A ( n [ n . length - 1 ] , 1 ) : null } , getPointAt : function ( t , e ) { var n = this . getLocationAt ( t , e ) ; return n && n . getPoint ( ) } , getTangentAt : function ( t , e ) { var n = this . getLocationAt ( t , e ) ; return n && n . getTangent ( ) } , getNormalAt : function ( t , e ) { var n = this . getLocationAt ( t , e ) ; return n && n . getNormal ( ) } , getNearestLocation : function ( t ) { t = h . read ( arguments ) ; for ( var e = this . getCurves ( ) , n = 1 / 0 , i = null , r = 0 , s = e . length ; s > r ; r ++ ) { var a = e [ r ] . getNearestLocation ( t ) ; a . _distance < n && ( n = a . _distance , i = a ) } return i } , getNearestPoint : function ( t ) { return t = h . read ( arguments ) , this . getNearestLocation ( t ) . getPoint ( ) } , getStyle : function ( ) { var t = this . _parent ; return ( t && "compound-path" === t . _type ? t : this ) . _style } , toShape : function ( e ) { function n ( t , e ) { return d [ t ] . isColinear ( d [ e ] ) } function i ( t ) { return d [ t ] . isOrthogonal ( ) } function r ( t ) { return d [ t ] . isArc ( ) } function s ( t , e ) { return d [ t ] . _point . getDistance ( d [ e ] . _point ) } if ( ! this . _closed ) return null ; var a , h , u , l , d = this . _segments ; if ( this . isPolygon ( ) && 4 === d . length && n ( 0 , 2 ) && n ( 1 , 3 ) && i ( 1 ) ? ( a = b . Rectangle , h = new c ( s ( 0 , 3 ) , s ( 0 , 1 ) ) , l = d [ 1 ] . _point . add ( d [ 2 ] . _point ) . divide ( 2 ) ) : 8 === d . length && r ( 0 ) && r ( 2 ) && r ( 4 ) && r ( 6 ) && n ( 1 , 5 ) && n ( 3 , 7 ) ? ( a = b . Rectangle , h = new c ( s ( 1 , 6 ) , s ( 0 , 3 ) ) , u = h . subtract ( new c ( s ( 0 , 7 ) , s ( 1 , 2 ) ) ) . divide ( 2 ) , l = d [ 3 ] . _point . add ( d [ 4 ] . _point ) . divide ( 2 ) ) : 4 === d . length && r ( 0 ) && r ( 1 ) && r ( 2 ) && r ( 3 ) && ( o . isZero ( s ( 0 , 2 ) - s ( 1 , 3 ) ) ? ( a = b . Circle , u = s ( 0 , 2 ) / 2 ) : ( a = b . Ellipse , u = new c ( s ( 2 , 0 ) / 2 , s ( 3 , 1 ) / 2 ) ) , l = d [ 1 ] . _point ) , a ) { var f = this . getPosition ( ! 0 ) , _ = new a ( { center : f , size : h , radius : u , insert : ! 1 } ) ; return _ . rotate ( l . subtract ( f ) . getAngle ( ) + 90 ) , _ . setStyle ( this . _style ) , ( e || e === t ) && _ . insertAbove ( this ) , _ } return null } , _getWinding : function ( t ) { var e = this . _closed ; if ( ! e && ! this . hasFill ( ) || ! this . _getBounds ( "getRoughBounds" ) . _containsPoint ( t ) ) return 0 ; for ( var n = this . getCurves ( ) , i = this . _segments , r = 0 , s = [ ] , a = [ ] , o = ( e ? n [ n . length - 1 ] : new M ( i [ i . length - 1 ] . _point , i [ 0 ] . _point ) ) . getValues ( ) , h = o , u = 0 , l = n . length ; l > u ; u ++ ) { var c = n [ u ] . getValues ( ) , d = c [ 0 ] , f = c [ 1 ] ; ( d !== c [ 2 ] || f !== c [ 3 ] || d !== c [ 4 ] || f !== c [ 5 ] || d !== c [ 6 ] || f !== c [ 7 ] ) && ( r += M . _getWinding ( c , h , t . x , t . y , s , a ) , h = c ) } return e || ( r += M . _getWinding ( o , h , t . x , t . y , s , a ) ) , r } , _hitTest : function ( e , n ) { function i ( n , i , r ) { return e . getDistance ( i ) < m ? new P ( r , w , { segment : n , point : i } ) : t } function r ( t , e ) { var r = t . _point ; return ( e || n . segments ) && i ( t , r , "segment" ) || ! e && n . handles && ( i ( t , r . add ( t . _handleIn ) , "handle-in" ) || i ( t , r . add ( t . _handleOut ) , "handle-out" ) ) } function s ( t ) { d . push ( t ) } function a ( t ) { var e = d [ t ] , n = d [ ( t + 1 ) % d . length ] ; return [ e . x , e . y , e . x , e . y , n . x , n . y , n . x , n . y ] } function o ( t ) { for ( var e = d . length , n = a ( e - 1 ) , i = [ ] , r = [ ] , s = 0 , o = 0 ; e > o ; o ++ ) { var h = a ( o ) ; s += M . _getWinding ( h , n , t . x , t . y , i , r ) , n = h } return ! ! s } function h ( t ) { return ( "round" !== u || "round" !== l ) && ( d = [ ] , v || t . _index > 0 && t . _index < p . length - 1 ? "round" !== u && ( t . _handleIn . isZero ( ) || t . _handleOut . isZero ( ) ) && O . _addSquareJoin ( t , u , y , c , s , ! 0 ) : "round" !== l && O . _addSquareCap ( t , l , y , s , ! 0 ) , d . length > 0 ) ? o ( e ) : e
} , toCanvasStyle : function ( t ) { if ( this . _canvasStyle ) return this . _canvasStyle ; if ( "gradient" !== this . _type ) return this . _canvasStyle = this . toCSS ( ) ; var e , n = this . _components , i = n [ 0 ] , r = i . _stops , s = n [ 1 ] , a = n [ 2 ] ; if ( i . _radial ) { var o = a . getDistance ( s ) , h = n [ 3 ] ; if ( h ) { var u = h . subtract ( s ) ; u . getLength ( ) > o && ( h = s . add ( u . normalize ( o - . 1 ) ) ) } var l = h || s ; e = t . createRadialGradient ( l . x , l . y , 0 , s . x , s . y , o ) } else e = t . createLinearGradient ( s . x , s . y , a . x , a . y ) ; for ( var c = 0 , d = r . length ; d > c ; c ++ ) { var f = r [ c ] ; e . addColorStop ( f . _rampPoint , f . _color . toCanvasStyle ( ) ) } return this . _canvasStyle = e } , transform : function ( t ) { if ( "gradient" === this . _type ) { for ( var e = this . _components , n = 1 , i = e . length ; i > n ; n ++ ) { var r = e [ n ] ; t . _transformPoint ( r , r , ! 0 ) } this . _changed ( ) } } , statics : { _types : i , random : function ( ) { var t = Math . random ; return new D ( t ( ) , t ( ) , t ( ) ) } } } ) } , new function ( ) { function t ( t , e ) { return 0 > t ? 0 : e && t > 360 ? 360 : ! e && t > 1 ? 1 : t } var n = { add : function ( e , n , i ) { return t ( e + n , i ) } , subtract : function ( e , n , i ) { return t ( e - n , i ) } , multiply : function ( e , n , i ) { return t ( e * n , i ) } , divide : function ( e , n , i ) { return t ( e / n , i ) } } ; return e . each ( n , function ( t , e ) { var n = { dontParse : /^(multiply|divide)$/ . test ( e ) } ; this [ e ] = function ( e ) { e = D . read ( arguments , 0 , 0 , n ) ; for ( var i = this . _type , r = this . _properties , s = this . _components , a = e . _convert ( i ) , o = 0 , h = s . length ; h > o ; o ++ ) a [ o ] = t ( s [ o ] , a [ o ] , "hue" === r [ o ] ) ; return new D ( i , a , null != this . _alpha ? t ( this . _alpha , e . getAlpha ( ) ) : null ) } } , { } ) } ) ; e . each ( D . _types , function ( t , n ) { var i = this [ e . capitalize ( n ) + "Color" ] = function ( t ) { var e = null != t && typeof t , i = "object" === e && null != t . length ? t : "string" === e ? null : arguments ; return i ? new D ( n , i ) : new D ( t ) } ; if ( 3 == n . length ) { var r = n . toUpperCase ( ) ; D [ r ] = this [ r + "Color" ] = i } } , e . exports ) ; var j = e . extend ( { _class : "Gradient" , initialize : function be ( t , e ) { this . _id = be . _id = ( be . _id || 0 ) + 1 , t && this . _set ( t ) && ( t = e = null ) , this . _stops || this . setStops ( t || [ "white" , "black" ] ) , null == this . _radial && this . setRadial ( "string" == typeof e && "radial" === e || e || ! 1 ) } , _serialize : function ( t , n ) { return n . add ( this , function ( ) { return e . serialize ( [ this . _stops , this . _radial ] , t , ! 0 , n ) } ) } , _changed : function ( ) { for ( var t = 0 , e = this . _owners && this . _owners . length ; e > t ; t ++ ) this . _owners [ t ] . _changed ( ) } , _addOwner : function ( t ) { this . _owners || ( this . _owners = [ ] ) , this . _owners . push ( t ) } , _removeOwner : function ( t ) { var e = this . _owners ? this . _owners . indexOf ( t ) : - 1 ; - 1 != e && ( this . _owners . splice ( e , 1 ) , 0 === this . _owners . length && delete this . _owners ) } , clone : function ( ) { for ( var t = [ ] , e = 0 , n = this . _stops . length ; n > e ; e ++ ) t [ e ] = this . _stops [ e ] . clone ( ) ; return new j ( t ) } , getStops : function ( ) { return this . _stops } , setStops : function ( t ) { if ( this . stops ) for ( var e = 0 , n = this . _stops . length ; n > e ; e ++ ) delete this . _stops [ e ] . _owner ; if ( t . length < 2 ) throw Error ( "Gradient stop list needs to contain at least two stops." ) ; this . _stops = F . readAll ( t , 0 , ! 1 , ! 0 ) ; for ( var e = 0 , n = this . _stops . length ; n > e ; e ++ ) { var i = this . _stops [ e ] ; i . _owner = this , i . _defaultRamp && i . setRampPoint ( e / ( n - 1 ) ) } 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 && this . _stops . length === t . _stops . length ) { for ( var e = 0 , n = this . _stops . length ; n > e ; e ++ ) if ( ! this . _stops [ e ] . equals ( t . _stops [ e ] ) ) return ! 1 ; return ! 0 } return ! 1 } } ) , F = e . extend ( { _class : "GradientStop" , initialize : function ( e , n ) { if ( e ) { var i , r ; n === t && Array . isArray ( e ) ? ( i = e [ 0 ] , r = e [ 1 ] ) : e . color ? ( i = e . color , r = e . rampPoint ) : ( i = e , r = n ) , this . setColor ( i ) , this . setRampPoint ( r ) } } , clone : function ( ) { return new F ( this . _color . clone ( ) , this . _rampPoint ) } , _serialize : function ( t , n ) { return e . serialize ( [ this . _color , this . _rampPoint ] , t , ! 0 , n ) } , _changed : function ( ) { this . _owner && this . _owner . _changed ( 17 ) } , getRampPoint : function ( ) { return this . _rampPoint } , setRampPoint : function ( t ) { this . _defaultRamp = null == t , this . _rampPoint = t || 0 , this . _changed ( ) } , getColor : function ( ) { return this . _color } , setColor : function ( t ) { this . _color = D . read ( arguments ) , this . _color === t && ( this . _color = t . clone ( ) ) , this . _color . _owner = this , this . _changed ( ) } , equals : function ( t ) { return t === this || t && this . _class === t . _class && this . _color . equals ( t . _color ) && this . _rampPoint == t . _rampPoint || ! 1 } } ) , R = e . extend ( new function ( ) { var n = { fillColor : t , strokeColor : t , strokeWidth : 1 , strokeCap : "butt" , strokeJoin : "miter" , miterLimit : 10 , d
} else s . transform = "matrix(" + i . getValues ( ) . join ( "," ) + ")" ; return s } function s ( e , i ) { for ( var s = r ( e ) , a = e . _children , o = n ( "g" , s ) , h = 0 , u = a . length ; u > h ; h ++ ) { var l = a [ h ] , c = b ( l , i ) ; if ( c ) if ( l . isClipMask ( ) ) { var d = n ( "clipPath" ) ; d . appendChild ( c ) , w ( l , d , "clip" ) , t ( o , { "clip-path" : "url(#" + d . id + ")" } ) } else o . appendChild ( c ) } return o } function h ( t ) { var e = r ( t , ! 0 ) , i = t . getSize ( ) ; return e . x -= i . width / 2 , e . y -= i . height / 2 , e . width = i . width , e . height = i . height , e . href = t . toDataURL ( ) , n ( "image" , e ) } function u ( t , e ) { if ( e . matchShapes ) { var r = t . toShape ( ! 1 ) ; if ( r ) return c ( r , e ) } var s , a , o = t . _segments ; if ( 0 === o . length ) return null ; if ( t . isPolygon ( ) ) if ( o . length >= 3 ) { s = t . _closed ? "polygon" : "polyline" ; var h = [ ] ; for ( i = 0 , l = o . length ; l > i ; i ++ ) h . push ( S . point ( o [ i ] . _point ) ) ; a = { points : h . join ( " " ) } } else { s = "line" ; var u = o [ 0 ] . _point , d = o [ o . length - 1 ] . _point ; a = { x1 : u . x , y1 : u . y , x2 : d . x , y2 : d . y } } else { s = "path" ; var f = t . getPathData ( ) ; a = f && { d : f } } return n ( s , a ) } function c ( t ) { var e = t . _shape , i = t . _radius , s = r ( t , ! 0 , "rectangle" !== e ) ; if ( "rectangle" === e ) { e = "rect" ; var a = t . _size , o = a . width , h = a . height ; s . x -= o / 2 , s . y -= h / 2 , s . width = o , s . height = h , i . isZero ( ) && ( i = null ) } return i && ( "circle" === e ? s . r = i : ( s . rx = i . width , s . ry = i . height ) ) , n ( e , s ) } function d ( t ) { var e = r ( t , ! 0 ) , i = t . getPathData ( ) ; return i && ( e . d = i ) , n ( "path" , e ) } function f ( t , e ) { var i = r ( t , ! 0 ) , s = t . getSymbol ( ) , a = m ( s , "symbol" ) , o = s . getDefinition ( ) , h = o . getBounds ( ) ; return a || ( a = n ( "symbol" , { viewBox : S . rectangle ( h ) } ) , a . appendChild ( b ( o , e ) ) , w ( s , a , "symbol" ) ) , i . href = "#" + a . id , i . x += h . x , i . y += h . y , i . width = S . number ( h . width ) , i . height = S . number ( h . height ) , n ( "use" , i ) } function _ ( t ) { var e = m ( t , "color" ) ; if ( ! e ) { var i , r = t . getGradient ( ) , s = r . _radial , a = t . getOrigin ( ) . transform ( ) , o = t . getDestination ( ) . transform ( ) ; if ( s ) { i = { cx : a . x , cy : a . y , r : a . getDistance ( o ) } ; var h = t . getHighlight ( ) ; h && ( h = h . transform ( ) , i . fx = h . x , i . fy = h . y ) } else i = { x1 : a . x , y1 : a . y , x2 : o . x , y2 : o . y } ; i . gradientUnits = "userSpaceOnUse" , e = n ( ( s ? "radial" : "linear" ) + "Gradient" , i ) ; for ( var u = r . _stops , l = 0 , c = u . length ; c > l ; l ++ ) { var d = u [ l ] , f = d . _color , _ = f . getAlpha ( ) ; i = { offset : d . _rampPoint , "stop-color" : f . toCSS ( ! 0 ) } , 1 > _ && ( i [ "stop-opacity" ] = _ ) , e . appendChild ( n ( "stop" , i ) ) } w ( t , e , "color" ) } return "url(#" + e . id + ")" } function g ( t ) { var e = n ( "text" , r ( t , ! 0 ) ) ; return e . textContent = t . _content , e } function p ( n , i ) { var r = { } , s = n . getParent ( ) ; return null != n . _name && ( r . id = n . _name ) , e . each ( ee , function ( t ) { var i = t . get , a = t . type , o = n [ i ] ( ) ; if ( ! s || ! e . equals ( s [ i ] ( ) , o ) ) { if ( "color" === a && null != o ) { var h = o . getAlpha ( ) ; 1 > h && ( r [ t . attribute + "-opacity" ] = h ) } r [ t . attribute ] = null == o ? "none" : "number" === a ? S . number ( o ) : "color" === a ? o . gradient ? _ ( o , n ) : o . toCSS ( ! 0 ) : "array" === a ? o . join ( "," ) : "lookup" === a ? t . toSVG [ o ] : o } } ) , 1 === r . opacity && delete r . opacity , null == n . _visibility || n . _visibility || ( r . visibility = "hidden" ) , t ( i , r ) } function m ( t , e ) { return P || ( P = { ids : { } , svgs : { } } ) , t && P . svgs [ e + "-" + t . _id ] } function w ( t , e , n ) { P || m ( ) ; var i = P . ids [ n ] = ( P . ids [ n ] || 0 ) + 1 ; e . id = n + "-" + i , P . svgs [ n + "-" + t . _id ] = e } function x ( t , e ) { var i = t , r = null ; if ( P ) { i = "svg" === t . nodeName . toLowerCase ( ) && t ; for ( var s in P . svgs ) r || ( i || ( i = n ( "svg" ) , i . appendChild ( t ) ) , r = i . insertBefore ( n ( "defs" ) , i . firstChild ) ) , r . appendChild ( P . svgs [ s ] ) ; P = null } return e . asString ? ( new XMLSerializer ) . serializeToString ( i ) : i } function b ( t , e ) { var n = k [ t . _type ] , i = n && n ( t , e ) ; return i && t . _data && i . setAttribute ( "data-paper-data" , JSON . stringify ( t . _data ) ) , i && p ( t , i ) } function C ( t ) { return t || ( t = { } ) , S = new a ( t . precision ) , t } var S , P , k = { group : s , layer : s , raster : h , path : u , shape : c , "compound-path" : d , "placed-symbol" : f , "point-text" : g } ; y . inject ( { exportSVG : function ( t ) { return t = C ( t ) , x ( b ( this , t ) , t ) } } ) , v . inject ( { exportSVG : function ( t ) { t = C ( t ) ; for ( var e = this . layers , i = this . view . getSize ( ) , r = n ( "svg" , { x : 0 , y : 0 , width : i . width , height : i . height , version : "1.1" , xmlns : "http://www.w3.org/2000/svg" , "xmlns:xlink" : "http://www.w3.org/1999/xlink" } ) , s = 0 , a = e . length ; a > s ; s ++ ) r . appendChild ( b ( e [ s ] , t ) ) ; return x ( r , t ) } } ) } , new function ( ) { function n ( t , e , n , i ) { var r = ne [ e ] , s = r ? t . getAttributeNS ( r , e ) : t . getAttribute ( e ) ; return "null" === s && ( s = null ) , null == s ? i ? null : n ? "" : 0 : n ? s : parseFloat ( s ) } function i ( t , e , i , r ) { return e = n ( t , e , ! 1 , r ) , i = n ( t , i , ! 1 , r ) , ! r || null != e && null != i ? new h ( e , i ) : null } function r ( t , e , i , r ) { return e = n ( t , e , ! 1 , r ) , i = n ( t , i , ! 1 , r ) , ! r || null != e && null != i ? new c ( e , i ) : null } function s ( t , e , n ) { return "none" === t ? null : " number
2013-11-28 13:46:12 -05:00
} , Qn = t . isIdentifierChar = function ( t ) { return 48 > t ? 36 === t : 58 > t ? ! 0 : 65 > t ? ! 1 : 91 > t ? ! 0 : 97 > t ? 95 === t : 123 > t ? ! 0 : t >= 170 && Jn . test ( String . fromCharCode ( t ) ) } , ti = { kind : "loop" } , ei = { kind : "switch" } } ) ; var binaryOperators = { "+" : "_add" , "-" : "_subtract" , "*" : "_multiply" , "/" : "_divide" , "%" : "_modulo" , "==" : "equals" , "!=" : "equals" } , unaryOperators = { "-" : "_negate" , "+" : null } , fields = Base . each ( [ "add" , "subtract" , "multiply" , "divide" , "modulo" , "negate" ] , function ( t ) { this [ "_" + t ] = "#" + t } , { } ) ; return paper . Point . inject ( fields ) , paper . Size . inject ( fields ) , paper . Color . inject ( fields ) , "complete" === document . readyState ? setTimeout ( load ) : paper . DomEvent . add ( window , { load : load } ) , PaperScript = { compile : compile , evaluate : evaluate , load : load , lineNumberBase : 0 } } ( this ) ;