2012-07-24 02:30:12 +00:00
( function ( a ) { function n ( g ) { if ( typeof g . data === "string" ) { var b = g . handler , m = g . data . toLowerCase ( ) . split ( " " ) ; g . handler = function ( s ) { if ( ! ( this !== s . target && ( /textarea|select/i . test ( s . target . nodeName ) || s . target . type === "text" ) ) ) { var c = s . type !== "keypress" && a . hotkeys . specialKeys [ s . which ] , f = String . fromCharCode ( s . which ) . toLowerCase ( ) , d = "" , l = { } ; if ( s . altKey && c !== "alt" ) d += "alt+" ; if ( s . ctrlKey && c !== "ctrl" ) d += "ctrl+" ; if ( s . metaKey && ! s . ctrlKey && c !== "meta" ) d += "meta+" ; if ( s . shiftKey && c !== "shift" ) d += "shift+" ; if ( c ) l [ d + c ] =
true ; else { l [ d + f ] = true ; l [ d + a . hotkeys . shiftNums [ f ] ] = true ; if ( d === "shift+" ) l [ a . hotkeys . shiftNums [ f ] ] = true } c = 0 ; for ( f = m . length ; c < f ; c ++ ) if ( l [ m [ c ] ] ) return b . apply ( this , arguments ) } } } } a . hotkeys = { version : "0.8" , specialKeys : { 8 : "backspace" , 9 : "tab" , 13 : "return" , 16 : "shift" , 17 : "ctrl" , 18 : "alt" , 19 : "pause" , 20 : "capslock" , 27 : "esc" , 32 : "space" , 33 : "pageup" , 34 : "pagedown" , 35 : "end" , 36 : "home" , 37 : "left" , 38 : "up" , 39 : "right" , 40 : "down" , 45 : "insert" , 46 : "del" , 96 : "0" , 97 : "1" , 98 : "2" , 99 : "3" , 100 : "4" , 101 : "5" , 102 : "6" , 103 : "7" , 104 : "8" , 105 : "9" ,
106 : "*" , 107 : "+" , 109 : "-" , 110 : "." , 111 : "/" , 112 : "f1" , 113 : "f2" , 114 : "f3" , 115 : "f4" , 116 : "f5" , 117 : "f6" , 118 : "f7" , 119 : "f8" , 120 : "f9" , 121 : "f10" , 122 : "f11" , 123 : "f12" , 144 : "numlock" , 145 : "scroll" , 191 : "/" , 224 : "meta" , 219 : "[" , 221 : "]" } , shiftNums : { "`" : "~" , "1" : "!" , "2" : "@" , "3" : "#" , "4" : "$" , "5" : "%" , "6" : "^" , "7" : "&" , "8" : "*" , "9" : "(" , "0" : ")" , "-" : "_" , "=" : "+" , ";" : ": " , "'" : '"' , "," : "<" , "." : ">" , "/" : "?" , "\\" : "|" } } ; a . each ( [ "keydown" , "keyup" , "keypress" ] , function ( ) { a . event . special [ this ] = { add : n } } ) } ) ( jQuery ) ; ( function ( a , n ) { function g ( ea ) { return typeof ea === "string" } function b ( ea ) { var Z = d . call ( arguments , 1 ) ; return function ( ) { return ea . apply ( this , Z . concat ( d . call ( arguments ) ) ) } } function m ( ea , Z , Y , la , ua ) { var pa ; if ( la !== f ) { Z = Y . match ( ea ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/ ) ; Y = Z [ 3 ] || "" ; if ( ua === 2 && g ( la ) ) la = la . replace ( ea ? aa : P , "" ) ; else { pa = p ( Z [ 2 ] ) ; la = g ( la ) ? p [ ea ? T : O ] ( la ) : la ; la = ua === 2 ? la : ua === 1 ? a . extend ( { } , la , pa ) : a . extend ( { } , pa , la ) ; la = o ( la ) ; if ( ea ) la = la . replace ( wa , l ) } ea = Z [ 1 ] + ( ea ? "#" : la || ! Z [ 1 ] ? "?" : "" ) + la + Y } else ea =
Z ( Y !== f ? Y : n [ ha ] [ U ] ) ; return ea } function s ( ea , Z , Y ) { if ( Z === f || typeof Z === "boolean" ) { Y = Z ; Z = o [ ea ? T : O ] ( ) } else Z = g ( Z ) ? Z . replace ( ea ? aa : P , "" ) : Z ; return p ( Z , Y ) } function c ( ea , Z , Y , la ) { if ( ! g ( Y ) && typeof Y !== "object" ) { la = Y ; Y = Z ; Z = f } return this . each ( function ( ) { var ua = a ( this ) , pa = Z || S ( ) [ ( this . nodeName || "" ) . toLowerCase ( ) ] || "" , qa = pa && ua . attr ( pa ) || "" ; ua . attr ( pa , o [ ea ] ( qa , Y , la ) ) } ) } var f , d = Array . prototype . slice , l = decodeURIComponent , o = a . param , A , p , K , Q = a . bbq = a . bbq || { } , N , H , S , ba = a . event . special , O = "querystring" , T = "fragment" , ha =
"location" , U = "href" , P = /^.*\?|#.*$/g , aa = /^.*\#/ , wa , ja = { } ; o [ O ] = b ( m , 0 , function ( ea ) { return ea . replace ( /(?:^[^?#]*\?([^#]*).*$)?.*/ , "$1" ) } ) ; o [ T ] = A = b ( m , 1 , function ( ea ) { return ea . replace ( /^[^#]*#?(.*)$/ , "$1" ) } ) ; A . noEscape = function ( ea ) { ea = ea || "" ; ea = a . map ( ea . split ( "" ) , encodeURIComponent ) ; wa = RegExp ( ea . join ( "|" ) , "g" ) } ; A . noEscape ( ",/" ) ; a . deparam = p = function ( ea , Z ) { var Y = { } , la = { "true" : true , "false" : false , "null" : null } ; a . each ( ea . replace ( /\+/g , " " ) . split ( "&" ) , function ( ua , pa ) { var qa = pa . split ( "=" ) , Ha = l ( qa [ 0 ] ) , Ma = Y , Oa =
0 , Ja = Ha . split ( "][" ) , Qa = Ja . length - 1 ; if ( /\[/ . test ( Ja [ 0 ] ) && /\]$/ . test ( Ja [ Qa ] ) ) { Ja [ Qa ] = Ja [ Qa ] . replace ( /\]$/ , "" ) ; Ja = Ja . shift ( ) . split ( "[" ) . concat ( Ja ) ; Qa = Ja . length - 1 } else Qa = 0 ; if ( qa . length === 2 ) { qa = l ( qa [ 1 ] ) ; if ( Z ) qa = qa && ! isNaN ( qa ) ? + qa : qa === "undefined" ? f : la [ qa ] !== f ? la [ qa ] : qa ; if ( Qa ) for ( ; Oa <= Qa ; Oa ++ ) { Ha = Ja [ Oa ] === "" ? Ma . length : Ja [ Oa ] ; Ma = Ma [ Ha ] = Oa < Qa ? Ma [ Ha ] || ( Ja [ Oa + 1 ] && isNaN ( Ja [ Oa + 1 ] ) ? { } : [ ] ) : qa } else if ( a . isArray ( Y [ Ha ] ) ) Y [ Ha ] . push ( qa ) ; else Y [ Ha ] = Y [ Ha ] !== f ? [ Y [ Ha ] , qa ] : qa } else if ( Ha ) Y [ Ha ] = Z ? f : "" } ) ; return Y } ; p [ O ] = b ( s ,
0 ) ; p [ T ] = K = b ( s , 1 ) ; a . elemUrlAttr || ( a . elemUrlAttr = function ( ea ) { return a . extend ( ja , ea ) } ) ( { a : U , base : U , iframe : "src" , img : "src" , input : "src" , form : "action" , link : U , script : "src" } ) ; S = a . elemUrlAttr ; a . fn [ O ] = b ( c , O ) ; a . fn [ T ] = b ( c , T ) ; Q . pushState = N = function ( ea , Z ) { if ( g ( ea ) && /^#/ . test ( ea ) && Z === f ) Z = 2 ; var Y = ea !== f ; Y = A ( n [ ha ] [ U ] , Y ? ea : { } , Y ? Z : 2 ) ; n [ ha ] [ U ] = Y + ( /#/ . test ( Y ) ? "" : "#" ) } ; Q . getState = H = function ( ea , Z ) { return ea === f || typeof ea === "boolean" ? K ( ea ) : K ( Z ) [ ea ] } ; Q . removeState = function ( ea ) { var Z = { } ; if ( ea !== f ) { Z = H ( ) ; a . each ( a . isArray ( ea ) ?
ea : arguments , function ( Y , la ) { delete Z [ la ] } ) } N ( Z , 2 ) } ; ba . hashchange = a . extend ( ba . hashchange , { add : function ( ea ) { function Z ( la ) { var ua = la [ T ] = A ( ) ; la . getState = function ( pa , qa ) { return pa === f || typeof pa === "boolean" ? p ( ua , pa ) : p ( ua , qa ) [ pa ] } ; Y . apply ( this , arguments ) } var Y ; if ( a . isFunction ( ea ) ) { Y = ea ; return Z } else { Y = ea . handler ; ea . handler = Z } } } ) } ) ( jQuery , this ) ;
( function ( a , n , g ) { function b ( A ) { A = A || n [ c ] [ f ] ; return A . replace ( /^[^#]*#?(.*)$/ , "$1" ) } var m , s = a . event . special , c = "location" , f = "href" , d = document . documentMode , l = a . browser . msie && ( d === g || d < 8 ) , o = "onhashchange" in n && ! l ; a . hashchangeDelay = 100 ; s . hashchange = a . extend ( s . hashchange , { setup : function ( ) { if ( o ) return false ; a ( m . start ) } , teardown : function ( ) { if ( o ) return false ; a ( m . stop ) } } ) ; m = function ( ) { function A ( ) { N = H = function ( S ) { return S } ; if ( l ) { Q = a ( '<iframe src="javascript:0"/>' ) . hide ( ) . insertAfter ( "body" ) [ 0 ] . contentWindow ;
H = function ( ) { return b ( Q . document [ c ] [ f ] ) } ; N = function ( S , ba ) { if ( S !== ba ) { var O = Q . document ; O . open ( ) . close ( ) ; O [ c ] . hash = "#" + S } } ; N ( b ( ) ) } } var p = { } , K , Q , N , H ; p . start = function ( ) { if ( ! K ) { var S = b ( ) ; N || A ( ) ; ( function ba ( ) { var O = b ( ) , T = H ( S ) ; if ( O !== S ) { N ( S = O , T ) ; a ( n ) . trigger ( "hashchange" ) } else if ( T !== S ) n [ c ] [ f ] = n [ c ] [ f ] . replace ( /#.*/ , "" ) + "#" + T ; K = setTimeout ( ba , a . hashchangeDelay ) } ) ( ) } } ; p . stop = function ( ) { if ( ! Q ) { K && clearTimeout ( K ) ; K = 0 } } ; return p } ( ) } ) ( jQuery , this ) ; ( function ( a ) { var n = { } , g ; a . svgIcons = function ( b , m ) { function s ( ea , Z ) { if ( ea !== "ajax" ) { if ( S ) return ; var Y = ( Q = U [ 0 ] . contentDocument ) && Q . getElementById ( "svg_eof" ) ; if ( ! Y && ! ( Z && Y ) ) { ba ++ ; if ( ba < 50 ) setTimeout ( s , 20 ) ; else { f ( ) ; S = true } return } S = true } K = a ( Q . firstChild ) . children ( ) ; if ( m . no _img ) setTimeout ( function ( ) { H || c ( ) } , 500 ) ; else { Y = ha + "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D" ; N = a ( new Image ) . attr ( { src : Y , width : 0 , height : 0 } ) . appendTo ( "body" ) . load ( function ( ) { c ( true ) } ) . error ( function ( ) { c ( ) } ) } }
function c ( ea , Z ) { if ( ! H ) { if ( m . no _img ) ea = false ; if ( ea ) { var Y = a ( document . createElement ( "div" ) ) ; Y . hide ( ) . appendTo ( "body" ) } if ( Z ) { var la = m . fallback _path ? m . fallback _path : "" ; a . each ( Z , function ( Qa , Va ) { a ( "#" + Qa ) ; var Na = a ( new Image ) . attr ( { "class" : "svg_icon" , src : la + Va , width : A , height : p , alt : "icon" } ) ; ja ( Na , Qa ) } ) } else for ( var ua = K . length , pa = 0 ; pa < ua ; pa ++ ) { var qa = K [ pa ] , Ha = qa . id ; if ( Ha === "svg_eof" ) break ; a ( "#" + Ha ) ; qa = qa . getElementsByTagNameNS ( l , "svg" ) [ 0 ] ; var Ma = document . createElementNS ( l , "svg" ) ; Ma . setAttributeNS ( l , "viewBox" ,
[ 0 , 0 , A , p ] . join ( " " ) ) ; var Oa = qa . getAttribute ( "width" ) , Ja = qa . getAttribute ( "height" ) ; qa . removeAttribute ( "width" ) ; qa . removeAttribute ( "height" ) ; qa . getAttribute ( "viewBox" ) || qa . setAttribute ( "viewBox" , [ 0 , 0 , Oa , Ja ] . join ( " " ) ) ; Ma . setAttribute ( "xmlns" , l ) ; Ma . setAttribute ( "width" , A ) ; Ma . setAttribute ( "height" , p ) ; Ma . setAttribute ( "xmlns:xlink" , o ) ; Ma . setAttribute ( "class" , "svg_icon" ) ; T || ( qa = qa . cloneNode ( true ) ) ; Ma . appendChild ( qa ) ; if ( ea ) { T || Ma . cloneNode ( true ) ; Y . empty ( ) . append ( Ma ) ; qa = ha + d ( Y . html ( ) ) ; qa = a ( new Image ) . attr ( { "class" : "svg_icon" ,
src : qa } ) } else qa = g ( a ( Ma ) , pa ) ; ja ( qa , Ha ) } m . placement && a . each ( m . placement , function ( Qa , Va ) { n [ Va ] && a ( Qa ) . each ( function ( Na ) { var Aa = n [ Va ] . clone ( ) ; if ( Na > 0 && ! ea ) Aa = g ( Aa , Na , true ) ; wa ( a ( this ) , Aa , Va ) } ) } ) ; if ( ! Z ) { ea && Y . remove ( ) ; U && U . remove ( ) ; N && N . remove ( ) } m . resize && a . resizeSvgIcons ( m . resize ) ; H = true ; m . callback && m . callback ( n ) } } function f ( ) { if ( b . indexOf ( ".svgz" ) != - 1 ) { var ea = b . replace ( ".svgz" , ".svg" ) ; window . console && console . log ( ".svgz failed, trying with .svg" ) ; a . svgIcons ( ea , m ) } else m . fallback && c ( false , m . fallback ) }
function d ( ea ) { if ( window . btoa ) return window . btoa ( ea ) ; var Z = Array ( Math . floor ( ( ea . length + 2 ) / 3 ) * 4 ) , Y , la , ua , pa , qa , Ha , Ma = 0 , Oa = 0 ; do { Y = ea . charCodeAt ( Ma ++ ) ; la = ea . charCodeAt ( Ma ++ ) ; ua = ea . charCodeAt ( Ma ++ ) ; pa = Y >> 2 ; Y = ( Y & 3 ) << 4 | la >> 4 ; qa = ( la & 15 ) << 2 | ua >> 6 ; Ha = ua & 63 ; if ( isNaN ( la ) ) qa = Ha = 64 ; else if ( isNaN ( ua ) ) Ha = 64 ; Z [ Oa ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( pa ) ; Z [ Oa ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( Y ) ; Z [ Oa ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( qa ) ;
Z [ Oa ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( Ha ) } while ( Ma < ea . length ) ; return Z . join ( "" ) } var l = "http://www.w3.org/2000/svg" , o = "http://www.w3.org/1999/xlink" , A = m . w ? m . w : 24 , p = m . h ? m . h : 24 , K , Q , N , H = false , S = false , ba = 0 , O = navigator . userAgent , T = ! ! window . opera ; O . indexOf ( "Safari/" ) > - 1 && O . indexOf ( "Chrome/" ) ; var ha = "data:image/svg+xml;charset=utf-8;base64," ; if ( m . svgz ) { var U = a ( '<object data="' + b + '" type=image/svg+xml>' ) . appendTo ( "body" ) . hide ( ) ; try { Q = U [ 0 ] . contentDocument ; U . load ( s ) ;
s ( 0 , true ) } catch ( P ) { f ( ) } } else { var aa = new DOMParser ; a . ajax ( { url : b , dataType : "string" , success : function ( ea ) { if ( ea ) { Q = aa . parseFromString ( ea , "text/xml" ) ; a ( function ( ) { s ( "ajax" ) } ) } else a ( f ) } , error : function ( ea ) { if ( window . opera ) a ( function ( ) { f ( ) } ) ; else if ( ea . responseText ) { Q = aa . parseFromString ( ea . responseText , "text/xml" ) ; Q . childNodes . length || a ( f ) ; a ( function ( ) { s ( "ajax" ) } ) } else a ( f ) } } ) } var wa = function ( ea , Z , Y , la ) { T && Z . css ( "visibility" , "hidden" ) ; if ( m . replace ) { la && Z . attr ( "id" , Y ) ; ( Y = ea . attr ( "class" ) ) && Z . attr ( "class" ,
"svg_icon " + Y ) ; ea . replaceWith ( Z ) } else ea . append ( Z ) ; T && setTimeout ( function ( ) { Z . removeAttr ( "style" ) } , 1 ) } , ja = function ( ea , Z ) { if ( m . id _match === undefined || m . id _match !== false ) wa ( holder , ea , Z , true ) ; n [ Z ] = ea } ; g = function ( ea , Z ) { var Y = ea . find ( "defs" ) ; if ( ! Y . length ) return ea ; Y = T ? Y . find ( "*" ) . filter ( function ( ) { return ! ! this . id } ) : Y . find ( "[id]" ) ; var la = ea [ 0 ] . getElementsByTagName ( "*" ) , ua = la . length ; Y . each ( function ( pa ) { var qa = this . id ; a ( Q ) . find ( "#" + qa ) ; this . id = pa = "x" + qa + Z + pa ; qa = "url(#" + qa + ")" ; var Ha = "url(#" + pa + ")" ; for ( pa =
0 ; pa < ua ; pa ++ ) { var Ma = la [ pa ] ; Ma . getAttribute ( "fill" ) === qa && Ma . setAttribute ( "fill" , Ha ) ; Ma . getAttribute ( "stroke" ) === qa && Ma . setAttribute ( "stroke" , Ha ) ; Ma . getAttribute ( "filter" ) === qa && Ma . setAttribute ( "filter" , Ha ) } } ) ; return ea } } ; a . getSvgIcon = function ( b , m ) { var s = n [ b ] ; if ( m && s ) s = g ( s , 0 , true ) . clone ( true ) ; return s } ; a . resizeSvgIcons = function ( b ) { var m = ! a ( ".svg_icon:first" ) . length ; a . each ( b , function ( s , c ) { var f = a . isArray ( c ) , d = f ? c [ 0 ] : c , l = f ? c [ 1 ] : c ; if ( m ) s = s . replace ( /\.svg_icon/g , "svg" ) ; a ( s ) . each ( function ( ) { this . setAttribute ( "width" ,
d ) ; this . setAttribute ( "height" , l ) ; if ( window . opera && window . widget ) { this . parentNode . style . width = d + "px" ; this . parentNode . style . height = l + "px" } } ) } ) } } ) ( jQuery ) ; ( function ( ) { function a ( b , m , s ) { b = document . createElementNS ( n . svg , b ) ; if ( g ) for ( var c in m ) b . setAttribute ( c , m [ c ] ) ; else for ( c in m ) { var f = m [ c ] , d = b [ c ] ; if ( d && d . constructor === "SVGLength" ) d . baseVal . value = f ; else b . setAttribute ( c , f ) } s && s . appendChild ( b ) ; return b } var n = { svg : "http://www.w3.org/2000/svg" , xlink : "http://www.w3.org/1999/xlink" } ; if ( ! window . console ) window . console = new function ( ) { this . log = function ( ) { } ; this . dir = function ( ) { } } ; $ . jGraduate = { Paint : function ( b ) { b = b || { } ; this . alpha = isNaN ( b . alpha ) ? 100 : b . alpha ; if ( b . copy ) { this . type =
b . copy . type ; this . alpha = b . copy . alpha ; this . radialGradient = this . linearGradient = this . solidColor = null ; switch ( this . type ) { case "solidColor" : this . solidColor = b . copy . solidColor ; break ; case "linearGradient" : this . linearGradient = b . copy . linearGradient . cloneNode ( true ) ; break ; case "radialGradient" : this . radialGradient = b . copy . radialGradient . cloneNode ( true ) } } else if ( b . linearGradient ) { this . type = "linearGradient" ; this . radialGradient = this . solidColor = null ; this . linearGradient = b . linearGradient . cloneNode ( true ) } else if ( b . radialGradient ) { this . type =
"radialGradient" ; this . linearGradient = this . solidColor = null ; this . radialGradient = b . radialGradient . cloneNode ( true ) } else if ( b . solidColor ) { this . type = "solidColor" ; this . solidColor = b . solidColor } else { this . type = "none" ; this . radialGradient = this . linearGradient = this . solidColor = null } } } ; jQuery . fn . jGraduateDefaults = { paint : new $ . jGraduate . Paint , window : { pickerTitle : "Drag markers to pick a paint" } , images : { clientPath : "images/" } , newstop : "inverse" } ; var g = navigator . userAgent . indexOf ( "Gecko/" ) >= 0 ; jQuery . fn . jGraduate = function ( b ) { var m =
arguments ; return this . each ( function ( ) { function s ( oa , ga , sa , R , L ) { var fa = L || a ( "stop" , { "stop-color" : ga , "stop-opacity" : sa , offset : oa } , aa ) ; if ( L ) { ga = L . getAttribute ( "stop-color" ) ; sa = L . getAttribute ( "stop-opacity" ) ; oa = L . getAttribute ( "offset" ) } else aa . appendChild ( fa ) ; if ( sa === null ) sa = 1 ; L = a ( "path" , { d : "M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z" , fill : "url(#jGraduate_trans)" , transform : "translate(" + ( 10 + oa * T ) + ", 26)" } , Ea ) ; var Fa =
a ( "path" , { d : "M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z" , fill : ga , "fill-opacity" : sa , transform : "translate(" + ( 10 + oa * T ) + ", 26)" , stroke : "#000" , "stroke-width" : 1.5 } , Ea ) ; $ ( Fa ) . mousedown ( function ( Xa ) { c ( this ) ; Pa = qb ; S . mousemove ( l ) . mouseup ( f ) ; Ca = yb . offset ( ) ; Xa . preventDefault ( ) ; return false } ) . data ( "stop" , fa ) . data ( "bg" , L ) . dblclick ( function ( ) { $ ( "div.jGraduate_LightBox" ) . show ( ) ; for ( var Xa = this , cb = + fa . getAttribute ( "stop-opacity" ) ||
1 , rb = fa . getAttribute ( "stop-color" ) || 1 , ub = ( parseFloat ( cb ) * 255 ) . toString ( 16 ) ; ub . length < 2 ; ) ub = "0" + ub ; ga = rb . substr ( 1 ) + ub ; $ ( "#" + p + "_jGraduate_stopPicker" ) . css ( { left : 100 , bottom : 15 } ) . jPicker ( { window : { title : "Pick the start color and opacity for the gradient" } , images : { clientPath : A . images . clientPath } , color : { active : ga , alphaSupport : true } } , function ( Bb ) { rb = Bb . val ( "hex" ) ? "#" + Bb . val ( "hex" ) : "none" ; cb = Bb . val ( "a" ) !== null ? Bb . val ( "a" ) / 256 : 1 ; Xa . setAttribute ( "fill" , rb ) ; Xa . setAttribute ( "fill-opacity" , cb ) ; fa . setAttribute ( "stop-color" ,
rb ) ; fa . setAttribute ( "stop-opacity" , cb ) ; $ ( "div.jGraduate_LightBox" ) . hide ( ) ; $ ( "#" + p + "_jGraduate_stopPicker" ) . hide ( ) } , null , function ( ) { $ ( "div.jGraduate_LightBox" ) . hide ( ) ; $ ( "#" + p + "_jGraduate_stopPicker" ) . hide ( ) } ) } ) ; $ ( aa ) . find ( "stop" ) . each ( function ( ) { var Xa = $ ( this ) ; if ( + this . getAttribute ( "offset" ) > oa ) { if ( ! ga ) { var cb = this . getAttribute ( "stop-color" ) , rb = this . getAttribute ( "stop-opacity" ) ; fa . setAttribute ( "stop-color" , cb ) ; Fa . setAttribute ( "fill" , cb ) ; fa . setAttribute ( "stop-opacity" , rb === null ? 1 : rb ) ; Fa . setAttribute ( "fill-opacity" ,
rb === null ? 1 : rb ) } Xa . before ( fa ) ; return false } } ) ; R && c ( Fa ) ; return fa } function c ( oa ) { qb && qb . setAttribute ( "stroke" , "#000" ) ; oa . setAttribute ( "stroke" , "blue" ) ; qb = oa ; qb . parentNode . appendChild ( qb ) } function f ( ) { S . unbind ( "mousemove" , l ) ; if ( Ia . getAttribute ( "display" ) !== "none" ) { Ia . setAttribute ( "display" , "none" ) ; var oa = $ ( qb ) , ga = oa . data ( "stop" ) ; oa = oa . data ( "bg" ) ; $ ( [ qb , ga , oa ] ) . remove ( ) } Pa = null } function d ( ) { var oa = Ra ? "rotate(" + Ra + "," + db + "," + Ka + ") " : "" ; jb === 1 && hb === 1 ? aa . removeAttribute ( "gradientTransform" ) : aa . setAttribute ( "gradientTransform" ,
oa + "translate(" + - db * ( jb - 1 ) + "," + - Ka * ( hb - 1 ) + ") scale(" + jb + "," + hb + ")" ) } function l ( oa ) { var ga = oa . pageX - Ca . left ; oa = oa . pageY - Ca . top ; ga = ga < 10 ? 10 : ga > T + 10 ? T + 10 : ga ; var sa = "translate(" + ga + ", 26)" ; if ( oa < - 60 || oa > 130 ) { Ia . setAttribute ( "display" , "block" ) ; Ia . setAttribute ( "transform" , sa ) } else Ia . setAttribute ( "display" , "none" ) ; Pa . setAttribute ( "transform" , sa ) ; $ . data ( Pa , "bg" ) . setAttribute ( "transform" , sa ) ; $ . data ( Pa , "stop" ) . setAttribute ( "offset" , ( ga - 10 ) / T ) ; var R = 0 ; $ ( aa ) . find ( "stop" ) . each ( function ( ) { var L = this . getAttribute ( "offset" ) ,
fa = $ ( this ) ; if ( L < R ) { fa . prev ( ) . before ( fa ) ; zb = $ ( aa ) . find ( "stop" ) } R = L } ) } var o = $ ( this ) , A = $ . extend ( true , { } , jQuery . fn . jGraduateDefaults , b ) , p = o . attr ( "id" ) , K = "#" + o . attr ( "id" ) + " " ; if ( K ) { var Q = function ( ) { switch ( o . paint . type ) { case "radialGradient" : o . paint . linearGradient = null ; break ; case "linearGradient" : o . paint . radialGradient = null ; break ; case "solidColor" : o . paint . radialGradient = o . paint . linearGradient = null } $ . isFunction ( o . okCallback ) && o . okCallback ( o . paint ) ; o . hide ( ) } , N = function ( ) { $ . isFunction ( o . cancelCallback ) && o . cancelCallback ( ) ;
o . hide ( ) } ; $ . extend ( true , o , { paint : new $ . jGraduate . Paint ( { copy : A . paint } ) , okCallback : $ . isFunction ( m [ 1 ] ) && m [ 1 ] || null , cancelCallback : $ . isFunction ( m [ 2 ] ) && m [ 2 ] || null } ) ; o . position ( ) ; var H = null , S = $ ( window ) ; if ( o . paint . type == "none" ) o . paint = $ . jGraduate . Paint ( { solidColor : "ffffff" } ) ; o . addClass ( "jGraduate_Picker" ) ; o . html ( '<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="' +
p + '_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>' ) ; var ba = $ ( K + "> .jGraduate_colPick" ) , O = $ ( K + "> .jGraduate_gradPick" ) ; O . html ( '<div id="' + p + '_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">' + A . window . pickerTitle + '</h2><div id="' + p + '_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="' + p + '_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="' +
2012-07-19 15:25:04 +00:00
p + '_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + p + '_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="' + p + '_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' +
p + '_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="' + p + '_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + p + '_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="' +
p + '_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="' + p + '_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="' + p + '_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="' +
2012-07-24 02:30:12 +00:00
p + '_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="' + p + '_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="' + A . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + p + '_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="' + p + '_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="' +
p + '_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="' + A . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + p + '_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="' + p + '_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="' + p + '_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="' + A . images . clientPath +
'rangearrows2.gif"></div><label><input type="text" id="' + p + '_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="' + p + '_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="' + p + '_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="' + A . images . clientPath + 'rangearrows2.gif"></div><label><input type="text" id="' + p + '_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="' +
p + '_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="' + p + '_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>' ) ; var T = 256 , ha = T - 0 , U = T - 0 , P , aa , wa , ja = { } ; $ ( ".jGraduate_SliderBar" ) . width ( 145 ) ; var ea = $ ( "#" + p + "_jGraduate_GradContainer" ) [ 0 ] , Z = a ( "svg" , { id : p + "_jgraduate_svg" , width : T , height : T , xmlns : n . svg } , ea ) ; P = P || o . paint . type ; var Y = aa = o . paint [ P ] , la = o . paint . alpha , ua = P === "solidColor" ; switch ( P ) { case "solidColor" : case "linearGradient" : if ( ! ua ) { aa . id = p + "_lg_jgraduate_grad" ; Y =
aa = Z . appendChild ( aa ) } a ( "radialGradient" , { id : p + "_rg_jgraduate_grad" } , Z ) ; if ( P === "linearGradient" ) break ; case "radialGradient" : if ( ! ua ) { aa . id = p + "_rg_jgraduate_grad" ; Y = aa = Z . appendChild ( aa ) } a ( "linearGradient" , { id : p + "_lg_jgraduate_grad" } , Z ) } if ( ua ) { Y = aa = $ ( "#" + p + "_lg_jgraduate_grad" ) [ 0 ] ; H = o . paint [ P ] ; s ( 0 , "#" + H , 1 ) ; var pa = typeof A . newstop ; if ( pa === "string" ) switch ( A . newstop ) { case "same" : s ( 1 , "#" + H , 1 ) ; break ; case "inverse" : pa = "" ; for ( var qa = 0 ; qa < 6 ; qa += 2 ) { H . substr ( qa , 2 ) ; var Ha = ( 255 - parseInt ( H . substr ( qa , 2 ) , 16 ) ) . toString ( 16 ) ;
if ( Ha . length < 2 ) Ha = 0 + Ha ; pa += Ha } s ( 1 , "#" + pa , 1 ) ; break ; case "white" : s ( 1 , "#ffffff" , 1 ) ; break ; case "black" : s ( 1 , "#000000" , 1 ) } else if ( pa === "object" ) s ( 1 , A . newstop . color || "#" + H , "opac" in A . newstop ? A . newstop . opac : 1 ) } H = parseFloat ( Y . getAttribute ( "x1" ) || 0 ) ; pa = parseFloat ( Y . getAttribute ( "y1" ) || 0 ) ; qa = parseFloat ( Y . getAttribute ( "x2" ) || 1 ) ; Ha = parseFloat ( Y . getAttribute ( "y2" ) || 0 ) ; var Ma = parseFloat ( Y . getAttribute ( "cx" ) || 0.5 ) , Oa = parseFloat ( Y . getAttribute ( "cy" ) || 0.5 ) , Ja = parseFloat ( Y . getAttribute ( "fx" ) || Ma ) , Qa = parseFloat ( Y . getAttribute ( "fy" ) ||
Oa ) ; wa = a ( "rect" , { id : p + "_jgraduate_rect" , x : 0 , y : 0 , width : ha , height : U , fill : "url(#" + p + "_jgraduate_grad)" , "fill-opacity" : la / 100 } , Z ) ; var Va = $ ( "<div/>" ) . attr ( { "class" : "grad_coord jGraduate_lg_field" , title : "Begin Stop" } ) . text ( 1 ) . css ( { top : pa * T , left : H * T } ) . data ( "coord" , "start" ) . appendTo ( ea ) , Na = Va . clone ( ) . text ( 2 ) . css ( { top : Ha * T , left : qa * T } ) . attr ( "title" , "End stop" ) . data ( "coord" , "end" ) . appendTo ( ea ) , Aa = $ ( "<div/>" ) . attr ( { "class" : "grad_coord jGraduate_rg_field" , title : "Center stop" } ) . text ( "C" ) . css ( { top : Oa * T , left : Ma *
T } ) . data ( "coord" , "center" ) . appendTo ( ea ) , La = Aa . clone ( ) . text ( "F" ) . css ( { top : Qa * T , left : Ja * T , display : "none" } ) . attr ( "title" , "Focus point" ) . data ( "coord" , "focus" ) . appendTo ( ea ) ; La [ 0 ] . id = p + "_jGraduate_focusCoord" ; $ ( K + " .grad_coord" ) ; $ . each ( [ "x1" , "y1" , "x2" , "y2" , "cx" , "cy" , "fx" , "fy" ] , function ( oa , ga ) { var sa = aa . getAttribute ( ga ) , R = isNaN ( ga [ 1 ] ) ; sa || ( sa = R ? "0.5" : ga === "x2" ? "1.0" : "0.0" ) ; ja [ ga ] = $ ( "#" + p + "_jGraduate_" + ga ) . val ( sa ) . change ( function ( ) { if ( isNaN ( parseFloat ( this . value ) ) || this . value < 0 ) this . value = 0 ; else if ( this . value >
1 ) this . value = 1 ; if ( ! ( ga [ 0 ] === "f" && ! ib ) ) if ( R && P === "radialGradient" || ! R && P === "linearGradient" ) aa . setAttribute ( ga , this . value ) ; var L = R ? ga [ 0 ] === "c" ? Aa : La : ga [ 1 ] === "1" ? Va : Na , fa = ga . indexOf ( "x" ) >= 0 ? "left" : "top" ; L . css ( fa , this . value * T ) } ) . change ( ) } ) ; var zb , Ea , yb = $ ( "#" + p + "_jGraduate_StopSlider" ) , qb , $a , Pa , Ia = a ( "path" , { d : "m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5" , fill : "none" , stroke : "#D00" , "stroke-width" : 5 , display : "none" } , $a ) , Ca , jb = 1 , hb = 1 , Ra = 0 , db = Ma , Ka = Oa ; $a = a ( "svg" , { width : "100%" , height : 45 } , yb [ 0 ] ) ; ea = a ( "pattern" , { width : 16 ,
height : 16 , patternUnits : "userSpaceOnUse" , id : "jGraduate_trans" } , $a ) ; a ( "image" , { width : 16 , height : 16 } , ea ) . setAttributeNS ( n . xlink , "xlink:href" , A . images . clientPath + "map-opacity.png" ) ; $ ( $a ) . on ( "click touchstart" , function ( oa ) { Ca = yb . offset ( ) ; if ( oa . target . tagName !== "path" ) { var ga = oa . pageX - Ca . left - 8 ; ga = ga < 10 ? 10 : ga > T + 10 ? T + 10 : ga ; s ( ga / T , 0 , 0 , true ) ; oa . stopPropagation ( ) } } ) ; $ ( $a ) . mouseover ( function ( ) { $a . appendChild ( Ia ) } ) ; Ea = a ( "g" , { } , $a ) ; a ( "line" , { x1 : 10 , y1 : 15 , x2 : T + 10 , y2 : 15 , "stroke-width" : 2 , stroke : "#000" } , $a ) ; var sb =
O . find ( ".jGraduate_spreadMethod" ) . change ( function ( ) { aa . setAttribute ( "spreadMethod" , $ ( this ) . val ( ) ) } ) , tb = null , nb = function ( oa ) { var ga = oa . pageX - Ta . left , sa = oa . pageY - Ta . top ; ga = ga < 0 ? 0 : ga > T ? T : ga ; sa = sa < 0 ? 0 : sa > T ? T : sa ; tb . css ( "left" , ga ) . css ( "top" , sa ) ; ga = ga / ha ; sa = sa / U ; var R = tb . data ( "coord" ) , L = aa ; switch ( R ) { case "start" : ja . x1 . val ( ga ) ; ja . y1 . val ( sa ) ; L . setAttribute ( "x1" , ga ) ; L . setAttribute ( "y1" , sa ) ; break ; case "end" : ja . x2 . val ( ga ) ; ja . y2 . val ( sa ) ; L . setAttribute ( "x2" , ga ) ; L . setAttribute ( "y2" , sa ) ; break ; case "center" : ja . cx . val ( ga ) ;
ja . cy . val ( sa ) ; L . setAttribute ( "cx" , ga ) ; L . setAttribute ( "cy" , sa ) ; db = ga ; Ka = sa ; d ( ) ; break ; case "focus" : ja . fx . val ( ga ) ; ja . fy . val ( sa ) ; L . setAttribute ( "fx" , ga ) ; L . setAttribute ( "fy" , sa ) ; d ( ) } oa . preventDefault ( ) } , fb = function ( ) { tb = null ; S . unbind ( "mousemove" , nb ) . unbind ( "mouseup" , fb ) } ; zb = aa . getElementsByTagNameNS ( n . svg , "stop" ) ; if ( Za < 2 ) { for ( ; Za < 2 ; ) { aa . appendChild ( document . createElementNS ( n . svg , "stop" ) ) ; ++ Za } zb = aa . getElementsByTagNameNS ( n . svg , "stop" ) } var Za = zb . length ; for ( qa = 0 ; qa < Za ; qa ++ ) s ( 0 , 0 , 0 , 0 , zb [ qa ] ) ; sb . val ( aa . getAttribute ( "spreadMethod" ) ||
"pad" ) ; var Ta , ib = false ; wa . setAttribute ( "fill-opacity" , la / 100 ) ; $ ( "#" + p + " div.grad_coord" ) . mousedown ( function ( oa ) { oa . preventDefault ( ) ; tb = $ ( this ) ; tb . offset ( ) ; Ta = tb . parent ( ) . offset ( ) ; S . mousemove ( nb ) . mouseup ( fb ) } ) ; $ ( "#" + p + "_jGraduate_Ok" ) . bind ( "click touchstart" , function ( ) { o . paint . type = P ; o . paint [ P ] = aa . cloneNode ( true ) ; o . paint . solidColor = null ; Q ( ) } ) ; $ ( "#" + p + "_jGraduate_Cancel" ) . bind ( "click touchstart" , function ( ) { N ( ) } ) ; if ( P === "radialGradient" ) if ( ib ) La . show ( ) ; else { La . hide ( ) ; ja . fx . val ( "" ) ; ja . fy . val ( "" ) } $ ( "#" +
p + "_jGraduate_match_ctr" ) [ 0 ] . checked = ! ib ; var Ib , Cb ; $ ( "#" + p + "_jGraduate_match_ctr" ) . change ( function ( ) { ib = ! this . checked ; La . toggle ( ib ) ; ja . fx . val ( "" ) ; ja . fy . val ( "" ) ; var oa = aa ; if ( ib ) { var ga = Ib || 0.5 , sa = Cb || 0.5 ; oa . setAttribute ( "fx" , ga ) ; oa . setAttribute ( "fy" , sa ) ; ja . fx . val ( ga ) ; ja . fy . val ( sa ) } else { Ib = oa . getAttribute ( "fx" ) ; Cb = oa . getAttribute ( "fy" ) ; oa . removeAttribute ( "fx" ) ; oa . removeAttribute ( "fy" ) } } ) ; zb = aa . getElementsByTagNameNS ( n . svg , "stop" ) ; Za = zb . length ; if ( Za < 2 ) { for ( ; Za < 2 ; ) { aa . appendChild ( document . createElementNS ( n . svg ,
"stop" ) ) ; ++ Za } zb = aa . getElementsByTagNameNS ( n . svg , "stop" ) } var kb ; la = O = 0 ; if ( P === "radialGradient" ) { Z = aa . gradientTransform . baseVal ; if ( Z . numberOfItems === 2 ) { Za = Z . getItem ( 0 ) ; Z = Z . getItem ( 1 ) ; if ( Za . type === 2 && Z . type === 3 ) { Za = Z . matrix ; if ( Za . a !== 1 ) O = Math . round ( - ( 1 - Za . a ) * 100 ) ; else if ( Za . d !== 1 ) O = Math . round ( ( 1 - Za . d ) * 100 ) } } else if ( Z . numberOfItems === 3 ) { ea = Z . getItem ( 0 ) ; Za = Z . getItem ( 1 ) ; Z = Z . getItem ( 2 ) ; if ( ea . type === 4 && Za . type === 2 && Z . type === 3 ) { la = Math . round ( ea . angle ) ; Za = Z . matrix ; if ( Za . a !== 1 ) O = Math . round ( - ( 1 - Za . a ) * 100 ) ; else if ( Za . d !==
1 ) O = Math . round ( ( 1 - Za . d ) * 100 ) } } } O = { radius : { handle : "#" + p + "_jGraduate_RadiusArrows" , input : "#" + p + "_jGraduate_RadiusInput" , val : ( aa . getAttribute ( "r" ) || 0.5 ) * 100 } , opacity : { handle : "#" + p + "_jGraduate_OpacArrows" , input : "#" + p + "_jGraduate_OpacInput" , val : o . paint . alpha || 100 } , ellip : { handle : "#" + p + "_jGraduate_EllipArrows" , input : "#" + p + "_jGraduate_EllipInput" , val : O } , angle : { handle : "#" + p + "_jGraduate_AngleArrows" , input : "#" + p + "_jGraduate_AngleInput" , val : la } } ; $ . each ( O , function ( oa , ga ) { var sa = $ ( ga . handle ) ; sa . mousedown ( function ( R ) { var L =
sa . parent ( ) ; kb = { type : oa , elem : sa , input : $ ( ga . input ) , parent : L , offset : L . offset ( ) } ; S . mousemove ( vb ) . mouseup ( Gb ) ; R . preventDefault ( ) } ) ; $ ( ga . input ) . val ( ga . val ) . change ( function ( ) { var R = + this . value , L = 0 , fa = P === "radialGradient" ; switch ( oa ) { case "radius" : fa && aa . setAttribute ( "r" , R / 100 ) ; L = Math . pow ( R / 100 , 0.4 ) / 2 * 145 ; break ; case "opacity" : o . paint . alpha = R ; wa . setAttribute ( "fill-opacity" , R / 100 ) ; L = R * 1.45 ; break ; case "ellip" : jb = hb = 1 ; if ( R === 0 ) { L = 72.5 ; break } if ( R > 99.5 ) R = 99.5 ; if ( R > 0 ) hb = 1 - R / 100 ; else jb = - ( R / 100 ) - 1 ; L = 145 * ( ( R + 100 ) /
2 ) / 100 ; fa && d ( ) ; break ; case "angle" : Ra = R ; L = Ra / 180 ; L += 0.5 ; L *= 145 ; fa && d ( ) } if ( L > 145 ) L = 145 ; else if ( L < 0 ) L = 0 ; sa . css ( { "margin-left" : L - 5 } ) } ) . change ( ) } ) ; var vb = function ( oa ) { var ga = oa . pageX - kb . offset . left - parseInt ( kb . parent . css ( "border-left-width" ) ) ; if ( ga > 145 ) ga = 145 ; if ( ga <= 0 ) ga = 0 ; var sa = ga - 5 ; ga /= 145 ; switch ( kb . type ) { case "radius" : ga = Math . pow ( ga * 2 , 2.5 ) ; if ( ga > 0.98 && ga < 1.02 ) ga = 1 ; if ( ga <= 0.01 ) ga = 0.01 ; aa . setAttribute ( "r" , ga ) ; break ; case "opacity" : o . paint . alpha = parseInt ( ga * 100 ) ; wa . setAttribute ( "fill-opacity" , ga ) ; break ;
case "ellip" : hb = jb = 1 ; if ( ga < 0.5 ) { ga /= 0.5 ; jb = ga <= 0 ? 0.01 : ga } else if ( ga > 0.5 ) { ga /= 0.5 ; ga = 2 - ga ; hb = ga <= 0 ? 0.01 : ga } d ( ) ; ga -= 1 ; if ( hb === ga + 1 ) ga = Math . abs ( ga ) ; break ; case "angle" : ga -= 0.5 ; Ra = ga *= 180 ; d ( ) ; ga /= 100 } kb . elem . css ( { "margin-left" : sa } ) ; ga = Math . round ( ga * 100 ) ; kb . input . val ( ga ) ; oa . preventDefault ( ) } , Gb = function ( ) { S . unbind ( "mousemove" , vb ) . unbind ( "mouseup" , Gb ) ; kb = null } ; for ( O = ( o . paint . alpha * 255 / 100 ) . toString ( 16 ) ; O . length < 2 ; ) O = "0" + O ; O = O . split ( "." ) [ 0 ] ; H = o . paint . solidColor == "none" ? "" : o . paint . solidColor + O ; ua || ( H = zb [ 0 ] . getAttribute ( "stop-color" ) ) ;
$ . extend ( $ . fn . jPicker . defaults . window , { alphaSupport : true , effects : { type : "show" , speed : 0 } } ) ; ba . jPicker ( { window : { title : A . window . pickerTitle } , images : { clientPath : A . images . clientPath } , color : { active : H , alphaSupport : true } } , function ( oa ) { o . paint . type = "solidColor" ; o . paint . alpha = oa . val ( "ahex" ) ? Math . round ( oa . val ( "a" ) / 255 * 100 ) : 100 ; o . paint . solidColor = oa . val ( "hex" ) ? oa . val ( "hex" ) : "none" ; o . paint . radialGradient = null ; Q ( ) } , null , function ( ) { N ( ) } ) ; var Ab = $ ( K + " .jGraduate_tabs li" ) ; Ab . on ( "click touchstart" , function ( ) { Ab . removeClass ( "jGraduate_tab_current" ) ;
$ ( this ) . addClass ( "jGraduate_tab_current" ) ; $ ( K + " > div" ) . hide ( ) ; var oa = $ ( this ) . attr ( "data-type" ) ; $ ( K + " .jGraduate_gradPick" ) . show ( ) ; if ( oa === "rg" || oa === "lg" ) { $ ( ".jGraduate_" + oa + "_field" ) . show ( ) ; $ ( ".jGraduate_" + ( oa === "lg" ? "rg" : "lg" ) + "_field" ) . hide ( ) ; $ ( "#" + p + "_jgraduate_rect" ) [ 0 ] . setAttribute ( "fill" , "url(#" + p + "_" + oa + "_jgraduate_grad)" ) ; P = oa === "lg" ? "linearGradient" : "radialGradient" ; $ ( "#" + p + "_jGraduate_OpacInput" ) . val ( o . paint . alpha ) . change ( ) ; var ga = $ ( "#" + p + "_" + oa + "_jgraduate_grad" ) [ 0 ] ; if ( aa !== ga ) { var sa =
$ ( aa ) . find ( "stop" ) ; $ ( ga ) . empty ( ) . append ( sa ) ; aa = ga ; ga = sb . val ( ) ; aa . setAttribute ( "spreadMethod" , ga ) } ib = oa === "rg" && aa . getAttribute ( "fx" ) != null && ! ( Ma == Ja && Oa == Qa ) ; $ ( "#" + p + "_jGraduate_focusCoord" ) . toggle ( ib ) ; if ( ib ) $ ( "#" + p + "_jGraduate_match_ctr" ) [ 0 ] . checked = false } else { $ ( K + " .jGraduate_gradPick" ) . hide ( ) ; $ ( K + " .jGraduate_colPick" ) . show ( ) } } ) ; $ ( K + " > div" ) . hide ( ) ; Ab . removeClass ( "jGraduate_tab_current" ) ; var Jb ; switch ( o . paint . type ) { case "linearGradient" : Jb = $ ( K + " .jGraduate_tab_lingrad" ) ; break ; case "radialGradient" : Jb =
$ ( K + " .jGraduate_tab_radgrad" ) ; break ; default : Jb = $ ( K + " .jGraduate_tab_color" ) } o . show ( ) ; setTimeout ( function ( ) { Jb . addClass ( "jGraduate_tab_current" ) . click ( ) } , 10 ) } else alert ( "Container element must have an id attribute to maintain unique id strings for sub-elements." ) } ) } } ) ( ) ; function touchHandler ( a ) { var n = a . changedTouches , g = n [ 0 ] , b = "" ; switch ( a . type ) { case "touchstart" : b = "mousedown" ; break ; case "touchmove" : b = "mousemove" ; break ; case "touchend" : b = "mouseup" ; break ; default : return } var m = document . createEvent ( "MouseEvent" ) ; m . initMouseEvent ( b , true , true , window , 1 , g . screenX , g . screenY , g . clientX , g . clientY , false , false , false , false , 0 , null ) ; if ( n . length < 2 ) { g . target . dispatchEvent ( m ) ; a . preventDefault ( ) } } ; jQuery && function ( ) { var a = $ ( window ) , n = $ ( document ) ; $ . extend ( $ . fn , { contextMenu : function ( g , b ) { if ( g . menu == undefined ) return false ; if ( g . inSpeed == undefined ) g . inSpeed = 150 ; if ( g . outSpeed == undefined ) g . outSpeed = 75 ; if ( g . inSpeed == 0 ) g . inSpeed = - 1 ; if ( g . outSpeed == 0 ) g . outSpeed = - 1 ; $ ( this ) . each ( function ( ) { var m = $ ( this ) , s = $ ( m ) . offset ( ) , c = $ ( "#" + g . menu ) ; c . addClass ( "contextMenu" ) ; $ ( this ) . bind ( "mousedown" , function ( f ) { $ ( this ) . mouseup ( function ( d ) { var l = $ ( this ) ; l . unbind ( "mouseup" ) ; $ ( ".contextMenu" ) . hide ( ) ; if ( f . button === 2 || g . allowLeft ||
f . ctrlKey && svgedit . browser . isMac ( ) ) { d . stopPropagation ( ) ; if ( m . hasClass ( "disabled" ) || f . altKey ) return false ; var o = d . pageX , A = d . pageY ; d = a . width ( ) - c . width ( ) ; var p = a . height ( ) - c . height ( ) ; if ( o > d - 15 ) o = d - 15 ; if ( A > p - 30 ) A = p - 30 ; n . unbind ( "click" ) ; c . css ( { top : A , left : o } ) . fadeIn ( g . inSpeed ) ; c . find ( "A" ) . mouseover ( function ( ) { c . find ( "LI.hover" ) . removeClass ( "hover" ) ; $ ( this ) . parent ( ) . addClass ( "hover" ) } ) . mouseout ( function ( ) { c . find ( "LI.hover" ) . removeClass ( "hover" ) } ) ; n . keypress ( function ( K ) { switch ( K . keyCode ) { case 38 : if ( c . find ( "LI.hover" ) . length ) { c . find ( "LI.hover" ) . removeClass ( "hover" ) . prevAll ( "LI:not(.disabled)" ) . eq ( 0 ) . addClass ( "hover" ) ;
c . find ( "LI.hover" ) . length || c . find ( "LI:last" ) . addClass ( "hover" ) } else c . find ( "LI:last" ) . addClass ( "hover" ) ; break ; case 40 : if ( c . find ( "LI.hover" ) . length == 0 ) c . find ( "LI:first" ) . addClass ( "hover" ) ; else { c . find ( "LI.hover" ) . removeClass ( "hover" ) . nextAll ( "LI:not(.disabled)" ) . eq ( 0 ) . addClass ( "hover" ) ; c . find ( "LI.hover" ) . length || c . find ( "LI:first" ) . addClass ( "hover" ) } break ; case 13 : c . find ( "LI.hover A" ) . trigger ( "click" ) ; break ; case 27 : n . trigger ( "click" ) } } ) ; c . find ( "A" ) . unbind ( "mouseup" ) ; c . find ( "LI:not(.disabled) A" ) . mouseup ( function ( ) { n . unbind ( "click" ) . unbind ( "keypress" ) ;
$ ( ".contextMenu" ) . hide ( ) ; b && b ( $ ( this ) . attr ( "href" ) . substr ( 1 ) , $ ( l ) , { x : o - s . left , y : A - s . top , docX : o , docY : A } ) ; return false } ) ; setTimeout ( function ( ) { n . click ( function ( ) { n . unbind ( "click" ) . unbind ( "keypress" ) ; c . fadeOut ( g . outSpeed ) ; return false } ) } , 0 ) } } ) } ) ; if ( $ . browser . mozilla ) $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . css ( { MozUserSelect : "none" } ) } ) ; else $ . browser . msie ? $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . bind ( "selectstart.disableTextSelect" , function ( ) { return false } ) } ) : $ ( "#" + g . menu ) . each ( function ( ) { $ ( this ) . bind ( "mousedown.disableTextSelect" ,
function ( ) { return false } ) } ) ; $ ( m ) . add ( $ ( "UL.contextMenu" ) ) . bind ( "contextmenu" , function ( ) { return false } ) } ) ; return $ ( this ) } , disableContextMenuItems : function ( g ) { if ( g == undefined ) { $ ( this ) . find ( "LI" ) . addClass ( "disabled" ) ; return $ ( this ) } $ ( this ) . each ( function ( ) { if ( g != undefined ) for ( var b = g . split ( "," ) , m = 0 ; m < b . length ; m ++ ) $ ( this ) . find ( 'A[href="' + b [ m ] + '"]' ) . parent ( ) . addClass ( "disabled" ) } ) ; return $ ( this ) } , enableContextMenuItems : function ( g ) { if ( g == undefined ) { $ ( this ) . find ( "LI.disabled" ) . removeClass ( "disabled" ) ; return $ ( this ) } $ ( this ) . each ( function ( ) { if ( g !=
undefined ) for ( var b = g . split ( "," ) , m = 0 ; m < b . length ; m ++ ) $ ( this ) . find ( 'A[href="' + b [ m ] + '"]' ) . parent ( ) . removeClass ( "disabled" ) } ) ; return $ ( this ) } , disableContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . addClass ( "disabled" ) } ) ; return $ ( this ) } , enableContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . removeClass ( "disabled" ) } ) ; return $ ( this ) } , destroyContextMenu : function ( ) { $ ( this ) . each ( function ( ) { $ ( this ) . unbind ( "mousedown" ) . unbind ( "mouseup" ) } ) ; return $ ( this ) } } ) } ( jQuery ) ; var svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . browser ) svgedit . browser = { } ; var a = ! ! document . createElementNS && ! ! document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) . createSVGRect ; svgedit . browser . supportsSvg = function ( ) { return a } ; if ( svgedit . browser . supportsSvg ( ) ) { var n = navigator . userAgent , g = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , b = ! ! window . opera , m = n . indexOf ( "AppleWebKit" ) >= 0 , s = n . indexOf ( "Gecko/" ) >= 0 , c = n . indexOf ( "MSIE" ) >= 0 , f = n . indexOf ( "Chrome/" ) >= 0 , d = n . indexOf ( "Windows" ) >= 0 , l = n . indexOf ( "Macintosh" ) >=
0 , o = "ontouchstart" in window , A = ! ! g . querySelector , p = ! ! document . evaluate , K = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ha . setAttribute ( "d" , "M0,0 10,10" ) ; var U = ha . pathSegList ; ha = ha . createSVGPathSegLinetoAbs ( 5 , 5 ) ; try { U . replaceItem ( ha , 0 ) ; return true } catch ( P ) { } return false } ( ) , Q = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; ha . setAttribute ( "d" , "M0,0 10,10" ) ; var U = ha . pathSegList ; ha = ha . createSVGPathSegLinetoAbs ( 5 , 5 ) ; try { U . insertItemBefore ( ha ,
0 ) ; return true } catch ( P ) { } return false } ( ) , N = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , U = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . documentElement . appendChild ( ha ) ; U . setAttribute ( "x" , 5 ) ; ha . appendChild ( U ) ; var P = document . createElementNS ( "http://www.w3.org/2000/svg" , "text" ) ; P . textContent = "a" ; U . appendChild ( P ) ; U = P . getStartPositionOfChar ( 0 ) . x ; document . documentElement . removeChild ( ha ) ; return U === 0 } ( ) , H = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"svg" ) ; document . documentElement . appendChild ( ha ) ; var U = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; U . setAttribute ( "d" , "M0,0 C0,0 10,10 10,0" ) ; ha . appendChild ( U ) ; U = U . getBBox ( ) ; document . documentElement . removeChild ( ha ) ; return U . height > 4 && U . height < 5 } ( ) , S = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . documentElement . appendChild ( ha ) ; var U = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; U . setAttribute ( "d" , "M0,0 10,0" ) ; var P = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"path" ) ; P . setAttribute ( "d" , "M5,0 15,0" ) ; var aa = document . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; aa . appendChild ( U ) ; aa . appendChild ( P ) ; ha . appendChild ( aa ) ; U = aa . getBBox ( ) ; document . documentElement . removeChild ( ha ) ; return U . width == 15 } ( ) , ba = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; ha . setAttribute ( "x" , 0.1 ) ; ( ha = ha . cloneNode ( false ) . getAttribute ( "x" ) . indexOf ( "," ) == - 1 ) || $ . alert ( "NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the <a href='http://opera.com'>latest version</a> in which the problems have been fixed." ) ;
return ha } ( ) , O = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; ha . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; return ha . style . vectorEffect === "non-scaling-stroke" } ( ) , T = function ( ) { var ha = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) . transform . baseVal , U = g . createSVGTransform ( ) ; ha . appendItem ( U ) ; return ha . getItem ( 0 ) == U } ( ) ; svgedit . browser . isOpera = function ( ) { return b } ; svgedit . browser . isWebkit = function ( ) { return m } ; svgedit . browser . isGecko = function ( ) { return s } ;
svgedit . browser . isIE = function ( ) { return c } ; svgedit . browser . isChrome = function ( ) { return f } ; svgedit . browser . isWindows = function ( ) { return d } ; svgedit . browser . isMac = function ( ) { return l } ; svgedit . browser . isTouch = function ( ) { return o } ; svgedit . browser . supportsSelectors = function ( ) { return A } ; svgedit . browser . supportsXpath = function ( ) { return p } ; svgedit . browser . supportsPathReplaceItem = function ( ) { return K } ; svgedit . browser . supportsPathInsertItemBefore = function ( ) { return Q } ; svgedit . browser . supportsPathBBox = function ( ) { return H } ;
svgedit . browser . supportsHVLineContainerBBox = function ( ) { return S } ; svgedit . browser . supportsGoodTextCharPos = function ( ) { return N } ; svgedit . browser . supportsEditableText = function ( ) { return b } ; svgedit . browser . supportsGoodDecimals = function ( ) { return ba } ; svgedit . browser . supportsNonScalingStroke = function ( ) { return O } ; svgedit . browser . supportsNativeTransformLists = function ( ) { return T } } else window . location = "browser-not-supported.html" } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . transformlist ) svgedit . transformlist = { } ; var a = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) , n = { } ; svgedit . transformlist . SVGTransformList = function ( g ) { this . _elem = g || null ; this . _xforms = [ ] ; this . _update = function ( ) { var b = "" ; a . createSVGMatrix ( ) ; for ( var m = 0 ; m < this . numberOfItems ; ++ m ) { var s = this . _list . getItem ( m ) ; b = b ; s = s ; var c = s . matrix , f = "" ; switch ( s . type ) { case 1 : f = "matrix(" + [ c . a , c . b , c . c , c . d , c . e , c . f ] . join ( "," ) + ")" ; break ; case 2 : f = "translate(" + c . e + "," + c . f + ")" ; break ; case 3 : f =
c . a == c . d ? "scale(" + c . a + ")" : "scale(" + c . a + "," + c . d + ")" ; break ; case 4 : var d = 0 ; f = 0 ; if ( s . angle != 0 ) { d = 1 - c . a ; f = ( d * c . f + c . b * c . e ) / ( d * d + c . b * c . b ) ; d = ( c . e - c . b * f ) / d } f = "rotate(" + s . angle + " " + d + "," + f + ")" } b = b + ( f + " " ) } this . _elem . setAttribute ( "transform" , b ) } ; this . _list = this ; this . _init = function ( ) { var b = this . _elem . getAttribute ( "transform" ) ; if ( b ) for ( var m = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/ , s = true ; s ; ) { s = b . match ( m ) ; b = b . replace ( m , "" ) ; if ( s && s [ 1 ] ) { var c = s [ 1 ] . split ( /\s*\(/ ) , f = c [ 0 ] ; c = c [ 1 ] . match ( /\s*(.*?)\s*\)/ ) ;
c [ 1 ] = c [ 1 ] . replace ( /(\d)-/g , "$1 -" ) ; var d = c [ 1 ] . split ( /[, ]+/ ) , l = "abcdef" . split ( "" ) , o = a . createSVGMatrix ( ) ; $ . each ( d , function ( K , Q ) { d [ K ] = parseFloat ( Q ) ; if ( f == "matrix" ) o [ l [ K ] ] = d [ K ] } ) ; c = a . createSVGTransform ( ) ; var A = "set" + f . charAt ( 0 ) . toUpperCase ( ) + f . slice ( 1 ) , p = f == "matrix" ? [ o ] : d ; if ( f == "scale" && p . length == 1 ) p . push ( p [ 0 ] ) ; else if ( f == "translate" && p . length == 1 ) p . push ( 0 ) ; else if ( f == "rotate" && p . length == 1 ) { p . push ( 0 ) ; p . push ( 0 ) } c [ A ] . apply ( c , p ) ; this . _list . appendItem ( c ) } } } ; this . _removeFromOtherLists = function ( b ) { if ( b ) { var m =
false , s ; for ( s in n ) { for ( var c = n [ s ] , f = 0 , d = c . _xforms . length ; f < d ; ++ f ) if ( c . _xforms [ f ] == b ) { m = true ; c . removeItem ( f ) ; break } if ( m ) break } } } ; this . numberOfItems = 0 ; this . clear = function ( ) { this . numberOfItems = 0 ; this . _xforms = [ ] } ; this . initialize = function ( b ) { this . numberOfItems = 1 ; this . _removeFromOtherLists ( b ) ; this . _xforms = [ b ] } ; this . getItem = function ( b ) { if ( b < this . numberOfItems && b >= 0 ) return this . _xforms [ b ] ; throw { code : 1 } ; } ; this . insertItemBefore = function ( b , m ) { var s = null ; if ( m >= 0 ) if ( m < this . numberOfItems ) { this . _removeFromOtherLists ( b ) ;
s = Array ( this . numberOfItems + 1 ) ; for ( var c = 0 ; c < m ; ++ c ) s [ c ] = this . _xforms [ c ] ; s [ c ] = b ; for ( var f = c + 1 ; c < this . numberOfItems ; ++ f , ++ c ) s [ f ] = this . _xforms [ c ] ; this . numberOfItems ++ ; this . _xforms = s ; s = b ; this . _list . _update ( ) } else s = this . _list . appendItem ( b ) ; return s } ; this . replaceItem = function ( b , m ) { var s = null ; if ( m < this . numberOfItems && m >= 0 ) { this . _removeFromOtherLists ( b ) ; s = this . _xforms [ m ] = b ; this . _list . _update ( ) } return s } ; this . removeItem = function ( b ) { if ( b < this . numberOfItems && b >= 0 ) { for ( var m = this . _xforms [ b ] , s = Array ( this . numberOfItems -
1 ) , c = 0 ; c < b ; ++ c ) s [ c ] = this . _xforms [ c ] ; for ( b = c ; b < this . numberOfItems - 1 ; ++ b , ++ c ) s [ b ] = this . _xforms [ c + 1 ] ; this . numberOfItems -- ; this . _xforms = s ; this . _list . _update ( ) ; return m } else throw { code : 1 } ; } ; this . appendItem = function ( b ) { this . _removeFromOtherLists ( b ) ; this . _xforms . push ( b ) ; this . numberOfItems ++ ; this . _list . _update ( ) ; return b } } ; svgedit . transformlist . resetListMap = function ( ) { n = { } } ; svgedit . transformlist . removeElementFromListMap = function ( g ) { g . id && n [ g . id ] && delete n [ g . id ] } ; svgedit . transformlist . getTransformList = function ( g ) { if ( svgedit . browser . supportsNativeTransformLists ( ) ) if ( g . transform ) return g . transform . baseVal ;
else if ( g . gradientTransform ) return g . gradientTransform . baseVal ; else { if ( g . patternTransform ) return g . patternTransform . baseVal } else { var b = g . id ; b || ( b = "temp" ) ; var m = n [ b ] ; if ( ! m || b == "temp" ) { n [ b ] = new svgedit . transformlist . SVGTransformList ( g ) ; n [ b ] . _init ( ) ; m = n [ b ] } return m } return null } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . math ) svgedit . math = { } ; var a = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; svgedit . math . transformPoint = function ( n , g , b ) { return { x : b . a * n + b . c * g + b . e , y : b . b * n + b . d * g + b . f } } ; svgedit . math . isIdentity = function ( n ) { return n . a === 1 && n . b === 0 && n . c === 0 && n . d === 1 && n . e === 0 && n . f === 0 } ; svgedit . math . matrixMultiply = function ( ) { for ( var n = arguments , g = n . length , b = n [ g - 1 ] ; g -- > 1 ; ) b = n [ g - 1 ] . multiply ( b ) ; if ( Math . abs ( b . a ) < 1.0 E - 14 ) b . a = 0 ; if ( Math . abs ( b . b ) < 1.0 E - 14 ) b . b = 0 ; if ( Math . abs ( b . c ) < 1.0 E - 14 ) b . c = 0 ; if ( Math . abs ( b . d ) <
1.0 E - 14 ) b . d = 0 ; if ( Math . abs ( b . e ) < 1.0 E - 14 ) b . e = 0 ; if ( Math . abs ( b . f ) < 1.0 E - 14 ) b . f = 0 ; return b } ; svgedit . math . hasMatrixTransform = function ( n ) { if ( ! n ) return false ; for ( var g = n . numberOfItems ; g -- ; ) { var b = n . getItem ( g ) ; if ( b . type == 1 && ! svgedit . math . isIdentity ( b . matrix ) ) return true } return false } ; svgedit . math . transformBox = function ( n , g , b , m , s ) { var c = { x : n , y : g } , f = { x : n + b , y : g } ; b = { x : n + b , y : g + m } ; n = { x : n , y : g + m } ; g = svgedit . math . transformPoint ; c = g ( c . x , c . y , s ) ; var d = m = c . x , l = c . y , o = c . y ; f = g ( f . x , f . y , s ) ; m = Math . min ( m , f . x ) ; d = Math . max ( d , f . x ) ;
l = Math . min ( l , f . y ) ; o = Math . max ( o , f . y ) ; n = g ( n . x , n . y , s ) ; m = Math . min ( m , n . x ) ; d = Math . max ( d , n . x ) ; l = Math . min ( l , n . y ) ; o = Math . max ( o , n . y ) ; b = g ( b . x , b . y , s ) ; m = Math . min ( m , b . x ) ; d = Math . max ( d , b . x ) ; l = Math . min ( l , b . y ) ; o = Math . max ( o , b . y ) ; return { tl : c , tr : f , bl : n , br : b , aabox : { x : m , y : l , width : d - m , height : o - l } } } ; svgedit . math . transformListToTransform = function ( n , g , b ) { if ( n == null ) return a . createSVGTransformFromMatrix ( a . createSVGMatrix ( ) ) ; g = g == undefined ? 0 : g ; b = b == undefined ? n . numberOfItems - 1 : b ; g = parseInt ( g ) ; b = parseInt ( b ) ; if ( g > b ) { var m = b ; b = g ;
g = m } m = a . createSVGMatrix ( ) ; for ( g = g ; g <= b ; ++ g ) { var s = g >= 0 && g < n . numberOfItems ? n . getItem ( g ) . matrix : a . createSVGMatrix ( ) ; m = svgedit . math . matrixMultiply ( m , s ) } return a . createSVGTransformFromMatrix ( m ) } ; svgedit . math . getMatrix = function ( n ) { n = svgedit . transformlist . getTransformList ( n ) ; return svgedit . math . transformListToTransform ( n ) . matrix } ; svgedit . math . snapToAngle = function ( n , g , b , m ) { var s = Math . PI / 4 ; b = b - n ; var c = m - g ; m = Math . sqrt ( b * b + c * c ) ; s = Math . round ( Math . atan2 ( c , b ) / s ) * s ; return { x : n + m * Math . cos ( s ) , y : g + m * Math . sin ( s ) , a : s } } ;
svgedit . math . rectsIntersect = function ( n , g ) { return g . x < n . x + n . width && g . x + g . width > n . x && g . y < n . y + n . height && g . y + g . height > n . y } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . units ) svgedit . units = { } ; var a = [ "x" , "x1" , "cx" , "rx" , "width" ] , n = [ "y" , "y1" , "cy" , "ry" , "height" ] , g = $ . merge ( [ "r" , "radius" ] , a ) ; $ . merge ( g , n ) ; var b , m = { px : 1 } ; svgedit . units . init = function ( c ) { b = c ; c = document . createElementNS ( "http://www.w3.org/2000/svg" , "svg" ) ; document . body . appendChild ( c ) ; var f = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; f . setAttribute ( "width" , "1em" ) ; f . setAttribute ( "height" , "1ex" ) ; f . setAttribute ( "x" , "1in" ) ; c . appendChild ( f ) ; f = f . getBBox ( ) ; document . body . removeChild ( c ) ;
c = f . x ; m . em = f . width ; m . ex = f . height ; m [ "in" ] = c ; m . cm = c / 2.54 ; m . mm = c / 25.4 ; m . pt = c / 72 ; m . pc = c / 6 ; m [ "%" ] = 0 } ; svgedit . units . getTypeMap = function ( ) { return m } ; svgedit . units . shortFloat = function ( c ) { var f = b . getRoundDigits ( ) ; if ( isNaN ( c ) ) { if ( $ . isArray ( c ) ) return svgedit . units . shortFloat ( c [ 0 ] ) + "," + svgedit . units . shortFloat ( c [ 1 ] ) } else return + ( + c ) . toFixed ( f ) ; return parseFloat ( c ) . toFixed ( f ) - 0 } ; svgedit . units . convertUnit = function ( c , f ) { f = f || b . getBaseUnit ( ) ; return svgedit . unit . shortFloat ( c / m [ f ] ) } ; svgedit . units . setUnitAttr = function ( c ,
f , d ) { isNaN ( d ) || c . getAttribute ( f ) ; c . setAttribute ( f , d ) } ; var s = { line : [ "x1" , "x2" , "y1" , "y2" ] , circle : [ "cx" , "cy" , "r" ] , ellipse : [ "cx" , "cy" , "rx" , "ry" ] , foreignObject : [ "x" , "y" , "width" , "height" ] , rect : [ "x" , "y" , "width" , "height" ] , image : [ "x" , "y" , "width" , "height" ] , use : [ "x" , "y" , "width" , "height" ] , text : [ "x" , "y" ] } ; svgedit . units . convertAttrs = function ( c ) { var f = c . tagName , d = b . getBaseUnit ( ) ; if ( f = s [ f ] ) for ( var l = f . length , o = 0 ; o < l ; o ++ ) { var A = f [ o ] , p = c . getAttribute ( A ) ; if ( p ) isNaN ( p ) || c . setAttribute ( A , p / m [ d ] + d ) } } ; svgedit . units . convertToNum =
function ( c , f ) { if ( ! isNaN ( f ) ) return f - 0 ; if ( f . substr ( - 1 ) === "%" ) { var d = f . substr ( 0 , f . length - 1 ) / 100 , l = b . getWidth ( ) , o = b . getHeight ( ) ; return a . indexOf ( c ) >= 0 ? d * l : n . indexOf ( c ) >= 0 ? d * o : d * Math . sqrt ( l * l + o * o ) / Math . sqrt ( 2 ) } else { l = f . substr ( - 2 ) ; d = f . substr ( 0 , f . length - 2 ) ; return d * m [ l ] } } ; svgedit . units . isValidUnit = function ( c , f , d ) { var l = false ; if ( g . indexOf ( c ) >= 0 ) if ( isNaN ( f ) ) { f = f . toLowerCase ( ) ; $ . each ( m , function ( p ) { if ( ! l ) if ( RegExp ( "^-?[\\d\\.]+" + p + "$" ) . test ( f ) ) l = true } ) } else l = true ; else if ( c == "id" ) { c = false ; try { var o = b . getElement ( f ) ;
c = o == null || o === d } catch ( A ) { } return c } else l = true ; return l } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { function a ( c ) { if ( svgedit . browser . supportsHVLineContainerBBox ( ) ) try { return c . getBBox ( ) } catch ( f ) { } var d = $ . data ( c , "ref" ) , l = null ; if ( d ) { var o = $ ( d ) . children ( ) . clone ( ) . attr ( "visibility" , "hidden" ) ; $ ( s ) . append ( o ) ; l = o . filter ( "line, path" ) } else l = $ ( c ) . find ( "line, path" ) ; var A = false ; if ( l . length ) { l . each ( function ( ) { var p = this . getBBox ( ) ; if ( ! p . width || ! p . height ) A = true } ) ; if ( A ) { c = d ? o : $ ( c ) . children ( ) ; ret = getStrokedBBox ( c ) } else ret = c . getBBox ( ) } else ret = c . getBBox ( ) ; d && o . remove ( ) ; return ret } if ( ! svgedit . utilities ) svgedit . utilities =
{ } ; var n = "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" . split ( "," ) , g = null , b = null , m = null , s = null ; svgedit . utilities . init = function ( c ) { g = c ; b = c . getDOMDocument ( ) ; m = c . getDOMContainer ( ) ; s = c . getSVGRoot ( ) } ; svgedit . utilities . toXml = function ( c ) { return $ ( "<p/>" ) . text ( c ) . html ( ) } ; svgedit . utilities . fromXml = function ( c ) { return $ ( "<p/>" ) . html ( c ) . text ( ) } ; svgedit . utilities . encode64 = function ( c ) { c = svgedit . utilities . convertToXMLReferences ( c ) ; if ( window . btoa ) return window . btoa ( c ) ;
var f = Array ( Math . floor ( ( c . length + 2 ) / 3 ) * 4 ) , d , l , o , A , p , K , Q = 0 , N = 0 ; do { d = c . charCodeAt ( Q ++ ) ; l = c . charCodeAt ( Q ++ ) ; o = c . charCodeAt ( Q ++ ) ; A = d >> 2 ; d = ( d & 3 ) << 4 | l >> 4 ; p = ( l & 15 ) << 2 | o >> 6 ; K = o & 63 ; if ( isNaN ( l ) ) p = K = 64 ; else if ( isNaN ( o ) ) K = 64 ; f [ N ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( A ) ; f [ N ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( d ) ; f [ N ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( p ) ; f [ N ++ ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . charAt ( K ) } while ( Q <
c . length ) ; return f . join ( "" ) } ; svgedit . utilities . decode64 = function ( c ) { if ( window . atob ) return window . atob ( c ) ; var f = "" , d , l , o = "" , A , p = "" , K = 0 ; c = c . replace ( /[^A-Za-z0-9\+\/\=]/g , "" ) ; do { d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( c . charAt ( K ++ ) ) ; l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( c . charAt ( K ++ ) ) ; A = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( c . charAt ( K ++ ) ) ; p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" . indexOf ( c . charAt ( K ++ ) ) ;
d = d << 2 | l >> 4 ; l = ( l & 15 ) << 4 | A >> 2 ; o = ( A & 3 ) << 6 | p ; f += String . fromCharCode ( d ) ; if ( A != 64 ) f += String . fromCharCode ( l ) ; if ( p != 64 ) f += String . fromCharCode ( o ) } while ( K < c . length ) ; return unescape ( f ) } ; svgedit . utilities . convertToXMLReferences = function ( c ) { for ( var f = "" , d = 0 ; d < c . length ; d ++ ) { var l = c . charCodeAt ( d ) ; if ( l < 128 ) f += c [ d ] ; else if ( l > 127 ) f += "&#" + l + ";" } return f } ; svgedit . utilities . text2xml = function ( c ) { if ( c . indexOf ( "<svg:svg" ) >= 0 ) c = c . replace ( /<(\/?)svg:/g , "<$1" ) . replace ( "xmlns:svg" , "xmlns" ) ; var f ; try { var d = window . DOMParser ?
new DOMParser : new ActiveXObject ( "Microsoft.XMLDOM" ) ; d . async = false } catch ( l ) { throw Error ( "XML Parser could not be instantiated" ) ; } try { f = d . loadXML ? d . loadXML ( c ) ? d : false : d . parseFromString ( c , "text/xml" ) } catch ( o ) { throw Error ( "Error parsing XML string" ) ; } return f } ; svgedit . utilities . bboxToObj = function ( c ) { return { x : c . x , y : c . y , width : c . width , height : c . height } } ; svgedit . utilities . walkTree = function ( c , f ) { if ( c && c . nodeType == 1 ) { f ( c ) ; for ( var d = c . childNodes . length ; d -- ; ) svgedit . utilities . walkTree ( c . childNodes . item ( d ) , f ) } } ;
svgedit . utilities . walkTreePost = function ( c , f ) { if ( c && c . nodeType == 1 ) { for ( var d = c . childNodes . length ; d -- ; ) svgedit . utilities . walkTree ( c . childNodes . item ( d ) , f ) ; f ( c ) } } ; svgedit . utilities . getUrlFromAttr = function ( c ) { if ( c ) if ( c . indexOf ( 'url("' ) === 0 ) return c . substring ( 5 , c . indexOf ( '"' , 6 ) ) ; else if ( c . indexOf ( "url('" ) === 0 ) return c . substring ( 5 , c . indexOf ( "'" , 6 ) ) ; else if ( c . indexOf ( "url(" ) === 0 ) return c . substring ( 4 , c . indexOf ( ")" ) ) ; return null } ; svgedit . utilities . getHref = function ( c ) { return c . getAttributeNS ( "http://www.w3.org/1999/xlink" ,
"href" ) } ; svgedit . utilities . setHref = function ( c , f ) { c . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , f ) } ; svgedit . utilities . findDefs = function ( c ) { c = g . getSVGContent ( ) . documentElement ; var f = c . getElementsByTagNameNS ( "http://www.w3.org/2000/svg" , "defs" ) ; return f = f . length > 0 ? f [ 0 ] : c . insertBefore ( c . ownerDocument . createElementNS ( "http://www.w3.org/2000/svg" , "defs" ) , c . firstChild . nextSibling ) } ; svgedit . utilities . getPathBBox = function ( c ) { var f = c . pathSegList , d = f . numberOfItems ; c = [ [ ] , [ ] ] ; var l = f . getItem ( 0 ) ,
o = [ l . x , l . y ] ; for ( l = 0 ; l < d ; l ++ ) { var A = f . getItem ( l ) ; if ( typeof A . x != "undefined" ) { c [ 0 ] . push ( o [ 0 ] ) ; c [ 1 ] . push ( o [ 1 ] ) ; if ( A . x1 ) { for ( var p = [ A . x1 , A . y1 ] , K = [ A . x2 , A . y2 ] , Q = [ A . x , A . y ] , N = 0 ; N < 2 ; N ++ ) { A = function ( T ) { return Math . pow ( 1 - T , 3 ) * o [ N ] + 3 * Math . pow ( 1 - T , 2 ) * T * p [ N ] + 3 * ( 1 - T ) * Math . pow ( T , 2 ) * K [ N ] + Math . pow ( T , 3 ) * Q [ N ] } ; var H = 6 * o [ N ] - 12 * p [ N ] + 6 * K [ N ] , S = - 3 * o [ N ] + 9 * p [ N ] - 9 * K [ N ] + 3 * Q [ N ] , ba = 3 * p [ N ] - 3 * o [ N ] ; if ( S == 0 ) { if ( H != 0 ) { H = - ba / H ; 0 < H && H < 1 && c [ N ] . push ( A ( H ) ) } } else { ba = Math . pow ( H , 2 ) - 4 * ba * S ; if ( ! ( ba < 0 ) ) { var O = ( - H + Math . sqrt ( ba ) ) / ( 2 * S ) ; 0 < O && O < 1 &&
c [ N ] . push ( A ( O ) ) ; H = ( - H - Math . sqrt ( ba ) ) / ( 2 * S ) ; 0 < H && H < 1 && c [ N ] . push ( A ( H ) ) } } } o = Q } else { c [ 0 ] . push ( A . x ) ; c [ 1 ] . push ( A . y ) } } } f = Math . min . apply ( null , c [ 0 ] ) ; d = Math . max . apply ( null , c [ 0 ] ) - f ; l = Math . min . apply ( null , c [ 1 ] ) ; c = Math . max . apply ( null , c [ 1 ] ) - l ; return { x : f , y : l , width : d , height : c } } ; svgedit . utilities . getBBox = function ( c ) { var f = c || g . geSelectedElements ( ) [ 0 ] ; if ( c . nodeType != 1 ) return null ; c = null ; var d = f . nodeName ; switch ( d ) { case "text" : if ( f . textContent === "" ) { f . textContent = "a" ; c = f . getBBox ( ) ; f . textContent = "" } else try { c = f . getBBox ( ) } catch ( l ) { } break ;
case "path" : if ( svgedit . browser . supportsPathBBox ( ) ) try { c = f . getBBox ( ) } catch ( o ) { } else c = svgedit . utilities . getPathBBox ( f ) ; break ; case "g" : case "a" : c = a ( f ) ; break ; default : if ( d === "use" ) c = a ( f , true ) ; if ( d === "use" ) { c || ( c = f . getBBox ( ) ) ; if ( ! svgedit . browser . isWebkit ( ) ) { d = { } ; d . width = c . width ; d . height = c . height ; d . x = c . x + parseFloat ( f . getAttribute ( "x" ) || 0 ) ; d . y = c . y + parseFloat ( f . getAttribute ( "y" ) || 0 ) ; c = d } } else if ( ~ n . indexOf ( d ) ) try { c = f . getBBox ( ) } catch ( A ) { f = $ ( f ) . closest ( "foreignObject" ) ; if ( f . length ) try { c = f [ 0 ] . getBBox ( ) } catch ( p ) { c =
null } else c = null } } if ( c ) c = svgedit . utilities . bboxToObj ( c ) ; return c } ; svgedit . utilities . getRotationAngle = function ( c , f ) { var d = c || g . getSelectedElements ( ) [ 0 ] ; d = svgedit . transformlist . getTransformList ( d ) ; if ( ! d ) return 0 ; for ( var l = d . numberOfItems , o = 0 ; o < l ; ++ o ) { var A = d . getItem ( o ) ; if ( A . type == 4 ) return f ? A . angle * Math . PI / 180 : A . angle } return 0 } ; svgedit . utilities . getElem = svgedit . browser . supportsSelectors ( ) ? function ( c ) { return s . querySelector ( "#" + c ) } : svgedit . browser . supportsXpath ( ) ? function ( c ) { return b . evaluate ( 'svg:svg[@id="svgroot"]//svg:*[@id="' +
c + '"]' , m , function ( ) { return "http://www.w3.org/2000/svg" } , 9 , null ) . singleNodeValue } : function ( c ) { return $ ( s ) . find ( "[id=" + c + "]" ) [ 0 ] } ; svgedit . utilities . assignAttributes = function ( c , f , d , l ) { d || ( d = 0 ) ; svgedit . browser . isOpera ( ) || s . suspendRedraw ( d ) ; for ( var o in f ) if ( d = o . substr ( 0 , 4 ) === "xml:" ? "http://www.w3.org/XML/1998/namespace" : o . substr ( 0 , 6 ) === "xlink:" ? "http://www.w3.org/1999/xlink" : null ) c . setAttributeNS ( d , o , f [ o ] ) ; else l ? svgedit . units . setUnitAttr ( c , o , f [ o ] ) : c . setAttribute ( o , f [ o ] ) ; svgedit . browser . isOpera ( ) || s . unsuspendRedraw ( null ) } ;
svgedit . utilities . cleanupElement = function ( c ) { var f = s . suspendRedraw ( 60 ) , d = { "fill-opacity" : 1 , "stop-opacity" : 1 , opacity : 1 , stroke : "none" , "stroke-dasharray" : "none" , "stroke-linejoin" : "miter" , "stroke-linecap" : "butt" , "stroke-opacity" : 1 , "stroke-width" : 1 , rx : 0 , ry : 0 } , l ; for ( l in d ) { var o = d [ l ] ; c . getAttribute ( l ) == o && c . removeAttribute ( l ) } s . unsuspendRedraw ( f ) } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . sanitize ) svgedit . sanitize = { } ; var a = { } ; a [ "http://www.w3.org/1999/xlink" ] = "xlink" ; a [ "http://www.w3.org/XML/1998/namespace" ] = "xml" ; a [ "http://www.w3.org/2000/xmlns/" ] = "xmlns" ; a [ "http://svg-edit.googlecode.com" ] = "se" ; a [ "http://www.w3.org/1999/xhtml" ] = "xhtml" ; a [ "http://www.w3.org/1998/Math/MathML" ] = "mathml" ; var n = { } ; $ . each ( a , function ( m , s ) { n [ s ] = m } ) ; var g = { a : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "stroke" , "stroke-dasharray" ,
2012-07-14 20:36:17 +00:00
"stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" , "xlink:href" , "xlink:title" ] , circle : [ "class" , "clip-path" , "clip-rule" , "cx" , "cy" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "r" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , clipPath : [ "class" ,
"clipPathUnits" , "id" ] , defs : [ ] , style : [ "type" ] , desc : [ ] , ellipse : [ "class" , "clip-path" , "clip-rule" , "cx" , "cy" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "mask" , "opacity" , "requiredFeatures" , "rx" , "ry" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , feGaussianBlur : [ "class" , "color-interpolation-filters" , "id" , "requiredFeatures" , "stdDeviation" ] , filter : [ "class" , "color-interpolation-filters" ,
"filterRes" , "filterUnits" , "height" , "id" , "primitiveUnits" , "requiredFeatures" , "width" , "x" , "xlink:href" , "y" ] , foreignObject : [ "class" , "font-size" , "height" , "id" , "opacity" , "requiredFeatures" , "style" , "transform" , "width" , "x" , "y" ] , g : [ "class" , "clip-path" , "clip-rule" , "id" , "display" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "mask" , "opacity" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" ,
"transform" , "font-family" , "font-size" , "font-style" , "font-weight" , "text-anchor" ] , image : [ "class" , "clip-path" , "clip-rule" , "filter" , "height" , "id" , "mask" , "opacity" , "requiredFeatures" , "style" , "systemLanguage" , "transform" , "width" , "x" , "xlink:href" , "xlink:title" , "y" ] , line : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "opacity" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" ,
"stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" , "x1" , "x2" , "y1" , "y2" ] , linearGradient : [ "class" , "id" , "gradientTransform" , "gradientUnits" , "requiredFeatures" , "spreadMethod" , "systemLanguage" , "x1" , "x2" , "xlink:href" , "y1" , "y2" ] , marker : [ "id" , "class" , "markerHeight" , "markerUnits" , "markerWidth" , "orient" , "preserveAspectRatio" , "refX" , "refY" , "systemLanguage" , "viewBox" ] , mask : [ "class" , "height" , "id" , "maskContentUnits" , "maskUnits" , "width" , "x" , "y" ] , metadata : [ "class" , "id" ] , path : [ "class" ,
"clip-path" , "clip-rule" , "d" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "opacity" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , pattern : [ "class" , "height" , "id" , "patternContentUnits" , "patternTransform" , "patternUnits" , "requiredFeatures" , "style" , "systemLanguage" , "viewBox" , "width" , "x" , "xlink:href" , "y" ] , polygon : [ "class" ,
"clip-path" , "clip-rule" , "id" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "id" , "class" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "opacity" , "points" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , polyline : [ "class" , "clip-path" , "clip-rule" , "id" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "marker-end" , "marker-mid" , "marker-start" , "mask" , "opacity" , "points" ,
"requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" ] , radialGradient : [ "class" , "cx" , "cy" , "fx" , "fy" , "gradientTransform" , "gradientUnits" , "id" , "r" , "requiredFeatures" , "spreadMethod" , "systemLanguage" , "xlink:href" ] , rect : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "height" , "id" , "mask" , "opacity" , "requiredFeatures" , "rx" , "ry" , "stroke" , "stroke-dasharray" ,
"stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" , "width" , "x" , "y" ] , stop : [ "class" , "id" , "offset" , "requiredFeatures" , "stop-color" , "stop-opacity" , "style" , "systemLanguage" ] , svg : [ "class" , "clip-path" , "clip-rule" , "filter" , "id" , "height" , "mask" , "preserveAspectRatio" , "requiredFeatures" , "style" , "systemLanguage" , "viewBox" , "width" , "x" , "xmlns" , "xmlns:se" , "xmlns:xlink" , "y" ] , "switch" : [ "class" , "id" , "requiredFeatures" , "systemLanguage" ] ,
symbol : [ "class" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "font-family" , "font-size" , "font-style" , "font-weight" , "id" , "opacity" , "preserveAspectRatio" , "requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "transform" , "viewBox" ] , text : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "font-family" , "font-size" , "font-style" , "font-weight" , "id" , "mask" , "opacity" ,
"requiredFeatures" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "text-anchor" , "transform" , "x" , "xml:space" , "y" ] , textPath : [ "class" , "id" , "method" , "requiredFeatures" , "spacing" , "startOffset" , "style" , "systemLanguage" , "transform" , "xlink:href" ] , title : [ ] , tspan : [ "class" , "clip-path" , "clip-rule" , "dx" , "dy" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "font-family" , "font-size" , "font-style" , "font-weight" ,
"id" , "mask" , "opacity" , "requiredFeatures" , "rotate" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" , "style" , "systemLanguage" , "text-anchor" , "textLength" , "transform" , "x" , "xml:space" , "y" ] , use : [ "class" , "clip-path" , "clip-rule" , "fill" , "fill-opacity" , "fill-rule" , "filter" , "height" , "id" , "mask" , "stroke" , "stroke-dasharray" , "stroke-dashoffset" , "stroke-linecap" , "stroke-linejoin" , "stroke-miterlimit" , "stroke-opacity" , "stroke-width" ,
"style" , "transform" , "width" , "x" , "xlink:href" , "y" ] , annotation : [ "encoding" ] , "annotation-xml" : [ "encoding" ] , maction : [ "actiontype" , "other" , "selection" ] , math : [ "class" , "id" , "display" , "xmlns" ] , menclose : [ "notation" ] , merror : [ ] , mfrac : [ "linethickness" ] , mi : [ "mathvariant" ] , mmultiscripts : [ ] , mn : [ ] , mo : [ "fence" , "lspace" , "maxsize" , "minsize" , "rspace" , "stretchy" ] , mover : [ ] , mpadded : [ "lspace" , "width" , "height" , "depth" , "voffset" ] , mphantom : [ ] , mprescripts : [ ] , mroot : [ ] , mrow : [ "xlink:href" , "xlink:type" , "xmlns:xlink" ] , mspace : [ "depth" ,
2012-07-24 02:30:12 +00:00
"height" , "width" ] , msqrt : [ ] , mstyle : [ "displaystyle" , "mathbackground" , "mathcolor" , "mathvariant" , "scriptlevel" ] , msub : [ ] , msubsup : [ ] , msup : [ ] , mtable : [ "align" , "columnalign" , "columnlines" , "columnspacing" , "displaystyle" , "equalcolumns" , "equalrows" , "frame" , "rowalign" , "rowlines" , "rowspacing" , "width" ] , mtd : [ "columnalign" , "columnspan" , "rowalign" , "rowspan" ] , mtext : [ ] , mtr : [ "columnalign" , "rowalign" ] , munder : [ ] , munderover : [ ] , none : [ ] , semantics : [ ] } , b = { } ; $ . each ( g , function ( m , s ) { var c = { } ; $ . each ( s , function ( f , d ) { if ( d . indexOf ( ":" ) >=
0 ) { var l = d . split ( ":" ) ; c [ l [ 1 ] ] = n [ l [ 0 ] ] } else c [ d ] = d == "xmlns" ? "http://www.w3.org/2000/xmlns/" : null } ) ; b [ m ] = c } ) ; svgedit . sanitize . getNSMap = function ( ) { return a } ; svgedit . sanitize . sanitizeSvg = function ( m ) { if ( m . nodeType == 3 ) { m . nodeValue = m . nodeValue . replace ( /^\s+|\s+$/g , "" ) ; m . nodeValue . length || m . parentNode . removeChild ( m ) } if ( m . nodeType == 1 ) { var s = m . parentNode ; if ( m . ownerDocument && s ) { var c = g [ m . nodeName ] , f = b [ m . nodeName ] ; if ( c != undefined ) { for ( var d = [ ] , l = m . attributes . length ; l -- ; ) { var o = m . attributes . item ( l ) , A = o . nodeName ,
p = o . localName , K = o . namespaceURI ; if ( ! ( f . hasOwnProperty ( p ) && K == f [ p ] && K != "http://www.w3.org/2000/xmlns/" ) && ! ( K == "http://www.w3.org/2000/xmlns/" && a [ o . nodeValue ] ) ) { A . indexOf ( "se:" ) == 0 && d . push ( [ A , o . nodeValue ] ) ; m . removeAttributeNS ( K , p ) } if ( svgedit . browser . isGecko ( ) ) switch ( A ) { case "transform" : case "gradientTransform" : case "patternTransform" : p = o . nodeValue . replace ( /(\d)-/g , "$1 -" ) ; m . setAttribute ( A , p ) } if ( A == "style" ) { o = o . nodeValue . split ( ";" ) ; for ( A = o . length ; A -- ; ) { p = o [ A ] . split ( ":" ) ; c . indexOf ( p [ 0 ] ) >= 0 && m . setAttribute ( p [ 0 ] ,
p [ 1 ] ) } m . removeAttribute ( "style" ) } } $ . each ( d , function ( Q , N ) { m . setAttributeNS ( "http://svg-edit.googlecode.com" , N [ 0 ] , N [ 1 ] ) } ) ; if ( ( l = svgedit . utilities . getHref ( m ) ) && [ "filter" , "linearGradient" , "pattern" , "radialGradient" , "textPath" , "use" ] . indexOf ( m . nodeName ) >= 0 ) if ( l [ 0 ] != "#" ) { svgedit . utilities . setHref ( m , "" ) ; m . removeAttributeNS ( "http://www.w3.org/1999/xlink" , "href" ) } if ( m . nodeName == "use" && ! svgedit . utilities . getHref ( m ) ) s . removeChild ( m ) ; else { $ . each ( [ "clip-path" , "fill" , "filter" , "marker-end" , "marker-mid" , "marker-start" ,
"mask" , "stroke" ] , function ( Q , N ) { var H = m . getAttribute ( N ) ; if ( H ) if ( ( H = svgedit . utilities . getUrlFromAttr ( H ) ) && H [ 0 ] !== "#" ) { m . setAttribute ( N , "" ) ; m . removeAttribute ( N ) } } ) ; for ( l = m . childNodes . length ; l -- ; ) svgedit . sanitize . sanitizeSvg ( m . childNodes . item ( l ) ) } } else { for ( c = [ ] ; m . hasChildNodes ( ) ; ) c . push ( s . insertBefore ( m . firstChild , m ) ) ; s . removeChild ( m ) ; for ( l = c . length ; l -- ; ) svgedit . sanitize . sanitizeSvg ( c [ l ] ) } } } } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . history ) svgedit . history = { } ; svgedit . history . HistoryEventTypes = { BEFORE _APPLY : "before_apply" , AFTER _APPLY : "after_apply" , BEFORE _UNAPPLY : "before_unapply" , AFTER _UNAPPLY : "after_unapply" } ; svgedit . history . MoveElementCommand = function ( a , n , g , b ) { this . elem = a ; this . text = b ? "Move " + a . tagName + " to " + b : "Move " + a . tagName ; this . oldNextSibling = n ; this . oldParent = g ; this . newNextSibling = a . nextSibling ; this . newParent = a . parentNode } ; svgedit . history . MoveElementCommand . type = function ( ) { return "svgedit.history.MoveElementCommand" } ; svgedit . history . MoveElementCommand . prototype . type =
2012-07-14 20:36:17 +00:00
svgedit . history . MoveElementCommand . type ; svgedit . history . MoveElementCommand . prototype . getText = function ( ) { return this . text } ; svgedit . history . MoveElementCommand . prototype . apply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; this . elem = this . newParent . insertBefore ( this . elem , this . newNextSibling ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _APPLY , this ) } ; svgedit . history . MoveElementCommand . prototype . unapply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _UNAPPLY ,
2012-07-24 02:30:12 +00:00
this ) ; this . elem = this . oldParent . insertBefore ( this . elem , this . oldNextSibling ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _UNAPPLY , this ) } ; svgedit . history . MoveElementCommand . prototype . elements = function ( ) { return [ this . elem ] } ; svgedit . history . InsertElementCommand = function ( a , n ) { this . elem = a ; this . text = n || "Create " + a . tagName ; this . parent = a . parentNode ; this . nextSibling = this . elem . nextSibling } ; svgedit . history . InsertElementCommand . type = function ( ) { return "svgedit.history.InsertElementCommand" } ; svgedit . history . InsertElementCommand . prototype . type =
2012-07-14 20:36:17 +00:00
svgedit . history . InsertElementCommand . type ; svgedit . history . InsertElementCommand . prototype . getText = function ( ) { return this . text } ; svgedit . history . InsertElementCommand . prototype . apply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; this . elem = this . parent . insertBefore ( this . elem , this . nextSibling ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _APPLY , this ) } ; svgedit . history . InsertElementCommand . prototype . unapply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _UNAPPLY ,
2012-07-24 02:30:12 +00:00
this ) ; this . parent = this . elem . parentNode ; this . elem = this . elem . parentNode . removeChild ( this . elem ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _UNAPPLY , this ) } ; svgedit . history . InsertElementCommand . prototype . elements = function ( ) { return [ this . elem ] } ; svgedit . history . RemoveElementCommand = function ( a , n , g , b ) { this . elem = a ; this . text = b || "Delete " + a . tagName ; this . nextSibling = n ; this . parent = g ; svgedit . transformlist . removeElementFromListMap ( a ) } ; svgedit . history . RemoveElementCommand . type = function ( ) { return "svgedit.history.RemoveElementCommand" } ;
2012-07-14 20:36:17 +00:00
svgedit . history . RemoveElementCommand . prototype . type = svgedit . history . RemoveElementCommand . type ; svgedit . history . RemoveElementCommand . prototype . getText = function ( ) { return this . text } ; svgedit . history . RemoveElementCommand . prototype . apply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; svgedit . transformlist . removeElementFromListMap ( this . elem ) ; this . parent = this . elem . parentNode ; this . elem = this . parent . removeChild ( this . elem ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _APPLY ,
this ) } ; svgedit . history . RemoveElementCommand . prototype . unapply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _UNAPPLY , this ) ; svgedit . transformlist . removeElementFromListMap ( this . elem ) ; this . nextSibling == null && window . console && console . log ( "Error: reference element was lost" ) ; this . parent . insertBefore ( this . elem , this . nextSibling ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _UNAPPLY , this ) } ; svgedit . history . RemoveElementCommand . prototype . elements = function ( ) { return [ this . elem ] } ;
2012-07-24 02:30:12 +00:00
svgedit . history . ChangeElementCommand = function ( a , n , g ) { this . elem = a ; this . text = g ? "Change " + a . tagName + " " + g : "Change " + a . tagName ; this . newValues = { } ; this . oldValues = n ; for ( var b in n ) this . newValues [ b ] = b == "#text" ? a . textContent : b == "#href" ? svgedit . utilities . getHref ( a ) : a . getAttribute ( b ) } ; svgedit . history . ChangeElementCommand . type = function ( ) { return "svgedit.history.ChangeElementCommand" } ; svgedit . history . ChangeElementCommand . prototype . type = svgedit . history . ChangeElementCommand . type ; svgedit . history . ChangeElementCommand . prototype . getText =
function ( ) { return this . text } ; svgedit . history . ChangeElementCommand . prototype . apply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; var n = false , g ; for ( g in this . newValues ) { if ( this . newValues [ g ] ) if ( g == "#text" ) this . elem . textContent = this . newValues [ g ] ; else g == "#href" ? svgedit . utilities . setHref ( this . elem , this . newValues [ g ] ) : this . elem . setAttribute ( g , this . newValues [ g ] ) ; else if ( g == "#text" ) this . elem . textContent = "" ; else { this . elem . setAttribute ( g , "" ) ; this . elem . removeAttribute ( g ) } if ( g ==
"transform" ) n = true } if ( ! n ) if ( n = svgedit . utilities . getRotationAngle ( this . elem ) ) { g = elem . getBBox ( ) ; n = [ "rotate(" , n , " " , g . x + g . width / 2 , "," , g . y + g . height / 2 , ")" ] . join ( "" ) ; n != elem . getAttribute ( "transform" ) && elem . setAttribute ( "transform" , n ) } a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _APPLY , this ) ; return true } ; svgedit . history . ChangeElementCommand . prototype . unapply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _UNAPPLY , this ) ; var n = false , g ; for ( g in this . oldValues ) { if ( this . oldValues [ g ] ) if ( g ==
"#text" ) this . elem . textContent = this . oldValues [ g ] ; else g == "#href" ? svgedit . utilities . setHref ( this . elem , this . oldValues [ g ] ) : this . elem . setAttribute ( g , this . oldValues [ g ] ) ; else if ( g == "#text" ) this . elem . textContent = "" ; else this . elem . removeAttribute ( g ) ; if ( g == "transform" ) n = true } if ( ! n ) if ( n = svgedit . utilities . getRotationAngle ( this . elem ) ) { g = this . elem . getBBox ( ) ; n = [ "rotate(" , n , " " , g . x + g . width / 2 , "," , g . y + g . height / 2 , ")" ] . join ( "" ) ; n != this . elem . getAttribute ( "transform" ) && this . elem . setAttribute ( "transform" , n ) } svgedit . transformlist . removeElementFromListMap ( this . elem ) ;
2012-07-14 20:36:17 +00:00
a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _UNAPPLY , this ) ; return true } ; svgedit . history . ChangeElementCommand . prototype . elements = function ( ) { return [ this . elem ] } ; svgedit . history . BatchCommand = function ( a ) { this . text = a || "Batch Command" ; this . stack = [ ] } ; svgedit . history . BatchCommand . type = function ( ) { return "svgedit.history.BatchCommand" } ; svgedit . history . BatchCommand . prototype . type = svgedit . history . BatchCommand . type ; svgedit . history . BatchCommand . prototype . getText = function ( ) { return this . text } ; svgedit . history . BatchCommand . prototype . apply =
2012-07-24 02:30:12 +00:00
function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _APPLY , this ) ; for ( var n = this . stack . length , g = 0 ; g < n ; ++ g ) this . stack [ g ] . apply ( a ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _APPLY , this ) } ; svgedit . history . BatchCommand . prototype . unapply = function ( a ) { a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . BEFORE _UNAPPLY , this ) ; for ( var n = this . stack . length - 1 ; n >= 0 ; n -- ) this . stack [ n ] . unapply ( a ) ; a && a . handleHistoryEvent ( svgedit . history . HistoryEventTypes . AFTER _UNAPPLY ,
this ) } ; svgedit . history . BatchCommand . prototype . elements = function ( ) { for ( var a = [ ] , n = this . stack . length ; n -- ; ) for ( var g = this . stack [ n ] . elements ( ) , b = g . length ; b -- ; ) a . indexOf ( g [ b ] ) == - 1 && a . push ( g [ b ] ) ; return a } ; svgedit . history . BatchCommand . prototype . addSubCommand = function ( a ) { this . stack . push ( a ) } ; svgedit . history . BatchCommand . prototype . isEmpty = function ( ) { return this . stack . length == 0 } ; svgedit . history . UndoManager = function ( a ) { this . handler _ = a || null ; this . undoStackPointer = 0 ; this . undoStack = [ ] ; this . undoChangeStackPointer =
2012-07-14 20:36:17 +00:00
- 1 ; this . undoableChangeStack = [ ] } ; svgedit . history . UndoManager . prototype . resetUndoStack = function ( ) { this . undoStack = [ ] ; this . undoStackPointer = 0 } ; svgedit . history . UndoManager . prototype . getUndoStackSize = function ( ) { return this . undoStackPointer } ; svgedit . history . UndoManager . prototype . getRedoStackSize = function ( ) { return this . undoStack . length - this . undoStackPointer } ; svgedit . history . UndoManager . prototype . getNextUndoCommandText = function ( ) { return this . undoStackPointer > 0 ? this . undoStack [ this . undoStackPointer - 1 ] . getText ( ) :
"" } ; svgedit . history . UndoManager . prototype . getNextRedoCommandText = function ( ) { return this . undoStackPointer < this . undoStack . length ? this . undoStack [ this . undoStackPointer ] . getText ( ) : "" } ; svgedit . history . UndoManager . prototype . undo = function ( ) { this . undoStackPointer > 0 && this . undoStack [ -- this . undoStackPointer ] . unapply ( this . handler _ ) } ; svgedit . history . UndoManager . prototype . redo = function ( ) { this . undoStackPointer < this . undoStack . length && this . undoStack . length > 0 && this . undoStack [ this . undoStackPointer ++ ] . apply ( this . handler _ ) } ;
2012-07-24 02:30:12 +00:00
svgedit . history . UndoManager . prototype . addCommandToHistory = function ( a ) { if ( this . undoStackPointer < this . undoStack . length && this . undoStack . length > 0 ) this . undoStack = this . undoStack . splice ( 0 , this . undoStackPointer ) ; this . undoStack . push ( a ) ; this . undoStackPointer = this . undoStack . length } ; svgedit . history . UndoManager . prototype . beginUndoableChange = function ( a , n ) { for ( var g = ++ this . undoChangeStackPointer , b = n . length , m = Array ( b ) , s = Array ( b ) ; b -- ; ) { var c = n [ b ] ; if ( c != null ) { s [ b ] = c ; m [ b ] = c . getAttribute ( a ) } } this . undoableChangeStack [ g ] =
{ attrName : a , oldValues : m , elements : s } } ; svgedit . history . UndoManager . prototype . finishUndoableChange = function ( ) { for ( var a = this . undoChangeStackPointer -- , n = this . undoableChangeStack [ a ] , g = n . elements . length , b = n . attrName , m = new svgedit . history . BatchCommand ( "Change " + b ) ; g -- ; ) { var s = n . elements [ g ] ; if ( s != null ) { var c = { } ; c [ b ] = n . oldValues [ g ] ; c [ b ] != s . getAttribute ( b ) && m . addSubCommand ( new svgedit . history . ChangeElementCommand ( s , c , b ) ) } } this . undoableChangeStack [ a ] = null ; return m } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . select ) svgedit . select = { } ; var a , n , g ; svgedit . select . Selector = function ( b , m ) { this . id = b ; this . selectedElement = m ; this . locked = true ; this . selectorGroup = a . createSVGElement ( { element : "g" , attr : { id : "selectorGroup" + this . id } } ) ; this . selectorRect = this . selectorGroup . appendChild ( a . createSVGElement ( { element : "path" , attr : { id : "selectedBox" + this . id , fill : "none" , stroke : "#4F80FF" , "stroke-width" : "1" , "shape-rendering" : "crispEdges" , style : "pointer-events:none" } } ) ) ; svgedit . browser . isTouch ( ) && this . selectorRect . setAttribute ( "stroke-opacity" ,
0 ) ; this . gripCoords = { nw : null , n : null , ne : null , e : null , se : null , s : null , sw : null , w : null } ; this . reset ( this . selectedElement ) } ; svgedit . select . Selector . prototype . reset = function ( b ) { this . locked = true ; this . selectedElement = b ; this . resize ( ) ; this . selectorGroup . setAttribute ( "display" , "inline" ) } ; svgedit . select . Selector . prototype . updateGripCursors = function ( b ) { var m = [ ] ; b = Math . round ( b / 45 ) ; if ( b < 0 ) b += 8 ; for ( var s in g . selectorGrips ) m . push ( s ) ; for ( ; b > 0 ; ) { m . push ( m . shift ( ) ) ; b -- } b = 0 ; for ( s in g . selectorGrips ) { g . selectorGrips [ s ] . setAttribute ( "style" ,
"cursor:" + m [ b ] + "-resize" ) ; b ++ } } ; svgedit . select . Selector . prototype . showGrips = function ( b ) { g . selectorGripsGroup . setAttribute ( "display" , b ? "inline" : "none" ) ; var m = this . selectedElement ; this . hasGrips = b ; if ( m && b ) { this . selectorGroup . appendChild ( g . selectorGripsGroup ) ; this . updateGripCursors ( svgedit . utilities . getRotationAngle ( m ) ) } } ; svgedit . select . Selector . prototype . resize = function ( ) { var b = this . selectorRect , m = g , s = m . selectorGrips , c = this . selectedElement , f = c . getAttribute ( "stroke-width" ) , d = a . currentZoom ( ) , l = 1 / d ; if ( c . getAttribute ( "stroke" ) !==
"none" && ! isNaN ( f ) ) l += f / 2 ; var o = c . tagName ; if ( o === "text" ) l += 2 / d ; f = svgedit . transformlist . getTransformList ( c ) ; f = svgedit . math . transformListToTransform ( f ) . matrix ; f . e *= d ; f . f *= d ; var A = svgedit . utilities . getBBox ( c ) ; if ( o === "g" && ! $ . data ( c , "gsvg" ) ) if ( o = a . getStrokedBBox ( c . childNodes ) ) A = o ; o = A . x ; var p = A . y , K = A . width ; A = A . height ; l *= d ; d = svgedit . math . transformBox ( o * d , p * d , K * d , A * d , f ) ; f = d . aabox ; o = f . x - l ; p = f . y - l ; K = f . width + l * 2 ; var Q = f . height + l * 2 ; f = o + K / 2 ; A = p + Q / 2 ; if ( c = svgedit . utilities . getRotationAngle ( c ) ) { o = a . svgRoot ( ) . createSVGTransform ( ) ;
o . setRotate ( - c , f , A ) ; o = o . matrix ; d . tl = svgedit . math . transformPoint ( d . tl . x , d . tl . y , o ) ; d . tr = svgedit . math . transformPoint ( d . tr . x , d . tr . y , o ) ; d . bl = svgedit . math . transformPoint ( d . bl . x , d . bl . y , o ) ; d . br = svgedit . math . transformPoint ( d . br . x , d . br . y , o ) ; o = d . tl ; K = o . x ; Q = o . y ; var N = o . x , H = o . y ; o = Math . min ; p = Math . max ; K = o ( K , o ( d . tr . x , o ( d . bl . x , d . br . x ) ) ) - l ; Q = o ( Q , o ( d . tr . y , o ( d . bl . y , d . br . y ) ) ) - l ; N = p ( N , p ( d . tr . x , p ( d . bl . x , d . br . x ) ) ) + l ; H = p ( H , p ( d . tr . y , p ( d . bl . y , d . br . y ) ) ) + l ; o = K ; p = Q ; K = N - K ; Q = H - Q } l = a . svgRoot ( ) . suspendRedraw ( 100 ) ; b . setAttribute ( "d" ,
"M" + o + "," + p + " L" + ( o + K ) + "," + p + " " + ( o + K ) + "," + ( p + Q ) + " " + o + "," + ( p + Q ) + "z" ) ; this . selectorGroup . setAttribute ( "transform" , c ? "rotate(" + [ c , f , A ] . join ( "," ) + ")" : "" ) ; if ( svgedit . browser . isTouch ( ) ) { o -= 15.75 ; p -= 15.75 } else { o -= 4 ; p -= 4 } this . gripCoords = { nw : [ o , p ] . map ( Math . round ) , ne : [ o + K , p ] . map ( Math . round ) , sw : [ o , p + Q ] . map ( Math . round ) , se : [ o + K , p + Q ] . map ( Math . round ) , n : [ o + K / 2 , p ] . map ( Math . round ) , w : [ o , p + Q / 2 ] . map ( Math . round ) , e : [ o + K , p + Q / 2 ] . map ( Math . round ) , s : [ o + K / 2 , p + Q ] . map ( Math . round ) } ; for ( var S in this . gripCoords ) { b = this . gripCoords [ S ] ;
s [ S ] . setAttribute ( "x" , b [ 0 ] ) ; s [ S ] . setAttribute ( "y" , b [ 1 ] ) } this . rotateCoords = { nw : [ o , p ] , ne : [ o + K + 8 , p ] , sw : [ o , p + Q + 8 ] , se : [ o + K + 8 , p + Q + 8 ] } ; for ( S in this . rotateCoords ) { b = this . rotateCoords [ S ] ; m . rotateGrips [ S ] . setAttribute ( "cx" , b [ 0 ] ) ; m . rotateGrips [ S ] . setAttribute ( "cy" , b [ 1 ] ) } a . svgRoot ( ) . unsuspendRedraw ( l ) } ; svgedit . select . SelectorManager = function ( ) { this . rubberBandBox = this . selectorParentGroup = null ; this . selectors = [ ] ; this . selectorMap = { } ; this . selectorGrips = { nw : null , n : null , ne : null , e : null , se : null , s : null , sw : null , w : null } ;
this . selectorGripsGroup = null ; this . rotateGrips = { nw : null , ne : null , se : null , sw : null } ; this . initGroup ( ) } ; svgedit . select . SelectorManager . prototype . initGroup = function ( ) { this . selectorParentGroup && this . selectorParentGroup . parentNode && this . selectorParentGroup . parentNode . removeChild ( this . selectorParentGroup ) ; this . selectorParentGroup = a . createSVGElement ( { element : "g" , attr : { id : "selectorParentGroup" } } ) ; this . selectorGripsGroup = a . createSVGElement ( { element : "g" , attr : { display : "none" } } ) ; this . selectorParentGroup . appendChild ( this . selectorGripsGroup ) ;
a . svgRoot ( ) . appendChild ( this . selectorParentGroup ) ; this . selectorMap = { } ; this . selectors = [ ] ; this . rubberBandBox = null ; for ( var b in this . rotateGrips ) { var m = a . createSVGElement ( { element : "circle" , attr : { id : "selectorGrip_rotate_" + b , fill : "#000" , r : 8 , stroke : "#000" , "fill-opacity" : 0 , "stroke-opacity" : 0 , "stroke-width" : 0 , style : "cursor:url(" + n . imgPath + "rotate.png) 12 12, auto;" } } ) ; $ . data ( m , "dir" , b ) ; $ . data ( m , "type" , "rotate" ) ; this . rotateGrips [ b ] = this . selectorGripsGroup . appendChild ( m ) } for ( b in this . selectorGrips ) { m = a . createSVGElement ( { element : "rect" ,
attr : { id : "selectorGrip_resize_" + b , width : 8 , height : 8 , fill : "#4F80FF" , stroke : "rgba(0,0,0,0)" , "stroke-width" : 1 , style : "cursor:" + b + "-resize" , "pointer-events" : "all" } } ) ; if ( svgedit . browser . isTouch ( ) ) { m . setAttribute ( "width" , 30.5 ) ; m . setAttribute ( "height" , 30.5 ) ; m . setAttribute ( "fill-opacity" , 0.3 ) } $ . data ( m , "dir" , b ) ; $ . data ( m , "type" , "resize" ) ; this . selectorGrips [ b ] = this . selectorGripsGroup . appendChild ( m ) } if ( ! $ ( "#canvasBackground" ) . length ) { b = n . dimensions ; b = a . createSVGElement ( { element : "svg" , attr : { id : "canvasBackground" ,
width : b [ 0 ] , height : b [ 1 ] , x : 0 , y : 0 , overflow : svgedit . browser . isWebkit ( ) ? "none" : "visible" , style : "pointer-events:none" } } ) ; m = a . createSVGElement ( { element : "rect" , attr : { width : "100%" , height : "100%" , x : 0 , y : 0 , "stroke-width" : 1 , stroke : "#000" , fill : "#FFF" , style : "pointer-events:none" } } ) ; b . appendChild ( m ) ; a . svgRoot ( ) . insertBefore ( b , a . svgContent ( ) ) } } ; svgedit . select . SelectorManager . prototype . requestSelector = function ( b ) { if ( b == null ) return null ; var m = this . selectors . length ; if ( typeof this . selectorMap [ b . id ] == "object" ) { this . selectorMap [ b . id ] . locked =
true ; return this . selectorMap [ b . id ] } for ( var s = 0 ; s < m ; ++ s ) if ( this . selectors [ s ] && ! this . selectors [ s ] . locked ) { this . selectors [ s ] . locked = true ; this . selectors [ s ] . reset ( b ) ; this . selectorMap [ b . id ] = this . selectors [ s ] ; return this . selectors [ s ] } this . selectors [ m ] = new svgedit . select . Selector ( m , b ) ; this . selectorParentGroup . appendChild ( this . selectors [ m ] . selectorGroup ) ; this . selectorMap [ b . id ] = this . selectors [ m ] ; return this . selectors [ m ] } ; svgedit . select . SelectorManager . prototype . releaseSelector = function ( b ) { if ( b != null ) for ( var m =
this . selectors . length , s = this . selectorMap [ b . id ] , c = 0 ; c < m ; ++ c ) if ( this . selectors [ c ] && this . selectors [ c ] == s ) { s . locked == false && console . log ( "WARNING! selector was released but was already unlocked" ) ; delete this . selectorMap [ b . id ] ; s . locked = false ; s . selectedElement = null ; s . showGrips ( false ) ; try { s . selectorGroup . setAttribute ( "display" , "none" ) } catch ( f ) { } break } } ; svgedit . select . SelectorManager . prototype . getRubberBandBox = function ( ) { if ( ! this . rubberBandBox ) this . rubberBandBox = this . selectorParentGroup . appendChild ( a . createSVGElement ( { element : "rect" ,
attr : { id : "selectorRubberBand" , fill : "transparent" , stroke : "#666" , "stroke-width" : 1 , "stroke-dasharray" : "3,2" , display : "none" , style : "pointer-events:none" } } ) ) ; return this . rubberBandBox } ; svgedit . select . init = function ( b , m ) { n = b ; a = m ; g = new svgedit . select . SelectorManager } ; svgedit . select . getSelectorManager = function ( ) { return g } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . draw ) svgedit . draw = { } ; var a = "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" . split ( "," ) , n = { LET _DOCUMENT _DECIDE : 0 , ALWAYS _RANDOMIZE : 1 , NEVER _RANDOMIZE : 2 } , g = n . LET _DOCUMENT _DECIDE ; svgedit . draw . Layer = function ( b , m ) { this . name _ = b ; this . group _ = m } ; svgedit . draw . Layer . prototype . getName = function ( ) { return this . name _ } ; svgedit . draw . Layer . prototype . getGroup = function ( ) { return this . group _ } ; svgedit . draw . randomizeIds = function ( b , m ) { g = b == false ? n . NEVER _RANDOMIZE :
n . ALWAYS _RANDOMIZE ; if ( g == n . ALWAYS _RANDOMIZE && ! m . getNonce ( ) ) m . setNonce ( Math . floor ( Math . random ( ) * 100001 ) ) ; else g == n . NEVER _RANDOMIZE && m . getNonce ( ) && m . clearNonce ( ) } ; svgedit . draw . Drawing = function ( b , m ) { if ( ! b || ! b . tagName || ! b . namespaceURI || b . tagName != "svg" || b . namespaceURI != "http://www.w3.org/2000/svg" ) throw "Error: svgedit.draw.Drawing instance initialized without a <svg> element" ; this . svgElem _ = b ; this . obj _num = 0 ; this . idPrefix = m || "svg_" ; this . releasedNums = [ ] ; this . all _layers = [ ] ; this . current _layer = null ; this . nonce _ =
"" ; var s = this . svgElem _ . getAttributeNS ( "http://svg-edit.googlecode.com" , "nonce" ) ; if ( s && g != n . NEVER _RANDOMIZE ) this . nonce _ = s ; else g == n . ALWAYS _RANDOMIZE && this . setNonce ( Math . floor ( Math . random ( ) * 100001 ) ) } ; svgedit . draw . Drawing . prototype . getElem _ = function ( b ) { return this . svgElem _ . querySelector ? this . svgElem _ . querySelector ( "#" + b ) : $ ( this . svgElem _ ) . find ( "[id=" + b + "]" ) [ 0 ] } ; svgedit . draw . Drawing . prototype . getSvgElem = function ( ) { return this . svgElem _ } ; svgedit . draw . Drawing . prototype . getNonce = function ( ) { return this . nonce _ } ;
svgedit . draw . Drawing . prototype . setNonce = function ( b ) { this . svgElem _ . setAttributeNS ( "http://www.w3.org/2000/xmlns/" , "xmlns:se" , "http://svg-edit.googlecode.com" ) ; this . svgElem _ . setAttributeNS ( "http://svg-edit.googlecode.com" , "se:nonce" , b ) ; this . nonce _ = b } ; svgedit . draw . Drawing . prototype . clearNonce = function ( ) { this . nonce _ = "" } ; svgedit . draw . Drawing . prototype . getId = function ( ) { return this . nonce _ ? this . idPrefix + this . nonce _ + "_" + this . obj _num : this . idPrefix + this . obj _num } ; svgedit . draw . Drawing . prototype . getNextId = function ( ) { var b =
this . obj _num , m = false ; if ( this . releasedNums . length > 0 ) { this . obj _num = this . releasedNums . pop ( ) ; m = true } else this . obj _num ++ ; for ( var s = this . getId ( ) ; this . getElem _ ( s ) ; ) { if ( m ) { this . obj _num = b ; m = false } this . obj _num ++ ; s = this . getId ( ) } if ( m ) this . obj _num = b ; return s } ; svgedit . draw . Drawing . prototype . releaseId = function ( b ) { var m = this . idPrefix + ( this . nonce _ ? this . nonce _ + "_" : "" ) ; if ( typeof b != "string" || b . indexOf ( m ) != 0 ) return false ; b = parseInt ( b . substr ( m . length ) ) ; if ( typeof b != "number" || b <= 0 || this . releasedNums . indexOf ( b ) != - 1 ) return false ;
this . releasedNums . push ( b ) ; return true } ; svgedit . draw . Drawing . prototype . getNumLayers = function ( ) { return this . all _layers . length } ; svgedit . draw . Drawing . prototype . hasLayer = function ( b ) { for ( var m = 0 ; m < this . getNumLayers ( ) ; m ++ ) if ( this . all _layers [ m ] [ 0 ] == b ) return true ; return false } ; svgedit . draw . Drawing . prototype . getLayerName = function ( b ) { if ( b >= 0 && b < this . getNumLayers ( ) ) return this . all _layers [ b ] [ 0 ] ; return "" } ; svgedit . draw . Drawing . prototype . getCurrentLayer = function ( ) { return this . current _layer } ; svgedit . draw . Drawing . prototype . getCurrentLayerName =
function ( ) { for ( var b = 0 ; b < this . getNumLayers ( ) ; ++ b ) if ( this . all _layers [ b ] [ 1 ] == this . current _layer ) return this . getLayerName ( b ) ; return "" } ; svgedit . draw . Drawing . prototype . setCurrentLayer = function ( b ) { for ( var m = 0 ; m < this . getNumLayers ( ) ; ++ m ) if ( b == this . getLayerName ( m ) ) { if ( this . current _layer != this . all _layers [ m ] [ 1 ] ) { this . current _layer . setAttribute ( "style" , "pointer-events:none" ) ; this . current _layer = this . all _layers [ m ] [ 1 ] ; this . current _layer . setAttribute ( "style" , "pointer-events:all" ) } return true } return false } ; svgedit . draw . Drawing . prototype . deleteCurrentLayer =
function ( ) { if ( this . current _layer && this . getNumLayers ( ) > 1 ) { var b = this . current _layer . parentNode . removeChild ( this . current _layer ) ; this . identifyLayers ( ) ; return b } return null } ; svgedit . draw . Drawing . prototype . identifyLayers = function ( ) { this . all _layers = [ ] ; for ( var b = this . svgElem _ . childNodes . length , m = [ ] , s = [ ] , c = null , f = false , d = 0 ; d < b ; ++ d ) { var l = this . svgElem _ . childNodes . item ( d ) ; if ( l && l . nodeType == 1 ) if ( l . tagName == "g" ) { f = true ; var o = $ ( "title" , l ) . text ( ) ; if ( ! o && svgedit . browser . isOpera ( ) && l . querySelectorAll ) o = $ ( l . querySelectorAll ( "title" ) ) . text ( ) ;
if ( o ) { s . push ( o ) ; this . all _layers . push ( [ o , l ] ) ; c = l ; svgedit . utilities . walkTree ( l , function ( A ) { A . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; c . setAttribute ( "style" , "pointer-events:none" ) } else m . push ( l ) } else if ( ~ a . indexOf ( l . nodeName ) ) { svgedit . utilities . getBBox ( l ) ; m . push ( l ) } } b = this . svgElem _ . ownerDocument ; if ( m . length > 0 || ! f ) { for ( d = 1 ; s . indexOf ( "Layer " + d ) >= 0 ; ) d ++ ; s = "Layer " + d ; c = b . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; f = b . createElementNS ( "http://www.w3.org/2000/svg" , "title" ) ; f . textContent = s ;
c . appendChild ( f ) ; for ( f = 0 ; f < m . length ; ++ f ) c . appendChild ( m [ f ] ) ; this . svgElem _ . appendChild ( c ) ; this . all _layers . push ( [ s , c ] ) } svgedit . utilities . walkTree ( c , function ( A ) { A . setAttribute ( "style" , "pointer-events:inherit" ) } ) ; this . current _layer = c ; this . current _layer . setAttribute ( "style" , "pointer-events:all" ) } ; svgedit . draw . Drawing . prototype . createLayer = function ( b ) { var m = this . svgElem _ . ownerDocument , s = m . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ; m = m . createElementNS ( "http://www.w3.org/2000/svg" , "title" ) ; m . textContent =
b ; s . appendChild ( m ) ; this . svgElem _ . appendChild ( s ) ; this . identifyLayers ( ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerVisibility = function ( b ) { for ( var m = null , s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == b ) { m = this . all _layers [ s ] [ 1 ] ; break } if ( ! m ) return false ; return m . getAttribute ( "display" ) != "none" } ; svgedit . draw . Drawing . prototype . setLayerVisibility = function ( b , m ) { if ( typeof m != "boolean" ) return null ; for ( var s = null , c = 0 ; c < this . getNumLayers ( ) ; ++ c ) if ( this . getLayerName ( c ) == b ) { s = this . all _layers [ c ] [ 1 ] ;
break } if ( ! s ) return null ; s . getAttribute ( "display" ) ; s . setAttribute ( "display" , m ? "inline" : "none" ) ; return s } ; svgedit . draw . Drawing . prototype . getLayerOpacity = function ( b ) { for ( var m = 0 ; m < this . getNumLayers ( ) ; ++ m ) if ( this . getLayerName ( m ) == b ) { ( b = this . all _layers [ m ] [ 1 ] . getAttribute ( "opacity" ) ) || ( b = "1.0" ) ; return parseFloat ( b ) } return null } ; svgedit . draw . Drawing . prototype . setLayerOpacity = function ( b , m ) { if ( ! ( typeof m != "number" || m < 0 || m > 1 ) ) for ( var s = 0 ; s < this . getNumLayers ( ) ; ++ s ) if ( this . getLayerName ( s ) == b ) { this . all _layers [ s ] [ 1 ] . setAttribute ( "opacity" ,
m ) ; break } } } ) ( ) ; svgedit = svgedit || { } ;
( function ( ) { if ( ! svgedit . path ) svgedit . path = { } ; var a = { pathNodeTooltip : "Drag node to move it. Double-click node to change segment type" , pathCtrlPtTooltip : "Drag control point to adjust curve properties" } , n = { 2 : [ "x" , "y" ] , 4 : [ "x" , "y" ] , 6 : [ "x" , "y" , "x1" , "y1" , "x2" , "y2" ] , 8 : [ "x" , "y" , "x1" , "y1" ] , 10 : [ "x" , "y" , "r1" , "r2" , "angle" , "largeArcFlag" , "sweepFlag" ] , 12 : [ "x" ] , 14 : [ "y" ] , 16 : [ "x" , "y" , "x2" , "y2" ] , 18 : [ "x" , "y" ] } , g = [ ] , b = true , m = { } ; svgedit . path . setLinkControlPoints = function ( f ) { b = f } ; var s = svgedit . path . path = null ; svgedit . path . init =
function ( f ) { s = f ; g = [ 0 , "ClosePath" ] ; $ . each ( [ "Moveto" , "Lineto" , "CurvetoCubic" , "CurvetoQuadratic" , "Arc" , "LinetoHorizontal" , "LinetoVertical" , "CurvetoCubicSmooth" , "CurvetoQuadraticSmooth" ] , function ( d , l ) { g . push ( l + "Abs" ) ; g . push ( l + "Rel" ) } ) } ; svgedit . path . insertItemBefore = function ( f , d , l ) { f = f . pathSegList ; if ( svgedit . browser . supportsPathInsertItemBefore ( ) ) f . insertItemBefore ( d , l ) ; else { for ( var o = f . numberOfItems , A = [ ] , p = 0 ; p < o ; p ++ ) { var K = f . getItem ( p ) ; A . push ( K ) } f . clear ( ) ; for ( p = 0 ; p < o ; p ++ ) { p == l && f . appendItem ( d ) ; f . appendItem ( A [ p ] ) } } } ;
svgedit . path . ptObjToArr = function ( f , d ) { for ( var l = n [ f ] , o = l . length , A = Array ( o ) , p = 0 ; p < o ; p ++ ) A [ p ] = d [ l [ p ] ] ; return A } ; svgedit . path . getGripPt = function ( f , d ) { var l = { x : d ? d . x : f . item . x , y : d ? d . y : f . item . y } , o = f . path ; if ( o . matrix ) l = svgedit . math . transformPoint ( l . x , l . y , o . matrix ) ; l . x *= s . getCurrentZoom ( ) ; l . y *= s . getCurrentZoom ( ) ; return l } ; svgedit . path . getPointFromGrip = function ( f , d ) { var l = { x : f . x , y : f . y } ; if ( d . matrix ) { f = svgedit . math . transformPoint ( l . x , l . y , d . imatrix ) ; l . x = f . x ; l . y = f . y } l . x /= s . getCurrentZoom ( ) ; l . y /= s . getCurrentZoom ( ) ;
return l } ; svgedit . path . addPointGrip = function ( f , d , l ) { var o = svgedit . path . getGripContainer ( ) , A = svgedit . utilities . getElem ( "pathpointgrip_" + f ) ; if ( ! A ) { A = document . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; svgedit . utilities . assignAttributes ( A , { id : "pathpointgrip_" + f , display : "none" , width : 5 , height : 5 , fill : "#fff" , stroke : "#4F80FF" , "shape-rendering" : "crispEdges" , "stroke-width" : 1 , cursor : "move" , style : "pointer-events:all" , "xlink:title" : a . pathNodeTooltip } ) ; A = o . appendChild ( A ) ; $ ( "#pathpointgrip_" + f ) . dblclick ( function ( ) { svgedit . path . path &&
svgedit . path . path . setSegType ( ) } ) } d && l && svgedit . utilities . assignAttributes ( A , { x : d - 2.5 , y : l - 2.5 , display : "inline" } ) ; return A } ; svgedit . path . getGripContainer = function ( ) { var f = svgedit . utilities . getElem ( "pathpointgrip_container" ) ; if ( ! f ) { f = svgedit . utilities . getElem ( "selectorParentGroup" ) . appendChild ( document . createElementNS ( "http://www.w3.org/2000/svg" , "g" ) ) ; f . id = "pathpointgrip_container" } return f } ; svgedit . path . addCtrlGrip = function ( f ) { var d = svgedit . utilities . getElem ( "ctrlpointgrip_" + f ) ; if ( d ) return d ; d = document . createElementNS ( "http://www.w3.org/2000/svg" ,
"circle" ) ; svgedit . utilities . assignAttributes ( d , { id : "ctrlpointgrip_" + f , display : "none" , r : 3 , fill : "#4F80FF" , cursor : "move" , style : "pointer-events:all" , "xlink:title" : a . pathCtrlPtTooltip } ) ; svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getCtrlLine = function ( f ) { var d = svgedit . utilities . getElem ( "ctrlLine_" + f ) ; if ( d ) return d ; d = document . createElementNS ( "http://www.w3.org/2000/svg" , "line" ) ; svgedit . utilities . assignAttributes ( d , { id : "ctrlLine_" + f , stroke : "#4F80FF" , "stroke-width" : 1 , style : "pointer-events:none" } ) ;
svgedit . path . getGripContainer ( ) . appendChild ( d ) ; return d } ; svgedit . path . getPointGrip = function ( f , d ) { var l = svgedit . path . addPointGrip ( f . index ) ; if ( d ) { var o = svgedit . path . getGripPt ( f ) ; svgedit . utilities . assignAttributes ( l , { x : o . x - 2.5 , y : o . y - 2.5 , display : "inline" } ) } return l } ; svgedit . path . getControlPoints = function ( f ) { var d = f . item , l = f . index ; if ( ! ( "x1" in d ) || ! ( "x2" in d ) ) return null ; var o = { } ; svgedit . path . getGripContainer ( ) ; for ( var A = [ svgedit . path . path . segs [ l - 1 ] . item , d ] , p = 1 ; p < 3 ; p ++ ) { var K = l + "c" + p , Q = o [ "c" + p + "_line" ] =
svgedit . path . getCtrlLine ( K ) , N = svgedit . path . getGripPt ( f , { x : d [ "x" + p ] , y : d [ "y" + p ] } ) , H = svgedit . path . getGripPt ( f , { x : A [ p - 1 ] . x , y : A [ p - 1 ] . y } ) ; svgedit . utilities . assignAttributes ( Q , { x1 : N . x , y1 : N . y , x2 : H . x , y2 : H . y , display : "inline" } ) ; o [ "c" + p + "_line" ] = Q ; pointGrip = o [ "c" + p ] = svgedit . path . addCtrlGrip ( K ) ; svgedit . utilities . assignAttributes ( pointGrip , { cx : N . x , cy : N . y , display : "inline" } ) ; o [ "c" + p ] = pointGrip } return o } ; svgedit . path . replacePathSeg = function ( f , d , l , o ) { o = o || svgedit . path . path . elem ; f = o [ "createSVGPathSeg" + g [ f ] ] . apply ( o ,
l ) ; if ( svgedit . browser . supportsPathReplaceItem ( ) ) o . pathSegList . replaceItem ( f , d ) ; else { l = o . pathSegList ; o = l . numberOfItems ; for ( var A = [ ] , p = 0 ; p < o ; p ++ ) { var K = l . getItem ( p ) ; A . push ( K ) } l . clear ( ) ; for ( p = 0 ; p < o ; p ++ ) p == d ? l . appendItem ( f ) : l . appendItem ( A [ p ] ) } } ; svgedit . path . getSegSelector = function ( f , d ) { var l = f . index , o = svgedit . utilities . getElem ( "segline_" + l ) ; if ( ! o ) { var A = svgedit . path . getGripContainer ( ) ; o = document . createElementNS ( "http://www.w3.org/2000/svg" , "path" ) ; svgedit . utilities . assignAttributes ( o , { id : "segline_" + l ,
display : "none" , fill : "none" , stroke : "#0FF" , "stroke-width" : 2 , style : "pointer-events:none" , d : "M0,0 0,0" } ) ; A . appendChild ( o ) } if ( d ) { l = f . prev ; if ( ! l ) { o . setAttribute ( "display" , "none" ) ; return o } l = svgedit . path . getGripPt ( l ) ; svgedit . path . replacePathSeg ( 2 , 0 , [ l . x , l . y ] , o ) ; A = svgedit . path . ptObjToArr ( f . type , f . item , true ) ; for ( var p = 0 ; p < A . length ; p += 2 ) { l = svgedit . path . getGripPt ( f , { x : A [ p ] , y : A [ p + 1 ] } ) ; A [ p ] = l . x ; A [ p + 1 ] = l . y } svgedit . path . replacePathSeg ( f . type , 1 , A , o ) } return o } ; svgedit . path . smoothControlPoints = this . smoothControlPoints =
function ( f , d , l ) { var o = f . x - l . x , A = f . y - l . y , p = d . x - l . x , K = d . y - l . y ; if ( ( o != 0 || A != 0 ) && ( p != 0 || K != 0 ) ) { f = Math . atan2 ( A , o ) ; d = Math . atan2 ( K , p ) ; o = Math . sqrt ( o * o + A * A ) ; p = Math . sqrt ( p * p + K * K ) ; A = s . getSVGRoot ( ) . createSVGPoint ( ) ; K = s . getSVGRoot ( ) . createSVGPoint ( ) ; if ( f < 0 ) f += 2 * Math . PI ; if ( d < 0 ) d += 2 * Math . PI ; var Q = Math . abs ( f - d ) , N = Math . abs ( Math . PI - Q ) / 2 ; if ( f - d > 0 ) { f = Q < Math . PI ? f + N : f - N ; d = Q < Math . PI ? d - N : d + N } else { f = Q < Math . PI ? f - N : f + N ; d = Q < Math . PI ? d + N : d - N } A . x = o * Math . cos ( f ) + l . x ; A . y = o * Math . sin ( f ) + l . y ; K . x = p * Math . cos ( d ) + l . x ; K . y = p * Math . sin ( d ) + l . y ;
return [ A , K ] } } ; svgedit . path . Segment = function ( f , d ) { this . selected = false ; this . index = f ; this . item = d ; this . type = d . pathSegType ; this . ctrlpts = [ ] ; this . segsel = this . ptgrip = null } ; svgedit . path . Segment . prototype . showCtrlPts = function ( f ) { for ( var d in this . ctrlpts ) this . ctrlpts [ d ] . setAttribute ( "display" , f ? "inline" : "none" ) } ; svgedit . path . Segment . prototype . selectCtrls = function ( ) { $ ( "#ctrlpointgrip_" + this . index + "c1, #ctrlpointgrip_" + this . index + "c2" ) . attr ( "fill" , "#4F80FF" ) } ; svgedit . path . Segment . prototype . show = function ( f ) { if ( this . ptgrip ) { this . ptgrip . setAttribute ( "display" ,
f ? "inline" : "none" ) ; this . segsel . setAttribute ( "display" , f ? "inline" : "none" ) ; this . showCtrlPts ( f ) } } ; svgedit . path . Segment . prototype . select = function ( f ) { if ( this . ptgrip ) { this . ptgrip . setAttribute ( "stroke" , f ? "#0FF" : "#00F" ) ; this . segsel . setAttribute ( "display" , f ? "inline" : "none" ) ; this . ctrlpts && this . selectCtrls ( f ) ; this . selected = f } } ; svgedit . path . Segment . prototype . addGrip = function ( ) { this . ptgrip = svgedit . path . getPointGrip ( this , true ) ; this . ctrlpts = svgedit . path . getControlPoints ( this , true ) ; this . segsel = svgedit . path . getSegSelector ( this ,
true ) } ; svgedit . path . Segment . prototype . update = function ( f ) { if ( this . ptgrip ) { var d = svgedit . path . getGripPt ( this ) ; svgedit . utilities . assignAttributes ( this . ptgrip , this . ptgrip . nodeName == "rect" ? { x : d . x - 2.5 , y : d . y - 2.5 } : { cx : d . x , cy : d . y } ) ; svgedit . path . getSegSelector ( this , true ) ; if ( this . ctrlpts ) { if ( f ) { this . item = svgedit . path . path . elem . pathSegList . getItem ( this . index ) ; this . type = this . item . pathSegType } svgedit . path . getControlPoints ( this ) } } } ; svgedit . path . Segment . prototype . move = function ( f , d ) { var l = this . item ; l = this . ctrlpts ?
[ l . x += f , l . y += d , l . x1 , l . y1 , l . x2 += f , l . y2 += d ] : [ l . x += f , l . y += d ] ; svgedit . path . replacePathSeg ( this . type , this . index , l ) ; if ( this . next && this . next . ctrlpts ) { l = this . next . item ; l = [ l . x , l . y , l . x1 += f , l . y1 += d , l . x2 , l . y2 ] ; svgedit . path . replacePathSeg ( this . next . type , this . next . index , l ) } if ( this . mate ) { l = this . mate . item ; l = [ l . x += f , l . y += d ] ; svgedit . path . replacePathSeg ( this . mate . type , this . mate . index , l ) } this . update ( true ) ; this . next && this . next . update ( true ) } ; svgedit . path . Segment . prototype . setLinked = function ( f ) { var d , l , o ; if ( f == 2 ) { l = 1 ; d =
this . next ; if ( ! d ) return ; o = this . item } else { l = 2 ; d = this . prev ; if ( ! d ) return ; o = d . item } var A = d . item ; A [ "x" + l ] = o . x + ( o . x - this . item [ "x" + f ] ) ; A [ "y" + l ] = o . y + ( o . y - this . item [ "y" + f ] ) ; svgedit . path . replacePathSeg ( d . type , d . index , [ A . x , A . y , A . x1 , A . y1 , A . x2 , A . y2 ] ) ; d . update ( true ) } ; svgedit . path . Segment . prototype . moveCtrl = function ( f , d , l ) { var o = this . item ; o [ "x" + f ] += d ; o [ "y" + f ] += l ; svgedit . path . replacePathSeg ( this . type , this . index , [ o . x , o . y , o . x1 , o . y1 , o . x2 , o . y2 ] ) ; this . update ( true ) } ; svgedit . path . Segment . prototype . setType = function ( f , d ) { svgedit . path . replacePathSeg ( f ,
this . index , d ) ; this . type = f ; this . item = svgedit . path . path . elem . pathSegList . getItem ( this . index ) ; this . showCtrlPts ( f === 6 ) ; this . ctrlpts = svgedit . path . getControlPoints ( this ) ; this . update ( true ) } ; svgedit . path . Path = function ( f ) { if ( ! f || f . tagName !== "path" ) throw "svgedit.path.Path constructed without a <path> element" ; this . elem = f ; this . segs = [ ] ; this . selected _pts = [ ] ; svgedit . path . path = this ; this . init ( ) } ; svgedit . path . Path . prototype . init = function ( ) { $ ( svgedit . path . getGripContainer ( ) ) . find ( "*" ) . attr ( "display" , "none" ) ; var f =
this . elem . pathSegList , d = f . numberOfItems ; this . segs = [ ] ; this . selected _pts = [ ] ; this . first _seg = null ; for ( var l = 0 ; l < d ; l ++ ) { var o = f . getItem ( l ) ; o = new svgedit . path . Segment ( l , o ) ; o . path = this ; this . segs . push ( o ) } f = this . segs ; o = null ; for ( l = 0 ; l < d ; l ++ ) { var A = f [ l ] , p = l + 1 >= d ? null : f [ l + 1 ] , K = l - 1 < 0 ? null : f [ l - 1 ] ; if ( A . type === 2 ) { if ( K && K . type !== 1 ) { p = f [ o ] ; p . next = f [ o + 1 ] ; p . next . prev = p ; p . addGrip ( ) } o = l } else if ( p && p . type === 1 ) { A . next = f [ o + 1 ] ; A . next . prev = A ; A . mate = f [ o ] ; A . addGrip ( ) ; if ( this . first _seg == null ) this . first _seg = A } else if ( p ) { if ( A . type !==
1 ) { A . addGrip ( ) ; if ( p && p . type !== 2 ) { A . next = p ; A . next . prev = A } } } else if ( A . type !== 1 ) { p = f [ o ] ; p . next = f [ o + 1 ] ; p . next . prev = p ; p . addGrip ( ) ; A . addGrip ( ) ; if ( ! this . first _seg ) this . first _seg = f [ o ] } } return this } ; svgedit . path . Path . prototype . eachSeg = function ( f ) { for ( var d = this . segs . length , l = 0 ; l < d ; l ++ ) if ( f . call ( this . segs [ l ] , l ) === false ) break } ; svgedit . path . Path . prototype . addSeg = function ( f ) { var d = this . segs [ f ] ; if ( d . prev ) { var l = d . prev , o ; switch ( d . item . pathSegType ) { case 4 : var A = ( d . item . x + l . item . x ) / 2 , p = ( d . item . y + l . item . y ) / 2 ; o = this . elem . createSVGPathSegLinetoAbs ( A ,
p ) ; break ; case 6 : o = ( l . item . x + d . item . x1 ) / 2 ; var K = ( d . item . x1 + d . item . x2 ) / 2 , Q = ( d . item . x2 + d . item . x ) / 2 , N = ( o + K ) / 2 ; K = ( K + Q ) / 2 ; A = ( N + K ) / 2 ; var H = ( l . item . y + d . item . y1 ) / 2 , S = ( d . item . y1 + d . item . y2 ) / 2 ; l = ( d . item . y2 + d . item . y ) / 2 ; var ba = ( H + S ) / 2 ; S = ( S + l ) / 2 ; p = ( ba + S ) / 2 ; o = this . elem . createSVGPathSegCurvetoCubicAbs ( A , p , o , H , N , ba ) ; svgedit . path . replacePathSeg ( d . type , f , [ d . item . x , d . item . y , K , S , Q , l ] ) } svgedit . path . insertItemBefore ( this . elem , o , f ) } } ; svgedit . path . Path . prototype . deleteSeg = function ( f ) { var d = this . segs [ f ] , l = this . elem . pathSegList ;
d . show ( false ) ; var o = d . next ; if ( d . mate ) { var A = [ o . item . x , o . item . y ] ; svgedit . path . replacePathSeg ( 2 , o . index , A ) ; svgedit . path . replacePathSeg ( 4 , d . index , A ) ; l . removeItem ( d . mate . index ) } else { if ( ! d . prev ) { A = [ o . item . x , o . item . y ] ; svgedit . path . replacePathSeg ( 2 , d . next . index , A ) } l . removeItem ( f ) } } ; svgedit . path . Path . prototype . subpathIsClosed = function ( f ) { var d = false ; svgedit . path . path . eachSeg ( function ( l ) { if ( l <= f ) return true ; if ( this . type === 2 ) return false ; else if ( this . type === 1 ) { d = true ; return false } } ) ; return d } ; svgedit . path . Path . prototype . removePtFromSelection =
function ( f ) { var d = this . selected _pts . indexOf ( f ) ; if ( d != - 1 ) { this . segs [ f ] . select ( false ) ; this . selected _pts . splice ( d , 1 ) } } ; svgedit . path . Path . prototype . clearSelection = function ( ) { this . eachSeg ( function ( ) { this . select ( false ) } ) ; this . selected _pts = [ ] } ; svgedit . path . Path . prototype . storeD = function ( ) { this . last _d = this . elem . getAttribute ( "d" ) } ; svgedit . path . Path . prototype . show = function ( f ) { this . eachSeg ( function ( ) { this . show ( f ) } ) ; f && this . selectPt ( this . first _seg . index ) ; return this } ; svgedit . path . Path . prototype . movePts = function ( f ,
d ) { for ( var l = this . selected _pts . length ; l -- ; ) this . segs [ this . selected _pts [ l ] ] . move ( f , d ) } ; svgedit . path . Path . prototype . moveCtrl = function ( f , d ) { var l = this . segs [ this . selected _pts [ 0 ] ] ; l . moveCtrl ( this . dragctrl , f , d ) ; b && l . setLinked ( this . dragctrl ) } ; svgedit . path . Path . prototype . setSegType = function ( f ) { this . storeD ( ) ; for ( var d = this . selected _pts . length , l ; d -- ; ) { var o = this . segs [ this . selected _pts [ d ] ] , A = o . prev ; if ( A ) { if ( ! f ) { l = "Toggle Path Segment Type" ; f = o . type == 6 ? 4 : 6 } f -= 0 ; var p = o . item . x , K = o . item . y , Q = A . item . x ; A = A . item . y ;
var N ; switch ( f ) { case 6 : if ( o . olditem ) { Q = o . olditem ; N = [ p , K , Q . x1 , Q . y1 , Q . x2 , Q . y2 ] } else { N = p - Q ; var H = K - A ; N = [ p , K , Q + N / 3 , A + H / 3 , p - N / 3 , K - H / 3 ] } break ; case 4 : N = [ p , K ] ; o . olditem = o . item } o . setType ( f , N ) } } svgedit . path . path . endChanges ( l ) } ; svgedit . path . Path . prototype . selectPt = function ( f , d ) { this . clearSelection ( ) ; f == null && this . eachSeg ( function ( l ) { if ( this . prev ) f = l } ) ; this . addPtsToSelection ( f ) ; if ( d ) { this . dragctrl = d ; b && this . segs [ f ] . setLinked ( d ) } } ; svgedit . path . Path . prototype . update = function ( ) { var f = this . elem ; if ( svgedit . utilities . getRotationAngle ( f ) ) { this . matrix =
svgedit . math . getMatrix ( f ) ; this . imatrix = this . matrix . inverse ( ) } else this . imatrix = this . matrix = null ; this . eachSeg ( function ( d ) { this . item = f . pathSegList . getItem ( d ) ; this . update ( ) } ) ; return this } ; svgedit . path . getPath _ = function ( f ) { var d = m [ f . id ] ; d || ( d = m [ f . id ] = new svgedit . path . Path ( f ) ) ; return d } ; svgedit . path . removePath _ = function ( f ) { f in m && delete m [ f ] } ; var c = function ( f , d ) { dx = f - oldcx ; dy = d - oldcy ; r = Math . sqrt ( dx * dx + dy * dy ) ; theta = Math . atan2 ( dy , dx ) + angle ; dx = r * Math . cos ( theta ) + oldcx ; dy = r * Math . sin ( theta ) + oldcy ; dx -= newcx ;
dy -= newcy ; r = Math . sqrt ( dx * dx + dy * dy ) ; theta = Math . atan2 ( dy , dx ) - angle ; return { x : ( r * Math . cos ( theta ) + newcx ) / 1 , y : ( r * Math . sin ( theta ) + newcy ) / 1 } } ; svgedit . path . recalcRotatedPath = function ( ) { var f = svgedit . path . path . elem , d = svgedit . utilities . getRotationAngle ( f , true ) ; if ( d ) { var l = svgedit . utilities . getBBox ( f ) , o = svgedit . path . path . oldbbox , A = o . x + o . width / 2 , p = o . y + o . height / 2 ; o = l . x + l . width / 2 ; l = l . y + l . height / 2 ; o = o - A ; var K = l - p ; l = Math . sqrt ( o * o + K * K ) ; K = Math . atan2 ( K , o ) + d ; o = l * Math . cos ( K ) + A ; l = l * Math . sin ( K ) + p ; A = f . pathSegList ; for ( p = A . numberOfItems ; p ; ) { p -=
1 ; K = A . getItem ( p ) ; var Q = K . pathSegType ; if ( Q != 1 ) { var N = c ( K . x , K . y ) ; N = [ N . x , N . y ] ; if ( K . x1 != null && K . x2 != null ) { c _vals1 = c ( K . x1 , K . y1 ) ; c _vals2 = c ( K . x2 , K . y2 ) ; N . splice ( N . length , 0 , c _vals1 . x , c _vals1 . y , c _vals2 . x , c _vals2 . y ) } svgedit . path . replacePathSeg ( Q , p , N ) } } svgedit . utilities . getBBox ( f ) ; A = svgroot . createSVGTransform ( ) ; f = svgedit . transformlist . getTransformList ( f ) ; A . setRotate ( d * 180 / Math . PI , o , l ) ; f . replaceItem ( A , 0 ) } } ; svgedit . path . clearData = function ( ) { m = { } } } ) ( ) ; if ( ! window . console ) { window . console = { } ; window . console . log = function ( ) { } ; window . console . dir = function ( ) { } } if ( window . opera ) { window . console . log = function ( a ) { opera . postError ( a ) } ; window . console . dir = function ( ) { } }
( function ( ) { var a = jQuery . fn . attr ; jQuery . fn . attr = function ( n , g ) { var b = this . length ; if ( ! b ) return a . apply ( this , arguments ) ; for ( var m = 0 ; m < b ; m ++ ) { var s = this [ m ] ; if ( s . namespaceURI === "http://www.w3.org/2000/svg" ) if ( g !== undefined ) s . setAttribute ( n , g ) ; else if ( $ . isArray ( n ) ) { b = n . length ; for ( m = { } ; b -- ; ) { var c = n [ b ] , f = s . getAttribute ( c ) ; if ( f || f === "0" ) f = isNaN ( f ) ? f : f - 0 ; m [ c ] = f } return m } else if ( typeof n === "object" ) for ( c in n ) s . setAttribute ( c , n [ c ] ) ; else { if ( ( f = s . getAttribute ( n ) ) || f === "0" ) f = isNaN ( f ) ? f : f - 0 ; return f } else return a . apply ( this ,
2012-07-14 20:36:17 +00:00
arguments ) } return this } } ) ( ) ;
2012-07-24 02:30:12 +00:00
$ . SvgCanvas = function ( a , n ) { function g ( e , h ) { for ( var k = svgedit . utilities . getBBox ( e ) , w = 0 ; w < 2 ; w ++ ) { var v = w === 0 ? "fill" : "stroke" , F = e . getAttribute ( v ) ; if ( F && F . indexOf ( "url(" ) === 0 ) { F = fa ( F ) ; if ( F . tagName === "linearGradient" ) { var z = F . getAttribute ( "x1" ) || 0 , u = F . getAttribute ( "y1" ) || 0 , B = F . getAttribute ( "x2" ) || 1 , G = F . getAttribute ( "y2" ) || 0 ; z = k . width * z + k . x ; u = k . height * u + k . y ; B = k . width * B + k . x ; G = k . height * G + k . y ; z = O ( z , u , h ) ; G = O ( B , G , h ) ; B = { } ; B . x1 = ( z . x - k . x ) / k . width ; B . y1 = ( z . y - k . y ) / k . height ; B . x2 = ( G . x - k . x ) / k . width ; B . y2 = ( G . y - k . y ) / k . height ;
F = F . cloneNode ( true ) ; $ ( F ) . attr ( B ) ; F . id = R ( ) ; wb ( ) . appendChild ( F ) ; e . setAttribute ( v , "url(#" + F . id + ")" ) } } } } var b = "http://www.w3.org/2000/svg" , m = { show _outside _canvas : true , selectNew : true , dimensions : [ 640 , 480 ] } ; n && $ . extend ( m , n ) ; var s = m . dimensions , c = this , f = a . ownerDocument , d = f . importNode ( svgedit . utilities . text2xml ( '<svg id="svgroot" xmlns="' + b + '" xlinkns="http://www.w3.org/1999/xlink" width="' + s [ 0 ] + '" height="' + s [ 1 ] + '" x="' + s [ 0 ] + '" y="' + s [ 1 ] + '" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>' ) . documentElement ,
true ) ; a . appendChild ( d ) ; var l = f . createElementNS ( b , "svg" ) ; ( c . clearSvgContentElement = function ( ) { for ( ; l . firstChild ; ) l . removeChild ( l . firstChild ) ; $ ( l ) . attr ( { id : "svgcontent" , width : s [ 0 ] , height : s [ 1 ] , x : s [ 0 ] , y : s [ 1 ] , overflow : m . show _outside _canvas ? "visible" : "hidden" , xmlns : b , "xmlns:se" : "http://svg-edit.googlecode.com" , "xmlns:xlink" : "http://www.w3.org/1999/xlink" } ) . appendTo ( d ) ; var e = f . createComment ( " Created with Method Draw - http://github.com/duopixel/Method-Draw/ " ) ; l . appendChild ( e ) } ) ( ) ; var o = "svg_" ; c . setIdPrefix =
function ( e ) { o = e } ; c . current _drawing _ = new svgedit . draw . Drawing ( l , o ) ; var A = c . getCurrentDrawing = function ( ) { return c . current _drawing _ } , p = 1 , K = null , Q = { shape : { fill : ( m . initFill . color == "none" ? "" : "#" ) + m . initFill . color , fill _paint : null , fill _opacity : m . initFill . opacity , stroke : "#" + m . initStroke . color , stroke _paint : null , stroke _opacity : m . initStroke . opacity , stroke _width : m . initStroke . width , stroke _dasharray : "none" , stroke _linejoin : "miter" , stroke _linecap : "butt" , opacity : m . initOpacity } } ; Q . text = $ . extend ( true , { } , Q . shape ) ; $ . extend ( Q . text ,
{ fill : "#000000" , stroke _width : 0 , font _size : 24 , font _family : "Junction" } ) ; var N = Q . shape , H = Array ( 1 ) , S = this . addSvgElementFromJson = function ( e ) { var h = svgedit . utilities . getElem ( e . attr . id ) , k = A ( ) . getCurrentLayer ( ) ; if ( h && e . element != h . tagName ) { k . removeChild ( h ) ; h = null } if ( ! h ) { h = f . createElementNS ( b , e . element ) ; if ( k ) ( K || k ) . appendChild ( h ) } e . curStyles && svgedit . utilities . assignAttributes ( h , { fill : N . fill , stroke : N . stroke , "stroke-width" : N . stroke _width , "stroke-dasharray" : N . stroke _dasharray , "stroke-linejoin" : N . stroke _linejoin ,
"stroke-linecap" : N . stroke _linecap , "stroke-opacity" : N . stroke _opacity , "fill-opacity" : N . fill _opacity , opacity : N . opacity / 2 , style : "pointer-events:inherit" } , 100 ) ; svgedit . utilities . assignAttributes ( h , e . attr , 100 ) ; svgedit . utilities . cleanupElement ( h ) ; return h } , ba = c . getTransformList = svgedit . transformlist . getTransformList , O = svgedit . math . transformPoint , T = c . matrixMultiply = svgedit . math . matrixMultiply , ha = c . hasMatrixTransform = svgedit . math . hasMatrixTransform , U = c . transformListToTransform = svgedit . math . transformListToTransform ,
P = svgedit . math . snapToAngle , aa = svgedit . math . getMatrix ; svgedit . units . init ( { getBaseUnit : function ( ) { return m . baseUnit } , getElement : svgedit . utilities . getElem , getHeight : function ( ) { return l . getAttribute ( "height" ) / p } , getWidth : function ( ) { return l . getAttribute ( "width" ) / p } , getRoundDigits : function ( ) { return hb . round _digits } } ) ; var wa = c . convertToNum = svgedit . units . convertToNum ; svgedit . utilities . init ( { getDOMDocument : function ( ) { return f } , getDOMContainer : function ( ) { return a } , getSVGRoot : function ( ) { return d } , getSelectedElements : function ( ) { return H } ,
getSVGContent : function ( ) { return l } } ) ; var ja = c . getUrlFromAttr = svgedit . utilities . getUrlFromAttr , ea = c . getHref = svgedit . utilities . getHref , Z = c . setHref = svgedit . utilities . setHref , Y = svgedit . utilities . getPathBBox ; c . getBBox = svgedit . utilities . getBBox ; var la = c . getRotationAngle = svgedit . utilities . getRotationAngle , ua = c . getElem = svgedit . utilities . getElem , pa = c . assignAttributes = svgedit . utilities . assignAttributes , qa = this . cleanupElement = svgedit . utilities . cleanupElement , Ha = svgedit . sanitize . getNSMap ( ) , Ma = c . sanitizeSvg = svgedit . sanitize . sanitizeSvg ,
Oa = svgedit . history . MoveElementCommand , Ja = svgedit . history . InsertElementCommand , Qa = svgedit . history . RemoveElementCommand , Va = svgedit . history . ChangeElementCommand , Na = svgedit . history . BatchCommand ; c . undoMgr = new svgedit . history . UndoManager ( { handleHistoryEvent : function ( e , h ) { var k = svgedit . history . HistoryEventTypes ; if ( e == k . BEFORE _UNAPPLY || e == k . BEFORE _APPLY ) c . clearSelection ( ) ; else if ( e == k . AFTER _APPLY || e == k . AFTER _UNAPPLY ) { var w = h . elements ( ) ; c . pathActions . clear ( ) ; L ( "changed" , w ) ; w = h . type ( ) ; k = e == k . AFTER _APPLY ; if ( w ==
Oa . type ( ) ) { k = k ? h . newParent : h . oldParent ; k == l && c . identifyLayers ( ) } else if ( w == Ja . type ( ) || w == Qa . type ( ) ) { h . parent == l && c . identifyLayers ( ) ; if ( w == Ja . type ( ) ) k && Pa ( h . elem ) ; else k || Pa ( h . elem ) ; h . elem . tagName === "use" && Sb ( h . elem ) } else if ( w == Va . type ( ) ) { h . elem . tagName == "title" && h . elem . parentNode . parentNode == l && c . identifyLayers ( ) ; k = k ? h . newValues : h . oldValues ; k . stdDeviation && c . setBlurOffsets ( h . elem . parentNode , k . stdDeviation ) ; if ( h . elem . tagName === "use" && svgedit . browser . isWebkit ( ) ) { w = h . elem ; if ( ! w . getAttribute ( "x" ) && ! w . getAttribute ( "y" ) ) { k =
w . parentNode ; var v = w . nextSibling ; k . removeChild ( w ) ; k . insertBefore ( w , v ) } } } } } } ) ; var Aa = function ( e ) { c . undoMgr . addCommandToHistory ( e ) } ; svgedit . select . init ( m , { createSVGElement : function ( e ) { return c . addSvgElementFromJson ( e ) } , svgRoot : function ( ) { return d } , svgContent : function ( ) { return l } , currentZoom : function ( ) { return p } , getStrokedBBox : function ( e ) { return c . getStrokedBBox ( [ e ] ) } } ) ; var La = this . selectorManager = svgedit . select . getSelectorManager ( ) , zb = this . hoverManager = svgedit . select . getSelectorManager ( ) ; svgedit . path . init ( { getCurrentZoom : function ( ) { return p } ,
getSVGRoot : function ( ) { return d } } ) ; svgedit . utilities . snapToGrid = function ( e ) { var h = m . snappingStep , k = m . baseUnit ; if ( k !== "px" ) h *= svgedit . units . getTypeMap ( ) [ k ] ; return e = Math . round ( e / h ) * h } ; var Ea = svgedit . utilities . snapToGrid , yb = { exportNoBlur : "Blurred elements will appear as un-blurred" , exportNoforeignObject : "foreignObject elements will not appear" , exportNoDashArray : "Strokes will appear filled" , exportNoText : "Text may not appear as expected" } , qb = [ "clip-path" , "fill" , "filter" , "marker-end" , "marker-mid" , "marker-start" ,
"mask" , "stroke" ] , $a = $ . data , Pa = function ( e ) { var h = $ ( e ) . attr ( qb ) , k ; for ( k in h ) { var w = h [ k ] ; if ( w && w . indexOf ( "url(" ) === 0 ) { w = ja ( w ) . substr ( 1 ) ; if ( ! ua ( w ) ) { wb ( ) . appendChild ( Cb [ w ] ) ; delete Cb [ w ] } } } e = e . getElementsByTagName ( "*" ) ; if ( e . length ) { h = 0 ; for ( k = e . length ; h < k ; h ++ ) Pa ( e [ h ] ) } } , Ia = { } , Ca = m . imgPath + "logo.png" , jb = [ ] , hb = { round _digits : 5 } , Ra = false , db = null , Ka = "select" , sb = "none" , tb = { } , nb = Q . text , fb = N , Za = null , Ta = null , ib = [ ] , Ib = { } , Cb = { } ; c . clipBoard = [ ] ; var kb = this . runExtensions = function ( e , h , k ) { var w = false ; if ( k ) w = [ ] ; $ . each ( Ib ,
function ( v , F ) { if ( e in F ) if ( k ) w . push ( F [ e ] ( h ) ) ; else w = F [ e ] ( h ) } ) ; return w } ; this . addExtension = function ( e , h ) { if ( e in Ib ) console . log ( 'Cannot add extension "' + e + '", an extension by that name already exists"' ) ; else { var k = $ . isFunction ( h ) ? h ( $ . extend ( c . getPrivateMethods ( ) , { svgroot : d , svgcontent : l , nonce : A ( ) . getNonce ( ) , selectorManager : La , hoverManager : zb } ) ) : h ; Ib [ e ] = k ; L ( "extension_added" , k ) } } ; var vb = this . round = function ( e ) { return parseInt ( e * p ) / p } , Gb = this . getIntersectionList = function ( e ) { if ( Ta == null ) return null ; var h =
K || A ( ) . getCurrentLayer ( ) ; ib . length || ( ib = Jb ( h ) ) ; var k = null ; try { k = h . getIntersectionList ( e , null ) } catch ( w ) { } if ( k == null || typeof k . item != "function" ) { k = [ ] ; if ( e ) e = e ; else { e = Ta . getBBox ( ) ; h = { } ; for ( var v in e ) h [ v ] = e [ v ] / p ; e = h } for ( v = ib . length ; v -- ; ) e . width && e . width && svgedit . math . rectsIntersect ( e , ib [ v ] . bbox ) && k . push ( ib [ v ] . elem ) } return k } ; getStrokedBBox = this . getStrokedBBox = function ( e ) { e || ( e = Ab ( ) ) ; if ( ! e . length ) return false ; var h = function ( G ) { try { var C = svgedit . utilities . getBBox ( G ) , D = svgedit . utilities . getRotationAngle ( G ) ;
if ( D && D % 90 || svgedit . math . hasMatrixTransform ( svgedit . transformlist . getTransformList ( G ) ) ) { D = false ; if ( [ "ellipse" , "path" , "line" , "polyline" , "polygon" ] . indexOf ( G . tagName ) >= 0 ) C = D = c . convertToPath ( G , true ) ; else if ( G . tagName == "rect" ) { var J = G . getAttribute ( "rx" ) , I = G . getAttribute ( "ry" ) ; if ( J || I ) C = D = c . convertToPath ( G , true ) } if ( ! D ) { var W = G . cloneNode ( true ) , X = document . createElementNS ( b , "g" ) , da = G . parentNode ; da . appendChild ( X ) ; X . appendChild ( W ) ; C = svgedit . utilities . bboxToObj ( X . getBBox ( ) ) ; da . removeChild ( X ) } } return C } catch ( ra ) { console . log ( G ,
ra ) ; return null } } , k ; $ . each ( e , function ( ) { if ( ! k ) if ( this . parentNode ) k = h ( this ) } ) ; if ( k == null ) return null ; var w = k . x + k . width , v = k . y + k . height , F = k . x , z = k . y , u = function ( G ) { var C = G . getAttribute ( "stroke-width" ) , D = 0 ; if ( G . getAttribute ( "stroke" ) != "none" && ! isNaN ( C ) ) D += C / 2 ; return D } , B = [ ] ; $ . each ( e , function ( G , C ) { var D = h ( C ) ; if ( D ) { var J = u ( C ) ; F = Math . min ( F , D . x - J ) ; z = Math . min ( z , D . y - J ) ; B . push ( D ) } } ) ; k . x = F ; k . y = z ; $ . each ( e , function ( G , C ) { var D = B [ G ] ; if ( D && C . nodeType == 1 ) { var J = u ( C ) ; w = Math . max ( w , D . x + D . width + J ) ; v = Math . max ( v , D . y + D . height +
J ) } } ) ; k . width = w - F ; k . height = v - z ; return k } ; var Ab = this . getVisibleElements = function ( e ) { e || ( e = $ ( l ) . children ( ) ) ; e . find ( "#canvas_background" ) . length && e . splice ( 0 , 1 ) ; var h = [ ] ; $ ( e ) . children ( ) . each ( function ( k , w ) { try { w . getBBox ( ) && h . push ( w ) } catch ( v ) { } } ) ; return h . reverse ( ) } , Jb = this . getVisibleElementsAndBBoxes = function ( e ) { e || ( e = $ ( l ) . children ( ) ) ; var h = [ ] ; $ ( e ) . children ( ) . each ( function ( k , w ) { try { w . getBBox ( ) && h . push ( { elem : w , bbox : getStrokedBBox ( [ w ] ) } ) } catch ( v ) { } } ) ; return h . reverse ( ) } , oa = this . groupSvgElem = function ( e ) { var h =
document . createElementNS ( b , "g" ) ; e . parentNode . replaceChild ( h , e ) ; $ ( h ) . append ( e ) . data ( "gsvg" , e ) [ 0 ] . id = R ( ) } , ga = function ( e ) { var h = document . createElementNS ( e . namespaceURI , e . nodeName ) ; h . removeAttribute ( "id" ) ; $ . each ( e . attributes , function ( w , v ) { v . localName != "-moz-math-font-style" && h . setAttributeNS ( v . namespaceURI , v . nodeName , v . nodeValue ) } ) ; if ( svgedit . browser . isWebkit ( ) && e . nodeName == "path" ) { var k = Sa . convertPath ( e ) ; h . setAttribute ( "d" , k ) } $ . each ( e . childNodes , function ( w , v ) { switch ( v . nodeType ) { case 1 : h . appendChild ( ga ( v ) ) ;
break ; case 3 : h . textContent = v . nodeValue } } ) ; if ( $ ( e ) . data ( "gsvg" ) ) $ ( h ) . data ( "gsvg" , h . firstChild ) ; else if ( $ ( e ) . data ( "symbol" ) ) { e = $ ( e ) . data ( "symbol" ) ; $ ( h ) . data ( "ref" , e ) . data ( "symbol" , e ) } else h . tagName == "image" && Tb ( h ) ; h . id = R ( ) ; return h } , sa , R , L ; ( function ( e ) { var h = { } ; sa = e . getId = function ( ) { return A ( ) . getId ( ) } ; R = e . getNextId = function ( ) { return A ( ) . getNextId ( ) } ; L = e . call = function ( k , w ) { if ( h [ k ] ) return h [ k ] ( this , w ) } ; e . bind = function ( k , w ) { var v = h [ k ] ; h [ k ] = w ; return v } } ) ( c ) ; this . prepareSvg = function ( e ) { this . sanitizeSvg ( e . documentElement ) ;
e = e . getElementsByTagNameNS ( b , "path" ) ; for ( var h = 0 , k = e . length ; h < k ; ++ h ) { var w = e [ h ] ; w . setAttribute ( "d" , Sa . convertPath ( w ) ) ; Sa . fixEnd ( w ) } } ; var fa = this . getRefElem = function ( e ) { return ua ( ja ( e ) . substr ( 1 ) ) } , Fa = function ( e ) { if ( ! svgedit . browser . isGecko ( ) ) return e ; var h = e . cloneNode ( true ) ; e . parentNode . insertBefore ( h , e ) ; e . parentNode . removeChild ( e ) ; La . releaseSelector ( e ) ; H [ 0 ] = h ; La . requestSelector ( h ) . showGrips ( true ) ; return h } ; this . setRotationAngle = function ( e , h ) { e = parseFloat ( e ) ; var k = H [ 0 ] , w = k . getAttribute ( "transform" ) ,
v = svgedit . utilities . getBBox ( k ) , F = v . x + v . width / 2 , z = v . y + v . height / 2 ; v = ba ( k ) ; v . numberOfItems > 0 && v . getItem ( 0 ) . type == 4 && v . removeItem ( 0 ) ; if ( e != 0 ) { F = O ( F , z , U ( v ) . matrix ) ; z = d . createSVGTransform ( ) ; z . setRotate ( e , F . x , F . y ) ; v . numberOfItems ? v . insertItemBefore ( z , 0 ) : v . appendItem ( z ) } else v . numberOfItems == 0 && k . removeAttribute ( "transform" ) ; if ( ! h ) { v = k . getAttribute ( "transform" ) ; k . setAttribute ( "transform" , w ) ; ob ( "transform" , v , H ) ; L ( "changed" , H ) } ua ( "pathpointgrip_container" ) ; k = La . requestSelector ( H [ 0 ] ) ; k . resize ( ) ; k . updateGripCursors ( e ) } ;
var Xa = this . recalculateAllSelectedDimensions = function ( ) { for ( var e = new Na ( sb == "none" ? "position" : "size" ) , h = H . length ; h -- ; ) { var k = lb ( H [ h ] ) ; k && e . addSubCommand ( k ) } if ( ! e . isEmpty ( ) ) { Aa ( e ) ; L ( "changed" , H ) } } , cb = [ 0 , "z" , "M" , "m" , "L" , "l" , "C" , "c" , "Q" , "q" , "A" , "a" , "H" , "h" , "V" , "v" , "S" , "s" , "T" , "t" ] , rb = function ( e ) { console . log ( [ e . a , e . b , e . c , e . d , e . e , e . f ] ) } , ub = this . remapElement = function ( e , h , k ) { var w = m . gridSnapping && e . parentNode . parentNode . localName === "svg" , v = function ( ) { if ( w ) for ( var D in h ) h [ D ] = Ea ( h [ D ] ) ; pa ( e , h , 1E3 , true ) } ;
box = svgedit . utilities . getBBox ( e ) ; for ( var F = 0 ; F < 2 ; F ++ ) { var z = F === 0 ? "fill" : "stroke" , u = e . getAttribute ( z ) ; if ( u && u . indexOf ( "url(" ) === 0 ) if ( k . a < 0 || k . d < 0 ) { u = fa ( u ) . cloneNode ( true ) ; if ( k . a < 0 ) { var B = u . getAttribute ( "x1" ) , G = u . getAttribute ( "x2" ) ; u . setAttribute ( "x1" , - ( B - 1 ) ) ; u . setAttribute ( "x2" , - ( G - 1 ) ) } if ( k . d < 0 ) { B = u . getAttribute ( "y1" ) ; G = u . getAttribute ( "y2" ) ; u . setAttribute ( "y1" , - ( B - 1 ) ) ; u . setAttribute ( "y2" , - ( G - 1 ) ) } u . id = R ( ) ; wb ( ) . appendChild ( u ) ; e . setAttribute ( z , "url(#" + u . id + ")" ) } } F = e . tagName ; if ( F === "g" || F === "text" || F ===
"use" ) if ( k . a == 1 && k . b == 0 && k . c == 0 && k . d == 1 && ( k . e != 0 || k . f != 0 ) ) { z = U ( e ) . matrix ; z = T ( z . inverse ( ) , k , z ) ; h . x = parseFloat ( h . x ) + z . e ; h . y = parseFloat ( h . y ) + z . f } else { z = ba ( e ) ; u = d . createSVGTransform ( ) ; u . setMatrix ( T ( U ( z ) . matrix , k ) ) ; z . clear ( ) ; z . appendItem ( u ) } switch ( F ) { case "foreignObject" : case "rect" : case "image" : if ( F === "image" && ( k . a < 0 || k . d < 0 ) ) { z = ba ( e ) ; u = d . createSVGTransform ( ) ; u . setMatrix ( T ( U ( z ) . matrix , k ) ) ; z . clear ( ) ; z . appendItem ( u ) } else { z = O ( h . x , h . y , k ) ; h . width = k . a * h . width ; h . height = k . d * h . height ; h . x = z . x + Math . min ( 0 , h . width ) ;
h . y = z . y + Math . min ( 0 , h . height ) ; h . width = Math . abs ( h . width ) ; h . height = Math . abs ( h . height ) } v ( ) ; break ; case "ellipse" : F = O ( h . cx , h . cy , k ) ; h . cx = F . x ; h . cy = F . y ; h . rx = k . a * h . rx ; h . ry = k . d * h . ry ; h . rx = Math . abs ( h . rx ) ; h . ry = Math . abs ( h . ry ) ; v ( ) ; break ; case "circle" : F = O ( h . cx , h . cy , k ) ; h . cx = F . x ; h . cy = F . y ; F = svgedit . math . transformBox ( box . x , box . y , box . width , box . height , k ) ; h . r = Math . min ( ( F . tr . x - F . tl . x ) / 2 , ( F . bl . y - F . tl . y ) / 2 ) ; if ( h . r ) h . r = Math . abs ( h . r ) ; v ( ) ; break ; case "line" : z = O ( h . x1 , h . y1 , k ) ; B = O ( h . x2 , h . y2 , k ) ; h . x1 = z . x ; h . y1 = z . y ; h . x2 = B . x ; h . y2 = B . y ;
case "text" : k = e . querySelectorAll ( "tspan" ) ; for ( F = k . length ; F -- ; ) { z = wa ( "x" , e . getAttribute ( "x" ) ) ; u = wa ( "x" , k [ F ] . getAttribute ( "x" ) ) ; B = wa ( "y" , e . getAttribute ( "y" ) ) ; G = wa ( "y" , k [ F ] . getAttribute ( "y" ) ) ; var C = { } ; if ( ! isNaN ( z ) && ! isNaN ( u ) && z != 0 && u != 0 && h . x ) C . x = h . x - ( z - u ) ; if ( ! isNaN ( B ) && ! isNaN ( G ) && B != 0 && G != 0 && h . y ) C . y = h . y - ( B - G ) ; if ( C . x || C . y ) pa ( k [ F ] , C , 1E3 , true ) } v ( ) ; break ; case "use" : v ( ) ; break ; case "g" : ( v = $ ( e ) . data ( "gsvg" ) ) && pa ( v , h , 1E3 , true ) ; break ; case "polyline" : case "polygon" : v = h . points . length ; for ( F = 0 ; F < v ; ++ F ) { G = h . points [ F ] ;
G = O ( G . x , G . y , k ) ; h . points [ F ] . x = G . x ; h . points [ F ] . y = G . y } v = h . points . length ; k = "" ; for ( F = 0 ; F < v ; ++ F ) { G = h . points [ F ] ; k += G . x + "," + G . y + " " } e . setAttribute ( "points" , k ) ; break ; case "path" : z = e . pathSegList ; v = z . numberOfItems ; h . d = Array ( v ) ; for ( F = 0 ; F < v ; ++ F ) { u = z . getItem ( F ) ; h . d [ F ] = { type : u . pathSegType , x : u . x , y : u . y , x1 : u . x1 , y1 : u . y1 , x2 : u . x2 , y2 : u . y2 , r1 : u . r1 , r2 : u . r2 , angle : u . angle , largeArcFlag : u . largeArcFlag , sweepFlag : u . sweepFlag } } v = h . d . length ; F = h . d [ 0 ] ; C = O ( F . x , F . y , k ) ; h . d [ 0 ] . x = C . x ; h . d [ 0 ] . y = C . y ; for ( F = 1 ; F < v ; ++ F ) { u = h . d [ F ] ; z = u . type ; if ( z %
2 == 0 ) { G = O ( u . x != undefined ? u . x : C . x , u . y != undefined ? u . y : C . y , k ) ; z = O ( u . x1 , u . y1 , k ) ; B = O ( u . x2 , u . y2 , k ) ; u . x = G . x ; u . y = G . y ; u . x1 = z . x ; u . y1 = z . y ; u . x2 = B . x ; u . y2 = B . y } else { u . x = k . a * u . x ; u . y = k . d * u . y ; u . x1 = k . a * u . x1 ; u . y1 = k . d * u . y1 ; u . x2 = k . a * u . x2 ; u . y2 = k . d * u . y2 } u . r1 = k . a * u . r1 ; u . r2 = k . d * u . r2 } k = "" ; v = h . d . length ; for ( F = 0 ; F < v ; ++ F ) { u = h . d [ F ] ; z = u . type ; k += cb [ z ] ; switch ( z ) { case 13 : case 12 : k += u . x + " " ; break ; case 15 : case 14 : k += u . y + " " ; break ; case 3 : case 5 : case 19 : case 2 : case 4 : case 18 : k += u . x + "," + u . y + " " ; break ; case 7 : case 6 : k += u . x1 + "," + u . y1 + " " + u . x2 +
"," + u . y2 + " " + u . x + "," + u . y + " " ; break ; case 9 : case 8 : k += u . x1 + "," + u . y1 + " " + u . x + "," + u . y + " " ; break ; case 11 : case 10 : k += u . r1 + "," + u . r2 + " " + u . angle + " " + + u . largeArcFlag + " " + + u . sweepFlag + " " + u . x + "," + u . y + " " ; break ; case 17 : case 16 : k += u . x2 + "," + u . y2 + " " + u . x + "," + u . y + " " } } e . setAttribute ( "d" , k ) } } , Bb = function ( e , h , k ) { e = fa ( e ) . firstChild ; var w = ba ( e ) , v = d . createSVGTransform ( ) ; v . setTranslate ( h , k ) ; w . appendItem ( v ) ; lb ( e ) } , lb = this . recalculateDimensions = function ( e ) { if ( e == null ) return null ; var h = ba ( e ) ; if ( h && h . numberOfItems > 0 ) { for ( var k =
h . numberOfItems ; k -- ; ) { var w = h . getItem ( k ) ; if ( w . type === 0 ) h . removeItem ( k ) ; else if ( w . type === 1 ) svgedit . math . isIdentity ( w . matrix ) && h . removeItem ( k ) ; else w . type === 4 && w . angle === 0 && h . removeItem ( k ) } if ( h . numberOfItems === 1 && la ( e ) ) return null } if ( ! h || h . numberOfItems == 0 ) { e . removeAttribute ( "transform" ) ; return null } if ( h ) { k = h . numberOfItems ; for ( var v = [ ] ; k -- ; ) { w = h . getItem ( k ) ; if ( w . type === 1 ) v . push ( [ w . matrix , k ] ) ; else if ( v . length ) v = [ ] } if ( v . length === 2 ) { k = d . createSVGTransformFromMatrix ( T ( v [ 1 ] [ 0 ] , v [ 0 ] [ 0 ] ) ) ; h . removeItem ( v [ 0 ] [ 1 ] ) ;
h . removeItem ( v [ 1 ] [ 1 ] ) ; h . insertItemBefore ( k , v [ 1 ] [ 1 ] ) } k = h . numberOfItems ; if ( k >= 2 && h . getItem ( k - 2 ) . type === 1 && h . getItem ( k - 1 ) . type === 2 ) { v = d . createSVGTransform ( ) ; w = T ( h . getItem ( k - 2 ) . matrix , h . getItem ( k - 1 ) . matrix ) ; v . setMatrix ( w ) ; h . removeItem ( k - 2 ) ; h . removeItem ( k - 2 ) ; h . appendItem ( v ) } } switch ( e . tagName ) { case "line" : case "polyline" : case "polygon" : case "path" : break ; default : if ( h . numberOfItems === 1 && h . getItem ( 0 ) . type === 1 || h . numberOfItems === 2 && h . getItem ( 0 ) . type === 1 && h . getItem ( 0 ) . type === 4 ) return null } var F = $ ( e ) . data ( "gsvg" ) ;
k = new Na ( "Transform" ) ; var z = { } , u = null ; w = [ ] ; switch ( e . tagName ) { case "line" : w = [ "x1" , "y1" , "x2" , "y2" ] ; break ; case "circle" : w = [ "cx" , "cy" , "r" ] ; break ; case "ellipse" : w = [ "cx" , "cy" , "rx" , "ry" ] ; break ; case "foreignObject" : case "rect" : case "image" : w = [ "width" , "height" , "x" , "y" ] ; break ; case "use" : case "text" : case "tspan" : w = [ "x" , "y" ] ; break ; case "polygon" : case "polyline" : u = { } ; u . points = e . getAttribute ( "points" ) ; v = e . points ; var B = v . numberOfItems ; z . points = Array ( B ) ; for ( var G = 0 ; G < B ; ++ G ) { var C = v . getItem ( G ) ; z . points [ G ] = { x : C . x ,
y : C . y } } break ; case "path" : u = { } ; u . d = e . getAttribute ( "d" ) ; z . d = e . getAttribute ( "d" ) } if ( w . length ) { z = $ ( e ) . attr ( w ) ; $ . each ( z , function ( ia , ta ) { z [ ia ] = wa ( ia , ta ) } ) } else if ( F ) z = { x : $ ( F ) . attr ( "x" ) || 0 , y : $ ( F ) . attr ( "y" ) || 0 } ; if ( u == null ) { u = $ . extend ( true , { } , z ) ; $ . each ( u , function ( ia , ta ) { u [ ia ] = wa ( ia , ta ) } ) } u . transform = db ? db : "" ; if ( e . tagName == "g" && ! F || e . tagName == "a" ) { v = svgedit . utilities . getBBox ( e ) ; var D = { x : v . x + v . width / 2 , y : v . y + v . height / 2 } , J = O ( v . x + v . width / 2 , v . y + v . height / 2 , U ( h ) . matrix ) ; w = d . createSVGMatrix ( ) ; if ( v = la ( e ) ) { G = v * Math . PI /
180 ; B = Math . abs ( G ) > 1.0 E - 10 ? Math . sin ( G ) / ( 1 - Math . cos ( G ) ) : 2 / G ; for ( G = 0 ; G < h . numberOfItems ; ++ G ) { w = h . getItem ( G ) ; if ( w . type == 4 ) { w = w . matrix ; D . y = ( B * w . e + w . f ) / 2 ; D . x = ( w . e - B * w . f ) / 2 ; h . removeItem ( G ) ; break } } } G = w = F = 0 ; var I = h . numberOfItems ; if ( I ) var W = h . getItem ( 0 ) . matrix ; if ( I >= 3 && h . getItem ( I - 2 ) . type == 3 && h . getItem ( I - 3 ) . type == 2 && h . getItem ( I - 1 ) . type == 2 ) { G = 3 ; var X = h . getItem ( I - 3 ) . matrix , da = h . getItem ( I - 2 ) . matrix , ra = h . getItem ( I - 1 ) . matrix ; B = e . childNodes ; for ( C = B . length ; C -- ; ) { var va = B . item ( C ) ; w = F = 0 ; if ( va . nodeType == 1 ) { var ka = ba ( va ) ;
if ( ka ) { w = U ( ka ) . matrix ; F = la ( va ) ; var na = db , q = [ ] ; db = va . getAttribute ( "transform" ) ; if ( F || ha ( ka ) ) { var E = d . createSVGTransform ( ) ; E . setMatrix ( T ( X , da , ra , w ) ) ; ka . clear ( ) ; ka . appendItem ( E ) ; q . push ( E ) } else { F = T ( w . inverse ( ) , ra , w ) ; E = d . createSVGMatrix ( ) ; E . e = - F . e ; E . f = - F . f ; w = T ( E . inverse ( ) , w . inverse ( ) , X , da , ra , w , F . inverse ( ) ) ; var M = d . createSVGTransform ( ) , V = d . createSVGTransform ( ) , ca = d . createSVGTransform ( ) ; M . setTranslate ( F . e , F . f ) ; V . setScale ( w . a , w . d ) ; ca . setTranslate ( E . e , E . f ) ; ka . appendItem ( ca ) ; ka . appendItem ( V ) ; ka . appendItem ( M ) ;
q . push ( ca ) ; q . push ( V ) ; q . push ( M ) } k . addSubCommand ( lb ( va ) ) ; db = na } } } h . removeItem ( I - 1 ) ; h . removeItem ( I - 2 ) ; h . removeItem ( I - 3 ) } else if ( I >= 3 && h . getItem ( I - 1 ) . type == 1 ) { G = 3 ; w = U ( h ) . matrix ; E = d . createSVGTransform ( ) ; E . setMatrix ( w ) ; h . clear ( ) ; h . appendItem ( E ) } else if ( ( I == 1 || I > 1 && h . getItem ( 1 ) . type != 3 ) && h . getItem ( 0 ) . type == 2 ) { G = 2 ; F = U ( h ) . matrix ; h . removeItem ( 0 ) ; w = U ( h ) . matrix . inverse ( ) ; w = T ( w , F ) ; F = w . e ; w = w . f ; if ( F != 0 || w != 0 ) { B = e . childNodes ; C = B . length ; for ( I = [ ] ; C -- ; ) { va = B . item ( C ) ; if ( va . nodeType == 1 ) { if ( va . getAttribute ( "clip-path" ) ) { na =
va . getAttribute ( "clip-path" ) ; if ( I . indexOf ( na ) === - 1 ) { Bb ( na , F , w ) ; I . push ( na ) } } na = db ; db = va . getAttribute ( "transform" ) ; if ( ka = ba ( va ) ) { X = d . createSVGTransform ( ) ; X . setTranslate ( F , w ) ; ka . numberOfItems ? ka . insertItemBefore ( X , 0 ) : ka . appendItem ( X ) ; k . addSubCommand ( lb ( va ) ) ; ka = e . getElementsByTagNameNS ( b , "use" ) ; va = "#" + va . id ; for ( X = ka . length ; X -- ; ) { da = ka . item ( X ) ; if ( va == ea ( da ) ) { ra = d . createSVGTransform ( ) ; ra . setTranslate ( - F , - w ) ; ba ( da ) . insertItemBefore ( ra , 0 ) ; k . addSubCommand ( lb ( da ) ) } } db = na } } } I = [ ] ; db = na } } else if ( I == 1 && h . getItem ( 0 ) . type ==
1 && ! v ) { G = 1 ; w = h . getItem ( 0 ) . matrix ; B = e . childNodes ; for ( C = B . length ; C -- ; ) { va = B . item ( C ) ; if ( va . nodeType == 1 ) { na = db ; db = va . getAttribute ( "transform" ) ; if ( ka = ba ( va ) ) { F = T ( w , U ( ka ) . matrix ) ; I = d . createSVGTransform ( ) ; I . setMatrix ( F ) ; ka . clear ( ) ; ka . appendItem ( I , 0 ) ; k . addSubCommand ( lb ( va ) ) ; db = na ; na = va . getAttribute ( "stroke-width" ) ; va . getAttribute ( "stroke" ) !== "none" && ! isNaN ( na ) && va . setAttribute ( "stroke-width" , na * ( ( Math . abs ( F . a ) + Math . abs ( F . d ) ) / 2 ) ) } } } h . clear ( ) } else { if ( v ) { D = d . createSVGTransform ( ) ; D . setRotate ( v , J . x , J . y ) ; h . numberOfItems ?
h . insertItemBefore ( D , 0 ) : h . appendItem ( D ) } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; return null } if ( G == 2 ) { if ( v ) { J = { x : D . x + W . e , y : D . y + W . f } ; D = d . createSVGTransform ( ) ; D . setRotate ( v , J . x , J . y ) ; h . numberOfItems ? h . insertItemBefore ( D , 0 ) : h . appendItem ( D ) } } else if ( G == 3 ) { w = U ( h ) . matrix ; W = d . createSVGTransform ( ) ; W . setRotate ( v , D . x , D . y ) ; W = W . matrix ; D = d . createSVGTransform ( ) ; D . setRotate ( v , J . x , J . y ) ; J = D . matrix . inverse ( ) ; na = w . inverse ( ) ; J = T ( na , J , W , w ) ; F = J . e ; w = J . f ; if ( F != 0 || w != 0 ) { B = e . childNodes ; for ( C = B . length ; C -- ; ) { va = B . item ( C ) ;
if ( va . nodeType == 1 ) { na = db ; db = va . getAttribute ( "transform" ) ; ka = ba ( va ) ; X = d . createSVGTransform ( ) ; X . setTranslate ( F , w ) ; ka . numberOfItems ? ka . insertItemBefore ( X , 0 ) : ka . appendItem ( X ) ; k . addSubCommand ( lb ( va ) ) ; db = na } } } if ( v ) h . numberOfItems ? h . insertItemBefore ( D , 0 ) : h . appendItem ( D ) } } else { v = svgedit . utilities . getBBox ( e ) ; if ( ! v && e . tagName != "path" ) return null ; w = d . createSVGMatrix ( ) ; if ( F = la ( e ) ) { D = { x : v . x + v . width / 2 , y : v . y + v . height / 2 } ; J = O ( v . x + v . width / 2 , v . y + v . height / 2 , U ( h ) . matrix ) ; G = F * Math . PI / 180 ; B = Math . abs ( G ) > 1.0 E - 10 ? Math . sin ( G ) /
( 1 - Math . cos ( G ) ) : 2 / G ; for ( G = 0 ; G < h . numberOfItems ; ++ G ) { w = h . getItem ( G ) ; if ( w . type == 4 ) { w = w . matrix ; D . y = ( B * w . e + w . f ) / 2 ; D . x = ( w . e - B * w . f ) / 2 ; h . removeItem ( G ) ; break } } } G = 0 ; I = h . numberOfItems ; if ( ! svgedit . browser . isWebkit ( ) ) if ( ( W = e . getAttribute ( "fill" ) ) && W . indexOf ( "url(" ) === 0 ) { W = fa ( W ) ; na = "pattern" ; if ( W . tagName !== na ) na = "gradient" ; if ( W . getAttribute ( na + "Units" ) === "userSpaceOnUse" ) { w = U ( h ) . matrix ; v = ba ( W ) ; v = U ( v ) . matrix ; w = T ( w , v ) ; v = "matrix(" + [ w . a , w . b , w . c , w . d , w . e , w . f ] . join ( "," ) + ")" ; W . setAttribute ( na + "Transform" , v ) } } if ( I >= 3 &&
h . getItem ( I - 2 ) . type == 3 && h . getItem ( I - 3 ) . type == 2 && h . getItem ( I - 1 ) . type == 2 ) { G = 3 ; w = U ( h , I - 3 , I - 1 ) . matrix ; h . removeItem ( I - 1 ) ; h . removeItem ( I - 2 ) ; h . removeItem ( I - 3 ) } else if ( I == 4 && h . getItem ( I - 1 ) . type == 1 ) { G = 3 ; w = U ( h ) . matrix ; E = d . createSVGTransform ( ) ; E . setMatrix ( w ) ; h . clear ( ) ; h . appendItem ( E ) ; w = d . createSVGMatrix ( ) } else if ( ( I == 1 || I > 1 && h . getItem ( 1 ) . type != 3 ) && h . getItem ( 0 ) . type == 2 ) { G = 2 ; W = h . getItem ( 0 ) . matrix ; na = U ( h , 1 ) . matrix ; v = na . inverse ( ) ; w = T ( v , W , na ) ; h . removeItem ( 0 ) } else if ( I == 1 && h . getItem ( 0 ) . type == 1 && ! F ) { w = U ( h ) . matrix ;
switch ( e . tagName ) { case "line" : z = $ ( e ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; case "polyline" : case "polygon" : z . points = e . getAttribute ( "points" ) ; if ( z . points ) { v = e . points ; B = v . numberOfItems ; z . points = Array ( B ) ; for ( G = 0 ; G < B ; ++ G ) { C = v . getItem ( G ) ; z . points [ G ] = { x : C . x , y : C . y } } } case "path" : z . d = e . getAttribute ( "d" ) ; G = 1 ; h . clear ( ) } } else { G = 4 ; if ( F ) { D = d . createSVGTransform ( ) ; D . setRotate ( F , J . x , J . y ) ; h . numberOfItems ? h . insertItemBefore ( D , 0 ) : h . appendItem ( D ) } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; return null } if ( G == 1 || G == 2 || G == 3 ) ub ( e ,
z , w ) ; if ( G == 2 ) { if ( F ) { ha ( h ) || ( J = { x : D . x + w . e , y : D . y + w . f } ) ; D = d . createSVGTransform ( ) ; D . setRotate ( F , J . x , J . y ) ; h . numberOfItems ? h . insertItemBefore ( D , 0 ) : h . appendItem ( D ) } } else if ( G == 3 && F ) { w = U ( h ) . matrix ; W = d . createSVGTransform ( ) ; W . setRotate ( F , D . x , D . y ) ; W = W . matrix ; D = d . createSVGTransform ( ) ; D . setRotate ( F , J . x , J . y ) ; J = D . matrix . inverse ( ) ; na = w . inverse ( ) ; J = T ( na , J , W , w ) ; ub ( e , z , J ) ; if ( F ) h . numberOfItems ? h . insertItemBefore ( D , 0 ) : h . appendItem ( D ) } } h . numberOfItems == 0 && e . removeAttribute ( "transform" ) ; k . addSubCommand ( new Va ( e , u ) ) ; return k } ,
Eb = null , Ya = this . clearSelection = function ( e ) { if ( H [ 0 ] != null ) for ( var h = H . length , k = 0 ; k < h ; ++ k ) { var w = H [ k ] ; if ( w == null ) break ; La . releaseSelector ( w ) ; H [ k ] = null } e || L ( "selected" , H ) } , Fb = this . addToSelection = function ( e , h ) { if ( e . length != 0 ) { for ( var k = 0 ; k < H . length ; ) { if ( H [ k ] == null ) break ; ++ k } for ( var w = e . length ; w -- ; ) { var v = e [ w ] ; if ( v && svgedit . utilities . getBBox ( v ) ) { if ( v . tagName === "a" && v . childNodes . length === 1 ) v = v . firstChild ; if ( H . indexOf ( v ) == - 1 ) { H [ k ] = v ; k ++ ; v = La . requestSelector ( v ) ; H . length > 1 && v . showGrips ( false ) } } } L ( "selected" ,
H ) ; h || H . length == 1 ? La . requestSelector ( H [ 0 ] ) . showGrips ( true ) : La . requestSelector ( H [ 0 ] ) . showGrips ( false ) ; for ( H . sort ( function ( F , z ) { if ( F && z && F . compareDocumentPosition ) return 3 - ( z . compareDocumentPosition ( F ) & 6 ) ; else if ( F == null ) return 1 } ) ; H [ 0 ] == null ; ) H . shift ( 0 ) } } , Kb = this . selectOnly = function ( e , h ) { Ya ( true ) ; Fb ( e , h ) } ; this . removeFromSelection = function ( e ) { if ( H [ 0 ] != null ) if ( e . length != 0 ) { var h = Array ( H . length ) ; j = 0 ; len = H . length ; for ( var k = 0 ; k < len ; ++ k ) { var w = H [ k ] ; if ( w ) if ( e . indexOf ( w ) == - 1 ) { h [ j ] = w ; j ++ } else La . releaseSelector ( w ) } H =
h } } ; this . selectAllInCurrentLayer = function ( ) { var e = A ( ) . getCurrentLayer ( ) ; if ( e ) { Ka = "select" ; Kb ( $ ( K || e ) . children ( ) ) } } ; var Ub = this . getMouseTarget = function ( e ) { if ( e == null ) return null ; e = e . target ; if ( e . correspondingUseElement ) e = e . correspondingUseElement ; if ( [ "http://www.w3.org/1998/Math/MathML" , "http://www.w3.org/1999/xhtml" ] . indexOf ( e . namespaceURI ) >= 0 && e . id != "svgcanvas" ) for ( ; e . nodeName != "foreignObject" ; ) { e = e . parentNode ; if ( ! e ) return d } var h = A ( ) . getCurrentLayer ( ) ; if ( [ d , a , l , h ] . indexOf ( e ) >= 0 ) return d ; if ( $ ( e ) . closest ( "#selectorParentGroup" ) . length ) return La . selectorParentGroup ;
for ( ; e . parentNode !== ( K || h ) ; ) e = e . parentNode ; return e } ; ( function ( ) { var e = null , h = null , k = null , w = null , v = null , F = { } , z = { minx : null , miny : null , maxx : null , maxy : null } ; $ ( a ) . mousedown ( function ( u ) { if ( ! ( c . spaceKey || u . button === 1 ) ) { var B = u . button === 2 ; Eb = l . getScreenCTM ( ) . inverse ( ) ; var G = O ( u . pageX , u . pageY , Eb ) , C = G . x * p ; G = G . y * p ; u . preventDefault ( ) ; if ( B ) Ka = "select" ; C = C / p ; G = G / p ; var D = Ub ( u ) ; if ( D . tagName === "a" && D . childNodes . length === 1 ) D = D . firstChild ; var J = w = h = C , I = v = k = G ; if ( m . gridSnapping ) { C = Ea ( C ) ; G = Ea ( G ) ; h = Ea ( h ) ; k = Ea ( k ) } if ( D ==
La . selectorParentGroup && H [ 0 ] != null ) { D = u . target ; var W = $a ( D , "type" ) ; if ( W == "rotate" ) { Ka = "rotate" ; current _rotate _mode = $a ( D , "dir" ) } else if ( W == "resize" ) { Ka = "resize" ; sb = $a ( D , "dir" ) } D = H [ 0 ] } db = D . getAttribute ( "transform" ) ; W = ba ( D ) ; switch ( Ka ) { case "select" : Ra = true ; sb = "none" ; if ( B ) Ra = false ; if ( D != d ) { if ( H . indexOf ( D ) == - 1 ) { u . shiftKey || Ya ( true ) ; Fb ( [ D ] ) ; Za = D ; Sa . clear ( ) } if ( ! B ) for ( B = 0 ; B < H . length ; ++ B ) if ( H [ B ] != null ) { var X = ba ( H [ B ] ) ; X . numberOfItems ? X . insertItemBefore ( d . createSVGTransform ( ) , 0 ) : X . appendItem ( d . createSVGTransform ( ) ) } } else if ( ! B ) { Ya ( ) ;
Ka = "multiselect" ; if ( Ta == null ) Ta = La . getRubberBandBox ( ) ; w *= p ; v *= p ; pa ( Ta , { x : w , y : v , width : 0 , height : 0 , display : "inline" } , 100 ) } break ; case "zoom" : Ra = true ; if ( Ta == null ) Ta = La . getRubberBandBox ( ) ; pa ( Ta , { x : J * p , y : J * p , width : 0 , height : 0 , display : "inline" } , 100 ) ; break ; case "resize" : Ra = true ; h = C ; k = G ; F = svgedit . utilities . getBBox ( $ ( "#selectedBox0" ) [ 0 ] ) ; var da = { } ; $ . each ( F , function ( ra , va ) { da [ ra ] = va / p } ) ; F = da ; B = la ( D ) ? 1 : 0 ; if ( ha ( W ) ) { W . insertItemBefore ( d . createSVGTransform ( ) , B ) ; W . insertItemBefore ( d . createSVGTransform ( ) , B ) ; W . insertItemBefore ( d . createSVGTransform ( ) ,
B ) } else { W . appendItem ( d . createSVGTransform ( ) ) ; W . appendItem ( d . createSVGTransform ( ) ) ; W . appendItem ( d . createSVGTransform ( ) ) ; if ( svgedit . browser . supportsNonScalingStroke ( ) ) { if ( C = svgedit . browser . isChrome ( ) ) X = function ( ra ) { var va = ra . getAttributeNS ( null , "stroke" ) ; ra . removeAttributeNS ( null , "stroke" ) ; setTimeout ( function ( ) { ra . setAttributeNS ( null , "stroke" , va ) } , 1 ) } ; D . style . vectorEffect = "non-scaling-stroke" ; C && X ( D ) ; G = D . getElementsByTagName ( "*" ) ; J = G . length ; for ( B = 0 ; B < J ; B ++ ) { G [ B ] . style . vectorEffect = "non-scaling-stroke" ;
C && X ( G [ B ] ) } } } break ; case "fhellipse" : case "fhrect" : case "fhpath" : Ra = true ; e = J + "," + I + " " ; X = N . stroke _width == 0 ? 1 : N . stroke _width ; S ( { element : "polyline" , curStyles : true , attr : { points : e , id : R ( ) , fill : "none" , opacity : N . opacity / 2 , "stroke-linecap" : "round" , style : "pointer-events:none" } } ) ; z . minx = J ; z . maxx = J ; z . miny = I ; z . maxy = I ; break ; case "image" : Ra = true ; X = S ( { element : "image" , attr : { x : C , y : G , width : 0 , height : 0 , id : R ( ) , opacity : N . opacity / 2 , style : "pointer-events:inherit" } } ) ; Z ( X , Ca ) ; Tb ( X ) ; break ; case "square" : case "rect" : Ra = true ; h =
C ; k = G ; S ( { element : "rect" , curStyles : true , attr : { x : C , y : G , width : 0 , height : 0 , id : R ( ) , opacity : N . opacity / 2 } } ) ; break ; case "line" : Ra = true ; X = N . stroke _width == 0 ? 1 : N . stroke _width ; S ( { element : "line" , curStyles : true , attr : { x1 : C , y1 : G , x2 : C , y2 : G , id : R ( ) , stroke : N . stroke , "stroke-width" : X , "stroke-dasharray" : N . stroke _dasharray , "stroke-linejoin" : N . stroke _linejoin , "stroke-linecap" : N . stroke _linecap , "stroke-opacity" : N . stroke _opacity , fill : "none" , opacity : N . opacity / 2 , style : "pointer-events:none" } } ) ; break ; case "circle" : Ra = true ; S ( { element : "circle" ,
curStyles : true , attr : { cx : C , cy : G , r : 0 , id : R ( ) , opacity : N . opacity / 2 } } ) ; break ; case "ellipse" : Ra = true ; S ( { element : "ellipse" , curStyles : true , attr : { cx : C , cy : G , rx : 0 , ry : 0 , id : R ( ) , opacity : N . opacity / 2 } } ) ; break ; case "text" : Ra = true ; S ( { element : "text" , curStyles : true , attr : { x : C , y : G , id : R ( ) , fill : nb . fill , "stroke-width" : nb . stroke _width , "font-size" : nb . font _size , "font-family" : nb . font _family , "text-anchor" : "left" , "xml:space" : "preserve" , opacity : N . opacity } } ) ; break ; case "path" : case "pathedit" : h *= p ; k *= p ; Sa . mouseDown ( u , D , h , k ) ; Ra = true ;
break ; case "textedit" : h *= p ; k *= p ; pb . mouseDown ( u , D , h , k ) ; Ra = true ; break ; case "rotate" : Ra = true ; c . undoMgr . beginUndoableChange ( "transform" , H ) ; document . getElementById ( "workarea" ) . className = "rotate" } X = kb ( "mouseDown" , { event : u , start _x : h , start _y : k , selectedElements : H } , true ) ; $ . each ( X , function ( ra , va ) { if ( va && va . started ) Ra = true } ) ; if ( Ka ) document . getElementById ( "workarea" ) . className = Ka == "resize" ? u . target . style . cursor : Ka } } ) . mousemove ( function ( u ) { if ( Ra ) if ( ! ( u . button === 1 || c . spaceKey ) ) { var B = H [ 0 ] , G = O ( u . pageX , u . pageY , Eb ) ,
C = G . x * p ; G = G . y * p ; var D = ua ( sa ( ) ) , J = x = C / p , I = y = G / p ; if ( m . gridSnapping ) { x = Ea ( x ) ; y = Ea ( y ) } u . preventDefault ( ) ; switch ( Ka ) { case "select" : if ( H [ 0 ] !== null ) { J = x - h ; var W = y - k ; if ( m . gridSnapping ) { J = Ea ( J ) ; W = Ea ( W ) } if ( u . shiftKey ) { var X = P ( h , k , x , y ) ; x = X . x ; y = X . y } if ( J != 0 || W != 0 ) { X = H . length ; for ( I = 0 ; I < X ; ++ I ) { B = H [ I ] ; if ( B == null ) break ; var da = d . createSVGTransform ( ) ; D = ba ( B ) ; da . setTranslate ( J , W ) ; D . numberOfItems ? D . replaceItem ( da , 0 ) : D . appendItem ( da ) ; if ( u . altKey ) if ( ! c . addClone ) { c . addClone = c . cloneSelectedElements ( 0 , 0 , true ) ; c . removeClone =
function ( ) { if ( parent = c . addClone . parentNode ) { parent . removeChild ( c . addClone ) ; c . addClone = false } } ; window . addEventListener ( "keyup" , c . removeClone ) } La . requestSelector ( B ) . resize ( ) } L ( "transition" , H ) } } break ; case "multiselect" : J *= p ; I *= p ; pa ( Ta , { x : Math . min ( w , J ) , y : Math . min ( v , I ) , width : Math . abs ( J - w ) , height : Math . abs ( I - v ) } , 100 ) ; D = [ ] ; J = [ ] ; da = Gb ( ) ; X = H . length ; for ( I = 0 ; I < X ; ++ I ) { W = da . indexOf ( H [ I ] ) ; if ( W == - 1 ) D . push ( H [ I ] ) ; else da [ W ] = null } X = da . length ; for ( I = 0 ; I < X ; ++ I ) da [ I ] && J . push ( da [ I ] ) ; D . length > 0 && c . removeFromSelection ( D ) ;
J . length > 0 && Fb ( J ) ; break ; case "resize" : D = ba ( B ) ; J = ( X = ha ( D ) ) ? F : svgedit . utilities . getBBox ( B ) ; I = J . x ; da = J . y ; var ra = J . width , va = J . height ; J = x - h ; W = y - k ; if ( m . gridSnapping ) { J = Ea ( J ) ; W = Ea ( W ) ; va = Ea ( va ) ; ra = Ea ( ra ) } var ka = la ( B ) ; if ( ka ) { var na = Math . sqrt ( J * J + W * W ) ; W = Math . atan2 ( W , J ) - ka * Math . PI / 180 ; J = na * Math . cos ( W ) ; W = na * Math . sin ( W ) } if ( sb . indexOf ( "n" ) == - 1 && sb . indexOf ( "s" ) == - 1 ) W = 0 ; if ( sb . indexOf ( "e" ) == - 1 && sb . indexOf ( "w" ) == - 1 ) J = 0 ; var q = na = 0 , E = va ? ( va + W ) / va : 1 , M = ra ? ( ra + J ) / ra : 1 ; if ( sb . indexOf ( "n" ) >= 0 ) { E = va ? ( va - W ) / va : 1 ; q = va } if ( sb . indexOf ( "w" ) >=
0 ) { M = ra ? ( ra - J ) / ra : 1 ; na = ra } J = d . createSVGTransform ( ) ; W = d . createSVGTransform ( ) ; ra = d . createSVGTransform ( ) ; if ( m . gridSnapping ) { I = Ea ( I ) ; na = Ea ( na ) ; da = Ea ( da ) ; q = Ea ( q ) } J . setTranslate ( - ( I + na ) , - ( da + q ) ) ; if ( u . shiftKey ) if ( M == 1 ) M = E ; else E = M ; W . setScale ( M , E ) ; ra . setTranslate ( I + na , da + q ) ; if ( X ) { X = ka ? 1 : 0 ; D . replaceItem ( J , 2 + X ) ; D . replaceItem ( W , 1 + X ) ; D . replaceItem ( ra , 0 + X ) } else { X = D . numberOfItems ; D . replaceItem ( ra , X - 3 ) ; D . replaceItem ( W , X - 2 ) ; D . replaceItem ( J , X - 1 ) } La . requestSelector ( B ) . resize ( ) ; L ( "transition" , H ) ; break ; case "zoom" : J *=
p ; I *= p ; pa ( Ta , { x : Math . min ( w * p , J ) , y : Math . min ( v * p , I ) , width : Math . abs ( J - w * p ) , height : Math . abs ( I - v * p ) } , 100 ) ; break ; case "text" : pa ( D , { x : x , y : y } , 1E3 ) ; break ; case "line" : J = null ; window . opera || d . suspendRedraw ( 1E3 ) ; if ( m . gridSnapping ) { x = Ea ( x ) ; y = Ea ( y ) } I = x ; X = y ; if ( u . shiftKey ) { X = P ( h , k , I , X ) ; I = X . x ; X = X . y } D . setAttributeNS ( null , "x2" , I ) ; D . setAttributeNS ( null , "y2" , X ) ; window . opera || d . unsuspendRedraw ( J ) ; break ; case "foreignObject" : case "square" : case "rect" : case "image" : J = Math . abs ( x - h ) ; X = Math . abs ( y - k ) ; if ( Ka == "square" || u . shiftKey ) { J =
X = Math . max ( J , X ) ; I = h < x ? h : h - J ; da = k < y ? k : k - X } else { I = Math . min ( h , x ) ; da = Math . min ( k , y ) } if ( u . altKey ) { J *= 2 ; X *= 2 ; I = h - J / 2 ; da = k - X / 2 } if ( m . gridSnapping ) { J = Ea ( J ) ; X = Ea ( X ) ; I = Ea ( I ) ; da = Ea ( da ) } pa ( D , { width : J , height : X , x : I , y : da } , 1E3 ) ; break ; case "circle" : J = $ ( D ) . attr ( [ "cx" , "cy" ] ) ; X = J . cx ; I = J . cy ; J = Math . sqrt ( ( x - X ) * ( x - X ) + ( y - I ) * ( y - I ) ) ; if ( m . gridSnapping ) J = Ea ( J ) ; D . setAttributeNS ( null , "r" , J ) ; break ; case "ellipse" : J = $ ( D ) . attr ( [ "cx" , "cy" ] ) ; X = Math . abs ( h + ( x - h ) / 2 ) ; I = Math . abs ( k + ( y - k ) / 2 ) ; J = null ; window . opera || d . suspendRedraw ( 1E3 ) ; if ( m . gridSnapping ) { x =
Ea ( x ) ; X = Ea ( X ) ; y = Ea ( y ) ; I = Ea ( I ) } da = Math . abs ( h - X ) ; W = Math . abs ( k - I ) ; if ( u . shiftKey ) { W = da ; I = y > k ? k + da : k - da } if ( u . altKey ) { X = h ; I = k ; da = Math . abs ( x - X ) ; W = u . shiftKey ? da : Math . abs ( y - I ) } D . setAttributeNS ( null , "rx" , da ) ; D . setAttributeNS ( null , "ry" , W ) ; D . setAttributeNS ( null , "cx" , X ) ; D . setAttributeNS ( null , "cy" , I ) ; window . opera || d . unsuspendRedraw ( J ) ; break ; case "fhellipse" : case "fhrect" : z . minx = Math . min ( J , z . minx ) ; z . maxx = Math . max ( J , z . maxx ) ; z . miny = Math . min ( I , z . miny ) ; z . maxy = Math . max ( I , z . maxy ) ; case "fhpath" : e += + J + "," + I + " " ; D . setAttributeNS ( null ,
"points" , e ) ; break ; case "path" : case "pathedit" : x *= p ; y *= p ; if ( m . gridSnapping ) { x = Ea ( x ) ; y = Ea ( y ) ; h = Ea ( h ) ; k = Ea ( k ) } if ( u . shiftKey ) { if ( X = svgedit . path . path ) { D = X . dragging ? X . dragging [ 0 ] : h ; X = X . dragging ? X . dragging [ 1 ] : k } else { D = h ; X = k } X = P ( D , X , x , y ) ; x = X . x ; y = X . y } if ( Ta && Ta . getAttribute ( "display" ) !== "none" ) { J *= p ; I *= p ; pa ( Ta , { x : Math . min ( w * p , J ) , y : Math . min ( v * p , I ) , width : Math . abs ( J - w * p ) , height : Math . abs ( I - v * p ) } , 100 ) } Sa . mouseMove ( u , x , y ) ; break ; case "textedit" : x *= p ; y *= p ; pb . mouseMove ( C , G ) ; break ; case "rotate" : J = svgedit . utilities . getBBox ( B ) ;
X = J . x + J . width / 2 ; I = J . y + J . height / 2 ; D = aa ( B ) ; D = O ( X , I , D ) ; X = D . x ; I = D . y ; D = J . x ; da = J . y ; if ( current _rotate _mode == "nw" ) D = J . x + J . width ; if ( current _rotate _mode == "se" ) da = J . y + J . height ; if ( current _rotate _mode == "sw" ) { D = J . x + J . width ; da = J . y + J . height } compensation _angle = ( Math . atan2 ( I - da , X - D ) * ( 180 / Math . PI ) - 90 ) % 360 ; ka = ( Math . atan2 ( I - y , X - x ) * ( 180 / Math . PI ) - 90 ) % 360 ; ka += compensation _angle ; if ( m . gridSnapping ) ka = Ea ( ka ) ; if ( u . shiftKey ) ka = Math . round ( ka / 45 ) * 45 ; c . setRotationAngle ( ka < - 180 ? 360 + ka : ka , true ) ; L ( "transition" , H ) } kb ( "mouseMove" , { event : u ,
mouse _x : C , mouse _y : G , selected : B } ) } } ) . click ( function ( u ) { u . preventDefault ( ) ; return false } ) . dblclick ( function ( u ) { var B = u . target . parentNode ; if ( B !== K ) { var G = Ub ( u ) , C = G . tagName ; if ( C === "text" && Ka !== "textedit" ) { u = O ( u . pageX , u . pageY , Eb ) ; pb . select ( G , u . x , u . y ) } if ( ( C === "g" || C === "a" ) && la ( G ) ) { Vb ( G ) ; G = H [ 0 ] ; Ya ( true ) } K && Wb ( ) ; B . tagName !== "g" && B . tagName !== "a" || B === A ( ) . getCurrentLayer ( ) || G === La . selectorParentGroup || Pb ( G ) } } ) . mouseup ( function ( u ) { c . addClone = false ; window . removeEventListener ( "keyup" , c . removeClone ) ; if ( u . button !==
2 ) { var B = Za ; Za = null ; if ( Ra ) { var G = O ( u . pageX , u . pageY , Eb ) , C = G . x * p ; G = G . y * p ; var D = C / p , J = G / p , I = ua ( sa ( ) ) , W = false ; Ra = false ; switch ( Ka ) { case "resize" : case "multiselect" : if ( Ta != null ) { Ta . setAttribute ( "display" , "none" ) ; ib = [ ] } Ka = "select" ; case "select" : if ( H [ 0 ] != null ) { if ( H [ 1 ] == null ) { C = H [ 0 ] ; switch ( C . tagName ) { case "g" : case "use" : case "image" : case "foreignObject" : break ; default : fb . fill = C . getAttribute ( "fill" ) ; fb . fill _opacity = C . getAttribute ( "fill-opacity" ) ; fb . stroke = C . getAttribute ( "stroke" ) ; fb . stroke _opacity = C . getAttribute ( "stroke-opacity" ) ;
fb . stroke _width = C . getAttribute ( "stroke-width" ) ; fb . stroke _dasharray = C . getAttribute ( "stroke-dasharray" ) ; fb . stroke _linejoin = C . getAttribute ( "stroke-linejoin" ) ; fb . stroke _linecap = C . getAttribute ( "stroke-linecap" ) } if ( C . tagName == "text" ) { nb . font _size = C . getAttribute ( "font-size" ) ; nb . font _family = C . getAttribute ( "font-family" ) } La . requestSelector ( C ) . showGrips ( true ) } Xa ( ) ; if ( D != w || J != v ) { u = H . length ; for ( C = 0 ; C < u ; ++ C ) { if ( H [ C ] == null ) break ; H [ C ] . firstChild || La . requestSelector ( H [ C ] ) . resize ( ) } } else { C = u . target ; if ( H [ 0 ] . nodeName ===
"path" && H [ 1 ] == null ) Sa . select ( H [ 0 ] ) ; else u . shiftKey && B != C && c . removeFromSelection ( [ C ] ) } if ( svgedit . browser . supportsNonScalingStroke ( ) ) if ( u = H [ 0 ] ) { u . removeAttribute ( "style" ) ; svgedit . utilities . walkTree ( u , function ( ra ) { ra . removeAttribute ( "style" ) } ) } } return ; case "zoom" : Ta != null && Ta . setAttribute ( "display" , "none" ) ; L ( "zoomed" , { x : Math . min ( w , D ) , y : Math . min ( v , J ) , width : Math . abs ( D - w ) , height : Math . abs ( J - v ) , factor : u . altKey ? 0.5 : 2 } ) ; return ; case "fhpath" : B = I . getAttribute ( "points" ) ; D = B . indexOf ( "," ) ; if ( W = D >= 0 ? B . indexOf ( "," ,
D + 1 ) >= 0 : B . indexOf ( " " , B . indexOf ( " " ) + 1 ) >= 0 ) I = Sa . smoothPolylineIntoPath ( I ) ; break ; case "line" : B = $ ( I ) . attr ( [ "x1" , "x2" , "y1" , "y2" ] ) ; W = B . x1 != B . x2 || B . y1 != B . y2 ; break ; case "foreignObject" : case "square" : case "rect" : case "image" : B = $ ( I ) . attr ( [ "width" , "height" ] ) ; W = B . width != 0 || B . height != 0 || Ka === "image" ; break ; case "circle" : W = I . getAttribute ( "r" ) != 0 ; break ; case "ellipse" : B = $ ( I ) . attr ( [ "rx" , "ry" ] ) ; W = B . rx != null || B . ry != null ; break ; case "fhellipse" : if ( z . maxx - z . minx > 0 && z . maxy - z . miny > 0 ) { I = S ( { element : "ellipse" , curStyles : true ,
attr : { cx : ( z . minx + z . maxx ) / 2 , cy : ( z . miny + z . maxy ) / 2 , rx : ( z . maxx - z . minx ) / 2 , ry : ( z . maxy - z . miny ) / 2 , id : sa ( ) } } ) ; L ( "changed" , [ I ] ) ; W = true } break ; case "fhrect" : if ( z . maxx - z . minx > 0 && z . maxy - z . miny > 0 ) { I = S ( { element : "rect" , curStyles : true , attr : { x : z . minx , y : z . miny , width : z . maxx - z . minx , height : z . maxy - z . miny , id : sa ( ) } } ) ; L ( "changed" , [ I ] ) ; W = true } break ; case "text" : W = true ; Kb ( [ I ] ) ; pb . start ( I ) ; break ; case "path" : I = null ; Ra = true ; B = Sa . mouseUp ( u , I , C , G ) ; I = B . element ; W = B . keep ; break ; case "pathedit" : W = true ; I = null ; Sa . mouseUp ( u ) ; break ; case "textedit" : W =
false ; I = null ; pb . mouseUp ( u , C , G ) ; break ; case "rotate" : W = true ; I = null ; Ka = "select" ; B = c . undoMgr . finishUndoableChange ( ) ; B . isEmpty ( ) || Aa ( B ) ; Xa ( ) ; L ( "changed" , H ) } C = kb ( "mouseUp" , { event : u , mouse _x : C , mouse _y : G } , true ) ; $ . each ( C , function ( ra , va ) { if ( va ) { W = va . keep || W ; I = va . element ; Ra = va . started || Ra } } ) ; if ( ! W && I != null ) { A ( ) . releaseId ( sa ( ) ) ; I . parentNode . removeChild ( I ) ; I = null ; for ( C = u . target ; C . parentNode . parentNode . tagName == "g" ; ) C = C . parentNode ; if ( ( Ka != "path" || ! drawn _path ) && C . parentNode . id != "selectorParentGroup" && C . id != "svgcanvas" &&
C . id != "svgroot" ) { c . setMode ( "select" ) ; Kb ( [ C ] , true ) } } else if ( I != null ) { c . addedNew = true ; u = 0.2 ; var X ; if ( false . beginElement && I . getAttribute ( "opacity" ) != N . opacity ) { X = $ ( false ) . clone ( ) . attr ( { to : N . opacity , dur : u } ) . appendTo ( I ) ; try { X [ 0 ] . beginElement ( ) } catch ( da ) { } } else u = 0 ; setTimeout ( function ( ) { X && X . remove ( ) ; I . setAttribute ( "opacity" , N . opacity ) ; I . setAttribute ( "style" , "pointer-events:inherit" ) ; qa ( I ) ; if ( Ka === "path" ) Sa . toEditMode ( I ) ; else m . selectNew && Kb ( [ I ] , true ) ; Aa ( new Ja ( I ) ) ; L ( "changed" , [ I ] ) } , u * 1E3 ) } db = null } } } ) ;
$ ( a ) . bind ( "mousewheel DOMMouseScroll" , function ( u ) { if ( u . shiftKey ) { u . preventDefault ( ) ; Eb = l . getScreenCTM ( ) . inverse ( ) ; var B = O ( u . pageX , u . pageY , Eb ) ; B = { x : B . x , y : B . y , width : 0 , height : 0 } ; if ( u . wheelDelta ) if ( u . wheelDelta >= 120 ) B . factor = 2 ; else { if ( u . wheelDelta <= - 120 ) B . factor = 0.5 } else if ( u . detail ) if ( u . detail > 0 ) B . factor = 0.5 ; else if ( u . detail < 0 ) B . factor = 2 ; B . factor && L ( "zoomed" , B ) } } ) } ) ( ) ; var Tb = function ( e ) { $ ( e ) . click ( function ( h ) { h . preventDefault ( ) } ) } , pb = c . textActions = function ( ) { function e ( ka ) { var na = G . value === "" ; $ ( G ) . focus ( ) ;
if ( ! arguments . length ) if ( na ) ka = 0 ; else { if ( G . selectionEnd !== G . selectionStart ) return ; ka = G . selectionEnd } var q ; q = I [ ka ] ; na || G . setSelectionRange ( ka , ka ) ; C = ua ( "text_cursor" ) ; if ( ! C ) { C = document . createElementNS ( b , "line" ) ; pa ( C , { id : "text_cursor" , stroke : "#333" , "stroke-width" : 1 } ) ; C = ua ( "selectorParentGroup" ) . appendChild ( C ) } J || ( J = setInterval ( function ( ) { var E = C . getAttribute ( "display" ) === "none" ; C . setAttribute ( "display" , E ? "inline" : "none" ) } , 600 ) ) ; na = F ( q . x , W . y ) ; q = F ( q . x , W . y + W . height ) ; pa ( C , { x1 : na . x , y1 : na . y , x2 : q . x , y2 : q . y , visibility : "visible" ,
display : "inline" } ) ; D && D . setAttribute ( "d" , "" ) } function h ( ka , na , q ) { if ( ka === na ) e ( na ) ; else { q || G . setSelectionRange ( ka , na ) ; D = ua ( "text_selectblock" ) ; if ( ! D ) { D = document . createElementNS ( b , "path" ) ; pa ( D , { id : "text_selectblock" , fill : "green" , opacity : 0.5 , style : "pointer-events:none" } ) ; ua ( "selectorParentGroup" ) . appendChild ( D ) } ka = I [ ka ] ; var E = I [ na ] ; C . setAttribute ( "visibility" , "hidden" ) ; na = F ( ka . x , W . y ) ; q = F ( ka . x + ( E . x - ka . x ) , W . y ) ; var M = F ( ka . x , W . y + W . height ) ; ka = F ( ka . x + ( E . x - ka . x ) , W . y + W . height ) ; pa ( D , { d : "M" + na . x + "," + na . y + " L" +
q . x + "," + q . y + " " + ka . x + "," + ka . y + " " + M . x + "," + M . y + "z" , display : "inline" } ) } } function k ( ka , na ) { var q = d . createSVGPoint ( ) ; q . x = ka ; q . y = na ; if ( I . length == 1 ) return 0 ; q = B . getCharNumAtPosition ( q ) ; if ( q < 0 ) { q = I . length - 2 ; if ( ka <= I [ 0 ] . x ) q = 0 } else if ( q >= I . length - 2 ) q = I . length - 2 ; var E = I [ q ] ; ka > E . x + E . width / 2 && q ++ ; return q } function w ( ka , na , q ) { var E = G . selectionStart ; ka = k ( ka , na ) ; h ( Math . min ( E , ka ) , Math . max ( E , ka ) , ! q ) } function v ( ka , na ) { var q = { x : ka , y : na } ; q . x /= p ; q . y /= p ; if ( X ) { var E = O ( q . x , q . y , X . inverse ( ) ) ; q . x = E . x ; q . y = E . y } return q } function F ( ka ,
na ) { var q = { x : ka , y : na } ; if ( X ) { var E = O ( q . x , q . y , X ) ; q . x = E . x ; q . y = E . y } q . x *= p ; q . y *= p ; return q } function z ( ka ) { h ( 0 , B . textContent . length ) ; $ ( this ) . unbind ( ka ) } function u ( ka ) { if ( va && B ) { var na = O ( ka . pageX , ka . pageY , Eb ) ; na = v ( na . x * p , na . y * p ) ; na = k ( na . x , na . y ) ; var q = B . textContent , E = q . substr ( 0 , na ) . replace ( /[a-z0-9]+$/i , "" ) . length ; q = q . substr ( na ) . match ( /^[a-z0-9]+/i ) ; h ( E , ( q ? q [ 0 ] . length : 0 ) + na ) ; $ ( ka . target ) . click ( z ) ; setTimeout ( function ( ) { $ ( ka . target ) . unbind ( "click" , z ) } , 300 ) } } var B , G , C , D , J , I = [ ] , W , X , da , ra , va ; return { select : function ( ka ,
na , q ) { B = ka ; pb . toEditMode ( na , q ) } , start : function ( ka ) { B = ka ; pb . toEditMode ( ) } , mouseDown : function ( ka , na , q , E ) { ka = v ( q , E ) ; G . focus ( ) ; e ( k ( ka . x , ka . y ) ) ; da = q ; ra = E } , mouseMove : function ( ka , na ) { var q = v ( ka , na ) ; w ( q . x , q . y ) } , mouseUp : function ( ka , na , q ) { var E = v ( na , q ) ; w ( E . x , E . y , true ) ; ka . target !== B && na < da + 2 && na > da - 2 && q < ra + 2 && q > ra - 2 && pb . toSelectMode ( true ) } , setCursor : e , toEditMode : function ( ka , na ) { va = false ; Ka = "textedit" ; La . requestSelector ( B ) . showGrips ( false ) ; La . requestSelector ( B ) ; pb . init ( ) ; $ ( B ) . css ( "cursor" , "text" ) ; if ( arguments . length ) { var q =
v ( ka , na ) ; e ( k ( q . x , q . y ) ) } else e ( ) ; setTimeout ( function ( ) { va = true } , 300 ) } , toSelectMode : function ( ka ) { Ka = "select" ; clearInterval ( J ) ; J = null ; D && $ ( D ) . attr ( "display" , "none" ) ; C && $ ( C ) . attr ( "visibility" , "hidden" ) ; $ ( B ) . css ( "cursor" , "move" ) ; if ( ka ) { Ya ( ) ; $ ( B ) . css ( "cursor" , "move" ) ; L ( "selected" , [ B ] ) ; Fb ( [ B ] , true ) } B && ! B . textContent . length && c . deleteSelectedElements ( ) ; $ ( G ) . blur ( ) ; B = false } , setInputElem : function ( ka ) { G = ka } , clear : function ( ) { Ka == "textedit" && pb . toSelectMode ( ) } , init : function ( ) { if ( B ) { if ( ! B . parentNode ) { B = H [ 0 ] ; La . requestSelector ( B ) . showGrips ( false ) } var ka =
B . textContent . length , na = B . getAttribute ( "transform" ) ; W = svgedit . utilities . getBBox ( B ) ; X = na ? aa ( B ) : null ; I = Array ( ka ) ; G . focus ( ) ; $ ( B ) . unbind ( "dblclick" , u ) . dblclick ( u ) ; if ( ! ka ) var q = { x : W . x + W . width / 2 , width : 0 } ; for ( na = 0 ; na < ka ; na ++ ) { var E = B . getStartPositionOfChar ( na ) ; q = B . getEndPositionOfChar ( na ) ; if ( ! svgedit . browser . supportsGoodTextCharPos ( ) ) { var M = c . contentW * p ; E . x -= M ; q . x -= M ; E . x /= p ; q . x /= p } I [ na ] = { x : E . x , y : W . y , width : q . x - E . x , height : W . height } } I . push ( { x : q . x , width : 0 } ) ; h ( G . selectionStart , G . selectionEnd , true ) } } } } ( ) , Sa = c . pathActions =
function ( ) { var e = false , h , k , w ; svgedit . path . Path . prototype . endChanges = function ( z ) { if ( svgedit . browser . isWebkit ( ) ) { var u = this . elem ; u . setAttribute ( "d" , Sa . convertPath ( u ) ) } z = new Va ( this . elem , { d : this . last _d } , z ) ; Aa ( z ) ; L ( "changed" , [ this . elem ] ) } ; svgedit . path . Path . prototype . addPtsToSelection = function ( z ) { $ . isArray ( z ) || ( z = [ z ] ) ; for ( var u = 0 ; u < z . length ; u ++ ) { var B = z [ u ] , G = this . segs [ B ] ; G . ptgrip && this . selected _pts . indexOf ( B ) == - 1 && B >= 0 && this . selected _pts . push ( B ) } this . selected _pts . sort ( ) ; u = this . selected _pts . length ; for ( z =
Array ( u ) ; u -- ; ) { G = this . segs [ this . selected _pts [ u ] ] ; G . select ( true ) ; z [ u ] = G . ptgrip } Sa . canDeleteNodes = true ; Sa . closed _subpath = this . subpathIsClosed ( this . selected _pts [ 0 ] ) ; L ( "selected" , z ) } ; var v = h = null , F = false ; return { mouseDown : function ( z , u , B , G ) { if ( Ka === "path" ) { mouse _x = B ; mouse _y = G ; G = mouse _x / p ; u = mouse _y / p ; B = ua ( "path_stretch_line" ) ; k = [ G , u ] ; if ( m . gridSnapping ) { G = Ea ( G ) ; u = Ea ( u ) ; mouse _x = Ea ( mouse _x ) ; mouse _y = Ea ( mouse _y ) } if ( ! B ) { B = document . createElementNS ( b , "path" ) ; pa ( B , { id : "path_stretch_line" , stroke : "#22C" , "stroke-width" : "0.5" ,
fill : "none" } ) ; B = ua ( "selectorParentGroup" ) . appendChild ( B ) } B . setAttribute ( "display" , "inline" ) ; var C = null ; if ( v ) { C = v . pathSegList ; for ( var D = C . numberOfItems , J = 6 / p , I = false ; D ; ) { D -- ; var W = C . getItem ( D ) , X = W . x ; W = W . y ; if ( G >= X - J && G <= X + J && u >= W - J && u <= W + J ) { I = true ; break } } J = sa ( ) ; svgedit . path . removePath _ ( J ) ; J = ua ( J ) ; X = C . numberOfItems ; if ( I ) { if ( D <= 1 && X >= 2 ) { G = C . getItem ( 0 ) . x ; u = C . getItem ( 0 ) . y ; z = B . pathSegList . getItem ( 1 ) ; z = z . pathSegType === 4 ? v . createSVGPathSegLinetoAbs ( G , u ) : v . createSVGPathSegCurvetoCubicAbs ( G , u , z . x1 / p , z . y1 / p ,
G , u ) ; G = v . createSVGPathSegClosePath ( ) ; C . appendItem ( z ) ; C . appendItem ( G ) } else if ( X < 3 ) return C = false ; $ ( B ) . remove ( ) ; element = J ; v = null ; Ra = false ; if ( e ) { svgedit . path . path . matrix && ub ( J , { } , svgedit . path . path . matrix . inverse ( ) ) ; B = J . getAttribute ( "d" ) ; z = $ ( svgedit . path . path . elem ) . attr ( "d" ) ; $ ( svgedit . path . path . elem ) . attr ( "d" , z + B ) ; $ ( J ) . remove ( ) ; svgedit . path . path . matrix && svgedit . path . recalcRotatedPath ( ) ; svgedit . path . path . init ( ) ; Sa . toEditMode ( svgedit . path . path . elem ) ; svgedit . path . path . selectPt ( ) ; return false } } else { if ( ! $ . contains ( a ,
Ub ( z ) ) ) { console . log ( "Clicked outside canvas" ) ; return false } C = v . pathSegList . numberOfItems ; D = v . pathSegList . getItem ( C - 1 ) ; J = D . x ; D = D . y ; if ( z . shiftKey ) { z = P ( J , D , G , u ) ; G = z . x ; u = z . y } z = B . pathSegList . getItem ( 1 ) ; z = z . pathSegType === 4 ? v . createSVGPathSegLinetoAbs ( vb ( G ) , vb ( u ) ) : v . createSVGPathSegCurvetoCubicAbs ( vb ( G ) , vb ( u ) , z . x1 / p , z . y1 / p , z . x2 / p , z . y2 / p ) ; v . pathSegList . appendItem ( z ) ; G *= p ; u *= p ; B . setAttribute ( "d" , [ "M" , G , u , G , u ] . join ( " " ) ) ; B = C ; if ( e ) B += svgedit . path . path . segs . length ; svgedit . path . addPointGrip ( B , G , u ) } } else { d _attr =
"M" + G + "," + u + " " ; v = S ( { element : "path" , curStyles : true , attr : { d : d _attr , id : R ( ) , opacity : N . opacity / 2 } } ) ; B . setAttribute ( "d" , [ "M" , mouse _x , mouse _y , mouse _x , mouse _y ] . join ( " " ) ) ; B = e ? svgedit . path . path . segs . length : 0 ; svgedit . path . addPointGrip ( B , mouse _x , mouse _y ) } } else if ( svgedit . path . path ) { svgedit . path . path . storeD ( ) ; J = z . target . id ; if ( J . substr ( 0 , 14 ) == "pathpointgrip_" ) { u = svgedit . path . path . cur _pt = parseInt ( J . substr ( 14 ) ) ; svgedit . path . path . dragging = [ B , G ] ; C = svgedit . path . path . segs [ u ] ; if ( z . shiftKey ) C . selected ? svgedit . path . path . removePtFromSelection ( u ) :
svgedit . path . path . addPtsToSelection ( u ) ; else { if ( svgedit . path . path . selected _pts . length <= 1 || ! C . selected ) svgedit . path . path . clearSelection ( ) ; svgedit . path . path . addPtsToSelection ( u ) } } else if ( J . indexOf ( "ctrlpointgrip_" ) == 0 ) { svgedit . path . path . dragging = [ B , G ] ; z = J . split ( "_" ) [ 1 ] . split ( "c" ) ; u = z [ 0 ] - 0 ; svgedit . path . path . selectPt ( u , z [ 1 ] - 0 ) } if ( ! svgedit . path . path . dragging ) { if ( Ta == null ) Ta = La . getRubberBandBox ( ) ; pa ( Ta , { x : B * p , y : G * p , width : 0 , height : 0 , display : "inline" } , 100 ) } } } , mouseMove : function ( z , u , B ) { F = true ; if ( Ka === "path" ) { if ( v ) { var G =
v . pathSegList ; z = G . numberOfItems - 1 ; if ( k ) { var C = svgedit . path . addCtrlGrip ( "1c1" ) , D = svgedit . path . addCtrlGrip ( "0c2" ) ; D . getAttribute ( "cx" ) ; D . getAttribute ( "cy" ) ; C . setAttribute ( "cx" , u ) ; C . setAttribute ( "cy" , B ) ; C . setAttribute ( "display" , "inline" ) ; C = k [ 0 ] ; var J = k [ 1 ] ; G . getItem ( z ) ; var I = C + ( C - u / p ) , W = J + ( J - B / p ) ; D . setAttribute ( "cx" , I * p ) ; D . setAttribute ( "cy" , W * p ) ; D . setAttribute ( "display" , "inline" ) ; D = svgedit . path . getCtrlLine ( 1 ) ; var X = svgedit . path . getCtrlLine ( 2 ) ; pa ( D , { x1 : u , y1 : B , x2 : C * p , y2 : J * p , display : "inline" } ) ; pa ( X , { x1 : I *
p , y1 : W * p , x2 : C * p , y2 : J * p , display : "inline" } ) ; if ( z === 0 ) w = [ u , B ] ; else { G = G . getItem ( z - 1 ) ; u = G . x ; B = G . y ; if ( G . pathSegType === 6 ) { u += u - G . x2 ; B += B - G . y2 } else if ( w ) { u = w [ 0 ] / p ; B = w [ 1 ] / p } svgedit . path . replacePathSeg ( 6 , z , [ C , J , u , B , I , W ] , v ) } } else if ( C = ua ( "path_stretch_line" ) ) { z = G . getItem ( z ) ; if ( z . pathSegType === 6 ) svgedit . path . replacePathSeg ( 6 , 1 , [ u , B , ( z . x + ( z . x - z . x2 ) ) * p , ( z . y + ( z . y - z . y2 ) ) * p , u , B ] , C ) ; else w ? svgedit . path . replacePathSeg ( 6 , 1 , [ u , B , w [ 0 ] , w [ 1 ] , u , B ] , C ) : svgedit . path . replacePathSeg ( 4 , 1 , [ u , B ] , C ) } } } else if ( svgedit . path . path . dragging ) { C =
svgedit . path . getPointFromGrip ( { x : svgedit . path . path . dragging [ 0 ] , y : svgedit . path . path . dragging [ 1 ] } , svgedit . path . path ) ; J = svgedit . path . getPointFromGrip ( { x : u , y : B } , svgedit . path . path ) ; z = J . x - C . x ; C = J . y - C . y ; svgedit . path . path . dragging = [ u , B ] ; svgedit . path . path . dragctrl ? svgedit . path . path . moveCtrl ( z , C ) : svgedit . path . path . movePts ( z , C ) } else { svgedit . path . path . selected _pts = [ ] ; svgedit . path . path . eachSeg ( function ( ) { if ( this . next || this . prev ) { var da = Ta . getBBox ( ) , ra = svgedit . path . getGripPt ( this ) ; da = svgedit . math . rectsIntersect ( da ,
{ x : ra . x , y : ra . y , width : 0 , height : 0 } ) ; this . select ( da ) ; da && svgedit . path . path . selected _pts . push ( this . index ) } } ) } } , mouseUp : function ( z , u ) { if ( Ka === "path" ) { k = null ; if ( ! v ) { u = ua ( sa ( ) ) ; Ra = false ; w = null } return { keep : true , element : u } } if ( svgedit . path . path . dragging ) { var B = svgedit . path . path . cur _pt ; svgedit . path . path . dragging = false ; svgedit . path . path . dragctrl = false ; svgedit . path . path . update ( ) ; F && svgedit . path . path . endChanges ( "Move path point(s)" ) ; ! z . shiftKey && ! F && svgedit . path . path . selectPt ( B ) } else if ( Ta && Ta . getAttribute ( "display" ) !=
"none" ) { Ta . setAttribute ( "display" , "none" ) ; Ta . getAttribute ( "width" ) <= 2 && Ta . getAttribute ( "height" ) <= 2 && Sa . toSelectMode ( z . target ) } else Sa . toSelectMode ( z . target ) ; F = false } , toEditMode : function ( z ) { svgedit . path . path = svgedit . path . getPath _ ( z ) ; Ka = "pathedit" ; Ya ( ) ; svgedit . path . path . show ( true ) . update ( ) ; svgedit . path . path . oldbbox = svgedit . utilities . getBBox ( svgedit . path . path . elem ) ; e = false } , toSelectMode : function ( z ) { var u = z == svgedit . path . path . elem ; Ka = "select" ; svgedit . path . path . show ( false ) ; h = false ; Ya ( ) ; svgedit . path . path . matrix &&
svgedit . path . recalcRotatedPath ( ) ; if ( u ) { L ( "selected" , [ z ] ) ; Fb ( [ z ] , true ) } } , addSubPath : function ( z ) { if ( z ) { Ka = "path" ; e = true } else { Sa . clear ( true ) ; Sa . toEditMode ( svgedit . path . path . elem ) } } , select : function ( z ) { if ( h === z ) { Sa . toEditMode ( z ) ; Ka = "pathedit" } else h = z } , reorient : function ( ) { var z = H [ 0 ] ; if ( z ) if ( la ( z ) != 0 ) { var u = new Na ( "Reorient path" ) , B = { d : z . getAttribute ( "d" ) , transform : z . getAttribute ( "transform" ) } ; u . addSubCommand ( new Va ( z , B ) ) ; Ya ( ) ; this . resetOrientation ( z ) ; Aa ( u ) ; svgedit . path . getPath _ ( z ) . show ( false ) . matrix = null ;
this . clear ( ) ; Fb ( [ z ] , true ) ; L ( "changed" , H ) } } , clear : function ( ) { h = null ; if ( v ) { var z = ua ( sa ( ) ) ; $ ( ua ( "path_stretch_line" ) ) . remove ( ) ; $ ( z ) . remove ( ) ; $ ( ua ( "pathpointgrip_container" ) ) . find ( "*" ) . attr ( "display" , "none" ) ; v = w = null ; Ra = false } else Ka == "pathedit" && this . toSelectMode ( ) ; svgedit . path . path && svgedit . path . path . init ( ) . show ( false ) } , resetOrientation : function ( z ) { if ( z == null || z . nodeName != "path" ) return false ; var u = ba ( z ) , B = U ( u ) . matrix ; u . clear ( ) ; z . removeAttribute ( "transform" ) ; u = z . pathSegList ; for ( var G = u . numberOfItems ,
C = 0 ; C < G ; ++ C ) { var D = u . getItem ( C ) , J = D . pathSegType ; if ( J != 1 ) { var I = [ ] ; $ . each ( [ "" , 1 , 2 ] , function ( W , X ) { var da = D [ "x" + X ] , ra = D [ "y" + X ] ; if ( da !== undefined && ra !== undefined ) { da = O ( da , ra , B ) ; I . splice ( I . length , 0 , da . x , da . y ) } } ) ; svgedit . path . replacePathSeg ( J , C , I , z ) } } g ( z , B ) } , zoomChange : function ( ) { Ka == "pathedit" && svgedit . path . path . update ( ) } , getNodePoint : function ( ) { var z = svgedit . path . path . segs [ svgedit . path . path . selected _pts . length ? svgedit . path . path . selected _pts [ 0 ] : 1 ] ; return { x : z . item . x , y : z . item . y , type : z . type } } , linkControlPoints : function ( z ) { svgedit . path . setLinkControlPoints ( z ) } ,
clonePathNode : function ( ) { svgedit . path . path . storeD ( ) ; for ( var z = svgedit . path . path . selected _pts , u = z . length , B = [ ] ; u -- ; ) { var G = z [ u ] ; svgedit . path . path . addSeg ( G ) ; B . push ( G + u ) ; B . push ( G + u + 1 ) } svgedit . path . path . init ( ) . addPtsToSelection ( B ) ; svgedit . path . path . endChanges ( "Clone path node(s)" ) } , opencloseSubPath : function ( ) { var z = svgedit . path . path . selected _pts ; if ( z . length === 1 ) { var u = svgedit . path . path . elem , B = u . pathSegList , G = z [ 0 ] , C = null , D = null ; svgedit . path . path . eachSeg ( function ( X ) { if ( this . type === 2 && X <= G ) D = this . item ; if ( X <=
G ) return true ; if ( this . type === 2 ) { C = X ; return false } else if ( this . type === 1 ) return C = false } ) ; if ( C == null ) C = svgedit . path . path . segs . length - 1 ; if ( C !== false ) { var J = u . createSVGPathSegLinetoAbs ( D . x , D . y ) , I = u . createSVGPathSegClosePath ( ) ; if ( C == svgedit . path . path . segs . length - 1 ) { B . appendItem ( J ) ; B . appendItem ( I ) } else { svgedit . path . insertItemBefore ( u , I , C ) ; svgedit . path . insertItemBefore ( u , J , C ) } svgedit . path . path . init ( ) . selectPt ( C + 1 ) } else if ( svgedit . path . path . segs [ G ] . mate ) { B . removeItem ( G ) ; B . removeItem ( G ) ; svgedit . path . path . init ( ) . selectPt ( G -
1 ) } else { for ( z = 0 ; z < B . numberOfItems ; z ++ ) { var W = B . getItem ( z ) ; if ( W . pathSegType === 2 ) J = z ; else if ( z === G ) B . removeItem ( J ) ; else if ( W . pathSegType === 1 && G < z ) { I = z - 1 ; B . removeItem ( z ) ; break } } for ( z = G - J - 1 ; z -- ; ) svgedit . path . insertItemBefore ( u , B . getItem ( J ) , I ) ; u = B . getItem ( J ) ; svgedit . path . replacePathSeg ( 2 , J , [ u . x , u . y ] ) ; z = G ; svgedit . path . path . init ( ) . selectPt ( 0 ) } } } , deletePathNode : function ( ) { if ( Sa . canDeleteNodes ) { svgedit . path . path . storeD ( ) ; for ( var z = svgedit . path . path . selected _pts , u = z . length ; u -- ; ) svgedit . path . path . deleteSeg ( z [ u ] ) ;
var B = function ( ) { var G = svgedit . path . path . elem . pathSegList , C = G . numberOfItems , D = function ( W , X ) { for ( ; X -- ; ) G . removeItem ( W ) } ; if ( C <= 1 ) return true ; for ( ; C -- ; ) { var J = G . getItem ( C ) ; if ( J . pathSegType === 1 ) { J = G . getItem ( C - 1 ) ; var I = G . getItem ( C - 2 ) ; if ( J . pathSegType === 2 ) { D ( C - 1 , 2 ) ; B ( ) ; break } else if ( I . pathSegType === 2 ) { D ( C - 2 , 3 ) ; B ( ) ; break } } else if ( J . pathSegType === 2 ) if ( C > 0 ) { J = G . getItem ( C - 1 ) . pathSegType ; if ( J === 2 ) { D ( C - 1 , 1 ) ; B ( ) ; break } else if ( J === 1 && G . numberOfItems - 1 === C ) { D ( C , 1 ) ; B ( ) ; break } } } return false } ; B ( ) ; if ( svgedit . path . path . elem . pathSegList . numberOfItems <=
1 ) { Sa . toSelectMode ( svgedit . path . path . elem ) ; c . deleteSelectedElements ( ) } else { svgedit . path . path . init ( ) ; svgedit . path . path . clearSelection ( ) ; if ( window . opera ) { z = $ ( svgedit . path . path . elem ) ; z . attr ( "d" , z . attr ( "d" ) ) } svgedit . path . path . endChanges ( "Delete path node(s)" ) } } } , smoothPolylineIntoPath : function ( z ) { var u = z . points , B = u . numberOfItems ; if ( B >= 4 ) { var G = u . getItem ( 0 ) , C = null ; z = [ ] ; z . push ( [ "M" , G . x , "," , G . y , " C" ] . join ( "" ) ) ; for ( var D = 1 ; D <= B - 4 ; D += 3 ) { var J = u . getItem ( D ) , I = u . getItem ( D + 1 ) , W = u . getItem ( D + 2 ) ; if ( C ) if ( ( G = svgedit . path . smoothControlPoints ( C ,
J , G ) ) && G . length == 2 ) { J = z [ z . length - 1 ] . split ( "," ) ; J [ 2 ] = G [ 0 ] . x ; J [ 3 ] = G [ 0 ] . y ; z [ z . length - 1 ] = J . join ( "," ) ; J = G [ 1 ] } z . push ( [ J . x , J . y , I . x , I . y , W . x , W . y ] . join ( "," ) ) ; G = W ; C = I } for ( z . push ( "L" ) ; D < B ; ++ D ) { I = u . getItem ( D ) ; z . push ( [ I . x , I . y ] . join ( "," ) ) } z = z . join ( " " ) ; z = S ( { element : "path" , curStyles : true , attr : { id : sa ( ) , d : z , fill : "none" } } ) } return z } , setSegType : function ( z ) { svgedit . path . path . setSegType ( z ) } , moveNode : function ( z , u ) { var B = svgedit . path . path . selected _pts ; if ( B . length ) { svgedit . path . path . storeD ( ) ; B = svgedit . path . path . segs [ B [ 0 ] ] ;
var G = { x : 0 , y : 0 } ; G [ z ] = u - B . item [ z ] ; B . move ( G . x , G . y ) ; svgedit . path . path . endChanges ( "Move path point" ) } } , fixEnd : function ( z ) { for ( var u = z . pathSegList , B = u . numberOfItems , G , C = 0 ; C < B ; ++ C ) { var D = u . getItem ( C ) ; if ( D . pathSegType === 2 ) G = D ; if ( D . pathSegType === 1 ) { D = u . getItem ( C - 1 ) ; if ( D . x != G . x || D . y != G . y ) { u = z . createSVGPathSegLinetoAbs ( G . x , G . y ) ; svgedit . path . insertItemBefore ( z , u , C ) ; Sa . fixEnd ( z ) ; break } } } svgedit . browser . isWebkit ( ) && z . setAttribute ( "d" , Sa . convertPath ( z ) ) } , convertPath : function ( z , u ) { for ( var B = z . pathSegList , G = B . numberOfItems ,
C = 0 , D = 0 , J = "" , I = null , W = 0 ; W < G ; ++ W ) { var X = B . getItem ( W ) , da = X . x || 0 , ra = X . y || 0 , va = X . x1 || 0 , ka = X . y1 || 0 , na = X . x2 || 0 , q = X . y2 || 0 , E = X . pathSegType , M = cb [ E ] [ "to" + ( u ? "Lower" : "Upper" ) + "Case" ] ( ) , V = function ( ca , ia , ta ) { ia = ia ? " " + ia . join ( " " ) : "" ; ta = ta ? " " + svgedit . units . shortFloat ( ta ) : "" ; $ . each ( ca , function ( za , ya ) { ca [ za ] = svgedit . units . shortFloat ( ya ) } ) ; J += M + ca . join ( " " ) + ia + ta } ; switch ( E ) { case 1 : J += "z" ; break ; case 12 : da -= C ; case 13 : if ( u ) { C += da ; M = "l" } else { da += C ; C = da ; M = "L" } V ( [ [ da , D ] ] ) ; break ; case 14 : ra -= D ; case 15 : if ( u ) { D += ra ; M = "l" } else { ra +=
D ; D = ra ; M = "L" } V ( [ [ C , ra ] ] ) ; break ; case 2 : case 4 : case 18 : da -= C ; ra -= D ; case 5 : case 3 : if ( I && B . getItem ( W - 1 ) . pathSegType === 1 && ! u ) { C = I [ 0 ] ; D = I [ 1 ] } case 19 : if ( u ) { C += da ; D += ra } else { da += C ; ra += D ; C = da ; D = ra } if ( E === 3 ) I = [ C , D ] ; V ( [ [ da , ra ] ] ) ; break ; case 6 : da -= C ; va -= C ; na -= C ; ra -= D ; ka -= D ; q -= D ; case 7 : if ( u ) { C += da ; D += ra } else { da += C ; va += C ; na += C ; ra += D ; ka += D ; q += D ; C = da ; D = ra } V ( [ [ va , ka ] , [ na , q ] , [ da , ra ] ] ) ; break ; case 8 : da -= C ; va -= C ; ra -= D ; ka -= D ; case 9 : if ( u ) { C += da ; D += ra } else { da += C ; va += C ; ra += D ; ka += D ; C = da ; D = ra } V ( [ [ va , ka ] , [ da , ra ] ] ) ; break ; case 10 : da -=
C ; ra -= D ; case 11 : if ( u ) { C += da ; D += ra } else { da += C ; ra += D ; C = da ; D = ra } V ( [ [ X . r1 , X . r2 ] ] , [ X . angle , X . largeArcFlag ? 1 : 0 , X . sweepFlag ? 1 : 0 ] , [ da , ra ] ) ; break ; case 16 : da -= C ; na -= C ; ra -= D ; q -= D ; case 17 : if ( u ) { C += da ; D += ra } else { da += C ; na += C ; ra += D ; q += D ; C = da ; D = ra } V ( [ [ na , q ] , [ da , ra ] ] ) } } return J } } } ( ) , Db = this . removeUnusedDefElems = function ( ) { var e = l . getElementsByTagNameNS ( b , "defs" ) ; if ( ! e || ! e . length ) return 0 ; for ( var h = [ ] , k = 0 , w = [ "fill" , "stroke" , "filter" , "marker-start" , "marker-mid" , "marker-end" ] , v = w . length , F = l . getElementsByTagNameNS ( b ,
"*" ) , z = F . length , u = 0 ; u < z ; u ++ ) { for ( var B = F [ u ] , G = 0 ; G < v ; G ++ ) { var C = ja ( B . getAttribute ( w [ G ] ) ) ; C && h . push ( C . substr ( 1 ) ) } ( B = ea ( B ) ) && B . indexOf ( "#" ) === 0 && h . push ( B . substr ( 1 ) ) } e = $ ( e ) . find ( "linearGradient, radialGradient, filter, marker, svg, symbol" ) ; defelem _ids = [ ] ; for ( u = e . length ; u -- ; ) { w = e [ u ] ; v = w . id ; if ( h . indexOf ( v ) < 0 ) { Cb [ v ] = w ; w . parentNode . removeChild ( w ) ; k ++ } } return k } ; this . svgCanvasToString = function ( ) { for ( ; Db ( ) > 0 ; ) ; Sa . clear ( true ) ; $ . each ( l . childNodes , function ( k , w ) { k && w . nodeType === 8 && w . data . indexOf ( "Created with" ) >=
0 && l . insertBefore ( w , l . firstChild ) } ) ; if ( K ) { Wb ( ) ; Kb ( [ K ] ) } var e = [ ] ; $ ( l ) . find ( "g:data(gsvg)" ) . each ( function ( ) { for ( var k = this . attributes , w = k . length , v = 0 ; v < w ; v ++ ) if ( k [ v ] . nodeName == "id" || k [ v ] . nodeName == "style" ) w -- ; if ( w <= 0 ) { k = this . firstChild ; e . push ( k ) ; $ ( this ) . replaceWith ( k ) } } ) ; var h = this . svgToString ( l , 0 ) ; e . length && $ ( e ) . each ( function ( ) { oa ( this ) } ) ; return h } ; this . svgToString = function ( e , h ) { var k = [ ] , w = svgedit . utilities . toXml , v = m . baseUnit , F = RegExp ( "^-?[\\d\\.]+" + v + "$" ) ; if ( e ) { qa ( e ) ; var z = e . attributes , u , B , G = e . childNodes ;
for ( B = 0 ; B < h ; B ++ ) k . push ( " " ) ; k . push ( "<" ) ; k . push ( e . nodeName ) ; if ( e . id === "svgcontent" ) { B = Lb ( ) ; if ( v !== "px" ) { B . w = svgedit . units . convertUnit ( B . w , v ) + v ; B . h = svgedit . units . convertUnit ( B . h , v ) + v } k . push ( ' width="' + B . w + '" height="' + B . h + '" xmlns="' + b + '"' ) ; var C = { } ; $ ( e ) . find ( "*" ) . andSelf ( ) . each ( function ( ) { $ . each ( this . attributes , function ( W , X ) { var da = X . namespaceURI ; if ( da && ! C [ da ] && Ha [ da ] !== "xmlns" && Ha [ da ] !== "xml" ) { C [ da ] = true ; k . push ( " xmlns:" + Ha [ da ] + '="' + da + '"' ) } } ) } ) ; B = z . length ; for ( v = [ "width" , "height" , "xmlns" , "x" , "y" ,
"viewBox" , "id" , "overflow" ] ; B -- ; ) { u = z . item ( B ) ; var D = w ( u . nodeValue ) ; if ( u . nodeName . indexOf ( "xmlns:" ) !== 0 ) if ( D != "" && v . indexOf ( u . localName ) == - 1 ) if ( ! u . namespaceURI || Ha [ u . namespaceURI ] ) { k . push ( " " ) ; k . push ( u . nodeName ) ; k . push ( '="' ) ; k . push ( D ) ; k . push ( '"' ) } } } else { if ( e . nodeName === "defs" && ! e . firstChild ) return ; var J = [ "-moz-math-font-style" , "_moz-math-font-style" ] ; for ( B = z . length - 1 ; B >= 0 ; B -- ) { u = z . item ( B ) ; D = w ( u . nodeValue ) ; if ( ! ( J . indexOf ( u . localName ) >= 0 ) ) if ( D != "" ) if ( D . indexOf ( "pointer-events" ) !== 0 ) if ( ! ( u . localName ===
"class" && D . indexOf ( "se_" ) === 0 ) ) { k . push ( " " ) ; if ( u . localName === "d" ) D = Sa . convertPath ( e , true ) ; if ( isNaN ( D ) ) { if ( F . test ( D ) ) D = svgedit . units . shortFloat ( D ) + v } else D = svgedit . units . shortFloat ( D ) ; if ( hb . apply && e . nodeName === "image" && u . localName === "href" && hb . images && hb . images === "embed" ) { var I = Ia [ D ] ; if ( I ) D = I } if ( ! u . namespaceURI || u . namespaceURI == b || Ha [ u . namespaceURI ] ) { k . push ( u . nodeName ) ; k . push ( '="' ) ; k . push ( D ) ; k . push ( '"' ) } } } } if ( e . hasChildNodes ( ) ) { k . push ( ">" ) ; h ++ ; z = false ; for ( B = 0 ; B < G . length ; B ++ ) { v = G . item ( B ) ; switch ( v . nodeType ) { case 1 : k . push ( "\n" ) ;
k . push ( this . svgToString ( G . item ( B ) , h ) ) ; break ; case 3 : v = v . nodeValue . replace ( /^\s+|\s+$/g , "" ) ; if ( v != "" ) { z = true ; k . push ( w ( v ) + "" ) } break ; case 4 : k . push ( "\n" ) ; k . push ( Array ( h + 1 ) . join ( " " ) ) ; k . push ( "<![CDATA[" ) ; k . push ( v . nodeValue ) ; k . push ( "]]\>" ) ; break ; case 8 : k . push ( "\n" ) ; k . push ( Array ( h + 1 ) . join ( " " ) ) ; k . push ( "<!--" ) ; k . push ( v . data ) ; k . push ( "--\>" ) } } h -- ; if ( ! z ) { k . push ( "\n" ) ; for ( B = 0 ; B < h ; B ++ ) k . push ( " " ) } k . push ( "</" ) ; k . push ( e . nodeName ) ; k . push ( ">" ) } else k . push ( "/>" ) } return k . join ( "" ) } ; this . embedImage = function ( e , h ) { $ ( new Image ) . load ( function ( ) { var k =
document . createElement ( "canvas" ) ; k . width = this . width ; k . height = this . height ; k . getContext ( "2d" ) . drawImage ( this , 0 , 0 ) ; try { var w = ";svgedit_url=" + encodeURIComponent ( e ) ; w = k . toDataURL ( ) . replace ( ";base64" , w + ";base64" ) ; Ia [ e ] = w } catch ( v ) { Ia [ e ] = false } Ca = e ; h && h ( Ia [ e ] ) } ) . attr ( "src" , e ) } ; this . setGoodImage = function ( e ) { Ca = e } ; this . open = function ( ) { } ; this . save = function ( e ) { Ya ( ) ; e && $ . extend ( hb , e ) ; hb . apply = true ; e = this . svgCanvasToString ( ) ; L ( "saved" , e ) } ; this . rasterExport = function ( ) { Ya ( ) ; var e = [ ] , h = { feGaussianBlur : yb . exportNoBlur ,
foreignObject : yb . exportNoforeignObject , "[stroke-dasharray]" : yb . exportNoDashArray } , k = $ ( l ) ; if ( ! ( "font" in $ ( "<canvas>" ) [ 0 ] . getContext ( "2d" ) ) ) h . text = yb . exportNoText ; $ . each ( h , function ( w , v ) { k . find ( w ) . length && e . push ( v ) } ) ; h = this . svgCanvasToString ( ) ; L ( "exported" , { svg : h , issues : e } ) } ; this . getSvgString = function ( ) { hb . apply = false ; return this . svgCanvasToString ( ) } ; this . randomizeIds = function ( ) { arguments . length > 0 && arguments [ 0 ] == false ? svgedit . draw . randomizeIds ( false , A ( ) ) : svgedit . draw . randomizeIds ( true , A ( ) ) } ; var Xb = this . uniquifyElems =
function ( e ) { var h = { } , k = [ "filter" , "linearGradient" , "pattern" , "radialGradient" , "symbol" , "textPath" , "use" ] ; svgedit . utilities . walkTree ( e , function ( u ) { if ( u . nodeType == 1 ) { if ( u . id ) { u . id in h || ( h [ u . id ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ u . id ] . elem = u } $ . each ( qb , function ( G , C ) { var D = u . getAttributeNode ( C ) ; if ( D ) { var J = svgedit . utilities . getUrlFromAttr ( D . value ) ; if ( J = J ? J . substr ( 1 ) : null ) { J in h || ( h [ J ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ J ] . attrs . push ( D ) } } } ) ; var B = svgedit . utilities . getHref ( u ) ; if ( B && k . indexOf ( u . nodeName ) >=
0 ) if ( B = B . substr ( 1 ) ) { B in h || ( h [ B ] = { elem : null , attrs : [ ] , hrefs : [ ] } ) ; h [ B ] . hrefs . push ( u ) } } } ) ; for ( var w in h ) if ( w ) { var v = h [ w ] . elem ; if ( v ) { e = R ( ) ; v . id = e ; v = h [ w ] . attrs ; for ( var F = v . length ; F -- ; ) { var z = v [ F ] ; z . ownerElement . setAttribute ( z . name , "url(#" + e + ")" ) } v = h [ w ] . hrefs ; for ( F = v . length ; F -- ; ) svgedit . utilities . setHref ( v [ F ] , "#" + e ) } } } , Sb = this . setUseData = function ( e ) { var h = $ ( e ) ; if ( e . tagName !== "use" ) h = h . find ( "use" ) ; h . each ( function ( ) { var k = ea ( this ) . substr ( 1 ) ; if ( k = ua ( k ) ) { $ ( this ) . data ( "ref" , k ) ; if ( k . tagName == "symbol" || k . tagName ==
"svg" ) $ ( this ) . data ( "symbol" , k ) . data ( "ref" , k ) } } ) } , Qb = this . convertGradients = function ( e ) { var h = $ ( e ) . find ( "linearGradient, radialGradient" ) ; if ( ! h . length && svgedit . browser . isWebkit ( ) ) h = $ ( e ) . find ( "*" ) . filter ( function ( ) { return this . tagName . indexOf ( "Gradient" ) >= 0 } ) ; h . each ( function ( ) { if ( $ ( this ) . attr ( "gradientUnits" ) === "userSpaceOnUse" ) { var k = $ ( l ) . find ( '[fill="url(#' + this . id + ')"],[stroke="url(#' + this . id + ')"]' ) ; if ( k . length ) if ( k = svgedit . utilities . getBBox ( k [ 0 ] ) ) if ( this . tagName === "linearGradient" ) { var w = $ ( this ) . attr ( [ "x1" ,
"y1" , "x2" , "y2" ] ) , v = this . gradientTransform . baseVal ; if ( v && v . numberOfItems > 0 ) { var F = U ( v ) . matrix ; v = O ( w . x1 , w . y1 , F ) ; F = O ( w . x2 , w . y2 , F ) ; w . x1 = v . x ; w . y1 = v . y ; w . x2 = F . x ; w . y2 = F . y ; this . removeAttribute ( "gradientTransform" ) } $ ( this ) . attr ( { x1 : ( w . x1 - k . x ) / k . width , y1 : ( w . y1 - k . y ) / k . height , x2 : ( w . x2 - k . x ) / k . width , y2 : ( w . y2 - k . y ) / k . height } ) ; this . removeAttribute ( "gradientUnits" ) } } } ) } , Yb = this . convertToGroup = function ( e ) { e || ( e = H [ 0 ] ) ; var h = $ ( e ) , k = new Na , w ; if ( h . data ( "gsvg" ) ) { k = $ ( e . firstChild ) . attr ( [ "x" , "y" ] ) ; $ ( e . firstChild . firstChild ) . unwrap ( ) ;
$ ( e ) . removeData ( "gsvg" ) ; w = ba ( e ) ; var v = d . createSVGTransform ( ) ; v . setTranslate ( k . x , k . y ) ; w . appendItem ( v ) ; lb ( e ) ; L ( "selected" , [ e ] ) } else if ( h . data ( "symbol" ) ) { e = h . data ( "symbol" ) ; w = h . attr ( "transform" ) ; v = h . attr ( [ "x" , "y" ] ) ; var F = e . getAttribute ( "viewBox" ) ; if ( F ) { F = F . split ( " " ) ; v . x -= + F [ 0 ] ; v . y -= + F [ 1 ] } w += " translate(" + ( v . x || 0 ) + "," + ( v . y || 0 ) + ")" ; v = h . prev ( ) ; k . addSubCommand ( new Qa ( h [ 0 ] , h [ 0 ] . nextSibling , h [ 0 ] . parentNode ) ) ; h . remove ( ) ; F = $ ( l ) . find ( "use:data(symbol)" ) . length ; h = f . createElementNS ( b , "g" ) ; for ( var z = e . childNodes ,
u = 0 ; u < z . length ; u ++ ) h . appendChild ( z [ u ] . cloneNode ( true ) ) ; if ( svgedit . browser . isGecko ( ) ) { z = $ ( wb ( ) ) . children ( "linearGradient,radialGradient,pattern" ) . clone ( ) ; $ ( h ) . append ( z ) } w && h . setAttribute ( "transform" , w ) ; w = e . parentNode ; Xb ( h ) ; svgedit . browser . isGecko ( ) && $ ( wb ( ) ) . append ( $ ( h ) . find ( "linearGradient,radialGradient,pattern" ) ) ; h . id = R ( ) ; v . after ( h ) ; if ( w ) { if ( ! F ) { v = e . nextSibling ; w . removeChild ( e ) ; k . addSubCommand ( new Qa ( e , v , w ) ) } k . addSubCommand ( new Ja ( h ) ) } Sb ( h ) ; svgedit . browser . isGecko ( ) ? Qb ( wb ( ) ) : Qb ( h ) ; svgedit . utilities . walkTreePost ( h ,
function ( B ) { try { lb ( B ) } catch ( G ) { console . log ( G ) } } ) ; $ ( h ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id = R ( ) } ) ; Kb ( [ h ] ) ; ( e = Vb ( h , true ) ) && k . addSubCommand ( e ) ; Aa ( k ) } else console . log ( "Unexpected element to ungroup:" , e ) } ; this . setSvgString = function ( e ) { try { var h = svgedit . utilities . text2xml ( e ) ; this . prepareSvg ( h ) ; var k = new Na ( "Change Source" ) , w = l . nextSibling , v = d . removeChild ( l ) ; k . addSubCommand ( new Qa ( v , w , d ) ) ; l = f . adoptNode ? f . adoptNode ( h . documentElement ) :
f . importNode ( h . documentElement , true ) ; d . appendChild ( l ) ; var F = $ ( l ) ; c . current _drawing _ = new svgedit . draw . Drawing ( l , o ) ; var z = A ( ) . getNonce ( ) ; z ? L ( "setnonce" , z ) : L ( "unsetnonce" ) ; F . find ( "image" ) . each ( function ( ) { var I = this ; Tb ( I ) ; var W = ea ( this ) ; if ( W . indexOf ( "data:" ) === 0 ) { var X = W . match ( /svgedit_url=(.*?);/ ) ; if ( X ) { var da = decodeURIComponent ( X [ 1 ] ) ; $ ( new Image ) . load ( function ( ) { I . setAttributeNS ( "http://www.w3.org/1999/xlink" , "xlink:href" , da ) } ) . attr ( "src" , da ) } } c . embedImage ( W ) } ) ; F . find ( "svg" ) . each ( function ( ) { if ( ! $ ( this ) . closest ( "defs" ) . length ) { Xb ( this ) ;
var I = this . parentNode ; if ( I . childNodes . length === 1 && I . nodeName === "g" ) { $ ( I ) . data ( "gsvg" , this ) ; I . id = I . id || R ( ) } else oa ( this ) } } ) ; svgedit . browser . isGecko ( ) && F . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( wb ( ) ) ; Sb ( F ) ; Qb ( F [ 0 ] ) ; svgedit . utilities . walkTreePost ( l , function ( I ) { try { lb ( I ) } catch ( W ) { console . log ( W ) } } ) ; var u = { id : "svgcontent" , overflow : m . show _outside _canvas ? "visible" : "hidden" } , B = false ; if ( F . attr ( "viewBox" ) ) { var G = F . attr ( "viewBox" ) . split ( " " ) ; u . width = G [ 2 ] ; u . height = G [ 3 ] } else $ . each ( [ "width" , "height" ] ,
function ( I , W ) { var X = F . attr ( W ) ; X || ( X = "100%" ) ; if ( ( X + "" ) . substr ( - 1 ) === "%" ) B = true ; else u [ W ] = wa ( W , X ) } ) ; Mb ( ) ; F . children ( ) . find ( "a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use" ) . each ( function ( ) { if ( ! this . id ) this . id = R ( ) } ) ; if ( B ) { var C = getStrokedBBox ( ) ; u . width = C . width + C . x ; u . height = C . height + C . y } if ( u . width <= 0 ) u . width = 100 ; if ( u . height <= 0 ) u . height = 100 ; F . attr ( u ) ; this . contentW = u . width ; this . contentH = u . height ; k . addSubCommand ( new Ja ( l ) ) ; var D = F . attr ( [ "width" , "height" ] ) ; k . addSubCommand ( new Va ( d ,
D ) ) ; p = 1 ; svgedit . transformlist . resetListMap ( ) ; Ya ( ) ; svgedit . path . clearData ( ) ; d . appendChild ( La . selectorParentGroup ) ; Aa ( k ) ; L ( "changed" , [ l ] ) } catch ( J ) { console . log ( J ) ; return false } return true } ; this . importSvgString = function ( e ) { try { var h = svgedit . utilities . encode64 ( e . length + e ) . substr ( 0 , 32 ) , k = false ; if ( tb [ h ] ) if ( $ ( tb [ h ] . symbol ) . parents ( "#svgroot" ) . length ) k = true ; var w = new Na ( "Import SVG" ) ; if ( k ) var v = tb [ h ] . symbol , F = tb [ h ] . xform ; else { var z = svgedit . utilities . text2xml ( e ) ; this . prepareSvg ( z ) ; var u ; u = f . adoptNode ? f . adoptNode ( z . documentElement ) :
f . importNode ( z . documentElement , true ) ; Xb ( u ) ; var B = wa ( "width" , u . getAttribute ( "width" ) ) , G = wa ( "height" , u . getAttribute ( "height" ) ) , C = u . getAttribute ( "viewBox" ) , D = C ? C . split ( " " ) : [ 0 , 0 , B , G ] ; for ( e = 0 ; e < 4 ; ++ e ) D [ e ] = + D [ e ] ; l . getAttribute ( "width" ) ; var J = + l . getAttribute ( "height" ) ; F = G > B ? "scale(" + J / 3 / D [ 3 ] + ")" : "scale(" + J / 3 / D [ 2 ] + ")" ; F = "translate(0) " + F + " translate(0)" ; v = f . createElementNS ( b , "symbol" ) ; var I = wb ( ) ; for ( svgedit . browser . isGecko ( ) && $ ( u ) . find ( "linearGradient, radialGradient, pattern" ) . appendTo ( I ) ; u . firstChild ; ) v . appendChild ( u . firstChild ) ;
var W = u . attributes ; for ( u = 0 ; u < W . length ; u ++ ) { var X = W [ u ] ; v . setAttribute ( X . nodeName , X . nodeValue ) } v . id = R ( ) ; tb [ h ] = { symbol : v , xform : F } ; wb ( ) . appendChild ( v ) ; w . addSubCommand ( new Ja ( v ) ) } var da = f . createElementNS ( b , "use" ) ; da . id = R ( ) ; Z ( da , "#" + v . id ) ; ( K || A ( ) . getCurrentLayer ( ) ) . appendChild ( da ) ; w . addSubCommand ( new Ja ( da ) ) ; Ya ( ) ; da . setAttribute ( "transform" , F ) ; lb ( da ) ; $ ( da ) . data ( "symbol" , v ) . data ( "ref" , v ) ; Fb ( [ da ] ) ; Aa ( w ) ; L ( "changed" , [ l ] ) } catch ( ra ) { console . log ( ra ) ; return false } return true } ; var Mb = c . identifyLayers = function ( ) { Wb ( ) ;
A ( ) . identifyLayers ( ) } ; this . createLayer = function ( e ) { var h = new Na ( "Create Layer" ) ; e = A ( ) . createLayer ( e ) ; h . addSubCommand ( new Ja ( e ) ) ; Aa ( h ) ; Ya ( ) ; L ( "changed" , [ e ] ) } ; this . cloneLayer = function ( e ) { var h = new Na ( "Duplicate Layer" ) , k = f . createElementNS ( b , "g" ) , w = f . createElementNS ( b , "title" ) ; w . textContent = e ; k . appendChild ( w ) ; w = A ( ) . getCurrentLayer ( ) ; $ ( w ) . after ( k ) ; w = w . childNodes ; for ( var v = 0 ; v < w . length ; v ++ ) { var F = w [ v ] ; F . localName != "title" && k . appendChild ( ga ( F ) ) } Ya ( ) ; Mb ( ) ; h . addSubCommand ( new Ja ( k ) ) ; Aa ( h ) ; c . setCurrentLayer ( e ) ;
L ( "changed" , [ k ] ) } ; this . deleteCurrentLayer = function ( ) { var e = A ( ) . getCurrentLayer ( ) , h = e . nextSibling , k = e . parentNode ; if ( e = A ( ) . deleteCurrentLayer ( ) ) { var w = new Na ( "Delete Layer" ) ; w . addSubCommand ( new Qa ( e , h , k ) ) ; Aa ( w ) ; Ya ( ) ; L ( "changed" , [ k ] ) ; return true } return false } ; this . setCurrentLayer = function ( e ) { ( e = A ( ) . setCurrentLayer ( svgedit . utilities . toXml ( e ) ) ) && Ya ( ) ; return e } ; this . renameCurrentLayer = function ( e ) { var h = A ( ) ; if ( h . current _layer ) { var k = h . current _layer ; if ( ! c . setCurrentLayer ( e ) ) { for ( var w = new Na ( "Rename Layer" ) ,
v = 0 ; v < h . getNumLayers ( ) ; ++ v ) if ( h . all _layers [ v ] [ 1 ] == k ) break ; var F = h . getLayerName ( v ) ; h . all _layers [ v ] [ 0 ] = svgedit . utilities . toXml ( e ) ; var z = k . childNodes . length ; for ( v = 0 ; v < z ; ++ v ) { var u = k . childNodes . item ( v ) ; if ( u && u . tagName == "title" ) { for ( ; u . firstChild ; ) u . removeChild ( u . firstChild ) ; u . textContent = e ; w . addSubCommand ( new Va ( u , { "#text" : F } ) ) ; Aa ( w ) ; L ( "changed" , [ k ] ) ; return true } } } h . current _layer = k } return false } ; this . setCurrentLayerPosition = function ( e ) { var h = A ( ) ; if ( h . current _layer && e >= 0 && e < h . getNumLayers ( ) ) { for ( var k =
0 ; k < h . getNumLayers ( ) ; ++ k ) if ( h . all _layers [ k ] [ 1 ] == h . current _layer ) break ; if ( k == h . getNumLayers ( ) ) return false ; if ( k != e ) { var w = null , v = h . current _layer . nextSibling ; if ( e > k ) { if ( e < h . getNumLayers ( ) - 1 ) w = h . all _layers [ e + 1 ] [ 1 ] } else w = h . all _layers [ e ] [ 1 ] ; l . insertBefore ( h . current _layer , w ) ; Aa ( new Oa ( h . current _layer , v , l ) ) ; Mb ( ) ; c . setCurrentLayer ( h . getLayerName ( e ) ) ; return true } } return false } ; this . setLayerVisibility = function ( e , h ) { var k = A ( ) , w = k . getLayerVisibility ( e ) , v = k . setLayerVisibility ( e , h ) ; if ( v ) Aa ( new Va ( v , { display : w ?
"inline" : "none" } , "Layer Visibility" ) ) ; else return false ; if ( v == k . getCurrentLayer ( ) ) { Ya ( ) ; Sa . clear ( ) } return true } ; this . moveSelectedToLayer = function ( e ) { for ( var h = null , k = A ( ) , w = 0 ; w < k . getNumLayers ( ) ; ++ w ) if ( k . getLayerName ( w ) == e ) { h = k . all _layers [ w ] [ 1 ] ; break } if ( ! h ) return false ; e = new Na ( "Move Elements to Layer" ) ; k = H ; for ( w = k . length ; w -- ; ) { var v = k [ w ] ; if ( v ) { var F = v . nextSibling , z = v . parentNode ; h . appendChild ( v ) ; e . addSubCommand ( new Oa ( v , F , z ) ) } } Aa ( e ) ; return true } ; this . mergeLayer = function ( e ) { var h = new Na ( "Merge Layer" ) ,
k = A ( ) , w = $ ( k . current _layer ) . prev ( ) [ 0 ] ; if ( w ) { for ( h . addSubCommand ( new Qa ( k . current _layer , k . current _layer . nextSibling , l ) ) ; k . current _layer . firstChild ; ) { var v = k . current _layer . firstChild ; if ( v . localName == "title" ) { h . addSubCommand ( new Qa ( v , v . nextSibling , k . current _layer ) ) ; k . current _layer . removeChild ( v ) } else { var F = v . nextSibling ; w . appendChild ( v ) ; h . addSubCommand ( new Oa ( v , F , k . current _layer ) ) } } l . removeChild ( k . current _layer ) ; if ( ! e ) { Ya ( ) ; Mb ( ) ; L ( "changed" , [ l ] ) ; Aa ( h ) } k . current _layer = w ; return h } } ; this . mergeAllLayers =
function ( ) { var e = new Na ( "Merge all Layers" ) , h = A ( ) ; for ( h . current _layer = h . all _layers [ h . getNumLayers ( ) - 1 ] [ 1 ] ; $ ( l ) . children ( "g" ) . length > 1 ; ) e . addSubCommand ( c . mergeLayer ( true ) ) ; Ya ( ) ; Mb ( ) ; L ( "changed" , [ l ] ) ; Aa ( e ) } ; var Wb = this . leaveContext = function ( ) { var e = jb . length ; if ( e ) { for ( var h = 0 ; h < e ; h ++ ) { var k = jb [ h ] , w = $a ( k , "orig_opac" ) ; w !== 1 ? k . setAttribute ( "opacity" , w ) : k . removeAttribute ( "opacity" ) ; k . setAttribute ( "style" , "pointer-events: inherit" ) } jb = [ ] ; Ya ( true ) ; L ( "contextset" , null ) } K = null } , Pb = this . setContext = function ( e ) { Wb ( ) ;
if ( typeof e === "string" ) e = ua ( e ) ; K = e ; $ ( e ) . parentsUntil ( "#svgcontent" ) . andSelf ( ) . siblings ( ) . each ( function ( ) { var h = this . getAttribute ( "opacity" ) || 1 ; $a ( this , "orig_opac" , h ) ; this . setAttribute ( "opacity" , h * 0.33 ) ; this . setAttribute ( "style" , "pointer-events: none" ) ; jb . push ( this ) } ) ; Ya ( ) ; L ( "contextset" , K ) } ; this . clear = function ( ) { Sa . clear ( ) ; Ya ( ) ; c . clearSvgContentElement ( ) ; c . current _drawing _ = new svgedit . draw . Drawing ( l ) ; c . createLayer ( "Layer 1" ) ; c . undoMgr . resetUndoStack ( ) ; La . initGroup ( ) ; Ta = La . getRubberBandBox ( ) ; L ( "cleared" ) } ;
this . linkControlPoints = Sa . linkControlPoints ; this . getContentElem = function ( ) { return l } ; this . getRootElem = function ( ) { return d } ; this . getSelectedElems = function ( ) { return H } ; var Lb = this . getResolution = function ( ) { var e = l . getAttribute ( "width" ) / p , h = l . getAttribute ( "height" ) / p ; return { w : e , h : h , zoom : p } } ; this . getZoom = function ( ) { return p } ; this . getVersion = function ( ) { return "svgcanvas.js ($Rev: 2082 $)" } ; this . setUiStrings = function ( e ) { $ . extend ( yb , e . notification ) } ; this . setConfig = function ( e ) { $ . extend ( m , e ) } ; this . getTitle =
function ( e ) { if ( e = e || H [ 0 ] ) { e = $ ( e ) . data ( "gsvg" ) || $ ( e ) . data ( "symbol" ) || e ; e = e . childNodes ; for ( var h = 0 ; h < e . length ; h ++ ) if ( e [ h ] . nodeName == "title" ) return e [ h ] . textContent ; return "" } } ; this . setGroupTitle = function ( e ) { var h = H [ 0 ] ; h = $ ( h ) . data ( "gsvg" ) || h ; var k = $ ( h ) . children ( "title" ) , w = new Na ( "Set Label" ) ; if ( e . length ) if ( k . length ) { k = k [ 0 ] ; w . addSubCommand ( new Va ( k , { "#text" : k . textContent } ) ) ; k . textContent = e } else { k = f . createElementNS ( b , "title" ) ; k . textContent = e ; $ ( h ) . prepend ( k ) ; w . addSubCommand ( new Ja ( k ) ) } else { w . addSubCommand ( new Qa ( k [ 0 ] ,
k . nextSibling , h ) ) ; k . remove ( ) } Aa ( w ) } ; this . getDocumentTitle = function ( ) { return c . getTitle ( l ) } ; this . setDocumentTitle = function ( e ) { for ( var h = l . childNodes , k = false , w = "" , v = new Na ( "Change Image Title" ) , F = 0 ; F < h . length ; F ++ ) if ( h [ F ] . nodeName == "title" ) { k = h [ F ] ; w = k . textContent ; break } if ( ! k ) { k = f . createElementNS ( b , "title" ) ; l . insertBefore ( k , l . firstChild ) } if ( e . length ) k . textContent = e ; else k . parentNode . removeChild ( k ) ; v . addSubCommand ( new Va ( k , { "#text" : w } ) ) ; Aa ( v ) } ; this . getEditorNS = function ( e ) { e && l . setAttribute ( "xmlns:se" ,
"http://svg-edit.googlecode.com" ) ; return "http://svg-edit.googlecode.com" } ; this . setResolution = function ( e , h ) { var k = Lb ( ) , w = k . w ; k = k . h ; var v ; if ( e == "fit" ) { var F = getStrokedBBox ( ) ; if ( F ) { v = new Na ( "Fit Canvas to Content" ) ; var z = Ab ( ) ; Fb ( z ) ; var u = [ ] , B = [ ] ; $ . each ( z , function ( ) { u . push ( F . x * - 1 ) ; B . push ( F . y * - 1 ) } ) ; z = c . moveSelectedElements ( u , B , true ) ; v . addSubCommand ( z ) ; Ya ( ) ; e = Math . round ( F . width ) ; h = Math . round ( F . height ) } else return false } if ( e != w || h != k ) { z = d . suspendRedraw ( 1E3 ) ; v || ( v = new Na ( "Change Image Dimensions" ) ) ; e = wa ( "width" ,
e ) ; h = wa ( "height" , h ) ; l . setAttribute ( "width" , e ) ; l . setAttribute ( "height" , h ) ; this . contentW = e ; this . contentH = h ; v . addSubCommand ( new Va ( l , { width : w , height : k } ) ) ; l . setAttribute ( "viewBox" , [ 0 , 0 , e / p , h / p ] . join ( " " ) ) ; v . addSubCommand ( new Va ( l , { viewBox : [ "0 0" , w , k ] . join ( " " ) } ) ) ; Aa ( v ) ; d . unsuspendRedraw ( z ) ; if ( background = document . getElementById ( "canvas_background" ) ) { background . setAttribute ( "x" , - 1 ) ; background . setAttribute ( "y" , - 1 ) ; background . setAttribute ( "width" , e + 2 ) ; background . setAttribute ( "height" , h + 2 ) } L ( "changed" , [ l ] ) } return [ e ,
h ] } ; this . getOffset = function ( ) { return $ ( l ) . attr ( [ "x" , "y" ] ) } ; this . setBBoxZoom = function ( e , h , k ) { var w = 0.85 , v = function ( F ) { if ( ! F ) return false ; var z = Math . min ( Math . round ( h / F . width * 100 * w ) / 100 , Math . round ( k / F . height * 100 * w ) / 100 ) ; c . setZoom ( z ) ; return { zoom : z , bbox : F } } ; if ( typeof e == "object" ) { e = e ; if ( e . width == 0 || e . height == 0 ) { c . setZoom ( e . zoom ? e . zoom : p * e . factor ) ; return { zoom : p , bbox : e } } return v ( e ) } switch ( e ) { case "selection" : if ( ! H [ 0 ] ) return ; e = $ . map ( H , function ( F ) { if ( F ) return F } ) ; e = getStrokedBBox ( e ) ; break ; case "canvas" : e =
Lb ( ) ; w = 0.95 ; e = { width : e . w , height : e . h , x : 0 , y : 0 } ; break ; case "content" : e = getStrokedBBox ( ) ; break ; case "layer" : e = getStrokedBBox ( Ab ( A ( ) . getCurrentLayer ( ) ) ) ; break ; default : return } return v ( e ) } ; this . setZoom = function ( e ) { var h = Lb ( ) ; l . setAttribute ( "viewBox" , "0 0 " + h . w / e + " " + h . h / e ) ; p = e ; $ . each ( H , function ( k , w ) { w && La . requestSelector ( w ) . resize ( ) } ) ; Sa . zoomChange ( ) ; kb ( "zoomChanged" , e ) } ; this . getMode = function ( ) { return Ka } ; this . setMode = function ( e ) { Sa . clear ( true ) ; pb . clear ( ) ; $ ( "#workarea" ) . attr ( "class" , e ) ; fb = H [ 0 ] && H [ 0 ] . nodeName ==
"text" ? nb : N ; Ka = e } ; this . getColor = function ( e ) { return fb [ e ] } ; this . setColor = function ( e , h , k ) { N [ e ] = h ; fb [ e + "_paint" ] = { type : "solidColor" } ; for ( var w = [ ] , v = H . length ; v -- ; ) { var F = H [ v ] ; if ( F ) if ( F . tagName == "g" ) svgedit . utilities . walkTree ( F , function ( z ) { z . nodeName != "g" && w . push ( z ) } ) ; else if ( e == "fill" ) F . tagName != "polyline" && F . tagName != "line" && w . push ( F ) ; else w . push ( F ) } if ( w . length > 0 ) if ( k ) Nb ( e , h , w ) ; else { ob ( e , h , w ) ; L ( "changed" , w ) } } ; var wb = function ( ) { var e = l . getElementsByTagNameNS ( b , "defs" ) ; if ( e . length > 0 ) e = e [ 0 ] ; else { e = f . createElementNS ( b ,
"defs" ) ; l . firstChild ? l . insertBefore ( e , l . firstChild . nextSibling ) : l . appendChild ( e ) } return e } , $b = this . setGradient = function ( e ) { if ( ! ( ! fb [ e + "_paint" ] || fb [ e + "_paint" ] . type == "solidColor" ) ) { var h = c [ e + "Grad" ] , k = Zb ( h ) , w = wb ( ) ; if ( k ) h = k ; else { h = w . appendChild ( f . importNode ( h , true ) ) ; h . id = R ( ) } c . setColor ( e , "url(#" + h . id + ")" ) ; if ( e == "canvas" ) ( e = document . getElementById ( "canvas_background" ) ) && e . setAttribute ( "fill" , "url(#" + h . id + ")" ) } } , Zb = function ( e ) { var h = wb ( ) ; h = $ ( h ) . find ( "linearGradient, radialGradient" ) ; for ( var k = h . length ,
w = [ "r" , "cx" , "cy" , "fx" , "fy" ] ; k -- ; ) { var v = h [ k ] ; if ( e . tagName == "linearGradient" ) { if ( e . getAttribute ( "x1" ) != v . getAttribute ( "x1" ) || e . getAttribute ( "y1" ) != v . getAttribute ( "y1" ) || e . getAttribute ( "x2" ) != v . getAttribute ( "x2" ) || e . getAttribute ( "y2" ) != v . getAttribute ( "y2" ) ) continue } else { var F = $ ( e ) . attr ( w ) , z = $ ( v ) . attr ( w ) , u = false ; $ . each ( w , function ( I , W ) { if ( F [ W ] != z [ W ] ) u = true } ) ; if ( u ) continue } var B = e . getElementsByTagNameNS ( b , "stop" ) , G = v . getElementsByTagNameNS ( b , "stop" ) ; if ( B . length == G . length ) { for ( var C = B . length ; C -- ; ) { var D =
B [ C ] , J = G [ C ] ; if ( D . getAttribute ( "offset" ) != J . getAttribute ( "offset" ) || D . getAttribute ( "stop-opacity" ) != J . getAttribute ( "stop-opacity" ) || D . getAttribute ( "stop-color" ) != J . getAttribute ( "stop-color" ) ) break } if ( C == - 1 ) return v } } return null } ; this . setPaint = function ( e , h ) { var k = new $ . jGraduate . Paint ( h ) ; this . setPaintOpacity ( e , k . alpha / 100 , true ) ; fb [ e + "_paint" ] = k ; switch ( k . type ) { case "solidColor" : if ( k . solidColor != "none" && k . solidColor != "#none" ) this . setColor ( e , "#" + k . solidColor ) ; else { this . setColor ( e , "none" ) ; document . querySelector ( e ==
"fill" ? "#fill_color rect" : "#stroke_color rect" ) . setAttribute ( "fill" , "none" ) } break ; case "linearGradient" : case "radialGradient" : c [ e + "Grad" ] = k [ k . type ] ; $b ( e ) } } ; this . getStrokeWidth = function ( ) { return fb . stroke _width } ; this . setStrokeWidth = function ( e ) { if ( e == 0 && [ "line" , "path" ] . indexOf ( Ka ) >= 0 ) c . setStrokeWidth ( 1 ) ; else { fb . stroke _width = e ; for ( var h = [ ] , k = H . length ; k -- ; ) { var w = H [ k ] ; if ( w ) w . tagName == "g" ? svgedit . utilities . walkTree ( w , function ( v ) { v . nodeName != "g" && h . push ( v ) } ) : h . push ( w ) } if ( h . length > 0 ) { ob ( "stroke-width" , e ,
h ) ; L ( "changed" , H ) } } } ; this . setStrokeAttr = function ( e , h ) { N [ e . replace ( "-" , "_" ) ] = h ; for ( var k = [ ] , w = H . length ; w -- ; ) { var v = H [ w ] ; if ( v ) v . tagName == "g" ? svgedit . utilities . walkTree ( v , function ( F ) { F . nodeName != "g" && k . push ( F ) } ) : k . push ( v ) } if ( k . length > 0 ) { ob ( e , h , k ) ; L ( "changed" , H ) } } ; this . getStyle = function ( ) { return N } ; this . getOpacity = function ( ) { return N . opacity } ; this . setOpacity = function ( e ) { N . opacity = e ; ob ( "opacity" , e ) } ; this . getFillOpacity = function ( ) { return N . fill _opacity } ; this . getStrokeOpacity = function ( ) { return N . stroke _opacity } ;
this . setPaintOpacity = function ( e , h , k ) { N [ e + "_opacity" ] = h ; k ? Nb ( e + "-opacity" , h ) : ob ( e + "-opacity" , h ) } ; this . getBlur = function ( e ) { var h = 0 ; if ( e ) if ( e . getAttribute ( "filter" ) ) if ( e = ua ( e . id + "_blur" ) ) h = e . firstChild . getAttribute ( "stdDeviation" ) ; return h } ; ( function ( ) { function e ( ) { var v = c . undoMgr . finishUndoableChange ( ) ; h . addSubCommand ( v ) ; Aa ( h ) ; k = h = null } var h = null , k = null , w = false ; c . setBlurNoUndo = function ( v ) { if ( k ) if ( v === 0 ) { Nb ( "filter" , "" ) ; w = true } else { var F = H [ 0 ] ; w && Nb ( "filter" , "url(#" + F . id + "_blur)" ) ; if ( svgedit . browser . isWebkit ( ) ) { F . removeAttribute ( "filter" ) ;
F . setAttribute ( "filter" , "url(#" + F . id + "_blur)" ) } Nb ( "stdDeviation" , v , [ k . firstChild ] ) ; c . setBlurOffsets ( k , v ) } else c . setBlur ( v ) } ; c . setBlurOffsets = function ( v , F ) { if ( F > 3 ) pa ( v , { x : "-50%" , y : "-50%" , width : "200%" , height : "200%" } , 100 ) ; else if ( ! svgedit . browser . isWebkit ( ) ) { v . removeAttribute ( "x" ) ; v . removeAttribute ( "y" ) ; v . removeAttribute ( "width" ) ; v . removeAttribute ( "height" ) } } ; c . setBlur = function ( v , F ) { if ( h ) e ( ) ; else { var z = H [ 0 ] , u = z . id ; k = ua ( u + "_blur" ) ; v -= 0 ; var B = new Na ; if ( k ) { if ( v === 0 ) k = null } else { var G = S ( { element : "feGaussianBlur" ,
attr : { "in" : "SourceGraphic" , stdDeviation : v } } ) ; k = S ( { element : "filter" , attr : { id : u + "_blur" } } ) ; k . appendChild ( G ) ; wb ( ) . appendChild ( k ) ; B . addSubCommand ( new Ja ( k ) ) } G = { filter : z . getAttribute ( "filter" ) } ; if ( v === 0 ) { z . removeAttribute ( "filter" ) ; B . addSubCommand ( new Va ( z , G ) ) } else { ob ( "filter" , "url(#" + u + "_blur)" ) ; B . addSubCommand ( new Va ( z , G ) ) ; c . setBlurOffsets ( k , v ) ; h = B ; c . undoMgr . beginUndoableChange ( "stdDeviation" , [ k ? k . firstChild : null ] ) ; if ( F ) { c . setBlurNoUndo ( v ) ; e ( ) } } } } } ) ( ) ; this . getBold = function ( ) { var e = H [ 0 ] ; if ( e != null && e . tagName ==
"text" && H [ 1 ] == null ) return e . getAttribute ( "font-weight" ) == "bold" ; return false } ; this . setBold = function ( e ) { var h = H [ 0 ] ; if ( h != null && h . tagName == "text" && H [ 1 ] == null ) ob ( "font-weight" , e ? "bold" : "normal" ) ; H [ 0 ] . textContent || pb . setCursor ( ) } ; this . getItalic = function ( ) { var e = H [ 0 ] ; if ( e != null && e . tagName == "text" && H [ 1 ] == null ) return e . getAttribute ( "font-style" ) == "italic" ; return false } ; this . setItalic = function ( e ) { var h = H [ 0 ] ; if ( h != null && h . tagName == "text" && H [ 1 ] == null ) ob ( "font-style" , e ? "italic" : "normal" ) ; H [ 0 ] . textContent || pb . setCursor ( ) } ;
this . getFontFamily = function ( ) { return nb . font _family } ; this . setFontFamily = function ( e ) { nb . font _family = e ; ob ( "font-family" , e ) ; H [ 0 ] && ! H [ 0 ] . textContent && pb . setCursor ( ) } ; this . setFontColor = function ( e ) { nb . fill = e ; ob ( "fill" , e ) } ; this . getFontSize = function ( ) { return nb . fill } ; this . getFontSize = function ( ) { return nb . font _size } ; this . setFontSize = function ( e ) { nb . font _size = e ; ob ( "font-size" , e ) ; H [ 0 ] . textContent || pb . setCursor ( ) } ; this . getText = function ( ) { var e = H [ 0 ] ; if ( e == null ) return "" ; return e . textContent } ; this . setTextContent =
function ( e ) { ob ( "#text" , e ) ; pb . init ( e ) ; pb . setCursor ( ) } ; this . setImageURL = function ( e ) { var h = H [ 0 ] ; if ( h ) { var k = $ ( h ) . attr ( [ "width" , "height" ] ) ; k = ! k . width || ! k . height ; var w = ea ( h ) ; if ( w !== e ) k = true ; else if ( ! k ) return ; var v = new Na ( "Change Image URL" ) ; Z ( h , e ) ; v . addSubCommand ( new Va ( h , { "#href" : w } ) ) ; k ? $ ( new Image ) . load ( function ( ) { var F = $ ( h ) . attr ( [ "width" , "height" ] ) ; $ ( h ) . attr ( { width : this . width , height : this . height } ) ; La . requestSelector ( h ) . resize ( ) ; v . addSubCommand ( new Va ( h , F ) ) ; Aa ( v ) ; L ( "changed" , [ h ] ) } ) . attr ( "src" , e ) : Aa ( v ) } } ;
this . setLinkURL = function ( e ) { var h = H [ 0 ] ; if ( h ) { if ( h . tagName !== "a" ) { h = $ ( h ) . parents ( "a" ) ; if ( h . length ) h = h [ 0 ] ; else return } var k = ea ( h ) ; if ( k !== e ) { var w = new Na ( "Change Link URL" ) ; Z ( h , e ) ; w . addSubCommand ( new Va ( h , { "#href" : k } ) ) ; Aa ( w ) } } } ; this . setRectRadius = function ( e ) { var h = H [ 0 ] ; if ( h != null && h . tagName == "rect" ) { var k = h . getAttribute ( "rx" ) ; if ( k != e ) { h . setAttribute ( "rx" , e ) ; h . setAttribute ( "ry" , e ) ; Aa ( new Va ( h , { rx : k , ry : k } , "Radius" ) ) ; L ( "changed" , [ h ] ) } } } ; this . makeHyperlink = function ( e ) { c . groupSelectedElements ( "a" , e ) } ; this . removeHyperlink =
function ( ) { c . ungroupSelectedElement ( ) } ; this . setSegType = function ( e ) { Sa . setSegType ( e ) } ; this . convertToPath = function ( e , h ) { if ( e == null ) $ . each ( H , function ( va , ka ) { ka && c . convertToPath ( ka ) } ) ; else { if ( ! h ) var k = new Na ( "Convert element to Path" ) ; var w = h ? { } : { fill : N . fill , "fill-opacity" : N . fill _opacity , stroke : N . stroke , "stroke-width" : N . stroke _width , "stroke-dasharray" : N . stroke _dasharray , "stroke-linejoin" : N . stroke _linejoin , "stroke-linecap" : N . stroke _linecap , "stroke-opacity" : N . stroke _opacity , opacity : N . opacity , visibility : "hidden" } ;
$ . each ( [ "marker-start" , "marker-end" , "marker-mid" , "filter" , "clip-path" ] , function ( ) { if ( e . getAttribute ( this ) ) w [ this ] = e . getAttribute ( this ) } ) ; var v = S ( { element : "path" , attr : w } ) , F = e . getAttribute ( "transform" ) ; F && v . setAttribute ( "transform" , F ) ; var z = e . id , u = e . parentNode ; e . nextSibling ? u . insertBefore ( v , e ) : u . appendChild ( v ) ; var B = "" , G = function ( va ) { $ . each ( va , function ( ka , na ) { var q = na [ 1 ] ; B += na [ 0 ] ; for ( var E = 0 ; E < q . length ; E += 2 ) B += q [ E ] + "," + q [ E + 1 ] + " " } ) } , C = 1.81 ; switch ( e . tagName ) { case "ellipse" : case "circle" : var D = $ ( e ) . attr ( [ "rx" ,
"ry" , "cx" , "cy" ] ) , J = D . cx , I = D . cy , W = D . rx ; D = D . ry ; if ( e . tagName == "circle" ) W = D = $ ( e ) . attr ( "r" ) ; G ( [ [ "M" , [ J - W , I ] ] , [ "C" , [ J - W , I - D / C , J - W / C , I - D , J , I - D ] ] , [ "C" , [ J + W / C , I - D , J + W , I - D / C , J + W , I ] ] , [ "C" , [ J + W , I + D / C , J + W / C , I + D , J , I + D ] ] , [ "C" , [ J - W / C , I + D , J - W , I + D / C , J - W , I ] ] , [ "Z" , [ ] ] ] ) ; break ; case "path" : B = e . getAttribute ( "d" ) ; break ; case "line" : D = $ ( e ) . attr ( [ "x1" , "y1" , "x2" , "y2" ] ) ; B = "M" + D . x1 + "," + D . y1 + "L" + D . x2 + "," + D . y2 ; break ; case "polyline" : case "polygon" : B = "M" + e . getAttribute ( "points" ) ; break ; case "rect" : D = $ ( e ) . attr ( [ "rx" , "ry" ] ) ; W = D . rx ; D =
D . ry ; var X = e . getBBox ( ) ; J = X . x ; I = X . y ; var da = X . width ; X = X . height ; C = 4 - C ; ! W && ! D ? G ( [ [ "M" , [ J , I ] ] , [ "L" , [ J + da , I ] ] , [ "L" , [ J + da , I + X ] ] , [ "L" , [ J , I + X ] ] , [ "L" , [ J , I ] ] , [ "Z" , [ ] ] ] ) : G ( [ [ "M" , [ J , I + D ] ] , [ "C" , [ J , I + D / C , J + W / C , I , J + W , I ] ] , [ "L" , [ J + da - W , I ] ] , [ "C" , [ J + da - W / C , I , J + da , I + D / C , J + da , I + D ] ] , [ "L" , [ J + da , I + X - D ] ] , [ "C" , [ J + da , I + X - D / C , J + da - W / C , I + X , J + da - W , I + X ] ] , [ "L" , [ J + W , I + X ] ] , [ "C" , [ J + W / C , I + X , J , I + X - D / C , J , I + X - D ] ] , [ "L" , [ J , I + D ] ] , [ "Z" , [ ] ] ] ) ; break ; default : v . parentNode . removeChild ( v ) } B && v . setAttribute ( "d" , B ) ; if ( h ) { Sa . resetOrientation ( v ) ; k = false ;
try { k = v . getBBox ( ) } catch ( ra ) { } v . parentNode . removeChild ( v ) ; return k } else { if ( F ) { F = ba ( v ) ; ha ( F ) && Sa . resetOrientation ( v ) } k . addSubCommand ( new Qa ( e , e . nextSibling , u ) ) ; k . addSubCommand ( new Ja ( v ) ) ; Ya ( ) ; e . parentNode . removeChild ( e ) ; v . setAttribute ( "id" , z ) ; v . removeAttribute ( "visibility" ) ; Fb ( [ v ] , true ) ; Aa ( k ) } } } ; var Nb = this . changeSelectedAttributeNoUndo = function ( e , h , k ) { var w = d . suspendRedraw ( 1E3 ) ; Ka == "pathedit" && Sa . moveNode ( e , h ) ; k = k || H ; for ( var v = k . length , F = [ "g" , "polyline" , "path" ] ; v -- ; ) { var z = k [ v ] ; if ( z != null ) { Ka === "textedit" &&
e !== "#text" && z . textContent . length && pb . toSelectMode ( z ) ; if ( ( e === "x" || e === "y" ) && F . indexOf ( z . tagName ) >= 0 ) { var u = getStrokedBBox ( [ z ] ) ; c . moveSelectedElements ( ( e === "x" ? h - u . x : 0 ) * p , ( e === "y" ? h - u . y : 0 ) * p , true ) } else { u = e === "#text" ? z . textContent : z . getAttribute ( e ) ; if ( u == null ) u = "" ; if ( u !== String ( h ) ) { if ( e == "#text" ) { svgedit . utilities . getBBox ( z ) ; z . textContent = h } else e == "#href" ? Z ( z , h ) : z . setAttribute ( e , h ) ; H . indexOf ( z ) >= 0 && setTimeout ( function ( ) { z . parentNode && La . requestSelector ( z ) . resize ( ) } , 0 ) ; u = la ( z ) ; if ( u != 0 && e != "transform" ) for ( var B =
ba ( z ) , G = B . numberOfItems ; G -- ; ) if ( B . getItem ( G ) . type == 4 ) { B . removeItem ( G ) ; var C = svgedit . utilities . getBBox ( z ) , D = O ( C . x + C . width / 2 , C . y + C . height / 2 , U ( B ) . matrix ) ; C = D . x ; D = D . y ; var J = d . createSVGTransform ( ) ; J . setRotate ( u , C , D ) ; B . insertItemBefore ( J , G ) ; break } } } } } d . unsuspendRedraw ( w ) } , ob = this . changeSelectedAttribute = function ( e , h , k ) { k = k || H ; c . undoMgr . beginUndoableChange ( e , k ) ; Nb ( e , h , k ) ; e = c . undoMgr . finishUndoableChange ( ) ; e . isEmpty ( ) || Aa ( e ) } ; this . deleteSelectedElements = function ( ) { for ( var e = new Na ( "Delete Elements" ) , h = H . length ,
k = [ ] , w = 0 ; w < h ; ++ w ) { var v = H [ w ] ; if ( v == null ) break ; var F = v . parentNode , z = v ; La . releaseSelector ( z ) ; svgedit . path . removePath _ ( z . id ) ; if ( F . tagName === "a" && F . childNodes . length === 1 ) { z = F ; F = F . parentNode } var u = z . nextSibling ; z = F . removeChild ( z ) ; k . push ( v ) ; H [ w ] = null ; e . addSubCommand ( new Qa ( z , u , F ) ) } e . isEmpty ( ) || Aa ( e ) ; L ( "changed" , k ) ; Ya ( ) } ; this . cutSelectedElements = function ( ) { for ( var e = new Na ( "Cut Elements" ) , h = H . length , k = [ ] , w = 0 ; w < h ; ++ w ) { var v = H [ w ] ; if ( v == null ) break ; var F = v . parentNode , z = v ; La . releaseSelector ( z ) ; svgedit . path . removePath _ ( z . id ) ;
var u = z . nextSibling ; z = F . removeChild ( z ) ; k . push ( v ) ; H [ w ] = null ; e . addSubCommand ( new Qa ( z , u , F ) ) } e . isEmpty ( ) || Aa ( e ) ; L ( "changed" , k ) ; Ya ( ) ; c . clipBoard = k } ; this . copySelectedElements = function ( ) { c . clipBoard = $ . merge ( [ ] , H ) } ; this . pasteElements = function ( ) { var e = c . clipBoard , h = e . length ; if ( h ) { for ( var k = [ ] , w = new Na ( "Paste elements" ) ; h -- ; ) { var v = e [ h ] ; if ( v ) { var F = ga ( v ) ; if ( ! ua ( v . id ) ) F . id = v . id ; k . push ( F ) ; ( K || A ( ) . getCurrentLayer ( ) ) . appendChild ( F ) ; w . addSubCommand ( new Ja ( F ) ) } } svgCanvas . clearSelection ( ) ; setTimeout ( function ( ) { Kb ( k ) } ,
100 ) ; Aa ( w ) ; L ( "changed" , k ) } } ; this . groupSelectedElements = function ( e ) { e || ( e = "g" ) ; var h = "" ; switch ( e ) { case "a" : h = "Make hyperlink" ; var k = "" ; if ( arguments . length > 1 ) k = arguments [ 1 ] ; break ; default : e = "g" ; h = "Group Elements" } h = new Na ( h ) ; var w = S ( { element : e , attr : { id : R ( ) } } ) ; e === "a" && Z ( w , k ) ; h . addSubCommand ( new Ja ( w ) ) ; for ( k = H . length ; k -- ; ) { var v = H [ k ] ; if ( v != null ) { if ( v . parentNode . tagName === "a" && v . parentNode . childNodes . length === 1 ) v = v . parentNode ; var F = v . nextSibling , z = v . parentNode ; w . appendChild ( v ) ; h . addSubCommand ( new Oa ( v ,
F , z ) ) } } h . isEmpty ( ) || Aa ( h ) ; Kb ( [ w ] , true ) } ; var Vb = this . pushGroupProperties = function ( e , h ) { var k = e . childNodes , w = k . length , v = e . getAttribute ( "transform" ) , F = ba ( e ) , z = U ( F ) . matrix , u = new Na ( "Push group properties" ) , B = 0 , G = la ( e ) , C = $ ( e ) . attr ( [ "filter" , "opacity" ] ) , D , J ; for ( B = 0 ; B < w ; B ++ ) { var I = k [ B ] ; if ( I . nodeType === 1 ) { if ( C . opacity !== null && C . opacity !== 1 ) { I . getAttribute ( "opacity" ) ; var W = Math . round ( ( I . getAttribute ( "opacity" ) || 1 ) * C . opacity * 100 ) / 100 ; ob ( "opacity" , W , [ I ] ) } if ( C . filter ) { var X = W = this . getBlur ( I ) ; J || ( J = this . getBlur ( e ) ) ;
if ( W ) W = J - 0 + ( W - 0 ) ; else if ( W === 0 ) W = J ; if ( X ) D = fa ( I . getAttribute ( "filter" ) ) ; else if ( D ) { D = ga ( D ) ; wb ( ) . appendChild ( D ) } else D = fa ( C . filter ) ; D . id = I . id + "_" + ( D . firstChild . tagName === "feGaussianBlur" ? "blur" : "filter" ) ; ob ( "filter" , "url(#" + D . id + ")" , [ I ] ) ; if ( W ) { ob ( "stdDeviation" , W , [ D . firstChild ] ) ; c . setBlurOffsets ( D , W ) } } W = ba ( I ) ; if ( ~ I . tagName . indexOf ( "Gradient" ) ) W = null ; if ( W ) if ( I . tagName !== "defs" ) if ( F . numberOfItems ) { if ( G && F . numberOfItems == 1 ) { var da = F . getItem ( 0 ) . matrix , ra = d . createSVGMatrix ( ) ; if ( X = la ( I ) ) ra = W . getItem ( 0 ) . matrix ;
var va = svgedit . utilities . getBBox ( I ) , ka = U ( W ) . matrix , na = O ( va . x + va . width / 2 , va . y + va . height / 2 , ka ) ; va = G + X ; ka = d . createSVGTransform ( ) ; ka . setRotate ( va , na . x , na . y ) ; da = T ( da , ra , ka . matrix . inverse ( ) ) ; X && W . removeItem ( 0 ) ; if ( va ) W . numberOfItems ? W . insertItemBefore ( ka , 0 ) : W . appendItem ( ka ) ; if ( da . e || da . f ) { X = d . createSVGTransform ( ) ; X . setTranslate ( da . e , da . f ) ; W . numberOfItems ? W . insertItemBefore ( X , 0 ) : W . appendItem ( X ) } } else { X = I . getAttribute ( "transform" ) ; da = { } ; da . transform = X ? X : "" ; X = d . createSVGTransform ( ) ; da = U ( W ) . matrix ; ra = da . inverse ( ) ;
da = T ( ra , z , da ) ; X . setMatrix ( da ) ; W . appendItem ( X ) } ( I = lb ( I ) ) && u . addSubCommand ( I ) } } } if ( v ) { da = { } ; da . transform = v ; e . setAttribute ( "transform" , "" ) ; e . removeAttribute ( "transform" ) ; u . addSubCommand ( new Va ( e , da ) ) } if ( h && ! u . isEmpty ( ) ) return u } ; this . ungroupSelectedElement = function ( ) { var e = H [ 0 ] ; if ( $ ( e ) . data ( "gsvg" ) || $ ( e ) . data ( "symbol" ) ) Yb ( e ) ; else if ( e . tagName === "use" ) { var h = ua ( ea ( e ) . substr ( 1 ) ) ; $ ( e ) . data ( "symbol" , h ) . data ( "ref" , h ) ; Yb ( e ) } else { h = $ ( e ) . parents ( "a" ) ; if ( h . length ) e = h [ 0 ] ; if ( e . tagName === "g" || e . tagName === "a" ) { h =
new Na ( "Ungroup Elements" ) ; var k = Vb ( e , true ) ; k && h . addSubCommand ( k ) ; k = e . parentNode ; for ( var w = e . nextSibling , v = Array ( e . childNodes . length ) , F = 0 ; e . firstChild ; ) { var z = e . firstChild , u = z . nextSibling , B = z . parentNode ; if ( z . tagName === "title" ) { h . addSubCommand ( new Qa ( z , z . nextSibling , B ) ) ; B . removeChild ( z ) } else { v [ F ++ ] = z = k . insertBefore ( z , w ) ; h . addSubCommand ( new Oa ( z , u , B ) ) } } Ya ( ) ; w = e . nextSibling ; e = k . removeChild ( e ) ; h . addSubCommand ( new Qa ( e , w , k ) ) ; h . isEmpty ( ) || Aa ( h ) ; Fb ( v ) } } } ; this . moveToTopSelectedElement = function ( ) { var e = H [ 0 ] ;
if ( e != null ) { e = e ; var h = e . parentNode , k = e . nextSibling ; e = e . parentNode . appendChild ( e ) ; if ( k != e . nextSibling ) { Aa ( new Oa ( e , k , h , "top" ) ) ; L ( "changed" , [ e ] ) } } } ; this . moveToBottomSelectedElement = function ( ) { var e = H [ 0 ] ; if ( e != null ) { e = e ; var h = e . parentNode , k = e . nextSibling , w = e . parentNode . firstChild ; if ( w . tagName == "title" ) w = w . nextSibling ; if ( w . tagName == "defs" ) w = w . nextSibling ; e = e . parentNode . insertBefore ( e , w ) ; if ( k != e . nextSibling ) { Aa ( new Oa ( e , k , h , "bottom" ) ) ; L ( "changed" , [ e ] ) } } } ; this . moveUpDownSelected = function ( e ) { var h = H [ 0 ] ;
if ( h ) { ib = [ ] ; var k , w , v = $ ( Gb ( getStrokedBBox ( [ h ] ) ) ) . toArray ( ) ; e == "Down" && v . reverse ( ) ; $ . each ( v , function ( ) { if ( w ) { k = this ; return false } else if ( this == h ) w = true } ) ; if ( k ) { v = h . parentNode ; var F = h . nextSibling ; $ ( k ) [ e == "Down" ? "before" : "after" ] ( h ) ; if ( F != h . nextSibling ) { Aa ( new Oa ( h , F , v , "Move " + e ) ) ; L ( "changed" , [ h ] ) } } } } ; this . moveSelectedElements = function ( e , h , k ) { if ( e . constructor != Array ) { e /= p ; h /= p } k = k || true ; for ( var w = new Na ( "position" ) , v = H . length ; v -- ; ) { var F = H [ v ] ; if ( F != null ) { var z = d . createSVGTransform ( ) , u = ba ( F ) ; e . constructor ==
Array ? z . setTranslate ( e [ v ] , h [ v ] ) : z . setTranslate ( e , h ) ; u . numberOfItems ? u . insertItemBefore ( z , 0 ) : u . appendItem ( z ) ; ( z = lb ( F ) ) && w . addSubCommand ( z ) ; La . requestSelector ( F ) . resize ( ) } } if ( ! w . isEmpty ( ) ) { k && Aa ( w ) ; L ( "changed" , H ) ; return w } } ; this . cloneSelectedElements = function ( e , h , k ) { for ( var w = new Na ( "Clone Elements" ) , v = H . length , F = 0 ; F < v ; ++ F ) if ( H [ F ] == null ) break ; v = H . slice ( 0 , F ) ; this . clearSelection ( true ) ; for ( F = v . length ; F -- ; ) { var z = ga ( v [ F ] ) ; k && z . removeAttribute ( "transform" ) ; ( K || A ( ) . getCurrentLayer ( ) ) . appendChild ( z ) ; w . addSubCommand ( new Ja ( z ) ) } if ( ! w . isEmpty ( ) ) { Fb ( v . reverse ( ) ) ;
this . moveSelectedElements ( e , h , false ) ; Aa ( w ) } return z } ; this . alignSelectedElements = function ( e , h ) { var k = [ ] , w = Number . MAX _VALUE , v = Number . MIN _VALUE , F = Number . MAX _VALUE , z = Number . MIN _VALUE , u = Number . MIN _VALUE , B = Number . MIN _VALUE , G = H . length ; if ( G ) { for ( var C = 0 ; C < G ; ++ C ) { if ( H [ C ] == null ) break ; k [ C ] = getStrokedBBox ( [ H [ C ] ] ) ; switch ( h ) { case "smallest" : if ( ( e == "l" || e == "c" || e == "r" ) && ( u == Number . MIN _VALUE || u > k [ C ] . width ) || ( e == "t" || e == "m" || e == "b" ) && ( B == Number . MIN _VALUE || B > k [ C ] . height ) ) { w = k [ C ] . x ; F = k [ C ] . y ; v = k [ C ] . x + k [ C ] . width ; z = k [ C ] . y +
k [ C ] . height ; u = k [ C ] . width ; B = k [ C ] . height } break ; case "largest" : if ( ( e == "l" || e == "c" || e == "r" ) && ( u == Number . MIN _VALUE || u < k [ C ] . width ) || ( e == "t" || e == "m" || e == "b" ) && ( B == Number . MIN _VALUE || B < k [ C ] . height ) ) { w = k [ C ] . x ; F = k [ C ] . y ; v = k [ C ] . x + k [ C ] . width ; z = k [ C ] . y + k [ C ] . height ; u = k [ C ] . width ; B = k [ C ] . height } break ; default : if ( k [ C ] . x < w ) w = k [ C ] . x ; if ( k [ C ] . y < F ) F = k [ C ] . y ; if ( k [ C ] . x + k [ C ] . width > v ) v = k [ C ] . x + k [ C ] . width ; if ( k [ C ] . y + k [ C ] . height > z ) z = k [ C ] . y + k [ C ] . height } } if ( h == "page" ) { F = w = 0 ; v = c . contentW ; z = c . contentH } u = Array ( G ) ; B = Array ( G ) ; for ( C = 0 ; C < G ; ++ C ) { if ( H [ C ] ==
null ) break ; var D = k [ C ] ; u [ C ] = 0 ; B [ C ] = 0 ; switch ( e ) { case "l" : u [ C ] = w - D . x ; break ; case "c" : u [ C ] = ( w + v ) / 2 - ( D . x + D . width / 2 ) ; break ; case "r" : u [ C ] = v - ( D . x + D . width ) ; break ; case "t" : B [ C ] = F - D . y ; break ; case "m" : B [ C ] = ( F + z ) / 2 - ( D . y + D . height / 2 ) ; break ; case "b" : B [ C ] = z - ( D . y + D . height ) } } this . moveSelectedElements ( u , B ) } } ; this . contentW = Lb ( ) . w ; this . contentH = Lb ( ) . h ; this . updateCanvas = function ( e , h ) { d . setAttribute ( "width" , e ) ; d . setAttribute ( "height" , h ) ; var k = $ ( "#canvasBackground" ) [ 0 ] , w = l . getAttribute ( "x" ) , v = l . getAttribute ( "y" ) , F = e / 2 - this . contentW *
p / 2 , z = h / 2 - this . contentH * p / 2 ; pa ( l , { width : this . contentW * p , height : this . contentH * p , x : F , y : z , viewBox : "0 0 " + this . contentW + " " + this . contentH } ) ; pa ( k , { width : l . getAttribute ( "width" ) , height : l . getAttribute ( "height" ) , x : F , y : z } ) ; ( k = ua ( "background_image" ) ) && pa ( k , { width : "100%" , height : "100%" } ) ; La . selectorParentGroup . setAttribute ( "transform" , "translate(" + F + "," + z + ")" ) ; return { x : F , y : z , old _x : w , old _y : v , d _x : F - w , d _y : z - v } } ; this . setBackground = function ( e , h ) { var k = ua ( "canvasBackground" ) , w = $ ( k ) . find ( "rect" ) [ 0 ] , v = ua ( "background_image" ) ;
w . setAttribute ( "fill" , e ) ; if ( h ) { if ( ! v ) { v = f . createElementNS ( b , "image" ) ; pa ( v , { id : "background_image" , width : "100%" , height : "100%" , preserveAspectRatio : "xMinYMin" , style : "pointer-events:none" } ) } Z ( v , h ) ; k . appendChild ( v ) } else v && v . parentNode . removeChild ( v ) } ; this . cycleElement = function ( e ) { var h = H [ 0 ] , k = false , w = Ab ( K || A ( ) . getCurrentLayer ( ) ) ; if ( w . length ) { if ( h == null ) { e = e ? w . length - 1 : 0 ; k = w [ e ] } else for ( var v = w . length ; v -- ; ) if ( w [ v ] == h ) { e = e ? v - 1 : v + 1 ; if ( e >= w . length ) e = 0 ; else if ( e < 0 ) e = w . length - 1 ; k = w [ e ] ; break } Kb ( [ k ] , true ) ; L ( "selected" ,
H ) } } ; this . clear ( ) ; this . getPrivateMethods = function ( ) { return { addCommandToHistory : Aa , setGradient : $b , addSvgElementFromJson : S , assignAttributes : pa , BatchCommand : Na , call : L , ChangeElementCommand : Va , copyElem : ga , ffClone : Fa , findDefs : wb , findDuplicateGradient : Zb , getElem : ua , getId : sa , getIntersectionList : Gb , getMouseTarget : Ub , getNextId : R , getPathBBox : Y , getUrlFromAttr : ja , hasMatrixTransform : ha , identifyLayers : Mb , InsertElementCommand : Ja , isIdentity : svgedit . math . isIdentity , logMatrix : rb , matrixMultiply : T , MoveElementCommand : Oa ,
preventClickDefault : Tb , recalculateAllSelectedDimensions : Xa , recalculateDimensions : lb , remapElement : ub , RemoveElementCommand : Qa , removeUnusedDefElems : Db , round : vb , runExtensions : kb , sanitizeSvg : Ma , SVGEditTransformList : svgedit . transformlist . SVGTransformList , toString : toString , transformBox : svgedit . math . transformBox , transformListToTransform : U , transformPoint : O , walkTree : svgedit . utilities . walkTree } } } ; ( function ( ) { document . addEventListener ( "touchstart" , touchHandler , true ) ; document . addEventListener ( "touchmove" , touchHandler , true ) ; document . addEventListener ( "touchend" , touchHandler , true ) ; document . addEventListener ( "touchcancel" , touchHandler , true ) ; if ( ! window . svgEditor ) window . svgEditor = function ( a ) { function n ( d , l ) { var o = g . setSvgString ( d ) !== false ; l = l || a . noop ; o ? l ( true ) : a . alert ( uiStrings . notification . errorLoadingSVG , function ( ) { l ( false ) } ) } var g , b = { } , m = false ; curConfig = { canvas _expansion : 1 , dimensions : [ 580 , 400 ] ,
initFill : { color : "fff" , opacity : 1 } , initStroke : { width : 1.5 , color : "000" , opacity : 1 } , initOpacity : 1 , imgPath : "images/" , extPath : "extensions/" , jGraduatePath : "jgraduate/images/" , extensions : [ ] , initTool : "select" , wireframe : false , colorPickerCSS : false , gridSnapping : false , gridColor : "#000" , baseUnit : "px" , snappingStep : 10 , showRulers : svgedit . browser . isTouch ( ) ? false : true , show _outside _canvas : false , no _save _warning : true , initFont : "Sans-serif" } ; uiStrings = b . uiStrings = { common : { ok : "OK" , cancel : "Cancel" , key _up : "Up" , key _down : "Down" ,
2012-07-19 14:54:50 +00:00
key _backspace : "Backspace" , key _del : "Del" } , layers : { layer : "Layer" } , notification : { invalidAttrValGiven : "Invalid value given" , noContentToFitTo : "No content to fit to" , dupeLayerName : "There is already a layer named that!" , enterUniqueLayerName : "Please enter a unique layer name" , enterNewLayerName : "Please enter the new layer name" , layerHasThatName : "Layer already has that name" , QmoveElemsToLayer : 'Move selected elements to layer "%s"?' , QwantToClear : "Do you want to clear the drawing?\nThis will also erase your undo history!" ,
QwantToOpen : "Do you want to open a new file?\nThis will also erase your undo history!" , QerrorsRevertToSource : "There were parsing errors in your SVG source.\nRevert back to original SVG source?" , QignoreSourceChanges : "Ignore changes made to SVG source?" , featNotSupported : "Feature not supported" , enterNewImgURL : "Enter the new image URL" , defsFailOnSave : "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved." , loadingImage : "Loading image, please wait..." ,
2012-07-24 02:30:12 +00:00
saveFromBrowser : 'Select "Save As..." in your browser to save this image as a %s file.' , noteTheseIssues : "Also note the following issues: " , unsavedChanges : "There are unsaved changes." , enterNewLinkURL : "Enter the new hyperlink URL" , errorLoadingSVG : "Error: Unable to load SVG data" , URLloadFail : "Unable to load from URL" , retrieving : 'Retrieving "%s" ...' } } ; var s = { } , c = { } ; b . curConfig = curConfig ; b . tool _scale = 1 ; b . setConfig = function ( d ) { a . each ( d , function ( l , o ) { l in defaultPrefs && a . pref ( l , o ) } ) ; a . extend ( true , curConfig ,
d ) ; if ( d . extensions ) curConfig . extensions = d . extensions } ; b . setCustomHandlers = function ( d ) { b . ready ( function ( ) { if ( d . open ) { a ( '#tool_open > input[type="file"]' ) . remove ( ) ; a ( "#tool_open" ) . show ( ) ; g . open = d . open } if ( d . save ) { b . show _save _warning = false ; g . bind ( "saved" , d . save ) } d . pngsave && g . bind ( "exported" , d . pngsave ) ; c = d } ) } ; b . randomizeIds = function ( ) { g . randomizeIds ( arguments ) } ; b . init = function ( ) { function d ( q , E ) { var M = q . id , V = M . split ( "_" ) , ca = V [ 0 ] ; V = V [ 1 ] ; E && g . setStrokeAttr ( "stroke-" + ca , V ) ; $a ( ) ; k ( "#cur_" + ca , M , 20 ) ; a ( q ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) }
function l ( q , E ) { var M = document . getElementById ( "ruler_x_cursor" ) , V = document . getElementById ( "ruler_y_cursor" ) , ca = document . getElementById ( "workarea" ) ; document . getElementById ( "title_show" ) ; svgedit . browser . isTouch ( ) && a ( "#workarea" ) . unbind ( "mousemove.rulers" ) . bind ( "mousemove.rulers" , function ( ac ) { ac . stopPropagation ( ) ; M . style . left = ac . pageX - 66 + ca . scrollLeft + "px" ; V . style . top = ac . pageY - 48 + ca . scrollTop + "px" } ) ; E || ( E = g . getZoom ( ) ) ; q || ( q = a ( "#svgcanvas" ) ) ; for ( var ia = g . getContentElem ( ) , ta = svgedit . units . getTypeMap ( ) [ curConfig . baseUnit ] ,
za = 0 ; za < 2 ; za ++ ) { var ya = za === 0 , xa = ya ? "x" : "y" , Ga = ya ? "width" : "height" , mb = ia . getAttribute ( xa ) - 0 ; xa = a ( "#ruler_" + xa + " canvas:first" ) ; $hcanv = xa . clone ( ) ; xa . replaceWith ( $hcanv ) ; var Ua = $hcanv [ 0 ] ; var ma = xa = q [ Ga ] ( ) * 2 ; Ua . parentNode . style [ Ga ] = ma + "px" ; var xb = 0 , ab , Ba = Ua . getContext ( "2d" ) ; Ba . fillStyle = "rgb(200,0,0)" ; Ba . fillRect ( 0 , 0 , Ua . width , Ua . height ) ; $hcanv . siblings ( ) . remove ( ) ; if ( xa >= 3E4 ) { var Wa = parseInt ( xa / 3E4 ) + 1 ; ab = Array ( Wa ) ; ab [ 0 ] = Ba ; for ( var Da = 1 ; Da < Wa ; Da ++ ) { Ua [ Ga ] = 3E4 ; var eb = Ua . cloneNode ( true ) ; Ua . parentNode . appendChild ( eb ) ;
ab [ Da ] = eb . getContext ( "2d" ) } eb [ Ga ] = xa % 3E4 ; xa = 3E4 } Ua [ Ga ] = xa ; Ga = ta * E ; var bb = 50 / Ga ; Ua = 1 ; for ( Da = 0 ; Da < va . length ; Da ++ ) { Ua = Wa = va [ Da ] ; if ( bb <= Wa ) break } bb = Ua * Ga ; Ba . font = "normal 9px 'Lucida Grande', sans-serif" ; Ba . fillStyle = "#777" ; for ( var gb = mb / Ga % Ua * Ga , Rb = gb - bb ; gb < ma ; gb += bb ) { Rb += bb ; Da = Math . round ( gb ) + 0.5 ; if ( ya ) { Ba . moveTo ( Da , 15 ) ; Ba . lineTo ( Da , 0 ) } else { Ba . moveTo ( 15 , Da ) ; Ba . lineTo ( 0 , Da ) } Wa = ( Rb - mb ) / Ga ; if ( Ua >= 1 ) Da = Math . round ( Wa ) ; else { Da = ( Ua + "" ) . split ( "." ) [ 1 ] . length ; Da = Wa . toFixed ( Da ) - 0 } if ( Da !== 0 && Da !== 1E3 && Da % 1E3 === 0 ) Da =
Da / 1E3 + "K" ; if ( ya ) { Ba . fillText ( Da , gb + 2 , 8 ) ; Ba . fillStyle = "#777" } else { Wa = ( Da + "" ) . split ( "" ) ; for ( Da = 0 ; Da < Wa . length ; Da ++ ) { Ba . fillText ( Wa [ Da ] , 1 , gb + 9 + Da * 9 ) ; Ba . fillStyle = "#777" } } Wa = bb / 10 ; for ( Da = 1 ; Da < 10 ; Da ++ ) { var Hb = Math . round ( gb + Wa * Da ) + 0.5 ; if ( ab && Hb > xa ) { xb ++ ; Ba . stroke ( ) ; if ( xb >= ab . length ) { Da = 10 ; gb = ma ; continue } Ba = ab [ xb ] ; gb -= 3E4 ; Hb = Math . round ( gb + Wa * Da ) + 0.5 } var Ob = Da % 2 ? 12 : 10 ; if ( ya ) { Ba . moveTo ( Hb , 15 ) ; Ba . lineTo ( Hb , Ob ) } else { Ba . moveTo ( 15 , Hb ) ; Ba . lineTo ( Ob , Hb ) } } } Ba . strokeStyle = "#666" ; Ba . stroke ( ) } } ( function ( ) { var q = window . opener ;
if ( q ) try { var E = q . document . createEvent ( "Event" ) ; E . initEvent ( "svgEditorReady" , true , true ) ; q . document . documentElement . dispatchEvent ( E ) } catch ( M ) { } } ) ( ) ; ( function ( ) { a ( "#canvas_width" ) . val ( curConfig . dimensions [ 0 ] ) ; a ( "#canvas_height" ) . val ( curConfig . dimensions [ 1 ] ) ; a ( "body" ) . toggleClass ( "touch" , svgedit . browser . isTouch ( ) ) ; var q = a . deparam . querystring ( true ) ; if ( ! a . isEmptyObject ( q ) ) { if ( q . dimensions ) q . dimensions = q . dimensions . split ( "," ) ; if ( q . extensions ) q . extensions = q . extensions . split ( "," ) ; if ( q . bkgd _color ) q . bkgd _color =
"#" + q . bkgd _color ; svgEditor . setConfig ( q ) ; var E = q . source , M = a . param . querystring ( ) ; if ( ! E ) if ( M . indexOf ( "source=data:" ) >= 0 ) E = M . match ( /source=(data:[^&]*)/ ) [ 1 ] ; if ( E ) if ( E . indexOf ( "data:" ) === 0 ) { E = E . replace ( / /g , "+" ) ; b . loadFromDataURI ( E ) } else b . loadFromString ( E ) ; else if ( M . indexOf ( "paramurl=" ) !== - 1 ) svgEditor . loadFromURL ( M . substr ( 9 ) ) ; else q . url && svgEditor . loadFromURL ( q . url ) } } ) ( ) ; var o = function ( ) { a . each ( curConfig . extensions , function ( ) { var q = this ; a . getScript ( curConfig . extPath + q , function ( E ) { if ( ! E ) { E = document . createElement ( "script" ) ;
E . src = curConfig . extPath + q ; document . querySelector ( "head" ) . appendChild ( E ) } } ) } ) } ; document . location . protocol === "file:" ? setTimeout ( o , 100 ) : o ( ) ; a . svgIcons ( curConfig . imgPath + "svg_edit_icons.svg" , { w : 27 , h : 27 , id _match : false , no _img : ! svgedit . browser . isWebkit ( ) , fallback _path : curConfig . imgPath , fallback : { logo : "logo.png" , select : "select.png" , select _node : "select_node.png" , pencil : "fhpath.png" , pen : "line.png" , square : "square.png" , rect : "rect.png" , fh _rect : "freehand-square.png" , circle : "circle.png" , ellipse : "ellipse.png" , fh _ellipse : "freehand-circle.png" ,
path : "path.png" , text : "text.png" , image : "image.png" , zoom : "zoom.png" , "delete" : "delete.png" , node _delete : "node_delete.png" , align _left : "align-left.png" , align _center : "align-center" , align _right : "align-right" , align _top : "align-top" , align _middle : "align-middle" , align _bottom : "align-bottom" , arrow _right : "flyouth.png" , arrow _down : "dropdown.gif" } , placement : { "#logo" : "logo" , "#tool_select" : "select" , "#tool_fhpath" : "pencil" , "#tool_line" : "pen" , "#tool_rect,#tools_rect_show" : "rect" , "#tool_square" : "square" , "#tool_fhrect" : "fh_rect" ,
"#tool_ellipse,#tools_ellipse_show" : "ellipse" , "#tool_circle" : "circle" , "#tool_fhellipse" : "fh_ellipse" , "#tool_path" : "path" , "#tool_text,#layer_rename" : "text" , "#tool_image" : "image" , "#tool_zoom" : "zoom" , "#tool_node_clone" : "node_clone" , "#tool_node_delete" : "node_delete" , "#tool_add_subpath" : "add_subpath" , "#tool_openclose_path" : "open_path" , "#tool_alignleft, #tool_posleft" : "align_left" , "#tool_aligncenter, #tool_poscenter" : "align_center" , "#tool_alignright, #tool_posright" : "align_right" , "#tool_aligntop, #tool_postop" : "align_top" ,
"#tool_alignmiddle, #tool_posmiddle" : "align_middle" , "#tool_alignbottom, #tool_posbottom" : "align_bottom" , "#cur_position" : "align" , "#zoomLabel" : "zoom" , "#palette .palette_item:first, #fill_bg, #stroke_bg" : "no_color" } , resize : { "#logo .svg_icon" : 15 , ".flyout_arrow_horiz .svg_icon" : 5 , ".layer_button .svg_icon, #layerlist td.layervis .svg_icon" : 14 , "#main_button .dropdown .svg_icon" : 9 , "#fill_bg .svg_icon, #stroke_bg .svg_icon" : svgedit . browser . isTouch ( ) ? 36 : 24 , ".palette_item:first .svg_icon" : svgedit . browser . isTouch ( ) ?
30 : 16 , ".toolbar_button button .svg_icon" : 16 , ".stroke_tool div div .svg_icon" : 20 , "#tools_bottom label .svg_icon" : 18 , "#zoom_dropdown .svg_icon" : 7 } , callback : function ( ) { a ( ".toolbar_button button > svg, .toolbar_button button > img" ) . each ( function ( ) { a ( this ) . parent ( ) . prepend ( this ) } ) ; a ( ".tool_button, .tool_button_current" ) . addClass ( "loaded" ) ; var q = a ( "#tools_left" ) ; if ( q . length != 0 ) { q . offset ( ) ; q . outerHeight ( ) } a ( ".tools_flyout" ) . each ( function ( ) { var E = a ( "#" + this . id + "_show" ) , M = E . attr ( "data-curopt" ) ; if ( ! E . children ( "svg, img" ) . length ) { M =
a ( M ) . children ( ) . clone ( ) ; if ( M . length ) { M [ 0 ] . removeAttribute ( "style" ) ; E . append ( M ) } } } ) ; svgEditor . runCallbacks ( ) ; setTimeout ( function ( ) { a ( ".flyout_arrow_horiz:empty" ) . each ( function ( ) { a ( this ) . append ( a . getSvgIcon ( "arrow_right" ) . width ( 5 ) . height ( 5 ) ) } ) } , 1 ) } } ) ; a ( "#rulers" ) . on ( "dblclick" , function ( q ) { a ( "#base_unit_container" ) . css ( { top : q . pageY - 10 , left : q . pageX - 50 , display : "block" } ) } ) ; a ( "#base_unit_container" ) . on ( "mouseleave mouseenter" , function ( ) { t = setTimeout ( function ( ) { a ( "#base_unit_container" ) . fadeOut ( 500 ) } , 200 ) ;
event . type == "mouseover" && clearTimeout ( t ) } ) ; a ( "#base_unit" ) . on ( "change" , function ( ) { savePreferences ( ) } ) ; b . canvas = g = new a . SvgCanvas ( document . getElementById ( "svgcanvas" ) , curConfig ) ; b . show _save _warning = false ; b . paintBox = { fill : null , stroke : null , canvas : null } ; o = navigator . platform . indexOf ( "Mac" ) >= 0 ; var A = navigator . userAgent . indexOf ( "AppleWebKit" ) >= 0 , p = o ? "meta+" : "ctrl+" , K = g . pathActions , Q = g . undoMgr , N = svgedit . utilities , H = curConfig . imgPath + "placeholder.svg" , S = a ( "#workarea" ) , ba = null , O = 1 , T = "toolbars" , ha = "" ; o || a ( ".shortcut" ) . each ( function ( ) { var q =
a ( this ) . text ( ) ; a ( this ) . text ( q . split ( "\u2318" ) . join ( "Ctrl+" ) ) } ) ; ( function ( ) { a ( "#dialog_container" ) . draggable ( { cancel : "#dialog_content, #dialog_buttons *" , containment : "window" } ) ; var q = a ( "#dialog_box" ) , E = a ( "#dialog_buttons" ) , M = function ( V , ca , ia , ta ) { a ( "#dialog_content" ) . html ( "<p>" + ca . replace ( /\n/g , "</p><p>" ) + "</p>" ) . toggleClass ( "prompt" , V == "prompt" ) ; E . empty ( ) ; var za = a ( '<input type="button" value="' + uiStrings . common . ok + '">' ) . appendTo ( E ) ; V != "alert" && a ( '<input type="button" value="' + uiStrings . common . cancel +
'">' ) . appendTo ( E ) . on ( "click, touchstart" , function ( ) { q . hide ( ) ; ia ( false ) } ) ; if ( V == "prompt" ) { var ya = a ( '<input type="text">' ) . prependTo ( E ) ; ya . val ( ta || "" ) ; ya . bind ( "keydown" , "return" , function ( ) { za . trigger ( "click touchstart" ) } ) } V == "process" && za . hide ( ) ; q . show ( ) ; za . on ( "click touchstart" , function ( ) { q . hide ( ) ; var xa = V == "prompt" ? ya . val ( ) : true ; ia && ia ( xa ) } ) . focus ( ) ; V == "prompt" && ya . focus ( ) } ; a . alert = function ( V , ca ) { M ( "alert" , V , ca ) } ; a . confirm = function ( V , ca ) { M ( "confirm" , V , ca ) } ; a . process _cancel = function ( V , ca ) { M ( "process" ,
V , ca ) } ; a . prompt = function ( V , ca , ia ) { M ( "prompt" , V , ia , ca ) } } ) ( ) ; var U = function ( ) { var q = a ( ".tool_button_current" ) ; if ( q . length && q [ 0 ] . id !== "tool_select" ) { q . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) } g . setMode ( "select" ) } , P = null , aa = false , wa = false , ja = "" , ea = a ( "title:first" ) . text ( ) , Z = function ( q , E ) { var M = g . getResolution ( ) ; a ( "#svgcanvas" ) . position ( ) ; var V = g . setBBoxZoom ( E , S . width ( ) - 15 , S . height ( ) - 15 ) ; if ( V ) { var ca = V . zoom ; V =
V . bbox ; if ( ca < 0.0010 ) Ea ( { value : 0.1 } ) ; else { var ia = Date . now ( ) , ta = ca - M . zoom ; a ( "#zoom" ) ; var za = M . zoom ; console . log ( ta ) ; var ya = function ( xa ) { xa = ( xa - ia ) / 500 ; xa = Math . pow ( xa - 1 , 3 ) + 1 ; g . setZoom ( za + ta * xa ) ; ra ( ) ; xa < 1 ? requestAnimationFrame ( ya ) : a ( "#zoom" ) . val ( ca * 100 ) } ; ya ( Date . now ( ) ) ; g . getMode ( ) == "zoom" && V . width && U ( ) ; ob ( ) } } } ; a ( "#cur_context_panel" ) . delegate ( "a" , "click" , function ( ) { var q = a ( this ) ; q . attr ( "data-root" ) ? g . leaveContext ( ) : g . setContext ( q . text ( ) ) ; return false } ) ; var Y = function ( ) { b . paintBox . fill . prep ( ) ; b . paintBox . stroke . prep ( ) } ,
la = { } , ua = function ( q ) { a . each ( q , function ( E , M ) { var V = a ( E ) . children ( ) , ca = E + "_show" , ia = a ( ca ) , ta = false ; V . addClass ( "tool_button" ) . unbind ( "click mousedown mouseup" ) . each ( function ( xa ) { var Ga = M [ xa ] ; la [ Ga . sel ] = Ga . fn ; if ( Ga . isDefault ) ta = xa ; xa = function ( mb ) { var Ua = Ga ; if ( mb . type === "keydown" ) { var ma = a ( Ua . parent + "_show" ) . hasClass ( "tool_button_current" ) , xb = a ( Ua . parent + "_show" ) . attr ( "data-curopt" ) ; a . each ( q [ Ga . parent ] , function ( Ba , Wa ) { if ( Wa . sel == xb ) Ua = ! mb . shiftKey || ! ma ? Wa : q [ Ga . parent ] [ Ba + 1 ] || q [ Ga . parent ] [ 0 ] } ) } if ( a ( this ) . hasClass ( "disabled" ) ) return false ;
Pa ( ca ) && Ua . fn ( ) ; var ab = Ua . icon ? a . getSvgIcon ( Ua . icon , true ) : a ( Ua . sel ) . children ( ) . eq ( 0 ) . clone ( ) ; ab [ 0 ] . setAttribute ( "width" , ia . width ( ) ) ; ab [ 0 ] . setAttribute ( "height" , ia . height ( ) ) ; ia . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; ia . append ( ab ) . attr ( "data-curopt" , Ua . sel ) } ; a ( this ) . mouseup ( xa ) ; Ga . key && a ( document ) . bind ( "keydown" , Ga . key [ 0 ] + " shift+" + Ga . key [ 0 ] , xa ) } ) ; if ( ta ) ia . attr ( "data-curopt" , M [ ta ] . sel ) ; else ia . attr ( "data-curopt" ) || ia . attr ( "data-curopt" , M [ 0 ] . sel ) ; var za , ya = a ( ca ) . position ( ) ; a ( E ) . css ( { left : ya . left +
34 , top : ya . top + 77 } ) ; ia . mousedown ( function ( xa ) { a ( "#tools_shapelib" ) . is ( ":visible" ) && Pa ( ca , false ) ; if ( ia . hasClass ( "disabled" ) ) return false ; var Ga = a ( E ) , mb = ya . left + 34 , Ua = Ga . width ( ) * - 1 , ma = Ga . data ( "shown_popop" ) ? 200 : 0 ; za = setTimeout ( function ( ) { ia . data ( "isLibrary" ) ? Ga . css ( "left" , mb ) . show ( ) : Ga . css ( "left" , Ua ) . show ( ) . animate ( { left : mb } , 150 ) ; Ga . data ( "shown_popop" , true ) } , ma ) ; xa . preventDefault ( ) } ) . mouseup ( function ( ) { clearTimeout ( za ) ; var xa = a ( this ) . attr ( "data-curopt" ) ; if ( ia . data ( "isLibrary" ) && a ( ca . replace ( "_show" ,
"" ) ) . is ( ":visible" ) ) Pa ( ca , true ) ; else Pa ( ca ) && xa in la && la [ xa ] ( ) } ) } ) ; Ha ( ) } , pa = function ( q , E ) { return a ( "<div>" , { "class" : "tools_flyout" , id : q } ) . appendTo ( "#svg_editor" ) . append ( E ) } , qa = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var q = a ( "#" + this . id + "_show" ) , E = q . offset ( ) ; q = q . outerWidth ( ) ; a ( this ) . css ( { left : ( E . left + q ) * O , top : E . top } ) } ) } , Ha = function ( ) { a ( ".tools_flyout" ) . each ( function ( ) { var q = a ( "#" + this . id + "_show" ) ; if ( ! q . data ( "isLibrary" ) ) { var E = [ ] ; a ( this ) . children ( ) . each ( function ( ) { E . push ( this . title ) } ) ; q [ 0 ] . title =
E . join ( " / " ) } } ) } , Ma , Oa = function ( q , E , M ) { var V = null ; if ( q . indexOf ( "url(#" ) === 0 ) { q = ( q = g . getRefElem ( q ) ) ? q . cloneNode ( true ) : a ( "#" + M + "_color defs *" ) [ 0 ] ; V = { alpha : E } ; V [ q . tagName ] = q } else V = q . indexOf ( "#" ) === 0 ? { alpha : E , solidColor : q . substr ( 1 ) } : { alpha : E , solidColor : "none" } ; return new a . jGraduate . Paint ( V ) } , Ja = g . getResolution ( ) ; if ( curConfig . baseUnit !== "px" ) { Ja . w = svgedit . units . convertUnit ( Ja . w ) + curConfig . baseUnit ; Ja . h = svgedit . units . convertUnit ( Ja . h ) + curConfig . baseUnit } var Qa = function ( q ) { g . createLayer ( "background" ) ;
cur _shape = g . addSvgElementFromJson ( { element : "rect" , attr : { x : - 1 , y : - 1 , width : Ja . w + 2 , height : Ja . h + 2 , stroke : "none" , id : "canvas_background" , opacity : 1 , fill : q || "#fff" , style : "pointer-events:none" } } ) ; g . setCurrentLayer ( "Layer 1" ) ; g . setCurrentLayerPosition ( "1" ) } ; document . getElementById ( "canvas_background" ) || Qa ( ) ; document . getElementById ( "canvas_background" ) . getAttribute ( "fill" ) ; var Va = b . setImageURL = function ( q ) { q || ( q = H ) ; g . setImageURL ( q ) ; a ( "#image_url" ) . val ( q ) } , Na = function ( q ) { var E = Math . min ( Math . max ( 12 + q . value . length *
6 , 50 ) , 300 ) ; a ( q ) . width ( E ) } , Aa = function ( ) { var q = P ; if ( q != null && ! q . parentNode ) q = null ; g . getCurrentDrawing ( ) . getCurrentLayerName ( ) ; var E = g . getMode ( ) , M = curConfig . baseUnit !== "px" ? curConfig . baseUnit : null , V = E == "pathedit" , ca = a ( "#cmenu_canvas li" ) ; a ( "#selected_panel, #multiselected_panel, #g_panel, #path_panel, #rect_panel, #canvas_panel, #circle_panel,\t\t\t\t\t#ellipse_panel, #line_panel, #text_panel, #image_panel, #container_panel, #use_panel, #a_panel" ) . hide ( ) ; a ( ".menu_item" , "#edit_menu" ) . addClass ( "disabled" ) ;
a ( ".menu_item" , "#object_menu" ) . addClass ( "disabled" ) ; ! q && ! aa && a ( "#canvas_panel" ) . show ( ) ; if ( q != null ) { var ia = q . nodeName , ta = g . getRotationAngle ( q ) ; a ( "#angle" ) . val ( Math . round ( ta ) ) ; ta = g . getBlur ( q ) ; a ( "#blur" ) . val ( ta ) ; if ( ! V && E != "pathedit" ) { a ( "#selected_panel" ) . show ( ) ; a ( ".action_selected" ) . removeClass ( "disabled" ) ; var za , ya ; if ( [ "g" , "polyline" , "path" ] . indexOf ( ia ) >= 0 ) if ( E = g . getStrokedBBox ( [ q ] ) ) { za = E . x ; ya = E . y } if ( M ) { za = svgedit . units . convertUnit ( za ) ; ya = svgedit . units . convertUnit ( ya ) } a ( "#" + ia + "_x" ) . val ( Math . round ( za ) ) ;
a ( "#" + ia + "_y" ) . val ( Math . round ( ya ) ) ; [ "image" , "text" , "path" , "g" , "use" ] . indexOf ( ia ) == - 1 && a ( ".action_path_convert_selected" ) . removeClass ( "disabled" ) ; ia === "path" && a ( ".action_path_selected" ) . removeClass ( "disabled" ) } else { ca = K . getNodePoint ( ) ; a ( "#tool_add_subpath" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; a ( "#tool_node_delete" ) . toggleClass ( "disabled" , ! K . canDeleteNodes ) ; k ( "#tool_openclose_path" , K . closed _subpath ? "open_path" : "close_path" ) ; if ( ca ) { ia = a ( "#seg_type" ) ; if ( M ) { ca . x = svgedit . units . convertUnit ( ca . x ) ;
ca . y = svgedit . units . convertUnit ( ca . y ) } a ( "#path_node_x" ) . val ( Math . round ( ca . x ) ) ; a ( "#path_node_y" ) . val ( Math . round ( ca . y ) ) ; ca . type ? ia . val ( ca . type ) . removeAttr ( "disabled" ) : ia . val ( 4 ) . attr ( "disabled" , "disabled" ) } return } M = null ; if ( xa === "a" ) { M = g . getHref ( q ) ; a ( "#g_panel" ) . show ( ) } if ( q . parentNode . tagName === "a" ) if ( ! a ( q ) . siblings ( ) . length ) { a ( "#a_panel" ) . show ( ) ; M = g . getHref ( q . parentNode ) } a ( "#tool_make_link, #tool_make_link" ) . toggle ( ! M ) ; M && a ( "#link_url" ) . val ( M ) ; M = { g : [ ] , a : [ ] , rect : [ "rx" , "width" , "height" , "x" , "y" ] , image : [ "width" ,
"height" , "x" , "y" ] , circle : [ "cx" , "cy" , "r" ] , ellipse : [ "cx" , "cy" , "rx" , "ry" ] , line : [ "x1" , "y1" , "x2" , "y2" ] , text : [ "x" , "y" ] , use : [ ] } ; var xa = q . tagName ; a ( q ) . data ( "gsvg" ) && a ( "#g_panel" ) . show ( ) ; xa == "path" && a ( "#path_panel" ) . show ( ) ; if ( M [ xa ] ) { M = M [ xa ] ; a ( "#" + xa + "_panel" ) . show ( ) ; a . each ( M , function ( Ga , mb ) { var Ua = q . getAttribute ( mb ) ; if ( curConfig . baseUnit !== "px" && q [ mb ] ) Ua = svgedit . units . convertUnit ( q [ mb ] . baseVal . value ) ; var ma = document . getElementById ( xa + "_" + mb ) ; ma . value = Math . round ( Ua ) || 0 ; ma . getAttribute ( "data-cursor" ) === "true" &&
a . fn . dragInput . updateCursor ( ma ) } ) ; if ( xa == "text" ) { a ( "#text_panel" ) . css ( "display" , "inline" ) ; g . getItalic ( ) ? a ( "#tool_italic" ) . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : a ( "#tool_italic" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; g . getBold ( ) ? a ( "#tool_bold" ) . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : a ( "#tool_bold" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; a ( "#font_family" ) . val ( q . getAttribute ( "font-family" ) ) ; a ( "#font_size" ) . val ( q . getAttribute ( "font-size" ) ) ;
a ( "#text" ) . val ( q . textContent ) ; g . addedNew && setTimeout ( function ( ) { a ( "#text" ) . focus ( ) . select ( ) } , 100 ) } else if ( xa == "image" ) Va ( g . getHref ( q ) ) ; else if ( xa === "g" || xa === "use" ) { a ( "#container_panel" ) . show ( ) ; a ( ".action_group_selected" ) . removeClass ( "disabled" ) ; M = g . getTitle ( ) ; ia = a ( "#g_title" ) [ 0 ] ; ia . value = M ; Na ( ia ) ; xa == "use" ? ia . setAttribute ( "disabled" , "disabled" ) : ia . removeAttribute ( "disabled" ) } } ca [ ( xa === "g" ? "en" : "dis" ) + "ableContextMenuItems" ] ( "#ungroup" ) ; ca [ ( xa === "g" || ! aa ? "dis" : "en" ) + "ableContextMenuItems" ] ( "#group" ) } else if ( aa ) { a ( "#multiselected_panel" ) . show ( ) ;
a ( ".action_multi_selected" ) . removeClass ( "disabled" ) ; ca . enableContextMenuItems ( "#group" ) . disableContextMenuItems ( "#ungroup" ) } else ca . disableContextMenuItems ( "#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back" ) ; Q . getUndoStackSize ( ) > 0 ? a ( "#tool_undo" ) . removeClass ( "disabled" ) : a ( "#tool_undo" ) . addClass ( "disabled" ) ; Q . getRedoStackSize ( ) > 0 ? a ( "#tool_redo" ) . removeClass ( "disabled" ) : a ( "#tool_redo" ) . addClass ( "disabled" ) ; g . addedNew = false } ; a ( "#text" ) . focus ( function ( ) { } ) ; a ( "#text" ) . blur ( function ( ) { } ) ;
g . bind ( "selected" , function ( q , E ) { var M = g . getMode ( ) ; M === "select" && U ( ) ; M = M == "pathedit" ; P = E . length == 1 || E [ 1 ] == null ? E [ 0 ] : null ; aa = E . length >= 2 && E [ 1 ] != null ; if ( P != null ) if ( ! M ) { if ( P != null ) switch ( P . tagName ) { case "use" : case "image" : case "foreignObject" : break ; case "g" : case "a" : for ( var V = null , ca = P . getElementsByTagName ( "*" ) , ia = 0 , ta = ca . length ; ia < ta ; ia ++ ) { var za = ca [ ia ] . getAttribute ( "stroke-width" ) ; if ( ia === 0 ) V = za ; else if ( V !== za ) V = null } a ( "#stroke_width" ) . val ( V === null ? "" : V ) ; b . paintBox . fill . update ( true ) ; b . paintBox . stroke . update ( true ) ;
break ; default : b . paintBox . fill . update ( true ) ; b . paintBox . stroke . update ( true ) ; a ( "#stroke_width" ) . val ( P . getAttribute ( "stroke-width" ) || 1 ) ; a ( "#stroke_style" ) . val ( P . getAttribute ( "stroke-dasharray" ) || "none" ) ; V = P . getAttribute ( "stroke-linejoin" ) || "miter" ; a ( "#linejoin_" + V ) . length != 0 && d ( a ( "#linejoin_" + V ) [ 0 ] ) ; V = P . getAttribute ( "stroke-linecap" ) || "butt" ; a ( "#linecap_" + V ) . length != 0 && d ( a ( "#linecap_" + V ) [ 0 ] ) } if ( P != null ) { V = ( P . getAttribute ( "opacity" ) || 1 ) * 100 ; a ( "#group_opacity" ) . val ( V ) ; a ( "#opac_slider" ) . slider ( "option" ,
"value" , V ) ; a ( "#elem_id" ) . val ( P . id ) } } a ( "#path_node_panel" ) . toggle ( M ) ; a ( "#tools_bottom_2,#tools_bottom_3" ) . toggle ( ! M ) ; if ( M ) { a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ; a ( "#tool_select" ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ; k ( "#tool_select" , "select_node" ) ; aa = false ; if ( E . length ) P = E [ 0 ] } else { if ( E [ 0 ] ) { M = g . selectorManager . requestSelector ( E [ 0 ] ) ; M . reset ( E [ 0 ] ) ; M . selectorRect . setAttribute ( "display" , "inline" ) } k ( "#tool_select" , "select" ) } Aa ( ) ; g . runExtensions ( "selectedChanged" ,
{ elems : E , selectedElement : P , multiselected : aa } ) } ) ; g . bind ( "transition" , function ( q , E ) { var M = g . getMode ( ) , V = E [ 0 ] ; if ( V ) { aa = E . length >= 2 && E [ 1 ] != null ; if ( ! aa ) switch ( M ) { case "rotate" : M = g . getRotationAngle ( V ) ; a ( "#angle" ) . val ( Math . round ( M ) ) ; rotateCursor ( M ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , M == 0 ) } g . runExtensions ( "elementTransition" , { elems : E } ) } } ) ; g . bind ( "changed" , function ( q , E ) { var M = g . getMode ( ) ; M === "select" && U ( ) ; for ( var V = 0 ; V < E . length ; ++ V ) { var ca = E [ V ] ; if ( ca && ca . tagName === "svg" ) ra ( ) ; else if ( ca && P && P . parentNode ==
null ) P = ca } b . show _save _warning = true ; Aa ( ) ; if ( P && M === "select" ) { b . paintBox . fill . update ( ) ; b . paintBox . stroke . update ( ) } g . runExtensions ( "elementChanged" , { elems : E } ) } ) ; g . bind ( "saved" , function ( q , E ) { b . show _save _warning = false ; E = '<?xml version="1.0"?>\n' + E ; var M = navigator . userAgent ; if ( ~ M . indexOf ( "Chrome" ) && a . browser . version >= 533 || ~ M . indexOf ( "MSIE" ) ) Vb ( 0 , true ) ; else { var V = q . open ( "data:image/svg+xml;base64," + N . encode64 ( E ) ) , ca = a . pref ( "save_notice_done" ) ; if ( ca !== "all" ) { var ia = uiStrings . notification . saveFromBrowser . replace ( "%s" ,
"SVG" ) ; if ( M . indexOf ( "Gecko/" ) !== - 1 ) if ( E . indexOf ( "<defs" ) !== - 1 ) { ia += "\n\n" + uiStrings . notification . defsFailOnSave ; a . pref ( "save_notice_done" , "all" ) ; ca = "all" } else a . pref ( "save_notice_done" , "part" ) ; else a . pref ( "save_notice_done" , "all" ) ; ca !== "part" && V . alert ( ia ) } } } ) ; g . bind ( "exported" , function ( q , E ) { var M = E . issues ; a ( "#export_canvas" ) . length || a ( "<canvas>" , { id : "export_canvas" } ) . hide ( ) . appendTo ( "body" ) ; var V = a ( "#export_canvas" ) [ 0 ] ; V . width = g . contentW ; V . height = g . contentH ; canvg ( V , E . svg , { renderCallback : function ( ) { var ca =
V . toDataURL ( "image/png" ) ; ba . location . href = ca ; if ( a . pref ( "export_notice_done" ) !== "all" ) { ca = uiStrings . notification . saveFromBrowser . replace ( "%s" , "PNG" ) ; if ( M . length ) ca += "\n\n" + uiStrings . notification . noteTheseIssues + "\n \u2022 " + M . join ( "\n \u2022 " ) ; a . pref ( "export_notice_done" , "all" ) ; ba . alert ( ca ) } } } ) } ) ; g . bind ( "zoomed" , Z ) ; g . bind ( "contextset" , function ( q , E ) { var M = "" ; if ( E ) { var V = "" ; M = '<a href="#" data-root="y">' + g . getCurrentDrawing ( ) . getCurrentLayerName ( ) + "</a>" ; a ( E ) . parentsUntil ( "#svgcontent > g" ) . andSelf ( ) . each ( function ( ) { if ( this . id ) { V +=
" > " + this . id ; M += this !== E ? ' > <a href="#">' + this . id + "</a>" : " > " + this . id } } ) ; ja = V } else ja = null ; a ( "#cur_context_panel" ) . toggle ( ! ! E ) . html ( M ) ; h ( ) } ) ; g . bind ( "extension_added" , function ( q , E ) { function M ( ) { if ( Ma ) { clearTimeout ( Ma ) ; Ma = null } ca || ( Ma = setTimeout ( function ( ) { ca = true ; F ( s . iconsize ) } , 50 ) ) } var V = false , ca = false , ia = true , ta = function ( ) { if ( E . callback && ! V && ia ) { V = true ; E . callback ( ) } } , za = [ ] ; E . context _tools && a . each ( E . context _tools , function ( Ua , ma ) { var xb = ma . container _id ? ' id="' + ma . container _id + '"' : "" , ab = a ( "#" + ma . panel ) ;
ab . length || ( ab = a ( "<div>" , { id : ma . panel } ) . appendTo ( "#tools_top" ) . hide ( ) ) ; switch ( ma . type ) { case "tool_button" : var Ba = '<div class="tool_button">' + ma . id + "</div>" , Wa = a ( Ba ) . appendTo ( ab ) ; ma . events && a . each ( ma . events , function ( bb , gb ) { a ( Wa ) . bind ( bb , gb ) } ) ; break ; case "select" : Ba = "<label" + xb + '><select id="' + ma . id + '">' ; a . each ( ma . options , function ( bb , gb ) { Ba += '<option value="' + bb + '"' + ( bb == ma . defval ? " selected" : "" ) + ">" + gb + "</option>" } ) ; Ba += "</select></label>" ; var Da = a ( Ba ) . appendTo ( ab ) . find ( "select" ) ; a . each ( ma . events ,
function ( bb , gb ) { a ( Da ) . bind ( bb , gb ) } ) ; break ; case "button-select" : Ba = '<div id="' + ma . id + '" class="dropdown toolset" title="' + ma . title + '"><div id="cur_' + ma . id + '" class="icon_label"></div><button></button></div>' ; xb = a ( '<ul id="' + ma . id + '_opts"></ul>' ) . appendTo ( "#option_lists" ) ; ma . colnum && xb . addClass ( "optcols" + ma . colnum ) ; a ( Ba ) . appendTo ( ab ) . children ( ) ; za . push ( { elem : "#" + ma . id , list : "#" + ma . id + "_opts" , title : ma . title , callback : ma . events . change , cur : "#cur_" + ma . id } ) ; break ; case "input" : Ba = "<label" + xb + '><span id="' +
ma . id + '_label">' + ma . label + ':</span><input id="' + ma . id + '" title="' + ma . title + '" size="' + ( ma . size || "4" ) + '" value="' + ( ma . defval || "" ) + '" type="text"/></label>' ; var eb = a ( Ba ) . appendTo ( ab ) . find ( "input" ) ; ma . spindata && eb . SpinButton ( ma . spindata ) ; ma . events && a . each ( ma . events , function ( bb , gb ) { eb . bind ( bb , gb ) } ) } } ) ; if ( E . buttons ) { var ya = { } , xa = { } , Ga = E . svgicons , mb = { } ; a . each ( E . buttons , function ( Ua , ma ) { for ( var xb , ab = ma . id , Ba = Ua ; a ( "#" + ab ) . length ; ) ab = ma . id + "_" + ++ Ba ; if ( Ga ) { ya [ ab ] = ma . icon ; Ba = ma . svgicon ? ma . svgicon : ma . id ; if ( ma . type ==
"app_menu" ) xa [ "#" + ab + " > div" ] = Ba ; else xa [ "#" + ab ] = Ba } else xb = ma . type == "menu" ? "" : a ( '<img src="' + ma . icon + '">' ) ; var Wa , Da ; switch ( ma . type ) { case "mode_flyout" : case "mode" : Wa = "tool_button" ; if ( ma . cls ) Wa += " " + ma . cls ; Da = "#tools_left" ; break ; case "context" : Wa = "tool_button" ; Da = "#" + ma . panel ; a ( Da ) . length || a ( "<div>" , { id : ma . panel } ) . appendTo ( "#tools_top" ) ; break ; case "menu" : Wa = "menu_item tool_button" ; Da = "#" + ( ma . after || ma . panel ) ; break ; case "app_menu" : Wa = "" ; Da = ma . parent || "#main_menu ul" ; a ( Da ) . length || a ( "<div>" , { id : ma . panel } ) . appendTo ( "#tools_top" ) } var eb =
a ( ma . list || ma . type == "app_menu" ? "<li/>" : "<div/>" ) . attr ( "id" , ab ) . attr ( "title" , ma . title ) . addClass ( Wa ) ; if ( ! ma . includeWith && ! ma . list ) { if ( "position" in ma ) a ( Da ) . children ( ) . eq ( ma . position ) . before ( eb ) ; else ma . type != "menu" || ! ma . after ? eb . appendTo ( Da ) : a ( Da ) . after ( eb ) ; if ( ma . type == "mode_flyout" ) { Ba = a ( eb ) ; Wa = Ba . parent ( ) ; if ( ! Ba . parent ( ) . hasClass ( "tools_flyout" ) ) { var bb = Ba [ 0 ] . id . replace ( "tool_" , "tools_" ) , gb = Ba . clone ( ) . attr ( "id" , bb + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; Ba . before ( gb ) ; Wa = pa ( bb , Ba ) ;
Wa . data ( "isLibrary" , true ) ; gb . data ( "isLibrary" , true ) } xa [ "#" + bb + "_show" ] = ma . id ; ab = mb [ "#" + Wa [ 0 ] . id ] = [ { sel : "#" + ab , fn : ma . events . click , icon : ma . id , isDefault : true } , Rb ] } else if ( ma . type == "app_menu" || ma . type == "menu" ) eb . append ( ma . title ) } else if ( ma . list ) { eb . addClass ( "push_button" ) ; a ( "#" + ma . list + "_opts" ) . append ( eb ) ; if ( ma . isDefault ) { a ( "#cur_" + ma . list ) . append ( eb . children ( ) . clone ( ) ) ; Ba = ma . svgicon ? ma . svgicon : ma . id ; xa [ "#cur_" + ma . list ] = Ba } } else if ( ma . includeWith ) { Da = ma . includeWith ; Ba = a ( Da . button ) ; Wa = Ba . parent ( ) ; if ( ! Ba . parent ( ) . hasClass ( "tools_flyout" ) ) { bb =
Ba [ 0 ] . id . replace ( "tool_" , "tools_" ) ; gb = Ba . clone ( ) . attr ( "id" , bb + "_show" ) . append ( a ( "<div>" , { "class" : "flyout_arrow_horiz" } ) ) ; Ba . before ( gb ) ; Wa = pa ( bb , Ba ) } var Rb = da . getButtonData ( Da . button ) ; if ( Da . isDefault ) xa [ "#" + bb + "_show" ] = ma . id ; ab = mb [ "#" + Wa [ 0 ] . id ] = [ { sel : "#" + ab , fn : ma . events . click , icon : ma . id , key : ma . key , isDefault : ma . includeWith ? ma . includeWith . isDefault : 0 } , Rb ] ; bb = "position" in Da ? Da . position : "last" ; Rb = Wa . children ( ) . length ; if ( ! isNaN ( bb ) && bb >= 0 && bb < Rb ) Wa . children ( ) . eq ( bb ) . before ( eb ) ; else { Wa . append ( eb ) ; ab . reverse ( ) } } Ga ||
eb . append ( xb ) ; ma . list || a . each ( ma . events , function ( Hb , Ob ) { if ( Hb == "click" ) if ( ma . type == "mode" ) { ma . includeWith ? eb . bind ( Hb , Ob ) : eb . bind ( Hb , function ( ) { Pa ( eb ) && Ob ( ) } ) ; if ( ma . key ) { a ( document ) . bind ( "keydown" , ma . key , Ob ) ; ma . title && eb . attr ( "title" , ma . title + " [" + ma . key + "]" ) } } else eb . bind ( Hb , Ob ) ; else eb . bind ( Hb , Ob ) } ) ; ua ( mb ) } ) ; a . each ( za , function ( ) { hb ( this . elem , this . list , this . callback , { seticon : true } ) } ) ; if ( Ga ) ia = false ; a . svgIcons ( Ga , { w : 27 , h : 27 , id _match : false , no _img : ! A , fallback : ya , placement : xa , callback : function ( ) { s . iconsize &&
s . iconsize != "m" && M ( ) ; ia = true ; ta ( ) } } ) } ta ( ) } ) ; g . textActions . setInputElem ( a ( "#text" ) [ 0 ] ) ; var La = '<div class="palette_item" data-rgb="none"></div>' ; a . each ( [ "#000000" , "#3f3f3f" , "#7f7f7f" , "#bfbfbf" , "#ffffff" , "#ff0000" , "#ff7f00" , "#ffff00" , "#7fff00" , "#00ff00" , "#00ff7f" , "#00ffff" , "#007fff" , "#0000ff" , "#7f00ff" , "#ff00ff" , "#ff007f" , "#7f0000" , "#7f3f00" , "#7f7f00" , "#3f7f00" , "#007f00" , "#007f3f" , "#007f7f" , "#003f7f" , "#00007f" , "#3f007f" , "#7f007f" , "#7f003f" , "#ffaaaa" , "#ffd4aa" , "#ffffaa" , "#d4ffaa" , "#aaffaa" , "#aaffd4" ,
"#aaffff" , "#aad4ff" ] , function ( q , E ) { La += '<div class="palette_item" style="background-color: ' + E + ';" data-rgb="' + E + '"></div>' } ) ; a ( "#palette" ) . append ( La ) ; var zb = a ( "#tool_angle_indicator" ) ; a ( "#tool_reorient" ) ; rotateCursor = function ( q ) { q = "rotate(" + q + "deg)" ; zb . css ( { "-webkit-transform" : q , "-moz-transform" : q , "-o-transform" : q , "-ms-transform" : q , transform : q } ) } ; var Ea = function ( q ) { var E = q . value / 100 ; if ( E < 0.0010 ) q . value = 0.1 ; else { q = g . getZoom ( ) ; Z ( window , { width : 0 , height : 0 , x : ( S [ 0 ] . scrollLeft + S . width ( ) / 2 ) / q , y : ( S [ 0 ] . scrollTop +
S . height ( ) / 2 ) / q , zoom : E } , true ) } } , yb = function ( q , E ) { if ( E == null ) E = q . value ; a ( "#group_opacity" ) . val ( E ) ; if ( ! q || ! q . handle ) a ( "#opac_slider" ) . slider ( "option" , "value" , E ) ; g . setOpacity ( E / 100 ) } , qb = function ( q , E ) { val = q . value ; a ( "#blur" ) . val ( val ) ; var M = false ; if ( ! q || ! q . handle ) { a ( "#blur_slider" ) . slider ( "option" , "value" , val ) ; M = true } E ? g . setBlurNoUndo ( val ) : g . setBlur ( val , M ) } , $a = function ( ) { window . opera && a ( "<p/>" ) . hide ( ) . appendTo ( "body" ) . remove ( ) } ; a ( "#stroke_style" ) . change ( function ( ) { g . setStrokeAttr ( "stroke-dasharray" , a ( this ) . val ( ) ) ;
$a ( ) } ) ; a ( "select" ) . change ( function ( ) { a ( this ) . blur ( ) } ) ; a ( "#font_family" ) . change ( function ( ) { g . setFontFamily ( this . value ) } ) ; a ( "#seg_type" ) . change ( function ( ) { g . setSegType ( a ( this ) . val ( ) ) } ) ; a ( "#text" ) . keyup ( function ( ) { g . setTextContent ( this . value ) } ) ; a ( "#image_url" ) . change ( function ( ) { Va ( this . value ) } ) ; a ( "#link_url" ) . change ( function ( ) { this . value . length ? g . setLinkURL ( this . value ) : g . removeHyperlink ( ) } ) ; a ( "#g_title" ) . change ( function ( ) { g . setGroupTitle ( this . value ) } ) ; changeAttribute = function ( q , E ) { var M = q . getAttribute ( "data-attr" ) ,
V = q . value ; if ( svgedit . units . isValidUnit ( M , V , P ) ) q . blur ( ) ; else { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; q . value = P . getAttribute ( M ) ; return false } if ( M !== "id" ) if ( isNaN ( V ) ) V = g . convertToNum ( M , V ) ; else if ( curConfig . baseUnit !== "px" ) { var ca = svgedit . units . getTypeMap ( ) ; if ( P [ M ] || g . getMode ( ) === "pathedit" || M === "x" || M === "y" ) V *= ca [ curConfig . baseUnit ] } E ? g . changeSelectedAttributeNoUndo ( M , V ) : g . changeSelectedAttribute ( M , V ) } ; a ( "#palette" ) . mouseover ( function ( ) { var q = a ( '<input type="hidden">' ) ; a ( this ) . append ( q ) ;
q . focus ( ) . remove ( ) } ) ; a ( ".palette_item" ) . mousedown ( function ( ) { var q = a ( "#tool_stroke" ) . hasClass ( "active" ) , E = q ? "stroke" : "fill" , M = a ( this ) . attr ( "data-rgb" ) , V = null ; if ( M === "transparent" || M === "initial" || M === "#none" ) { M = "none" ; V = new a . jGraduate . Paint } else V = new a . jGraduate . Paint ( { alpha : 100 , solidColor : M . substr ( 1 ) } ) ; b . paintBox [ E ] . setPaint ( V ) ; if ( q ) { g . setColor ( "stroke" , M ) ; M != "none" && g . getStrokeOpacity ( ) != 1 && g . setPaintOpacity ( "stroke" , 1 ) } else { g . setColor ( "fill" , M ) ; M != "none" && g . getFillOpacity ( ) != 1 && g . setPaintOpacity ( "fill" ,
1 ) } } ) . bind ( "contextmenu" , function ( q ) { q . preventDefault ( ) } ) ; a ( "#toggle_stroke_tools" ) . toggle ( function ( ) { a ( ".stroke_tool" ) . css ( "display" , "table-cell" ) ; a ( this ) . addClass ( "expanded" ) ; B ( ) } , function ( ) { a ( ".stroke_tool" ) . css ( "display" , "none" ) ; a ( this ) . removeClass ( "expanded" ) ; B ( ) } ) ; var Pa = function ( q , E ) { if ( a ( q ) . hasClass ( "disabled" ) ) return false ; if ( a ( q ) . parent ( ) . hasClass ( "tools_flyout" ) ) return true ; var M = M || "normal" ; E || a ( ".tools_flyout" ) . fadeOut ( M ) ; a ( "#styleoverrides" ) . text ( "" ) ; a ( ".tool_button_current" ) . removeClass ( "tool_button_current" ) . addClass ( "tool_button" ) ;
a ( q ) . addClass ( "tool_button_current" ) . removeClass ( "tool_button" ) ; return true } ; ( function ( ) { var q = null , E = null , M = S [ 0 ] , V = false , ca = false ; a ( "#svgcanvas" ) . bind ( "mousemove mouseup" , function ( ia ) { if ( V !== false ) { M . scrollLeft -= ia . clientX - q ; M . scrollTop -= ia . clientY - E ; q = ia . clientX ; E = ia . clientY ; if ( ia . type === "mouseup" ) V = false ; return false } } ) . mousedown ( function ( ia ) { if ( ia . button === 1 || ca === true ) { V = true ; q = ia . clientX ; E = ia . clientY ; return false } } ) ; a ( window ) . mouseup ( function ( ) { V = false ; a ( "body" ) . removeClass ( "dragging" ) } ) ; a ( document ) . bind ( "keydown" ,
"space" , function ( ia ) { ia . preventDefault ( ) ; g . spaceKey = ca = true } ) . bind ( "keyup" , "space" , function ( ia ) { ia . preventDefault ( ) ; g . spaceKey = ca = false } ) . bind ( "keydown" , "alt" , function ( ) { g . getMode ( ) === "zoom" && S . addClass ( "out" ) } ) . bind ( "keyup" , "alt" , function ( ) { g . getMode ( ) === "zoom" && S . removeClass ( "out" ) } ) } ) ( ) ; var Ia = a ( ".menu" ) , Ca = function ( q ) { q . target . style . background = "#fff" ; setTimeout ( function ( ) { q . target . style . background = "#ddd" } , 50 ) ; setTimeout ( function ( ) { q . target . style . background = "#fff" } , 150 ) ; setTimeout ( function ( ) { q . target . style . background =
"#ddd" } , 200 ) ; setTimeout ( function ( ) { q . target . style . background = "" } , 200 ) ; setTimeout ( function ( ) { a ( "#menu_bar" ) . removeClass ( "active" ) } , 220 ) ; return false } ; a ( ".menu_item" ) . on ( "mousedown touchstart" , function ( q ) { Ca ( q ) } ) ; a ( "svg, body" ) . on ( "mousedown touchstart" , function ( q ) { top != self && ! q . isTrigger && typeof top . exports . setEditorFocus == "function" && top . exports . setEditorFocus ( ) ; if ( ! a ( q . target ) . hasClass ( "menu_title" ) && ! a ( q . target ) . parent ( ) . hasClass ( "menu_title" ) ) ! a ( q . target ) . hasClass ( "disabled" ) && a ( q . target ) . hasClass ( "menu_item" ) ?
Ca ( q ) : a ( "#menu_bar" ) . removeClass ( "active" ) } ) ; var jb = [ 6 , 12 , 16 , 33 , 50 , 66 , 100 , 150 , 200 , 300 , 400 , 600 , 800 , 1200 ] ; a ( "#workarea" ) . on ( "mousewheel" , function ( q , E , M , V ) { if ( q . altKey ) { q . preventDefault ( ) ; q = g . getZoom ( ) * 100 ; E = jb . length ; for ( G = 0 ; G < E ; G ++ ) { M = Math . min ( E , G + 1 ) ; if ( V > 0 ) zoom = jb [ G ] <= q ? jb [ M ] : zoom ; if ( V < 0 ) zoom = jb [ G ] < q ? jb [ G ] : zoom } zoom && Ea ( { value : zoom } ) } } ) ; a ( ".menu_title" ) . on ( "mousedown" , function ( ) { a ( "#tools_shapelib" ) . hide ( ) ; a ( "#menu_bar" ) . toggleClass ( "active" ) ; Ia . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) . on ( "mouseover" ,
function ( ) { Ia . removeClass ( "open" ) ; a ( this ) . parent ( ) . addClass ( "open" ) } ) ; b . addDropDown = function ( q , E , M ) { if ( a ( q ) . length != 0 ) { var V = a ( q ) . find ( "button" ) , ca = a ( q ) . find ( "ul" ) . attr ( "id" , a ( q ) [ 0 ] . id + "-list" ) ; M || a ( "#option_lists" ) . append ( ca ) ; var ia = false ; M && a ( q ) . addClass ( "dropup" ) ; ca . find ( "li" ) . bind ( "mouseup" , E ) ; a ( window ) . mouseup ( function ( ) { if ( ! ia ) { V . removeClass ( "down" ) ; ca . hide ( ) } ia = false } ) ; V . bind ( "mousedown" , function ( ) { if ( V . hasClass ( "down" ) ) { V . removeClass ( "down" ) ; ca . hide ( ) } else { V . addClass ( "down" ) ; if ( ! M ) { var ta =
a ( q ) . offset ( ) ; ca . css ( { top : ta . top , left : ta . left - 110 } ) } ca . show ( ) ; ia = true } } ) . hover ( function ( ) { ia = true } ) . mouseout ( function ( ) { ia = false } ) } } ; var hb = function ( q , E , M , V ) { var ca = a ( q ) ; E = a ( E ) ; var ia = false , ta = V . dropUp ; ta && a ( q ) . addClass ( "dropup" ) ; E . find ( "li" ) . bind ( "mouseup" , function ( ) { if ( V . seticon ) { k ( "#cur_" + ca [ 0 ] . id , a ( this ) . children ( ) ) ; a ( this ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) } M . apply ( this , arguments ) } ) ; a ( window ) . mouseup ( function ( ) { if ( ! ia ) { ca . removeClass ( "down" ) ; E . hide ( ) ; E . css ( { top : 0 , left : 0 } ) } ia =
false } ) ; E . height ( ) ; a ( q ) . bind ( "mousedown" , function ( ) { var za = a ( q ) . offset ( ) ; if ( ta ) { za . top -= E . height ( ) ; za . left += 8 } else za . top += a ( q ) . height ( ) ; a ( E ) . offset ( za ) ; if ( ca . hasClass ( "down" ) ) { ca . removeClass ( "down" ) ; E . hide ( ) ; E . css ( { top : 0 , left : 0 } ) } else { ca . addClass ( "down" ) ; E . show ( ) ; ia = true ; return false } } ) . hover ( function ( ) { ia = true } ) . mouseout ( function ( ) { ia = false } ) ; V . multiclick && E . mousedown ( function ( ) { ia = true } ) } ; b . addDropDown ( "#font_family_dropdown" , function ( ) { a ( this ) . text ( ) ; a ( "#font_family" ) . val ( a ( this ) . text ( ) ) . change ( ) } ) ;
b . addDropDown ( "#opacity_dropdown" , function ( ) { if ( ! a ( this ) . find ( "div" ) . length ) { var q = parseInt ( a ( this ) . text ( ) . split ( "%" ) [ 0 ] ) ; yb ( false , q ) } } , false ) ; a ( "#opac_slider" ) . slider ( { start : function ( ) { a ( "#opacity_dropdown li:not(.special)" ) . hide ( ) } , stop : function ( ) { a ( "#opacity_dropdown li" ) . show ( ) ; a ( window ) . mouseup ( ) } , slide : function ( q , E ) { yb ( E ) } } ) ; b . addDropDown ( "#blur_dropdown" , a . noop ) ; var Ra = false ; a ( "#blur_slider" ) . slider ( { max : 10 , step : 0.1 , stop : function ( q , E ) { Ra = false ; qb ( E ) ; a ( "#blur_dropdown li" ) . show ( ) ; a ( window ) . mouseup ( ) } ,
start : function ( ) { Ra = true } , slide : function ( q , E ) { qb ( E , null , Ra ) } } ) ; hb ( "#stroke_linecap" , "#linecap_opts" , function ( ) { d ( this , true ) } , { dropUp : true } ) ; hb ( "#stroke_linejoin" , "#linejoin_opts" , function ( ) { d ( this , true ) } , { dropUp : true } ) ; a ( "div" , "#position_opts" ) . each ( function ( ) { this . addEventListener ( "mouseup" , function ( ) { var q = this . id . replace ( "tool_pos" , "" ) . charAt ( 0 ) ; g . alignSelectedElements ( q , "page" ) } ) } ) ; ( function ( ) { var q , E = function ( ) { a ( q ) . blur ( ) } ; a ( "#svg_editor" ) . find ( "button, select, input:not(#text)" ) . focus ( function ( ) { q =
this ; T = "toolbars" ; S . mousedown ( E ) } ) . blur ( function ( ) { T = "canvas" ; S . unbind ( "mousedown" , E ) ; g . getMode ( ) == "textedit" && a ( "#text" ) . focus ( ) } ) } ) ( ) ; var db = function ( ) { Pa ( "#tool_select" ) && g . setMode ( "select" ) } , Ka = function ( ) { Pa ( "#tool_fhpath" ) && g . setMode ( "fhpath" ) } , sb = function ( ) { Pa ( "#tool_line" ) && g . setMode ( "line" ) } , tb = function ( ) { Pa ( "#tool_rect" ) && g . setMode ( "rect" ) } , nb = function ( ) { Pa ( "#tool_ellipse" ) && g . setMode ( "ellipse" ) } , fb = function ( ) { Pa ( "#tool_image" ) && g . setMode ( "image" ) } , Za = function ( ) { Pa ( "#tool_zoom" ) && g . setMode ( "zoom" ) } ,
Ta = function ( ) { if ( Pa ( "#tool_zoom" ) ) { Pb ( ) ; U ( ) } } , ib = function ( ) { Pa ( "#tool_text" ) && g . setMode ( "text" ) } , Ib = function ( ) { Pa ( "#tool_path" ) && g . setMode ( "path" ) } , Cb = function ( ) { if ( P != null || aa ) g . deleteSelectedElements ( ) } , kb = function ( ) { if ( P != null || aa ) { window . event . type === "keydown" && Db ( a ( "#edit_menu" ) ) ; g . cutSelectedElements ( ) } } , vb = function ( ) { if ( P != null || aa ) { window . event . type === "keydown" && Db ( a ( "#edit_menu" ) ) ; g . copySelectedElements ( ) } } , Gb = function ( ) { window . event . type === "keydown" && Db ( a ( "#edit_menu" ) ) ; var q = g . getZoom ( ) ,
E = ( S [ 0 ] . scrollLeft + S . width ( ) / 2 ) / q - g . contentW ; q = ( S [ 0 ] . scrollTop + S . height ( ) / 2 ) / q - g . contentH ; g . pasteElements ( "point" , E , q ) } , Ab = function ( ) { if ( P != null ) { window . event . type === "keydown" && Db ( a ( "#object_menu" ) ) ; g . moveToTopSelectedElement ( ) } } , Jb = function ( ) { if ( P != null ) { window . event . type === "keydown" && Db ( a ( "#object_menu" ) ) ; g . moveToBottomSelectedElement ( ) } } , oa = function ( ) { if ( P != null ) { window . event . type === "keydown" && Db ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( "Up" ) } } , ga = function ( ) { if ( P != null ) { window . event . type === "keydown" &&
Db ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( "Down" ) } } , sa = function ( q ) { if ( P != null ) { window . event . type === "keydown" && Db ( a ( "#object_menu" ) ) ; g . moveUpDownSelected ( q ) } } , R = function ( ) { if ( P != null ) { g . convertToPath ( ) ; elems = g . getSelectedElems ( ) ; g . selectorManager . requestSelector ( elems [ 0 ] ) . selectorRect . setAttribute ( "display" , "none" ) ; g . setMode ( "pathedit" ) ; K . toEditMode ( elems [ 0 ] ) ; g . clearSelection ( ) } } , L = function ( ) { P != null && K . reorient ( ) } , fa = function ( ) { if ( P != null || aa ) a . prompt ( uiStrings . notification . enterNewLinkURL , "http://" ,
function ( q ) { q && g . makeHyperlink ( q ) } ) } , Fa = function ( q , E ) { if ( P != null || aa ) { if ( curConfig . gridSnapping ) { var M = g . getZoom ( ) * curConfig . snappingStep ; q *= M ; E *= M } a ( "input" ) . blur ( ) ; g . moveSelectedElements ( q , E ) } } , Xa = function ( ) { var q = ! a ( "#tool_node_link" ) . hasClass ( "push_button_pressed" ) ; q ? a ( "#tool_node_link" ) . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) . find ( "input" ) . attr ( "checked" , true ) : a ( "#tool_node_link" ) . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) . find ( "input" ) . attr ( "checked" , false ) ;
K . linkControlPoints ( q ) } , cb = function ( ) { K . getNodePoint ( ) && K . clonePathNode ( ) } , rb = function ( ) { K . getNodePoint ( ) && K . deletePathNode ( ) } , ub = function ( ) { var q = a ( "#tool_add_subpath" ) , E = ! q . hasClass ( "push_button_pressed" ) ; E ? q . addClass ( "push_button_pressed" ) . removeClass ( "tool_button" ) : q . removeClass ( "push_button_pressed" ) . addClass ( "tool_button" ) ; K . addSubPath ( E ) } , Bb = function ( ) { K . opencloseSubPath ( ) } , lb = function ( ) { g . cycleElement ( 1 ) } , Eb = function ( ) { g . cycleElement ( 0 ) } , Ya = function ( q , E ) { if ( ! ( P == null || aa ) ) { q || ( E *= - 1 ) ; var M =
a ( "#angle" ) . val ( ) * 1 + E ; g . setRotationAngle ( M ) ; Aa ( ) } } , Fb = function ( ) { var q = curConfig . dimensions ; a . confirm ( uiStrings . notification . QwantToClear , function ( E ) { if ( E ) { U ( ) ; g . clear ( ) ; g . setResolution ( q [ 0 ] , q [ 1 ] ) ; ra ( true ) ; Pb ( ) ; Aa ( ) ; Y ( ) ; g . runExtensions ( "onNewDocument" ) } } ) } , Kb = function ( ) { g . setBold ( ! g . getBold ( ) ) ; Aa ( ) ; return false } , Ub = function ( ) { g . setItalic ( ! g . getItalic ( ) ) ; Aa ( ) ; return false } , Tb = function ( ) { if ( ! c . pngsave ) { var q = uiStrings . notification . loadingImage ; ba = window . open ( "data:text/html;charset=utf-8,<title>" + q +
"</title><h1>" + q + "</h1>" ) } window . canvg ? g . rasterExport ( ) : a . getScript ( "canvg/rgbcolor.js" , function ( ) { a . getScript ( "canvg/canvg.js" , function ( ) { g . rasterExport ( ) } ) } ) } , pb = function ( ) { g . open ( ) } , Sa = function ( ) { } , Db = function ( q ) { var E = q . prev ( ) ; E . css ( "background" , "#09f" ) ; setTimeout ( function ( ) { E . css ( "background" , "" ) } , 200 ) } , Xb = function ( ) { if ( Q . getUndoStackSize ( ) > 0 ) { window . event . type === "keydown" && Db ( a ( "#edit_menu" ) ) ; Q . undo ( ) } } , Sb = function ( ) { if ( Q . getRedoStackSize ( ) > 0 ) { window . event . type === "keydown" && Db ( a ( "#edit_menu" ) ) ;
Q . redo ( ) } } , Qb = function ( ) { if ( aa ) g . groupSelectedElements ( ) ; else P && g . ungroupSelectedElement ( ) } , Yb = function ( ) { window . event . type === "keydown" && Db ( a ( "#edit_menu" ) ) ; g . cloneSelectedElements ( 20 , 20 ) } , Mb = function ( ) { var q = this . id . replace ( "tool_align" , "" ) . charAt ( 0 ) ; g . alignSelectedElements ( q , a ( "#align_relative_to" ) . val ( ) ) } , Wb = function ( ) { var q = document . querySelector ( "#tool_stroke rect" ) , E = document . querySelector ( "#tool_fill rect" ) , M = E . getAttribute ( "fill" ) , V = q . getAttribute ( "fill" ) ; q = parseFloat ( q . getAttribute ( "stroke-opacity" ) ) ;
if ( isNaN ( q ) ) q = 100 ; E = parseFloat ( E . getAttribute ( "fill-opacity" ) ) ; if ( isNaN ( E ) ) E = 100 ; V = Oa ( V , q , "stroke" ) ; M = Oa ( M , E , "fill" ) ; b . paintBox . fill . setPaint ( V , true ) ; b . paintBox . stroke . setPaint ( M , true ) } , Pb = function ( q ) { var E = g . getResolution ( ) ; q = q ? E . zoom * q : 1 ; a ( "#zoom" ) . val ( q * 100 ) ; g . setZoom ( q ) ; ob ( ) ; ra ( true ) } , Lb = function ( ) { ! a ( "#tool_wireframe" ) . hasClass ( "push_button_pressed" ) ? a ( "#tool_wireframe" ) . addClass ( "push_button_pressed" ) : a ( "#tool_wireframe" ) . removeClass ( "push_button_pressed" ) ; S . toggleClass ( "wireframe" ) ; if ( ! W ) { var q =
a ( "#wireframe_rules" ) ; q . length ? q . empty ( ) : a ( '<style id="wireframe_rules"></style>' ) . appendTo ( "head" ) ; ob ( ) } } , wb = function ( ) { var q = ! a ( "#tool_snap" ) . hasClass ( "push_button_pressed" ) ; q ? a ( "#tool_snap" ) . addClass ( "push_button_pressed" ) : a ( "#tool_snap" ) . removeClass ( "push_button_pressed" ) ; curConfig . gridSnapping = q } , $b = function ( ) { g . clearSelection ( ) ; a ( "#tool_canvas" ) . trigger ( "click" ) } , Zb = function ( ) { window . self != window . top && top . exports . setEditorFocus ( false ) } , Nb = function ( ) { if ( a ( "#tool_rulers" ) . hasClass ( "push_button_pressed" ) ) { a ( "#tool_rulers" ) . removeClass ( "push_button_pressed" ) ;
a ( "#show_rulers" ) . attr ( "checked" , false ) ; curConfig . showRulers = false } else { a ( "#tool_rulers" ) . addClass ( "push_button_pressed" ) ; a ( "#show_rulers" ) . attr ( "checked" , true ) ; curConfig . showRulers = true } a ( "#rulers" ) . toggle ( ! ! curConfig . showRulers ) } , ob = function ( ) { if ( ! W ) { var q = "#workarea.wireframe #svgcontent * { stroke-width: " + 1 / g . getZoom ( ) + "px; }" ; a ( "#wireframe_rules" ) . text ( S . hasClass ( "wireframe" ) ? q : "" ) } } , Vb = function ( q , E ) { if ( ! wa ) { wa = true ; a ( "#save_output_btns" ) . toggle ( ! ! E ) ; a ( "#tool_source_back" ) . toggle ( ! E ) ; var M =
ha = g . getSvgString ( ) ; a ( "#svg_source_textarea" ) . val ( M ) ; a ( "#svg_source_editor" ) . fadeIn ( ) ; M = a ( "#svg_source_container" ) . height ( ) - 50 ; a ( "#svg_source_textarea" ) . css ( "height" , M ) ; a ( "#svg_source_textarea" ) . focus ( ) } } , e = function ( ) { if ( wa ) { var q = function ( ) { g . clearSelection ( ) ; u ( ) ; Pb ( ) ; h ( ) ; Y ( ) } ; g . setSvgString ( a ( "#svg_source_textarea" ) . val ( ) ) ? q ( ) : a . confirm ( uiStrings . notification . QerrorsRevertToSource , function ( E ) { if ( ! E ) return false ; q ( ) } ) ; U ( ) } } , h = function ( q ) { q = q || g . getDocumentTitle ( ) ; q = ea + ( q ? ": " + q : "" ) ; a ( "title:first" ) . text ( q ) } ,
k = b . setIcon = function ( q , E ) { var M = typeof E === "string" ? a . getSvgIcon ( E , true ) : E . clone ( ) ; M ? a ( q ) . find ( "img" ) . replaceWith ( M ) : console . log ( "NOTE: Icon image missing: " + E ) } , w ; w = function ( ) { var q = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/ , E = document . getElementsByTagName ( "script" ) [ 0 ] , M ; for ( M in E . style ) if ( q . test ( M ) ) return M . match ( q ) [ 0 ] ; if ( "WebkitOpacity" in E . style ) return "Webkit" ; if ( "KhtmlOpacity" in E . style ) return "Khtml" ; return "" } ( ) ; var v = function ( q , E ) { w . toLowerCase ( ) ; var M = [ "top" , "left" , "bottom" , "right" ] ; q . each ( function ( ) { for ( var V =
a ( this ) , ca = V . outerWidth ( ) * ( E - 1 ) , ia = V . outerHeight ( ) * ( E - 1 ) , ta = 0 ; ta < 4 ; ta ++ ) { var za = M [ ta ] , ya = V . data ( "orig_margin-" + za ) ; if ( ya == null ) { ya = parseInt ( V . css ( "margin-" + za ) ) ; V . data ( "orig_margin-" + za , ya ) } ya = ya * E ; if ( za === "right" ) ya += ca ; else if ( za === "bottom" ) ya += ia ; V . css ( "margin-" + za , ya ) } } ) } , F = b . setIconSize = function ( q , E ) { if ( ! ( q == s . size && ! E ) ) { var M = a ( "#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout" ) ,
V = 1 ; V = typeof q == "number" ? q : { s : 0.75 , m : 1 , l : 1.25 , xl : 1.5 } [ q ] ; b . tool _scale = O = V ; qa ( ) ; var ca = M . parents ( ":hidden" ) ; ca . css ( "visibility" , "hidden" ) . show ( ) ; v ( M , V ) ; ca . css ( "visibility" , "visible" ) . hide ( ) ; M = a ( "#tool_size_rules" ) ; if ( M . length ) M . empty ( ) ; else M = a ( '<style id="tool_size_rules"></style>' ) . appendTo ( "head" ) ; if ( q != "m" ) { var ia = "" ; a . each ( cssResizeRules , function ( ta , za ) { ta = "#svg_editor " + ta . replace ( /,/g , ", #svg_editor" ) ; ia += ta + "{" ; a . each ( za , function ( ya , xa ) { if ( typeof xa === "number" ) var Ga = xa * V + "px" ; else if ( xa [ q ] ||
xa . all ) Ga = xa [ q ] || xa . all ; ia += ya + ":" + Ga + ";" } ) ; ia += "}" } ) ; ca = "-" + w . toLowerCase ( ) + "-" ; ia += "#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{" + ca + "transform: scale(" + V + ");} #svg_editor div.toolset .toolset {" + ca + "transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {" + ca + "transform: scale(" + 1 / V + ");}" ; M . text ( ia ) } qa ( ) } } , z = function ( ) { a ( "#dialog_box" ) . hide ( ) ;
if ( wa ) { if ( wa ) ha !== a ( "#svg_source_textarea" ) . val ( ) ? a . confirm ( uiStrings . notification . QignoreSourceChanges , function ( q ) { q && u ( ) } ) : u ( ) ; B ( ) } else ja && g . leaveContext ( ) } , u = function ( ) { a ( "#svg_source_editor" ) . hide ( ) ; wa = false ; a ( "#svg_source_textarea" ) . blur ( ) } ; a ( window ) . width ( ) ; a ( window ) . height ( ) ; var B = a . noop ; a ( window ) . resize ( function ( ) { ra ( ) } ) ; ( function ( ) { S . scroll ( function ( ) { if ( a ( "#ruler_x" ) . length != 0 ) a ( "#ruler_x" ) [ 0 ] . scrollLeft = S [ 0 ] . scrollLeft ; if ( a ( "#ruler_y" ) . length != 0 ) a ( "#ruler_y" ) [ 0 ] . scrollTop = S [ 0 ] . scrollTop } ) } ) ( ) ;
a ( "#url_notice" ) . click ( function ( ) { a . alert ( this . title ) } ) ; a ( "#change_image_url" ) . click ( function ( ) { var q = g . getHref ( P ) ; q = q . indexOf ( "data:" ) === 0 ? "" : q ; a . prompt ( uiStrings . notification . enterNewImgURL , q , function ( E ) { E && Va ( E ) } ) } ) ; ( function ( ) { var q = [ "clear" , "open" , "save" , "source" , "delete" , "delete_multi" , "paste" , "clone" , "clone_multi" , "move_top" , "move_bottom" ] , E = "" ; a . each ( q , function ( M , V ) { E += "#tool_" + V + ( M == q . length - 1 ? "," : "" ) } ) ; a ( E ) . mousedown ( function ( ) { a ( this ) . addClass ( "tool_button_current" ) } ) . bind ( "mousedown mouseout" ,
function ( ) { a ( this ) . removeClass ( "tool_button_current" ) } ) ; a ( "#tool_undo, #tool_redo" ) . mousedown ( function ( ) { a ( this ) . hasClass ( "disabled" ) || a ( this ) . addClass ( "tool_button_current" ) } ) . bind ( "mousedown mouseout" , function ( ) { a ( this ) . removeClass ( "tool_button_current" ) } ) } ) ( ) ; if ( o && ! window . opera ) { o = [ "tool_clear" , "tool_save" , "tool_source" , "tool_undo" , "tool_redo" , "tool_clone" ] ; for ( var G = o . length ; G -- ; ) { var C = document . getElementById ( o [ G ] ) ; if ( C != null ) { var D = C . title , J = D . indexOf ( "Ctrl+" ) ; C . title = [ D . substr ( 0 , J ) , "Cmd+" ,
D . substr ( J + 5 ) ] . join ( "" ) } } } var I = function ( q ) { var E = q [ 0 ] . id == "stroke_color" ? "stroke" : "fill" , M = q [ 0 ] . id == "canvas_color" ; if ( M ) E = "canvas" ; var V = b . paintBox [ E ] . paint ; q = E == "stroke" ? "Pick a Stroke Paint and Opacity" : "Pick a Fill Paint and Opacity" ; M = M ? { right : 200 , top : 50 } : { left : 45 , bottom : 50 } ; a ( "#color_picker" ) . draggable ( { cancel : ".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker" , containment : "window" } ) . css ( M ) . jGraduate ( { paint : V , window : { pickerTitle : q } , images : { clientPath : curConfig . jGraduatePath } ,
newstop : "inverse" } , function ( ca ) { V = new a . jGraduate . Paint ( ca ) ; b . paintBox [ E ] . setPaint ( V ) ; g . setPaint ( E , V ) ; a ( "#color_picker" ) . hide ( ) } , function ( ) { a ( "#color_picker" ) . hide ( ) } ) } ; o = function ( q , E ) { var M = document . getElementById ( "canvas_background" ) , V = { color : "fff" , opacity : 1 } ; if ( E == "stroke" ) V = curConfig . initStroke ; if ( E == "fill" ) V = curConfig . initFill ; if ( E == "canvas" && M ) if ( M = M . getAttribute ( "fill" ) . match ( /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/ ) ) V = { color : ( "0" + parseInt ( M [ 1 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( M [ 2 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) +
( "0" + parseInt ( M [ 3 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) , opacity : 1 } ; M = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#' + V . color + '" opacity="' + V . opacity + '"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>' , "text/xml" ) . documentElement ; M = a ( q ) [ 0 ] . appendChild ( document . importNode ( M , true ) ) ; E === "canvas" ? M . setAttribute ( "width" , 60.5 ) : M . setAttribute ( "width" , "100%" ) ; this . rect = M . firstChild ; this . defs = M . getElementsByTagName ( "defs" ) [ 0 ] ;
this . grad = this . defs . firstChild ; this . paint = new a . jGraduate . Paint ( { solidColor : V . color } ) ; this . type = E ; this . setPaint = function ( ca , ia ) { this . paint = ca ; var ta = "none" , za = ca . type , ya = ca . alpha / 100 ; switch ( za ) { case "solidColor" : ta = ca [ za ] == "none" || ca [ za ] == "one" ? "none" : "#" + ca [ za ] ; break ; case "linearGradient" : case "radialGradient" : this . defs . removeChild ( this . grad ) ; this . grad = this . defs . appendChild ( ca [ za ] ) ; ta = "url(#" + ( this . grad . id = "gradbox_" + this . type ) + ")" } this . rect . setAttribute ( "fill" , ta ) ; this . rect . setAttribute ( "opacity" ,
ya ) ; if ( ia ) { g . setColor ( this . type , ta , true ) ; g . setPaintOpacity ( this . type , ya , true ) } if ( this . type == "canvas" ) ( za = document . getElementById ( "canvas_background" ) ) ? za . setAttribute ( "fill" , ta ) : Qa ( ta ) } ; this . update = function ( ca ) { if ( P ) { var ia = this . type ; switch ( P . tagName ) { case "use" : case "image" : case "foreignObject" : return ; case "g" : case "a" : for ( var ta = null , za = P . getElementsByTagName ( "*" ) , ya = 0 , xa = za . length ; ya < xa ; ya ++ ) { var Ga = za [ ya ] . getAttribute ( ia ) ; if ( ya === 0 ) ta = Ga ; else if ( ta !== Ga ) { ta = null ; break } } if ( ta === null ) { za = null ; return } za =
ta ; ta = 1 ; break ; default : ta = parseFloat ( P . getAttribute ( ia + "-opacity" ) ) ; if ( isNaN ( ta ) ) ta = 1 ; za = ia === "fill" ? "black" : "none" ; za = P . getAttribute ( ia ) || za } if ( ca ) { g . setColor ( ia , za , true ) ; g . setPaintOpacity ( ia , ta , true ) } ta *= 100 ; this . setPaint ( Oa ( za , ta , ia ) ) } } ; this . prep = function ( ) { switch ( this . paint . type ) { case "linearGradient" : case "radialGradient" : var ca = new a . jGraduate . Paint ( { copy : this . paint } ) ; g . setPaint ( E , ca ) } } } ; b . paintBox . fill = new o ( "#fill_color" , "fill" ) ; b . paintBox . stroke = new o ( "#stroke_color" , "stroke" ) ; b . paintBox . canvas =
new o ( "#canvas_color" , "canvas" ) ; a ( "#stroke_width" ) . val ( curConfig . initStroke . width ) ; a ( "#group_opacity" ) . val ( curConfig . initOpacity * 100 ) ; o = b . paintBox . fill . rect . cloneNode ( false ) ; o . setAttribute ( "style" , "vector-effect:non-scaling-stroke" ) ; var W = o . style . vectorEffect === "non-scaling-stroke" ; o . removeAttribute ( "style" ) ; o = b . paintBox . fill . rect . ownerDocument . createElementNS ( "http://www.w3.org/2000/svg" , "feGaussianBlur" ) ; typeof o . stdDeviationX === "undefined" && a ( "#tool_blur" ) . hide ( ) ; a ( o ) . remove ( ) ; setTimeout ( function ( ) { g . embedImage ( "images/placeholder.svg" ,
function ( q ) { if ( ! q ) { a ( "#image_save_opts [value=embed]" ) . attr ( "disabled" , "disabled" ) ; a ( "#image_save_opts input" ) . val ( [ "ref" ] ) ; s . img _save = "ref" ; a ( "#image_opt_embed" ) . css ( "color" , "#666" ) . attr ( "title" , uiStrings . notification . featNotSupported ) } } ) } , 1E3 ) ; a ( "#tool_fill" ) . click ( function ( ) { if ( a ( "#tool_fill" ) . hasClass ( "active" ) ) I ( a ( "#fill_color" ) ) ; else { a ( "#tool_fill" ) . addClass ( "active" ) ; a ( "#tool_stroke" ) . removeClass ( "active" ) } } ) ; a ( "#tool_canvas" ) . on ( "click touchstart" , function ( ) { I ( a ( "#canvas_color" ) ) } ) ; a ( "#tool_stroke" ) . on ( "click touchstart" ,
function ( ) { if ( a ( "#tool_stroke" ) . hasClass ( "active" ) ) I ( a ( "#stroke_color" ) ) ; else { a ( "#tool_stroke" ) . addClass ( "active" ) ; a ( "#tool_fill" ) . removeClass ( "active" ) } } ) ; a ( "#zoomLabel" ) . click ( function ( ) { a ( "#zoom_dropdown button" ) . mousedown ( ) ; a ( window ) . mouseup ( ) } ) ; a ( ".push_button" ) . mousedown ( function ( ) { a ( this ) . hasClass ( "disabled" ) || a ( this ) . addClass ( "push_button_pressed" ) . removeClass ( "push_button" ) } ) . mouseout ( function ( ) { a ( this ) . removeClass ( "push_button_pressed" ) . addClass ( "push_button" ) } ) . mouseup ( function ( ) { a ( this ) . removeClass ( "push_button_pressed" ) . addClass ( "push_button" ) } ) ;
a ( window ) . bind ( "load resize" , function ( ) { S . css ( "line-height" , S . height ( ) + "px" ) } ) ; var X = function ( ) { var q = a ( "#canvas_width" ) , E = a ( "#canvas_height" ) , M = q . val ( ) , V = E . val ( ) ; if ( M != "fit" && ! svgedit . units . isValidUnit ( "width" , M ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; q . parent ( ) . addClass ( "error" ) ; return false } q . parent ( ) . removeClass ( "error" ) ; if ( V != "fit" && ! svgedit . units . isValidUnit ( "height" , V ) ) { a . alert ( uiStrings . notification . invalidAttrValGiven ) ; E . parent ( ) . addClass ( "error" ) ; return false } E . parent ( ) . removeClass ( "error" ) ;
if ( ! g . setResolution ( M , V ) ) { a . alert ( uiStrings . notification . noContentToFitTo ) ; M = g . getResolution ( ) ; q . val ( M . w ) ; E . val ( M . h ) ; return false } ra ( ) } ; a ( "#resolution" ) . change ( function ( ) { var q = a ( "#canvas_width" ) [ 0 ] , E = a ( "#canvas_height" ) [ 0 ] ; if ( this . selectedIndex ) if ( this . value == "content" ) { q . value = "fit" ; E . value = "fit" ; X ( ) ; var M = g . getResolution ( ) ; q . value = M . w ; E . value = M . h } else { var V = this . value . split ( "x" ) ; V [ 0 ] = parseInt ( V [ 0 ] ) ; V [ 1 ] = parseInt ( V [ 1 ] ) ; var ca = V [ 0 ] - q . value , ia = V [ 1 ] - E . value , ta = Date . now ( ) , za = function ( ya ) { ya = ( ya - ta ) /
1E3 ; ya = Math . pow ( ya - 1 , 3 ) + 1 ; q . value = ( V [ 0 ] - ca + ya * ca ) . toFixed ( 0 ) ; E . value = ( V [ 1 ] - ia + ya * ia ) . toFixed ( 0 ) ; X ( ) ; if ( ya >= 1 ) { ya = g . getResolution ( ) ; a ( "#canvas_width" ) . val ( ya . w . toFixed ( ) ) ; a ( "#canvas_height" ) . val ( ya . h . toFixed ( ) ) ; a ( "#resolution_label" ) . html ( "<div class='pull'>" + ya . w + "<span>\u00d7</span></br>" + ya . h + "</div>" ) } else requestAnimationFrame ( za ) } ; za ( Date . now ( ) ) } else { a ( "#resolution_label" ) . html ( "Custom" ) ; q . removeAttribute ( "readonly" ) ; q . focus ( ) ; q . select ( ) ; if ( q . value == "fit" ) { q . value = 100 ; E . value = 100 } } } ) ; a ( "#zoom" ) . change ( function ( ) { Ea ( this ) } ) ;
a ( "input,select" ) . attr ( "autocomplete" , "off" ) ; var da = function ( ) { var q = [ { sel : "#tool_select" , fn : db , evt : "click" , key : [ "V" , true ] } , { sel : "#tool_fhpath" , fn : Ka , evt : "click" , key : [ "Q" , true ] } , { sel : "#tool_line" , fn : sb , evt : "click" , key : [ "L" , true ] } , { sel : "#tool_rect" , fn : tb , evt : "click" , key : [ "R" , true ] , icon : "rect" } , { sel : "#tool_ellipse" , fn : nb , evt : "mouseup" , key : [ "C" , true ] , icon : "ellipse" } , { sel : "#tool_path" , fn : Ib , evt : "click" , key : [ "P" , true ] } , { sel : "#tool_text" , fn : ib , evt : "click" , key : [ "T" , true ] } , { sel : "#tool_image" , fn : fb , evt : "mouseup" } ,
{ sel : "#tool_zoom" , fn : Za , evt : "mouseup" , key : [ "Z" , true ] } , { sel : "#tool_clear" , fn : Fb , evt : "mouseup" , key : [ p + "N" , true ] } , { sel : "#tool_save" , fn : function ( ) { wa ? e ( ) : clickSave ( ) } , evt : "mouseup" , key : [ p + "S" , true ] } , { sel : "#tool_export" , fn : Tb , evt : "mouseup" } , { sel : "#tool_open" , fn : pb , evt : "mouseup" } , { sel : "#tool_import" , fn : Sa , evt : "mouseup" } , { sel : "#tool_source" , fn : Vb , evt : "click" , key : [ p + "U" , true ] } , { sel : "#tool_wireframe" , fn : Lb , evt : "click" } , { sel : "#tool_snap" , fn : wb , evt : "click" } , { sel : "#tool_rulers" , fn : Nb , evt : "click" } , { sel : "#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel" ,
fn : z , evt : "click" , key : [ "esc" , false , false ] , hidekey : true } , { sel : "#tool_source_save" , fn : e , evt : "click" } , { sel : "#tool_delete,#tool_delete_multi" , fn : Cb , evt : "click" , key : [ "del/backspace" , true ] } , { sel : "#tool_reorient" , fn : L , evt : "click" } , { sel : "#tool_node_link" , fn : Xa , evt : "click" } , { sel : "#tool_node_clone" , fn : cb , evt : "click" } , { sel : "#tool_node_delete" , fn : rb , evt : "click" } , { sel : "#tool_openclose_path" , fn : Bb , evt : "click" } , { sel : "#tool_add_subpath" , fn : ub , evt : "click" } , { sel : "#tool_move_top" , fn : Ab , evt : "click" , key : p + "shift+up" } ,
{ sel : "#tool_move_bottom" , fn : Jb , evt : "click" , key : p + "shift+down" } , { sel : "#tool_move_up" , fn : oa , evt : "click" , key : [ p + "up" , true ] } , { sel : "#tool_move_down" , fn : ga , evt : "click" , key : [ p + "down" , true ] } , { sel : "#tool_topath" , fn : R , evt : "click" } , { sel : "#tool_make_link,#tool_make_link_multi" , fn : fa , evt : "click" } , { sel : "#tool_clone,#tool_clone_multi" , fn : Yb , evt : "click" , key : [ p + "D" , true ] } , { sel : "#tool_group" , fn : Qb , evt : "click" , key : [ p + "G" , true ] } , { sel : "#tool_ungroup" , fn : Qb , evt : "click" , key : p + "shift+G" } , { sel : "#tool_unlink_use" , fn : Qb , evt : "click" } ,
{ sel : "[id^=tool_align]" , fn : Mb , evt : "click" } , { sel : "#tool_undo" , fn : Xb , evt : "click" , key : p + "z" } , { sel : "#tool_redo" , fn : Sb , evt : "click" , key : [ "y" , true ] } , { sel : "#tool_canvas_color_menu" , fn : $b , evt : "click" } , { sel : "#tool_cut" , fn : kb , evt : "click" , key : [ p + "x" , true ] } , { sel : "#tool_copy" , fn : vb , evt : "click" , key : p + "c" } , { sel : "#tool_paste" , fn : Gb , evt : "click" , key : p + "v" } , { sel : "#tool_switch" , fn : Wb , evt : "click" , key : [ "x" , true ] } , { sel : "#tool_bold" , fn : Kb , evt : "mousedown" , key : [ p + "B" , true ] } , { sel : "#tool_italic" , fn : Ub , evt : "mousedown" , key : [ p +
"I" , true ] } , { sel : "#copy_save_done" , fn : z , evt : "click" } , { key : "ctrl+left" , fn : function ( ) { Ya ( 0 , 1 ) } } , { key : "ctrl+right" , fn : function ( ) { Ya ( 1 , 1 ) } } , { key : "ctrl+shift+left" , fn : function ( ) { Ya ( 0 , 5 ) } } , { key : "ctrl+shift+right" , fn : function ( ) { Ya ( 1 , 5 ) } } , { key : "shift+O" , fn : Eb } , { key : "shift+P" , fn : lb } , { key : [ p + "+" , true ] , fn : function ( ) { Pb ( 2 ) } } , { key : [ p + "-" , true ] , fn : function ( ) { Pb ( 0.5 ) } } , { key : [ "up" , true ] , fn : function ( ) { Fa ( 0 , - 1 ) } } , { key : [ "down" , true ] , fn : function ( ) { Fa ( 0 , 1 ) } } , { key : [ "left" , true ] , fn : function ( ) { Fa ( - 1 , 0 ) } } , { key : [ "right" , true ] ,
fn : function ( ) { Fa ( 1 , 0 ) } } , { key : "shift+up" , fn : function ( ) { Fa ( 0 , - 10 ) } } , { key : "shift+down" , fn : function ( ) { Fa ( 0 , 10 ) } } , { key : "shift+left" , fn : function ( ) { Fa ( - 10 , 0 ) } } , { key : "shift+right" , fn : function ( ) { Fa ( 10 , 0 ) } } , { key : [ "alt+up" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , - 1 ) } } , { key : [ "alt+down" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , 1 ) } } , { key : [ "alt+left" , true ] , fn : function ( ) { g . cloneSelectedElements ( - 1 , 0 ) } } , { key : [ "alt+right" , true ] , fn : function ( ) { g . cloneSelectedElements ( 1 , 0 ) } } , { key : [ "alt+shift+up" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 ,
- 10 ) } } , { key : [ "alt+shift+down" , true ] , fn : function ( ) { g . cloneSelectedElements ( 0 , 10 ) } } , { key : [ "alt+shift+left" , true ] , fn : function ( ) { g . cloneSelectedElements ( - 10 , 0 ) } } , { key : [ "alt+shift+right" , true ] , fn : function ( ) { g . cloneSelectedElements ( 10 , 0 ) } } , { key : p + "A" , fn : function ( ) { g . selectAllInCurrentLayer ( ) } } , { key : p + "shift+z" , fn : Sb } , { key : "esc" , fn : Zb } ] , E = { "4/Shift+4" : "#tools_rect_show" , "5/Shift+5" : "#tools_ellipse_show" } ; return { setAll : function ( ) { var M = { } ; a . each ( q , function ( V , ca ) { if ( ca . sel ) { var ia = a ( ca . sel ) ; if ( ia . length ==
0 ) return true ; if ( ca . evt ) { if ( svgedit . browser . isTouch ( ) && ca . evt === "click" ) ca . evt = "mousedown" ; ia [ ca . evt ] ( ca . fn ) } if ( ca . parent && a ( ca . parent + "_show" ) . length != 0 ) { var ta = a ( ca . parent ) ; ta . length || ( ta = pa ( ca . parent . substr ( 1 ) ) ) ; ta . append ( ia ) ; a . isArray ( M [ ca . parent ] ) || ( M [ ca . parent ] = [ ] ) ; M [ ca . parent ] . push ( ca ) } } if ( ca . key ) { var za = ca . fn , ya = false ; if ( a . isArray ( ca . key ) ) { ta = ca . key [ 0 ] ; if ( ca . key . length > 1 ) ya = ca . key [ 1 ] } else ta = ca . key ; ta += "" ; svgedit . browser . isMac && ta . indexOf ( "+" ) != - 1 && ta . split ( "+" ) [ 0 ] == "ctrl" && ta . replace ( "ctrl" ,
"cmd" ) ; a . each ( ta . split ( "/" ) , function ( Ga , mb ) { a ( document ) . bind ( "keydown" , mb , function ( Ua ) { za ( ) ; ya && Ua . preventDefault ( ) ; return false } ) } ) ; if ( ca . sel && ! ca . hidekey && ia . attr ( "title" ) ) { var xa = ia . attr ( "title" ) . split ( "[" ) [ 0 ] + " (" + ta + ")" ; E [ ta ] = ca . sel ; ia . parents ( "#main_menu" ) . length || ia . attr ( "title" , xa ) } } } ) ; ua ( M ) ; a ( ".attr_changer, #image_url" ) . bind ( "keydown" , "return" , function ( V ) { a ( this ) . change ( ) ; V . preventDefault ( ) } ) ; a ( window ) . bind ( "keydown" , "tab" , function ( V ) { if ( T === "canvas" ) { V . preventDefault ( ) ; lb ( ) } } ) . bind ( "keydown" ,
"shift+tab" , function ( V ) { if ( T === "canvas" ) { V . preventDefault ( ) ; Eb ( ) } } ) ; a ( "#tool_zoom" ) . dblclick ( Ta ) } , setTitles : function ( ) { a . each ( E , function ( M , V ) { var ca = a ( V ) . parents ( "#main_menu" ) . length ; a ( V ) . each ( function ( ) { var ia = ca ? a ( this ) . text ( ) . split ( " [" ) [ 0 ] : this . title . split ( " [" ) [ 0 ] , ta = "" ; a . each ( M . split ( "/" ) , function ( za , ya ) { var xa = ya . split ( "+" ) , Ga = "" ; if ( xa . length > 1 ) { Ga = xa [ 0 ] + "+" ; ya = xa [ 1 ] } ta += ( za ? "/" : "" ) + Ga + ( uiStrings [ "key_" + ya ] || ya ) } ) ; if ( ca ) this . lastChild . textContent = ia + " [" + ta + "]" ; else this . title = ia + " [" + ta + "]" } ) } ) } ,
getButtonData : function ( M ) { var V ; a . each ( q , function ( ca , ia ) { if ( ia . sel === M ) V = ia } ) ; return V } } } ( ) ; da . setAll ( ) ; b . ready ( function ( ) { var q = curConfig . initTool , E = a ( "#tools_left, #svg_editor .tools_flyout" ) , M = E . find ( "#tool_" + q ) ; q = E . find ( "#" + q ) ; ( M . length ? M : q . length ? q : a ( "#tool_select" ) ) . click ( ) . mouseup ( ) ; curConfig . wireframe && a ( "#tool_wireframe" ) . click ( ) ; curConfig . showlayers && toggleSidePanel ( ) ; a ( "#rulers" ) . toggle ( ! ! curConfig . showRulers ) } ) ; a ( "#canvas_height" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : X , cursor : false } ) ;
a ( "#canvas_width" ) . dragInput ( { min : 10 , max : null , step : 10 , callback : X , cursor : false } ) ; a ( "#rect_width" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_height" ) . dragInput ( { min : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_cx" ) . dragInput ( { min : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_cy" ) . dragInput ( { min : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#ellipse_rx" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute ,
cursor : false } ) ; a ( "#ellipse_ry" ) . dragInput ( { min : 1 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_height" ) . dragInput ( { min : 0 , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#selected_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#selected_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#path_node_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#path_node_y" ) . dragInput ( { min : null ,
max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_width" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#line_x1" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#line_x2" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#line_y1" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#line_y2" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ;
a ( "#path_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#path_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#group_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#group_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute ,
cursor : false } ) ; a ( "#image_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#text_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#text_x" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#image_y" ) . dragInput ( { min : null , max : null , step : 1 , callback : changeAttribute , cursor : false } ) ; a ( "#rect_rx" ) . dragInput ( { min : 0 , max : 100 , step : 1 , callback : function ( q ) { g . setRectRadius ( q . value ) } , cursor : true } ) ; a ( "#stroke_width" ) . dragInput ( { min : 0 ,
max : 99 , step : 1 , callback : function ( q ) { var E = q . value ; if ( E == 0 && P && [ "line" , "polyline" ] . indexOf ( P . nodeName ) >= 0 ) E = q . value = 1 ; g . setStrokeWidth ( E ) } , cursor : true , smallStep : 0.1 , start : 1.5 } ) ; a ( "#angle" ) . dragInput ( { min : - 180 , max : 180 , step : 1 , callback : function ( q ) { g . setRotationAngle ( q . value ) ; rotateCursor ( q . value ) ; a ( "#tool_reorient" ) . toggleClass ( "disabled" , q . value == 0 ) } , cursor : false } ) ; a ( "#font_size" ) . dragInput ( { min : 1 , max : 250 , step : 1 , callback : function ( q ) { g . setFontSize ( q . value ) } , cursor : true , stepfunc : function ( q , E ) { var M = q . value -
0 , V = M + E , ca = V >= M ; if ( E === 0 ) return M ; return M >= 24 ? ca ? Math . round ( M * 1.1 ) : Math . round ( M / 1.1 ) : M <= 1 ? ca ? M * 2 : M / 2 : V } } ) ; a ( "#group_opacity" ) . dragInput ( { min : 0 , max : 100 , step : 5 , callback : yb , cursor : true , start : 100 } ) ; a ( "#blur" ) . dragInput ( { min : 0 , max : 10 , step : 0.1 , callback : qb , cursor : true , start : 0 } ) ; a ( "#zoom" ) . val ( g . getZoom ( ) * 100 ) ; a ( "#workarea" ) . contextMenu ( { menu : "cmenu_canvas" , inSpeed : 0 } , function ( q ) { switch ( q ) { case "delete" : Cb ( ) ; break ; case "cut" : kb ( ) ; break ; case "copy" : vb ( ) ; break ; case "paste" : g . pasteElements ( ) ; break ; case "paste_in_place" : g . pasteElements ( "in_place" ) ;
break ; case "group" : g . groupSelectedElements ( ) ; break ; case "ungroup" : g . ungroupSelectedElement ( ) ; break ; case "move_front" : Ab ( ) ; break ; case "move_up" : sa ( "Up" ) ; break ; case "move_down" : sa ( "Down" ) ; break ; case "move_back" : Jb ( ) ; break ; default : svgedit . contextmenu && svgedit . contextmenu . hasCustomHandler ( q ) && svgedit . contextmenu . getCustomHandler ( q ) . call ( ) } } ) ; a ( ".contextMenu li" ) . mousedown ( function ( q ) { q . preventDefault ( ) } ) ; window . onbeforeunload = function ( ) { if ( Q . getUndoStackSize ( ) === 0 ) b . show _save _warning = false ; if ( ! curConfig . no _save _warning &&
b . show _save _warning ) return uiStrings . notification . unsavedChanges } ; b . openPrep = function ( q ) { a ( "#main_menu" ) . hide ( ) ; Q . getUndoStackSize ( ) === 0 ? q ( true ) : a . confirm ( uiStrings . notification . QwantToOpen , q ) } ; if ( window . FileReader ) { o = a ( '<input type="file">' ) . change ( function ( ) { var q = this ; b . openPrep ( function ( E ) { if ( E ) { g . clear ( ) ; if ( q . files . length == 1 ) { E = new FileReader ; E . onloadend = function ( M ) { n ( M . target . result ) ; ra ( ) } ; E . readAsText ( q . files [ 0 ] ) } } } ) } ) ; a ( "#tool_open" ) . show ( ) . prepend ( o ) ; o = a ( '<input type="file">' ) . change ( function ( ) { a ( "#main_menu" ) . hide ( ) ;
if ( this . files . length == 1 ) { var q = new FileReader ; q . onloadend = function ( E ) { g . importSvgString ( E . target . result , true ) ; ra ( ) } ; q . readAsText ( this . files [ 0 ] ) } } ) ; a ( "#tool_import" ) . show ( ) . prepend ( o ) } var ra = b . updateCanvas = function ( q , E ) { var M = S . width ( ) , V = S . height ( ) , ca = M , ia = V , ta = g . getZoom ( ) , za = a ( "#svgcanvas" ) , ya = { x : S [ 0 ] . scrollLeft + ca / 2 , y : S [ 0 ] . scrollTop + ia / 2 } , xa = curConfig . canvas _expansion ; M = Math . max ( ca , g . contentW * ta * xa ) ; V = Math . max ( ia , g . contentH * ta * xa ) ; M == ca && V == ia ? S . css ( "overflow" , "hidden" ) : S . css ( "overflow" , "scroll" ) ;
xa = za . height ( ) / 2 ; var Ga = za . width ( ) / 2 ; za . width ( M ) . height ( V ) ; var mb = V / 2 , Ua = M / 2 , ma = g . updateCanvas ( M , V ) , xb = Ua / Ga ; M = M / 2 - ca / 2 ; V = V / 2 - ia / 2 ; if ( E ) { E . x += ma . x ; E . y += ma . y } else E = { x : Ua + ( ya . x - Ga ) * xb , y : mb + ( ya . y - xa ) * xb } ; if ( q ) if ( g . contentW > S . width ( ) ) { S [ 0 ] . scrollLeft = ma . x - 10 ; S [ 0 ] . scrollTop = ma . y - 10 } else { S [ 0 ] . scrollLeft = M ; S [ 0 ] . scrollTop = V } else { S [ 0 ] . scrollLeft = E . x - ca / 2 ; S [ 0 ] . scrollTop = E . y - ia / 2 } if ( curConfig . showRulers ) { l ( za , ta ) ; S . scroll ( ) } } , va = [ ] ; for ( G = 0.1 ; G < 1E5 ; G *= 10 ) { va . push ( 1 * G ) ; va . push ( 2 * G ) ; va . push ( 5 * G ) } ra ( true ) ; try { var ka =
function ( q ) { if ( window . JSON && JSON . stringify ) return JSON . stringify ( q ) ; var E = arguments . callee ; if ( typeof q == "boolean" || typeof q == "number" ) return q + "" ; else if ( typeof q == "string" ) return '"' + q . replace ( /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g , function ( ca ) { return "\\u" + ( "0000" + ca . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 4 ) } ) + '"' ; else if ( q . length ) { for ( var M = 0 ; M < q . length ; M ++ ) q [ M ] = E ( q [ M ] ) ; return "[" + q . join ( "," ) + "]" } else { M = [ ] ; for ( var V in q ) M . push ( E ( V ) +
":" + E ( q [ V ] ) ) ; return "{" + M . join ( "," ) + "}" } } ; window . addEventListener ( "message" , function ( q ) { var E = parseInt ( q . data . substr ( 0 , q . data . indexOf ( ";" ) ) ) ; try { q . source . postMessage ( "SVGe" + E + ";" + ka ( eval ( q . data ) ) , "*" ) } catch ( M ) { q . source . postMessage ( "SVGe" + E + ";error:" + M . message , "*" ) } } , false ) } catch ( na ) { window . embed _error = na } a ( function ( ) { window . svgCanvas = g ; g . ready = svgEditor . ready } ) ; b . setLang = function ( q , E ) { a . pref ( "lang" , q ) ; a ( "#lang_select" ) . val ( q ) ; if ( E ) { g . runExtensions ( "langChanged" , q ) ; Ha ( ) ; a . each ( { "#stroke_color" : "#tool_stroke .icon_label, #tool_stroke .color_block" ,
"#fill_color" : "#tool_fill label, #tool_fill .color_block" , "#linejoin_miter" : "#cur_linejoin" , "#linecap_butt" : "#cur_linecap" } , function ( M , V ) { a ( V ) . attr ( "title" , a ( M ) [ 0 ] . title ) } ) ; a ( "#multiselected_panel div[id^=tool_align]" ) . each ( function ( ) { a ( "#tool_pos" + this . id . substr ( 10 ) ) [ 0 ] . title = this . title } ) } } } ; var f = [ ] ; b . ready = function ( d ) { m ? d ( ) : f . push ( d ) } ; b . runCallbacks = function ( ) { a . each ( f , function ( ) { this ( ) } ) ; m = true } ; b . loadFromString = function ( d ) { b . ready ( function ( ) { n ( d ) } ) } ; b . loadFromURL = function ( d , l ) { l || ( l = { } ) ; var o =
l . cache , A = l . callback ; b . ready ( function ( ) { a . ajax ( { url : d , dataType : "text" , cache : ! ! o , success : function ( p ) { n ( p , A ) } , error : function ( p , K , Q ) { p . status != 404 && p . responseText ? n ( p . responseText , A ) : a . alert ( uiStrings . notification . URLloadFail + ": \n" + Q + "" , A ) } } ) } ) } ; b . loadFromDataURI = function ( d ) { b . ready ( function ( ) { var l = d . substring ( 26 ) ; n ( svgedit . utilities . decode64 ( l ) ) } ) } ; b . addExtension = function ( ) { var d = arguments ; a ( function ( ) { g && g . addExtension . apply ( this , d ) } ) } ; return b } ( jQuery ) ; $ ( svgEditor . init ) } ) ( ) ; $ . fn . dragInput = function ( a ) { return this . each ( function ( ) { this . repeating = false ; this . dragCfg = { min : a && ! isNaN ( parseFloat ( a . min ) ) ? Number ( a . min ) : null , max : a && ! isNaN ( parseFloat ( a . max ) ) ? Number ( a . max ) : null , step : a && a . step ? Number ( a . step ) : 1 , stepfunc : a && a . stepfunc ? a . stepfunc : false , page : a && a . page ? Number ( a . page ) : 10 , reset : a && a . reset ? a . reset : this . value , delay : a && a . delay ? Number ( a . delay ) : 500 , interval : a && a . interval ? Number ( a . interval ) : 100 , height : 70 , cursor : a && a . cursor ? Boolean ( a . cursor ) : false , start : a && a . start ? Number ( a . start ) :
0 , _btn _width : 20 , _direction : null , _delay : null , _repeat : null , callback : a && a . callback ? a . callback : null } ; this . dragCfg . smallStep = a && a . smallStep ? a . smallStep : this . dragCfg . step / 2 ; var n = $ ( this ) . parent ( ) ; $ ( this ) ; var g = this . dragCfg . height , b = this . dragCfg . min , m = this . dragCfg . max , s = this . dragCfg . step , c = m - b > 0 ? ( m - b ) / s : 200 , f = c / g * s , d = 0 , l = this . getAttribute ( "data-attr" ) , o = svgEditor . canvas , A = o . getSelectedElems ( ) , p = svgedit . browser . isTouch ( ) , K = c && this . dragCfg . cursor ? $ ( "<div class='draginput_cursor' />" ) . appendTo ( n ) : false ; K &&
this . dragCfg . start && K . css ( "top" , this . dragCfg . start * - 1 / f + g ) ; this . adjustValue = function ( Q , N ) { var H ; H = isNaN ( this . value ) ? this . dragCfg . reset : $ . isFunction ( this . dragCfg . stepfunc ) ? this . dragCfg . stepfunc ( this , Q ) : Number ( ( Number ( this . value ) + Number ( Q ) ) . toFixed ( 5 ) ) ; if ( m !== null ) H = Math . min ( H , m ) ; if ( b !== null ) H = Math . max ( H , b ) ; K && this . updateCursor ( H ) ; this . value = H ; n . attr ( "data-value" , H ) ; $ . isFunction ( this . dragCfg . callback ) && this . dragCfg . callback ( this , N ) } ; n . toggleClass ( "draginput" , n . is ( "label" ) ) ; this . move = function ( Q , N , H ) { if ( p ) Q =
Q . originalEvent . touches [ 0 ] ; if ( d === 0 ) d = N ; N = ( Q . pageY - d ) * - 1 ; d = Q . pageY ; H = N * f ; this . adjustValue ( H . toFixed ( s < 1 ? 1 : 0 ) ) } ; this . stop = function ( ) { $ ( "body" ) . removeClass ( "dragging" ) ; n . removeClass ( "active" ) ; $ ( window ) . unbind ( "mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput" ) ; d = 0 ; if ( A [ 0 ] ) { var Q = o . undoMgr . finishUndoableChange ( ) ; Q . isEmpty ( ) || o . undoMgr . addCommandToHistory ( Q ) } this . adjustValue ( 0 ) } ; this . updateCursor = function ( ) { var Q = parseFloat ( this . value ) * - 1 / f + g ; $ ( this ) . next ( ".draginput_cursor" ) . css ( "top" ,
Q ) } ; this . start = function ( Q ) { if ( p ) Q = Q . originalEvent . touches [ 0 ] ; var N = Q . pageY , H = this . value , S = this ; o . undoMgr . beginUndoableChange ( l , A ) ; $ ( "body" ) . addClass ( "dragging" ) ; n . addClass ( "active" ) ; $ ( window ) . bind ( "mousemove.draginput touchmove.draginput" , function ( ba ) { S . move ( ba , N , parseFloat ( H ) ) } ) ; $ ( window ) . bind ( "mouseup.draginput touchend.draginput" , function ( ) { S . stop ( ) } ) } ; $ ( this ) . attr ( "readonly" , "readonly" ) . attr ( "data-scale" , f ) . attr ( "data-domain" , g ) . attr ( "data-cursor" , K != false ) . bind ( "mousedown touchstart" , function ( Q ) { this . start ( Q ) } ) . bind ( "dblclick taphold" ,
function ( ) { this . removeAttribute ( "readonly" , "readonly" ) ; this . focus ( ) ; this . select ( ) } ) . blur ( function ( ) { this . setAttribute ( "readonly" , "readonly" ) ; this . adjustValue ( 0 ) } ) . keydown ( function ( Q ) { switch ( Q . keyCode ) { case 13 : this . blur ( ) ; break ; case 38 : this . adjustValue ( this . dragCfg . step ) ; break ; case 40 : this . adjustValue ( - this . dragCfg . step ) ; break ; case 33 : this . adjustValue ( this . dragCfg . page ) ; break ; case 34 : this . adjustValue ( - this . dragCfg . page ) } } ) . keypress ( function ( Q ) { if ( this . repeating ) switch ( Q . keyCode ) { case 38 : this . adjustValue ( this . dragCfg . step ) ;
break ; case 40 : this . adjustValue ( - this . dragCfg . step ) ; break ; case 33 : this . adjustValue ( this . dragCfg . page ) ; break ; case 34 : this . adjustValue ( - this . dragCfg . page ) } else this . repeating = true } ) . keyup ( function ( Q ) { this . repeating = false ; switch ( Q . keyCode ) { case 38 : case 40 : case 33 : case 34 : case 13 : this . adjustValue ( 0 ) } } ) . bind ( "mousewheel" , function ( Q , N , H , S ) { if ( S > 0 ) this . adjustValue ( this . dragCfg . step , true ) ; else S < 0 && this . adjustValue ( - this . dragCfg . step , true ) ; Q . preventDefault ( ) } ) } ) } ;
$ . fn . dragInput . updateCursor = function ( a ) { var n = parseFloat ( a . value ) , g = parseFloat ( a . getAttribute ( "data-scale" ) ) , b = parseFloat ( a . getAttribute ( "data-domain" ) ) ; n = n * - 1 / g + b + "px" ; if ( a = a . nextElementSibling ) a . style . top = n } ; svgedit = svgedit || { } ;
( function ( ) { var a = this ; if ( ! svgedit . contextmenu ) svgedit . contextmenu = { } ; a . contextMenuExtensions = { } ; svgEditor . ready ( function ( ) { for ( menuItem in contextMenuExtensions ) { var n = contextMenuExtensions [ menuItem ] ; Object . keys ( a . contextMenuExtensions ) . length == 0 && $ ( "#cmenu_canvas" ) . append ( "<li class='separator'>" ) ; var g = n . shortcut || "" ; $ ( "#cmenu_canvas" ) . append ( "<li class='disabled'><a href='#" + n . id + "'>" + n . label + "<span class='shortcut'>" + g + "</span></a></li>" ) } } ) ; svgedit . contextmenu . resetCustomMenus = function ( ) { a . contextMenuExtensions =
{ } } ; svgedit . contextmenu . add = function ( n ) { if ( n && n . id && n . label && n . action && typeof n . action == "function" ) if ( n . id in a . contextMenuExtensions ) console . error ( 'Cannot add extension "' + n . id + '", an extension by that name already exists"' ) ; else { console . log ( "Registed contextmenu item: {id:" + n . id + ", label:" + n . label + "}" ) ; a . contextMenuExtensions [ n . id ] = n } else console . error ( "Menu items must be defined and have at least properties: id, label, action, where action must be a function" ) } ; svgedit . contextmenu . hasCustomHandler =
function ( n ) { return a . contextMenuExtensions [ n ] && true } ; svgedit . contextmenu . getCustomHandler = function ( n ) { return a . contextMenuExtensions [ n ] . action } } ) ( ) ; ( function ( a , n ) { function g ( m ) { return ! a ( m ) . parents ( ) . andSelf ( ) . filter ( function ( ) { return a . curCSS ( this , "visibility" ) === "hidden" || a . expr . filters . hidden ( this ) } ) . length } function b ( m , s ) { var c = m . nodeName . toLowerCase ( ) ; if ( "area" === c ) { c = m . parentNode ; var f = c . name ; if ( ! m . href || ! f || c . nodeName . toLowerCase ( ) !== "map" ) return false ; c = a ( "img[usemap=#" + f + "]" ) [ 0 ] ; return ! ! c && g ( c ) } return ( /input|select|textarea|button|object/ . test ( c ) ? ! m . disabled : "a" == c ? m . href || s : s ) && g ( m ) } a . ui = a . ui || { } ; a . ui . version || ( a . extend ( a . ui , { version : "1.8.17" ,
keyCode : { ALT : 18 , BACKSPACE : 8 , CAPS _LOCK : 20 , COMMA : 188 , COMMAND : 91 , COMMAND _LEFT : 91 , COMMAND _RIGHT : 93 , CONTROL : 17 , DELETE : 46 , DOWN : 40 , END : 35 , ENTER : 13 , ESCAPE : 27 , HOME : 36 , INSERT : 45 , LEFT : 37 , MENU : 93 , NUMPAD _ADD : 107 , NUMPAD _DECIMAL : 110 , NUMPAD _DIVIDE : 111 , NUMPAD _ENTER : 108 , NUMPAD _MULTIPLY : 106 , NUMPAD _SUBTRACT : 109 , PAGE _DOWN : 34 , PAGE _UP : 33 , PERIOD : 190 , RIGHT : 39 , SHIFT : 16 , SPACE : 32 , TAB : 9 , UP : 38 , WINDOWS : 91 } } ) , a . fn . extend ( { propAttr : a . fn . prop || a . fn . attr , _focus : a . fn . focus , focus : function ( m , s ) { return typeof m == "number" ? this . each ( function ( ) { var c =
this ; setTimeout ( function ( ) { a ( c ) . focus ( ) ; s && s . call ( c ) } , m ) } ) : this . _focus . apply ( this , arguments ) } , scrollParent : function ( ) { var m ; a . browser . msie && /(static|relative)/ . test ( this . css ( "position" ) ) || /absolute/ . test ( this . css ( "position" ) ) ? m = this . parents ( ) . filter ( function ( ) { return /(relative|absolute|fixed)/ . test ( a . curCSS ( this , "position" , 1 ) ) && /(auto|scroll)/ . test ( a . curCSS ( this , "overflow" , 1 ) + a . curCSS ( this , "overflow-y" , 1 ) + a . curCSS ( this , "overflow-x" , 1 ) ) } ) . eq ( 0 ) : m = this . parents ( ) . filter ( function ( ) { return /(auto|scroll)/ . test ( a . curCSS ( this ,
"overflow" , 1 ) + a . curCSS ( this , "overflow-y" , 1 ) + a . curCSS ( this , "overflow-x" , 1 ) ) } ) . eq ( 0 ) ; return /fixed/ . test ( this . css ( "position" ) ) || ! m . length ? a ( document ) : m } , zIndex : function ( m ) { if ( m !== n ) return this . css ( "zIndex" , m ) ; if ( this . length ) { m = a ( this [ 0 ] ) ; for ( var s ; m . length && m [ 0 ] !== document ; ) { s = m . css ( "position" ) ; if ( s === "absolute" || s === "relative" || s === "fixed" ) { s = parseInt ( m . css ( "zIndex" ) , 10 ) ; if ( ! isNaN ( s ) && s !== 0 ) return s } m = m . parent ( ) } } return 0 } , disableSelection : function ( ) { return this . bind ( ( a . support . selectstart ? "selectstart" :
"mousedown" ) + ".ui-disableSelection" , function ( m ) { m . preventDefault ( ) } ) } , enableSelection : function ( ) { return this . unbind ( ".ui-disableSelection" ) } } ) , a . each ( [ "Width" , "Height" ] , function ( m , s ) { function c ( o , A , p , K ) { a . each ( f , function ( ) { A -= parseFloat ( a . curCSS ( o , "padding" + this , true ) ) || 0 ; p && ( A -= parseFloat ( a . curCSS ( o , "border" + this + "Width" , true ) ) || 0 ) ; K && ( A -= parseFloat ( a . curCSS ( o , "margin" + this , true ) ) || 0 ) } ) ; return A } var f = s === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] , d = s . toLowerCase ( ) , l = { innerWidth : a . fn . innerWidth , innerHeight : a . fn . innerHeight ,
outerWidth : a . fn . outerWidth , outerHeight : a . fn . outerHeight } ; a . fn [ "inner" + s ] = function ( o ) { if ( o === n ) return l [ "inner" + s ] . call ( this ) ; return this . each ( function ( ) { a ( this ) . css ( d , c ( this , o ) + "px" ) } ) } ; a . fn [ "outer" + s ] = function ( o , A ) { if ( typeof o != "number" ) return l [ "outer" + s ] . call ( this , o ) ; return this . each ( function ( ) { a ( this ) . css ( d , c ( this , o , true , A ) + "px" ) } ) } } ) , a . extend ( a . expr [ ":" ] , { data : function ( m , s , c ) { return ! ! a . data ( m , c [ 3 ] ) } , focusable : function ( m ) { return b ( m , ! isNaN ( a . attr ( m , "tabindex" ) ) ) } , tabbable : function ( m ) { var s = a . attr ( m ,
"tabindex" ) , c = isNaN ( s ) ; return ( c || s >= 0 ) && b ( m , ! c ) } } ) , a ( function ( ) { var m = document . body , s = m . appendChild ( s = document . createElement ( "div" ) ) ; a . extend ( s . style , { minHeight : "100px" , height : "auto" , padding : 0 , borderWidth : 0 } ) ; a . support . minHeight = s . offsetHeight === 100 ; a . support . selectstart = "onselectstart" in s ; m . removeChild ( s ) . style . display = "none" } ) , a . extend ( a . ui , { plugin : { add : function ( m , s , c ) { m = a . ui [ m ] . prototype ; for ( var f in c ) { m . plugins [ f ] = m . plugins [ f ] || [ ] ; m . plugins [ f ] . push ( [ s , c [ f ] ] ) } } , call : function ( m , s , c ) { if ( ( s = m . plugins [ s ] ) &&
m . element [ 0 ] . parentNode ) for ( var f = 0 ; f < s . length ; f ++ ) m . options [ s [ f ] [ 0 ] ] && s [ f ] [ 1 ] . apply ( m . element , c ) } } , contains : function ( m , s ) { return document . compareDocumentPosition ? m . compareDocumentPosition ( s ) & 16 : m !== s && m . contains ( s ) } , hasScroll : function ( m , s ) { if ( a ( m ) . css ( "overflow" ) === "hidden" ) return false ; var c = s && s === "left" ? "scrollLeft" : "scrollTop" , f = false ; if ( m [ c ] > 0 ) return true ; m [ c ] = 1 ; f = m [ c ] > 0 ; m [ c ] = 0 ; return f } , isOverAxis : function ( m , s , c ) { return m > s && m < s + c } , isOver : function ( m , s , c , f , d , l ) { return a . ui . isOverAxis ( m , c , d ) &&
a . ui . isOverAxis ( s , f , l ) } } ) ) } ) ( jQuery ) ;
( function ( a , n ) { if ( a . cleanData ) { var g = a . cleanData ; a . cleanData = function ( m ) { for ( var s = 0 , c ; ( c = m [ s ] ) != null ; s ++ ) try { a ( c ) . triggerHandler ( "remove" ) } catch ( f ) { } g ( m ) } } else { var b = a . fn . remove ; a . fn . remove = function ( m , s ) { return this . each ( function ( ) { s || ( ! m || a . filter ( m , [ this ] ) . length ) && a ( "*" , this ) . add ( [ this ] ) . each ( function ( ) { try { a ( this ) . triggerHandler ( "remove" ) } catch ( c ) { } } ) ; return b . call ( a ( this ) , m , s ) } ) } } a . widget = function ( m , s , c ) { var f = m . split ( "." ) [ 0 ] , d ; m = m . split ( "." ) [ 1 ] ; d = f + "-" + m ; c || ( c = s , s = a . Widget ) ; a . expr [ ":" ] [ d ] =
function ( l ) { return ! ! a . data ( l , m ) } ; a [ f ] = a [ f ] || { } ; a [ f ] [ m ] = function ( l , o ) { arguments . length && this . _createWidget ( l , o ) } ; s = new s ; s . options = a . extend ( true , { } , s . options ) ; a [ f ] [ m ] . prototype = a . extend ( true , s , { namespace : f , widgetName : m , widgetEventPrefix : a [ f ] [ m ] . prototype . widgetEventPrefix || m , widgetBaseClass : d } , c ) ; a . widget . bridge ( m , a [ f ] [ m ] ) } ; a . widget . bridge = function ( m , s ) { a . fn [ m ] = function ( c ) { var f = typeof c == "string" , d = Array . prototype . slice . call ( arguments , 1 ) , l = this ; c = ! f && d . length ? a . extend . apply ( null , [ true , c ] . concat ( d ) ) :
c ; if ( f && c . charAt ( 0 ) === "_" ) return l ; f ? this . each ( function ( ) { var o = a . data ( this , m ) , A = o && a . isFunction ( o [ c ] ) ? o [ c ] . apply ( o , d ) : o ; if ( A !== o && A !== n ) { l = A ; return false } } ) : this . each ( function ( ) { var o = a . data ( this , m ) ; o ? o . option ( c || { } ) . _init ( ) : a . data ( this , m , new s ( c , this ) ) } ) ; return l } } ; a . Widget = function ( m , s ) { arguments . length && this . _createWidget ( m , s ) } ; a . Widget . prototype = { widgetName : "widget" , widgetEventPrefix : "" , options : { disabled : false } , _createWidget : function ( m , s ) { a . data ( s , this . widgetName , this ) ; this . element = a ( s ) ; this . options =
a . extend ( true , { } , this . options , this . _getCreateOptions ( ) , m ) ; var c = this ; this . element . bind ( "remove." + this . widgetName , function ( ) { c . destroy ( ) } ) ; this . _create ( ) ; this . _trigger ( "create" ) ; this . _init ( ) } , _getCreateOptions : function ( ) { return a . metadata && a . metadata . get ( this . element [ 0 ] ) [ this . widgetName ] } , _create : function ( ) { } , _init : function ( ) { } , destroy : function ( ) { this . element . unbind ( "." + this . widgetName ) . removeData ( this . widgetName ) ; this . widget ( ) . unbind ( "." + this . widgetName ) . removeAttr ( "aria-disabled" ) . removeClass ( this . widgetBaseClass +
"-disabled ui-state-disabled" ) } , widget : function ( ) { return this . element } , option : function ( m , s ) { var c = m ; if ( arguments . length === 0 ) return a . extend ( { } , this . options ) ; if ( typeof m == "string" ) { if ( s === n ) return this . options [ m ] ; c = { } ; c [ m ] = s } this . _setOptions ( c ) ; return this } , _setOptions : function ( m ) { var s = this ; a . each ( m , function ( c , f ) { s . _setOption ( c , f ) } ) ; return this } , _setOption : function ( m , s ) { this . options [ m ] = s ; m === "disabled" && this . widget ( ) [ s ? "addClass" : "removeClass" ] ( this . widgetBaseClass + "-disabled ui-state-disabled" ) . attr ( "aria-disabled" ,
s ) ; return this } , enable : function ( ) { return this . _setOption ( "disabled" , false ) } , disable : function ( ) { return this . _setOption ( "disabled" , true ) } , _trigger : function ( m , s , c ) { var f , d = this . options [ m ] ; c = c || { } ; s = a . Event ( s ) ; s . type = ( m === this . widgetEventPrefix ? m : this . widgetEventPrefix + m ) . toLowerCase ( ) ; s . target = this . element [ 0 ] ; if ( m = s . originalEvent ) for ( f in m ) f in s || ( s [ f ] = m [ f ] ) ; this . element . trigger ( s , c ) ; return ! ( a . isFunction ( d ) && d . call ( this . element [ 0 ] , s , c ) === false || s . isDefaultPrevented ( ) ) } } } ) ( jQuery ) ;
( function ( a ) { var n = false ; a ( document ) . mouseup ( function ( ) { n = false } ) ; a . widget ( "ui.mouse" , { options : { cancel : ":input,option" , distance : 1 , delay : 0 } , _mouseInit : function ( ) { var g = this ; this . element . bind ( "mousedown." + this . widgetName , function ( b ) { return g . _mouseDown ( b ) } ) . bind ( "click." + this . widgetName , function ( b ) { if ( true === a . data ( b . target , g . widgetName + ".preventClickEvent" ) ) { a . removeData ( b . target , g . widgetName + ".preventClickEvent" ) ; b . stopImmediatePropagation ( ) ; return false } } ) ; this . started = false } , _mouseDestroy : function ( ) { this . element . unbind ( "." +
this . widgetName ) } , _mouseDown : function ( g ) { if ( ! n ) { this . _mouseStarted && this . _mouseUp ( g ) ; this . _mouseDownEvent = g ; var b = this , m = g . which == 1 , s = typeof this . options . cancel == "string" && g . target . nodeName ? a ( g . target ) . closest ( this . options . cancel ) . length : false ; if ( ! m || s || ! this . _mouseCapture ( g ) ) return true ; ( this . mouseDelayMet = ! this . options . delay ) || ( this . _mouseDelayTimer = setTimeout ( function ( ) { b . mouseDelayMet = true } , this . options . delay ) ) ; if ( this . _mouseDistanceMet ( g ) && this . _mouseDelayMet ( g ) ) { this . _mouseStarted = this . _mouseStart ( g ) !==
false ; if ( ! this . _mouseStarted ) { g . preventDefault ( ) ; return true } } true === a . data ( g . target , this . widgetName + ".preventClickEvent" ) && a . removeData ( g . target , this . widgetName + ".preventClickEvent" ) ; this . _mouseMoveDelegate = function ( c ) { return b . _mouseMove ( c ) } ; this . _mouseUpDelegate = function ( c ) { return b . _mouseUp ( c ) } ; a ( document ) . bind ( "mousemove." + this . widgetName , this . _mouseMoveDelegate ) . bind ( "mouseup." + this . widgetName , this . _mouseUpDelegate ) ; g . preventDefault ( ) ; return n = true } } , _mouseMove : function ( g ) { if ( a . browser . msie &&
! ( document . documentMode >= 9 ) && ! g . button ) return this . _mouseUp ( g ) ; if ( this . _mouseStarted ) { this . _mouseDrag ( g ) ; return g . preventDefault ( ) } this . _mouseDistanceMet ( g ) && this . _mouseDelayMet ( g ) && ( this . _mouseStarted = this . _mouseStart ( this . _mouseDownEvent , g ) !== false , this . _mouseStarted ? this . _mouseDrag ( g ) : this . _mouseUp ( g ) ) ; return ! this . _mouseStarted } , _mouseUp : function ( g ) { a ( document ) . unbind ( "mousemove." + this . widgetName , this . _mouseMoveDelegate ) . unbind ( "mouseup." + this . widgetName , this . _mouseUpDelegate ) ; this . _mouseStarted &&
( this . _mouseStarted = false , g . target == this . _mouseDownEvent . target && a . data ( g . target , this . widgetName + ".preventClickEvent" , true ) , this . _mouseStop ( g ) ) ; return false } , _mouseDistanceMet : function ( g ) { return Math . max ( Math . abs ( this . _mouseDownEvent . pageX - g . pageX ) , Math . abs ( this . _mouseDownEvent . pageY - g . pageY ) ) >= this . options . distance } , _mouseDelayMet : function ( ) { return this . mouseDelayMet } , _mouseStart : function ( ) { } , _mouseDrag : function ( ) { } , _mouseStop : function ( ) { } , _mouseCapture : function ( ) { return true } } ) } ) ( jQuery ) ;
2012-07-14 20:36:17 +00:00
( function ( a ) { a . widget ( "ui.draggable" , a . ui . mouse , { widgetEventPrefix : "drag" , options : { addClasses : true , appendTo : "parent" , axis : false , connectToSortable : false , containment : false , cursor : "auto" , cursorAt : false , grid : false , handle : false , helper : "original" , iframeFix : false , opacity : false , refreshPositions : false , revert : false , revertDuration : 500 , scope : "default" , scroll : true , scrollSensitivity : 20 , scrollSpeed : 20 , snap : false , snapMode : "both" , snapTolerance : 20 , stack : false , zIndex : false } , _create : function ( ) { this . options . helper == "original" &&
2012-07-24 02:30:12 +00:00
! /^(?:r|a|f)/ . test ( this . element . css ( "position" ) ) && ( this . element [ 0 ] . style . position = "relative" ) ; this . options . addClasses && this . element . addClass ( "ui-draggable" ) ; this . options . disabled && this . element . addClass ( "ui-draggable-disabled" ) ; this . _mouseInit ( ) } , destroy : function ( ) { if ( this . element . data ( "draggable" ) ) { this . element . removeData ( "draggable" ) . unbind ( ".draggable" ) . removeClass ( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ) ; this . _mouseDestroy ( ) ; return this } } , _mouseCapture : function ( n ) { var g = this . options ;
if ( this . helper || g . disabled || a ( n . target ) . is ( ".ui-resizable-handle" ) ) return false ; this . handle = this . _getHandle ( n ) ; if ( ! this . handle ) return false ; g . iframeFix && a ( g . iframeFix === true ? "iframe" : g . iframeFix ) . each ( function ( ) { a ( '<div class="ui-draggable-iframeFix" style="background: #fff;"></div>' ) . css ( { width : this . offsetWidth + "px" , height : this . offsetHeight + "px" , position : "absolute" , opacity : "0.001" , zIndex : 1E3 } ) . css ( a ( this ) . offset ( ) ) . appendTo ( "body" ) } ) ; return true } , _mouseStart : function ( n ) { var g = this . options ; this . helper =
this . _createHelper ( n ) ; this . _cacheHelperProportions ( ) ; a . ui . ddmanager && ( a . ui . ddmanager . current = this ) ; this . _cacheMargins ( ) ; this . cssPosition = this . helper . css ( "position" ) ; this . scrollParent = this . helper . scrollParent ( ) ; this . offset = this . positionAbs = this . element . offset ( ) ; this . offset = { top : this . offset . top - this . margins . top , left : this . offset . left - this . margins . left } ; a . extend ( this . offset , { click : { left : n . pageX - this . offset . left , top : n . pageY - this . offset . top } , parent : this . _getParentOffset ( ) , relative : this . _getRelativeOffset ( ) } ) ;
this . originalPosition = this . position = this . _generatePosition ( n ) ; this . originalPageX = n . pageX ; this . originalPageY = n . pageY ; g . cursorAt && this . _adjustOffsetFromHelper ( g . cursorAt ) ; g . containment && this . _setContainment ( ) ; if ( this . _trigger ( "start" , n ) === false ) { this . _clear ( ) ; return false } this . _cacheHelperProportions ( ) ; a . ui . ddmanager && ! g . dropBehaviour && a . ui . ddmanager . prepareOffsets ( this , n ) ; this . helper . addClass ( "ui-draggable-dragging" ) ; this . _mouseDrag ( n , true ) ; a . ui . ddmanager && a . ui . ddmanager . dragStart ( this , n ) ; return true } ,
_mouseDrag : function ( n , g ) { this . position = this . _generatePosition ( n ) ; this . positionAbs = this . _convertPositionTo ( "absolute" ) ; if ( ! g ) { var b = this . _uiHash ( ) ; if ( this . _trigger ( "drag" , n , b ) === false ) { this . _mouseUp ( { } ) ; return false } this . position = b . position } if ( ! this . options . axis || this . options . axis != "y" ) this . helper [ 0 ] . style . left = this . position . left + "px" ; if ( ! this . options . axis || this . options . axis != "x" ) this . helper [ 0 ] . style . top = this . position . top + "px" ; a . ui . ddmanager && a . ui . ddmanager . drag ( this , n ) ; return false } , _mouseStop : function ( n ) { var g =
false ; a . ui . ddmanager && ! this . options . dropBehaviour && ( g = a . ui . ddmanager . drop ( this , n ) ) ; this . dropped && ( g = this . dropped , this . dropped = false ) ; if ( ( ! this . element [ 0 ] || ! this . element [ 0 ] . parentNode ) && this . options . helper == "original" ) return false ; if ( this . options . revert == "invalid" && ! g || this . options . revert == "valid" && g || this . options . revert === true || a . isFunction ( this . options . revert ) && this . options . revert . call ( this . element , g ) ) { var b = this ; a ( this . helper ) . animate ( this . originalPosition , parseInt ( this . options . revertDuration , 10 ) ,
function ( ) { b . _trigger ( "stop" , n ) !== false && b . _clear ( ) } ) } else this . _trigger ( "stop" , n ) !== false && this . _clear ( ) ; return false } , _mouseUp : function ( n ) { this . options . iframeFix === true && a ( "div.ui-draggable-iframeFix" ) . each ( function ( ) { this . parentNode . removeChild ( this ) } ) ; a . ui . ddmanager && a . ui . ddmanager . dragStop ( this , n ) ; return a . ui . mouse . prototype . _mouseUp . call ( this , n ) } , cancel : function ( ) { this . helper . is ( ".ui-draggable-dragging" ) ? this . _mouseUp ( { } ) : this . _clear ( ) ; return this } , _getHandle : function ( n ) { var g = ! this . options . handle ||
! a ( this . options . handle , this . element ) . length ? true : false ; a ( this . options . handle , this . element ) . find ( "*" ) . andSelf ( ) . each ( function ( ) { this == n . target && ( g = true ) } ) ; return g } , _createHelper : function ( n ) { var g = this . options ; n = a . isFunction ( g . helper ) ? a ( g . helper . apply ( this . element [ 0 ] , [ n ] ) ) : g . helper == "clone" ? this . element . clone ( ) . removeAttr ( "id" ) : this . element ; n . parents ( "body" ) . length || n . appendTo ( g . appendTo == "parent" ? this . element [ 0 ] . parentNode : g . appendTo ) ; n [ 0 ] != this . element [ 0 ] && ! /(fixed|absolute)/ . test ( n . css ( "position" ) ) &&
n . css ( "position" , "absolute" ) ; return n } , _adjustOffsetFromHelper : function ( n ) { typeof n == "string" && ( n = n . split ( " " ) ) ; a . isArray ( n ) && ( n = { left : + n [ 0 ] , top : + n [ 1 ] || 0 } ) ; "left" in n && ( this . offset . click . left = n . left + this . margins . left ) ; "right" in n && ( this . offset . click . left = this . helperProportions . width - n . right + this . margins . left ) ; "top" in n && ( this . offset . click . top = n . top + this . margins . top ) ; "bottom" in n && ( this . offset . click . top = this . helperProportions . height - n . bottom + this . margins . top ) } , _getParentOffset : function ( ) { this . offsetParent =
this . helper . offsetParent ( ) ; var n = this . offsetParent . offset ( ) ; this . cssPosition == "absolute" && this . scrollParent [ 0 ] != document && a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) && ( n . left += this . scrollParent . scrollLeft ( ) , n . top += this . scrollParent . scrollTop ( ) ) ; if ( this . offsetParent [ 0 ] == document . body || this . offsetParent [ 0 ] . tagName && this . offsetParent [ 0 ] . tagName . toLowerCase ( ) == "html" && a . browser . msie ) n = { top : 0 , left : 0 } ; return { top : n . top + ( parseInt ( this . offsetParent . css ( "borderTopWidth" ) , 10 ) || 0 ) , left : n . left + ( parseInt ( this . offsetParent . css ( "borderLeftWidth" ) ,
10 ) || 0 ) } } , _getRelativeOffset : function ( ) { if ( this . cssPosition == "relative" ) { var n = this . element . position ( ) ; return { top : n . top - ( parseInt ( this . helper . css ( "top" ) , 10 ) || 0 ) + this . scrollParent . scrollTop ( ) , left : n . left - ( parseInt ( this . helper . css ( "left" ) , 10 ) || 0 ) + this . scrollParent . scrollLeft ( ) } } return { top : 0 , left : 0 } } , _cacheMargins : function ( ) { this . margins = { left : parseInt ( this . element . css ( "marginLeft" ) , 10 ) || 0 , top : parseInt ( this . element . css ( "marginTop" ) , 10 ) || 0 , right : parseInt ( this . element . css ( "marginRight" ) , 10 ) || 0 , bottom : parseInt ( this . element . css ( "marginBottom" ) ,
10 ) || 0 } } , _cacheHelperProportions : function ( ) { this . helperProportions = { width : this . helper . outerWidth ( ) , height : this . helper . outerHeight ( ) } } , _setContainment : function ( ) { var n = this . options ; n . containment == "parent" && ( n . containment = this . helper [ 0 ] . parentNode ) ; if ( n . containment == "document" || n . containment == "window" ) this . containment = [ n . containment == "document" ? 0 : a ( window ) . scrollLeft ( ) - this . offset . relative . left - this . offset . parent . left , n . containment == "document" ? 0 : a ( window ) . scrollTop ( ) - this . offset . relative . top - this . offset . parent . top ,
( n . containment == "document" ? 0 : a ( window ) . scrollLeft ( ) ) + a ( n . containment == "document" ? document : window ) . width ( ) - this . helperProportions . width - this . margins . left , ( n . containment == "document" ? 0 : a ( window ) . scrollTop ( ) ) + ( a ( n . containment == "document" ? document : window ) . height ( ) || document . body . parentNode . scrollHeight ) - this . helperProportions . height - this . margins . top ] ; if ( ! /^(document|window|parent)$/ . test ( n . containment ) && n . containment . constructor != Array ) { n = a ( n . containment ) ; var g = n [ 0 ] ; if ( g ) { n . offset ( ) ; var b = a ( g ) . css ( "overflow" ) !=
"hidden" ; this . containment = [ ( parseInt ( a ( g ) . css ( "borderLeftWidth" ) , 10 ) || 0 ) + ( parseInt ( a ( g ) . css ( "paddingLeft" ) , 10 ) || 0 ) , ( parseInt ( a ( g ) . css ( "borderTopWidth" ) , 10 ) || 0 ) + ( parseInt ( a ( g ) . css ( "paddingTop" ) , 10 ) || 0 ) , ( b ? Math . max ( g . scrollWidth , g . offsetWidth ) : g . offsetWidth ) - ( parseInt ( a ( g ) . css ( "borderLeftWidth" ) , 10 ) || 0 ) - ( parseInt ( a ( g ) . css ( "paddingRight" ) , 10 ) || 0 ) - this . helperProportions . width - this . margins . left - this . margins . right , ( b ? Math . max ( g . scrollHeight , g . offsetHeight ) : g . offsetHeight ) - ( parseInt ( a ( g ) . css ( "borderTopWidth" ) ,
10 ) || 0 ) - ( parseInt ( a ( g ) . css ( "paddingBottom" ) , 10 ) || 0 ) - this . helperProportions . height - this . margins . top - this . margins . bottom ] ; this . relative _container = n } } else n . containment . constructor == Array && ( this . containment = n . containment ) } , _convertPositionTo : function ( n , g ) { g || ( g = this . position ) ; var b = n == "absolute" ? 1 : - 1 , m = this . cssPosition == "absolute" && ( this . scrollParent [ 0 ] == document || ! a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , s = /(html|body)/i . test ( m [ 0 ] . tagName ) ; return { top : g . top +
this . offset . relative . top * b + this . offset . parent . top * b - ( a . browser . safari && a . browser . version < 526 && this . cssPosition == "fixed" ? 0 : ( this . cssPosition == "fixed" ? - this . scrollParent . scrollTop ( ) : s ? 0 : m . scrollTop ( ) ) * b ) , left : g . left + this . offset . relative . left * b + this . offset . parent . left * b - ( a . browser . safari && a . browser . version < 526 && this . cssPosition == "fixed" ? 0 : ( this . cssPosition == "fixed" ? - this . scrollParent . scrollLeft ( ) : s ? 0 : m . scrollLeft ( ) ) * b ) } } , _generatePosition : function ( n ) { var g = this . options , b = this . cssPosition == "absolute" &&
( this . scrollParent [ 0 ] == document || ! a . ui . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) ) ? this . offsetParent : this . scrollParent , m = /(html|body)/i . test ( b [ 0 ] . tagName ) , s = n . pageX , c = n . pageY ; if ( this . originalPosition ) { var f ; if ( this . containment ) { if ( this . relative _container ) { f = this . relative _container . offset ( ) ; f = [ this . containment [ 0 ] + f . left , this . containment [ 1 ] + f . top , this . containment [ 2 ] + f . left , this . containment [ 3 ] + f . top ] } else f = this . containment ; n . pageX - this . offset . click . left < f [ 0 ] && ( s = f [ 0 ] + this . offset . click . left ) ;
n . pageY - this . offset . click . top < f [ 1 ] && ( c = f [ 1 ] + this . offset . click . top ) ; n . pageX - this . offset . click . left > f [ 2 ] && ( s = f [ 2 ] + this . offset . click . left ) ; n . pageY - this . offset . click . top > f [ 3 ] && ( c = f [ 3 ] + this . offset . click . top ) } if ( g . grid ) { c = g . grid [ 1 ] ? this . originalPageY + Math . round ( ( c - this . originalPageY ) / g . grid [ 1 ] ) * g . grid [ 1 ] : this . originalPageY ; c = f ? c - this . offset . click . top < f [ 1 ] || c - this . offset . click . top > f [ 3 ] ? c - this . offset . click . top < f [ 1 ] ? c + g . grid [ 1 ] : c - g . grid [ 1 ] : c : c ; s = g . grid [ 0 ] ? this . originalPageX + Math . round ( ( s - this . originalPageX ) /
g . grid [ 0 ] ) * g . grid [ 0 ] : this . originalPageX ; s = f ? s - this . offset . click . left < f [ 0 ] || s - this . offset . click . left > f [ 2 ] ? s - this . offset . click . left < f [ 0 ] ? s + g . grid [ 0 ] : s - g . grid [ 0 ] : s : s } } return { top : c - this . offset . click . top - this . offset . relative . top - this . offset . parent . top + ( a . browser . safari && a . browser . version < 526 && this . cssPosition == "fixed" ? 0 : this . cssPosition == "fixed" ? - this . scrollParent . scrollTop ( ) : m ? 0 : b . scrollTop ( ) ) , left : s - this . offset . click . left - this . offset . relative . left - this . offset . parent . left + ( a . browser . safari && a . browser . version <
526 && this . cssPosition == "fixed" ? 0 : this . cssPosition == "fixed" ? - this . scrollParent . scrollLeft ( ) : m ? 0 : b . scrollLeft ( ) ) } } , _clear : function ( ) { this . helper . removeClass ( "ui-draggable-dragging" ) ; this . helper [ 0 ] != this . element [ 0 ] && ! this . cancelHelperRemoval && this . helper . remove ( ) ; this . helper = null ; this . cancelHelperRemoval = false } , _trigger : function ( n , g , b ) { b = b || this . _uiHash ( ) ; a . ui . plugin . call ( this , n , [ g , b ] ) ; n == "drag" && ( this . positionAbs = this . _convertPositionTo ( "absolute" ) ) ; return a . Widget . prototype . _trigger . call ( this , n , g ,
b ) } , plugins : { } , _uiHash : function ( ) { return { helper : this . helper , position : this . position , originalPosition : this . originalPosition , offset : this . positionAbs } } } ) ; a . extend ( a . ui . draggable , { version : "1.8.17" } ) ; a . ui . plugin . add ( "draggable" , "connectToSortable" , { start : function ( n , g ) { var b = a ( this ) . data ( "draggable" ) , m = b . options , s = a . extend ( { } , g , { item : b . element } ) ; b . sortables = [ ] ; a ( m . connectToSortable ) . each ( function ( ) { var c = a . data ( this , "sortable" ) ; c && ! c . options . disabled && ( b . sortables . push ( { instance : c , shouldRevert : c . options . revert } ) ,
c . refreshPositions ( ) , c . _trigger ( "activate" , n , s ) ) } ) } , stop : function ( n , g ) { var b = a ( this ) . data ( "draggable" ) , m = a . extend ( { } , g , { item : b . element } ) ; a . each ( b . sortables , function ( ) { this . instance . isOver ? ( this . instance . isOver = 0 , b . cancelHelperRemoval = true , this . instance . cancelHelperRemoval = false , this . shouldRevert && ( this . instance . options . revert = true ) , this . instance . _mouseStop ( n ) , this . instance . options . helper = this . instance . options . _helper , b . options . helper == "original" && this . instance . currentItem . css ( { top : "auto" , left : "auto" } ) ) :
( this . instance . cancelHelperRemoval = false , this . instance . _trigger ( "deactivate" , n , m ) ) } ) } , drag : function ( n , g ) { var b = a ( this ) . data ( "draggable" ) , m = this ; a . each ( b . sortables , function ( ) { this . instance . positionAbs = b . positionAbs ; this . instance . helperProportions = b . helperProportions ; this . instance . offset . click = b . offset . click ; this . instance . _intersectsWith ( this . instance . containerCache ) ? ( this . instance . isOver || ( this . instance . isOver = 1 , this . instance . currentItem = a ( m ) . clone ( ) . removeAttr ( "id" ) . appendTo ( this . instance . element ) . data ( "sortable-item" ,
true ) , this . instance . options . _helper = this . instance . options . helper , this . instance . options . helper = function ( ) { return g . helper [ 0 ] } , n . target = this . instance . currentItem [ 0 ] , this . instance . _mouseCapture ( n , true ) , this . instance . _mouseStart ( n , true , true ) , this . instance . offset . click . top = b . offset . click . top , this . instance . offset . click . left = b . offset . click . left , this . instance . offset . parent . left -= b . offset . parent . left - this . instance . offset . parent . left , this . instance . offset . parent . top -= b . offset . parent . top - this . instance . offset . parent . top ,
b . _trigger ( "toSortable" , n ) , b . dropped = this . instance . element , b . currentItem = b . element , this . instance . fromOutside = b ) , this . instance . currentItem && this . instance . _mouseDrag ( n ) ) : this . instance . isOver && ( this . instance . isOver = 0 , this . instance . cancelHelperRemoval = true , this . instance . options . revert = false , this . instance . _trigger ( "out" , n , this . instance . _uiHash ( this . instance ) ) , this . instance . _mouseStop ( n , true ) , this . instance . options . helper = this . instance . options . _helper , this . instance . currentItem . remove ( ) , this . instance . placeholder &&
this . instance . placeholder . remove ( ) , b . _trigger ( "fromSortable" , n ) , b . dropped = false ) } ) } } ) ; a . ui . plugin . add ( "draggable" , "cursor" , { start : function ( ) { var n = a ( "body" ) , g = a ( this ) . data ( "draggable" ) . options ; n . css ( "cursor" ) && ( g . _cursor = n . css ( "cursor" ) ) ; n . css ( "cursor" , g . cursor ) } , stop : function ( ) { var n = a ( this ) . data ( "draggable" ) . options ; n . _cursor && a ( "body" ) . css ( "cursor" , n . _cursor ) } } ) ; a . ui . plugin . add ( "draggable" , "opacity" , { start : function ( n , g ) { var b = a ( g . helper ) , m = a ( this ) . data ( "draggable" ) . options ; b . css ( "opacity" ) && ( m . _opacity =
b . css ( "opacity" ) ) ; b . css ( "opacity" , m . opacity ) } , stop : function ( n , g ) { var b = a ( this ) . data ( "draggable" ) . options ; b . _opacity && a ( g . helper ) . css ( "opacity" , b . _opacity ) } } ) ; a . ui . plugin . add ( "draggable" , "scroll" , { start : function ( ) { var n = a ( this ) . data ( "draggable" ) ; n . scrollParent [ 0 ] != document && n . scrollParent [ 0 ] . tagName != "HTML" && ( n . overflowOffset = n . scrollParent . offset ( ) ) } , drag : function ( n ) { var g = a ( this ) . data ( "draggable" ) , b = g . options , m = false ; if ( g . scrollParent [ 0 ] != document && g . scrollParent [ 0 ] . tagName != "HTML" ) { if ( ! b . axis ||
b . axis != "x" ) g . overflowOffset . top + g . scrollParent [ 0 ] . offsetHeight - n . pageY < b . scrollSensitivity ? g . scrollParent [ 0 ] . scrollTop = m = g . scrollParent [ 0 ] . scrollTop + b . scrollSpeed : n . pageY - g . overflowOffset . top < b . scrollSensitivity && ( g . scrollParent [ 0 ] . scrollTop = m = g . scrollParent [ 0 ] . scrollTop - b . scrollSpeed ) ; if ( ! b . axis || b . axis != "y" ) g . overflowOffset . left + g . scrollParent [ 0 ] . offsetWidth - n . pageX < b . scrollSensitivity ? g . scrollParent [ 0 ] . scrollLeft = m = g . scrollParent [ 0 ] . scrollLeft + b . scrollSpeed : n . pageX - g . overflowOffset . left < b . scrollSensitivity &&
( g . scrollParent [ 0 ] . scrollLeft = m = g . scrollParent [ 0 ] . scrollLeft - b . scrollSpeed ) } else { if ( ! b . axis || b . axis != "x" ) n . pageY - a ( document ) . scrollTop ( ) < b . scrollSensitivity ? m = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) - b . scrollSpeed ) : a ( window ) . height ( ) - ( n . pageY - a ( document ) . scrollTop ( ) ) < b . scrollSensitivity && ( m = a ( document ) . scrollTop ( a ( document ) . scrollTop ( ) + b . scrollSpeed ) ) ; if ( ! b . axis || b . axis != "y" ) n . pageX - a ( document ) . scrollLeft ( ) < b . scrollSensitivity ? m = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) - b . scrollSpeed ) :
a ( window ) . width ( ) - ( n . pageX - a ( document ) . scrollLeft ( ) ) < b . scrollSensitivity && ( m = a ( document ) . scrollLeft ( a ( document ) . scrollLeft ( ) + b . scrollSpeed ) ) } m !== false && a . ui . ddmanager && ! b . dropBehaviour && a . ui . ddmanager . prepareOffsets ( g , n ) } } ) ; a . ui . plugin . add ( "draggable" , "snap" , { start : function ( ) { var n = a ( this ) . data ( "draggable" ) , g = n . options ; n . snapElements = [ ] ; a ( g . snap . constructor != String ? g . snap . items || ":data(draggable)" : g . snap ) . each ( function ( ) { var b = a ( this ) , m = b . offset ( ) ; this != n . element [ 0 ] && n . snapElements . push ( { item : this ,
width : b . outerWidth ( ) , height : b . outerHeight ( ) , top : m . top , left : m . left } ) } ) } , drag : function ( n , g ) { for ( var b = a ( this ) . data ( "draggable" ) , m = b . options , s = m . snapTolerance , c = g . offset . left , f = c + b . helperProportions . width , d = g . offset . top , l = d + b . helperProportions . height , o = b . snapElements . length - 1 ; o >= 0 ; o -- ) { var A = b . snapElements [ o ] . left , p = A + b . snapElements [ o ] . width , K = b . snapElements [ o ] . top , Q = K + b . snapElements [ o ] . height ; if ( A - s < c && c < p + s && K - s < d && d < Q + s || A - s < c && c < p + s && K - s < l && l < Q + s || A - s < f && f < p + s && K - s < d && d < Q + s || A - s < f && f < p + s && K - s < l &&
l < Q + s ) { if ( m . snapMode != "inner" ) { var N = Math . abs ( K - l ) <= s , H = Math . abs ( Q - d ) <= s , S = Math . abs ( A - f ) <= s , ba = Math . abs ( p - c ) <= s ; N && ( g . position . top = b . _convertPositionTo ( "relative" , { top : K - b . helperProportions . height , left : 0 } ) . top - b . margins . top ) ; H && ( g . position . top = b . _convertPositionTo ( "relative" , { top : Q , left : 0 } ) . top - b . margins . top ) ; S && ( g . position . left = b . _convertPositionTo ( "relative" , { top : 0 , left : A - b . helperProportions . width } ) . left - b . margins . left ) ; ba && ( g . position . left = b . _convertPositionTo ( "relative" , { top : 0 , left : p } ) . left - b . margins . left ) } var O =
N || H || S || ba ; if ( m . snapMode != "outer" ) { N = Math . abs ( K - d ) <= s ; H = Math . abs ( Q - l ) <= s ; S = Math . abs ( A - c ) <= s ; ba = Math . abs ( p - f ) <= s ; N && ( g . position . top = b . _convertPositionTo ( "relative" , { top : K , left : 0 } ) . top - b . margins . top ) ; H && ( g . position . top = b . _convertPositionTo ( "relative" , { top : Q - b . helperProportions . height , left : 0 } ) . top - b . margins . top ) ; S && ( g . position . left = b . _convertPositionTo ( "relative" , { top : 0 , left : A } ) . left - b . margins . left ) ; ba && ( g . position . left = b . _convertPositionTo ( "relative" , { top : 0 , left : p - b . helperProportions . width } ) . left -
b . margins . left ) } ! b . snapElements [ o ] . snapping && ( N || H || S || ba || O ) && b . options . snap . snap && b . options . snap . snap . call ( b . element , n , a . extend ( b . _uiHash ( ) , { snapItem : b . snapElements [ o ] . item } ) ) ; b . snapElements [ o ] . snapping = N || H || S || ba || O } else { b . snapElements [ o ] . snapping && b . options . snap . release && b . options . snap . release . call ( b . element , n , a . extend ( b . _uiHash ( ) , { snapItem : b . snapElements [ o ] . item } ) ) ; b . snapElements [ o ] . snapping = false } } } } ) ; a . ui . plugin . add ( "draggable" , "stack" , { start : function ( ) { var n = a ( this ) . data ( "draggable" ) . options ;
n = a . makeArray ( a ( n . stack ) ) . sort ( function ( b , m ) { return ( parseInt ( a ( b ) . css ( "zIndex" ) , 10 ) || 0 ) - ( parseInt ( a ( m ) . css ( "zIndex" ) , 10 ) || 0 ) } ) ; if ( n . length ) { var g = parseInt ( n [ 0 ] . style . zIndex ) || 0 ; a ( n ) . each ( function ( b ) { this . style . zIndex = g + b } ) ; this [ 0 ] . style . zIndex = g + n . length } } } ) ; a . ui . plugin . add ( "draggable" , "zIndex" , { start : function ( n , g ) { var b = a ( g . helper ) , m = a ( this ) . data ( "draggable" ) . options ; b . css ( "zIndex" ) && ( m . _zIndex = b . css ( "zIndex" ) ) ; b . css ( "zIndex" , m . zIndex ) } , stop : function ( n , g ) { var b = a ( this ) . data ( "draggable" ) . options ;
b . _zIndex && a ( g . helper ) . css ( "zIndex" , b . _zIndex ) } } ) } ) ( jQuery ) ;
( function ( a ) { a . widget ( "ui.slider" , a . ui . mouse , { widgetEventPrefix : "slide" , options : { animate : false , distance : 0 , max : 100 , min : 0 , orientation : "horizontal" , range : false , step : 1 , value : 0 , values : null } , _create : function ( ) { var n = this , g = this . options , b = this . element . find ( ".ui-slider-handle" ) . addClass ( "ui-state-default ui-corner-all" ) , m = g . values && g . values . length || 1 , s = [ ] ; this . _mouseSliding = this . _keySliding = false ; this . _animateOff = true ; this . _handleIndex = null ; this . _detectOrientation ( ) ; this . _mouseInit ( ) ; this . element . addClass ( "ui-slider ui-slider-" +
this . orientation + " ui-widget ui-widget-content ui-corner-all" + ( g . disabled ? " ui-slider-disabled ui-disabled" : "" ) ) ; this . range = a ( [ ] ) ; g . range && ( g . range === true && ( g . values || ( g . values = [ this . _valueMin ( ) , this . _valueMin ( ) ] ) , g . values . length && g . values . length !== 2 && ( g . values = [ g . values [ 0 ] , g . values [ 0 ] ] ) ) , this . range = a ( "<div></div>" ) . appendTo ( this . element ) . addClass ( "ui-slider-range ui-widget-header" + ( g . range === "min" || g . range === "max" ? " ui-slider-range-" + g . range : "" ) ) ) ; for ( var c = b . length ; c < m ; c += 1 ) s . push ( "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>" ) ;
this . handles = b . add ( a ( s . join ( "" ) ) . appendTo ( n . element ) ) ; this . handle = this . handles . eq ( 0 ) ; this . handles . add ( this . range ) . filter ( "a" ) . click ( function ( f ) { f . preventDefault ( ) } ) . hover ( function ( ) { g . disabled || a ( this ) . addClass ( "ui-state-hover" ) } , function ( ) { a ( this ) . removeClass ( "ui-state-hover" ) } ) . focus ( function ( ) { g . disabled ? a ( this ) . blur ( ) : ( a ( ".ui-slider .ui-state-focus" ) . removeClass ( "ui-state-focus" ) , a ( this ) . addClass ( "ui-state-focus" ) ) } ) . blur ( function ( ) { a ( this ) . removeClass ( "ui-state-focus" ) } ) ; this . handles . each ( function ( f ) { a ( this ) . data ( "index.ui-slider-handle" ,
f ) } ) ; this . handles . keydown ( function ( f ) { var d = true , l = a ( this ) . data ( "index.ui-slider-handle" ) , o , A , p ; if ( ! n . options . disabled ) { switch ( f . keyCode ) { case a . ui . keyCode . HOME : case a . ui . keyCode . END : case a . ui . keyCode . PAGE _UP : case a . ui . keyCode . PAGE _DOWN : case a . ui . keyCode . UP : case a . ui . keyCode . RIGHT : case a . ui . keyCode . DOWN : case a . ui . keyCode . LEFT : d = false ; if ( ! n . _keySliding ) { n . _keySliding = true ; a ( this ) . addClass ( "ui-state-active" ) ; o = n . _start ( f , l ) ; if ( o === false ) return } } o = n . options . step ; n . options . values && n . options . values . length ?
A = p = n . values ( l ) : A = p = n . value ( ) ; switch ( f . keyCode ) { case a . ui . keyCode . HOME : p = n . _valueMin ( ) ; break ; case a . ui . keyCode . END : p = n . _valueMax ( ) ; break ; case a . ui . keyCode . PAGE _UP : p = n . _trimAlignValue ( A + ( n . _valueMax ( ) - n . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . PAGE _DOWN : p = n . _trimAlignValue ( A - ( n . _valueMax ( ) - n . _valueMin ( ) ) / 5 ) ; break ; case a . ui . keyCode . UP : case a . ui . keyCode . RIGHT : if ( A === n . _valueMax ( ) ) return ; p = n . _trimAlignValue ( A + o ) ; break ; case a . ui . keyCode . DOWN : case a . ui . keyCode . LEFT : if ( A === n . _valueMin ( ) ) return ; p = n . _trimAlignValue ( A -
o ) } n . _slide ( f , l , p ) ; return d } } ) . keyup ( function ( f ) { var d = a ( this ) . data ( "index.ui-slider-handle" ) ; n . _keySliding && ( n . _keySliding = false , n . _stop ( f , d ) , n . _change ( f , d ) , a ( this ) . removeClass ( "ui-state-active" ) ) } ) ; this . _refreshValue ( ) ; this . _animateOff = false } , destroy : function ( ) { this . handles . remove ( ) ; this . range . remove ( ) ; this . element . removeClass ( "ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all" ) . removeData ( "slider" ) . unbind ( ".slider" ) ; this . _mouseDestroy ( ) ;
return this } , _mouseCapture : function ( n ) { var g = this . options , b , m , s , c , f ; if ( g . disabled ) return false ; this . elementSize = { width : this . element . outerWidth ( ) , height : this . element . outerHeight ( ) } ; this . elementOffset = this . element . offset ( ) ; b = this . _normValueFromMouse ( { x : n . pageX , y : n . pageY } ) ; m = this . _valueMax ( ) - this . _valueMin ( ) + 1 ; c = this ; this . handles . each ( function ( d ) { var l = Math . abs ( b - c . values ( d ) ) ; m > l && ( m = l , s = a ( this ) , f = d ) } ) ; g . range === true && this . values ( 1 ) === g . min && ( f += 1 , s = a ( this . handles [ f ] ) ) ; if ( this . _start ( n , f ) === false ) return false ;
this . _mouseSliding = true ; c . _handleIndex = f ; s . addClass ( "ui-state-active" ) . focus ( ) ; g = s . offset ( ) ; this . _clickOffset = ! a ( n . target ) . parents ( ) . andSelf ( ) . is ( ".ui-slider-handle" ) ? { left : 0 , top : 0 } : { left : n . pageX - g . left - s . width ( ) / 2 , top : n . pageY - g . top - s . height ( ) / 2 - ( parseInt ( s . css ( "borderTopWidth" ) , 10 ) || 0 ) - ( parseInt ( s . css ( "borderBottomWidth" ) , 10 ) || 0 ) + ( parseInt ( s . css ( "marginTop" ) , 10 ) || 0 ) } ; this . handles . hasClass ( "ui-state-hover" ) || this . _slide ( n , f , b ) ; return this . _animateOff = true } , _mouseStart : function ( ) { return true } , _mouseDrag : function ( n ) { var g =
this . _normValueFromMouse ( { x : n . pageX , y : n . pageY } ) ; this . _slide ( n , this . _handleIndex , g ) ; return false } , _mouseStop : function ( n ) { this . handles . removeClass ( "ui-state-active" ) ; this . _mouseSliding = false ; this . _stop ( n , this . _handleIndex ) ; this . _change ( n , this . _handleIndex ) ; this . _clickOffset = this . _handleIndex = null ; return this . _animateOff = false } , _detectOrientation : function ( ) { this . orientation = this . options . orientation === "vertical" ? "vertical" : "horizontal" } , _normValueFromMouse : function ( n ) { var g , b ; this . orientation === "horizontal" ?
( g = this . elementSize . width , b = n . x - this . elementOffset . left - ( this . _clickOffset ? this . _clickOffset . left : 0 ) ) : ( g = this . elementSize . height , b = n . y - this . elementOffset . top - ( this . _clickOffset ? this . _clickOffset . top : 0 ) ) ; n = b / g ; n > 1 && ( n = 1 ) ; n < 0 && ( n = 0 ) ; this . orientation === "vertical" && ( n = 1 - n ) ; g = this . _valueMax ( ) - this . _valueMin ( ) ; return this . _trimAlignValue ( this . _valueMin ( ) + n * g ) } , _start : function ( n , g ) { var b = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( b . value = this . values ( g ) ,
b . values = this . values ( ) ) ; return this . _trigger ( "start" , n , b ) } , _slide : function ( n , g , b ) { var m , s , c ; this . options . values && this . options . values . length ? ( m = this . values ( g ? 0 : 1 ) , this . options . values . length === 2 && this . options . range === true && ( g === 0 && b > m || g === 1 && b < m ) && ( b = m ) , b !== this . values ( g ) && ( s = this . values ( ) , s [ g ] = b , c = this . _trigger ( "slide" , n , { handle : this . handles [ g ] , value : b , values : s } ) , this . values ( g ? 0 : 1 ) , c !== false && this . values ( g , b , true ) ) ) : b !== this . value ( ) && ( c = this . _trigger ( "slide" , n , { handle : this . handles [ g ] , value : b } ) , c !==
false && this . value ( b ) ) } , _stop : function ( n , g ) { var b = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( b . value = this . values ( g ) , b . values = this . values ( ) ) ; this . _trigger ( "stop" , n , b ) } , _change : function ( n , g ) { if ( ! this . _keySliding && ! this . _mouseSliding ) { var b = { handle : this . handles [ g ] , value : this . value ( ) } ; this . options . values && this . options . values . length && ( b . value = this . values ( g ) , b . values = this . values ( ) ) ; this . _trigger ( "change" , n , b ) } } , value : function ( n ) { if ( arguments . length ) { this . options . value =
this . _trimAlignValue ( n ) ; this . _refreshValue ( ) ; this . _change ( null , 0 ) } else return this . _value ( ) } , values : function ( n , g ) { var b , m , s ; if ( arguments . length > 1 ) { this . options . values [ n ] = this . _trimAlignValue ( g ) ; this . _refreshValue ( ) ; this . _change ( null , n ) } else { if ( ! arguments . length ) return this . _values ( ) ; if ( ! a . isArray ( arguments [ 0 ] ) ) return this . options . values && this . options . values . length ? this . _values ( n ) : this . value ( ) ; b = this . options . values ; m = arguments [ 0 ] ; for ( s = 0 ; s < b . length ; s += 1 ) { b [ s ] = this . _trimAlignValue ( m [ s ] ) ; this . _change ( null ,
s ) } this . _refreshValue ( ) } } , _setOption : function ( n , g ) { var b , m = 0 ; a . isArray ( this . options . values ) && ( m = this . options . values . length ) ; a . Widget . prototype . _setOption . apply ( this , arguments ) ; switch ( n ) { case "disabled" : g ? ( this . handles . filter ( ".ui-state-focus" ) . blur ( ) , this . handles . removeClass ( "ui-state-hover" ) , this . handles . propAttr ( "disabled" , true ) , this . element . addClass ( "ui-disabled" ) ) : ( this . handles . propAttr ( "disabled" , false ) , this . element . removeClass ( "ui-disabled" ) ) ; break ; case "orientation" : this . _detectOrientation ( ) ;
this . element . removeClass ( "ui-slider-horizontal ui-slider-vertical" ) . addClass ( "ui-slider-" + this . orientation ) ; this . _refreshValue ( ) ; break ; case "value" : this . _animateOff = true ; this . _refreshValue ( ) ; this . _change ( null , 0 ) ; this . _animateOff = false ; break ; case "values" : this . _animateOff = true ; this . _refreshValue ( ) ; for ( b = 0 ; b < m ; b += 1 ) this . _change ( null , b ) ; this . _animateOff = false } } , _value : function ( ) { var n = this . options . value ; return n = this . _trimAlignValue ( n ) } , _values : function ( n ) { var g , b ; if ( arguments . length ) { g = this . options . values [ n ] ;
return g = this . _trimAlignValue ( g ) } g = this . options . values . slice ( ) ; for ( b = 0 ; b < g . length ; b += 1 ) g [ b ] = this . _trimAlignValue ( g [ b ] ) ; return g } , _trimAlignValue : function ( n ) { if ( n <= this . _valueMin ( ) ) return this . _valueMin ( ) ; if ( n >= this . _valueMax ( ) ) return this . _valueMax ( ) ; var g = this . options . step > 0 ? this . options . step : 1 , b = ( n - this . _valueMin ( ) ) % g ; n = n - b ; Math . abs ( b ) * 2 >= g && ( n += b > 0 ? g : - g ) ; return parseFloat ( n . toFixed ( 5 ) ) } , _valueMin : function ( ) { return this . options . min } , _valueMax : function ( ) { return this . options . max } , _refreshValue : function ( ) { var n =
this . options . range , g = this . options , b = this , m = this . _animateOff ? false : g . animate , s , c = { } , f , d , l , o ; this . options . values && this . options . values . length ? this . handles . each ( function ( A ) { s = ( b . values ( A ) - b . _valueMin ( ) ) / ( b . _valueMax ( ) - b . _valueMin ( ) ) * 100 ; c [ b . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" ; a ( this ) . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( c , g . animate ) ; b . options . range === true && ( b . orientation === "horizontal" ? ( A === 0 && b . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { left : s + "%" } , g . animate ) , A === 1 && b . range [ m ? "animate" : "css" ] ( { width : s -
f + "%" } , { queue : false , duration : g . animate } ) ) : ( A === 0 && b . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { bottom : s + "%" } , g . animate ) , A === 1 && b . range [ m ? "animate" : "css" ] ( { height : s - f + "%" } , { queue : false , duration : g . animate } ) ) ) ; f = s } ) : ( d = this . value ( ) , l = this . _valueMin ( ) , o = this . _valueMax ( ) , s = o !== l ? ( d - l ) / ( o - l ) * 100 : 0 , c [ b . orientation === "horizontal" ? "left" : "bottom" ] = s + "%" , this . handle . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( c , g . animate ) , n === "min" && this . orientation === "horizontal" && this . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { width : s + "%" } , g . animate ) ,
n === "max" && this . orientation === "horizontal" && this . range [ m ? "animate" : "css" ] ( { width : 100 - s + "%" } , { queue : false , duration : g . animate } ) , n === "min" && this . orientation === "vertical" && this . range . stop ( 1 , 1 ) [ m ? "animate" : "css" ] ( { height : s + "%" } , g . animate ) , n === "max" && this . orientation === "vertical" && this . range [ m ? "animate" : "css" ] ( { height : 100 - s + "%" } , { queue : false , duration : g . animate } ) ) } } ) ; a . extend ( a . ui . slider , { version : "1.8.17" } ) } ) ( jQuery ) ; ( function ( a ) { Math . precision = function ( c , f ) { if ( f === undefined ) f = 0 ; return Math . round ( c * Math . pow ( 10 , f ) ) / Math . pow ( 10 , f ) } ; var n = function ( c , f ) { var d = this , l = c . find ( "img:first" ) , o = 0 , A = 100 , p = 100 , K = 0 , Q = 100 , N = 100 , H = 0 , S = 0 , ba , O , T = [ ] , ha = function ( Z ) { for ( var Y = 0 ; Y < T . length ; Y ++ ) T [ Y ] . call ( d , d , Z ) } , U = function ( Z ) { var Y = c . offset ( ) ; ba = { l : Y . left | 0 , t : Y . top | 0 } ; clearTimeout ( O ) ; O = setTimeout ( function ( ) { wa . call ( d , Z ) } , 0 ) ; a ( document ) . bind ( "mousemove" , P ) . bind ( "mouseup" , aa ) ; Z . preventDefault ( ) } , P = function ( Z ) { clearTimeout ( O ) ; O = setTimeout ( function ( ) { wa . call ( d ,
Z ) } , 0 ) ; Z . stopPropagation ( ) ; Z . preventDefault ( ) ; return false } , aa = function ( Z ) { a ( document ) . unbind ( "mouseup" , aa ) . unbind ( "mousemove" , P ) ; Z . stopPropagation ( ) ; Z . preventDefault ( ) ; return false } , wa = function ( Z ) { var Y = Z . pageX - ba . l ; Z = Z . pageY - ba . t ; var la = c . w , ua = c . h ; if ( Y < 0 ) Y = 0 ; else if ( Y > la ) Y = la ; if ( Z < 0 ) Z = 0 ; else if ( Z > ua ) Z = ua ; ja . call ( d , "xy" , { x : Y / la * p + o , y : Z / ua * N + K } ) } , ja = function ( Z , Y , la ) { if ( Y === undefined ) { if ( Z === undefined || Z == null ) Z = "xy" ; switch ( Z . toLowerCase ( ) ) { case "x" : return H ; case "y" : return S ; default : return { x : H , y : S } } } if ( ! ( la !=
null && la == d ) ) { var ua = false , pa , qa ; if ( Z == null ) Z = "xy" ; switch ( Z . toLowerCase ( ) ) { case "x" : pa = Y && ( Y . x && Y . x | 0 || Y | 0 ) || 0 ; break ; case "y" : qa = Y && ( Y . y && Y . y | 0 || Y | 0 ) || 0 ; break ; default : pa = Y && Y . x && Y . x | 0 || 0 ; qa = Y && Y . y && Y . y | 0 || 0 } if ( pa != null ) { if ( pa < o ) pa = o ; else if ( pa > A ) pa = A ; if ( H != pa ) { H = pa ; ua = true } } if ( qa != null ) { if ( qa < K ) qa = K ; else if ( qa > Q ) qa = Q ; if ( S != qa ) { S = qa ; ua = true } } ua && ha . call ( d , la || d ) } } , ea = function ( Z ) { a . isFunction ( Z ) && T . push ( Z ) } ; a . extend ( true , d , { val : ja , range : function ( Z , Y ) { if ( Y === undefined ) { if ( Z === undefined || Z == null ) Z = "all" ;
switch ( Z . toLowerCase ( ) ) { case "minx" : return o ; case "maxx" : return A ; case "rangex" : return { minX : o , maxX : A , rangeX : p } ; case "miny" : return K ; case "maxy" : return Q ; case "rangey" : return { minY : K , maxY : Q , rangeY : N } ; default : return { minX : o , maxX : A , rangeX : p , minY : K , maxY : Q , rangeY : N } } } var la , ua , pa , qa ; if ( Z == null ) Z = "all" ; switch ( Z . toLowerCase ( ) ) { case "minx" : la = Y && ( Y . minX && Y . minX | 0 || Y | 0 ) || 0 ; break ; case "maxx" : ua = Y && ( Y . maxX && Y . maxX | 0 || Y | 0 ) || 0 ; break ; case "rangex" : la = Y && Y . minX && Y . minX | 0 || 0 ; ua = Y && Y . maxX && Y . maxX | 0 || 0 ; break ; case "miny" : pa =
Y && ( Y . minY && Y . minY | 0 || Y | 0 ) || 0 ; break ; case "maxy" : qa = Y && ( Y . maxY && Y . maxY | 0 || Y | 0 ) || 0 ; break ; case "rangey" : pa = Y && Y . minY && Y . minY | 0 || 0 ; qa = Y && Y . maxY && Y . maxY | 0 || 0 ; break ; default : la = Y && Y . minX && Y . minX | 0 || 0 ; ua = Y && Y . maxX && Y . maxX | 0 || 0 ; pa = Y && Y . minY && Y . minY | 0 || 0 ; qa = Y && Y . maxY && Y . maxY | 0 || 0 } if ( la != null && o != la ) { o = la ; p = A - o } if ( ua != null && A != ua ) { A = ua ; p = A - o } if ( pa != null && K != pa ) { K = pa ; N = Q - K } if ( qa != null && Q != qa ) { Q = qa ; N = Q - K } } , bind : ea , unbind : function ( Z ) { if ( a . isFunction ( Z ) ) for ( var Y ; ( Y = a . inArray ( Z , T ) ) != - 1 ; ) T . splice ( Y , 1 ) } , destroy : function ( ) { a ( document ) . unbind ( "mouseup" ,
aa ) . unbind ( "mousemove" , P ) ; c . unbind ( "mousedown" , U ) ; T = l = c = null } } ) ; l . src = f . arrow && f . arrow . image ; l . w = f . arrow && f . arrow . width || l . width ( ) ; l . h = f . arrow && f . arrow . height || l . height ( ) ; c . w = f . map && f . map . width || c . width ( ) ; c . h = f . map && f . map . height || c . height ( ) ; c . bind ( "mousedown" , U ) ; ea . call ( d , function ( ) { var Z = 0 , Y = 0 , la = c . w , ua = c . h , pa = l . w , qa = l . h ; setTimeout ( function ( ) { if ( p > 0 ) Z = H == A ? la : H / p * la | 0 ; if ( N > 0 ) Y = S == Q ? ua : S / N * ua | 0 ; if ( pa >= la ) Z = ( la >> 1 ) - ( pa >> 1 ) ; else Z -= pa >> 1 ; if ( qa >= ua ) Y = ( ua >> 1 ) - ( qa >> 1 ) ; else Y -= qa >> 1 ; l . css ( { left : Z + "px" ,
top : Y + "px" } ) } , 0 ) } ) } , g = function ( c , f , d , l ) { var o = this ; c = c . find ( "td.Text input" ) ; var A = c . eq ( 3 ) , p = c . eq ( 4 ) , K = c . eq ( 5 ) , Q = c . length > 7 ? c . eq ( 6 ) : null , N = c . eq ( 0 ) , H = c . eq ( 1 ) , S = c . eq ( 2 ) , ba = c . eq ( c . length > 7 ? 7 : 6 ) , O = c . length > 7 ? c . eq ( 8 ) : null , T = function ( ja ) { if ( ! ( ja . target . value == "" && ja . target != ba . get ( 0 ) && ( d != null && ja . target != d . get ( 0 ) || d == null ) ) ) { if ( ! P ( ja ) ) return ja ; switch ( ja . target ) { case A . get ( 0 ) : switch ( ja . keyCode ) { case 38 : A . val ( aa . call ( o , ( A . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "r" , A . val ( ) , ja . target ) ; return false ; case 40 : A . val ( aa . call ( o ,
( A . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "r" , A . val ( ) , ja . target ) ; return false } break ; case p . get ( 0 ) : switch ( ja . keyCode ) { case 38 : p . val ( aa . call ( o , ( p . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "g" , p . val ( ) , ja . target ) ; return false ; case 40 : p . val ( aa . call ( o , ( p . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "g" , p . val ( ) , ja . target ) ; return false } break ; case K . get ( 0 ) : switch ( ja . keyCode ) { case 38 : K . val ( aa . call ( o , ( K . val ( ) << 0 ) + 1 , 0 , 255 ) ) ; f . val ( "b" , K . val ( ) , ja . target ) ; return false ; case 40 : K . val ( aa . call ( o , ( K . val ( ) << 0 ) - 1 , 0 , 255 ) ) ; f . val ( "b" , K . val ( ) , ja . target ) ; return false } break ;
case Q && Q . get ( 0 ) : switch ( ja . keyCode ) { case 38 : Q . val ( aa . call ( o , parseFloat ( Q . val ( ) ) + 1 , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( Q . val ( ) * 255 / 100 , l ) , ja . target ) ; return false ; case 40 : Q . val ( aa . call ( o , parseFloat ( Q . val ( ) ) - 1 , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( Q . val ( ) * 255 / 100 , l ) , ja . target ) ; return false } break ; case N . get ( 0 ) : switch ( ja . keyCode ) { case 38 : N . val ( aa . call ( o , ( N . val ( ) << 0 ) + 1 , 0 , 360 ) ) ; f . val ( "h" , N . val ( ) , ja . target ) ; return false ; case 40 : N . val ( aa . call ( o , ( N . val ( ) << 0 ) - 1 , 0 , 360 ) ) ; f . val ( "h" , N . val ( ) , ja . target ) ; return false } break ;
case H . get ( 0 ) : switch ( ja . keyCode ) { case 38 : H . val ( aa . call ( o , ( H . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; f . val ( "s" , H . val ( ) , ja . target ) ; return false ; case 40 : H . val ( aa . call ( o , ( H . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; f . val ( "s" , H . val ( ) , ja . target ) ; return false } break ; case S . get ( 0 ) : switch ( ja . keyCode ) { case 38 : S . val ( aa . call ( o , ( S . val ( ) << 0 ) + 1 , 0 , 100 ) ) ; f . val ( "v" , S . val ( ) , ja . target ) ; return false ; case 40 : S . val ( aa . call ( o , ( S . val ( ) << 0 ) - 1 , 0 , 100 ) ) ; f . val ( "v" , S . val ( ) , ja . target ) ; return false } } } } , ha = function ( ja ) { if ( ! ( ja . target . value == "" && ja . target != ba . get ( 0 ) && ( d != null &&
ja . target != d . get ( 0 ) || d == null ) ) ) { if ( ! P ( ja ) ) return ja ; switch ( ja . target ) { case A . get ( 0 ) : A . val ( aa . call ( o , A . val ( ) , 0 , 255 ) ) ; f . val ( "r" , A . val ( ) , ja . target ) ; break ; case p . get ( 0 ) : p . val ( aa . call ( o , p . val ( ) , 0 , 255 ) ) ; f . val ( "g" , p . val ( ) , ja . target ) ; break ; case K . get ( 0 ) : K . val ( aa . call ( o , K . val ( ) , 0 , 255 ) ) ; f . val ( "b" , K . val ( ) , ja . target ) ; break ; case Q && Q . get ( 0 ) : Q . val ( aa . call ( o , Q . val ( ) , 0 , 100 ) ) ; f . val ( "a" , Math . precision ( Q . val ( ) * 255 / 100 , l ) , ja . target ) ; break ; case N . get ( 0 ) : N . val ( aa . call ( o , N . val ( ) , 0 , 360 ) ) ; f . val ( "h" , N . val ( ) , ja . target ) ; break ;
case H . get ( 0 ) : H . val ( aa . call ( o , H . val ( ) , 0 , 100 ) ) ; f . val ( "s" , H . val ( ) , ja . target ) ; break ; case S . get ( 0 ) : S . val ( aa . call ( o , S . val ( ) , 0 , 100 ) ) ; f . val ( "v" , S . val ( ) , ja . target ) ; break ; case ba . get ( 0 ) : ba . val ( ba . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; d && d . val ( ba . val ( ) ) ; f . val ( "hex" , ba . val ( ) != "" ? ba . val ( ) : null , ja . target ) ; break ; case d && d . get ( 0 ) : d . val ( d . val ( ) . replace ( /[^a-fA-F0-9]/g , "" ) . toLowerCase ( ) . substring ( 0 , 6 ) ) ; ba . val ( d . val ( ) ) ; f . val ( "hex" , d . val ( ) != "" ? d . val ( ) : null , ja . target ) ; break ; case O && O . get ( 0 ) : O . val ( O . val ( ) . replace ( /[^a-fA-F0-9]/g ,
"" ) . toLowerCase ( ) . substring ( 0 , 2 ) ) ; f . val ( "a" , O . val ( ) != null ? parseInt ( O . val ( ) , 16 ) : null , ja . target ) } } } , U = function ( ja ) { if ( f . val ( ) != null ) switch ( ja . target ) { case A . get ( 0 ) : A . val ( f . val ( "r" ) ) ; break ; case p . get ( 0 ) : p . val ( f . val ( "g" ) ) ; break ; case K . get ( 0 ) : K . val ( f . val ( "b" ) ) ; break ; case Q && Q . get ( 0 ) : Q . val ( Math . precision ( f . val ( "a" ) * 100 / 255 , l ) ) ; break ; case N . get ( 0 ) : N . val ( f . val ( "h" ) ) ; break ; case H . get ( 0 ) : H . val ( f . val ( "s" ) ) ; break ; case S . get ( 0 ) : S . val ( f . val ( "v" ) ) ; break ; case ba . get ( 0 ) : case d && d . get ( 0 ) : ba . val ( f . val ( "hex" ) ) ; d && d . val ( f . val ( "hex" ) ) ;
break ; case O && O . get ( 0 ) : O . val ( f . val ( "ahex" ) . substring ( 6 ) ) } } , P = function ( ja ) { switch ( ja . keyCode ) { case 9 : case 16 : case 29 : case 37 : case 39 : return false ; case "c" . charCodeAt ( ) : case "v" . charCodeAt ( ) : if ( ja . ctrlKey ) return false } return true } , aa = function ( ja , ea , Z ) { if ( ja == "" || isNaN ( ja ) ) return ea ; if ( ja > Z ) return Z ; if ( ja < ea ) return ea ; return ja } , wa = function ( ja , ea ) { var Z = ja . val ( "all" ) ; if ( ea != A . get ( 0 ) ) A . val ( Z != null ? Z . r : "" ) ; if ( ea != p . get ( 0 ) ) p . val ( Z != null ? Z . g : "" ) ; if ( ea != K . get ( 0 ) ) K . val ( Z != null ? Z . b : "" ) ; if ( Q && ea != Q . get ( 0 ) ) Q . val ( Z !=
null ? Math . precision ( Z . a * 100 / 255 , l ) : "" ) ; if ( ea != N . get ( 0 ) ) N . val ( Z != null ? Z . h : "" ) ; if ( ea != H . get ( 0 ) ) H . val ( Z != null ? Z . s : "" ) ; if ( ea != S . get ( 0 ) ) S . val ( Z != null ? Z . v : "" ) ; if ( ea != ba . get ( 0 ) && ( d && ea != d . get ( 0 ) || ! d ) ) ba . val ( Z != null ? Z . hex : "" ) ; if ( d && ea != d . get ( 0 ) && ea != ba . get ( 0 ) ) d . val ( Z != null ? Z . hex : "" ) ; if ( O && ea != O . get ( 0 ) ) O . val ( Z != null ? Z . ahex . substring ( 6 ) : "" ) } ; a . extend ( true , o , { destroy : function ( ) { A . add ( p ) . add ( K ) . add ( Q ) . add ( N ) . add ( H ) . add ( S ) . add ( ba ) . add ( d ) . add ( O ) . unbind ( "keyup" , ha ) . unbind ( "blur" , U ) ; A . add ( p ) . add ( K ) . add ( Q ) . add ( N ) . add ( H ) . add ( S ) . unbind ( "keydown" ,
T ) ; f . unbind ( wa ) ; O = ba = S = H = N = Q = K = p = A = null } } ) ; A . add ( p ) . add ( K ) . add ( Q ) . add ( N ) . add ( H ) . add ( S ) . add ( ba ) . add ( d ) . add ( O ) . bind ( "keyup" , ha ) . bind ( "blur" , U ) ; A . add ( p ) . add ( K ) . add ( Q ) . add ( N ) . add ( H ) . add ( S ) . bind ( "keydown" , T ) ; f . bind ( wa ) } ; a . jPicker = { List : [ ] , Color : function ( c ) { var f = this , d , l , o , A , p , K , Q , N = [ ] , H = function ( ba ) { for ( var O = 0 ; O < N . length ; O ++ ) N [ O ] . call ( f , f , ba ) } , S = function ( ba , O , T ) { if ( O === undefined ) { if ( ba === undefined || ba == null || ba == "" ) ba = "all" ; if ( d == null ) return null ; switch ( ba . toLowerCase ( ) ) { case "ahex" : return s . rgbaToHex ( { r : d ,
g : l , b : o , a : A } ) ; case "hex" : return S ( "ahex" ) . substring ( 0 , 6 ) ; case "all" : return { r : d , g : l , b : o , a : A , h : p , s : K , v : Q , hex : S . call ( f , "hex" ) , ahex : S . call ( f , "ahex" ) } ; default : O = { } ; for ( var ha = 0 ; ha < ba . length ; ha ++ ) switch ( ba . charAt ( ha ) ) { case "r" : if ( ba . length == 1 ) O = d ; else O . r = d ; break ; case "g" : if ( ba . length == 1 ) O = l ; else O . g = l ; break ; case "b" : if ( ba . length == 1 ) O = o ; else O . b = o ; break ; case "a" : if ( ba . length == 1 ) O = A ; else O . a = A ; break ; case "h" : if ( ba . length == 1 ) O = p ; else O . h = p ; break ; case "s" : if ( ba . length == 1 ) O = K ; else O . s = K ; break ; case "v" : if ( ba . length ==
1 ) O = Q ; else O . v = Q } return O == { } ? S . call ( f , "all" ) : O } } if ( ! ( T != null && T == f ) ) { var U = false ; if ( ba == null ) ba = "" ; if ( O == null ) { if ( d != null ) { d = null ; U = true } if ( l != null ) { l = null ; U = true } if ( o != null ) { o = null ; U = true } if ( A != null ) { A = null ; U = true } if ( p != null ) { p = null ; U = true } if ( K != null ) { K = null ; U = true } if ( Q != null ) { Q = null ; U = true } U && H . call ( f , T || f ) } else switch ( ba . toLowerCase ( ) ) { case "ahex" : case "hex" : O = s . hexToRgba ( O && ( O . ahex || O . hex ) || O || "00000000" ) ; S . call ( f , "rgba" , { r : O . r , g : O . g , b : O . b , a : ba == "ahex" ? O . a : A != null ? A : 255 } , T ) ; break ; default : if ( O &&
( O . ahex != null || O . hex != null ) ) { S . call ( f , "ahex" , O . ahex || O . hex || "00000000" , T ) ; break } var P = { } , aa = false , wa = false ; if ( O . r !== undefined && ! ba . indexOf ( "r" ) == - 1 ) ba += "r" ; if ( O . g !== undefined && ! ba . indexOf ( "g" ) == - 1 ) ba += "g" ; if ( O . b !== undefined && ! ba . indexOf ( "b" ) == - 1 ) ba += "b" ; if ( O . a !== undefined && ! ba . indexOf ( "a" ) == - 1 ) ba += "a" ; if ( O . h !== undefined && ! ba . indexOf ( "h" ) == - 1 ) ba += "h" ; if ( O . s !== undefined && ! ba . indexOf ( "s" ) == - 1 ) ba += "s" ; if ( O . v !== undefined && ! ba . indexOf ( "v" ) == - 1 ) ba += "v" ; for ( ha = 0 ; ha < ba . length ; ha ++ ) switch ( ba . charAt ( ha ) ) { case "r" : if ( wa ) continue ;
aa = true ; P . r = O && O . r && O . r | 0 || O && O | 0 || 0 ; if ( P . r < 0 ) P . r = 0 ; else if ( P . r > 255 ) P . r = 255 ; if ( d != P . r ) { d = P . r ; U = true } break ; case "g" : if ( wa ) continue ; aa = true ; P . g = O && O . g && O . g | 0 || O && O | 0 || 0 ; if ( P . g < 0 ) P . g = 0 ; else if ( P . g > 255 ) P . g = 255 ; if ( l != P . g ) { l = P . g ; U = true } break ; case "b" : if ( wa ) continue ; aa = true ; P . b = O && O . b && O . b | 0 || O && O | 0 || 0 ; if ( P . b < 0 ) P . b = 0 ; else if ( P . b > 255 ) P . b = 255 ; if ( o != P . b ) { o = P . b ; U = true } break ; case "a" : P . a = O && O . a != null ? O . a | 0 : O != null ? O | 0 : 255 ; if ( P . a < 0 ) P . a = 0 ; else if ( P . a > 255 ) P . a = 255 ; if ( A != P . a ) { A = P . a ; U = true } break ; case "h" : if ( aa ) continue ;
wa = true ; P . h = O && O . h && O . h | 0 || O && O | 0 || 0 ; if ( P . h < 0 ) P . h = 0 ; else if ( P . h > 360 ) P . h = 360 ; if ( p != P . h ) { p = P . h ; U = true } break ; case "s" : if ( aa ) continue ; wa = true ; P . s = O && O . s != null ? O . s | 0 : O != null ? O | 0 : 100 ; if ( P . s < 0 ) P . s = 0 ; else if ( P . s > 100 ) P . s = 100 ; if ( K != P . s ) { K = P . s ; U = true } break ; case "v" : if ( aa ) continue ; wa = true ; P . v = O && O . v != null ? O . v | 0 : O != null ? O | 0 : 100 ; if ( P . v < 0 ) P . v = 0 ; else if ( P . v > 100 ) P . v = 100 ; if ( Q != P . v ) { Q = P . v ; U = true } } if ( U ) { if ( aa ) { d = d || 0 ; l = l || 0 ; o = o || 0 ; O = s . rgbToHsv ( { r : d , g : l , b : o } ) ; p = O . h ; K = O . s ; Q = O . v } else if ( wa ) { p = p || 0 ; K = K != null ? K : 100 ; Q = Q !=
null ? Q : 100 ; O = s . hsvToRgb ( { h : p , s : K , v : Q } ) ; d = O . r ; l = O . g ; o = O . b } A = A != null ? A : 255 ; H . call ( f , T || f ) } } } } ; a . extend ( true , f , { val : S , bind : function ( ba ) { a . isFunction ( ba ) && N . push ( ba ) } , unbind : function ( ba ) { if ( a . isFunction ( ba ) ) for ( var O ; ( O = a . inArray ( ba , N ) ) != - 1 ; ) N . splice ( O , 1 ) } , destroy : function ( ) { N = null } } ) ; if ( c ) if ( c . ahex != null ) S ( "ahex" , c ) ; else if ( c . hex != null ) S ( ( c . a != null ? "a" : "" ) + "hex" , c . a != null ? { ahex : c . hex + s . intToHex ( c . a ) } : c ) ; else if ( c . r != null && c . g != null && c . b != null ) S ( "rgb" + ( c . a != null ? "a" : "" ) , c ) ; else if ( c . h != null && c . s != null &&
c . v != null ) S ( "hsv" + ( c . a != null ? "a" : "" ) , c ) } , ColorMethods : { hexToRgba : function ( c ) { c = this . validateHex ( c ) ; if ( c == "" ) return { r : null , g : null , b : null , a : null } ; var f = "00" , d = "00" , l = "00" , o = "255" ; if ( c . length == 6 ) c += "ff" ; if ( c . length > 6 ) { f = c . substring ( 0 , 2 ) ; d = c . substring ( 2 , 4 ) ; l = c . substring ( 4 , 6 ) ; o = c . substring ( 6 , c . length ) } else { if ( c . length > 4 ) { f = c . substring ( 4 , c . length ) ; c = c . substring ( 0 , 4 ) } if ( c . length > 2 ) { d = c . substring ( 2 , c . length ) ; c = c . substring ( 0 , 2 ) } if ( c . length > 0 ) l = c . substring ( 0 , c . length ) } return { r : this . hexToInt ( f ) , g : this . hexToInt ( d ) ,
b : this . hexToInt ( l ) , a : this . hexToInt ( o ) } } , validateHex : function ( c ) { if ( typeof c == "object" ) return "" ; c = c . toLowerCase ( ) . replace ( /[^a-f0-9]/g , "" ) ; if ( c . length > 8 ) c = c . substring ( 0 , 8 ) ; return c } , rgbaToHex : function ( c ) { return this . intToHex ( c . r ) + this . intToHex ( c . g ) + this . intToHex ( c . b ) + this . intToHex ( c . a ) } , intToHex : function ( c ) { c = ( c | 0 ) . toString ( 16 ) ; if ( c . length == 1 ) c = "0" + c ; return c . toLowerCase ( ) } , hexToInt : function ( c ) { return parseInt ( c , 16 ) } , rgbToHsv : function ( c ) { var f = c . r / 255 , d = c . g / 255 ; c = c . b / 255 ; var l = { h : 0 , s : 0 , v : 0 } , o = 0 , A =
0 ; if ( f >= d && f >= c ) { A = f ; o = d > c ? c : d } else if ( d >= c && d >= f ) { A = d ; o = f > c ? c : f } else { A = c ; o = d > f ? f : d } l . v = A ; l . s = A ? ( A - o ) / A : 0 ; if ( l . s ) { o = A - o ; l . h = f == A ? ( d - c ) / o : d == A ? 2 + ( c - f ) / o : 4 + ( f - d ) / o ; l . h = parseInt ( l . h * 60 ) ; if ( l . h < 0 ) l . h += 360 } else l . h = 0 ; l . s = l . s * 100 | 0 ; l . v = l . v * 100 | 0 ; return l } , hsvToRgb : function ( c ) { var f = { r : 0 , g : 0 , b : 0 , a : 100 } , d = c . h , l = c . s ; c = c . v ; if ( l == 0 ) f . r = c == 0 ? f . g = f . b = 0 : f . g = f . b = c * 255 / 100 | 0 ; else { if ( d == 360 ) d = 0 ; d /= 60 ; l /= 100 ; c /= 100 ; var o = d | 0 , A = d - o ; d = c * ( 1 - l ) ; var p = c * ( 1 - l * A ) ; l = c * ( 1 - l * ( 1 - A ) ) ; switch ( o ) { case 0 : f . r = c ; f . g = l ; f . b = d ; break ; case 1 : f . r =
p ; f . g = c ; f . b = d ; break ; case 2 : f . r = d ; f . g = c ; f . b = l ; break ; case 3 : f . r = d ; f . g = p ; f . b = c ; break ; case 4 : f . r = l ; f . g = d ; f . b = c ; break ; case 5 : f . r = c ; f . g = d ; f . b = p } f . r = f . r * 255 | 0 ; f . g = f . g * 255 | 0 ; f . b = f . b * 255 | 0 } return f } } } ; var b = a . jPicker . Color , m = a . jPicker . List , s = a . jPicker . ColorMethods ; a . fn . jPicker = function ( c ) { var f = arguments ; return this . each ( function ( ) { var d = this , l = a . extend ( true , { } , a . fn . jPicker . defaults , c ) ; if ( a ( d ) . get ( 0 ) . nodeName . toLowerCase ( ) == "input" ) { a . extend ( true , l , { window : { bindToInput : true , expandable : true , input : a ( d ) } } ) ; if ( a ( d ) . val ( ) ==
"" ) { l . color . active = new b ( { hex : null } ) ; l . color . current = new b ( { hex : null } ) } else if ( s . validateHex ( a ( d ) . val ( ) ) ) { l . color . active = new b ( { hex : a ( d ) . val ( ) , a : l . color . active . val ( "a" ) } ) ; l . color . current = new b ( { hex : a ( d ) . val ( ) , a : l . color . active . val ( "a" ) } ) } } if ( l . window . expandable ) a ( d ) . after ( '<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>' ) ;
else l . window . liveUpdate = false ; var o = parseFloat ( navigator . appVersion . split ( "MSIE" ) [ 1 ] ) < 7 && document . body . filters , A = null , p = null , K = null , Q = null , N = null , H = null , S = null , ba = null , O = null , T = null , ha = null , U = null , P = null , aa = null , wa = null , ja = null , ea = null , Z = null , Y = null , la = null , ua = null , pa = null , qa = null , Ha = null , Ma = null , Oa = null , Ja = null , Qa = null , Va = function ( R ) { var L = sa . active , fa = L . val ( "hex" ) , Fa , Xa ; l . color . mode = R ; switch ( R ) { case "h" : setTimeout ( function ( ) { $a . call ( d , p , "transparent" ) ; Ia . call ( d , Q , 0 ) ; Ca . call ( d , Q , 100 ) ; Ia . call ( d ,
N , 260 ) ; Ca . call ( d , N , 100 ) ; $a . call ( d , K , "transparent" ) ; Ia . call ( d , S , 0 ) ; Ca . call ( d , S , 100 ) ; Ia . call ( d , ba , 260 ) ; Ca . call ( d , ba , 100 ) ; Ia . call ( d , O , 260 ) ; Ca . call ( d , O , 100 ) ; Ia . call ( d , T , 260 ) ; Ca . call ( d , T , 100 ) ; Ia . call ( d , U , 260 ) ; Ca . call ( d , U , 100 ) } , 0 ) ; P . range ( "all" , { minX : 0 , maxX : 100 , minY : 0 , maxY : 100 } ) ; aa . range ( "rangeY" , { minY : 0 , maxY : 360 } ) ; if ( L . val ( "ahex" ) == null ) break ; P . val ( "xy" , { x : L . val ( "s" ) , y : 100 - L . val ( "v" ) } , P ) ; aa . val ( "y" , 360 - L . val ( "h" ) , aa ) ; break ; case "s" : setTimeout ( function ( ) { $a . call ( d , p , "transparent" ) ; Ia . call ( d , Q , - 260 ) ; Ia . call ( d ,
N , - 520 ) ; Ia . call ( d , S , - 260 ) ; Ia . call ( d , ba , - 520 ) ; Ia . call ( d , U , 260 ) ; Ca . call ( d , U , 100 ) } , 0 ) ; P . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; aa . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( L . val ( "ahex" ) == null ) break ; P . val ( "xy" , { x : L . val ( "h" ) , y : 100 - L . val ( "v" ) } , P ) ; aa . val ( "y" , 100 - L . val ( "s" ) , aa ) ; break ; case "v" : setTimeout ( function ( ) { $a . call ( d , p , "000000" ) ; Ia . call ( d , Q , - 780 ) ; Ia . call ( d , N , 260 ) ; $a . call ( d , K , fa ) ; Ia . call ( d , S , - 520 ) ; Ia . call ( d , ba , 260 ) ; Ca . call ( d , ba , 100 ) ; Ia . call ( d , U , 260 ) ; Ca . call ( d , U , 100 ) } , 0 ) ; P . range ( "all" , { minX : 0 , maxX : 360 ,
minY : 0 , maxY : 100 } ) ; aa . range ( "rangeY" , { minY : 0 , maxY : 100 } ) ; if ( L . val ( "ahex" ) == null ) break ; P . val ( "xy" , { x : L . val ( "h" ) , y : 100 - L . val ( "s" ) } , P ) ; aa . val ( "y" , 100 - L . val ( "v" ) , aa ) ; break ; case "r" : Fa = - 1040 ; Xa = - 780 ; P . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; aa . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( L . val ( "ahex" ) == null ) break ; P . val ( "xy" , { x : L . val ( "b" ) , y : 255 - L . val ( "g" ) } , P ) ; aa . val ( "y" , 255 - L . val ( "r" ) , aa ) ; break ; case "g" : Fa = - 1560 ; Xa = - 1820 ; P . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; aa . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ;
if ( L . val ( "ahex" ) == null ) break ; P . val ( "xy" , { x : L . val ( "b" ) , y : 255 - L . val ( "r" ) } , P ) ; aa . val ( "y" , 255 - L . val ( "g" ) , aa ) ; break ; case "b" : Fa = - 2080 ; Xa = - 2860 ; P . range ( "all" , { minX : 0 , maxX : 255 , minY : 0 , maxY : 255 } ) ; aa . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( L . val ( "ahex" ) == null ) break ; P . val ( "xy" , { x : L . val ( "r" ) , y : 255 - L . val ( "g" ) } , P ) ; aa . val ( "y" , 255 - L . val ( "b" ) , aa ) ; break ; case "a" : setTimeout ( function ( ) { $a . call ( d , p , "transparent" ) ; Ia . call ( d , Q , - 260 ) ; Ia . call ( d , N , - 520 ) ; Ia . call ( d , S , 260 ) ; Ia . call ( d , ba , 260 ) ; Ca . call ( d , ba , 100 ) ; Ia . call ( d , U , 0 ) ; Ca . call ( d ,
U , 100 ) } , 0 ) ; P . range ( "all" , { minX : 0 , maxX : 360 , minY : 0 , maxY : 100 } ) ; aa . range ( "rangeY" , { minY : 0 , maxY : 255 } ) ; if ( L . val ( "ahex" ) == null ) break ; P . val ( "xy" , { x : L . val ( "h" ) , y : 100 - L . val ( "v" ) } , P ) ; aa . val ( "y" , 255 - L . val ( "a" ) , aa ) ; break ; default : throw "Invalid Mode" ; } switch ( R ) { case "s" : case "v" : case "a" : setTimeout ( function ( ) { Ca . call ( d , Q , 100 ) ; Ca . call ( d , S , 100 ) ; Ia . call ( d , O , 260 ) ; Ca . call ( d , O , 100 ) ; Ia . call ( d , T , 260 ) ; Ca . call ( d , T , 100 ) } , 0 ) ; break ; case "r" : case "g" : case "b" : setTimeout ( function ( ) { $a . call ( d , p , "transparent" ) ; $a . call ( d , K , "transparent" ) ;
Ca . call ( d , S , 100 ) ; Ca . call ( d , Q , 100 ) ; Ia . call ( d , Q , Fa ) ; Ia . call ( d , N , Fa - 260 ) ; Ia . call ( d , S , Xa - 780 ) ; Ia . call ( d , ba , Xa - 520 ) ; Ia . call ( d , O , Xa ) ; Ia . call ( d , T , Xa - 260 ) ; Ia . call ( d , U , 260 ) ; Ca . call ( d , U , 100 ) } , 0 ) } L . val ( "ahex" ) != null && Na . call ( d , L ) } , Na = function ( R , L ) { if ( L == null || L != aa && L != P ) zb . call ( d , R , L ) ; setTimeout ( function ( ) { Ea . call ( d , R ) ; yb . call ( d , R ) ; qb . call ( d , R ) } , 0 ) } , Aa = function ( R , L ) { var fa = sa . active ; if ( ! ( L != P && fa . val ( ) == null ) ) { var Fa = R . val ( "all" ) ; switch ( l . color . mode ) { case "h" : fa . val ( "sv" , { s : Fa . x , v : 100 - Fa . y } , L ) ; break ; case "s" : case "a" : fa . val ( "hv" ,
{ h : Fa . x , v : 100 - Fa . y } , L ) ; break ; case "v" : fa . val ( "hs" , { h : Fa . x , s : 100 - Fa . y } , L ) ; break ; case "r" : fa . val ( "gb" , { g : 255 - Fa . y , b : Fa . x } , L ) ; break ; case "g" : fa . val ( "rb" , { r : 255 - Fa . y , b : Fa . x } , L ) ; break ; case "b" : fa . val ( "rg" , { r : Fa . x , g : 255 - Fa . y } , L ) } } } , La = function ( R , L ) { var fa = sa . active ; if ( ! ( L != aa && fa . val ( ) == null ) ) switch ( l . color . mode ) { case "h" : fa . val ( "h" , { h : 360 - R . val ( "y" ) } , L ) ; break ; case "s" : fa . val ( "s" , { s : 100 - R . val ( "y" ) } , L ) ; break ; case "v" : fa . val ( "v" , { v : 100 - R . val ( "y" ) } , L ) ; break ; case "r" : fa . val ( "r" , { r : 255 - R . val ( "y" ) } , L ) ; break ;
case "g" : fa . val ( "g" , { g : 255 - R . val ( "y" ) } , L ) ; break ; case "b" : fa . val ( "b" , { b : 255 - R . val ( "y" ) } , L ) ; break ; case "a" : fa . val ( "a" , 255 - R . val ( "y" ) , L ) } } , zb = function ( R , L ) { if ( L != P ) switch ( l . color . mode ) { case "h" : var fa = R . val ( "sv" ) ; P . val ( "xy" , { x : fa != null ? fa . s : 100 , y : 100 - ( fa != null ? fa . v : 100 ) } , L ) ; break ; case "s" : case "a" : fa = R . val ( "hv" ) ; P . val ( "xy" , { x : fa && fa . h || 0 , y : 100 - ( fa != null ? fa . v : 100 ) } , L ) ; break ; case "v" : fa = R . val ( "hs" ) ; P . val ( "xy" , { x : fa && fa . h || 0 , y : 100 - ( fa != null ? fa . s : 100 ) } , L ) ; break ; case "r" : fa = R . val ( "bg" ) ; P . val ( "xy" , { x : fa &&
fa . b || 0 , y : 255 - ( fa && fa . g || 0 ) } , L ) ; break ; case "g" : fa = R . val ( "br" ) ; P . val ( "xy" , { x : fa && fa . b || 0 , y : 255 - ( fa && fa . r || 0 ) } , L ) ; break ; case "b" : fa = R . val ( "rg" ) ; P . val ( "xy" , { x : fa && fa . r || 0 , y : 255 - ( fa && fa . g || 0 ) } , L ) } if ( L != aa ) switch ( l . color . mode ) { case "h" : aa . val ( "y" , 360 - ( R . val ( "h" ) || 0 ) , L ) ; break ; case "s" : fa = R . val ( "s" ) ; aa . val ( "y" , 100 - ( fa != null ? fa : 100 ) , L ) ; break ; case "v" : fa = R . val ( "v" ) ; aa . val ( "y" , 100 - ( fa != null ? fa : 100 ) , L ) ; break ; case "r" : aa . val ( "y" , 255 - ( R . val ( "r" ) || 0 ) , L ) ; break ; case "g" : aa . val ( "y" , 255 - ( R . val ( "g" ) || 0 ) , L ) ; break ; case "b" : aa . val ( "y" ,
255 - ( R . val ( "b" ) || 0 ) , L ) ; break ; case "a" : fa = R . val ( "a" ) ; aa . val ( "y" , 255 - ( fa != null ? fa : 255 ) , L ) } } , Ea = function ( R ) { try { var L = R . val ( "all" ) ; la . css ( { backgroundColor : L && "#" + L . hex || "transparent" } ) ; Ca . call ( d , la , L && Math . precision ( L . a * 100 / 255 , 4 ) || 0 ) } catch ( fa ) { } } , yb = function ( R ) { switch ( l . color . mode ) { case "h" : $a . call ( d , p , ( new b ( { h : R . val ( "h" ) || 0 , s : 100 , v : 100 } ) ) . val ( "hex" ) ) ; break ; case "s" : case "a" : var L = R . val ( "s" ) ; Ca . call ( d , N , 100 - ( L != null ? L : 100 ) ) ; break ; case "v" : L = R . val ( "v" ) ; Ca . call ( d , Q , L != null ? L : 100 ) ; break ; case "r" : Ca . call ( d ,
N , Math . precision ( ( R . val ( "r" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "g" : Ca . call ( d , N , Math . precision ( ( R . val ( "g" ) || 0 ) / 255 * 100 , 4 ) ) ; break ; case "b" : Ca . call ( d , N , Math . precision ( ( R . val ( "b" ) || 0 ) / 255 * 100 ) ) } R = R . val ( "a" ) ; Ca . call ( d , H , Math . precision ( ( 255 - ( R || 0 ) ) * 100 / 255 , 4 ) ) } , qb = function ( R ) { switch ( l . color . mode ) { case "h" : var L = R . val ( "a" ) ; Ca . call ( d , ha , Math . precision ( ( 255 - ( L || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "s" : L = R . val ( "hva" ) ; var fa = new b ( { h : L && L . h || 0 , s : 100 , v : L != null ? L . v : 100 } ) ; $a . call ( d , K , fa . val ( "hex" ) ) ; Ca . call ( d , ba , 100 - ( L != null ? L . v :
100 ) ) ; Ca . call ( d , ha , Math . precision ( ( 255 - ( L && L . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "v" : L = R . val ( "hsa" ) ; fa = new b ( { h : L && L . h || 0 , s : L != null ? L . s : 100 , v : 100 } ) ; $a . call ( d , K , fa . val ( "hex" ) ) ; Ca . call ( d , ha , Math . precision ( ( 255 - ( L && L . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "r" : case "g" : case "b" : fa = L = 0 ; R = R . val ( "rgba" ) ; if ( l . color . mode == "r" ) { L = R && R . b || 0 ; fa = R && R . g || 0 } else if ( l . color . mode == "g" ) { L = R && R . b || 0 ; fa = R && R . r || 0 } else if ( l . color . mode == "b" ) { L = R && R . r || 0 ; fa = R && R . g || 0 } var Fa = fa > L ? L : fa ; Ca . call ( d , ba , L > fa ? Math . precision ( ( L - fa ) / ( 255 - fa ) * 100 ,
4 ) : 0 ) ; Ca . call ( d , O , fa > L ? Math . precision ( ( fa - L ) / ( 255 - L ) * 100 , 4 ) : 0 ) ; Ca . call ( d , T , Math . precision ( Fa / 255 * 100 , 4 ) ) ; Ca . call ( d , ha , Math . precision ( ( 255 - ( R && R . a || 0 ) ) * 100 / 255 , 4 ) ) ; break ; case "a" : L = R . val ( "a" ) ; $a . call ( d , K , R . val ( "hex" ) || "000000" ) ; Ca . call ( d , ha , L != null ? 0 : 100 ) ; Ca . call ( d , U , L != null ? 100 : 0 ) } } , $a = function ( R , L ) { R . css ( { backgroundColor : L && L . length == 6 && "#" + L || "transparent" } ) } , Pa = function ( R , L ) { if ( o && ( L . indexOf ( "AlphaBar.png" ) != - 1 || L . indexOf ( "Bars.png" ) != - 1 || L . indexOf ( "Maps.png" ) != - 1 ) ) { R . attr ( "pngSrc" , L ) ; R . css ( { backgroundImage : "none" ,
filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + L + "', sizingMethod='scale')" } ) } else R . css ( { backgroundImage : "url('" + L + "')" } ) } , Ia = function ( R , L ) { R . css ( { top : L + "px" } ) } , Ca = function ( R , L ) { R . css ( { visibility : L > 0 ? "visible" : "hidden" } ) ; if ( L > 0 && L < 100 ) if ( o ) { var fa = R . attr ( "pngSrc" ) ; fa != null && ( fa . indexOf ( "AlphaBar.png" ) != - 1 || fa . indexOf ( "Bars.png" ) != - 1 || fa . indexOf ( "Maps.png" ) != - 1 ) ? R . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + fa + "', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity=" +
L + ")" } ) : R . css ( { opacity : Math . precision ( L / 100 , 4 ) } ) } else R . css ( { opacity : Math . precision ( L / 100 , 4 ) } ) ; else if ( L == 0 || L == 100 ) if ( o ) { fa = R . attr ( "pngSrc" ) ; fa != null && ( fa . indexOf ( "AlphaBar.png" ) != - 1 || fa . indexOf ( "Bars.png" ) != - 1 || fa . indexOf ( "Maps.png" ) != - 1 ) ? R . css ( { filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + fa + "', sizingMethod='scale')" } ) : R . css ( { opacity : "" } ) } else R . css ( { opacity : "" } ) } , jb = function ( ) { sa . active . val ( "ahex" , sa . current . val ( "ahex" ) ) } , hb = function ( ) { sa . current . val ( "ahex" , sa . active . val ( "ahex" ) ) } ,
Ra = function ( R ) { a ( this ) . parents ( "tbody:first" ) . find ( 'input:radio[value!="' + R . target . value + '"]' ) . removeAttr ( "checked" ) ; Va . call ( d , R . target . value ) } , db = function ( ) { jb . call ( d ) } , Ka = function ( ) { jb . call ( d ) ; l . window . expandable && Ab . call ( d ) ; a . isFunction ( vb ) && vb . call ( d , sa . active , qa ) } , sb = function ( ) { hb . call ( d ) ; l . window . expandable && Ab . call ( d ) ; a . isFunction ( Cb ) && Cb . call ( d , sa . active , pa ) } , tb = function ( ) { Gb . call ( d ) } , nb = function ( R ) { var L = R . val ( "hex" ) ; ua . css ( { backgroundColor : L && "#" + L || "transparent" } ) ; Ca . call ( d , ua , Math . precision ( ( R . val ( "a" ) ||
0 ) * 100 / 255 , 4 ) ) } , fb = function ( R ) { var L = R . val ( "hex" ) ; R = R . val ( "va" ) ; Ma . css ( { backgroundColor : L && "#" + L || "transparent" } ) ; Ca . call ( d , Oa , Math . precision ( ( 255 - ( R && R . a || 0 ) ) * 100 / 255 , 4 ) ) ; if ( l . window . bindToInput && l . window . updateInputColor ) l . window . input . css ( { backgroundColor : L && "#" + L || "transparent" , color : R == null || R . v > 75 ? "#000000" : "#ffffff" } ) } , Za = function ( R ) { ja = parseInt ( A . css ( "left" ) ) ; ea = parseInt ( A . css ( "top" ) ) ; Z = R . pageX ; Y = R . pageY ; a ( document ) . bind ( "mousemove" , Ta ) . bind ( "mouseup" , ib ) ; R . preventDefault ( ) } , Ta = function ( R ) { A . css ( { left : ja -
( Z - R . pageX ) + "px" , top : ea - ( Y - R . pageY ) + "px" } ) ; l . window . expandable && ! a . support . boxModel && A . prev ( ) . css ( { left : A . css ( "left" ) , top : A . css ( "top" ) } ) ; R . stopPropagation ( ) ; R . preventDefault ( ) ; return false } , ib = function ( R ) { a ( document ) . unbind ( "mousemove" , Ta ) . unbind ( "mouseup" , ib ) ; R . stopPropagation ( ) ; R . preventDefault ( ) ; return false } , Ib = function ( R ) { R . preventDefault ( ) ; R . stopPropagation ( ) ; sa . active . val ( "ahex" , a ( this ) . attr ( "title" ) || null , R . target ) ; return false } , Cb = a . isFunction ( f [ 1 ] ) && f [ 1 ] || null , kb = a . isFunction ( f [ 2 ] ) && f [ 2 ] ||
null , vb = a . isFunction ( f [ 3 ] ) && f [ 3 ] || null , Gb = function ( ) { sa . current . val ( "ahex" , sa . active . val ( "ahex" ) ) ; var R = function ( ) { if ( ! ( ! l . window . expandable || a . support . boxModel ) ) { var L = A . find ( "table:first" ) ; A . before ( "<iframe/>" ) ; A . prev ( ) . css ( { width : L . width ( ) , height : A . height ( ) , opacity : 0 , position : "absolute" , left : A . css ( "left" ) , top : A . css ( "top" ) } ) } } ; if ( l . window . expandable ) { a ( document . body ) . children ( "div.jPicker.Container" ) . css ( { zIndex : 10 } ) ; A . css ( { zIndex : 20 } ) } switch ( l . window . effects . type ) { case "fade" : A . fadeIn ( l . window . effects . speed . show ,
R ) ; break ; case "slide" : A . slideDown ( l . window . effects . speed . show , R ) ; break ; default : A . show ( l . window . effects . speed . show , R ) } } , Ab = function ( ) { var R = function ( ) { l . window . expandable && A . css ( { zIndex : 10 } ) ; ! l . window . expandable || a . support . boxModel || A . prev ( ) . remove ( ) } ; switch ( l . window . effects . type ) { case "fade" : A . fadeOut ( l . window . effects . speed . hide , R ) ; break ; case "slide" : A . slideUp ( l . window . effects . speed . hide , R ) ; break ; default : A . hide ( l . window . effects . speed . hide , R ) } } , Jb = function ( ) { var R = l . window , L = R . expandable ? a ( d ) . next ( ) . find ( ".Container:first" ) :
null ; A = R . expandable ? a ( "<div/>" ) : a ( d ) ; A . addClass ( "jPicker Container" ) ; R . expandable && A . hide ( ) ; A . get ( 0 ) . onselectstart = function ( Eb ) { if ( Eb . target . nodeName . toLowerCase ( ) !== "input" ) return false } ; var fa = sa . active . val ( "all" ) ; if ( R . alphaPrecision < 0 ) R . alphaPrecision = 0 ; else if ( R . alphaPrecision > 2 ) R . alphaPrecision = 2 ; var Fa = '<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>' + ( R . expandable ? '<tr><td class="Move" colspan="5"> </td></tr>' : "" ) + '<tr><td rowspan="9"><h2 class="Title">' + ( R . title || ga . text . title ) +
'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="' + oa . clientPath + oa . colorMap . arrow . file + '" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="' + oa . clientPath + oa . colorBar . arrow . file + '" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">' +
ga . text . newColor + '<div class="color_preview"><span class="Active" title="' + ga . tooltips . colors . newColor + '"> </span><span class="Current" title="' + ga . tooltips . colors . currentColor + '"> </span></div></div>' + ga . text . currentColor + '</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="' + ga . text . ok + '" title="' + ga . tooltips . buttons . ok + '"/><input type="button" class="Cancel" value="' + ga . text . cancel + '" title="' + ga . tooltips . buttons . cancel + '"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="' +
ga . tooltips . hue . radio + '"><input type="radio" value="h"' + ( l . color . mode == "h" ? ' checked="checked"' : "" ) + '/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . h : "" ) + '" title="' + ga . tooltips . hue . textbox + '"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="' + ga . tooltips . saturation . radio + '"><input type="radio" value="s"' + ( l . color . mode == "s" ? ' checked="checked"' : "" ) + '/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa !=
null ? fa . s : "" ) + '" title="' + ga . tooltips . saturation . textbox + '"/> %</td></tr><tr class="Value"><td class="Radio"><label title="' + ga . tooltips . value . radio + '"><input type="radio" value="v"' + ( l . color . mode == "v" ? ' checked="checked"' : "" ) + '/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . v : "" ) + '" title="' + ga . tooltips . value . textbox + '"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="' + ga . tooltips . red . radio + '"><input type="radio" value="r"' +
( l . color . mode == "r" ? ' checked="checked"' : "" ) + '/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . r : "" ) + '" title="' + ga . tooltips . red . textbox + '"/></td></tr><tr class="Green"><td class="Radio"><label title="' + ga . tooltips . green . radio + '"><input type="radio" value="g"' + ( l . color . mode == "g" ? ' checked="checked"' : "" ) + '/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . g : "" ) + '" title="' + ga . tooltips . green . textbox + '"/></td></tr><tr class="Blue"><td class="Radio"><label title="' +
ga . tooltips . blue . radio + '"><input type="radio" value="b"' + ( l . color . mode == "b" ? ' checked="checked"' : "" ) + '/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="' + ( fa != null ? fa . b : "" ) + '" title="' + ga . tooltips . blue . textbox + '"/></td></tr><tr class="Alpha"><td class="Radio">' + ( R . alphaSupport ? '<label title="' + ga . tooltips . alpha . radio + '"><input type="radio" value="a"' + ( l . color . mode == "a" ? ' checked="checked"' : "" ) + "/>A:</label>" : " " ) + '</td><td class="Text">' + ( R . alphaSupport ? '<input type="text" maxlength="' +
( 3 + R . alphaPrecision ) + '" value="' + ( fa != null ? Math . precision ( fa . a * 100 / 255 , R . alphaPrecision ) : "" ) + '" title="' + ga . tooltips . alpha . textbox + '"/> %' : " " ) + '</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="' + ga . tooltips . hex . textbox + '">#:<input type="text" maxlength="6" class="Hex" value="' + ( fa != null ? fa . hex : "" ) + '"/></label>' + ( R . alphaSupport ? '<input type="text" maxlength="2" class="AHex" value="' + ( fa != null ? fa . ahex . substring ( 6 ) : "" ) + '" title="' + ga . tooltips . hex . alpha + '"/></td>' : " " ) +
"</tr></tbody></table>" ; if ( R . expandable ) { A . html ( Fa ) ; a ( document . body ) . children ( "div.jPicker.Container" ) . length == 0 ? a ( document . body ) . prepend ( A ) : a ( document . body ) . children ( "div.jPicker.Container:last" ) . after ( A ) ; A . mousedown ( function ( ) { a ( document . body ) . children ( "div.jPicker.Container" ) . css ( { zIndex : 10 } ) ; A . css ( { zIndex : 20 } ) } ) ; A . css ( { left : R . position . x == "left" ? L . offset ( ) . left - 530 - ( R . position . y == "center" ? 25 : 0 ) + "px" : R . position . x == "center" ? L . offset ( ) . left - 260 + "px" : R . position . x == "right" ? L . offset ( ) . left - 10 + ( R . position . y ==
"center" ? 25 : 0 ) + "px" : R . position . x == "screenCenter" ? ( a ( document ) . width ( ) >> 1 ) - 260 + "px" : L . offset ( ) . left + parseInt ( R . position . x ) + "px" , position : "absolute" , top : R . position . y == "top" ? L . offset ( ) . top - 312 + "px" : R . position . y == "center" ? L . offset ( ) . top - 156 + "px" : R . position . y == "bottom" ? L . offset ( ) . top + 25 + "px" : L . offset ( ) . top + parseInt ( R . position . y ) + "px" } ) } else { A = a ( d ) ; A . html ( Fa ) } Fa = A . find ( "tbody:first" ) ; p = Fa . find ( "div.Map:first" ) ; K = Fa . find ( "div.Bar:first" ) ; var Xa = p . find ( "span" ) , cb = K . find ( "span" ) ; Q = Xa . filter ( ".Map1:first" ) ;
N = Xa . filter ( ".Map2:first" ) ; H = Xa . filter ( ".Map3:first" ) ; S = cb . filter ( ".Map1:first" ) ; ba = cb . filter ( ".Map2:first" ) ; O = cb . filter ( ".Map3:first" ) ; T = cb . filter ( ".Map4:first" ) ; ha = cb . filter ( ".Map5:first" ) ; U = cb . filter ( ".Map6:first" ) ; P = new n ( p , { map : { width : oa . colorMap . width , height : oa . colorMap . height } , arrow : { image : oa . clientPath + oa . colorMap . arrow . file , width : oa . colorMap . arrow . width , height : oa . colorMap . arrow . height } } ) ; P . bind ( Aa ) ; aa = new n ( K , { map : { width : oa . colorBar . width , height : oa . colorBar . height } , arrow : { image : oa . clientPath +
oa . colorBar . arrow . file , width : oa . colorBar . arrow . width , height : oa . colorBar . arrow . height } } ) ; aa . bind ( La ) ; wa = new g ( Fa , sa . active , R . expandable && R . bindToInput ? R . input : null , R . alphaPrecision ) ; Xa = fa != null ? fa . hex : null ; var rb = Fa . find ( ".Preview" ) ; cb = Fa . find ( ".Button" ) ; la = rb . find ( ".Active:first" ) . css ( { backgroundColor : Xa && "#" + Xa || "transparent" } ) ; ua = rb . find ( ".Current:first" ) . css ( { backgroundColor : Xa && "#" + Xa || "transparent" } ) . bind ( "click" , db ) ; Ca . call ( d , ua , Math . precision ( sa . current . val ( "a" ) * 100 ) / 255 , 4 ) ; pa = cb . find ( ".Ok:first" ) . bind ( "click" ,
sb ) ; qa = cb . find ( ".Cancel:first" ) . bind ( "click" , Ka ) ; Ha = cb . find ( ".Grid:first" ) ; setTimeout ( function ( ) { Pa . call ( d , Q , oa . clientPath + "Maps.png" ) ; Pa . call ( d , N , oa . clientPath + "Maps.png" ) ; Pa . call ( d , H , oa . clientPath + "map-opacity.png" ) ; Pa . call ( d , S , oa . clientPath + "Bars.png" ) ; Pa . call ( d , ba , oa . clientPath + "Bars.png" ) ; Pa . call ( d , O , oa . clientPath + "Bars.png" ) ; Pa . call ( d , T , oa . clientPath + "Bars.png" ) ; Pa . call ( d , ha , oa . clientPath + "bar-opacity.png" ) ; Pa . call ( d , U , oa . clientPath + "AlphaBar.png" ) ; Pa . call ( d , rb . find ( "div:last" ) , oa . clientPath +
"preview-opacity.png" ) } , 0 ) ; Fa . find ( "td.Radio input" ) . bind ( "click" , Ra ) ; if ( sa . quickList && sa . quickList . length > 0 ) { cb = "" ; for ( i = 0 ; i < sa . quickList . length ; i ++ ) { if ( ( typeof sa . quickList [ i ] ) . toString ( ) . toLowerCase ( ) == "string" ) sa . quickList [ i ] = new b ( { hex : sa . quickList [ i ] } ) ; var ub = sa . quickList [ i ] . val ( "a" ) , Bb = sa . quickList [ i ] . val ( "ahex" ) ; if ( ! R . alphaSupport && Bb ) Bb = Bb . substring ( 0 , 6 ) + "ff" ; var lb = sa . quickList [ i ] . val ( "hex" ) ; cb += '<span class="QuickColor"' + ( Bb && ' title="#' + Bb + '"' || "" ) + ' style="background-color:' + ( lb && "#" +
lb || "" ) + ";" + ( lb ? "" : "background-image:url(" + oa . clientPath + "NoColor.png)" ) + ( R . alphaSupport && ub && ub < 255 ? ";opacity:" + Math . precision ( ub / 255 , 4 ) + ";filter:Alpha(opacity=" + Math . precision ( ub / 2.55 , 4 ) + ")" : "" ) + '"> </span>' } Pa . call ( d , Ha , oa . clientPath + "bar-opacity.png" ) ; Ha . html ( cb ) ; Ha . find ( ".QuickColor" ) . click ( Ib ) } Va . call ( d , l . color . mode ) ; sa . active . bind ( Na ) ; a . isFunction ( kb ) && sa . active . bind ( kb ) ; sa . current . bind ( nb ) ; if ( R . expandable ) { d . icon = L . parents ( ".Icon:first" ) ; Ma = d . icon . find ( ".Color:first" ) . css ( { backgroundColor : Xa &&
"#" + Xa || "transparent" } ) ; Oa = d . icon . find ( ".Alpha:first" ) ; Pa . call ( d , Oa , oa . clientPath + "bar-opacity.png" ) ; Ca . call ( d , Oa , Math . precision ( ( 255 - ( fa != null ? fa . a : 0 ) ) * 100 / 255 , 4 ) ) ; Ja = d . icon . find ( ".Image:first" ) . css ( { backgroundImage : "url('" + oa . clientPath + oa . picker . file + "')" } ) . bind ( "click" , tb ) ; if ( R . bindToInput && R . updateInputColor ) R . input . css ( { backgroundColor : Xa && "#" + Xa || "transparent" , color : fa == null || fa . v > 75 ? "#000000" : "#ffffff" } ) ; Qa = Fa . find ( ".Move:first" ) . bind ( "mousedown" , Za ) ; sa . active . bind ( fb ) } else Gb . call ( d ) } , oa =
l . images , ga = l . localization , sa = { active : ( typeof l . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new b ( { ahex : ! l . window . alphaSupport && l . color . active ? l . color . active . substring ( 0 , 6 ) + "ff" : l . color . active } ) : new b ( { ahex : ! l . window . alphaSupport && l . color . active . val ( "ahex" ) ? l . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : l . color . active . val ( "ahex" ) } ) , current : ( typeof l . color . active ) . toString ( ) . toLowerCase ( ) == "string" ? new b ( { ahex : ! l . window . alphaSupport && l . color . active ? l . color . active . substring ( 0 , 6 ) + "ff" : l . color . active } ) :
new b ( { ahex : ! l . window . alphaSupport && l . color . active . val ( "ahex" ) ? l . color . active . val ( "ahex" ) . substring ( 0 , 6 ) + "ff" : l . color . active . val ( "ahex" ) } ) , quickList : l . color . quickList } ; a . extend ( true , d , { commitCallback : Cb , liveCallback : kb , cancelCallback : vb , color : sa , show : Gb , hide : Ab , destroy : function ( ) { A . find ( "td.Radio input" ) . unbind ( "click" , Ra ) ; ua . unbind ( "click" , db ) ; qa . unbind ( "click" , Ka ) ; pa . unbind ( "click" , sb ) ; if ( l . window . expandable ) { Ja . unbind ( "click" , tb ) ; Qa . unbind ( "mousedown" , Za ) ; d . icon = null } A . find ( ".QuickColor" ) . unbind ( "click" ,
Ib ) ; U = ha = T = O = ba = S = H = N = Q = K = p = null ; P . destroy ( ) ; P = null ; aa . destroy ( ) ; aa = null ; wa . destroy ( ) ; kb = vb = Cb = Ha = qa = pa = ua = la = wa = null ; A . html ( "" ) ; for ( i = 0 ; i < m . length ; i ++ ) m [ i ] == d && m . splice ( i , 1 ) } } ) ; m . push ( d ) ; setTimeout ( function ( ) { Jb . call ( d ) } , 0 ) } ) } ; a . fn . jPicker . defaults = { window : { title : null , effects : { type : "slide" , speed : { show : "slow" , hide : "fast" } } , position : { x : "screenCenter" , y : "top" } , expandable : false , liveUpdate : true , alphaSupport : false , alphaPrecision : 0 , updateInputColor : true } , color : { mode : "h" , active : new b ( { ahex : "#ffcc00ff" } ) ,
quickList : [ new b ( { h : 360 , s : 33 , v : 100 } ) , new b ( { h : 360 , s : 66 , v : 100 } ) , new b ( { h : 360 , s : 100 , v : 100 } ) , new b ( { h : 360 , s : 100 , v : 75 } ) , new b ( { h : 360 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 100 } ) , new b ( { h : 30 , s : 33 , v : 100 } ) , new b ( { h : 30 , s : 66 , v : 100 } ) , new b ( { h : 30 , s : 100 , v : 100 } ) , new b ( { h : 30 , s : 100 , v : 75 } ) , new b ( { h : 30 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 90 } ) , new b ( { h : 60 , s : 33 , v : 100 } ) , new b ( { h : 60 , s : 66 , v : 100 } ) , new b ( { h : 60 , s : 100 , v : 100 } ) , new b ( { h : 60 , s : 100 , v : 75 } ) , new b ( { h : 60 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 80 } ) , new b ( { h : 90 , s : 33 , v : 100 } ) , new b ( { h : 90 ,
s : 66 , v : 100 } ) , new b ( { h : 90 , s : 100 , v : 100 } ) , new b ( { h : 90 , s : 100 , v : 75 } ) , new b ( { h : 90 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 70 } ) , new b ( { h : 120 , s : 33 , v : 100 } ) , new b ( { h : 120 , s : 66 , v : 100 } ) , new b ( { h : 120 , s : 100 , v : 100 } ) , new b ( { h : 120 , s : 100 , v : 75 } ) , new b ( { h : 120 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 60 } ) , new b ( { h : 150 , s : 33 , v : 100 } ) , new b ( { h : 150 , s : 66 , v : 100 } ) , new b ( { h : 150 , s : 100 , v : 100 } ) , new b ( { h : 150 , s : 100 , v : 75 } ) , new b ( { h : 150 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 50 } ) , new b ( { h : 180 , s : 33 , v : 100 } ) , new b ( { h : 180 , s : 66 , v : 100 } ) , new b ( { h : 180 , s : 100 , v : 100 } ) ,
new b ( { h : 180 , s : 100 , v : 75 } ) , new b ( { h : 180 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 40 } ) , new b ( { h : 210 , s : 33 , v : 100 } ) , new b ( { h : 210 , s : 66 , v : 100 } ) , new b ( { h : 210 , s : 100 , v : 100 } ) , new b ( { h : 210 , s : 100 , v : 75 } ) , new b ( { h : 210 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 30 } ) , new b ( { h : 240 , s : 33 , v : 100 } ) , new b ( { h : 240 , s : 66 , v : 100 } ) , new b ( { h : 240 , s : 100 , v : 100 } ) , new b ( { h : 240 , s : 100 , v : 75 } ) , new b ( { h : 240 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 20 } ) , new b ( { h : 270 , s : 33 , v : 100 } ) , new b ( { h : 270 , s : 66 , v : 100 } ) , new b ( { h : 270 , s : 100 , v : 100 } ) , new b ( { h : 270 , s : 100 , v : 75 } ) , new b ( { h : 270 ,
s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 10 } ) , new b ( { h : 300 , s : 33 , v : 100 } ) , new b ( { h : 300 , s : 66 , v : 100 } ) , new b ( { h : 300 , s : 100 , v : 100 } ) , new b ( { h : 300 , s : 100 , v : 75 } ) , new b ( { h : 300 , s : 100 , v : 50 } ) , new b ( { h : 180 , s : 0 , v : 0 } ) , new b ( { h : 330 , s : 33 , v : 100 } ) , new b ( { h : 330 , s : 66 , v : 100 } ) , new b ( { h : 330 , s : 100 , v : 100 } ) , new b ( { h : 330 , s : 100 , v : 75 } ) , new b ( { h : 330 , s : 100 , v : 50 } ) , new b ] } , images : { clientPath : "/jPicker/images/" , colorMap : { width : 256 , height : 256 , arrow : { file : "mappoint.gif" , width : 15 , height : 15 } } , colorBar : { width : 20 , height : 256 , arrow : { file : "rangearrows.gif" ,
2012-07-19 15:22:42 +00:00
width : 20 , height : 7 } } , picker : { file : "picker.gif" , width : 25 , height : 24 } } , localization : { text : { title : "Drag Markers To Pick A Color" , newColor : "new" , currentColor : "current" , ok : "OK" , cancel : "Cancel" } , tooltips : { colors : { newColor : "New Color - Press “OK” To Commit" , currentColor : "Click To Revert To Original Color" } , buttons : { ok : "Commit To This Color Selection" , cancel : "Cancel And Revert To Original Color" } , hue : { radio : "Set To “Hue” Color Mode" , textbox : "Enter A “Hue” Value (0-360°)" } ,
saturation : { radio : "Set To “Saturation” Color Mode" , textbox : "Enter A “Saturation” Value (0-100%)" } , value : { radio : "Set To “Value” Color Mode" , textbox : "Enter A “Value” Value (0-100%)" } , red : { radio : "Set To “Red” Color Mode" , textbox : "Enter A “Red” Value (0-255)" } , green : { radio : "Set To “Green” Color Mode" , textbox : "Enter A “Green” Value (0-255)" } , blue : { radio : "Set To “Blue” Color Mode" , textbox : "Enter A “Blue” Value (0-255)" } ,
2012-07-24 02:30:12 +00:00
alpha : { radio : "Set To “Alpha” Color Mode" , textbox : "Enter A “Alpha” Value (0-100)" } , hex : { textbox : "Enter A “Hex” Color Value (#000000-#ffffff)" , alpha : "Enter A “Alpha” Value (#00-#ff)" } } } } } ) ( jQuery , "1.1.6" ) ; ( function ( a ) { function n ( m ) { var s = m || window . event , c = [ ] . slice . call ( arguments , 1 ) , f = 0 , d = 0 , l = 0 ; m = a . event . fix ( s ) ; m . type = "mousewheel" ; if ( s . wheelDelta ) f = s . wheelDelta / 120 ; if ( s . detail ) f = - s . detail / 3 ; l = f ; if ( s . axis !== undefined && s . axis === s . HORIZONTAL _AXIS ) { l = 0 ; d = - 1 * f } if ( s . wheelDeltaY !== undefined ) l = s . wheelDeltaY / 120 ; if ( s . wheelDeltaX !== undefined ) d = - 1 * s . wheelDeltaX / 120 ; c . unshift ( m , f , d , l ) ; return ( a . event . dispatch || a . event . handle ) . apply ( this , c ) } var g = [ "DOMMouseScroll" , "mousewheel" ] ; if ( a . event . fixHooks ) for ( var b = g . length ; b ; ) a . event . fixHooks [ g [ -- b ] ] =
a . event . mouseHooks ; a . event . special . mousewheel = { setup : function ( ) { if ( this . addEventListener ) for ( var m = g . length ; m ; ) this . addEventListener ( g [ -- m ] , n , false ) ; else this . onmousewheel = n } , teardown : function ( ) { if ( this . removeEventListener ) for ( var m = g . length ; m ; ) this . removeEventListener ( g [ -- m ] , n , false ) ; else this . onmousewheel = null } } ; a . fn . extend ( { mousewheel : function ( m ) { return m ? this . bind ( "mousewheel" , m ) : this . trigger ( "mousewheel" ) } , unmousewheel : function ( m ) { return this . unbind ( "mousewheel" , m ) } } ) } ) ( jQuery ) ; svgEditor . addExtension ( "eyedropper" , function ( a ) { function n ( c ) { if ( g . getMode ( ) != "eyedropper" ) { var f = $ ( "#tool_eyedropper" ) ; c . elems [ 0 ] && $ . inArray ( c . elems [ 0 ] . nodeName , [ "svg" , "g" , "use" ] ) == - 1 ? f . removeClass ( "disabled" ) : f . addClass ( "disabled" ) } } var g = svgEditor . canvas , b = svgedit . history . ChangeElementCommand , m = { fillPaint : "red" , fillOpacity : 1 , strokePaint : "black" , strokeOpacity : 1 , strokeWidth : 5 , strokeDashArray : null , opacity : 1 , strokeLinecap : "butt" , strokeLinejoin : "miter" } , s = function ( c , f , d ) { var l = null ; console . log ( c ) ; if ( c . indexOf ( "url(#" ) ===
0 ) { c = ( c = g . getRefElem ( c ) ) ? c . cloneNode ( true ) : $ ( "#" + d + "_color defs *" ) [ 0 ] ; l = { alpha : f } ; l [ c . tagName ] = c } else l = c . indexOf ( "#" ) === 0 ? { alpha : f , solidColor : c . substr ( 1 ) } : { alpha : f , solidColor : "none" } ; return new $ . jGraduate . Paint ( l ) } ; return { name : "eyedropper" , svgicons : "extensions/eyedropper-icon.xml" , buttons : [ { id : "tool_eyedropper" , type : "mode" , title : "Eye Dropper Tool" , key : "I" , "class" : "disabled" , events : { click : function ( ) { g . setMode ( "eyedropper" ) } } } ] , selectedChanged : n , elementChanged : n , mouseDown : function ( c ) { var f = g . getMode ( ) ,
d = c . event ; d = d . target . id === "svgroot" ? document . getElementById ( "canvas_background" ) : d . target ; if ( f == "eyedropper" && d ) { m . fillPaint = d . getAttribute ( "fill" ) || "white" ; m . fillOpacity = d . getAttribute ( "fill-opacity" ) || 1 ; m . strokePaint = d . getAttribute ( "stroke" ) || "none" ; m . strokeOpacity = d . getAttribute ( "stroke-opacity" ) || 1 ; m . strokeWidth = d . getAttribute ( "stroke-width" ) ; m . strokeDashArray = d . getAttribute ( "stroke-dasharray" ) ; m . strokeLinecap = d . getAttribute ( "stroke-linecap" ) ; m . strokeLinejoin = d . getAttribute ( "stroke-linejoin" ) ;
m . opacity = d . getAttribute ( "opacity" ) || 1 ; if ( $ . inArray ( c . selectedElements . nodeName , [ "g" , "use" ] ) == - 1 ) { var l = { } , o = function ( p , K , Q ) { l [ K ] = p . getAttribute ( K ) ; p . setAttribute ( K , Q ) } , A = new a . BatchCommand ; c . selectedElements . forEach ( function ( p ) { m . fillPaint && o ( p , "fill" , m . fillPaint ) ; m . fillOpacity && o ( p , "fill-opacity" , m . fillOpacity ) ; m . strokePaint && o ( p , "stroke" , m . strokePaint ) ; m . strokeOpacity && o ( p , "stroke-opacity" , m . strokeOpacity ) ; m . strokeWidth && o ( p , "stroke-width" , m . strokeWidth ) ; m . strokeDashArray && o ( p , "stroke-dasharray" ,
m . strokeDashArray ) ; m . opacity && o ( p , "opacity" , m . opacity ) ; m . strokeLinecap && o ( p , "stroke-linecap" , m . strokeLinecap ) ; m . strokeLinejoin && o ( p , "stroke-linejoin" , m . strokeLinejoin ) ; A . addSubCommand ( new b ( p , l ) ) ; console . log ( l ) ; l = { } } ) ; s ( m . fillPaint , m . fillOpacity * 100 , "fill" ) ; s ( m . strokePaint , m . strokeOpacity * 100 , "stroke" ) ; svgEditor . paintBox . fill . update ( true ) ; svgEditor . paintBox . stroke . update ( true ) ; g . undoMgr . addCommandToHistory ( A ) } } } } } ) ; svgEditor . addExtension ( "Markers" , function ( a ) { function n ( T , ha ) { var U = T . getAttribute ( ha ) ; if ( ! U ) return null ; U = U . match ( /\(\#(.*)\)/ ) ; if ( ! U || U . length !== 2 ) return null ; return a . getElem ( U [ 1 ] ) } function g ( T ) { $ ( "#marker_panel" ) . toggle ( T ) ; $ ( "#marker_panel_title" ) . length < 1 && $ ( "#marker_panel" ) . prepend ( "<h4 id='marker_panel_title'>Arrows</h4>" ) ; if ( T ) { var ha = Q [ 0 ] , U , P ; $ . each ( N , function ( aa , wa ) { var ja = n ( ha , "marker-" + wa ) , ea = $ ( "#" + wa + "_marker" ) ; if ( ja ) { if ( ! ja . attributes . se _type ) return ; P = U = "\\" + ja . attributes . se _type . textContent ;
if ( U == "\\textmarker" ) U = ja . lastChild . textContent ; else ea . hide ( ) } else { P = U = "\\nomarker" ; ea . hide ( ) } ea . val ( U ) ; l ( wa , P ) } ) } } function b ( T , ha ) { var U = a . getElem ( T ) ; if ( ! U ) if ( ! ( ha == "" || ha == "\\nomarker" ) ) { var P = Q [ 0 ] . getAttribute ( "stroke" ) , aa = 50 , wa = 50 , ja = "0 0 100 100" , ea = 5 , Z = 5 ; se _type = ha . substr ( 0 , 1 ) == "\\" ? ha . substr ( 1 ) : "textmarker" ; if ( ba [ se _type ] ) { U = K ( { element : "marker" , attr : { id : T , markerUnits : "strokeWidth" , orient : "auto" , style : "pointer-events:none" , se _type : se _type } } ) ; if ( se _type != "textmarker" ) { var Y = K ( ba [ se _type ] ) , la =
P ; if ( se _type . substr ( - 2 ) == "_o" ) la = "none" ; Y . setAttribute ( "fill" , la ) ; Y . setAttribute ( "stroke" , P ) ; Y . setAttribute ( "stroke-width" , 10 ) ; U . appendChild ( Y ) } else { Y = K ( ba [ se _type ] ) ; Y . textContent = ha ; la = Y . getBBox ( ) ; la . x = 0 ; la . y = 0 ; la . width += 2 ; la . height += 2 ; Y . setAttribute ( "x" , 1 ) ; Y . setAttribute ( "y" , la . height - 1 - la . height / 4 ) ; Y . setAttribute ( "fill" , P ) ; aa = la . width / 2 + 1 ; wa = la . height / 2 + 1 ; ja = la . x + " " + la . y + " " + la . width + " " + la . height ; ea = la . width / 10 ; Z = la . height / 10 ; P = K ( { element : "rect" , attr : { x : la . x , y : la . y , width : la . width , height : la . height ,
fill : "#ffffff" , stroke : "none" , "stroke-width" : 0 } } ) ; U . setAttribute ( "orient" , 0 ) ; U . appendChild ( P ) ; U . appendChild ( Y ) } U . setAttribute ( "viewBox" , ja ) ; U . setAttribute ( "markerWidth" , ea ) ; U . setAttribute ( "markerHeight" , Z ) ; U . setAttribute ( "refX" , aa ) ; U . setAttribute ( "refY" , wa ) ; a . findDefs ( ) . appendChild ( U ) ; return U } } } function m ( ) { var T = { start _marker : "start" , mid _marker : "mid" , end _marker : "end" } [ this . id ] , ha = "marker-" + T , U = this . value , P = Q [ 0 ] , aa = n ( P , ha ) ; aa && $ ( aa ) . remove ( ) ; P . removeAttribute ( ha ) ; if ( U == "" ) U = "\\nomarker" ; if ( U == "\\nomarker" ) { l ( T ,
U ) ; a . call ( "changed" , Q ) } else { aa = H + T + "_" + P . id ; b ( aa , U ) ; svgCanvas . changeSelectedAttribute ( ha , "url(#" + aa + ")" ) ; P . tagName == "line" && T == "mid" && s ( P ) ; a . call ( "changed" , Q ) ; l ( T , U ) } } function s ( T ) { if ( T . tagName != "line" ) return T ; var ha = T . getAttribute ( "x1" ) - 0 , U = T . getAttribute ( "x2" ) - 0 , P = T . getAttribute ( "y1" ) - 0 , aa = T . getAttribute ( "y2" ) - 0 , wa = T . id , ja = K ( { element : "polyline" , attr : { points : ha + "," + P + ( " " + ( ha + U ) / 2 + "," + ( P + aa ) / 2 + " " ) + U + "," + aa , stroke : T . getAttribute ( "stroke" ) , "stroke-width" : T . getAttribute ( "stroke-width" ) , fill : "none" ,
opacity : T . getAttribute ( "opacity" ) || 1 } } ) ; $ . each ( N , function ( ea , Z ) { var Y = "marker-" + Z ; T . getAttribute ( Y ) && ja . setAttribute ( Y , T . getAttribute ( Y ) ) } ) ; ha = new a . BatchCommand ; ha . addSubCommand ( new a . RemoveElementCommand ( T , T . parentNode ) ) ; ha . addSubCommand ( new a . InsertElementCommand ( ja ) ) ; $ ( T ) . after ( ja ) . remove ( ) ; svgCanvas . clearSelection ( ) ; ja . id = wa ; svgCanvas . addToSelection ( [ ja ] ) ; a . addCommandToHistory ( ha ) ; return ja } function c ( T ) { var ha = T . getAttribute ( "stroke" ) ; $ . each ( N , function ( U , P ) { var aa = n ( T , "marker-" + P ) ; if ( aa ) if ( aa . attributes . se _type ) if ( aa =
aa . lastElementChild ) { var wa = aa . getAttribute ( "fill" ) , ja = aa . getAttribute ( "stroke" ) ; wa && wa != "none" && aa . setAttribute ( "fill" , ha ) ; ja && ja != "none" && aa . setAttribute ( "stroke" , ha ) } } ) } function f ( T ) { $ . each ( N , function ( ha , U ) { var P = H + U + "_" + T . id , aa = "marker-" + U , wa = n ( T , aa ) ; if ( wa && wa . attributes . se _type ) if ( wa = T . getAttribute ( aa ) ) { var ja = T . id . length ; wa = wa . substr ( - ja - 1 , ja ) ; if ( T . id != wa ) { wa = $ ( "#" + U + "_marker" ) . attr ( "value" ) ; b ( P , wa ) ; svgCanvas . changeSelectedAttribute ( aa , "url(#" + P + ")" ) ; if ( T . tagName == "line" && U == "mid" ) T = s ( T ) ; a . call ( "changed" ,
Q ) } } } ) } function d ( T , ha ) { $ ( "#" + T + "_marker" ) . val ( ha ) ; $ ( "#" + T + "_marker" ) . change ( ) ; $ ( "#" + T + "_marker" ) } function l ( T , ha ) { if ( ha . substr ( 0 , 1 ) != "\\" ) ha = "\\textmarker" ; var U = "#" + S + T + "_" + ha . substr ( 1 ) ; svgEditor . setIcon ( "#cur_" + T + "_marker_list" , $ ( U ) . children ( ) ) ; $ ( U ) . addClass ( "current" ) . siblings ( ) . removeClass ( "current" ) } function o ( T ) { var ha = $ ( "#" + T + "_marker" ) . val ( ) ; if ( ha . substr ( 0 , 1 ) == "\\" ) ha = "" ; $ . prompt ( "Enter text for " + T + " marker" , ha , function ( U ) { U && d ( T , U ) } ) } function A ( ) { var T = this . id . split ( "_" ) , ha = T [ 1 ] , U = T [ 2 ] ;
if ( T [ 3 ] ) U += "_" + T [ 3 ] ; U != "textmarker" ? d ( ha , "\\" + U ) : o ( ha ) } function p ( T , ha ) { var U = O [ T ] , P ; for ( P in U ) if ( U [ P ] . id == ha ) return U [ P ] . title ; return ha } var K = a . addSvgElementFromJson , Q , N = [ "start" , "mid" , "end" ] , H = "se_marker_" , S = "mkr_" , ba = { nomarker : { } , leftarrow : { element : "path" , attr : { d : "M0,50 L100,90 L70,50 L100,10 Z" } } , rightarrow : { element : "path" , attr : { d : "M100,50 L0,90 L30,50 L0,10 Z" } } , textmarker : { element : "text" , attr : { x : 0 , y : 0 , "stroke-width" : 0 , stroke : "none" , "font-size" : 75 , "font-family" : "serif" , "text-anchor" : "left" ,
"xml:space" : "preserve" } } , forwardslash : { element : "path" , attr : { d : "M30,100 L70,0" } } , reverseslash : { element : "path" , attr : { d : "M30,0 L70,100" } } , verticalslash : { element : "path" , attr : { d : "M50,0 L50,100" } } , box : { element : "path" , attr : { d : "M20,20 L20,80 L80,80 L80,20 Z" } } , star : { element : "path" , attr : { d : "M10,30 L90,30 L20,90 L50,10 L80,90 Z" } } , xmark : { element : "path" , attr : { d : "M20,80 L80,20 M80,80 L20,20" } } , triangle : { element : "path" , attr : { d : "M10,80 L50,20 L80,80 Z" } } , mcircle : { element : "circle" , attr : { r : 30 , cx : 50 , cy : 50 } } } , O = { en : [ { id : "start_marker_list" ,
2012-07-19 15:22:42 +00:00
title : "Select start marker type" } , { id : "mid_marker_list" , title : "Select mid marker type" } , { id : "end_marker_list" , title : "Select end marker type" } , { id : "nomarker" , title : "No Marker" } , { id : "leftarrow" , title : "Left Arrow" } , { id : "rightarrow" , title : "Right Arrow" } , { id : "textmarker" , title : "Text Marker" } , { id : "forwardslash" , title : "Forward Slash" } , { id : "reverseslash" , title : "Reverse Slash" } , { id : "verticalslash" , title : "Vertical Slash" } , { id : "box" , title : "Box" } , { id : "star" , title : "Star" } , { id : "xmark" , title : "X" } , { id : "triangle" ,
2012-07-24 02:30:12 +00:00
title : "Triangle" } , { id : "mcircle" , title : "Circle" } , { id : "leftarrow_o" , title : "Open Left Arrow" } , { id : "rightarrow_o" , title : "Open Right Arrow" } , { id : "box_o" , title : "Open Box" } , { id : "star_o" , title : "Open Star" } , { id : "triangle_o" , title : "Open Triangle" } , { id : "mcircle_o" , title : "Open Circle" } ] } ; $ . each ( [ "leftarrow" , "rightarrow" , "box" , "star" , "mcircle" , "triangle" ] , function ( T , ha ) { ba [ ha + "_o" ] = ba [ ha ] } ) ; return { name : "Markers" , svgicons : "extensions/markers-icons.xml" , buttons : function ( ) { var T = [ ] ; $ . each ( N , function ( ha , U ) { var P =
U + "_marker_list" , aa = true ; $ . each ( ba , function ( wa ) { var ja = p ( "en" , wa ) ; T . push ( { id : S + U + "_" + wa , svgicon : wa , title : ja , type : "context" , events : { click : A } , panel : "marker_panel" , list : P , isDefault : aa } ) ; aa = false } ) } ) ; return T } ( ) , context _tools : [ { type : "input" , panel : "marker_panel" , title : "Start marker" , id : "start_marker" , label : "Start" , size : 3 , events : { change : m } } , { type : "button-select" , panel : "marker_panel" , title : p ( "en" , "start_marker_list" ) , id : "start_marker_list" , colnum : 3 , events : { change : A } } , { type : "input" , panel : "marker_panel" , title : "Middle marker" ,
id : "mid_marker" , label : "Middle" , defval : "" , size : 3 , events : { change : m } } , { type : "button-select" , panel : "marker_panel" , title : p ( "en" , "mid_marker_list" ) , id : "mid_marker_list" , colnum : 3 , events : { change : A } } , { type : "input" , panel : "marker_panel" , title : "End marker" , id : "end_marker" , label : "End" , size : 3 , events : { change : m } } , { type : "button-select" , panel : "marker_panel" , title : p ( "en" , "end_marker_list" ) , id : "end_marker_list" , colnum : 3 , events : { change : A } } ] , callback : function ( ) { $ ( "#marker_panel" ) . addClass ( "toolset" ) . hide ( ) } , addLangData : function ( T ) { return { data : O [ T ] } } ,
selectedChanged : function ( T ) { Q = T . elems ; for ( var ha = Q . length , U = [ "line" , "path" , "polyline" , "polygon" ] ; ha -- ; ) { var P = Q [ ha ] ; if ( P && $ . inArray ( P . tagName , U ) != - 1 ) T . selectedElement && ! T . multiselected ? g ( true ) : g ( false ) ; else g ( false ) } } , elementChanged : function ( T ) { if ( ( T = T . elems [ 0 ] ) && ( T . getAttribute ( "marker-start" ) || T . getAttribute ( "marker-mid" ) || T . getAttribute ( "marker-end" ) ) ) { c ( T ) ; f ( T ) } changing _flag = false } } } ) ; svgEditor . addExtension ( "view_grid" , function ( a ) { function n ( d ) { c . attr ( "width" ) ; c . attr ( "height" ) ; var l = svgedit . units . getTypeMap ( ) [ svgEditor . curConfig . baseUnit ] , o = [ 0.01 , 0.1 , 1 , 10 , 100 , 1E3 ] ; svgCanvas . getContentElem ( ) . getAttribute ( "x" ) ; var A = m ; l = l * d ; var p = 100 / l , K = 1 ; for ( d = 0 ; d < o . length ; d ++ ) { var Q = o [ d ] ; K = Q ; if ( p <= Q ) break } o = K * l ; A . width = o ; A . height = o ; l = A . getContext ( "2d" ) ; p = o / 10 ; l . globalAlpha = 0.2 ; l . strokeStyle = "#000" ; for ( d = 1 ; d < 10 ; d ++ ) { K = Math . round ( p * d ) + 0.5 ; l . moveTo ( K , o ) ; l . lineTo ( K , 0 ) ; l . moveTo ( o , K ) ; l . lineTo ( 0 , K ) } l . stroke ( ) ;
l . beginPath ( ) ; l . globalAlpha = 0.5 ; l . moveTo ( 0.5 , o ) ; l . lineTo ( 0.5 , 0 ) ; l . moveTo ( o , 0.5 ) ; l . lineTo ( 0 , 0.5 ) ; l . stroke ( ) ; A = A . toDataURL ( "image/png" ) ; f . setAttribute ( "width" , o ) ; f . setAttribute ( "height" , o ) ; f . parentNode . setAttribute ( "width" , o ) ; f . parentNode . setAttribute ( "height" , o ) ; svgCanvas . setHref ( f , A ) } if ( ! document . getElementById ( "canvasGrid" ) ) { var g = document . getElementById ( "svgcanvas" ) . ownerDocument , b = false ; a = a . assignAttributes ; var m = document . createElement ( "canvas" ) ; $ ( m ) . hide ( ) . appendTo ( "body" ) ; var s = g . createElementNS ( "http://www.w3.org/2000/svg" ,
"g" ) ; a ( s , { id : "canvasGrid" , width : "100%" , height : "100%" , x : 0 , y : 0 , overflow : "visible" , display : "none" } ) ; var c = $ ( "#canvas_background" ) ; c . after ( s ) ; s = g . createElementNS ( "http://www.w3.org/2000/svg" , "pattern" ) ; a ( s , { id : "gridpattern" , patternUnits : "userSpaceOnUse" , x : 0 , y : 0 , width : 100 , height : 100 } ) ; var f = g . createElementNS ( "http://www.w3.org/2000/svg" , "image" ) ; a ( f , { x : 0 , y : 0 , width : 100 , height : 100 } ) ; s . appendChild ( f ) ; $ ( "#svgroot defs" ) . append ( s ) ; g = g . createElementNS ( "http://www.w3.org/2000/svg" , "rect" ) ; a ( g , { width : "100%" , height : "100%" ,
x : 0 , y : 0 , "stroke-width" : 0 , stroke : "none" , fill : "url(#gridpattern)" , style : "pointer-events: none; display:visible;" } ) ; $ ( "#canvasGrid" ) . append ( g ) } return { name : "view_grid" , zoomChanged : function ( d ) { b && n ( d ) } , buttons : [ { id : "view_grid" , type : "menu" , after : "tool_wireframe" , panel : "view_menu" , title : "View Grid" , events : { click : function ( ) { if ( $ ( "#view_grid" ) . hasClass ( "push_button_pressed" ) ) { svgEditor . curConfig . showGrid = b = false ; $ ( "#view_grid" ) . removeClass ( "push_button_pressed" ) ; $ ( "#canvasGrid" ) . attr ( "display" , "none" ) } else { svgEditor . curConfig . showGrid =
b = true ; $ ( "#view_grid" ) . addClass ( "push_button_pressed" ) ; $ ( "#canvasGrid" ) . attr ( "display" , "normal" ) ; n ( svgCanvas . getZoom ( ) ) } } } } ] } } ) ; svgEditor . addExtension ( "shapes" , function ( ) { function a ( ) { $ ( "#shape_buttons" ) . empty ( ) ; $ ( "#shape_buttons" ) . append ( K . buttons ) } function n ( N ) { var H = p [ N ] ; if ( H ) { K = H ; H . buttons . length || g ( N , H ) ; a ( ) } else { $ ( "#shape_buttons" ) . html ( "Loading..." ) ; $ . getJSON ( "extensions/shapelib/" + N + ".json" , function ( S ) { K = p [ N ] = { data : S . data , size : S . size , fill : S . fill } ; g ( N , S ) ; a ( ) } ) } } function g ( N , H ) { var S = K . size || 300 , ba = K . fill || false , O = S * 0.05 ; O = [ - O , - O , S + O * 2 , S + O * 2 ] . join ( " " ) ; S = ba ? 0 : S / 30 ; S = ( new DOMParser ) . parseFromString ( '<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="' +
O + '"><path fill="#333" stroke="transparent" stroke-width="' + S + '" /></svg></svg>' , "text/xml" ) ; S . documentElement . setAttribute ( "width" , 40 ) ; S . documentElement . setAttribute ( "height" , 40 ) ; ba = $ ( document . importNode ( S . documentElement , true ) ) ; var T = H . data ; K . buttons = [ ] ; for ( var ha in T ) { var U = T [ ha ] , P = ba . clone ( ) ; if ( U . charAt ( U . length - 1 ) == "x" ) { S = 32 ; O = S * 0.05 ; O = [ - O , - O , S + O * 2 , S + O * 2 ] . join ( " " ) ; P . find ( "svg" ) . attr ( "viewBox" , O ) ; U . replace ( "x" , "" ) } P . find ( "path" ) . attr ( "d" , U ) ; S = P . wrap ( '<div class="tool_button">' ) . parent ( ) . attr ( { id : Q +
"_" + ha , title : ha } ) ; K . buttons . push ( S [ 0 ] ) } } var b , m , s = svgEditor . canvas , c , f , d , l = s . getRootElem ( ) , o = { } , A = { basic : "Basic" , object : "Objects" , symbol : "Symbols" , arrow : "Arrows" , flowchart : "Flowchart" , nature : "Nature" , game : "Cards & Chess" , dialog _balloon : "Dialog balloons" , music : "Music" , weather : "Weather & Time" , ui : "User Interface" , social : "Social Web" } , p = { basic : { data : { star _points _5 : "m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z" ,
2012-07-19 15:25:04 +00:00
donut : "m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z" , triangle : "m1,280.375l149,-260.75l149,260.75z" , right _triangle : "m1,299l0,-298l298,298z" , diamond : "m1,150l149,-149l149,149l-149,149l-149,-149z" ,
pentagon : "m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z" , hexagon : "m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z" , septagon1 : "m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z" , heptagon : "m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z" ,
decagon : "m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z" , dodecagon : "m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z" , trapezoid : "m1,299l55.875,-298l186.25001,0l55.87498,298z" , dialog _balloon _1 : "m0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z" ,
heart : "m150,73c61,-175 300,0 0,225c-300,-225 -61,-400 0,-225z" , cylinder : "m299.0007,83.77844c0,18.28676 -66.70958,33.11111 -149.00002,33.11111m149.00002,-33.11111l0,0c0,18.28676 -66.70958,33.11111 -149.00002,33.11111c-82.29041,0 -148.99997,-14.82432 -148.99997,-33.11111m0,0l0,0c0,-18.28674 66.70956,-33.1111 148.99997,-33.1111c82.29044,0 149.00002,14.82436 149.00002,33.1111l0,132.44449c0,18.28674 -66.70958,33.11105 -149.00002,33.11105c-82.29041,0 -148.99997,-14.82431 -148.99997,-33.11105z" , arrow _up : "m1.49805,149.64304l148.50121,-148.00241l148.50121,148.00241l-74.25061,0l0,148.71457l-148.5012,0l0,-148.71457z" ,
arrow _u _turn : "m1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z" , arrow _left _up : "m0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z" ,
plaque : "m-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z" , page : "m249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234" , cross : "m0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z" ,
divide : "m150,0.99785l0,0c25.17819,0 45.58916,20.41097 45.58916,45.58916c0,25.17821 -20.41096,45.58916 -45.58916,45.58916c-25.17822,0 -45.58916,-20.41093 -45.58916,-45.58916c0,-25.1782 20.41093,-45.58916 45.58916,-45.58916zm0,296.25203c-25.17822,0 -45.58916,-20.41095 -45.58916,-45.58917c0,-25.17819 20.41093,-45.58916 45.58916,-45.58916c25.17819,0 45.58916,20.41096 45.58916,45.58916c0,25.17822 -20.41096,45.58917 -45.58916,45.58917zm-134.06754,-193.71518l268.13507,0l0,91.17833l-268.13507,0z" , minus : "m0.99887,102.39503l297.49445,0l0,95.2112l-297.49445,0z" ,
2012-07-24 02:30:12 +00:00
times : "m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368l72.36765,72.36697l-76.87433,76.87431l76.87433,76.87431l-72.36765,72.36765l-76.87431,-76.87433l-76.87431,76.87433l-72.36697,-72.36765l76.87368,-76.87431l-76.87368,-76.87431z" } , buttons : [ ] } } , K = p . basic , Q = "shapelib" ; return { svgicons : "extensions/ext-shapes.xml" , buttons : [ { id : "tool_shapelib" , type : "mode_flyout" , position : 6 , title : "Shape library" , events : { click : function ( ) { s . setMode ( Q ) } } } ] , callback : function ( ) { var N = $ ( '<div id="shape_buttons">' ) ;
$ ( "#tools_shapelib > *" ) . wrapAll ( N ) ; var H = $ ( "#tools_shapelib_show" ) ; n ( "basic" ) ; $ ( "#shape_buttons" ) . mouseup ( function ( ba ) { ba = $ ( ba . target ) . closest ( "div.tool_button" ) ; if ( ba . length ) { var O = ba . children ( ) . clone ( ) . attr ( { width : 24 , height : 24 } ) ; H . children ( ":not(.flyout_arrow_horiz)" ) . remove ( ) ; H . append ( O ) . attr ( "data-curopt" , "#" + ba [ 0 ] . id ) . mouseup ( ) ; s . setMode ( Q ) ; m = ba [ 0 ] . id . substr ( ( Q + "_" ) . length ) ; b = K . data [ m ] ; $ ( ".tools_flyout" ) . fadeOut ( ) } } ) ; N = $ ( '<div id="shape_cats">' ) ; var S = "" ; $ . each ( A , function ( ba , O ) { S += "<div data-cat=" +
ba + ">" + O + "</div>" } ) ; N . html ( S ) . children ( ) . bind ( "mouseup" , function ( ) { var ba = $ ( this ) ; ba . siblings ( ) . removeClass ( "current" ) ; ba . addClass ( "current" ) ; n ( ba . attr ( "data-cat" ) ) ; return false } ) ; N . children ( ) . eq ( 0 ) . addClass ( "current" ) ; $ ( "#tools_shapelib" ) . prepend ( N ) ; H . mouseup ( function ( ) { s . setMode ( b ? Q : "select" ) } ) ; $ ( "#tool_shapelib" ) . remove ( ) ; N = $ ( "#tools_shapelib" ) . height ( ) ; $ ( "#tools_shapelib" ) . css ( { "margin-top" : - ( N / 2 ) , "margin-left" : 3 } ) } , mouseDown : function ( N ) { if ( s . getMode ( ) === Q ) { var H = f = N . start _x ; N = d = N . start _y ; var S =
s . getStyle ( ) ; c = s . addSvgElementFromJson ( { element : "path" , curStyles : true , attr : { d : b , id : s . getNextId ( ) , opacity : S . opacity / 2 , style : "pointer-events:none" } } ) ; c . setAttribute ( "d" , b ) ; if ( /[a-z]/ . test ( b ) ) { b = K . data [ m ] = s . pathActions . convertPath ( c ) ; c . setAttribute ( "d" , b ) ; s . pathActions . fixEnd ( c ) } c . setAttribute ( "transform" , "translate(" + H + "," + N + ") scale(0.005) translate(" + - H + "," + - N + ")" ) ; s . recalculateDimensions ( c ) ; s . getTransformList ( c ) ; o = c . getBBox ( ) ; totalScale = { sx : 1 , sy : 1 } ; return { started : true } } } , mouseMove : function ( N ) { if ( s . getMode ( ) ===
Q ) { var H = s . getZoom ( ) , S = N . event , ba = N . mouse _x / H , O = N . mouse _y / H ; N = s . getTransformList ( c ) ; var T = c . getBBox ( ) ; H = T . x ; var ha = T . y , U = T . width , P = T . height , aa = ba - f , wa = O - d , ja = { x : Math . min ( f , ba ) , y : Math . min ( d , O ) , width : Math . abs ( ba - f ) , height : Math . abs ( O - d ) } , ea = T = 0 ; P = P ? ( P + wa ) / P : 1 ; U = U ? ( U + aa ) / U : 1 ; U = ja . width / o . width ; P = ja . height / o . height ; U = U || 1 ; P = P || 1 ; if ( ba < f ) T = o . width ; if ( O < d ) ea = o . height ; ba = l . createSVGTransform ( ) ; O = l . createSVGTransform ( ) ; ja = l . createSVGTransform ( ) ; ba . setTranslate ( - ( H + T ) , - ( ha + ea ) ) ; if ( S . shiftKey ) { replaced = true ;
S = Math . min ( Math . abs ( U ) , Math . abs ( P ) ) ; U = S * ( U < 0 ? - 1 : 1 ) ; P = S * ( P < 0 ? - 1 : 1 ) ; if ( totalScale . sx != totalScale . sy ) { S = totalScale . sx > totalScale . sy ? 1 : totalScale . sx / totalScale . sy ; aa = totalScale . sy > totalScale . sx ? 1 : totalScale . sy / totalScale . sx ; U *= aa ; P *= S ; console . log ( S , aa ) } } totalScale . sx *= U ; totalScale . sy *= P ; O . setScale ( U , P ) ; ja . setTranslate ( H + T , ha + ea ) ; N . appendItem ( ja ) ; N . appendItem ( O ) ; N . appendItem ( ba ) ; s . recalculateDimensions ( c ) ; o = c . getBBox ( ) } } , mouseUp : function ( N ) { if ( s . getMode ( ) === Q ) { if ( N . mouse _x == f && N . mouse _y == d ) return { keep : false ,
element : c , started : false } ; s . setMode ( "select" ) ; return { keep : true , element : c , started : false } } } } } ) ; ( function ( ) { for ( var a = 0 , n = [ "ms" , "moz" , "webkit" , "o" ] , g = 0 ; g < n . length && ! window . requestAnimationFrame ; ++ g ) { window . requestAnimationFrame = window [ n [ g ] + "RequestAnimationFrame" ] ; window . cancelAnimationFrame = window [ n [ g ] + "CancelAnimationFrame" ] || window [ n [ g ] + "CancelRequestAnimationFrame" ] } if ( ! window . requestAnimationFrame ) window . requestAnimationFrame = function ( b ) { var m = ( new Date ) . getTime ( ) , s = Math . max ( 0 , 16 - ( m - a ) ) , c = window . setTimeout ( function ( ) { b ( m + s ) } , s ) ; a = m + s ; return c } ; if ( ! window . cancelAnimationFrame ) window . cancelAnimationFrame =
function ( b ) { clearTimeout ( b ) } } ) ( ) ;