latest changes

master
Mark MacKay 2012-07-14 21:38:51 -05:00
parent 45efa72585
commit b2b5ebcae3
48 changed files with 958 additions and 2682 deletions

View File

@ -65,7 +65,8 @@
snappingStep: 10,
showRulers: true,
show_outside_canvas: false,
no_save_warning: true
no_save_warning: true,
initFont: 'Sans-serif'
},
uiStrings = Editor.uiStrings = {
common: {
@ -4180,7 +4181,7 @@
// Standard shortcuts
{key: modKey + 'shift+z', fn: clickRedo},
{key: 'esc', fn: minimizeModal},
{key: 'esc', fn: minimizeModal}
];
// Tooltips not directly associated with a single function

View File

@ -1,30 +1,30 @@
(function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]=
true;else{l[e+d]=true;l[e+a.hotkeys.shiftNums[d]]=true;if(e==="shift+")l[a.hotkeys.shiftNums[d]]=true}b=0;for(d=m.length;b<d;b++)if(l[m[b]])return c.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 f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,sa,la){var oa;if(sa!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(sa))sa=sa.replace(ba?ea:ca,"");else{oa=p(S[2]);sa=f(sa)?p[ba?fa:O](sa):sa;sa=la===2?sa:la===1?a.extend({},sa,oa):a.extend({},oa,sa);sa=u(sa);if(ba)sa=sa.replace(ra,l)}ba=S[1]+(ba?"#":sa||!S[1]?"?":"")+sa+U}else ba=
S(U!==d?U:n[ua][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?fa:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,sa){if(!f(U)&&typeof U!=="object"){sa=U;U=S;S=d}return this.each(function(){var la=a(this),oa=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=oa&&la.attr(oa)||"";la.attr(oa,u[ba](Z,U,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,p,L,T=a.bbq=a.bbq||{},M,J,da,V=a.event.special,O="querystring",fa="fragment",
ua="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,ra,qa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[fa]=w=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);ra=RegExp(ba.join("|"),"g")};w.noEscape(",/");a.deparam=p=function(ba,S){var U={},sa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,oa){var Z=oa.split("="),Aa=l(Z[0]),Ka=U,
Ra=0,Na=Aa.split("]["),Sa=Na.length-1;if(/\[/.test(Na[0])&&/\]$/.test(Na[Sa])){Na[Sa]=Na[Sa].replace(/\]$/,"");Na=Na.shift().split("[").concat(Na);Sa=Na.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:sa[Z]!==d?sa[Z]:Z;if(Sa)for(;Ra<=Sa;Ra++){Aa=Na[Ra]===""?Ka.length:Na[Ra];Ka=Ka[Aa]=Ra<Sa?Ka[Aa]||(Na[Ra+1]&&isNaN(Na[Ra+1])?{}:[]):Z}else if(a.isArray(U[Aa]))U[Aa].push(Z);else U[Aa]=U[Aa]!==d?[U[Aa],Z]:Z}else if(Aa)U[Aa]=S?d:""});return U};p[O]=c(o,0);p[fa]=L=
c(o,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(qa,ba)})({a:ha,base:ha,iframe:"src",img:"src",input:"src",form:"action",link:ha,script:"src"});da=a.elemUrlAttr;a.fn[O]=c(b,O);a.fn[fa]=c(b,fa);T.pushState=M=function(ba,S){if(f(ba)&&/^#/.test(ba)&&S===d)S=2;var U=ba!==d;U=w(n[ua][ha],U?ba:{},U?S:2);n[ua][ha]=U+(/#/.test(U)?"":"#")};T.getState=J=function(ba,S){return ba===d||typeof ba==="boolean"?L(ba):L(S)[ba]};T.removeState=function(ba){var S={};if(ba!==d){S=J();a.each(a.isArray(ba)?
ba:arguments,function(U,sa){delete S[sa]})}M(S,2)};V.hashchange=a.extend(V.hashchange,{add:function(ba){function S(sa){var la=sa[fa]=w();sa.getState=function(oa,Z){return oa===d||typeof oa==="boolean"?p(la,oa):p(la,Z)[oa]};U.apply(this,arguments)}var U;if(a.isFunction(ba)){U=ba;return S}else{U=ba.handler;ba.handler=S}}})})(jQuery,this);
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 f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,sa,la){var oa;if(sa!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(sa))sa=sa.replace(ba?ea:ca,"");else{oa=p(S[2]);sa=f(sa)?p[ba?ga:O](sa):sa;sa=la===2?sa:la===1?a.extend({},sa,oa):a.extend({},oa,sa);sa=u(sa);if(ba)sa=sa.replace(ra,l)}ba=S[1]+(ba?"#":sa||!S[1]?"?":"")+sa+U}else ba=
S(U!==d?U:n[ta][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?ga:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,sa){if(!f(U)&&typeof U!=="object"){sa=U;U=S;S=d}return this.each(function(){var la=a(this),oa=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=oa&&la.attr(oa)||"";la.attr(oa,u[ba](Z,U,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,p,L,T=a.bbq=a.bbq||{},M,J,da,V=a.event.special,O="querystring",ga="fragment",
ta="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,ra,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=w=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);ra=RegExp(ba.join("|"),"g")};w.noEscape(",/");a.deparam=p=function(ba,S){var U={},sa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,oa){var Z=oa.split("="),Aa=l(Z[0]),Ka=U,
Ra=0,Na=Aa.split("]["),Sa=Na.length-1;if(/\[/.test(Na[0])&&/\]$/.test(Na[Sa])){Na[Sa]=Na[Sa].replace(/\]$/,"");Na=Na.shift().split("[").concat(Na);Sa=Na.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:sa[Z]!==d?sa[Z]:Z;if(Sa)for(;Ra<=Sa;Ra++){Aa=Na[Ra]===""?Ka.length:Na[Ra];Ka=Ka[Aa]=Ra<Sa?Ka[Aa]||(Na[Ra+1]&&isNaN(Na[Ra+1])?{}:[]):Z}else if(a.isArray(U[Aa]))U[Aa].push(Z);else U[Aa]=U[Aa]!==d?[U[Aa],Z]:Z}else if(Aa)U[Aa]=S?d:""});return U};p[O]=c(o,0);p[ga]=L=
c(o,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(pa,ba)})({a:ha,base:ha,iframe:"src",img:"src",input:"src",form:"action",link:ha,script:"src"});da=a.elemUrlAttr;a.fn[O]=c(b,O);a.fn[ga]=c(b,ga);T.pushState=M=function(ba,S){if(f(ba)&&/^#/.test(ba)&&S===d)S=2;var U=ba!==d;U=w(n[ta][ha],U?ba:{},U?S:2);n[ta][ha]=U+(/#/.test(U)?"":"#")};T.getState=J=function(ba,S){return ba===d||typeof ba==="boolean"?L(ba):L(S)[ba]};T.removeState=function(ba){var S={};if(ba!==d){S=J();a.each(a.isArray(ba)?
ba:arguments,function(U,sa){delete S[sa]})}M(S,2)};V.hashchange=a.extend(V.hashchange,{add:function(ba){function S(sa){var la=sa[ga]=w();sa.getState=function(oa,Z){return oa===d||typeof oa==="boolean"?p(la,oa):p(la,Z)[oa]};U.apply(this,arguments)}var U;if(a.isFunction(ba)){U=ba;return S}else{U=ba.handler;ba.handler=S}}})})(jQuery,this);
(function(a,n,f){function c(w){w=w||n[b][d];return w.replace(/^[^#]*#?(.*)$/,"$1")}var m,o=a.event.special,b="location",d="href",e=document.documentMode,l=a.browser.msie&&(e===f||e<8),u="onhashchange"in n&&!l;a.hashchangeDelay=100;o.hashchange=a.extend(o.hashchange,{setup:function(){if(u)return false;a(m.start)},teardown:function(){if(u)return false;a(m.stop)}});m=function(){function w(){M=J=function(da){return da};if(l){T=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
J=function(){return c(T.document[b][d])};M=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};M(c())}}var p={},L,T,M,J;p.start=function(){if(!L){var da=c();M||w();(function V(){var O=c(),fa=J(da);if(O!==da){M(da=O,fa);a(n).trigger("hashchange")}else if(fa!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+fa;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){J||b()},500);else{U=ua+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}}
function b(ba,S){if(!J){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var sa=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Wa){a("#"+Sa);var Oa=a(new Image).attr({"class":"svg_icon",src:sa+Wa,width:w,height:p,alt:"icon"});qa(Oa,Sa)})}else for(var la=L.length,oa=0;oa<la;oa++){var Z=L[oa],Aa=Z.id;if(Aa==="svg_eof")break;a("#"+Aa);Z=Z.getElementsByTagNameNS(l,"svg")[0];var Ka=document.createElementNS(l,"svg");Ka.setAttributeNS(l,"viewBox",
[0,0,w,p].join(" "));var Ra=Z.getAttribute("width"),Na=Z.getAttribute("height");Z.removeAttribute("width");Z.removeAttribute("height");Z.getAttribute("viewBox")||Z.setAttribute("viewBox",[0,0,Ra,Na].join(" "));Ka.setAttribute("xmlns",l);Ka.setAttribute("width",w);Ka.setAttribute("height",p);Ka.setAttribute("xmlns:xlink",u);Ka.setAttribute("class","svg_icon");fa||(Z=Z.cloneNode(true));Ka.appendChild(Z);if(ba){fa||Ka.cloneNode(true);U.empty().append(Ka);Z=ua+e(U.html());Z=a(new Image).attr({"class":"svg_icon",
src:Z})}else Z=f(a(Ka),oa);qa(Z,Aa)}m.placement&&a.each(m.placement,function(Sa,Wa){n[Wa]&&a(Sa).each(function(Oa){var Ia=n[Wa].clone();if(Oa>0&&!ba)Ia=f(Ia,Oa,true);ra(a(this),Ia,Wa)})});if(!S){ba&&U.remove();ha&&ha.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);J=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba);
J=function(){return c(T.document[b][d])};M=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};M(c())}}var p={},L,T,M,J;p.start=function(){if(!L){var da=c();M||w();(function V(){var O=c(),ga=J(da);if(O!==da){M(da=O,ga);a(n).trigger("hashchange")}else if(ga!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ga;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){J||b()},500);else{U=ta+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}}
function b(ba,S){if(!J){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var sa=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Wa){a("#"+Sa);var Oa=a(new Image).attr({"class":"svg_icon",src:sa+Wa,width:w,height:p,alt:"icon"});pa(Oa,Sa)})}else for(var la=L.length,oa=0;oa<la;oa++){var Z=L[oa],Aa=Z.id;if(Aa==="svg_eof")break;a("#"+Aa);Z=Z.getElementsByTagNameNS(l,"svg")[0];var Ka=document.createElementNS(l,"svg");Ka.setAttributeNS(l,"viewBox",
[0,0,w,p].join(" "));var Ra=Z.getAttribute("width"),Na=Z.getAttribute("height");Z.removeAttribute("width");Z.removeAttribute("height");Z.getAttribute("viewBox")||Z.setAttribute("viewBox",[0,0,Ra,Na].join(" "));Ka.setAttribute("xmlns",l);Ka.setAttribute("width",w);Ka.setAttribute("height",p);Ka.setAttribute("xmlns:xlink",u);Ka.setAttribute("class","svg_icon");ga||(Z=Z.cloneNode(true));Ka.appendChild(Z);if(ba){ga||Ka.cloneNode(true);U.empty().append(Ka);Z=ta+e(U.html());Z=a(new Image).attr({"class":"svg_icon",
src:Z})}else Z=f(a(Ka),oa);pa(Z,Aa)}m.placement&&a.each(m.placement,function(Sa,Wa){n[Wa]&&a(Sa).each(function(Oa){var Ia=n[Wa].clone();if(Oa>0&&!ba)Ia=f(Ia,Oa,true);ra(a(this),Ia,Wa)})});if(!S){ba&&U.remove();ha&&ha.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);J=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba);
var S=Array(Math.floor((ba.length+2)/3)*4),U,sa,la,oa,Z,Aa,Ka=0,Ra=0;do{U=ba.charCodeAt(Ka++);sa=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);oa=U>>2;U=(U&3)<<4|sa>>4;Z=(sa&15)<<2|la>>6;Aa=la&63;if(isNaN(sa))Z=Aa=64;else if(isNaN(la))Aa=64;S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(oa);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);S[Ra++]=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ka<ba.length);return S.join("")}var l="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",w=m.w?m.w:24,p=m.h?m.h:24,L,T,M,J=false,da=false,V=0,O=navigator.userAgent,fa=!!window.opera;O.indexOf("Safari/")>-1&&O.indexOf("Chrome/");var ua="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('<object data="'+c+'" type=image/svg+xml>').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o);
o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ba,S,U,sa){fa&&S.css("visibility","hidden");if(m.replace){sa&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class",
"svg_icon "+U);ba.replaceWith(S)}else ba.append(S);fa&&setTimeout(function(){S.removeAttr("style")},1)},qa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)ra(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=fa?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var sa=ba[0].getElementsByTagName("*"),la=sa.length;U.each(function(oa){var Z=this.id;a(T).find("#"+Z);this.id=oa="x"+Z+S+oa;Z="url(#"+Z+")";var Aa="url(#"+oa+")";for(oa=0;oa<
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ka<ba.length);return S.join("")}var l="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",w=m.w?m.w:24,p=m.h?m.h:24,L,T,M,J=false,da=false,V=0,O=navigator.userAgent,ga=!!window.opera;O.indexOf("Safari/")>-1&&O.indexOf("Chrome/");var ta="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('<object data="'+c+'" type=image/svg+xml>').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o);
o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ba,S,U,sa){ga&&S.css("visibility","hidden");if(m.replace){sa&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class",
"svg_icon "+U);ba.replaceWith(S)}else ba.append(S);ga&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)ra(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=ga?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var sa=ba[0].getElementsByTagName("*"),la=sa.length;U.each(function(oa){var Z=this.id;a(T).find("#"+Z);this.id=oa="x"+Z+S+oa;Z="url(#"+Z+")";var Aa="url(#"+oa+")";for(oa=0;oa<
la;oa++){var Ka=sa[oa];Ka.getAttribute("fill")===Z&&Ka.setAttribute("fill",Aa);Ka.getAttribute("stroke")===Z&&Ka.setAttribute("stroke",Aa);Ka.getAttribute("filter")===Z&&Ka.setAttribute("filter",Aa)}});return ba}};a.getSvgIcon=function(c,m){var o=n[c];if(m&&o)o=f(o,0,true).clone(true);return o};a.resizeSvgIcons=function(c){var m=!a(".svg_icon:first").length;a.each(c,function(o,b){var d=a.isArray(b),e=d?b[0]:b,l=d?b[1]:b;if(m)o=o.replace(/\.svg_icon/g,"svg");a(o).each(function(){this.setAttribute("width",
e);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=e+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(c,m,o){c=document.createElementNS(n.svg,c);if(f)for(var b in m)c.setAttribute(b,m[b]);else for(b in m){var d=m[b],e=c[b];if(e&&e.constructor==="SVGLength")e.baseVal.value=d;else c.setAttribute(b,d)}o&&o.appendChild(c);return c}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(c){c=c||{};this.alpha=isNaN(c.alpha)?100:c.alpha;if(c.copy){this.type=
c.copy.type;this.alpha=c.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=c.copy.solidColor;break;case "linearGradient":this.linearGradient=c.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=c.copy.radialGradient.cloneNode(true)}}else if(c.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=c.linearGradient.cloneNode(true)}else if(c.radialGradient){this.type=
"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=c.radialGradient.cloneNode(true)}else if(c.solidColor){this.type="solidColor";this.solidColor=c.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 f=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(c){var m=
arguments;return this.each(function(){function o(ma,Y,na,K,N){var aa=N||a("stop",{"stop-color":Y,"stop-opacity":na,offset:ma},ea);if(N){Y=N.getAttribute("stop-color");na=N.getAttribute("stop-opacity");ma=N.getAttribute("offset")}else ea.appendChild(aa);if(na===null)na=1;N=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+ma*fa)+", 26)"},Cb);var Pa=
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:Y,"fill-opacity":na,transform:"translate("+(10+ma*fa)+", 26)",stroke:"#000","stroke-width":1.5},Cb);$(Pa).mousedown(function(Xa){b(this);Ya=lb;da.mousemove(l).mouseup(d);Ea=Mb.offset();Xa.preventDefault();return false}).data("stop",aa).data("bg",N).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Xa=this,fb=+aa.getAttribute("stop-opacity")||
1,nb=aa.getAttribute("stop-color")||1,Db=(parseFloat(fb)*255).toString(16);Db.length<2;)Db="0"+Db;Y=nb.substr(1)+Db;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:Y,alphaSupport:true}},function(cb){nb=cb.val("hex")?"#"+cb.val("hex"):"none";fb=cb.val("a")!==null?cb.val("a")/256:1;Xa.setAttribute("fill",nb);Xa.setAttribute("fill-opacity",fb);aa.setAttribute("stop-color",
nb);aa.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Xa=$(this);if(+this.getAttribute("offset")>ma){if(!Y){var fb=this.getAttribute("stop-color"),nb=this.getAttribute("stop-opacity");aa.setAttribute("stop-color",fb);Pa.setAttribute("fill",fb);aa.setAttribute("stop-opacity",nb===null?1:nb);Pa.setAttribute("fill-opacity",
nb===null?1:nb)}Xa.before(aa);return false}});K&&b(Pa);return aa}function b(ma){lb&&lb.setAttribute("stroke","#000");ma.setAttribute("stroke","blue");lb=ma;lb.parentNode.appendChild(lb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var ma=$(lb),Y=ma.data("stop");ma=ma.data("bg");$([lb,Y,ma]).remove()}Ya=null}function e(){var ma=Za?"rotate("+Za+","+Ma+","+mb+") ":"";ob===1&&Ja===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform",
ma+"translate("+-Ma*(ob-1)+","+-mb*(Ja-1)+") scale("+ob+","+Ja+")")}function l(ma){var Y=ma.pageX-Ea.left;ma=ma.pageY-Ea.top;Y=Y<10?10:Y>fa+10?fa+10:Y;var na="translate("+Y+", 26)";if(ma<-60||ma>130){La.setAttribute("display","block");La.setAttribute("transform",na)}else La.setAttribute("display","none");Ya.setAttribute("transform",na);$.data(Ya,"bg").setAttribute("transform",na);$.data(Ya,"stop").setAttribute("offset",(Y-10)/fa);var K=0;$(ea).find("stop").each(function(){var N=this.getAttribute("offset"),
arguments;return this.each(function(){function o(ma,Y,na,K,N){var aa=N||a("stop",{"stop-color":Y,"stop-opacity":na,offset:ma},ea);if(N){Y=N.getAttribute("stop-color");na=N.getAttribute("stop-opacity");ma=N.getAttribute("offset")}else ea.appendChild(aa);if(na===null)na=1;N=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+ma*ga)+", 26)"},Cb);var Pa=
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:Y,"fill-opacity":na,transform:"translate("+(10+ma*ga)+", 26)",stroke:"#000","stroke-width":1.5},Cb);$(Pa).mousedown(function(Xa){b(this);Ya=nb;da.mousemove(l).mouseup(d);Ea=Kb.offset();Xa.preventDefault();return false}).data("stop",aa).data("bg",N).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Xa=this,hb=+aa.getAttribute("stop-opacity")||
1,pb=aa.getAttribute("stop-color")||1,Db=(parseFloat(hb)*255).toString(16);Db.length<2;)Db="0"+Db;Y=pb.substr(1)+Db;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:Y,alphaSupport:true}},function(cb){pb=cb.val("hex")?"#"+cb.val("hex"):"none";hb=cb.val("a")!==null?cb.val("a")/256:1;Xa.setAttribute("fill",pb);Xa.setAttribute("fill-opacity",hb);aa.setAttribute("stop-color",
pb);aa.setAttribute("stop-opacity",hb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Xa=$(this);if(+this.getAttribute("offset")>ma){if(!Y){var hb=this.getAttribute("stop-color"),pb=this.getAttribute("stop-opacity");aa.setAttribute("stop-color",hb);Pa.setAttribute("fill",hb);aa.setAttribute("stop-opacity",pb===null?1:pb);Pa.setAttribute("fill-opacity",
pb===null?1:pb)}Xa.before(aa);return false}});K&&b(Pa);return aa}function b(ma){nb&&nb.setAttribute("stroke","#000");ma.setAttribute("stroke","blue");nb=ma;nb.parentNode.appendChild(nb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var ma=$(nb),Y=ma.data("stop");ma=ma.data("bg");$([nb,Y,ma]).remove()}Ya=null}function e(){var ma=Za?"rotate("+Za+","+Ma+","+ob+") ":"";qb===1&&Ja===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform",
ma+"translate("+-Ma*(qb-1)+","+-ob*(Ja-1)+") scale("+qb+","+Ja+")")}function l(ma){var Y=ma.pageX-Ea.left;ma=ma.pageY-Ea.top;Y=Y<10?10:Y>ga+10?ga+10:Y;var na="translate("+Y+", 26)";if(ma<-60||ma>130){La.setAttribute("display","block");La.setAttribute("transform",na)}else La.setAttribute("display","none");Ya.setAttribute("transform",na);$.data(Ya,"bg").setAttribute("transform",na);$.data(Ya,"stop").setAttribute("offset",(Y-10)/ga);var K=0;$(ea).find("stop").each(function(){var N=this.getAttribute("offset"),
aa=$(this);if(N<K){aa.prev().before(aa);Ga=$(ea).find("stop")}K=N})}var u=$(this),w=$.extend(true,{},jQuery.fn.jGraduateDefaults,c),p=u.attr("id"),L="#"+u.attr("id")+" ";if(L){var T=function(){switch(u.paint.type){case "radialGradient":u.paint.linearGradient=null;break;case "linearGradient":u.paint.radialGradient=null;break;case "solidColor":u.paint.radialGradient=u.paint.linearGradient=null}$.isFunction(u.okCallback)&&u.okCallback(u.paint);u.hide()},M=function(){$.isFunction(u.cancelCallback)&&u.cancelCallback();
u.hide()};$.extend(true,u,{paint:new $.jGraduate.Paint({copy:w.paint}),okCallback:$.isFunction(m[1])&&m[1]||null,cancelCallback:$.isFunction(m[2])&&m[2]||null});u.position();var J=null,da=$(window);if(u.paint.type=="none")u.paint=$.jGraduate.Paint({solidColor:"ffffff"});u.addClass("jGraduate_Picker");u.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 V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+w.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="'+
@ -34,25 +34,25 @@ p+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'
p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+w.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="'+w.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="'+w.images.clientPath+
'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</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="'+w.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 fa=256,ua=fa-0,ha=fa-0,ca,ea,ra,qa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:fa,height:fa,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],sa=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad";
p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ga=256,ta=ga-0,ha=ga-0,ca,ea,ra,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:ga,height:ga,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],sa=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad";
U=ea=S.appendChild(ea)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},S);if(ca==="linearGradient")break;case "radialGradient":if(!la){ea.id=p+"_rg_jgraduate_grad";U=ea=S.appendChild(ea)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},S)}if(la){U=ea=$("#"+p+"_lg_jgraduate_grad")[0];J=u.paint[ca];o(0,"#"+J,1);var oa=typeof w.newstop;if(oa==="string")switch(w.newstop){case "same":o(1,"#"+J,1);break;case "inverse":oa="";for(var Z=0;Z<6;Z+=2){J.substr(Z,2);var Aa=(255-parseInt(J.substr(Z,2),16)).toString(16);
if(Aa.length<2)Aa=0+Aa;oa+=Aa}o(1,"#"+oa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(oa==="object")o(1,w.newstop.color||"#"+J,"opac"in w.newstop?w.newstop.opac:1)}J=parseFloat(U.getAttribute("x1")||0);oa=parseFloat(U.getAttribute("y1")||0);Z=parseFloat(U.getAttribute("x2")||1);Aa=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Ra=parseFloat(U.getAttribute("cy")||0.5),Na=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")||
Ra);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:ua,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":sa/100},S);var Wa=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:oa*fa,left:J*fa}).data("coord","start").appendTo(ba),Oa=Wa.clone().text(2).css({top:Aa*fa,left:Z*fa}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*fa,left:Ka*
fa}).data("coord","center").appendTo(ba),Qa=Ia.clone().text("F").css({top:Sa*fa,left:Na*fa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Qa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ma,Y){var na=ea.getAttribute(Y),K=isNaN(Y[1]);na||(na=K?"0.5":Y==="x2"?"1.0":"0.0");qa[Y]=$("#"+p+"_jGraduate_"+Y).val(na).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
1)this.value=1;if(!(Y[0]==="f"&&!qb))if(K&&ca==="radialGradient"||!K&&ca==="linearGradient")ea.setAttribute(Y,this.value);var N=K?Y[0]==="c"?Ia:Qa:Y[1]==="1"?Wa:Oa,aa=Y.indexOf("x")>=0?"left":"top";N.css(aa,this.value*fa)}).change()});var Ga,Cb,Mb=$("#"+p+"_jGraduate_StopSlider"),lb,ab,Ya,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Ea,ob=1,Ja=1,Za=0,Ma=Ka,mb=Ra;ab=a("svg",{width:"100%",height:45},Mb[0]);ba=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(ma){Ea=Mb.offset();if(ma.target.tagName!=="path"){var Y=ma.pageX-Ea.left-8;Y=Y<10?10:Y>fa+10?fa+10:Y;o(Y/fa,0,0,true);ma.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Cb=a("g",{},ab);a("line",{x1:10,y1:15,x2:fa+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var zb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",
$(this).val())}),eb=null,gb=function(ma){var Y=ma.pageX-wb.left,na=ma.pageY-wb.top;Y=Y<0?0:Y>fa?fa:Y;na=na<0?0:na>fa?fa:na;eb.css("left",Y).css("top",na);Y/=ua;na/=ha;var K=eb.data("coord"),N=ea;switch(K){case "start":qa.x1.val(Y);qa.y1.val(na);N.setAttribute("x1",Y);N.setAttribute("y1",na);break;case "end":qa.x2.val(Y);qa.y2.val(na);N.setAttribute("x2",Y);N.setAttribute("y2",na);break;case "center":qa.cx.val(Y);qa.cy.val(na);N.setAttribute("cx",Y);N.setAttribute("cy",na);Ma=Y;mb=na;e();break;case "focus":qa.fx.val(Y);
qa.fy.val(na);N.setAttribute("fx",Y);N.setAttribute("fy",na);e()}ma.preventDefault()},Nb=function(){eb=null;da.unbind("mousemove",gb).unbind("mouseup",Nb)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var xa=Ga.length;for(Z=0;Z<xa;Z++)o(0,0,0,0,Ga[Z]);zb.val(ea.getAttribute("spreadMethod")||"pad");var wb,qb=false;ra.setAttribute("fill-opacity",sa/100);$("#"+p+" div.grad_coord").mousedown(function(ma){ma.preventDefault();
eb=$(this);eb.offset();wb=eb.parent().offset();da.mousemove(gb).mouseup(Nb)});$("#"+p+"_jGraduate_Ok").bind("click",function(){u.paint.type=ca;u.paint[ca]=ea.cloneNode(true);u.paint.solidColor=null;T()});$("#"+p+"_jGraduate_Cancel").bind("click",function(){M()});if(ca==="radialGradient")if(qb)Qa.show();else{Qa.hide();qa.fx.val("");qa.fy.val("")}$("#"+p+"_jGraduate_match_ctr")[0].checked=!qb;var Ab,sb;$("#"+p+"_jGraduate_match_ctr").change(function(){qb=!this.checked;Qa.toggle(qb);qa.fx.val("");qa.fy.val("");
var ma=ea;if(qb){var Y=Ab||0.5,na=sb||0.5;ma.setAttribute("fx",Y);ma.setAttribute("fy",na);qa.fx.val(Y);qa.fy.val(na)}else{Ab=ma.getAttribute("fx");sb=ma.getAttribute("fy");ma.removeAttribute("fx");ma.removeAttribute("fy")}});Ga=ea.getElementsByTagNameNS(n.svg,"stop");xa=Ga.length;if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var kb;sa=O=0;if(ca==="radialGradient"){S=ea.gradientTransform.baseVal;if(S.numberOfItems===2){xa=
Ra);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:ta,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":sa/100},S);var Wa=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:oa*ga,left:J*ga}).data("coord","start").appendTo(ba),Oa=Wa.clone().text(2).css({top:Aa*ga,left:Z*ga}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ga,left:Ka*
ga}).data("coord","center").appendTo(ba),Qa=Ia.clone().text("F").css({top:Sa*ga,left:Na*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Qa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ma,Y){var na=ea.getAttribute(Y),K=isNaN(Y[1]);na||(na=K?"0.5":Y==="x2"?"1.0":"0.0");pa[Y]=$("#"+p+"_jGraduate_"+Y).val(na).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
1)this.value=1;if(!(Y[0]==="f"&&!rb))if(K&&ca==="radialGradient"||!K&&ca==="linearGradient")ea.setAttribute(Y,this.value);var N=K?Y[0]==="c"?Ia:Qa:Y[1]==="1"?Wa:Oa,aa=Y.indexOf("x")>=0?"left":"top";N.css(aa,this.value*ga)}).change()});var Ga,Cb,Kb=$("#"+p+"_jGraduate_StopSlider"),nb,ab,Ya,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Ea,qb=1,Ja=1,Za=0,Ma=Ka,ob=Ra;ab=a("svg",{width:"100%",height:45},Kb[0]);ba=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(ma){Ea=Kb.offset();if(ma.target.tagName!=="path"){var Y=ma.pageX-Ea.left-8;Y=Y<10?10:Y>ga+10?ga+10:Y;o(Y/ga,0,0,true);ma.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Cb=a("g",{},ab);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var xb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",
$(this).val())}),fb=null,ib=function(ma){var Y=ma.pageX-ub.left,na=ma.pageY-ub.top;Y=Y<0?0:Y>ga?ga:Y;na=na<0?0:na>ga?ga:na;fb.css("left",Y).css("top",na);Y/=ta;na/=ha;var K=fb.data("coord"),N=ea;switch(K){case "start":pa.x1.val(Y);pa.y1.val(na);N.setAttribute("x1",Y);N.setAttribute("y1",na);break;case "end":pa.x2.val(Y);pa.y2.val(na);N.setAttribute("x2",Y);N.setAttribute("y2",na);break;case "center":pa.cx.val(Y);pa.cy.val(na);N.setAttribute("cx",Y);N.setAttribute("cy",na);Ma=Y;ob=na;e();break;case "focus":pa.fx.val(Y);
pa.fy.val(na);N.setAttribute("fx",Y);N.setAttribute("fy",na);e()}ma.preventDefault()},Lb=function(){fb=null;da.unbind("mousemove",ib).unbind("mouseup",Lb)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var xa=Ga.length;for(Z=0;Z<xa;Z++)o(0,0,0,0,Ga[Z]);xb.val(ea.getAttribute("spreadMethod")||"pad");var ub,rb=false;ra.setAttribute("fill-opacity",sa/100);$("#"+p+" div.grad_coord").mousedown(function(ma){ma.preventDefault();
fb=$(this);fb.offset();ub=fb.parent().offset();da.mousemove(ib).mouseup(Lb)});$("#"+p+"_jGraduate_Ok").bind("click",function(){u.paint.type=ca;u.paint[ca]=ea.cloneNode(true);u.paint.solidColor=null;T()});$("#"+p+"_jGraduate_Cancel").bind("click",function(){M()});if(ca==="radialGradient")if(rb)Qa.show();else{Qa.hide();pa.fx.val("");pa.fy.val("")}$("#"+p+"_jGraduate_match_ctr")[0].checked=!rb;var yb,sb;$("#"+p+"_jGraduate_match_ctr").change(function(){rb=!this.checked;Qa.toggle(rb);pa.fx.val("");pa.fy.val("");
var ma=ea;if(rb){var Y=yb||0.5,na=sb||0.5;ma.setAttribute("fx",Y);ma.setAttribute("fy",na);pa.fx.val(Y);pa.fy.val(na)}else{yb=ma.getAttribute("fx");sb=ma.getAttribute("fy");ma.removeAttribute("fx");ma.removeAttribute("fy")}});Ga=ea.getElementsByTagNameNS(n.svg,"stop");xa=Ga.length;if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var mb;sa=O=0;if(ca==="radialGradient"){S=ea.gradientTransform.baseVal;if(S.numberOfItems===2){xa=
S.getItem(0);S=S.getItem(1);if(xa.type===2&&S.type===3){xa=S.matrix;if(xa.a!==1)O=Math.round(-(1-xa.a)*100);else if(xa.d!==1)O=Math.round((1-xa.d)*100)}}else if(S.numberOfItems===3){ba=S.getItem(0);xa=S.getItem(1);S=S.getItem(2);if(ba.type===4&&xa.type===2&&S.type===3){sa=Math.round(ba.angle);xa=S.matrix;if(xa.a!==1)O=Math.round(-(1-xa.a)*100);else if(xa.d!==1)O=Math.round((1-xa.d)*100)}}}O={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+p+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||
0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:sa}};$.each(O,function(ma,Y){var na=$(Y.handle);na.mousedown(function(K){var N=na.parent();kb={type:ma,elem:na,input:$(Y.input),parent:N,offset:N.offset()};da.mousemove(Gb).mouseup(Hb);K.preventDefault()});$(Y.input).val(Y.val).change(function(){var K=
+this.value,N=0,aa=ca==="radialGradient";switch(ma){case "radius":aa&&ea.setAttribute("r",K/100);N=Math.pow(K/100,0.4)/2*145;break;case "opacity":u.paint.alpha=K;ra.setAttribute("fill-opacity",K/100);N=K*1.45;break;case "ellip":ob=Ja=1;if(K===0){N=72.5;break}if(K>99.5)K=99.5;if(K>0)Ja=1-K/100;else ob=-(K/100)-1;N=145*((K+100)/2)/100;aa&&e();break;case "angle":Za=K;N=Za/180;N+=0.5;N*=145;aa&&e()}if(N>145)N=145;else if(N<0)N=0;na.css({"margin-left":N-5})}).change()});var Gb=function(ma){var Y=ma.pageX-
kb.offset.left-parseInt(kb.parent.css("border-left-width"));if(Y>145)Y=145;if(Y<=0)Y=0;var na=Y-5;Y/=145;switch(kb.type){case "radius":Y=Math.pow(Y*2,2.5);if(Y>0.98&&Y<1.02)Y=1;if(Y<=0.01)Y=0.01;ea.setAttribute("r",Y);break;case "opacity":u.paint.alpha=parseInt(Y*100);ra.setAttribute("fill-opacity",Y);break;case "ellip":Ja=ob=1;if(Y<0.5){Y/=0.5;ob=Y<=0?0.01:Y}else if(Y>0.5){Y/=0.5;Y=2-Y;Ja=Y<=0?0.01:Y}e();Y-=1;if(Ja===Y+1)Y=Math.abs(Y);break;case "angle":Y-=0.5;Za=Y*=180;e();Y/=100}kb.elem.css({"margin-left":na});
Y=Math.round(Y*100);kb.input.val(Y);ma.preventDefault()},Hb=function(){da.unbind("mousemove",Gb).unbind("mouseup",Hb);kb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(J=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});V.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:J,alphaSupport:true}},
function(ma){u.paint.type="solidColor";u.paint.alpha=ma.val("ahex")?Math.round(ma.val("a")/255*100):100;u.paint.solidColor=ma.val("hex")?ma.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){M()});var Ob=$(L+" .jGraduate_tabs li");Ob.click(function(){Ob.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ma=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ma==="rg"||ma==="lg"){$(".jGraduate_"+ma+"_field").show();$(".jGraduate_"+
(ma==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ma+"_jgraduate_grad)");ca=ma==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var Y=$("#"+p+"_"+ma+"_jgraduate_grad")[0];if(ea!==Y){var na=$(ea).find("stop");$(Y).empty().append(na);ea=Y;Y=zb.val();ea.setAttribute("spreadMethod",Y)}qb=ma==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Na&&Ra==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(qb);if(qb)$("#"+
p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Ob.removeClass("jGraduate_tab_current");var Pb;switch(u.paint.type){case "linearGradient":Pb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Pb=$(L+" .jGraduate_tab_radgrad");break;default:Pb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Pb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={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,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass?
0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:sa}};$.each(O,function(ma,Y){var na=$(Y.handle);na.mousedown(function(K){var N=na.parent();mb={type:ma,elem:na,input:$(Y.input),parent:N,offset:N.offset()};da.mousemove(Gb).mouseup(Hb);K.preventDefault()});$(Y.input).val(Y.val).change(function(){var K=
+this.value,N=0,aa=ca==="radialGradient";switch(ma){case "radius":aa&&ea.setAttribute("r",K/100);N=Math.pow(K/100,0.4)/2*145;break;case "opacity":u.paint.alpha=K;ra.setAttribute("fill-opacity",K/100);N=K*1.45;break;case "ellip":qb=Ja=1;if(K===0){N=72.5;break}if(K>99.5)K=99.5;if(K>0)Ja=1-K/100;else qb=-(K/100)-1;N=145*((K+100)/2)/100;aa&&e();break;case "angle":Za=K;N=Za/180;N+=0.5;N*=145;aa&&e()}if(N>145)N=145;else if(N<0)N=0;na.css({"margin-left":N-5})}).change()});var Gb=function(ma){var Y=ma.pageX-
mb.offset.left-parseInt(mb.parent.css("border-left-width"));if(Y>145)Y=145;if(Y<=0)Y=0;var na=Y-5;Y/=145;switch(mb.type){case "radius":Y=Math.pow(Y*2,2.5);if(Y>0.98&&Y<1.02)Y=1;if(Y<=0.01)Y=0.01;ea.setAttribute("r",Y);break;case "opacity":u.paint.alpha=parseInt(Y*100);ra.setAttribute("fill-opacity",Y);break;case "ellip":Ja=qb=1;if(Y<0.5){Y/=0.5;qb=Y<=0?0.01:Y}else if(Y>0.5){Y/=0.5;Y=2-Y;Ja=Y<=0?0.01:Y}e();Y-=1;if(Ja===Y+1)Y=Math.abs(Y);break;case "angle":Y-=0.5;Za=Y*=180;e();Y/=100}mb.elem.css({"margin-left":na});
Y=Math.round(Y*100);mb.input.val(Y);ma.preventDefault()},Hb=function(){da.unbind("mousemove",Gb).unbind("mouseup",Hb);mb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(J=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});V.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:J,alphaSupport:true}},
function(ma){u.paint.type="solidColor";u.paint.alpha=ma.val("ahex")?Math.round(ma.val("a")/255*100):100;u.paint.solidColor=ma.val("hex")?ma.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){M()});var Mb=$(L+" .jGraduate_tabs li");Mb.click(function(){Mb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ma=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ma==="rg"||ma==="lg"){$(".jGraduate_"+ma+"_field").show();$(".jGraduate_"+
(ma==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ma+"_jgraduate_grad)");ca=ma==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var Y=$("#"+p+"_"+ma+"_jgraduate_grad")[0];if(ea!==Y){var na=$(ea).find("stop");$(Y).empty().append(na);ea=Y;Y=xb.val();ea.setAttribute("spreadMethod",Y)}rb=ma==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Na&&Ra==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(rb);if(rb)$("#"+
p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Mb.removeClass("jGraduate_tab_current");var Nb;switch(u.paint.type){case "linearGradient":Nb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Nb=$(L+" .jGraduate_tab_radgrad");break;default:Nb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Nb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={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,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass?
a.downClass:"down",reset:a&&a.reset?a.reset:this.value,delay:a&&a.delay?Number(a.delay):500,interval:a&&a.interval?Number(a.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.spinCfg.smallStep=a&&a.smallStep?a.smallStep:this.spinCfg.step/2;this.adjustValue=function(f){f=isNaN(this.value)?this.spinCfg.reset:$.isFunction(this.spinCfg.stepfunc)?this.spinCfg.stepfunc(this,f):Number((Number(this.value)+Number(f)).toFixed(5));if(this.spinCfg.min!==
null)f=Math.max(f,this.spinCfg.min);if(this.spinCfg.max!==null)f=Math.min(f,this.spinCfg.max);this.value=f;$.isFunction(this.spinCfg.callback)&&this.spinCfg.callback(this)};$(this).addClass(a&&a.spinClass?a.spinClass:"spin-button").mousemove(function(f){var c=f.pageX||f.x,m=f.pageY||f.y;f=f.target||f.srcElement;var o=svgEditor.tool_scale||1,b=$(f).height()/2;c=c>n(f,"offsetLeft")+f.offsetWidth*o-this.spinCfg._btn_width?m<n(f,"offsetTop")+b*o?1:-1:0;if(c!==this.spinCfg._direction){switch(c){case 1:$(this).removeClass(this.spinCfg.downClass).addClass(this.spinCfg.upClass);
break;case -1:$(this).removeClass(this.spinCfg.upClass).addClass(this.spinCfg.downClass);break;default:$(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass)}this.spinCfg._direction=c}}).mouseout(function(){$(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);this.spinCfg._direction=null;window.clearInterval(this.spinCfg._repeat);window.clearTimeout(this.spinCfg._delay)}).mousedown(function(f){if(f.button===0&&this.spinCfg._direction!=0){var c=this,
@ -65,13 +65,13 @@ $(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:u-o.left,y:
function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(f){if(f==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(f!=undefined)for(var c=f.split(","),m=0;m<c.length;m++)$(this).find('A[href="'+c[m]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(f){if(f==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(f!=
undefined)for(var c=f.split(","),m=0;m<c.length;m++)$(this).find('A[href="'+c[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,f=document.createElementNS("http://www.w3.org/2000/svg","svg"),c=!!window.opera,m=n.indexOf("AppleWebKit")>=0,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>=
0,u="ontouchstart"in window,w=!!f.querySelector,p=!!document.evaluate,L=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ha=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(ua,0);return true}catch(ca){}return false}(),T=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ha=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(ua,
0);return true}catch(ca){}return false}(),M=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);ha.setAttribute("x",5);ua.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(ua);return ha===0}(),J=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg",
"svg");document.documentElement.appendChild(ua);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");ua.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(ua);return ha.height>4&&ha.height<5}(),da=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca=
document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);ua.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(ua);return ha.width==15}(),V=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("x",0.1);(ua=ua.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 ua}(),O=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("style","vector-effect:non-scaling-stroke");return ua.style.vectorEffect==="non-scaling-stroke"}(),fa=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();ua.appendItem(ha);return ua.getItem(0)==ha}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o};
0,u="ontouchstart"in window,w=!!f.querySelector,p=!!document.evaluate,L=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(ta,0);return true}catch(ca){}return false}(),T=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(ta,
0);return true}catch(ca){}return false}(),M=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);ha.setAttribute("x",5);ta.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(ta);return ha===0}(),J=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg",
"svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");ta.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(ta);return ha.height>4&&ha.height<5}(),da=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca=
document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);ta.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(ta);return ha.width==15}(),V=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("x",0.1);(ta=ta.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 ta}(),O=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("style","vector-effect:non-scaling-stroke");return ta.style.vectorEffect==="non-scaling-stroke"}(),ga=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();ta.appendItem(ha);return ta.getItem(0)==ha}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o};
svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return J};
svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return fa}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{};
svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return ga}}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(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m<this.numberOfItems;++m){var o=this._list.getItem(m);c=c;o=o;var b=o.matrix,d="";switch(o.type){case 1:d="matrix("+[b.a,b.b,b.c,b.d,b.e,b.f].join(",")+")";break;case 2:d="translate("+b.e+","+b.f+")";break;case 3:d=
b.a==b.d?"scale("+b.a+")":"scale("+b.a+","+b.d+")";break;case 4:var e=0;d=0;if(o.angle!=0){e=1-b.a;d=(e*b.f+b.b*b.e)/(e*e+b.b*b.b);e=(b.e-b.b*d)/e}d="rotate("+o.angle+" "+e+","+d+")"}c=c+(d+" ")}this._elem.setAttribute("transform",c)};this._list=this;this._init=function(){var c=this._elem.getAttribute("transform");if(c)for(var m=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,o=true;o;){o=c.match(m);c=c.replace(m,"");if(o&&o[1]){var b=o[1].split(/\s*\(/),d=b[0];b=b[1].match(/\s*(.*?)\s*\)/);
b[1]=b[1].replace(/(\d)-/g,"$1 -");var e=b[1].split(/[, ]+/),l="abcdef".split(""),u=a.createSVGMatrix();$.each(e,function(L,T){e[L]=parseFloat(T);if(d=="matrix")u[l[L]]=e[L]});b=a.createSVGTransform();var w="set"+d.charAt(0).toUpperCase()+d.slice(1),p=d=="matrix"?[u]:e;if(d=="scale"&&p.length==1)p.push(p[0]);else if(d=="translate"&&p.length==1)p.push(0);else if(d=="rotate"&&p.length==1){p.push(0);p.push(0)}b[w].apply(b,p);this._list.appendItem(b)}}};this._removeFromOtherLists=function(c){if(c){var m=
@ -97,7 +97,7 @@ e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|p;d+=String.fromCharCode(e);if(w!=64)d+=
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(u){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}};
svgedit.utilities.walkTreePost=function(b,d){if(b&&b.nodeType==1){for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d);d(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){return b.getAttributeNS("http://www.w3.org/1999/xlink",
"href")};svgedit.utilities.setHref=function(b,d){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d)};svgedit.utilities.findDefs=function(b){b=f.getSVGContent().documentElement;var d=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return d=d.length>0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var l=d.getItem(0),
u=[l.x,l.y];for(l=0;l<e;l++){var w=d.getItem(l);if(typeof w.x!="undefined"){b[0].push(u[0]);b[1].push(u[1]);if(w.x1){for(var p=[w.x1,w.y1],L=[w.x2,w.y2],T=[w.x,w.y],M=0;M<2;M++){w=function(fa){return Math.pow(1-fa,3)*u[M]+3*Math.pow(1-fa,2)*fa*p[M]+3*(1-fa)*Math.pow(fa,2)*L[M]+Math.pow(fa,3)*T[M]};var J=6*u[M]-12*p[M]+6*L[M],da=-3*u[M]+9*p[M]-9*L[M]+3*T[M],V=3*p[M]-3*u[M];if(da==0){if(J!=0){J=-V/J;0<J&&J<1&&b[M].push(w(J))}}else{V=Math.pow(J,2)-4*V*da;if(!(V<0)){var O=(-J+Math.sqrt(V))/(2*da);0<O&&
u=[l.x,l.y];for(l=0;l<e;l++){var w=d.getItem(l);if(typeof w.x!="undefined"){b[0].push(u[0]);b[1].push(u[1]);if(w.x1){for(var p=[w.x1,w.y1],L=[w.x2,w.y2],T=[w.x,w.y],M=0;M<2;M++){w=function(ga){return Math.pow(1-ga,3)*u[M]+3*Math.pow(1-ga,2)*ga*p[M]+3*(1-ga)*Math.pow(ga,2)*L[M]+Math.pow(ga,3)*T[M]};var J=6*u[M]-12*p[M]+6*L[M],da=-3*u[M]+9*p[M]-9*L[M]+3*T[M],V=3*p[M]-3*u[M];if(da==0){if(J!=0){J=-V/J;0<J&&J<1&&b[M].push(w(J))}}else{V=Math.pow(J,2)-4*V*da;if(!(V<0)){var O=(-J+Math.sqrt(V))/(2*da);0<O&&
O<1&&b[M].push(w(O));J=(-J-Math.sqrt(V))/(2*da);0<J&&J<1&&b[M].push(w(J))}}}u=T}else{b[0].push(w.x);b[1].push(w.y)}}}d=Math.min.apply(null,b[0]);e=Math.max.apply(null,b[0])-d;l=Math.min.apply(null,b[1]);b=Math.max.apply(null,b[1])-l;return{x:d,y:l,width:e,height:b}};svgedit.utilities.getBBox=function(b){var d=b||f.geSelectedElements()[0];if(b.nodeType!=1)return null;b=null;var e=d.nodeName;switch(e){case "text":if(d.textContent===""){d.textContent="a";b=d.getBBox();d.textContent=""}else try{b=d.getBBox()}catch(l){}break;
case "path":if(svgedit.browser.supportsPathBBox())try{b=d.getBBox()}catch(u){}else b=svgedit.utilities.getPathBBox(d);break;case "g":case "a":b=a(d);break;default:if(e==="use")b=a(d,true);if(e==="use"){b||(b=d.getBBox());if(!svgedit.browser.isWebkit()){e={};e.width=b.width;e.height=b.height;e.x=b.x+parseFloat(d.getAttribute("x")||0);e.y=b.y+parseFloat(d.getAttribute("y")||0);b=e}}else if(~n.indexOf(e))try{b=d.getBBox()}catch(w){d=$(d).closest("foreignObject");if(d.length)try{b=d[0].getBBox()}catch(p){b=
null}else b=null}}if(b)b=svgedit.utilities.bboxToObj(b);return b};svgedit.utilities.getRotationAngle=function(b,d){var e=b||f.getSelectedElements()[0];e=svgedit.transformlist.getTransformList(e);if(!e)return 0;for(var l=e.numberOfItems,u=0;u<l;++u){var w=e.getItem(u);if(w.type==4)return d?w.angle*Math.PI/180:w.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(b){return o.querySelector("#"+b)}:svgedit.browser.supportsXpath()?function(b){return c.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
@ -148,11 +148,12 @@ u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u)
"M"+u+","+p+" L"+(u+L)+","+p+" "+(u+L)+","+(p+T)+" "+u+","+(p+T)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;p-=3.5;this.gripCoords={nw:[u,p],ne:[u+L,p],sw:[u,p+T],se:[u+L,p+T],n:[u+L/2,p],w:[u,p+T/2],e:[u+L,p+T/2],s:[u+L/2,p+T]};for(var da in this.gripCoords){c=this.gripCoords[da];o[da].setAttribute("x",c[0]);o[da].setAttribute("y",c[1])}this.rotateCoords={nw:[u,p],ne:[u+L+8,p],sw:[u,p+T+8],se:[u+L+8,p+T+8]};for(da in this.rotateCoords){c=this.rotateCoords[da];
m.rotateGrips[da].setAttribute("cx",c[0]);m.rotateGrips[da].setAttribute("cy",c[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 c in this.rotateGrips){var m=a.createSVGElement({element:"circle",
attr:{id:"selectorGrip_rotate_"+c,fill:"transparent",r:8,stroke:"transparent","stroke-width":0,style:"cursor:url("+n.imgPath+"rotate.png) 12 12, auto;"}});$.data(m,"dir",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}});$.data(m,"dir",c);$.data(m,
"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=n.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[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"}});c.appendChild(m);a.svgRoot().insertBefore(c,
a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var m=this.selectors.length;if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var o=0;o<m;++o)if(this.selectors[o]&&!this.selectors[o].locked){this.selectors[o].locked=true;this.selectors[o].reset(c);this.selectorMap[c.id]=this.selectors[o];return this.selectors[o]}this.selectors[m]=new svgedit.select.Selector(m,c);this.selectorParentGroup.appendChild(this.selectors[m].selectorGroup);
this.selectorMap[c.id]=this.selectors[m];return this.selectors[m]};svgedit.select.SelectorManager.prototype.releaseSelector=function(c){if(c!=null)for(var m=this.selectors.length,o=this.selectorMap[c.id],b=0;b<m;++b)if(this.selectors[b]&&this.selectors[b]==o){o.locked==false&&console.log("WARNING! selector was released but was already unlocked");delete this.selectorMap[c.id];o.locked=false;o.selectedElement=null;o.showGrips(false);try{o.selectorGroup.setAttribute("display","none")}catch(d){}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(c,m){n=c;a=m;f=new svgedit.select.SelectorManager};svgedit.select.getSelectorManager=function(){return f}})();svgedit=svgedit||{};
attr:{id:"selectorGrip_rotate_"+c,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",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}});
$.data(m,"dir",c);$.data(m,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=n.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[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"}});c.appendChild(m);
a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var m=this.selectors.length;if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var o=0;o<m;++o)if(this.selectors[o]&&!this.selectors[o].locked){this.selectors[o].locked=true;this.selectors[o].reset(c);this.selectorMap[c.id]=this.selectors[o];return this.selectors[o]}this.selectors[m]=new svgedit.select.Selector(m,
c);this.selectorParentGroup.appendChild(this.selectors[m].selectorGroup);this.selectorMap[c.id]=this.selectors[m];return this.selectors[m]};svgedit.select.SelectorManager.prototype.releaseSelector=function(c){if(c!=null)for(var m=this.selectors.length,o=this.selectorMap[c.id],b=0;b<m;++b)if(this.selectors[b]&&this.selectors[b]==o){o.locked==false&&console.log("WARNING! selector was released but was already unlocked");delete this.selectorMap[c.id];o.locked=false;o.selectedElement=null;o.showGrips(false);
try{o.selectorGroup.setAttribute("display","none")}catch(d){}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(c,m){n=c;a=m;f=new svgedit.select.SelectorManager};
svgedit.select.getSelectorManager=function(){return f}})();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},f=n.LET_DOCUMENT_DECIDE;svgedit.draw.Layer=function(c,m){this.name_=c;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(c,m){f=c==false?n.NEVER_RANDOMIZE:
n.ALWAYS_RANDOMIZE;if(f==n.ALWAYS_RANDOMIZE&&!m.getNonce())m.setNonce(Math.floor(Math.random()*100001));else f==n.NEVER_RANDOMIZE&&m.getNonce()&&m.clearNonce()};svgedit.draw.Drawing=function(c,m){if(!c||!c.tagName||!c.namespaceURI||c.tagName!="svg"||c.namespaceURI!="http://www.w3.org/2000/svg")throw"Error: svgedit.draw.Drawing instance initialized without a <svg> element";this.svgElem_=c;this.obj_num=0;this.idPrefix=m||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_=
"";var o=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(o&&f!=n.NEVER_RANDOMIZE)this.nonce_=o;else f==n.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(c){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+c):$(this.svgElem_).find("[id="+c+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_};
@ -195,325 +196,326 @@ dy-=newcy;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-angle;return{x:(r*Mat
1;L=w.getItem(p);var T=L.pathSegType;if(T!=1){var M=b(L.x,L.y);M=[M.x,M.y];if(L.x1!=null&&L.x2!=null){c_vals1=b(L.x1,L.y1);c_vals2=b(L.x2,L.y2);M.splice(M.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(T,p,M)}}svgedit.utilities.getBBox(d);w=svgroot.createSVGTransform();d=svgedit.transformlist.getTransformList(d);w.setRotate(e*180/Math.PI,u,l);d.replaceItem(w,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,f){var c=this.length;if(!c)return a.apply(this,arguments);for(var m=0;m<c;m++){var o=this[m];if(o.namespaceURI==="http://www.w3.org/2000/svg")if(f!==undefined)o.setAttribute(n,f);else if($.isArray(n)){c=n.length;for(m={};c--;){var b=n[c],d=o.getAttribute(b);if(d||d==="0")d=isNaN(d)?d:d-0;m[b]=d}return m}else if(typeof n==="object")for(b in n)o.setAttribute(b,n[b]);else{if((d=o.getAttribute(n))||d==="0")d=isNaN(d)?d:d-0;return d}else return a.apply(this,
arguments)}return this}})();
$.SvgCanvas=function(a,n){function f(g,h){for(var k=svgedit.utilities.getBBox(g),v=0;v<2;v++){var s=v===0?"fill":"stroke",E=g.getAttribute(s);if(E&&E.indexOf("url(")===0){E=N(E);if(E.tagName==="linearGradient"){var z=E.getAttribute("x1")||0,t=E.getAttribute("y1")||0,B=E.getAttribute("x2")||1,F=E.getAttribute("y2")||0;z=k.width*z+k.x;t=k.height*t+k.y;B=k.width*B+k.x;F=k.height*F+k.y;z=O(z,t,h);F=O(B,F,h);B={};B.x1=(z.x-k.x)/k.width;B.y1=(z.y-k.y)/k.height;B.x2=(F.x-k.x)/k.width;B.y2=(F.y-k.y)/k.height;
E=E.cloneNode(true);$(E).attr(B);E.id=na();xb().appendChild(E);g.setAttribute(s,"url(#"+E.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(m,n);var o=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+c+'" xlinkns="http://www.w3.org/1999/xlink" width="'+o[0]+'" height="'+o[1]+'" x="'+o[0]+'" y="'+o[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,
$.SvgCanvas=function(a,n){function f(g,h){for(var k=svgedit.utilities.getBBox(g),v=0;v<2;v++){var s=v===0?"fill":"stroke",E=g.getAttribute(s);if(E&&E.indexOf("url(")===0){E=N(E);if(E.tagName==="linearGradient"){var z=E.getAttribute("x1")||0,t=E.getAttribute("y1")||0,C=E.getAttribute("x2")||1,F=E.getAttribute("y2")||0;z=k.width*z+k.x;t=k.height*t+k.y;C=k.width*C+k.x;F=k.height*F+k.y;z=O(z,t,h);F=O(C,F,h);C={};C.x1=(z.x-k.x)/k.width;C.y1=(z.y-k.y)/k.height;C.x2=(F.x-k.x)/k.width;C.y2=(F.y-k.y)/k.height;
E=E.cloneNode(true);$(E).attr(C);E.id=na();vb().appendChild(E);g.setAttribute(s,"url(#"+E.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(m,n);var o=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+c+'" xlinkns="http://www.w3.org/1999/xlink" width="'+o[0]+'" height="'+o[1]+'" x="'+o[0]+'" y="'+o[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(e);var l=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[1],overflow:m.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(e);var g=d.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(g)})();var u="svg_";b.setIdPrefix=
function(g){u=g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=b.getCurrentDrawing=function(){return b.current_drawing_},p=1,L=null,T={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}};T.text=$.extend(true,{},T.shape);$.extend(T.text,
{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=T.shape,J=Array(1),da=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=w().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(L||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,
"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,fa=b.matrixMultiply=svgedit.math.matrixMultiply,ua=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform,
ca=svgedit.math.snapToAngle,ea=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 ob.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return J},
getSVGContent:function(){return l}});var qa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,oa=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,ga=b.matrixMultiply=svgedit.math.matrixMultiply,ta=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform,
ca=svgedit.math.snapToAngle,ea=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 qb.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return J},
getSVGContent:function(){return l}});var pa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,oa=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
Ra=svgedit.history.MoveElementCommand,Na=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Wa=svgedit.history.ChangeElementCommand,Oa=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var k=svgedit.history.HistoryEventTypes;if(g==k.BEFORE_UNAPPLY||g==k.BEFORE_APPLY)b.clearSelection();else if(g==k.AFTER_APPLY||g==k.AFTER_UNAPPLY){var v=h.elements();b.pathActions.clear();K("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v==
Ra.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Na.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Na.type())k&&ab(h.elem);else k||ab(h.elem);h.elem.tagName==="use"&&cc(h.elem)}else if(v==Wa.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k=
v.parentNode;var s=v.nextSibling;k.removeChild(v);k.insertBefore(v,s)}}}}}});var Ia=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(m,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Qa=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return e}});
svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Cb={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"},Mb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],lb=$.data,
ab=function(g){var h=$(g).attr(Mb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=qa(v).substr(1);if(!la(v)){xb().appendChild(Ab[v]);delete Ab[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h<k;h++)ab(g[h])}},Ya={},La=m.imgPath+"logo.png",Ea=[],ob={round_digits:5},Ja=false,Za=null,Ma="select",mb="none",zb={},eb=T.text,gb=M,Nb=null,xa=null,wb=[],qb={},Ab={};b.clipBoard=[];var sb=this.runExtensions=function(g,h,k){var v=false;if(k)v=[];$.each(qb,function(s,E){if(g in E)if(k)v.push(E[g](h));
else v=E[g](h)});return v};this.addExtension=function(g,h){if(g in qb)console.log('Cannot add extension "'+g+'", an extension by that name already exists"');else{var k=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:e,svgcontent:l,nonce:w().getNonce(),selectorManager:Qa})):h;qb[g]=k;K("extension_added",k)}};var kb=this.round=function(g){return parseInt(g*p)/p},Gb=this.getIntersectionList=function(g){if(xa==null)return null;var h=L||w().getCurrentLayer();wb.length||(wb=Ob(h));var k=null;
try{k=h.getIntersectionList(g,null)}catch(v){}if(k==null||typeof k.item!="function"){k=[];if(g)g=g;else{g=xa.getBBox();h={};for(var s in g)h[s]=g[s]/p;g=h}for(s=wb.length;s--;)g.width&&g.width&&svgedit.math.rectsIntersect(g,wb[s].bbox)&&k.push(wb[s].elem)}return k};getStrokedBBox=this.getStrokedBBox=function(g){g||(g=Hb());if(!g.length)return false;var h=function(F){try{var C=svgedit.utilities.getBBox(F),D=svgedit.utilities.getRotationAngle(F);if(D&&D%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(F))){D=
false;if(["ellipse","path","line","polyline","polygon"].indexOf(F.tagName)>=0)C=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var H=F.getAttribute("rx"),G=F.getAttribute("ry");if(H||G)C=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),R=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(R);R.appendChild(P);C=svgedit.utilities.bboxToObj(R.getBBox());W.removeChild(R)}}return C}catch(ta){console.log(F,ta);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});
if(k==null)return null;var v=k.x+k.width,s=k.y+k.height,E=k.x,z=k.y,t=function(F){var C=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(C))D+=C/2;return D},B=[];$.each(g,function(F,C){var D=h(C);if(D){var H=t(C);E=Math.min(E,D.x-H);z=Math.min(z,D.y-H);B.push(D)}});k.x=E;k.y=z;$.each(g,function(F,C){var D=B[F];if(D&&C.nodeType==1){var H=t(C);v=Math.max(v,D.x+D.width+H);s=Math.max(s,D.y+D.height+H)}});k.width=v-E;k.height=s-z;return k};var Hb=this.getVisibleElements=function(g){g||
(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Ob=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},Pb=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=na()},ma=function(g){var h=document.createElementNS(g.namespaceURI,
svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Cb={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"},Kb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],nb=$.data,
ab=function(g){var h=$(g).attr(Kb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){vb().appendChild(yb[v]);delete yb[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h<k;h++)ab(g[h])}},Ya={},La=m.imgPath+"logo.png",Ea=[],qb={round_digits:5},Ja=false,Za=null,Ma="select",ob="none",xb={},fb=T.text,ib=M,Lb=null,xa=null,ub=[],rb={},yb={};b.clipBoard=[];var sb=this.runExtensions=function(g,h,k){var v=false;if(k)v=[];$.each(rb,function(s,E){if(g in E)if(k)v.push(E[g](h));
else v=E[g](h)});return v};this.addExtension=function(g,h){if(g in rb)console.log('Cannot add extension "'+g+'", an extension by that name already exists"');else{var k=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:e,svgcontent:l,nonce:w().getNonce(),selectorManager:Qa})):h;rb[g]=k;K("extension_added",k)}};var mb=this.round=function(g){return parseInt(g*p)/p},Gb=this.getIntersectionList=function(g){if(xa==null)return null;var h=L||w().getCurrentLayer();ub.length||(ub=Mb(h));var k=null;
try{k=h.getIntersectionList(g,null)}catch(v){}if(k==null||typeof k.item!="function"){k=[];if(g)g=g;else{g=xa.getBBox();h={};for(var s in g)h[s]=g[s]/p;g=h}for(s=ub.length;s--;)g.width&&g.width&&svgedit.math.rectsIntersect(g,ub[s].bbox)&&k.push(ub[s].elem)}return k};getStrokedBBox=this.getStrokedBBox=function(g){g||(g=Hb());if(!g.length)return false;var h=function(F){try{var B=svgedit.utilities.getBBox(F),D=svgedit.utilities.getRotationAngle(F);if(D&&D%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(F))){D=
false;if(["ellipse","path","line","polyline","polygon"].indexOf(F.tagName)>=0)B=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var H=F.getAttribute("rx"),G=F.getAttribute("ry");if(H||G)B=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),Q=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(Q);Q.appendChild(P);B=svgedit.utilities.bboxToObj(Q.getBBox());W.removeChild(Q)}}return B}catch(ua){console.log(F,ua);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});
if(k==null)return null;var v=k.x+k.width,s=k.y+k.height,E=k.x,z=k.y,t=function(F){var B=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(B))D+=B/2;return D},C=[];$.each(g,function(F,B){var D=h(B);if(D){var H=t(B);E=Math.min(E,D.x-H);z=Math.min(z,D.y-H);C.push(D)}});k.x=E;k.y=z;$.each(g,function(F,B){var D=C[F];if(D&&B.nodeType==1){var H=t(B);v=Math.max(v,D.x+D.width+H);s=Math.max(s,D.y+D.height+H)}});k.width=v-E;k.height=s-z;return k};var Hb=this.getVisibleElements=function(g){g||
(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Mb=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},Nb=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=na()},ma=function(g){var h=document.createElementNS(g.namespaceURI,
g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,s){s.localName!="-moz-math-font-style"&&h.setAttributeNS(s.namespaceURI,s.nodeName,s.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,s){switch(s.nodeType){case 1:h.appendChild(ma(s));break;case 3:h.textContent=s.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref",
g).data("symbol",g)}else h.tagName=="image"&&Ib(h);h.id=na();return h},Y,na,K;(function(g){var h={};Y=g.getId=function(){return w().getId()};na=g.getNextId=function(){return w().getNextId()};K=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h<k;++h){var v=g[h];v.setAttribute("d",Ua.convertPath(v));Ua.fixEnd(v)}};var N=this.getRefElem=
function(g){return la(qa(g).substr(1))},aa=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);Qa.releaseSelector(g);J[0]=h;Qa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=J[0],v=k.getAttribute("transform"),s=svgedit.utilities.getBBox(k),E=s.x+s.width/2,z=s.y+s.height/2;s=V(k);s.numberOfItems>0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){E=O(E,z,ha(s).matrix);
z=e.createSVGTransform();z.setRotate(g,E.x,E.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);rb("transform",s,J);K("changed",J)}la("pathpointgrip_container");k=Qa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Pa=this.recalculateAllSelectedDimensions=function(){for(var g=new Oa(mb=="none"?"position":"size"),h=J.length;h--;){var k=cb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g);
K("changed",J)}},Xa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],fb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},nb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ga(h[D]);oa(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var z=E===0?"fill":"stroke",t=g.getAttribute(z);if(t&&t.indexOf("url(")===0)if(k.a<0||k.d<0){t=N(t).cloneNode(true);if(k.a<0){var B=
t.getAttribute("x1"),F=t.getAttribute("x2");t.setAttribute("x1",-(B-1));t.setAttribute("x2",-(F-1))}if(k.d<0){B=t.getAttribute("y1");F=t.getAttribute("y2");t.setAttribute("y1",-(B-1));t.setAttribute("y2",-(F-1))}t.id=na();xb().appendChild(t);g.setAttribute(z,"url(#"+t.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=ha(g).matrix;z=fa(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=V(g);t=e.createSVGTransform();t.setMatrix(fa(ha(z).matrix,
k));z.clear();z.appendItem(t)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){z=V(g);t=e.createSVGTransform();t.setMatrix(fa(ha(z).matrix,k));z.clear();z.appendItem(t)}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)}s();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.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);
s();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);s();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=g.querySelectorAll("tspan");for(E=k.length;E--;){z=ra("x",g.getAttribute("x"));t=ra("x",k[E].getAttribute("x"));B=ra("y",g.getAttribute("y"));F=ra("y",k[E].getAttribute("y"));var C={};if(!isNaN(z)&&
!isNaN(t)&&z!=0&&t!=0&&h.x)C.x=h.x-(z-t);if(!isNaN(B)&&!isNaN(F)&&B!=0&&F!=0&&h.y)C.y=h.y-(B-F);if(C.x||C.y)oa(k[E],C,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&oa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(E=0;E<s;++E){F=h.points[E];F=O(F.x,F.y,k);h.points[E].x=F.x;h.points[E].y=F.y}s=h.points.length;k="";for(E=0;E<s;++E){F=h.points[E];k+=F.x+","+F.y+" "}g.setAttribute("points",k);break;case "path":z=g.pathSegList;s=z.numberOfItems;h.d=
Array(s);for(E=0;E<s;++E){t=z.getItem(E);h.d[E]={type:t.pathSegType,x:t.x,y:t.y,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,r1:t.r1,r2:t.r2,angle:t.angle,largeArcFlag:t.largeArcFlag,sweepFlag:t.sweepFlag}}s=h.d.length;E=h.d[0];C=O(E.x,E.y,k);h.d[0].x=C.x;h.d[0].y=C.y;for(E=1;E<s;++E){t=h.d[E];z=t.type;if(z%2==0){F=O(t.x!=undefined?t.x:C.x,t.y!=undefined?t.y:C.y,k);z=O(t.x1,t.y1,k);B=O(t.x2,t.y2,k);t.x=F.x;t.y=F.y;t.x1=z.x;t.y1=z.y;t.x2=B.x;t.y2=B.y}else{t.x=k.a*t.x;t.y=k.d*t.y;t.x1=k.a*t.x1;t.y1=k.d*t.y1;t.x2=
g).data("symbol",g)}else h.tagName=="image"&&Zb(h);h.id=na();return h},Y,na,K;(function(g){var h={};Y=g.getId=function(){return w().getId()};na=g.getNextId=function(){return w().getNextId()};K=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h<k;++h){var v=g[h];v.setAttribute("d",Ua.convertPath(v));Ua.fixEnd(v)}};var N=this.getRefElem=
function(g){return la(pa(g).substr(1))},aa=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);Qa.releaseSelector(g);J[0]=h;Qa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=J[0],v=k.getAttribute("transform"),s=svgedit.utilities.getBBox(k),E=s.x+s.width/2,z=s.y+s.height/2;s=V(k);s.numberOfItems>0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){E=O(E,z,ha(s).matrix);
z=e.createSVGTransform();z.setRotate(g,E.x,E.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);db("transform",s,J);K("changed",J)}la("pathpointgrip_container");k=Qa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Pa=this.recalculateAllSelectedDimensions=function(){for(var g=new Oa(ob=="none"?"position":"size"),h=J.length;h--;){var k=cb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g);
K("changed",J)}},Xa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],hb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},pb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ga(h[D]);oa(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var z=E===0?"fill":"stroke",t=g.getAttribute(z);if(t&&t.indexOf("url(")===0)if(k.a<0||k.d<0){t=N(t).cloneNode(true);if(k.a<0){var C=
t.getAttribute("x1"),F=t.getAttribute("x2");t.setAttribute("x1",-(C-1));t.setAttribute("x2",-(F-1))}if(k.d<0){C=t.getAttribute("y1");F=t.getAttribute("y2");t.setAttribute("y1",-(C-1));t.setAttribute("y2",-(F-1))}t.id=na();vb().appendChild(t);g.setAttribute(z,"url(#"+t.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=ha(g).matrix;z=ga(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix,
k));z.clear();z.appendItem(t)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix,k));z.clear();z.appendItem(t)}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)}s();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.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);
s();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);s();break;case "line":z=O(h.x1,h.y1,k);C=O(h.x2,h.y2,k);h.x1=z.x;h.y1=z.y;h.x2=C.x;h.y2=C.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){z=ra("x",g.getAttribute("x"));t=ra("x",k[E].getAttribute("x"));C=ra("y",g.getAttribute("y"));F=ra("y",k[E].getAttribute("y"));var B={};if(!isNaN(z)&&
!isNaN(t)&&z!=0&&t!=0&&h.x)B.x=h.x-(z-t);if(!isNaN(C)&&!isNaN(F)&&C!=0&&F!=0&&h.y)B.y=h.y-(C-F);if(B.x||B.y)oa(k[E],B,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&oa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(E=0;E<s;++E){F=h.points[E];F=O(F.x,F.y,k);h.points[E].x=F.x;h.points[E].y=F.y}s=h.points.length;k="";for(E=0;E<s;++E){F=h.points[E];k+=F.x+","+F.y+" "}g.setAttribute("points",k);break;case "path":z=g.pathSegList;s=z.numberOfItems;h.d=
Array(s);for(E=0;E<s;++E){t=z.getItem(E);h.d[E]={type:t.pathSegType,x:t.x,y:t.y,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,r1:t.r1,r2:t.r2,angle:t.angle,largeArcFlag:t.largeArcFlag,sweepFlag:t.sweepFlag}}s=h.d.length;E=h.d[0];B=O(E.x,E.y,k);h.d[0].x=B.x;h.d[0].y=B.y;for(E=1;E<s;++E){t=h.d[E];z=t.type;if(z%2==0){F=O(t.x!=undefined?t.x:B.x,t.y!=undefined?t.y:B.y,k);z=O(t.x1,t.y1,k);C=O(t.x2,t.y2,k);t.x=F.x;t.y=F.y;t.x1=z.x;t.y1=z.y;t.x2=C.x;t.y2=C.y}else{t.x=k.a*t.x;t.y=k.d*t.y;t.x1=k.a*t.x1;t.y1=k.d*t.y1;t.x2=
k.a*t.x2;t.y2=k.d*t.y2}t.r1=k.a*t.r1;t.r2=k.d*t.r2}k="";s=h.d.length;for(E=0;E<s;++E){t=h.d[E];z=t.type;k+=Xa[z];switch(z){case 13:case 12:k+=t.x+" ";break;case 15:case 14:k+=t.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:k+=t.x+","+t.y+" ";break;case 7:case 6:k+=t.x1+","+t.y1+" "+t.x2+","+t.y2+" "+t.x+","+t.y+" ";break;case 9:case 8:k+=t.x1+","+t.y1+" "+t.x+","+t.y+" ";break;case 11:case 10:k+=t.r1+","+t.r2+" "+t.angle+" "+ +t.largeArcFlag+" "+ +t.sweepFlag+" "+t.x+","+t.y+" ";break;case 17:case 16:k+=
t.x2+","+t.y2+" "+t.x+","+t.y+" "}}g.setAttribute("d",k)}},Db=function(g,h,k){g=N(g).firstChild;var v=V(g),s=e.createSVGTransform();s.setTranslate(h,k);v.appendItem(s);cb(g)},cb=this.recalculateDimensions=function(g){if(g==null)return null;var h=V(g);if(h&&h.numberOfItems>0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type===1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&sa(g))return null}if(!h||
h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(fa(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=fa(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k-
h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(ga(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=ga(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k-
2);h.removeItem(k-2);h.appendItem(s)}}switch(g.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 E=$(g).data("gsvg");k=new Oa("Transform");var z={},t=null;v=[];switch(g.tagName){case "line":v=["x1","y1","x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v=
["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":t={};t.points=g.getAttribute("points");s=g.points;var B=s.numberOfItems;z.points=Array(B);for(var F=0;F<B;++F){var C=s.getItem(F);z.points[F]={x:C.x,y:C.y}}break;case "path":t={};t.d=g.getAttribute("d");z.d=g.getAttribute("d")}if(v.length){z=$(g).attr(v);$.each(z,function(tb,Jb){z[tb]=ra(tb,Jb)})}else if(E)z={x:$(E).attr("x")||0,y:$(E).attr("y")||0};if(t==null){t=$.extend(true,{},
z);$.each(t,function(tb,Jb){t[tb]=ra(tb,Jb)})}t.transform=Za?Za:"";if(g.tagName=="g"&&!E||g.tagName=="a"){s=svgedit.utilities.getBBox(g);var D={x:s.x+s.width/2,y:s.y+s.height/2},H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);v=e.createSVGMatrix();if(s=sa(g)){F=s*Math.PI/180;B=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(B*v.e+v.f)/2;D.x=(v.e-B*v.f)/2;h.removeItem(F);break}}}F=v=E=0;var G=h.numberOfItems;if(G)var P=
h.getItem(0).matrix;if(G>=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;var R=h.getItem(G-3).matrix,W=h.getItem(G-2).matrix,ta=h.getItem(G-1).matrix;B=g.childNodes;for(C=B.length;C--;){var wa=B.item(C);v=E=0;if(wa.nodeType==1){var ga=V(wa);if(ga){v=ha(ga).matrix;E=sa(wa);var ka=Za,pa=[];Za=wa.getAttribute("transform");if(E||ua(ga)){var za=e.createSVGTransform();za.setMatrix(fa(R,W,ta,v));ga.clear();ga.appendItem(za);pa.push(za)}else{E=fa(v.inverse(),ta,v);za=e.createSVGMatrix();
za.e=-E.e;za.f=-E.f;v=fa(za.inverse(),v.inverse(),R,W,ta,v,E.inverse());var hb=e.createSVGTransform(),Eb=e.createSVGTransform(),Sb=e.createSVGTransform();hb.setTranslate(E.e,E.f);Eb.setScale(v.a,v.d);Sb.setTranslate(za.e,za.f);ga.appendItem(Sb);ga.appendItem(Eb);ga.appendItem(hb);pa.push(Sb);pa.push(Eb);pa.push(hb)}k.addSubCommand(cb(wa));Za=ka}}}h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G>=3&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v);
h.clear();h.appendItem(za)}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=fa(v,E);E=v.e;v=v.f;if(E!=0||v!=0){B=g.childNodes;C=B.length;for(G=[];C--;){wa=B.item(C);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(G.indexOf(ka)===-1){Db(ka,E,v);G.push(ka)}}ka=Za;Za=wa.getAttribute("transform");if(ga=V(wa)){R=e.createSVGTransform();R.setTranslate(E,v);ga.numberOfItems?ga.insertItemBefore(R,
0):ga.appendItem(R);k.addSubCommand(cb(wa));ga=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(R=ga.length;R--;){W=ga.item(R);if(wa==ba(W)){ta=e.createSVGTransform();ta.setTranslate(-E,-v);V(W).insertItemBefore(ta,0);k.addSubCommand(cb(W))}}Za=ka}}}G=[];Za=ka}}else if(G==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;B=g.childNodes;for(C=B.length;C--;){wa=B.item(C);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");if(ga=V(wa)){E=fa(v,ha(ga).matrix);G=e.createSVGTransform();G.setMatrix(E);
ga.clear();ga.appendItem(G,0);k.addSubCommand(cb(wa));Za=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(s){H={x:D.x+P.e,y:D.y+P.f};D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?
h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(s,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(s,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=fa(ka,H,P,v);E=H.e;v=H.f;if(E!=0||v!=0){B=g.childNodes;for(C=B.length;C--;){wa=B.item(C);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");ga=V(wa);R=e.createSVGTransform();R.setTranslate(E,v);ga.numberOfItems?ga.insertItemBefore(R,0):ga.appendItem(R);k.addSubCommand(cb(wa));Za=
ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);F=E*Math.PI/180;B=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(B*v.e+v.f)/2;D.x=(v.e-B*v.f)/2;h.removeItem(F);break}}}F=0;G=h.numberOfItems;if(!svgedit.browser.isWebkit())if((P=
g.getAttribute("fill"))&&P.indexOf("url(")===0){P=N(P);ka="pattern";if(P.tagName!==ka)ka="gradient";if(P.getAttribute(ka+"Units")==="userSpaceOnUse"){v=ha(h).matrix;s=V(P);s=ha(s).matrix;v=fa(v,s);s="matrix("+[v.a,v.b,v.c,v.d,v.e,v.f].join(",")+")";P.setAttribute(ka+"Transform",s)}}if(G>=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;v=ha(h,G-3,G-1).matrix;h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G==4&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;
za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;s=ka.inverse();v=fa(s,P,ka);h.removeItem(0)}else if(G==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points=g.getAttribute("points");if(z.points){s=g.points;B=s.numberOfItems;z.points=Array(B);for(F=0;F<B;++F){C=
s.getItem(F);z.points[F]={x:C.x,y:C.y}}}case "path":z.d=g.getAttribute("d");F=1;h.clear()}}else{F=4;if(E){D=e.createSVGTransform();D.setRotate(E,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==1||F==2||F==3)nb(g,z,v);if(F==2){if(E){ua(h)||(H={x:D.x+v.e,y:D.y+v.f});D=e.createSVGTransform();D.setRotate(E,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3&&E){v=ha(h).matrix;P=e.createSVGTransform();
P.setRotate(E,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(E,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=fa(ka,H,P,v);nb(g,z,H);if(E)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}h.numberOfItems==0&&g.removeAttribute("transform");k.addSubCommand(new Wa(g,t));return k},Fb=null,$a=this.clearSelection=function(g){if(J[0]!=null)for(var h=J.length,k=0;k<h;++k){var v=J[k];if(v==null)break;Qa.releaseSelector(v);J[k]=null}g||K("selected",J)},Kb=this.addToSelection=function(g,h){if(g.length!=
["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":t={};t.points=g.getAttribute("points");s=g.points;var C=s.numberOfItems;z.points=Array(C);for(var F=0;F<C;++F){var B=s.getItem(F);z.points[F]={x:B.x,y:B.y}}break;case "path":t={};t.d=g.getAttribute("d");z.d=g.getAttribute("d")}if(v.length){z=$(g).attr(v);$.each(z,function(Ib,Ob){z[Ib]=ra(Ib,Ob)})}else if(E)z={x:$(E).attr("x")||0,y:$(E).attr("y")||0};if(t==null){t=$.extend(true,{},
z);$.each(t,function(Ib,Ob){t[Ib]=ra(Ib,Ob)})}t.transform=Za?Za:"";if(g.tagName=="g"&&!E||g.tagName=="a"){s=svgedit.utilities.getBBox(g);var D={x:s.x+s.width/2,y:s.y+s.height/2},H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);v=e.createSVGMatrix();if(s=sa(g)){F=s*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(C*v.e+v.f)/2;D.x=(v.e-C*v.f)/2;h.removeItem(F);break}}}F=v=E=0;var G=h.numberOfItems;if(G)var P=
h.getItem(0).matrix;if(G>=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;var Q=h.getItem(G-3).matrix,W=h.getItem(G-2).matrix,ua=h.getItem(G-1).matrix;C=g.childNodes;for(B=C.length;B--;){var wa=C.item(B);v=E=0;if(wa.nodeType==1){var fa=V(wa);if(fa){v=ha(fa).matrix;E=sa(wa);var ka=Za,qa=[];Za=wa.getAttribute("transform");if(E||ta(fa)){var za=e.createSVGTransform();za.setMatrix(ga(Q,W,ua,v));fa.clear();fa.appendItem(za);qa.push(za)}else{E=ga(v.inverse(),ua,v);za=e.createSVGMatrix();
za.e=-E.e;za.f=-E.f;v=ga(za.inverse(),v.inverse(),Q,W,ua,v,E.inverse());var jb=e.createSVGTransform(),zb=e.createSVGTransform(),Qb=e.createSVGTransform();jb.setTranslate(E.e,E.f);zb.setScale(v.a,v.d);Qb.setTranslate(za.e,za.f);fa.appendItem(Qb);fa.appendItem(zb);fa.appendItem(jb);qa.push(Qb);qa.push(zb);qa.push(jb)}k.addSubCommand(cb(wa));Za=ka}}}h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G>=3&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v);
h.clear();h.appendItem(za)}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=ga(v,E);E=v.e;v=v.f;if(E!=0||v!=0){C=g.childNodes;B=C.length;for(G=[];B--;){wa=C.item(B);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(G.indexOf(ka)===-1){Db(ka,E,v);G.push(ka)}}ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q,
0):fa.appendItem(Q);k.addSubCommand(cb(wa));fa=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(Q=fa.length;Q--;){W=fa.item(Q);if(wa==ba(W)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(W).insertItemBefore(ua,0);k.addSubCommand(cb(W))}}Za=ka}}}G=[];Za=ka}}else if(G==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){E=ga(v,ha(fa).matrix);G=e.createSVGTransform();G.setMatrix(E);
fa.clear();fa.appendItem(G,0);k.addSubCommand(cb(wa));Za=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(s){H={x:D.x+P.e,y:D.y+P.f};D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?
h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(s,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(s,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=ga(ka,H,P,v);E=H.e;v=H.f;if(E!=0||v!=0){C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");fa=V(wa);Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q,0):fa.appendItem(Q);k.addSubCommand(cb(wa));Za=
ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);F=E*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(C*v.e+v.f)/2;D.x=(v.e-C*v.f)/2;h.removeItem(F);break}}}F=0;G=h.numberOfItems;if(!svgedit.browser.isWebkit())if((P=
g.getAttribute("fill"))&&P.indexOf("url(")===0){P=N(P);ka="pattern";if(P.tagName!==ka)ka="gradient";if(P.getAttribute(ka+"Units")==="userSpaceOnUse"){v=ha(h).matrix;s=V(P);s=ha(s).matrix;v=ga(v,s);s="matrix("+[v.a,v.b,v.c,v.d,v.e,v.f].join(",")+")";P.setAttribute(ka+"Transform",s)}}if(G>=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;v=ha(h,G-3,G-1).matrix;h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G==4&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;
za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;s=ka.inverse();v=ga(s,P,ka);h.removeItem(0)}else if(G==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points=g.getAttribute("points");if(z.points){s=g.points;C=s.numberOfItems;z.points=Array(C);for(F=0;F<C;++F){B=
s.getItem(F);z.points[F]={x:B.x,y:B.y}}}case "path":z.d=g.getAttribute("d");F=1;h.clear()}}else{F=4;if(E){D=e.createSVGTransform();D.setRotate(E,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==1||F==2||F==3)pb(g,z,v);if(F==2){if(E){ta(h)||(H={x:D.x+v.e,y:D.y+v.f});D=e.createSVGTransform();D.setRotate(E,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3&&E){v=ha(h).matrix;P=e.createSVGTransform();
P.setRotate(E,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(E,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=ga(ka,H,P,v);pb(g,z,H);if(E)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}h.numberOfItems==0&&g.removeAttribute("transform");k.addSubCommand(new Wa(g,t));return k},Eb=null,$a=this.clearSelection=function(g){if(J[0]!=null)for(var h=J.length,k=0;k<h;++k){var v=J[k];if(v==null)break;Qa.releaseSelector(v);J[k]=null}g||K("selected",J)},Fb=this.addToSelection=function(g,h){if(g.length!=
0){for(var k=0;k<J.length;){if(J[k]==null)break;++k}for(var v=g.length;v--;){var s=g[v];if(s&&svgedit.utilities.getBBox(s)){if(s.tagName==="a"&&s.childNodes.length===1)s=s.firstChild;if(J.indexOf(s)==-1){J[k]=s;k++;s=Qa.requestSelector(s);J.length>1&&s.showGrips(false)}}}K("selected",J);h||J.length==1?Qa.requestSelector(J[0]).showGrips(true):Qa.requestSelector(J[0]).showGrips(false);for(J.sort(function(E,z){if(E&&z&&E.compareDocumentPosition)return 3-(z.compareDocumentPosition(E)&6);else if(E==null)return 1});J[0]==
null;)J.shift(0)}},Qb=this.selectOnly=function(g,h){$a(true);Kb(g,h)};this.removeFromSelection=function(g){if(J[0]!=null)if(g.length!=0){var h=Array(J.length);j=0;len=J.length;for(var k=0;k<len;++k){var v=J[k];if(v)if(g.indexOf(v)==-1){h[j]=v;j++}else Qa.releaseSelector(v)}J=h}};this.selectAllInCurrentLayer=function(){var g=w().getCurrentLayer();if(g){Ma="select";Qb($(L||g).children())}};var Zb=this.getMouseTarget=function(g){if(g==null)return null;g=g.target;if(g.correspondingUseElement)g=g.correspondingUseElement;
null;)J.shift(0)}},Pb=this.selectOnly=function(g,h){$a(true);Fb(g,h)};this.removeFromSelection=function(g){if(J[0]!=null)if(g.length!=0){var h=Array(J.length);j=0;len=J.length;for(var k=0;k<len;++k){var v=J[k];if(v)if(g.indexOf(v)==-1){h[j]=v;j++}else Qa.releaseSelector(v)}J=h}};this.selectAllInCurrentLayer=function(){var g=w().getCurrentLayer();if(g){Ma="select";Pb($(L||g).children())}};var $b=this.getMouseTarget=function(g){if(g==null)return null;g=g.target;if(g.correspondingUseElement)g=g.correspondingUseElement;
if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(g.namespaceURI)>=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=w().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Qa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=null,s=null,E={},z={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(t){if(!(b.spaceKey||
t.button===1)){var B=t.button===2;t.altKey&&svgCanvas.cloneSelectedElements(0,0);Fb=l.getScreenCTM().inverse();var F=O(t.pageX,t.pageY,Fb),C=F.x*p;F=F.y*p;t.preventDefault();if(B)Ma="select";C=C/p;F=F/p;var D=Zb(t);if(D.tagName==="a"&&D.childNodes.length===1)D=D.firstChild;var H=v=h=C,G=s=k=F;if(m.gridSnapping){C=Ga(C);F=Ga(F);h=Ga(h);k=Ga(k)}if(D==Qa.selectorParentGroup&&J[0]!=null){D=t.target;var P=lb(D,"type");if(P=="rotate"){Ma="rotate";current_rotate_mode=lb(D,"dir")}else if(P=="resize"){Ma=
"resize";mb=lb(D,"dir")}D=J[0]}Za=D.getAttribute("transform");P=V(D);switch(Ma){case "select":Ja=true;mb="none";if(B)Ja=false;if(D!=e){if(J.indexOf(D)==-1){t.shiftKey||$a(true);Kb([D]);Nb=D;Ua.clear()}if(!B)for(B=0;B<J.length;++B)if(J[B]!=null){var R=V(J[B]);R.numberOfItems?R.insertItemBefore(e.createSVGTransform(),0):R.appendItem(e.createSVGTransform())}}else if(!B){$a();Ma="multiselect";if(xa==null)xa=Qa.getRubberBandBox();v*=p;s*=p;oa(xa,{x:v,y:s,width:0,height:0,display:"inline"},100)}break;case "zoom":Ja=
true;if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:H*p,y:H*p,width:0,height:0,display:"inline"},100);break;case "resize":Ja=true;h=C;k=F;E=svgedit.utilities.getBBox($("#selectedBox0")[0]);var W={};$.each(E,function(ta,wa){W[ta]=wa/p});E=W;B=sa(D)?1:0;if(ua(P)){P.insertItemBefore(e.createSVGTransform(),B);P.insertItemBefore(e.createSVGTransform(),B);P.insertItemBefore(e.createSVGTransform(),B)}else{P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());
if(svgedit.browser.supportsNonScalingStroke()){if(C=svgedit.browser.isChrome())R=function(ta){var wa=ta.getAttributeNS(null,"stroke");ta.removeAttributeNS(null,"stroke");setTimeout(function(){ta.setAttributeNS(null,"stroke",wa)},1)};D.style.vectorEffect="non-scaling-stroke";C&&R(D);F=D.getElementsByTagName("*");H=F.length;for(B=0;B<H;B++){F[B].style.vectorEffect="non-scaling-stroke";C&&R(F[B])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ja=true;g=H+","+G+" ";R=M.stroke_width==0?1:M.stroke_width;
da({element:"polyline",curStyles:true,attr:{points:g,id:na(),fill:"none",opacity:M.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});z.minx=H;z.maxx=H;z.miny=G;z.maxy=G;break;case "image":Ja=true;R=da({element:"image",attr:{x:C,y:F,width:0,height:0,id:na(),opacity:M.opacity/2,style:"pointer-events:inherit"}});S(R,La);Ib(R);break;case "square":case "rect":Ja=true;h=C;k=F;da({element:"rect",curStyles:true,attr:{x:C,y:F,width:0,height:0,id:na(),opacity:M.opacity/2}});break;case "line":Ja=
true;R=M.stroke_width==0?1:M.stroke_width;da({element:"line",curStyles:true,attr:{x1:C,y1:F,x2:C,y2:F,id:na(),stroke:M.stroke,"stroke-width":R,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,fill:"none",opacity:M.opacity/2,style:"pointer-events:none"}});break;case "circle":Ja=true;da({element:"circle",curStyles:true,attr:{cx:C,cy:F,r:0,id:na(),opacity:M.opacity/2}});break;case "ellipse":Ja=true;da({element:"ellipse",
curStyles:true,attr:{cx:C,cy:F,rx:0,ry:0,id:na(),opacity:M.opacity/2}});break;case "text":Ja=true;da({element:"text",curStyles:true,attr:{x:C,y:F,id:na(),fill:eb.fill,"stroke-width":eb.stroke_width,"font-size":eb.font_size,"font-family":eb.font_family,"text-anchor":"left","xml:space":"preserve",opacity:M.opacity}});break;case "path":case "pathedit":h*=p;k*=p;Ua.mouseDown(t,D,h,k);Ja=true;break;case "textedit":h*=p;k*=p;pb.mouseDown(t,D,h,k);Ja=true;break;case "rotate":Ja=true;b.undoMgr.beginUndoableChange("transform",
J);document.getElementById("workarea").className="rotate"}R=sb("mouseDown",{event:t,start_x:h,start_y:k,selectedElements:J},true);$.each(R,function(ta,wa){if(wa&&wa.started)Ja=true});if(Ma)document.getElementById("workarea").className=Ma=="resize"?t.target.style.cursor:Ma}}).mousemove(function(t){if(Ja)if(!(t.button===1||b.spaceKey)){var B=J[0],F=O(t.pageX,t.pageY,Fb),C=F.x*p;F=F.y*p;var D=la(Y()),H=x=C/p,G=y=F/p;if(m.gridSnapping){x=Ga(x);y=Ga(y)}t.preventDefault();switch(Ma){case "select":if(J[0]!==
null){H=x-h;var P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P)}if(t.shiftKey){var R=ca(h,k,x,y);x=R.x;y=R.y}if(H!=0||P!=0){R=J.length;for(G=0;G<R;++G){B=J[G];if(B==null)break;var W=e.createSVGTransform();D=V(B);W.setTranslate(H,P);D.numberOfItems?D.replaceItem(W,0):D.appendItem(W);Qa.requestSelector(B).resize()}K("transition",J)}}break;case "multiselect":H*=p;G*=p;oa(xa,{x:Math.min(v,H),y:Math.min(s,G),width:Math.abs(H-v),height:Math.abs(G-s)},100);D=[];H=[];W=Gb();R=J.length;for(G=0;G<R;++G){P=W.indexOf(J[G]);
if(P==-1)D.push(J[G]);else W[P]=null}R=W.length;for(G=0;G<R;++G)W[G]&&H.push(W[G]);D.length>0&&b.removeFromSelection(D);H.length>0&&Kb(H);break;case "resize":D=V(B);H=(R=ua(D))?E:svgedit.utilities.getBBox(B);G=H.x;W=H.y;var ta=H.width,wa=H.height;H=x-h;P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P);wa=Ga(wa);ta=Ga(ta)}var ga=sa(B);if(ga){var ka=Math.sqrt(H*H+P*P);P=Math.atan2(P,H)-ga*Math.PI/180;H=ka*Math.cos(P);P=ka*Math.sin(P)}if(mb.indexOf("n")==-1&&mb.indexOf("s")==-1)P=0;if(mb.indexOf("e")==-1&&mb.indexOf("w")==
-1)H=0;var pa=ka=0,za=wa?(wa+P)/wa:1,hb=ta?(ta+H)/ta:1;if(mb.indexOf("n")>=0){za=wa?(wa-P)/wa:1;pa=wa}if(mb.indexOf("w")>=0){hb=ta?(ta-H)/ta:1;ka=ta}H=e.createSVGTransform();P=e.createSVGTransform();ta=e.createSVGTransform();if(m.gridSnapping){G=Ga(G);ka=Ga(ka);W=Ga(W);pa=Ga(pa)}H.setTranslate(-(G+ka),-(W+pa));if(t.shiftKey)if(hb==1)hb=za;else za=hb;P.setScale(hb,za);ta.setTranslate(G+ka,W+pa);if(R){R=ga?1:0;D.replaceItem(H,2+R);D.replaceItem(P,1+R);D.replaceItem(ta,0+R)}else{R=D.numberOfItems;D.replaceItem(ta,
R-3);D.replaceItem(P,R-2);D.replaceItem(H,R-1)}Qa.requestSelector(B).resize();K("transition",J);break;case "zoom":H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100);break;case "text":oa(D,{x:x,y:y},1E3);break;case "line":H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);y=Ga(y)}G=x;R=y;if(t.shiftKey){R=ca(h,k,G,R);G=R.x;R=R.y}D.setAttributeNS(null,"x2",G);D.setAttributeNS(null,"y2",R);window.opera||e.unsuspendRedraw(H);break;
case "foreignObject":case "square":case "rect":case "image":H=Math.abs(x-h);R=Math.abs(y-k);if(Ma=="square"||t.shiftKey){H=R=Math.max(H,R);G=h<x?h:h-H;W=k<y?k:k-R}else{G=Math.min(h,x);W=Math.min(k,y)}if(t.altKey){H*=2;R*=2;G=h-H/2;W=k-R/2}if(m.gridSnapping){H=Ga(H);R=Ga(R);G=Ga(G);W=Ga(W)}oa(D,{width:H,height:R,x:G,y:W},1E3);break;case "circle":H=$(D).attr(["cx","cy"]);R=H.cx;G=H.cy;H=Math.sqrt((x-R)*(x-R)+(y-G)*(y-G));if(m.gridSnapping)H=Ga(H);D.setAttributeNS(null,"r",H);break;case "ellipse":$(D).attr(["cx",
"cy"]);R=Math.abs(h+(x-h)/2);G=Math.abs(k+(y-k)/2);H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);R=Ga(R);y=Ga(y);G=Ga(G)}W=Math.abs(h-R);P=Math.abs(k-G);if(t.shiftKey){P=W;G=y>k?k+W:k-W}if(t.altKey){R=h;G=k;W=Math.abs(x-R);P=t.shiftKey?W:Math.abs(y-G)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P);D.setAttributeNS(null,"cx",R);D.setAttributeNS(null,"cy",G);window.opera||e.unsuspendRedraw(H);break;case "fhellipse":case "fhrect":z.minx=Math.min(H,z.minx);z.maxx=Math.max(H,
z.maxx);z.miny=Math.min(G,z.miny);z.maxy=Math.max(G,z.maxy);case "fhpath":g+=+H+","+G+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(t.shiftKey){if(R=svgedit.path.path){D=R.dragging?R.dragging[0]:h;R=R.dragging?R.dragging[1]:k}else{D=h;R=k}R=ca(D,R,x,y);x=R.x;y=R.y}if(xa&&xa.getAttribute("display")!=="none"){H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100)}Ua.mouseMove(t,
x,y);break;case "textedit":x*=p;y*=p;pb.mouseMove(C,F);break;case "rotate":H=svgedit.utilities.getBBox(B);R=H.x+H.width/2;G=H.y+H.height/2;D=ea(B);D=O(R,G,D);R=D.x;G=D.y;D=H.x;W=H.y;if(current_rotate_mode=="nw")D=H.x+H.width;if(current_rotate_mode=="se")W=H.y+H.height;if(current_rotate_mode=="sw"){D=H.x+H.width;W=H.y+H.height}compensation_angle=(Math.atan2(G-W,R-D)*(180/Math.PI)-90)%360;ga=(Math.atan2(G-y,R-x)*(180/Math.PI)-90)%360;ga+=compensation_angle;if(m.gridSnapping)ga=Ga(ga);if(t.shiftKey)ga=
Math.round(ga/45)*45;b.setRotationAngle(ga<-180?360+ga:ga,true);K("transition",J)}sb("mouseMove",{event:t,mouse_x:C,mouse_y:F,selected:B})}}).click(function(t){t.preventDefault();return false}).dblclick(function(t){var B=t.target.parentNode;if(B!==L){var F=Zb(t),C=F.tagName;if(C==="text"&&Ma!=="textedit"){t=O(t.pageX,t.pageY,Fb);pb.select(F,t.x,t.y)}if((C==="g"||C==="a")&&sa(F)){Xb(F);F=J[0];$a(true)}L&&$b();B.tagName!=="g"&&B.tagName!=="a"||B===w().getCurrentLayer()||F===Qa.selectorParentGroup||
lc(F)}}).mouseup(function(t){if(t.button!==2){var B=Nb;Nb=null;if(Ja){var F=O(t.pageX,t.pageY,Fb),C=F.x*p;F=F.y*p;var D=C/p,H=F/p,G=la(Y()),P=false;Ja=false;switch(Ma){case "resize":case "multiselect":if(xa!=null){xa.setAttribute("display","none");wb=[]}Ma="select";case "select":if(J[0]!=null){if(J[1]==null){C=J[0];switch(C.tagName){case "g":case "use":case "image":case "foreignObject":break;default:gb.fill=C.getAttribute("fill");gb.fill_opacity=C.getAttribute("fill-opacity");gb.stroke=C.getAttribute("stroke");
gb.stroke_opacity=C.getAttribute("stroke-opacity");gb.stroke_width=C.getAttribute("stroke-width");gb.stroke_dasharray=C.getAttribute("stroke-dasharray");gb.stroke_linejoin=C.getAttribute("stroke-linejoin");gb.stroke_linecap=C.getAttribute("stroke-linecap")}if(C.tagName=="text"){eb.font_size=C.getAttribute("font-size");eb.font_family=C.getAttribute("font-family")}Qa.requestSelector(C).showGrips(true)}Pa();if(D!=v||H!=s){t=J.length;for(C=0;C<t;++C){if(J[C]==null)break;J[C].firstChild||Qa.requestSelector(J[C]).resize()}}else{C=
t.target;if(J[0].nodeName==="path"&&J[1]==null)Ua.select(J[0]);else t.shiftKey&&B!=C&&b.removeFromSelection([C])}if(svgedit.browser.supportsNonScalingStroke())if(t=J[0]){t.removeAttribute("style");svgedit.utilities.walkTree(t,function(ta){ta.removeAttribute("style")})}}return;case "zoom":xa!=null&&xa.setAttribute("display","none");K("zoomed",{x:Math.min(v,D),y:Math.min(s,H),width:Math.abs(D-v),height:Math.abs(H-s),factor:t.altKey?0.5:2});return;case "fhpath":B=G.getAttribute("points");D=B.indexOf(",");
if(P=D>=0?B.indexOf(",",D+1)>=0:B.indexOf(" ",B.indexOf(" ")+1)>=0)G=Ua.smoothPolylineIntoPath(G);break;case "line":B=$(G).attr(["x1","x2","y1","y2"]);P=B.x1!=B.x2||B.y1!=B.y2;break;case "foreignObject":case "square":case "rect":case "image":B=$(G).attr(["width","height"]);P=B.width!=0||B.height!=0||Ma==="image";break;case "circle":P=G.getAttribute("r")!=0;break;case "ellipse":B=$(G).attr(["rx","ry"]);P=B.rx!=null||B.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({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:Y()}});K("changed",[G]);P=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx-z.minx,height:z.maxy-z.miny,id:Y()}});K("changed",[G]);P=true}break;case "text":P=true;Qb([G]);pb.start(G);break;case "path":G=null;Ja=true;B=Ua.mouseUp(t,G,C,F);G=B.element;P=B.keep;break;case "pathedit":P=true;G=null;Ua.mouseUp(t);
break;case "textedit":P=false;G=null;pb.mouseUp(t,C,F);break;case "rotate":P=true;G=null;Ma="select";B=b.undoMgr.finishUndoableChange();B.isEmpty()||Ia(B);Pa();K("changed",J)}C=sb("mouseUp",{event:t,mouse_x:C,mouse_y:F},true);$.each(C,function(ta,wa){if(wa){P=wa.keep||P;G=wa.element;Ja=wa.started||Ja}});if(!P&&G!=null){w().releaseId(Y());G.parentNode.removeChild(G);G=null;for(C=t.target;C.parentNode.parentNode.tagName=="g";)C=C.parentNode;if((Ma!="path"||!drawn_path)&&C.parentNode.id!="selectorParentGroup"&&
C.id!="svgcanvas"&&C.id!="svgroot"){b.setMode("select");Qb([C],true)}}else if(G!=null){b.addedNew=true;t=0.2;var R;if(false.beginElement&&G.getAttribute("opacity")!=M.opacity){R=$(false).clone().attr({to:M.opacity,dur:t}).appendTo(G);try{R[0].beginElement()}catch(W){}}else t=0;setTimeout(function(){R&&R.remove();G.setAttribute("opacity",M.opacity);G.setAttribute("style","pointer-events:inherit");Z(G);if(Ma==="path")Ua.toEditMode(G);else m.selectNew&&Qb([G],true);Ia(new Na(G));K("changed",[G])},t*
1E3)}Za=null}}});$(a).bind("mousewheel DOMMouseScroll",function(t){if(t.shiftKey){t.preventDefault();Fb=l.getScreenCTM().inverse();var B=O(t.pageX,t.pageY,Fb);B={x:B.x,y:B.y,width:0,height:0};if(t.wheelDelta)if(t.wheelDelta>=120)B.factor=2;else{if(t.wheelDelta<=-120)B.factor=0.5}else if(t.detail)if(t.detail>0)B.factor=0.5;else if(t.detail<0)B.factor=2;B.factor&&K("zoomed",B)}})})();var Ib=function(g){$(g).click(function(h){h.preventDefault()})},pb=b.textActions=function(){function g(ga){var ka=F.value===
"";$(F).focus();if(!arguments.length)if(ka)ga=0;else{if(F.selectionEnd!==F.selectionStart)return;ga=F.selectionEnd}var pa;pa=G[ga];ka||F.setSelectionRange(ga,ga);C=la("text_cursor");if(!C){C=document.createElementNS(c,"line");oa(C,{id:"text_cursor",stroke:"#333","stroke-width":1});C=la("selectorParentGroup").appendChild(C)}H||(H=setInterval(function(){var za=C.getAttribute("display")==="none";C.setAttribute("display",za?"inline":"none")},600));ka=E(pa.x,P.y);pa=E(pa.x,P.y+P.height);oa(C,{x1:ka.x,
y1:ka.y,x2:pa.x,y2:pa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(ga,ka,pa){if(ga===ka)g(ka);else{pa||F.setSelectionRange(ga,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");oa(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}ga=G[ga];var za=G[ka];C.setAttribute("visibility","hidden");ka=E(ga.x,P.y);pa=E(ga.x+(za.x-ga.x),P.y);var hb=E(ga.x,P.y+P.height);ga=E(ga.x+(za.x-
ga.x),P.y+P.height);oa(D,{d:"M"+ka.x+","+ka.y+" L"+pa.x+","+pa.y+" "+ga.x+","+ga.y+" "+hb.x+","+hb.y+"z",display:"inline"})}}function k(ga,ka){var pa=e.createSVGPoint();pa.x=ga;pa.y=ka;if(G.length==1)return 0;pa=B.getCharNumAtPosition(pa);if(pa<0){pa=G.length-2;if(ga<=G[0].x)pa=0}else if(pa>=G.length-2)pa=G.length-2;var za=G[pa];ga>za.x+za.width/2&&pa++;return pa}function v(ga,ka,pa){var za=F.selectionStart;ga=k(ga,ka);h(Math.min(za,ga),Math.max(za,ga),!pa)}function s(ga,ka){var pa={x:ga,y:ka};pa.x/=
p;pa.y/=p;if(R){var za=O(pa.x,pa.y,R.inverse());pa.x=za.x;pa.y=za.y}return pa}function E(ga,ka){var pa={x:ga,y:ka};if(R){var za=O(pa.x,pa.y,R);pa.x=za.x;pa.y=za.y}pa.x*=p;pa.y*=p;return pa}function z(ga){h(0,B.textContent.length);$(this).unbind(ga)}function t(ga){if(wa&&B){var ka=O(ga.pageX,ga.pageY,Fb);ka=s(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var pa=B.textContent,za=pa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;pa=pa.substr(ka).match(/^[a-z0-9]+/i);h(za,(pa?pa[0].length:0)+ka);$(ga.target).click(z);
setTimeout(function(){$(ga.target).unbind("click",z)},300)}}var B,F,C,D,H,G=[],P,R,W,ta,wa;return{select:function(ga,ka,pa){B=ga;pb.toEditMode(ka,pa)},start:function(ga){B=ga;pb.toEditMode()},mouseDown:function(ga,ka,pa,za){ga=s(pa,za);F.focus();g(k(ga.x,ga.y));W=pa;ta=za},mouseMove:function(ga,ka){var pa=s(ga,ka);v(pa.x,pa.y)},mouseUp:function(ga,ka,pa){var za=s(ka,pa);v(za.x,za.y,true);ga.target!==B&&ka<W+2&&ka>W-2&&pa<ta+2&&pa>ta-2&&pb.toSelectMode(true)},setCursor:g,toEditMode:function(ga,ka){wa=
false;Ma="textedit";Qa.requestSelector(B).showGrips(false);Qa.requestSelector(B);pb.init();$(B).css("cursor","text");if(arguments.length){var pa=s(ga,ka);g(k(pa.x,pa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(ga){Ma="select";clearInterval(H);H=null;D&&$(D).attr("display","none");C&&$(C).attr("visibility","hidden");$(B).css("cursor","move");if(ga){$a();$(B).css("cursor","move");K("selected",[B]);Kb([B],true)}B&&!B.textContent.length&&b.deleteSelectedElements();$(F).blur();
B=false},setInputElem:function(ga){F=ga},clear:function(){Ma=="textedit"&&pb.toSelectMode()},init:function(){if(B){if(!B.parentNode){B=J[0];Qa.requestSelector(B).showGrips(false)}var ga=B.textContent.length,ka=B.getAttribute("transform");P=svgedit.utilities.getBBox(B);R=ka?ea(B):null;G=Array(ga);F.focus();$(B).unbind("dblclick",t).dblclick(t);if(!ga)var pa={x:P.x+P.width/2,width:0};for(ka=0;ka<ga;ka++){var za=B.getStartPositionOfChar(ka);pa=B.getEndPositionOfChar(ka);if(!svgedit.browser.supportsGoodTextCharPos()){var hb=
b.contentW*p;za.x-=hb;pa.x-=hb;za.x/=p;pa.x/=p}G[ka]={x:za.x,y:P.y,width:pa.x-za.x,height:P.height}}G.push({x:pa.x,width:0});h(F.selectionStart,F.selectionEnd,true)}}}}(),Ua=b.pathActions=function(){var g=false,h,k,v;svgedit.path.Path.prototype.endChanges=function(z){if(svgedit.browser.isWebkit()){var t=this.elem;t.setAttribute("d",Ua.convertPath(t))}z=new Wa(this.elem,{d:this.last_d},z);Ia(z);K("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(z){$.isArray(z)||(z=[z]);
for(var t=0;t<z.length;t++){var B=z[t],F=this.segs[B];F.ptgrip&&this.selected_pts.indexOf(B)==-1&&B>=0&&this.selected_pts.push(B)}this.selected_pts.sort();t=this.selected_pts.length;for(z=Array(t);t--;){F=this.segs[this.selected_pts[t]];F.select(true);z[t]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);K("selected",z)};var s=h=null,E=false;return{mouseDown:function(z,t,B,F){if(Ma==="path"){mouse_x=B;mouse_y=F;F=mouse_x/p;t=mouse_y/p;B=la("path_stretch_line");
k=[F,t];if(m.gridSnapping){F=Ga(F);t=Ga(t);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!B){B=document.createElementNS(c,"path");oa(B,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});B=la("selectorParentGroup").appendChild(B)}B.setAttribute("display","inline");var C=null;if(s){C=s.pathSegList;for(var D=C.numberOfItems,H=6/p,G=false;D;){D--;var P=C.getItem(D),R=P.x;P=P.y;if(F>=R-H&&F<=R+H&&t>=P-H&&t<=P+H){G=true;break}}H=Y();svgedit.path.removePath_(H);H=la(H);R=C.numberOfItems;
if(G){if(D<=1&&R>=2){F=C.getItem(0).x;t=C.getItem(0).y;z=B.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,t):s.createSVGPathSegCurvetoCubicAbs(F,t,z.x1/p,z.y1/p,F,t);F=s.createSVGPathSegClosePath();C.appendItem(z);C.appendItem(F)}else if(R<3)return C=false;$(B).remove();element=H;s=null;Ja=false;if(g){svgedit.path.path.matrix&&nb(H,{},svgedit.path.path.matrix.inverse());B=H.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+B);$(H).remove();
svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Zb(z))){console.log("Clicked outside canvas");return false}C=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(C-1);H=D.x;D=D.y;if(z.shiftKey){z=ca(H,D,F,t);F=z.x;t=z.y}z=B.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(kb(F),kb(t)):s.createSVGPathSegCurvetoCubicAbs(kb(F),kb(t),z.x1/p,z.y1/
p,z.x2/p,z.y2/p);s.pathSegList.appendItem(z);F*=p;t*=p;B.setAttribute("d",["M",F,t,F,t].join(" "));B=C;if(g)B+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(B,F,t)}}else{d_attr="M"+F+","+t+" ";s=da({element:"path",curStyles:true,attr:{d:d_attr,id:na(),opacity:M.opacity/2}});B.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));B=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(B,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();H=z.target.id;
if(H.substr(0,14)=="pathpointgrip_"){t=svgedit.path.path.cur_pt=parseInt(H.substr(14));svgedit.path.path.dragging=[B,F];C=svgedit.path.path.segs[t];if(z.shiftKey)C.selected?svgedit.path.path.removePtFromSelection(t):svgedit.path.path.addPtsToSelection(t);else{if(svgedit.path.path.selected_pts.length<=1||!C.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(t)}}else if(H.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[B,F];z=H.split("_")[1].split("c");t=z[0]-
0;svgedit.path.path.selectPt(t,z[1]-0)}if(!svgedit.path.path.dragging){if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:B*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,t,B){E=true;if(Ma==="path"){if(s){var F=s.pathSegList;z=F.numberOfItems-1;if(k){var C=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");C.setAttribute("cx",t);C.setAttribute("cy",B);C.setAttribute("display","inline");C=k[0];var H=k[1];F.getItem(z);var G=
C+(C-t/p),P=H+(H-B/p);D.setAttribute("cx",G*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var R=svgedit.path.getCtrlLine(2);oa(D,{x1:t,y1:B,x2:C*p,y2:H*p,display:"inline"});oa(R,{x1:G*p,y1:P*p,x2:C*p,y2:H*p,display:"inline"});if(z===0)v=[t,B];else{F=F.getItem(z-1);t=F.x;B=F.y;if(F.pathSegType===6){t+=t-F.x2;B+=B-F.y2}else if(v){t=v[0]/p;B=v[1]/p}svgedit.path.replacePathSeg(6,z,[C,H,t,B,G,P],s)}}else if(C=la("path_stretch_line")){z=F.getItem(z);if(z.pathSegType===
6)svgedit.path.replacePathSeg(6,1,[t,B,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,t,B],C);else v?svgedit.path.replacePathSeg(6,1,[t,B,v[0],v[1],t,B],C):svgedit.path.replacePathSeg(4,1,[t,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);H=svgedit.path.getPointFromGrip({x:t,y:B},svgedit.path.path);z=H.x-C.x;C=H.y-C.y;svgedit.path.path.dragging=[t,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 W=xa.getBBox(),ta=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ta.x,y:ta.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(z,t){if(Ma==="path"){k=null;if(!s){t=la(Y());Ja=false;v=null}return{keep:true,element:t}}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();E&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!E&&svgedit.path.path.selectPt(B)}else if(xa&&xa.getAttribute("display")!="none"){xa.setAttribute("display","none");xa.getAttribute("width")<=2&&xa.getAttribute("height")<=2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);E=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ma="pathedit";$a();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=
svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var t=z==svgedit.path.path.elem;Ma="select";svgedit.path.path.show(false);h=false;$a();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(t){K("selected",[z]);Kb([z],true)}},addSubPath:function(z){if(z){Ma="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ma="pathedit"}else h=z},reorient:function(){var z=J[0];if(z)if(sa(z)!=0){var t=new Oa("Reorient path"),
B={d:z.getAttribute("d"),transform:z.getAttribute("transform")};t.addSubCommand(new Wa(z,B));$a();this.resetOrientation(z);Ia(t);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Kb([z],true);K("changed",J)}},clear:function(){h=null;if(s){var z=la(Y());$(la("path_stretch_line")).remove();$(z).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");s=v=null;Ja=false}else Ma=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z==
null||z.nodeName!="path")return false;var t=V(z),B=ha(t).matrix;t.clear();z.removeAttribute("transform");t=z.pathSegList;for(var F=t.numberOfItems,C=0;C<F;++C){var D=t.getItem(C),H=D.pathSegType;if(H!=1){var G=[];$.each(["",1,2],function(P,R){var W=D["x"+R],ta=D["y"+R];if(W!==undefined&&ta!==undefined){W=O(W,ta,B);G.splice(G.length,0,W.x,W.y)}});svgedit.path.replacePathSeg(H,C,G,z)}}f(z,B)},zoomChange:function(){Ma=="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,t=z.length,B=[];t--;){var F=z[t];svgedit.path.path.addSeg(F);B.push(F+t);B.push(F+t+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 t=svgedit.path.path.elem,B=t.pathSegList,F=z[0],C=null,D=null;svgedit.path.path.eachSeg(function(R){if(this.type===2&&R<=F)D=this.item;if(R<=F)return true;if(this.type===2){C=R;return false}else if(this.type===1)return C=false});if(C==null)C=svgedit.path.path.segs.length-1;if(C!==false){var H=t.createSVGPathSegLinetoAbs(D.x,D.y),G=t.createSVGPathSegClosePath();if(C==svgedit.path.path.segs.length-1){B.appendItem(H);B.appendItem(G)}else{svgedit.path.insertItemBefore(t,G,C);svgedit.path.insertItemBefore(t,
H,C)}svgedit.path.path.init().selectPt(C+1)}else if(svgedit.path.path.segs[F].mate){B.removeItem(F);B.removeItem(F);svgedit.path.path.init().selectPt(F-1)}else{for(z=0;z<B.numberOfItems;z++){var P=B.getItem(z);if(P.pathSegType===2)H=z;else if(z===F)B.removeItem(H);else if(P.pathSegType===1&&F<z){G=z-1;B.removeItem(z);break}}for(z=F-H-1;z--;)svgedit.path.insertItemBefore(t,B.getItem(H),G);t=B.getItem(H);svgedit.path.replacePathSeg(2,H,[t.x,t.y]);z=F;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ua.canDeleteNodes){svgedit.path.path.storeD();
for(var z=svgedit.path.path.selected_pts,t=z.length;t--;)svgedit.path.path.deleteSeg(z[t]);var B=function(){var F=svgedit.path.path.elem.pathSegList,C=F.numberOfItems,D=function(P,R){for(;R--;)F.removeItem(P)};if(C<=1)return true;for(;C--;){var H=F.getItem(C);if(H.pathSegType===1){H=F.getItem(C-1);var G=F.getItem(C-2);if(H.pathSegType===2){D(C-1,2);B();break}else if(G.pathSegType===2){D(C-2,3);B();break}}else if(H.pathSegType===2)if(C>0){H=F.getItem(C-1).pathSegType;if(H===2){D(C-1,1);B();break}else if(H===
1&&F.numberOfItems-1===C){D(C,1);B();break}}}return false};B();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem);b.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 t=z.points,B=t.numberOfItems;if(B>=4){var F=t.getItem(0),C=null;z=[];z.push(["M",F.x,",",
F.y," C"].join(""));for(var D=1;D<=B-4;D+=3){var H=t.getItem(D),G=t.getItem(D+1),P=t.getItem(D+2);if(C)if((F=svgedit.path.smoothControlPoints(C,H,F))&&F.length==2){H=z[z.length-1].split(",");H[2]=F[0].x;H[3]=F[0].y;z[z.length-1]=H.join(",");H=F[1]}z.push([H.x,H.y,G.x,G.y,P.x,P.y].join(","));F=P;C=G}for(z.push("L");D<B;++D){G=t.getItem(D);z.push([G.x,G.y].join(","))}z=z.join(" ");z=da({element:"path",curStyles:true,attr:{id:Y(),d:z,fill:"none"}})}return z},setSegType:function(z){svgedit.path.path.setSegType(z)},
moveNode:function(z,t){var B=svgedit.path.path.selected_pts;if(B.length){svgedit.path.path.storeD();B=svgedit.path.path.segs[B[0]];var F={x:0,y:0};F[z]=t-B.item[z];B.move(F.x,F.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(z){for(var t=z.pathSegList,B=t.numberOfItems,F,C=0;C<B;++C){var D=t.getItem(C);if(D.pathSegType===2)F=D;if(D.pathSegType===1){D=t.getItem(C-1);if(D.x!=F.x||D.y!=F.y){t=z.createSVGPathSegLinetoAbs(F.x,F.y);svgedit.path.insertItemBefore(z,t,C);Ua.fixEnd(z);
break}}}svgedit.browser.isWebkit()&&z.setAttribute("d",Ua.convertPath(z))},convertPath:function(z,t){for(var B=z.pathSegList,F=B.numberOfItems,C=0,D=0,H="",G=null,P=0;P<F;++P){var R=B.getItem(P),W=R.x||0,ta=R.y||0,wa=R.x1||0,ga=R.y1||0,ka=R.x2||0,pa=R.y2||0,za=R.pathSegType,hb=Xa[za]["to"+(t?"Lower":"Upper")+"Case"](),Eb=function(Sb,tb,Jb){tb=tb?" "+tb.join(" "):"";Jb=Jb?" "+svgedit.units.shortFloat(Jb):"";$.each(Sb,function(ub,dc){Sb[ub]=svgedit.units.shortFloat(dc)});H+=hb+Sb.join(" ")+tb+Jb};switch(za){case 1:H+=
"z";break;case 12:W-=C;case 13:if(t){C+=W;hb="l"}else{W+=C;C=W;hb="L"}Eb([[W,D]]);break;case 14:ta-=D;case 15:if(t){D+=ta;hb="l"}else{ta+=D;D=ta;hb="L"}Eb([[C,ta]]);break;case 2:case 4:case 18:W-=C;ta-=D;case 5:case 3:if(G&&B.getItem(P-1).pathSegType===1&&!t){C=G[0];D=G[1]}case 19:if(t){C+=W;D+=ta}else{W+=C;ta+=D;C=W;D=ta}if(za===3)G=[C,D];Eb([[W,ta]]);break;case 6:W-=C;wa-=C;ka-=C;ta-=D;ga-=D;pa-=D;case 7:if(t){C+=W;D+=ta}else{W+=C;wa+=C;ka+=C;ta+=D;ga+=D;pa+=D;C=W;D=ta}Eb([[wa,ga],[ka,pa],[W,ta]]);
break;case 8:W-=C;wa-=C;ta-=D;ga-=D;case 9:if(t){C+=W;D+=ta}else{W+=C;wa+=C;ta+=D;ga+=D;C=W;D=ta}Eb([[wa,ga],[W,ta]]);break;case 10:W-=C;ta-=D;case 11:if(t){C+=W;D+=ta}else{W+=C;ta+=D;C=W;D=ta}Eb([[R.r1,R.r2]],[R.angle,R.largeArcFlag?1:0,R.sweepFlag?1:0],[W,ta]);break;case 16:W-=C;ka-=C;ta-=D;pa-=D;case 17:if(t){C+=W;D+=ta}else{W+=C;ka+=C;ta+=D;pa+=D;C=W;D=ta}Eb([[ka,pa],[W,ta]])}}return H}}}(),hc=this.removeUnusedDefElems=function(){var g=l.getElementsByTagNameNS(c,"defs");if(!g||!g.length)return 0;
for(var h=[],k=0,v=["fill","stroke","filter","marker-start","marker-mid","marker-end"],s=v.length,E=l.getElementsByTagNameNS(c,"*"),z=E.length,t=0;t<z;t++){for(var B=E[t],F=0;F<s;F++){var C=qa(B.getAttribute(v[F]));C&&h.push(C.substr(1))}(B=ba(B))&&B.indexOf("#")===0&&h.push(B.substr(1))}g=$(g).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(t=g.length;t--;){v=g[t];s=v.id;if(h.indexOf(s)<0){Ab[s]=v;v.parentNode.removeChild(v);k++}}return k};this.svgCanvasToString=
function(){for(;hc()>0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&&l.insertBefore(v,l.firstChild)});if(L){$b();Qb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s<v;s++)if(k[s].nodeName=="id"||k[s].nodeName=="style")v--;if(v<=0){k=this.firstChild;g.push(k);$(this).replaceWith(k)}});var h=this.svgToString(l,0);g.length&&$(g).each(function(){Pb(this)});return h};this.svgToString=function(g,
h){var k=[],v=svgedit.utilities.toXml,s=m.baseUnit,E=RegExp("^-?[\\d\\.]+"+s+"$");if(g){Z(g);var z=g.attributes,t,B,F=g.childNodes;for(B=0;B<h;B++)k.push(" ");k.push("<");k.push(g.nodeName);if(g.id==="svgcontent"){B=Vb();if(s!=="px"){B.w=svgedit.units.convertUnit(B.w,s)+s;B.h=svgedit.units.convertUnit(B.h,s)+s}k.push(' width="'+B.w+'" height="'+B.h+'" xmlns="'+c+'"');var C={};$(g).find("*").andSelf().each(function(){$.each(this.attributes,function(P,R){var W=R.namespaceURI;if(W&&!C[W]&&Aa[W]!=="xmlns"&&
Aa[W]!=="xml"){C[W]=true;k.push(" xmlns:"+Aa[W]+'="'+W+'"')}})});B=z.length;for(s=["width","height","xmlns","x","y","viewBox","id","overflow"];B--;){t=z.item(B);var D=v(t.nodeValue);if(t.nodeName.indexOf("xmlns:")!==0)if(D!=""&&s.indexOf(t.localName)==-1)if(!t.namespaceURI||Aa[t.namespaceURI]){k.push(" ");k.push(t.nodeName);k.push('="');k.push(D);k.push('"')}}}else{if(g.nodeName==="defs"&&!g.firstChild)return;var H=["-moz-math-font-style","_moz-math-font-style"];for(B=z.length-1;B>=0;B--){t=z.item(B);
D=v(t.nodeValue);if(!(H.indexOf(t.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(t.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(t.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+s}else D=svgedit.units.shortFloat(D);if(ob.apply&&g.nodeName==="image"&&t.localName==="href"&&ob.images&&ob.images==="embed"){var G=Ya[D];if(G)D=G}if(!t.namespaceURI||t.namespaceURI==c||Aa[t.namespaceURI]){k.push(t.nodeName);k.push('="');k.push(D);
k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(B=0;B<F.length;B++){s=F.item(B);switch(s.nodeType){case 1:k.push("\n");k.push(this.svgToString(F.item(B),h));break;case 3:s=s.nodeValue.replace(/^\s+|\s+$/g,"");if(s!=""){z=true;k.push(v(s)+"")}break;case 4:k.push("\n");k.push(Array(h+1).join(" "));k.push("<![CDATA[");k.push(s.nodeValue);k.push("]]\>");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push("<!--");k.push(s.data);k.push("--\>")}}h--;if(!z){k.push("\n");for(B=0;B<
h;B++)k.push(" ")}k.push("</");k.push(g.nodeName);k.push(">")}else k.push("/>")}return k.join("")};this.embedImage=function(g,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 v=";svgedit_url="+encodeURIComponent(g);v=k.toDataURL().replace(";base64",v+";base64");Ya[g]=v}catch(s){Ya[g]=false}La=g;h&&h(Ya[g])}).attr("src",g)};this.setGoodImage=function(g){La=g};this.open=function(){};this.save=
function(g){$a();g&&$.extend(ob,g);ob.apply=true;g=this.svgCanvasToString();K("saved",g)};this.rasterExport=function(){$a();var g=[],h={feGaussianBlur:Cb.exportNoBlur,foreignObject:Cb.exportNoforeignObject,"[stroke-dasharray]":Cb.exportNoDashArray},k=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))h.text=Cb.exportNoText;$.each(h,function(v,s){k.find(v).length&&g.push(s)});h=this.svgCanvasToString();K("exported",{svg:h,issues:g})};this.getSvgString=function(){ob.apply=false;return this.svgCanvasToString()};
this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,w()):svgedit.draw.randomizeIds(true,w())};var ec=this.uniquifyElems=function(g){var h={},k=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(g,function(t){if(t.nodeType==1){if(t.id){t.id in h||(h[t.id]={elem:null,attrs:[],hrefs:[]});h[t.id].elem=t}$.each(Mb,function(F,C){var D=t.getAttributeNode(C);if(D){var H=svgedit.utilities.getUrlFromAttr(D.value);
if(H=H?H.substr(1):null){H in h||(h[H]={elem:null,attrs:[],hrefs:[]});h[H].attrs.push(D)}}});var B=svgedit.utilities.getHref(t);if(B&&k.indexOf(t.nodeName)>=0)if(B=B.substr(1)){B in h||(h[B]={elem:null,attrs:[],hrefs:[]});h[B].hrefs.push(t)}}});for(var v in h)if(v){var s=h[v].elem;if(s){g=na();s.id=g;s=h[v].attrs;for(var E=s.length;E--;){var z=s[E];z.ownerElement.setAttribute(z.name,"url(#"+g+")")}s=h[v].hrefs;for(E=s.length;E--;)svgedit.utilities.setHref(s[E],"#"+g)}}},cc=this.setUseData=function(g){var h=
$(g);if(g.tagName!=="use")h=h.find("use");h.each(function(){var k=ba(this).substr(1);if(k=la(k)){$(this).data("ref",k);if(k.tagName=="symbol"||k.tagName=="svg")$(this).data("symbol",k).data("ref",k)}})},ac=this.convertGradients=function(g){var h=$(g).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(g).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var k=$(l).find('[fill="url(#'+
t.button===1)){var C=t.button===2;t.altKey&&svgCanvas.cloneSelectedElements(0,0);Eb=l.getScreenCTM().inverse();var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;t.preventDefault();if(C)Ma="select";B=B/p;F=F/p;var D=$b(t);if(D.tagName==="a"&&D.childNodes.length===1)D=D.firstChild;var H=v=h=B,G=s=k=F;if(m.gridSnapping){B=Ga(B);F=Ga(F);h=Ga(h);k=Ga(k)}if(D==Qa.selectorParentGroup&&J[0]!=null){D=t.target;var P=nb(D,"type");if(P=="rotate"){Ma="rotate";current_rotate_mode=nb(D,"dir")}else if(P=="resize"){Ma=
"resize";ob=nb(D,"dir")}D=J[0]}Za=D.getAttribute("transform");P=V(D);switch(Ma){case "select":Ja=true;ob="none";if(C)Ja=false;if(D!=e){if(J.indexOf(D)==-1){t.shiftKey||$a(true);Fb([D]);Lb=D;Ua.clear()}if(!C)for(C=0;C<J.length;++C)if(J[C]!=null){var Q=V(J[C]);Q.numberOfItems?Q.insertItemBefore(e.createSVGTransform(),0):Q.appendItem(e.createSVGTransform())}}else if(!C){$a();Ma="multiselect";if(xa==null)xa=Qa.getRubberBandBox();v*=p;s*=p;oa(xa,{x:v,y:s,width:0,height:0,display:"inline"},100)}break;case "zoom":Ja=
true;if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:H*p,y:H*p,width:0,height:0,display:"inline"},100);break;case "resize":Ja=true;h=B;k=F;E=svgedit.utilities.getBBox($("#selectedBox0")[0]);var W={};$.each(E,function(ua,wa){W[ua]=wa/p});E=W;C=sa(D)?1:0;if(ta(P)){P.insertItemBefore(e.createSVGTransform(),C);P.insertItemBefore(e.createSVGTransform(),C);P.insertItemBefore(e.createSVGTransform(),C)}else{P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());
if(svgedit.browser.supportsNonScalingStroke()){if(B=svgedit.browser.isChrome())Q=function(ua){var wa=ua.getAttributeNS(null,"stroke");ua.removeAttributeNS(null,"stroke");setTimeout(function(){ua.setAttributeNS(null,"stroke",wa)},1)};D.style.vectorEffect="non-scaling-stroke";B&&Q(D);F=D.getElementsByTagName("*");H=F.length;for(C=0;C<H;C++){F[C].style.vectorEffect="non-scaling-stroke";B&&Q(F[C])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ja=true;g=H+","+G+" ";Q=M.stroke_width==0?1:M.stroke_width;
da({element:"polyline",curStyles:true,attr:{points:g,id:na(),fill:"none",opacity:M.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});z.minx=H;z.maxx=H;z.miny=G;z.maxy=G;break;case "image":Ja=true;Q=da({element:"image",attr:{x:B,y:F,width:0,height:0,id:na(),opacity:M.opacity/2,style:"pointer-events:inherit"}});S(Q,La);Zb(Q);break;case "square":case "rect":Ja=true;h=B;k=F;da({element:"rect",curStyles:true,attr:{x:B,y:F,width:0,height:0,id:na(),opacity:M.opacity/2}});break;case "line":Ja=
true;Q=M.stroke_width==0?1:M.stroke_width;da({element:"line",curStyles:true,attr:{x1:B,y1:F,x2:B,y2:F,id:na(),stroke:M.stroke,"stroke-width":Q,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,fill:"none",opacity:M.opacity/2,style:"pointer-events:none"}});break;case "circle":Ja=true;da({element:"circle",curStyles:true,attr:{cx:B,cy:F,r:0,id:na(),opacity:M.opacity/2}});break;case "ellipse":Ja=true;da({element:"ellipse",
curStyles:true,attr:{cx:B,cy:F,rx:0,ry:0,id:na(),opacity:M.opacity/2}});break;case "text":Ja=true;da({element:"text",curStyles:true,attr:{x:B,y:F,id:na(),fill:fb.fill,"stroke-width":fb.stroke_width,"font-size":fb.font_size,"font-family":fb.font_family,"text-anchor":"left","xml:space":"preserve",opacity:M.opacity}});break;case "path":case "pathedit":h*=p;k*=p;Ua.mouseDown(t,D,h,k);Ja=true;break;case "textedit":h*=p;k*=p;gb.mouseDown(t,D,h,k);Ja=true;break;case "rotate":Ja=true;b.undoMgr.beginUndoableChange("transform",
J);document.getElementById("workarea").className="rotate"}Q=sb("mouseDown",{event:t,start_x:h,start_y:k,selectedElements:J},true);$.each(Q,function(ua,wa){if(wa&&wa.started)Ja=true});if(Ma)document.getElementById("workarea").className=Ma=="resize"?t.target.style.cursor:Ma}}).mousemove(function(t){if(Ja)if(!(t.button===1||b.spaceKey)){var C=J[0],F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;var D=la(Y()),H=x=B/p,G=y=F/p;if(m.gridSnapping){x=Ga(x);y=Ga(y)}t.preventDefault();switch(Ma){case "select":if(J[0]!==
null){H=x-h;var P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P)}if(t.shiftKey){var Q=ca(h,k,x,y);x=Q.x;y=Q.y}if(H!=0||P!=0){Q=J.length;for(G=0;G<Q;++G){C=J[G];if(C==null)break;var W=e.createSVGTransform();D=V(C);W.setTranslate(H,P);D.numberOfItems?D.replaceItem(W,0):D.appendItem(W);Qa.requestSelector(C).resize()}K("transition",J)}}break;case "multiselect":H*=p;G*=p;oa(xa,{x:Math.min(v,H),y:Math.min(s,G),width:Math.abs(H-v),height:Math.abs(G-s)},100);D=[];H=[];W=Gb();Q=J.length;for(G=0;G<Q;++G){P=W.indexOf(J[G]);
if(P==-1)D.push(J[G]);else W[P]=null}Q=W.length;for(G=0;G<Q;++G)W[G]&&H.push(W[G]);D.length>0&&b.removeFromSelection(D);H.length>0&&Fb(H);break;case "resize":D=V(C);H=(Q=ta(D))?E:svgedit.utilities.getBBox(C);G=H.x;W=H.y;var ua=H.width,wa=H.height;H=x-h;P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var fa=sa(C);if(fa){var ka=Math.sqrt(H*H+P*P);P=Math.atan2(P,H)-fa*Math.PI/180;H=ka*Math.cos(P);P=ka*Math.sin(P)}if(ob.indexOf("n")==-1&&ob.indexOf("s")==-1)P=0;if(ob.indexOf("e")==-1&&ob.indexOf("w")==
-1)H=0;var qa=ka=0,za=wa?(wa+P)/wa:1,jb=ua?(ua+H)/ua:1;if(ob.indexOf("n")>=0){za=wa?(wa-P)/wa:1;qa=wa}if(ob.indexOf("w")>=0){jb=ua?(ua-H)/ua:1;ka=ua}H=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){G=Ga(G);ka=Ga(ka);W=Ga(W);qa=Ga(qa)}H.setTranslate(-(G+ka),-(W+qa));if(t.shiftKey)if(jb==1)jb=za;else za=jb;P.setScale(jb,za);ua.setTranslate(G+ka,W+qa);if(Q){Q=fa?1:0;D.replaceItem(H,2+Q);D.replaceItem(P,1+Q);D.replaceItem(ua,0+Q)}else{Q=D.numberOfItems;D.replaceItem(ua,
Q-3);D.replaceItem(P,Q-2);D.replaceItem(H,Q-1)}Qa.requestSelector(C).resize();K("transition",J);break;case "zoom":H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100);break;case "text":oa(D,{x:x,y:y},1E3);break;case "line":H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);y=Ga(y)}G=x;Q=y;if(t.shiftKey){Q=ca(h,k,G,Q);G=Q.x;Q=Q.y}D.setAttributeNS(null,"x2",G);D.setAttributeNS(null,"y2",Q);window.opera||e.unsuspendRedraw(H);break;
case "foreignObject":case "square":case "rect":case "image":H=Math.abs(x-h);Q=Math.abs(y-k);if(Ma=="square"||t.shiftKey){H=Q=Math.max(H,Q);G=h<x?h:h-H;W=k<y?k:k-Q}else{G=Math.min(h,x);W=Math.min(k,y)}if(t.altKey){H*=2;Q*=2;G=h-H/2;W=k-Q/2}if(m.gridSnapping){H=Ga(H);Q=Ga(Q);G=Ga(G);W=Ga(W)}oa(D,{width:H,height:Q,x:G,y:W},1E3);break;case "circle":H=$(D).attr(["cx","cy"]);Q=H.cx;G=H.cy;H=Math.sqrt((x-Q)*(x-Q)+(y-G)*(y-G));if(m.gridSnapping)H=Ga(H);D.setAttributeNS(null,"r",H);break;case "ellipse":$(D).attr(["cx",
"cy"]);Q=Math.abs(h+(x-h)/2);G=Math.abs(k+(y-k)/2);H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);Q=Ga(Q);y=Ga(y);G=Ga(G)}W=Math.abs(h-Q);P=Math.abs(k-G);if(t.shiftKey){P=W;G=y>k?k+W:k-W}if(t.altKey){Q=h;G=k;W=Math.abs(x-Q);P=t.shiftKey?W:Math.abs(y-G)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P);D.setAttributeNS(null,"cx",Q);D.setAttributeNS(null,"cy",G);window.opera||e.unsuspendRedraw(H);break;case "fhellipse":case "fhrect":z.minx=Math.min(H,z.minx);z.maxx=Math.max(H,
z.maxx);z.miny=Math.min(G,z.miny);z.maxy=Math.max(G,z.maxy);case "fhpath":g+=+H+","+G+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(t.shiftKey){if(Q=svgedit.path.path){D=Q.dragging?Q.dragging[0]:h;Q=Q.dragging?Q.dragging[1]:k}else{D=h;Q=k}Q=ca(D,Q,x,y);x=Q.x;y=Q.y}if(xa&&xa.getAttribute("display")!=="none"){H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100)}Ua.mouseMove(t,
x,y);break;case "textedit":x*=p;y*=p;gb.mouseMove(B,F);break;case "rotate":H=svgedit.utilities.getBBox(C);Q=H.x+H.width/2;G=H.y+H.height/2;D=ea(C);D=O(Q,G,D);Q=D.x;G=D.y;D=H.x;W=H.y;if(current_rotate_mode=="nw")D=H.x+H.width;if(current_rotate_mode=="se")W=H.y+H.height;if(current_rotate_mode=="sw"){D=H.x+H.width;W=H.y+H.height}compensation_angle=(Math.atan2(G-W,Q-D)*(180/Math.PI)-90)%360;fa=(Math.atan2(G-y,Q-x)*(180/Math.PI)-90)%360;fa+=compensation_angle;if(m.gridSnapping)fa=Ga(fa);if(t.shiftKey)fa=
Math.round(fa/45)*45;b.setRotationAngle(fa<-180?360+fa:fa,true);K("transition",J)}sb("mouseMove",{event:t,mouse_x:B,mouse_y:F,selected:C})}}).click(function(t){t.preventDefault();return false}).dblclick(function(t){var C=t.target.parentNode;if(C!==L){var F=$b(t),B=F.tagName;if(B==="text"&&Ma!=="textedit"){t=O(t.pageX,t.pageY,Eb);gb.select(F,t.x,t.y)}if((B==="g"||B==="a")&&sa(F)){dc(F);F=J[0];$a(true)}L&&Sb();C.tagName!=="g"&&C.tagName!=="a"||C===w().getCurrentLayer()||F===Qa.selectorParentGroup||
mc(F)}}).mouseup(function(t){if(t.button!==2){var C=Lb;Lb=null;if(Ja){var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;var D=B/p,H=F/p,G=la(Y()),P=false;Ja=false;switch(Ma){case "resize":case "multiselect":if(xa!=null){xa.setAttribute("display","none");ub=[]}Ma="select";case "select":if(J[0]!=null){if(J[1]==null){B=J[0];switch(B.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ib.fill=B.getAttribute("fill");ib.fill_opacity=B.getAttribute("fill-opacity");ib.stroke=B.getAttribute("stroke");
ib.stroke_opacity=B.getAttribute("stroke-opacity");ib.stroke_width=B.getAttribute("stroke-width");ib.stroke_dasharray=B.getAttribute("stroke-dasharray");ib.stroke_linejoin=B.getAttribute("stroke-linejoin");ib.stroke_linecap=B.getAttribute("stroke-linecap")}if(B.tagName=="text"){fb.font_size=B.getAttribute("font-size");fb.font_family=B.getAttribute("font-family")}Qa.requestSelector(B).showGrips(true)}Pa();if(D!=v||H!=s){t=J.length;for(B=0;B<t;++B){if(J[B]==null)break;J[B].firstChild||Qa.requestSelector(J[B]).resize()}}else{B=
t.target;if(J[0].nodeName==="path"&&J[1]==null)Ua.select(J[0]);else t.shiftKey&&C!=B&&b.removeFromSelection([B])}if(svgedit.browser.supportsNonScalingStroke())if(t=J[0]){t.removeAttribute("style");svgedit.utilities.walkTree(t,function(ua){ua.removeAttribute("style")})}}return;case "zoom":xa!=null&&xa.setAttribute("display","none");K("zoomed",{x:Math.min(v,D),y:Math.min(s,H),width:Math.abs(D-v),height:Math.abs(H-s),factor:t.altKey?0.5:2});return;case "fhpath":C=G.getAttribute("points");D=C.indexOf(",");
if(P=D>=0?C.indexOf(",",D+1)>=0:C.indexOf(" ",C.indexOf(" ")+1)>=0)G=Ua.smoothPolylineIntoPath(G);break;case "line":C=$(G).attr(["x1","x2","y1","y2"]);P=C.x1!=C.x2||C.y1!=C.y2;break;case "foreignObject":case "square":case "rect":case "image":C=$(G).attr(["width","height"]);P=C.width!=0||C.height!=0||Ma==="image";break;case "circle":P=G.getAttribute("r")!=0;break;case "ellipse":C=$(G).attr(["rx","ry"]);P=C.rx!=null||C.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({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:Y()}});K("changed",[G]);P=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx-z.minx,height:z.maxy-z.miny,id:Y()}});K("changed",[G]);P=true}break;case "text":P=true;Pb([G]);gb.start(G);break;case "path":G=null;Ja=true;C=Ua.mouseUp(t,G,B,F);G=C.element;P=C.keep;break;case "pathedit":P=true;G=null;Ua.mouseUp(t);
break;case "textedit":P=false;G=null;gb.mouseUp(t,B,F);break;case "rotate":P=true;G=null;Ma="select";C=b.undoMgr.finishUndoableChange();C.isEmpty()||Ia(C);Pa();K("changed",J)}B=sb("mouseUp",{event:t,mouse_x:B,mouse_y:F},true);$.each(B,function(ua,wa){if(wa){P=wa.keep||P;G=wa.element;Ja=wa.started||Ja}});if(!P&&G!=null){w().releaseId(Y());G.parentNode.removeChild(G);G=null;for(B=t.target;B.parentNode.parentNode.tagName=="g";)B=B.parentNode;if((Ma!="path"||!drawn_path)&&B.parentNode.id!="selectorParentGroup"&&
B.id!="svgcanvas"&&B.id!="svgroot"){b.setMode("select");Pb([B],true)}}else if(G!=null){b.addedNew=true;t=0.2;var Q;if(false.beginElement&&G.getAttribute("opacity")!=M.opacity){Q=$(false).clone().attr({to:M.opacity,dur:t}).appendTo(G);try{Q[0].beginElement()}catch(W){}}else t=0;setTimeout(function(){Q&&Q.remove();G.setAttribute("opacity",M.opacity);G.setAttribute("style","pointer-events:inherit");Z(G);if(Ma==="path")Ua.toEditMode(G);else m.selectNew&&Pb([G],true);Ia(new Na(G));K("changed",[G])},t*
1E3)}Za=null}}});$(a).bind("mousewheel DOMMouseScroll",function(t){if(t.shiftKey){t.preventDefault();Eb=l.getScreenCTM().inverse();var C=O(t.pageX,t.pageY,Eb);C={x:C.x,y:C.y,width:0,height:0};if(t.wheelDelta)if(t.wheelDelta>=120)C.factor=2;else{if(t.wheelDelta<=-120)C.factor=0.5}else if(t.detail)if(t.detail>0)C.factor=0.5;else if(t.detail<0)C.factor=2;C.factor&&K("zoomed",C)}})})();var Zb=function(g){$(g).click(function(h){h.preventDefault()})},gb=b.textActions=function(){function g(fa){var ka=F.value===
"";$(F).focus();if(!arguments.length)if(ka)fa=0;else{if(F.selectionEnd!==F.selectionStart)return;fa=F.selectionEnd}var qa;qa=G[fa];ka||F.setSelectionRange(fa,fa);B=la("text_cursor");if(!B){B=document.createElementNS(c,"line");oa(B,{id:"text_cursor",stroke:"#333","stroke-width":1});B=la("selectorParentGroup").appendChild(B)}H||(H=setInterval(function(){var za=B.getAttribute("display")==="none";B.setAttribute("display",za?"inline":"none")},600));ka=E(qa.x,P.y);qa=E(qa.x,P.y+P.height);oa(B,{x1:ka.x,
y1:ka.y,x2:qa.x,y2:qa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(fa,ka,qa){if(fa===ka)g(ka);else{qa||F.setSelectionRange(fa,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");oa(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}fa=G[fa];var za=G[ka];B.setAttribute("visibility","hidden");ka=E(fa.x,P.y);qa=E(fa.x+(za.x-fa.x),P.y);var jb=E(fa.x,P.y+P.height);fa=E(fa.x+(za.x-
fa.x),P.y+P.height);oa(D,{d:"M"+ka.x+","+ka.y+" L"+qa.x+","+qa.y+" "+fa.x+","+fa.y+" "+jb.x+","+jb.y+"z",display:"inline"})}}function k(fa,ka){var qa=e.createSVGPoint();qa.x=fa;qa.y=ka;if(G.length==1)return 0;qa=C.getCharNumAtPosition(qa);if(qa<0){qa=G.length-2;if(fa<=G[0].x)qa=0}else if(qa>=G.length-2)qa=G.length-2;var za=G[qa];fa>za.x+za.width/2&&qa++;return qa}function v(fa,ka,qa){var za=F.selectionStart;fa=k(fa,ka);h(Math.min(za,fa),Math.max(za,fa),!qa)}function s(fa,ka){var qa={x:fa,y:ka};qa.x/=
p;qa.y/=p;if(Q){var za=O(qa.x,qa.y,Q.inverse());qa.x=za.x;qa.y=za.y}return qa}function E(fa,ka){var qa={x:fa,y:ka};if(Q){var za=O(qa.x,qa.y,Q);qa.x=za.x;qa.y=za.y}qa.x*=p;qa.y*=p;return qa}function z(fa){h(0,C.textContent.length);$(this).unbind(fa)}function t(fa){if(wa&&C){var ka=O(fa.pageX,fa.pageY,Eb);ka=s(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var qa=C.textContent,za=qa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;qa=qa.substr(ka).match(/^[a-z0-9]+/i);h(za,(qa?qa[0].length:0)+ka);$(fa.target).click(z);
setTimeout(function(){$(fa.target).unbind("click",z)},300)}}var C,F,B,D,H,G=[],P,Q,W,ua,wa;return{select:function(fa,ka,qa){C=fa;gb.toEditMode(ka,qa)},start:function(fa){C=fa;gb.toEditMode()},mouseDown:function(fa,ka,qa,za){fa=s(qa,za);F.focus();g(k(fa.x,fa.y));W=qa;ua=za},mouseMove:function(fa,ka){var qa=s(fa,ka);v(qa.x,qa.y)},mouseUp:function(fa,ka,qa){var za=s(ka,qa);v(za.x,za.y,true);fa.target!==C&&ka<W+2&&ka>W-2&&qa<ua+2&&qa>ua-2&&gb.toSelectMode(true)},setCursor:g,toEditMode:function(fa,ka){wa=
false;Ma="textedit";Qa.requestSelector(C).showGrips(false);Qa.requestSelector(C);gb.init();$(C).css("cursor","text");if(arguments.length){var qa=s(fa,ka);g(k(qa.x,qa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(fa){Ma="select";clearInterval(H);H=null;D&&$(D).attr("display","none");B&&$(B).attr("visibility","hidden");$(C).css("cursor","move");if(fa){$a();$(C).css("cursor","move");K("selected",[C]);Fb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur();
C=false},setInputElem:function(fa){F=fa},clear:function(){Ma=="textedit"&&gb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=J[0];Qa.requestSelector(C).showGrips(false)}var fa=C.textContent.length,ka=C.getAttribute("transform");P=svgedit.utilities.getBBox(C);Q=ka?ea(C):null;G=Array(fa);F.focus();$(C).unbind("dblclick",t).dblclick(t);if(!fa)var qa={x:P.x+P.width/2,width:0};for(ka=0;ka<fa;ka++){var za=C.getStartPositionOfChar(ka);qa=C.getEndPositionOfChar(ka);if(!svgedit.browser.supportsGoodTextCharPos()){var jb=
b.contentW*p;za.x-=jb;qa.x-=jb;za.x/=p;qa.x/=p}G[ka]={x:za.x,y:P.y,width:qa.x-za.x,height:P.height}}G.push({x:qa.x,width:0});h(F.selectionStart,F.selectionEnd,true)}}}}(),Ua=b.pathActions=function(){var g=false,h,k,v;svgedit.path.Path.prototype.endChanges=function(z){if(svgedit.browser.isWebkit()){var t=this.elem;t.setAttribute("d",Ua.convertPath(t))}z=new Wa(this.elem,{d:this.last_d},z);Ia(z);K("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(z){$.isArray(z)||(z=[z]);
for(var t=0;t<z.length;t++){var C=z[t],F=this.segs[C];F.ptgrip&&this.selected_pts.indexOf(C)==-1&&C>=0&&this.selected_pts.push(C)}this.selected_pts.sort();t=this.selected_pts.length;for(z=Array(t);t--;){F=this.segs[this.selected_pts[t]];F.select(true);z[t]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);K("selected",z)};var s=h=null,E=false;return{mouseDown:function(z,t,C,F){if(Ma==="path"){mouse_x=C;mouse_y=F;F=mouse_x/p;t=mouse_y/p;C=la("path_stretch_line");
k=[F,t];if(m.gridSnapping){F=Ga(F);t=Ga(t);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!C){C=document.createElementNS(c,"path");oa(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=la("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var B=null;if(s){B=s.pathSegList;for(var D=B.numberOfItems,H=6/p,G=false;D;){D--;var P=B.getItem(D),Q=P.x;P=P.y;if(F>=Q-H&&F<=Q+H&&t>=P-H&&t<=P+H){G=true;break}}H=Y();svgedit.path.removePath_(H);H=la(H);Q=B.numberOfItems;
if(G){if(D<=1&&Q>=2){F=B.getItem(0).x;t=B.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,t):s.createSVGPathSegCurvetoCubicAbs(F,t,z.x1/p,z.y1/p,F,t);F=s.createSVGPathSegClosePath();B.appendItem(z);B.appendItem(F)}else if(Q<3)return B=false;$(C).remove();element=H;s=null;Ja=false;if(g){svgedit.path.path.matrix&&pb(H,{},svgedit.path.path.matrix.inverse());C=H.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(H).remove();
svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,$b(z))){console.log("Clicked outside canvas");return false}B=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(B-1);H=D.x;D=D.y;if(z.shiftKey){z=ca(H,D,F,t);F=z.x;t=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(mb(F),mb(t)):s.createSVGPathSegCurvetoCubicAbs(mb(F),mb(t),z.x1/p,z.y1/
p,z.x2/p,z.y2/p);s.pathSegList.appendItem(z);F*=p;t*=p;C.setAttribute("d",["M",F,t,F,t].join(" "));C=B;if(g)C+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(C,F,t)}}else{d_attr="M"+F+","+t+" ";s=da({element:"path",curStyles:true,attr:{d:d_attr,id:na(),opacity:M.opacity/2}});C.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));C=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(C,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();H=z.target.id;
if(H.substr(0,14)=="pathpointgrip_"){t=svgedit.path.path.cur_pt=parseInt(H.substr(14));svgedit.path.path.dragging=[C,F];B=svgedit.path.path.segs[t];if(z.shiftKey)B.selected?svgedit.path.path.removePtFromSelection(t):svgedit.path.path.addPtsToSelection(t);else{if(svgedit.path.path.selected_pts.length<=1||!B.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(t)}}else if(H.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=H.split("_")[1].split("c");t=z[0]-
0;svgedit.path.path.selectPt(t,z[1]-0)}if(!svgedit.path.path.dragging){if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:C*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,t,C){E=true;if(Ma==="path"){if(s){var F=s.pathSegList;z=F.numberOfItems-1;if(k){var B=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");B.setAttribute("cx",t);B.setAttribute("cy",C);B.setAttribute("display","inline");B=k[0];var H=k[1];F.getItem(z);var G=
B+(B-t/p),P=H+(H-C/p);D.setAttribute("cx",G*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var Q=svgedit.path.getCtrlLine(2);oa(D,{x1:t,y1:C,x2:B*p,y2:H*p,display:"inline"});oa(Q,{x1:G*p,y1:P*p,x2:B*p,y2:H*p,display:"inline"});if(z===0)v=[t,C];else{F=F.getItem(z-1);t=F.x;C=F.y;if(F.pathSegType===6){t+=t-F.x2;C+=C-F.y2}else if(v){t=v[0]/p;C=v[1]/p}svgedit.path.replacePathSeg(6,z,[B,H,t,C,G,P],s)}}else if(B=la("path_stretch_line")){z=F.getItem(z);if(z.pathSegType===
6)svgedit.path.replacePathSeg(6,1,[t,C,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,t,C],B);else v?svgedit.path.replacePathSeg(6,1,[t,C,v[0],v[1],t,C],B):svgedit.path.replacePathSeg(4,1,[t,C],B)}}}else if(svgedit.path.path.dragging){B=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);H=svgedit.path.getPointFromGrip({x:t,y:C},svgedit.path.path);z=H.x-B.x;B=H.y-B.y;svgedit.path.path.dragging=[t,C];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(z,
B):svgedit.path.path.movePts(z,B)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var W=xa.getBBox(),ua=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ua.x,y:ua.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(z,t){if(Ma==="path"){k=null;if(!s){t=la(Y());Ja=false;v=null}return{keep:true,element:t}}if(svgedit.path.path.dragging){var C=svgedit.path.path.cur_pt;svgedit.path.path.dragging=
false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();E&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!E&&svgedit.path.path.selectPt(C)}else if(xa&&xa.getAttribute("display")!="none"){xa.setAttribute("display","none");xa.getAttribute("width")<=2&&xa.getAttribute("height")<=2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);E=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ma="pathedit";$a();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=
svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var t=z==svgedit.path.path.elem;Ma="select";svgedit.path.path.show(false);h=false;$a();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(t){K("selected",[z]);Fb([z],true)}},addSubPath:function(z){if(z){Ma="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ma="pathedit"}else h=z},reorient:function(){var z=J[0];if(z)if(sa(z)!=0){var t=new Oa("Reorient path"),
C={d:z.getAttribute("d"),transform:z.getAttribute("transform")};t.addSubCommand(new Wa(z,C));$a();this.resetOrientation(z);Ia(t);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Fb([z],true);K("changed",J)}},clear:function(){h=null;if(s){var z=la(Y());$(la("path_stretch_line")).remove();$(z).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");s=v=null;Ja=false}else Ma=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z==
null||z.nodeName!="path")return false;var t=V(z),C=ha(t).matrix;t.clear();z.removeAttribute("transform");t=z.pathSegList;for(var F=t.numberOfItems,B=0;B<F;++B){var D=t.getItem(B),H=D.pathSegType;if(H!=1){var G=[];$.each(["",1,2],function(P,Q){var W=D["x"+Q],ua=D["y"+Q];if(W!==undefined&&ua!==undefined){W=O(W,ua,C);G.splice(G.length,0,W.x,W.y)}});svgedit.path.replacePathSeg(H,B,G,z)}}f(z,C)},zoomChange:function(){Ma=="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,t=z.length,C=[];t--;){var F=z[t];svgedit.path.path.addSeg(F);C.push(F+t);C.push(F+t+1)}svgedit.path.path.init().addPtsToSelection(C);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var z=svgedit.path.path.selected_pts;if(z.length===
1){var t=svgedit.path.path.elem,C=t.pathSegList,F=z[0],B=null,D=null;svgedit.path.path.eachSeg(function(Q){if(this.type===2&&Q<=F)D=this.item;if(Q<=F)return true;if(this.type===2){B=Q;return false}else if(this.type===1)return B=false});if(B==null)B=svgedit.path.path.segs.length-1;if(B!==false){var H=t.createSVGPathSegLinetoAbs(D.x,D.y),G=t.createSVGPathSegClosePath();if(B==svgedit.path.path.segs.length-1){C.appendItem(H);C.appendItem(G)}else{svgedit.path.insertItemBefore(t,G,B);svgedit.path.insertItemBefore(t,
H,B)}svgedit.path.path.init().selectPt(B+1)}else if(svgedit.path.path.segs[F].mate){C.removeItem(F);C.removeItem(F);svgedit.path.path.init().selectPt(F-1)}else{for(z=0;z<C.numberOfItems;z++){var P=C.getItem(z);if(P.pathSegType===2)H=z;else if(z===F)C.removeItem(H);else if(P.pathSegType===1&&F<z){G=z-1;C.removeItem(z);break}}for(z=F-H-1;z--;)svgedit.path.insertItemBefore(t,C.getItem(H),G);t=C.getItem(H);svgedit.path.replacePathSeg(2,H,[t.x,t.y]);z=F;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ua.canDeleteNodes){svgedit.path.path.storeD();
for(var z=svgedit.path.path.selected_pts,t=z.length;t--;)svgedit.path.path.deleteSeg(z[t]);var C=function(){var F=svgedit.path.path.elem.pathSegList,B=F.numberOfItems,D=function(P,Q){for(;Q--;)F.removeItem(P)};if(B<=1)return true;for(;B--;){var H=F.getItem(B);if(H.pathSegType===1){H=F.getItem(B-1);var G=F.getItem(B-2);if(H.pathSegType===2){D(B-1,2);C();break}else if(G.pathSegType===2){D(B-2,3);C();break}}else if(H.pathSegType===2)if(B>0){H=F.getItem(B-1).pathSegType;if(H===2){D(B-1,1);C();break}else if(H===
1&&F.numberOfItems-1===B){D(B,1);C();break}}}return false};C();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem);b.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 t=z.points,C=t.numberOfItems;if(C>=4){var F=t.getItem(0),B=null;z=[];z.push(["M",F.x,",",
F.y," C"].join(""));for(var D=1;D<=C-4;D+=3){var H=t.getItem(D),G=t.getItem(D+1),P=t.getItem(D+2);if(B)if((F=svgedit.path.smoothControlPoints(B,H,F))&&F.length==2){H=z[z.length-1].split(",");H[2]=F[0].x;H[3]=F[0].y;z[z.length-1]=H.join(",");H=F[1]}z.push([H.x,H.y,G.x,G.y,P.x,P.y].join(","));F=P;B=G}for(z.push("L");D<C;++D){G=t.getItem(D);z.push([G.x,G.y].join(","))}z=z.join(" ");z=da({element:"path",curStyles:true,attr:{id:Y(),d:z,fill:"none"}})}return z},setSegType:function(z){svgedit.path.path.setSegType(z)},
moveNode:function(z,t){var C=svgedit.path.path.selected_pts;if(C.length){svgedit.path.path.storeD();C=svgedit.path.path.segs[C[0]];var F={x:0,y:0};F[z]=t-C.item[z];C.move(F.x,F.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(z){for(var t=z.pathSegList,C=t.numberOfItems,F,B=0;B<C;++B){var D=t.getItem(B);if(D.pathSegType===2)F=D;if(D.pathSegType===1){D=t.getItem(B-1);if(D.x!=F.x||D.y!=F.y){t=z.createSVGPathSegLinetoAbs(F.x,F.y);svgedit.path.insertItemBefore(z,t,B);Ua.fixEnd(z);
break}}}svgedit.browser.isWebkit()&&z.setAttribute("d",Ua.convertPath(z))},convertPath:function(z,t){for(var C=z.pathSegList,F=C.numberOfItems,B=0,D=0,H="",G=null,P=0;P<F;++P){var Q=C.getItem(P),W=Q.x||0,ua=Q.y||0,wa=Q.x1||0,fa=Q.y1||0,ka=Q.x2||0,qa=Q.y2||0,za=Q.pathSegType,jb=Xa[za]["to"+(t?"Lower":"Upper")+"Case"](),zb=function(Qb,Ib,Ob){Ib=Ib?" "+Ib.join(" "):"";Ob=Ob?" "+svgedit.units.shortFloat(Ob):"";$.each(Qb,function(Ub,ac){Qb[Ub]=svgedit.units.shortFloat(ac)});H+=jb+Qb.join(" ")+Ib+Ob};switch(za){case 1:H+=
"z";break;case 12:W-=B;case 13:if(t){B+=W;jb="l"}else{W+=B;B=W;jb="L"}zb([[W,D]]);break;case 14:ua-=D;case 15:if(t){D+=ua;jb="l"}else{ua+=D;D=ua;jb="L"}zb([[B,ua]]);break;case 2:case 4:case 18:W-=B;ua-=D;case 5:case 3:if(G&&C.getItem(P-1).pathSegType===1&&!t){B=G[0];D=G[1]}case 19:if(t){B+=W;D+=ua}else{W+=B;ua+=D;B=W;D=ua}if(za===3)G=[B,D];zb([[W,ua]]);break;case 6:W-=B;wa-=B;ka-=B;ua-=D;fa-=D;qa-=D;case 7:if(t){B+=W;D+=ua}else{W+=B;wa+=B;ka+=B;ua+=D;fa+=D;qa+=D;B=W;D=ua}zb([[wa,fa],[ka,qa],[W,ua]]);
break;case 8:W-=B;wa-=B;ua-=D;fa-=D;case 9:if(t){B+=W;D+=ua}else{W+=B;wa+=B;ua+=D;fa+=D;B=W;D=ua}zb([[wa,fa],[W,ua]]);break;case 10:W-=B;ua-=D;case 11:if(t){B+=W;D+=ua}else{W+=B;ua+=D;B=W;D=ua}zb([[Q.r1,Q.r2]],[Q.angle,Q.largeArcFlag?1:0,Q.sweepFlag?1:0],[W,ua]);break;case 16:W-=B;ka-=B;ua-=D;qa-=D;case 17:if(t){B+=W;D+=ua}else{W+=B;ka+=B;ua+=D;qa+=D;B=W;D=ua}zb([[ka,qa],[W,ua]])}}return H}}}(),ic=this.removeUnusedDefElems=function(){var g=l.getElementsByTagNameNS(c,"defs");if(!g||!g.length)return 0;
for(var h=[],k=0,v=["fill","stroke","filter","marker-start","marker-mid","marker-end"],s=v.length,E=l.getElementsByTagNameNS(c,"*"),z=E.length,t=0;t<z;t++){for(var C=E[t],F=0;F<s;F++){var B=pa(C.getAttribute(v[F]));B&&h.push(B.substr(1))}(C=ba(C))&&C.indexOf("#")===0&&h.push(C.substr(1))}g=$(g).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(t=g.length;t--;){v=g[t];s=v.id;if(h.indexOf(s)<0){yb[s]=v;v.parentNode.removeChild(v);k++}}return k};this.svgCanvasToString=
function(){for(;ic()>0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&&l.insertBefore(v,l.firstChild)});if(L){Sb();Pb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s<v;s++)if(k[s].nodeName=="id"||k[s].nodeName=="style")v--;if(v<=0){k=this.firstChild;g.push(k);$(this).replaceWith(k)}});var h=this.svgToString(l,0);g.length&&$(g).each(function(){Nb(this)});return h};this.svgToString=function(g,
h){var k=[],v=svgedit.utilities.toXml,s=m.baseUnit,E=RegExp("^-?[\\d\\.]+"+s+"$");if(g){Z(g);var z=g.attributes,t,C,F=g.childNodes;for(C=0;C<h;C++)k.push(" ");k.push("<");k.push(g.nodeName);if(g.id==="svgcontent"){C=Vb();if(s!=="px"){C.w=svgedit.units.convertUnit(C.w,s)+s;C.h=svgedit.units.convertUnit(C.h,s)+s}k.push(' width="'+C.w+'" height="'+C.h+'" xmlns="'+c+'"');var B={};$(g).find("*").andSelf().each(function(){$.each(this.attributes,function(P,Q){var W=Q.namespaceURI;if(W&&!B[W]&&Aa[W]!=="xmlns"&&
Aa[W]!=="xml"){B[W]=true;k.push(" xmlns:"+Aa[W]+'="'+W+'"')}})});C=z.length;for(s=["width","height","xmlns","x","y","viewBox","id","overflow"];C--;){t=z.item(C);var D=v(t.nodeValue);if(t.nodeName.indexOf("xmlns:")!==0)if(D!=""&&s.indexOf(t.localName)==-1)if(!t.namespaceURI||Aa[t.namespaceURI]){k.push(" ");k.push(t.nodeName);k.push('="');k.push(D);k.push('"')}}}else{if(g.nodeName==="defs"&&!g.firstChild)return;var H=["-moz-math-font-style","_moz-math-font-style"];for(C=z.length-1;C>=0;C--){t=z.item(C);
D=v(t.nodeValue);if(!(H.indexOf(t.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(t.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(t.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+s}else D=svgedit.units.shortFloat(D);if(qb.apply&&g.nodeName==="image"&&t.localName==="href"&&qb.images&&qb.images==="embed"){var G=Ya[D];if(G)D=G}if(!t.namespaceURI||t.namespaceURI==c||Aa[t.namespaceURI]){k.push(t.nodeName);k.push('="');k.push(D);
k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(C=0;C<F.length;C++){s=F.item(C);switch(s.nodeType){case 1:k.push("\n");k.push(this.svgToString(F.item(C),h));break;case 3:s=s.nodeValue.replace(/^\s+|\s+$/g,"");if(s!=""){z=true;k.push(v(s)+"")}break;case 4:k.push("\n");k.push(Array(h+1).join(" "));k.push("<![CDATA[");k.push(s.nodeValue);k.push("]]\>");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push("<!--");k.push(s.data);k.push("--\>")}}h--;if(!z){k.push("\n");for(C=0;C<
h;C++)k.push(" ")}k.push("</");k.push(g.nodeName);k.push(">")}else k.push("/>")}return k.join("")};this.embedImage=function(g,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 v=";svgedit_url="+encodeURIComponent(g);v=k.toDataURL().replace(";base64",v+";base64");Ya[g]=v}catch(s){Ya[g]=false}La=g;h&&h(Ya[g])}).attr("src",g)};this.setGoodImage=function(g){La=g};this.open=function(){};this.save=
function(g){$a();g&&$.extend(qb,g);qb.apply=true;g=this.svgCanvasToString();K("saved",g)};this.rasterExport=function(){$a();var g=[],h={feGaussianBlur:Cb.exportNoBlur,foreignObject:Cb.exportNoforeignObject,"[stroke-dasharray]":Cb.exportNoDashArray},k=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))h.text=Cb.exportNoText;$.each(h,function(v,s){k.find(v).length&&g.push(s)});h=this.svgCanvasToString();K("exported",{svg:h,issues:g})};this.getSvgString=function(){qb.apply=false;return this.svgCanvasToString()};
this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,w()):svgedit.draw.randomizeIds(true,w())};var ec=this.uniquifyElems=function(g){var h={},k=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(g,function(t){if(t.nodeType==1){if(t.id){t.id in h||(h[t.id]={elem:null,attrs:[],hrefs:[]});h[t.id].elem=t}$.each(Kb,function(F,B){var D=t.getAttributeNode(B);if(D){var H=svgedit.utilities.getUrlFromAttr(D.value);
if(H=H?H.substr(1):null){H in h||(h[H]={elem:null,attrs:[],hrefs:[]});h[H].attrs.push(D)}}});var C=svgedit.utilities.getHref(t);if(C&&k.indexOf(t.nodeName)>=0)if(C=C.substr(1)){C in h||(h[C]={elem:null,attrs:[],hrefs:[]});h[C].hrefs.push(t)}}});for(var v in h)if(v){var s=h[v].elem;if(s){g=na();s.id=g;s=h[v].attrs;for(var E=s.length;E--;){var z=s[E];z.ownerElement.setAttribute(z.name,"url(#"+g+")")}s=h[v].hrefs;for(E=s.length;E--;)svgedit.utilities.setHref(s[E],"#"+g)}}},cc=this.setUseData=function(g){var h=
$(g);if(g.tagName!=="use")h=h.find("use");h.each(function(){var k=ba(this).substr(1);if(k=la(k)){$(this).data("ref",k);if(k.tagName=="symbol"||k.tagName=="svg")$(this).data("symbol",k).data("ref",k)}})},fc=this.convertGradients=function(g){var h=$(g).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(g).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 v=$(this).attr(["x1","y1","x2","y2"]),s=this.gradientTransform.baseVal;if(s&&s.numberOfItems>0){var E=ha(s).matrix;s=O(v.x1,v.y1,E);E=O(v.x2,v.y2,E);v.x1=s.x;v.y1=s.y;v.x2=E.x;v.y2=E.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(v.x1-k.x)/k.width,y1:(v.y1-k.y)/k.height,x2:(v.x2-k.x)/k.width,y2:(v.y2-k.y)/k.height});this.removeAttribute("gradientUnits")}}})},
fc=this.convertToGroup=function(g){g||(g=J[0]);var h=$(g),k=new Oa,v;if(h.data("gsvg")){k=$(g.firstChild).attr(["x","y"]);$(g.firstChild.firstChild).unwrap();$(g).removeData("gsvg");v=V(g);var s=e.createSVGTransform();s.setTranslate(k.x,k.y);v.appendItem(s);cb(g);K("selected",[g])}else if(h.data("symbol")){g=h.data("symbol");v=h.attr("transform");s=h.attr(["x","y"]);var E=g.getAttribute("viewBox");if(E){E=E.split(" ");s.x-=+E[0];s.y-=+E[1]}v+=" translate("+(s.x||0)+","+(s.y||0)+")";s=h.prev();k.addSubCommand(new Sa(h[0],
h[0].nextSibling,h[0].parentNode));h.remove();E=$(l).find("use:data(symbol)").length;h=d.createElementNS(c,"g");for(var z=g.childNodes,t=0;t<z.length;t++)h.appendChild(z[t].cloneNode(true));if(svgedit.browser.isGecko()){z=$(xb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(z)}v&&h.setAttribute("transform",v);v=g.parentNode;ec(h);svgedit.browser.isGecko()&&$(xb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=na();s.after(h);if(v){if(!E){s=g.nextSibling;
v.removeChild(g);k.addSubCommand(new Sa(g,s,v))}k.addSubCommand(new Na(h))}cc(h);svgedit.browser.isGecko()?ac(xb()):ac(h);svgedit.utilities.walkTreePost(h,function(B){try{cb(B)}catch(F){console.log(F)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=na()});Qb([h]);(g=Xb(h,true))&&k.addSubCommand(g);Ia(k)}else console.log("Unexpected element to ungroup:",g)};this.setSvgString=function(g){try{var h=svgedit.utilities.text2xml(g);
this.prepareSvg(h);var k=new Oa("Change Source"),v=l.nextSibling,s=e.removeChild(l);k.addSubCommand(new Sa(s,v,e));l=d.adoptNode?d.adoptNode(h.documentElement):d.importNode(h.documentElement,true);e.appendChild(l);var E=$(l);b.current_drawing_=new svgedit.draw.Drawing(l,u);var z=w().getNonce();z?K("setnonce",z):K("unsetnonce");E.find("image").each(function(){var G=this;Ib(G);var P=ba(this);if(P.indexOf("data:")===0){var R=P.match(/svgedit_url=(.*?);/);if(R){var W=decodeURIComponent(R[1]);$(new Image).load(function(){G.setAttributeNS("http://www.w3.org/1999/xlink",
"xlink:href",W)}).attr("src",W)}}b.embedImage(P)});E.find("svg").each(function(){if(!$(this).closest("defs").length){ec(this);var G=this.parentNode;if(G.childNodes.length===1&&G.nodeName==="g"){$(G).data("gsvg",this);G.id=G.id||na()}else Pb(this)}});svgedit.browser.isGecko()&&E.find("linearGradient, radialGradient, pattern").appendTo(xb());cc(E);ac(E[0]);svgedit.utilities.walkTreePost(l,function(G){try{cb(G)}catch(P){console.log(P)}});var t={id:"svgcontent",overflow:m.show_outside_canvas?"visible":
"hidden"},B=false;if(E.attr("viewBox")){var F=E.attr("viewBox").split(" ");t.width=F[2];t.height=F[3]}else $.each(["width","height"],function(G,P){var R=E.attr(P);R||(R="100%");if((R+"").substr(-1)==="%")B=true;else t[P]=ra(P,R)});Rb();E.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=na()});if(B){var C=getStrokedBBox();t.width=C.width+C.x;t.height=C.height+C.y}if(t.width<=0)t.width=100;if(t.height<=0)t.height=
100;E.attr(t);this.contentW=t.width;this.contentH=t.height;k.addSubCommand(new Na(l));var D=E.attr(["width","height"]);k.addSubCommand(new Wa(e,D));p=1;svgedit.transformlist.resetListMap();$a();svgedit.path.clearData();e.appendChild(Qa.selectorParentGroup);Ia(k);K("changed",[l])}catch(H){console.log(H);return false}return true};this.importSvgString=function(g){try{var h=svgedit.utilities.encode64(g.length+g).substr(0,32),k=false;if(zb[h])if($(zb[h].symbol).parents("#svgroot").length)k=true;var v=
new Oa("Import SVG");if(k)var s=zb[h].symbol,E=zb[h].xform;else{var z=svgedit.utilities.text2xml(g);this.prepareSvg(z);var t;t=d.adoptNode?d.adoptNode(z.documentElement):d.importNode(z.documentElement,true);ec(t);var B=ra("width",t.getAttribute("width")),F=ra("height",t.getAttribute("height")),C=t.getAttribute("viewBox"),D=C?C.split(" "):[0,0,B,F];for(g=0;g<4;++g)D[g]=+D[g];l.getAttribute("width");var H=+l.getAttribute("height");E=F>B?"scale("+H/3/D[3]+")":"scale("+H/3/D[2]+")";E="translate(0) "+
E+" translate(0)";s=d.createElementNS(c,"symbol");var G=xb();for(svgedit.browser.isGecko()&&$(t).find("linearGradient, radialGradient, pattern").appendTo(G);t.firstChild;)s.appendChild(t.firstChild);var P=t.attributes;for(t=0;t<P.length;t++){var R=P[t];s.setAttribute(R.nodeName,R.nodeValue)}s.id=na();zb[h]={symbol:s,xform:E};xb().appendChild(s);v.addSubCommand(new Na(s))}var W=d.createElementNS(c,"use");W.id=na();S(W,"#"+s.id);(L||w().getCurrentLayer()).appendChild(W);v.addSubCommand(new Na(W));$a();
W.setAttribute("transform",E);cb(W);$(W).data("symbol",s).data("ref",s);Kb([W]);Ia(v);K("changed",[l])}catch(ta){console.log(ta);return false}return true};var Rb=b.identifyLayers=function(){$b();w().identifyLayers()};this.createLayer=function(g){var h=new Oa("Create Layer");g=w().createLayer(g);h.addSubCommand(new Na(g));Ia(h);$a();K("changed",[g])};this.cloneLayer=function(g){var h=new Oa("Duplicate Layer"),k=d.createElementNS(c,"g"),v=d.createElementNS(c,"title");v.textContent=g;k.appendChild(v);
v=w().getCurrentLayer();$(v).after(k);v=v.childNodes;for(var s=0;s<v.length;s++){var E=v[s];E.localName!="title"&&k.appendChild(ma(E))}$a();Rb();h.addSubCommand(new Na(k));Ia(h);b.setCurrentLayer(g);K("changed",[k])};this.deleteCurrentLayer=function(){var g=w().getCurrentLayer(),h=g.nextSibling,k=g.parentNode;if(g=w().deleteCurrentLayer()){var v=new Oa("Delete Layer");v.addSubCommand(new Sa(g,h,k));Ia(v);$a();K("changed",[k]);return true}return false};this.setCurrentLayer=function(g){(g=w().setCurrentLayer(svgedit.utilities.toXml(g)))&&
gc=this.convertToGroup=function(g){g||(g=J[0]);var h=$(g),k=new Oa,v;if(h.data("gsvg")){k=$(g.firstChild).attr(["x","y"]);$(g.firstChild.firstChild).unwrap();$(g).removeData("gsvg");v=V(g);var s=e.createSVGTransform();s.setTranslate(k.x,k.y);v.appendItem(s);cb(g);K("selected",[g])}else if(h.data("symbol")){g=h.data("symbol");v=h.attr("transform");s=h.attr(["x","y"]);var E=g.getAttribute("viewBox");if(E){E=E.split(" ");s.x-=+E[0];s.y-=+E[1]}v+=" translate("+(s.x||0)+","+(s.y||0)+")";s=h.prev();k.addSubCommand(new Sa(h[0],
h[0].nextSibling,h[0].parentNode));h.remove();E=$(l).find("use:data(symbol)").length;h=d.createElementNS(c,"g");for(var z=g.childNodes,t=0;t<z.length;t++)h.appendChild(z[t].cloneNode(true));if(svgedit.browser.isGecko()){z=$(vb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(z)}v&&h.setAttribute("transform",v);v=g.parentNode;ec(h);svgedit.browser.isGecko()&&$(vb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=na();s.after(h);if(v){if(!E){s=g.nextSibling;
v.removeChild(g);k.addSubCommand(new Sa(g,s,v))}k.addSubCommand(new Na(h))}cc(h);svgedit.browser.isGecko()?fc(vb()):fc(h);svgedit.utilities.walkTreePost(h,function(C){try{cb(C)}catch(F){console.log(F)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=na()});Pb([h]);(g=dc(h,true))&&k.addSubCommand(g);Ia(k)}else console.log("Unexpected element to ungroup:",g)};this.setSvgString=function(g){try{var h=svgedit.utilities.text2xml(g);
this.prepareSvg(h);var k=new Oa("Change Source"),v=l.nextSibling,s=e.removeChild(l);k.addSubCommand(new Sa(s,v,e));l=d.adoptNode?d.adoptNode(h.documentElement):d.importNode(h.documentElement,true);e.appendChild(l);var E=$(l);b.current_drawing_=new svgedit.draw.Drawing(l,u);var z=w().getNonce();z?K("setnonce",z):K("unsetnonce");E.find("image").each(function(){var G=this;Zb(G);var P=ba(this);if(P.indexOf("data:")===0){var Q=P.match(/svgedit_url=(.*?);/);if(Q){var W=decodeURIComponent(Q[1]);$(new Image).load(function(){G.setAttributeNS("http://www.w3.org/1999/xlink",
"xlink:href",W)}).attr("src",W)}}b.embedImage(P)});E.find("svg").each(function(){if(!$(this).closest("defs").length){ec(this);var G=this.parentNode;if(G.childNodes.length===1&&G.nodeName==="g"){$(G).data("gsvg",this);G.id=G.id||na()}else Nb(this)}});svgedit.browser.isGecko()&&E.find("linearGradient, radialGradient, pattern").appendTo(vb());cc(E);fc(E[0]);svgedit.utilities.walkTreePost(l,function(G){try{cb(G)}catch(P){console.log(P)}});var t={id:"svgcontent",overflow:m.show_outside_canvas?"visible":
"hidden"},C=false;if(E.attr("viewBox")){var F=E.attr("viewBox").split(" ");t.width=F[2];t.height=F[3]}else $.each(["width","height"],function(G,P){var Q=E.attr(P);Q||(Q="100%");if((Q+"").substr(-1)==="%")C=true;else t[P]=ra(P,Q)});Tb();E.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=na()});if(C){var B=getStrokedBBox();t.width=B.width+B.x;t.height=B.height+B.y}if(t.width<=0)t.width=100;if(t.height<=0)t.height=
100;E.attr(t);this.contentW=t.width;this.contentH=t.height;k.addSubCommand(new Na(l));var D=E.attr(["width","height"]);k.addSubCommand(new Wa(e,D));p=1;svgedit.transformlist.resetListMap();$a();svgedit.path.clearData();e.appendChild(Qa.selectorParentGroup);Ia(k);K("changed",[l])}catch(H){console.log(H);return false}return true};this.importSvgString=function(g){try{var h=svgedit.utilities.encode64(g.length+g).substr(0,32),k=false;if(xb[h])if($(xb[h].symbol).parents("#svgroot").length)k=true;var v=
new Oa("Import SVG");if(k)var s=xb[h].symbol,E=xb[h].xform;else{var z=svgedit.utilities.text2xml(g);this.prepareSvg(z);var t;t=d.adoptNode?d.adoptNode(z.documentElement):d.importNode(z.documentElement,true);ec(t);var C=ra("width",t.getAttribute("width")),F=ra("height",t.getAttribute("height")),B=t.getAttribute("viewBox"),D=B?B.split(" "):[0,0,C,F];for(g=0;g<4;++g)D[g]=+D[g];l.getAttribute("width");var H=+l.getAttribute("height");E=F>C?"scale("+H/3/D[3]+")":"scale("+H/3/D[2]+")";E="translate(0) "+
E+" translate(0)";s=d.createElementNS(c,"symbol");var G=vb();for(svgedit.browser.isGecko()&&$(t).find("linearGradient, radialGradient, pattern").appendTo(G);t.firstChild;)s.appendChild(t.firstChild);var P=t.attributes;for(t=0;t<P.length;t++){var Q=P[t];s.setAttribute(Q.nodeName,Q.nodeValue)}s.id=na();xb[h]={symbol:s,xform:E};vb().appendChild(s);v.addSubCommand(new Na(s))}var W=d.createElementNS(c,"use");W.id=na();S(W,"#"+s.id);(L||w().getCurrentLayer()).appendChild(W);v.addSubCommand(new Na(W));$a();
W.setAttribute("transform",E);cb(W);$(W).data("symbol",s).data("ref",s);Fb([W]);Ia(v);K("changed",[l])}catch(ua){console.log(ua);return false}return true};var Tb=b.identifyLayers=function(){Sb();w().identifyLayers()};this.createLayer=function(g){var h=new Oa("Create Layer");g=w().createLayer(g);h.addSubCommand(new Na(g));Ia(h);$a();K("changed",[g])};this.cloneLayer=function(g){var h=new Oa("Duplicate Layer"),k=d.createElementNS(c,"g"),v=d.createElementNS(c,"title");v.textContent=g;k.appendChild(v);
v=w().getCurrentLayer();$(v).after(k);v=v.childNodes;for(var s=0;s<v.length;s++){var E=v[s];E.localName!="title"&&k.appendChild(ma(E))}$a();Tb();h.addSubCommand(new Na(k));Ia(h);b.setCurrentLayer(g);K("changed",[k])};this.deleteCurrentLayer=function(){var g=w().getCurrentLayer(),h=g.nextSibling,k=g.parentNode;if(g=w().deleteCurrentLayer()){var v=new Oa("Delete Layer");v.addSubCommand(new Sa(g,h,k));Ia(v);$a();K("changed",[k]);return true}return false};this.setCurrentLayer=function(g){(g=w().setCurrentLayer(svgedit.utilities.toXml(g)))&&
$a();return g};this.renameCurrentLayer=function(g){var h=w();if(h.current_layer){var k=h.current_layer;if(!b.setCurrentLayer(g)){for(var v=new Oa("Rename Layer"),s=0;s<h.getNumLayers();++s)if(h.all_layers[s][1]==k)break;var E=h.getLayerName(s);h.all_layers[s][0]=svgedit.utilities.toXml(g);var z=k.childNodes.length;for(s=0;s<z;++s){var t=k.childNodes.item(s);if(t&&t.tagName=="title"){for(;t.firstChild;)t.removeChild(t.firstChild);t.textContent=g;v.addSubCommand(new Wa(t,{"#text":E}));Ia(v);K("changed",
[k]);return true}}}h.current_layer=k}return false};this.setCurrentLayerPosition=function(g){var h=w();if(h.current_layer&&g>=0&&g<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!=g){var v=null,s=h.current_layer.nextSibling;if(g>k){if(g<h.getNumLayers()-1)v=h.all_layers[g+1][1]}else v=h.all_layers[g][1];l.insertBefore(h.current_layer,v);Ia(new Ra(h.current_layer,s,l));Rb();b.setCurrentLayer(h.getLayerName(g));
[k]);return true}}}h.current_layer=k}return false};this.setCurrentLayerPosition=function(g){var h=w();if(h.current_layer&&g>=0&&g<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!=g){var v=null,s=h.current_layer.nextSibling;if(g>k){if(g<h.getNumLayers()-1)v=h.all_layers[g+1][1]}else v=h.all_layers[g][1];l.insertBefore(h.current_layer,v);Ia(new Ra(h.current_layer,s,l));Tb();b.setCurrentLayer(h.getLayerName(g));
return true}}return false};this.setLayerVisibility=function(g,h){var k=w(),v=k.getLayerVisibility(g),s=k.setLayerVisibility(g,h);if(s)Ia(new Wa(s,{display:v?"inline":"none"},"Layer Visibility"));else return false;if(s==k.getCurrentLayer()){$a();Ua.clear()}return true};this.moveSelectedToLayer=function(g){for(var h=null,k=w(),v=0;v<k.getNumLayers();++v)if(k.getLayerName(v)==g){h=k.all_layers[v][1];break}if(!h)return false;g=new Oa("Move Elements to Layer");k=J;for(v=k.length;v--;){var s=k[v];if(s){var E=
s.nextSibling,z=s.parentNode;h.appendChild(s);g.addSubCommand(new Ra(s,E,z))}}Ia(g);return true};this.mergeLayer=function(g){var h=new Oa("Merge Layer"),k=w(),v=$(k.current_layer).prev()[0];if(v){for(h.addSubCommand(new Sa(k.current_layer,k.current_layer.nextSibling,l));k.current_layer.firstChild;){var s=k.current_layer.firstChild;if(s.localName=="title"){h.addSubCommand(new Sa(s,s.nextSibling,k.current_layer));k.current_layer.removeChild(s)}else{var E=s.nextSibling;v.appendChild(s);h.addSubCommand(new Ra(s,
E,k.current_layer))}}l.removeChild(k.current_layer);if(!g){$a();Rb();K("changed",[l]);Ia(h)}k.current_layer=v;return h}};this.mergeAllLayers=function(){var g=new Oa("Merge all Layers"),h=w();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(l).children("g").length>1;)g.addSubCommand(b.mergeLayer(true));$a();Rb();K("changed",[l]);Ia(g)};var $b=this.leaveContext=function(){var g=Ea.length;if(g){for(var h=0;h<g;h++){var k=Ea[h],v=lb(k,"orig_opac");v!==1?k.setAttribute("opacity",v):k.removeAttribute("opacity");
k.setAttribute("style","pointer-events: inherit")}Ea=[];$a(true);K("contextset",null)}L=null},lc=this.setContext=function(g){$b();if(typeof g==="string")g=la(g);L=g;$(g).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;lb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");Ea.push(this)});$a();K("contextset",L)};this.clear=function(){Ua.clear();$a();b.clearSvgContentElement();b.current_drawing_=
E,k.current_layer))}}l.removeChild(k.current_layer);if(!g){$a();Tb();K("changed",[l]);Ia(h)}k.current_layer=v;return h}};this.mergeAllLayers=function(){var g=new Oa("Merge all Layers"),h=w();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(l).children("g").length>1;)g.addSubCommand(b.mergeLayer(true));$a();Tb();K("changed",[l]);Ia(g)};var Sb=this.leaveContext=function(){var g=Ea.length;if(g){for(var h=0;h<g;h++){var k=Ea[h],v=nb(k,"orig_opac");v!==1?k.setAttribute("opacity",v):k.removeAttribute("opacity");
k.setAttribute("style","pointer-events: inherit")}Ea=[];$a(true);K("contextset",null)}L=null},mc=this.setContext=function(g){Sb();if(typeof g==="string")g=la(g);L=g;$(g).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;nb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");Ea.push(this)});$a();K("contextset",L)};this.clear=function(){Ua.clear();$a();b.clearSvgContentElement();b.current_drawing_=
new svgedit.draw.Drawing(l);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();Qa.initGroup();xa=Qa.getRubberBandBox();K("cleared")};this.linkControlPoints=Ua.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=function(){return e};this.getSelectedElems=function(){return J};var Vb=this.getResolution=function(){var g=l.getAttribute("width")/p,h=l.getAttribute("height")/p;return{w:g,h:h,zoom:p}};this.getZoom=function(){return p};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};
this.setUiStrings=function(g){$.extend(Cb,g.notification)};this.setConfig=function(g){$.extend(m,g)};this.getTitle=function(g){if(g=g||J[0]){g=$(g).data("gsvg")||$(g).data("symbol")||g;g=g.childNodes;for(var h=0;h<g.length;h++)if(g[h].nodeName=="title")return g[h].textContent;return""}};this.setGroupTitle=function(g){var h=J[0];h=$(h).data("gsvg")||h;var k=$(h).children("title"),v=new Oa("Set Label");if(g.length)if(k.length){k=k[0];v.addSubCommand(new Wa(k,{"#text":k.textContent}));k.textContent=
g}else{k=d.createElementNS(c,"title");k.textContent=g;$(h).prepend(k);v.addSubCommand(new Na(k))}else{v.addSubCommand(new Sa(k[0],k.nextSibling,h));k.remove()}Ia(v)};this.getDocumentTitle=function(){return b.getTitle(l)};this.setDocumentTitle=function(g){for(var h=l.childNodes,k=false,v="",s=new Oa("Change Image Title"),E=0;E<h.length;E++)if(h[E].nodeName=="title"){k=h[E];v=k.textContent;break}if(!k){k=d.createElementNS(c,"title");l.insertBefore(k,l.firstChild)}if(g.length)k.textContent=g;else k.parentNode.removeChild(k);
s.addSubCommand(new Wa(k,{"#text":v}));Ia(s)};this.getEditorNS=function(g){g&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(g,h){var k=Vb(),v=k.w;k=k.h;var s;if(g=="fit"){var E=getStrokedBBox();if(E){s=new Oa("Fit Canvas to Content");var z=Hb();Kb(z);var t=[],B=[];$.each(z,function(){t.push(E.x*-1);B.push(E.y*-1)});z=b.moveSelectedElements(t,B,true);s.addSubCommand(z);$a();g=Math.round(E.width);h=Math.round(E.height)}else return false}if(g!=
s.addSubCommand(new Wa(k,{"#text":v}));Ia(s)};this.getEditorNS=function(g){g&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(g,h){var k=Vb(),v=k.w;k=k.h;var s;if(g=="fit"){var E=getStrokedBBox();if(E){s=new Oa("Fit Canvas to Content");var z=Hb();Fb(z);var t=[],C=[];$.each(z,function(){t.push(E.x*-1);C.push(E.y*-1)});z=b.moveSelectedElements(t,C,true);s.addSubCommand(z);$a();g=Math.round(E.width);h=Math.round(E.height)}else return false}if(g!=
v||h!=k){z=e.suspendRedraw(1E3);s||(s=new Oa("Change Image Dimensions"));g=ra("width",g);h=ra("height",h);l.setAttribute("width",g);l.setAttribute("height",h);this.contentW=g;this.contentH=h;s.addSubCommand(new Wa(l,{width:v,height:k}));l.setAttribute("viewBox",[0,0,g/p,h/p].join(" "));s.addSubCommand(new Wa(l,{viewBox:["0 0",v,k].join(" ")}));Ia(s);e.unsuspendRedraw(z);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width",
g+1);background.setAttribute("height",h+1)}K("changed",[l])}return true};this.getOffset=function(){return $(l).attr(["x","y"])};this.setBBoxZoom=function(g,h,k){var v=0.85,s=function(E){if(!E)return false;var z=Math.min(Math.round(h/E.width*100*v)/100,Math.round(k/E.height*100*v)/100);b.setZoom(z);return{zoom:z,bbox:E}};if(typeof g=="object"){g=g;if(g.width==0||g.height==0){b.setZoom(g.zoom?g.zoom:p*g.factor);return{zoom:p,bbox:g}}return s(g)}switch(g){case "selection":if(!J[0])return;g=$.map(J,function(E){if(E)return E});
g=getStrokedBBox(g);break;case "canvas":g=Vb();v=0.95;g={width:g.w,height:g.h,x:0,y:0};break;case "content":g=getStrokedBBox();break;case "layer":g=getStrokedBBox(Hb(w().getCurrentLayer()));break;default:return}return s(g)};this.setZoom=function(g){var h=Vb();l.setAttribute("viewBox","0 0 "+h.w/g+" "+h.h/g);p=g;$.each(J,function(k,v){v&&Qa.requestSelector(v).resize()});Ua.zoomChange();sb("zoomChanged",g)};this.getMode=function(){return Ma};this.setMode=function(g){Ua.clear(true);pb.clear();$("#workarea").attr("class",
g);gb=J[0]&&J[0].nodeName=="text"?eb:M;Ma=g};this.getColor=function(g){return gb[g]};this.setColor=function(g,h,k){M[g]=h;gb[g+"_paint"]={type:"solidColor"};for(var v=[],s=J.length;s--;){var E=J[s];if(E)if(E.tagName=="g")svgedit.utilities.walkTree(E,function(z){z.nodeName!="g"&&v.push(z)});else if(g=="fill")E.tagName!="polyline"&&E.tagName!="line"&&v.push(E);else v.push(E)}if(v.length>0)if(k)Tb(g,h,v);else{rb(g,h,v);K("changed",v)}};var xb=function(){var g=l.getElementsByTagNameNS(c,"defs");if(g.length>
0)g=g[0];else{g=d.createElementNS(c,"defs");l.firstChild?l.insertBefore(g,l.firstChild.nextSibling):l.appendChild(g)}return g},jc=this.setGradient=function(g){if(!(!gb[g+"_paint"]||gb[g+"_paint"].type=="solidColor")){var h=b[g+"Grad"],k=ic(h),v=xb();if(k)h=k;else{h=v.appendChild(d.importNode(h,true));h.id=na()}b.setColor(g,"url(#"+h.id+")");if(g=="canvas")(g=document.getElementById("canvas_background"))&&g.setAttribute("fill","url(#"+h.id+")")}},ic=function(g){var h=xb();h=$(h).find("linearGradient, radialGradient");
for(var k=h.length,v=["r","cx","cy","fx","fy"];k--;){var s=h[k];if(g.tagName=="linearGradient"){if(g.getAttribute("x1")!=s.getAttribute("x1")||g.getAttribute("y1")!=s.getAttribute("y1")||g.getAttribute("x2")!=s.getAttribute("x2")||g.getAttribute("y2")!=s.getAttribute("y2"))continue}else{var E=$(g).attr(v),z=$(s).attr(v),t=false;$.each(v,function(G,P){if(E[P]!=z[P])t=true});if(t)continue}var B=g.getElementsByTagNameNS(c,"stop"),F=s.getElementsByTagNameNS(c,"stop");if(B.length==F.length){for(var C=
B.length;C--;){var D=B[C],H=F[C];if(D.getAttribute("offset")!=H.getAttribute("offset")||D.getAttribute("stop-opacity")!=H.getAttribute("stop-opacity")||D.getAttribute("stop-color")!=H.getAttribute("stop-color"))break}if(C==-1)return s}}return null};this.setPaint=function(g,h){var k=new $.jGraduate.Paint(h);this.setPaintOpacity(g,k.alpha/100,true);gb[g+"_paint"]=k;switch(k.type){case "solidColor":if(k.solidColor!="none"&&k.solidColor!="#none")this.setColor(g,"#"+k.solidColor);else{this.setColor(g,
"none");document.querySelector(g=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","transparent")}break;case "linearGradient":case "radialGradient":b[g+"Grad"]=k[k.type];jc(g)}};this.getStrokeWidth=function(){return gb.stroke_width};this.setStrokeWidth=function(g){if(g==0&&["line","path"].indexOf(Ma)>=0)b.setStrokeWidth(1);else{gb.stroke_width=g;for(var h=[],k=J.length;k--;){var v=J[k];if(v)v.tagName=="g"?svgedit.utilities.walkTree(v,function(s){s.nodeName!="g"&&h.push(s)}):h.push(v)}if(h.length>
0){rb("stroke-width",g,h);K("changed",J)}}};this.setStrokeAttr=function(g,h){M[g.replace("-","_")]=h;for(var k=[],v=J.length;v--;){var s=J[v];if(s)s.tagName=="g"?svgedit.utilities.walkTree(s,function(E){E.nodeName!="g"&&k.push(E)}):k.push(s)}if(k.length>0){rb(g,h,k);K("changed",J)}};this.getStyle=function(){return M};this.getOpacity=function(){return M.opacity};this.setOpacity=function(g){M.opacity=g;rb("opacity",g)};this.getFillOpacity=function(){return M.fill_opacity};this.getStrokeOpacity=function(){return M.stroke_opacity};
this.setPaintOpacity=function(g,h,k){M[g+"_opacity"]=h;k?Tb(g+"-opacity",h):rb(g+"-opacity",h)};this.getBlur=function(g){var h=0;if(g)if(g.getAttribute("filter"))if(g=la(g.id+"_blur"))h=g.firstChild.getAttribute("stdDeviation");return h};(function(){function g(){var s=b.undoMgr.finishUndoableChange();h.addSubCommand(s);Ia(h);k=h=null}var h=null,k=null,v=false;b.setBlurNoUndo=function(s){if(k)if(s===0){Tb("filter","");v=true}else{var E=J[0];v&&Tb("filter","url(#"+E.id+"_blur)");if(svgedit.browser.isWebkit()){E.removeAttribute("filter");
E.setAttribute("filter","url(#"+E.id+"_blur)")}Tb("stdDeviation",s,[k.firstChild]);b.setBlurOffsets(k,s)}else b.setBlur(s)};b.setBlurOffsets=function(s,E){if(E>3)oa(s,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){s.removeAttribute("x");s.removeAttribute("y");s.removeAttribute("width");s.removeAttribute("height")}};b.setBlur=function(s,E){if(h)g();else{var z=J[0],t=z.id;k=la(t+"_blur");s-=0;var B=new Oa;if(k){if(s===0)k=null}else{var F=da({element:"feGaussianBlur",
attr:{"in":"SourceGraphic",stdDeviation:s}});k=da({element:"filter",attr:{id:t+"_blur"}});k.appendChild(F);xb().appendChild(k);B.addSubCommand(new Na(k))}F={filter:z.getAttribute("filter")};if(s===0){z.removeAttribute("filter");B.addSubCommand(new Wa(z,F))}else{rb("filter","url(#"+t+"_blur)");B.addSubCommand(new Wa(z,F));b.setBlurOffsets(k,s);h=B;b.undoMgr.beginUndoableChange("stdDeviation",[k?k.firstChild:null]);if(E){b.setBlurNoUndo(s);g()}}}}})();this.getBold=function(){var g=J[0];if(g!=null&&
g.tagName=="text"&&J[1]==null)return g.getAttribute("font-weight")=="bold";return false};this.setBold=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)rb("font-weight",g?"bold":"normal");J[0].textContent||pb.setCursor()};this.getItalic=function(){var g=J[0];if(g!=null&&g.tagName=="text"&&J[1]==null)return g.getAttribute("font-style")=="italic";return false};this.setItalic=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)rb("font-style",g?"italic":"normal");J[0].textContent||
pb.setCursor()};this.getFontFamily=function(){return eb.font_family};this.setFontFamily=function(g){eb.font_family=g;rb("font-family",g);J[0]&&!J[0].textContent&&pb.setCursor()};this.setFontColor=function(g){eb.fill=g;rb("fill",g)};this.getFontSize=function(){return eb.fill};this.getFontSize=function(){return eb.font_size};this.setFontSize=function(g){eb.font_size=g;rb("font-size",g);J[0].textContent||pb.setCursor()};this.getText=function(){var g=J[0];if(g==null)return"";return g.textContent};this.setTextContent=
function(g){rb("#text",g);pb.init(g);pb.setCursor()};this.setImageURL=function(g){var h=J[0];if(h){var k=$(h).attr(["width","height"]);k=!k.width||!k.height;var v=ba(h);if(v!==g)k=true;else if(!k)return;var s=new Oa("Change Image URL");S(h,g);s.addSubCommand(new Wa(h,{"#href":v}));k?$(new Image).load(function(){var E=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});Qa.requestSelector(h).resize();s.addSubCommand(new Wa(h,E));Ia(s);K("changed",[h])}).attr("src",g):Ia(s)}};
g=getStrokedBBox(g);break;case "canvas":g=Vb();v=0.95;g={width:g.w,height:g.h,x:0,y:0};break;case "content":g=getStrokedBBox();break;case "layer":g=getStrokedBBox(Hb(w().getCurrentLayer()));break;default:return}return s(g)};this.setZoom=function(g){var h=Vb();l.setAttribute("viewBox","0 0 "+h.w/g+" "+h.h/g);p=g;$.each(J,function(k,v){v&&Qa.requestSelector(v).resize()});Ua.zoomChange();sb("zoomChanged",g)};this.getMode=function(){return Ma};this.setMode=function(g){Ua.clear(true);gb.clear();$("#workarea").attr("class",
g);ib=J[0]&&J[0].nodeName=="text"?fb:M;Ma=g};this.getColor=function(g){return ib[g]};this.setColor=function(g,h,k){M[g]=h;ib[g+"_paint"]={type:"solidColor"};for(var v=[],s=J.length;s--;){var E=J[s];if(E)if(E.tagName=="g")svgedit.utilities.walkTree(E,function(z){z.nodeName!="g"&&v.push(z)});else if(g=="fill")E.tagName!="polyline"&&E.tagName!="line"&&v.push(E);else v.push(E)}if(v.length>0)if(k)Wb(g,h,v);else{db(g,h,v);K("changed",v)}};var vb=function(){var g=l.getElementsByTagNameNS(c,"defs");if(g.length>
0)g=g[0];else{g=d.createElementNS(c,"defs");l.firstChild?l.insertBefore(g,l.firstChild.nextSibling):l.appendChild(g)}return g},kc=this.setGradient=function(g){if(!(!ib[g+"_paint"]||ib[g+"_paint"].type=="solidColor")){var h=b[g+"Grad"],k=jc(h),v=vb();if(k)h=k;else{h=v.appendChild(d.importNode(h,true));h.id=na()}b.setColor(g,"url(#"+h.id+")");if(g=="canvas")(g=document.getElementById("canvas_background"))&&g.setAttribute("fill","url(#"+h.id+")")}},jc=function(g){var h=vb();h=$(h).find("linearGradient, radialGradient");
for(var k=h.length,v=["r","cx","cy","fx","fy"];k--;){var s=h[k];if(g.tagName=="linearGradient"){if(g.getAttribute("x1")!=s.getAttribute("x1")||g.getAttribute("y1")!=s.getAttribute("y1")||g.getAttribute("x2")!=s.getAttribute("x2")||g.getAttribute("y2")!=s.getAttribute("y2"))continue}else{var E=$(g).attr(v),z=$(s).attr(v),t=false;$.each(v,function(G,P){if(E[P]!=z[P])t=true});if(t)continue}var C=g.getElementsByTagNameNS(c,"stop"),F=s.getElementsByTagNameNS(c,"stop");if(C.length==F.length){for(var B=
C.length;B--;){var D=C[B],H=F[B];if(D.getAttribute("offset")!=H.getAttribute("offset")||D.getAttribute("stop-opacity")!=H.getAttribute("stop-opacity")||D.getAttribute("stop-color")!=H.getAttribute("stop-color"))break}if(B==-1)return s}}return null};this.setPaint=function(g,h){var k=new $.jGraduate.Paint(h);this.setPaintOpacity(g,k.alpha/100,true);ib[g+"_paint"]=k;switch(k.type){case "solidColor":if(k.solidColor!="none"&&k.solidColor!="#none")this.setColor(g,"#"+k.solidColor);else{this.setColor(g,
"none");document.querySelector(g=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","transparent")}break;case "linearGradient":case "radialGradient":b[g+"Grad"]=k[k.type];kc(g)}};this.getStrokeWidth=function(){return ib.stroke_width};this.setStrokeWidth=function(g){if(g==0&&["line","path"].indexOf(Ma)>=0)b.setStrokeWidth(1);else{ib.stroke_width=g;for(var h=[],k=J.length;k--;){var v=J[k];if(v)v.tagName=="g"?svgedit.utilities.walkTree(v,function(s){s.nodeName!="g"&&h.push(s)}):h.push(v)}if(h.length>
0){db("stroke-width",g,h);K("changed",J)}}};this.setStrokeAttr=function(g,h){M[g.replace("-","_")]=h;for(var k=[],v=J.length;v--;){var s=J[v];if(s)s.tagName=="g"?svgedit.utilities.walkTree(s,function(E){E.nodeName!="g"&&k.push(E)}):k.push(s)}if(k.length>0){db(g,h,k);K("changed",J)}};this.getStyle=function(){return M};this.getOpacity=function(){return M.opacity};this.setOpacity=function(g){M.opacity=g;db("opacity",g)};this.getFillOpacity=function(){return M.fill_opacity};this.getStrokeOpacity=function(){return M.stroke_opacity};
this.setPaintOpacity=function(g,h,k){M[g+"_opacity"]=h;k?Wb(g+"-opacity",h):db(g+"-opacity",h)};this.getBlur=function(g){var h=0;if(g)if(g.getAttribute("filter"))if(g=la(g.id+"_blur"))h=g.firstChild.getAttribute("stdDeviation");return h};(function(){function g(){var s=b.undoMgr.finishUndoableChange();h.addSubCommand(s);Ia(h);k=h=null}var h=null,k=null,v=false;b.setBlurNoUndo=function(s){if(k)if(s===0){Wb("filter","");v=true}else{var E=J[0];v&&Wb("filter","url(#"+E.id+"_blur)");if(svgedit.browser.isWebkit()){E.removeAttribute("filter");
E.setAttribute("filter","url(#"+E.id+"_blur)")}Wb("stdDeviation",s,[k.firstChild]);b.setBlurOffsets(k,s)}else b.setBlur(s)};b.setBlurOffsets=function(s,E){if(E>3)oa(s,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){s.removeAttribute("x");s.removeAttribute("y");s.removeAttribute("width");s.removeAttribute("height")}};b.setBlur=function(s,E){if(h)g();else{var z=J[0],t=z.id;k=la(t+"_blur");s-=0;var C=new Oa;if(k){if(s===0)k=null}else{var F=da({element:"feGaussianBlur",
attr:{"in":"SourceGraphic",stdDeviation:s}});k=da({element:"filter",attr:{id:t+"_blur"}});k.appendChild(F);vb().appendChild(k);C.addSubCommand(new Na(k))}F={filter:z.getAttribute("filter")};if(s===0){z.removeAttribute("filter");C.addSubCommand(new Wa(z,F))}else{db("filter","url(#"+t+"_blur)");C.addSubCommand(new Wa(z,F));b.setBlurOffsets(k,s);h=C;b.undoMgr.beginUndoableChange("stdDeviation",[k?k.firstChild:null]);if(E){b.setBlurNoUndo(s);g()}}}}})();this.getBold=function(){var g=J[0];if(g!=null&&
g.tagName=="text"&&J[1]==null)return g.getAttribute("font-weight")=="bold";return false};this.setBold=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)db("font-weight",g?"bold":"normal");J[0].textContent||gb.setCursor()};this.getItalic=function(){var g=J[0];if(g!=null&&g.tagName=="text"&&J[1]==null)return g.getAttribute("font-style")=="italic";return false};this.setItalic=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)db("font-style",g?"italic":"normal");J[0].textContent||
gb.setCursor()};this.getFontFamily=function(){return fb.font_family};this.setFontFamily=function(g){fb.font_family=g;db("font-family",g);J[0]&&!J[0].textContent&&gb.setCursor()};this.setFontColor=function(g){fb.fill=g;db("fill",g)};this.getFontSize=function(){return fb.fill};this.getFontSize=function(){return fb.font_size};this.setFontSize=function(g){fb.font_size=g;db("font-size",g);J[0].textContent||gb.setCursor()};this.getText=function(){var g=J[0];if(g==null)return"";return g.textContent};this.setTextContent=
function(g){db("#text",g);gb.init(g);gb.setCursor()};this.setImageURL=function(g){var h=J[0];if(h){var k=$(h).attr(["width","height"]);k=!k.width||!k.height;var v=ba(h);if(v!==g)k=true;else if(!k)return;var s=new Oa("Change Image URL");S(h,g);s.addSubCommand(new Wa(h,{"#href":v}));k?$(new Image).load(function(){var E=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});Qa.requestSelector(h).resize();s.addSubCommand(new Wa(h,E));Ia(s);K("changed",[h])}).attr("src",g):Ia(s)}};
this.setLinkURL=function(g){var h=J[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var k=ba(h);if(k!==g){var v=new Oa("Change Link URL");S(h,g);v.addSubCommand(new Wa(h,{"#href":k}));Ia(v)}}};this.setRectRadius=function(g){var h=J[0];if(h!=null&&h.tagName=="rect"){var k=h.getAttribute("rx");if(k!=g){h.setAttribute("rx",g);h.setAttribute("ry",g);Ia(new Wa(h,{rx:k,ry:k},"Radius"));K("changed",[h])}}};this.makeHyperlink=function(g){b.groupSelectedElements("a",g)};this.removeHyperlink=
function(){b.ungroupSelectedElement()};this.setSegType=function(g){Ua.setSegType(g)};this.convertToPath=function(g,h){if(g==null)$.each(J,function(wa,ga){ga&&b.convertToPath(ga)});else{if(!h)var k=new Oa("Convert element to Path");var v=h?{}:{fill:M.fill,"fill-opacity":M.fill_opacity,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,opacity:M.opacity,visibility:"hidden"};
$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(g.getAttribute(this))v[this]=g.getAttribute(this)});var s=da({element:"path",attr:v}),E=g.getAttribute("transform");E&&s.setAttribute("transform",E);var z=g.id,t=g.parentNode;g.nextSibling?t.insertBefore(s,g):t.appendChild(s);var B="",F=function(wa){$.each(wa,function(ga,ka){var pa=ka[1];B+=ka[0];for(var za=0;za<pa.length;za+=2)B+=pa[za]+","+pa[za+1]+" "})},C=1.81;switch(g.tagName){case "ellipse":case "circle":var D=
$(g).attr(["rx","ry","cx","cy"]),H=D.cx,G=D.cy,P=D.rx;D=D.ry;if(g.tagName=="circle")P=D=$(g).attr("r");F([["M",[H-P,G]],["C",[H-P,G-D/C,H-P/C,G-D,H,G-D]],["C",[H+P/C,G-D,H+P,G-D/C,H+P,G]],["C",[H+P,G+D/C,H+P/C,G+D,H,G+D]],["C",[H-P/C,G+D,H-P,G+D/C,H-P,G]],["Z",[]]]);break;case "path":B=g.getAttribute("d");break;case "line":D=$(g).attr(["x1","y1","x2","y2"]);B="M"+D.x1+","+D.y1+"L"+D.x2+","+D.y2;break;case "polyline":case "polygon":B="M"+g.getAttribute("points");break;case "rect":D=$(g).attr(["rx",
"ry"]);P=D.rx;D=D.ry;var R=g.getBBox();H=R.x;G=R.y;var W=R.width;R=R.height;C=4-C;!P&&!D?F([["M",[H,G]],["L",[H+W,G]],["L",[H+W,G+R]],["L",[H,G+R]],["L",[H,G]],["Z",[]]]):F([["M",[H,G+D]],["C",[H,G+D/C,H+P/C,G,H+P,G]],["L",[H+W-P,G]],["C",[H+W-P/C,G,H+W,G+D/C,H+W,G+D]],["L",[H+W,G+R-D]],["C",[H+W,G+R-D/C,H+W-P/C,G+R,H+W-P,G+R]],["L",[H+P,G+R]],["C",[H+P/C,G+R,H,G+R-D/C,H,G+R-D]],["L",[H,G+D]],["Z",[]]]);break;default:s.parentNode.removeChild(s)}B&&s.setAttribute("d",B);if(h){Ua.resetOrientation(s);
k=false;try{k=s.getBBox()}catch(ta){}s.parentNode.removeChild(s);return k}else{if(E){E=V(s);ua(E)&&Ua.resetOrientation(s)}k.addSubCommand(new Sa(g,g.nextSibling,t));k.addSubCommand(new Na(s));$a();g.parentNode.removeChild(g);s.setAttribute("id",z);s.removeAttribute("visibility");Kb([s],true);Ia(k)}}};var Tb=function(g,h,k){var v=e.suspendRedraw(1E3);Ma=="pathedit"&&Ua.moveNode(g,h);k=k||J;for(var s=k.length,E=["g","polyline","path"];s--;){var z=k[s];if(z!=null){Ma==="textedit"&&g!=="#text"&&z.textContent.length&&
pb.toSelectMode(z);if((g==="x"||g==="y")&&E.indexOf(z.tagName)>=0){var t=getStrokedBBox([z]);b.moveSelectedElements((g==="x"?h-t.x:0)*p,(g==="y"?h-t.y:0)*p,true)}else{t=g==="#text"?z.textContent:z.getAttribute(g);if(t==null)t="";if(t!==String(h)){if(g=="#text"){svgedit.utilities.getBBox(z);z.textContent=h;if(/rotate/.test(z.getAttribute("transform")))z=aa(z)}else g=="#href"?S(z,h):z.setAttribute(g,h);if(svgedit.browser.isGecko()&&z.nodeName==="text"&&/rotate/.test(z.getAttribute("transform")))if((h+
"").indexOf("url")===0||["font-size","font-family","x","y"].indexOf(g)>=0&&z.textContent)z=aa(z);J.indexOf(z)>=0&&setTimeout(function(){z.parentNode&&Qa.requestSelector(z).resize()},0);t=sa(z);if(t!=0&&g!="transform")for(var B=V(z),F=B.numberOfItems;F--;)if(B.getItem(F).type==4){B.removeItem(F);var C=svgedit.utilities.getBBox(z),D=O(C.x+C.width/2,C.y+C.height/2,ha(B).matrix);C=D.x;D=D.y;var H=e.createSVGTransform();H.setRotate(t,C,D);B.insertItemBefore(H,F);break}}}}}e.unsuspendRedraw(v)},rb=this.changeSelectedAttribute=
function(g,h,k){k=k||J;b.undoMgr.beginUndoableChange(g,k);Tb(g,h,k);g=b.undoMgr.finishUndoableChange();g.isEmpty()||Ia(g)};this.deleteSelectedElements=function(){for(var g=new Oa("Delete Elements"),h=J.length,k=[],v=0;v<h;++v){var s=J[v];if(s==null)break;var E=s.parentNode,z=s;Qa.releaseSelector(z);svgedit.path.removePath_(z.id);if(E.tagName==="a"&&E.childNodes.length===1){z=E;E=E.parentNode}var t=z.nextSibling;z=E.removeChild(z);k.push(s);J[v]=null;g.addSubCommand(new Sa(z,t,E))}g.isEmpty()||Ia(g);
function(){b.ungroupSelectedElement()};this.setSegType=function(g){Ua.setSegType(g)};this.convertToPath=function(g,h){if(g==null)$.each(J,function(wa,fa){fa&&b.convertToPath(fa)});else{if(!h)var k=new Oa("Convert element to Path");var v=h?{}:{fill:M.fill,"fill-opacity":M.fill_opacity,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,opacity:M.opacity,visibility:"hidden"};
$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(g.getAttribute(this))v[this]=g.getAttribute(this)});var s=da({element:"path",attr:v}),E=g.getAttribute("transform");E&&s.setAttribute("transform",E);var z=g.id,t=g.parentNode;g.nextSibling?t.insertBefore(s,g):t.appendChild(s);var C="",F=function(wa){$.each(wa,function(fa,ka){var qa=ka[1];C+=ka[0];for(var za=0;za<qa.length;za+=2)C+=qa[za]+","+qa[za+1]+" "})},B=1.81;switch(g.tagName){case "ellipse":case "circle":var D=
$(g).attr(["rx","ry","cx","cy"]),H=D.cx,G=D.cy,P=D.rx;D=D.ry;if(g.tagName=="circle")P=D=$(g).attr("r");F([["M",[H-P,G]],["C",[H-P,G-D/B,H-P/B,G-D,H,G-D]],["C",[H+P/B,G-D,H+P,G-D/B,H+P,G]],["C",[H+P,G+D/B,H+P/B,G+D,H,G+D]],["C",[H-P/B,G+D,H-P,G+D/B,H-P,G]],["Z",[]]]);break;case "path":C=g.getAttribute("d");break;case "line":D=$(g).attr(["x1","y1","x2","y2"]);C="M"+D.x1+","+D.y1+"L"+D.x2+","+D.y2;break;case "polyline":case "polygon":C="M"+g.getAttribute("points");break;case "rect":D=$(g).attr(["rx",
"ry"]);P=D.rx;D=D.ry;var Q=g.getBBox();H=Q.x;G=Q.y;var W=Q.width;Q=Q.height;B=4-B;!P&&!D?F([["M",[H,G]],["L",[H+W,G]],["L",[H+W,G+Q]],["L",[H,G+Q]],["L",[H,G]],["Z",[]]]):F([["M",[H,G+D]],["C",[H,G+D/B,H+P/B,G,H+P,G]],["L",[H+W-P,G]],["C",[H+W-P/B,G,H+W,G+D/B,H+W,G+D]],["L",[H+W,G+Q-D]],["C",[H+W,G+Q-D/B,H+W-P/B,G+Q,H+W-P,G+Q]],["L",[H+P,G+Q]],["C",[H+P/B,G+Q,H,G+Q-D/B,H,G+Q-D]],["L",[H,G+D]],["Z",[]]]);break;default:s.parentNode.removeChild(s)}C&&s.setAttribute("d",C);if(h){Ua.resetOrientation(s);
k=false;try{k=s.getBBox()}catch(ua){}s.parentNode.removeChild(s);return k}else{if(E){E=V(s);ta(E)&&Ua.resetOrientation(s)}k.addSubCommand(new Sa(g,g.nextSibling,t));k.addSubCommand(new Na(s));$a();g.parentNode.removeChild(g);s.setAttribute("id",z);s.removeAttribute("visibility");Fb([s],true);Ia(k)}}};var Wb=function(g,h,k){var v=e.suspendRedraw(1E3);Ma=="pathedit"&&Ua.moveNode(g,h);k=k||J;for(var s=k.length,E=["g","polyline","path"];s--;){var z=k[s];if(z!=null){Ma==="textedit"&&g!=="#text"&&z.textContent.length&&
gb.toSelectMode(z);if((g==="x"||g==="y")&&E.indexOf(z.tagName)>=0){var t=getStrokedBBox([z]);b.moveSelectedElements((g==="x"?h-t.x:0)*p,(g==="y"?h-t.y:0)*p,true)}else{t=g==="#text"?z.textContent:z.getAttribute(g);if(t==null)t="";if(t!==String(h)){if(g=="#text"){svgedit.utilities.getBBox(z);z.textContent=h;if(/rotate/.test(z.getAttribute("transform")))z=aa(z)}else g=="#href"?S(z,h):z.setAttribute(g,h);if(svgedit.browser.isGecko()&&z.nodeName==="text"&&/rotate/.test(z.getAttribute("transform")))if((h+
"").indexOf("url")===0||["font-size","font-family","x","y"].indexOf(g)>=0&&z.textContent)z=aa(z);J.indexOf(z)>=0&&setTimeout(function(){z.parentNode&&Qa.requestSelector(z).resize()},0);t=sa(z);if(t!=0&&g!="transform")for(var C=V(z),F=C.numberOfItems;F--;)if(C.getItem(F).type==4){C.removeItem(F);var B=svgedit.utilities.getBBox(z),D=O(B.x+B.width/2,B.y+B.height/2,ha(C).matrix);B=D.x;D=D.y;var H=e.createSVGTransform();H.setRotate(t,B,D);C.insertItemBefore(H,F);break}}}}}e.unsuspendRedraw(v)},db=this.changeSelectedAttribute=
function(g,h,k){k=k||J;b.undoMgr.beginUndoableChange(g,k);Wb(g,h,k);g=b.undoMgr.finishUndoableChange();g.isEmpty()||Ia(g)};this.deleteSelectedElements=function(){for(var g=new Oa("Delete Elements"),h=J.length,k=[],v=0;v<h;++v){var s=J[v];if(s==null)break;var E=s.parentNode,z=s;Qa.releaseSelector(z);svgedit.path.removePath_(z.id);if(E.tagName==="a"&&E.childNodes.length===1){z=E;E=E.parentNode}var t=z.nextSibling;z=E.removeChild(z);k.push(s);J[v]=null;g.addSubCommand(new Sa(z,t,E))}g.isEmpty()||Ia(g);
K("changed",k);$a()};this.cutSelectedElements=function(){for(var g=new Oa("Cut Elements"),h=J.length,k=[],v=0;v<h;++v){var s=J[v];if(s==null)break;var E=s.parentNode,z=s;Qa.releaseSelector(z);svgedit.path.removePath_(z.id);var t=z.nextSibling;z=E.removeChild(z);k.push(s);J[v]=null;g.addSubCommand(new Sa(z,t,E))}g.isEmpty()||Ia(g);K("changed",k);$a();b.clipBoard=k};this.copySelectedElements=function(){b.clipBoard=$.merge([],J)};this.pasteElements=function(){var g=b.clipBoard,h=g.length;if(h){for(var k=
[],v=new Oa("Paste elements");h--;){var s=g[h];if(s){var E=ma(s);if(!la(s.id))E.id=s.id;k.push(E);(L||w().getCurrentLayer()).appendChild(E);v.addSubCommand(new Na(E))}}svgCanvas.clearSelection();setTimeout(function(){Qb(k)},100);Ia(v);K("changed",k)}};this.groupSelectedElements=function(g){g||(g="g");var h="";switch(g){case "a":h="Make hyperlink";var k="";if(arguments.length>1)k=arguments[1];break;default:g="g";h="Group Elements"}h=new Oa(h);var v=da({element:g,attr:{id:na()}});g==="a"&&S(v,k);h.addSubCommand(new Na(v));
for(k=J.length;k--;){var s=J[k];if(s!=null){if(s.parentNode.tagName==="a"&&s.parentNode.childNodes.length===1)s=s.parentNode;var E=s.nextSibling,z=s.parentNode;v.appendChild(s);h.addSubCommand(new Ra(s,E,z))}}h.isEmpty()||Ia(h);Qb([v],true)};var Xb=this.pushGroupProperties=function(g,h){var k=g.childNodes,v=k.length,s=g.getAttribute("transform"),E=V(g),z=ha(E).matrix,t=new Oa("Push group properties"),B=0,F=sa(g),C=$(g).attr(["filter","opacity"]),D,H;for(B=0;B<v;B++){var G=k[B];if(G.nodeType===1){if(C.opacity!==
null&&C.opacity!==1){G.getAttribute("opacity");var P=Math.round((G.getAttribute("opacity")||1)*C.opacity*100)/100;rb("opacity",P,[G])}if(C.filter){var R=P=this.getBlur(G);H||(H=this.getBlur(g));if(P)P=H-0+(P-0);else if(P===0)P=H;if(R)D=N(G.getAttribute("filter"));else if(D){D=ma(D);xb().appendChild(D)}else D=N(C.filter);D.id=G.id+"_"+(D.firstChild.tagName==="feGaussianBlur"?"blur":"filter");rb("filter","url(#"+D.id+")",[G]);if(P){rb("stdDeviation",P,[D.firstChild]);b.setBlurOffsets(D,P)}}P=V(G);if(~G.tagName.indexOf("Gradient"))P=
null;if(P)if(G.tagName!=="defs")if(E.numberOfItems){if(F&&E.numberOfItems==1){var W=E.getItem(0).matrix,ta=e.createSVGMatrix();if(R=sa(G))ta=P.getItem(0).matrix;var wa=svgedit.utilities.getBBox(G),ga=ha(P).matrix,ka=O(wa.x+wa.width/2,wa.y+wa.height/2,ga);wa=F+R;ga=e.createSVGTransform();ga.setRotate(wa,ka.x,ka.y);W=fa(W,ta,ga.matrix.inverse());R&&P.removeItem(0);if(wa)P.numberOfItems?P.insertItemBefore(ga,0):P.appendItem(ga);if(W.e||W.f){R=e.createSVGTransform();R.setTranslate(W.e,W.f);P.numberOfItems?
P.insertItemBefore(R,0):P.appendItem(R)}}else{R=G.getAttribute("transform");W={};W.transform=R?R:"";R=e.createSVGTransform();W=ha(P).matrix;ta=W.inverse();W=fa(ta,z,W);R.setMatrix(W);P.appendItem(R)}(G=cb(G))&&t.addSubCommand(G)}}}if(s){W={};W.transform=s;g.setAttribute("transform","");g.removeAttribute("transform");t.addSubCommand(new Wa(g,W))}if(h&&!t.isEmpty())return t};this.ungroupSelectedElement=function(){var g=J[0];if($(g).data("gsvg")||$(g).data("symbol"))fc(g);else if(g.tagName==="use"){var h=
la(ba(g).substr(1));$(g).data("symbol",h).data("ref",h);fc(g)}else{h=$(g).parents("a");if(h.length)g=h[0];if(g.tagName==="g"||g.tagName==="a"){h=new Oa("Ungroup Elements");var k=Xb(g,true);k&&h.addSubCommand(k);k=g.parentNode;for(var v=g.nextSibling,s=Array(g.childNodes.length),E=0;g.firstChild;){var z=g.firstChild,t=z.nextSibling,B=z.parentNode;if(z.tagName==="title"){h.addSubCommand(new Sa(z,z.nextSibling,B));B.removeChild(z)}else{s[E++]=z=k.insertBefore(z,v);h.addSubCommand(new Ra(z,t,B))}}$a();
v=g.nextSibling;g=k.removeChild(g);h.addSubCommand(new Sa(g,v,k));h.isEmpty()||Ia(h);Kb(s)}}};this.moveToTopSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling;g=g.parentNode.appendChild(g);if(k!=g.nextSibling){Ia(new Ra(g,k,h,"top"));K("changed",[g])}}};this.moveToBottomSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling,v=g.parentNode.firstChild;if(v.tagName=="title")v=v.nextSibling;if(v.tagName=="defs")v=v.nextSibling;g=
g.parentNode.insertBefore(g,v);if(k!=g.nextSibling){Ia(new Ra(g,k,h,"bottom"));K("changed",[g])}}};this.moveUpDownSelected=function(g){var h=J[0];if(h){wb=[];var k,v,s=$(Gb(getStrokedBBox([h]))).toArray();g=="Down"&&s.reverse();$.each(s,function(){if(v){k=this;return false}else if(this==h)v=true});if(k){s=h.parentNode;var E=h.nextSibling;$(k)[g=="Down"?"before":"after"](h);if(E!=h.nextSibling){Ia(new Ra(h,E,s,"Move "+g));K("changed",[h])}}}};this.moveSelectedElements=function(g,h,k){if(g.constructor!=
[],v=new Oa("Paste elements");h--;){var s=g[h];if(s){var E=ma(s);if(!la(s.id))E.id=s.id;k.push(E);(L||w().getCurrentLayer()).appendChild(E);v.addSubCommand(new Na(E))}}svgCanvas.clearSelection();setTimeout(function(){Pb(k)},100);Ia(v);K("changed",k)}};this.groupSelectedElements=function(g){g||(g="g");var h="";switch(g){case "a":h="Make hyperlink";var k="";if(arguments.length>1)k=arguments[1];break;default:g="g";h="Group Elements"}h=new Oa(h);var v=da({element:g,attr:{id:na()}});g==="a"&&S(v,k);h.addSubCommand(new Na(v));
for(k=J.length;k--;){var s=J[k];if(s!=null){if(s.parentNode.tagName==="a"&&s.parentNode.childNodes.length===1)s=s.parentNode;var E=s.nextSibling,z=s.parentNode;v.appendChild(s);h.addSubCommand(new Ra(s,E,z))}}h.isEmpty()||Ia(h);Pb([v],true)};var dc=this.pushGroupProperties=function(g,h){var k=g.childNodes,v=k.length,s=g.getAttribute("transform"),E=V(g),z=ha(E).matrix,t=new Oa("Push group properties"),C=0,F=sa(g),B=$(g).attr(["filter","opacity"]),D,H;for(C=0;C<v;C++){var G=k[C];if(G.nodeType===1){if(B.opacity!==
null&&B.opacity!==1){G.getAttribute("opacity");var P=Math.round((G.getAttribute("opacity")||1)*B.opacity*100)/100;db("opacity",P,[G])}if(B.filter){var Q=P=this.getBlur(G);H||(H=this.getBlur(g));if(P)P=H-0+(P-0);else if(P===0)P=H;if(Q)D=N(G.getAttribute("filter"));else if(D){D=ma(D);vb().appendChild(D)}else D=N(B.filter);D.id=G.id+"_"+(D.firstChild.tagName==="feGaussianBlur"?"blur":"filter");db("filter","url(#"+D.id+")",[G]);if(P){db("stdDeviation",P,[D.firstChild]);b.setBlurOffsets(D,P)}}P=V(G);if(~G.tagName.indexOf("Gradient"))P=
null;if(P)if(G.tagName!=="defs")if(E.numberOfItems){if(F&&E.numberOfItems==1){var W=E.getItem(0).matrix,ua=e.createSVGMatrix();if(Q=sa(G))ua=P.getItem(0).matrix;var wa=svgedit.utilities.getBBox(G),fa=ha(P).matrix,ka=O(wa.x+wa.width/2,wa.y+wa.height/2,fa);wa=F+Q;fa=e.createSVGTransform();fa.setRotate(wa,ka.x,ka.y);W=ga(W,ua,fa.matrix.inverse());Q&&P.removeItem(0);if(wa)P.numberOfItems?P.insertItemBefore(fa,0):P.appendItem(fa);if(W.e||W.f){Q=e.createSVGTransform();Q.setTranslate(W.e,W.f);P.numberOfItems?
P.insertItemBefore(Q,0):P.appendItem(Q)}}else{Q=G.getAttribute("transform");W={};W.transform=Q?Q:"";Q=e.createSVGTransform();W=ha(P).matrix;ua=W.inverse();W=ga(ua,z,W);Q.setMatrix(W);P.appendItem(Q)}(G=cb(G))&&t.addSubCommand(G)}}}if(s){W={};W.transform=s;g.setAttribute("transform","");g.removeAttribute("transform");t.addSubCommand(new Wa(g,W))}if(h&&!t.isEmpty())return t};this.ungroupSelectedElement=function(){var g=J[0];if($(g).data("gsvg")||$(g).data("symbol"))gc(g);else if(g.tagName==="use"){var h=
la(ba(g).substr(1));$(g).data("symbol",h).data("ref",h);gc(g)}else{h=$(g).parents("a");if(h.length)g=h[0];if(g.tagName==="g"||g.tagName==="a"){h=new Oa("Ungroup Elements");var k=dc(g,true);k&&h.addSubCommand(k);k=g.parentNode;for(var v=g.nextSibling,s=Array(g.childNodes.length),E=0;g.firstChild;){var z=g.firstChild,t=z.nextSibling,C=z.parentNode;if(z.tagName==="title"){h.addSubCommand(new Sa(z,z.nextSibling,C));C.removeChild(z)}else{s[E++]=z=k.insertBefore(z,v);h.addSubCommand(new Ra(z,t,C))}}$a();
v=g.nextSibling;g=k.removeChild(g);h.addSubCommand(new Sa(g,v,k));h.isEmpty()||Ia(h);Fb(s)}}};this.moveToTopSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling;g=g.parentNode.appendChild(g);if(k!=g.nextSibling){Ia(new Ra(g,k,h,"top"));K("changed",[g])}}};this.moveToBottomSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling,v=g.parentNode.firstChild;if(v.tagName=="title")v=v.nextSibling;if(v.tagName=="defs")v=v.nextSibling;g=
g.parentNode.insertBefore(g,v);if(k!=g.nextSibling){Ia(new Ra(g,k,h,"bottom"));K("changed",[g])}}};this.moveUpDownSelected=function(g){var h=J[0];if(h){ub=[];var k,v,s=$(Gb(getStrokedBBox([h]))).toArray();g=="Down"&&s.reverse();$.each(s,function(){if(v){k=this;return false}else if(this==h)v=true});if(k){s=h.parentNode;var E=h.nextSibling;$(k)[g=="Down"?"before":"after"](h);if(E!=h.nextSibling){Ia(new Ra(h,E,s,"Move "+g));K("changed",[h])}}}};this.moveSelectedElements=function(g,h,k){if(g.constructor!=
Array){g/=p;h/=p}k=k||true;for(var v=new Oa("position"),s=J.length;s--;){var E=J[s];if(E!=null){var z=e.createSVGTransform(),t=V(E);g.constructor==Array?z.setTranslate(g[s],h[s]):z.setTranslate(g,h);t.numberOfItems?t.insertItemBefore(z,0):t.appendItem(z);(z=cb(E))&&v.addSubCommand(z);Qa.requestSelector(E).resize()}}if(!v.isEmpty()){k&&Ia(v);K("changed",J);return v}};this.cloneSelectedElements=function(g,h){for(var k=new Oa("Clone Elements"),v=J.length,s=0;s<v;++s){var E=J[s];if(E==null)break}v=J.slice(0,
s);this.clearSelection(true);for(s=v.length;s--;){E=v[s]=ma(v[s]);(L||w().getCurrentLayer()).appendChild(E);k.addSubCommand(new Na(E))}if(!k.isEmpty()){Kb(v.reverse());this.moveSelectedElements(g,h,false);Ia(k)}};this.alignSelectedElements=function(g,h){var k=[],v=Number.MAX_VALUE,s=Number.MIN_VALUE,E=Number.MAX_VALUE,z=Number.MIN_VALUE,t=Number.MIN_VALUE,B=Number.MIN_VALUE,F=J.length;if(F){for(var C=0;C<F;++C){if(J[C]==null)break;k[C]=getStrokedBBox([J[C]]);switch(h){case "smallest":if((g=="l"||
g=="c"||g=="r")&&(t==Number.MIN_VALUE||t>k[C].width)||(g=="t"||g=="m"||g=="b")&&(B==Number.MIN_VALUE||B>k[C].height)){v=k[C].x;E=k[C].y;s=k[C].x+k[C].width;z=k[C].y+k[C].height;t=k[C].width;B=k[C].height}break;case "largest":if((g=="l"||g=="c"||g=="r")&&(t==Number.MIN_VALUE||t<k[C].width)||(g=="t"||g=="m"||g=="b")&&(B==Number.MIN_VALUE||B<k[C].height)){v=k[C].x;E=k[C].y;s=k[C].x+k[C].width;z=k[C].y+k[C].height;t=k[C].width;B=k[C].height}break;default:if(k[C].x<v)v=k[C].x;if(k[C].y<E)E=k[C].y;if(k[C].x+
k[C].width>s)s=k[C].x+k[C].width;if(k[C].y+k[C].height>z)z=k[C].y+k[C].height}}if(h=="page"){E=v=0;s=b.contentW;z=b.contentH}t=Array(F);B=Array(F);for(C=0;C<F;++C){if(J[C]==null)break;var D=k[C];t[C]=0;B[C]=0;switch(g){case "l":t[C]=v-D.x;break;case "c":t[C]=(v+s)/2-(D.x+D.width/2);break;case "r":t[C]=s-(D.x+D.width);break;case "t":B[C]=E-D.y;break;case "m":B[C]=(E+z)/2-(D.y+D.height/2);break;case "b":B[C]=z-(D.y+D.height)}}this.moveSelectedElements(t,B)}};this.contentW=Vb().w;this.contentH=Vb().h;
s);this.clearSelection(true);for(s=v.length;s--;){E=v[s]=ma(v[s]);(L||w().getCurrentLayer()).appendChild(E);k.addSubCommand(new Na(E))}if(!k.isEmpty()){Fb(v.reverse());this.moveSelectedElements(g,h,false);Ia(k)}};this.alignSelectedElements=function(g,h){var k=[],v=Number.MAX_VALUE,s=Number.MIN_VALUE,E=Number.MAX_VALUE,z=Number.MIN_VALUE,t=Number.MIN_VALUE,C=Number.MIN_VALUE,F=J.length;if(F){for(var B=0;B<F;++B){if(J[B]==null)break;k[B]=getStrokedBBox([J[B]]);switch(h){case "smallest":if((g=="l"||
g=="c"||g=="r")&&(t==Number.MIN_VALUE||t>k[B].width)||(g=="t"||g=="m"||g=="b")&&(C==Number.MIN_VALUE||C>k[B].height)){v=k[B].x;E=k[B].y;s=k[B].x+k[B].width;z=k[B].y+k[B].height;t=k[B].width;C=k[B].height}break;case "largest":if((g=="l"||g=="c"||g=="r")&&(t==Number.MIN_VALUE||t<k[B].width)||(g=="t"||g=="m"||g=="b")&&(C==Number.MIN_VALUE||C<k[B].height)){v=k[B].x;E=k[B].y;s=k[B].x+k[B].width;z=k[B].y+k[B].height;t=k[B].width;C=k[B].height}break;default:if(k[B].x<v)v=k[B].x;if(k[B].y<E)E=k[B].y;if(k[B].x+
k[B].width>s)s=k[B].x+k[B].width;if(k[B].y+k[B].height>z)z=k[B].y+k[B].height}}if(h=="page"){E=v=0;s=b.contentW;z=b.contentH}t=Array(F);C=Array(F);for(B=0;B<F;++B){if(J[B]==null)break;var D=k[B];t[B]=0;C[B]=0;switch(g){case "l":t[B]=v-D.x;break;case "c":t[B]=(v+s)/2-(D.x+D.width/2);break;case "r":t[B]=s-(D.x+D.width);break;case "t":C[B]=E-D.y;break;case "m":C[B]=(E+z)/2-(D.y+D.height/2);break;case "b":C[B]=z-(D.y+D.height)}}this.moveSelectedElements(t,C)}};this.contentW=Vb().w;this.contentH=Vb().h;
this.updateCanvas=function(g,h){e.setAttribute("width",g);e.setAttribute("height",h);var k=$("#canvasBackground")[0],v=l.getAttribute("x"),s=l.getAttribute("y"),E=g/2-this.contentW*p/2,z=h/2-this.contentH*p/2;oa(l,{width:this.contentW*p,height:this.contentH*p,x:E,y:z,viewBox:"0 0 "+this.contentW+" "+this.contentH});oa(k,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:E,y:z});(k=la("background_image"))&&oa(k,{width:"100%",height:"100%"});Qa.selectorParentGroup.setAttribute("transform",
"translate("+E+","+z+")");return{x:E,y:z,old_x:v,old_y:s,d_x:E-v,d_y:z-s}};this.setBackground=function(g,h){var k=la("canvasBackground"),v=$(k).find("rect")[0],s=la("background_image");v.setAttribute("fill",g);if(h){if(!s){s=d.createElementNS(c,"image");oa(s,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}S(s,h);k.appendChild(s)}else s&&s.parentNode.removeChild(s)};this.cycleElement=function(g){var h=J[0],k=false,v=Hb(L||w().getCurrentLayer());
if(v.length){if(h==null){g=g?v.length-1:0;k=v[g]}else for(var s=v.length;s--;)if(v[s]==h){g=g?s-1:s+1;if(g>=v.length)g=0;else if(g<0)g=v.length-1;k=v[g];break}Qb([k],true);K("selected",J)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:Ia,setGradient:jc,addSvgElementFromJson:da,assignAttributes:oa,BatchCommand:Oa,call:K,ChangeElementCommand:Wa,copyElem:ma,ffClone:aa,findDefs:xb,findDuplicateGradient:ic,getElem:la,getId:Y,getIntersectionList:Gb,getMouseTarget:Zb,getNextId:na,
getPathBBox:U,getUrlFromAttr:qa,hasMatrixTransform:ua,identifyLayers:Rb,InsertElementCommand:Na,isIdentity:svgedit.math.isIdentity,logMatrix:fb,matrixMultiply:fa,MoveElementCommand:Ra,preventClickDefault:Ib,recalculateAllSelectedDimensions:Pa,recalculateDimensions:cb,remapElement:nb,RemoveElementCommand:Sa,removeUnusedDefElems:hc,round:kb,runExtensions:sb,sanitizeSvg:Ka,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ha,
if(v.length){if(h==null){g=g?v.length-1:0;k=v[g]}else for(var s=v.length;s--;)if(v[s]==h){g=g?s-1:s+1;if(g>=v.length)g=0;else if(g<0)g=v.length-1;k=v[g];break}Pb([k],true);K("selected",J)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:Ia,setGradient:kc,addSvgElementFromJson:da,assignAttributes:oa,BatchCommand:Oa,call:K,ChangeElementCommand:Wa,copyElem:ma,ffClone:aa,findDefs:vb,findDuplicateGradient:jc,getElem:la,getId:Y,getIntersectionList:Gb,getMouseTarget:$b,getNextId:na,
getPathBBox:U,getUrlFromAttr:pa,hasMatrixTransform:ta,identifyLayers:Tb,InsertElementCommand:Na,isIdentity:svgedit.math.isIdentity,logMatrix:hb,matrixMultiply:ga,MoveElementCommand:Ra,preventClickDefault:Zb,recalculateAllSelectedDimensions:Pa,recalculateDimensions:cb,remapElement:pb,RemoveElementCommand:Sa,removeUnusedDefElems:ic,round:mb,runExtensions:sb,sanitizeSvg:Ka,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ha,
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(w,p){var L=f.setSvgString(w)!==false;p=p||a.noop;L?p(true):a.alert(e.notification.errorLoadingSVG,function(){p(false)})}var f,c={},m=false,o={lang:"en",iconsize:"m",bkgd_color:"FFF",bkgd_url:"",img_save:"embed"},
b={},d={canvas_expansion:1,dimensions:[640,480],initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",langPath:"locale/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:["ext-markers.js","ext-eyedropper.js","ext-shapes.js","ext-grid.js"],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:true,show_outside_canvas:false,no_save_warning:true},e=c.uiStrings=
{common:{ok:"OK",cancel:"Cancel",key_up:"Up",key_down:"Down",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...",
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" ...'}};b={};var l={};c.curConfig=d;c.tool_scale=1;a.pref=function(w,p){if(p)b[w]=p;w="svg-edit-"+w;var L=location.hostname,T=L&&L.indexOf(".")>=0,M=p!=undefined,
J=false;try{if(window.localStorage)J=localStorage}catch(da){}try{if(window.globalStorage&&T)J=globalStorage[L]}catch(V){}if(J)if(M)J.setItem(w,p);else{if(J.getItem(w))return J.getItem(w)+""}else if(window.widget)if(M)widget.setPreferenceForKey(p,w);else return widget.preferenceForKey(w);else if(M){L=new Date;L.setTime(L.getTime()+31536E6);p=encodeURIComponent(p);document.cookie=w+"="+p+"; expires="+L.toUTCString()}else return(L=document.cookie.match(RegExp(w+"=([^;]+)")))?decodeURIComponent(L[1]):
""};c.setConfig=function(w){a.each(w,function(p,L){p in o&&a.pref(p,L)});a.extend(true,d,w);if(w.extensions)d.extensions=w.extensions};c.setCustomHandlers=function(w){c.ready(function(){if(w.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();f.open=w.open}if(w.save){c.show_save_warning=false;f.bind("saved",w.save)}w.pngsave&&f.bind("exported",w.pngsave);l=w})};c.randomizeIds=function(){f.randomizeIds(arguments)};c.init=function(){function w(q,A){var I=q.id,Q=I.split("_"),X=
Q[0];Q=Q[1];A&&f.setStrokeAttr("stroke-"+X,Q);gb();ta("#cur_"+X,I,20);a(q).addClass("current").siblings().removeClass("current")}function p(q,A){a.pref("bkgd_color",q);a.pref("bkgd_url",A);f.setBackground(q,A)}function L(){var q=f.getHref(Z);q=q.indexOf("data:")===0?"":q;a.prompt(e.notification.enterNewImgURL,q,function(A){A&&Ea(A)})}function T(){if(f.deleteCurrentLayer()){Ja();Bb();a("#layerlist tr.layer").removeClass("layersel");a("#layerlist tr.layer:first").addClass("layersel")}}function M(){var q=
f.getCurrentDrawing().getCurrentLayerName()+" copy";a.prompt(e.notification.enterUniqueLayerName,q,function(A){if(A)if(f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.dupeLayerName);else{f.cloneLayer(A);Ja();Bb()}})}function J(q){var A=a("#layerlist tr.layersel").index(),I=f.getCurrentDrawing().getNumLayers();if(A>0||A<I-1){A+=q;f.setCurrentLayerPosition(I-A-1);Bb()}}function da(q,A){var I=document.getElementById("ruler_x_cursor"),Q=document.getElementById("ruler_y_cursor"),X=document.getElementById("workarea");
document.getElementById("title_show");svgedit.browser.isTouch()||a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(mc){mc.stopPropagation();I.style.left=mc.pageX-66+X.scrollLeft+"px";Q.style.top=mc.pageY-48+X.scrollTop+"px"});A||(A=f.getZoom());q||(q=a("#svgcanvas"));for(var ja=f.getContentElem(),va=svgedit.units.getTypeMap()[d.baseUnit],ya=0;ya<2;ya++){var Da=ya===0,Ca=Da?"x":"y",Ba=Da?"width":"height",vb=ja.getAttribute(Ca)-0;Ca=a("#ruler_"+Ca+" canvas:first");$hcanv=Ca.clone();
Ca.replaceWith($hcanv);var Ta=$hcanv[0];var ia=Ca=q[Ba]()*2;Ta.parentNode.style[Ba]=ia+"px";var yb=0,bb,Fa=Ta.getContext("2d");Fa.fillStyle="rgb(200,0,0)";Fa.fillRect(0,0,Ta.width,Ta.height);$hcanv.siblings().remove();if(Ca>=3E4){var Va=parseInt(Ca/3E4)+1;bb=Array(Va);bb[0]=Fa;for(var Ha=1;Ha<Va;Ha++){Ta[Ba]=3E4;var ib=Ta.cloneNode(true);Ta.parentNode.appendChild(ib);bb[Ha]=ib.getContext("2d")}ib[Ba]=Ca%3E4;Ca=3E4}Ta[Ba]=Ca;Ba=va*A;var db=50/Ba;Ta=1;for(Ha=0;Ha<gc.length;Ha++){Ta=Va=gc[Ha];if(db<=
Va)break}db=Ta*Ba;Fa.font="normal 9px 'Lucida Grande', sans-serif";Fa.fillStyle="#777";for(var jb=vb/Ba%Ta*Ba,Yb=jb-db;jb<ia;jb+=db){Yb+=db;Ha=Math.round(jb)+0.5;if(Da){Fa.moveTo(Ha,15);Fa.lineTo(Ha,0)}else{Fa.moveTo(15,Ha);Fa.lineTo(0,Ha)}Va=(Yb-vb)/Ba;if(Ta>=1)Ha=Math.round(Va);else{Ha=(Ta+"").split(".")[1].length;Ha=Va.toFixed(Ha)-0}if(Ha!==0&&Ha!==1E3&&Ha%1E3===0)Ha=Ha/1E3+"K";if(Da){Fa.fillText(Ha,jb+2,8);Fa.fillStyle="#777"}else{Va=(Ha+"").split("");for(Ha=0;Ha<Va.length;Ha++){Fa.fillText(Va[Ha],
1,jb+9+Ha*9);Fa.fillStyle="#777"}}Va=db/10;for(Ha=1;Ha<10;Ha++){var Lb=Math.round(jb+Va*Ha)+0.5;if(bb&&Lb>Ca){yb++;Fa.stroke();if(yb>=bb.length){Ha=10;jb=ia;continue}Fa=bb[yb];jb-=3E4;Lb=Math.round(jb+Va*Ha)+0.5}var Wb=Ha%2?12:10;if(Da){Fa.moveTo(Lb,15);Fa.lineTo(Lb,Wb)}else{Fa.moveTo(15,Lb);Fa.lineTo(Wb,Lb)}}}Fa.strokeStyle="#666";Fa.stroke()}}(function(){var q=window.opener;if(q)try{var A=q.document.createEvent("Event");A.initEvent("svgEditorReady",true,true);q.document.documentElement.dispatchEvent(A)}catch(I){}})();
(function(){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 A=q.source,I=a.param.querystring();if(!A)if(I.indexOf("source=data:")>=0)A=I.match(/source=(data:[^&]*)/)[1];if(A)if(A.indexOf("data:")===0){A=A.replace(/ /g,"+");c.loadFromDataURI(A)}else c.loadFromString(A);else if(I.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(I.substr(9));
else q.url&&svgEditor.loadFromURL(q.url)}})();var V=function(){a.each(d.extensions,function(){var A=this;a.getScript(d.extPath+A,function(I){if(!I){I=document.createElement("script");I.src=d.extPath+A;document.querySelector("head").appendChild(I)}})});var q=[];a("#lang_select option").each(function(){q.push(this.value)});c.putLocale(null,q)};document.location.protocol==="file:"?setTimeout(V,100):V();a.svgIcons(d.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),
fallback_path:d.imgPath,fallback:{new_image:"clear.png",save:"save.png",open:"open.png",source:"source.png",docprops:"document-properties.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.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",clone:"clone.png",
node_clone:"node_clone.png","delete":"delete.png",node_delete:"node_delete.png",move_top:"move_top.png",move_bottom:"move_bottom.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.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",go_up:"go-up.png",go_down:"go-down.png",ok:"save.png",cancel:"cancel.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},
placement:{"#tool_docprops > div":"docprops","#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","#linecap_butt,#cur_linecap":"linecap_butt","#linecap_round":"linecap_round","#linecap_square":"linecap_square","#linejoin_miter,#cur_linejoin":"linejoin_miter","#linejoin_round":"linejoin_round",
"#linejoin_bevel":"linejoin_bevel","#url_notice":"warning","#layer_up":"go_up","#layer_down":"go_down","#layer_moreopts":"context_menu","#layerlist td.layervis":"eye","#tool_source_save,#tool_docprops_save,#tool_prefs_save":"ok","#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel":"cancel","#rwidthLabel, #iwidthLabel":"width","#rheightLabel, #iheightLabel":"height","#angleLabel":"angle","#linkLabel,#tool_make_link,#tool_make_link_multi":"globe_link","#zoomLabel":"zoom","#blurLabel":"blur",
".flyout_arrow_horiz":"arrow_right","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":32,".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":24,".palette_item:first .svg_icon":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)});
var q=a("#tools_left");if(q.length!=0){q.offset();q.outerHeight()}a(".tools_flyout").each(function(){var A=a("#"+this.id+"_show"),I=A.attr("data-curopt");if(!A.children("svg, img").length){I=a(I).children().clone();if(I.length){I[0].removeAttribute("style");A.append(I)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});c.canvas=f=new a.SvgCanvas(document.getElementById("svgcanvas"),
d);c.show_save_warning=false;V=navigator.platform.indexOf("Mac")>=0;var O=navigator.userAgent.indexOf("AppleWebKit")>=0,fa=V?"meta+":"ctrl+",ua=f.pathActions,ha=f.undoMgr,ca=svgedit.utilities,ea=d.imgPath+"placeholder.svg",ra=a("#workarea"),qa=a("#cmenu_canvas");a("#cmenu_layers");var ba=null,S=1,U="toolbars",sa="",la={fill:null,stroke:null};V||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"),A=a("#dialog_buttons"),I=function(Q,X,ja,va){a("#dialog_content").html("<p>"+X.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",Q=="prompt");A.empty();var ya=a('<input type="button" value="'+e.common.ok+'">').appendTo(A);Q!="alert"&&a('<input type="button" value="'+e.common.cancel+'">').appendTo(A).click(function(){q.hide();ja(false)});if(Q=="prompt"){var Da=a('<input type="text">').prependTo(A);Da.val(va||"");Da.bind("keydown","return",function(){ya.click()})}Q==
"process"&&ya.hide();q.show();ya.click(function(){q.hide();var Ca=Q=="prompt"?Da.val():true;ja&&ja(Ca)}).focus();Q=="prompt"&&Da.focus()};a.alert=function(Q,X){I("alert",Q,X)};a.confirm=function(Q,X){I("confirm",Q,X)};a.process_cancel=function(Q,X){I("process",Q,X)};a.prompt=function(Q,X,ja){I("prompt",Q,ja,X)}})();var oa=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");
a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")}f.setMode("select")},Z=null,Aa=false,Ka=false,Ra=false,Na=false,Sa="",Wa=a("title:first").text(),Oa=function(q,A,I){f.getResolution();a("#svgcanvas").position();if(A=f.setBBoxZoom(A,ra.width()-15,ra.height()-15)){q=A.zoom;A=A.bbox;if(q<0.0010)mb({value:0.1});else{a("#zoom").val(q*100);I?Ub():Ub(false,{x:A.x*q+A.width*q/2,y:A.y*q+A.height*q/2});f.getMode()=="zoom"&&A.width&&oa();B()}}};a("#cur_context_panel").delegate("a",
"click",function(){var q=a(this);q.attr("data-root")?f.leaveContext():f.setContext(q.text());return false});var Ia={},Qa=function(q){a.each(q,function(A,I){var Q=a(A).children(),X=A+"_show",ja=a(X),va=false;Q.addClass("tool_button").unbind("click mousedown mouseup").each(function(Ca){var Ba=I[Ca];Ia[Ba.sel]=Ba.fn;if(Ba.isDefault)va=Ca;Ca=function(vb){var Ta=Ba;if(vb.type==="keydown"){var ia=a(Ta.parent+"_show").hasClass("tool_button_current"),yb=a(Ta.parent+"_show").attr("data-curopt");a.each(q[Ba.parent],
function(Fa,Va){if(Va.sel==yb)Ta=!vb.shiftKey||!ia?Va:q[Ba.parent][Fa+1]||q[Ba.parent][0]})}if(a(this).hasClass("disabled"))return false;xa(X)&&Ta.fn();var bb=Ta.icon?a.getSvgIcon(Ta.icon,true):a(Ta.sel).children().eq(0).clone();bb[0].setAttribute("width",ja.width());bb[0].setAttribute("height",ja.height());ja.children(":not(.flyout_arrow_horiz)").remove();ja.append(bb).attr("data-curopt",Ta.sel)};a(this).mouseup(Ca);Ba.key&&a(document).bind("keydown",Ba.key[0]+" shift+"+Ba.key[0],Ca)});if(va)ja.attr("data-curopt",
I[va].sel);else ja.attr("data-curopt")||ja.attr("data-curopt",I[0].sel);var ya,Da=a(X).position();a(A).css({left:Da.left+34,top:Da.top+77});ja.mousedown(function(Ca){a("#tools_shapelib").is(":visible")&&xa(X,false);if(ja.hasClass("disabled"))return false;var Ba=a(A),vb=Da.left+34,Ta=Ba.width()*-1,ia=Ba.data("shown_popop")?200:0;ya=setTimeout(function(){ja.data("isLibrary")?Ba.css("left",vb).show():Ba.css("left",Ta).show().animate({left:vb},150);Ba.data("shown_popop",true)},ia);Ca.preventDefault()}).mouseup(function(){clearTimeout(ya);
var Ca=a(this).attr("data-curopt");if(ja.data("isLibrary")&&a(X.replace("_show","")).is(":visible"))xa(X,true);else xa(X)&&Ca in Ia&&Ia[Ca]()})});Mb()},Ga=function(q,A){return a("<div>",{"class":"tools_flyout",id:q}).appendTo("#svg_editor").append(A)},Cb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show"),A=q.offset();q=q.outerWidth();a(this).css({left:(A.left+q)*S,top:A.top})})},Mb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show");if(!q.data("isLibrary")){var A=
[];a(this).children().each(function(){A.push(this.title)});q[0].title=A.join(" / ")}})},lb,ab=function(q,A,I){var Q=null;if(q.indexOf("url(#")===0){q=(q=f.getRefElem(q))?q.cloneNode(true):a("#"+I+"_color defs *")[0];Q={alpha:A};Q[q.tagName]=q}else Q=q.indexOf("#")===0?{alpha:A,solidColor:q.substr(1)}:{alpha:A,solidColor:"none"};return new a.jGraduate.Paint(Q)},Ya=f.getResolution();if(d.baseUnit!=="px"){Ya.w=svgedit.units.convertUnit(Ya.w)+d.baseUnit;Ya.h=svgedit.units.convertUnit(Ya.h)+d.baseUnit}a(".canvas_width").val(Ya.w);
a(".canvas_height").val(Ya.h);a("#docprops_button").on("click",function(){C()});var La=function(q){f.createLayer("background");cur_shape=f.addSvgElementFromJson({element:"rect",attr:{x:0,y:0,width:Ya.w,height:Ya.h,stroke:"none",id:"canvas_background",opacity:1,fill:q||a.pref("bkgd_color"),style:"pointer-events:none"}});f.setCurrentLayer("Layer 1");f.setCurrentLayerPosition("1")};document.getElementById("canvas_background")?document.getElementById("canvas_background").getAttribute("fill"):La();if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),
a.pref("bkgd_url"));else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));var Ea=c.setImageURL=function(q){q||(q=ea);f.setImageURL(q);a("#image_url").val(q);if(q.indexOf("data:")===0){a("#image_url").hide();a("#change_image_url").show()}else{f.embedImage(q,function(A){A?a("#url_notice").hide():a("#url_notice").show();ea=q});a("#image_url").show();a("#change_image_url").hide()}},ob=function(q){var A=Math.min(Math.max(12+q.value.length*6,50),300);a(q).width(A)},Ja=function(){var q=Z;if(q!=null&&
!q.parentNode)q=null;var A=f.getCurrentDrawing().getCurrentLayerName(),I=f.getMode(),Q=d.baseUnit!=="px"?d.baseUnit:null,X=I=="pathedit",ja=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 va=q.nodeName,ya=f.getRotationAngle(q);a("#angle").val(Math.round(ya));ya=f.getBlur(q);a("#blur").val(ya);a("#blur_slider").slider("option","value",ya);f.addedNew&&va==="image"&&f.getHref(q).indexOf("data:")!==0&&L();if(!X&&I!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");if(["line","circle","ellipse"].indexOf(va)>=0)a("#xy_panel").hide();else{var Da,Ca;if(["g","polyline","path"].indexOf(va)>=0){if(I=f.getStrokedBBox([q])){Da=I.x;Ca=I.y}}else{Da=
q.getAttribute("x");Ca=q.getAttribute("y")}if(Q){Da=svgedit.units.convertUnit(Da);Ca=svgedit.units.convertUnit(Ca)}a("#selected_x").val(Math.round(Ca)||0);a("#selected_y").val(Math.round(Da)||0);a("#xy_panel").show()}["image","text","path","g","use"].indexOf(va)==-1&&a(".action_path_convert_selected").removeClass("disabled");va==="path"&&a(".action_path_selected").removeClass("disabled")}else{A=ua.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",
!ua.canDeleteNodes);ta("#tool_openclose_path",ua.closed_subpath?"open_path":"close_path");if(A){X=a("#seg_type");if(Q){A.x=svgedit.units.convertUnit(A.x);A.y=svgedit.units.convertUnit(A.y)}a("#path_node_x").val(Math.round(A.x));a("#path_node_y").val(Math.round(A.y));A.type?X.val(A.type).removeAttr("disabled"):X.val(4).attr("disabled","disabled")}return}Q={g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],
text:[],use:[]};var Ba=q.tagName;a(q).data("gsvg")&&a("#g_panel").show();Ba=="path"&&a("#path_panel").show();if(Q[Ba]){Q=Q[Ba];a("#"+Ba+"_panel").show();a.each(Q,function(vb,Ta){var ia=q.getAttribute(Ta);if(d.baseUnit!=="px"&&q[Ta])ia=svgedit.units.convertUnit(q[Ta].baseVal.value);a("#"+Ba+"_"+Ta).val(Math.round(ia)||0)});if(Ba=="text"){a("#text_panel").css("display","inline");f.getItalic()?a("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):a("#tool_italic").removeClass("push_button_pressed").addClass("tool_button");
f.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);f.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(Ba=="image")Ea(f.getHref(q));else if(Ba==="g"||Ba==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");
Q=f.getTitle();va=a("#g_title")[0];va.value=Q;ob(va);Ba=="use"?va.setAttribute("disabled","disabled"):va.removeAttribute("disabled")}}ja[(Ba==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");ja[(Ba==="g"||!Aa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(Aa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");ja.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else ja.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
ha.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");ha.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");f.addedNew=false;if(q&&!X||Aa){a("#selLayerNames").removeAttr("disabled").val(A);qa.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}else a("#selLayerNames").attr("disabled","disabled")};a("#text").focus(function(){});a("#text").blur(function(){});f.bind("selected",
function(q,A){var I=f.getMode();I==="select"&&oa();I=I=="pathedit";Z=A.length==1||A[1]==null?A[0]:null;Aa=A.length>=2&&A[1]!=null;if(Z!=null)if(!I){if(Z!=null)switch(Z.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var Q=null,X=Z.getElementsByTagName("*"),ja=0,va=X.length;ja<va;ja++){var ya=X[ja].getAttribute("stroke-width");if(ja===0)Q=ya;else if(Q!==ya)Q=null}a("#stroke_width").val(Q===null?"":Q);la.fill.update(true);la.stroke.update(true);break;default:la.fill.update(true);
la.stroke.update(true);a("#stroke_width").val(Z.getAttribute("stroke-width")||1);a("#stroke_style").val(Z.getAttribute("stroke-dasharray")||"none");Q=Z.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+Q).length!=0&&w(a("#linejoin_"+Q)[0]);Q=Z.getAttribute("stroke-linecap")||"butt";a("#linecap_"+Q).length!=0&&w(a("#linecap_"+Q)[0])}if(Z!=null){Q=(Z.getAttribute("opacity")||1)*100;a("#group_opacity").val(Q);a("#opac_slider").slider("option","value",Q);a("#elem_id").val(Z.id)}}a("#path_node_panel").toggle(I);
a("#tools_bottom_2,#tools_bottom_3").toggle(!I);if(I){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");ta("#tool_select","select_node");Aa=false;if(A.length)Z=A[0]}else{if(A[0]){I=f.selectorManager.requestSelector(A[0]);I.reset(A[0]);I.selectorRect.setAttribute("display","inline")}ta("#tool_select","select")}Ja();f.runExtensions("selectedChanged",{elems:A,selectedElement:Z,multiselected:Aa})});
f.bind("transition",function(q,A){var I=f.getMode(),Q=A[0];if(Q){Aa=A.length>=2&&A[1]!=null;if(!Aa)switch(I){case "rotate":I=f.getRotationAngle(Q);a("#angle").val(Math.round(I));a("#tool_reorient").toggleClass("disabled",I==0)}f.runExtensions("elementTransition",{elems:A})}});f.bind("changed",function(q,A){var I=f.getMode();I==="select"&&oa();for(var Q=0;Q<A.length;++Q){var X=A[Q];if(X&&X.tagName==="svg"){Bb();Ub()}else if(X&&Z&&Z.parentNode==null)Z=X}c.show_save_warning=true;Ja();if(Z&&I==="select"){la.fill.update();
la.stroke.update()}f.runExtensions("elementChanged",{elems:A})});f.bind("saved",function(q,A){c.show_save_warning=false;A='<?xml version="1.0"?>\n'+A;var I=navigator.userAgent;if(~I.indexOf("Chrome")&&a.browser.version>=533||~I.indexOf("MSIE"))F(0,true);else{var Q=q.open("data:image/svg+xml;base64,"+ca.encode64(A)),X=a.pref("save_notice_done");if(X!=="all"){var ja=e.notification.saveFromBrowser.replace("%s","SVG");if(I.indexOf("Gecko/")!==-1)if(A.indexOf("<defs")!==-1){ja+="\n\n"+e.notification.defsFailOnSave;
a.pref("save_notice_done","all");X="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");X!=="part"&&Q.alert(ja)}}});f.bind("exported",function(q,A){var I=A.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var Q=a("#export_canvas")[0];Q.width=f.contentW;Q.height=f.contentH;canvg(Q,A.svg,{renderCallback:function(){var X=Q.toDataURL("image/png");ba.location.href=X;if(a.pref("export_notice_done")!=="all"){X=e.notification.saveFromBrowser.replace("%s",
"PNG");if(I.length)X+="\n\n"+e.notification.noteTheseIssues+"\n \u2022 "+I.join("\n \u2022 ");a.pref("export_notice_done","all");ba.alert(X)}}})});f.bind("zoomed",Oa);f.bind("contextset",function(q,A){var I="";if(A){var Q="";I='<a href="#" data-root="y">'+f.getCurrentDrawing().getCurrentLayerName()+"</a>";a(A).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){Q+=" > "+this.id;I+=this!==A?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Sa=Q}else Sa=null;a("#cur_context_panel").toggle(!!A).html(I);
P()});f.bind("extension_added",function(q,A){function I(){if(lb){clearTimeout(lb);lb=null}X||(lb=setTimeout(function(){X=true;ka(b.iconsize)},50))}var Q=false,X=false,ja=true,va=function(){if(A.callback&&!Q&&ja){Q=true;A.callback()}},ya=[];A.context_tools&&a.each(A.context_tools,function(Ta,ia){var yb=ia.container_id?' id="'+ia.container_id+'"':"",bb=a("#"+ia.panel);bb.length||(bb=a("<div>",{id:ia.panel}).appendTo("#tools_top"));switch(ia.type){case "tool_button":var Fa='<div class="tool_button">'+
ia.id+"</div>",Va=a(Fa).appendTo(bb);ia.events&&a.each(ia.events,function(db,jb){a(Va).bind(db,jb)});break;case "select":Fa="<label"+yb+'><select id="'+ia.id+'">';a.each(ia.options,function(db,jb){Fa+='<option value="'+db+'"'+(db==ia.defval?" selected":"")+">"+jb+"</option>"});Fa+="</select></label>";var Ha=a(Fa).appendTo(bb).find("select");a.each(ia.events,function(db,jb){a(Ha).bind(db,jb)});break;case "button-select":Fa='<div id="'+ia.id+'" class="dropdown toolset" title="'+ia.title+'"><div id="cur_'+
ia.id+'" class="icon_label"></div><button></button></div>';yb=a('<ul id="'+ia.id+'_opts"></ul>').appendTo("#option_lists");ia.colnum&&yb.addClass("optcols"+ia.colnum);a(Fa).appendTo(bb).children();ya.push({elem:"#"+ia.id,list:"#"+ia.id+"_opts",title:ia.title,callback:ia.events.change,cur:"#cur_"+ia.id});break;case "input":Fa="<label"+yb+'><span id="'+ia.id+'_label">'+ia.label+':</span><input id="'+ia.id+'" title="'+ia.title+'" size="'+(ia.size||"4")+'" value="'+(ia.defval||"")+'" type="text"/></label>';
var ib=a(Fa).appendTo(bb).find("input");ia.spindata&&ib.SpinButton(ia.spindata);ia.events&&a.each(ia.events,function(db,jb){ib.bind(db,jb)})}});if(A.buttons){var Da={},Ca={},Ba=A.svgicons,vb={};a.each(A.buttons,function(Ta,ia){for(var yb,bb=ia.id,Fa=Ta;a("#"+bb).length;)bb=ia.id+"_"+ ++Fa;if(Ba){Da[bb]=ia.icon;Fa=ia.svgicon?ia.svgicon:ia.id;if(ia.type=="app_menu")Ca["#"+bb+" > div"]=Fa;else Ca["#"+bb]=Fa}else yb=ia.type=="menu"?"":a('<img src="'+ia.icon+'">');var Va,Ha;switch(ia.type){case "mode_flyout":case "mode":Va=
"tool_button";if(ia.cls)Va+=" "+ia.cls;Ha="#tools_left";break;case "context":Va="tool_button";Ha="#"+ia.panel;a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top");break;case "menu":Va="menu_item tool_button";Ha="#"+(ia.after||ia.panel);break;case "app_menu":Va="";Ha=ia.parent||"#main_menu ul";a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top")}var ib=a(ia.list||ia.type=="app_menu"?"<li/>":"<div/>").attr("id",bb).attr("title",ia.title).addClass(Va);if(!ia.includeWith&&!ia.list){if("position"in
ia)a(Ha).children().eq(ia.position).before(ib);else ia.type!="menu"||!ia.after?ib.appendTo(Ha):a(Ha).after(ib);if(ia.type=="mode_flyout"){Fa=a(ib);Va=Fa.parent();if(!Fa.parent().hasClass("tools_flyout")){var db=Fa[0].id.replace("tool_","tools_"),jb=Fa.clone().attr("id",db+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Fa.before(jb);Va=Ga(db,Fa);Va.data("isLibrary",true);jb.data("isLibrary",true)}Ca["#"+db+"_show"]=ia.id;bb=vb["#"+Va[0].id]=[{sel:"#"+bb,fn:ia.events.click,icon:ia.id,isDefault:true},
Yb]}else if(ia.type=="app_menu"||ia.type=="menu")ib.append(ia.title)}else if(ia.list){ib.addClass("push_button");a("#"+ia.list+"_opts").append(ib);if(ia.isDefault){a("#cur_"+ia.list).append(ib.children().clone());Fa=ia.svgicon?ia.svgicon:ia.id;Ca["#cur_"+ia.list]=Fa}}else if(ia.includeWith){Ha=ia.includeWith;Fa=a(Ha.button);Va=Fa.parent();if(!Fa.parent().hasClass("tools_flyout")){db=Fa[0].id.replace("tool_","tools_");jb=Fa.clone().attr("id",db+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));
Fa.before(jb);Va=Ga(db,Fa)}var Yb=nc.getButtonData(Ha.button);if(Ha.isDefault)Ca["#"+db+"_show"]=ia.id;bb=vb["#"+Va[0].id]=[{sel:"#"+bb,fn:ia.events.click,icon:ia.id,key:ia.key,isDefault:ia.includeWith?ia.includeWith.isDefault:0},Yb];db="position"in Ha?Ha.position:"last";Yb=Va.children().length;if(!isNaN(db)&&db>=0&&db<Yb)Va.children().eq(db).before(ib);else{Va.append(ib);bb.reverse()}}Ba||ib.append(yb);ia.list||a.each(ia.events,function(Lb,Wb){if(Lb=="click")if(ia.type=="mode"){ia.includeWith?ib.bind(Lb,
Wb):ib.bind(Lb,function(){xa(ib)&&Wb()});if(ia.key){a(document).bind("keydown",ia.key,Wb);ia.title&&ib.attr("title",ia.title+" ["+ia.key+"]")}}else ib.bind(Lb,Wb);else ib.bind(Lb,Wb)});Qa(vb)});a.each(ya,function(){sb(this.elem,this.list,this.callback,{seticon:true})});if(Ba)ja=false;a.svgIcons(Ba,{w:27,h:27,id_match:false,no_img:!O,fallback:Da,placement:Ca,callback:function(){b.iconsize&&b.iconsize!="m"&&I();ja=true;va()}})}va()});f.textActions.setInputElem(a("#text")[0]);var Za='<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,A){Za+='<div class="palette_item" style="background-color: '+A+';" data-rgb="'+A+'"></div>'});a("#palette").append(Za);
Za="";a.each(["#FFF","#888","#000"],function(){Za+='<div class="color_block" style="background-color:'+this+';"></div>'});a("#bg_blocks").append(Za);var Ma=a("#bg_blocks div");Ma.each(function(){a(this).click(function(){Ma.removeClass("cur_background");a(this).addClass("cur_background")})});if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),a.pref("bkgd_url"));else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));if(a.pref("img_save")){b.img_save=a.pref("img_save");a("#image_save_opts input").val([b.img_save])}var mb=
function(q){var A=q.value/100;if(A<0.0010)q.value=0.1;else{q=f.getZoom();Oa(window,{width:0,height:0,x:(ra[0].scrollLeft+ra.width()/2)/q,y:(ra[0].scrollTop+ra.height()/2)/q,zoom:A},true)}},zb=function(q,A){if(A==null)A=q.value;a("#group_opacity").val(A);if(!q||!q.handle)a("#opac_slider").slider("option","value",A);f.setOpacity(A/100)},eb=function(q,A,I){if(A==null)A=q.value;a("#blur").val(A);var Q=false;if(!q||!q.handle){a("#blur_slider").slider("option","value",A);Q=true}I?f.setBlurNoUndo(A):f.setBlur(A,
Q)},gb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){f.setStrokeAttr("stroke-dasharray",a(this).val());gb()});a("#stroke_linejoin").change(function(){f.setStrokeAttr("stroke-linejoin",a(this).val());gb()});a("select").change(function(){a(this).blur()});var Nb=false;a("#selLayerNames").change(function(){var q=this.options[this.selectedIndex].value,A=e.notification.QmoveElemsToLayer.replace("%s",q),I=function(Q){if(Q){Nb=true;f.moveSelectedToLayer(q);
f.clearSelection();Bb()}};if(q)Nb?I(true):a.confirm(A,I)});a("#font_family").change(function(){f.setFontFamily(this.value)});a("#seg_type").change(function(){f.setSegType(a(this).val())});a("#text").keyup(function(){f.setTextContent(this.value)});a("#image_url").change(function(){Ea(this.value)});a("#link_url").change(function(){this.value.length?f.setLinkURL(this.value):f.removeHyperlink()});a("#g_title").change(function(){f.setGroupTitle(this.value)});a(".attr_changer").change(function(){var q=
this.getAttribute("data-attr"),A=this.value;if(svgedit.units.isValidUnit(q,A,Z))this.blur();else{a.alert(e.notification.invalidAttrValGiven);this.value=Z.getAttribute(q);return false}if(q!=="id")if(isNaN(A))A=f.convertToNum(q,A);else if(d.baseUnit!=="px"){var I=svgedit.units.getTypeMap();if(Z[q]||f.getMode()==="pathedit"||q==="x"||q==="y")A*=I[d.baseUnit]}if(q==="id"){q=Z;f.clearSelection();q.id=A;f.addToSelection([q],true)}else f.changeSelectedAttribute(q,A);this.blur()});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"),A=q?"stroke":"fill",I=a(this).attr("data-rgb"),Q=null;if(I==="transparent"||I==="initial"||I==="#none"){I="none";Q=new a.jGraduate.Paint}else Q=new a.jGraduate.Paint({alpha:100,solidColor:I.substr(1)});la[A].setPaint(Q);if(q){f.setColor("stroke",I);I!="none"&&f.getStrokeOpacity()!=1&&f.setPaintOpacity("stroke",1)}else{f.setColor("fill",I);I!="none"&&
f.getFillOpacity()!=1&&f.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");tb()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");tb()});var xa=function(q,A){if(a(q).hasClass("disabled"))return false;if(a(q).parent().hasClass("tools_flyout"))return true;var I=I||"normal";A||a(".tools_flyout").fadeOut(I);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,A=null,I=ra[0],Q=false,X=false;a("#svgcanvas").bind("mousemove mouseup",function(ja){if(Q!==false){I.scrollLeft-=ja.clientX-q;I.scrollTop-=ja.clientY-A;q=ja.clientX;A=ja.clientY;if(ja.type==="mouseup")Q=false;return false}}).mousedown(function(ja){if(ja.button===1||X===true){Q=true;q=ja.clientX;A=ja.clientY;return false}});
a(window).mouseup(function(){Q=false});a(document).bind("keydown","space",function(ja){f.spaceKey=X=true;ja.preventDefault()}).bind("keyup","space",function(ja){ja.preventDefault();f.spaceKey=X=false}).bind("keydown","alt",function(){f.getMode()==="zoom"&&ra.addClass("out")}).bind("keyup","alt",function(){f.getMode()==="zoom"&&ra.removeClass("out")})})();var wb=a(".menu"),qb=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").live("click",function(q){qb(q)});a("svg, body").on("mousedown",function(q){top!=self&&!q.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(!a(q.target).hasClass("menu_title"))if(!a(q.target).hasClass("disabled")&&a(q.target).hasClass("menu_item"))qb(q);
else{a("#tools_shapelib").is(":visible")&&!a(q.target).parents("#tools_shapelib_show, #tools_shapelib").length&&a("#tools_shapelib").hide();q.target.nodeName.toLowerCase()!="input"&&a("input").blur()}});var Ab=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(q,A,I,Q){if(q.altKey){q.preventDefault();q=f.getZoom()*100;A=Ab.length;for(ub=0;ub<A;ub++){I=Math.min(A,ub+1);if(Q>0)zoom=Ab[ub]<=q?Ab[I]:zoom;if(Q<0)zoom=Ab[ub]<q?Ab[ub]:zoom}zoom&&mb({value:zoom})}});
a(".menu_title").on("click",function(){a("#menu_bar").toggleClass("active")});a(".menu_title").on("mouseover",function(){wb.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(q,A,I){if(a(q).length!=0){var Q=a(q).find("button"),X=a(q).find("ul").attr("id",a(q)[0].id+"-list");I||a("#option_lists").append(X);var ja=false;I&&a(q).addClass("dropup");X.find("li").bind("mouseup",A);a(window).mouseup(function(){if(!ja){Q.removeClass("down");X.hide()}ja=false});Q.bind("mousedown",
function(){if(Q.hasClass("down")){Q.removeClass("down");X.hide()}else{Q.addClass("down");if(!I){var va=a(q).offset();X.css({top:va.top,left:va.left-110})}X.show();ja=true}}).hover(function(){ja=true}).mouseout(function(){ja=false})}};var sb=function(q,A,I,Q){var X=a(q);A=a(A);var ja=false,va=Q.dropUp;va&&a(q).addClass("dropup");A.find("li").bind("mouseup",function(){if(Q.seticon){ta("#cur_"+X[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}I.apply(this,arguments)});
a(window).mouseup(function(){if(!ja){X.removeClass("down");A.hide();A.css({top:0,left:0})}ja=false});A.height();a(q).bind("mousedown",function(){var ya=a(q).offset();if(va){ya.top-=A.height();ya.left+=8}else ya.top+=a(q).height();a(A).offset(ya);if(X.hasClass("down")){X.removeClass("down");A.hide();A.css({top:0,left:0})}else{X.addClass("down");A.show();ja=true;return false}}).hover(function(){ja=true}).mouseout(function(){ja=false});Q.multiclick&&A.mousedown(function(){ja=true})};c.addDropDown("#font_family_dropdown",
function(){a(this).text();a("#font_family").val(a(this).text()).change()});c.addDropDown("#opacity_dropdown",function(){if(!a(this).find("div").length){var q=parseInt(a(this).text().split("%")[0]);zb(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,A){zb(A)}});c.addDropDown("#blur_dropdown",a.noop);var kb=false;a("#blur_slider").slider({max:10,step:0.1,
stop:function(q,A){kb=false;eb(A);a("#blur_dropdown li").show();a(window).mouseup()},start:function(){kb=true},slide:function(q,A){eb(A,null,kb)}});c.addDropDown("#zoom_dropdown",function(){var q=a(this),A=q.attr("data-val");A?Oa(window,A):mb({value:parseInt(q.text())})},true);sb("#stroke_linecap","#linecap_opts",function(){w(this,true)},{dropUp:true});sb("#stroke_linejoin","#linejoin_opts",function(){w(this,true)},{dropUp:true});a("div","#position_opts").each(function(){this.addEventListener("mouseup",
function(){var q=this.id.replace("tool_pos","").charAt(0);f.alignSelectedElements(q,"page")})});(function(){var q,A=function(){a(q).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){q=this;U="toolbars";ra.mousedown(A)}).blur(function(){U="canvas";ra.unbind("mousedown",A);f.getMode()=="textedit"&&a("#text").focus()})})();var Gb=function(){if(xa("#tool_select")){f.setMode("select");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}")}},
Hb=function(){xa("#tool_fhpath")&&f.setMode("fhpath")},Ob=function(){xa("#tool_line")&&f.setMode("line")},Pb=function(){xa("#tool_rect")&&f.setMode("rect")},ma=function(){xa("#tool_ellipse")&&f.setMode("ellipse")},Y=function(){xa("#tool_image")&&f.setMode("image")},na=function(){xa("#tool_zoom")&&f.setMode("zoom")},K=function(){if(xa("#tool_zoom")){s();oa()}},N=function(){xa("#tool_text")&&f.setMode("text")},aa=function(){xa("#tool_path")&&f.setMode("path")},Pa=function(){if(Z!=null||Aa)f.deleteSelectedElements()},
Xa=function(){if(Z!=null||Aa)f.cutSelectedElements()},fb=function(){if(Z!=null||Aa)f.copySelectedElements()},nb=function(){var q=f.getZoom(),A=(ra[0].scrollLeft+ra.width()/2)/q-f.contentW;q=(ra[0].scrollTop+ra.height()/2)/q-f.contentH;f.pasteElements("point",A,q)},Db=function(){Z!=null&&f.moveToTopSelectedElement()},cb=function(){Z!=null&&f.moveToBottomSelectedElement()},Fb=function(){Z!=null&&f.moveUpDownSelected("Up")},$a=function(){Z!=null&&f.moveUpDownSelected("Down")},Kb=function(){if(Z!=null){f.convertToPath();
elems=f.getSelectedElems();f.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");f.setMode("pathedit");ua.toEditMode(elems[0]);f.clearSelection()}},Qb=function(){Z!=null&&ua.reorient()},Zb=function(){if(Z!=null||Aa)a.prompt(e.notification.enterNewLinkURL,"http://",function(q){q&&f.makeHyperlink(q)})},Ib=function(q,A){if(Z!=null||Aa){if(d.gridSnapping){var I=f.getZoom()*d.snappingStep;q*=I;A*=I}f.moveSelectedElements(q,A)}},pb=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);ua.linkControlPoints(q)},Ua=function(){ua.getNodePoint()&&ua.clonePathNode()},hc=function(){ua.getNodePoint()&&ua.deletePathNode()},ec=function(){var q=a("#tool_add_subpath"),A=!q.hasClass("push_button_pressed");A?q.addClass("push_button_pressed").removeClass("tool_button"):
q.removeClass("push_button_pressed").addClass("tool_button");ua.addSubPath(A)},cc=function(){ua.opencloseSubPath()},ac=function(){f.cycleElement(1)},fc=function(){f.cycleElement(0)},Rb=function(q,A){if(!(Z==null||Aa)){q||(A*=-1);var I=a("#angle").val()*1+A;f.setRotationAngle(I);Ja()}},$b=function(){var q=d.dimensions;a.confirm(e.notification.QwantToClear,function(A){if(A){oa();f.clear();f.setResolution(q[0],q[1]);Ub(true);s();Bb();Ja();la.fill.prep();la.stroke.prep();f.runExtensions("onNewDocument")}})},
lc=function(){f.setBold(!f.getBold());Ja();return false},Vb=function(){f.setItalic(!f.getItalic());Ja();return false},xb=function(){if(!l.pngsave){var q=e.notification.loadingImage;ba=window.open("data:text/html;charset=utf-8,<title>"+q+"</title><h1>"+q+"</h1>")}window.canvg?f.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){f.rasterExport()})})},jc=function(){f.open()},ic=function(){},Tb=function(q){var A=q.prev();A.css("background","#09f");setTimeout(function(){A.css("background",
"")},200)},rb=function(){if(ha.getUndoStackSize()>0){window.event.type==="keydown"&&Tb(a("#edit_menu"));ha.undo();Bb()}},Xb=function(){if(ha.getRedoStackSize()>0){window.event.type==="keydown"&&Tb(a("#edit_menu"));ha.redo();Bb()}},g=function(){if(Aa)f.groupSelectedElements();else Z&&f.ungroupSelectedElement()},h=function(){window.event.type==="keydown"&&Tb(a("#edit_menu"));f.cloneSelectedElements(20,20)},k=function(){var q=this.id.replace("tool_align","").charAt(0);f.alignSelectedElements(q,a("#align_relative_to").val())},
v=function(){var q=document.querySelector("#tool_stroke rect"),A=document.querySelector("#tool_fill rect"),I=A.getAttribute("fill"),Q=q.getAttribute("fill");q=parseFloat(q.getAttribute("stroke-opacity"));if(isNaN(q))q=100;A=parseFloat(A.getAttribute("fill-opacity"));if(isNaN(A))A=100;Q=ab(Q,q,"stroke");I=ab(I,A,"fill");la.fill.setPaint(Q,true);la.stroke.setPaint(I,true)},s=function(q){var A=f.getResolution();q=q?A.zoom*q:1;a("#zoom").val(q*100);f.setZoom(q);B();Ub(true)},E=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?
a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");ra.toggleClass("wireframe");if(!rc){var q=a("#wireframe_rules");q.length?q.empty():a('<style id="wireframe_rules"></style>').appendTo("head");B()}},z=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},t=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);d.showRulers=
false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);d.showRulers=true}a("#rulers").toggle(!!d.showRulers)},B=function(){if(!rc){var q="#workarea.wireframe #svgcontent * { stroke-width: "+1/f.getZoom()+"px; }";a("#wireframe_rules").text(ra.hasClass("wireframe")?q:"")}},F=function(q,A){if(!Ka){Ka=true;a("#save_output_btns").toggle(!!A);a("#tool_source_back").toggle(!A);var I=sa=f.getSvgString();a("#svg_source_textarea").val(I);a("#svg_source_editor").fadeIn();
H();a("#svg_source_textarea").focus()}},C=function(){if(!Ra){Ra=true;a("#image_save_opts input").val([b.img_save]);var q=f.getResolution();if(d.baseUnit!=="px"){q.w=svgedit.units.convertUnit(q.w)+d.baseUnit;q.h=svgedit.units.convertUnit(q.h)+d.baseUnit}a(".canvas_width").val(q.w);a(".canvas_height").val(q.h);a("#canvas_title").val(f.getDocumentTitle());a("#svg_docprops").show()}},D=function(){if(!Na){Na=true;var q=a("#bg_blocks div"),A=a.pref("bkgd_color"),I=a.pref("bkgd_url");q.each(function(){var Q=
a(this),X=Q.css("background-color")==A;Q.toggleClass("cur_background",X);X&&a("#canvas_bg_url").removeClass("cur_background")});A||q.eq(0).addClass("cur_background");I&&a("#canvas_bg_url").val(I);a("grid_snapping_step").attr("value",d.snappingStep);d.gridSnapping==true?a("#grid_snapping_on").attr("checked","checked"):a("#grid_snapping_on").removeAttr("checked");a("#svg_prefs").show()}},H=function(){var q=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",q)},G=function(){if(Ka){var q=
function(){f.clearSelection();za();s();Bb();P();la.fill.prep();la.stroke.prep()};f.setSvgString(a("#svg_source_textarea").val())?q():a.confirm(e.notification.QerrorsRevertToSource,function(A){if(!A)return false;q()});oa()}},P=function(q){q=q||f.getDocumentTitle();q=Wa+(q?": "+q:"");a("title:first").text(q)},R=function(){var q=a("#canvas_width"),A=q.val(),I=a("#canvas_height"),Q=I.val();if(A!="fit"&&!svgedit.units.isValidUnit("width",A)){a.alert(e.notification.invalidAttrValGiven);q.parent().addClass("error");
return false}q.parent().removeClass("error");if(Q!="fit"&&!svgedit.units.isValidUnit("height",Q)){a.alert(e.notification.invalidAttrValGiven);I.parent().addClass("error");return false}I.parent().removeClass("error");if(!f.setResolution(A,Q)){a.alert(e.notification.noContentToFitTo);return false}b.img_save=a("#image_save_opts :checked").val();a.pref("img_save",b.img_save);Ub();hb()},W=function(){var q=a("#bg_blocks div.cur_background").css("background-color")||"#FFF";p(q,a("#canvas_bg_url").val());
q=a("#lang_select").val();q!=b.lang&&c.putLocale(q);ka(a("#iconsize").val());d.gridSnapping=a("#grid_snapping_on")[0].checked;d.snappingStep=a("#grid_snapping_step").val();d.showRulers=a("#show_rulers")[0].checked;a("#rulers").toggle(d.showRulers);d.showRulers&&da();d.baseUnit=a("#base_unit").val();f.setConfig(d);Ub();Eb()},ta=c.setIcon=function(q,A){var I=typeof A==="string"?a.getSvgIcon(A,true):A.clone();I?a(q).find("img").replaceWith(I):console.log("NOTE: Icon image missing: "+A)},wa;wa=function(){var q=
/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,A=document.getElementsByTagName("script")[0],I;for(I in A.style)if(q.test(I))return I.match(q)[0];if("WebkitOpacity"in A.style)return"Webkit";if("KhtmlOpacity"in A.style)return"Khtml";return""}();var ga=function(q,A){wa.toLowerCase();var I=["top","left","bottom","right"];q.each(function(){for(var Q=a(this),X=Q.outerWidth()*(A-1),ja=Q.outerHeight()*(A-1),va=0;va<4;va++){var ya=I[va],Da=Q.data("orig_margin-"+ya);if(Da==null){Da=parseInt(Q.css("margin-"+ya));
Q.data("orig_margin-"+ya,Da)}Da=Da*A;if(ya==="right")Da+=X;else if(ya==="bottom")Da+=ja;Q.css("margin-"+ya,Da)}})},ka=c.setIconSize=function(q,A){if(!(q==b.size&&!A)){var I=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"),Q=1;Q=typeof q=="number"?q:{s:0.75,m:1,l:1.25,xl:1.5}[q];c.tool_scale=S=Q;Cb();var X=I.parents(":hidden");X.css("visibility",
"hidden").show();ga(I,Q);X.css("visibility","visible").hide();a.pref("iconsize",q);a("#iconsize").val(q);X={"#tools_top":{left:50,height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}};I=a("#tool_size_rules");if(I.length)I.empty();else I=a('<style id="tool_size_rules"></style>').appendTo("head");if(q!="m"){var ja="";a.each(X,function(va,ya){va="#svg_editor "+va.replace(/,/g,", #svg_editor");ja+=va+"{";a.each(ya,function(Da,Ca){if(typeof Ca==="number")var Ba=Ca*Q+"px";else if(Ca[q]||
Ca.all)Ba=Ca[q]||Ca.all;ja+=Da+":"+Ba+";"});ja+="}"});X="-"+wa.toLowerCase()+"-";ja+="#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{"+X+"transform: scale("+Q+");} #svg_editor div.toolset .toolset {"+X+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+X+"transform: scale("+1/Q+");}";I.text(ja)}Cb()}},pa=function(){a("#dialog_box").hide();
if(!Ka&&!Ra&&!Na)Sa&&f.leaveContext();else{if(Ka)sa!==a("#svg_source_textarea").val()?a.confirm(e.notification.QignoreSourceChanges,function(q){q&&za()}):za();else if(Ra)hb();else Na&&Eb();tb()}},za=function(){a("#svg_source_editor").hide();Ka=false;a("#svg_source_textarea").blur()},hb=function(){a("#svg_docprops").hide();a("#canvas_width,#canvas_height").removeAttr("disabled");a("#resolution")[0].selectedIndex=0;a("#image_save_opts input").val([b.img_save]);Ra=false},Eb=function(){a("#svg_prefs").hide();
Na=false},Sb={width:a(window).width(),height:a(window).height()},tb=a.noop,Jb;svgedit.browser.isIE()&&function(){tb=function(){if(ra[0].scrollLeft===0&&ra[0].scrollTop===0){ra[0].scrollLeft=Jb.left;ra[0].scrollTop=Jb.top}};Jb={left:ra[0].scrollLeft,top:ra[0].scrollTop};a(window).resize(tb);svgEditor.ready(function(){setTimeout(function(){tb()},500)});ra.scroll(function(){Jb={left:ra[0].scrollLeft,top:ra[0].scrollTop}})}();a(window).resize(function(){Ka&&H();a.each(Sb,function(q,A){var I=a(window)[q]();
ra[0]["scroll"+(q==="width"?"Left":"Top")]-=(I-A)/2;Sb[q]=I})});(function(){ra.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=ra[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=ra[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(L);(function(){var q=["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],A="";a.each(q,function(I,Q){A+="#tool_"+
Q+(I==q.length-1?",":"")});a(A).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(V&&!window.opera){V=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"];for(var ub=V.length;ub--;){var dc=
document.getElementById(V[ub]);if(dc!=null){var oc=dc.title,sc=oc.indexOf("Ctrl+");dc.title=[oc.substr(0,sc),"Cmd+",oc.substr(sc+5)].join("")}}}var pc=function(q){var A=q[0].id=="stroke_color"?"stroke":"fill",I=q[0].id=="canvas_color";if(I)A="canvas";var Q=la[A].paint;q=A=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";I=I?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(I).jGraduate({paint:Q,
window:{pickerTitle:q},images:{clientPath:d.jGraduatePath},newstop:"inverse"},function(X){Q=new a.jGraduate.Paint(X);la[A].setPaint(Q);f.setPaint(A,Q);a("#color_picker").hide()},function(){a("#color_picker").hide()})};V=function(q,A){var I=document.getElementById("canvas_background"),Q={color:"#fff",opacity:1};if(A=="stroke")Q=d.initStroke;if(A=="fill")Q=d.initFill;if(A=="canvas"&&I){Q=I.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);Q={color:("0"+parseInt(Q[1],10).toString(16)).slice(-2)+
("0"+parseInt(Q[2],10).toString(16)).slice(-2)+("0"+parseInt(Q[3],10).toString(16)).slice(-2),opacity:1}}I=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+Q.color+'" opacity="'+Q.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;I=a(q)[0].appendChild(document.importNode(I,true));I.setAttribute("width",24.5);this.rect=I.firstChild;this.defs=I.getElementsByTagName("defs")[0];
this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:Q.color});this.type=A;this.setPaint=function(X,ja){this.paint=X;var va="none",ya=X.type,Da=X.alpha/100;switch(ya){case "solidColor":va=X[ya]=="none"||X[ya]=="one"?"none":"#"+X[ya];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(X[ya]);va="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",va);this.rect.setAttribute("opacity",Da);if(ja){f.setColor(this.type,
va,true);f.setPaintOpacity(this.type,Da,true)}if(this.type=="canvas"){(ya=document.getElementById("canvas_background"))?ya.setAttribute("fill",va):La(va);console.log(ya.getAttribute("fill"))}};this.update=function(X){if(Z){var ja=this.type;switch(Z.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var va=null,ya=Z.getElementsByTagName("*"),Da=0,Ca=ya.length;Da<Ca;Da++){var Ba=ya[Da].getAttribute(ja);if(Da===0)va=Ba;else if(va!==Ba){va=null;break}}if(va===null){ya=
null;return}ya=va;va=1;break;default:va=parseFloat(Z.getAttribute(ja+"-opacity"));if(isNaN(va))va=1;ya=ja==="fill"?"black":"none";ya=Z.getAttribute(ja)||ya}if(X){f.setColor(ja,ya,true);f.setPaintOpacity(ja,va,true)}va*=100;this.setPaint(ab(ya,va,ja))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var X=new a.jGraduate.Paint({copy:this.paint});f.setPaint(A,X)}}};la.fill=new V("#fill_color","fill");la.stroke=new V("#stroke_color","stroke");la.canvas=new V("#canvas_color",
"canvas");a("#stroke_width").val(d.initStroke.width);a("#group_opacity").val(d.initOpacity*100);V=la.fill.rect.cloneNode(false);V.setAttribute("style","vector-effect:non-scaling-stroke");var rc=V.style.vectorEffect==="non-scaling-stroke";V.removeAttribute("style");V=la.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof V.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(V).remove();setTimeout(function(){f.embedImage("images/placeholder.svg",function(q){if(!q){a("#image_save_opts [value=embed]").attr("disabled",
"disabled");a("#image_save_opts input").val(["ref"]);b.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",e.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))pc(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_canvas").click(function(){pc(a("#canvas_color"))});a("#tool_stroke").click(function(){if(a("#tool_stroke").hasClass("active"))pc(a("#stroke_color"));else{a("#tool_stroke").addClass("active");
a("#tool_fill").removeClass("active")}});a("#group_opacityLabel").click(function(){a("#opacity_dropdown button").mousedown();a(window).mouseup()});a("#zoomLabel").click(function(){a("#zoom_dropdown button").mousedown();a(window).mouseup()});a("#tool_move_top").mousedown(function(q){a("#tools_stacking").show();q.preventDefault()});a(".layer_button").mousedown(function(){a(this).addClass("layer_buttonpressed")}).mouseout(function(){a(this).removeClass("layer_buttonpressed")}).mouseup(function(){a(this).removeClass("layer_buttonpressed")});
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("#layer_new").click(function(){var q=f.getCurrentDrawing().getNumLayers();do var A=e.layers.layer+" "+ ++q;while(f.getCurrentDrawing().hasLayer(A));a.prompt(e.notification.enterUniqueLayerName,
A,function(I){if(I)if(f.getCurrentDrawing().hasLayer(I))a.alert(e.notification.dupeLayerName);else{f.createLayer(I);Ja();Bb()}})});a("#layer_delete").click(T);a("#layer_up").click(function(){J(-1)});a("#layer_down").click(function(){J(1)});a("#layer_rename").click(function(){a("#layerlist tr.layersel").prevAll();var q=a("#layerlist tr.layersel td.layername").text();a.prompt(e.notification.enterNewLayerName,"",function(A){if(A)if(q==A||f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.layerHasThatName);
else{f.renameCurrentLayer(A);Bb()}})});var bc=-1,kc=false,qc=false,tc=function(q){if(qc)if(bc!=-1){kc=true;q=bc-q.pageX;var A=a("#sidepanels"),I=parseInt(A.css("width"));if(I+q>300)q=300-I;else if(I+q<2)q=2-I;if(q!=0){bc-=q;I=a("#layerpanel");ra.css("right",parseInt(ra.css("right"))+q);A.css("width",parseInt(A.css("width"))+q);I.css("width",parseInt(I.css("width"))+q);A=a("#ruler_x");A.css("right",parseInt(A.css("right"))+q)}}};a("#sidepanel_handle").mousedown(function(q){bc=q.pageX;a(window).mousemove(tc);
qc=false;setTimeout(function(){qc=true},20)}).mouseup(function(){kc||uc();bc=-1;kc=false});a(window).mouseup(function(){bc=-1;kc=false;a("#svg_editor").unbind("mousemove",tc)});var uc=function(q){var A=parseInt(a("#sidepanels").css("width"));q=(A>2||q?2:150)-A;A=a("#sidepanels");var I=a("#layerpanel"),Q=a("#ruler_x");ra.css("right",parseInt(ra.css("right"))+q);A.css("width",parseInt(A.css("width"))+q);I.css("width",parseInt(I.css("width"))+q);Q.css("right",parseInt(Q.css("right"))+q)},vc=function(q){for(var A=
Array(f.getCurrentDrawing().getNumLayers()),I=0;I<A.length;++I)A[I]=f.getCurrentDrawing().getLayerName(I);if(q)for(I=0;I<A.length;++I)A[I]!=q&&f.getCurrentDrawing().setLayerOpacity(A[I],0.5);else for(I=0;I<A.length;++I)f.getCurrentDrawing().setLayerOpacity(A[I],1)},Bb=function(){var q=a("#layerlist tbody"),A=a("#selLayerNames");q.empty();A.empty();for(var I=f.getCurrentDrawing().getCurrentLayerName(),Q=f.getCurrentDrawing().getNumLayers(),X=a.getSvgIcon("eye");Q--;){var ja=f.getCurrentDrawing().getLayerName(Q),
va='<tr class="layer';if(ja==I)va+=" layersel";va+='">';va+=f.getCurrentDrawing().getLayerVisibility(ja)?'<td class="layervis"/><td class="layername" >'+ja+"</td></tr>":'<td class="layervis layerinvis"/><td class="layername" >'+ja+"</td></tr>";q.append(va);A.append('<option value="'+ja+'">'+ja+"</option>")}if(X!==undefined){X.clone();a("td.layervis",q).append(X.clone());a.resizeSvgIcons({"td.layervis .svg_icon":14})}a("#layerlist td.layername").mouseup(function(ya){a("#layerlist tr.layer").removeClass("layersel");
a(this.parentNode).addClass("layersel");f.setCurrentLayer(this.textContent);ya.preventDefault()}).mouseover(function(){a(this).css({"font-style":"italic",color:"blue"});vc(this.textContent)}).mouseout(function(){a(this).css({"font-style":"normal",color:"black"});vc()});a("#layerlist td.layervis").click(function(){var ya=a(this.parentNode).prevAll().length;ya=a("#layerlist tr.layer:eq("+ya+") td.layername").text();var Da=a(this).hasClass("layerinvis");f.setLayerVisibility(ya,Da);Da?a(this).removeClass("layerinvis"):
a(this).addClass("layerinvis")});for(A=5-a("#layerlist tr.layer").size();A-- >0;)q.append('<tr><td style="color:white">_</td><td/></tr>')};Bb();a(window).bind("load resize",function(){ra.css("line-height",ra.height()+"px")});a("#resolution").change(function(){var q=a("#canvas_width,#canvas_height");if(this.selectedIndex)if(this.value=="content")q.val("fit").attr("disabled","disabled");else{var A=this.value.split("x");a("#canvas_width").val(A[0]);a("#canvas_height").val(A[1]);q.removeAttr("disabled")}else a("#canvas_width").val()==
"fit"&&q.removeAttr("disabled").val(100)});a("input,select").attr("autocomplete","off");var nc=function(){var q=[{sel:"#tool_select",fn:Gb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Hb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Ob,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Pb,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ma,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:aa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:N,evt:"click",key:["T",
true]},{sel:"#tool_image",fn:Y,evt:"mouseup"},{sel:"#tool_zoom",fn:na,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:$b,evt:"mouseup",key:[fa+"N",true]},{sel:"#tool_save",fn:function(){Ka?G():f.save({images:b.img_save,round_digits:6})},evt:"mouseup",key:[fa+"S",true]},{sel:"#tool_export",fn:xb,evt:"mouseup"},{sel:"#tool_open",fn:jc,evt:"mouseup"},{sel:"#tool_import",fn:ic,evt:"mouseup"},{sel:"#tool_source",fn:F,evt:"click",key:[fa+"U",true]},{sel:"#tool_wireframe",fn:E,evt:"click"},{sel:"#tool_rulers",
fn:t,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:pa,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:G,evt:"click"},{sel:"#tool_docprops_save",fn:R,evt:"click"},{sel:"#tool_docprops",fn:C,evt:"mouseup"},{sel:"#tool_prefs_save",fn:W,evt:"click"},{sel:"#tool_prefs_option",fn:function(){D();return false},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Pa,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",
fn:Qb,evt:"click"},{sel:"#tool_node_link",fn:pb,evt:"click"},{sel:"#tool_node_clone",fn:Ua,evt:"click"},{sel:"#tool_node_delete",fn:hc,evt:"click"},{sel:"#tool_openclose_path",fn:cc,evt:"click"},{sel:"#tool_add_subpath",fn:ec,evt:"click"},{sel:"#tool_move_top",fn:Db,evt:"click",key:fa+"shift+up"},{sel:"#tool_move_bottom",fn:cb,evt:"click",key:fa+"shift+down"},{sel:"#tool_move_up",fn:Fb,evt:"click",key:[fa+"up",true]},{sel:"#tool_move_down",fn:$a,evt:"click",key:[fa+"down",true]},{sel:"#tool_topath",
fn:Kb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:Zb,evt:"click"},{sel:"#tool_undo",fn:rb,evt:"click"},{sel:"#tool_redo",fn:Xb,evt:"click",key:["Y",true]},{sel:"#tool_clone,#tool_clone_multi",fn:h,evt:"click",key:[fa+"D",true]},{sel:"#tool_group",fn:g,evt:"click",key:[fa+"G",true]},{sel:"#tool_ungroup",fn:g,evt:"click",key:fa+"shift+G"},{sel:"#tool_unlink_use",fn:g,evt:"click"},{sel:"[id^=tool_align]",fn:k,evt:"click"},{sel:"#tool_switch",fn:v,evt:"click",key:["X",true]},{sel:"#tool_bold",
fn:lc,evt:"mousedown",key:[fa+"B",true]},{sel:"#tool_italic",fn:Vb,evt:"mousedown",key:[fa+"I",true]},{sel:"#copy_save_done",fn:pa,evt:"click"},{key:"ctrl+left",fn:function(){Rb(0,1)}},{key:"ctrl+right",fn:function(){Rb(1,1)}},{key:"ctrl+shift+left",fn:function(){Rb(0,5)}},{key:"ctrl+shift+right",fn:function(){Rb(1,5)}},{key:"shift+O",fn:fc},{key:"shift+P",fn:ac},{key:[fa+"+",true],fn:function(){s(2)}},{key:[fa+"-",true],fn:function(){s(0.5)}},{key:["up",true],fn:function(){Ib(0,-1)}},{key:["down",
true],fn:function(){Ib(0,1)}},{key:["left",true],fn:function(){Ib(-1,0)}},{key:["right",true],fn:function(){Ib(1,0)}},{key:"shift+up",fn:function(){Ib(0,-10)}},{key:"shift+down",fn:function(){Ib(0,10)}},{key:"shift+left",fn:function(){Ib(-10,0)}},{key:"shift+right",fn:function(){Ib(10,0)}},{key:["alt+up",true],fn:function(){f.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){f.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){f.cloneSelectedElements(-1,0)}},{key:["alt+right",
true],fn:function(){f.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){f.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){f.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){f.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){f.cloneSelectedElements(10,0)}},{key:fa+"A",fn:function(){f.selectAllInCurrentLayer()}},{key:fa+"z",fn:rb},{key:fa+"shift+z",fn:Xb},{key:fa+"y",fn:Xb},{key:"esc",fn:z},{key:fa+"x",fn:Xa},
{key:fa+"c",fn:fb},{key:fa+"v",fn:nb}],A={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var I={};a.each(q,function(Q,X){if(X.sel){var ja=a(X.sel);if(ja.length==0)return true;if(X.evt){if(svgedit.browser.isTouch()&&X.evt==="click")X.evt="mousedown";ja[X.evt](X.fn)}if(X.parent&&a(X.parent+"_show").length!=0){var va=a(X.parent);va.length||(va=Ga(X.parent.substr(1)));va.append(ja);a.isArray(I[X.parent])||(I[X.parent]=[]);I[X.parent].push(X)}}if(X.key){var ya=
X.fn,Da=false;if(a.isArray(X.key)){va=X.key[0];if(X.key.length>1)Da=X.key[1]}else va=X.key;va+="";svgedit.browser.isMac&&va.indexOf("+")!=-1&&va.split("+")[0]=="ctrl"&&va.replace("ctrl","cmd");a.each(va.split("/"),function(Ba,vb){a(document).bind("keydown",vb,function(Ta){ya();Da&&Ta.preventDefault();return false})});if(X.sel&&!X.hidekey&&ja.attr("title")){var Ca=ja.attr("title").split("[")[0]+" ("+va+")";A[va]=X.sel;ja.parents("#main_menu").length||ja.attr("title",Ca)}}});Qa(I);a(".attr_changer, #image_url").bind("keydown",
"return",function(Q){a(this).change();Q.preventDefault()});a(window).bind("keydown","tab",function(Q){if(U==="canvas"){Q.preventDefault();ac()}}).bind("keydown","shift+tab",function(Q){if(U==="canvas"){Q.preventDefault();fc()}});a("#tool_zoom").dblclick(K)},setTitles:function(){a.each(A,function(I,Q){var X=a(Q).parents("#main_menu").length;a(Q).each(function(){var ja=X?a(this).text().split(" [")[0]:this.title.split(" [")[0],va="";a.each(I.split("/"),function(ya,Da){var Ca=Da.split("+"),Ba="";if(Ca.length>
1){Ba=Ca[0]+"+";Da=Ca[1]}va+=(ya?"/":"")+Ba+(e["key_"+Da]||Da)});if(X)this.lastChild.textContent=ja+" ["+va+"]";else this.title=ja+" ["+va+"]"})})},getButtonData:function(I){var Q;a.each(q,function(X,ja){if(ja.sel===I)Q=ja});return Q}}}();nc.setAll();c.ready(function(){var q=d.initTool,A=a("#tools_left, #svg_editor .tools_flyout"),I=A.find("#tool_"+q);q=A.find("#"+q);(I.length?I:q.length?q:a("#tool_select")).click().mouseup();d.wireframe&&a("#tool_wireframe").click();d.showlayers&&uc();a("#rulers").toggle(!!d.showRulers);
if(d.showRulers)a("#show_rulers")[0].checked=true;if(d.gridSnapping)a("#grid_snapping_on")[0].checked=true;d.baseUnit&&a("#base_unit").val(d.baseUnit);d.snappingStep&&a("#grid_snapping_step").val(d.snappingStep)});a("#rect_rx").SpinButton({min:0,max:1E3,step:1,callback:function(q){f.setRectRadius(q.value)}});a("#stroke_width").SpinButton({min:0,max:99,step:1,smallStep:0.1,callback:function(q){var A=q.value;if(A==0&&Z&&["line","polyline"].indexOf(Z.nodeName)>=0)A=q.value=1;f.setStrokeWidth(A)}});a("#angle").SpinButton({min:-180,
max:180,step:5,callback:function(q){f.setRotationAngle(q.value);a("#tool_reorient").toggleClass("disabled",q.value==0)}});a("#font_size").SpinButton({step:1,min:0.0010,stepfunc:function(q,A){var I=q.value-0,Q=I+A,X=Q>=I;if(A===0)return I;return I>=24?X?Math.round(I*1.1):Math.round(I/1.1):I<=1?X?I*2:I/2:Q},callback:function(q){f.setFontSize(q.value)}});a("#group_opacity").SpinButton({step:5,min:0,max:100,callback:zb});a("#blur").SpinButton({step:0.1,min:0,max:10,callback:eb});a("#zoom").SpinButton({min:0.0010,
max:1E4,step:50,stepfunc:function(q,A){var I=q.value-0;if(I===0)return 100;var Q=I+A;if(A===0)return I;return I>=100?Q:Q>=I?I*2:I/2},callback:mb}).val(f.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(q){switch(q){case "delete":Pa();break;case "cut":Xa();break;case "copy":fb();break;case "paste":f.pasteElements();break;case "paste_in_place":f.pasteElements("in_place");break;case "group":f.groupSelectedElements();break;case "ungroup":f.ungroupSelectedElement();break;
case "move_front":Db();break;case "move_up":Z!=null&&f.moveUpDownSelected("Up");break;case "move_down":Z!=null&&f.moveUpDownSelected("Down");break;case "move_back":cb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(q)&&svgedit.contextmenu.getCustomHandler(q).call()}f.clipBoard.length&&qa.enableContextMenuItems("#paste,#paste_in_place")});V=function(q){switch(q){case "dupe":M();break;case "delete":T();break;case "merge_down":if(a("#layerlist tr.layersel").index()!=f.getCurrentDrawing().getNumLayers()-
1){f.mergeLayer();Ja();Bb()}break;case "merge_all":f.mergeAllLayers();Ja();Bb()}};a("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},V);a("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:true},V);a(".contextMenu li").mousedown(function(q){q.preventDefault()});a("#cmenu_canvas li").disableContextMenu();qa.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(ha.getUndoStackSize()===0)c.show_save_warning=false;if(!d.no_save_warning&&c.show_save_warning)return e.notification.unsavedChanges};
c.openPrep=function(q){a("#main_menu").hide();ha.getUndoStackSize()===0?q(true):a.confirm(e.notification.QwantToOpen,q)};if(window.FileReader){V=a('<input type="file">').change(function(){var q=this;c.openPrep(function(A){if(A){f.clear();if(q.files.length==1){A=new FileReader;A.onloadend=function(I){n(I.target.result);Ub()};A.readAsText(q.files[0])}}})});a("#tool_open").show().prepend(V);V=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var q=new FileReader;
q.onloadend=function(A){f.importSvgString(A.target.result,true);Ub()};q.readAsText(this.files[0])}});a("#tool_import").show().prepend(V)}var Ub=c.updateCanvas=function(q,A){var I=ra.width(),Q=ra.height(),X=I,ja=Q,va=f.getZoom(),ya=a("#svgcanvas"),Da={x:ra[0].scrollLeft+X/2,y:ra[0].scrollTop+ja/2},Ca=d.canvas_expansion;I=Math.max(X,f.contentW*va*Ca);Q=Math.max(ja,f.contentH*va*Ca);I==X&&Q==ja?ra.css("overflow","hidden"):ra.css("overflow","scroll");Ca=ya.height()/2;var Ba=ya.width()/2;ya.width(I).height(Q);
var vb=Q/2,Ta=I/2,ia=f.updateCanvas(I,Q),yb=Ta/Ba;I=I/2-X/2;Q=Q/2-ja/2;if(A){A.x+=ia.x;A.y+=ia.y}else A={x:Ta+(Da.x-Ba)*yb,y:vb+(Da.y-Ca)*yb};if(q)if(f.contentW>ra.width()){ra[0].scrollLeft=ia.x-10;ra[0].scrollTop=ia.y-10}else{ra[0].scrollLeft=I;ra[0].scrollTop=Q}else{ra[0].scrollLeft=A.x-X/2;ra[0].scrollTop=A.y-ja/2}if(d.showRulers){da(ya,va);ra.scroll()}},gc=[];for(ub=0.1;ub<1E5;ub*=10){gc.push(1*ub);gc.push(2*ub);gc.push(5*ub)}Ub(true);try{var wc=function(q){if(window.JSON&&JSON.stringify)return JSON.stringify(q);
var A=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(X){return"\\u"+("0000"+X.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(q.length){for(var I=0;I<q.length;I++)q[I]=A(q[I]);return"["+q.join(",")+"]"}else{I=[];for(var Q in q)I.push(A(Q)+":"+A(q[Q]));return"{"+I.join(",")+"}"}};window.addEventListener("message",
function(q){var A=parseInt(q.data.substr(0,q.data.indexOf(";")));try{q.source.postMessage("SVGe"+A+";"+wc(eval(q.data)),"*")}catch(I){q.source.postMessage("SVGe"+A+";error:"+I.message,"*")}},false)}catch(xc){window.embed_error=xc}a(function(){window.svgCanvas=f;f.ready=svgEditor.ready});c.setLang=function(q,A){a.pref("lang",q);a("#lang_select").val(q);if(A){var I=a("#layerlist tr.layersel td.layername").text()==e.common.layer+" 1";a.extend(e,A);f.setUiStrings(A);nc.setTitles();if(I){f.renameCurrentLayer(e.common.layer+
" 1");Bb()}f.runExtensions("langChanged",q);Mb();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(Q,X){a(X).attr("title",a(Q)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var u=[];c.ready=function(w){m?w():u.push(w)};c.runCallbacks=function(){a.each(u,
function(){this()});m=true};c.loadFromString=function(w){c.ready(function(){n(w)})};c.disableUI=function(){};c.loadFromURL=function(w,p){p||(p={});var L=p.cache,T=p.callback;c.ready(function(){a.ajax({url:w,dataType:"text",cache:!!L,success:function(M){n(M,T)},error:function(M,J,da){M.status!=404&&M.responseText?n(M.responseText,T):a.alert(e.notification.URLloadFail+": \n"+da+"",T)}})})};c.loadFromDataURI=function(w){c.ready(function(){var p=w.substring(26);n(svgedit.utilities.decode64(p))})};c.addExtension=
function(){var w=arguments;a(function(){f&&f.addExtension.apply(this,w)})};return c}(jQuery);$(svgEditor.init)})();svgedit=svgedit||{};
b={},d={canvas_expansion:1,dimensions:[640,480],initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",langPath:"locale/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:["ext-markers.js","ext-eyedropper.js","ext-shapes.js","ext-grid.js"],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:true,show_outside_canvas:false,no_save_warning:true,initFont:"Sans-serif"},
e=c.uiStrings={common:{ok:"OK",cancel:"Cancel",key_up:"Up",key_down:"Down",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...",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" ...'}};b={};var l={};c.curConfig=d;c.tool_scale=1;a.pref=function(w,p){if(p)b[w]=p;w="svg-edit-"+w;var L=location.hostname,
T=L&&L.indexOf(".")>=0,M=p!=undefined,J=false;try{if(window.localStorage)J=localStorage}catch(da){}try{if(window.globalStorage&&T)J=globalStorage[L]}catch(V){}if(J)if(M)J.setItem(w,p);else{if(J.getItem(w))return J.getItem(w)+""}else if(window.widget)if(M)widget.setPreferenceForKey(p,w);else return widget.preferenceForKey(w);else if(M){L=new Date;L.setTime(L.getTime()+31536E6);p=encodeURIComponent(p);document.cookie=w+"="+p+"; expires="+L.toUTCString()}else return(L=document.cookie.match(RegExp(w+
"=([^;]+)")))?decodeURIComponent(L[1]):""};c.setConfig=function(w){a.each(w,function(p,L){p in o&&a.pref(p,L)});a.extend(true,d,w);if(w.extensions)d.extensions=w.extensions};c.setCustomHandlers=function(w){c.ready(function(){if(w.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();f.open=w.open}if(w.save){c.show_save_warning=false;f.bind("saved",w.save)}w.pngsave&&f.bind("exported",w.pngsave);l=w})};c.randomizeIds=function(){f.randomizeIds(arguments)};c.init=function(){function w(q,
A){var I=q.id,R=I.split("_"),X=R[0];R=R[1];A&&f.setStrokeAttr("stroke-"+X,R);ib();fa("#cur_"+X,I,20);a(q).addClass("current").siblings().removeClass("current")}function p(q,A){a.pref("bkgd_color",q);a.pref("bkgd_url",A);f.setBackground(q,A)}function L(){var q=f.getHref(Z);q=q.indexOf("data:")===0?"":q;a.prompt(e.notification.enterNewImgURL,q,function(A){A&&Ea(A)})}function T(){if(f.deleteCurrentLayer()){Ja();Ab();a("#layerlist tr.layer").removeClass("layersel");a("#layerlist tr.layer:first").addClass("layersel")}}
function M(){var q=f.getCurrentDrawing().getCurrentLayerName()+" copy";a.prompt(e.notification.enterUniqueLayerName,q,function(A){if(A)if(f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.dupeLayerName);else{f.cloneLayer(A);Ja();Ab()}})}function J(q){var A=a("#layerlist tr.layersel").index(),I=f.getCurrentDrawing().getNumLayers();if(A>0||A<I-1){A+=q;f.setCurrentLayerPosition(I-A-1);Ab()}}function da(q,A){var I=document.getElementById("ruler_x_cursor"),R=document.getElementById("ruler_y_cursor"),
X=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()||a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(nc){nc.stopPropagation();I.style.left=nc.pageX-66+X.scrollLeft+"px";R.style.top=nc.pageY-48+X.scrollTop+"px"});A||(A=f.getZoom());q||(q=a("#svgcanvas"));for(var ja=f.getContentElem(),va=svgedit.units.getTypeMap()[d.baseUnit],ya=0;ya<2;ya++){var Da=ya===0,Ca=Da?"x":"y",Ba=Da?"width":"height",tb=ja.getAttribute(Ca)-0;Ca=a("#ruler_"+
Ca+" canvas:first");$hcanv=Ca.clone();Ca.replaceWith($hcanv);var Ta=$hcanv[0];var ia=Ca=q[Ba]()*2;Ta.parentNode.style[Ba]=ia+"px";var wb=0,bb,Fa=Ta.getContext("2d");Fa.fillStyle="rgb(200,0,0)";Fa.fillRect(0,0,Ta.width,Ta.height);$hcanv.siblings().remove();if(Ca>=3E4){var Va=parseInt(Ca/3E4)+1;bb=Array(Va);bb[0]=Fa;for(var Ha=1;Ha<Va;Ha++){Ta[Ba]=3E4;var kb=Ta.cloneNode(true);Ta.parentNode.appendChild(kb);bb[Ha]=kb.getContext("2d")}kb[Ba]=Ca%3E4;Ca=3E4}Ta[Ba]=Ca;Ba=va*A;var eb=50/Ba;Ta=1;for(Ha=0;Ha<
hc.length;Ha++){Ta=Va=hc[Ha];if(eb<=Va)break}eb=Ta*Ba;Fa.font="normal 9px 'Lucida Grande', sans-serif";Fa.fillStyle="#777";for(var lb=tb/Ba%Ta*Ba,Yb=lb-eb;lb<ia;lb+=eb){Yb+=eb;Ha=Math.round(lb)+0.5;if(Da){Fa.moveTo(Ha,15);Fa.lineTo(Ha,0)}else{Fa.moveTo(15,Ha);Fa.lineTo(0,Ha)}Va=(Yb-tb)/Ba;if(Ta>=1)Ha=Math.round(Va);else{Ha=(Ta+"").split(".")[1].length;Ha=Va.toFixed(Ha)-0}if(Ha!==0&&Ha!==1E3&&Ha%1E3===0)Ha=Ha/1E3+"K";if(Da){Fa.fillText(Ha,lb+2,8);Fa.fillStyle="#777"}else{Va=(Ha+"").split("");for(Ha=
0;Ha<Va.length;Ha++){Fa.fillText(Va[Ha],1,lb+9+Ha*9);Fa.fillStyle="#777"}}Va=eb/10;for(Ha=1;Ha<10;Ha++){var Jb=Math.round(lb+Va*Ha)+0.5;if(bb&&Jb>Ca){wb++;Fa.stroke();if(wb>=bb.length){Ha=10;lb=ia;continue}Fa=bb[wb];lb-=3E4;Jb=Math.round(lb+Va*Ha)+0.5}var Xb=Ha%2?12:10;if(Da){Fa.moveTo(Jb,15);Fa.lineTo(Jb,Xb)}else{Fa.moveTo(15,Jb);Fa.lineTo(Xb,Jb)}}}Fa.strokeStyle="#666";Fa.stroke()}}(function(){var q=window.opener;if(q)try{var A=q.document.createEvent("Event");A.initEvent("svgEditorReady",true,true);
q.document.documentElement.dispatchEvent(A)}catch(I){}})();(function(){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 A=q.source,I=a.param.querystring();if(!A)if(I.indexOf("source=data:")>=0)A=I.match(/source=(data:[^&]*)/)[1];if(A)if(A.indexOf("data:")===0){A=A.replace(/ /g,"+");c.loadFromDataURI(A)}else c.loadFromString(A);
else if(I.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(I.substr(9));else q.url&&svgEditor.loadFromURL(q.url)}})();var V=function(){a.each(d.extensions,function(){var A=this;a.getScript(d.extPath+A,function(I){if(!I){I=document.createElement("script");I.src=d.extPath+A;document.querySelector("head").appendChild(I)}})});var q=[];a("#lang_select option").each(function(){q.push(this.value)});c.putLocale(null,q)};document.location.protocol==="file:"?setTimeout(V,100):V();a.svgIcons(d.imgPath+"svg_edit_icons.svg",
{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:d.imgPath,fallback:{new_image:"clear.png",save:"save.png",open:"open.png",source:"source.png",docprops:"document-properties.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.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",clone:"clone.png",node_clone:"node_clone.png","delete":"delete.png",node_delete:"node_delete.png",move_top:"move_top.png",move_bottom:"move_bottom.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.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",go_up:"go-up.png",go_down:"go-down.png",ok:"save.png",cancel:"cancel.png",
arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#tool_docprops > div":"docprops","#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","#linecap_butt,#cur_linecap":"linecap_butt","#linecap_round":"linecap_round","#linecap_square":"linecap_square","#linejoin_miter,#cur_linejoin":"linejoin_miter",
"#linejoin_round":"linejoin_round","#linejoin_bevel":"linejoin_bevel","#url_notice":"warning","#layer_up":"go_up","#layer_down":"go_down","#layer_moreopts":"context_menu","#layerlist td.layervis":"eye","#tool_source_save,#tool_docprops_save,#tool_prefs_save":"ok","#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel":"cancel","#rwidthLabel, #iwidthLabel":"width","#rheightLabel, #iheightLabel":"height","#angleLabel":"angle","#linkLabel,#tool_make_link,#tool_make_link_multi":"globe_link","#zoomLabel":"zoom",
"#blurLabel":"blur",".flyout_arrow_horiz":"arrow_right","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":32,".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":24,".palette_item:first .svg_icon":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)});var q=a("#tools_left");if(q.length!=0){q.offset();q.outerHeight()}a(".tools_flyout").each(function(){var A=a("#"+this.id+"_show"),I=A.attr("data-curopt");if(!A.children("svg, img").length){I=a(I).children().clone();if(I.length){I[0].removeAttribute("style");A.append(I)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},
1)}});c.canvas=f=new a.SvgCanvas(document.getElementById("svgcanvas"),d);c.show_save_warning=false;V=navigator.platform.indexOf("Mac")>=0;var O=navigator.userAgent.indexOf("AppleWebKit")>=0,ga=V?"meta+":"ctrl+",ta=f.pathActions,ha=f.undoMgr,ca=svgedit.utilities,ea=d.imgPath+"placeholder.svg",ra=a("#workarea"),pa=a("#cmenu_canvas");a("#cmenu_layers");var ba=null,S=1,U="toolbars",sa="",la={fill:null,stroke:null};V||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"),A=a("#dialog_buttons"),I=function(R,X,ja,va){a("#dialog_content").html("<p>"+X.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",R=="prompt");A.empty();var ya=a('<input type="button" value="'+e.common.ok+'">').appendTo(A);R!="alert"&&a('<input type="button" value="'+e.common.cancel+'">').appendTo(A).click(function(){q.hide();ja(false)});if(R=="prompt"){var Da=
a('<input type="text">').prependTo(A);Da.val(va||"");Da.bind("keydown","return",function(){ya.click()})}R=="process"&&ya.hide();q.show();ya.click(function(){q.hide();var Ca=R=="prompt"?Da.val():true;ja&&ja(Ca)}).focus();R=="prompt"&&Da.focus()};a.alert=function(R,X){I("alert",R,X)};a.confirm=function(R,X){I("confirm",R,X)};a.process_cancel=function(R,X){I("process",R,X)};a.prompt=function(R,X,ja){I("prompt",R,ja,X)}})();var oa=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");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")}f.setMode("select")},Z=null,Aa=false,Ka=false,Ra=false,Na=false,Sa="",Wa=a("title:first").text(),Oa=function(q,A,I){f.getResolution();a("#svgcanvas").position();if(A=f.setBBoxZoom(A,ra.width()-15,ra.height()-15)){q=A.zoom;A=A.bbox;if(q<0.0010)ob({value:0.1});else{a("#zoom").val(q*100);I?Rb():Rb(false,{x:A.x*q+A.width*
q/2,y:A.y*q+A.height*q/2});f.getMode()=="zoom"&&A.width&&oa();B()}}};a("#cur_context_panel").delegate("a","click",function(){var q=a(this);q.attr("data-root")?f.leaveContext():f.setContext(q.text());return false});var Ia={},Qa=function(q){a.each(q,function(A,I){var R=a(A).children(),X=A+"_show",ja=a(X),va=false;R.addClass("tool_button").unbind("click mousedown mouseup").each(function(Ca){var Ba=I[Ca];Ia[Ba.sel]=Ba.fn;if(Ba.isDefault)va=Ca;Ca=function(tb){var Ta=Ba;if(tb.type==="keydown"){var ia=a(Ta.parent+
"_show").hasClass("tool_button_current"),wb=a(Ta.parent+"_show").attr("data-curopt");a.each(q[Ba.parent],function(Fa,Va){if(Va.sel==wb)Ta=!tb.shiftKey||!ia?Va:q[Ba.parent][Fa+1]||q[Ba.parent][0]})}if(a(this).hasClass("disabled"))return false;xa(X)&&Ta.fn();var bb=Ta.icon?a.getSvgIcon(Ta.icon,true):a(Ta.sel).children().eq(0).clone();bb[0].setAttribute("width",ja.width());bb[0].setAttribute("height",ja.height());ja.children(":not(.flyout_arrow_horiz)").remove();ja.append(bb).attr("data-curopt",Ta.sel)};
a(this).mouseup(Ca);Ba.key&&a(document).bind("keydown",Ba.key[0]+" shift+"+Ba.key[0],Ca)});if(va)ja.attr("data-curopt",I[va].sel);else ja.attr("data-curopt")||ja.attr("data-curopt",I[0].sel);var ya,Da=a(X).position();a(A).css({left:Da.left+34,top:Da.top+77});ja.mousedown(function(Ca){a("#tools_shapelib").is(":visible")&&xa(X,false);if(ja.hasClass("disabled"))return false;var Ba=a(A),tb=Da.left+34,Ta=Ba.width()*-1,ia=Ba.data("shown_popop")?200:0;ya=setTimeout(function(){ja.data("isLibrary")?Ba.css("left",
tb).show():Ba.css("left",Ta).show().animate({left:tb},150);Ba.data("shown_popop",true)},ia);Ca.preventDefault()}).mouseup(function(){clearTimeout(ya);var Ca=a(this).attr("data-curopt");if(ja.data("isLibrary")&&a(X.replace("_show","")).is(":visible"))xa(X,true);else xa(X)&&Ca in Ia&&Ia[Ca]()})});Kb()},Ga=function(q,A){return a("<div>",{"class":"tools_flyout",id:q}).appendTo("#svg_editor").append(A)},Cb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show"),A=q.offset();q=q.outerWidth();
a(this).css({left:(A.left+q)*S,top:A.top})})},Kb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show");if(!q.data("isLibrary")){var A=[];a(this).children().each(function(){A.push(this.title)});q[0].title=A.join(" / ")}})},nb,ab=function(q,A,I){var R=null;if(q.indexOf("url(#")===0){q=(q=f.getRefElem(q))?q.cloneNode(true):a("#"+I+"_color defs *")[0];R={alpha:A};R[q.tagName]=q}else R=q.indexOf("#")===0?{alpha:A,solidColor:q.substr(1)}:{alpha:A,solidColor:"none"};return new a.jGraduate.Paint(R)},
Ya=f.getResolution();if(d.baseUnit!=="px"){Ya.w=svgedit.units.convertUnit(Ya.w)+d.baseUnit;Ya.h=svgedit.units.convertUnit(Ya.h)+d.baseUnit}a(".canvas_width").val(Ya.w);a(".canvas_height").val(Ya.h);a("#docprops_button").on("click",function(){H()});var La=function(q){f.createLayer("background");cur_shape=f.addSvgElementFromJson({element:"rect",attr:{x:0,y:0,width:Ya.w,height:Ya.h,stroke:"none",id:"canvas_background",opacity:1,fill:q||a.pref("bkgd_color"),style:"pointer-events:none"}});f.setCurrentLayer("Layer 1");
f.setCurrentLayerPosition("1")};document.getElementById("canvas_background")?document.getElementById("canvas_background").getAttribute("fill"):La();if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),a.pref("bkgd_url"));else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));var Ea=c.setImageURL=function(q){q||(q=ea);f.setImageURL(q);a("#image_url").val(q);if(q.indexOf("data:")===0){a("#image_url").hide();a("#change_image_url").show()}else{f.embedImage(q,function(A){A?a("#url_notice").hide():a("#url_notice").show();
ea=q});a("#image_url").show();a("#change_image_url").hide()}},qb=function(q){var A=Math.min(Math.max(12+q.value.length*6,50),300);a(q).width(A)},Ja=function(){var q=Z;if(q!=null&&!q.parentNode)q=null;var A=f.getCurrentDrawing().getCurrentLayerName(),I=f.getMode(),R=d.baseUnit!=="px"?d.baseUnit:null,X=I=="pathedit",ja=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 va=q.nodeName,ya=f.getRotationAngle(q);a("#angle").val(Math.round(ya));ya=f.getBlur(q);a("#blur").val(ya);a("#blur_slider").slider("option","value",ya);f.addedNew&&va==="image"&&f.getHref(q).indexOf("data:")!==0&&L();if(!X&&I!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");if(["line","circle","ellipse"].indexOf(va)>=
0)a("#xy_panel").hide();else{var Da,Ca;if(["g","polyline","path"].indexOf(va)>=0){if(I=f.getStrokedBBox([q])){Da=I.x;Ca=I.y}}else{Da=q.getAttribute("x");Ca=q.getAttribute("y")}if(R){Da=svgedit.units.convertUnit(Da);Ca=svgedit.units.convertUnit(Ca)}a("#selected_x").val(Math.round(Ca)||0);a("#selected_y").val(Math.round(Da)||0);a("#xy_panel").show()}["image","text","path","g","use"].indexOf(va)==-1&&a(".action_path_convert_selected").removeClass("disabled");va==="path"&&a(".action_path_selected").removeClass("disabled")}else{A=
ta.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!ta.canDeleteNodes);fa("#tool_openclose_path",ta.closed_subpath?"open_path":"close_path");if(A){X=a("#seg_type");if(R){A.x=svgedit.units.convertUnit(A.x);A.y=svgedit.units.convertUnit(A.y)}a("#path_node_x").val(Math.round(A.x));a("#path_node_y").val(Math.round(A.y));A.type?X.val(A.type).removeAttr("disabled"):X.val(4).attr("disabled","disabled")}return}R=
{g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:[],use:[]};var Ba=q.tagName;a(q).data("gsvg")&&a("#g_panel").show();Ba=="path"&&a("#path_panel").show();if(R[Ba]){R=R[Ba];a("#"+Ba+"_panel").show();a.each(R,function(tb,Ta){var ia=q.getAttribute(Ta);if(d.baseUnit!=="px"&&q[Ta])ia=svgedit.units.convertUnit(q[Ta].baseVal.value);a("#"+Ba+"_"+Ta).val(Math.round(ia)||0)});if(Ba=="text"){a("#text_panel").css("display",
"inline");f.getItalic()?a("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):a("#tool_italic").removeClass("push_button_pressed").addClass("tool_button");f.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);f.addedNew&&setTimeout(function(){a("#text").focus().select()},
100)}else if(Ba=="image")Ea(f.getHref(q));else if(Ba==="g"||Ba==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");R=f.getTitle();va=a("#g_title")[0];va.value=R;qb(va);Ba=="use"?va.setAttribute("disabled","disabled"):va.removeAttribute("disabled")}}ja[(Ba==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");ja[(Ba==="g"||!Aa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(Aa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");
ja.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else ja.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");ha.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");ha.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");f.addedNew=false;if(q&&!X||Aa){a("#selLayerNames").removeAttr("disabled").val(A);pa.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}else a("#selLayerNames").attr("disabled",
"disabled")};a("#text").focus(function(){});a("#text").blur(function(){});f.bind("selected",function(q,A){var I=f.getMode();I==="select"&&oa();I=I=="pathedit";Z=A.length==1||A[1]==null?A[0]:null;Aa=A.length>=2&&A[1]!=null;if(Z!=null)if(!I){if(Z!=null)switch(Z.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var R=null,X=Z.getElementsByTagName("*"),ja=0,va=X.length;ja<va;ja++){var ya=X[ja].getAttribute("stroke-width");if(ja===0)R=ya;else if(R!==ya)R=null}a("#stroke_width").val(R===
null?"":R);la.fill.update(true);la.stroke.update(true);break;default:la.fill.update(true);la.stroke.update(true);a("#stroke_width").val(Z.getAttribute("stroke-width")||1);a("#stroke_style").val(Z.getAttribute("stroke-dasharray")||"none");R=Z.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+R).length!=0&&w(a("#linejoin_"+R)[0]);R=Z.getAttribute("stroke-linecap")||"butt";a("#linecap_"+R).length!=0&&w(a("#linecap_"+R)[0])}if(Z!=null){R=(Z.getAttribute("opacity")||1)*100;a("#group_opacity").val(R);
a("#opac_slider").slider("option","value",R);a("#elem_id").val(Z.id)}}a("#path_node_panel").toggle(I);a("#tools_bottom_2,#tools_bottom_3").toggle(!I);if(I){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");fa("#tool_select","select_node");Aa=false;if(A.length)Z=A[0]}else{if(A[0]){I=f.selectorManager.requestSelector(A[0]);I.reset(A[0]);I.selectorRect.setAttribute("display","inline")}fa("#tool_select",
"select")}Ja();f.runExtensions("selectedChanged",{elems:A,selectedElement:Z,multiselected:Aa})});f.bind("transition",function(q,A){var I=f.getMode(),R=A[0];if(R){Aa=A.length>=2&&A[1]!=null;if(!Aa)switch(I){case "rotate":I=f.getRotationAngle(R);a("#angle").val(Math.round(I));a("#tool_reorient").toggleClass("disabled",I==0)}f.runExtensions("elementTransition",{elems:A})}});f.bind("changed",function(q,A){var I=f.getMode();I==="select"&&oa();for(var R=0;R<A.length;++R){var X=A[R];if(X&&X.tagName==="svg"){Ab();
Rb()}else if(X&&Z&&Z.parentNode==null)Z=X}c.show_save_warning=true;Ja();if(Z&&I==="select"){la.fill.update();la.stroke.update()}f.runExtensions("elementChanged",{elems:A})});f.bind("saved",function(q,A){c.show_save_warning=false;A='<?xml version="1.0"?>\n'+A;var I=navigator.userAgent;if(~I.indexOf("Chrome")&&a.browser.version>=533||~I.indexOf("MSIE"))D(0,true);else{var R=q.open("data:image/svg+xml;base64,"+ca.encode64(A)),X=a.pref("save_notice_done");if(X!=="all"){var ja=e.notification.saveFromBrowser.replace("%s",
"SVG");if(I.indexOf("Gecko/")!==-1)if(A.indexOf("<defs")!==-1){ja+="\n\n"+e.notification.defsFailOnSave;a.pref("save_notice_done","all");X="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");X!=="part"&&R.alert(ja)}}});f.bind("exported",function(q,A){var I=A.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var R=a("#export_canvas")[0];R.width=f.contentW;R.height=f.contentH;canvg(R,A.svg,{renderCallback:function(){var X=R.toDataURL("image/png");
ba.location.href=X;if(a.pref("export_notice_done")!=="all"){X=e.notification.saveFromBrowser.replace("%s","PNG");if(I.length)X+="\n\n"+e.notification.noteTheseIssues+"\n \u2022 "+I.join("\n \u2022 ");a.pref("export_notice_done","all");ba.alert(X)}}})});f.bind("zoomed",Oa);f.bind("contextset",function(q,A){var I="";if(A){var R="";I='<a href="#" data-root="y">'+f.getCurrentDrawing().getCurrentLayerName()+"</a>";a(A).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){R+=" > "+this.id;
I+=this!==A?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Sa=R}else Sa=null;a("#cur_context_panel").toggle(!!A).html(I);W()});f.bind("extension_added",function(q,A){function I(){if(nb){clearTimeout(nb);nb=null}X||(nb=setTimeout(function(){X=true;za(b.iconsize)},50))}var R=false,X=false,ja=true,va=function(){if(A.callback&&!R&&ja){R=true;A.callback()}},ya=[];A.context_tools&&a.each(A.context_tools,function(Ta,ia){var wb=ia.container_id?' id="'+ia.container_id+'"':"",bb=a("#"+ia.panel);bb.length||
(bb=a("<div>",{id:ia.panel}).appendTo("#tools_top"));switch(ia.type){case "tool_button":var Fa='<div class="tool_button">'+ia.id+"</div>",Va=a(Fa).appendTo(bb);ia.events&&a.each(ia.events,function(eb,lb){a(Va).bind(eb,lb)});break;case "select":Fa="<label"+wb+'><select id="'+ia.id+'">';a.each(ia.options,function(eb,lb){Fa+='<option value="'+eb+'"'+(eb==ia.defval?" selected":"")+">"+lb+"</option>"});Fa+="</select></label>";var Ha=a(Fa).appendTo(bb).find("select");a.each(ia.events,function(eb,lb){a(Ha).bind(eb,
lb)});break;case "button-select":Fa='<div id="'+ia.id+'" class="dropdown toolset" title="'+ia.title+'"><div id="cur_'+ia.id+'" class="icon_label"></div><button></button></div>';wb=a('<ul id="'+ia.id+'_opts"></ul>').appendTo("#option_lists");ia.colnum&&wb.addClass("optcols"+ia.colnum);a(Fa).appendTo(bb).children();ya.push({elem:"#"+ia.id,list:"#"+ia.id+"_opts",title:ia.title,callback:ia.events.change,cur:"#cur_"+ia.id});break;case "input":Fa="<label"+wb+'><span id="'+ia.id+'_label">'+ia.label+':</span><input id="'+
ia.id+'" title="'+ia.title+'" size="'+(ia.size||"4")+'" value="'+(ia.defval||"")+'" type="text"/></label>';var kb=a(Fa).appendTo(bb).find("input");ia.spindata&&kb.SpinButton(ia.spindata);ia.events&&a.each(ia.events,function(eb,lb){kb.bind(eb,lb)})}});if(A.buttons){var Da={},Ca={},Ba=A.svgicons,tb={};a.each(A.buttons,function(Ta,ia){for(var wb,bb=ia.id,Fa=Ta;a("#"+bb).length;)bb=ia.id+"_"+ ++Fa;if(Ba){Da[bb]=ia.icon;Fa=ia.svgicon?ia.svgicon:ia.id;if(ia.type=="app_menu")Ca["#"+bb+" > div"]=Fa;else Ca["#"+
bb]=Fa}else wb=ia.type=="menu"?"":a('<img src="'+ia.icon+'">');var Va,Ha;switch(ia.type){case "mode_flyout":case "mode":Va="tool_button";if(ia.cls)Va+=" "+ia.cls;Ha="#tools_left";break;case "context":Va="tool_button";Ha="#"+ia.panel;a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top");break;case "menu":Va="menu_item tool_button";Ha="#"+(ia.after||ia.panel);break;case "app_menu":Va="";Ha=ia.parent||"#main_menu ul";a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top")}var kb=a(ia.list||
ia.type=="app_menu"?"<li/>":"<div/>").attr("id",bb).attr("title",ia.title).addClass(Va);if(!ia.includeWith&&!ia.list){if("position"in ia)a(Ha).children().eq(ia.position).before(kb);else ia.type!="menu"||!ia.after?kb.appendTo(Ha):a(Ha).after(kb);if(ia.type=="mode_flyout"){Fa=a(kb);Va=Fa.parent();if(!Fa.parent().hasClass("tools_flyout")){var eb=Fa[0].id.replace("tool_","tools_"),lb=Fa.clone().attr("id",eb+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Fa.before(lb);Va=Ga(eb,Fa);Va.data("isLibrary",
true);lb.data("isLibrary",true)}Ca["#"+eb+"_show"]=ia.id;bb=tb["#"+Va[0].id]=[{sel:"#"+bb,fn:ia.events.click,icon:ia.id,isDefault:true},Yb]}else if(ia.type=="app_menu"||ia.type=="menu")kb.append(ia.title)}else if(ia.list){kb.addClass("push_button");a("#"+ia.list+"_opts").append(kb);if(ia.isDefault){a("#cur_"+ia.list).append(kb.children().clone());Fa=ia.svgicon?ia.svgicon:ia.id;Ca["#cur_"+ia.list]=Fa}}else if(ia.includeWith){Ha=ia.includeWith;Fa=a(Ha.button);Va=Fa.parent();if(!Fa.parent().hasClass("tools_flyout")){eb=
Fa[0].id.replace("tool_","tools_");lb=Fa.clone().attr("id",eb+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Fa.before(lb);Va=Ga(eb,Fa)}var Yb=oc.getButtonData(Ha.button);if(Ha.isDefault)Ca["#"+eb+"_show"]=ia.id;bb=tb["#"+Va[0].id]=[{sel:"#"+bb,fn:ia.events.click,icon:ia.id,key:ia.key,isDefault:ia.includeWith?ia.includeWith.isDefault:0},Yb];eb="position"in Ha?Ha.position:"last";Yb=Va.children().length;if(!isNaN(eb)&&eb>=0&&eb<Yb)Va.children().eq(eb).before(kb);else{Va.append(kb);bb.reverse()}}Ba||
kb.append(wb);ia.list||a.each(ia.events,function(Jb,Xb){if(Jb=="click")if(ia.type=="mode"){ia.includeWith?kb.bind(Jb,Xb):kb.bind(Jb,function(){xa(kb)&&Xb()});if(ia.key){a(document).bind("keydown",ia.key,Xb);ia.title&&kb.attr("title",ia.title+" ["+ia.key+"]")}}else kb.bind(Jb,Xb);else kb.bind(Jb,Xb)});Qa(tb)});a.each(ya,function(){sb(this.elem,this.list,this.callback,{seticon:true})});if(Ba)ja=false;a.svgIcons(Ba,{w:27,h:27,id_match:false,no_img:!O,fallback:Da,placement:Ca,callback:function(){b.iconsize&&
b.iconsize!="m"&&I();ja=true;va()}})}va()});f.textActions.setInputElem(a("#text")[0]);var Za='<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,A){Za+='<div class="palette_item" style="background-color: '+A+';" data-rgb="'+A+'"></div>'});a("#palette").append(Za);Za="";a.each(["#FFF","#888","#000"],function(){Za+='<div class="color_block" style="background-color:'+this+';"></div>'});a("#bg_blocks").append(Za);var Ma=a("#bg_blocks div");Ma.each(function(){a(this).click(function(){Ma.removeClass("cur_background");a(this).addClass("cur_background")})});if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),a.pref("bkgd_url"));
else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));if(a.pref("img_save")){b.img_save=a.pref("img_save");a("#image_save_opts input").val([b.img_save])}var ob=function(q){var A=q.value/100;if(A<0.0010)q.value=0.1;else{q=f.getZoom();Oa(window,{width:0,height:0,x:(ra[0].scrollLeft+ra.width()/2)/q,y:(ra[0].scrollTop+ra.height()/2)/q,zoom:A},true)}},xb=function(q,A){if(A==null)A=q.value;a("#group_opacity").val(A);if(!q||!q.handle)a("#opac_slider").slider("option","value",A);f.setOpacity(A/100)},
fb=function(q,A,I){if(A==null)A=q.value;a("#blur").val(A);var R=false;if(!q||!q.handle){a("#blur_slider").slider("option","value",A);R=true}I?f.setBlurNoUndo(A):f.setBlur(A,R)},ib=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){f.setStrokeAttr("stroke-dasharray",a(this).val());ib()});a("#stroke_linejoin").change(function(){f.setStrokeAttr("stroke-linejoin",a(this).val());ib()});a("select").change(function(){a(this).blur()});var Lb=false;a("#selLayerNames").change(function(){var q=
this.options[this.selectedIndex].value,A=e.notification.QmoveElemsToLayer.replace("%s",q),I=function(R){if(R){Lb=true;f.moveSelectedToLayer(q);f.clearSelection();Ab()}};if(q)Lb?I(true):a.confirm(A,I)});a("#font_family").change(function(){f.setFontFamily(this.value)});a("#seg_type").change(function(){f.setSegType(a(this).val())});a("#text").keyup(function(){f.setTextContent(this.value)});a("#image_url").change(function(){Ea(this.value)});a("#link_url").change(function(){this.value.length?f.setLinkURL(this.value):
f.removeHyperlink()});a("#g_title").change(function(){f.setGroupTitle(this.value)});a(".attr_changer").change(function(){var q=this.getAttribute("data-attr"),A=this.value;if(svgedit.units.isValidUnit(q,A,Z))this.blur();else{a.alert(e.notification.invalidAttrValGiven);this.value=Z.getAttribute(q);return false}if(q!=="id")if(isNaN(A))A=f.convertToNum(q,A);else if(d.baseUnit!=="px"){var I=svgedit.units.getTypeMap();if(Z[q]||f.getMode()==="pathedit"||q==="x"||q==="y")A*=I[d.baseUnit]}if(q==="id"){q=Z;
f.clearSelection();q.id=A;f.addToSelection([q],true)}else f.changeSelectedAttribute(q,A);this.blur()});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"),A=q?"stroke":"fill",I=a(this).attr("data-rgb"),R=null;if(I==="transparent"||I==="initial"||I==="#none"){I="none";R=new a.jGraduate.Paint}else R=new a.jGraduate.Paint({alpha:100,solidColor:I.substr(1)});la[A].setPaint(R);
if(q){f.setColor("stroke",I);I!="none"&&f.getStrokeOpacity()!=1&&f.setPaintOpacity("stroke",1)}else{f.setColor("fill",I);I!="none"&&f.getFillOpacity()!=1&&f.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");Ub()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Ub()});var xa=function(q,A){if(a(q).hasClass("disabled"))return false;
if(a(q).parent().hasClass("tools_flyout"))return true;var I=I||"normal";A||a(".tools_flyout").fadeOut(I);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,A=null,I=ra[0],R=false,X=false;a("#svgcanvas").bind("mousemove mouseup",function(ja){if(R!==false){I.scrollLeft-=ja.clientX-q;I.scrollTop-=ja.clientY-A;q=ja.clientX;A=ja.clientY;if(ja.type===
"mouseup")R=false;return false}}).mousedown(function(ja){if(ja.button===1||X===true){R=true;q=ja.clientX;A=ja.clientY;return false}});a(window).mouseup(function(){R=false});a(document).bind("keydown","space",function(ja){f.spaceKey=X=true;ja.preventDefault()}).bind("keyup","space",function(ja){ja.preventDefault();f.spaceKey=X=false}).bind("keydown","alt",function(){f.getMode()==="zoom"&&ra.addClass("out")}).bind("keyup","alt",function(){f.getMode()==="zoom"&&ra.removeClass("out")})})();var ub=a(".menu"),
rb=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").live("click",function(q){rb(q)});a("svg, body").on("mousedown",function(q){top!=self&&!q.isTrigger&&typeof top.exports.setEditorFocus==
"function"&&top.exports.setEditorFocus();if(!a(q.target).hasClass("menu_title"))if(!a(q.target).hasClass("disabled")&&a(q.target).hasClass("menu_item"))rb(q);else{a("#menu_bar").removeClass("active");a("#tools_shapelib").is(":visible")&&!a(q.target).parents("#tools_shapelib_show, #tools_shapelib").length&&a("#tools_shapelib").hide();q.target.nodeName.toLowerCase()!="input"&&a("input").blur()}});var yb=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(q,A,
I,R){if(q.altKey){q.preventDefault();q=f.getZoom()*100;A=yb.length;for(Bb=0;Bb<A;Bb++){I=Math.min(A,Bb+1);if(R>0)zoom=yb[Bb]<=q?yb[I]:zoom;if(R<0)zoom=yb[Bb]<q?yb[Bb]:zoom}zoom&&ob({value:zoom})}});a(".menu_title").on("click",function(){a("#menu_bar").toggleClass("active")});a(".menu_title").on("mouseover",function(){ub.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(q,A,I){if(a(q).length!=0){var R=a(q).find("button"),X=a(q).find("ul").attr("id",a(q)[0].id+"-list");
I||a("#option_lists").append(X);var ja=false;I&&a(q).addClass("dropup");X.find("li").bind("mouseup",A);a(window).mouseup(function(){if(!ja){R.removeClass("down");X.hide()}ja=false});R.bind("mousedown",function(){if(R.hasClass("down")){R.removeClass("down");X.hide()}else{R.addClass("down");if(!I){var va=a(q).offset();X.css({top:va.top,left:va.left-110})}X.show();ja=true}}).hover(function(){ja=true}).mouseout(function(){ja=false})}};var sb=function(q,A,I,R){var X=a(q);A=a(A);var ja=false,va=R.dropUp;
va&&a(q).addClass("dropup");A.find("li").bind("mouseup",function(){if(R.seticon){fa("#cur_"+X[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}I.apply(this,arguments)});a(window).mouseup(function(){if(!ja){X.removeClass("down");A.hide();A.css({top:0,left:0})}ja=false});A.height();a(q).bind("mousedown",function(){var ya=a(q).offset();if(va){ya.top-=A.height();ya.left+=8}else ya.top+=a(q).height();a(A).offset(ya);if(X.hasClass("down")){X.removeClass("down");A.hide();
A.css({top:0,left:0})}else{X.addClass("down");A.show();ja=true;return false}}).hover(function(){ja=true}).mouseout(function(){ja=false});R.multiclick&&A.mousedown(function(){ja=true})};c.addDropDown("#font_family_dropdown",function(){a(this).text();a("#font_family").val(a(this).text()).change()});c.addDropDown("#opacity_dropdown",function(){if(!a(this).find("div").length){var q=parseInt(a(this).text().split("%")[0]);xb(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,A){xb(A)}});c.addDropDown("#blur_dropdown",a.noop);var mb=false;a("#blur_slider").slider({max:10,step:0.1,stop:function(q,A){mb=false;fb(A);a("#blur_dropdown li").show();a(window).mouseup()},start:function(){mb=true},slide:function(q,A){fb(A,null,mb)}});c.addDropDown("#zoom_dropdown",function(){var q=a(this),A=q.attr("data-val");A?Oa(window,A):ob({value:parseInt(q.text())})},true);sb("#stroke_linecap","#linecap_opts",
function(){w(this,true)},{dropUp:true});sb("#stroke_linejoin","#linejoin_opts",function(){w(this,true)},{dropUp:true});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var q=this.id.replace("tool_pos","").charAt(0);f.alignSelectedElements(q,"page")})});(function(){var q,A=function(){a(q).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){q=this;U="toolbars";ra.mousedown(A)}).blur(function(){U="canvas";ra.unbind("mousedown",A);f.getMode()==
"textedit"&&a("#text").focus()})})();var Gb=function(){if(xa("#tool_select")){f.setMode("select");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}")}},Hb=function(){xa("#tool_fhpath")&&f.setMode("fhpath")},Mb=function(){xa("#tool_line")&&f.setMode("line")},Nb=function(){xa("#tool_rect")&&f.setMode("rect")},ma=function(){xa("#tool_ellipse")&&f.setMode("ellipse")},Y=function(){xa("#tool_image")&&f.setMode("image")},na=function(){xa("#tool_zoom")&&
f.setMode("zoom")},K=function(){if(xa("#tool_zoom")){E();oa()}},N=function(){xa("#tool_text")&&f.setMode("text")},aa=function(){xa("#tool_path")&&f.setMode("path")},Pa=function(){if(Z!=null||Aa)f.deleteSelectedElements()},Xa=function(){if(Z!=null||Aa){window.event.type==="keydown"&&db(a("#edit_menu"));f.cutSelectedElements()}},hb=function(){if(Z!=null||Aa){window.event.type==="keydown"&&db(a("#edit_menu"));f.copySelectedElements()}},pb=function(){window.event.type==="keydown"&&db(a("#edit_menu"));
var q=f.getZoom(),A=(ra[0].scrollLeft+ra.width()/2)/q-f.contentW;q=(ra[0].scrollTop+ra.height()/2)/q-f.contentH;f.pasteElements("point",A,q)},Db=function(){if(Z!=null){window.event.type==="keydown"&&db(a("#object_menu"));f.moveToTopSelectedElement()}},cb=function(){if(Z!=null){window.event.type==="keydown"&&db(a("#object_menu"));f.moveToBottomSelectedElement()}},Eb=function(){if(Z!=null){window.event.type==="keydown"&&db(a("#object_menu"));f.moveUpDownSelected("Up")}},$a=function(){if(Z!=null){window.event.type===
"keydown"&&db(a("#object_menu"));f.moveUpDownSelected("Down")}},Fb=function(q){if(Z!=null){window.event.type==="keydown"&&db(a("#object_menu"));f.moveUpDownSelected(q)}},Pb=function(){if(Z!=null){f.convertToPath();elems=f.getSelectedElems();f.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");f.setMode("pathedit");ta.toEditMode(elems[0]);f.clearSelection()}},$b=function(){Z!=null&&ta.reorient()},Zb=function(){if(Z!=null||Aa)a.prompt(e.notification.enterNewLinkURL,
"http://",function(q){q&&f.makeHyperlink(q)})},gb=function(q,A){if(Z!=null||Aa){if(d.gridSnapping){var I=f.getZoom()*d.snappingStep;q*=I;A*=I}a("input").blur();f.moveSelectedElements(q,A)}},Ua=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);ta.linkControlPoints(q)},
ic=function(){ta.getNodePoint()&&ta.clonePathNode()},ec=function(){ta.getNodePoint()&&ta.deletePathNode()},cc=function(){var q=a("#tool_add_subpath"),A=!q.hasClass("push_button_pressed");A?q.addClass("push_button_pressed").removeClass("tool_button"):q.removeClass("push_button_pressed").addClass("tool_button");ta.addSubPath(A)},fc=function(){ta.opencloseSubPath()},gc=function(){f.cycleElement(1)},Tb=function(){f.cycleElement(0)},Sb=function(q,A){if(!(Z==null||Aa)){q||(A*=-1);var I=a("#angle").val()*
1+A;f.setRotationAngle(I);Ja()}},mc=function(){var q=d.dimensions;a.confirm(e.notification.QwantToClear,function(A){if(A){oa();f.clear();f.setResolution(q[0],q[1]);Rb(true);E();Ab();Ja();la.fill.prep();la.stroke.prep();f.runExtensions("onNewDocument")}})},Vb=function(){f.setBold(!f.getBold());Ja();return false},vb=function(){f.setItalic(!f.getItalic());Ja();return false},kc=function(){if(!l.pngsave){var q=e.notification.loadingImage;ba=window.open("data:text/html;charset=utf-8,<title>"+q+"</title><h1>"+
q+"</h1>")}window.canvg?f.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){f.rasterExport()})})},jc=function(){f.open()},Wb=function(){},db=function(q){var A=q.prev();A.css("background","#09f");setTimeout(function(){A.css("background","")},200)},dc=function(){if(ha.getUndoStackSize()>0){window.event.type==="keydown"&&db(a("#edit_menu"));ha.undo();Ab()}},g=function(){if(ha.getRedoStackSize()>0){window.event.type==="keydown"&&db(a("#edit_menu"));ha.redo();
Ab()}},h=function(){if(Aa)f.groupSelectedElements();else Z&&f.ungroupSelectedElement()},k=function(){window.event.type==="keydown"&&db(a("#edit_menu"));f.cloneSelectedElements(20,20)},v=function(){var q=this.id.replace("tool_align","").charAt(0);f.alignSelectedElements(q,a("#align_relative_to").val())},s=function(){var q=document.querySelector("#tool_stroke rect"),A=document.querySelector("#tool_fill rect"),I=A.getAttribute("fill"),R=q.getAttribute("fill");q=parseFloat(q.getAttribute("stroke-opacity"));
if(isNaN(q))q=100;A=parseFloat(A.getAttribute("fill-opacity"));if(isNaN(A))A=100;R=ab(R,q,"stroke");I=ab(I,A,"fill");la.fill.setPaint(R,true);la.stroke.setPaint(I,true)},E=function(q){var A=f.getResolution();q=q?A.zoom*q:1;a("#zoom").val(q*100);f.setZoom(q);B();Rb(true)},z=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");ra.toggleClass("wireframe");if(!tc){var q=a("#wireframe_rules");
q.length?q.empty():a('<style id="wireframe_rules"></style>').appendTo("head");B()}},t=function(){f.clearSelection();a("#tool_canvas").trigger("click")},C=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},F=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);d.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);d.showRulers=
true}a("#rulers").toggle(!!d.showRulers)},B=function(){if(!tc){var q="#workarea.wireframe #svgcontent * { stroke-width: "+1/f.getZoom()+"px; }";a("#wireframe_rules").text(ra.hasClass("wireframe")?q:"")}},D=function(q,A){if(!Ka){Ka=true;a("#save_output_btns").toggle(!!A);a("#tool_source_back").toggle(!A);var I=sa=f.getSvgString();a("#svg_source_textarea").val(I);a("#svg_source_editor").fadeIn();P();a("#svg_source_textarea").focus()}},H=function(){if(!Ra){Ra=true;a("#image_save_opts input").val([b.img_save]);
var q=f.getResolution();if(d.baseUnit!=="px"){q.w=svgedit.units.convertUnit(q.w)+d.baseUnit;q.h=svgedit.units.convertUnit(q.h)+d.baseUnit}a(".canvas_width").val(q.w);a(".canvas_height").val(q.h);a("#canvas_title").val(f.getDocumentTitle());a("#svg_docprops").show()}},G=function(){if(!Na){Na=true;var q=a("#bg_blocks div"),A=a.pref("bkgd_color"),I=a.pref("bkgd_url");q.each(function(){var R=a(this),X=R.css("background-color")==A;R.toggleClass("cur_background",X);X&&a("#canvas_bg_url").removeClass("cur_background")});
A||q.eq(0).addClass("cur_background");I&&a("#canvas_bg_url").val(I);a("grid_snapping_step").attr("value",d.snappingStep);d.gridSnapping==true?a("#grid_snapping_on").attr("checked","checked"):a("#grid_snapping_on").removeAttr("checked");a("#svg_prefs").show()}},P=function(){var q=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",q)},Q=function(){if(Ka){var q=function(){f.clearSelection();zb();E();Ab();W();la.fill.prep();la.stroke.prep()};f.setSvgString(a("#svg_source_textarea").val())?
q():a.confirm(e.notification.QerrorsRevertToSource,function(A){if(!A)return false;q()});oa()}},W=function(q){q=q||f.getDocumentTitle();q=Wa+(q?": "+q:"");a("title:first").text(q)},ua=function(){var q=a("#canvas_width"),A=q.val(),I=a("#canvas_height"),R=I.val();if(A!="fit"&&!svgedit.units.isValidUnit("width",A)){a.alert(e.notification.invalidAttrValGiven);q.parent().addClass("error");return false}q.parent().removeClass("error");if(R!="fit"&&!svgedit.units.isValidUnit("height",R)){a.alert(e.notification.invalidAttrValGiven);
I.parent().addClass("error");return false}I.parent().removeClass("error");if(!f.setResolution(A,R)){a.alert(e.notification.noContentToFitTo);return false}b.img_save=a("#image_save_opts :checked").val();a.pref("img_save",b.img_save);Rb();Qb()},wa=function(){var q=a("#bg_blocks div.cur_background").css("background-color")||"#FFF";p(q,a("#canvas_bg_url").val());q=a("#lang_select").val();q!=b.lang&&c.putLocale(q);za(a("#iconsize").val());d.gridSnapping=a("#grid_snapping_on")[0].checked;d.snappingStep=
a("#grid_snapping_step").val();d.showRulers=a("#show_rulers")[0].checked;a("#rulers").toggle(d.showRulers);d.showRulers&&da();d.baseUnit=a("#base_unit").val();f.setConfig(d);Rb();Ib()},fa=c.setIcon=function(q,A){var I=typeof A==="string"?a.getSvgIcon(A,true):A.clone();I?a(q).find("img").replaceWith(I):console.log("NOTE: Icon image missing: "+A)},ka;ka=function(){var q=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,A=document.getElementsByTagName("script")[0],I;for(I in A.style)if(q.test(I))return I.match(q)[0];
if("WebkitOpacity"in A.style)return"Webkit";if("KhtmlOpacity"in A.style)return"Khtml";return""}();var qa=function(q,A){ka.toLowerCase();var I=["top","left","bottom","right"];q.each(function(){for(var R=a(this),X=R.outerWidth()*(A-1),ja=R.outerHeight()*(A-1),va=0;va<4;va++){var ya=I[va],Da=R.data("orig_margin-"+ya);if(Da==null){Da=parseInt(R.css("margin-"+ya));R.data("orig_margin-"+ya,Da)}Da=Da*A;if(ya==="right")Da+=X;else if(ya==="bottom")Da+=ja;R.css("margin-"+ya,Da)}})},za=c.setIconSize=function(q,
A){if(!(q==b.size&&!A)){var I=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"),R=1;R=typeof q=="number"?q:{s:0.75,m:1,l:1.25,xl:1.5}[q];c.tool_scale=S=R;Cb();var X=I.parents(":hidden");X.css("visibility","hidden").show();qa(I,R);X.css("visibility","visible").hide();a.pref("iconsize",q);a("#iconsize").val(q);X={"#tools_top":{left:50,height:72},
"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}};I=a("#tool_size_rules");if(I.length)I.empty();else I=a('<style id="tool_size_rules"></style>').appendTo("head");if(q!="m"){var ja="";a.each(X,function(va,ya){va="#svg_editor "+va.replace(/,/g,", #svg_editor");ja+=va+"{";a.each(ya,function(Da,Ca){if(typeof Ca==="number")var Ba=Ca*R+"px";else if(Ca[q]||Ca.all)Ba=Ca[q]||Ca.all;ja+=Da+":"+Ba+";"});ja+="}"});X="-"+ka.toLowerCase()+"-";ja+="#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{"+
X+"transform: scale("+R+");} #svg_editor div.toolset .toolset {"+X+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+X+"transform: scale("+1/R+");}";I.text(ja)}Cb()}},jb=function(){a("#dialog_box").hide();if(!Ka&&!Ra&&!Na)Sa&&f.leaveContext();else{if(Ka)sa!==a("#svg_source_textarea").val()?a.confirm(e.notification.QignoreSourceChanges,function(q){q&&zb()}):zb();else if(Ra)Qb();else Na&&Ib();Ub()}},zb=function(){a("#svg_source_editor").hide();Ka=false;a("#svg_source_textarea").blur()},
Qb=function(){a("#svg_docprops").hide();a("#canvas_width,#canvas_height").removeAttr("disabled");a("#resolution")[0].selectedIndex=0;a("#image_save_opts input").val([b.img_save]);Ra=false},Ib=function(){a("#svg_prefs").hide();Na=false},Ob={width:a(window).width(),height:a(window).height()},Ub=a.noop,ac;svgedit.browser.isIE()&&function(){Ub=function(){if(ra[0].scrollLeft===0&&ra[0].scrollTop===0){ra[0].scrollLeft=ac.left;ra[0].scrollTop=ac.top}};ac={left:ra[0].scrollLeft,top:ra[0].scrollTop};a(window).resize(Ub);
svgEditor.ready(function(){setTimeout(function(){Ub()},500)});ra.scroll(function(){ac={left:ra[0].scrollLeft,top:ra[0].scrollTop}})}();a(window).resize(function(){Ka&&P();a.each(Ob,function(q,A){var I=a(window)[q]();ra[0]["scroll"+(q==="width"?"Left":"Top")]-=(I-A)/2;Ob[q]=I})});(function(){ra.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=ra[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=ra[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});
a("#change_image_url").click(L);(function(){var q=["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],A="";a.each(q,function(I,R){A+="#tool_"+R+(I==q.length-1?",":"")});a(A).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(V&&!window.opera){V=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"];for(var Bb=V.length;Bb--;){var pc=document.getElementById(V[Bb]);if(pc!=null){var qc=pc.title,uc=qc.indexOf("Ctrl+");pc.title=[qc.substr(0,uc),"Cmd+",qc.substr(uc+5)].join("")}}}var rc=function(q){var A=q[0].id=="stroke_color"?"stroke":"fill",I=q[0].id=="canvas_color";if(I)A="canvas";var R=la[A].paint;q=A=="stroke"?"Pick a Stroke Paint and Opacity":
"Pick a Fill Paint and Opacity";I=I?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(I).jGraduate({paint:R,window:{pickerTitle:q},images:{clientPath:d.jGraduatePath},newstop:"inverse"},function(X){R=new a.jGraduate.Paint(X);la[A].setPaint(R);f.setPaint(A,R);a("#color_picker").hide()},function(){a("#color_picker").hide()})};V=function(q,A){var I=document.getElementById("canvas_background"),
R={color:"#fff",opacity:1};if(A=="stroke")R=d.initStroke;if(A=="fill")R=d.initFill;if(A=="canvas"&&I)if(I=I.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))R={color:("0"+parseInt(I[1],10).toString(16)).slice(-2)+("0"+parseInt(I[2],10).toString(16)).slice(-2)+("0"+parseInt(I[3],10).toString(16)).slice(-2),opacity:1};I=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+R.color+'" opacity="'+R.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',
"text/xml").documentElement;I=a(q)[0].appendChild(document.importNode(I,true));I.setAttribute("width",24.5);this.rect=I.firstChild;this.defs=I.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:R.color});this.type=A;this.setPaint=function(X,ja){this.paint=X;var va="none",ya=X.type,Da=X.alpha/100;switch(ya){case "solidColor":va=X[ya]=="none"||X[ya]=="one"?"none":"#"+X[ya];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);
this.grad=this.defs.appendChild(X[ya]);va="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",va);this.rect.setAttribute("opacity",Da);if(ja){f.setColor(this.type,va,true);f.setPaintOpacity(this.type,Da,true)}if(this.type=="canvas"){(ya=document.getElementById("canvas_background"))?ya.setAttribute("fill",va):La(va);console.log(ya.getAttribute("fill"))}};this.update=function(X){if(Z){var ja=this.type;switch(Z.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var va=
null,ya=Z.getElementsByTagName("*"),Da=0,Ca=ya.length;Da<Ca;Da++){var Ba=ya[Da].getAttribute(ja);if(Da===0)va=Ba;else if(va!==Ba){va=null;break}}if(va===null){ya=null;return}ya=va;va=1;break;default:va=parseFloat(Z.getAttribute(ja+"-opacity"));if(isNaN(va))va=1;ya=ja==="fill"?"black":"none";ya=Z.getAttribute(ja)||ya}if(X){f.setColor(ja,ya,true);f.setPaintOpacity(ja,va,true)}va*=100;this.setPaint(ab(ya,va,ja))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var X=
new a.jGraduate.Paint({copy:this.paint});f.setPaint(A,X)}}};la.fill=new V("#fill_color","fill");la.stroke=new V("#stroke_color","stroke");la.canvas=new V("#canvas_color","canvas");a("#stroke_width").val(d.initStroke.width);a("#group_opacity").val(d.initOpacity*100);V=la.fill.rect.cloneNode(false);V.setAttribute("style","vector-effect:non-scaling-stroke");var tc=V.style.vectorEffect==="non-scaling-stroke";V.removeAttribute("style");V=la.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"feGaussianBlur");typeof V.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(V).remove();setTimeout(function(){f.embedImage("images/placeholder.svg",function(q){if(!q){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);b.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",e.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))rc(a("#fill_color"));else{a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active")}});a("#tool_canvas").click(function(){rc(a("#canvas_color"))});a("#tool_stroke").click(function(){if(a("#tool_stroke").hasClass("active"))rc(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#group_opacityLabel").click(function(){a("#opacity_dropdown button").mousedown();a(window).mouseup()});a("#zoomLabel").click(function(){a("#zoom_dropdown button").mousedown();a(window).mouseup()});a("#tool_move_top").mousedown(function(q){a("#tools_stacking").show();
q.preventDefault()});a(".layer_button").mousedown(function(){a(this).addClass("layer_buttonpressed")}).mouseout(function(){a(this).removeClass("layer_buttonpressed")}).mouseup(function(){a(this).removeClass("layer_buttonpressed")});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("#layer_new").click(function(){var q=f.getCurrentDrawing().getNumLayers();do var A=e.layers.layer+" "+ ++q;while(f.getCurrentDrawing().hasLayer(A));a.prompt(e.notification.enterUniqueLayerName,A,function(I){if(I)if(f.getCurrentDrawing().hasLayer(I))a.alert(e.notification.dupeLayerName);else{f.createLayer(I);Ja();Ab()}})});a("#layer_delete").click(T);a("#layer_up").click(function(){J(-1)});a("#layer_down").click(function(){J(1)});a("#layer_rename").click(function(){a("#layerlist tr.layersel").prevAll();
var q=a("#layerlist tr.layersel td.layername").text();a.prompt(e.notification.enterNewLayerName,"",function(A){if(A)if(q==A||f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.layerHasThatName);else{f.renameCurrentLayer(A);Ab()}})});var bc=-1,lc=false,sc=false,vc=function(q){if(sc)if(bc!=-1){lc=true;q=bc-q.pageX;var A=a("#sidepanels"),I=parseInt(A.css("width"));if(I+q>300)q=300-I;else if(I+q<2)q=2-I;if(q!=0){bc-=q;I=a("#layerpanel");ra.css("right",parseInt(ra.css("right"))+q);A.css("width",
parseInt(A.css("width"))+q);I.css("width",parseInt(I.css("width"))+q);A=a("#ruler_x");A.css("right",parseInt(A.css("right"))+q)}}};a("#sidepanel_handle").mousedown(function(q){bc=q.pageX;a(window).mousemove(vc);sc=false;setTimeout(function(){sc=true},20)}).mouseup(function(){lc||wc();bc=-1;lc=false});a(window).mouseup(function(){bc=-1;lc=false;a("#svg_editor").unbind("mousemove",vc)});var wc=function(q){var A=parseInt(a("#sidepanels").css("width"));q=(A>2||q?2:150)-A;A=a("#sidepanels");var I=a("#layerpanel"),
R=a("#ruler_x");ra.css("right",parseInt(ra.css("right"))+q);A.css("width",parseInt(A.css("width"))+q);I.css("width",parseInt(I.css("width"))+q);R.css("right",parseInt(R.css("right"))+q)},xc=function(q){for(var A=Array(f.getCurrentDrawing().getNumLayers()),I=0;I<A.length;++I)A[I]=f.getCurrentDrawing().getLayerName(I);if(q)for(I=0;I<A.length;++I)A[I]!=q&&f.getCurrentDrawing().setLayerOpacity(A[I],0.5);else for(I=0;I<A.length;++I)f.getCurrentDrawing().setLayerOpacity(A[I],1)},Ab=function(){var q=a("#layerlist tbody"),
A=a("#selLayerNames");q.empty();A.empty();for(var I=f.getCurrentDrawing().getCurrentLayerName(),R=f.getCurrentDrawing().getNumLayers(),X=a.getSvgIcon("eye");R--;){var ja=f.getCurrentDrawing().getLayerName(R),va='<tr class="layer';if(ja==I)va+=" layersel";va+='">';va+=f.getCurrentDrawing().getLayerVisibility(ja)?'<td class="layervis"/><td class="layername" >'+ja+"</td></tr>":'<td class="layervis layerinvis"/><td class="layername" >'+ja+"</td></tr>";q.append(va);A.append('<option value="'+ja+'">'+ja+
"</option>")}if(X!==undefined){X.clone();a("td.layervis",q).append(X.clone());a.resizeSvgIcons({"td.layervis .svg_icon":14})}a("#layerlist td.layername").mouseup(function(ya){a("#layerlist tr.layer").removeClass("layersel");a(this.parentNode).addClass("layersel");f.setCurrentLayer(this.textContent);ya.preventDefault()}).mouseover(function(){a(this).css({"font-style":"italic",color:"blue"});xc(this.textContent)}).mouseout(function(){a(this).css({"font-style":"normal",color:"black"});xc()});a("#layerlist td.layervis").click(function(){var ya=
a(this.parentNode).prevAll().length;ya=a("#layerlist tr.layer:eq("+ya+") td.layername").text();var Da=a(this).hasClass("layerinvis");f.setLayerVisibility(ya,Da);Da?a(this).removeClass("layerinvis"):a(this).addClass("layerinvis")});for(A=5-a("#layerlist tr.layer").size();A-- >0;)q.append('<tr><td style="color:white">_</td><td/></tr>')};Ab();a(window).bind("load resize",function(){ra.css("line-height",ra.height()+"px")});a("#resolution").change(function(){var q=a("#canvas_width,#canvas_height");if(this.selectedIndex)if(this.value==
"content")q.val("fit").attr("disabled","disabled");else{var A=this.value.split("x");a("#canvas_width").val(A[0]);a("#canvas_height").val(A[1]);q.removeAttr("disabled")}else a("#canvas_width").val()=="fit"&&q.removeAttr("disabled").val(100)});a("input,select").attr("autocomplete","off");var oc=function(){var q=[{sel:"#tool_select",fn:Gb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Hb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Mb,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Nb,evt:"click",
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ma,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:aa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:N,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Y,evt:"mouseup"},{sel:"#tool_zoom",fn:na,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:mc,evt:"mouseup",key:[ga+"N",true]},{sel:"#tool_save",fn:function(){Ka?Q():f.save({images:b.img_save,round_digits:6})},evt:"mouseup",key:[ga+"S",true]},{sel:"#tool_export",fn:kc,evt:"mouseup"},
{sel:"#tool_open",fn:jc,evt:"mouseup"},{sel:"#tool_import",fn:Wb,evt:"mouseup"},{sel:"#tool_source",fn:D,evt:"click",key:[ga+"U",true]},{sel:"#tool_wireframe",fn:z,evt:"click"},{sel:"#tool_rulers",fn:F,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:jb,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Q,evt:"click"},{sel:"#tool_docprops_save",fn:ua,evt:"click"},{sel:"#tool_docprops",fn:H,evt:"mouseup"},{sel:"#tool_prefs_save",
fn:wa,evt:"click"},{sel:"#tool_prefs_option",fn:function(){G();return false},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Pa,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:$b,evt:"click"},{sel:"#tool_node_link",fn:Ua,evt:"click"},{sel:"#tool_node_clone",fn:ic,evt:"click"},{sel:"#tool_node_delete",fn:ec,evt:"click"},{sel:"#tool_openclose_path",fn:fc,evt:"click"},{sel:"#tool_add_subpath",fn:cc,evt:"click"},{sel:"#tool_move_top",fn:Db,evt:"click",key:ga+"shift+up"},{sel:"#tool_move_bottom",
fn:cb,evt:"click",key:ga+"shift+down"},{sel:"#tool_move_up",fn:Eb,evt:"click",key:[ga+"up",true]},{sel:"#tool_move_down",fn:$a,evt:"click",key:[ga+"down",true]},{sel:"#tool_topath",fn:Pb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:Zb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:k,evt:"click",key:[ga+"D",true]},{sel:"#tool_group",fn:h,evt:"click",key:[ga+"G",true]},{sel:"#tool_ungroup",fn:h,evt:"click",key:ga+"shift+G"},{sel:"#tool_unlink_use",fn:h,evt:"click"},{sel:"[id^=tool_align]",
fn:v,evt:"click"},{sel:"#tool_switch",fn:s,evt:"click",key:["shift+x",true]},{sel:"#tool_undo",fn:dc,evt:"click",key:ga+"z"},{sel:"#tool_redo",fn:g,evt:"click",key:["y",true]},{sel:"#tool_canvas_color_menu",fn:t,evt:"click"},{sel:"#tool_cut",fn:Xa,evt:"click",key:ga+"x"},{sel:"#tool_copy",fn:hb,evt:"click",key:ga+"c"},{sel:"#tool_paste",fn:pb,evt:"click",key:ga+"v"},{sel:"#tool_bold",fn:Vb,evt:"mousedown",key:[ga+"B",true]},{sel:"#tool_italic",fn:vb,evt:"mousedown",key:[ga+"I",true]},{sel:"#copy_save_done",
fn:jb,evt:"click"},{key:"ctrl+left",fn:function(){Sb(0,1)}},{key:"ctrl+right",fn:function(){Sb(1,1)}},{key:"ctrl+shift+left",fn:function(){Sb(0,5)}},{key:"ctrl+shift+right",fn:function(){Sb(1,5)}},{key:"shift+O",fn:Tb},{key:"shift+P",fn:gc},{key:[ga+"+",true],fn:function(){E(2)}},{key:[ga+"-",true],fn:function(){E(0.5)}},{key:["up",true],fn:function(){gb(0,-1)}},{key:["down",true],fn:function(){gb(0,1)}},{key:["left",true],fn:function(){gb(-1,0)}},{key:["right",true],fn:function(){gb(1,0)}},{key:"shift+up",
fn:function(){gb(0,-10)}},{key:"shift+down",fn:function(){gb(0,10)}},{key:"shift+left",fn:function(){gb(-10,0)}},{key:"shift+right",fn:function(){gb(10,0)}},{key:["alt+up",true],fn:function(){f.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){f.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){f.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){f.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){f.cloneSelectedElements(0,-10)}},
{key:["alt+shift+down",true],fn:function(){f.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){f.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){f.cloneSelectedElements(10,0)}},{key:ga+"A",fn:function(){f.selectAllInCurrentLayer()}},{key:ga+"shift+z",fn:g},{key:"esc",fn:C}],A={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var I={};a.each(q,function(R,X){if(X.sel){var ja=a(X.sel);if(ja.length==0)return true;
if(X.evt){if(svgedit.browser.isTouch()&&X.evt==="click")X.evt="mousedown";ja[X.evt](X.fn)}if(X.parent&&a(X.parent+"_show").length!=0){var va=a(X.parent);va.length||(va=Ga(X.parent.substr(1)));va.append(ja);a.isArray(I[X.parent])||(I[X.parent]=[]);I[X.parent].push(X)}}if(X.key){var ya=X.fn,Da=false;if(a.isArray(X.key)){va=X.key[0];if(X.key.length>1)Da=X.key[1]}else va=X.key;va+="";svgedit.browser.isMac&&va.indexOf("+")!=-1&&va.split("+")[0]=="ctrl"&&va.replace("ctrl","cmd");a.each(va.split("/"),function(Ba,
tb){a(document).bind("keydown",tb,function(Ta){ya();Da&&Ta.preventDefault();return false})});if(X.sel&&!X.hidekey&&ja.attr("title")){var Ca=ja.attr("title").split("[")[0]+" ("+va+")";A[va]=X.sel;ja.parents("#main_menu").length||ja.attr("title",Ca)}}});Qa(I);a(".attr_changer, #image_url").bind("keydown","return",function(R){a(this).change();R.preventDefault()});a(window).bind("keydown","tab",function(R){if(U==="canvas"){R.preventDefault();gc()}}).bind("keydown","shift+tab",function(R){if(U==="canvas"){R.preventDefault();
Tb()}});a("#tool_zoom").dblclick(K)},setTitles:function(){a.each(A,function(I,R){var X=a(R).parents("#main_menu").length;a(R).each(function(){var ja=X?a(this).text().split(" [")[0]:this.title.split(" [")[0],va="";a.each(I.split("/"),function(ya,Da){var Ca=Da.split("+"),Ba="";if(Ca.length>1){Ba=Ca[0]+"+";Da=Ca[1]}va+=(ya?"/":"")+Ba+(e["key_"+Da]||Da)});if(X)this.lastChild.textContent=ja+" ["+va+"]";else this.title=ja+" ["+va+"]"})})},getButtonData:function(I){var R;a.each(q,function(X,ja){if(ja.sel===
I)R=ja});return R}}}();oc.setAll();c.ready(function(){var q=d.initTool,A=a("#tools_left, #svg_editor .tools_flyout"),I=A.find("#tool_"+q);q=A.find("#"+q);(I.length?I:q.length?q:a("#tool_select")).click().mouseup();d.wireframe&&a("#tool_wireframe").click();d.showlayers&&wc();a("#rulers").toggle(!!d.showRulers);if(d.showRulers)a("#show_rulers")[0].checked=true;if(d.gridSnapping)a("#grid_snapping_on")[0].checked=true;d.baseUnit&&a("#base_unit").val(d.baseUnit);d.snappingStep&&a("#grid_snapping_step").val(d.snappingStep)});
a("#rect_rx").SpinButton({min:0,max:1E3,step:1,callback:function(q){f.setRectRadius(q.value)}});a("#stroke_width").SpinButton({min:0,max:99,step:1,smallStep:0.1,callback:function(q){var A=q.value;if(A==0&&Z&&["line","polyline"].indexOf(Z.nodeName)>=0)A=q.value=1;f.setStrokeWidth(A)}});a("#angle").SpinButton({min:-180,max:180,step:5,callback:function(q){f.setRotationAngle(q.value);a("#tool_reorient").toggleClass("disabled",q.value==0)}});a("#font_size").SpinButton({step:1,min:0.0010,stepfunc:function(q,
A){var I=q.value-0,R=I+A,X=R>=I;if(A===0)return I;return I>=24?X?Math.round(I*1.1):Math.round(I/1.1):I<=1?X?I*2:I/2:R},callback:function(q){f.setFontSize(q.value)}});a("#group_opacity").SpinButton({step:5,min:0,max:100,callback:xb});a("#blur").SpinButton({step:0.1,min:0,max:10,callback:fb});a("#zoom").SpinButton({min:0.0010,max:1E4,step:50,stepfunc:function(q,A){var I=q.value-0;if(I===0)return 100;var R=I+A;if(A===0)return I;return I>=100?R:R>=I?I*2:I/2},callback:ob}).val(f.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",
inSpeed:0},function(q){switch(q){case "delete":Pa();break;case "cut":Xa();break;case "copy":hb();break;case "paste":f.pasteElements();break;case "paste_in_place":f.pasteElements("in_place");break;case "group":f.groupSelectedElements();break;case "ungroup":f.ungroupSelectedElement();break;case "move_front":Db();break;case "move_up":Fb("Up");break;case "move_down":Fb("Down");break;case "move_back":cb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(q)&&svgedit.contextmenu.getCustomHandler(q).call()}f.clipBoard.length&&
pa.enableContextMenuItems("#paste,#paste_in_place")});V=function(q){switch(q){case "dupe":M();break;case "delete":T();break;case "merge_down":if(a("#layerlist tr.layersel").index()!=f.getCurrentDrawing().getNumLayers()-1){f.mergeLayer();Ja();Ab()}break;case "merge_all":f.mergeAllLayers();Ja();Ab()}};a("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},V);a("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:true},V);a(".contextMenu li").mousedown(function(q){q.preventDefault()});
a("#cmenu_canvas li").disableContextMenu();pa.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(ha.getUndoStackSize()===0)c.show_save_warning=false;if(!d.no_save_warning&&c.show_save_warning)return e.notification.unsavedChanges};c.openPrep=function(q){a("#main_menu").hide();ha.getUndoStackSize()===0?q(true):a.confirm(e.notification.QwantToOpen,q)};if(window.FileReader){V=a('<input type="file">').change(function(){var q=this;c.openPrep(function(A){if(A){f.clear();if(q.files.length==
1){A=new FileReader;A.onloadend=function(I){n(I.target.result);Rb()};A.readAsText(q.files[0])}}})});a("#tool_open").show().prepend(V);V=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var q=new FileReader;q.onloadend=function(A){f.importSvgString(A.target.result,true);Rb()};q.readAsText(this.files[0])}});a("#tool_import").show().prepend(V)}var Rb=c.updateCanvas=function(q,A){var I=ra.width(),R=ra.height(),X=I,ja=R,va=f.getZoom(),ya=a("#svgcanvas"),Da={x:ra[0].scrollLeft+
X/2,y:ra[0].scrollTop+ja/2},Ca=d.canvas_expansion;I=Math.max(X,f.contentW*va*Ca);R=Math.max(ja,f.contentH*va*Ca);I==X&&R==ja?ra.css("overflow","hidden"):ra.css("overflow","scroll");Ca=ya.height()/2;var Ba=ya.width()/2;ya.width(I).height(R);var tb=R/2,Ta=I/2,ia=f.updateCanvas(I,R),wb=Ta/Ba;I=I/2-X/2;R=R/2-ja/2;if(A){A.x+=ia.x;A.y+=ia.y}else A={x:Ta+(Da.x-Ba)*wb,y:tb+(Da.y-Ca)*wb};if(q)if(f.contentW>ra.width()){ra[0].scrollLeft=ia.x-10;ra[0].scrollTop=ia.y-10}else{ra[0].scrollLeft=I;ra[0].scrollTop=
R}else{ra[0].scrollLeft=A.x-X/2;ra[0].scrollTop=A.y-ja/2}if(d.showRulers){da(ya,va);ra.scroll()}},hc=[];for(Bb=0.1;Bb<1E5;Bb*=10){hc.push(1*Bb);hc.push(2*Bb);hc.push(5*Bb)}Rb(true);try{var yc=function(q){if(window.JSON&&JSON.stringify)return JSON.stringify(q);var A=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(X){return"\\u"+("0000"+X.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(q.length){for(var I=0;I<q.length;I++)q[I]=A(q[I]);return"["+q.join(",")+"]"}else{I=[];for(var R in q)I.push(A(R)+":"+A(q[R]));return"{"+I.join(",")+"}"}};window.addEventListener("message",function(q){var A=parseInt(q.data.substr(0,q.data.indexOf(";")));try{q.source.postMessage("SVGe"+A+";"+yc(eval(q.data)),"*")}catch(I){q.source.postMessage("SVGe"+A+";error:"+I.message,"*")}},false)}catch(zc){window.embed_error=
zc}a(function(){window.svgCanvas=f;f.ready=svgEditor.ready});c.setLang=function(q,A){a.pref("lang",q);a("#lang_select").val(q);if(A){var I=a("#layerlist tr.layersel td.layername").text()==e.common.layer+" 1";a.extend(e,A);f.setUiStrings(A);oc.setTitles();if(I){f.renameCurrentLayer(e.common.layer+" 1");Ab()}f.runExtensions("langChanged",q);Kb();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(R,X){a(X).attr("title",a(R)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var u=[];c.ready=function(w){m?w():u.push(w)};c.runCallbacks=function(){a.each(u,function(){this()});m=true};c.loadFromString=function(w){c.ready(function(){n(w)})};c.disableUI=function(){};c.loadFromURL=function(w,p){p||(p={});var L=p.cache,T=p.callback;c.ready(function(){a.ajax({url:w,dataType:"text",
cache:!!L,success:function(M){n(M,T)},error:function(M,J,da){M.status!=404&&M.responseText?n(M.responseText,T):a.alert(e.notification.URLloadFail+": \n"+da+"",T)}})})};c.loadFromDataURI=function(w){c.ready(function(){var p=w.substring(26);n(svgedit.utilities.decode64(p))})};c.addExtension=function(){var w=arguments;a(function(){f&&f.addExtension.apply(this,w)})};return c}(jQuery);$(svgEditor.init)})();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 f=n.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+n.id+"'>"+n.label+"<span class='shortcut'>"+f+"</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}})();var svgEditor=function(a,n){function f(m,o,b){var d=a("#svg_editor").parent(),e;for(e in o){var l=o[e];l||console.log(e);if(b)e="#"+e;if(d.find(e).length){var u=d.find(e)[0];switch(m){case "content":for(var w=0;w<u.childNodes.length;w++){var p=u.childNodes[w];if(p.nodeType===3&&p.textContent.replace(/\s/g,"")){p.textContent=l;break}}break;case "title":u.title=l}}else console.log("Missing: "+e)}}var c;n.readLang=function(m){var o=n.canvas.runExtensions("addlangData",c,true);a.each(o,function(T,M){if(M.data)m=
@ -602,55 +604,55 @@ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui
return f=this._trimAlignValue(f)}f=this.options.values.slice();for(c=0;c<f.length;c+=1)f[c]=this._trimAlignValue(f[c]);return f},_trimAlignValue:function(n){if(n<=this._valueMin())return this._valueMin();if(n>=this._valueMax())return this._valueMax();var f=this.options.step>0?this.options.step:1,c=(n-this._valueMin())%f;n=n-c;Math.abs(c)*2>=f&&(n+=c>0?f:-f);return parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var n=
this.options.range,f=this.options,c=this,m=this._animateOff?false:f.animate,o,b={},d,e,l,u;this.options.values&&this.options.values.length?this.handles.each(function(w){o=(c.values(w)-c._valueMin())/(c._valueMax()-c._valueMin())*100;b[c.orientation==="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[m?"animate":"css"](b,f.animate);c.options.range===true&&(c.orientation==="horizontal"?(w===0&&c.range.stop(1,1)[m?"animate":"css"]({left:o+"%"},f.animate),w===1&&c.range[m?"animate":"css"]({width:o-
d+"%"},{queue:false,duration:f.animate})):(w===0&&c.range.stop(1,1)[m?"animate":"css"]({bottom:o+"%"},f.animate),w===1&&c.range[m?"animate":"css"]({height:o-d+"%"},{queue:false,duration:f.animate})));d=o}):(e=this.value(),l=this._valueMin(),u=this._valueMax(),o=u!==l?(e-l)/(u-l)*100:0,b[c.orientation==="horizontal"?"left":"bottom"]=o+"%",this.handle.stop(1,1)[m?"animate":"css"](b,f.animate),n==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[m?"animate":"css"]({width:o+"%"},f.animate),
n==="max"&&this.orientation==="horizontal"&&this.range[m?"animate":"css"]({width:100-o+"%"},{queue:false,duration:f.animate}),n==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[m?"animate":"css"]({height:o+"%"},f.animate),n==="max"&&this.orientation==="vertical"&&this.range[m?"animate":"css"]({height:100-o+"%"},{queue:false,duration:f.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(b,d){if(d===undefined)d=0;return Math.round(b*Math.pow(10,d))/Math.pow(10,d)};var n=function(b,d){var e=this,l=b.find("img:first"),u=0,w=100,p=100,L=0,T=100,M=100,J=0,da=0,V,O,fa=[],ua=function(S){for(var U=0;U<fa.length;U++)fa[U].call(e,e,S)},ha=function(S){var U=b.offset();V={l:U.left|0,t:U.top|0};clearTimeout(O);O=setTimeout(function(){ra.call(e,S)},0);a(document).bind("mousemove",ca).bind("mouseup",ea);S.preventDefault()},ca=function(S){clearTimeout(O);O=setTimeout(function(){ra.call(e,
S)},0);S.stopPropagation();S.preventDefault();return false},ea=function(S){a(document).unbind("mouseup",ea).unbind("mousemove",ca);S.stopPropagation();S.preventDefault();return false},ra=function(S){var U=S.pageX-V.l;S=S.pageY-V.t;var sa=b.w,la=b.h;if(U<0)U=0;else if(U>sa)U=sa;if(S<0)S=0;else if(S>la)S=la;qa.call(e,"xy",{x:U/sa*p+u,y:S/la*M+L})},qa=function(S,U,sa){if(U===undefined){if(S===undefined||S==null)S="xy";switch(S.toLowerCase()){case "x":return J;case "y":return da;default:return{x:J,y:da}}}if(!(sa!=
null&&sa==e)){var la=false,oa,Z;if(S==null)S="xy";switch(S.toLowerCase()){case "x":oa=U&&(U.x&&U.x|0||U|0)||0;break;case "y":Z=U&&(U.y&&U.y|0||U|0)||0;break;default:oa=U&&U.x&&U.x|0||0;Z=U&&U.y&&U.y|0||0}if(oa!=null){if(oa<u)oa=u;else if(oa>w)oa=w;if(J!=oa){J=oa;la=true}}if(Z!=null){if(Z<L)Z=L;else if(Z>T)Z=T;if(da!=Z){da=Z;la=true}}la&&ua.call(e,sa||e)}},ba=function(S){a.isFunction(S)&&fa.push(S)};a.extend(true,e,{val:qa,range:function(S,U){if(U===undefined){if(S===undefined||S==null)S="all";switch(S.toLowerCase()){case "minx":return u;
n==="max"&&this.orientation==="horizontal"&&this.range[m?"animate":"css"]({width:100-o+"%"},{queue:false,duration:f.animate}),n==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[m?"animate":"css"]({height:o+"%"},f.animate),n==="max"&&this.orientation==="vertical"&&this.range[m?"animate":"css"]({height:100-o+"%"},{queue:false,duration:f.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(b,d){if(d===undefined)d=0;return Math.round(b*Math.pow(10,d))/Math.pow(10,d)};var n=function(b,d){var e=this,l=b.find("img:first"),u=0,w=100,p=100,L=0,T=100,M=100,J=0,da=0,V,O,ga=[],ta=function(S){for(var U=0;U<ga.length;U++)ga[U].call(e,e,S)},ha=function(S){var U=b.offset();V={l:U.left|0,t:U.top|0};clearTimeout(O);O=setTimeout(function(){ra.call(e,S)},0);a(document).bind("mousemove",ca).bind("mouseup",ea);S.preventDefault()},ca=function(S){clearTimeout(O);O=setTimeout(function(){ra.call(e,
S)},0);S.stopPropagation();S.preventDefault();return false},ea=function(S){a(document).unbind("mouseup",ea).unbind("mousemove",ca);S.stopPropagation();S.preventDefault();return false},ra=function(S){var U=S.pageX-V.l;S=S.pageY-V.t;var sa=b.w,la=b.h;if(U<0)U=0;else if(U>sa)U=sa;if(S<0)S=0;else if(S>la)S=la;pa.call(e,"xy",{x:U/sa*p+u,y:S/la*M+L})},pa=function(S,U,sa){if(U===undefined){if(S===undefined||S==null)S="xy";switch(S.toLowerCase()){case "x":return J;case "y":return da;default:return{x:J,y:da}}}if(!(sa!=
null&&sa==e)){var la=false,oa,Z;if(S==null)S="xy";switch(S.toLowerCase()){case "x":oa=U&&(U.x&&U.x|0||U|0)||0;break;case "y":Z=U&&(U.y&&U.y|0||U|0)||0;break;default:oa=U&&U.x&&U.x|0||0;Z=U&&U.y&&U.y|0||0}if(oa!=null){if(oa<u)oa=u;else if(oa>w)oa=w;if(J!=oa){J=oa;la=true}}if(Z!=null){if(Z<L)Z=L;else if(Z>T)Z=T;if(da!=Z){da=Z;la=true}}la&&ta.call(e,sa||e)}},ba=function(S){a.isFunction(S)&&ga.push(S)};a.extend(true,e,{val:pa,range:function(S,U){if(U===undefined){if(S===undefined||S==null)S="all";switch(S.toLowerCase()){case "minx":return u;
case "maxx":return w;case "rangex":return{minX:u,maxX:w,rangeX:p};case "miny":return L;case "maxy":return T;case "rangey":return{minY:L,maxY:T,rangeY:M};default:return{minX:u,maxX:w,rangeX:p,minY:L,maxY:T,rangeY:M}}}var sa,la,oa,Z;if(S==null)S="all";switch(S.toLowerCase()){case "minx":sa=U&&(U.minX&&U.minX|0||U|0)||0;break;case "maxx":la=U&&(U.maxX&&U.maxX|0||U|0)||0;break;case "rangex":sa=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;break;case "miny":oa=U&&(U.minY&&U.minY|0||U|0)||0;break;case "maxy":Z=
U&&(U.maxY&&U.maxY|0||U|0)||0;break;case "rangey":oa=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0;break;default:sa=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;oa=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0}if(sa!=null&&u!=sa){u=sa;p=w-u}if(la!=null&&w!=la){w=la;p=w-u}if(oa!=null&&L!=oa){L=oa;M=T-L}if(Z!=null&&T!=Z){T=Z;M=T-L}},bind:ba,unbind:function(S){if(a.isFunction(S))for(var U;(U=a.inArray(S,fa))!=-1;)fa.splice(U,1)},destroy:function(){a(document).unbind("mouseup",ea).unbind("mousemove",
ca);b.unbind("mousedown",ha);fa=l=b=null}});l.src=d.arrow&&d.arrow.image;l.w=d.arrow&&d.arrow.width||l.width();l.h=d.arrow&&d.arrow.height||l.height();b.w=d.map&&d.map.width||b.width();b.h=d.map&&d.map.height||b.height();b.bind("mousedown",ha);ba.call(e,function(){var S=0,U=0,sa=b.w,la=b.h,oa=l.w,Z=l.h;setTimeout(function(){if(p>0)S=J==w?sa:J/p*sa|0;if(M>0)U=da==T?la:da/M*la|0;if(oa>=sa)S=(sa>>1)-(oa>>1);else S-=oa>>1;if(Z>=la)U=(la>>1)-(Z>>1);else U-=Z>>1;l.css({left:S+"px",top:U+"px"})},0)})},f=
function(b,d,e,l){var u=this;b=b.find("td.Text input");var w=b.eq(3),p=b.eq(4),L=b.eq(5),T=b.length>7?b.eq(6):null,M=b.eq(0),J=b.eq(1),da=b.eq(2),V=b.eq(b.length>7?7:6),O=b.length>7?b.eq(8):null,fa=function(qa){if(!(qa.target.value==""&&qa.target!=V.get(0)&&(e!=null&&qa.target!=e.get(0)||e==null))){if(!ca(qa))return qa;switch(qa.target){case w.get(0):switch(qa.keyCode){case 38:w.val(ea.call(u,(w.val()<<0)+1,0,255));d.val("r",w.val(),qa.target);return false;case 40:w.val(ea.call(u,(w.val()<<0)-1,0,
255));d.val("r",w.val(),qa.target);return false}break;case p.get(0):switch(qa.keyCode){case 38:p.val(ea.call(u,(p.val()<<0)+1,0,255));d.val("g",p.val(),qa.target);return false;case 40:p.val(ea.call(u,(p.val()<<0)-1,0,255));d.val("g",p.val(),qa.target);return false}break;case L.get(0):switch(qa.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));d.val("b",L.val(),qa.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));d.val("b",L.val(),qa.target);return false}break;case T&&T.get(0):switch(qa.keyCode){case 38:T.val(ea.call(u,
parseFloat(T.val())+1,0,100));d.val("a",Math.precision(T.val()*255/100,l),qa.target);return false;case 40:T.val(ea.call(u,parseFloat(T.val())-1,0,100));d.val("a",Math.precision(T.val()*255/100,l),qa.target);return false}break;case M.get(0):switch(qa.keyCode){case 38:M.val(ea.call(u,(M.val()<<0)+1,0,360));d.val("h",M.val(),qa.target);return false;case 40:M.val(ea.call(u,(M.val()<<0)-1,0,360));d.val("h",M.val(),qa.target);return false}break;case J.get(0):switch(qa.keyCode){case 38:J.val(ea.call(u,(J.val()<<
0)+1,0,100));d.val("s",J.val(),qa.target);return false;case 40:J.val(ea.call(u,(J.val()<<0)-1,0,100));d.val("s",J.val(),qa.target);return false}break;case da.get(0):switch(qa.keyCode){case 38:da.val(ea.call(u,(da.val()<<0)+1,0,100));d.val("v",da.val(),qa.target);return false;case 40:da.val(ea.call(u,(da.val()<<0)-1,0,100));d.val("v",da.val(),qa.target);return false}}}},ua=function(qa){if(!(qa.target.value==""&&qa.target!=V.get(0)&&(e!=null&&qa.target!=e.get(0)||e==null))){if(!ca(qa))return qa;switch(qa.target){case w.get(0):w.val(ea.call(u,
w.val(),0,255));d.val("r",w.val(),qa.target);break;case p.get(0):p.val(ea.call(u,p.val(),0,255));d.val("g",p.val(),qa.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));d.val("b",L.val(),qa.target);break;case T&&T.get(0):T.val(ea.call(u,T.val(),0,100));d.val("a",Math.precision(T.val()*255/100,l),qa.target);break;case M.get(0):M.val(ea.call(u,M.val(),0,360));d.val("h",M.val(),qa.target);break;case J.get(0):J.val(ea.call(u,J.val(),0,100));d.val("s",J.val(),qa.target);break;case da.get(0):da.val(ea.call(u,
da.val(),0,100));d.val("v",da.val(),qa.target);break;case V.get(0):V.val(V.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));e&&e.val(V.val());d.val("hex",V.val()!=""?V.val():null,qa.target);break;case e&&e.get(0):e.val(e.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));V.val(e.val());d.val("hex",e.val()!=""?e.val():null,qa.target);break;case O&&O.get(0):O.val(O.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));d.val("a",O.val()!=null?parseInt(O.val(),16):
null,qa.target)}}},ha=function(qa){if(d.val()!=null)switch(qa.target){case w.get(0):w.val(d.val("r"));break;case p.get(0):p.val(d.val("g"));break;case L.get(0):L.val(d.val("b"));break;case T&&T.get(0):T.val(Math.precision(d.val("a")*100/255,l));break;case M.get(0):M.val(d.val("h"));break;case J.get(0):J.val(d.val("s"));break;case da.get(0):da.val(d.val("v"));break;case V.get(0):case e&&e.get(0):V.val(d.val("hex"));e&&e.val(d.val("hex"));break;case O&&O.get(0):O.val(d.val("ahex").substring(6))}},ca=
function(qa){switch(qa.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(qa.ctrlKey)return false}return true},ea=function(qa,ba,S){if(qa==""||isNaN(qa))return ba;if(qa>S)return S;if(qa<ba)return ba;return qa},ra=function(qa,ba){var S=qa.val("all");if(ba!=w.get(0))w.val(S!=null?S.r:"");if(ba!=p.get(0))p.val(S!=null?S.g:"");if(ba!=L.get(0))L.val(S!=null?S.b:"");if(T&&ba!=T.get(0))T.val(S!=null?Math.precision(S.a*100/255,l):"");if(ba!=M.get(0))M.val(S!=
null?S.h:"");if(ba!=J.get(0))J.val(S!=null?S.s:"");if(ba!=da.get(0))da.val(S!=null?S.v:"");if(ba!=V.get(0)&&(e&&ba!=e.get(0)||!e))V.val(S!=null?S.hex:"");if(e&&ba!=e.get(0)&&ba!=V.get(0))e.val(S!=null?S.hex:"");if(O&&ba!=O.get(0))O.val(S!=null?S.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){w.add(p).add(L).add(T).add(M).add(J).add(da).add(V).add(e).add(O).unbind("keyup",ua).unbind("blur",ha);w.add(p).add(L).add(T).add(M).add(J).add(da).unbind("keydown",fa);d.unbind(ra);O=V=da=J=M=T=L=
p=w=null}});w.add(p).add(L).add(T).add(M).add(J).add(da).add(V).add(e).add(O).bind("keyup",ua).bind("blur",ha);w.add(p).add(L).add(T).add(M).add(J).add(da).bind("keydown",fa);d.bind(ra)};a.jPicker={List:[],Color:function(b){var d=this,e,l,u,w,p,L,T,M=[],J=function(V){for(var O=0;O<M.length;O++)M[O].call(d,d,V)},da=function(V,O,fa){if(O===undefined){if(V===undefined||V==null||V=="")V="all";if(e==null)return null;switch(V.toLowerCase()){case "ahex":return o.rgbaToHex({r:e,g:l,b:u,a:w});case "hex":return da("ahex").substring(0,
6);case "all":return{r:e,g:l,b:u,a:w,h:p,s:L,v:T,hex:da.call(d,"hex"),ahex:da.call(d,"ahex")};default:O={};for(var ua=0;ua<V.length;ua++)switch(V.charAt(ua)){case "r":if(V.length==1)O=e;else O.r=e;break;case "g":if(V.length==1)O=l;else O.g=l;break;case "b":if(V.length==1)O=u;else O.b=u;break;case "a":if(V.length==1)O=w;else O.a=w;break;case "h":if(V.length==1)O=p;else O.h=p;break;case "s":if(V.length==1)O=L;else O.s=L;break;case "v":if(V.length==1)O=T;else O.v=T}return O=={}?da.call(d,"all"):O}}if(!(fa!=
null&&fa==d)){var ha=false;if(V==null)V="";if(O==null){if(e!=null){e=null;ha=true}if(l!=null){l=null;ha=true}if(u!=null){u=null;ha=true}if(w!=null){w=null;ha=true}if(p!=null){p=null;ha=true}if(L!=null){L=null;ha=true}if(T!=null){T=null;ha=true}ha&&J.call(d,fa||d)}else switch(V.toLowerCase()){case "ahex":case "hex":O=o.hexToRgba(O&&(O.ahex||O.hex)||O||"00000000");da.call(d,"rgba",{r:O.r,g:O.g,b:O.b,a:V=="ahex"?O.a:w!=null?w:255},fa);break;default:if(O&&(O.ahex!=null||O.hex!=null)){da.call(d,"ahex",
O.ahex||O.hex||"00000000",fa);break}var ca={},ea=false,ra=false;if(O.r!==undefined&&!V.indexOf("r")==-1)V+="r";if(O.g!==undefined&&!V.indexOf("g")==-1)V+="g";if(O.b!==undefined&&!V.indexOf("b")==-1)V+="b";if(O.a!==undefined&&!V.indexOf("a")==-1)V+="a";if(O.h!==undefined&&!V.indexOf("h")==-1)V+="h";if(O.s!==undefined&&!V.indexOf("s")==-1)V+="s";if(O.v!==undefined&&!V.indexOf("v")==-1)V+="v";for(ua=0;ua<V.length;ua++)switch(V.charAt(ua)){case "r":if(ra)continue;ea=true;ca.r=O&&O.r&&O.r|0||O&&O|0||0;
U&&(U.maxY&&U.maxY|0||U|0)||0;break;case "rangey":oa=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0;break;default:sa=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;oa=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0}if(sa!=null&&u!=sa){u=sa;p=w-u}if(la!=null&&w!=la){w=la;p=w-u}if(oa!=null&&L!=oa){L=oa;M=T-L}if(Z!=null&&T!=Z){T=Z;M=T-L}},bind:ba,unbind:function(S){if(a.isFunction(S))for(var U;(U=a.inArray(S,ga))!=-1;)ga.splice(U,1)},destroy:function(){a(document).unbind("mouseup",ea).unbind("mousemove",
ca);b.unbind("mousedown",ha);ga=l=b=null}});l.src=d.arrow&&d.arrow.image;l.w=d.arrow&&d.arrow.width||l.width();l.h=d.arrow&&d.arrow.height||l.height();b.w=d.map&&d.map.width||b.width();b.h=d.map&&d.map.height||b.height();b.bind("mousedown",ha);ba.call(e,function(){var S=0,U=0,sa=b.w,la=b.h,oa=l.w,Z=l.h;setTimeout(function(){if(p>0)S=J==w?sa:J/p*sa|0;if(M>0)U=da==T?la:da/M*la|0;if(oa>=sa)S=(sa>>1)-(oa>>1);else S-=oa>>1;if(Z>=la)U=(la>>1)-(Z>>1);else U-=Z>>1;l.css({left:S+"px",top:U+"px"})},0)})},f=
function(b,d,e,l){var u=this;b=b.find("td.Text input");var w=b.eq(3),p=b.eq(4),L=b.eq(5),T=b.length>7?b.eq(6):null,M=b.eq(0),J=b.eq(1),da=b.eq(2),V=b.eq(b.length>7?7:6),O=b.length>7?b.eq(8):null,ga=function(pa){if(!(pa.target.value==""&&pa.target!=V.get(0)&&(e!=null&&pa.target!=e.get(0)||e==null))){if(!ca(pa))return pa;switch(pa.target){case w.get(0):switch(pa.keyCode){case 38:w.val(ea.call(u,(w.val()<<0)+1,0,255));d.val("r",w.val(),pa.target);return false;case 40:w.val(ea.call(u,(w.val()<<0)-1,0,
255));d.val("r",w.val(),pa.target);return false}break;case p.get(0):switch(pa.keyCode){case 38:p.val(ea.call(u,(p.val()<<0)+1,0,255));d.val("g",p.val(),pa.target);return false;case 40:p.val(ea.call(u,(p.val()<<0)-1,0,255));d.val("g",p.val(),pa.target);return false}break;case L.get(0):switch(pa.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));d.val("b",L.val(),pa.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));d.val("b",L.val(),pa.target);return false}break;case T&&T.get(0):switch(pa.keyCode){case 38:T.val(ea.call(u,
parseFloat(T.val())+1,0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);return false;case 40:T.val(ea.call(u,parseFloat(T.val())-1,0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);return false}break;case M.get(0):switch(pa.keyCode){case 38:M.val(ea.call(u,(M.val()<<0)+1,0,360));d.val("h",M.val(),pa.target);return false;case 40:M.val(ea.call(u,(M.val()<<0)-1,0,360));d.val("h",M.val(),pa.target);return false}break;case J.get(0):switch(pa.keyCode){case 38:J.val(ea.call(u,(J.val()<<
0)+1,0,100));d.val("s",J.val(),pa.target);return false;case 40:J.val(ea.call(u,(J.val()<<0)-1,0,100));d.val("s",J.val(),pa.target);return false}break;case da.get(0):switch(pa.keyCode){case 38:da.val(ea.call(u,(da.val()<<0)+1,0,100));d.val("v",da.val(),pa.target);return false;case 40:da.val(ea.call(u,(da.val()<<0)-1,0,100));d.val("v",da.val(),pa.target);return false}}}},ta=function(pa){if(!(pa.target.value==""&&pa.target!=V.get(0)&&(e!=null&&pa.target!=e.get(0)||e==null))){if(!ca(pa))return pa;switch(pa.target){case w.get(0):w.val(ea.call(u,
w.val(),0,255));d.val("r",w.val(),pa.target);break;case p.get(0):p.val(ea.call(u,p.val(),0,255));d.val("g",p.val(),pa.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));d.val("b",L.val(),pa.target);break;case T&&T.get(0):T.val(ea.call(u,T.val(),0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);break;case M.get(0):M.val(ea.call(u,M.val(),0,360));d.val("h",M.val(),pa.target);break;case J.get(0):J.val(ea.call(u,J.val(),0,100));d.val("s",J.val(),pa.target);break;case da.get(0):da.val(ea.call(u,
da.val(),0,100));d.val("v",da.val(),pa.target);break;case V.get(0):V.val(V.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));e&&e.val(V.val());d.val("hex",V.val()!=""?V.val():null,pa.target);break;case e&&e.get(0):e.val(e.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));V.val(e.val());d.val("hex",e.val()!=""?e.val():null,pa.target);break;case O&&O.get(0):O.val(O.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));d.val("a",O.val()!=null?parseInt(O.val(),16):
null,pa.target)}}},ha=function(pa){if(d.val()!=null)switch(pa.target){case w.get(0):w.val(d.val("r"));break;case p.get(0):p.val(d.val("g"));break;case L.get(0):L.val(d.val("b"));break;case T&&T.get(0):T.val(Math.precision(d.val("a")*100/255,l));break;case M.get(0):M.val(d.val("h"));break;case J.get(0):J.val(d.val("s"));break;case da.get(0):da.val(d.val("v"));break;case V.get(0):case e&&e.get(0):V.val(d.val("hex"));e&&e.val(d.val("hex"));break;case O&&O.get(0):O.val(d.val("ahex").substring(6))}},ca=
function(pa){switch(pa.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(pa.ctrlKey)return false}return true},ea=function(pa,ba,S){if(pa==""||isNaN(pa))return ba;if(pa>S)return S;if(pa<ba)return ba;return pa},ra=function(pa,ba){var S=pa.val("all");if(ba!=w.get(0))w.val(S!=null?S.r:"");if(ba!=p.get(0))p.val(S!=null?S.g:"");if(ba!=L.get(0))L.val(S!=null?S.b:"");if(T&&ba!=T.get(0))T.val(S!=null?Math.precision(S.a*100/255,l):"");if(ba!=M.get(0))M.val(S!=
null?S.h:"");if(ba!=J.get(0))J.val(S!=null?S.s:"");if(ba!=da.get(0))da.val(S!=null?S.v:"");if(ba!=V.get(0)&&(e&&ba!=e.get(0)||!e))V.val(S!=null?S.hex:"");if(e&&ba!=e.get(0)&&ba!=V.get(0))e.val(S!=null?S.hex:"");if(O&&ba!=O.get(0))O.val(S!=null?S.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){w.add(p).add(L).add(T).add(M).add(J).add(da).add(V).add(e).add(O).unbind("keyup",ta).unbind("blur",ha);w.add(p).add(L).add(T).add(M).add(J).add(da).unbind("keydown",ga);d.unbind(ra);O=V=da=J=M=T=L=
p=w=null}});w.add(p).add(L).add(T).add(M).add(J).add(da).add(V).add(e).add(O).bind("keyup",ta).bind("blur",ha);w.add(p).add(L).add(T).add(M).add(J).add(da).bind("keydown",ga);d.bind(ra)};a.jPicker={List:[],Color:function(b){var d=this,e,l,u,w,p,L,T,M=[],J=function(V){for(var O=0;O<M.length;O++)M[O].call(d,d,V)},da=function(V,O,ga){if(O===undefined){if(V===undefined||V==null||V=="")V="all";if(e==null)return null;switch(V.toLowerCase()){case "ahex":return o.rgbaToHex({r:e,g:l,b:u,a:w});case "hex":return da("ahex").substring(0,
6);case "all":return{r:e,g:l,b:u,a:w,h:p,s:L,v:T,hex:da.call(d,"hex"),ahex:da.call(d,"ahex")};default:O={};for(var ta=0;ta<V.length;ta++)switch(V.charAt(ta)){case "r":if(V.length==1)O=e;else O.r=e;break;case "g":if(V.length==1)O=l;else O.g=l;break;case "b":if(V.length==1)O=u;else O.b=u;break;case "a":if(V.length==1)O=w;else O.a=w;break;case "h":if(V.length==1)O=p;else O.h=p;break;case "s":if(V.length==1)O=L;else O.s=L;break;case "v":if(V.length==1)O=T;else O.v=T}return O=={}?da.call(d,"all"):O}}if(!(ga!=
null&&ga==d)){var ha=false;if(V==null)V="";if(O==null){if(e!=null){e=null;ha=true}if(l!=null){l=null;ha=true}if(u!=null){u=null;ha=true}if(w!=null){w=null;ha=true}if(p!=null){p=null;ha=true}if(L!=null){L=null;ha=true}if(T!=null){T=null;ha=true}ha&&J.call(d,ga||d)}else switch(V.toLowerCase()){case "ahex":case "hex":O=o.hexToRgba(O&&(O.ahex||O.hex)||O||"00000000");da.call(d,"rgba",{r:O.r,g:O.g,b:O.b,a:V=="ahex"?O.a:w!=null?w:255},ga);break;default:if(O&&(O.ahex!=null||O.hex!=null)){da.call(d,"ahex",
O.ahex||O.hex||"00000000",ga);break}var ca={},ea=false,ra=false;if(O.r!==undefined&&!V.indexOf("r")==-1)V+="r";if(O.g!==undefined&&!V.indexOf("g")==-1)V+="g";if(O.b!==undefined&&!V.indexOf("b")==-1)V+="b";if(O.a!==undefined&&!V.indexOf("a")==-1)V+="a";if(O.h!==undefined&&!V.indexOf("h")==-1)V+="h";if(O.s!==undefined&&!V.indexOf("s")==-1)V+="s";if(O.v!==undefined&&!V.indexOf("v")==-1)V+="v";for(ta=0;ta<V.length;ta++)switch(V.charAt(ta)){case "r":if(ra)continue;ea=true;ca.r=O&&O.r&&O.r|0||O&&O|0||0;
if(ca.r<0)ca.r=0;else if(ca.r>255)ca.r=255;if(e!=ca.r){e=ca.r;ha=true}break;case "g":if(ra)continue;ea=true;ca.g=O&&O.g&&O.g|0||O&&O|0||0;if(ca.g<0)ca.g=0;else if(ca.g>255)ca.g=255;if(l!=ca.g){l=ca.g;ha=true}break;case "b":if(ra)continue;ea=true;ca.b=O&&O.b&&O.b|0||O&&O|0||0;if(ca.b<0)ca.b=0;else if(ca.b>255)ca.b=255;if(u!=ca.b){u=ca.b;ha=true}break;case "a":ca.a=O&&O.a!=null?O.a|0:O!=null?O|0:255;if(ca.a<0)ca.a=0;else if(ca.a>255)ca.a=255;if(w!=ca.a){w=ca.a;ha=true}break;case "h":if(ea)continue;
ra=true;ca.h=O&&O.h&&O.h|0||O&&O|0||0;if(ca.h<0)ca.h=0;else if(ca.h>360)ca.h=360;if(p!=ca.h){p=ca.h;ha=true}break;case "s":if(ea)continue;ra=true;ca.s=O&&O.s!=null?O.s|0:O!=null?O|0:100;if(ca.s<0)ca.s=0;else if(ca.s>100)ca.s=100;if(L!=ca.s){L=ca.s;ha=true}break;case "v":if(ea)continue;ra=true;ca.v=O&&O.v!=null?O.v|0:O!=null?O|0:100;if(ca.v<0)ca.v=0;else if(ca.v>100)ca.v=100;if(T!=ca.v){T=ca.v;ha=true}}if(ha){if(ea){e=e||0;l=l||0;u=u||0;O=o.rgbToHsv({r:e,g:l,b:u});p=O.h;L=O.s;T=O.v}else if(ra){p=p||
0;L=L!=null?L:100;T=T!=null?T:100;O=o.hsvToRgb({h:p,s:L,v:T});e=O.r;l=O.g;u=O.b}w=w!=null?w:255;J.call(d,fa||d)}}}};a.extend(true,d,{val:da,bind:function(V){a.isFunction(V)&&M.push(V)},unbind:function(V){if(a.isFunction(V))for(var O;(O=a.inArray(V,M))!=-1;)M.splice(O,1)},destroy:function(){M=null}});if(b)if(b.ahex!=null)da("ahex",b);else if(b.hex!=null)da((b.a!=null?"a":"")+"hex",b.a!=null?{ahex:b.hex+o.intToHex(b.a)}:b);else if(b.r!=null&&b.g!=null&&b.b!=null)da("rgb"+(b.a!=null?"a":""),b);else if(b.h!=
0;L=L!=null?L:100;T=T!=null?T:100;O=o.hsvToRgb({h:p,s:L,v:T});e=O.r;l=O.g;u=O.b}w=w!=null?w:255;J.call(d,ga||d)}}}};a.extend(true,d,{val:da,bind:function(V){a.isFunction(V)&&M.push(V)},unbind:function(V){if(a.isFunction(V))for(var O;(O=a.inArray(V,M))!=-1;)M.splice(O,1)},destroy:function(){M=null}});if(b)if(b.ahex!=null)da("ahex",b);else if(b.hex!=null)da((b.a!=null?"a":"")+"hex",b.a!=null?{ahex:b.hex+o.intToHex(b.a)}:b);else if(b.r!=null&&b.g!=null&&b.b!=null)da("rgb"+(b.a!=null?"a":""),b);else if(b.h!=
null&&b.s!=null&&b.v!=null)da("hsv"+(b.a!=null?"a":""),b)},ColorMethods:{hexToRgba:function(b){b=this.validateHex(b);if(b=="")return{r:null,g:null,b:null,a:null};var d="00",e="00",l="00",u="255";if(b.length==6)b+="ff";if(b.length>6){d=b.substring(0,2);e=b.substring(2,4);l=b.substring(4,6);u=b.substring(6,b.length)}else{if(b.length>4){d=b.substring(4,b.length);b=b.substring(0,4)}if(b.length>2){e=b.substring(2,b.length);b=b.substring(0,2)}if(b.length>0)l=b.substring(0,b.length)}return{r:this.hexToInt(d),
g:this.hexToInt(e),b:this.hexToInt(l),a:this.hexToInt(u)}},validateHex:function(b){if(typeof b=="object")return"";b=b.toLowerCase().replace(/[^a-f0-9]/g,"");if(b.length>8)b=b.substring(0,8);return b},rgbaToHex:function(b){return this.intToHex(b.r)+this.intToHex(b.g)+this.intToHex(b.b)+this.intToHex(b.a)},intToHex:function(b){b=(b|0).toString(16);if(b.length==1)b="0"+b;return b.toLowerCase()},hexToInt:function(b){return parseInt(b,16)},rgbToHsv:function(b){var d=b.r/255,e=b.g/255;b=b.b/255;var l={h:0,
s:0,v:0},u=0,w=0;if(d>=e&&d>=b){w=d;u=e>b?b:e}else if(e>=b&&e>=d){w=e;u=d>b?b:d}else{w=b;u=e>d?d:e}l.v=w;l.s=w?(w-u)/w:0;if(l.s){u=w-u;l.h=d==w?(e-b)/u:e==w?2+(b-d)/u:4+(d-e)/u;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(b){var d={r:0,g:0,b:0,a:100},e=b.h,l=b.s;b=b.v;if(l==0)d.r=b==0?d.g=d.b=0:d.g=d.b=b*255/100|0;else{if(e==360)e=0;e/=60;l/=100;b/=100;var u=e|0,w=e-u;e=b*(1-l);var p=b*(1-l*w);l=b*(1-l*(1-w));switch(u){case 0:d.r=b;d.g=
l;d.b=e;break;case 1:d.r=p;d.g=b;d.b=e;break;case 2:d.r=e;d.g=b;d.b=l;break;case 3:d.r=e;d.g=p;d.b=b;break;case 4:d.r=l;d.g=e;d.b=b;break;case 5:d.r=b;d.g=e;d.b=p}d.r=d.r*255|0;d.g=d.g*255|0;d.b=d.b*255|0}return d}}};var c=a.jPicker.Color,m=a.jPicker.List,o=a.jPicker.ColorMethods;a.fn.jPicker=function(b){var d=arguments;return this.each(function(){var e=this,l=a.extend(true,{},a.fn.jPicker.defaults,b);if(a(e).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,
input:a(e)}});if(a(e).val()==""){l.color.active=new c({hex:null});l.color.current=new c({hex:null})}else if(o.validateHex(a(e).val())){l.color.active=new c({hex:a(e).val(),a:l.color.active.val("a")});l.color.current=new c({hex:a(e).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(e).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>');
else l.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,w=null,p=null,L=null,T=null,M=null,J=null,da=null,V=null,O=null,fa=null,ua=null,ha=null,ca=null,ea=null,ra=null,qa=null,ba=null,S=null,U=null,sa=null,la=null,oa=null,Z=null,Aa=null,Ka=null,Ra=null,Na=null,Sa=null,Wa=function(K){var N=na.active,aa=N.val("hex"),Pa,Xa;l.color.mode=K;switch(K){case "h":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,0);Ea.call(e,T,100);La.call(e,
M,260);Ea.call(e,M,100);ab.call(e,L,"transparent");La.call(e,da,0);Ea.call(e,da,100);La.call(e,V,260);Ea.call(e,V,100);La.call(e,O,260);Ea.call(e,O,100);La.call(e,fa,260);Ea.call(e,fa,100);La.call(e,ha,260);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("s"),y:100-N.val("v")},ca);ea.val("y",360-N.val("h"),ea);break;case "s":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);
else l.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,w=null,p=null,L=null,T=null,M=null,J=null,da=null,V=null,O=null,ga=null,ta=null,ha=null,ca=null,ea=null,ra=null,pa=null,ba=null,S=null,U=null,sa=null,la=null,oa=null,Z=null,Aa=null,Ka=null,Ra=null,Na=null,Sa=null,Wa=function(K){var N=na.active,aa=N.val("hex"),Pa,Xa;l.color.mode=K;switch(K){case "h":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,0);Ea.call(e,T,100);La.call(e,
M,260);Ea.call(e,M,100);ab.call(e,L,"transparent");La.call(e,da,0);Ea.call(e,da,100);La.call(e,V,260);Ea.call(e,V,100);La.call(e,O,260);Ea.call(e,O,100);La.call(e,ga,260);Ea.call(e,ga,100);La.call(e,ha,260);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("s"),y:100-N.val("v")},ca);ea.val("y",360-N.val("h"),ea);break;case "s":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);
La.call(e,M,-520);La.call(e,da,-260);La.call(e,V,-520);La.call(e,ha,260);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("h"),y:100-N.val("v")},ca);ea.val("y",100-N.val("s"),ea);break;case "v":setTimeout(function(){ab.call(e,p,"000000");La.call(e,T,-780);La.call(e,M,260);ab.call(e,L,aa);La.call(e,da,-520);La.call(e,V,260);Ea.call(e,V,100);La.call(e,ha,260);Ea.call(e,ha,100)},0);ca.range("all",
{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("h"),y:100-N.val("s")},ca);ea.val("y",100-N.val("v"),ea);break;case "r":Pa=-1040;Xa=-780;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("b"),y:255-N.val("g")},ca);ea.val("y",255-N.val("r"),ea);break;case "g":Pa=-1560;Xa=-1820;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",
{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("b"),y:255-N.val("r")},ca);ea.val("y",255-N.val("g"),ea);break;case "b":Pa=-2080;Xa=-2860;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("r"),y:255-N.val("g")},ca);ea.val("y",255-N.val("b"),ea);break;case "a":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);La.call(e,M,-520);La.call(e,da,260);La.call(e,V,260);Ea.call(e,V,100);
La.call(e,ha,0);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("h"),y:100-N.val("v")},ca);ea.val("y",255-N.val("a"),ea);break;default:throw"Invalid Mode";}switch(K){case "s":case "v":case "a":setTimeout(function(){Ea.call(e,T,100);Ea.call(e,da,100);La.call(e,O,260);Ea.call(e,O,100);La.call(e,fa,260);Ea.call(e,fa,100)},0);break;case "r":case "g":case "b":setTimeout(function(){ab.call(e,p,
"transparent");ab.call(e,L,"transparent");Ea.call(e,da,100);Ea.call(e,T,100);La.call(e,T,Pa);La.call(e,M,Pa-260);La.call(e,da,Xa-780);La.call(e,V,Xa-520);La.call(e,O,Xa);La.call(e,fa,Xa-260);La.call(e,ha,260);Ea.call(e,ha,100)},0)}N.val("ahex")!=null&&Oa.call(e,N)},Oa=function(K,N){if(N==null||N!=ea&&N!=ca)Ga.call(e,K,N);setTimeout(function(){Cb.call(e,K);Mb.call(e,K);lb.call(e,K)},0)},Ia=function(K,N){var aa=na.active;if(!(N!=ca&&aa.val()==null)){var Pa=K.val("all");switch(l.color.mode){case "h":aa.val("sv",
La.call(e,ha,0);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("h"),y:100-N.val("v")},ca);ea.val("y",255-N.val("a"),ea);break;default:throw"Invalid Mode";}switch(K){case "s":case "v":case "a":setTimeout(function(){Ea.call(e,T,100);Ea.call(e,da,100);La.call(e,O,260);Ea.call(e,O,100);La.call(e,ga,260);Ea.call(e,ga,100)},0);break;case "r":case "g":case "b":setTimeout(function(){ab.call(e,p,
"transparent");ab.call(e,L,"transparent");Ea.call(e,da,100);Ea.call(e,T,100);La.call(e,T,Pa);La.call(e,M,Pa-260);La.call(e,da,Xa-780);La.call(e,V,Xa-520);La.call(e,O,Xa);La.call(e,ga,Xa-260);La.call(e,ha,260);Ea.call(e,ha,100)},0)}N.val("ahex")!=null&&Oa.call(e,N)},Oa=function(K,N){if(N==null||N!=ea&&N!=ca)Ga.call(e,K,N);setTimeout(function(){Cb.call(e,K);Kb.call(e,K);nb.call(e,K)},0)},Ia=function(K,N){var aa=na.active;if(!(N!=ca&&aa.val()==null)){var Pa=K.val("all");switch(l.color.mode){case "h":aa.val("sv",
{s:Pa.x,v:100-Pa.y},N);break;case "s":case "a":aa.val("hv",{h:Pa.x,v:100-Pa.y},N);break;case "v":aa.val("hs",{h:Pa.x,s:100-Pa.y},N);break;case "r":aa.val("gb",{g:255-Pa.y,b:Pa.x},N);break;case "g":aa.val("rb",{r:255-Pa.y,b:Pa.x},N);break;case "b":aa.val("rg",{r:Pa.x,g:255-Pa.y},N)}}},Qa=function(K,N){var aa=na.active;if(!(N!=ea&&aa.val()==null))switch(l.color.mode){case "h":aa.val("h",{h:360-K.val("y")},N);break;case "s":aa.val("s",{s:100-K.val("y")},N);break;case "v":aa.val("v",{v:100-K.val("y")},
N);break;case "r":aa.val("r",{r:255-K.val("y")},N);break;case "g":aa.val("g",{g:255-K.val("y")},N);break;case "b":aa.val("b",{b:255-K.val("y")},N);break;case "a":aa.val("a",255-K.val("y"),N)}},Ga=function(K,N){if(N!=ca)switch(l.color.mode){case "h":var aa=K.val("sv");ca.val("xy",{x:aa!=null?aa.s:100,y:100-(aa!=null?aa.v:100)},N);break;case "s":case "a":aa=K.val("hv");ca.val("xy",{x:aa&&aa.h||0,y:100-(aa!=null?aa.v:100)},N);break;case "v":aa=K.val("hs");ca.val("xy",{x:aa&&aa.h||0,y:100-(aa!=null?aa.s:
100)},N);break;case "r":aa=K.val("bg");ca.val("xy",{x:aa&&aa.b||0,y:255-(aa&&aa.g||0)},N);break;case "g":aa=K.val("br");ca.val("xy",{x:aa&&aa.b||0,y:255-(aa&&aa.r||0)},N);break;case "b":aa=K.val("rg");ca.val("xy",{x:aa&&aa.r||0,y:255-(aa&&aa.g||0)},N)}if(N!=ea)switch(l.color.mode){case "h":ea.val("y",360-(K.val("h")||0),N);break;case "s":aa=K.val("s");ea.val("y",100-(aa!=null?aa:100),N);break;case "v":aa=K.val("v");ea.val("y",100-(aa!=null?aa:100),N);break;case "r":ea.val("y",255-(K.val("r")||0),
N);break;case "g":ea.val("y",255-(K.val("g")||0),N);break;case "b":ea.val("y",255-(K.val("b")||0),N);break;case "a":aa=K.val("a");ea.val("y",255-(aa!=null?aa:255),N)}},Cb=function(K){try{var N=K.val("all");sa.css({backgroundColor:N&&"#"+N.hex||"transparent"});Ea.call(e,sa,N&&Math.precision(N.a*100/255,4)||0)}catch(aa){}},Mb=function(K){switch(l.color.mode){case "h":ab.call(e,p,(new c({h:K.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var N=K.val("s");Ea.call(e,M,100-(N!=null?N:100));
break;case "v":N=K.val("v");Ea.call(e,T,N!=null?N:100);break;case "r":Ea.call(e,M,Math.precision((K.val("r")||0)/255*100,4));break;case "g":Ea.call(e,M,Math.precision((K.val("g")||0)/255*100,4));break;case "b":Ea.call(e,M,Math.precision((K.val("b")||0)/255*100))}K=K.val("a");Ea.call(e,J,Math.precision((255-(K||0))*100/255,4))},lb=function(K){switch(l.color.mode){case "h":var N=K.val("a");Ea.call(e,ua,Math.precision((255-(N||0))*100/255,4));break;case "s":N=K.val("hva");var aa=new c({h:N&&N.h||0,s:100,
v:N!=null?N.v:100});ab.call(e,L,aa.val("hex"));Ea.call(e,V,100-(N!=null?N.v:100));Ea.call(e,ua,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "v":N=K.val("hsa");aa=new c({h:N&&N.h||0,s:N!=null?N.s:100,v:100});ab.call(e,L,aa.val("hex"));Ea.call(e,ua,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "r":case "g":case "b":aa=N=0;K=K.val("rgba");if(l.color.mode=="r"){N=K&&K.b||0;aa=K&&K.g||0}else if(l.color.mode=="g"){N=K&&K.b||0;aa=K&&K.r||0}else if(l.color.mode=="b"){N=K&&K.r||0;aa=K&&
K.g||0}var Pa=aa>N?N:aa;Ea.call(e,V,N>aa?Math.precision((N-aa)/(255-aa)*100,4):0);Ea.call(e,O,aa>N?Math.precision((aa-N)/(255-N)*100,4):0);Ea.call(e,fa,Math.precision(Pa/255*100,4));Ea.call(e,ua,Math.precision((255-(K&&K.a||0))*100/255,4));break;case "a":N=K.val("a");ab.call(e,L,K.val("hex")||"000000");Ea.call(e,ua,N!=null?0:100);Ea.call(e,ha,N!=null?100:0)}},ab=function(K,N){K.css({backgroundColor:N&&N.length==6&&"#"+N||"transparent"})},Ya=function(K,N){if(u&&(N.indexOf("AlphaBar.png")!=-1||N.indexOf("Bars.png")!=
N);break;case "g":ea.val("y",255-(K.val("g")||0),N);break;case "b":ea.val("y",255-(K.val("b")||0),N);break;case "a":aa=K.val("a");ea.val("y",255-(aa!=null?aa:255),N)}},Cb=function(K){try{var N=K.val("all");sa.css({backgroundColor:N&&"#"+N.hex||"transparent"});Ea.call(e,sa,N&&Math.precision(N.a*100/255,4)||0)}catch(aa){}},Kb=function(K){switch(l.color.mode){case "h":ab.call(e,p,(new c({h:K.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var N=K.val("s");Ea.call(e,M,100-(N!=null?N:100));
break;case "v":N=K.val("v");Ea.call(e,T,N!=null?N:100);break;case "r":Ea.call(e,M,Math.precision((K.val("r")||0)/255*100,4));break;case "g":Ea.call(e,M,Math.precision((K.val("g")||0)/255*100,4));break;case "b":Ea.call(e,M,Math.precision((K.val("b")||0)/255*100))}K=K.val("a");Ea.call(e,J,Math.precision((255-(K||0))*100/255,4))},nb=function(K){switch(l.color.mode){case "h":var N=K.val("a");Ea.call(e,ta,Math.precision((255-(N||0))*100/255,4));break;case "s":N=K.val("hva");var aa=new c({h:N&&N.h||0,s:100,
v:N!=null?N.v:100});ab.call(e,L,aa.val("hex"));Ea.call(e,V,100-(N!=null?N.v:100));Ea.call(e,ta,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "v":N=K.val("hsa");aa=new c({h:N&&N.h||0,s:N!=null?N.s:100,v:100});ab.call(e,L,aa.val("hex"));Ea.call(e,ta,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "r":case "g":case "b":aa=N=0;K=K.val("rgba");if(l.color.mode=="r"){N=K&&K.b||0;aa=K&&K.g||0}else if(l.color.mode=="g"){N=K&&K.b||0;aa=K&&K.r||0}else if(l.color.mode=="b"){N=K&&K.r||0;aa=K&&
K.g||0}var Pa=aa>N?N:aa;Ea.call(e,V,N>aa?Math.precision((N-aa)/(255-aa)*100,4):0);Ea.call(e,O,aa>N?Math.precision((aa-N)/(255-N)*100,4):0);Ea.call(e,ga,Math.precision(Pa/255*100,4));Ea.call(e,ta,Math.precision((255-(K&&K.a||0))*100/255,4));break;case "a":N=K.val("a");ab.call(e,L,K.val("hex")||"000000");Ea.call(e,ta,N!=null?0:100);Ea.call(e,ha,N!=null?100:0)}},ab=function(K,N){K.css({backgroundColor:N&&N.length==6&&"#"+N||"transparent"})},Ya=function(K,N){if(u&&(N.indexOf("AlphaBar.png")!=-1||N.indexOf("Bars.png")!=
-1||N.indexOf("Maps.png")!=-1)){K.attr("pngSrc",N);K.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+N+"', sizingMethod='scale')"})}else K.css({backgroundImage:"url('"+N+"')"})},La=function(K,N){K.css({top:N+"px"})},Ea=function(K,N){K.css({visibility:N>0?"visible":"hidden"});if(N>0&&N<100)if(u){var aa=K.attr("pngSrc");aa!=null&&(aa.indexOf("AlphaBar.png")!=-1||aa.indexOf("Bars.png")!=-1||aa.indexOf("Maps.png")!=-1)?K.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
aa+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+N+")"}):K.css({opacity:Math.precision(N/100,4)})}else K.css({opacity:Math.precision(N/100,4)});else if(N==0||N==100)if(u){aa=K.attr("pngSrc");aa!=null&&(aa.indexOf("AlphaBar.png")!=-1||aa.indexOf("Bars.png")!=-1||aa.indexOf("Maps.png")!=-1)?K.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aa+"', sizingMethod='scale')"}):K.css({opacity:""})}else K.css({opacity:""})},ob=function(){na.active.val("ahex",
na.current.val("ahex"))},Ja=function(){na.current.val("ahex",na.active.val("ahex"))},Za=function(K){a(this).parents("tbody:first").find('input:radio[value!="'+K.target.value+'"]').removeAttr("checked");Wa.call(e,K.target.value)},Ma=function(){ob.call(e)},mb=function(){ob.call(e);l.window.expandable&&Ob.call(e);a.isFunction(Gb)&&Gb.call(e,na.active,Z)},zb=function(){Ja.call(e);l.window.expandable&&Ob.call(e);a.isFunction(sb)&&sb.call(e,na.active,oa)},eb=function(){Hb.call(e)},gb=function(K){var N=
K.val("hex");la.css({backgroundColor:N&&"#"+N||"transparent"});Ea.call(e,la,Math.precision((K.val("a")||0)*100/255,4))},Nb=function(K){var N=K.val("hex");K=K.val("va");Ka.css({backgroundColor:N&&"#"+N||"transparent"});Ea.call(e,Ra,Math.precision((255-(K&&K.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:N&&"#"+N||"transparent",color:K==null||K.v>75?"#000000":"#ffffff"})},xa=function(K){qa=parseInt(w.css("left"));ba=parseInt(w.css("top"));S=
K.pageX;U=K.pageY;a(document).bind("mousemove",wb).bind("mouseup",qb);K.preventDefault()},wb=function(K){w.css({left:qa-(S-K.pageX)+"px",top:ba-(U-K.pageY)+"px"});l.window.expandable&&!a.support.boxModel&&w.prev().css({left:w.css("left"),top:w.css("top")});K.stopPropagation();K.preventDefault();return false},qb=function(K){a(document).unbind("mousemove",wb).unbind("mouseup",qb);K.stopPropagation();K.preventDefault();return false},Ab=function(K){K.preventDefault();K.stopPropagation();na.active.val("ahex",
a(this).attr("title")||null,K.target);return false},sb=a.isFunction(d[1])&&d[1]||null,kb=a.isFunction(d[2])&&d[2]||null,Gb=a.isFunction(d[3])&&d[3]||null,Hb=function(){na.current.val("ahex",na.active.val("ahex"));var K=function(){if(!(!l.window.expandable||a.support.boxModel)){var N=w.find("table:first");w.before("<iframe/>");w.prev().css({width:N.width(),height:w.height(),opacity:0,position:"absolute",left:w.css("left"),top:w.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});
w.css({zIndex:20})}switch(l.window.effects.type){case "fade":w.fadeIn(l.window.effects.speed.show,K);break;case "slide":w.slideDown(l.window.effects.speed.show,K);break;default:w.show(l.window.effects.speed.show,K)}},Ob=function(){var K=function(){l.window.expandable&&w.css({zIndex:10});!l.window.expandable||a.support.boxModel||w.prev().remove()};switch(l.window.effects.type){case "fade":w.fadeOut(l.window.effects.speed.hide,K);break;case "slide":w.slideUp(l.window.effects.speed.hide,K);break;default:w.hide(l.window.effects.speed.hide,
K)}},Pb=function(){var K=l.window,N=K.expandable?a(e).next().find(".Container:first"):null;w=K.expandable?a("<div/>"):a(e);w.addClass("jPicker Container");K.expandable&&w.hide();w.get(0).onselectstart=function($a){if($a.target.nodeName.toLowerCase()!=="input")return false};var aa=na.active.val("all");if(K.alphaPrecision<0)K.alphaPrecision=0;else if(K.alphaPrecision>2)K.alphaPrecision=2;var Pa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(K.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':
aa+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+N+")"}):K.css({opacity:Math.precision(N/100,4)})}else K.css({opacity:Math.precision(N/100,4)});else if(N==0||N==100)if(u){aa=K.attr("pngSrc");aa!=null&&(aa.indexOf("AlphaBar.png")!=-1||aa.indexOf("Bars.png")!=-1||aa.indexOf("Maps.png")!=-1)?K.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aa+"', sizingMethod='scale')"}):K.css({opacity:""})}else K.css({opacity:""})},qb=function(){na.active.val("ahex",
na.current.val("ahex"))},Ja=function(){na.current.val("ahex",na.active.val("ahex"))},Za=function(K){a(this).parents("tbody:first").find('input:radio[value!="'+K.target.value+'"]').removeAttr("checked");Wa.call(e,K.target.value)},Ma=function(){qb.call(e)},ob=function(){qb.call(e);l.window.expandable&&Mb.call(e);a.isFunction(Gb)&&Gb.call(e,na.active,Z)},xb=function(){Ja.call(e);l.window.expandable&&Mb.call(e);a.isFunction(sb)&&sb.call(e,na.active,oa)},fb=function(){Hb.call(e)},ib=function(K){var N=
K.val("hex");la.css({backgroundColor:N&&"#"+N||"transparent"});Ea.call(e,la,Math.precision((K.val("a")||0)*100/255,4))},Lb=function(K){var N=K.val("hex");K=K.val("va");Ka.css({backgroundColor:N&&"#"+N||"transparent"});Ea.call(e,Ra,Math.precision((255-(K&&K.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:N&&"#"+N||"transparent",color:K==null||K.v>75?"#000000":"#ffffff"})},xa=function(K){pa=parseInt(w.css("left"));ba=parseInt(w.css("top"));S=
K.pageX;U=K.pageY;a(document).bind("mousemove",ub).bind("mouseup",rb);K.preventDefault()},ub=function(K){w.css({left:pa-(S-K.pageX)+"px",top:ba-(U-K.pageY)+"px"});l.window.expandable&&!a.support.boxModel&&w.prev().css({left:w.css("left"),top:w.css("top")});K.stopPropagation();K.preventDefault();return false},rb=function(K){a(document).unbind("mousemove",ub).unbind("mouseup",rb);K.stopPropagation();K.preventDefault();return false},yb=function(K){K.preventDefault();K.stopPropagation();na.active.val("ahex",
a(this).attr("title")||null,K.target);return false},sb=a.isFunction(d[1])&&d[1]||null,mb=a.isFunction(d[2])&&d[2]||null,Gb=a.isFunction(d[3])&&d[3]||null,Hb=function(){na.current.val("ahex",na.active.val("ahex"));var K=function(){if(!(!l.window.expandable||a.support.boxModel)){var N=w.find("table:first");w.before("<iframe/>");w.prev().css({width:N.width(),height:w.height(),opacity:0,position:"absolute",left:w.css("left"),top:w.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});
w.css({zIndex:20})}switch(l.window.effects.type){case "fade":w.fadeIn(l.window.effects.speed.show,K);break;case "slide":w.slideDown(l.window.effects.speed.show,K);break;default:w.show(l.window.effects.speed.show,K)}},Mb=function(){var K=function(){l.window.expandable&&w.css({zIndex:10});!l.window.expandable||a.support.boxModel||w.prev().remove()};switch(l.window.effects.type){case "fade":w.fadeOut(l.window.effects.speed.hide,K);break;case "slide":w.slideUp(l.window.effects.speed.hide,K);break;default:w.hide(l.window.effects.speed.hide,
K)}},Nb=function(){var K=l.window,N=K.expandable?a(e).next().find(".Container:first"):null;w=K.expandable?a("<div/>"):a(e);w.addClass("jPicker Container");K.expandable&&w.hide();w.get(0).onselectstart=function($a){if($a.target.nodeName.toLowerCase()!=="input")return false};var aa=na.active.val("all");if(K.alphaPrecision<0)K.alphaPrecision=0;else if(K.alphaPrecision>2)K.alphaPrecision=2;var Pa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(K.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':
"")+'<tr><td rowspan="9"><h2 class="Title">'+(K.title||Y.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+ma.clientPath+ma.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+
ma.clientPath+ma.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+Y.text.newColor+'<div class="color_preview"><span class="Active" title="'+Y.tooltips.colors.newColor+'">&nbsp;</span><span class="Current" title="'+Y.tooltips.colors.currentColor+'">&nbsp;</span></div></div>'+Y.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+Y.text.ok+'" title="'+Y.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+
Y.text.cancel+'" title="'+Y.tooltips.buttons.cancel+'"/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="'+Y.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="'+(aa!=null?aa.h:"")+'" title="'+Y.tooltips.hue.textbox+'"/>&nbsp;\u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+Y.tooltips.saturation.radio+'"><input type="radio" value="s"'+
@ -660,15 +662,15 @@ Y.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label
"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(K.alphaSupport?'<input type="text" maxlength="'+(3+K.alphaPrecision)+'" value="'+(aa!=null?Math.precision(aa.a*100/255,K.alphaPrecision):"")+'" title="'+Y.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+Y.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(aa!=null?aa.hex:"")+'"/></label>'+(K.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+
(aa!=null?aa.ahex.substring(6):"")+'" title="'+Y.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"</tr></tbody></table>";if(K.expandable){w.html(Pa);a(document.body).children("div.jPicker.Container").length==0?a(document.body).prepend(w):a(document.body).children("div.jPicker.Container:last").after(w);w.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});w.css({zIndex:20})});w.css({left:K.position.x=="left"?N.offset().left-530-(K.position.y=="center"?25:0)+"px":K.position.x==
"center"?N.offset().left-260+"px":K.position.x=="right"?N.offset().left-10+(K.position.y=="center"?25:0)+"px":K.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":N.offset().left+parseInt(K.position.x)+"px",position:"absolute",top:K.position.y=="top"?N.offset().top-312+"px":K.position.y=="center"?N.offset().top-156+"px":K.position.y=="bottom"?N.offset().top+25+"px":N.offset().top+parseInt(K.position.y)+"px"})}else{w=a(e);w.html(Pa)}Pa=w.find("tbody:first");p=Pa.find("div.Map:first");L=Pa.find("div.Bar:first");
var Xa=p.find("span"),fb=L.find("span");T=Xa.filter(".Map1:first");M=Xa.filter(".Map2:first");J=Xa.filter(".Map3:first");da=fb.filter(".Map1:first");V=fb.filter(".Map2:first");O=fb.filter(".Map3:first");fa=fb.filter(".Map4:first");ua=fb.filter(".Map5:first");ha=fb.filter(".Map6:first");ca=new n(p,{map:{width:ma.colorMap.width,height:ma.colorMap.height},arrow:{image:ma.clientPath+ma.colorMap.arrow.file,width:ma.colorMap.arrow.width,height:ma.colorMap.arrow.height}});ca.bind(Ia);ea=new n(L,{map:{width:ma.colorBar.width,
height:ma.colorBar.height},arrow:{image:ma.clientPath+ma.colorBar.arrow.file,width:ma.colorBar.arrow.width,height:ma.colorBar.arrow.height}});ea.bind(Qa);ra=new f(Pa,na.active,K.expandable&&K.bindToInput?K.input:null,K.alphaPrecision);Xa=aa!=null?aa.hex:null;var nb=Pa.find(".Preview");fb=Pa.find(".Button");sa=nb.find(".Active:first").css({backgroundColor:Xa&&"#"+Xa||"transparent"});la=nb.find(".Current:first").css({backgroundColor:Xa&&"#"+Xa||"transparent"}).bind("click",Ma);Ea.call(e,la,Math.precision(na.current.val("a")*
100)/255,4);oa=fb.find(".Ok:first").bind("click",zb);Z=fb.find(".Cancel:first").bind("click",mb);Aa=fb.find(".Grid:first");setTimeout(function(){Ya.call(e,T,ma.clientPath+"Maps.png");Ya.call(e,M,ma.clientPath+"Maps.png");Ya.call(e,J,ma.clientPath+"map-opacity.png");Ya.call(e,da,ma.clientPath+"Bars.png");Ya.call(e,V,ma.clientPath+"Bars.png");Ya.call(e,O,ma.clientPath+"Bars.png");Ya.call(e,fa,ma.clientPath+"Bars.png");Ya.call(e,ua,ma.clientPath+"bar-opacity.png");Ya.call(e,ha,ma.clientPath+"AlphaBar.png");
Ya.call(e,nb.find("div:last"),ma.clientPath+"preview-opacity.png")},0);Pa.find("td.Radio input").bind("click",Za);if(na.quickList&&na.quickList.length>0){fb="";for(i=0;i<na.quickList.length;i++){if((typeof na.quickList[i]).toString().toLowerCase()=="string")na.quickList[i]=new c({hex:na.quickList[i]});var Db=na.quickList[i].val("a"),cb=na.quickList[i].val("ahex");if(!K.alphaSupport&&cb)cb=cb.substring(0,6)+"ff";var Fb=na.quickList[i].val("hex");fb+='<span class="QuickColor"'+(cb&&' title="#'+cb+'"'||
"")+' style="background-color:'+(Fb&&"#"+Fb||"")+";"+(Fb?"":"background-image:url("+ma.clientPath+"NoColor.png)")+(K.alphaSupport&&Db&&Db<255?";opacity:"+Math.precision(Db/255,4)+";filter:Alpha(opacity="+Math.precision(Db/2.55,4)+")":"")+'">&nbsp;</span>'}Ya.call(e,Aa,ma.clientPath+"bar-opacity.png");Aa.html(fb);Aa.find(".QuickColor").click(Ab)}Wa.call(e,l.color.mode);na.active.bind(Oa);a.isFunction(kb)&&na.active.bind(kb);na.current.bind(gb);if(K.expandable){e.icon=N.parents(".Icon:first");Ka=e.icon.find(".Color:first").css({backgroundColor:Xa&&
"#"+Xa||"transparent"});Ra=e.icon.find(".Alpha:first");Ya.call(e,Ra,ma.clientPath+"bar-opacity.png");Ea.call(e,Ra,Math.precision((255-(aa!=null?aa.a:0))*100/255,4));Na=e.icon.find(".Image:first").css({backgroundImage:"url('"+ma.clientPath+ma.picker.file+"')"}).bind("click",eb);if(K.bindToInput&&K.updateInputColor)K.input.css({backgroundColor:Xa&&"#"+Xa||"transparent",color:aa==null||aa.v>75?"#000000":"#ffffff"});Sa=Pa.find(".Move:first").bind("mousedown",xa);na.active.bind(Nb)}else Hb.call(e)},ma=
var Xa=p.find("span"),hb=L.find("span");T=Xa.filter(".Map1:first");M=Xa.filter(".Map2:first");J=Xa.filter(".Map3:first");da=hb.filter(".Map1:first");V=hb.filter(".Map2:first");O=hb.filter(".Map3:first");ga=hb.filter(".Map4:first");ta=hb.filter(".Map5:first");ha=hb.filter(".Map6:first");ca=new n(p,{map:{width:ma.colorMap.width,height:ma.colorMap.height},arrow:{image:ma.clientPath+ma.colorMap.arrow.file,width:ma.colorMap.arrow.width,height:ma.colorMap.arrow.height}});ca.bind(Ia);ea=new n(L,{map:{width:ma.colorBar.width,
height:ma.colorBar.height},arrow:{image:ma.clientPath+ma.colorBar.arrow.file,width:ma.colorBar.arrow.width,height:ma.colorBar.arrow.height}});ea.bind(Qa);ra=new f(Pa,na.active,K.expandable&&K.bindToInput?K.input:null,K.alphaPrecision);Xa=aa!=null?aa.hex:null;var pb=Pa.find(".Preview");hb=Pa.find(".Button");sa=pb.find(".Active:first").css({backgroundColor:Xa&&"#"+Xa||"transparent"});la=pb.find(".Current:first").css({backgroundColor:Xa&&"#"+Xa||"transparent"}).bind("click",Ma);Ea.call(e,la,Math.precision(na.current.val("a")*
100)/255,4);oa=hb.find(".Ok:first").bind("click",xb);Z=hb.find(".Cancel:first").bind("click",ob);Aa=hb.find(".Grid:first");setTimeout(function(){Ya.call(e,T,ma.clientPath+"Maps.png");Ya.call(e,M,ma.clientPath+"Maps.png");Ya.call(e,J,ma.clientPath+"map-opacity.png");Ya.call(e,da,ma.clientPath+"Bars.png");Ya.call(e,V,ma.clientPath+"Bars.png");Ya.call(e,O,ma.clientPath+"Bars.png");Ya.call(e,ga,ma.clientPath+"Bars.png");Ya.call(e,ta,ma.clientPath+"bar-opacity.png");Ya.call(e,ha,ma.clientPath+"AlphaBar.png");
Ya.call(e,pb.find("div:last"),ma.clientPath+"preview-opacity.png")},0);Pa.find("td.Radio input").bind("click",Za);if(na.quickList&&na.quickList.length>0){hb="";for(i=0;i<na.quickList.length;i++){if((typeof na.quickList[i]).toString().toLowerCase()=="string")na.quickList[i]=new c({hex:na.quickList[i]});var Db=na.quickList[i].val("a"),cb=na.quickList[i].val("ahex");if(!K.alphaSupport&&cb)cb=cb.substring(0,6)+"ff";var Eb=na.quickList[i].val("hex");hb+='<span class="QuickColor"'+(cb&&' title="#'+cb+'"'||
"")+' style="background-color:'+(Eb&&"#"+Eb||"")+";"+(Eb?"":"background-image:url("+ma.clientPath+"NoColor.png)")+(K.alphaSupport&&Db&&Db<255?";opacity:"+Math.precision(Db/255,4)+";filter:Alpha(opacity="+Math.precision(Db/2.55,4)+")":"")+'">&nbsp;</span>'}Ya.call(e,Aa,ma.clientPath+"bar-opacity.png");Aa.html(hb);Aa.find(".QuickColor").click(yb)}Wa.call(e,l.color.mode);na.active.bind(Oa);a.isFunction(mb)&&na.active.bind(mb);na.current.bind(ib);if(K.expandable){e.icon=N.parents(".Icon:first");Ka=e.icon.find(".Color:first").css({backgroundColor:Xa&&
"#"+Xa||"transparent"});Ra=e.icon.find(".Alpha:first");Ya.call(e,Ra,ma.clientPath+"bar-opacity.png");Ea.call(e,Ra,Math.precision((255-(aa!=null?aa.a:0))*100/255,4));Na=e.icon.find(".Image:first").css({backgroundImage:"url('"+ma.clientPath+ma.picker.file+"')"}).bind("click",fb);if(K.bindToInput&&K.updateInputColor)K.input.css({backgroundColor:Xa&&"#"+Xa||"transparent",color:aa==null||aa.v>75?"#000000":"#ffffff"});Sa=Pa.find(".Move:first").bind("mousedown",xa);na.active.bind(Lb)}else Hb.call(e)},ma=
l.images,Y=l.localization,na={active:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({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 c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):
new c({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,e,{commitCallback:sb,liveCallback:kb,cancelCallback:Gb,color:na,show:Hb,hide:Ob,destroy:function(){w.find("td.Radio input").unbind("click",Za);la.unbind("click",Ma);Z.unbind("click",mb);oa.unbind("click",zb);if(l.window.expandable){Na.unbind("click",eb);Sa.unbind("mousedown",xa);e.icon=null}w.find(".QuickColor").unbind("click",
Ab);ha=ua=fa=O=V=da=J=M=T=L=p=null;ca.destroy();ca=null;ea.destroy();ea=null;ra.destroy();kb=Gb=sb=Aa=Z=oa=la=sa=ra=null;w.html("");for(i=0;i<m.length;i++)m[i]==e&&m.splice(i,1)}});m.push(e);setTimeout(function(){Pb.call(e)},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 c({ahex:"#ffcc00ff"}),
new c({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,e,{commitCallback:sb,liveCallback:mb,cancelCallback:Gb,color:na,show:Hb,hide:Mb,destroy:function(){w.find("td.Radio input").unbind("click",Za);la.unbind("click",Ma);Z.unbind("click",ob);oa.unbind("click",xb);if(l.window.expandable){Na.unbind("click",fb);Sa.unbind("mousedown",xa);e.icon=null}w.find(".QuickColor").unbind("click",
yb);ha=ta=ga=O=V=da=J=M=T=L=p=null;ca.destroy();ca=null;ea.destroy();ea=null;ra.destroy();mb=Gb=sb=Aa=Z=oa=la=sa=ra=null;w.html("");for(i=0;i<m.length;i++)m[i]==e&&m.splice(i,1)}});m.push(e);setTimeout(function(){Nb.call(e)},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 c({ahex:"#ffcc00ff"}),
quickList:[new c({h:360,s:33,v:100}),new c({h:360,s:66,v:100}),new c({h:360,s:100,v:100}),new c({h:360,s:100,v:75}),new c({h:360,s:100,v:50}),new c({h:180,s:0,v:100}),new c({h:30,s:33,v:100}),new c({h:30,s:66,v:100}),new c({h:30,s:100,v:100}),new c({h:30,s:100,v:75}),new c({h:30,s:100,v:50}),new c({h:180,s:0,v:90}),new c({h:60,s:33,v:100}),new c({h:60,s:66,v:100}),new c({h:60,s:100,v:100}),new c({h:60,s:100,v:75}),new c({h:60,s:100,v:50}),new c({h:180,s:0,v:80}),new c({h:90,s:33,v:100}),new c({h:90,
s:66,v:100}),new c({h:90,s:100,v:100}),new c({h:90,s:100,v:75}),new c({h:90,s:100,v:50}),new c({h:180,s:0,v:70}),new c({h:120,s:33,v:100}),new c({h:120,s:66,v:100}),new c({h:120,s:100,v:100}),new c({h:120,s:100,v:75}),new c({h:120,s:100,v:50}),new c({h:180,s:0,v:60}),new c({h:150,s:33,v:100}),new c({h:150,s:66,v:100}),new c({h:150,s:100,v:100}),new c({h:150,s:100,v:75}),new c({h:150,s:100,v:50}),new c({h:180,s:0,v:50}),new c({h:180,s:33,v:100}),new c({h:180,s:66,v:100}),new c({h:180,s:100,v:100}),
new c({h:180,s:100,v:75}),new c({h:180,s:100,v:50}),new c({h:180,s:0,v:40}),new c({h:210,s:33,v:100}),new c({h:210,s:66,v:100}),new c({h:210,s:100,v:100}),new c({h:210,s:100,v:75}),new c({h:210,s:100,v:50}),new c({h:180,s:0,v:30}),new c({h:240,s:33,v:100}),new c({h:240,s:66,v:100}),new c({h:240,s:100,v:100}),new c({h:240,s:100,v:75}),new c({h:240,s:100,v:50}),new c({h:180,s:0,v:20}),new c({h:270,s:33,v:100}),new c({h:270,s:66,v:100}),new c({h:270,s:100,v:100}),new c({h:270,s:100,v:75}),new c({h:270,

View File

@ -1,8 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg">
<g id="tool_shapelib">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="#2f2f2c" d="M0,0v24h24V0H0z M18.649,22.23L12,18.736L5.352,22.23l1.27-7.402L1.243,9.585l7.433-1.081L12,1.77
l3.325,6.735l7.432,1.081l-5.377,5.243L18.649,22.23z"/>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M20.328,24.166l-6.891-3.622l-6.891,3.622l1.316-7.672L2.289,11.06l7.704-1.121
l3.445-6.979l3.447,6.98l7.702,1.121l-5.573,5.434L20.328,24.166z"/>
</svg>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 395 B

View File

@ -5,7 +5,11 @@
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="27px" height="27px"
>
<path d="M 6.0622 22.6906 L 17.3661 11.4659 L 15.6438 9.756 L 4.3402 20.9804 C 4.1126 22.0362 3.5914 23.0909 3.0734 23.9488 C 3.9369 23.4341 4.9996 22.9165 6.0622 22.6906 ZM 27 27 L 27 3.065 C 26.9997 4.5607 25.2111 6.3359 25.2111 6.3359 L 22.3407 9.1861 L 22.5324 9.3765 C 23.0605 9.9007 23.0608 10.7515 22.5324 11.2762 L 20.8101 12.9861 C 20.2822 13.5104 19.4248 13.5104 18.8972 12.9861 L 18.5143 12.6058 L 6.8496 24.1882 L 6.5935 24.2307 C 4.5412 24.57 2.2243 26.5011 2.2007 26.5206 L 1.6309 27 L 27 27 ZM 0 27 L 1.6309 27 L 1.1024 26.4753 L 0.5283 25.9053 L 0 25.3808 L 0 27 ZM 0 0 L 0 25.3808 L 0.4832 24.8147 C 0.502 24.792 2.4485 22.4828 2.7891 20.4531 L 2.8317 20.1984 L 14.496 8.6164 L 14.1134 8.2364 C 13.5853 7.7121 13.5853 6.8612 14.1134 6.3364 L 15.8353 4.6266 C 16.3638 4.102 17.2206 4.102 17.7488 4.6266 L 20.6189 1.7766 C 20.6189 1.7766 23.4892 -1.0736 25.0202 0.4462 L 25.7857 1.2062 L 26.5505 1.9661 C 26.8729 2.2862 27.0001 2.666 27 3.065 L 27 0 L 0 0 Z" fill="#2f2f2c"/>
<path fill="#2F2F2C" d="M16.867,11.729l-1.5-1.49l-9.845,9.777c-0.198,0.919-0.653,1.838-1.104,2.585
c0.752-0.448,1.678-0.899,2.604-1.096L16.867,11.729z"/>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M2.702,24.801l-0.5-0.496l-0.46-0.457l0.421-0.493c0.016-0.02,1.711-2.031,2.008-3.799
l0.037-0.222L14.367,9.247l-0.333-0.331c-0.459-0.457-0.459-1.198,0-1.655l1.5-1.489c0.46-0.457,1.206-0.457,1.667,0L19.7,3.289c0,0,2.5-2.482,3.833-1.158L24.2,2.792l0.667,0.662c0.28,0.278,0.391,0.609,0.391,0.957c0,1.302-1.558,2.849-1.558,2.849
l-2.5,2.482l0.167,0.166c0.46,0.457,0.46,1.197,0,1.655l-1.5,1.489c-0.46,0.456-1.207,0.456-1.667,0l-0.333-0.332L7.708,22.809l-0.223,0.037c-1.787,0.296-3.805,1.978-3.826,1.995l-0.496,0.417L2.702,24.801z"/>
</svg>
</g>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 718 B

After

Width:  |  Height:  |  Size: 364 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="27px" height="27px" viewBox="0 0 27 27" enable-background="new 0 0 27 27" xml:space="preserve">
<g>
<path fill="#2F2F2C" d="M16.867,11.729l-1.5-1.49l-9.845,9.777c-0.198,0.919-0.653,1.838-1.104,2.585
c0.752-0.448,1.678-0.899,2.604-1.096L16.867,11.729z"/>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M2.702,24.801l-0.5-0.496l-0.46-0.457l0.421-0.493c0.016-0.02,1.711-2.031,2.008-3.799
l0.037-0.222L14.367,9.247l-0.333-0.331c-0.459-0.457-0.459-1.198,0-1.655l1.5-1.489c0.46-0.457,1.206-0.457,1.667,0L19.7,3.289
c0,0,2.5-2.482,3.833-1.158L24.2,2.792l0.667,0.662c0.28,0.278,0.391,0.609,0.391,0.957c0,1.302-1.558,2.849-1.558,2.849
l-2.5,2.482l0.167,0.166c0.46,0.457,0.46,1.197,0,1.655l-1.5,1.489c-0.46,0.456-1.207,0.456-1.667,0l-0.333-0.332L7.708,22.809
l-0.223,0.037c-1.787,0.296-3.805,1.978-3.826,1.995l-0.496,0.417L2.702,24.801z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="27px" height="27px" viewBox="0 0 27 27" enable-background="new 0 0 27 27" xml:space="preserve">
<g>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M20.328,24.166l-6.891-3.622l-6.891,3.622l1.316-7.672L2.289,11.06l7.704-1.121
l3.445-6.979l3.447,6.98l7.702,1.121l-5.573,5.434L20.328,24.166z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 245 B

View File

@ -1,277 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
id="svg5741"
sodipodi:version="0.32"
inkscape:version="0.44+devel"
version="1.0"
sodipodi:docbase="/home/andreas/project/inkscape/22x22/actions"
sodipodi:docname="align-bottom-vertical.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/andreas/project/inkscape/22x22/actions/align-bottom-vertical.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:modified="true">
<defs
id="defs5743">
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2968"
id="linearGradient6938"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2974"
id="linearGradient6936"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2986"
id="linearGradient6934"
gradientUnits="userSpaceOnUse"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2980"
id="linearGradient6932"
gradientUnits="userSpaceOnUse"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
<linearGradient
id="linearGradient2968"
inkscape:collect="always">
<stop
id="stop2970"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2972"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2968"
id="linearGradient6930"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2974"
inkscape:collect="always">
<stop
id="stop2976"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2978"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2974"
id="linearGradient6928"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
<linearGradient
id="linearGradient2986"
inkscape:collect="always">
<stop
id="stop2988"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2990"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2986"
id="linearGradient6926"
gradientUnits="userSpaceOnUse"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2980"
inkscape:collect="always">
<stop
id="stop2982"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2984"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2980"
id="linearGradient6924"
gradientUnits="userSpaceOnUse"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.197802"
inkscape:cx="8"
inkscape:cy="9.8019802"
inkscape:current-layer="g6828"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
width="22px"
height="22px"
inkscape:window-width="1078"
inkscape:window-height="786"
inkscape:window-x="243"
inkscape:window-y="71" />
<metadata
id="metadata5746">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
style="display:inline"
id="g6828"
transform="translate(30.00011,90.000366)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<g
style="display:inline"
id="g6838"
transform="translate(-30.00009,-1.0002798)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
style="fill:#d3d7cf;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect3052"
width="12"
height="7"
x="69.500122"
y="12.5"
transform="matrix(0,-1,1,0,0,0)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect3054"
width="10"
height="5.0000305"
x="70.500122"
y="13.5"
transform="matrix(0,-1,1,0,0,0)"
rx="0"
ry="0"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<g
id="g3056"
transform="translate(-127,-559)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
transform="matrix(0,-1,1,0,0,0)"
y="129.49626"
x="-489.49979"
height="7.0035982"
width="17.999748"
id="rect3058"
style="color:#000000;fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.00024867;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="130.50006"
x="-488.50009"
height="4.9998937"
width="15.999757"
id="rect3060"
style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00024891;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
rx="0"
ry="0" />
</g>
<g
id="g3294"
transform="translate(-187,-560)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
y="489.5"
x="196.49989"
height="1.9999999"
width="3.0000916"
id="rect3296"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
style="fill:url(#linearGradient6932);fill-opacity:1;stroke:url(#linearGradient6934);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dashoffset:0;stroke-opacity:1"
d="M 197.49998,491.5 L 186.49989,491.5 L 186.49989,489.5 L 197.49998,489.5"
id="path3298"
sodipodi:nodetypes="cccc" />
<path
style="fill:url(#linearGradient6936);fill-opacity:1;stroke:url(#linearGradient6938);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dashoffset:0;stroke-opacity:1"
d="M 198.49989,489.5 L 209.49998,489.5 L 209.49998,491.5 L 198.49989,491.5"
id="path3300"
sodipodi:nodetypes="cccc" />
</g>
</g>
</g>
</g>
</svg>
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="Untitled-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <path d="M 1 25 L 5 25 L 5 13 L 11 13 L 11 25 L 16 25 L 16 7 L 22 7 L 22 25 L 26 25 L 26 26 L 1 26 L 1 25 ZM 0 0 L 0 27 L 27 27 L 27 0 L 0 0 Z" fill="#000000"/> </svg>

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 245 B

View File

@ -1,252 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
id="svg10958"
sodipodi:version="0.32"
inkscape:version="0.44+devel"
version="1.0"
sodipodi:docbase="/home/andreas/project/inkscape/22x22/actions"
sodipodi:docname="align-horisontal-center.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/andreas/project/inkscape/22x22/actions/align-horisontal-center.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:modified="true">
<defs
id="defs10960">
<linearGradient
id="linearGradient2968"
inkscape:collect="always">
<stop
id="stop2970"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2972"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2968"
id="linearGradient4708"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-395.9999,-981)"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2974"
inkscape:collect="always">
<stop
id="stop2976"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2978"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2974"
id="linearGradient4706"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-395.9999,-981)"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
<linearGradient
id="linearGradient2986"
inkscape:collect="always">
<stop
id="stop2988"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2990"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2986"
id="linearGradient4704"
gradientUnits="userSpaceOnUse"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2980"
inkscape:collect="always">
<stop
id="stop2982"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2984"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2980"
id="linearGradient4702"
gradientUnits="userSpaceOnUse"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.197802"
inkscape:cx="16"
inkscape:cy="11.460711"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
width="22px"
height="22px"
inkscape:window-width="797"
inkscape:window-height="628"
inkscape:window-x="0"
inkscape:window-y="47" />
<metadata
id="metadata10963">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
style="display:inline"
id="g4044"
transform="matrix(0,-1,1,0,-59.999911,-168.00002)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
style="fill:#d3d7cf;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
id="rect3851"
width="12"
height="7"
x="-76.499878"
y="-177.5"
transform="matrix(0,-1,1,0,0,0)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<g
transform="translate(-317,-410)"
id="g3853"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
style="display:inline">
<rect
transform="matrix(0,-1,1,0,0,0)"
y="129.49626"
x="-489.49979"
height="7.0035982"
width="17.999748"
id="rect3855"
style="color:#000000;fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.00024867;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="130.50006"
x="-488.50009"
height="4.9998937"
width="15.999757"
id="rect3857"
style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00024891;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
rx="0"
ry="0" />
</g>
<rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
id="rect3859"
width="10"
height="5.0000305"
x="-75.499878"
y="-176.5"
transform="matrix(0,-1,1,0,0,0)"
rx="0"
ry="0"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<g
id="g3861"
transform="translate(-377,-420)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
style="display:inline">
<rect
y="489.5"
x="186.49989"
height="1.9999999"
width="3.0000916"
id="rect3863"
style="fill:url(#linearGradient4702);fill-opacity:1;stroke:url(#linearGradient4704);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="489.5"
x="191.49989"
height="1.9999999"
width="3.0000916"
id="rect3865"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="489.5"
x="196.49989"
height="1.9999999"
width="3.0000916"
id="rect3867"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="489.5"
x="201.49989"
height="1.9999999"
width="3.0000916"
id="rect3869"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
transform="scale(-1,-1)"
y="-491.5"
x="-209.49998"
height="1.9999999"
width="3.0000916"
id="rect3871"
style="fill:url(#linearGradient4706);fill-opacity:1;stroke:url(#linearGradient4708);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</g>
</g>
</svg>
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="Untitled-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <g id="Layer%201"> <path d="M 13 1 L 14 1 L 14 6 L 22 6 L 22 12 L 14 12 L 14 15 L 19 15 L 19 21 L 14 21 L 14 26 L 13 26 L 13 21 L 8 21 L 8 15 L 13 15 L 13 12 L 5 12 L 5 6 L 13 6 L 13 1 ZM 0 0 L 0 27 L 27 27 L 27 0 L 0 0 Z" fill="#000000"/> </g> </svg>

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 246 B

View File

@ -1,235 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
id="svg11272"
sodipodi:version="0.32"
inkscape:version="0.44+devel"
version="1.0"
sodipodi:docbase="/home/andreas/project/inkscape/22x22/actions"
sodipodi:docname="align-horisontal-left.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/andreas/project/inkscape/22x22/actions/align-horisontal-left.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:modified="true">
<defs
id="defs11274">
<linearGradient
id="linearGradient2968"
inkscape:collect="always">
<stop
id="stop2970"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2972"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2968"
id="linearGradient4716"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2974"
inkscape:collect="always">
<stop
id="stop2976"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2978"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2974"
id="linearGradient4714"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
<linearGradient
id="linearGradient2986"
inkscape:collect="always">
<stop
id="stop2988"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2990"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2986"
id="linearGradient4712"
gradientUnits="userSpaceOnUse"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2980"
inkscape:collect="always">
<stop
id="stop2982"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2984"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2980"
id="linearGradient4710"
gradientUnits="userSpaceOnUse"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.197802"
inkscape:cx="16"
inkscape:cy="14.269093"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
width="22px"
height="22px"
inkscape:window-width="797"
inkscape:window-height="628"
inkscape:window-x="0"
inkscape:window-y="47" />
<metadata
id="metadata11277">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
style="display:inline"
id="g4065"
transform="matrix(0,-1,1,0,8.9287758e-5,51.99998)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<g
id="g3883"
transform="translate(-127,-473)"
style="fill:#d3d7cf;stroke:#888a85;display:inline"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
transform="matrix(0,1,1,0,0,0)"
y="169.5"
x="475.50012"
height="7"
width="12"
id="rect3885"
style="fill:#d3d7cf;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
ry="0"
rx="0"
transform="matrix(0,1,1,0,0,0)"
y="170.5"
x="476.50012"
height="5.0000305"
width="10"
id="rect3887"
style="opacity:1;fill:#d3d7cf;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
<g
id="g3889"
transform="translate(-97,-469)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
style="display:inline">
<rect
transform="matrix(0,-1,1,0,0,0)"
y="129.49626"
x="-489.49979"
height="7.0035982"
width="17.999748"
id="rect3891"
style="color:#000000;fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.00024867;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="130.50006"
x="-488.50009"
height="4.9998937"
width="15.999757"
id="rect3893"
style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00024891;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
rx="0"
ry="0" />
</g>
<g
id="g3903"
transform="translate(-157,-488)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
style="display:inline">
<rect
y="489.5"
x="196.49989"
height="1.9999999"
width="3.0000916"
id="rect3905"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
style="fill:url(#linearGradient4710);fill-opacity:1;stroke:url(#linearGradient4712);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dashoffset:0;stroke-opacity:1"
d="M 197.49998,491.5 L 186.49989,491.5 L 186.49989,489.5 L 197.49998,489.5"
id="path3907"
sodipodi:nodetypes="cccc" />
<path
style="fill:url(#linearGradient4714);fill-opacity:1;stroke:url(#linearGradient4716);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dashoffset:0;stroke-opacity:1"
d="M 198.49989,489.5 L 209.49998,489.5 L 209.49998,491.5 L 198.49989,491.5"
id="path3909"
sodipodi:nodetypes="cccc" />
</g>
</g>
</g>
</svg>
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="Untitled-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <path d="M 2 1 L 2 5 L 14 5 L 14 11 L 2 11 L 2 16 L 20 16 L 20 22 L 2 22 L 2 26 L 1 26 L 1 1 L 2 1 ZM 27 0 L 0 0 L 0 27 L 27 27 L 27 0 Z" fill="#000000"/> </svg>

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 255 B

View File

@ -1,250 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
id="svg10625"
sodipodi:version="0.32"
inkscape:version="0.44+devel"
version="1.0"
sodipodi:docbase="/home/andreas/project/inkscape/22x22/actions"
sodipodi:docname="align-vertical-center.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/andreas/project/inkscape/22x22/actions/align-vertical-center.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:modified="true">
<defs
id="defs10627">
<linearGradient
id="linearGradient2968"
inkscape:collect="always">
<stop
id="stop2970"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2972"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2968"
id="linearGradient6962"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-395.9999,-981)"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2974"
inkscape:collect="always">
<stop
id="stop2976"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2978"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2974"
id="linearGradient6960"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-395.9999,-981)"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
<linearGradient
id="linearGradient2986"
inkscape:collect="always">
<stop
id="stop2988"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2990"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2986"
id="linearGradient6958"
gradientUnits="userSpaceOnUse"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2980"
inkscape:collect="always">
<stop
id="stop2982"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2984"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2980"
id="linearGradient6956"
gradientUnits="userSpaceOnUse"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.197802"
inkscape:cx="16"
inkscape:cy="16"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
width="22px"
height="22px"
inkscape:window-width="797"
inkscape:window-height="628"
inkscape:window-x="0"
inkscape:window-y="47" />
<metadata
id="metadata10630">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
style="display:inline"
id="g6849"
transform="translate(-29.999893,91.000089)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
style="fill:#d3d7cf;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1933"
width="12"
height="7"
x="73.500122"
y="42.5"
transform="matrix(0,-1,1,0,0,0)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<g
transform="translate(-97,-560)"
id="g2063"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
transform="matrix(0,-1,1,0,0,0)"
y="129.49626"
x="-489.49979"
height="7.0035982"
width="17.999748"
id="rect1935"
style="color:#000000;fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.00024867;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="130.50006"
x="-488.50009"
height="4.9998937"
width="15.999757"
id="rect1937"
style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00024891;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
rx="0"
ry="0" />
</g>
<rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1939"
width="10"
height="5.0000305"
x="74.500122"
y="43.5"
transform="matrix(0,-1,1,0,0,0)"
rx="0"
ry="0"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<g
id="g2992"
transform="translate(-157,-570)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
y="489.5"
x="186.49989"
height="1.9999999"
width="3.0000916"
id="rect2994"
style="fill:url(#linearGradient6956);fill-opacity:1;stroke:url(#linearGradient6958);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="489.5"
x="191.49989"
height="1.9999999"
width="3.0000916"
id="rect2996"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="489.5"
x="196.49989"
height="1.9999999"
width="3.0000916"
id="rect2998"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="489.5"
x="201.49989"
height="1.9999999"
width="3.0000916"
id="rect3000"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
transform="scale(-1,-1)"
y="-491.5"
x="-209.49998"
height="1.9999999"
width="3.0000916"
id="rect3002"
style="fill:url(#linearGradient6960);fill-opacity:1;stroke:url(#linearGradient6962);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</g>
</g>
</svg>
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="Untitled-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <path d="M 26 13 L 26 14 L 21 14 L 21 22 L 15 22 L 15 14 L 12 14 L 12 19 L 6 19 L 6 14 L 1 14 L 1 13 L 6 13 L 6 8 L 12 8 L 12 13 L 15 13 L 15 5 L 21 5 L 21 13 L 26 13 ZM 27 0 L 0 0 L 0 27 L 27 27 L 27 0 Z" fill="#000000"/> </svg>

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 255 B

View File

@ -1,233 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
id="svg11187"
sodipodi:version="0.32"
inkscape:version="0.44+devel"
version="1.0"
sodipodi:docbase="/home/andreas/project/inkscape/22x22/actions"
sodipodi:docname="align-horisontal-right.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="TRUE"
inkscape:export-filename="/home/andreas/project/inkscape/22x22/actions/align-horisontal-right.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs11189">
<linearGradient
id="linearGradient2968"
inkscape:collect="always">
<stop
id="stop2970"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2972"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2968"
id="linearGradient4732"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2974"
inkscape:collect="always">
<stop
id="stop2976"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2978"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2974"
id="linearGradient4730"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
<linearGradient
id="linearGradient2986"
inkscape:collect="always">
<stop
id="stop2988"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2990"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2986"
id="linearGradient4728"
gradientUnits="userSpaceOnUse"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2980"
inkscape:collect="always">
<stop
id="stop2982"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2984"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2980"
id="linearGradient4726"
gradientUnits="userSpaceOnUse"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.197802"
inkscape:cx="16"
inkscape:cy="16"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
width="22px"
height="22px"
inkscape:window-width="797"
inkscape:window-height="628"
inkscape:window-x="0"
inkscape:window-y="47" />
<metadata
id="metadata11192">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
style="display:inline"
id="g4025"
transform="matrix(0,-1,1,0,-60.999914,-198.00011)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
style="fill:#d3d7cf;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
id="rect3873"
width="12"
height="7"
x="-80.499878"
y="-207.5"
transform="matrix(0,-1,1,0,0,0)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
id="rect3875"
width="10"
height="5.0000305"
x="-79.499878"
y="-206.5"
transform="matrix(0,-1,1,0,0,0)"
rx="0"
ry="0"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<g
id="g3877"
transform="translate(-347,-409)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
style="display:inline">
<rect
transform="matrix(0,-1,1,0,0,0)"
y="129.49626"
x="-489.49979"
height="7.0035982"
width="17.999748"
id="rect3879"
style="color:#000000;fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.00024867;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="130.50006"
x="-488.50009"
height="4.9998937"
width="15.999757"
id="rect3881"
style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00024891;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
rx="0"
ry="0" />
</g>
<g
id="g3919"
transform="translate(-407,-410)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
style="display:inline">
<rect
y="489.5"
x="196.49989"
height="1.9999999"
width="3.0000916"
id="rect3921"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
style="fill:url(#linearGradient4726);fill-opacity:1;stroke:url(#linearGradient4728);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dashoffset:0;stroke-opacity:1"
d="M 197.49998,491.5 L 186.49989,491.5 L 186.49989,489.5 L 197.49998,489.5"
id="path3923"
sodipodi:nodetypes="cccc" />
<path
style="fill:url(#linearGradient4730);fill-opacity:1;stroke:url(#linearGradient4732);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dashoffset:0;stroke-opacity:1"
d="M 198.49989,489.5 L 209.49998,489.5 L 209.49998,491.5 L 198.49989,491.5"
id="path3925"
sodipodi:nodetypes="cccc" />
</g>
</g>
</g>
</svg>
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="Untitled-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <path d="M 25 1 L 25 5 L 13 5 L 13 11 L 25 11 L 25 16 L 7 16 L 7 22 L 25 22 L 25 26 L 26 26 L 26 1 L 25 1 ZM 0 0 L 27 0 L 27 27 L 0 27 L 0 0 Z" fill="#000000"/> </svg>

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 243 B

View File

@ -1,233 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
id="svg10699"
sodipodi:version="0.32"
inkscape:version="0.44+devel"
version="1.0"
sodipodi:docbase="/home/andreas/project/inkscape/22x22/actions"
sodipodi:docname="align-vertical-bottom.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/andreas/project/inkscape/22x22/actions/align-vertical-bottom.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:modified="true">
<defs
id="defs10701">
<linearGradient
id="linearGradient2968"
inkscape:collect="always">
<stop
id="stop2970"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2972"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2968"
id="linearGradient6954"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2974"
inkscape:collect="always">
<stop
id="stop2976"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2978"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2974"
id="linearGradient6952"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1,0,0,-1,395.9999,981)"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
<linearGradient
id="linearGradient2986"
inkscape:collect="always">
<stop
id="stop2988"
offset="0"
style="stop-color:#ce5c00;stop-opacity:1" />
<stop
id="stop2990"
offset="1"
style="stop-color:#ce5c00;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2986"
id="linearGradient6950"
gradientUnits="userSpaceOnUse"
x1="187.60938"
y1="489.35938"
x2="186.93732"
y2="489.35938" />
<linearGradient
id="linearGradient2980"
inkscape:collect="always">
<stop
id="stop2982"
offset="0"
style="stop-color:#fcaf3e;stop-opacity:1" />
<stop
id="stop2984"
offset="1"
style="stop-color:#fcaf3e;stop-opacity:0" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2980"
id="linearGradient6948"
gradientUnits="userSpaceOnUse"
x1="187.81554"
y1="489.54688"
x2="187.1716"
y2="489.54688" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.197802"
inkscape:cx="16"
inkscape:cy="16"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
width="22px"
height="22px"
inkscape:window-width="797"
inkscape:window-height="628"
inkscape:window-x="0"
inkscape:window-y="47" />
<metadata
id="metadata10704">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
style="display:inline"
id="g6862"
transform="translate(-59.99998,90)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<g
id="g3084"
transform="translate(-97,-563)"
style="fill:#d3d7cf;stroke:#888a85"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
transform="matrix(0,1,1,0,0,0)"
y="169.5"
x="475.50012"
height="7"
width="12"
id="rect3086"
style="fill:#d3d7cf;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
ry="0"
rx="0"
transform="matrix(0,1,1,0,0,0)"
y="170.5"
x="476.50012"
height="5.0000305"
width="10"
id="rect3088"
style="opacity:1;fill:#d3d7cf;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
<g
id="g3090"
transform="translate(-67,-559)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
transform="matrix(0,-1,1,0,0,0)"
y="129.49626"
x="-489.49979"
height="7.0035982"
width="17.999748"
id="rect3092"
style="color:#000000;fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.00024867;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="130.50006"
x="-488.50009"
height="4.9998937"
width="15.999757"
id="rect3094"
style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00024891;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
rx="0"
ry="0" />
</g>
<g
id="g3262"
transform="translate(-127,-578)"
inkscape:export-filename="/home/lapo/Desktop/align-distribute.tar.gz_FILES/align-stuff.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
y="489.5"
x="196.49989"
height="1.9999999"
width="3.0000916"
id="rect3264"
style="fill:#fcaf3e;fill-opacity:1;stroke:#ce5c00;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
style="fill:url(#linearGradient6948);fill-opacity:1;stroke:url(#linearGradient6950);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dashoffset:0;stroke-opacity:1"
d="M 197.49998,491.5 L 186.49989,491.5 L 186.49989,489.5 L 197.49998,489.5"
id="path3266"
sodipodi:nodetypes="cccc" />
<path
style="fill:url(#linearGradient6952);fill-opacity:1;stroke:url(#linearGradient6954);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-dashoffset:0;stroke-opacity:1"
d="M 198.49989,489.5 L 209.49998,489.5 L 209.49998,491.5 L 198.49989,491.5"
id="path3268"
sodipodi:nodetypes="cccc" />
</g>
</g>
</g>
</svg>
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="Untitled-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <path d="M 1 2 L 5 2 L 5 14 L 11 14 L 11 2 L 16 2 L 16 20 L 22 20 L 22 2 L 26 2 L 26 1 L 1 1 L 1 2 ZM 0 27 L 0 0 L 27 0 L 27 27 L 0 27 Z" fill="#000000"/> </svg>

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 370 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="27px" height="27px" viewBox="0 0 27 27" enable-background="new 0 0 27 27" xml:space="preserve">
<path fill="#2F2F2C" d="M27,0H0v27h27 M13.25,7.617c6.742,0,12.207,3.846,12.207,8.59c0,4.745-5.465,8.591-12.207,8.591
S1.042,20.952,1.042,16.207C1.042,11.463,6.508,7.617,13.25,7.617z"/>
</svg>

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 468 B

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <path d="M 26.575 14.5 C 25.0764 18.8131 19.7906 22 13.5 22 C 7.2094 22 1.9236 18.8131 0.425 14.5 C 1.9236 10.1869 7.2094 7 13.5 7 C 19.7906 7 25.0764 10.1869 26.575 14.5 ZM 0 0 L 0 27 L 27 27 L 27 0 L 0 0 ZM 20.5226 14.5 C 20.5226 10.9101 16.5538 8.0625 14.0226 8 C 13.8544 7.9958 14.6876 9.0074 14.5226 9.02 C 16.6163 9 18.5226 11.0783 18.5226 14.5 C 18.5226 17.9217 16.7413 19.625 14.5226 19.98 C 14.6876 19.9926 13.8543 21 14.0226 21 C 16.5851 21 20.5226 18.0899 20.5226 14.5 ZM 6 14.5 C 6 18.0899 9.9375 21 12.5 21 C 12.6682 21 11.835 19.9926 12 19.98 C 9.7813 19.625 8 17.9217 8 14.5 C 8 11.0783 9.9063 9 12 9.02 C 11.835 9.0074 12.6682 7.9958 12.5 8 C 9.9688 8.0625 6 10.9101 6 14.5 Z" fill="#000000"/> </svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 376 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="27px" height="27px" viewBox="0 0 27 27" enable-background="new 0 0 27 27" xml:space="preserve">
<g>
<path fill="#2F2F2C" d="M23.377,8.006H3.624v13.602h19.753V8.006z M19.849,9.676c0.91,0,1.646,0.748,1.646,1.67
s-0.736,1.671-1.646,1.671c-0.908,0-1.646-0.749-1.646-1.671S18.94,9.676,19.849,9.676z M5.034,20.175L9.972,9.438l5.173,7.158
l2.587-2.147l4.233,5.727H5.034z"/>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M25.258,23.517H1.742V6.097h23.516V23.517z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 438 B

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <g id="Layer%201"> <path d="M 16.6855 8.9536 L 12.8818 22.146 C 12.6714 22.9009 12.5664 23.396 12.5664 23.6304 C 12.5664 23.7671 12.6221 23.8931 12.7334 24.0112 C 12.8447 24.1284 12.9619 24.187 13.0859 24.187 C 13.2959 24.187 13.5063 24.0942 13.7168 23.9087 C 14.2734 23.4517 14.9414 22.6226 15.7207 21.4224 L 16.3516 21.7935 C 14.4834 25.0474 12.498 26.6733 10.3955 26.6733 C 9.5913 26.6733 8.9512 26.4478 8.4751 25.9956 C 7.9985 25.5444 7.7607 24.9731 7.7607 24.2798 C 7.7607 23.8228 7.8657 23.2407 8.0762 22.5356 L 10.6553 13.6665 C 10.9023 12.813 11.0264 12.1704 11.0264 11.7368 C 11.0264 11.4653 10.9087 11.2241 10.6738 11.0132 C 10.4385 10.8032 10.1172 10.6978 9.709 10.6978 C 9.5234 10.6978 9.3008 10.7046 9.041 10.7163 L 9.2822 9.9741 L 15.5723 8.9536 L 16.6855 8.9536 ZM 15.5352 0.4185 C 16.3018 0.4185 16.9482 0.6851 17.4741 1.2163 C 17.9995 1.7485 18.2627 2.3921 18.2627 3.146 C 18.2627 3.9009 17.9966 4.5444 17.4648 5.0757 C 16.9326 5.6079 16.2896 5.8735 15.5352 5.8735 C 14.793 5.8735 14.1558 5.6079 13.624 5.0757 C 13.0918 4.5444 12.8262 3.9009 12.8262 3.146 C 12.8262 2.3921 13.0889 1.7485 13.6147 1.2163 C 14.1401 0.6851 14.7803 0.4185 15.5352 0.4185 ZM 0 0 L 0 27 L 27 27 L 27 0 L 0 0 Z" fill="#000000"/> </g> </svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 854 B

After

Width:  |  Height:  |  Size: 345 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="27px" height="27px" viewBox="0 0 27 27" enable-background="new 0 0 27 27" xml:space="preserve">
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M12.193,1.904c0-0.365,0.871,0,0.871,0v12.105c-0.509,0.18-0.871,0.664-0.871,1.233
c0,0.722,0.585,1.305,1.307,1.305c0.722,0,1.307-0.583,1.307-1.305c0-0.569-0.362-1.054-0.871-1.233V1.904c0,0,0.871-0.365,0.871,0
c0,6.811,5.226,11.677,5.226,11.677l-3.256,8.193h-6.552l-3.256-8.193C6.968,13.581,12.193,8.714,12.193,1.904z M7.839,25.258
v-2.612h11.322v2.612H7.839z"/>
</svg>

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 409 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="27px" height="27px" viewBox="-1.5 -1.5 27 27" enable-background="new -1.5 -1.5 27 27" xml:space="preserve">
<path fill="#2F2F2C" d="M-1.5-1.5v27h27v-27 M19.616,9.216L6.647,21.567l-5.531,1.285l-0.1-0.094l1.449-5.269L15.438,5.204
c0.231-0.062,0.788-0.219,1.579-0.062L3.255,18.243l-0.394,1.381l1.58,1.504l1.481-0.375l0.66-0.598l0.065-1.408l-1.053-1.004
L18.203,5.736c0.196,0.157,0.196,0.157,0.396,0.376C20.476,7.869,19.616,9.216,19.616,9.216z M22.87,4.9
c-0.002,0.774-0.358,1.561-1.013,2.185l-1.217,1.16c0,0,0.921-1.348-0.989-3.103c-1.679-1.599-3.259-0.91-3.259-0.91l1.284-1.223
c1.154-1.126,3.161-1.126,4.278-0.062c0.622,0.549,0.913,1.239,0.915,1.938V4.9z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

After

Width:  |  Height:  |  Size: 422 B

View File

@ -1,219 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="draw-polygon.svg"
sodipodi:docbase="/home/andreas/projekt/tango/22"
inkscape:version="0.42"
id="svg8728"
height="22.000000px"
width="22.000000px"
inkscape:export-filename="/home/andreas/projekt/tango/22/draw-polygon.png"
inkscape:export-xdpi="90.000000"
inkscape:export-ydpi="90.000000">
<defs
id="defs3">
<linearGradient
inkscape:collect="always"
id="linearGradient3941">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3943" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3945" />
</linearGradient>
<linearGradient
id="linearGradient6581">
<stop
style="stop-color:#eeeeec;stop-opacity:1;"
offset="0"
id="stop6583" />
<stop
style="stop-color:#e0e0de;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop6585" />
</linearGradient>
<linearGradient
id="linearGradient14920">
<stop
id="stop14922"
offset="0"
style="stop-color:#5a7aa4;stop-opacity:1;" />
<stop
id="stop14924"
offset="1.0000000"
style="stop-color:#1f2b3a;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient13390">
<stop
id="stop13392"
offset="0.0000000"
style="stop-color:#81a2cd;stop-opacity:1.0000000;" />
<stop
id="stop13394"
offset="1.0000000"
style="stop-color:#2a415f;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient10325">
<stop
id="stop10327"
offset="0"
style="stop-color:#5a7aa4;stop-opacity:1;" />
<stop
id="stop10329"
offset="1.0000000"
style="stop-color:#455e7e;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
y2="39.486301"
x2="37.746555"
y1="23.992306"
x1="23.598076"
gradientTransform="matrix(0.363308,0,0,0.363571,1.976073,1.180651)"
id="linearGradient13217"
xlink:href="#linearGradient6581"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3941"
id="radialGradient3947"
cx="2.25"
cy="16"
fx="2.25"
fy="16"
r="16.875"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.333333,-5.774893e-15,10.66667)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6581"
id="linearGradient2398"
x1="10.769515"
y1="8.7196503"
x2="15.923767"
y2="15.039417"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6581"
id="linearGradient2403"
gradientUnits="userSpaceOnUse"
x1="10.769515"
y1="8.7196503"
x2="15.923767"
y2="15.039417"
gradientTransform="matrix(0.874941,0.000000,0.000000,0.868551,1.339139,1.349650)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6581"
id="linearGradient2405"
gradientUnits="userSpaceOnUse"
x1="10.769515"
y1="8.7196503"
x2="15.923767"
y2="15.039417"
gradientTransform="matrix(1.001575,0.000000,0.000000,1.000000,-3.040037e-3,0.000000)" />
</defs>
<sodipodi:namedview
inkscape:window-y="25"
inkscape:window-x="0"
inkscape:window-height="949"
inkscape:window-width="1280"
inkscape:document-units="px"
inkscape:grid-bbox="true"
showgrid="false"
inkscape:current-layer="layer1"
inkscape:cy="10.249014"
inkscape:cx="16.435231"
inkscape:zoom="15.999999"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="0.08235294"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
showguides="true"
inkscape:guide-bbox="true"
inkscape:showpageshadow="false"
stroke="#888a85" />
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Draw Rectangle</dc:title>
<dc:date>2005-10-10</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Andreas Nilsson</dc:title>
</cc:Agent>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>draw</rdf:li>
<rdf:li>rectangle</rdf:li>
<rdf:li>square</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
inkscape:label="Layer 1"
id="layer1">
<path
sodipodi:type="arc"
style="opacity:0.60000000;color:#000000;fill:url(#radialGradient3947);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:block;overflow:visible"
id="path2193"
sodipodi:cx="2.2500000"
sodipodi:cy="16.000000"
sodipodi:rx="16.875000"
sodipodi:ry="5.6250000"
d="M 19.125000 16.000000 A 16.875000 5.6250000 0 1 1 -14.625000,16.000000 A 16.875000 5.6250000 0 1 1 19.125000 16.000000 z"
transform="matrix(0.503704,0.000000,0.000000,0.349014,9.366667,12.45257)" />
<path
style="fill:url(#linearGradient2405);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#888a85;stroke-width:1.0000002px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
d="M 10.376363,3.6237647 L 18.439333,9.5822222 L 15.644242,18.503298 L 5.3933717,18.503298 L 2.5694122,9.5814367 L 10.376363,3.6237647 z "
id="path1661"
sodipodi:nodetypes="cccccc" />
<path
style="fill:url(#linearGradient2403);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#fdfdfb;stroke-width:0.99999976px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
d="M 10.383801,4.6223366 L 17.428917,9.8682235 L 14.894231,17.502140 L 6.1335005,17.494329 L 3.6135882,9.9131875 L 10.383801,4.6223366 z "
id="path2401"
sodipodi:nodetypes="cccccc" />
</g>
</svg>
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS5, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="27px" height="27px" > <g id="Layer%201"> <path d="M 13.6027 0.5027 L 26.844 10.2723 L 21.6443 25.8845 L 5.1894 25.7637 L 0.2195 10.0769 L 13.6027 0.5027 ZM 0 0 L 0 27 L 27 27 L 27 0 L 0 0 Z" fill="#000000"/> </g> </svg>

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 344 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<g>
<path fill="#2F2F2C" d="M0,0v24h24V0H0z M17.147,20.757l-2.941,1.501l-3.677-6.005l-4.411,3.003V1.241l12.5,12.01l-4.412,1.501
L17.147,20.757z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 145 B

View File

@ -37,12 +37,10 @@
<g id="select">
<svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="27px" height="27px"
>
<svg viewBox="0 0 24 24" version="1.1">
<g>
<path d="M -10 -10 L -10 39 L 38 39 L 38 -10 L -10 -10 ZM 20.8631 25.5087 L 16.9412 27.511 L 12.0393 19.5038 L 6.157 23.5073 L 6.157 -0.5122 L 22.8236 15.5012 L 16.9412 17.5025 L 20.8631 25.5087 Z" fill="#2f2f2c"/>
<path fill="#2F2F2C" d="M0,0v24h24V0H0z M17.147,20.757l-2.941,1.501l-3.677-6.005l-4.411,3.003V1.241l12.5,12.01l-4.412,1.501
L17.147,20.757z"/>
</g>
</svg>
</g>
@ -59,17 +57,6 @@
</svg>
</g>
<g id="square">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<defs>
<linearGradient id="svg_2" x1="0.36328" y1="0.10156" x2="1" y2="1">
<stop offset="0" stop-color="#ffffff" stop-opacity="1"/>
<stop offset="1" stop-color="#3b7e9b" stop-opacity="1"/>
</linearGradient>
</defs>
<rect x="1.5" y="1.5" width="20" height="20" id="svg_1" fill="url(#svg_2)" stroke="#2f2f2c"/>
</svg>
</g>
<g id="rect">
<svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1"
@ -115,7 +102,8 @@
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="27px" height="27px"
>
<path d="M 27 27 L 27 14.5 C 27 19.7468 20.9559 24 13.5 24 C 6.0441 24 0 19.7468 0 14.5 L 0 27 L 27 27 ZM 0 0 L 0 14.5 C 0 9.2532 6.0441 5 13.5 5 C 20.9559 5 27 9.2532 27 14.5 L 27 0 L 0 0 Z" fill="#2f2f2c"/>
<path fill="#2F2F2C" d="M27,0H0v27h27 M13.25,7.617c6.742,0,12.207,3.846,12.207,8.59c0,4.745-5.465,8.591-12.207,8.591
S1.042,20.952,1.042,16.207C1.042,11.463,6.508,7.617,13.25,7.617z"/>
</svg>
</g>
@ -139,11 +127,12 @@
</g>
<g id="pencil">
<svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="27px" height="27px"
>
<path d="M 0 27 L 0.1227 27 L 0 26.8782 L 0 27 ZM 0 0 L 0 26.8782 L 1.7899 20.0068 L 17.8149 3.9765 C 18.0997 3.895 18.7917 3.6902 19.7669 3.895 L 2.7668 20.9889 L 2.2792 22.7878 L 4.2312 24.7511 L 6.0605 24.2601 L 6.8753 23.4829 L 6.9555 21.6429 L 5.6546 20.3342 L 21.2329 4.6723 C 21.4767 4.8763 21.4767 4.8763 21.7205 5.1626 C 24.039 7.4533 22.9804 9.2111 22.9804 9.2111 L 6.9555 25.3237 L 0.1227 27 L 27 27 L 27 3.58 C 26.9969 4.5907 26.556 5.6169 25.7473 6.4309 L 24.2419 7.9435 C 24.2419 7.9435 25.3807 6.1849 23.0214 3.895 C 20.9467 1.8099 18.9947 2.7089 18.9947 2.7089 L 20.5817 1.114 C 22.0052 -0.3575 24.4858 -0.3575 25.8684 1.0326 C 26.6372 1.7481 26.9972 2.6477 27 3.56 L 27 0 L 0 0 Z" fill="#2f2f2c"/>
<svg viewBox="0 0 24 24" version="1.1">
<path fill="#2F2F2C" d="M-1.5-1.5v27h27v-27 M19.616,9.216L6.647,21.567l-5.531,1.285l-0.1-0.094l1.449-5.269L15.438,5.204
c0.231-0.062,0.788-0.219,1.579-0.062L3.255,18.243l-0.394,1.381l1.58,1.504l1.481-0.375l0.66-0.598l0.065-1.408l-1.053-1.004
L18.203,5.736c0.196,0.157,0.196,0.157,0.396,0.376C20.476,7.869,19.616,9.216,19.616,9.216z M22.87,4.9
c-0.002,0.774-0.358,1.561-1.013,2.185l-1.217,1.16c0,0,0.921-1.348-0.989-3.103c-1.679-1.599-3.259-0.91-3.259-0.91l1.284-1.223
c1.154-1.126,3.161-1.126,4.278-0.062c0.622,0.549,0.913,1.239,0.915,1.938V4.9z"/>
</svg>
</g>
@ -158,27 +147,29 @@
</g>
<g id="text">
<svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="27px" height="27px"
>
<path d="M 0 0 L 0 27 L 6.3617 27 L 6.3617 25 L 6.9803 25 C 8.2811 25 9.1377 24.7656 9.5343 24.2656 C 9.9308 23.7812 10.1371 22.9375 10.1371 21.75 L 10.1371 3 L 8.0273 3 C 6.7583 3 5.8382 3.1406 5.2513 3.4219 C 4.6485 3.7031 4.1567 4.25 3.7601 5.0625 C 3.3477 5.8906 3.1098 6.875 3.0305 8 L 1 8 L 1 1 L 26 1 L 26 8 L 23.811 8 C 23.3986 6.0469 22.8116 4.7187 22.066 4.0313 C 21.3205 3.3437 20.1308 3 18.4969 3 L 16.2285 3 L 16.2285 21.75 C 16.2285 22.9688 16.4188 23.8281 16.8313 24.2969 C 17.2437 24.7656 18.1003 25 19.401 25 L 20.0831 25 L 20.0831 27 L 27 27 L 27 0 L 0 0 Z" fill="#2f2f2c"/>
</svg>
</g>
<g id="path">
<svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="27px" height="27px"
>
<g id="Layer%201">
<path d="M 12 0.1861 C 12 -0.2327 13.0001 0.1861 13.0001 0.1861 L 13.0001 14.0835 C 12.4167 14.2901 12 14.8467 12 15.4996 C 12 16.329 12.6722 16.9985 13.5 16.9985 C 14.3278 16.9985 14.9999 16.329 14.9999 15.4996 C 14.9999 14.8467 14.5833 14.2901 13.9999 14.0835 L 13.9999 0.1861 C 13.9999 0.1861 14.9999 -0.2327 14.9999 0.1861 C 14.9999 8.0054 21 13.593 21 13.593 L 17.2611 22.9994 L 9.7389 22.9994 L 6 13.593 C 6 13.593 12 8.0054 12 0.1861 ZM 0 0 L 0 27 L 7.0001 27 L 7.0001 23.9995 L 19.9999 23.9995 L 19.9999 27 L 27 27 L 27 0 L 0 0 Z" fill="#2f2f2c"/>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M12.193,1.904c0-0.365,0.871,0,0.871,0v12.105c-0.509,0.18-0.871,0.664-0.871,1.233c0,0.722,0.585,1.305,1.307,1.305c0.722,0,1.307-0.583,1.307-1.305c0-0.569-0.362-1.054-0.871-1.233V1.904c0,0,0.871-0.365,0.871,0c0,6.811,5.226,11.677,5.226,11.677l-3.256,8.193h-6.552l-3.256-8.193C6.968,13.581,12.193,8.714,12.193,1.904z M7.839,25.258v-2.612h11.322v2.612H7.839z"/>
</g>
</svg>
</g>
<g id="text">
<svg id="eye-Page%201" viewBox="0 0 27 27" style="background-color:#ffffff00" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="27px" height="27px"
>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M7.283,25.258v-1.741h0.539c1.133,0,1.879-0.204,2.224-0.64c0.345-0.422,0.525-1.157,0.525-2.191V4.355H8.733c-1.105,0-1.906,0.123-2.417,0.367C5.791,4.967,5.362,5.443,5.017,6.151C4.658,6.873,4.451,7.73,4.381,8.709H2.613V2.613h21.774v6.097H22.48c-0.359-1.701-0.87-2.858-1.52-3.457s-1.686-0.898-3.108-0.898h-1.976v16.331c0,1.062,0.165,1.81,0.525,2.218c0.358,0.409,1.104,0.613,2.236,0.613h0.595v1.741H7.283z"/>
</svg>
</g>
<g id="add_subpath">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 124 124" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
@ -242,7 +233,8 @@
x="0px" y="0px" width="27px" height="27px"
>
<g id="Layer%201">
<path d="M 2.16 22.8082 L 24.84 22.8082 L 24.84 7.1918 L 2.16 7.1918 L 2.16 22.8082 ZM 9.4498 8.8356 L 15.3898 17.0548 L 18.3598 14.589 L 23.2197 21.1643 L 3.7797 21.1643 L 9.4498 8.8356 ZM 20.7897 9.1096 C 21.8337 9.1096 22.6798 9.9681 22.6798 11.0274 C 22.6798 12.0866 21.8337 12.9452 20.7897 12.9452 C 19.7458 12.9452 18.8997 12.0866 18.8997 11.0274 C 18.8997 9.9681 19.7458 9.1096 20.7897 9.1096 ZM 0 25 L 0 27 L 27 27 L 27 25 L 0 25 ZM 0 0 L 0 5 L 27 5 L 27 0 L 0 0 Z" fill="#2f2f2c"/>
<path fill="#2F2F2C" d="M23.377,8.006H3.624v13.602h19.753V8.006z M19.849,9.676c0.91,0,1.646,0.748,1.646,1.67s-0.736,1.671-1.646,1.671c-0.908,0-1.646-0.749-1.646-1.671S18.94,9.676,19.849,9.676z M5.034,20.175L9.972,9.438l5.173,7.158l2.587-2.147l4.233,5.727H5.034z"/>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M25.258,23.517H1.742V6.097h23.516V23.517z"/>
</g>
</svg>
</g>
@ -252,13 +244,16 @@
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="27px" height="27px"
>
<path d="M 3 10.5 C 3 14.6422 6.3578 18 10.5 18 C 14.6422 18 18 14.6422 18 10.5 C 18 6.3578 14.6422 3 10.5 3 C 6.3578 3 3 6.3578 3 10.5 ZM 27 0 L 10.5 0 C 16.2991 0 21 4.7009 21 10.5 C 21 12.8896 20.1998 15.0909 18.855 16.855 L 26 24 L 23 27 L 27 27 L 27 0 ZM 0 27 L 23 27 L 15.65 19.65 C 14.128 20.5085 12.372 21 10.5 21 C 4.701 21 0 16.299 0 10.5 L 0 27 ZM 0 0 L 0 10.5 C 0 4.7009 4.701 0 10.5 0 L 0 0 Z" fill="#2f2f2c"/>
<circle fill="#2F2F2C" cx="10.887" cy="10.887" r="6.532"/>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M15.373,18.856c-1.326,0.747-2.855,1.176-4.486,1.176c-5.051,0-9.145-4.095-9.145-9.145
c0-5.051,4.094-9.145,9.145-9.145c5.05,0,9.145,4.094,9.145,9.145c0,2.081-0.697,3.999-1.868,5.536l6.223,6.223l-2.612,2.612
L15.373,18.856z"/>
</svg>
</g>
<g id="arrow_right">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 50">
<path stroke="#2f2f2c" fill="#2f2f2c" d="m0,0l0,50l25,-25l-25,-25z"/>
<path stroke="#2f2f2c" fill="#ccc" d="m0,0l0,50l25,-25l-25,-25z"/>
</svg>
</g>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 323 B

View File

@ -1,157 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22.000000px"
height="22.000000px"
id="svg1306"
sodipodi:version="0.32"
inkscape:version="0.42.2"
sodipodi:docbase="/home/andreas/projekt/bild/tango/22"
sodipodi:docname="draw-text2.svg">
<defs
id="defs1308">
<linearGradient
id="linearGradient3682">
<stop
style="stop-color:#1f1f1f;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop3684" />
<stop
style="stop-color:#5c5c5c;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop3686" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3558">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3560" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3562" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3558"
id="radialGradient3564"
cx="22.571428"
cy="30.857143"
fx="22.571428"
fy="30.857143"
r="15.571428"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.651376,4.300378e-15,10.75754)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient2834">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2836" />
<stop
style="stop-color:#b3b3b3;stop-opacity:0.0000000;"
offset="1.0000000"
id="stop2838" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2834"
id="linearGradient2840"
x1="19.944447"
y1="16.527262"
x2="24.133829"
y2="19.642126"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.498259,0.000000,0.000000,0.466519,-0.799974,-0.839637)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3682"
id="linearGradient3688"
x1="23.305620"
y1="24.843527"
x2="14.388516"
y2="9.5902243"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.498259,0.000000,0.000000,0.488600,-0.799974,-1.273557)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="14.000000"
inkscape:cx="17.541947"
inkscape:cy="12.572768"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1280"
inkscape:window-height="885"
inkscape:window-x="0"
inkscape:window-y="25" />
<metadata
id="metadata1311">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
style="opacity:0.47368422;color:#000000;fill:url(#radialGradient3564);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
id="path3556"
sodipodi:cx="22.571428"
sodipodi:cy="30.857143"
sodipodi:rx="15.571428"
sodipodi:ry="10.142858"
d="M 38.142857 30.857143 A 15.571428 10.142858 0 1 1 7.0000000,30.857143 A 15.571428 10.142858 0 1 1 38.142857 30.857143 z"
transform="matrix(0.706422,0.000000,0.000000,0.208015,-4.944952,13.47138)" />
<path
style="font-size:54.869392px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;fill:url(#linearGradient3688);fill-opacity:1.0000000;stroke:#000000;stroke-width:1.0000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
d="M 15.189363,15.520771 L 7.1531447,15.520771 L 5.8598048,19.513834 L 0.51627279,19.513834 L 8.1009381,0.48837876 L 14.228221,0.48837876 L 21.560524,19.464779 L 16.444188,19.464779 L 15.189363,15.520771 M 8.3990779,12.473977 L 13.858901,12.473977 L 11.171254,5.1526958 L 8.3990779,12.473977"
id="text1314"
sodipodi:nodetypes="ccccccccccccc" />
<path
style="font-size:54.869392px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;opacity:0.37912086;fill:none;fill-opacity:1.0000000;stroke:url(#linearGradient2840);stroke-width:1.0000008;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
d="M 15.684541,15.159554 L 6.6710758,15.159554 L 5.4166733,18.527305 L 2.0035414,18.527305 L 8.7384662,1.4621947 L 13.512484,1.4621947 L 20.022564,18.410463 L 16.899702,18.410463 L 15.684541,15.159554 z "
id="path2047"
sodipodi:nodetypes="ccccccccc" />
<image
id="image2089"
height="459.00000"
width="400.00000"
sodipodi:absref="/home/andreas/palette2.png"
xlink:href="/home/andreas/palette2.png"
x="-354.93631"
y="-214.53793" />
<path
style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#999999;stroke-width:1.0000007;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000;opacity:0.51098901"
d="M 8.1686844,13.551882 L 14.147791,13.551882"
id="path5142"
sodipodi:nodetypes="cc" />
</g>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="27px" height="27px" viewBox="0 0 27 27" enable-background="new 0 0 27 27" xml:space="preserve">
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M7.283,25.258v-1.741h0.539c1.133,0,1.879-0.204,2.224-0.64
c0.345-0.422,0.525-1.157,0.525-2.191V4.355H8.733c-1.105,0-1.906,0.123-2.417,0.367C5.791,4.967,5.362,5.443,5.017,6.151
C4.658,6.873,4.451,7.73,4.381,8.709H2.613V2.613h21.774v6.097H22.48c-0.359-1.701-0.87-2.858-1.52-3.457s-1.686-0.898-3.108-0.898
h-1.976v16.331c0,1.062,0.165,1.81,0.525,2.218c0.358,0.409,1.104,0.613,2.236,0.613h0.595v1.741H7.283z"/>
</svg>

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 483 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="27px" height="27px" viewBox="0 0 27 27" enable-background="new 0 0 27 27" xml:space="preserve">
<g>
<circle fill="#2F2F2C" cx="10.887" cy="10.887" r="6.532"/>
<path fill="#2F2F2C" d="M0,0v27h27V0H0z M15.373,18.856c-1.326,0.747-2.855,1.176-4.486,1.176c-5.051,0-9.145-4.095-9.145-9.145
c0-5.051,4.094-9.145,9.145-9.145c5.05,0,9.145,4.094,9.145,9.145c0,2.081-0.697,3.999-1.868,5.536l6.223,6.223l-2.612,2.612
L15.373,18.856z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 822 B

View File

@ -331,9 +331,11 @@ svgedit.select.SelectorManager.prototype.initGroup = function() {
'element': 'circle',
'attr': {
'id': 'selectorGrip_rotate_' + dir,
'fill': 'transparent',
'fill': '#000',
'r': 8,
'stroke': 'transparent',
'stroke': '#000',
"fill-opacity": 0,
"stroke-opacity": 0,
'stroke-width': 0,
'style': 'cursor:url(' + config_.imgPath + 'rotate.png) 12 12, auto;'
}

View File

@ -147,6 +147,7 @@ $(function(){
<div class="menu_item" id="tool_undo">Undo <span class="shortcut">⌘Z</span></div>
<div class="menu_item" id="tool_redo">Redo <span class="shortcut">⌘Y</span></div>
<div class="separator"></div>
<div class="menu_item action_selected disabled" id="tool_copy">Cut <span class="shortcut">⌘X</span></div>
<div class="menu_item action_selected disabled" id="tool_copy">Copy <span class="shortcut">⌘C</span></div>
<div class="menu_item action_selected disabled" id="tool_paste">Paste <span class="shortcut">⌘V</span></div>
<div class="menu_item action_selected disabled" id="tool_clone">Duplicate <span class="shortcut">⌘D</span></div>
@ -173,7 +174,8 @@ $(function(){
<div class="menu">
<div class="menu_title">Canvas</div>
<div class="menu_list" id="canvas_menu">
<div class="menu_item" id="tool_docprops">Canvas Properties...</div>
<div class="menu_item" id="tool_docprops">Canvas Dimensions...</div>
<div class="menu_item" id="tool_canvas_color_menu">Canvas Color...</div>
</div>
</div>

View File

@ -65,7 +65,8 @@
snappingStep: 10,
showRulers: true,
show_outside_canvas: false,
no_save_warning: true
no_save_warning: true,
initFont: 'Sans-serif'
},
uiStrings = Editor.uiStrings = {
common: {
@ -2101,7 +2102,6 @@
return false;
}
var closer = function(e){
//Method of Action specific to detect when the iframe has focus
if (top != self && !e.isTrigger) {
if(typeof top.exports.setEditorFocus == 'function') {
@ -2113,10 +2113,14 @@
blinker(e);
return;
}
else {
$('#menu_bar').removeClass('active')
}
if ($("#tools_shapelib").is(":visible") && !$(e.target).parents("#tools_shapelib_show, #tools_shapelib").length)
$("#tools_shapelib").hide()
if (e.target.nodeName.toLowerCase() != "input") $("input").blur();
}
}
@ -2466,19 +2470,21 @@
var cutSelected = function() {
if (selectedElement != null || multiselected) {
if (window.event.type === "keydown") flash($('#edit_menu'));
svgCanvas.cutSelectedElements();
}
};
var copySelected = function() {
if (selectedElement != null || multiselected) {
if (window.event.type === "keydown") flash($('#edit_menu'));
svgCanvas.copySelectedElements();
}
};
var pasteInCenter = function() {
var zoom = svgCanvas.getZoom();
var pasteSelected = function() {
if (window.event.type === "keydown") flash($('#edit_menu'));
var zoom = svgCanvas.getZoom();
var x = (workarea[0].scrollLeft + workarea.width()/2)/zoom - svgCanvas.contentW;
var y = (workarea[0].scrollTop + workarea.height()/2)/zoom - svgCanvas.contentH;
svgCanvas.pasteElements('point', x, y);
@ -2486,30 +2492,35 @@
var moveToTopSelected = function() {
if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveToTopSelectedElement();
}
};
var moveToBottomSelected = function() {
if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveToBottomSelectedElement();
}
};
var moveUpSelected = function() {
if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveUpDownSelected("Up");
}
};
var moveDownSelected = function() {
if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveUpDownSelected("Down");
}
};
var moveUpDownSelected = function(dir) {
if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveUpDownSelected(dir);
}
};
@ -2548,6 +2559,7 @@
dx *= multi;
dy *= multi;
}
$('input').blur()
svgCanvas.moveSelectedElements(dx,dy);
}
};
@ -2765,6 +2777,11 @@
updateWireFrame();
}
var clickCanvasColor = function(){
svgCanvas.clearSelection();
$('#tool_canvas').trigger("click")
};
var minimizeModal = function() {
if (window.self != window.top) { //we're in an iframe
@ -3513,10 +3530,12 @@
if (type == "fill") cur = curConfig['initFill'];
if (type == "canvas" && background) {
var rgb = background.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
var hex = ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[3],10).toString(16)).slice(-2);
cur = {color: hex, opacity: 1}
if (rgb) {
var hex = ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[3],10).toString(16)).slice(-2);
cur = {color: hex, opacity: 1}
}
}
@ -4111,14 +4130,19 @@
{sel:'#tool_move_down', fn: moveDownSelected, evt:'click', key: [modKey+'down', true]},
{sel:'#tool_topath', fn: convertToPath, evt: 'click'},
{sel:'#tool_make_link,#tool_make_link_multi', fn: makeHyperlink, evt: 'click'},
{sel:'#tool_undo', fn: clickUndo, evt: 'click'},
{sel:'#tool_redo', fn: clickRedo, evt: 'click', key: ['Y', true]},
{sel:'#tool_clone,#tool_clone_multi', fn: clickClone, evt: 'click', key: [modKey + 'D', true]},
{sel:'#tool_group', fn: clickGroup, evt: 'click', key: [modKey + 'G', true]},
{sel:'#tool_ungroup', fn: clickGroup, evt: 'click', key: modKey + 'shift+G'},
{sel:'#tool_unlink_use', fn: clickGroup, evt: 'click'},
{sel:'[id^=tool_align]', fn: clickAlign, evt: 'click'},
{sel:'#tool_switch', fn: clickSwitch, evt: 'click', key: ['X', true]},
{sel:'#tool_switch', fn: clickSwitch, evt: 'click', key: ['shift+x', true]},
{sel:'#tool_undo', fn: clickUndo, evt: 'click', key: modKey + 'z'},
{sel:'#tool_redo', fn: clickRedo, evt: 'click', key: ['y', true]},
{sel:'#tool_canvas_color_menu', fn: clickCanvasColor, evt: 'click'},
{sel:'#tool_cut', fn: cutSelected, evt: 'click', key: modKey+'x'},
{sel:'#tool_copy', fn: copySelected, evt: 'click', key: modKey+'c'},
{sel:'#tool_paste', fn: pasteSelected, evt: 'click', key: modKey+'v'},
// these two lines are required to make Opera work properly with the flyout mechanism
// {sel:'#tools_rect_show', fn: clickRect, evt: 'click'},
// {sel:'#tools_ellipse_show', fn: clickEllipse, evt: 'click'},
@ -4156,15 +4180,8 @@
{key: modKey + 'A', fn: function(){svgCanvas.selectAllInCurrentLayer();}},
// Standard shortcuts
{key: modKey + 'z', fn: clickUndo},
{key: modKey + 'shift+z', fn: clickRedo},
{key: modKey + 'y', fn: clickRedo},
{key: 'esc', fn: minimizeModal},
{key: modKey+'x', fn: cutSelected},
{key: modKey+'c', fn: copySelected},
{key: modKey+'v', fn: pasteInCenter}
{key: 'esc', fn: minimizeModal}
];
// Tooltips not directly associated with a single function

View File

@ -1,30 +1,30 @@
(function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]=
true;else{l[e+d]=true;l[e+a.hotkeys.shiftNums[d]]=true;if(e==="shift+")l[a.hotkeys.shiftNums[d]]=true}b=0;for(d=m.length;b<d;b++)if(l[m[b]])return c.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 f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,sa,la){var oa;if(sa!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(sa))sa=sa.replace(ba?ea:ca,"");else{oa=p(S[2]);sa=f(sa)?p[ba?fa:O](sa):sa;sa=la===2?sa:la===1?a.extend({},sa,oa):a.extend({},oa,sa);sa=u(sa);if(ba)sa=sa.replace(ra,l)}ba=S[1]+(ba?"#":sa||!S[1]?"?":"")+sa+U}else ba=
S(U!==d?U:n[ua][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?fa:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,sa){if(!f(U)&&typeof U!=="object"){sa=U;U=S;S=d}return this.each(function(){var la=a(this),oa=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=oa&&la.attr(oa)||"";la.attr(oa,u[ba](Z,U,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,p,L,T=a.bbq=a.bbq||{},M,J,da,V=a.event.special,O="querystring",fa="fragment",
ua="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,ra,qa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[fa]=w=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);ra=RegExp(ba.join("|"),"g")};w.noEscape(",/");a.deparam=p=function(ba,S){var U={},sa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,oa){var Z=oa.split("="),Aa=l(Z[0]),Ka=U,
Ra=0,Na=Aa.split("]["),Sa=Na.length-1;if(/\[/.test(Na[0])&&/\]$/.test(Na[Sa])){Na[Sa]=Na[Sa].replace(/\]$/,"");Na=Na.shift().split("[").concat(Na);Sa=Na.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:sa[Z]!==d?sa[Z]:Z;if(Sa)for(;Ra<=Sa;Ra++){Aa=Na[Ra]===""?Ka.length:Na[Ra];Ka=Ka[Aa]=Ra<Sa?Ka[Aa]||(Na[Ra+1]&&isNaN(Na[Ra+1])?{}:[]):Z}else if(a.isArray(U[Aa]))U[Aa].push(Z);else U[Aa]=U[Aa]!==d?[U[Aa],Z]:Z}else if(Aa)U[Aa]=S?d:""});return U};p[O]=c(o,0);p[fa]=L=
c(o,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(qa,ba)})({a:ha,base:ha,iframe:"src",img:"src",input:"src",form:"action",link:ha,script:"src"});da=a.elemUrlAttr;a.fn[O]=c(b,O);a.fn[fa]=c(b,fa);T.pushState=M=function(ba,S){if(f(ba)&&/^#/.test(ba)&&S===d)S=2;var U=ba!==d;U=w(n[ua][ha],U?ba:{},U?S:2);n[ua][ha]=U+(/#/.test(U)?"":"#")};T.getState=J=function(ba,S){return ba===d||typeof ba==="boolean"?L(ba):L(S)[ba]};T.removeState=function(ba){var S={};if(ba!==d){S=J();a.each(a.isArray(ba)?
ba:arguments,function(U,sa){delete S[sa]})}M(S,2)};V.hashchange=a.extend(V.hashchange,{add:function(ba){function S(sa){var la=sa[fa]=w();sa.getState=function(oa,Z){return oa===d||typeof oa==="boolean"?p(la,oa):p(la,Z)[oa]};U.apply(this,arguments)}var U;if(a.isFunction(ba)){U=ba;return S}else{U=ba.handler;ba.handler=S}}})})(jQuery,this);
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 f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,sa,la){var oa;if(sa!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(sa))sa=sa.replace(ba?ea:ca,"");else{oa=p(S[2]);sa=f(sa)?p[ba?ga:O](sa):sa;sa=la===2?sa:la===1?a.extend({},sa,oa):a.extend({},oa,sa);sa=u(sa);if(ba)sa=sa.replace(ra,l)}ba=S[1]+(ba?"#":sa||!S[1]?"?":"")+sa+U}else ba=
S(U!==d?U:n[ta][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?ga:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,sa){if(!f(U)&&typeof U!=="object"){sa=U;U=S;S=d}return this.each(function(){var la=a(this),oa=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=oa&&la.attr(oa)||"";la.attr(oa,u[ba](Z,U,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,p,L,T=a.bbq=a.bbq||{},M,J,da,V=a.event.special,O="querystring",ga="fragment",
ta="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,ra,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=w=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);ra=RegExp(ba.join("|"),"g")};w.noEscape(",/");a.deparam=p=function(ba,S){var U={},sa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,oa){var Z=oa.split("="),Aa=l(Z[0]),Ka=U,
Ra=0,Na=Aa.split("]["),Sa=Na.length-1;if(/\[/.test(Na[0])&&/\]$/.test(Na[Sa])){Na[Sa]=Na[Sa].replace(/\]$/,"");Na=Na.shift().split("[").concat(Na);Sa=Na.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:sa[Z]!==d?sa[Z]:Z;if(Sa)for(;Ra<=Sa;Ra++){Aa=Na[Ra]===""?Ka.length:Na[Ra];Ka=Ka[Aa]=Ra<Sa?Ka[Aa]||(Na[Ra+1]&&isNaN(Na[Ra+1])?{}:[]):Z}else if(a.isArray(U[Aa]))U[Aa].push(Z);else U[Aa]=U[Aa]!==d?[U[Aa],Z]:Z}else if(Aa)U[Aa]=S?d:""});return U};p[O]=c(o,0);p[ga]=L=
c(o,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(pa,ba)})({a:ha,base:ha,iframe:"src",img:"src",input:"src",form:"action",link:ha,script:"src"});da=a.elemUrlAttr;a.fn[O]=c(b,O);a.fn[ga]=c(b,ga);T.pushState=M=function(ba,S){if(f(ba)&&/^#/.test(ba)&&S===d)S=2;var U=ba!==d;U=w(n[ta][ha],U?ba:{},U?S:2);n[ta][ha]=U+(/#/.test(U)?"":"#")};T.getState=J=function(ba,S){return ba===d||typeof ba==="boolean"?L(ba):L(S)[ba]};T.removeState=function(ba){var S={};if(ba!==d){S=J();a.each(a.isArray(ba)?
ba:arguments,function(U,sa){delete S[sa]})}M(S,2)};V.hashchange=a.extend(V.hashchange,{add:function(ba){function S(sa){var la=sa[ga]=w();sa.getState=function(oa,Z){return oa===d||typeof oa==="boolean"?p(la,oa):p(la,Z)[oa]};U.apply(this,arguments)}var U;if(a.isFunction(ba)){U=ba;return S}else{U=ba.handler;ba.handler=S}}})})(jQuery,this);
(function(a,n,f){function c(w){w=w||n[b][d];return w.replace(/^[^#]*#?(.*)$/,"$1")}var m,o=a.event.special,b="location",d="href",e=document.documentMode,l=a.browser.msie&&(e===f||e<8),u="onhashchange"in n&&!l;a.hashchangeDelay=100;o.hashchange=a.extend(o.hashchange,{setup:function(){if(u)return false;a(m.start)},teardown:function(){if(u)return false;a(m.stop)}});m=function(){function w(){M=J=function(da){return da};if(l){T=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
J=function(){return c(T.document[b][d])};M=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};M(c())}}var p={},L,T,M,J;p.start=function(){if(!L){var da=c();M||w();(function V(){var O=c(),fa=J(da);if(O!==da){M(da=O,fa);a(n).trigger("hashchange")}else if(fa!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+fa;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){J||b()},500);else{U=ua+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}}
function b(ba,S){if(!J){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var sa=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Wa){a("#"+Sa);var Oa=a(new Image).attr({"class":"svg_icon",src:sa+Wa,width:w,height:p,alt:"icon"});qa(Oa,Sa)})}else for(var la=L.length,oa=0;oa<la;oa++){var Z=L[oa],Aa=Z.id;if(Aa==="svg_eof")break;a("#"+Aa);Z=Z.getElementsByTagNameNS(l,"svg")[0];var Ka=document.createElementNS(l,"svg");Ka.setAttributeNS(l,"viewBox",
[0,0,w,p].join(" "));var Ra=Z.getAttribute("width"),Na=Z.getAttribute("height");Z.removeAttribute("width");Z.removeAttribute("height");Z.getAttribute("viewBox")||Z.setAttribute("viewBox",[0,0,Ra,Na].join(" "));Ka.setAttribute("xmlns",l);Ka.setAttribute("width",w);Ka.setAttribute("height",p);Ka.setAttribute("xmlns:xlink",u);Ka.setAttribute("class","svg_icon");fa||(Z=Z.cloneNode(true));Ka.appendChild(Z);if(ba){fa||Ka.cloneNode(true);U.empty().append(Ka);Z=ua+e(U.html());Z=a(new Image).attr({"class":"svg_icon",
src:Z})}else Z=f(a(Ka),oa);qa(Z,Aa)}m.placement&&a.each(m.placement,function(Sa,Wa){n[Wa]&&a(Sa).each(function(Oa){var Ia=n[Wa].clone();if(Oa>0&&!ba)Ia=f(Ia,Oa,true);ra(a(this),Ia,Wa)})});if(!S){ba&&U.remove();ha&&ha.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);J=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba);
J=function(){return c(T.document[b][d])};M=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};M(c())}}var p={},L,T,M,J;p.start=function(){if(!L){var da=c();M||w();(function V(){var O=c(),ga=J(da);if(O!==da){M(da=O,ga);a(n).trigger("hashchange")}else if(ga!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ga;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){J||b()},500);else{U=ta+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}}
function b(ba,S){if(!J){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var sa=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Wa){a("#"+Sa);var Oa=a(new Image).attr({"class":"svg_icon",src:sa+Wa,width:w,height:p,alt:"icon"});pa(Oa,Sa)})}else for(var la=L.length,oa=0;oa<la;oa++){var Z=L[oa],Aa=Z.id;if(Aa==="svg_eof")break;a("#"+Aa);Z=Z.getElementsByTagNameNS(l,"svg")[0];var Ka=document.createElementNS(l,"svg");Ka.setAttributeNS(l,"viewBox",
[0,0,w,p].join(" "));var Ra=Z.getAttribute("width"),Na=Z.getAttribute("height");Z.removeAttribute("width");Z.removeAttribute("height");Z.getAttribute("viewBox")||Z.setAttribute("viewBox",[0,0,Ra,Na].join(" "));Ka.setAttribute("xmlns",l);Ka.setAttribute("width",w);Ka.setAttribute("height",p);Ka.setAttribute("xmlns:xlink",u);Ka.setAttribute("class","svg_icon");ga||(Z=Z.cloneNode(true));Ka.appendChild(Z);if(ba){ga||Ka.cloneNode(true);U.empty().append(Ka);Z=ta+e(U.html());Z=a(new Image).attr({"class":"svg_icon",
src:Z})}else Z=f(a(Ka),oa);pa(Z,Aa)}m.placement&&a.each(m.placement,function(Sa,Wa){n[Wa]&&a(Sa).each(function(Oa){var Ia=n[Wa].clone();if(Oa>0&&!ba)Ia=f(Ia,Oa,true);ra(a(this),Ia,Wa)})});if(!S){ba&&U.remove();ha&&ha.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);J=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba);
var S=Array(Math.floor((ba.length+2)/3)*4),U,sa,la,oa,Z,Aa,Ka=0,Ra=0;do{U=ba.charCodeAt(Ka++);sa=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);oa=U>>2;U=(U&3)<<4|sa>>4;Z=(sa&15)<<2|la>>6;Aa=la&63;if(isNaN(sa))Z=Aa=64;else if(isNaN(la))Aa=64;S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(oa);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);S[Ra++]=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ka<ba.length);return S.join("")}var l="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",w=m.w?m.w:24,p=m.h?m.h:24,L,T,M,J=false,da=false,V=0,O=navigator.userAgent,fa=!!window.opera;O.indexOf("Safari/")>-1&&O.indexOf("Chrome/");var ua="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('<object data="'+c+'" type=image/svg+xml>').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o);
o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ba,S,U,sa){fa&&S.css("visibility","hidden");if(m.replace){sa&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class",
"svg_icon "+U);ba.replaceWith(S)}else ba.append(S);fa&&setTimeout(function(){S.removeAttr("style")},1)},qa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)ra(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=fa?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var sa=ba[0].getElementsByTagName("*"),la=sa.length;U.each(function(oa){var Z=this.id;a(T).find("#"+Z);this.id=oa="x"+Z+S+oa;Z="url(#"+Z+")";var Aa="url(#"+oa+")";for(oa=0;oa<
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ka<ba.length);return S.join("")}var l="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",w=m.w?m.w:24,p=m.h?m.h:24,L,T,M,J=false,da=false,V=0,O=navigator.userAgent,ga=!!window.opera;O.indexOf("Safari/")>-1&&O.indexOf("Chrome/");var ta="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('<object data="'+c+'" type=image/svg+xml>').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o);
o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ba,S,U,sa){ga&&S.css("visibility","hidden");if(m.replace){sa&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class",
"svg_icon "+U);ba.replaceWith(S)}else ba.append(S);ga&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)ra(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=ga?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var sa=ba[0].getElementsByTagName("*"),la=sa.length;U.each(function(oa){var Z=this.id;a(T).find("#"+Z);this.id=oa="x"+Z+S+oa;Z="url(#"+Z+")";var Aa="url(#"+oa+")";for(oa=0;oa<
la;oa++){var Ka=sa[oa];Ka.getAttribute("fill")===Z&&Ka.setAttribute("fill",Aa);Ka.getAttribute("stroke")===Z&&Ka.setAttribute("stroke",Aa);Ka.getAttribute("filter")===Z&&Ka.setAttribute("filter",Aa)}});return ba}};a.getSvgIcon=function(c,m){var o=n[c];if(m&&o)o=f(o,0,true).clone(true);return o};a.resizeSvgIcons=function(c){var m=!a(".svg_icon:first").length;a.each(c,function(o,b){var d=a.isArray(b),e=d?b[0]:b,l=d?b[1]:b;if(m)o=o.replace(/\.svg_icon/g,"svg");a(o).each(function(){this.setAttribute("width",
e);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=e+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(c,m,o){c=document.createElementNS(n.svg,c);if(f)for(var b in m)c.setAttribute(b,m[b]);else for(b in m){var d=m[b],e=c[b];if(e&&e.constructor==="SVGLength")e.baseVal.value=d;else c.setAttribute(b,d)}o&&o.appendChild(c);return c}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(c){c=c||{};this.alpha=isNaN(c.alpha)?100:c.alpha;if(c.copy){this.type=
c.copy.type;this.alpha=c.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=c.copy.solidColor;break;case "linearGradient":this.linearGradient=c.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=c.copy.radialGradient.cloneNode(true)}}else if(c.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=c.linearGradient.cloneNode(true)}else if(c.radialGradient){this.type=
"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=c.radialGradient.cloneNode(true)}else if(c.solidColor){this.type="solidColor";this.solidColor=c.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 f=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(c){var m=
arguments;return this.each(function(){function o(ma,Y,na,K,N){var aa=N||a("stop",{"stop-color":Y,"stop-opacity":na,offset:ma},ea);if(N){Y=N.getAttribute("stop-color");na=N.getAttribute("stop-opacity");ma=N.getAttribute("offset")}else ea.appendChild(aa);if(na===null)na=1;N=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+ma*fa)+", 26)"},Cb);var Pa=
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:Y,"fill-opacity":na,transform:"translate("+(10+ma*fa)+", 26)",stroke:"#000","stroke-width":1.5},Cb);$(Pa).mousedown(function(Xa){b(this);Ya=lb;da.mousemove(l).mouseup(d);Ea=Mb.offset();Xa.preventDefault();return false}).data("stop",aa).data("bg",N).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Xa=this,fb=+aa.getAttribute("stop-opacity")||
1,nb=aa.getAttribute("stop-color")||1,Db=(parseFloat(fb)*255).toString(16);Db.length<2;)Db="0"+Db;Y=nb.substr(1)+Db;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:Y,alphaSupport:true}},function(cb){nb=cb.val("hex")?"#"+cb.val("hex"):"none";fb=cb.val("a")!==null?cb.val("a")/256:1;Xa.setAttribute("fill",nb);Xa.setAttribute("fill-opacity",fb);aa.setAttribute("stop-color",
nb);aa.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Xa=$(this);if(+this.getAttribute("offset")>ma){if(!Y){var fb=this.getAttribute("stop-color"),nb=this.getAttribute("stop-opacity");aa.setAttribute("stop-color",fb);Pa.setAttribute("fill",fb);aa.setAttribute("stop-opacity",nb===null?1:nb);Pa.setAttribute("fill-opacity",
nb===null?1:nb)}Xa.before(aa);return false}});K&&b(Pa);return aa}function b(ma){lb&&lb.setAttribute("stroke","#000");ma.setAttribute("stroke","blue");lb=ma;lb.parentNode.appendChild(lb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var ma=$(lb),Y=ma.data("stop");ma=ma.data("bg");$([lb,Y,ma]).remove()}Ya=null}function e(){var ma=Za?"rotate("+Za+","+Ma+","+mb+") ":"";ob===1&&Ja===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform",
ma+"translate("+-Ma*(ob-1)+","+-mb*(Ja-1)+") scale("+ob+","+Ja+")")}function l(ma){var Y=ma.pageX-Ea.left;ma=ma.pageY-Ea.top;Y=Y<10?10:Y>fa+10?fa+10:Y;var na="translate("+Y+", 26)";if(ma<-60||ma>130){La.setAttribute("display","block");La.setAttribute("transform",na)}else La.setAttribute("display","none");Ya.setAttribute("transform",na);$.data(Ya,"bg").setAttribute("transform",na);$.data(Ya,"stop").setAttribute("offset",(Y-10)/fa);var K=0;$(ea).find("stop").each(function(){var N=this.getAttribute("offset"),
arguments;return this.each(function(){function o(ma,Y,na,K,N){var aa=N||a("stop",{"stop-color":Y,"stop-opacity":na,offset:ma},ea);if(N){Y=N.getAttribute("stop-color");na=N.getAttribute("stop-opacity");ma=N.getAttribute("offset")}else ea.appendChild(aa);if(na===null)na=1;N=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+ma*ga)+", 26)"},Cb);var Pa=
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:Y,"fill-opacity":na,transform:"translate("+(10+ma*ga)+", 26)",stroke:"#000","stroke-width":1.5},Cb);$(Pa).mousedown(function(Xa){b(this);Ya=nb;da.mousemove(l).mouseup(d);Ea=Kb.offset();Xa.preventDefault();return false}).data("stop",aa).data("bg",N).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Xa=this,hb=+aa.getAttribute("stop-opacity")||
1,pb=aa.getAttribute("stop-color")||1,Db=(parseFloat(hb)*255).toString(16);Db.length<2;)Db="0"+Db;Y=pb.substr(1)+Db;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:Y,alphaSupport:true}},function(cb){pb=cb.val("hex")?"#"+cb.val("hex"):"none";hb=cb.val("a")!==null?cb.val("a")/256:1;Xa.setAttribute("fill",pb);Xa.setAttribute("fill-opacity",hb);aa.setAttribute("stop-color",
pb);aa.setAttribute("stop-opacity",hb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Xa=$(this);if(+this.getAttribute("offset")>ma){if(!Y){var hb=this.getAttribute("stop-color"),pb=this.getAttribute("stop-opacity");aa.setAttribute("stop-color",hb);Pa.setAttribute("fill",hb);aa.setAttribute("stop-opacity",pb===null?1:pb);Pa.setAttribute("fill-opacity",
pb===null?1:pb)}Xa.before(aa);return false}});K&&b(Pa);return aa}function b(ma){nb&&nb.setAttribute("stroke","#000");ma.setAttribute("stroke","blue");nb=ma;nb.parentNode.appendChild(nb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var ma=$(nb),Y=ma.data("stop");ma=ma.data("bg");$([nb,Y,ma]).remove()}Ya=null}function e(){var ma=Za?"rotate("+Za+","+Ma+","+ob+") ":"";qb===1&&Ja===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform",
ma+"translate("+-Ma*(qb-1)+","+-ob*(Ja-1)+") scale("+qb+","+Ja+")")}function l(ma){var Y=ma.pageX-Ea.left;ma=ma.pageY-Ea.top;Y=Y<10?10:Y>ga+10?ga+10:Y;var na="translate("+Y+", 26)";if(ma<-60||ma>130){La.setAttribute("display","block");La.setAttribute("transform",na)}else La.setAttribute("display","none");Ya.setAttribute("transform",na);$.data(Ya,"bg").setAttribute("transform",na);$.data(Ya,"stop").setAttribute("offset",(Y-10)/ga);var K=0;$(ea).find("stop").each(function(){var N=this.getAttribute("offset"),
aa=$(this);if(N<K){aa.prev().before(aa);Ga=$(ea).find("stop")}K=N})}var u=$(this),w=$.extend(true,{},jQuery.fn.jGraduateDefaults,c),p=u.attr("id"),L="#"+u.attr("id")+" ";if(L){var T=function(){switch(u.paint.type){case "radialGradient":u.paint.linearGradient=null;break;case "linearGradient":u.paint.radialGradient=null;break;case "solidColor":u.paint.radialGradient=u.paint.linearGradient=null}$.isFunction(u.okCallback)&&u.okCallback(u.paint);u.hide()},M=function(){$.isFunction(u.cancelCallback)&&u.cancelCallback();
u.hide()};$.extend(true,u,{paint:new $.jGraduate.Paint({copy:w.paint}),okCallback:$.isFunction(m[1])&&m[1]||null,cancelCallback:$.isFunction(m[2])&&m[2]||null});u.position();var J=null,da=$(window);if(u.paint.type=="none")u.paint=$.jGraduate.Paint({solidColor:"ffffff"});u.addClass("jGraduate_Picker");u.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 V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+w.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="'+
@ -34,25 +34,25 @@ p+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'
p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+w.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="'+w.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="'+w.images.clientPath+
'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba&nbsp;</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="'+w.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 fa=256,ua=fa-0,ha=fa-0,ca,ea,ra,qa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:fa,height:fa,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],sa=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad";
p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ga=256,ta=ga-0,ha=ga-0,ca,ea,ra,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:ga,height:ga,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],sa=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad";
U=ea=S.appendChild(ea)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},S);if(ca==="linearGradient")break;case "radialGradient":if(!la){ea.id=p+"_rg_jgraduate_grad";U=ea=S.appendChild(ea)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},S)}if(la){U=ea=$("#"+p+"_lg_jgraduate_grad")[0];J=u.paint[ca];o(0,"#"+J,1);var oa=typeof w.newstop;if(oa==="string")switch(w.newstop){case "same":o(1,"#"+J,1);break;case "inverse":oa="";for(var Z=0;Z<6;Z+=2){J.substr(Z,2);var Aa=(255-parseInt(J.substr(Z,2),16)).toString(16);
if(Aa.length<2)Aa=0+Aa;oa+=Aa}o(1,"#"+oa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(oa==="object")o(1,w.newstop.color||"#"+J,"opac"in w.newstop?w.newstop.opac:1)}J=parseFloat(U.getAttribute("x1")||0);oa=parseFloat(U.getAttribute("y1")||0);Z=parseFloat(U.getAttribute("x2")||1);Aa=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Ra=parseFloat(U.getAttribute("cy")||0.5),Na=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")||
Ra);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:ua,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":sa/100},S);var Wa=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:oa*fa,left:J*fa}).data("coord","start").appendTo(ba),Oa=Wa.clone().text(2).css({top:Aa*fa,left:Z*fa}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*fa,left:Ka*
fa}).data("coord","center").appendTo(ba),Qa=Ia.clone().text("F").css({top:Sa*fa,left:Na*fa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Qa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ma,Y){var na=ea.getAttribute(Y),K=isNaN(Y[1]);na||(na=K?"0.5":Y==="x2"?"1.0":"0.0");qa[Y]=$("#"+p+"_jGraduate_"+Y).val(na).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
1)this.value=1;if(!(Y[0]==="f"&&!qb))if(K&&ca==="radialGradient"||!K&&ca==="linearGradient")ea.setAttribute(Y,this.value);var N=K?Y[0]==="c"?Ia:Qa:Y[1]==="1"?Wa:Oa,aa=Y.indexOf("x")>=0?"left":"top";N.css(aa,this.value*fa)}).change()});var Ga,Cb,Mb=$("#"+p+"_jGraduate_StopSlider"),lb,ab,Ya,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Ea,ob=1,Ja=1,Za=0,Ma=Ka,mb=Ra;ab=a("svg",{width:"100%",height:45},Mb[0]);ba=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(ma){Ea=Mb.offset();if(ma.target.tagName!=="path"){var Y=ma.pageX-Ea.left-8;Y=Y<10?10:Y>fa+10?fa+10:Y;o(Y/fa,0,0,true);ma.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Cb=a("g",{},ab);a("line",{x1:10,y1:15,x2:fa+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var zb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",
$(this).val())}),eb=null,gb=function(ma){var Y=ma.pageX-wb.left,na=ma.pageY-wb.top;Y=Y<0?0:Y>fa?fa:Y;na=na<0?0:na>fa?fa:na;eb.css("left",Y).css("top",na);Y/=ua;na/=ha;var K=eb.data("coord"),N=ea;switch(K){case "start":qa.x1.val(Y);qa.y1.val(na);N.setAttribute("x1",Y);N.setAttribute("y1",na);break;case "end":qa.x2.val(Y);qa.y2.val(na);N.setAttribute("x2",Y);N.setAttribute("y2",na);break;case "center":qa.cx.val(Y);qa.cy.val(na);N.setAttribute("cx",Y);N.setAttribute("cy",na);Ma=Y;mb=na;e();break;case "focus":qa.fx.val(Y);
qa.fy.val(na);N.setAttribute("fx",Y);N.setAttribute("fy",na);e()}ma.preventDefault()},Nb=function(){eb=null;da.unbind("mousemove",gb).unbind("mouseup",Nb)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var xa=Ga.length;for(Z=0;Z<xa;Z++)o(0,0,0,0,Ga[Z]);zb.val(ea.getAttribute("spreadMethod")||"pad");var wb,qb=false;ra.setAttribute("fill-opacity",sa/100);$("#"+p+" div.grad_coord").mousedown(function(ma){ma.preventDefault();
eb=$(this);eb.offset();wb=eb.parent().offset();da.mousemove(gb).mouseup(Nb)});$("#"+p+"_jGraduate_Ok").bind("click",function(){u.paint.type=ca;u.paint[ca]=ea.cloneNode(true);u.paint.solidColor=null;T()});$("#"+p+"_jGraduate_Cancel").bind("click",function(){M()});if(ca==="radialGradient")if(qb)Qa.show();else{Qa.hide();qa.fx.val("");qa.fy.val("")}$("#"+p+"_jGraduate_match_ctr")[0].checked=!qb;var Ab,sb;$("#"+p+"_jGraduate_match_ctr").change(function(){qb=!this.checked;Qa.toggle(qb);qa.fx.val("");qa.fy.val("");
var ma=ea;if(qb){var Y=Ab||0.5,na=sb||0.5;ma.setAttribute("fx",Y);ma.setAttribute("fy",na);qa.fx.val(Y);qa.fy.val(na)}else{Ab=ma.getAttribute("fx");sb=ma.getAttribute("fy");ma.removeAttribute("fx");ma.removeAttribute("fy")}});Ga=ea.getElementsByTagNameNS(n.svg,"stop");xa=Ga.length;if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var kb;sa=O=0;if(ca==="radialGradient"){S=ea.gradientTransform.baseVal;if(S.numberOfItems===2){xa=
Ra);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:ta,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":sa/100},S);var Wa=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:oa*ga,left:J*ga}).data("coord","start").appendTo(ba),Oa=Wa.clone().text(2).css({top:Aa*ga,left:Z*ga}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ga,left:Ka*
ga}).data("coord","center").appendTo(ba),Qa=Ia.clone().text("F").css({top:Sa*ga,left:Na*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Qa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ma,Y){var na=ea.getAttribute(Y),K=isNaN(Y[1]);na||(na=K?"0.5":Y==="x2"?"1.0":"0.0");pa[Y]=$("#"+p+"_jGraduate_"+Y).val(na).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
1)this.value=1;if(!(Y[0]==="f"&&!rb))if(K&&ca==="radialGradient"||!K&&ca==="linearGradient")ea.setAttribute(Y,this.value);var N=K?Y[0]==="c"?Ia:Qa:Y[1]==="1"?Wa:Oa,aa=Y.indexOf("x")>=0?"left":"top";N.css(aa,this.value*ga)}).change()});var Ga,Cb,Kb=$("#"+p+"_jGraduate_StopSlider"),nb,ab,Ya,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Ea,qb=1,Ja=1,Za=0,Ma=Ka,ob=Ra;ab=a("svg",{width:"100%",height:45},Kb[0]);ba=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(ma){Ea=Kb.offset();if(ma.target.tagName!=="path"){var Y=ma.pageX-Ea.left-8;Y=Y<10?10:Y>ga+10?ga+10:Y;o(Y/ga,0,0,true);ma.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Cb=a("g",{},ab);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var xb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",
$(this).val())}),fb=null,ib=function(ma){var Y=ma.pageX-ub.left,na=ma.pageY-ub.top;Y=Y<0?0:Y>ga?ga:Y;na=na<0?0:na>ga?ga:na;fb.css("left",Y).css("top",na);Y/=ta;na/=ha;var K=fb.data("coord"),N=ea;switch(K){case "start":pa.x1.val(Y);pa.y1.val(na);N.setAttribute("x1",Y);N.setAttribute("y1",na);break;case "end":pa.x2.val(Y);pa.y2.val(na);N.setAttribute("x2",Y);N.setAttribute("y2",na);break;case "center":pa.cx.val(Y);pa.cy.val(na);N.setAttribute("cx",Y);N.setAttribute("cy",na);Ma=Y;ob=na;e();break;case "focus":pa.fx.val(Y);
pa.fy.val(na);N.setAttribute("fx",Y);N.setAttribute("fy",na);e()}ma.preventDefault()},Lb=function(){fb=null;da.unbind("mousemove",ib).unbind("mouseup",Lb)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var xa=Ga.length;for(Z=0;Z<xa;Z++)o(0,0,0,0,Ga[Z]);xb.val(ea.getAttribute("spreadMethod")||"pad");var ub,rb=false;ra.setAttribute("fill-opacity",sa/100);$("#"+p+" div.grad_coord").mousedown(function(ma){ma.preventDefault();
fb=$(this);fb.offset();ub=fb.parent().offset();da.mousemove(ib).mouseup(Lb)});$("#"+p+"_jGraduate_Ok").bind("click",function(){u.paint.type=ca;u.paint[ca]=ea.cloneNode(true);u.paint.solidColor=null;T()});$("#"+p+"_jGraduate_Cancel").bind("click",function(){M()});if(ca==="radialGradient")if(rb)Qa.show();else{Qa.hide();pa.fx.val("");pa.fy.val("")}$("#"+p+"_jGraduate_match_ctr")[0].checked=!rb;var yb,sb;$("#"+p+"_jGraduate_match_ctr").change(function(){rb=!this.checked;Qa.toggle(rb);pa.fx.val("");pa.fy.val("");
var ma=ea;if(rb){var Y=yb||0.5,na=sb||0.5;ma.setAttribute("fx",Y);ma.setAttribute("fy",na);pa.fx.val(Y);pa.fy.val(na)}else{yb=ma.getAttribute("fx");sb=ma.getAttribute("fy");ma.removeAttribute("fx");ma.removeAttribute("fy")}});Ga=ea.getElementsByTagNameNS(n.svg,"stop");xa=Ga.length;if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var mb;sa=O=0;if(ca==="radialGradient"){S=ea.gradientTransform.baseVal;if(S.numberOfItems===2){xa=
S.getItem(0);S=S.getItem(1);if(xa.type===2&&S.type===3){xa=S.matrix;if(xa.a!==1)O=Math.round(-(1-xa.a)*100);else if(xa.d!==1)O=Math.round((1-xa.d)*100)}}else if(S.numberOfItems===3){ba=S.getItem(0);xa=S.getItem(1);S=S.getItem(2);if(ba.type===4&&xa.type===2&&S.type===3){sa=Math.round(ba.angle);xa=S.matrix;if(xa.a!==1)O=Math.round(-(1-xa.a)*100);else if(xa.d!==1)O=Math.round((1-xa.d)*100)}}}O={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+p+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||
0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:sa}};$.each(O,function(ma,Y){var na=$(Y.handle);na.mousedown(function(K){var N=na.parent();kb={type:ma,elem:na,input:$(Y.input),parent:N,offset:N.offset()};da.mousemove(Gb).mouseup(Hb);K.preventDefault()});$(Y.input).val(Y.val).change(function(){var K=
+this.value,N=0,aa=ca==="radialGradient";switch(ma){case "radius":aa&&ea.setAttribute("r",K/100);N=Math.pow(K/100,0.4)/2*145;break;case "opacity":u.paint.alpha=K;ra.setAttribute("fill-opacity",K/100);N=K*1.45;break;case "ellip":ob=Ja=1;if(K===0){N=72.5;break}if(K>99.5)K=99.5;if(K>0)Ja=1-K/100;else ob=-(K/100)-1;N=145*((K+100)/2)/100;aa&&e();break;case "angle":Za=K;N=Za/180;N+=0.5;N*=145;aa&&e()}if(N>145)N=145;else if(N<0)N=0;na.css({"margin-left":N-5})}).change()});var Gb=function(ma){var Y=ma.pageX-
kb.offset.left-parseInt(kb.parent.css("border-left-width"));if(Y>145)Y=145;if(Y<=0)Y=0;var na=Y-5;Y/=145;switch(kb.type){case "radius":Y=Math.pow(Y*2,2.5);if(Y>0.98&&Y<1.02)Y=1;if(Y<=0.01)Y=0.01;ea.setAttribute("r",Y);break;case "opacity":u.paint.alpha=parseInt(Y*100);ra.setAttribute("fill-opacity",Y);break;case "ellip":Ja=ob=1;if(Y<0.5){Y/=0.5;ob=Y<=0?0.01:Y}else if(Y>0.5){Y/=0.5;Y=2-Y;Ja=Y<=0?0.01:Y}e();Y-=1;if(Ja===Y+1)Y=Math.abs(Y);break;case "angle":Y-=0.5;Za=Y*=180;e();Y/=100}kb.elem.css({"margin-left":na});
Y=Math.round(Y*100);kb.input.val(Y);ma.preventDefault()},Hb=function(){da.unbind("mousemove",Gb).unbind("mouseup",Hb);kb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(J=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});V.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:J,alphaSupport:true}},
function(ma){u.paint.type="solidColor";u.paint.alpha=ma.val("ahex")?Math.round(ma.val("a")/255*100):100;u.paint.solidColor=ma.val("hex")?ma.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){M()});var Ob=$(L+" .jGraduate_tabs li");Ob.click(function(){Ob.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ma=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ma==="rg"||ma==="lg"){$(".jGraduate_"+ma+"_field").show();$(".jGraduate_"+
(ma==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ma+"_jgraduate_grad)");ca=ma==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var Y=$("#"+p+"_"+ma+"_jgraduate_grad")[0];if(ea!==Y){var na=$(ea).find("stop");$(Y).empty().append(na);ea=Y;Y=zb.val();ea.setAttribute("spreadMethod",Y)}qb=ma==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Na&&Ra==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(qb);if(qb)$("#"+
p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Ob.removeClass("jGraduate_tab_current");var Pb;switch(u.paint.type){case "linearGradient":Pb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Pb=$(L+" .jGraduate_tab_radgrad");break;default:Pb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Pb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={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,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass?
0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:sa}};$.each(O,function(ma,Y){var na=$(Y.handle);na.mousedown(function(K){var N=na.parent();mb={type:ma,elem:na,input:$(Y.input),parent:N,offset:N.offset()};da.mousemove(Gb).mouseup(Hb);K.preventDefault()});$(Y.input).val(Y.val).change(function(){var K=
+this.value,N=0,aa=ca==="radialGradient";switch(ma){case "radius":aa&&ea.setAttribute("r",K/100);N=Math.pow(K/100,0.4)/2*145;break;case "opacity":u.paint.alpha=K;ra.setAttribute("fill-opacity",K/100);N=K*1.45;break;case "ellip":qb=Ja=1;if(K===0){N=72.5;break}if(K>99.5)K=99.5;if(K>0)Ja=1-K/100;else qb=-(K/100)-1;N=145*((K+100)/2)/100;aa&&e();break;case "angle":Za=K;N=Za/180;N+=0.5;N*=145;aa&&e()}if(N>145)N=145;else if(N<0)N=0;na.css({"margin-left":N-5})}).change()});var Gb=function(ma){var Y=ma.pageX-
mb.offset.left-parseInt(mb.parent.css("border-left-width"));if(Y>145)Y=145;if(Y<=0)Y=0;var na=Y-5;Y/=145;switch(mb.type){case "radius":Y=Math.pow(Y*2,2.5);if(Y>0.98&&Y<1.02)Y=1;if(Y<=0.01)Y=0.01;ea.setAttribute("r",Y);break;case "opacity":u.paint.alpha=parseInt(Y*100);ra.setAttribute("fill-opacity",Y);break;case "ellip":Ja=qb=1;if(Y<0.5){Y/=0.5;qb=Y<=0?0.01:Y}else if(Y>0.5){Y/=0.5;Y=2-Y;Ja=Y<=0?0.01:Y}e();Y-=1;if(Ja===Y+1)Y=Math.abs(Y);break;case "angle":Y-=0.5;Za=Y*=180;e();Y/=100}mb.elem.css({"margin-left":na});
Y=Math.round(Y*100);mb.input.val(Y);ma.preventDefault()},Hb=function(){da.unbind("mousemove",Gb).unbind("mouseup",Hb);mb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(J=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});V.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:J,alphaSupport:true}},
function(ma){u.paint.type="solidColor";u.paint.alpha=ma.val("ahex")?Math.round(ma.val("a")/255*100):100;u.paint.solidColor=ma.val("hex")?ma.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){M()});var Mb=$(L+" .jGraduate_tabs li");Mb.click(function(){Mb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ma=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ma==="rg"||ma==="lg"){$(".jGraduate_"+ma+"_field").show();$(".jGraduate_"+
(ma==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ma+"_jgraduate_grad)");ca=ma==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var Y=$("#"+p+"_"+ma+"_jgraduate_grad")[0];if(ea!==Y){var na=$(ea).find("stop");$(Y).empty().append(na);ea=Y;Y=xb.val();ea.setAttribute("spreadMethod",Y)}rb=ma==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Na&&Ra==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(rb);if(rb)$("#"+
p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Mb.removeClass("jGraduate_tab_current");var Nb;switch(u.paint.type){case "linearGradient":Nb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Nb=$(L+" .jGraduate_tab_radgrad");break;default:Nb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Nb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={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,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass?
a.downClass:"down",reset:a&&a.reset?a.reset:this.value,delay:a&&a.delay?Number(a.delay):500,interval:a&&a.interval?Number(a.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.spinCfg.smallStep=a&&a.smallStep?a.smallStep:this.spinCfg.step/2;this.adjustValue=function(f){f=isNaN(this.value)?this.spinCfg.reset:$.isFunction(this.spinCfg.stepfunc)?this.spinCfg.stepfunc(this,f):Number((Number(this.value)+Number(f)).toFixed(5));if(this.spinCfg.min!==
null)f=Math.max(f,this.spinCfg.min);if(this.spinCfg.max!==null)f=Math.min(f,this.spinCfg.max);this.value=f;$.isFunction(this.spinCfg.callback)&&this.spinCfg.callback(this)};$(this).addClass(a&&a.spinClass?a.spinClass:"spin-button").mousemove(function(f){var c=f.pageX||f.x,m=f.pageY||f.y;f=f.target||f.srcElement;var o=svgEditor.tool_scale||1,b=$(f).height()/2;c=c>n(f,"offsetLeft")+f.offsetWidth*o-this.spinCfg._btn_width?m<n(f,"offsetTop")+b*o?1:-1:0;if(c!==this.spinCfg._direction){switch(c){case 1:$(this).removeClass(this.spinCfg.downClass).addClass(this.spinCfg.upClass);
break;case -1:$(this).removeClass(this.spinCfg.upClass).addClass(this.spinCfg.downClass);break;default:$(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass)}this.spinCfg._direction=c}}).mouseout(function(){$(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);this.spinCfg._direction=null;window.clearInterval(this.spinCfg._repeat);window.clearTimeout(this.spinCfg._delay)}).mousedown(function(f){if(f.button===0&&this.spinCfg._direction!=0){var c=this,
@ -65,13 +65,13 @@ $(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:u-o.left,y:
function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(f){if(f==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(f!=undefined)for(var c=f.split(","),m=0;m<c.length;m++)$(this).find('A[href="'+c[m]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(f){if(f==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(f!=
undefined)for(var c=f.split(","),m=0;m<c.length;m++)$(this).find('A[href="'+c[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,f=document.createElementNS("http://www.w3.org/2000/svg","svg"),c=!!window.opera,m=n.indexOf("AppleWebKit")>=0,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>=
0,u="ontouchstart"in window,w=!!f.querySelector,p=!!document.evaluate,L=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ha=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(ua,0);return true}catch(ca){}return false}(),T=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ha=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(ua,
0);return true}catch(ca){}return false}(),M=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);ha.setAttribute("x",5);ua.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(ua);return ha===0}(),J=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg",
"svg");document.documentElement.appendChild(ua);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");ua.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(ua);return ha.height>4&&ha.height<5}(),da=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca=
document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);ua.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(ua);return ha.width==15}(),V=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("x",0.1);(ua=ua.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 ua}(),O=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("style","vector-effect:non-scaling-stroke");return ua.style.vectorEffect==="non-scaling-stroke"}(),fa=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();ua.appendItem(ha);return ua.getItem(0)==ha}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o};
0,u="ontouchstart"in window,w=!!f.querySelector,p=!!document.evaluate,L=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(ta,0);return true}catch(ca){}return false}(),T=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(ta,
0);return true}catch(ca){}return false}(),M=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);ha.setAttribute("x",5);ta.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(ta);return ha===0}(),J=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg",
"svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");ta.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(ta);return ha.height>4&&ha.height<5}(),da=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca=
document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);ta.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(ta);return ha.width==15}(),V=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("x",0.1);(ta=ta.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 ta}(),O=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("style","vector-effect:non-scaling-stroke");return ta.style.vectorEffect==="non-scaling-stroke"}(),ga=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();ta.appendItem(ha);return ta.getItem(0)==ha}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o};
svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return J};
svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return fa}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{};
svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return ga}}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(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m<this.numberOfItems;++m){var o=this._list.getItem(m);c=c;o=o;var b=o.matrix,d="";switch(o.type){case 1:d="matrix("+[b.a,b.b,b.c,b.d,b.e,b.f].join(",")+")";break;case 2:d="translate("+b.e+","+b.f+")";break;case 3:d=
b.a==b.d?"scale("+b.a+")":"scale("+b.a+","+b.d+")";break;case 4:var e=0;d=0;if(o.angle!=0){e=1-b.a;d=(e*b.f+b.b*b.e)/(e*e+b.b*b.b);e=(b.e-b.b*d)/e}d="rotate("+o.angle+" "+e+","+d+")"}c=c+(d+" ")}this._elem.setAttribute("transform",c)};this._list=this;this._init=function(){var c=this._elem.getAttribute("transform");if(c)for(var m=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,o=true;o;){o=c.match(m);c=c.replace(m,"");if(o&&o[1]){var b=o[1].split(/\s*\(/),d=b[0];b=b[1].match(/\s*(.*?)\s*\)/);
b[1]=b[1].replace(/(\d)-/g,"$1 -");var e=b[1].split(/[, ]+/),l="abcdef".split(""),u=a.createSVGMatrix();$.each(e,function(L,T){e[L]=parseFloat(T);if(d=="matrix")u[l[L]]=e[L]});b=a.createSVGTransform();var w="set"+d.charAt(0).toUpperCase()+d.slice(1),p=d=="matrix"?[u]:e;if(d=="scale"&&p.length==1)p.push(p[0]);else if(d=="translate"&&p.length==1)p.push(0);else if(d=="rotate"&&p.length==1){p.push(0);p.push(0)}b[w].apply(b,p);this._list.appendItem(b)}}};this._removeFromOtherLists=function(c){if(c){var m=
@ -97,7 +97,7 @@ e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|p;d+=String.fromCharCode(e);if(w!=64)d+=
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(u){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}};
svgedit.utilities.walkTreePost=function(b,d){if(b&&b.nodeType==1){for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d);d(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){return b.getAttributeNS("http://www.w3.org/1999/xlink",
"href")};svgedit.utilities.setHref=function(b,d){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d)};svgedit.utilities.findDefs=function(b){b=f.getSVGContent().documentElement;var d=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return d=d.length>0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var l=d.getItem(0),
u=[l.x,l.y];for(l=0;l<e;l++){var w=d.getItem(l);if(typeof w.x!="undefined"){b[0].push(u[0]);b[1].push(u[1]);if(w.x1){for(var p=[w.x1,w.y1],L=[w.x2,w.y2],T=[w.x,w.y],M=0;M<2;M++){w=function(fa){return Math.pow(1-fa,3)*u[M]+3*Math.pow(1-fa,2)*fa*p[M]+3*(1-fa)*Math.pow(fa,2)*L[M]+Math.pow(fa,3)*T[M]};var J=6*u[M]-12*p[M]+6*L[M],da=-3*u[M]+9*p[M]-9*L[M]+3*T[M],V=3*p[M]-3*u[M];if(da==0){if(J!=0){J=-V/J;0<J&&J<1&&b[M].push(w(J))}}else{V=Math.pow(J,2)-4*V*da;if(!(V<0)){var O=(-J+Math.sqrt(V))/(2*da);0<O&&
u=[l.x,l.y];for(l=0;l<e;l++){var w=d.getItem(l);if(typeof w.x!="undefined"){b[0].push(u[0]);b[1].push(u[1]);if(w.x1){for(var p=[w.x1,w.y1],L=[w.x2,w.y2],T=[w.x,w.y],M=0;M<2;M++){w=function(ga){return Math.pow(1-ga,3)*u[M]+3*Math.pow(1-ga,2)*ga*p[M]+3*(1-ga)*Math.pow(ga,2)*L[M]+Math.pow(ga,3)*T[M]};var J=6*u[M]-12*p[M]+6*L[M],da=-3*u[M]+9*p[M]-9*L[M]+3*T[M],V=3*p[M]-3*u[M];if(da==0){if(J!=0){J=-V/J;0<J&&J<1&&b[M].push(w(J))}}else{V=Math.pow(J,2)-4*V*da;if(!(V<0)){var O=(-J+Math.sqrt(V))/(2*da);0<O&&
O<1&&b[M].push(w(O));J=(-J-Math.sqrt(V))/(2*da);0<J&&J<1&&b[M].push(w(J))}}}u=T}else{b[0].push(w.x);b[1].push(w.y)}}}d=Math.min.apply(null,b[0]);e=Math.max.apply(null,b[0])-d;l=Math.min.apply(null,b[1]);b=Math.max.apply(null,b[1])-l;return{x:d,y:l,width:e,height:b}};svgedit.utilities.getBBox=function(b){var d=b||f.geSelectedElements()[0];if(b.nodeType!=1)return null;b=null;var e=d.nodeName;switch(e){case "text":if(d.textContent===""){d.textContent="a";b=d.getBBox();d.textContent=""}else try{b=d.getBBox()}catch(l){}break;
case "path":if(svgedit.browser.supportsPathBBox())try{b=d.getBBox()}catch(u){}else b=svgedit.utilities.getPathBBox(d);break;case "g":case "a":b=a(d);break;default:if(e==="use")b=a(d,true);if(e==="use"){b||(b=d.getBBox());if(!svgedit.browser.isWebkit()){e={};e.width=b.width;e.height=b.height;e.x=b.x+parseFloat(d.getAttribute("x")||0);e.y=b.y+parseFloat(d.getAttribute("y")||0);b=e}}else if(~n.indexOf(e))try{b=d.getBBox()}catch(w){d=$(d).closest("foreignObject");if(d.length)try{b=d[0].getBBox()}catch(p){b=
null}else b=null}}if(b)b=svgedit.utilities.bboxToObj(b);return b};svgedit.utilities.getRotationAngle=function(b,d){var e=b||f.getSelectedElements()[0];e=svgedit.transformlist.getTransformList(e);if(!e)return 0;for(var l=e.numberOfItems,u=0;u<l;++u){var w=e.getItem(u);if(w.type==4)return d?w.angle*Math.PI/180:w.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(b){return o.querySelector("#"+b)}:svgedit.browser.supportsXpath()?function(b){return c.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
@ -148,11 +148,12 @@ u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u)
"M"+u+","+p+" L"+(u+L)+","+p+" "+(u+L)+","+(p+T)+" "+u+","+(p+T)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;p-=3.5;this.gripCoords={nw:[u,p],ne:[u+L,p],sw:[u,p+T],se:[u+L,p+T],n:[u+L/2,p],w:[u,p+T/2],e:[u+L,p+T/2],s:[u+L/2,p+T]};for(var da in this.gripCoords){c=this.gripCoords[da];o[da].setAttribute("x",c[0]);o[da].setAttribute("y",c[1])}this.rotateCoords={nw:[u,p],ne:[u+L+8,p],sw:[u,p+T+8],se:[u+L+8,p+T+8]};for(da in this.rotateCoords){c=this.rotateCoords[da];
m.rotateGrips[da].setAttribute("cx",c[0]);m.rotateGrips[da].setAttribute("cy",c[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 c in this.rotateGrips){var m=a.createSVGElement({element:"circle",
attr:{id:"selectorGrip_rotate_"+c,fill:"transparent",r:8,stroke:"transparent","stroke-width":0,style:"cursor:url("+n.imgPath+"rotate.png) 12 12, auto;"}});$.data(m,"dir",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}});$.data(m,"dir",c);$.data(m,
"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=n.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[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"}});c.appendChild(m);a.svgRoot().insertBefore(c,
a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var m=this.selectors.length;if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var o=0;o<m;++o)if(this.selectors[o]&&!this.selectors[o].locked){this.selectors[o].locked=true;this.selectors[o].reset(c);this.selectorMap[c.id]=this.selectors[o];return this.selectors[o]}this.selectors[m]=new svgedit.select.Selector(m,c);this.selectorParentGroup.appendChild(this.selectors[m].selectorGroup);
this.selectorMap[c.id]=this.selectors[m];return this.selectors[m]};svgedit.select.SelectorManager.prototype.releaseSelector=function(c){if(c!=null)for(var m=this.selectors.length,o=this.selectorMap[c.id],b=0;b<m;++b)if(this.selectors[b]&&this.selectors[b]==o){o.locked==false&&console.log("WARNING! selector was released but was already unlocked");delete this.selectorMap[c.id];o.locked=false;o.selectedElement=null;o.showGrips(false);try{o.selectorGroup.setAttribute("display","none")}catch(d){}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(c,m){n=c;a=m;f=new svgedit.select.SelectorManager};svgedit.select.getSelectorManager=function(){return f}})();svgedit=svgedit||{};
attr:{id:"selectorGrip_rotate_"+c,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",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}});
$.data(m,"dir",c);$.data(m,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=n.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[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"}});c.appendChild(m);
a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var m=this.selectors.length;if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var o=0;o<m;++o)if(this.selectors[o]&&!this.selectors[o].locked){this.selectors[o].locked=true;this.selectors[o].reset(c);this.selectorMap[c.id]=this.selectors[o];return this.selectors[o]}this.selectors[m]=new svgedit.select.Selector(m,
c);this.selectorParentGroup.appendChild(this.selectors[m].selectorGroup);this.selectorMap[c.id]=this.selectors[m];return this.selectors[m]};svgedit.select.SelectorManager.prototype.releaseSelector=function(c){if(c!=null)for(var m=this.selectors.length,o=this.selectorMap[c.id],b=0;b<m;++b)if(this.selectors[b]&&this.selectors[b]==o){o.locked==false&&console.log("WARNING! selector was released but was already unlocked");delete this.selectorMap[c.id];o.locked=false;o.selectedElement=null;o.showGrips(false);
try{o.selectorGroup.setAttribute("display","none")}catch(d){}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(c,m){n=c;a=m;f=new svgedit.select.SelectorManager};
svgedit.select.getSelectorManager=function(){return f}})();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},f=n.LET_DOCUMENT_DECIDE;svgedit.draw.Layer=function(c,m){this.name_=c;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(c,m){f=c==false?n.NEVER_RANDOMIZE:
n.ALWAYS_RANDOMIZE;if(f==n.ALWAYS_RANDOMIZE&&!m.getNonce())m.setNonce(Math.floor(Math.random()*100001));else f==n.NEVER_RANDOMIZE&&m.getNonce()&&m.clearNonce()};svgedit.draw.Drawing=function(c,m){if(!c||!c.tagName||!c.namespaceURI||c.tagName!="svg"||c.namespaceURI!="http://www.w3.org/2000/svg")throw"Error: svgedit.draw.Drawing instance initialized without a <svg> element";this.svgElem_=c;this.obj_num=0;this.idPrefix=m||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_=
"";var o=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(o&&f!=n.NEVER_RANDOMIZE)this.nonce_=o;else f==n.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(c){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+c):$(this.svgElem_).find("[id="+c+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_};
@ -195,325 +196,326 @@ dy-=newcy;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-angle;return{x:(r*Mat
1;L=w.getItem(p);var T=L.pathSegType;if(T!=1){var M=b(L.x,L.y);M=[M.x,M.y];if(L.x1!=null&&L.x2!=null){c_vals1=b(L.x1,L.y1);c_vals2=b(L.x2,L.y2);M.splice(M.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(T,p,M)}}svgedit.utilities.getBBox(d);w=svgroot.createSVGTransform();d=svgedit.transformlist.getTransformList(d);w.setRotate(e*180/Math.PI,u,l);d.replaceItem(w,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,f){var c=this.length;if(!c)return a.apply(this,arguments);for(var m=0;m<c;m++){var o=this[m];if(o.namespaceURI==="http://www.w3.org/2000/svg")if(f!==undefined)o.setAttribute(n,f);else if($.isArray(n)){c=n.length;for(m={};c--;){var b=n[c],d=o.getAttribute(b);if(d||d==="0")d=isNaN(d)?d:d-0;m[b]=d}return m}else if(typeof n==="object")for(b in n)o.setAttribute(b,n[b]);else{if((d=o.getAttribute(n))||d==="0")d=isNaN(d)?d:d-0;return d}else return a.apply(this,
arguments)}return this}})();
$.SvgCanvas=function(a,n){function f(g,h){for(var k=svgedit.utilities.getBBox(g),v=0;v<2;v++){var s=v===0?"fill":"stroke",E=g.getAttribute(s);if(E&&E.indexOf("url(")===0){E=N(E);if(E.tagName==="linearGradient"){var z=E.getAttribute("x1")||0,t=E.getAttribute("y1")||0,B=E.getAttribute("x2")||1,F=E.getAttribute("y2")||0;z=k.width*z+k.x;t=k.height*t+k.y;B=k.width*B+k.x;F=k.height*F+k.y;z=O(z,t,h);F=O(B,F,h);B={};B.x1=(z.x-k.x)/k.width;B.y1=(z.y-k.y)/k.height;B.x2=(F.x-k.x)/k.width;B.y2=(F.y-k.y)/k.height;
E=E.cloneNode(true);$(E).attr(B);E.id=na();xb().appendChild(E);g.setAttribute(s,"url(#"+E.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(m,n);var o=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+c+'" xlinkns="http://www.w3.org/1999/xlink" width="'+o[0]+'" height="'+o[1]+'" x="'+o[0]+'" y="'+o[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,
$.SvgCanvas=function(a,n){function f(g,h){for(var k=svgedit.utilities.getBBox(g),v=0;v<2;v++){var s=v===0?"fill":"stroke",E=g.getAttribute(s);if(E&&E.indexOf("url(")===0){E=N(E);if(E.tagName==="linearGradient"){var z=E.getAttribute("x1")||0,t=E.getAttribute("y1")||0,C=E.getAttribute("x2")||1,F=E.getAttribute("y2")||0;z=k.width*z+k.x;t=k.height*t+k.y;C=k.width*C+k.x;F=k.height*F+k.y;z=O(z,t,h);F=O(C,F,h);C={};C.x1=(z.x-k.x)/k.width;C.y1=(z.y-k.y)/k.height;C.x2=(F.x-k.x)/k.width;C.y2=(F.y-k.y)/k.height;
E=E.cloneNode(true);$(E).attr(C);E.id=na();vb().appendChild(E);g.setAttribute(s,"url(#"+E.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(m,n);var o=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+c+'" xlinkns="http://www.w3.org/1999/xlink" width="'+o[0]+'" height="'+o[1]+'" x="'+o[0]+'" y="'+o[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(e);var l=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[1],overflow:m.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(e);var g=d.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(g)})();var u="svg_";b.setIdPrefix=
function(g){u=g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=b.getCurrentDrawing=function(){return b.current_drawing_},p=1,L=null,T={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}};T.text=$.extend(true,{},T.shape);$.extend(T.text,
{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=T.shape,J=Array(1),da=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=w().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(L||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,
"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,fa=b.matrixMultiply=svgedit.math.matrixMultiply,ua=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform,
ca=svgedit.math.snapToAngle,ea=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 ob.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return J},
getSVGContent:function(){return l}});var qa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,oa=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,ga=b.matrixMultiply=svgedit.math.matrixMultiply,ta=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform,
ca=svgedit.math.snapToAngle,ea=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 qb.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return J},
getSVGContent:function(){return l}});var pa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,oa=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
Ra=svgedit.history.MoveElementCommand,Na=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Wa=svgedit.history.ChangeElementCommand,Oa=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var k=svgedit.history.HistoryEventTypes;if(g==k.BEFORE_UNAPPLY||g==k.BEFORE_APPLY)b.clearSelection();else if(g==k.AFTER_APPLY||g==k.AFTER_UNAPPLY){var v=h.elements();b.pathActions.clear();K("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v==
Ra.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Na.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Na.type())k&&ab(h.elem);else k||ab(h.elem);h.elem.tagName==="use"&&cc(h.elem)}else if(v==Wa.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k=
v.parentNode;var s=v.nextSibling;k.removeChild(v);k.insertBefore(v,s)}}}}}});var Ia=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(m,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Qa=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return e}});
svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Cb={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"},Mb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],lb=$.data,
ab=function(g){var h=$(g).attr(Mb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=qa(v).substr(1);if(!la(v)){xb().appendChild(Ab[v]);delete Ab[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h<k;h++)ab(g[h])}},Ya={},La=m.imgPath+"logo.png",Ea=[],ob={round_digits:5},Ja=false,Za=null,Ma="select",mb="none",zb={},eb=T.text,gb=M,Nb=null,xa=null,wb=[],qb={},Ab={};b.clipBoard=[];var sb=this.runExtensions=function(g,h,k){var v=false;if(k)v=[];$.each(qb,function(s,E){if(g in E)if(k)v.push(E[g](h));
else v=E[g](h)});return v};this.addExtension=function(g,h){if(g in qb)console.log('Cannot add extension "'+g+'", an extension by that name already exists"');else{var k=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:e,svgcontent:l,nonce:w().getNonce(),selectorManager:Qa})):h;qb[g]=k;K("extension_added",k)}};var kb=this.round=function(g){return parseInt(g*p)/p},Gb=this.getIntersectionList=function(g){if(xa==null)return null;var h=L||w().getCurrentLayer();wb.length||(wb=Ob(h));var k=null;
try{k=h.getIntersectionList(g,null)}catch(v){}if(k==null||typeof k.item!="function"){k=[];if(g)g=g;else{g=xa.getBBox();h={};for(var s in g)h[s]=g[s]/p;g=h}for(s=wb.length;s--;)g.width&&g.width&&svgedit.math.rectsIntersect(g,wb[s].bbox)&&k.push(wb[s].elem)}return k};getStrokedBBox=this.getStrokedBBox=function(g){g||(g=Hb());if(!g.length)return false;var h=function(F){try{var C=svgedit.utilities.getBBox(F),D=svgedit.utilities.getRotationAngle(F);if(D&&D%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(F))){D=
false;if(["ellipse","path","line","polyline","polygon"].indexOf(F.tagName)>=0)C=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var H=F.getAttribute("rx"),G=F.getAttribute("ry");if(H||G)C=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),R=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(R);R.appendChild(P);C=svgedit.utilities.bboxToObj(R.getBBox());W.removeChild(R)}}return C}catch(ta){console.log(F,ta);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});
if(k==null)return null;var v=k.x+k.width,s=k.y+k.height,E=k.x,z=k.y,t=function(F){var C=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(C))D+=C/2;return D},B=[];$.each(g,function(F,C){var D=h(C);if(D){var H=t(C);E=Math.min(E,D.x-H);z=Math.min(z,D.y-H);B.push(D)}});k.x=E;k.y=z;$.each(g,function(F,C){var D=B[F];if(D&&C.nodeType==1){var H=t(C);v=Math.max(v,D.x+D.width+H);s=Math.max(s,D.y+D.height+H)}});k.width=v-E;k.height=s-z;return k};var Hb=this.getVisibleElements=function(g){g||
(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Ob=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},Pb=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=na()},ma=function(g){var h=document.createElementNS(g.namespaceURI,
svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Cb={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"},Kb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],nb=$.data,
ab=function(g){var h=$(g).attr(Kb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){vb().appendChild(yb[v]);delete yb[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h<k;h++)ab(g[h])}},Ya={},La=m.imgPath+"logo.png",Ea=[],qb={round_digits:5},Ja=false,Za=null,Ma="select",ob="none",xb={},fb=T.text,ib=M,Lb=null,xa=null,ub=[],rb={},yb={};b.clipBoard=[];var sb=this.runExtensions=function(g,h,k){var v=false;if(k)v=[];$.each(rb,function(s,E){if(g in E)if(k)v.push(E[g](h));
else v=E[g](h)});return v};this.addExtension=function(g,h){if(g in rb)console.log('Cannot add extension "'+g+'", an extension by that name already exists"');else{var k=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:e,svgcontent:l,nonce:w().getNonce(),selectorManager:Qa})):h;rb[g]=k;K("extension_added",k)}};var mb=this.round=function(g){return parseInt(g*p)/p},Gb=this.getIntersectionList=function(g){if(xa==null)return null;var h=L||w().getCurrentLayer();ub.length||(ub=Mb(h));var k=null;
try{k=h.getIntersectionList(g,null)}catch(v){}if(k==null||typeof k.item!="function"){k=[];if(g)g=g;else{g=xa.getBBox();h={};for(var s in g)h[s]=g[s]/p;g=h}for(s=ub.length;s--;)g.width&&g.width&&svgedit.math.rectsIntersect(g,ub[s].bbox)&&k.push(ub[s].elem)}return k};getStrokedBBox=this.getStrokedBBox=function(g){g||(g=Hb());if(!g.length)return false;var h=function(F){try{var B=svgedit.utilities.getBBox(F),D=svgedit.utilities.getRotationAngle(F);if(D&&D%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(F))){D=
false;if(["ellipse","path","line","polyline","polygon"].indexOf(F.tagName)>=0)B=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var H=F.getAttribute("rx"),G=F.getAttribute("ry");if(H||G)B=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),Q=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(Q);Q.appendChild(P);B=svgedit.utilities.bboxToObj(Q.getBBox());W.removeChild(Q)}}return B}catch(ua){console.log(F,ua);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});
if(k==null)return null;var v=k.x+k.width,s=k.y+k.height,E=k.x,z=k.y,t=function(F){var B=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(B))D+=B/2;return D},C=[];$.each(g,function(F,B){var D=h(B);if(D){var H=t(B);E=Math.min(E,D.x-H);z=Math.min(z,D.y-H);C.push(D)}});k.x=E;k.y=z;$.each(g,function(F,B){var D=C[F];if(D&&B.nodeType==1){var H=t(B);v=Math.max(v,D.x+D.width+H);s=Math.max(s,D.y+D.height+H)}});k.width=v-E;k.height=s-z;return k};var Hb=this.getVisibleElements=function(g){g||
(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Mb=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},Nb=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=na()},ma=function(g){var h=document.createElementNS(g.namespaceURI,
g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,s){s.localName!="-moz-math-font-style"&&h.setAttributeNS(s.namespaceURI,s.nodeName,s.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,s){switch(s.nodeType){case 1:h.appendChild(ma(s));break;case 3:h.textContent=s.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref",
g).data("symbol",g)}else h.tagName=="image"&&Ib(h);h.id=na();return h},Y,na,K;(function(g){var h={};Y=g.getId=function(){return w().getId()};na=g.getNextId=function(){return w().getNextId()};K=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h<k;++h){var v=g[h];v.setAttribute("d",Ua.convertPath(v));Ua.fixEnd(v)}};var N=this.getRefElem=
function(g){return la(qa(g).substr(1))},aa=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);Qa.releaseSelector(g);J[0]=h;Qa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=J[0],v=k.getAttribute("transform"),s=svgedit.utilities.getBBox(k),E=s.x+s.width/2,z=s.y+s.height/2;s=V(k);s.numberOfItems>0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){E=O(E,z,ha(s).matrix);
z=e.createSVGTransform();z.setRotate(g,E.x,E.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);rb("transform",s,J);K("changed",J)}la("pathpointgrip_container");k=Qa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Pa=this.recalculateAllSelectedDimensions=function(){for(var g=new Oa(mb=="none"?"position":"size"),h=J.length;h--;){var k=cb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g);
K("changed",J)}},Xa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],fb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},nb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ga(h[D]);oa(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var z=E===0?"fill":"stroke",t=g.getAttribute(z);if(t&&t.indexOf("url(")===0)if(k.a<0||k.d<0){t=N(t).cloneNode(true);if(k.a<0){var B=
t.getAttribute("x1"),F=t.getAttribute("x2");t.setAttribute("x1",-(B-1));t.setAttribute("x2",-(F-1))}if(k.d<0){B=t.getAttribute("y1");F=t.getAttribute("y2");t.setAttribute("y1",-(B-1));t.setAttribute("y2",-(F-1))}t.id=na();xb().appendChild(t);g.setAttribute(z,"url(#"+t.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=ha(g).matrix;z=fa(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=V(g);t=e.createSVGTransform();t.setMatrix(fa(ha(z).matrix,
k));z.clear();z.appendItem(t)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){z=V(g);t=e.createSVGTransform();t.setMatrix(fa(ha(z).matrix,k));z.clear();z.appendItem(t)}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)}s();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.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);
s();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);s();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=g.querySelectorAll("tspan");for(E=k.length;E--;){z=ra("x",g.getAttribute("x"));t=ra("x",k[E].getAttribute("x"));B=ra("y",g.getAttribute("y"));F=ra("y",k[E].getAttribute("y"));var C={};if(!isNaN(z)&&
!isNaN(t)&&z!=0&&t!=0&&h.x)C.x=h.x-(z-t);if(!isNaN(B)&&!isNaN(F)&&B!=0&&F!=0&&h.y)C.y=h.y-(B-F);if(C.x||C.y)oa(k[E],C,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&oa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(E=0;E<s;++E){F=h.points[E];F=O(F.x,F.y,k);h.points[E].x=F.x;h.points[E].y=F.y}s=h.points.length;k="";for(E=0;E<s;++E){F=h.points[E];k+=F.x+","+F.y+" "}g.setAttribute("points",k);break;case "path":z=g.pathSegList;s=z.numberOfItems;h.d=
Array(s);for(E=0;E<s;++E){t=z.getItem(E);h.d[E]={type:t.pathSegType,x:t.x,y:t.y,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,r1:t.r1,r2:t.r2,angle:t.angle,largeArcFlag:t.largeArcFlag,sweepFlag:t.sweepFlag}}s=h.d.length;E=h.d[0];C=O(E.x,E.y,k);h.d[0].x=C.x;h.d[0].y=C.y;for(E=1;E<s;++E){t=h.d[E];z=t.type;if(z%2==0){F=O(t.x!=undefined?t.x:C.x,t.y!=undefined?t.y:C.y,k);z=O(t.x1,t.y1,k);B=O(t.x2,t.y2,k);t.x=F.x;t.y=F.y;t.x1=z.x;t.y1=z.y;t.x2=B.x;t.y2=B.y}else{t.x=k.a*t.x;t.y=k.d*t.y;t.x1=k.a*t.x1;t.y1=k.d*t.y1;t.x2=
g).data("symbol",g)}else h.tagName=="image"&&Zb(h);h.id=na();return h},Y,na,K;(function(g){var h={};Y=g.getId=function(){return w().getId()};na=g.getNextId=function(){return w().getNextId()};K=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h<k;++h){var v=g[h];v.setAttribute("d",Ua.convertPath(v));Ua.fixEnd(v)}};var N=this.getRefElem=
function(g){return la(pa(g).substr(1))},aa=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);Qa.releaseSelector(g);J[0]=h;Qa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=J[0],v=k.getAttribute("transform"),s=svgedit.utilities.getBBox(k),E=s.x+s.width/2,z=s.y+s.height/2;s=V(k);s.numberOfItems>0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){E=O(E,z,ha(s).matrix);
z=e.createSVGTransform();z.setRotate(g,E.x,E.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);db("transform",s,J);K("changed",J)}la("pathpointgrip_container");k=Qa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Pa=this.recalculateAllSelectedDimensions=function(){for(var g=new Oa(ob=="none"?"position":"size"),h=J.length;h--;){var k=cb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g);
K("changed",J)}},Xa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],hb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},pb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ga(h[D]);oa(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var z=E===0?"fill":"stroke",t=g.getAttribute(z);if(t&&t.indexOf("url(")===0)if(k.a<0||k.d<0){t=N(t).cloneNode(true);if(k.a<0){var C=
t.getAttribute("x1"),F=t.getAttribute("x2");t.setAttribute("x1",-(C-1));t.setAttribute("x2",-(F-1))}if(k.d<0){C=t.getAttribute("y1");F=t.getAttribute("y2");t.setAttribute("y1",-(C-1));t.setAttribute("y2",-(F-1))}t.id=na();vb().appendChild(t);g.setAttribute(z,"url(#"+t.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=ha(g).matrix;z=ga(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix,
k));z.clear();z.appendItem(t)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix,k));z.clear();z.appendItem(t)}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)}s();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.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);
s();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);s();break;case "line":z=O(h.x1,h.y1,k);C=O(h.x2,h.y2,k);h.x1=z.x;h.y1=z.y;h.x2=C.x;h.y2=C.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){z=ra("x",g.getAttribute("x"));t=ra("x",k[E].getAttribute("x"));C=ra("y",g.getAttribute("y"));F=ra("y",k[E].getAttribute("y"));var B={};if(!isNaN(z)&&
!isNaN(t)&&z!=0&&t!=0&&h.x)B.x=h.x-(z-t);if(!isNaN(C)&&!isNaN(F)&&C!=0&&F!=0&&h.y)B.y=h.y-(C-F);if(B.x||B.y)oa(k[E],B,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&oa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(E=0;E<s;++E){F=h.points[E];F=O(F.x,F.y,k);h.points[E].x=F.x;h.points[E].y=F.y}s=h.points.length;k="";for(E=0;E<s;++E){F=h.points[E];k+=F.x+","+F.y+" "}g.setAttribute("points",k);break;case "path":z=g.pathSegList;s=z.numberOfItems;h.d=
Array(s);for(E=0;E<s;++E){t=z.getItem(E);h.d[E]={type:t.pathSegType,x:t.x,y:t.y,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,r1:t.r1,r2:t.r2,angle:t.angle,largeArcFlag:t.largeArcFlag,sweepFlag:t.sweepFlag}}s=h.d.length;E=h.d[0];B=O(E.x,E.y,k);h.d[0].x=B.x;h.d[0].y=B.y;for(E=1;E<s;++E){t=h.d[E];z=t.type;if(z%2==0){F=O(t.x!=undefined?t.x:B.x,t.y!=undefined?t.y:B.y,k);z=O(t.x1,t.y1,k);C=O(t.x2,t.y2,k);t.x=F.x;t.y=F.y;t.x1=z.x;t.y1=z.y;t.x2=C.x;t.y2=C.y}else{t.x=k.a*t.x;t.y=k.d*t.y;t.x1=k.a*t.x1;t.y1=k.d*t.y1;t.x2=
k.a*t.x2;t.y2=k.d*t.y2}t.r1=k.a*t.r1;t.r2=k.d*t.r2}k="";s=h.d.length;for(E=0;E<s;++E){t=h.d[E];z=t.type;k+=Xa[z];switch(z){case 13:case 12:k+=t.x+" ";break;case 15:case 14:k+=t.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:k+=t.x+","+t.y+" ";break;case 7:case 6:k+=t.x1+","+t.y1+" "+t.x2+","+t.y2+" "+t.x+","+t.y+" ";break;case 9:case 8:k+=t.x1+","+t.y1+" "+t.x+","+t.y+" ";break;case 11:case 10:k+=t.r1+","+t.r2+" "+t.angle+" "+ +t.largeArcFlag+" "+ +t.sweepFlag+" "+t.x+","+t.y+" ";break;case 17:case 16:k+=
t.x2+","+t.y2+" "+t.x+","+t.y+" "}}g.setAttribute("d",k)}},Db=function(g,h,k){g=N(g).firstChild;var v=V(g),s=e.createSVGTransform();s.setTranslate(h,k);v.appendItem(s);cb(g)},cb=this.recalculateDimensions=function(g){if(g==null)return null;var h=V(g);if(h&&h.numberOfItems>0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type===1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&sa(g))return null}if(!h||
h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(fa(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=fa(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k-
h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(ga(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=ga(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k-
2);h.removeItem(k-2);h.appendItem(s)}}switch(g.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 E=$(g).data("gsvg");k=new Oa("Transform");var z={},t=null;v=[];switch(g.tagName){case "line":v=["x1","y1","x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v=
["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":t={};t.points=g.getAttribute("points");s=g.points;var B=s.numberOfItems;z.points=Array(B);for(var F=0;F<B;++F){var C=s.getItem(F);z.points[F]={x:C.x,y:C.y}}break;case "path":t={};t.d=g.getAttribute("d");z.d=g.getAttribute("d")}if(v.length){z=$(g).attr(v);$.each(z,function(tb,Jb){z[tb]=ra(tb,Jb)})}else if(E)z={x:$(E).attr("x")||0,y:$(E).attr("y")||0};if(t==null){t=$.extend(true,{},
z);$.each(t,function(tb,Jb){t[tb]=ra(tb,Jb)})}t.transform=Za?Za:"";if(g.tagName=="g"&&!E||g.tagName=="a"){s=svgedit.utilities.getBBox(g);var D={x:s.x+s.width/2,y:s.y+s.height/2},H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);v=e.createSVGMatrix();if(s=sa(g)){F=s*Math.PI/180;B=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(B*v.e+v.f)/2;D.x=(v.e-B*v.f)/2;h.removeItem(F);break}}}F=v=E=0;var G=h.numberOfItems;if(G)var P=
h.getItem(0).matrix;if(G>=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;var R=h.getItem(G-3).matrix,W=h.getItem(G-2).matrix,ta=h.getItem(G-1).matrix;B=g.childNodes;for(C=B.length;C--;){var wa=B.item(C);v=E=0;if(wa.nodeType==1){var ga=V(wa);if(ga){v=ha(ga).matrix;E=sa(wa);var ka=Za,pa=[];Za=wa.getAttribute("transform");if(E||ua(ga)){var za=e.createSVGTransform();za.setMatrix(fa(R,W,ta,v));ga.clear();ga.appendItem(za);pa.push(za)}else{E=fa(v.inverse(),ta,v);za=e.createSVGMatrix();
za.e=-E.e;za.f=-E.f;v=fa(za.inverse(),v.inverse(),R,W,ta,v,E.inverse());var hb=e.createSVGTransform(),Eb=e.createSVGTransform(),Sb=e.createSVGTransform();hb.setTranslate(E.e,E.f);Eb.setScale(v.a,v.d);Sb.setTranslate(za.e,za.f);ga.appendItem(Sb);ga.appendItem(Eb);ga.appendItem(hb);pa.push(Sb);pa.push(Eb);pa.push(hb)}k.addSubCommand(cb(wa));Za=ka}}}h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G>=3&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v);
h.clear();h.appendItem(za)}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=fa(v,E);E=v.e;v=v.f;if(E!=0||v!=0){B=g.childNodes;C=B.length;for(G=[];C--;){wa=B.item(C);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(G.indexOf(ka)===-1){Db(ka,E,v);G.push(ka)}}ka=Za;Za=wa.getAttribute("transform");if(ga=V(wa)){R=e.createSVGTransform();R.setTranslate(E,v);ga.numberOfItems?ga.insertItemBefore(R,
0):ga.appendItem(R);k.addSubCommand(cb(wa));ga=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(R=ga.length;R--;){W=ga.item(R);if(wa==ba(W)){ta=e.createSVGTransform();ta.setTranslate(-E,-v);V(W).insertItemBefore(ta,0);k.addSubCommand(cb(W))}}Za=ka}}}G=[];Za=ka}}else if(G==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;B=g.childNodes;for(C=B.length;C--;){wa=B.item(C);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");if(ga=V(wa)){E=fa(v,ha(ga).matrix);G=e.createSVGTransform();G.setMatrix(E);
ga.clear();ga.appendItem(G,0);k.addSubCommand(cb(wa));Za=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(s){H={x:D.x+P.e,y:D.y+P.f};D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?
h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(s,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(s,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=fa(ka,H,P,v);E=H.e;v=H.f;if(E!=0||v!=0){B=g.childNodes;for(C=B.length;C--;){wa=B.item(C);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");ga=V(wa);R=e.createSVGTransform();R.setTranslate(E,v);ga.numberOfItems?ga.insertItemBefore(R,0):ga.appendItem(R);k.addSubCommand(cb(wa));Za=
ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);F=E*Math.PI/180;B=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(B*v.e+v.f)/2;D.x=(v.e-B*v.f)/2;h.removeItem(F);break}}}F=0;G=h.numberOfItems;if(!svgedit.browser.isWebkit())if((P=
g.getAttribute("fill"))&&P.indexOf("url(")===0){P=N(P);ka="pattern";if(P.tagName!==ka)ka="gradient";if(P.getAttribute(ka+"Units")==="userSpaceOnUse"){v=ha(h).matrix;s=V(P);s=ha(s).matrix;v=fa(v,s);s="matrix("+[v.a,v.b,v.c,v.d,v.e,v.f].join(",")+")";P.setAttribute(ka+"Transform",s)}}if(G>=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;v=ha(h,G-3,G-1).matrix;h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G==4&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;
za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;s=ka.inverse();v=fa(s,P,ka);h.removeItem(0)}else if(G==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points=g.getAttribute("points");if(z.points){s=g.points;B=s.numberOfItems;z.points=Array(B);for(F=0;F<B;++F){C=
s.getItem(F);z.points[F]={x:C.x,y:C.y}}}case "path":z.d=g.getAttribute("d");F=1;h.clear()}}else{F=4;if(E){D=e.createSVGTransform();D.setRotate(E,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==1||F==2||F==3)nb(g,z,v);if(F==2){if(E){ua(h)||(H={x:D.x+v.e,y:D.y+v.f});D=e.createSVGTransform();D.setRotate(E,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3&&E){v=ha(h).matrix;P=e.createSVGTransform();
P.setRotate(E,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(E,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=fa(ka,H,P,v);nb(g,z,H);if(E)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}h.numberOfItems==0&&g.removeAttribute("transform");k.addSubCommand(new Wa(g,t));return k},Fb=null,$a=this.clearSelection=function(g){if(J[0]!=null)for(var h=J.length,k=0;k<h;++k){var v=J[k];if(v==null)break;Qa.releaseSelector(v);J[k]=null}g||K("selected",J)},Kb=this.addToSelection=function(g,h){if(g.length!=
["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":t={};t.points=g.getAttribute("points");s=g.points;var C=s.numberOfItems;z.points=Array(C);for(var F=0;F<C;++F){var B=s.getItem(F);z.points[F]={x:B.x,y:B.y}}break;case "path":t={};t.d=g.getAttribute("d");z.d=g.getAttribute("d")}if(v.length){z=$(g).attr(v);$.each(z,function(Ib,Ob){z[Ib]=ra(Ib,Ob)})}else if(E)z={x:$(E).attr("x")||0,y:$(E).attr("y")||0};if(t==null){t=$.extend(true,{},
z);$.each(t,function(Ib,Ob){t[Ib]=ra(Ib,Ob)})}t.transform=Za?Za:"";if(g.tagName=="g"&&!E||g.tagName=="a"){s=svgedit.utilities.getBBox(g);var D={x:s.x+s.width/2,y:s.y+s.height/2},H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);v=e.createSVGMatrix();if(s=sa(g)){F=s*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(C*v.e+v.f)/2;D.x=(v.e-C*v.f)/2;h.removeItem(F);break}}}F=v=E=0;var G=h.numberOfItems;if(G)var P=
h.getItem(0).matrix;if(G>=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;var Q=h.getItem(G-3).matrix,W=h.getItem(G-2).matrix,ua=h.getItem(G-1).matrix;C=g.childNodes;for(B=C.length;B--;){var wa=C.item(B);v=E=0;if(wa.nodeType==1){var fa=V(wa);if(fa){v=ha(fa).matrix;E=sa(wa);var ka=Za,qa=[];Za=wa.getAttribute("transform");if(E||ta(fa)){var za=e.createSVGTransform();za.setMatrix(ga(Q,W,ua,v));fa.clear();fa.appendItem(za);qa.push(za)}else{E=ga(v.inverse(),ua,v);za=e.createSVGMatrix();
za.e=-E.e;za.f=-E.f;v=ga(za.inverse(),v.inverse(),Q,W,ua,v,E.inverse());var jb=e.createSVGTransform(),zb=e.createSVGTransform(),Qb=e.createSVGTransform();jb.setTranslate(E.e,E.f);zb.setScale(v.a,v.d);Qb.setTranslate(za.e,za.f);fa.appendItem(Qb);fa.appendItem(zb);fa.appendItem(jb);qa.push(Qb);qa.push(zb);qa.push(jb)}k.addSubCommand(cb(wa));Za=ka}}}h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G>=3&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v);
h.clear();h.appendItem(za)}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=ga(v,E);E=v.e;v=v.f;if(E!=0||v!=0){C=g.childNodes;B=C.length;for(G=[];B--;){wa=C.item(B);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(G.indexOf(ka)===-1){Db(ka,E,v);G.push(ka)}}ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q,
0):fa.appendItem(Q);k.addSubCommand(cb(wa));fa=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(Q=fa.length;Q--;){W=fa.item(Q);if(wa==ba(W)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(W).insertItemBefore(ua,0);k.addSubCommand(cb(W))}}Za=ka}}}G=[];Za=ka}}else if(G==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){E=ga(v,ha(fa).matrix);G=e.createSVGTransform();G.setMatrix(E);
fa.clear();fa.appendItem(G,0);k.addSubCommand(cb(wa));Za=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(s){H={x:D.x+P.e,y:D.y+P.f};D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?
h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(s,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(s,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=ga(ka,H,P,v);E=H.e;v=H.f;if(E!=0||v!=0){C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");fa=V(wa);Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q,0):fa.appendItem(Q);k.addSubCommand(cb(wa));Za=
ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);F=E*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(C*v.e+v.f)/2;D.x=(v.e-C*v.f)/2;h.removeItem(F);break}}}F=0;G=h.numberOfItems;if(!svgedit.browser.isWebkit())if((P=
g.getAttribute("fill"))&&P.indexOf("url(")===0){P=N(P);ka="pattern";if(P.tagName!==ka)ka="gradient";if(P.getAttribute(ka+"Units")==="userSpaceOnUse"){v=ha(h).matrix;s=V(P);s=ha(s).matrix;v=ga(v,s);s="matrix("+[v.a,v.b,v.c,v.d,v.e,v.f].join(",")+")";P.setAttribute(ka+"Transform",s)}}if(G>=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;v=ha(h,G-3,G-1).matrix;h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G==4&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;
za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;s=ka.inverse();v=ga(s,P,ka);h.removeItem(0)}else if(G==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points=g.getAttribute("points");if(z.points){s=g.points;C=s.numberOfItems;z.points=Array(C);for(F=0;F<C;++F){B=
s.getItem(F);z.points[F]={x:B.x,y:B.y}}}case "path":z.d=g.getAttribute("d");F=1;h.clear()}}else{F=4;if(E){D=e.createSVGTransform();D.setRotate(E,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==1||F==2||F==3)pb(g,z,v);if(F==2){if(E){ta(h)||(H={x:D.x+v.e,y:D.y+v.f});D=e.createSVGTransform();D.setRotate(E,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3&&E){v=ha(h).matrix;P=e.createSVGTransform();
P.setRotate(E,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(E,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=ga(ka,H,P,v);pb(g,z,H);if(E)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}h.numberOfItems==0&&g.removeAttribute("transform");k.addSubCommand(new Wa(g,t));return k},Eb=null,$a=this.clearSelection=function(g){if(J[0]!=null)for(var h=J.length,k=0;k<h;++k){var v=J[k];if(v==null)break;Qa.releaseSelector(v);J[k]=null}g||K("selected",J)},Fb=this.addToSelection=function(g,h){if(g.length!=
0){for(var k=0;k<J.length;){if(J[k]==null)break;++k}for(var v=g.length;v--;){var s=g[v];if(s&&svgedit.utilities.getBBox(s)){if(s.tagName==="a"&&s.childNodes.length===1)s=s.firstChild;if(J.indexOf(s)==-1){J[k]=s;k++;s=Qa.requestSelector(s);J.length>1&&s.showGrips(false)}}}K("selected",J);h||J.length==1?Qa.requestSelector(J[0]).showGrips(true):Qa.requestSelector(J[0]).showGrips(false);for(J.sort(function(E,z){if(E&&z&&E.compareDocumentPosition)return 3-(z.compareDocumentPosition(E)&6);else if(E==null)return 1});J[0]==
null;)J.shift(0)}},Qb=this.selectOnly=function(g,h){$a(true);Kb(g,h)};this.removeFromSelection=function(g){if(J[0]!=null)if(g.length!=0){var h=Array(J.length);j=0;len=J.length;for(var k=0;k<len;++k){var v=J[k];if(v)if(g.indexOf(v)==-1){h[j]=v;j++}else Qa.releaseSelector(v)}J=h}};this.selectAllInCurrentLayer=function(){var g=w().getCurrentLayer();if(g){Ma="select";Qb($(L||g).children())}};var Zb=this.getMouseTarget=function(g){if(g==null)return null;g=g.target;if(g.correspondingUseElement)g=g.correspondingUseElement;
null;)J.shift(0)}},Pb=this.selectOnly=function(g,h){$a(true);Fb(g,h)};this.removeFromSelection=function(g){if(J[0]!=null)if(g.length!=0){var h=Array(J.length);j=0;len=J.length;for(var k=0;k<len;++k){var v=J[k];if(v)if(g.indexOf(v)==-1){h[j]=v;j++}else Qa.releaseSelector(v)}J=h}};this.selectAllInCurrentLayer=function(){var g=w().getCurrentLayer();if(g){Ma="select";Pb($(L||g).children())}};var $b=this.getMouseTarget=function(g){if(g==null)return null;g=g.target;if(g.correspondingUseElement)g=g.correspondingUseElement;
if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(g.namespaceURI)>=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=w().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Qa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=null,s=null,E={},z={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(t){if(!(b.spaceKey||
t.button===1)){var B=t.button===2;t.altKey&&svgCanvas.cloneSelectedElements(0,0);Fb=l.getScreenCTM().inverse();var F=O(t.pageX,t.pageY,Fb),C=F.x*p;F=F.y*p;t.preventDefault();if(B)Ma="select";C=C/p;F=F/p;var D=Zb(t);if(D.tagName==="a"&&D.childNodes.length===1)D=D.firstChild;var H=v=h=C,G=s=k=F;if(m.gridSnapping){C=Ga(C);F=Ga(F);h=Ga(h);k=Ga(k)}if(D==Qa.selectorParentGroup&&J[0]!=null){D=t.target;var P=lb(D,"type");if(P=="rotate"){Ma="rotate";current_rotate_mode=lb(D,"dir")}else if(P=="resize"){Ma=
"resize";mb=lb(D,"dir")}D=J[0]}Za=D.getAttribute("transform");P=V(D);switch(Ma){case "select":Ja=true;mb="none";if(B)Ja=false;if(D!=e){if(J.indexOf(D)==-1){t.shiftKey||$a(true);Kb([D]);Nb=D;Ua.clear()}if(!B)for(B=0;B<J.length;++B)if(J[B]!=null){var R=V(J[B]);R.numberOfItems?R.insertItemBefore(e.createSVGTransform(),0):R.appendItem(e.createSVGTransform())}}else if(!B){$a();Ma="multiselect";if(xa==null)xa=Qa.getRubberBandBox();v*=p;s*=p;oa(xa,{x:v,y:s,width:0,height:0,display:"inline"},100)}break;case "zoom":Ja=
true;if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:H*p,y:H*p,width:0,height:0,display:"inline"},100);break;case "resize":Ja=true;h=C;k=F;E=svgedit.utilities.getBBox($("#selectedBox0")[0]);var W={};$.each(E,function(ta,wa){W[ta]=wa/p});E=W;B=sa(D)?1:0;if(ua(P)){P.insertItemBefore(e.createSVGTransform(),B);P.insertItemBefore(e.createSVGTransform(),B);P.insertItemBefore(e.createSVGTransform(),B)}else{P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());
if(svgedit.browser.supportsNonScalingStroke()){if(C=svgedit.browser.isChrome())R=function(ta){var wa=ta.getAttributeNS(null,"stroke");ta.removeAttributeNS(null,"stroke");setTimeout(function(){ta.setAttributeNS(null,"stroke",wa)},1)};D.style.vectorEffect="non-scaling-stroke";C&&R(D);F=D.getElementsByTagName("*");H=F.length;for(B=0;B<H;B++){F[B].style.vectorEffect="non-scaling-stroke";C&&R(F[B])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ja=true;g=H+","+G+" ";R=M.stroke_width==0?1:M.stroke_width;
da({element:"polyline",curStyles:true,attr:{points:g,id:na(),fill:"none",opacity:M.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});z.minx=H;z.maxx=H;z.miny=G;z.maxy=G;break;case "image":Ja=true;R=da({element:"image",attr:{x:C,y:F,width:0,height:0,id:na(),opacity:M.opacity/2,style:"pointer-events:inherit"}});S(R,La);Ib(R);break;case "square":case "rect":Ja=true;h=C;k=F;da({element:"rect",curStyles:true,attr:{x:C,y:F,width:0,height:0,id:na(),opacity:M.opacity/2}});break;case "line":Ja=
true;R=M.stroke_width==0?1:M.stroke_width;da({element:"line",curStyles:true,attr:{x1:C,y1:F,x2:C,y2:F,id:na(),stroke:M.stroke,"stroke-width":R,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,fill:"none",opacity:M.opacity/2,style:"pointer-events:none"}});break;case "circle":Ja=true;da({element:"circle",curStyles:true,attr:{cx:C,cy:F,r:0,id:na(),opacity:M.opacity/2}});break;case "ellipse":Ja=true;da({element:"ellipse",
curStyles:true,attr:{cx:C,cy:F,rx:0,ry:0,id:na(),opacity:M.opacity/2}});break;case "text":Ja=true;da({element:"text",curStyles:true,attr:{x:C,y:F,id:na(),fill:eb.fill,"stroke-width":eb.stroke_width,"font-size":eb.font_size,"font-family":eb.font_family,"text-anchor":"left","xml:space":"preserve",opacity:M.opacity}});break;case "path":case "pathedit":h*=p;k*=p;Ua.mouseDown(t,D,h,k);Ja=true;break;case "textedit":h*=p;k*=p;pb.mouseDown(t,D,h,k);Ja=true;break;case "rotate":Ja=true;b.undoMgr.beginUndoableChange("transform",
J);document.getElementById("workarea").className="rotate"}R=sb("mouseDown",{event:t,start_x:h,start_y:k,selectedElements:J},true);$.each(R,function(ta,wa){if(wa&&wa.started)Ja=true});if(Ma)document.getElementById("workarea").className=Ma=="resize"?t.target.style.cursor:Ma}}).mousemove(function(t){if(Ja)if(!(t.button===1||b.spaceKey)){var B=J[0],F=O(t.pageX,t.pageY,Fb),C=F.x*p;F=F.y*p;var D=la(Y()),H=x=C/p,G=y=F/p;if(m.gridSnapping){x=Ga(x);y=Ga(y)}t.preventDefault();switch(Ma){case "select":if(J[0]!==
null){H=x-h;var P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P)}if(t.shiftKey){var R=ca(h,k,x,y);x=R.x;y=R.y}if(H!=0||P!=0){R=J.length;for(G=0;G<R;++G){B=J[G];if(B==null)break;var W=e.createSVGTransform();D=V(B);W.setTranslate(H,P);D.numberOfItems?D.replaceItem(W,0):D.appendItem(W);Qa.requestSelector(B).resize()}K("transition",J)}}break;case "multiselect":H*=p;G*=p;oa(xa,{x:Math.min(v,H),y:Math.min(s,G),width:Math.abs(H-v),height:Math.abs(G-s)},100);D=[];H=[];W=Gb();R=J.length;for(G=0;G<R;++G){P=W.indexOf(J[G]);
if(P==-1)D.push(J[G]);else W[P]=null}R=W.length;for(G=0;G<R;++G)W[G]&&H.push(W[G]);D.length>0&&b.removeFromSelection(D);H.length>0&&Kb(H);break;case "resize":D=V(B);H=(R=ua(D))?E:svgedit.utilities.getBBox(B);G=H.x;W=H.y;var ta=H.width,wa=H.height;H=x-h;P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P);wa=Ga(wa);ta=Ga(ta)}var ga=sa(B);if(ga){var ka=Math.sqrt(H*H+P*P);P=Math.atan2(P,H)-ga*Math.PI/180;H=ka*Math.cos(P);P=ka*Math.sin(P)}if(mb.indexOf("n")==-1&&mb.indexOf("s")==-1)P=0;if(mb.indexOf("e")==-1&&mb.indexOf("w")==
-1)H=0;var pa=ka=0,za=wa?(wa+P)/wa:1,hb=ta?(ta+H)/ta:1;if(mb.indexOf("n")>=0){za=wa?(wa-P)/wa:1;pa=wa}if(mb.indexOf("w")>=0){hb=ta?(ta-H)/ta:1;ka=ta}H=e.createSVGTransform();P=e.createSVGTransform();ta=e.createSVGTransform();if(m.gridSnapping){G=Ga(G);ka=Ga(ka);W=Ga(W);pa=Ga(pa)}H.setTranslate(-(G+ka),-(W+pa));if(t.shiftKey)if(hb==1)hb=za;else za=hb;P.setScale(hb,za);ta.setTranslate(G+ka,W+pa);if(R){R=ga?1:0;D.replaceItem(H,2+R);D.replaceItem(P,1+R);D.replaceItem(ta,0+R)}else{R=D.numberOfItems;D.replaceItem(ta,
R-3);D.replaceItem(P,R-2);D.replaceItem(H,R-1)}Qa.requestSelector(B).resize();K("transition",J);break;case "zoom":H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100);break;case "text":oa(D,{x:x,y:y},1E3);break;case "line":H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);y=Ga(y)}G=x;R=y;if(t.shiftKey){R=ca(h,k,G,R);G=R.x;R=R.y}D.setAttributeNS(null,"x2",G);D.setAttributeNS(null,"y2",R);window.opera||e.unsuspendRedraw(H);break;
case "foreignObject":case "square":case "rect":case "image":H=Math.abs(x-h);R=Math.abs(y-k);if(Ma=="square"||t.shiftKey){H=R=Math.max(H,R);G=h<x?h:h-H;W=k<y?k:k-R}else{G=Math.min(h,x);W=Math.min(k,y)}if(t.altKey){H*=2;R*=2;G=h-H/2;W=k-R/2}if(m.gridSnapping){H=Ga(H);R=Ga(R);G=Ga(G);W=Ga(W)}oa(D,{width:H,height:R,x:G,y:W},1E3);break;case "circle":H=$(D).attr(["cx","cy"]);R=H.cx;G=H.cy;H=Math.sqrt((x-R)*(x-R)+(y-G)*(y-G));if(m.gridSnapping)H=Ga(H);D.setAttributeNS(null,"r",H);break;case "ellipse":$(D).attr(["cx",
"cy"]);R=Math.abs(h+(x-h)/2);G=Math.abs(k+(y-k)/2);H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);R=Ga(R);y=Ga(y);G=Ga(G)}W=Math.abs(h-R);P=Math.abs(k-G);if(t.shiftKey){P=W;G=y>k?k+W:k-W}if(t.altKey){R=h;G=k;W=Math.abs(x-R);P=t.shiftKey?W:Math.abs(y-G)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P);D.setAttributeNS(null,"cx",R);D.setAttributeNS(null,"cy",G);window.opera||e.unsuspendRedraw(H);break;case "fhellipse":case "fhrect":z.minx=Math.min(H,z.minx);z.maxx=Math.max(H,
z.maxx);z.miny=Math.min(G,z.miny);z.maxy=Math.max(G,z.maxy);case "fhpath":g+=+H+","+G+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(t.shiftKey){if(R=svgedit.path.path){D=R.dragging?R.dragging[0]:h;R=R.dragging?R.dragging[1]:k}else{D=h;R=k}R=ca(D,R,x,y);x=R.x;y=R.y}if(xa&&xa.getAttribute("display")!=="none"){H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100)}Ua.mouseMove(t,
x,y);break;case "textedit":x*=p;y*=p;pb.mouseMove(C,F);break;case "rotate":H=svgedit.utilities.getBBox(B);R=H.x+H.width/2;G=H.y+H.height/2;D=ea(B);D=O(R,G,D);R=D.x;G=D.y;D=H.x;W=H.y;if(current_rotate_mode=="nw")D=H.x+H.width;if(current_rotate_mode=="se")W=H.y+H.height;if(current_rotate_mode=="sw"){D=H.x+H.width;W=H.y+H.height}compensation_angle=(Math.atan2(G-W,R-D)*(180/Math.PI)-90)%360;ga=(Math.atan2(G-y,R-x)*(180/Math.PI)-90)%360;ga+=compensation_angle;if(m.gridSnapping)ga=Ga(ga);if(t.shiftKey)ga=
Math.round(ga/45)*45;b.setRotationAngle(ga<-180?360+ga:ga,true);K("transition",J)}sb("mouseMove",{event:t,mouse_x:C,mouse_y:F,selected:B})}}).click(function(t){t.preventDefault();return false}).dblclick(function(t){var B=t.target.parentNode;if(B!==L){var F=Zb(t),C=F.tagName;if(C==="text"&&Ma!=="textedit"){t=O(t.pageX,t.pageY,Fb);pb.select(F,t.x,t.y)}if((C==="g"||C==="a")&&sa(F)){Xb(F);F=J[0];$a(true)}L&&$b();B.tagName!=="g"&&B.tagName!=="a"||B===w().getCurrentLayer()||F===Qa.selectorParentGroup||
lc(F)}}).mouseup(function(t){if(t.button!==2){var B=Nb;Nb=null;if(Ja){var F=O(t.pageX,t.pageY,Fb),C=F.x*p;F=F.y*p;var D=C/p,H=F/p,G=la(Y()),P=false;Ja=false;switch(Ma){case "resize":case "multiselect":if(xa!=null){xa.setAttribute("display","none");wb=[]}Ma="select";case "select":if(J[0]!=null){if(J[1]==null){C=J[0];switch(C.tagName){case "g":case "use":case "image":case "foreignObject":break;default:gb.fill=C.getAttribute("fill");gb.fill_opacity=C.getAttribute("fill-opacity");gb.stroke=C.getAttribute("stroke");
gb.stroke_opacity=C.getAttribute("stroke-opacity");gb.stroke_width=C.getAttribute("stroke-width");gb.stroke_dasharray=C.getAttribute("stroke-dasharray");gb.stroke_linejoin=C.getAttribute("stroke-linejoin");gb.stroke_linecap=C.getAttribute("stroke-linecap")}if(C.tagName=="text"){eb.font_size=C.getAttribute("font-size");eb.font_family=C.getAttribute("font-family")}Qa.requestSelector(C).showGrips(true)}Pa();if(D!=v||H!=s){t=J.length;for(C=0;C<t;++C){if(J[C]==null)break;J[C].firstChild||Qa.requestSelector(J[C]).resize()}}else{C=
t.target;if(J[0].nodeName==="path"&&J[1]==null)Ua.select(J[0]);else t.shiftKey&&B!=C&&b.removeFromSelection([C])}if(svgedit.browser.supportsNonScalingStroke())if(t=J[0]){t.removeAttribute("style");svgedit.utilities.walkTree(t,function(ta){ta.removeAttribute("style")})}}return;case "zoom":xa!=null&&xa.setAttribute("display","none");K("zoomed",{x:Math.min(v,D),y:Math.min(s,H),width:Math.abs(D-v),height:Math.abs(H-s),factor:t.altKey?0.5:2});return;case "fhpath":B=G.getAttribute("points");D=B.indexOf(",");
if(P=D>=0?B.indexOf(",",D+1)>=0:B.indexOf(" ",B.indexOf(" ")+1)>=0)G=Ua.smoothPolylineIntoPath(G);break;case "line":B=$(G).attr(["x1","x2","y1","y2"]);P=B.x1!=B.x2||B.y1!=B.y2;break;case "foreignObject":case "square":case "rect":case "image":B=$(G).attr(["width","height"]);P=B.width!=0||B.height!=0||Ma==="image";break;case "circle":P=G.getAttribute("r")!=0;break;case "ellipse":B=$(G).attr(["rx","ry"]);P=B.rx!=null||B.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({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:Y()}});K("changed",[G]);P=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx-z.minx,height:z.maxy-z.miny,id:Y()}});K("changed",[G]);P=true}break;case "text":P=true;Qb([G]);pb.start(G);break;case "path":G=null;Ja=true;B=Ua.mouseUp(t,G,C,F);G=B.element;P=B.keep;break;case "pathedit":P=true;G=null;Ua.mouseUp(t);
break;case "textedit":P=false;G=null;pb.mouseUp(t,C,F);break;case "rotate":P=true;G=null;Ma="select";B=b.undoMgr.finishUndoableChange();B.isEmpty()||Ia(B);Pa();K("changed",J)}C=sb("mouseUp",{event:t,mouse_x:C,mouse_y:F},true);$.each(C,function(ta,wa){if(wa){P=wa.keep||P;G=wa.element;Ja=wa.started||Ja}});if(!P&&G!=null){w().releaseId(Y());G.parentNode.removeChild(G);G=null;for(C=t.target;C.parentNode.parentNode.tagName=="g";)C=C.parentNode;if((Ma!="path"||!drawn_path)&&C.parentNode.id!="selectorParentGroup"&&
C.id!="svgcanvas"&&C.id!="svgroot"){b.setMode("select");Qb([C],true)}}else if(G!=null){b.addedNew=true;t=0.2;var R;if(false.beginElement&&G.getAttribute("opacity")!=M.opacity){R=$(false).clone().attr({to:M.opacity,dur:t}).appendTo(G);try{R[0].beginElement()}catch(W){}}else t=0;setTimeout(function(){R&&R.remove();G.setAttribute("opacity",M.opacity);G.setAttribute("style","pointer-events:inherit");Z(G);if(Ma==="path")Ua.toEditMode(G);else m.selectNew&&Qb([G],true);Ia(new Na(G));K("changed",[G])},t*
1E3)}Za=null}}});$(a).bind("mousewheel DOMMouseScroll",function(t){if(t.shiftKey){t.preventDefault();Fb=l.getScreenCTM().inverse();var B=O(t.pageX,t.pageY,Fb);B={x:B.x,y:B.y,width:0,height:0};if(t.wheelDelta)if(t.wheelDelta>=120)B.factor=2;else{if(t.wheelDelta<=-120)B.factor=0.5}else if(t.detail)if(t.detail>0)B.factor=0.5;else if(t.detail<0)B.factor=2;B.factor&&K("zoomed",B)}})})();var Ib=function(g){$(g).click(function(h){h.preventDefault()})},pb=b.textActions=function(){function g(ga){var ka=F.value===
"";$(F).focus();if(!arguments.length)if(ka)ga=0;else{if(F.selectionEnd!==F.selectionStart)return;ga=F.selectionEnd}var pa;pa=G[ga];ka||F.setSelectionRange(ga,ga);C=la("text_cursor");if(!C){C=document.createElementNS(c,"line");oa(C,{id:"text_cursor",stroke:"#333","stroke-width":1});C=la("selectorParentGroup").appendChild(C)}H||(H=setInterval(function(){var za=C.getAttribute("display")==="none";C.setAttribute("display",za?"inline":"none")},600));ka=E(pa.x,P.y);pa=E(pa.x,P.y+P.height);oa(C,{x1:ka.x,
y1:ka.y,x2:pa.x,y2:pa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(ga,ka,pa){if(ga===ka)g(ka);else{pa||F.setSelectionRange(ga,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");oa(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}ga=G[ga];var za=G[ka];C.setAttribute("visibility","hidden");ka=E(ga.x,P.y);pa=E(ga.x+(za.x-ga.x),P.y);var hb=E(ga.x,P.y+P.height);ga=E(ga.x+(za.x-
ga.x),P.y+P.height);oa(D,{d:"M"+ka.x+","+ka.y+" L"+pa.x+","+pa.y+" "+ga.x+","+ga.y+" "+hb.x+","+hb.y+"z",display:"inline"})}}function k(ga,ka){var pa=e.createSVGPoint();pa.x=ga;pa.y=ka;if(G.length==1)return 0;pa=B.getCharNumAtPosition(pa);if(pa<0){pa=G.length-2;if(ga<=G[0].x)pa=0}else if(pa>=G.length-2)pa=G.length-2;var za=G[pa];ga>za.x+za.width/2&&pa++;return pa}function v(ga,ka,pa){var za=F.selectionStart;ga=k(ga,ka);h(Math.min(za,ga),Math.max(za,ga),!pa)}function s(ga,ka){var pa={x:ga,y:ka};pa.x/=
p;pa.y/=p;if(R){var za=O(pa.x,pa.y,R.inverse());pa.x=za.x;pa.y=za.y}return pa}function E(ga,ka){var pa={x:ga,y:ka};if(R){var za=O(pa.x,pa.y,R);pa.x=za.x;pa.y=za.y}pa.x*=p;pa.y*=p;return pa}function z(ga){h(0,B.textContent.length);$(this).unbind(ga)}function t(ga){if(wa&&B){var ka=O(ga.pageX,ga.pageY,Fb);ka=s(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var pa=B.textContent,za=pa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;pa=pa.substr(ka).match(/^[a-z0-9]+/i);h(za,(pa?pa[0].length:0)+ka);$(ga.target).click(z);
setTimeout(function(){$(ga.target).unbind("click",z)},300)}}var B,F,C,D,H,G=[],P,R,W,ta,wa;return{select:function(ga,ka,pa){B=ga;pb.toEditMode(ka,pa)},start:function(ga){B=ga;pb.toEditMode()},mouseDown:function(ga,ka,pa,za){ga=s(pa,za);F.focus();g(k(ga.x,ga.y));W=pa;ta=za},mouseMove:function(ga,ka){var pa=s(ga,ka);v(pa.x,pa.y)},mouseUp:function(ga,ka,pa){var za=s(ka,pa);v(za.x,za.y,true);ga.target!==B&&ka<W+2&&ka>W-2&&pa<ta+2&&pa>ta-2&&pb.toSelectMode(true)},setCursor:g,toEditMode:function(ga,ka){wa=
false;Ma="textedit";Qa.requestSelector(B).showGrips(false);Qa.requestSelector(B);pb.init();$(B).css("cursor","text");if(arguments.length){var pa=s(ga,ka);g(k(pa.x,pa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(ga){Ma="select";clearInterval(H);H=null;D&&$(D).attr("display","none");C&&$(C).attr("visibility","hidden");$(B).css("cursor","move");if(ga){$a();$(B).css("cursor","move");K("selected",[B]);Kb([B],true)}B&&!B.textContent.length&&b.deleteSelectedElements();$(F).blur();
B=false},setInputElem:function(ga){F=ga},clear:function(){Ma=="textedit"&&pb.toSelectMode()},init:function(){if(B){if(!B.parentNode){B=J[0];Qa.requestSelector(B).showGrips(false)}var ga=B.textContent.length,ka=B.getAttribute("transform");P=svgedit.utilities.getBBox(B);R=ka?ea(B):null;G=Array(ga);F.focus();$(B).unbind("dblclick",t).dblclick(t);if(!ga)var pa={x:P.x+P.width/2,width:0};for(ka=0;ka<ga;ka++){var za=B.getStartPositionOfChar(ka);pa=B.getEndPositionOfChar(ka);if(!svgedit.browser.supportsGoodTextCharPos()){var hb=
b.contentW*p;za.x-=hb;pa.x-=hb;za.x/=p;pa.x/=p}G[ka]={x:za.x,y:P.y,width:pa.x-za.x,height:P.height}}G.push({x:pa.x,width:0});h(F.selectionStart,F.selectionEnd,true)}}}}(),Ua=b.pathActions=function(){var g=false,h,k,v;svgedit.path.Path.prototype.endChanges=function(z){if(svgedit.browser.isWebkit()){var t=this.elem;t.setAttribute("d",Ua.convertPath(t))}z=new Wa(this.elem,{d:this.last_d},z);Ia(z);K("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(z){$.isArray(z)||(z=[z]);
for(var t=0;t<z.length;t++){var B=z[t],F=this.segs[B];F.ptgrip&&this.selected_pts.indexOf(B)==-1&&B>=0&&this.selected_pts.push(B)}this.selected_pts.sort();t=this.selected_pts.length;for(z=Array(t);t--;){F=this.segs[this.selected_pts[t]];F.select(true);z[t]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);K("selected",z)};var s=h=null,E=false;return{mouseDown:function(z,t,B,F){if(Ma==="path"){mouse_x=B;mouse_y=F;F=mouse_x/p;t=mouse_y/p;B=la("path_stretch_line");
k=[F,t];if(m.gridSnapping){F=Ga(F);t=Ga(t);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!B){B=document.createElementNS(c,"path");oa(B,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});B=la("selectorParentGroup").appendChild(B)}B.setAttribute("display","inline");var C=null;if(s){C=s.pathSegList;for(var D=C.numberOfItems,H=6/p,G=false;D;){D--;var P=C.getItem(D),R=P.x;P=P.y;if(F>=R-H&&F<=R+H&&t>=P-H&&t<=P+H){G=true;break}}H=Y();svgedit.path.removePath_(H);H=la(H);R=C.numberOfItems;
if(G){if(D<=1&&R>=2){F=C.getItem(0).x;t=C.getItem(0).y;z=B.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,t):s.createSVGPathSegCurvetoCubicAbs(F,t,z.x1/p,z.y1/p,F,t);F=s.createSVGPathSegClosePath();C.appendItem(z);C.appendItem(F)}else if(R<3)return C=false;$(B).remove();element=H;s=null;Ja=false;if(g){svgedit.path.path.matrix&&nb(H,{},svgedit.path.path.matrix.inverse());B=H.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+B);$(H).remove();
svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Zb(z))){console.log("Clicked outside canvas");return false}C=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(C-1);H=D.x;D=D.y;if(z.shiftKey){z=ca(H,D,F,t);F=z.x;t=z.y}z=B.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(kb(F),kb(t)):s.createSVGPathSegCurvetoCubicAbs(kb(F),kb(t),z.x1/p,z.y1/
p,z.x2/p,z.y2/p);s.pathSegList.appendItem(z);F*=p;t*=p;B.setAttribute("d",["M",F,t,F,t].join(" "));B=C;if(g)B+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(B,F,t)}}else{d_attr="M"+F+","+t+" ";s=da({element:"path",curStyles:true,attr:{d:d_attr,id:na(),opacity:M.opacity/2}});B.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));B=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(B,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();H=z.target.id;
if(H.substr(0,14)=="pathpointgrip_"){t=svgedit.path.path.cur_pt=parseInt(H.substr(14));svgedit.path.path.dragging=[B,F];C=svgedit.path.path.segs[t];if(z.shiftKey)C.selected?svgedit.path.path.removePtFromSelection(t):svgedit.path.path.addPtsToSelection(t);else{if(svgedit.path.path.selected_pts.length<=1||!C.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(t)}}else if(H.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[B,F];z=H.split("_")[1].split("c");t=z[0]-
0;svgedit.path.path.selectPt(t,z[1]-0)}if(!svgedit.path.path.dragging){if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:B*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,t,B){E=true;if(Ma==="path"){if(s){var F=s.pathSegList;z=F.numberOfItems-1;if(k){var C=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");C.setAttribute("cx",t);C.setAttribute("cy",B);C.setAttribute("display","inline");C=k[0];var H=k[1];F.getItem(z);var G=
C+(C-t/p),P=H+(H-B/p);D.setAttribute("cx",G*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var R=svgedit.path.getCtrlLine(2);oa(D,{x1:t,y1:B,x2:C*p,y2:H*p,display:"inline"});oa(R,{x1:G*p,y1:P*p,x2:C*p,y2:H*p,display:"inline"});if(z===0)v=[t,B];else{F=F.getItem(z-1);t=F.x;B=F.y;if(F.pathSegType===6){t+=t-F.x2;B+=B-F.y2}else if(v){t=v[0]/p;B=v[1]/p}svgedit.path.replacePathSeg(6,z,[C,H,t,B,G,P],s)}}else if(C=la("path_stretch_line")){z=F.getItem(z);if(z.pathSegType===
6)svgedit.path.replacePathSeg(6,1,[t,B,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,t,B],C);else v?svgedit.path.replacePathSeg(6,1,[t,B,v[0],v[1],t,B],C):svgedit.path.replacePathSeg(4,1,[t,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);H=svgedit.path.getPointFromGrip({x:t,y:B},svgedit.path.path);z=H.x-C.x;C=H.y-C.y;svgedit.path.path.dragging=[t,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 W=xa.getBBox(),ta=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ta.x,y:ta.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(z,t){if(Ma==="path"){k=null;if(!s){t=la(Y());Ja=false;v=null}return{keep:true,element:t}}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();E&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!E&&svgedit.path.path.selectPt(B)}else if(xa&&xa.getAttribute("display")!="none"){xa.setAttribute("display","none");xa.getAttribute("width")<=2&&xa.getAttribute("height")<=2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);E=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ma="pathedit";$a();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=
svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var t=z==svgedit.path.path.elem;Ma="select";svgedit.path.path.show(false);h=false;$a();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(t){K("selected",[z]);Kb([z],true)}},addSubPath:function(z){if(z){Ma="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ma="pathedit"}else h=z},reorient:function(){var z=J[0];if(z)if(sa(z)!=0){var t=new Oa("Reorient path"),
B={d:z.getAttribute("d"),transform:z.getAttribute("transform")};t.addSubCommand(new Wa(z,B));$a();this.resetOrientation(z);Ia(t);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Kb([z],true);K("changed",J)}},clear:function(){h=null;if(s){var z=la(Y());$(la("path_stretch_line")).remove();$(z).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");s=v=null;Ja=false}else Ma=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z==
null||z.nodeName!="path")return false;var t=V(z),B=ha(t).matrix;t.clear();z.removeAttribute("transform");t=z.pathSegList;for(var F=t.numberOfItems,C=0;C<F;++C){var D=t.getItem(C),H=D.pathSegType;if(H!=1){var G=[];$.each(["",1,2],function(P,R){var W=D["x"+R],ta=D["y"+R];if(W!==undefined&&ta!==undefined){W=O(W,ta,B);G.splice(G.length,0,W.x,W.y)}});svgedit.path.replacePathSeg(H,C,G,z)}}f(z,B)},zoomChange:function(){Ma=="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,t=z.length,B=[];t--;){var F=z[t];svgedit.path.path.addSeg(F);B.push(F+t);B.push(F+t+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 t=svgedit.path.path.elem,B=t.pathSegList,F=z[0],C=null,D=null;svgedit.path.path.eachSeg(function(R){if(this.type===2&&R<=F)D=this.item;if(R<=F)return true;if(this.type===2){C=R;return false}else if(this.type===1)return C=false});if(C==null)C=svgedit.path.path.segs.length-1;if(C!==false){var H=t.createSVGPathSegLinetoAbs(D.x,D.y),G=t.createSVGPathSegClosePath();if(C==svgedit.path.path.segs.length-1){B.appendItem(H);B.appendItem(G)}else{svgedit.path.insertItemBefore(t,G,C);svgedit.path.insertItemBefore(t,
H,C)}svgedit.path.path.init().selectPt(C+1)}else if(svgedit.path.path.segs[F].mate){B.removeItem(F);B.removeItem(F);svgedit.path.path.init().selectPt(F-1)}else{for(z=0;z<B.numberOfItems;z++){var P=B.getItem(z);if(P.pathSegType===2)H=z;else if(z===F)B.removeItem(H);else if(P.pathSegType===1&&F<z){G=z-1;B.removeItem(z);break}}for(z=F-H-1;z--;)svgedit.path.insertItemBefore(t,B.getItem(H),G);t=B.getItem(H);svgedit.path.replacePathSeg(2,H,[t.x,t.y]);z=F;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ua.canDeleteNodes){svgedit.path.path.storeD();
for(var z=svgedit.path.path.selected_pts,t=z.length;t--;)svgedit.path.path.deleteSeg(z[t]);var B=function(){var F=svgedit.path.path.elem.pathSegList,C=F.numberOfItems,D=function(P,R){for(;R--;)F.removeItem(P)};if(C<=1)return true;for(;C--;){var H=F.getItem(C);if(H.pathSegType===1){H=F.getItem(C-1);var G=F.getItem(C-2);if(H.pathSegType===2){D(C-1,2);B();break}else if(G.pathSegType===2){D(C-2,3);B();break}}else if(H.pathSegType===2)if(C>0){H=F.getItem(C-1).pathSegType;if(H===2){D(C-1,1);B();break}else if(H===
1&&F.numberOfItems-1===C){D(C,1);B();break}}}return false};B();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem);b.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 t=z.points,B=t.numberOfItems;if(B>=4){var F=t.getItem(0),C=null;z=[];z.push(["M",F.x,",",
F.y," C"].join(""));for(var D=1;D<=B-4;D+=3){var H=t.getItem(D),G=t.getItem(D+1),P=t.getItem(D+2);if(C)if((F=svgedit.path.smoothControlPoints(C,H,F))&&F.length==2){H=z[z.length-1].split(",");H[2]=F[0].x;H[3]=F[0].y;z[z.length-1]=H.join(",");H=F[1]}z.push([H.x,H.y,G.x,G.y,P.x,P.y].join(","));F=P;C=G}for(z.push("L");D<B;++D){G=t.getItem(D);z.push([G.x,G.y].join(","))}z=z.join(" ");z=da({element:"path",curStyles:true,attr:{id:Y(),d:z,fill:"none"}})}return z},setSegType:function(z){svgedit.path.path.setSegType(z)},
moveNode:function(z,t){var B=svgedit.path.path.selected_pts;if(B.length){svgedit.path.path.storeD();B=svgedit.path.path.segs[B[0]];var F={x:0,y:0};F[z]=t-B.item[z];B.move(F.x,F.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(z){for(var t=z.pathSegList,B=t.numberOfItems,F,C=0;C<B;++C){var D=t.getItem(C);if(D.pathSegType===2)F=D;if(D.pathSegType===1){D=t.getItem(C-1);if(D.x!=F.x||D.y!=F.y){t=z.createSVGPathSegLinetoAbs(F.x,F.y);svgedit.path.insertItemBefore(z,t,C);Ua.fixEnd(z);
break}}}svgedit.browser.isWebkit()&&z.setAttribute("d",Ua.convertPath(z))},convertPath:function(z,t){for(var B=z.pathSegList,F=B.numberOfItems,C=0,D=0,H="",G=null,P=0;P<F;++P){var R=B.getItem(P),W=R.x||0,ta=R.y||0,wa=R.x1||0,ga=R.y1||0,ka=R.x2||0,pa=R.y2||0,za=R.pathSegType,hb=Xa[za]["to"+(t?"Lower":"Upper")+"Case"](),Eb=function(Sb,tb,Jb){tb=tb?" "+tb.join(" "):"";Jb=Jb?" "+svgedit.units.shortFloat(Jb):"";$.each(Sb,function(ub,dc){Sb[ub]=svgedit.units.shortFloat(dc)});H+=hb+Sb.join(" ")+tb+Jb};switch(za){case 1:H+=
"z";break;case 12:W-=C;case 13:if(t){C+=W;hb="l"}else{W+=C;C=W;hb="L"}Eb([[W,D]]);break;case 14:ta-=D;case 15:if(t){D+=ta;hb="l"}else{ta+=D;D=ta;hb="L"}Eb([[C,ta]]);break;case 2:case 4:case 18:W-=C;ta-=D;case 5:case 3:if(G&&B.getItem(P-1).pathSegType===1&&!t){C=G[0];D=G[1]}case 19:if(t){C+=W;D+=ta}else{W+=C;ta+=D;C=W;D=ta}if(za===3)G=[C,D];Eb([[W,ta]]);break;case 6:W-=C;wa-=C;ka-=C;ta-=D;ga-=D;pa-=D;case 7:if(t){C+=W;D+=ta}else{W+=C;wa+=C;ka+=C;ta+=D;ga+=D;pa+=D;C=W;D=ta}Eb([[wa,ga],[ka,pa],[W,ta]]);
break;case 8:W-=C;wa-=C;ta-=D;ga-=D;case 9:if(t){C+=W;D+=ta}else{W+=C;wa+=C;ta+=D;ga+=D;C=W;D=ta}Eb([[wa,ga],[W,ta]]);break;case 10:W-=C;ta-=D;case 11:if(t){C+=W;D+=ta}else{W+=C;ta+=D;C=W;D=ta}Eb([[R.r1,R.r2]],[R.angle,R.largeArcFlag?1:0,R.sweepFlag?1:0],[W,ta]);break;case 16:W-=C;ka-=C;ta-=D;pa-=D;case 17:if(t){C+=W;D+=ta}else{W+=C;ka+=C;ta+=D;pa+=D;C=W;D=ta}Eb([[ka,pa],[W,ta]])}}return H}}}(),hc=this.removeUnusedDefElems=function(){var g=l.getElementsByTagNameNS(c,"defs");if(!g||!g.length)return 0;
for(var h=[],k=0,v=["fill","stroke","filter","marker-start","marker-mid","marker-end"],s=v.length,E=l.getElementsByTagNameNS(c,"*"),z=E.length,t=0;t<z;t++){for(var B=E[t],F=0;F<s;F++){var C=qa(B.getAttribute(v[F]));C&&h.push(C.substr(1))}(B=ba(B))&&B.indexOf("#")===0&&h.push(B.substr(1))}g=$(g).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(t=g.length;t--;){v=g[t];s=v.id;if(h.indexOf(s)<0){Ab[s]=v;v.parentNode.removeChild(v);k++}}return k};this.svgCanvasToString=
function(){for(;hc()>0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&&l.insertBefore(v,l.firstChild)});if(L){$b();Qb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s<v;s++)if(k[s].nodeName=="id"||k[s].nodeName=="style")v--;if(v<=0){k=this.firstChild;g.push(k);$(this).replaceWith(k)}});var h=this.svgToString(l,0);g.length&&$(g).each(function(){Pb(this)});return h};this.svgToString=function(g,
h){var k=[],v=svgedit.utilities.toXml,s=m.baseUnit,E=RegExp("^-?[\\d\\.]+"+s+"$");if(g){Z(g);var z=g.attributes,t,B,F=g.childNodes;for(B=0;B<h;B++)k.push(" ");k.push("<");k.push(g.nodeName);if(g.id==="svgcontent"){B=Vb();if(s!=="px"){B.w=svgedit.units.convertUnit(B.w,s)+s;B.h=svgedit.units.convertUnit(B.h,s)+s}k.push(' width="'+B.w+'" height="'+B.h+'" xmlns="'+c+'"');var C={};$(g).find("*").andSelf().each(function(){$.each(this.attributes,function(P,R){var W=R.namespaceURI;if(W&&!C[W]&&Aa[W]!=="xmlns"&&
Aa[W]!=="xml"){C[W]=true;k.push(" xmlns:"+Aa[W]+'="'+W+'"')}})});B=z.length;for(s=["width","height","xmlns","x","y","viewBox","id","overflow"];B--;){t=z.item(B);var D=v(t.nodeValue);if(t.nodeName.indexOf("xmlns:")!==0)if(D!=""&&s.indexOf(t.localName)==-1)if(!t.namespaceURI||Aa[t.namespaceURI]){k.push(" ");k.push(t.nodeName);k.push('="');k.push(D);k.push('"')}}}else{if(g.nodeName==="defs"&&!g.firstChild)return;var H=["-moz-math-font-style","_moz-math-font-style"];for(B=z.length-1;B>=0;B--){t=z.item(B);
D=v(t.nodeValue);if(!(H.indexOf(t.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(t.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(t.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+s}else D=svgedit.units.shortFloat(D);if(ob.apply&&g.nodeName==="image"&&t.localName==="href"&&ob.images&&ob.images==="embed"){var G=Ya[D];if(G)D=G}if(!t.namespaceURI||t.namespaceURI==c||Aa[t.namespaceURI]){k.push(t.nodeName);k.push('="');k.push(D);
k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(B=0;B<F.length;B++){s=F.item(B);switch(s.nodeType){case 1:k.push("\n");k.push(this.svgToString(F.item(B),h));break;case 3:s=s.nodeValue.replace(/^\s+|\s+$/g,"");if(s!=""){z=true;k.push(v(s)+"")}break;case 4:k.push("\n");k.push(Array(h+1).join(" "));k.push("<![CDATA[");k.push(s.nodeValue);k.push("]]\>");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push("<!--");k.push(s.data);k.push("--\>")}}h--;if(!z){k.push("\n");for(B=0;B<
h;B++)k.push(" ")}k.push("</");k.push(g.nodeName);k.push(">")}else k.push("/>")}return k.join("")};this.embedImage=function(g,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 v=";svgedit_url="+encodeURIComponent(g);v=k.toDataURL().replace(";base64",v+";base64");Ya[g]=v}catch(s){Ya[g]=false}La=g;h&&h(Ya[g])}).attr("src",g)};this.setGoodImage=function(g){La=g};this.open=function(){};this.save=
function(g){$a();g&&$.extend(ob,g);ob.apply=true;g=this.svgCanvasToString();K("saved",g)};this.rasterExport=function(){$a();var g=[],h={feGaussianBlur:Cb.exportNoBlur,foreignObject:Cb.exportNoforeignObject,"[stroke-dasharray]":Cb.exportNoDashArray},k=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))h.text=Cb.exportNoText;$.each(h,function(v,s){k.find(v).length&&g.push(s)});h=this.svgCanvasToString();K("exported",{svg:h,issues:g})};this.getSvgString=function(){ob.apply=false;return this.svgCanvasToString()};
this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,w()):svgedit.draw.randomizeIds(true,w())};var ec=this.uniquifyElems=function(g){var h={},k=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(g,function(t){if(t.nodeType==1){if(t.id){t.id in h||(h[t.id]={elem:null,attrs:[],hrefs:[]});h[t.id].elem=t}$.each(Mb,function(F,C){var D=t.getAttributeNode(C);if(D){var H=svgedit.utilities.getUrlFromAttr(D.value);
if(H=H?H.substr(1):null){H in h||(h[H]={elem:null,attrs:[],hrefs:[]});h[H].attrs.push(D)}}});var B=svgedit.utilities.getHref(t);if(B&&k.indexOf(t.nodeName)>=0)if(B=B.substr(1)){B in h||(h[B]={elem:null,attrs:[],hrefs:[]});h[B].hrefs.push(t)}}});for(var v in h)if(v){var s=h[v].elem;if(s){g=na();s.id=g;s=h[v].attrs;for(var E=s.length;E--;){var z=s[E];z.ownerElement.setAttribute(z.name,"url(#"+g+")")}s=h[v].hrefs;for(E=s.length;E--;)svgedit.utilities.setHref(s[E],"#"+g)}}},cc=this.setUseData=function(g){var h=
$(g);if(g.tagName!=="use")h=h.find("use");h.each(function(){var k=ba(this).substr(1);if(k=la(k)){$(this).data("ref",k);if(k.tagName=="symbol"||k.tagName=="svg")$(this).data("symbol",k).data("ref",k)}})},ac=this.convertGradients=function(g){var h=$(g).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(g).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var k=$(l).find('[fill="url(#'+
t.button===1)){var C=t.button===2;t.altKey&&svgCanvas.cloneSelectedElements(0,0);Eb=l.getScreenCTM().inverse();var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;t.preventDefault();if(C)Ma="select";B=B/p;F=F/p;var D=$b(t);if(D.tagName==="a"&&D.childNodes.length===1)D=D.firstChild;var H=v=h=B,G=s=k=F;if(m.gridSnapping){B=Ga(B);F=Ga(F);h=Ga(h);k=Ga(k)}if(D==Qa.selectorParentGroup&&J[0]!=null){D=t.target;var P=nb(D,"type");if(P=="rotate"){Ma="rotate";current_rotate_mode=nb(D,"dir")}else if(P=="resize"){Ma=
"resize";ob=nb(D,"dir")}D=J[0]}Za=D.getAttribute("transform");P=V(D);switch(Ma){case "select":Ja=true;ob="none";if(C)Ja=false;if(D!=e){if(J.indexOf(D)==-1){t.shiftKey||$a(true);Fb([D]);Lb=D;Ua.clear()}if(!C)for(C=0;C<J.length;++C)if(J[C]!=null){var Q=V(J[C]);Q.numberOfItems?Q.insertItemBefore(e.createSVGTransform(),0):Q.appendItem(e.createSVGTransform())}}else if(!C){$a();Ma="multiselect";if(xa==null)xa=Qa.getRubberBandBox();v*=p;s*=p;oa(xa,{x:v,y:s,width:0,height:0,display:"inline"},100)}break;case "zoom":Ja=
true;if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:H*p,y:H*p,width:0,height:0,display:"inline"},100);break;case "resize":Ja=true;h=B;k=F;E=svgedit.utilities.getBBox($("#selectedBox0")[0]);var W={};$.each(E,function(ua,wa){W[ua]=wa/p});E=W;C=sa(D)?1:0;if(ta(P)){P.insertItemBefore(e.createSVGTransform(),C);P.insertItemBefore(e.createSVGTransform(),C);P.insertItemBefore(e.createSVGTransform(),C)}else{P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());
if(svgedit.browser.supportsNonScalingStroke()){if(B=svgedit.browser.isChrome())Q=function(ua){var wa=ua.getAttributeNS(null,"stroke");ua.removeAttributeNS(null,"stroke");setTimeout(function(){ua.setAttributeNS(null,"stroke",wa)},1)};D.style.vectorEffect="non-scaling-stroke";B&&Q(D);F=D.getElementsByTagName("*");H=F.length;for(C=0;C<H;C++){F[C].style.vectorEffect="non-scaling-stroke";B&&Q(F[C])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ja=true;g=H+","+G+" ";Q=M.stroke_width==0?1:M.stroke_width;
da({element:"polyline",curStyles:true,attr:{points:g,id:na(),fill:"none",opacity:M.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});z.minx=H;z.maxx=H;z.miny=G;z.maxy=G;break;case "image":Ja=true;Q=da({element:"image",attr:{x:B,y:F,width:0,height:0,id:na(),opacity:M.opacity/2,style:"pointer-events:inherit"}});S(Q,La);Zb(Q);break;case "square":case "rect":Ja=true;h=B;k=F;da({element:"rect",curStyles:true,attr:{x:B,y:F,width:0,height:0,id:na(),opacity:M.opacity/2}});break;case "line":Ja=
true;Q=M.stroke_width==0?1:M.stroke_width;da({element:"line",curStyles:true,attr:{x1:B,y1:F,x2:B,y2:F,id:na(),stroke:M.stroke,"stroke-width":Q,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,fill:"none",opacity:M.opacity/2,style:"pointer-events:none"}});break;case "circle":Ja=true;da({element:"circle",curStyles:true,attr:{cx:B,cy:F,r:0,id:na(),opacity:M.opacity/2}});break;case "ellipse":Ja=true;da({element:"ellipse",
curStyles:true,attr:{cx:B,cy:F,rx:0,ry:0,id:na(),opacity:M.opacity/2}});break;case "text":Ja=true;da({element:"text",curStyles:true,attr:{x:B,y:F,id:na(),fill:fb.fill,"stroke-width":fb.stroke_width,"font-size":fb.font_size,"font-family":fb.font_family,"text-anchor":"left","xml:space":"preserve",opacity:M.opacity}});break;case "path":case "pathedit":h*=p;k*=p;Ua.mouseDown(t,D,h,k);Ja=true;break;case "textedit":h*=p;k*=p;gb.mouseDown(t,D,h,k);Ja=true;break;case "rotate":Ja=true;b.undoMgr.beginUndoableChange("transform",
J);document.getElementById("workarea").className="rotate"}Q=sb("mouseDown",{event:t,start_x:h,start_y:k,selectedElements:J},true);$.each(Q,function(ua,wa){if(wa&&wa.started)Ja=true});if(Ma)document.getElementById("workarea").className=Ma=="resize"?t.target.style.cursor:Ma}}).mousemove(function(t){if(Ja)if(!(t.button===1||b.spaceKey)){var C=J[0],F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;var D=la(Y()),H=x=B/p,G=y=F/p;if(m.gridSnapping){x=Ga(x);y=Ga(y)}t.preventDefault();switch(Ma){case "select":if(J[0]!==
null){H=x-h;var P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P)}if(t.shiftKey){var Q=ca(h,k,x,y);x=Q.x;y=Q.y}if(H!=0||P!=0){Q=J.length;for(G=0;G<Q;++G){C=J[G];if(C==null)break;var W=e.createSVGTransform();D=V(C);W.setTranslate(H,P);D.numberOfItems?D.replaceItem(W,0):D.appendItem(W);Qa.requestSelector(C).resize()}K("transition",J)}}break;case "multiselect":H*=p;G*=p;oa(xa,{x:Math.min(v,H),y:Math.min(s,G),width:Math.abs(H-v),height:Math.abs(G-s)},100);D=[];H=[];W=Gb();Q=J.length;for(G=0;G<Q;++G){P=W.indexOf(J[G]);
if(P==-1)D.push(J[G]);else W[P]=null}Q=W.length;for(G=0;G<Q;++G)W[G]&&H.push(W[G]);D.length>0&&b.removeFromSelection(D);H.length>0&&Fb(H);break;case "resize":D=V(C);H=(Q=ta(D))?E:svgedit.utilities.getBBox(C);G=H.x;W=H.y;var ua=H.width,wa=H.height;H=x-h;P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var fa=sa(C);if(fa){var ka=Math.sqrt(H*H+P*P);P=Math.atan2(P,H)-fa*Math.PI/180;H=ka*Math.cos(P);P=ka*Math.sin(P)}if(ob.indexOf("n")==-1&&ob.indexOf("s")==-1)P=0;if(ob.indexOf("e")==-1&&ob.indexOf("w")==
-1)H=0;var qa=ka=0,za=wa?(wa+P)/wa:1,jb=ua?(ua+H)/ua:1;if(ob.indexOf("n")>=0){za=wa?(wa-P)/wa:1;qa=wa}if(ob.indexOf("w")>=0){jb=ua?(ua-H)/ua:1;ka=ua}H=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){G=Ga(G);ka=Ga(ka);W=Ga(W);qa=Ga(qa)}H.setTranslate(-(G+ka),-(W+qa));if(t.shiftKey)if(jb==1)jb=za;else za=jb;P.setScale(jb,za);ua.setTranslate(G+ka,W+qa);if(Q){Q=fa?1:0;D.replaceItem(H,2+Q);D.replaceItem(P,1+Q);D.replaceItem(ua,0+Q)}else{Q=D.numberOfItems;D.replaceItem(ua,
Q-3);D.replaceItem(P,Q-2);D.replaceItem(H,Q-1)}Qa.requestSelector(C).resize();K("transition",J);break;case "zoom":H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100);break;case "text":oa(D,{x:x,y:y},1E3);break;case "line":H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);y=Ga(y)}G=x;Q=y;if(t.shiftKey){Q=ca(h,k,G,Q);G=Q.x;Q=Q.y}D.setAttributeNS(null,"x2",G);D.setAttributeNS(null,"y2",Q);window.opera||e.unsuspendRedraw(H);break;
case "foreignObject":case "square":case "rect":case "image":H=Math.abs(x-h);Q=Math.abs(y-k);if(Ma=="square"||t.shiftKey){H=Q=Math.max(H,Q);G=h<x?h:h-H;W=k<y?k:k-Q}else{G=Math.min(h,x);W=Math.min(k,y)}if(t.altKey){H*=2;Q*=2;G=h-H/2;W=k-Q/2}if(m.gridSnapping){H=Ga(H);Q=Ga(Q);G=Ga(G);W=Ga(W)}oa(D,{width:H,height:Q,x:G,y:W},1E3);break;case "circle":H=$(D).attr(["cx","cy"]);Q=H.cx;G=H.cy;H=Math.sqrt((x-Q)*(x-Q)+(y-G)*(y-G));if(m.gridSnapping)H=Ga(H);D.setAttributeNS(null,"r",H);break;case "ellipse":$(D).attr(["cx",
"cy"]);Q=Math.abs(h+(x-h)/2);G=Math.abs(k+(y-k)/2);H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);Q=Ga(Q);y=Ga(y);G=Ga(G)}W=Math.abs(h-Q);P=Math.abs(k-G);if(t.shiftKey){P=W;G=y>k?k+W:k-W}if(t.altKey){Q=h;G=k;W=Math.abs(x-Q);P=t.shiftKey?W:Math.abs(y-G)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P);D.setAttributeNS(null,"cx",Q);D.setAttributeNS(null,"cy",G);window.opera||e.unsuspendRedraw(H);break;case "fhellipse":case "fhrect":z.minx=Math.min(H,z.minx);z.maxx=Math.max(H,
z.maxx);z.miny=Math.min(G,z.miny);z.maxy=Math.max(G,z.maxy);case "fhpath":g+=+H+","+G+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(t.shiftKey){if(Q=svgedit.path.path){D=Q.dragging?Q.dragging[0]:h;Q=Q.dragging?Q.dragging[1]:k}else{D=h;Q=k}Q=ca(D,Q,x,y);x=Q.x;y=Q.y}if(xa&&xa.getAttribute("display")!=="none"){H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100)}Ua.mouseMove(t,
x,y);break;case "textedit":x*=p;y*=p;gb.mouseMove(B,F);break;case "rotate":H=svgedit.utilities.getBBox(C);Q=H.x+H.width/2;G=H.y+H.height/2;D=ea(C);D=O(Q,G,D);Q=D.x;G=D.y;D=H.x;W=H.y;if(current_rotate_mode=="nw")D=H.x+H.width;if(current_rotate_mode=="se")W=H.y+H.height;if(current_rotate_mode=="sw"){D=H.x+H.width;W=H.y+H.height}compensation_angle=(Math.atan2(G-W,Q-D)*(180/Math.PI)-90)%360;fa=(Math.atan2(G-y,Q-x)*(180/Math.PI)-90)%360;fa+=compensation_angle;if(m.gridSnapping)fa=Ga(fa);if(t.shiftKey)fa=
Math.round(fa/45)*45;b.setRotationAngle(fa<-180?360+fa:fa,true);K("transition",J)}sb("mouseMove",{event:t,mouse_x:B,mouse_y:F,selected:C})}}).click(function(t){t.preventDefault();return false}).dblclick(function(t){var C=t.target.parentNode;if(C!==L){var F=$b(t),B=F.tagName;if(B==="text"&&Ma!=="textedit"){t=O(t.pageX,t.pageY,Eb);gb.select(F,t.x,t.y)}if((B==="g"||B==="a")&&sa(F)){dc(F);F=J[0];$a(true)}L&&Sb();C.tagName!=="g"&&C.tagName!=="a"||C===w().getCurrentLayer()||F===Qa.selectorParentGroup||
mc(F)}}).mouseup(function(t){if(t.button!==2){var C=Lb;Lb=null;if(Ja){var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;var D=B/p,H=F/p,G=la(Y()),P=false;Ja=false;switch(Ma){case "resize":case "multiselect":if(xa!=null){xa.setAttribute("display","none");ub=[]}Ma="select";case "select":if(J[0]!=null){if(J[1]==null){B=J[0];switch(B.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ib.fill=B.getAttribute("fill");ib.fill_opacity=B.getAttribute("fill-opacity");ib.stroke=B.getAttribute("stroke");
ib.stroke_opacity=B.getAttribute("stroke-opacity");ib.stroke_width=B.getAttribute("stroke-width");ib.stroke_dasharray=B.getAttribute("stroke-dasharray");ib.stroke_linejoin=B.getAttribute("stroke-linejoin");ib.stroke_linecap=B.getAttribute("stroke-linecap")}if(B.tagName=="text"){fb.font_size=B.getAttribute("font-size");fb.font_family=B.getAttribute("font-family")}Qa.requestSelector(B).showGrips(true)}Pa();if(D!=v||H!=s){t=J.length;for(B=0;B<t;++B){if(J[B]==null)break;J[B].firstChild||Qa.requestSelector(J[B]).resize()}}else{B=
t.target;if(J[0].nodeName==="path"&&J[1]==null)Ua.select(J[0]);else t.shiftKey&&C!=B&&b.removeFromSelection([B])}if(svgedit.browser.supportsNonScalingStroke())if(t=J[0]){t.removeAttribute("style");svgedit.utilities.walkTree(t,function(ua){ua.removeAttribute("style")})}}return;case "zoom":xa!=null&&xa.setAttribute("display","none");K("zoomed",{x:Math.min(v,D),y:Math.min(s,H),width:Math.abs(D-v),height:Math.abs(H-s),factor:t.altKey?0.5:2});return;case "fhpath":C=G.getAttribute("points");D=C.indexOf(",");
if(P=D>=0?C.indexOf(",",D+1)>=0:C.indexOf(" ",C.indexOf(" ")+1)>=0)G=Ua.smoothPolylineIntoPath(G);break;case "line":C=$(G).attr(["x1","x2","y1","y2"]);P=C.x1!=C.x2||C.y1!=C.y2;break;case "foreignObject":case "square":case "rect":case "image":C=$(G).attr(["width","height"]);P=C.width!=0||C.height!=0||Ma==="image";break;case "circle":P=G.getAttribute("r")!=0;break;case "ellipse":C=$(G).attr(["rx","ry"]);P=C.rx!=null||C.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({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:Y()}});K("changed",[G]);P=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx-z.minx,height:z.maxy-z.miny,id:Y()}});K("changed",[G]);P=true}break;case "text":P=true;Pb([G]);gb.start(G);break;case "path":G=null;Ja=true;C=Ua.mouseUp(t,G,B,F);G=C.element;P=C.keep;break;case "pathedit":P=true;G=null;Ua.mouseUp(t);
break;case "textedit":P=false;G=null;gb.mouseUp(t,B,F);break;case "rotate":P=true;G=null;Ma="select";C=b.undoMgr.finishUndoableChange();C.isEmpty()||Ia(C);Pa();K("changed",J)}B=sb("mouseUp",{event:t,mouse_x:B,mouse_y:F},true);$.each(B,function(ua,wa){if(wa){P=wa.keep||P;G=wa.element;Ja=wa.started||Ja}});if(!P&&G!=null){w().releaseId(Y());G.parentNode.removeChild(G);G=null;for(B=t.target;B.parentNode.parentNode.tagName=="g";)B=B.parentNode;if((Ma!="path"||!drawn_path)&&B.parentNode.id!="selectorParentGroup"&&
B.id!="svgcanvas"&&B.id!="svgroot"){b.setMode("select");Pb([B],true)}}else if(G!=null){b.addedNew=true;t=0.2;var Q;if(false.beginElement&&G.getAttribute("opacity")!=M.opacity){Q=$(false).clone().attr({to:M.opacity,dur:t}).appendTo(G);try{Q[0].beginElement()}catch(W){}}else t=0;setTimeout(function(){Q&&Q.remove();G.setAttribute("opacity",M.opacity);G.setAttribute("style","pointer-events:inherit");Z(G);if(Ma==="path")Ua.toEditMode(G);else m.selectNew&&Pb([G],true);Ia(new Na(G));K("changed",[G])},t*
1E3)}Za=null}}});$(a).bind("mousewheel DOMMouseScroll",function(t){if(t.shiftKey){t.preventDefault();Eb=l.getScreenCTM().inverse();var C=O(t.pageX,t.pageY,Eb);C={x:C.x,y:C.y,width:0,height:0};if(t.wheelDelta)if(t.wheelDelta>=120)C.factor=2;else{if(t.wheelDelta<=-120)C.factor=0.5}else if(t.detail)if(t.detail>0)C.factor=0.5;else if(t.detail<0)C.factor=2;C.factor&&K("zoomed",C)}})})();var Zb=function(g){$(g).click(function(h){h.preventDefault()})},gb=b.textActions=function(){function g(fa){var ka=F.value===
"";$(F).focus();if(!arguments.length)if(ka)fa=0;else{if(F.selectionEnd!==F.selectionStart)return;fa=F.selectionEnd}var qa;qa=G[fa];ka||F.setSelectionRange(fa,fa);B=la("text_cursor");if(!B){B=document.createElementNS(c,"line");oa(B,{id:"text_cursor",stroke:"#333","stroke-width":1});B=la("selectorParentGroup").appendChild(B)}H||(H=setInterval(function(){var za=B.getAttribute("display")==="none";B.setAttribute("display",za?"inline":"none")},600));ka=E(qa.x,P.y);qa=E(qa.x,P.y+P.height);oa(B,{x1:ka.x,
y1:ka.y,x2:qa.x,y2:qa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(fa,ka,qa){if(fa===ka)g(ka);else{qa||F.setSelectionRange(fa,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");oa(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}fa=G[fa];var za=G[ka];B.setAttribute("visibility","hidden");ka=E(fa.x,P.y);qa=E(fa.x+(za.x-fa.x),P.y);var jb=E(fa.x,P.y+P.height);fa=E(fa.x+(za.x-
fa.x),P.y+P.height);oa(D,{d:"M"+ka.x+","+ka.y+" L"+qa.x+","+qa.y+" "+fa.x+","+fa.y+" "+jb.x+","+jb.y+"z",display:"inline"})}}function k(fa,ka){var qa=e.createSVGPoint();qa.x=fa;qa.y=ka;if(G.length==1)return 0;qa=C.getCharNumAtPosition(qa);if(qa<0){qa=G.length-2;if(fa<=G[0].x)qa=0}else if(qa>=G.length-2)qa=G.length-2;var za=G[qa];fa>za.x+za.width/2&&qa++;return qa}function v(fa,ka,qa){var za=F.selectionStart;fa=k(fa,ka);h(Math.min(za,fa),Math.max(za,fa),!qa)}function s(fa,ka){var qa={x:fa,y:ka};qa.x/=
p;qa.y/=p;if(Q){var za=O(qa.x,qa.y,Q.inverse());qa.x=za.x;qa.y=za.y}return qa}function E(fa,ka){var qa={x:fa,y:ka};if(Q){var za=O(qa.x,qa.y,Q);qa.x=za.x;qa.y=za.y}qa.x*=p;qa.y*=p;return qa}function z(fa){h(0,C.textContent.length);$(this).unbind(fa)}function t(fa){if(wa&&C){var ka=O(fa.pageX,fa.pageY,Eb);ka=s(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var qa=C.textContent,za=qa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;qa=qa.substr(ka).match(/^[a-z0-9]+/i);h(za,(qa?qa[0].length:0)+ka);$(fa.target).click(z);
setTimeout(function(){$(fa.target).unbind("click",z)},300)}}var C,F,B,D,H,G=[],P,Q,W,ua,wa;return{select:function(fa,ka,qa){C=fa;gb.toEditMode(ka,qa)},start:function(fa){C=fa;gb.toEditMode()},mouseDown:function(fa,ka,qa,za){fa=s(qa,za);F.focus();g(k(fa.x,fa.y));W=qa;ua=za},mouseMove:function(fa,ka){var qa=s(fa,ka);v(qa.x,qa.y)},mouseUp:function(fa,ka,qa){var za=s(ka,qa);v(za.x,za.y,true);fa.target!==C&&ka<W+2&&ka>W-2&&qa<ua+2&&qa>ua-2&&gb.toSelectMode(true)},setCursor:g,toEditMode:function(fa,ka){wa=
false;Ma="textedit";Qa.requestSelector(C).showGrips(false);Qa.requestSelector(C);gb.init();$(C).css("cursor","text");if(arguments.length){var qa=s(fa,ka);g(k(qa.x,qa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(fa){Ma="select";clearInterval(H);H=null;D&&$(D).attr("display","none");B&&$(B).attr("visibility","hidden");$(C).css("cursor","move");if(fa){$a();$(C).css("cursor","move");K("selected",[C]);Fb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur();
C=false},setInputElem:function(fa){F=fa},clear:function(){Ma=="textedit"&&gb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=J[0];Qa.requestSelector(C).showGrips(false)}var fa=C.textContent.length,ka=C.getAttribute("transform");P=svgedit.utilities.getBBox(C);Q=ka?ea(C):null;G=Array(fa);F.focus();$(C).unbind("dblclick",t).dblclick(t);if(!fa)var qa={x:P.x+P.width/2,width:0};for(ka=0;ka<fa;ka++){var za=C.getStartPositionOfChar(ka);qa=C.getEndPositionOfChar(ka);if(!svgedit.browser.supportsGoodTextCharPos()){var jb=
b.contentW*p;za.x-=jb;qa.x-=jb;za.x/=p;qa.x/=p}G[ka]={x:za.x,y:P.y,width:qa.x-za.x,height:P.height}}G.push({x:qa.x,width:0});h(F.selectionStart,F.selectionEnd,true)}}}}(),Ua=b.pathActions=function(){var g=false,h,k,v;svgedit.path.Path.prototype.endChanges=function(z){if(svgedit.browser.isWebkit()){var t=this.elem;t.setAttribute("d",Ua.convertPath(t))}z=new Wa(this.elem,{d:this.last_d},z);Ia(z);K("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(z){$.isArray(z)||(z=[z]);
for(var t=0;t<z.length;t++){var C=z[t],F=this.segs[C];F.ptgrip&&this.selected_pts.indexOf(C)==-1&&C>=0&&this.selected_pts.push(C)}this.selected_pts.sort();t=this.selected_pts.length;for(z=Array(t);t--;){F=this.segs[this.selected_pts[t]];F.select(true);z[t]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);K("selected",z)};var s=h=null,E=false;return{mouseDown:function(z,t,C,F){if(Ma==="path"){mouse_x=C;mouse_y=F;F=mouse_x/p;t=mouse_y/p;C=la("path_stretch_line");
k=[F,t];if(m.gridSnapping){F=Ga(F);t=Ga(t);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!C){C=document.createElementNS(c,"path");oa(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=la("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var B=null;if(s){B=s.pathSegList;for(var D=B.numberOfItems,H=6/p,G=false;D;){D--;var P=B.getItem(D),Q=P.x;P=P.y;if(F>=Q-H&&F<=Q+H&&t>=P-H&&t<=P+H){G=true;break}}H=Y();svgedit.path.removePath_(H);H=la(H);Q=B.numberOfItems;
if(G){if(D<=1&&Q>=2){F=B.getItem(0).x;t=B.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,t):s.createSVGPathSegCurvetoCubicAbs(F,t,z.x1/p,z.y1/p,F,t);F=s.createSVGPathSegClosePath();B.appendItem(z);B.appendItem(F)}else if(Q<3)return B=false;$(C).remove();element=H;s=null;Ja=false;if(g){svgedit.path.path.matrix&&pb(H,{},svgedit.path.path.matrix.inverse());C=H.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(H).remove();
svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,$b(z))){console.log("Clicked outside canvas");return false}B=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(B-1);H=D.x;D=D.y;if(z.shiftKey){z=ca(H,D,F,t);F=z.x;t=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(mb(F),mb(t)):s.createSVGPathSegCurvetoCubicAbs(mb(F),mb(t),z.x1/p,z.y1/
p,z.x2/p,z.y2/p);s.pathSegList.appendItem(z);F*=p;t*=p;C.setAttribute("d",["M",F,t,F,t].join(" "));C=B;if(g)C+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(C,F,t)}}else{d_attr="M"+F+","+t+" ";s=da({element:"path",curStyles:true,attr:{d:d_attr,id:na(),opacity:M.opacity/2}});C.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));C=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(C,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();H=z.target.id;
if(H.substr(0,14)=="pathpointgrip_"){t=svgedit.path.path.cur_pt=parseInt(H.substr(14));svgedit.path.path.dragging=[C,F];B=svgedit.path.path.segs[t];if(z.shiftKey)B.selected?svgedit.path.path.removePtFromSelection(t):svgedit.path.path.addPtsToSelection(t);else{if(svgedit.path.path.selected_pts.length<=1||!B.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(t)}}else if(H.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=H.split("_")[1].split("c");t=z[0]-
0;svgedit.path.path.selectPt(t,z[1]-0)}if(!svgedit.path.path.dragging){if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:C*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,t,C){E=true;if(Ma==="path"){if(s){var F=s.pathSegList;z=F.numberOfItems-1;if(k){var B=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");B.setAttribute("cx",t);B.setAttribute("cy",C);B.setAttribute("display","inline");B=k[0];var H=k[1];F.getItem(z);var G=
B+(B-t/p),P=H+(H-C/p);D.setAttribute("cx",G*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var Q=svgedit.path.getCtrlLine(2);oa(D,{x1:t,y1:C,x2:B*p,y2:H*p,display:"inline"});oa(Q,{x1:G*p,y1:P*p,x2:B*p,y2:H*p,display:"inline"});if(z===0)v=[t,C];else{F=F.getItem(z-1);t=F.x;C=F.y;if(F.pathSegType===6){t+=t-F.x2;C+=C-F.y2}else if(v){t=v[0]/p;C=v[1]/p}svgedit.path.replacePathSeg(6,z,[B,H,t,C,G,P],s)}}else if(B=la("path_stretch_line")){z=F.getItem(z);if(z.pathSegType===
6)svgedit.path.replacePathSeg(6,1,[t,C,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,t,C],B);else v?svgedit.path.replacePathSeg(6,1,[t,C,v[0],v[1],t,C],B):svgedit.path.replacePathSeg(4,1,[t,C],B)}}}else if(svgedit.path.path.dragging){B=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);H=svgedit.path.getPointFromGrip({x:t,y:C},svgedit.path.path);z=H.x-B.x;B=H.y-B.y;svgedit.path.path.dragging=[t,C];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(z,
B):svgedit.path.path.movePts(z,B)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var W=xa.getBBox(),ua=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ua.x,y:ua.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(z,t){if(Ma==="path"){k=null;if(!s){t=la(Y());Ja=false;v=null}return{keep:true,element:t}}if(svgedit.path.path.dragging){var C=svgedit.path.path.cur_pt;svgedit.path.path.dragging=
false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();E&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!E&&svgedit.path.path.selectPt(C)}else if(xa&&xa.getAttribute("display")!="none"){xa.setAttribute("display","none");xa.getAttribute("width")<=2&&xa.getAttribute("height")<=2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);E=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ma="pathedit";$a();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=
svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var t=z==svgedit.path.path.elem;Ma="select";svgedit.path.path.show(false);h=false;$a();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(t){K("selected",[z]);Fb([z],true)}},addSubPath:function(z){if(z){Ma="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ma="pathedit"}else h=z},reorient:function(){var z=J[0];if(z)if(sa(z)!=0){var t=new Oa("Reorient path"),
C={d:z.getAttribute("d"),transform:z.getAttribute("transform")};t.addSubCommand(new Wa(z,C));$a();this.resetOrientation(z);Ia(t);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Fb([z],true);K("changed",J)}},clear:function(){h=null;if(s){var z=la(Y());$(la("path_stretch_line")).remove();$(z).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");s=v=null;Ja=false}else Ma=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z==
null||z.nodeName!="path")return false;var t=V(z),C=ha(t).matrix;t.clear();z.removeAttribute("transform");t=z.pathSegList;for(var F=t.numberOfItems,B=0;B<F;++B){var D=t.getItem(B),H=D.pathSegType;if(H!=1){var G=[];$.each(["",1,2],function(P,Q){var W=D["x"+Q],ua=D["y"+Q];if(W!==undefined&&ua!==undefined){W=O(W,ua,C);G.splice(G.length,0,W.x,W.y)}});svgedit.path.replacePathSeg(H,B,G,z)}}f(z,C)},zoomChange:function(){Ma=="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,t=z.length,C=[];t--;){var F=z[t];svgedit.path.path.addSeg(F);C.push(F+t);C.push(F+t+1)}svgedit.path.path.init().addPtsToSelection(C);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var z=svgedit.path.path.selected_pts;if(z.length===
1){var t=svgedit.path.path.elem,C=t.pathSegList,F=z[0],B=null,D=null;svgedit.path.path.eachSeg(function(Q){if(this.type===2&&Q<=F)D=this.item;if(Q<=F)return true;if(this.type===2){B=Q;return false}else if(this.type===1)return B=false});if(B==null)B=svgedit.path.path.segs.length-1;if(B!==false){var H=t.createSVGPathSegLinetoAbs(D.x,D.y),G=t.createSVGPathSegClosePath();if(B==svgedit.path.path.segs.length-1){C.appendItem(H);C.appendItem(G)}else{svgedit.path.insertItemBefore(t,G,B);svgedit.path.insertItemBefore(t,
H,B)}svgedit.path.path.init().selectPt(B+1)}else if(svgedit.path.path.segs[F].mate){C.removeItem(F);C.removeItem(F);svgedit.path.path.init().selectPt(F-1)}else{for(z=0;z<C.numberOfItems;z++){var P=C.getItem(z);if(P.pathSegType===2)H=z;else if(z===F)C.removeItem(H);else if(P.pathSegType===1&&F<z){G=z-1;C.removeItem(z);break}}for(z=F-H-1;z--;)svgedit.path.insertItemBefore(t,C.getItem(H),G);t=C.getItem(H);svgedit.path.replacePathSeg(2,H,[t.x,t.y]);z=F;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ua.canDeleteNodes){svgedit.path.path.storeD();
for(var z=svgedit.path.path.selected_pts,t=z.length;t--;)svgedit.path.path.deleteSeg(z[t]);var C=function(){var F=svgedit.path.path.elem.pathSegList,B=F.numberOfItems,D=function(P,Q){for(;Q--;)F.removeItem(P)};if(B<=1)return true;for(;B--;){var H=F.getItem(B);if(H.pathSegType===1){H=F.getItem(B-1);var G=F.getItem(B-2);if(H.pathSegType===2){D(B-1,2);C();break}else if(G.pathSegType===2){D(B-2,3);C();break}}else if(H.pathSegType===2)if(B>0){H=F.getItem(B-1).pathSegType;if(H===2){D(B-1,1);C();break}else if(H===
1&&F.numberOfItems-1===B){D(B,1);C();break}}}return false};C();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem);b.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 t=z.points,C=t.numberOfItems;if(C>=4){var F=t.getItem(0),B=null;z=[];z.push(["M",F.x,",",
F.y," C"].join(""));for(var D=1;D<=C-4;D+=3){var H=t.getItem(D),G=t.getItem(D+1),P=t.getItem(D+2);if(B)if((F=svgedit.path.smoothControlPoints(B,H,F))&&F.length==2){H=z[z.length-1].split(",");H[2]=F[0].x;H[3]=F[0].y;z[z.length-1]=H.join(",");H=F[1]}z.push([H.x,H.y,G.x,G.y,P.x,P.y].join(","));F=P;B=G}for(z.push("L");D<C;++D){G=t.getItem(D);z.push([G.x,G.y].join(","))}z=z.join(" ");z=da({element:"path",curStyles:true,attr:{id:Y(),d:z,fill:"none"}})}return z},setSegType:function(z){svgedit.path.path.setSegType(z)},
moveNode:function(z,t){var C=svgedit.path.path.selected_pts;if(C.length){svgedit.path.path.storeD();C=svgedit.path.path.segs[C[0]];var F={x:0,y:0};F[z]=t-C.item[z];C.move(F.x,F.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(z){for(var t=z.pathSegList,C=t.numberOfItems,F,B=0;B<C;++B){var D=t.getItem(B);if(D.pathSegType===2)F=D;if(D.pathSegType===1){D=t.getItem(B-1);if(D.x!=F.x||D.y!=F.y){t=z.createSVGPathSegLinetoAbs(F.x,F.y);svgedit.path.insertItemBefore(z,t,B);Ua.fixEnd(z);
break}}}svgedit.browser.isWebkit()&&z.setAttribute("d",Ua.convertPath(z))},convertPath:function(z,t){for(var C=z.pathSegList,F=C.numberOfItems,B=0,D=0,H="",G=null,P=0;P<F;++P){var Q=C.getItem(P),W=Q.x||0,ua=Q.y||0,wa=Q.x1||0,fa=Q.y1||0,ka=Q.x2||0,qa=Q.y2||0,za=Q.pathSegType,jb=Xa[za]["to"+(t?"Lower":"Upper")+"Case"](),zb=function(Qb,Ib,Ob){Ib=Ib?" "+Ib.join(" "):"";Ob=Ob?" "+svgedit.units.shortFloat(Ob):"";$.each(Qb,function(Ub,ac){Qb[Ub]=svgedit.units.shortFloat(ac)});H+=jb+Qb.join(" ")+Ib+Ob};switch(za){case 1:H+=
"z";break;case 12:W-=B;case 13:if(t){B+=W;jb="l"}else{W+=B;B=W;jb="L"}zb([[W,D]]);break;case 14:ua-=D;case 15:if(t){D+=ua;jb="l"}else{ua+=D;D=ua;jb="L"}zb([[B,ua]]);break;case 2:case 4:case 18:W-=B;ua-=D;case 5:case 3:if(G&&C.getItem(P-1).pathSegType===1&&!t){B=G[0];D=G[1]}case 19:if(t){B+=W;D+=ua}else{W+=B;ua+=D;B=W;D=ua}if(za===3)G=[B,D];zb([[W,ua]]);break;case 6:W-=B;wa-=B;ka-=B;ua-=D;fa-=D;qa-=D;case 7:if(t){B+=W;D+=ua}else{W+=B;wa+=B;ka+=B;ua+=D;fa+=D;qa+=D;B=W;D=ua}zb([[wa,fa],[ka,qa],[W,ua]]);
break;case 8:W-=B;wa-=B;ua-=D;fa-=D;case 9:if(t){B+=W;D+=ua}else{W+=B;wa+=B;ua+=D;fa+=D;B=W;D=ua}zb([[wa,fa],[W,ua]]);break;case 10:W-=B;ua-=D;case 11:if(t){B+=W;D+=ua}else{W+=B;ua+=D;B=W;D=ua}zb([[Q.r1,Q.r2]],[Q.angle,Q.largeArcFlag?1:0,Q.sweepFlag?1:0],[W,ua]);break;case 16:W-=B;ka-=B;ua-=D;qa-=D;case 17:if(t){B+=W;D+=ua}else{W+=B;ka+=B;ua+=D;qa+=D;B=W;D=ua}zb([[ka,qa],[W,ua]])}}return H}}}(),ic=this.removeUnusedDefElems=function(){var g=l.getElementsByTagNameNS(c,"defs");if(!g||!g.length)return 0;
for(var h=[],k=0,v=["fill","stroke","filter","marker-start","marker-mid","marker-end"],s=v.length,E=l.getElementsByTagNameNS(c,"*"),z=E.length,t=0;t<z;t++){for(var C=E[t],F=0;F<s;F++){var B=pa(C.getAttribute(v[F]));B&&h.push(B.substr(1))}(C=ba(C))&&C.indexOf("#")===0&&h.push(C.substr(1))}g=$(g).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(t=g.length;t--;){v=g[t];s=v.id;if(h.indexOf(s)<0){yb[s]=v;v.parentNode.removeChild(v);k++}}return k};this.svgCanvasToString=
function(){for(;ic()>0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&&l.insertBefore(v,l.firstChild)});if(L){Sb();Pb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s<v;s++)if(k[s].nodeName=="id"||k[s].nodeName=="style")v--;if(v<=0){k=this.firstChild;g.push(k);$(this).replaceWith(k)}});var h=this.svgToString(l,0);g.length&&$(g).each(function(){Nb(this)});return h};this.svgToString=function(g,
h){var k=[],v=svgedit.utilities.toXml,s=m.baseUnit,E=RegExp("^-?[\\d\\.]+"+s+"$");if(g){Z(g);var z=g.attributes,t,C,F=g.childNodes;for(C=0;C<h;C++)k.push(" ");k.push("<");k.push(g.nodeName);if(g.id==="svgcontent"){C=Vb();if(s!=="px"){C.w=svgedit.units.convertUnit(C.w,s)+s;C.h=svgedit.units.convertUnit(C.h,s)+s}k.push(' width="'+C.w+'" height="'+C.h+'" xmlns="'+c+'"');var B={};$(g).find("*").andSelf().each(function(){$.each(this.attributes,function(P,Q){var W=Q.namespaceURI;if(W&&!B[W]&&Aa[W]!=="xmlns"&&
Aa[W]!=="xml"){B[W]=true;k.push(" xmlns:"+Aa[W]+'="'+W+'"')}})});C=z.length;for(s=["width","height","xmlns","x","y","viewBox","id","overflow"];C--;){t=z.item(C);var D=v(t.nodeValue);if(t.nodeName.indexOf("xmlns:")!==0)if(D!=""&&s.indexOf(t.localName)==-1)if(!t.namespaceURI||Aa[t.namespaceURI]){k.push(" ");k.push(t.nodeName);k.push('="');k.push(D);k.push('"')}}}else{if(g.nodeName==="defs"&&!g.firstChild)return;var H=["-moz-math-font-style","_moz-math-font-style"];for(C=z.length-1;C>=0;C--){t=z.item(C);
D=v(t.nodeValue);if(!(H.indexOf(t.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(t.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(t.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+s}else D=svgedit.units.shortFloat(D);if(qb.apply&&g.nodeName==="image"&&t.localName==="href"&&qb.images&&qb.images==="embed"){var G=Ya[D];if(G)D=G}if(!t.namespaceURI||t.namespaceURI==c||Aa[t.namespaceURI]){k.push(t.nodeName);k.push('="');k.push(D);
k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(C=0;C<F.length;C++){s=F.item(C);switch(s.nodeType){case 1:k.push("\n");k.push(this.svgToString(F.item(C),h));break;case 3:s=s.nodeValue.replace(/^\s+|\s+$/g,"");if(s!=""){z=true;k.push(v(s)+"")}break;case 4:k.push("\n");k.push(Array(h+1).join(" "));k.push("<![CDATA[");k.push(s.nodeValue);k.push("]]\>");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push("<!--");k.push(s.data);k.push("--\>")}}h--;if(!z){k.push("\n");for(C=0;C<
h;C++)k.push(" ")}k.push("</");k.push(g.nodeName);k.push(">")}else k.push("/>")}return k.join("")};this.embedImage=function(g,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 v=";svgedit_url="+encodeURIComponent(g);v=k.toDataURL().replace(";base64",v+";base64");Ya[g]=v}catch(s){Ya[g]=false}La=g;h&&h(Ya[g])}).attr("src",g)};this.setGoodImage=function(g){La=g};this.open=function(){};this.save=
function(g){$a();g&&$.extend(qb,g);qb.apply=true;g=this.svgCanvasToString();K("saved",g)};this.rasterExport=function(){$a();var g=[],h={feGaussianBlur:Cb.exportNoBlur,foreignObject:Cb.exportNoforeignObject,"[stroke-dasharray]":Cb.exportNoDashArray},k=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))h.text=Cb.exportNoText;$.each(h,function(v,s){k.find(v).length&&g.push(s)});h=this.svgCanvasToString();K("exported",{svg:h,issues:g})};this.getSvgString=function(){qb.apply=false;return this.svgCanvasToString()};
this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,w()):svgedit.draw.randomizeIds(true,w())};var ec=this.uniquifyElems=function(g){var h={},k=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(g,function(t){if(t.nodeType==1){if(t.id){t.id in h||(h[t.id]={elem:null,attrs:[],hrefs:[]});h[t.id].elem=t}$.each(Kb,function(F,B){var D=t.getAttributeNode(B);if(D){var H=svgedit.utilities.getUrlFromAttr(D.value);
if(H=H?H.substr(1):null){H in h||(h[H]={elem:null,attrs:[],hrefs:[]});h[H].attrs.push(D)}}});var C=svgedit.utilities.getHref(t);if(C&&k.indexOf(t.nodeName)>=0)if(C=C.substr(1)){C in h||(h[C]={elem:null,attrs:[],hrefs:[]});h[C].hrefs.push(t)}}});for(var v in h)if(v){var s=h[v].elem;if(s){g=na();s.id=g;s=h[v].attrs;for(var E=s.length;E--;){var z=s[E];z.ownerElement.setAttribute(z.name,"url(#"+g+")")}s=h[v].hrefs;for(E=s.length;E--;)svgedit.utilities.setHref(s[E],"#"+g)}}},cc=this.setUseData=function(g){var h=
$(g);if(g.tagName!=="use")h=h.find("use");h.each(function(){var k=ba(this).substr(1);if(k=la(k)){$(this).data("ref",k);if(k.tagName=="symbol"||k.tagName=="svg")$(this).data("symbol",k).data("ref",k)}})},fc=this.convertGradients=function(g){var h=$(g).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(g).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 v=$(this).attr(["x1","y1","x2","y2"]),s=this.gradientTransform.baseVal;if(s&&s.numberOfItems>0){var E=ha(s).matrix;s=O(v.x1,v.y1,E);E=O(v.x2,v.y2,E);v.x1=s.x;v.y1=s.y;v.x2=E.x;v.y2=E.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(v.x1-k.x)/k.width,y1:(v.y1-k.y)/k.height,x2:(v.x2-k.x)/k.width,y2:(v.y2-k.y)/k.height});this.removeAttribute("gradientUnits")}}})},
fc=this.convertToGroup=function(g){g||(g=J[0]);var h=$(g),k=new Oa,v;if(h.data("gsvg")){k=$(g.firstChild).attr(["x","y"]);$(g.firstChild.firstChild).unwrap();$(g).removeData("gsvg");v=V(g);var s=e.createSVGTransform();s.setTranslate(k.x,k.y);v.appendItem(s);cb(g);K("selected",[g])}else if(h.data("symbol")){g=h.data("symbol");v=h.attr("transform");s=h.attr(["x","y"]);var E=g.getAttribute("viewBox");if(E){E=E.split(" ");s.x-=+E[0];s.y-=+E[1]}v+=" translate("+(s.x||0)+","+(s.y||0)+")";s=h.prev();k.addSubCommand(new Sa(h[0],
h[0].nextSibling,h[0].parentNode));h.remove();E=$(l).find("use:data(symbol)").length;h=d.createElementNS(c,"g");for(var z=g.childNodes,t=0;t<z.length;t++)h.appendChild(z[t].cloneNode(true));if(svgedit.browser.isGecko()){z=$(xb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(z)}v&&h.setAttribute("transform",v);v=g.parentNode;ec(h);svgedit.browser.isGecko()&&$(xb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=na();s.after(h);if(v){if(!E){s=g.nextSibling;
v.removeChild(g);k.addSubCommand(new Sa(g,s,v))}k.addSubCommand(new Na(h))}cc(h);svgedit.browser.isGecko()?ac(xb()):ac(h);svgedit.utilities.walkTreePost(h,function(B){try{cb(B)}catch(F){console.log(F)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=na()});Qb([h]);(g=Xb(h,true))&&k.addSubCommand(g);Ia(k)}else console.log("Unexpected element to ungroup:",g)};this.setSvgString=function(g){try{var h=svgedit.utilities.text2xml(g);
this.prepareSvg(h);var k=new Oa("Change Source"),v=l.nextSibling,s=e.removeChild(l);k.addSubCommand(new Sa(s,v,e));l=d.adoptNode?d.adoptNode(h.documentElement):d.importNode(h.documentElement,true);e.appendChild(l);var E=$(l);b.current_drawing_=new svgedit.draw.Drawing(l,u);var z=w().getNonce();z?K("setnonce",z):K("unsetnonce");E.find("image").each(function(){var G=this;Ib(G);var P=ba(this);if(P.indexOf("data:")===0){var R=P.match(/svgedit_url=(.*?);/);if(R){var W=decodeURIComponent(R[1]);$(new Image).load(function(){G.setAttributeNS("http://www.w3.org/1999/xlink",
"xlink:href",W)}).attr("src",W)}}b.embedImage(P)});E.find("svg").each(function(){if(!$(this).closest("defs").length){ec(this);var G=this.parentNode;if(G.childNodes.length===1&&G.nodeName==="g"){$(G).data("gsvg",this);G.id=G.id||na()}else Pb(this)}});svgedit.browser.isGecko()&&E.find("linearGradient, radialGradient, pattern").appendTo(xb());cc(E);ac(E[0]);svgedit.utilities.walkTreePost(l,function(G){try{cb(G)}catch(P){console.log(P)}});var t={id:"svgcontent",overflow:m.show_outside_canvas?"visible":
"hidden"},B=false;if(E.attr("viewBox")){var F=E.attr("viewBox").split(" ");t.width=F[2];t.height=F[3]}else $.each(["width","height"],function(G,P){var R=E.attr(P);R||(R="100%");if((R+"").substr(-1)==="%")B=true;else t[P]=ra(P,R)});Rb();E.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=na()});if(B){var C=getStrokedBBox();t.width=C.width+C.x;t.height=C.height+C.y}if(t.width<=0)t.width=100;if(t.height<=0)t.height=
100;E.attr(t);this.contentW=t.width;this.contentH=t.height;k.addSubCommand(new Na(l));var D=E.attr(["width","height"]);k.addSubCommand(new Wa(e,D));p=1;svgedit.transformlist.resetListMap();$a();svgedit.path.clearData();e.appendChild(Qa.selectorParentGroup);Ia(k);K("changed",[l])}catch(H){console.log(H);return false}return true};this.importSvgString=function(g){try{var h=svgedit.utilities.encode64(g.length+g).substr(0,32),k=false;if(zb[h])if($(zb[h].symbol).parents("#svgroot").length)k=true;var v=
new Oa("Import SVG");if(k)var s=zb[h].symbol,E=zb[h].xform;else{var z=svgedit.utilities.text2xml(g);this.prepareSvg(z);var t;t=d.adoptNode?d.adoptNode(z.documentElement):d.importNode(z.documentElement,true);ec(t);var B=ra("width",t.getAttribute("width")),F=ra("height",t.getAttribute("height")),C=t.getAttribute("viewBox"),D=C?C.split(" "):[0,0,B,F];for(g=0;g<4;++g)D[g]=+D[g];l.getAttribute("width");var H=+l.getAttribute("height");E=F>B?"scale("+H/3/D[3]+")":"scale("+H/3/D[2]+")";E="translate(0) "+
E+" translate(0)";s=d.createElementNS(c,"symbol");var G=xb();for(svgedit.browser.isGecko()&&$(t).find("linearGradient, radialGradient, pattern").appendTo(G);t.firstChild;)s.appendChild(t.firstChild);var P=t.attributes;for(t=0;t<P.length;t++){var R=P[t];s.setAttribute(R.nodeName,R.nodeValue)}s.id=na();zb[h]={symbol:s,xform:E};xb().appendChild(s);v.addSubCommand(new Na(s))}var W=d.createElementNS(c,"use");W.id=na();S(W,"#"+s.id);(L||w().getCurrentLayer()).appendChild(W);v.addSubCommand(new Na(W));$a();
W.setAttribute("transform",E);cb(W);$(W).data("symbol",s).data("ref",s);Kb([W]);Ia(v);K("changed",[l])}catch(ta){console.log(ta);return false}return true};var Rb=b.identifyLayers=function(){$b();w().identifyLayers()};this.createLayer=function(g){var h=new Oa("Create Layer");g=w().createLayer(g);h.addSubCommand(new Na(g));Ia(h);$a();K("changed",[g])};this.cloneLayer=function(g){var h=new Oa("Duplicate Layer"),k=d.createElementNS(c,"g"),v=d.createElementNS(c,"title");v.textContent=g;k.appendChild(v);
v=w().getCurrentLayer();$(v).after(k);v=v.childNodes;for(var s=0;s<v.length;s++){var E=v[s];E.localName!="title"&&k.appendChild(ma(E))}$a();Rb();h.addSubCommand(new Na(k));Ia(h);b.setCurrentLayer(g);K("changed",[k])};this.deleteCurrentLayer=function(){var g=w().getCurrentLayer(),h=g.nextSibling,k=g.parentNode;if(g=w().deleteCurrentLayer()){var v=new Oa("Delete Layer");v.addSubCommand(new Sa(g,h,k));Ia(v);$a();K("changed",[k]);return true}return false};this.setCurrentLayer=function(g){(g=w().setCurrentLayer(svgedit.utilities.toXml(g)))&&
gc=this.convertToGroup=function(g){g||(g=J[0]);var h=$(g),k=new Oa,v;if(h.data("gsvg")){k=$(g.firstChild).attr(["x","y"]);$(g.firstChild.firstChild).unwrap();$(g).removeData("gsvg");v=V(g);var s=e.createSVGTransform();s.setTranslate(k.x,k.y);v.appendItem(s);cb(g);K("selected",[g])}else if(h.data("symbol")){g=h.data("symbol");v=h.attr("transform");s=h.attr(["x","y"]);var E=g.getAttribute("viewBox");if(E){E=E.split(" ");s.x-=+E[0];s.y-=+E[1]}v+=" translate("+(s.x||0)+","+(s.y||0)+")";s=h.prev();k.addSubCommand(new Sa(h[0],
h[0].nextSibling,h[0].parentNode));h.remove();E=$(l).find("use:data(symbol)").length;h=d.createElementNS(c,"g");for(var z=g.childNodes,t=0;t<z.length;t++)h.appendChild(z[t].cloneNode(true));if(svgedit.browser.isGecko()){z=$(vb()).children("linearGradient,radialGradient,pattern").clone();$(h).append(z)}v&&h.setAttribute("transform",v);v=g.parentNode;ec(h);svgedit.browser.isGecko()&&$(vb()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=na();s.after(h);if(v){if(!E){s=g.nextSibling;
v.removeChild(g);k.addSubCommand(new Sa(g,s,v))}k.addSubCommand(new Na(h))}cc(h);svgedit.browser.isGecko()?fc(vb()):fc(h);svgedit.utilities.walkTreePost(h,function(C){try{cb(C)}catch(F){console.log(F)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=na()});Pb([h]);(g=dc(h,true))&&k.addSubCommand(g);Ia(k)}else console.log("Unexpected element to ungroup:",g)};this.setSvgString=function(g){try{var h=svgedit.utilities.text2xml(g);
this.prepareSvg(h);var k=new Oa("Change Source"),v=l.nextSibling,s=e.removeChild(l);k.addSubCommand(new Sa(s,v,e));l=d.adoptNode?d.adoptNode(h.documentElement):d.importNode(h.documentElement,true);e.appendChild(l);var E=$(l);b.current_drawing_=new svgedit.draw.Drawing(l,u);var z=w().getNonce();z?K("setnonce",z):K("unsetnonce");E.find("image").each(function(){var G=this;Zb(G);var P=ba(this);if(P.indexOf("data:")===0){var Q=P.match(/svgedit_url=(.*?);/);if(Q){var W=decodeURIComponent(Q[1]);$(new Image).load(function(){G.setAttributeNS("http://www.w3.org/1999/xlink",
"xlink:href",W)}).attr("src",W)}}b.embedImage(P)});E.find("svg").each(function(){if(!$(this).closest("defs").length){ec(this);var G=this.parentNode;if(G.childNodes.length===1&&G.nodeName==="g"){$(G).data("gsvg",this);G.id=G.id||na()}else Nb(this)}});svgedit.browser.isGecko()&&E.find("linearGradient, radialGradient, pattern").appendTo(vb());cc(E);fc(E[0]);svgedit.utilities.walkTreePost(l,function(G){try{cb(G)}catch(P){console.log(P)}});var t={id:"svgcontent",overflow:m.show_outside_canvas?"visible":
"hidden"},C=false;if(E.attr("viewBox")){var F=E.attr("viewBox").split(" ");t.width=F[2];t.height=F[3]}else $.each(["width","height"],function(G,P){var Q=E.attr(P);Q||(Q="100%");if((Q+"").substr(-1)==="%")C=true;else t[P]=ra(P,Q)});Tb();E.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=na()});if(C){var B=getStrokedBBox();t.width=B.width+B.x;t.height=B.height+B.y}if(t.width<=0)t.width=100;if(t.height<=0)t.height=
100;E.attr(t);this.contentW=t.width;this.contentH=t.height;k.addSubCommand(new Na(l));var D=E.attr(["width","height"]);k.addSubCommand(new Wa(e,D));p=1;svgedit.transformlist.resetListMap();$a();svgedit.path.clearData();e.appendChild(Qa.selectorParentGroup);Ia(k);K("changed",[l])}catch(H){console.log(H);return false}return true};this.importSvgString=function(g){try{var h=svgedit.utilities.encode64(g.length+g).substr(0,32),k=false;if(xb[h])if($(xb[h].symbol).parents("#svgroot").length)k=true;var v=
new Oa("Import SVG");if(k)var s=xb[h].symbol,E=xb[h].xform;else{var z=svgedit.utilities.text2xml(g);this.prepareSvg(z);var t;t=d.adoptNode?d.adoptNode(z.documentElement):d.importNode(z.documentElement,true);ec(t);var C=ra("width",t.getAttribute("width")),F=ra("height",t.getAttribute("height")),B=t.getAttribute("viewBox"),D=B?B.split(" "):[0,0,C,F];for(g=0;g<4;++g)D[g]=+D[g];l.getAttribute("width");var H=+l.getAttribute("height");E=F>C?"scale("+H/3/D[3]+")":"scale("+H/3/D[2]+")";E="translate(0) "+
E+" translate(0)";s=d.createElementNS(c,"symbol");var G=vb();for(svgedit.browser.isGecko()&&$(t).find("linearGradient, radialGradient, pattern").appendTo(G);t.firstChild;)s.appendChild(t.firstChild);var P=t.attributes;for(t=0;t<P.length;t++){var Q=P[t];s.setAttribute(Q.nodeName,Q.nodeValue)}s.id=na();xb[h]={symbol:s,xform:E};vb().appendChild(s);v.addSubCommand(new Na(s))}var W=d.createElementNS(c,"use");W.id=na();S(W,"#"+s.id);(L||w().getCurrentLayer()).appendChild(W);v.addSubCommand(new Na(W));$a();
W.setAttribute("transform",E);cb(W);$(W).data("symbol",s).data("ref",s);Fb([W]);Ia(v);K("changed",[l])}catch(ua){console.log(ua);return false}return true};var Tb=b.identifyLayers=function(){Sb();w().identifyLayers()};this.createLayer=function(g){var h=new Oa("Create Layer");g=w().createLayer(g);h.addSubCommand(new Na(g));Ia(h);$a();K("changed",[g])};this.cloneLayer=function(g){var h=new Oa("Duplicate Layer"),k=d.createElementNS(c,"g"),v=d.createElementNS(c,"title");v.textContent=g;k.appendChild(v);
v=w().getCurrentLayer();$(v).after(k);v=v.childNodes;for(var s=0;s<v.length;s++){var E=v[s];E.localName!="title"&&k.appendChild(ma(E))}$a();Tb();h.addSubCommand(new Na(k));Ia(h);b.setCurrentLayer(g);K("changed",[k])};this.deleteCurrentLayer=function(){var g=w().getCurrentLayer(),h=g.nextSibling,k=g.parentNode;if(g=w().deleteCurrentLayer()){var v=new Oa("Delete Layer");v.addSubCommand(new Sa(g,h,k));Ia(v);$a();K("changed",[k]);return true}return false};this.setCurrentLayer=function(g){(g=w().setCurrentLayer(svgedit.utilities.toXml(g)))&&
$a();return g};this.renameCurrentLayer=function(g){var h=w();if(h.current_layer){var k=h.current_layer;if(!b.setCurrentLayer(g)){for(var v=new Oa("Rename Layer"),s=0;s<h.getNumLayers();++s)if(h.all_layers[s][1]==k)break;var E=h.getLayerName(s);h.all_layers[s][0]=svgedit.utilities.toXml(g);var z=k.childNodes.length;for(s=0;s<z;++s){var t=k.childNodes.item(s);if(t&&t.tagName=="title"){for(;t.firstChild;)t.removeChild(t.firstChild);t.textContent=g;v.addSubCommand(new Wa(t,{"#text":E}));Ia(v);K("changed",
[k]);return true}}}h.current_layer=k}return false};this.setCurrentLayerPosition=function(g){var h=w();if(h.current_layer&&g>=0&&g<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!=g){var v=null,s=h.current_layer.nextSibling;if(g>k){if(g<h.getNumLayers()-1)v=h.all_layers[g+1][1]}else v=h.all_layers[g][1];l.insertBefore(h.current_layer,v);Ia(new Ra(h.current_layer,s,l));Rb();b.setCurrentLayer(h.getLayerName(g));
[k]);return true}}}h.current_layer=k}return false};this.setCurrentLayerPosition=function(g){var h=w();if(h.current_layer&&g>=0&&g<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!=g){var v=null,s=h.current_layer.nextSibling;if(g>k){if(g<h.getNumLayers()-1)v=h.all_layers[g+1][1]}else v=h.all_layers[g][1];l.insertBefore(h.current_layer,v);Ia(new Ra(h.current_layer,s,l));Tb();b.setCurrentLayer(h.getLayerName(g));
return true}}return false};this.setLayerVisibility=function(g,h){var k=w(),v=k.getLayerVisibility(g),s=k.setLayerVisibility(g,h);if(s)Ia(new Wa(s,{display:v?"inline":"none"},"Layer Visibility"));else return false;if(s==k.getCurrentLayer()){$a();Ua.clear()}return true};this.moveSelectedToLayer=function(g){for(var h=null,k=w(),v=0;v<k.getNumLayers();++v)if(k.getLayerName(v)==g){h=k.all_layers[v][1];break}if(!h)return false;g=new Oa("Move Elements to Layer");k=J;for(v=k.length;v--;){var s=k[v];if(s){var E=
s.nextSibling,z=s.parentNode;h.appendChild(s);g.addSubCommand(new Ra(s,E,z))}}Ia(g);return true};this.mergeLayer=function(g){var h=new Oa("Merge Layer"),k=w(),v=$(k.current_layer).prev()[0];if(v){for(h.addSubCommand(new Sa(k.current_layer,k.current_layer.nextSibling,l));k.current_layer.firstChild;){var s=k.current_layer.firstChild;if(s.localName=="title"){h.addSubCommand(new Sa(s,s.nextSibling,k.current_layer));k.current_layer.removeChild(s)}else{var E=s.nextSibling;v.appendChild(s);h.addSubCommand(new Ra(s,
E,k.current_layer))}}l.removeChild(k.current_layer);if(!g){$a();Rb();K("changed",[l]);Ia(h)}k.current_layer=v;return h}};this.mergeAllLayers=function(){var g=new Oa("Merge all Layers"),h=w();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(l).children("g").length>1;)g.addSubCommand(b.mergeLayer(true));$a();Rb();K("changed",[l]);Ia(g)};var $b=this.leaveContext=function(){var g=Ea.length;if(g){for(var h=0;h<g;h++){var k=Ea[h],v=lb(k,"orig_opac");v!==1?k.setAttribute("opacity",v):k.removeAttribute("opacity");
k.setAttribute("style","pointer-events: inherit")}Ea=[];$a(true);K("contextset",null)}L=null},lc=this.setContext=function(g){$b();if(typeof g==="string")g=la(g);L=g;$(g).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;lb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");Ea.push(this)});$a();K("contextset",L)};this.clear=function(){Ua.clear();$a();b.clearSvgContentElement();b.current_drawing_=
E,k.current_layer))}}l.removeChild(k.current_layer);if(!g){$a();Tb();K("changed",[l]);Ia(h)}k.current_layer=v;return h}};this.mergeAllLayers=function(){var g=new Oa("Merge all Layers"),h=w();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(l).children("g").length>1;)g.addSubCommand(b.mergeLayer(true));$a();Tb();K("changed",[l]);Ia(g)};var Sb=this.leaveContext=function(){var g=Ea.length;if(g){for(var h=0;h<g;h++){var k=Ea[h],v=nb(k,"orig_opac");v!==1?k.setAttribute("opacity",v):k.removeAttribute("opacity");
k.setAttribute("style","pointer-events: inherit")}Ea=[];$a(true);K("contextset",null)}L=null},mc=this.setContext=function(g){Sb();if(typeof g==="string")g=la(g);L=g;$(g).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;nb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");Ea.push(this)});$a();K("contextset",L)};this.clear=function(){Ua.clear();$a();b.clearSvgContentElement();b.current_drawing_=
new svgedit.draw.Drawing(l);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();Qa.initGroup();xa=Qa.getRubberBandBox();K("cleared")};this.linkControlPoints=Ua.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=function(){return e};this.getSelectedElems=function(){return J};var Vb=this.getResolution=function(){var g=l.getAttribute("width")/p,h=l.getAttribute("height")/p;return{w:g,h:h,zoom:p}};this.getZoom=function(){return p};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};
this.setUiStrings=function(g){$.extend(Cb,g.notification)};this.setConfig=function(g){$.extend(m,g)};this.getTitle=function(g){if(g=g||J[0]){g=$(g).data("gsvg")||$(g).data("symbol")||g;g=g.childNodes;for(var h=0;h<g.length;h++)if(g[h].nodeName=="title")return g[h].textContent;return""}};this.setGroupTitle=function(g){var h=J[0];h=$(h).data("gsvg")||h;var k=$(h).children("title"),v=new Oa("Set Label");if(g.length)if(k.length){k=k[0];v.addSubCommand(new Wa(k,{"#text":k.textContent}));k.textContent=
g}else{k=d.createElementNS(c,"title");k.textContent=g;$(h).prepend(k);v.addSubCommand(new Na(k))}else{v.addSubCommand(new Sa(k[0],k.nextSibling,h));k.remove()}Ia(v)};this.getDocumentTitle=function(){return b.getTitle(l)};this.setDocumentTitle=function(g){for(var h=l.childNodes,k=false,v="",s=new Oa("Change Image Title"),E=0;E<h.length;E++)if(h[E].nodeName=="title"){k=h[E];v=k.textContent;break}if(!k){k=d.createElementNS(c,"title");l.insertBefore(k,l.firstChild)}if(g.length)k.textContent=g;else k.parentNode.removeChild(k);
s.addSubCommand(new Wa(k,{"#text":v}));Ia(s)};this.getEditorNS=function(g){g&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(g,h){var k=Vb(),v=k.w;k=k.h;var s;if(g=="fit"){var E=getStrokedBBox();if(E){s=new Oa("Fit Canvas to Content");var z=Hb();Kb(z);var t=[],B=[];$.each(z,function(){t.push(E.x*-1);B.push(E.y*-1)});z=b.moveSelectedElements(t,B,true);s.addSubCommand(z);$a();g=Math.round(E.width);h=Math.round(E.height)}else return false}if(g!=
s.addSubCommand(new Wa(k,{"#text":v}));Ia(s)};this.getEditorNS=function(g){g&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(g,h){var k=Vb(),v=k.w;k=k.h;var s;if(g=="fit"){var E=getStrokedBBox();if(E){s=new Oa("Fit Canvas to Content");var z=Hb();Fb(z);var t=[],C=[];$.each(z,function(){t.push(E.x*-1);C.push(E.y*-1)});z=b.moveSelectedElements(t,C,true);s.addSubCommand(z);$a();g=Math.round(E.width);h=Math.round(E.height)}else return false}if(g!=
v||h!=k){z=e.suspendRedraw(1E3);s||(s=new Oa("Change Image Dimensions"));g=ra("width",g);h=ra("height",h);l.setAttribute("width",g);l.setAttribute("height",h);this.contentW=g;this.contentH=h;s.addSubCommand(new Wa(l,{width:v,height:k}));l.setAttribute("viewBox",[0,0,g/p,h/p].join(" "));s.addSubCommand(new Wa(l,{viewBox:["0 0",v,k].join(" ")}));Ia(s);e.unsuspendRedraw(z);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width",
g+1);background.setAttribute("height",h+1)}K("changed",[l])}return true};this.getOffset=function(){return $(l).attr(["x","y"])};this.setBBoxZoom=function(g,h,k){var v=0.85,s=function(E){if(!E)return false;var z=Math.min(Math.round(h/E.width*100*v)/100,Math.round(k/E.height*100*v)/100);b.setZoom(z);return{zoom:z,bbox:E}};if(typeof g=="object"){g=g;if(g.width==0||g.height==0){b.setZoom(g.zoom?g.zoom:p*g.factor);return{zoom:p,bbox:g}}return s(g)}switch(g){case "selection":if(!J[0])return;g=$.map(J,function(E){if(E)return E});
g=getStrokedBBox(g);break;case "canvas":g=Vb();v=0.95;g={width:g.w,height:g.h,x:0,y:0};break;case "content":g=getStrokedBBox();break;case "layer":g=getStrokedBBox(Hb(w().getCurrentLayer()));break;default:return}return s(g)};this.setZoom=function(g){var h=Vb();l.setAttribute("viewBox","0 0 "+h.w/g+" "+h.h/g);p=g;$.each(J,function(k,v){v&&Qa.requestSelector(v).resize()});Ua.zoomChange();sb("zoomChanged",g)};this.getMode=function(){return Ma};this.setMode=function(g){Ua.clear(true);pb.clear();$("#workarea").attr("class",
g);gb=J[0]&&J[0].nodeName=="text"?eb:M;Ma=g};this.getColor=function(g){return gb[g]};this.setColor=function(g,h,k){M[g]=h;gb[g+"_paint"]={type:"solidColor"};for(var v=[],s=J.length;s--;){var E=J[s];if(E)if(E.tagName=="g")svgedit.utilities.walkTree(E,function(z){z.nodeName!="g"&&v.push(z)});else if(g=="fill")E.tagName!="polyline"&&E.tagName!="line"&&v.push(E);else v.push(E)}if(v.length>0)if(k)Tb(g,h,v);else{rb(g,h,v);K("changed",v)}};var xb=function(){var g=l.getElementsByTagNameNS(c,"defs");if(g.length>
0)g=g[0];else{g=d.createElementNS(c,"defs");l.firstChild?l.insertBefore(g,l.firstChild.nextSibling):l.appendChild(g)}return g},jc=this.setGradient=function(g){if(!(!gb[g+"_paint"]||gb[g+"_paint"].type=="solidColor")){var h=b[g+"Grad"],k=ic(h),v=xb();if(k)h=k;else{h=v.appendChild(d.importNode(h,true));h.id=na()}b.setColor(g,"url(#"+h.id+")");if(g=="canvas")(g=document.getElementById("canvas_background"))&&g.setAttribute("fill","url(#"+h.id+")")}},ic=function(g){var h=xb();h=$(h).find("linearGradient, radialGradient");
for(var k=h.length,v=["r","cx","cy","fx","fy"];k--;){var s=h[k];if(g.tagName=="linearGradient"){if(g.getAttribute("x1")!=s.getAttribute("x1")||g.getAttribute("y1")!=s.getAttribute("y1")||g.getAttribute("x2")!=s.getAttribute("x2")||g.getAttribute("y2")!=s.getAttribute("y2"))continue}else{var E=$(g).attr(v),z=$(s).attr(v),t=false;$.each(v,function(G,P){if(E[P]!=z[P])t=true});if(t)continue}var B=g.getElementsByTagNameNS(c,"stop"),F=s.getElementsByTagNameNS(c,"stop");if(B.length==F.length){for(var C=
B.length;C--;){var D=B[C],H=F[C];if(D.getAttribute("offset")!=H.getAttribute("offset")||D.getAttribute("stop-opacity")!=H.getAttribute("stop-opacity")||D.getAttribute("stop-color")!=H.getAttribute("stop-color"))break}if(C==-1)return s}}return null};this.setPaint=function(g,h){var k=new $.jGraduate.Paint(h);this.setPaintOpacity(g,k.alpha/100,true);gb[g+"_paint"]=k;switch(k.type){case "solidColor":if(k.solidColor!="none"&&k.solidColor!="#none")this.setColor(g,"#"+k.solidColor);else{this.setColor(g,
"none");document.querySelector(g=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","transparent")}break;case "linearGradient":case "radialGradient":b[g+"Grad"]=k[k.type];jc(g)}};this.getStrokeWidth=function(){return gb.stroke_width};this.setStrokeWidth=function(g){if(g==0&&["line","path"].indexOf(Ma)>=0)b.setStrokeWidth(1);else{gb.stroke_width=g;for(var h=[],k=J.length;k--;){var v=J[k];if(v)v.tagName=="g"?svgedit.utilities.walkTree(v,function(s){s.nodeName!="g"&&h.push(s)}):h.push(v)}if(h.length>
0){rb("stroke-width",g,h);K("changed",J)}}};this.setStrokeAttr=function(g,h){M[g.replace("-","_")]=h;for(var k=[],v=J.length;v--;){var s=J[v];if(s)s.tagName=="g"?svgedit.utilities.walkTree(s,function(E){E.nodeName!="g"&&k.push(E)}):k.push(s)}if(k.length>0){rb(g,h,k);K("changed",J)}};this.getStyle=function(){return M};this.getOpacity=function(){return M.opacity};this.setOpacity=function(g){M.opacity=g;rb("opacity",g)};this.getFillOpacity=function(){return M.fill_opacity};this.getStrokeOpacity=function(){return M.stroke_opacity};
this.setPaintOpacity=function(g,h,k){M[g+"_opacity"]=h;k?Tb(g+"-opacity",h):rb(g+"-opacity",h)};this.getBlur=function(g){var h=0;if(g)if(g.getAttribute("filter"))if(g=la(g.id+"_blur"))h=g.firstChild.getAttribute("stdDeviation");return h};(function(){function g(){var s=b.undoMgr.finishUndoableChange();h.addSubCommand(s);Ia(h);k=h=null}var h=null,k=null,v=false;b.setBlurNoUndo=function(s){if(k)if(s===0){Tb("filter","");v=true}else{var E=J[0];v&&Tb("filter","url(#"+E.id+"_blur)");if(svgedit.browser.isWebkit()){E.removeAttribute("filter");
E.setAttribute("filter","url(#"+E.id+"_blur)")}Tb("stdDeviation",s,[k.firstChild]);b.setBlurOffsets(k,s)}else b.setBlur(s)};b.setBlurOffsets=function(s,E){if(E>3)oa(s,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){s.removeAttribute("x");s.removeAttribute("y");s.removeAttribute("width");s.removeAttribute("height")}};b.setBlur=function(s,E){if(h)g();else{var z=J[0],t=z.id;k=la(t+"_blur");s-=0;var B=new Oa;if(k){if(s===0)k=null}else{var F=da({element:"feGaussianBlur",
attr:{"in":"SourceGraphic",stdDeviation:s}});k=da({element:"filter",attr:{id:t+"_blur"}});k.appendChild(F);xb().appendChild(k);B.addSubCommand(new Na(k))}F={filter:z.getAttribute("filter")};if(s===0){z.removeAttribute("filter");B.addSubCommand(new Wa(z,F))}else{rb("filter","url(#"+t+"_blur)");B.addSubCommand(new Wa(z,F));b.setBlurOffsets(k,s);h=B;b.undoMgr.beginUndoableChange("stdDeviation",[k?k.firstChild:null]);if(E){b.setBlurNoUndo(s);g()}}}}})();this.getBold=function(){var g=J[0];if(g!=null&&
g.tagName=="text"&&J[1]==null)return g.getAttribute("font-weight")=="bold";return false};this.setBold=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)rb("font-weight",g?"bold":"normal");J[0].textContent||pb.setCursor()};this.getItalic=function(){var g=J[0];if(g!=null&&g.tagName=="text"&&J[1]==null)return g.getAttribute("font-style")=="italic";return false};this.setItalic=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)rb("font-style",g?"italic":"normal");J[0].textContent||
pb.setCursor()};this.getFontFamily=function(){return eb.font_family};this.setFontFamily=function(g){eb.font_family=g;rb("font-family",g);J[0]&&!J[0].textContent&&pb.setCursor()};this.setFontColor=function(g){eb.fill=g;rb("fill",g)};this.getFontSize=function(){return eb.fill};this.getFontSize=function(){return eb.font_size};this.setFontSize=function(g){eb.font_size=g;rb("font-size",g);J[0].textContent||pb.setCursor()};this.getText=function(){var g=J[0];if(g==null)return"";return g.textContent};this.setTextContent=
function(g){rb("#text",g);pb.init(g);pb.setCursor()};this.setImageURL=function(g){var h=J[0];if(h){var k=$(h).attr(["width","height"]);k=!k.width||!k.height;var v=ba(h);if(v!==g)k=true;else if(!k)return;var s=new Oa("Change Image URL");S(h,g);s.addSubCommand(new Wa(h,{"#href":v}));k?$(new Image).load(function(){var E=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});Qa.requestSelector(h).resize();s.addSubCommand(new Wa(h,E));Ia(s);K("changed",[h])}).attr("src",g):Ia(s)}};
g=getStrokedBBox(g);break;case "canvas":g=Vb();v=0.95;g={width:g.w,height:g.h,x:0,y:0};break;case "content":g=getStrokedBBox();break;case "layer":g=getStrokedBBox(Hb(w().getCurrentLayer()));break;default:return}return s(g)};this.setZoom=function(g){var h=Vb();l.setAttribute("viewBox","0 0 "+h.w/g+" "+h.h/g);p=g;$.each(J,function(k,v){v&&Qa.requestSelector(v).resize()});Ua.zoomChange();sb("zoomChanged",g)};this.getMode=function(){return Ma};this.setMode=function(g){Ua.clear(true);gb.clear();$("#workarea").attr("class",
g);ib=J[0]&&J[0].nodeName=="text"?fb:M;Ma=g};this.getColor=function(g){return ib[g]};this.setColor=function(g,h,k){M[g]=h;ib[g+"_paint"]={type:"solidColor"};for(var v=[],s=J.length;s--;){var E=J[s];if(E)if(E.tagName=="g")svgedit.utilities.walkTree(E,function(z){z.nodeName!="g"&&v.push(z)});else if(g=="fill")E.tagName!="polyline"&&E.tagName!="line"&&v.push(E);else v.push(E)}if(v.length>0)if(k)Wb(g,h,v);else{db(g,h,v);K("changed",v)}};var vb=function(){var g=l.getElementsByTagNameNS(c,"defs");if(g.length>
0)g=g[0];else{g=d.createElementNS(c,"defs");l.firstChild?l.insertBefore(g,l.firstChild.nextSibling):l.appendChild(g)}return g},kc=this.setGradient=function(g){if(!(!ib[g+"_paint"]||ib[g+"_paint"].type=="solidColor")){var h=b[g+"Grad"],k=jc(h),v=vb();if(k)h=k;else{h=v.appendChild(d.importNode(h,true));h.id=na()}b.setColor(g,"url(#"+h.id+")");if(g=="canvas")(g=document.getElementById("canvas_background"))&&g.setAttribute("fill","url(#"+h.id+")")}},jc=function(g){var h=vb();h=$(h).find("linearGradient, radialGradient");
for(var k=h.length,v=["r","cx","cy","fx","fy"];k--;){var s=h[k];if(g.tagName=="linearGradient"){if(g.getAttribute("x1")!=s.getAttribute("x1")||g.getAttribute("y1")!=s.getAttribute("y1")||g.getAttribute("x2")!=s.getAttribute("x2")||g.getAttribute("y2")!=s.getAttribute("y2"))continue}else{var E=$(g).attr(v),z=$(s).attr(v),t=false;$.each(v,function(G,P){if(E[P]!=z[P])t=true});if(t)continue}var C=g.getElementsByTagNameNS(c,"stop"),F=s.getElementsByTagNameNS(c,"stop");if(C.length==F.length){for(var B=
C.length;B--;){var D=C[B],H=F[B];if(D.getAttribute("offset")!=H.getAttribute("offset")||D.getAttribute("stop-opacity")!=H.getAttribute("stop-opacity")||D.getAttribute("stop-color")!=H.getAttribute("stop-color"))break}if(B==-1)return s}}return null};this.setPaint=function(g,h){var k=new $.jGraduate.Paint(h);this.setPaintOpacity(g,k.alpha/100,true);ib[g+"_paint"]=k;switch(k.type){case "solidColor":if(k.solidColor!="none"&&k.solidColor!="#none")this.setColor(g,"#"+k.solidColor);else{this.setColor(g,
"none");document.querySelector(g=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","transparent")}break;case "linearGradient":case "radialGradient":b[g+"Grad"]=k[k.type];kc(g)}};this.getStrokeWidth=function(){return ib.stroke_width};this.setStrokeWidth=function(g){if(g==0&&["line","path"].indexOf(Ma)>=0)b.setStrokeWidth(1);else{ib.stroke_width=g;for(var h=[],k=J.length;k--;){var v=J[k];if(v)v.tagName=="g"?svgedit.utilities.walkTree(v,function(s){s.nodeName!="g"&&h.push(s)}):h.push(v)}if(h.length>
0){db("stroke-width",g,h);K("changed",J)}}};this.setStrokeAttr=function(g,h){M[g.replace("-","_")]=h;for(var k=[],v=J.length;v--;){var s=J[v];if(s)s.tagName=="g"?svgedit.utilities.walkTree(s,function(E){E.nodeName!="g"&&k.push(E)}):k.push(s)}if(k.length>0){db(g,h,k);K("changed",J)}};this.getStyle=function(){return M};this.getOpacity=function(){return M.opacity};this.setOpacity=function(g){M.opacity=g;db("opacity",g)};this.getFillOpacity=function(){return M.fill_opacity};this.getStrokeOpacity=function(){return M.stroke_opacity};
this.setPaintOpacity=function(g,h,k){M[g+"_opacity"]=h;k?Wb(g+"-opacity",h):db(g+"-opacity",h)};this.getBlur=function(g){var h=0;if(g)if(g.getAttribute("filter"))if(g=la(g.id+"_blur"))h=g.firstChild.getAttribute("stdDeviation");return h};(function(){function g(){var s=b.undoMgr.finishUndoableChange();h.addSubCommand(s);Ia(h);k=h=null}var h=null,k=null,v=false;b.setBlurNoUndo=function(s){if(k)if(s===0){Wb("filter","");v=true}else{var E=J[0];v&&Wb("filter","url(#"+E.id+"_blur)");if(svgedit.browser.isWebkit()){E.removeAttribute("filter");
E.setAttribute("filter","url(#"+E.id+"_blur)")}Wb("stdDeviation",s,[k.firstChild]);b.setBlurOffsets(k,s)}else b.setBlur(s)};b.setBlurOffsets=function(s,E){if(E>3)oa(s,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){s.removeAttribute("x");s.removeAttribute("y");s.removeAttribute("width");s.removeAttribute("height")}};b.setBlur=function(s,E){if(h)g();else{var z=J[0],t=z.id;k=la(t+"_blur");s-=0;var C=new Oa;if(k){if(s===0)k=null}else{var F=da({element:"feGaussianBlur",
attr:{"in":"SourceGraphic",stdDeviation:s}});k=da({element:"filter",attr:{id:t+"_blur"}});k.appendChild(F);vb().appendChild(k);C.addSubCommand(new Na(k))}F={filter:z.getAttribute("filter")};if(s===0){z.removeAttribute("filter");C.addSubCommand(new Wa(z,F))}else{db("filter","url(#"+t+"_blur)");C.addSubCommand(new Wa(z,F));b.setBlurOffsets(k,s);h=C;b.undoMgr.beginUndoableChange("stdDeviation",[k?k.firstChild:null]);if(E){b.setBlurNoUndo(s);g()}}}}})();this.getBold=function(){var g=J[0];if(g!=null&&
g.tagName=="text"&&J[1]==null)return g.getAttribute("font-weight")=="bold";return false};this.setBold=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)db("font-weight",g?"bold":"normal");J[0].textContent||gb.setCursor()};this.getItalic=function(){var g=J[0];if(g!=null&&g.tagName=="text"&&J[1]==null)return g.getAttribute("font-style")=="italic";return false};this.setItalic=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)db("font-style",g?"italic":"normal");J[0].textContent||
gb.setCursor()};this.getFontFamily=function(){return fb.font_family};this.setFontFamily=function(g){fb.font_family=g;db("font-family",g);J[0]&&!J[0].textContent&&gb.setCursor()};this.setFontColor=function(g){fb.fill=g;db("fill",g)};this.getFontSize=function(){return fb.fill};this.getFontSize=function(){return fb.font_size};this.setFontSize=function(g){fb.font_size=g;db("font-size",g);J[0].textContent||gb.setCursor()};this.getText=function(){var g=J[0];if(g==null)return"";return g.textContent};this.setTextContent=
function(g){db("#text",g);gb.init(g);gb.setCursor()};this.setImageURL=function(g){var h=J[0];if(h){var k=$(h).attr(["width","height"]);k=!k.width||!k.height;var v=ba(h);if(v!==g)k=true;else if(!k)return;var s=new Oa("Change Image URL");S(h,g);s.addSubCommand(new Wa(h,{"#href":v}));k?$(new Image).load(function(){var E=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});Qa.requestSelector(h).resize();s.addSubCommand(new Wa(h,E));Ia(s);K("changed",[h])}).attr("src",g):Ia(s)}};
this.setLinkURL=function(g){var h=J[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var k=ba(h);if(k!==g){var v=new Oa("Change Link URL");S(h,g);v.addSubCommand(new Wa(h,{"#href":k}));Ia(v)}}};this.setRectRadius=function(g){var h=J[0];if(h!=null&&h.tagName=="rect"){var k=h.getAttribute("rx");if(k!=g){h.setAttribute("rx",g);h.setAttribute("ry",g);Ia(new Wa(h,{rx:k,ry:k},"Radius"));K("changed",[h])}}};this.makeHyperlink=function(g){b.groupSelectedElements("a",g)};this.removeHyperlink=
function(){b.ungroupSelectedElement()};this.setSegType=function(g){Ua.setSegType(g)};this.convertToPath=function(g,h){if(g==null)$.each(J,function(wa,ga){ga&&b.convertToPath(ga)});else{if(!h)var k=new Oa("Convert element to Path");var v=h?{}:{fill:M.fill,"fill-opacity":M.fill_opacity,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,opacity:M.opacity,visibility:"hidden"};
$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(g.getAttribute(this))v[this]=g.getAttribute(this)});var s=da({element:"path",attr:v}),E=g.getAttribute("transform");E&&s.setAttribute("transform",E);var z=g.id,t=g.parentNode;g.nextSibling?t.insertBefore(s,g):t.appendChild(s);var B="",F=function(wa){$.each(wa,function(ga,ka){var pa=ka[1];B+=ka[0];for(var za=0;za<pa.length;za+=2)B+=pa[za]+","+pa[za+1]+" "})},C=1.81;switch(g.tagName){case "ellipse":case "circle":var D=
$(g).attr(["rx","ry","cx","cy"]),H=D.cx,G=D.cy,P=D.rx;D=D.ry;if(g.tagName=="circle")P=D=$(g).attr("r");F([["M",[H-P,G]],["C",[H-P,G-D/C,H-P/C,G-D,H,G-D]],["C",[H+P/C,G-D,H+P,G-D/C,H+P,G]],["C",[H+P,G+D/C,H+P/C,G+D,H,G+D]],["C",[H-P/C,G+D,H-P,G+D/C,H-P,G]],["Z",[]]]);break;case "path":B=g.getAttribute("d");break;case "line":D=$(g).attr(["x1","y1","x2","y2"]);B="M"+D.x1+","+D.y1+"L"+D.x2+","+D.y2;break;case "polyline":case "polygon":B="M"+g.getAttribute("points");break;case "rect":D=$(g).attr(["rx",
"ry"]);P=D.rx;D=D.ry;var R=g.getBBox();H=R.x;G=R.y;var W=R.width;R=R.height;C=4-C;!P&&!D?F([["M",[H,G]],["L",[H+W,G]],["L",[H+W,G+R]],["L",[H,G+R]],["L",[H,G]],["Z",[]]]):F([["M",[H,G+D]],["C",[H,G+D/C,H+P/C,G,H+P,G]],["L",[H+W-P,G]],["C",[H+W-P/C,G,H+W,G+D/C,H+W,G+D]],["L",[H+W,G+R-D]],["C",[H+W,G+R-D/C,H+W-P/C,G+R,H+W-P,G+R]],["L",[H+P,G+R]],["C",[H+P/C,G+R,H,G+R-D/C,H,G+R-D]],["L",[H,G+D]],["Z",[]]]);break;default:s.parentNode.removeChild(s)}B&&s.setAttribute("d",B);if(h){Ua.resetOrientation(s);
k=false;try{k=s.getBBox()}catch(ta){}s.parentNode.removeChild(s);return k}else{if(E){E=V(s);ua(E)&&Ua.resetOrientation(s)}k.addSubCommand(new Sa(g,g.nextSibling,t));k.addSubCommand(new Na(s));$a();g.parentNode.removeChild(g);s.setAttribute("id",z);s.removeAttribute("visibility");Kb([s],true);Ia(k)}}};var Tb=function(g,h,k){var v=e.suspendRedraw(1E3);Ma=="pathedit"&&Ua.moveNode(g,h);k=k||J;for(var s=k.length,E=["g","polyline","path"];s--;){var z=k[s];if(z!=null){Ma==="textedit"&&g!=="#text"&&z.textContent.length&&
pb.toSelectMode(z);if((g==="x"||g==="y")&&E.indexOf(z.tagName)>=0){var t=getStrokedBBox([z]);b.moveSelectedElements((g==="x"?h-t.x:0)*p,(g==="y"?h-t.y:0)*p,true)}else{t=g==="#text"?z.textContent:z.getAttribute(g);if(t==null)t="";if(t!==String(h)){if(g=="#text"){svgedit.utilities.getBBox(z);z.textContent=h;if(/rotate/.test(z.getAttribute("transform")))z=aa(z)}else g=="#href"?S(z,h):z.setAttribute(g,h);if(svgedit.browser.isGecko()&&z.nodeName==="text"&&/rotate/.test(z.getAttribute("transform")))if((h+
"").indexOf("url")===0||["font-size","font-family","x","y"].indexOf(g)>=0&&z.textContent)z=aa(z);J.indexOf(z)>=0&&setTimeout(function(){z.parentNode&&Qa.requestSelector(z).resize()},0);t=sa(z);if(t!=0&&g!="transform")for(var B=V(z),F=B.numberOfItems;F--;)if(B.getItem(F).type==4){B.removeItem(F);var C=svgedit.utilities.getBBox(z),D=O(C.x+C.width/2,C.y+C.height/2,ha(B).matrix);C=D.x;D=D.y;var H=e.createSVGTransform();H.setRotate(t,C,D);B.insertItemBefore(H,F);break}}}}}e.unsuspendRedraw(v)},rb=this.changeSelectedAttribute=
function(g,h,k){k=k||J;b.undoMgr.beginUndoableChange(g,k);Tb(g,h,k);g=b.undoMgr.finishUndoableChange();g.isEmpty()||Ia(g)};this.deleteSelectedElements=function(){for(var g=new Oa("Delete Elements"),h=J.length,k=[],v=0;v<h;++v){var s=J[v];if(s==null)break;var E=s.parentNode,z=s;Qa.releaseSelector(z);svgedit.path.removePath_(z.id);if(E.tagName==="a"&&E.childNodes.length===1){z=E;E=E.parentNode}var t=z.nextSibling;z=E.removeChild(z);k.push(s);J[v]=null;g.addSubCommand(new Sa(z,t,E))}g.isEmpty()||Ia(g);
function(){b.ungroupSelectedElement()};this.setSegType=function(g){Ua.setSegType(g)};this.convertToPath=function(g,h){if(g==null)$.each(J,function(wa,fa){fa&&b.convertToPath(fa)});else{if(!h)var k=new Oa("Convert element to Path");var v=h?{}:{fill:M.fill,"fill-opacity":M.fill_opacity,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin,"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,opacity:M.opacity,visibility:"hidden"};
$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(g.getAttribute(this))v[this]=g.getAttribute(this)});var s=da({element:"path",attr:v}),E=g.getAttribute("transform");E&&s.setAttribute("transform",E);var z=g.id,t=g.parentNode;g.nextSibling?t.insertBefore(s,g):t.appendChild(s);var C="",F=function(wa){$.each(wa,function(fa,ka){var qa=ka[1];C+=ka[0];for(var za=0;za<qa.length;za+=2)C+=qa[za]+","+qa[za+1]+" "})},B=1.81;switch(g.tagName){case "ellipse":case "circle":var D=
$(g).attr(["rx","ry","cx","cy"]),H=D.cx,G=D.cy,P=D.rx;D=D.ry;if(g.tagName=="circle")P=D=$(g).attr("r");F([["M",[H-P,G]],["C",[H-P,G-D/B,H-P/B,G-D,H,G-D]],["C",[H+P/B,G-D,H+P,G-D/B,H+P,G]],["C",[H+P,G+D/B,H+P/B,G+D,H,G+D]],["C",[H-P/B,G+D,H-P,G+D/B,H-P,G]],["Z",[]]]);break;case "path":C=g.getAttribute("d");break;case "line":D=$(g).attr(["x1","y1","x2","y2"]);C="M"+D.x1+","+D.y1+"L"+D.x2+","+D.y2;break;case "polyline":case "polygon":C="M"+g.getAttribute("points");break;case "rect":D=$(g).attr(["rx",
"ry"]);P=D.rx;D=D.ry;var Q=g.getBBox();H=Q.x;G=Q.y;var W=Q.width;Q=Q.height;B=4-B;!P&&!D?F([["M",[H,G]],["L",[H+W,G]],["L",[H+W,G+Q]],["L",[H,G+Q]],["L",[H,G]],["Z",[]]]):F([["M",[H,G+D]],["C",[H,G+D/B,H+P/B,G,H+P,G]],["L",[H+W-P,G]],["C",[H+W-P/B,G,H+W,G+D/B,H+W,G+D]],["L",[H+W,G+Q-D]],["C",[H+W,G+Q-D/B,H+W-P/B,G+Q,H+W-P,G+Q]],["L",[H+P,G+Q]],["C",[H+P/B,G+Q,H,G+Q-D/B,H,G+Q-D]],["L",[H,G+D]],["Z",[]]]);break;default:s.parentNode.removeChild(s)}C&&s.setAttribute("d",C);if(h){Ua.resetOrientation(s);
k=false;try{k=s.getBBox()}catch(ua){}s.parentNode.removeChild(s);return k}else{if(E){E=V(s);ta(E)&&Ua.resetOrientation(s)}k.addSubCommand(new Sa(g,g.nextSibling,t));k.addSubCommand(new Na(s));$a();g.parentNode.removeChild(g);s.setAttribute("id",z);s.removeAttribute("visibility");Fb([s],true);Ia(k)}}};var Wb=function(g,h,k){var v=e.suspendRedraw(1E3);Ma=="pathedit"&&Ua.moveNode(g,h);k=k||J;for(var s=k.length,E=["g","polyline","path"];s--;){var z=k[s];if(z!=null){Ma==="textedit"&&g!=="#text"&&z.textContent.length&&
gb.toSelectMode(z);if((g==="x"||g==="y")&&E.indexOf(z.tagName)>=0){var t=getStrokedBBox([z]);b.moveSelectedElements((g==="x"?h-t.x:0)*p,(g==="y"?h-t.y:0)*p,true)}else{t=g==="#text"?z.textContent:z.getAttribute(g);if(t==null)t="";if(t!==String(h)){if(g=="#text"){svgedit.utilities.getBBox(z);z.textContent=h;if(/rotate/.test(z.getAttribute("transform")))z=aa(z)}else g=="#href"?S(z,h):z.setAttribute(g,h);if(svgedit.browser.isGecko()&&z.nodeName==="text"&&/rotate/.test(z.getAttribute("transform")))if((h+
"").indexOf("url")===0||["font-size","font-family","x","y"].indexOf(g)>=0&&z.textContent)z=aa(z);J.indexOf(z)>=0&&setTimeout(function(){z.parentNode&&Qa.requestSelector(z).resize()},0);t=sa(z);if(t!=0&&g!="transform")for(var C=V(z),F=C.numberOfItems;F--;)if(C.getItem(F).type==4){C.removeItem(F);var B=svgedit.utilities.getBBox(z),D=O(B.x+B.width/2,B.y+B.height/2,ha(C).matrix);B=D.x;D=D.y;var H=e.createSVGTransform();H.setRotate(t,B,D);C.insertItemBefore(H,F);break}}}}}e.unsuspendRedraw(v)},db=this.changeSelectedAttribute=
function(g,h,k){k=k||J;b.undoMgr.beginUndoableChange(g,k);Wb(g,h,k);g=b.undoMgr.finishUndoableChange();g.isEmpty()||Ia(g)};this.deleteSelectedElements=function(){for(var g=new Oa("Delete Elements"),h=J.length,k=[],v=0;v<h;++v){var s=J[v];if(s==null)break;var E=s.parentNode,z=s;Qa.releaseSelector(z);svgedit.path.removePath_(z.id);if(E.tagName==="a"&&E.childNodes.length===1){z=E;E=E.parentNode}var t=z.nextSibling;z=E.removeChild(z);k.push(s);J[v]=null;g.addSubCommand(new Sa(z,t,E))}g.isEmpty()||Ia(g);
K("changed",k);$a()};this.cutSelectedElements=function(){for(var g=new Oa("Cut Elements"),h=J.length,k=[],v=0;v<h;++v){var s=J[v];if(s==null)break;var E=s.parentNode,z=s;Qa.releaseSelector(z);svgedit.path.removePath_(z.id);var t=z.nextSibling;z=E.removeChild(z);k.push(s);J[v]=null;g.addSubCommand(new Sa(z,t,E))}g.isEmpty()||Ia(g);K("changed",k);$a();b.clipBoard=k};this.copySelectedElements=function(){b.clipBoard=$.merge([],J)};this.pasteElements=function(){var g=b.clipBoard,h=g.length;if(h){for(var k=
[],v=new Oa("Paste elements");h--;){var s=g[h];if(s){var E=ma(s);if(!la(s.id))E.id=s.id;k.push(E);(L||w().getCurrentLayer()).appendChild(E);v.addSubCommand(new Na(E))}}svgCanvas.clearSelection();setTimeout(function(){Qb(k)},100);Ia(v);K("changed",k)}};this.groupSelectedElements=function(g){g||(g="g");var h="";switch(g){case "a":h="Make hyperlink";var k="";if(arguments.length>1)k=arguments[1];break;default:g="g";h="Group Elements"}h=new Oa(h);var v=da({element:g,attr:{id:na()}});g==="a"&&S(v,k);h.addSubCommand(new Na(v));
for(k=J.length;k--;){var s=J[k];if(s!=null){if(s.parentNode.tagName==="a"&&s.parentNode.childNodes.length===1)s=s.parentNode;var E=s.nextSibling,z=s.parentNode;v.appendChild(s);h.addSubCommand(new Ra(s,E,z))}}h.isEmpty()||Ia(h);Qb([v],true)};var Xb=this.pushGroupProperties=function(g,h){var k=g.childNodes,v=k.length,s=g.getAttribute("transform"),E=V(g),z=ha(E).matrix,t=new Oa("Push group properties"),B=0,F=sa(g),C=$(g).attr(["filter","opacity"]),D,H;for(B=0;B<v;B++){var G=k[B];if(G.nodeType===1){if(C.opacity!==
null&&C.opacity!==1){G.getAttribute("opacity");var P=Math.round((G.getAttribute("opacity")||1)*C.opacity*100)/100;rb("opacity",P,[G])}if(C.filter){var R=P=this.getBlur(G);H||(H=this.getBlur(g));if(P)P=H-0+(P-0);else if(P===0)P=H;if(R)D=N(G.getAttribute("filter"));else if(D){D=ma(D);xb().appendChild(D)}else D=N(C.filter);D.id=G.id+"_"+(D.firstChild.tagName==="feGaussianBlur"?"blur":"filter");rb("filter","url(#"+D.id+")",[G]);if(P){rb("stdDeviation",P,[D.firstChild]);b.setBlurOffsets(D,P)}}P=V(G);if(~G.tagName.indexOf("Gradient"))P=
null;if(P)if(G.tagName!=="defs")if(E.numberOfItems){if(F&&E.numberOfItems==1){var W=E.getItem(0).matrix,ta=e.createSVGMatrix();if(R=sa(G))ta=P.getItem(0).matrix;var wa=svgedit.utilities.getBBox(G),ga=ha(P).matrix,ka=O(wa.x+wa.width/2,wa.y+wa.height/2,ga);wa=F+R;ga=e.createSVGTransform();ga.setRotate(wa,ka.x,ka.y);W=fa(W,ta,ga.matrix.inverse());R&&P.removeItem(0);if(wa)P.numberOfItems?P.insertItemBefore(ga,0):P.appendItem(ga);if(W.e||W.f){R=e.createSVGTransform();R.setTranslate(W.e,W.f);P.numberOfItems?
P.insertItemBefore(R,0):P.appendItem(R)}}else{R=G.getAttribute("transform");W={};W.transform=R?R:"";R=e.createSVGTransform();W=ha(P).matrix;ta=W.inverse();W=fa(ta,z,W);R.setMatrix(W);P.appendItem(R)}(G=cb(G))&&t.addSubCommand(G)}}}if(s){W={};W.transform=s;g.setAttribute("transform","");g.removeAttribute("transform");t.addSubCommand(new Wa(g,W))}if(h&&!t.isEmpty())return t};this.ungroupSelectedElement=function(){var g=J[0];if($(g).data("gsvg")||$(g).data("symbol"))fc(g);else if(g.tagName==="use"){var h=
la(ba(g).substr(1));$(g).data("symbol",h).data("ref",h);fc(g)}else{h=$(g).parents("a");if(h.length)g=h[0];if(g.tagName==="g"||g.tagName==="a"){h=new Oa("Ungroup Elements");var k=Xb(g,true);k&&h.addSubCommand(k);k=g.parentNode;for(var v=g.nextSibling,s=Array(g.childNodes.length),E=0;g.firstChild;){var z=g.firstChild,t=z.nextSibling,B=z.parentNode;if(z.tagName==="title"){h.addSubCommand(new Sa(z,z.nextSibling,B));B.removeChild(z)}else{s[E++]=z=k.insertBefore(z,v);h.addSubCommand(new Ra(z,t,B))}}$a();
v=g.nextSibling;g=k.removeChild(g);h.addSubCommand(new Sa(g,v,k));h.isEmpty()||Ia(h);Kb(s)}}};this.moveToTopSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling;g=g.parentNode.appendChild(g);if(k!=g.nextSibling){Ia(new Ra(g,k,h,"top"));K("changed",[g])}}};this.moveToBottomSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling,v=g.parentNode.firstChild;if(v.tagName=="title")v=v.nextSibling;if(v.tagName=="defs")v=v.nextSibling;g=
g.parentNode.insertBefore(g,v);if(k!=g.nextSibling){Ia(new Ra(g,k,h,"bottom"));K("changed",[g])}}};this.moveUpDownSelected=function(g){var h=J[0];if(h){wb=[];var k,v,s=$(Gb(getStrokedBBox([h]))).toArray();g=="Down"&&s.reverse();$.each(s,function(){if(v){k=this;return false}else if(this==h)v=true});if(k){s=h.parentNode;var E=h.nextSibling;$(k)[g=="Down"?"before":"after"](h);if(E!=h.nextSibling){Ia(new Ra(h,E,s,"Move "+g));K("changed",[h])}}}};this.moveSelectedElements=function(g,h,k){if(g.constructor!=
[],v=new Oa("Paste elements");h--;){var s=g[h];if(s){var E=ma(s);if(!la(s.id))E.id=s.id;k.push(E);(L||w().getCurrentLayer()).appendChild(E);v.addSubCommand(new Na(E))}}svgCanvas.clearSelection();setTimeout(function(){Pb(k)},100);Ia(v);K("changed",k)}};this.groupSelectedElements=function(g){g||(g="g");var h="";switch(g){case "a":h="Make hyperlink";var k="";if(arguments.length>1)k=arguments[1];break;default:g="g";h="Group Elements"}h=new Oa(h);var v=da({element:g,attr:{id:na()}});g==="a"&&S(v,k);h.addSubCommand(new Na(v));
for(k=J.length;k--;){var s=J[k];if(s!=null){if(s.parentNode.tagName==="a"&&s.parentNode.childNodes.length===1)s=s.parentNode;var E=s.nextSibling,z=s.parentNode;v.appendChild(s);h.addSubCommand(new Ra(s,E,z))}}h.isEmpty()||Ia(h);Pb([v],true)};var dc=this.pushGroupProperties=function(g,h){var k=g.childNodes,v=k.length,s=g.getAttribute("transform"),E=V(g),z=ha(E).matrix,t=new Oa("Push group properties"),C=0,F=sa(g),B=$(g).attr(["filter","opacity"]),D,H;for(C=0;C<v;C++){var G=k[C];if(G.nodeType===1){if(B.opacity!==
null&&B.opacity!==1){G.getAttribute("opacity");var P=Math.round((G.getAttribute("opacity")||1)*B.opacity*100)/100;db("opacity",P,[G])}if(B.filter){var Q=P=this.getBlur(G);H||(H=this.getBlur(g));if(P)P=H-0+(P-0);else if(P===0)P=H;if(Q)D=N(G.getAttribute("filter"));else if(D){D=ma(D);vb().appendChild(D)}else D=N(B.filter);D.id=G.id+"_"+(D.firstChild.tagName==="feGaussianBlur"?"blur":"filter");db("filter","url(#"+D.id+")",[G]);if(P){db("stdDeviation",P,[D.firstChild]);b.setBlurOffsets(D,P)}}P=V(G);if(~G.tagName.indexOf("Gradient"))P=
null;if(P)if(G.tagName!=="defs")if(E.numberOfItems){if(F&&E.numberOfItems==1){var W=E.getItem(0).matrix,ua=e.createSVGMatrix();if(Q=sa(G))ua=P.getItem(0).matrix;var wa=svgedit.utilities.getBBox(G),fa=ha(P).matrix,ka=O(wa.x+wa.width/2,wa.y+wa.height/2,fa);wa=F+Q;fa=e.createSVGTransform();fa.setRotate(wa,ka.x,ka.y);W=ga(W,ua,fa.matrix.inverse());Q&&P.removeItem(0);if(wa)P.numberOfItems?P.insertItemBefore(fa,0):P.appendItem(fa);if(W.e||W.f){Q=e.createSVGTransform();Q.setTranslate(W.e,W.f);P.numberOfItems?
P.insertItemBefore(Q,0):P.appendItem(Q)}}else{Q=G.getAttribute("transform");W={};W.transform=Q?Q:"";Q=e.createSVGTransform();W=ha(P).matrix;ua=W.inverse();W=ga(ua,z,W);Q.setMatrix(W);P.appendItem(Q)}(G=cb(G))&&t.addSubCommand(G)}}}if(s){W={};W.transform=s;g.setAttribute("transform","");g.removeAttribute("transform");t.addSubCommand(new Wa(g,W))}if(h&&!t.isEmpty())return t};this.ungroupSelectedElement=function(){var g=J[0];if($(g).data("gsvg")||$(g).data("symbol"))gc(g);else if(g.tagName==="use"){var h=
la(ba(g).substr(1));$(g).data("symbol",h).data("ref",h);gc(g)}else{h=$(g).parents("a");if(h.length)g=h[0];if(g.tagName==="g"||g.tagName==="a"){h=new Oa("Ungroup Elements");var k=dc(g,true);k&&h.addSubCommand(k);k=g.parentNode;for(var v=g.nextSibling,s=Array(g.childNodes.length),E=0;g.firstChild;){var z=g.firstChild,t=z.nextSibling,C=z.parentNode;if(z.tagName==="title"){h.addSubCommand(new Sa(z,z.nextSibling,C));C.removeChild(z)}else{s[E++]=z=k.insertBefore(z,v);h.addSubCommand(new Ra(z,t,C))}}$a();
v=g.nextSibling;g=k.removeChild(g);h.addSubCommand(new Sa(g,v,k));h.isEmpty()||Ia(h);Fb(s)}}};this.moveToTopSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling;g=g.parentNode.appendChild(g);if(k!=g.nextSibling){Ia(new Ra(g,k,h,"top"));K("changed",[g])}}};this.moveToBottomSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling,v=g.parentNode.firstChild;if(v.tagName=="title")v=v.nextSibling;if(v.tagName=="defs")v=v.nextSibling;g=
g.parentNode.insertBefore(g,v);if(k!=g.nextSibling){Ia(new Ra(g,k,h,"bottom"));K("changed",[g])}}};this.moveUpDownSelected=function(g){var h=J[0];if(h){ub=[];var k,v,s=$(Gb(getStrokedBBox([h]))).toArray();g=="Down"&&s.reverse();$.each(s,function(){if(v){k=this;return false}else if(this==h)v=true});if(k){s=h.parentNode;var E=h.nextSibling;$(k)[g=="Down"?"before":"after"](h);if(E!=h.nextSibling){Ia(new Ra(h,E,s,"Move "+g));K("changed",[h])}}}};this.moveSelectedElements=function(g,h,k){if(g.constructor!=
Array){g/=p;h/=p}k=k||true;for(var v=new Oa("position"),s=J.length;s--;){var E=J[s];if(E!=null){var z=e.createSVGTransform(),t=V(E);g.constructor==Array?z.setTranslate(g[s],h[s]):z.setTranslate(g,h);t.numberOfItems?t.insertItemBefore(z,0):t.appendItem(z);(z=cb(E))&&v.addSubCommand(z);Qa.requestSelector(E).resize()}}if(!v.isEmpty()){k&&Ia(v);K("changed",J);return v}};this.cloneSelectedElements=function(g,h){for(var k=new Oa("Clone Elements"),v=J.length,s=0;s<v;++s){var E=J[s];if(E==null)break}v=J.slice(0,
s);this.clearSelection(true);for(s=v.length;s--;){E=v[s]=ma(v[s]);(L||w().getCurrentLayer()).appendChild(E);k.addSubCommand(new Na(E))}if(!k.isEmpty()){Kb(v.reverse());this.moveSelectedElements(g,h,false);Ia(k)}};this.alignSelectedElements=function(g,h){var k=[],v=Number.MAX_VALUE,s=Number.MIN_VALUE,E=Number.MAX_VALUE,z=Number.MIN_VALUE,t=Number.MIN_VALUE,B=Number.MIN_VALUE,F=J.length;if(F){for(var C=0;C<F;++C){if(J[C]==null)break;k[C]=getStrokedBBox([J[C]]);switch(h){case "smallest":if((g=="l"||
g=="c"||g=="r")&&(t==Number.MIN_VALUE||t>k[C].width)||(g=="t"||g=="m"||g=="b")&&(B==Number.MIN_VALUE||B>k[C].height)){v=k[C].x;E=k[C].y;s=k[C].x+k[C].width;z=k[C].y+k[C].height;t=k[C].width;B=k[C].height}break;case "largest":if((g=="l"||g=="c"||g=="r")&&(t==Number.MIN_VALUE||t<k[C].width)||(g=="t"||g=="m"||g=="b")&&(B==Number.MIN_VALUE||B<k[C].height)){v=k[C].x;E=k[C].y;s=k[C].x+k[C].width;z=k[C].y+k[C].height;t=k[C].width;B=k[C].height}break;default:if(k[C].x<v)v=k[C].x;if(k[C].y<E)E=k[C].y;if(k[C].x+
k[C].width>s)s=k[C].x+k[C].width;if(k[C].y+k[C].height>z)z=k[C].y+k[C].height}}if(h=="page"){E=v=0;s=b.contentW;z=b.contentH}t=Array(F);B=Array(F);for(C=0;C<F;++C){if(J[C]==null)break;var D=k[C];t[C]=0;B[C]=0;switch(g){case "l":t[C]=v-D.x;break;case "c":t[C]=(v+s)/2-(D.x+D.width/2);break;case "r":t[C]=s-(D.x+D.width);break;case "t":B[C]=E-D.y;break;case "m":B[C]=(E+z)/2-(D.y+D.height/2);break;case "b":B[C]=z-(D.y+D.height)}}this.moveSelectedElements(t,B)}};this.contentW=Vb().w;this.contentH=Vb().h;
s);this.clearSelection(true);for(s=v.length;s--;){E=v[s]=ma(v[s]);(L||w().getCurrentLayer()).appendChild(E);k.addSubCommand(new Na(E))}if(!k.isEmpty()){Fb(v.reverse());this.moveSelectedElements(g,h,false);Ia(k)}};this.alignSelectedElements=function(g,h){var k=[],v=Number.MAX_VALUE,s=Number.MIN_VALUE,E=Number.MAX_VALUE,z=Number.MIN_VALUE,t=Number.MIN_VALUE,C=Number.MIN_VALUE,F=J.length;if(F){for(var B=0;B<F;++B){if(J[B]==null)break;k[B]=getStrokedBBox([J[B]]);switch(h){case "smallest":if((g=="l"||
g=="c"||g=="r")&&(t==Number.MIN_VALUE||t>k[B].width)||(g=="t"||g=="m"||g=="b")&&(C==Number.MIN_VALUE||C>k[B].height)){v=k[B].x;E=k[B].y;s=k[B].x+k[B].width;z=k[B].y+k[B].height;t=k[B].width;C=k[B].height}break;case "largest":if((g=="l"||g=="c"||g=="r")&&(t==Number.MIN_VALUE||t<k[B].width)||(g=="t"||g=="m"||g=="b")&&(C==Number.MIN_VALUE||C<k[B].height)){v=k[B].x;E=k[B].y;s=k[B].x+k[B].width;z=k[B].y+k[B].height;t=k[B].width;C=k[B].height}break;default:if(k[B].x<v)v=k[B].x;if(k[B].y<E)E=k[B].y;if(k[B].x+
k[B].width>s)s=k[B].x+k[B].width;if(k[B].y+k[B].height>z)z=k[B].y+k[B].height}}if(h=="page"){E=v=0;s=b.contentW;z=b.contentH}t=Array(F);C=Array(F);for(B=0;B<F;++B){if(J[B]==null)break;var D=k[B];t[B]=0;C[B]=0;switch(g){case "l":t[B]=v-D.x;break;case "c":t[B]=(v+s)/2-(D.x+D.width/2);break;case "r":t[B]=s-(D.x+D.width);break;case "t":C[B]=E-D.y;break;case "m":C[B]=(E+z)/2-(D.y+D.height/2);break;case "b":C[B]=z-(D.y+D.height)}}this.moveSelectedElements(t,C)}};this.contentW=Vb().w;this.contentH=Vb().h;
this.updateCanvas=function(g,h){e.setAttribute("width",g);e.setAttribute("height",h);var k=$("#canvasBackground")[0],v=l.getAttribute("x"),s=l.getAttribute("y"),E=g/2-this.contentW*p/2,z=h/2-this.contentH*p/2;oa(l,{width:this.contentW*p,height:this.contentH*p,x:E,y:z,viewBox:"0 0 "+this.contentW+" "+this.contentH});oa(k,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:E,y:z});(k=la("background_image"))&&oa(k,{width:"100%",height:"100%"});Qa.selectorParentGroup.setAttribute("transform",
"translate("+E+","+z+")");return{x:E,y:z,old_x:v,old_y:s,d_x:E-v,d_y:z-s}};this.setBackground=function(g,h){var k=la("canvasBackground"),v=$(k).find("rect")[0],s=la("background_image");v.setAttribute("fill",g);if(h){if(!s){s=d.createElementNS(c,"image");oa(s,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}S(s,h);k.appendChild(s)}else s&&s.parentNode.removeChild(s)};this.cycleElement=function(g){var h=J[0],k=false,v=Hb(L||w().getCurrentLayer());
if(v.length){if(h==null){g=g?v.length-1:0;k=v[g]}else for(var s=v.length;s--;)if(v[s]==h){g=g?s-1:s+1;if(g>=v.length)g=0;else if(g<0)g=v.length-1;k=v[g];break}Qb([k],true);K("selected",J)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:Ia,setGradient:jc,addSvgElementFromJson:da,assignAttributes:oa,BatchCommand:Oa,call:K,ChangeElementCommand:Wa,copyElem:ma,ffClone:aa,findDefs:xb,findDuplicateGradient:ic,getElem:la,getId:Y,getIntersectionList:Gb,getMouseTarget:Zb,getNextId:na,
getPathBBox:U,getUrlFromAttr:qa,hasMatrixTransform:ua,identifyLayers:Rb,InsertElementCommand:Na,isIdentity:svgedit.math.isIdentity,logMatrix:fb,matrixMultiply:fa,MoveElementCommand:Ra,preventClickDefault:Ib,recalculateAllSelectedDimensions:Pa,recalculateDimensions:cb,remapElement:nb,RemoveElementCommand:Sa,removeUnusedDefElems:hc,round:kb,runExtensions:sb,sanitizeSvg:Ka,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ha,
if(v.length){if(h==null){g=g?v.length-1:0;k=v[g]}else for(var s=v.length;s--;)if(v[s]==h){g=g?s-1:s+1;if(g>=v.length)g=0;else if(g<0)g=v.length-1;k=v[g];break}Pb([k],true);K("selected",J)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:Ia,setGradient:kc,addSvgElementFromJson:da,assignAttributes:oa,BatchCommand:Oa,call:K,ChangeElementCommand:Wa,copyElem:ma,ffClone:aa,findDefs:vb,findDuplicateGradient:jc,getElem:la,getId:Y,getIntersectionList:Gb,getMouseTarget:$b,getNextId:na,
getPathBBox:U,getUrlFromAttr:pa,hasMatrixTransform:ta,identifyLayers:Tb,InsertElementCommand:Na,isIdentity:svgedit.math.isIdentity,logMatrix:hb,matrixMultiply:ga,MoveElementCommand:Ra,preventClickDefault:Zb,recalculateAllSelectedDimensions:Pa,recalculateDimensions:cb,remapElement:pb,RemoveElementCommand:Sa,removeUnusedDefElems:ic,round:mb,runExtensions:sb,sanitizeSvg:Ka,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ha,
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(w,p){var L=f.setSvgString(w)!==false;p=p||a.noop;L?p(true):a.alert(e.notification.errorLoadingSVG,function(){p(false)})}var f,c={},m=false,o={lang:"en",iconsize:"m",bkgd_color:"FFF",bkgd_url:"",img_save:"embed"},
b={},d={canvas_expansion:1,dimensions:[640,480],initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",langPath:"locale/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:["ext-markers.js","ext-eyedropper.js","ext-shapes.js","ext-grid.js"],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:true,show_outside_canvas:false,no_save_warning:true},e=c.uiStrings=
{common:{ok:"OK",cancel:"Cancel",key_up:"Up",key_down:"Down",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...",
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" ...'}};b={};var l={};c.curConfig=d;c.tool_scale=1;a.pref=function(w,p){if(p)b[w]=p;w="svg-edit-"+w;var L=location.hostname,T=L&&L.indexOf(".")>=0,M=p!=undefined,
J=false;try{if(window.localStorage)J=localStorage}catch(da){}try{if(window.globalStorage&&T)J=globalStorage[L]}catch(V){}if(J)if(M)J.setItem(w,p);else{if(J.getItem(w))return J.getItem(w)+""}else if(window.widget)if(M)widget.setPreferenceForKey(p,w);else return widget.preferenceForKey(w);else if(M){L=new Date;L.setTime(L.getTime()+31536E6);p=encodeURIComponent(p);document.cookie=w+"="+p+"; expires="+L.toUTCString()}else return(L=document.cookie.match(RegExp(w+"=([^;]+)")))?decodeURIComponent(L[1]):
""};c.setConfig=function(w){a.each(w,function(p,L){p in o&&a.pref(p,L)});a.extend(true,d,w);if(w.extensions)d.extensions=w.extensions};c.setCustomHandlers=function(w){c.ready(function(){if(w.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();f.open=w.open}if(w.save){c.show_save_warning=false;f.bind("saved",w.save)}w.pngsave&&f.bind("exported",w.pngsave);l=w})};c.randomizeIds=function(){f.randomizeIds(arguments)};c.init=function(){function w(q,A){var I=q.id,Q=I.split("_"),X=
Q[0];Q=Q[1];A&&f.setStrokeAttr("stroke-"+X,Q);gb();ta("#cur_"+X,I,20);a(q).addClass("current").siblings().removeClass("current")}function p(q,A){a.pref("bkgd_color",q);a.pref("bkgd_url",A);f.setBackground(q,A)}function L(){var q=f.getHref(Z);q=q.indexOf("data:")===0?"":q;a.prompt(e.notification.enterNewImgURL,q,function(A){A&&Ea(A)})}function T(){if(f.deleteCurrentLayer()){Ja();Bb();a("#layerlist tr.layer").removeClass("layersel");a("#layerlist tr.layer:first").addClass("layersel")}}function M(){var q=
f.getCurrentDrawing().getCurrentLayerName()+" copy";a.prompt(e.notification.enterUniqueLayerName,q,function(A){if(A)if(f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.dupeLayerName);else{f.cloneLayer(A);Ja();Bb()}})}function J(q){var A=a("#layerlist tr.layersel").index(),I=f.getCurrentDrawing().getNumLayers();if(A>0||A<I-1){A+=q;f.setCurrentLayerPosition(I-A-1);Bb()}}function da(q,A){var I=document.getElementById("ruler_x_cursor"),Q=document.getElementById("ruler_y_cursor"),X=document.getElementById("workarea");
document.getElementById("title_show");svgedit.browser.isTouch()||a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(mc){mc.stopPropagation();I.style.left=mc.pageX-66+X.scrollLeft+"px";Q.style.top=mc.pageY-48+X.scrollTop+"px"});A||(A=f.getZoom());q||(q=a("#svgcanvas"));for(var ja=f.getContentElem(),va=svgedit.units.getTypeMap()[d.baseUnit],ya=0;ya<2;ya++){var Da=ya===0,Ca=Da?"x":"y",Ba=Da?"width":"height",vb=ja.getAttribute(Ca)-0;Ca=a("#ruler_"+Ca+" canvas:first");$hcanv=Ca.clone();
Ca.replaceWith($hcanv);var Ta=$hcanv[0];var ia=Ca=q[Ba]()*2;Ta.parentNode.style[Ba]=ia+"px";var yb=0,bb,Fa=Ta.getContext("2d");Fa.fillStyle="rgb(200,0,0)";Fa.fillRect(0,0,Ta.width,Ta.height);$hcanv.siblings().remove();if(Ca>=3E4){var Va=parseInt(Ca/3E4)+1;bb=Array(Va);bb[0]=Fa;for(var Ha=1;Ha<Va;Ha++){Ta[Ba]=3E4;var ib=Ta.cloneNode(true);Ta.parentNode.appendChild(ib);bb[Ha]=ib.getContext("2d")}ib[Ba]=Ca%3E4;Ca=3E4}Ta[Ba]=Ca;Ba=va*A;var db=50/Ba;Ta=1;for(Ha=0;Ha<gc.length;Ha++){Ta=Va=gc[Ha];if(db<=
Va)break}db=Ta*Ba;Fa.font="normal 9px 'Lucida Grande', sans-serif";Fa.fillStyle="#777";for(var jb=vb/Ba%Ta*Ba,Yb=jb-db;jb<ia;jb+=db){Yb+=db;Ha=Math.round(jb)+0.5;if(Da){Fa.moveTo(Ha,15);Fa.lineTo(Ha,0)}else{Fa.moveTo(15,Ha);Fa.lineTo(0,Ha)}Va=(Yb-vb)/Ba;if(Ta>=1)Ha=Math.round(Va);else{Ha=(Ta+"").split(".")[1].length;Ha=Va.toFixed(Ha)-0}if(Ha!==0&&Ha!==1E3&&Ha%1E3===0)Ha=Ha/1E3+"K";if(Da){Fa.fillText(Ha,jb+2,8);Fa.fillStyle="#777"}else{Va=(Ha+"").split("");for(Ha=0;Ha<Va.length;Ha++){Fa.fillText(Va[Ha],
1,jb+9+Ha*9);Fa.fillStyle="#777"}}Va=db/10;for(Ha=1;Ha<10;Ha++){var Lb=Math.round(jb+Va*Ha)+0.5;if(bb&&Lb>Ca){yb++;Fa.stroke();if(yb>=bb.length){Ha=10;jb=ia;continue}Fa=bb[yb];jb-=3E4;Lb=Math.round(jb+Va*Ha)+0.5}var Wb=Ha%2?12:10;if(Da){Fa.moveTo(Lb,15);Fa.lineTo(Lb,Wb)}else{Fa.moveTo(15,Lb);Fa.lineTo(Wb,Lb)}}}Fa.strokeStyle="#666";Fa.stroke()}}(function(){var q=window.opener;if(q)try{var A=q.document.createEvent("Event");A.initEvent("svgEditorReady",true,true);q.document.documentElement.dispatchEvent(A)}catch(I){}})();
(function(){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 A=q.source,I=a.param.querystring();if(!A)if(I.indexOf("source=data:")>=0)A=I.match(/source=(data:[^&]*)/)[1];if(A)if(A.indexOf("data:")===0){A=A.replace(/ /g,"+");c.loadFromDataURI(A)}else c.loadFromString(A);else if(I.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(I.substr(9));
else q.url&&svgEditor.loadFromURL(q.url)}})();var V=function(){a.each(d.extensions,function(){var A=this;a.getScript(d.extPath+A,function(I){if(!I){I=document.createElement("script");I.src=d.extPath+A;document.querySelector("head").appendChild(I)}})});var q=[];a("#lang_select option").each(function(){q.push(this.value)});c.putLocale(null,q)};document.location.protocol==="file:"?setTimeout(V,100):V();a.svgIcons(d.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),
fallback_path:d.imgPath,fallback:{new_image:"clear.png",save:"save.png",open:"open.png",source:"source.png",docprops:"document-properties.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.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",clone:"clone.png",
node_clone:"node_clone.png","delete":"delete.png",node_delete:"node_delete.png",move_top:"move_top.png",move_bottom:"move_bottom.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.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",go_up:"go-up.png",go_down:"go-down.png",ok:"save.png",cancel:"cancel.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},
placement:{"#tool_docprops > div":"docprops","#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","#linecap_butt,#cur_linecap":"linecap_butt","#linecap_round":"linecap_round","#linecap_square":"linecap_square","#linejoin_miter,#cur_linejoin":"linejoin_miter","#linejoin_round":"linejoin_round",
"#linejoin_bevel":"linejoin_bevel","#url_notice":"warning","#layer_up":"go_up","#layer_down":"go_down","#layer_moreopts":"context_menu","#layerlist td.layervis":"eye","#tool_source_save,#tool_docprops_save,#tool_prefs_save":"ok","#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel":"cancel","#rwidthLabel, #iwidthLabel":"width","#rheightLabel, #iheightLabel":"height","#angleLabel":"angle","#linkLabel,#tool_make_link,#tool_make_link_multi":"globe_link","#zoomLabel":"zoom","#blurLabel":"blur",
".flyout_arrow_horiz":"arrow_right","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":32,".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":24,".palette_item:first .svg_icon":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)});
var q=a("#tools_left");if(q.length!=0){q.offset();q.outerHeight()}a(".tools_flyout").each(function(){var A=a("#"+this.id+"_show"),I=A.attr("data-curopt");if(!A.children("svg, img").length){I=a(I).children().clone();if(I.length){I[0].removeAttribute("style");A.append(I)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});c.canvas=f=new a.SvgCanvas(document.getElementById("svgcanvas"),
d);c.show_save_warning=false;V=navigator.platform.indexOf("Mac")>=0;var O=navigator.userAgent.indexOf("AppleWebKit")>=0,fa=V?"meta+":"ctrl+",ua=f.pathActions,ha=f.undoMgr,ca=svgedit.utilities,ea=d.imgPath+"placeholder.svg",ra=a("#workarea"),qa=a("#cmenu_canvas");a("#cmenu_layers");var ba=null,S=1,U="toolbars",sa="",la={fill:null,stroke:null};V||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"),A=a("#dialog_buttons"),I=function(Q,X,ja,va){a("#dialog_content").html("<p>"+X.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",Q=="prompt");A.empty();var ya=a('<input type="button" value="'+e.common.ok+'">').appendTo(A);Q!="alert"&&a('<input type="button" value="'+e.common.cancel+'">').appendTo(A).click(function(){q.hide();ja(false)});if(Q=="prompt"){var Da=a('<input type="text">').prependTo(A);Da.val(va||"");Da.bind("keydown","return",function(){ya.click()})}Q==
"process"&&ya.hide();q.show();ya.click(function(){q.hide();var Ca=Q=="prompt"?Da.val():true;ja&&ja(Ca)}).focus();Q=="prompt"&&Da.focus()};a.alert=function(Q,X){I("alert",Q,X)};a.confirm=function(Q,X){I("confirm",Q,X)};a.process_cancel=function(Q,X){I("process",Q,X)};a.prompt=function(Q,X,ja){I("prompt",Q,ja,X)}})();var oa=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");
a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")}f.setMode("select")},Z=null,Aa=false,Ka=false,Ra=false,Na=false,Sa="",Wa=a("title:first").text(),Oa=function(q,A,I){f.getResolution();a("#svgcanvas").position();if(A=f.setBBoxZoom(A,ra.width()-15,ra.height()-15)){q=A.zoom;A=A.bbox;if(q<0.0010)mb({value:0.1});else{a("#zoom").val(q*100);I?Ub():Ub(false,{x:A.x*q+A.width*q/2,y:A.y*q+A.height*q/2});f.getMode()=="zoom"&&A.width&&oa();B()}}};a("#cur_context_panel").delegate("a",
"click",function(){var q=a(this);q.attr("data-root")?f.leaveContext():f.setContext(q.text());return false});var Ia={},Qa=function(q){a.each(q,function(A,I){var Q=a(A).children(),X=A+"_show",ja=a(X),va=false;Q.addClass("tool_button").unbind("click mousedown mouseup").each(function(Ca){var Ba=I[Ca];Ia[Ba.sel]=Ba.fn;if(Ba.isDefault)va=Ca;Ca=function(vb){var Ta=Ba;if(vb.type==="keydown"){var ia=a(Ta.parent+"_show").hasClass("tool_button_current"),yb=a(Ta.parent+"_show").attr("data-curopt");a.each(q[Ba.parent],
function(Fa,Va){if(Va.sel==yb)Ta=!vb.shiftKey||!ia?Va:q[Ba.parent][Fa+1]||q[Ba.parent][0]})}if(a(this).hasClass("disabled"))return false;xa(X)&&Ta.fn();var bb=Ta.icon?a.getSvgIcon(Ta.icon,true):a(Ta.sel).children().eq(0).clone();bb[0].setAttribute("width",ja.width());bb[0].setAttribute("height",ja.height());ja.children(":not(.flyout_arrow_horiz)").remove();ja.append(bb).attr("data-curopt",Ta.sel)};a(this).mouseup(Ca);Ba.key&&a(document).bind("keydown",Ba.key[0]+" shift+"+Ba.key[0],Ca)});if(va)ja.attr("data-curopt",
I[va].sel);else ja.attr("data-curopt")||ja.attr("data-curopt",I[0].sel);var ya,Da=a(X).position();a(A).css({left:Da.left+34,top:Da.top+77});ja.mousedown(function(Ca){a("#tools_shapelib").is(":visible")&&xa(X,false);if(ja.hasClass("disabled"))return false;var Ba=a(A),vb=Da.left+34,Ta=Ba.width()*-1,ia=Ba.data("shown_popop")?200:0;ya=setTimeout(function(){ja.data("isLibrary")?Ba.css("left",vb).show():Ba.css("left",Ta).show().animate({left:vb},150);Ba.data("shown_popop",true)},ia);Ca.preventDefault()}).mouseup(function(){clearTimeout(ya);
var Ca=a(this).attr("data-curopt");if(ja.data("isLibrary")&&a(X.replace("_show","")).is(":visible"))xa(X,true);else xa(X)&&Ca in Ia&&Ia[Ca]()})});Mb()},Ga=function(q,A){return a("<div>",{"class":"tools_flyout",id:q}).appendTo("#svg_editor").append(A)},Cb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show"),A=q.offset();q=q.outerWidth();a(this).css({left:(A.left+q)*S,top:A.top})})},Mb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show");if(!q.data("isLibrary")){var A=
[];a(this).children().each(function(){A.push(this.title)});q[0].title=A.join(" / ")}})},lb,ab=function(q,A,I){var Q=null;if(q.indexOf("url(#")===0){q=(q=f.getRefElem(q))?q.cloneNode(true):a("#"+I+"_color defs *")[0];Q={alpha:A};Q[q.tagName]=q}else Q=q.indexOf("#")===0?{alpha:A,solidColor:q.substr(1)}:{alpha:A,solidColor:"none"};return new a.jGraduate.Paint(Q)},Ya=f.getResolution();if(d.baseUnit!=="px"){Ya.w=svgedit.units.convertUnit(Ya.w)+d.baseUnit;Ya.h=svgedit.units.convertUnit(Ya.h)+d.baseUnit}a(".canvas_width").val(Ya.w);
a(".canvas_height").val(Ya.h);a("#docprops_button").on("click",function(){C()});var La=function(q){f.createLayer("background");cur_shape=f.addSvgElementFromJson({element:"rect",attr:{x:0,y:0,width:Ya.w,height:Ya.h,stroke:"none",id:"canvas_background",opacity:1,fill:q||a.pref("bkgd_color"),style:"pointer-events:none"}});f.setCurrentLayer("Layer 1");f.setCurrentLayerPosition("1")};document.getElementById("canvas_background")?document.getElementById("canvas_background").getAttribute("fill"):La();if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),
a.pref("bkgd_url"));else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));var Ea=c.setImageURL=function(q){q||(q=ea);f.setImageURL(q);a("#image_url").val(q);if(q.indexOf("data:")===0){a("#image_url").hide();a("#change_image_url").show()}else{f.embedImage(q,function(A){A?a("#url_notice").hide():a("#url_notice").show();ea=q});a("#image_url").show();a("#change_image_url").hide()}},ob=function(q){var A=Math.min(Math.max(12+q.value.length*6,50),300);a(q).width(A)},Ja=function(){var q=Z;if(q!=null&&
!q.parentNode)q=null;var A=f.getCurrentDrawing().getCurrentLayerName(),I=f.getMode(),Q=d.baseUnit!=="px"?d.baseUnit:null,X=I=="pathedit",ja=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 va=q.nodeName,ya=f.getRotationAngle(q);a("#angle").val(Math.round(ya));ya=f.getBlur(q);a("#blur").val(ya);a("#blur_slider").slider("option","value",ya);f.addedNew&&va==="image"&&f.getHref(q).indexOf("data:")!==0&&L();if(!X&&I!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");if(["line","circle","ellipse"].indexOf(va)>=0)a("#xy_panel").hide();else{var Da,Ca;if(["g","polyline","path"].indexOf(va)>=0){if(I=f.getStrokedBBox([q])){Da=I.x;Ca=I.y}}else{Da=
q.getAttribute("x");Ca=q.getAttribute("y")}if(Q){Da=svgedit.units.convertUnit(Da);Ca=svgedit.units.convertUnit(Ca)}a("#selected_x").val(Math.round(Ca)||0);a("#selected_y").val(Math.round(Da)||0);a("#xy_panel").show()}["image","text","path","g","use"].indexOf(va)==-1&&a(".action_path_convert_selected").removeClass("disabled");va==="path"&&a(".action_path_selected").removeClass("disabled")}else{A=ua.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",
!ua.canDeleteNodes);ta("#tool_openclose_path",ua.closed_subpath?"open_path":"close_path");if(A){X=a("#seg_type");if(Q){A.x=svgedit.units.convertUnit(A.x);A.y=svgedit.units.convertUnit(A.y)}a("#path_node_x").val(Math.round(A.x));a("#path_node_y").val(Math.round(A.y));A.type?X.val(A.type).removeAttr("disabled"):X.val(4).attr("disabled","disabled")}return}Q={g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],
text:[],use:[]};var Ba=q.tagName;a(q).data("gsvg")&&a("#g_panel").show();Ba=="path"&&a("#path_panel").show();if(Q[Ba]){Q=Q[Ba];a("#"+Ba+"_panel").show();a.each(Q,function(vb,Ta){var ia=q.getAttribute(Ta);if(d.baseUnit!=="px"&&q[Ta])ia=svgedit.units.convertUnit(q[Ta].baseVal.value);a("#"+Ba+"_"+Ta).val(Math.round(ia)||0)});if(Ba=="text"){a("#text_panel").css("display","inline");f.getItalic()?a("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):a("#tool_italic").removeClass("push_button_pressed").addClass("tool_button");
f.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);f.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(Ba=="image")Ea(f.getHref(q));else if(Ba==="g"||Ba==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");
Q=f.getTitle();va=a("#g_title")[0];va.value=Q;ob(va);Ba=="use"?va.setAttribute("disabled","disabled"):va.removeAttribute("disabled")}}ja[(Ba==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");ja[(Ba==="g"||!Aa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(Aa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");ja.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else ja.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
ha.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");ha.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");f.addedNew=false;if(q&&!X||Aa){a("#selLayerNames").removeAttr("disabled").val(A);qa.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}else a("#selLayerNames").attr("disabled","disabled")};a("#text").focus(function(){});a("#text").blur(function(){});f.bind("selected",
function(q,A){var I=f.getMode();I==="select"&&oa();I=I=="pathedit";Z=A.length==1||A[1]==null?A[0]:null;Aa=A.length>=2&&A[1]!=null;if(Z!=null)if(!I){if(Z!=null)switch(Z.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var Q=null,X=Z.getElementsByTagName("*"),ja=0,va=X.length;ja<va;ja++){var ya=X[ja].getAttribute("stroke-width");if(ja===0)Q=ya;else if(Q!==ya)Q=null}a("#stroke_width").val(Q===null?"":Q);la.fill.update(true);la.stroke.update(true);break;default:la.fill.update(true);
la.stroke.update(true);a("#stroke_width").val(Z.getAttribute("stroke-width")||1);a("#stroke_style").val(Z.getAttribute("stroke-dasharray")||"none");Q=Z.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+Q).length!=0&&w(a("#linejoin_"+Q)[0]);Q=Z.getAttribute("stroke-linecap")||"butt";a("#linecap_"+Q).length!=0&&w(a("#linecap_"+Q)[0])}if(Z!=null){Q=(Z.getAttribute("opacity")||1)*100;a("#group_opacity").val(Q);a("#opac_slider").slider("option","value",Q);a("#elem_id").val(Z.id)}}a("#path_node_panel").toggle(I);
a("#tools_bottom_2,#tools_bottom_3").toggle(!I);if(I){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");ta("#tool_select","select_node");Aa=false;if(A.length)Z=A[0]}else{if(A[0]){I=f.selectorManager.requestSelector(A[0]);I.reset(A[0]);I.selectorRect.setAttribute("display","inline")}ta("#tool_select","select")}Ja();f.runExtensions("selectedChanged",{elems:A,selectedElement:Z,multiselected:Aa})});
f.bind("transition",function(q,A){var I=f.getMode(),Q=A[0];if(Q){Aa=A.length>=2&&A[1]!=null;if(!Aa)switch(I){case "rotate":I=f.getRotationAngle(Q);a("#angle").val(Math.round(I));a("#tool_reorient").toggleClass("disabled",I==0)}f.runExtensions("elementTransition",{elems:A})}});f.bind("changed",function(q,A){var I=f.getMode();I==="select"&&oa();for(var Q=0;Q<A.length;++Q){var X=A[Q];if(X&&X.tagName==="svg"){Bb();Ub()}else if(X&&Z&&Z.parentNode==null)Z=X}c.show_save_warning=true;Ja();if(Z&&I==="select"){la.fill.update();
la.stroke.update()}f.runExtensions("elementChanged",{elems:A})});f.bind("saved",function(q,A){c.show_save_warning=false;A='<?xml version="1.0"?>\n'+A;var I=navigator.userAgent;if(~I.indexOf("Chrome")&&a.browser.version>=533||~I.indexOf("MSIE"))F(0,true);else{var Q=q.open("data:image/svg+xml;base64,"+ca.encode64(A)),X=a.pref("save_notice_done");if(X!=="all"){var ja=e.notification.saveFromBrowser.replace("%s","SVG");if(I.indexOf("Gecko/")!==-1)if(A.indexOf("<defs")!==-1){ja+="\n\n"+e.notification.defsFailOnSave;
a.pref("save_notice_done","all");X="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");X!=="part"&&Q.alert(ja)}}});f.bind("exported",function(q,A){var I=A.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var Q=a("#export_canvas")[0];Q.width=f.contentW;Q.height=f.contentH;canvg(Q,A.svg,{renderCallback:function(){var X=Q.toDataURL("image/png");ba.location.href=X;if(a.pref("export_notice_done")!=="all"){X=e.notification.saveFromBrowser.replace("%s",
"PNG");if(I.length)X+="\n\n"+e.notification.noteTheseIssues+"\n \u2022 "+I.join("\n \u2022 ");a.pref("export_notice_done","all");ba.alert(X)}}})});f.bind("zoomed",Oa);f.bind("contextset",function(q,A){var I="";if(A){var Q="";I='<a href="#" data-root="y">'+f.getCurrentDrawing().getCurrentLayerName()+"</a>";a(A).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){Q+=" > "+this.id;I+=this!==A?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Sa=Q}else Sa=null;a("#cur_context_panel").toggle(!!A).html(I);
P()});f.bind("extension_added",function(q,A){function I(){if(lb){clearTimeout(lb);lb=null}X||(lb=setTimeout(function(){X=true;ka(b.iconsize)},50))}var Q=false,X=false,ja=true,va=function(){if(A.callback&&!Q&&ja){Q=true;A.callback()}},ya=[];A.context_tools&&a.each(A.context_tools,function(Ta,ia){var yb=ia.container_id?' id="'+ia.container_id+'"':"",bb=a("#"+ia.panel);bb.length||(bb=a("<div>",{id:ia.panel}).appendTo("#tools_top"));switch(ia.type){case "tool_button":var Fa='<div class="tool_button">'+
ia.id+"</div>",Va=a(Fa).appendTo(bb);ia.events&&a.each(ia.events,function(db,jb){a(Va).bind(db,jb)});break;case "select":Fa="<label"+yb+'><select id="'+ia.id+'">';a.each(ia.options,function(db,jb){Fa+='<option value="'+db+'"'+(db==ia.defval?" selected":"")+">"+jb+"</option>"});Fa+="</select></label>";var Ha=a(Fa).appendTo(bb).find("select");a.each(ia.events,function(db,jb){a(Ha).bind(db,jb)});break;case "button-select":Fa='<div id="'+ia.id+'" class="dropdown toolset" title="'+ia.title+'"><div id="cur_'+
ia.id+'" class="icon_label"></div><button></button></div>';yb=a('<ul id="'+ia.id+'_opts"></ul>').appendTo("#option_lists");ia.colnum&&yb.addClass("optcols"+ia.colnum);a(Fa).appendTo(bb).children();ya.push({elem:"#"+ia.id,list:"#"+ia.id+"_opts",title:ia.title,callback:ia.events.change,cur:"#cur_"+ia.id});break;case "input":Fa="<label"+yb+'><span id="'+ia.id+'_label">'+ia.label+':</span><input id="'+ia.id+'" title="'+ia.title+'" size="'+(ia.size||"4")+'" value="'+(ia.defval||"")+'" type="text"/></label>';
var ib=a(Fa).appendTo(bb).find("input");ia.spindata&&ib.SpinButton(ia.spindata);ia.events&&a.each(ia.events,function(db,jb){ib.bind(db,jb)})}});if(A.buttons){var Da={},Ca={},Ba=A.svgicons,vb={};a.each(A.buttons,function(Ta,ia){for(var yb,bb=ia.id,Fa=Ta;a("#"+bb).length;)bb=ia.id+"_"+ ++Fa;if(Ba){Da[bb]=ia.icon;Fa=ia.svgicon?ia.svgicon:ia.id;if(ia.type=="app_menu")Ca["#"+bb+" > div"]=Fa;else Ca["#"+bb]=Fa}else yb=ia.type=="menu"?"":a('<img src="'+ia.icon+'">');var Va,Ha;switch(ia.type){case "mode_flyout":case "mode":Va=
"tool_button";if(ia.cls)Va+=" "+ia.cls;Ha="#tools_left";break;case "context":Va="tool_button";Ha="#"+ia.panel;a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top");break;case "menu":Va="menu_item tool_button";Ha="#"+(ia.after||ia.panel);break;case "app_menu":Va="";Ha=ia.parent||"#main_menu ul";a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top")}var ib=a(ia.list||ia.type=="app_menu"?"<li/>":"<div/>").attr("id",bb).attr("title",ia.title).addClass(Va);if(!ia.includeWith&&!ia.list){if("position"in
ia)a(Ha).children().eq(ia.position).before(ib);else ia.type!="menu"||!ia.after?ib.appendTo(Ha):a(Ha).after(ib);if(ia.type=="mode_flyout"){Fa=a(ib);Va=Fa.parent();if(!Fa.parent().hasClass("tools_flyout")){var db=Fa[0].id.replace("tool_","tools_"),jb=Fa.clone().attr("id",db+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Fa.before(jb);Va=Ga(db,Fa);Va.data("isLibrary",true);jb.data("isLibrary",true)}Ca["#"+db+"_show"]=ia.id;bb=vb["#"+Va[0].id]=[{sel:"#"+bb,fn:ia.events.click,icon:ia.id,isDefault:true},
Yb]}else if(ia.type=="app_menu"||ia.type=="menu")ib.append(ia.title)}else if(ia.list){ib.addClass("push_button");a("#"+ia.list+"_opts").append(ib);if(ia.isDefault){a("#cur_"+ia.list).append(ib.children().clone());Fa=ia.svgicon?ia.svgicon:ia.id;Ca["#cur_"+ia.list]=Fa}}else if(ia.includeWith){Ha=ia.includeWith;Fa=a(Ha.button);Va=Fa.parent();if(!Fa.parent().hasClass("tools_flyout")){db=Fa[0].id.replace("tool_","tools_");jb=Fa.clone().attr("id",db+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));
Fa.before(jb);Va=Ga(db,Fa)}var Yb=nc.getButtonData(Ha.button);if(Ha.isDefault)Ca["#"+db+"_show"]=ia.id;bb=vb["#"+Va[0].id]=[{sel:"#"+bb,fn:ia.events.click,icon:ia.id,key:ia.key,isDefault:ia.includeWith?ia.includeWith.isDefault:0},Yb];db="position"in Ha?Ha.position:"last";Yb=Va.children().length;if(!isNaN(db)&&db>=0&&db<Yb)Va.children().eq(db).before(ib);else{Va.append(ib);bb.reverse()}}Ba||ib.append(yb);ia.list||a.each(ia.events,function(Lb,Wb){if(Lb=="click")if(ia.type=="mode"){ia.includeWith?ib.bind(Lb,
Wb):ib.bind(Lb,function(){xa(ib)&&Wb()});if(ia.key){a(document).bind("keydown",ia.key,Wb);ia.title&&ib.attr("title",ia.title+" ["+ia.key+"]")}}else ib.bind(Lb,Wb);else ib.bind(Lb,Wb)});Qa(vb)});a.each(ya,function(){sb(this.elem,this.list,this.callback,{seticon:true})});if(Ba)ja=false;a.svgIcons(Ba,{w:27,h:27,id_match:false,no_img:!O,fallback:Da,placement:Ca,callback:function(){b.iconsize&&b.iconsize!="m"&&I();ja=true;va()}})}va()});f.textActions.setInputElem(a("#text")[0]);var Za='<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,A){Za+='<div class="palette_item" style="background-color: '+A+';" data-rgb="'+A+'"></div>'});a("#palette").append(Za);
Za="";a.each(["#FFF","#888","#000"],function(){Za+='<div class="color_block" style="background-color:'+this+';"></div>'});a("#bg_blocks").append(Za);var Ma=a("#bg_blocks div");Ma.each(function(){a(this).click(function(){Ma.removeClass("cur_background");a(this).addClass("cur_background")})});if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),a.pref("bkgd_url"));else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));if(a.pref("img_save")){b.img_save=a.pref("img_save");a("#image_save_opts input").val([b.img_save])}var mb=
function(q){var A=q.value/100;if(A<0.0010)q.value=0.1;else{q=f.getZoom();Oa(window,{width:0,height:0,x:(ra[0].scrollLeft+ra.width()/2)/q,y:(ra[0].scrollTop+ra.height()/2)/q,zoom:A},true)}},zb=function(q,A){if(A==null)A=q.value;a("#group_opacity").val(A);if(!q||!q.handle)a("#opac_slider").slider("option","value",A);f.setOpacity(A/100)},eb=function(q,A,I){if(A==null)A=q.value;a("#blur").val(A);var Q=false;if(!q||!q.handle){a("#blur_slider").slider("option","value",A);Q=true}I?f.setBlurNoUndo(A):f.setBlur(A,
Q)},gb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){f.setStrokeAttr("stroke-dasharray",a(this).val());gb()});a("#stroke_linejoin").change(function(){f.setStrokeAttr("stroke-linejoin",a(this).val());gb()});a("select").change(function(){a(this).blur()});var Nb=false;a("#selLayerNames").change(function(){var q=this.options[this.selectedIndex].value,A=e.notification.QmoveElemsToLayer.replace("%s",q),I=function(Q){if(Q){Nb=true;f.moveSelectedToLayer(q);
f.clearSelection();Bb()}};if(q)Nb?I(true):a.confirm(A,I)});a("#font_family").change(function(){f.setFontFamily(this.value)});a("#seg_type").change(function(){f.setSegType(a(this).val())});a("#text").keyup(function(){f.setTextContent(this.value)});a("#image_url").change(function(){Ea(this.value)});a("#link_url").change(function(){this.value.length?f.setLinkURL(this.value):f.removeHyperlink()});a("#g_title").change(function(){f.setGroupTitle(this.value)});a(".attr_changer").change(function(){var q=
this.getAttribute("data-attr"),A=this.value;if(svgedit.units.isValidUnit(q,A,Z))this.blur();else{a.alert(e.notification.invalidAttrValGiven);this.value=Z.getAttribute(q);return false}if(q!=="id")if(isNaN(A))A=f.convertToNum(q,A);else if(d.baseUnit!=="px"){var I=svgedit.units.getTypeMap();if(Z[q]||f.getMode()==="pathedit"||q==="x"||q==="y")A*=I[d.baseUnit]}if(q==="id"){q=Z;f.clearSelection();q.id=A;f.addToSelection([q],true)}else f.changeSelectedAttribute(q,A);this.blur()});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"),A=q?"stroke":"fill",I=a(this).attr("data-rgb"),Q=null;if(I==="transparent"||I==="initial"||I==="#none"){I="none";Q=new a.jGraduate.Paint}else Q=new a.jGraduate.Paint({alpha:100,solidColor:I.substr(1)});la[A].setPaint(Q);if(q){f.setColor("stroke",I);I!="none"&&f.getStrokeOpacity()!=1&&f.setPaintOpacity("stroke",1)}else{f.setColor("fill",I);I!="none"&&
f.getFillOpacity()!=1&&f.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");tb()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");tb()});var xa=function(q,A){if(a(q).hasClass("disabled"))return false;if(a(q).parent().hasClass("tools_flyout"))return true;var I=I||"normal";A||a(".tools_flyout").fadeOut(I);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,A=null,I=ra[0],Q=false,X=false;a("#svgcanvas").bind("mousemove mouseup",function(ja){if(Q!==false){I.scrollLeft-=ja.clientX-q;I.scrollTop-=ja.clientY-A;q=ja.clientX;A=ja.clientY;if(ja.type==="mouseup")Q=false;return false}}).mousedown(function(ja){if(ja.button===1||X===true){Q=true;q=ja.clientX;A=ja.clientY;return false}});
a(window).mouseup(function(){Q=false});a(document).bind("keydown","space",function(ja){f.spaceKey=X=true;ja.preventDefault()}).bind("keyup","space",function(ja){ja.preventDefault();f.spaceKey=X=false}).bind("keydown","alt",function(){f.getMode()==="zoom"&&ra.addClass("out")}).bind("keyup","alt",function(){f.getMode()==="zoom"&&ra.removeClass("out")})})();var wb=a(".menu"),qb=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").live("click",function(q){qb(q)});a("svg, body").on("mousedown",function(q){top!=self&&!q.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(!a(q.target).hasClass("menu_title"))if(!a(q.target).hasClass("disabled")&&a(q.target).hasClass("menu_item"))qb(q);
else{a("#tools_shapelib").is(":visible")&&!a(q.target).parents("#tools_shapelib_show, #tools_shapelib").length&&a("#tools_shapelib").hide();q.target.nodeName.toLowerCase()!="input"&&a("input").blur()}});var Ab=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(q,A,I,Q){if(q.altKey){q.preventDefault();q=f.getZoom()*100;A=Ab.length;for(ub=0;ub<A;ub++){I=Math.min(A,ub+1);if(Q>0)zoom=Ab[ub]<=q?Ab[I]:zoom;if(Q<0)zoom=Ab[ub]<q?Ab[ub]:zoom}zoom&&mb({value:zoom})}});
a(".menu_title").on("click",function(){a("#menu_bar").toggleClass("active")});a(".menu_title").on("mouseover",function(){wb.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(q,A,I){if(a(q).length!=0){var Q=a(q).find("button"),X=a(q).find("ul").attr("id",a(q)[0].id+"-list");I||a("#option_lists").append(X);var ja=false;I&&a(q).addClass("dropup");X.find("li").bind("mouseup",A);a(window).mouseup(function(){if(!ja){Q.removeClass("down");X.hide()}ja=false});Q.bind("mousedown",
function(){if(Q.hasClass("down")){Q.removeClass("down");X.hide()}else{Q.addClass("down");if(!I){var va=a(q).offset();X.css({top:va.top,left:va.left-110})}X.show();ja=true}}).hover(function(){ja=true}).mouseout(function(){ja=false})}};var sb=function(q,A,I,Q){var X=a(q);A=a(A);var ja=false,va=Q.dropUp;va&&a(q).addClass("dropup");A.find("li").bind("mouseup",function(){if(Q.seticon){ta("#cur_"+X[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}I.apply(this,arguments)});
a(window).mouseup(function(){if(!ja){X.removeClass("down");A.hide();A.css({top:0,left:0})}ja=false});A.height();a(q).bind("mousedown",function(){var ya=a(q).offset();if(va){ya.top-=A.height();ya.left+=8}else ya.top+=a(q).height();a(A).offset(ya);if(X.hasClass("down")){X.removeClass("down");A.hide();A.css({top:0,left:0})}else{X.addClass("down");A.show();ja=true;return false}}).hover(function(){ja=true}).mouseout(function(){ja=false});Q.multiclick&&A.mousedown(function(){ja=true})};c.addDropDown("#font_family_dropdown",
function(){a(this).text();a("#font_family").val(a(this).text()).change()});c.addDropDown("#opacity_dropdown",function(){if(!a(this).find("div").length){var q=parseInt(a(this).text().split("%")[0]);zb(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,A){zb(A)}});c.addDropDown("#blur_dropdown",a.noop);var kb=false;a("#blur_slider").slider({max:10,step:0.1,
stop:function(q,A){kb=false;eb(A);a("#blur_dropdown li").show();a(window).mouseup()},start:function(){kb=true},slide:function(q,A){eb(A,null,kb)}});c.addDropDown("#zoom_dropdown",function(){var q=a(this),A=q.attr("data-val");A?Oa(window,A):mb({value:parseInt(q.text())})},true);sb("#stroke_linecap","#linecap_opts",function(){w(this,true)},{dropUp:true});sb("#stroke_linejoin","#linejoin_opts",function(){w(this,true)},{dropUp:true});a("div","#position_opts").each(function(){this.addEventListener("mouseup",
function(){var q=this.id.replace("tool_pos","").charAt(0);f.alignSelectedElements(q,"page")})});(function(){var q,A=function(){a(q).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){q=this;U="toolbars";ra.mousedown(A)}).blur(function(){U="canvas";ra.unbind("mousedown",A);f.getMode()=="textedit"&&a("#text").focus()})})();var Gb=function(){if(xa("#tool_select")){f.setMode("select");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}")}},
Hb=function(){xa("#tool_fhpath")&&f.setMode("fhpath")},Ob=function(){xa("#tool_line")&&f.setMode("line")},Pb=function(){xa("#tool_rect")&&f.setMode("rect")},ma=function(){xa("#tool_ellipse")&&f.setMode("ellipse")},Y=function(){xa("#tool_image")&&f.setMode("image")},na=function(){xa("#tool_zoom")&&f.setMode("zoom")},K=function(){if(xa("#tool_zoom")){s();oa()}},N=function(){xa("#tool_text")&&f.setMode("text")},aa=function(){xa("#tool_path")&&f.setMode("path")},Pa=function(){if(Z!=null||Aa)f.deleteSelectedElements()},
Xa=function(){if(Z!=null||Aa)f.cutSelectedElements()},fb=function(){if(Z!=null||Aa)f.copySelectedElements()},nb=function(){var q=f.getZoom(),A=(ra[0].scrollLeft+ra.width()/2)/q-f.contentW;q=(ra[0].scrollTop+ra.height()/2)/q-f.contentH;f.pasteElements("point",A,q)},Db=function(){Z!=null&&f.moveToTopSelectedElement()},cb=function(){Z!=null&&f.moveToBottomSelectedElement()},Fb=function(){Z!=null&&f.moveUpDownSelected("Up")},$a=function(){Z!=null&&f.moveUpDownSelected("Down")},Kb=function(){if(Z!=null){f.convertToPath();
elems=f.getSelectedElems();f.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");f.setMode("pathedit");ua.toEditMode(elems[0]);f.clearSelection()}},Qb=function(){Z!=null&&ua.reorient()},Zb=function(){if(Z!=null||Aa)a.prompt(e.notification.enterNewLinkURL,"http://",function(q){q&&f.makeHyperlink(q)})},Ib=function(q,A){if(Z!=null||Aa){if(d.gridSnapping){var I=f.getZoom()*d.snappingStep;q*=I;A*=I}f.moveSelectedElements(q,A)}},pb=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);ua.linkControlPoints(q)},Ua=function(){ua.getNodePoint()&&ua.clonePathNode()},hc=function(){ua.getNodePoint()&&ua.deletePathNode()},ec=function(){var q=a("#tool_add_subpath"),A=!q.hasClass("push_button_pressed");A?q.addClass("push_button_pressed").removeClass("tool_button"):
q.removeClass("push_button_pressed").addClass("tool_button");ua.addSubPath(A)},cc=function(){ua.opencloseSubPath()},ac=function(){f.cycleElement(1)},fc=function(){f.cycleElement(0)},Rb=function(q,A){if(!(Z==null||Aa)){q||(A*=-1);var I=a("#angle").val()*1+A;f.setRotationAngle(I);Ja()}},$b=function(){var q=d.dimensions;a.confirm(e.notification.QwantToClear,function(A){if(A){oa();f.clear();f.setResolution(q[0],q[1]);Ub(true);s();Bb();Ja();la.fill.prep();la.stroke.prep();f.runExtensions("onNewDocument")}})},
lc=function(){f.setBold(!f.getBold());Ja();return false},Vb=function(){f.setItalic(!f.getItalic());Ja();return false},xb=function(){if(!l.pngsave){var q=e.notification.loadingImage;ba=window.open("data:text/html;charset=utf-8,<title>"+q+"</title><h1>"+q+"</h1>")}window.canvg?f.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){f.rasterExport()})})},jc=function(){f.open()},ic=function(){},Tb=function(q){var A=q.prev();A.css("background","#09f");setTimeout(function(){A.css("background",
"")},200)},rb=function(){if(ha.getUndoStackSize()>0){window.event.type==="keydown"&&Tb(a("#edit_menu"));ha.undo();Bb()}},Xb=function(){if(ha.getRedoStackSize()>0){window.event.type==="keydown"&&Tb(a("#edit_menu"));ha.redo();Bb()}},g=function(){if(Aa)f.groupSelectedElements();else Z&&f.ungroupSelectedElement()},h=function(){window.event.type==="keydown"&&Tb(a("#edit_menu"));f.cloneSelectedElements(20,20)},k=function(){var q=this.id.replace("tool_align","").charAt(0);f.alignSelectedElements(q,a("#align_relative_to").val())},
v=function(){var q=document.querySelector("#tool_stroke rect"),A=document.querySelector("#tool_fill rect"),I=A.getAttribute("fill"),Q=q.getAttribute("fill");q=parseFloat(q.getAttribute("stroke-opacity"));if(isNaN(q))q=100;A=parseFloat(A.getAttribute("fill-opacity"));if(isNaN(A))A=100;Q=ab(Q,q,"stroke");I=ab(I,A,"fill");la.fill.setPaint(Q,true);la.stroke.setPaint(I,true)},s=function(q){var A=f.getResolution();q=q?A.zoom*q:1;a("#zoom").val(q*100);f.setZoom(q);B();Ub(true)},E=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?
a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");ra.toggleClass("wireframe");if(!rc){var q=a("#wireframe_rules");q.length?q.empty():a('<style id="wireframe_rules"></style>').appendTo("head");B()}},z=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},t=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);d.showRulers=
false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);d.showRulers=true}a("#rulers").toggle(!!d.showRulers)},B=function(){if(!rc){var q="#workarea.wireframe #svgcontent * { stroke-width: "+1/f.getZoom()+"px; }";a("#wireframe_rules").text(ra.hasClass("wireframe")?q:"")}},F=function(q,A){if(!Ka){Ka=true;a("#save_output_btns").toggle(!!A);a("#tool_source_back").toggle(!A);var I=sa=f.getSvgString();a("#svg_source_textarea").val(I);a("#svg_source_editor").fadeIn();
H();a("#svg_source_textarea").focus()}},C=function(){if(!Ra){Ra=true;a("#image_save_opts input").val([b.img_save]);var q=f.getResolution();if(d.baseUnit!=="px"){q.w=svgedit.units.convertUnit(q.w)+d.baseUnit;q.h=svgedit.units.convertUnit(q.h)+d.baseUnit}a(".canvas_width").val(q.w);a(".canvas_height").val(q.h);a("#canvas_title").val(f.getDocumentTitle());a("#svg_docprops").show()}},D=function(){if(!Na){Na=true;var q=a("#bg_blocks div"),A=a.pref("bkgd_color"),I=a.pref("bkgd_url");q.each(function(){var Q=
a(this),X=Q.css("background-color")==A;Q.toggleClass("cur_background",X);X&&a("#canvas_bg_url").removeClass("cur_background")});A||q.eq(0).addClass("cur_background");I&&a("#canvas_bg_url").val(I);a("grid_snapping_step").attr("value",d.snappingStep);d.gridSnapping==true?a("#grid_snapping_on").attr("checked","checked"):a("#grid_snapping_on").removeAttr("checked");a("#svg_prefs").show()}},H=function(){var q=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",q)},G=function(){if(Ka){var q=
function(){f.clearSelection();za();s();Bb();P();la.fill.prep();la.stroke.prep()};f.setSvgString(a("#svg_source_textarea").val())?q():a.confirm(e.notification.QerrorsRevertToSource,function(A){if(!A)return false;q()});oa()}},P=function(q){q=q||f.getDocumentTitle();q=Wa+(q?": "+q:"");a("title:first").text(q)},R=function(){var q=a("#canvas_width"),A=q.val(),I=a("#canvas_height"),Q=I.val();if(A!="fit"&&!svgedit.units.isValidUnit("width",A)){a.alert(e.notification.invalidAttrValGiven);q.parent().addClass("error");
return false}q.parent().removeClass("error");if(Q!="fit"&&!svgedit.units.isValidUnit("height",Q)){a.alert(e.notification.invalidAttrValGiven);I.parent().addClass("error");return false}I.parent().removeClass("error");if(!f.setResolution(A,Q)){a.alert(e.notification.noContentToFitTo);return false}b.img_save=a("#image_save_opts :checked").val();a.pref("img_save",b.img_save);Ub();hb()},W=function(){var q=a("#bg_blocks div.cur_background").css("background-color")||"#FFF";p(q,a("#canvas_bg_url").val());
q=a("#lang_select").val();q!=b.lang&&c.putLocale(q);ka(a("#iconsize").val());d.gridSnapping=a("#grid_snapping_on")[0].checked;d.snappingStep=a("#grid_snapping_step").val();d.showRulers=a("#show_rulers")[0].checked;a("#rulers").toggle(d.showRulers);d.showRulers&&da();d.baseUnit=a("#base_unit").val();f.setConfig(d);Ub();Eb()},ta=c.setIcon=function(q,A){var I=typeof A==="string"?a.getSvgIcon(A,true):A.clone();I?a(q).find("img").replaceWith(I):console.log("NOTE: Icon image missing: "+A)},wa;wa=function(){var q=
/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,A=document.getElementsByTagName("script")[0],I;for(I in A.style)if(q.test(I))return I.match(q)[0];if("WebkitOpacity"in A.style)return"Webkit";if("KhtmlOpacity"in A.style)return"Khtml";return""}();var ga=function(q,A){wa.toLowerCase();var I=["top","left","bottom","right"];q.each(function(){for(var Q=a(this),X=Q.outerWidth()*(A-1),ja=Q.outerHeight()*(A-1),va=0;va<4;va++){var ya=I[va],Da=Q.data("orig_margin-"+ya);if(Da==null){Da=parseInt(Q.css("margin-"+ya));
Q.data("orig_margin-"+ya,Da)}Da=Da*A;if(ya==="right")Da+=X;else if(ya==="bottom")Da+=ja;Q.css("margin-"+ya,Da)}})},ka=c.setIconSize=function(q,A){if(!(q==b.size&&!A)){var I=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"),Q=1;Q=typeof q=="number"?q:{s:0.75,m:1,l:1.25,xl:1.5}[q];c.tool_scale=S=Q;Cb();var X=I.parents(":hidden");X.css("visibility",
"hidden").show();ga(I,Q);X.css("visibility","visible").hide();a.pref("iconsize",q);a("#iconsize").val(q);X={"#tools_top":{left:50,height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}};I=a("#tool_size_rules");if(I.length)I.empty();else I=a('<style id="tool_size_rules"></style>').appendTo("head");if(q!="m"){var ja="";a.each(X,function(va,ya){va="#svg_editor "+va.replace(/,/g,", #svg_editor");ja+=va+"{";a.each(ya,function(Da,Ca){if(typeof Ca==="number")var Ba=Ca*Q+"px";else if(Ca[q]||
Ca.all)Ba=Ca[q]||Ca.all;ja+=Da+":"+Ba+";"});ja+="}"});X="-"+wa.toLowerCase()+"-";ja+="#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{"+X+"transform: scale("+Q+");} #svg_editor div.toolset .toolset {"+X+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+X+"transform: scale("+1/Q+");}";I.text(ja)}Cb()}},pa=function(){a("#dialog_box").hide();
if(!Ka&&!Ra&&!Na)Sa&&f.leaveContext();else{if(Ka)sa!==a("#svg_source_textarea").val()?a.confirm(e.notification.QignoreSourceChanges,function(q){q&&za()}):za();else if(Ra)hb();else Na&&Eb();tb()}},za=function(){a("#svg_source_editor").hide();Ka=false;a("#svg_source_textarea").blur()},hb=function(){a("#svg_docprops").hide();a("#canvas_width,#canvas_height").removeAttr("disabled");a("#resolution")[0].selectedIndex=0;a("#image_save_opts input").val([b.img_save]);Ra=false},Eb=function(){a("#svg_prefs").hide();
Na=false},Sb={width:a(window).width(),height:a(window).height()},tb=a.noop,Jb;svgedit.browser.isIE()&&function(){tb=function(){if(ra[0].scrollLeft===0&&ra[0].scrollTop===0){ra[0].scrollLeft=Jb.left;ra[0].scrollTop=Jb.top}};Jb={left:ra[0].scrollLeft,top:ra[0].scrollTop};a(window).resize(tb);svgEditor.ready(function(){setTimeout(function(){tb()},500)});ra.scroll(function(){Jb={left:ra[0].scrollLeft,top:ra[0].scrollTop}})}();a(window).resize(function(){Ka&&H();a.each(Sb,function(q,A){var I=a(window)[q]();
ra[0]["scroll"+(q==="width"?"Left":"Top")]-=(I-A)/2;Sb[q]=I})});(function(){ra.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=ra[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=ra[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(L);(function(){var q=["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],A="";a.each(q,function(I,Q){A+="#tool_"+
Q+(I==q.length-1?",":"")});a(A).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(V&&!window.opera){V=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"];for(var ub=V.length;ub--;){var dc=
document.getElementById(V[ub]);if(dc!=null){var oc=dc.title,sc=oc.indexOf("Ctrl+");dc.title=[oc.substr(0,sc),"Cmd+",oc.substr(sc+5)].join("")}}}var pc=function(q){var A=q[0].id=="stroke_color"?"stroke":"fill",I=q[0].id=="canvas_color";if(I)A="canvas";var Q=la[A].paint;q=A=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";I=I?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(I).jGraduate({paint:Q,
window:{pickerTitle:q},images:{clientPath:d.jGraduatePath},newstop:"inverse"},function(X){Q=new a.jGraduate.Paint(X);la[A].setPaint(Q);f.setPaint(A,Q);a("#color_picker").hide()},function(){a("#color_picker").hide()})};V=function(q,A){var I=document.getElementById("canvas_background"),Q={color:"#fff",opacity:1};if(A=="stroke")Q=d.initStroke;if(A=="fill")Q=d.initFill;if(A=="canvas"&&I){Q=I.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);Q={color:("0"+parseInt(Q[1],10).toString(16)).slice(-2)+
("0"+parseInt(Q[2],10).toString(16)).slice(-2)+("0"+parseInt(Q[3],10).toString(16)).slice(-2),opacity:1}}I=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+Q.color+'" opacity="'+Q.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;I=a(q)[0].appendChild(document.importNode(I,true));I.setAttribute("width",24.5);this.rect=I.firstChild;this.defs=I.getElementsByTagName("defs")[0];
this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:Q.color});this.type=A;this.setPaint=function(X,ja){this.paint=X;var va="none",ya=X.type,Da=X.alpha/100;switch(ya){case "solidColor":va=X[ya]=="none"||X[ya]=="one"?"none":"#"+X[ya];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(X[ya]);va="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",va);this.rect.setAttribute("opacity",Da);if(ja){f.setColor(this.type,
va,true);f.setPaintOpacity(this.type,Da,true)}if(this.type=="canvas"){(ya=document.getElementById("canvas_background"))?ya.setAttribute("fill",va):La(va);console.log(ya.getAttribute("fill"))}};this.update=function(X){if(Z){var ja=this.type;switch(Z.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var va=null,ya=Z.getElementsByTagName("*"),Da=0,Ca=ya.length;Da<Ca;Da++){var Ba=ya[Da].getAttribute(ja);if(Da===0)va=Ba;else if(va!==Ba){va=null;break}}if(va===null){ya=
null;return}ya=va;va=1;break;default:va=parseFloat(Z.getAttribute(ja+"-opacity"));if(isNaN(va))va=1;ya=ja==="fill"?"black":"none";ya=Z.getAttribute(ja)||ya}if(X){f.setColor(ja,ya,true);f.setPaintOpacity(ja,va,true)}va*=100;this.setPaint(ab(ya,va,ja))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var X=new a.jGraduate.Paint({copy:this.paint});f.setPaint(A,X)}}};la.fill=new V("#fill_color","fill");la.stroke=new V("#stroke_color","stroke");la.canvas=new V("#canvas_color",
"canvas");a("#stroke_width").val(d.initStroke.width);a("#group_opacity").val(d.initOpacity*100);V=la.fill.rect.cloneNode(false);V.setAttribute("style","vector-effect:non-scaling-stroke");var rc=V.style.vectorEffect==="non-scaling-stroke";V.removeAttribute("style");V=la.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof V.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(V).remove();setTimeout(function(){f.embedImage("images/placeholder.svg",function(q){if(!q){a("#image_save_opts [value=embed]").attr("disabled",
"disabled");a("#image_save_opts input").val(["ref"]);b.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",e.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))pc(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_canvas").click(function(){pc(a("#canvas_color"))});a("#tool_stroke").click(function(){if(a("#tool_stroke").hasClass("active"))pc(a("#stroke_color"));else{a("#tool_stroke").addClass("active");
a("#tool_fill").removeClass("active")}});a("#group_opacityLabel").click(function(){a("#opacity_dropdown button").mousedown();a(window).mouseup()});a("#zoomLabel").click(function(){a("#zoom_dropdown button").mousedown();a(window).mouseup()});a("#tool_move_top").mousedown(function(q){a("#tools_stacking").show();q.preventDefault()});a(".layer_button").mousedown(function(){a(this).addClass("layer_buttonpressed")}).mouseout(function(){a(this).removeClass("layer_buttonpressed")}).mouseup(function(){a(this).removeClass("layer_buttonpressed")});
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("#layer_new").click(function(){var q=f.getCurrentDrawing().getNumLayers();do var A=e.layers.layer+" "+ ++q;while(f.getCurrentDrawing().hasLayer(A));a.prompt(e.notification.enterUniqueLayerName,
A,function(I){if(I)if(f.getCurrentDrawing().hasLayer(I))a.alert(e.notification.dupeLayerName);else{f.createLayer(I);Ja();Bb()}})});a("#layer_delete").click(T);a("#layer_up").click(function(){J(-1)});a("#layer_down").click(function(){J(1)});a("#layer_rename").click(function(){a("#layerlist tr.layersel").prevAll();var q=a("#layerlist tr.layersel td.layername").text();a.prompt(e.notification.enterNewLayerName,"",function(A){if(A)if(q==A||f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.layerHasThatName);
else{f.renameCurrentLayer(A);Bb()}})});var bc=-1,kc=false,qc=false,tc=function(q){if(qc)if(bc!=-1){kc=true;q=bc-q.pageX;var A=a("#sidepanels"),I=parseInt(A.css("width"));if(I+q>300)q=300-I;else if(I+q<2)q=2-I;if(q!=0){bc-=q;I=a("#layerpanel");ra.css("right",parseInt(ra.css("right"))+q);A.css("width",parseInt(A.css("width"))+q);I.css("width",parseInt(I.css("width"))+q);A=a("#ruler_x");A.css("right",parseInt(A.css("right"))+q)}}};a("#sidepanel_handle").mousedown(function(q){bc=q.pageX;a(window).mousemove(tc);
qc=false;setTimeout(function(){qc=true},20)}).mouseup(function(){kc||uc();bc=-1;kc=false});a(window).mouseup(function(){bc=-1;kc=false;a("#svg_editor").unbind("mousemove",tc)});var uc=function(q){var A=parseInt(a("#sidepanels").css("width"));q=(A>2||q?2:150)-A;A=a("#sidepanels");var I=a("#layerpanel"),Q=a("#ruler_x");ra.css("right",parseInt(ra.css("right"))+q);A.css("width",parseInt(A.css("width"))+q);I.css("width",parseInt(I.css("width"))+q);Q.css("right",parseInt(Q.css("right"))+q)},vc=function(q){for(var A=
Array(f.getCurrentDrawing().getNumLayers()),I=0;I<A.length;++I)A[I]=f.getCurrentDrawing().getLayerName(I);if(q)for(I=0;I<A.length;++I)A[I]!=q&&f.getCurrentDrawing().setLayerOpacity(A[I],0.5);else for(I=0;I<A.length;++I)f.getCurrentDrawing().setLayerOpacity(A[I],1)},Bb=function(){var q=a("#layerlist tbody"),A=a("#selLayerNames");q.empty();A.empty();for(var I=f.getCurrentDrawing().getCurrentLayerName(),Q=f.getCurrentDrawing().getNumLayers(),X=a.getSvgIcon("eye");Q--;){var ja=f.getCurrentDrawing().getLayerName(Q),
va='<tr class="layer';if(ja==I)va+=" layersel";va+='">';va+=f.getCurrentDrawing().getLayerVisibility(ja)?'<td class="layervis"/><td class="layername" >'+ja+"</td></tr>":'<td class="layervis layerinvis"/><td class="layername" >'+ja+"</td></tr>";q.append(va);A.append('<option value="'+ja+'">'+ja+"</option>")}if(X!==undefined){X.clone();a("td.layervis",q).append(X.clone());a.resizeSvgIcons({"td.layervis .svg_icon":14})}a("#layerlist td.layername").mouseup(function(ya){a("#layerlist tr.layer").removeClass("layersel");
a(this.parentNode).addClass("layersel");f.setCurrentLayer(this.textContent);ya.preventDefault()}).mouseover(function(){a(this).css({"font-style":"italic",color:"blue"});vc(this.textContent)}).mouseout(function(){a(this).css({"font-style":"normal",color:"black"});vc()});a("#layerlist td.layervis").click(function(){var ya=a(this.parentNode).prevAll().length;ya=a("#layerlist tr.layer:eq("+ya+") td.layername").text();var Da=a(this).hasClass("layerinvis");f.setLayerVisibility(ya,Da);Da?a(this).removeClass("layerinvis"):
a(this).addClass("layerinvis")});for(A=5-a("#layerlist tr.layer").size();A-- >0;)q.append('<tr><td style="color:white">_</td><td/></tr>')};Bb();a(window).bind("load resize",function(){ra.css("line-height",ra.height()+"px")});a("#resolution").change(function(){var q=a("#canvas_width,#canvas_height");if(this.selectedIndex)if(this.value=="content")q.val("fit").attr("disabled","disabled");else{var A=this.value.split("x");a("#canvas_width").val(A[0]);a("#canvas_height").val(A[1]);q.removeAttr("disabled")}else a("#canvas_width").val()==
"fit"&&q.removeAttr("disabled").val(100)});a("input,select").attr("autocomplete","off");var nc=function(){var q=[{sel:"#tool_select",fn:Gb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Hb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Ob,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Pb,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ma,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:aa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:N,evt:"click",key:["T",
true]},{sel:"#tool_image",fn:Y,evt:"mouseup"},{sel:"#tool_zoom",fn:na,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:$b,evt:"mouseup",key:[fa+"N",true]},{sel:"#tool_save",fn:function(){Ka?G():f.save({images:b.img_save,round_digits:6})},evt:"mouseup",key:[fa+"S",true]},{sel:"#tool_export",fn:xb,evt:"mouseup"},{sel:"#tool_open",fn:jc,evt:"mouseup"},{sel:"#tool_import",fn:ic,evt:"mouseup"},{sel:"#tool_source",fn:F,evt:"click",key:[fa+"U",true]},{sel:"#tool_wireframe",fn:E,evt:"click"},{sel:"#tool_rulers",
fn:t,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:pa,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:G,evt:"click"},{sel:"#tool_docprops_save",fn:R,evt:"click"},{sel:"#tool_docprops",fn:C,evt:"mouseup"},{sel:"#tool_prefs_save",fn:W,evt:"click"},{sel:"#tool_prefs_option",fn:function(){D();return false},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Pa,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",
fn:Qb,evt:"click"},{sel:"#tool_node_link",fn:pb,evt:"click"},{sel:"#tool_node_clone",fn:Ua,evt:"click"},{sel:"#tool_node_delete",fn:hc,evt:"click"},{sel:"#tool_openclose_path",fn:cc,evt:"click"},{sel:"#tool_add_subpath",fn:ec,evt:"click"},{sel:"#tool_move_top",fn:Db,evt:"click",key:fa+"shift+up"},{sel:"#tool_move_bottom",fn:cb,evt:"click",key:fa+"shift+down"},{sel:"#tool_move_up",fn:Fb,evt:"click",key:[fa+"up",true]},{sel:"#tool_move_down",fn:$a,evt:"click",key:[fa+"down",true]},{sel:"#tool_topath",
fn:Kb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:Zb,evt:"click"},{sel:"#tool_undo",fn:rb,evt:"click"},{sel:"#tool_redo",fn:Xb,evt:"click",key:["Y",true]},{sel:"#tool_clone,#tool_clone_multi",fn:h,evt:"click",key:[fa+"D",true]},{sel:"#tool_group",fn:g,evt:"click",key:[fa+"G",true]},{sel:"#tool_ungroup",fn:g,evt:"click",key:fa+"shift+G"},{sel:"#tool_unlink_use",fn:g,evt:"click"},{sel:"[id^=tool_align]",fn:k,evt:"click"},{sel:"#tool_switch",fn:v,evt:"click",key:["X",true]},{sel:"#tool_bold",
fn:lc,evt:"mousedown",key:[fa+"B",true]},{sel:"#tool_italic",fn:Vb,evt:"mousedown",key:[fa+"I",true]},{sel:"#copy_save_done",fn:pa,evt:"click"},{key:"ctrl+left",fn:function(){Rb(0,1)}},{key:"ctrl+right",fn:function(){Rb(1,1)}},{key:"ctrl+shift+left",fn:function(){Rb(0,5)}},{key:"ctrl+shift+right",fn:function(){Rb(1,5)}},{key:"shift+O",fn:fc},{key:"shift+P",fn:ac},{key:[fa+"+",true],fn:function(){s(2)}},{key:[fa+"-",true],fn:function(){s(0.5)}},{key:["up",true],fn:function(){Ib(0,-1)}},{key:["down",
true],fn:function(){Ib(0,1)}},{key:["left",true],fn:function(){Ib(-1,0)}},{key:["right",true],fn:function(){Ib(1,0)}},{key:"shift+up",fn:function(){Ib(0,-10)}},{key:"shift+down",fn:function(){Ib(0,10)}},{key:"shift+left",fn:function(){Ib(-10,0)}},{key:"shift+right",fn:function(){Ib(10,0)}},{key:["alt+up",true],fn:function(){f.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){f.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){f.cloneSelectedElements(-1,0)}},{key:["alt+right",
true],fn:function(){f.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){f.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){f.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){f.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){f.cloneSelectedElements(10,0)}},{key:fa+"A",fn:function(){f.selectAllInCurrentLayer()}},{key:fa+"z",fn:rb},{key:fa+"shift+z",fn:Xb},{key:fa+"y",fn:Xb},{key:"esc",fn:z},{key:fa+"x",fn:Xa},
{key:fa+"c",fn:fb},{key:fa+"v",fn:nb}],A={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var I={};a.each(q,function(Q,X){if(X.sel){var ja=a(X.sel);if(ja.length==0)return true;if(X.evt){if(svgedit.browser.isTouch()&&X.evt==="click")X.evt="mousedown";ja[X.evt](X.fn)}if(X.parent&&a(X.parent+"_show").length!=0){var va=a(X.parent);va.length||(va=Ga(X.parent.substr(1)));va.append(ja);a.isArray(I[X.parent])||(I[X.parent]=[]);I[X.parent].push(X)}}if(X.key){var ya=
X.fn,Da=false;if(a.isArray(X.key)){va=X.key[0];if(X.key.length>1)Da=X.key[1]}else va=X.key;va+="";svgedit.browser.isMac&&va.indexOf("+")!=-1&&va.split("+")[0]=="ctrl"&&va.replace("ctrl","cmd");a.each(va.split("/"),function(Ba,vb){a(document).bind("keydown",vb,function(Ta){ya();Da&&Ta.preventDefault();return false})});if(X.sel&&!X.hidekey&&ja.attr("title")){var Ca=ja.attr("title").split("[")[0]+" ("+va+")";A[va]=X.sel;ja.parents("#main_menu").length||ja.attr("title",Ca)}}});Qa(I);a(".attr_changer, #image_url").bind("keydown",
"return",function(Q){a(this).change();Q.preventDefault()});a(window).bind("keydown","tab",function(Q){if(U==="canvas"){Q.preventDefault();ac()}}).bind("keydown","shift+tab",function(Q){if(U==="canvas"){Q.preventDefault();fc()}});a("#tool_zoom").dblclick(K)},setTitles:function(){a.each(A,function(I,Q){var X=a(Q).parents("#main_menu").length;a(Q).each(function(){var ja=X?a(this).text().split(" [")[0]:this.title.split(" [")[0],va="";a.each(I.split("/"),function(ya,Da){var Ca=Da.split("+"),Ba="";if(Ca.length>
1){Ba=Ca[0]+"+";Da=Ca[1]}va+=(ya?"/":"")+Ba+(e["key_"+Da]||Da)});if(X)this.lastChild.textContent=ja+" ["+va+"]";else this.title=ja+" ["+va+"]"})})},getButtonData:function(I){var Q;a.each(q,function(X,ja){if(ja.sel===I)Q=ja});return Q}}}();nc.setAll();c.ready(function(){var q=d.initTool,A=a("#tools_left, #svg_editor .tools_flyout"),I=A.find("#tool_"+q);q=A.find("#"+q);(I.length?I:q.length?q:a("#tool_select")).click().mouseup();d.wireframe&&a("#tool_wireframe").click();d.showlayers&&uc();a("#rulers").toggle(!!d.showRulers);
if(d.showRulers)a("#show_rulers")[0].checked=true;if(d.gridSnapping)a("#grid_snapping_on")[0].checked=true;d.baseUnit&&a("#base_unit").val(d.baseUnit);d.snappingStep&&a("#grid_snapping_step").val(d.snappingStep)});a("#rect_rx").SpinButton({min:0,max:1E3,step:1,callback:function(q){f.setRectRadius(q.value)}});a("#stroke_width").SpinButton({min:0,max:99,step:1,smallStep:0.1,callback:function(q){var A=q.value;if(A==0&&Z&&["line","polyline"].indexOf(Z.nodeName)>=0)A=q.value=1;f.setStrokeWidth(A)}});a("#angle").SpinButton({min:-180,
max:180,step:5,callback:function(q){f.setRotationAngle(q.value);a("#tool_reorient").toggleClass("disabled",q.value==0)}});a("#font_size").SpinButton({step:1,min:0.0010,stepfunc:function(q,A){var I=q.value-0,Q=I+A,X=Q>=I;if(A===0)return I;return I>=24?X?Math.round(I*1.1):Math.round(I/1.1):I<=1?X?I*2:I/2:Q},callback:function(q){f.setFontSize(q.value)}});a("#group_opacity").SpinButton({step:5,min:0,max:100,callback:zb});a("#blur").SpinButton({step:0.1,min:0,max:10,callback:eb});a("#zoom").SpinButton({min:0.0010,
max:1E4,step:50,stepfunc:function(q,A){var I=q.value-0;if(I===0)return 100;var Q=I+A;if(A===0)return I;return I>=100?Q:Q>=I?I*2:I/2},callback:mb}).val(f.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(q){switch(q){case "delete":Pa();break;case "cut":Xa();break;case "copy":fb();break;case "paste":f.pasteElements();break;case "paste_in_place":f.pasteElements("in_place");break;case "group":f.groupSelectedElements();break;case "ungroup":f.ungroupSelectedElement();break;
case "move_front":Db();break;case "move_up":Z!=null&&f.moveUpDownSelected("Up");break;case "move_down":Z!=null&&f.moveUpDownSelected("Down");break;case "move_back":cb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(q)&&svgedit.contextmenu.getCustomHandler(q).call()}f.clipBoard.length&&qa.enableContextMenuItems("#paste,#paste_in_place")});V=function(q){switch(q){case "dupe":M();break;case "delete":T();break;case "merge_down":if(a("#layerlist tr.layersel").index()!=f.getCurrentDrawing().getNumLayers()-
1){f.mergeLayer();Ja();Bb()}break;case "merge_all":f.mergeAllLayers();Ja();Bb()}};a("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},V);a("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:true},V);a(".contextMenu li").mousedown(function(q){q.preventDefault()});a("#cmenu_canvas li").disableContextMenu();qa.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(ha.getUndoStackSize()===0)c.show_save_warning=false;if(!d.no_save_warning&&c.show_save_warning)return e.notification.unsavedChanges};
c.openPrep=function(q){a("#main_menu").hide();ha.getUndoStackSize()===0?q(true):a.confirm(e.notification.QwantToOpen,q)};if(window.FileReader){V=a('<input type="file">').change(function(){var q=this;c.openPrep(function(A){if(A){f.clear();if(q.files.length==1){A=new FileReader;A.onloadend=function(I){n(I.target.result);Ub()};A.readAsText(q.files[0])}}})});a("#tool_open").show().prepend(V);V=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var q=new FileReader;
q.onloadend=function(A){f.importSvgString(A.target.result,true);Ub()};q.readAsText(this.files[0])}});a("#tool_import").show().prepend(V)}var Ub=c.updateCanvas=function(q,A){var I=ra.width(),Q=ra.height(),X=I,ja=Q,va=f.getZoom(),ya=a("#svgcanvas"),Da={x:ra[0].scrollLeft+X/2,y:ra[0].scrollTop+ja/2},Ca=d.canvas_expansion;I=Math.max(X,f.contentW*va*Ca);Q=Math.max(ja,f.contentH*va*Ca);I==X&&Q==ja?ra.css("overflow","hidden"):ra.css("overflow","scroll");Ca=ya.height()/2;var Ba=ya.width()/2;ya.width(I).height(Q);
var vb=Q/2,Ta=I/2,ia=f.updateCanvas(I,Q),yb=Ta/Ba;I=I/2-X/2;Q=Q/2-ja/2;if(A){A.x+=ia.x;A.y+=ia.y}else A={x:Ta+(Da.x-Ba)*yb,y:vb+(Da.y-Ca)*yb};if(q)if(f.contentW>ra.width()){ra[0].scrollLeft=ia.x-10;ra[0].scrollTop=ia.y-10}else{ra[0].scrollLeft=I;ra[0].scrollTop=Q}else{ra[0].scrollLeft=A.x-X/2;ra[0].scrollTop=A.y-ja/2}if(d.showRulers){da(ya,va);ra.scroll()}},gc=[];for(ub=0.1;ub<1E5;ub*=10){gc.push(1*ub);gc.push(2*ub);gc.push(5*ub)}Ub(true);try{var wc=function(q){if(window.JSON&&JSON.stringify)return JSON.stringify(q);
var A=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(X){return"\\u"+("0000"+X.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(q.length){for(var I=0;I<q.length;I++)q[I]=A(q[I]);return"["+q.join(",")+"]"}else{I=[];for(var Q in q)I.push(A(Q)+":"+A(q[Q]));return"{"+I.join(",")+"}"}};window.addEventListener("message",
function(q){var A=parseInt(q.data.substr(0,q.data.indexOf(";")));try{q.source.postMessage("SVGe"+A+";"+wc(eval(q.data)),"*")}catch(I){q.source.postMessage("SVGe"+A+";error:"+I.message,"*")}},false)}catch(xc){window.embed_error=xc}a(function(){window.svgCanvas=f;f.ready=svgEditor.ready});c.setLang=function(q,A){a.pref("lang",q);a("#lang_select").val(q);if(A){var I=a("#layerlist tr.layersel td.layername").text()==e.common.layer+" 1";a.extend(e,A);f.setUiStrings(A);nc.setTitles();if(I){f.renameCurrentLayer(e.common.layer+
" 1");Bb()}f.runExtensions("langChanged",q);Mb();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(Q,X){a(X).attr("title",a(Q)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var u=[];c.ready=function(w){m?w():u.push(w)};c.runCallbacks=function(){a.each(u,
function(){this()});m=true};c.loadFromString=function(w){c.ready(function(){n(w)})};c.disableUI=function(){};c.loadFromURL=function(w,p){p||(p={});var L=p.cache,T=p.callback;c.ready(function(){a.ajax({url:w,dataType:"text",cache:!!L,success:function(M){n(M,T)},error:function(M,J,da){M.status!=404&&M.responseText?n(M.responseText,T):a.alert(e.notification.URLloadFail+": \n"+da+"",T)}})})};c.loadFromDataURI=function(w){c.ready(function(){var p=w.substring(26);n(svgedit.utilities.decode64(p))})};c.addExtension=
function(){var w=arguments;a(function(){f&&f.addExtension.apply(this,w)})};return c}(jQuery);$(svgEditor.init)})();svgedit=svgedit||{};
b={},d={canvas_expansion:1,dimensions:[640,480],initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",langPath:"locale/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:["ext-markers.js","ext-eyedropper.js","ext-shapes.js","ext-grid.js"],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:true,show_outside_canvas:false,no_save_warning:true,initFont:"Sans-serif"},
e=c.uiStrings={common:{ok:"OK",cancel:"Cancel",key_up:"Up",key_down:"Down",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...",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" ...'}};b={};var l={};c.curConfig=d;c.tool_scale=1;a.pref=function(w,p){if(p)b[w]=p;w="svg-edit-"+w;var L=location.hostname,
T=L&&L.indexOf(".")>=0,M=p!=undefined,J=false;try{if(window.localStorage)J=localStorage}catch(da){}try{if(window.globalStorage&&T)J=globalStorage[L]}catch(V){}if(J)if(M)J.setItem(w,p);else{if(J.getItem(w))return J.getItem(w)+""}else if(window.widget)if(M)widget.setPreferenceForKey(p,w);else return widget.preferenceForKey(w);else if(M){L=new Date;L.setTime(L.getTime()+31536E6);p=encodeURIComponent(p);document.cookie=w+"="+p+"; expires="+L.toUTCString()}else return(L=document.cookie.match(RegExp(w+
"=([^;]+)")))?decodeURIComponent(L[1]):""};c.setConfig=function(w){a.each(w,function(p,L){p in o&&a.pref(p,L)});a.extend(true,d,w);if(w.extensions)d.extensions=w.extensions};c.setCustomHandlers=function(w){c.ready(function(){if(w.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();f.open=w.open}if(w.save){c.show_save_warning=false;f.bind("saved",w.save)}w.pngsave&&f.bind("exported",w.pngsave);l=w})};c.randomizeIds=function(){f.randomizeIds(arguments)};c.init=function(){function w(q,
A){var I=q.id,R=I.split("_"),X=R[0];R=R[1];A&&f.setStrokeAttr("stroke-"+X,R);ib();fa("#cur_"+X,I,20);a(q).addClass("current").siblings().removeClass("current")}function p(q,A){a.pref("bkgd_color",q);a.pref("bkgd_url",A);f.setBackground(q,A)}function L(){var q=f.getHref(Z);q=q.indexOf("data:")===0?"":q;a.prompt(e.notification.enterNewImgURL,q,function(A){A&&Ea(A)})}function T(){if(f.deleteCurrentLayer()){Ja();Ab();a("#layerlist tr.layer").removeClass("layersel");a("#layerlist tr.layer:first").addClass("layersel")}}
function M(){var q=f.getCurrentDrawing().getCurrentLayerName()+" copy";a.prompt(e.notification.enterUniqueLayerName,q,function(A){if(A)if(f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.dupeLayerName);else{f.cloneLayer(A);Ja();Ab()}})}function J(q){var A=a("#layerlist tr.layersel").index(),I=f.getCurrentDrawing().getNumLayers();if(A>0||A<I-1){A+=q;f.setCurrentLayerPosition(I-A-1);Ab()}}function da(q,A){var I=document.getElementById("ruler_x_cursor"),R=document.getElementById("ruler_y_cursor"),
X=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()||a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(nc){nc.stopPropagation();I.style.left=nc.pageX-66+X.scrollLeft+"px";R.style.top=nc.pageY-48+X.scrollTop+"px"});A||(A=f.getZoom());q||(q=a("#svgcanvas"));for(var ja=f.getContentElem(),va=svgedit.units.getTypeMap()[d.baseUnit],ya=0;ya<2;ya++){var Da=ya===0,Ca=Da?"x":"y",Ba=Da?"width":"height",tb=ja.getAttribute(Ca)-0;Ca=a("#ruler_"+
Ca+" canvas:first");$hcanv=Ca.clone();Ca.replaceWith($hcanv);var Ta=$hcanv[0];var ia=Ca=q[Ba]()*2;Ta.parentNode.style[Ba]=ia+"px";var wb=0,bb,Fa=Ta.getContext("2d");Fa.fillStyle="rgb(200,0,0)";Fa.fillRect(0,0,Ta.width,Ta.height);$hcanv.siblings().remove();if(Ca>=3E4){var Va=parseInt(Ca/3E4)+1;bb=Array(Va);bb[0]=Fa;for(var Ha=1;Ha<Va;Ha++){Ta[Ba]=3E4;var kb=Ta.cloneNode(true);Ta.parentNode.appendChild(kb);bb[Ha]=kb.getContext("2d")}kb[Ba]=Ca%3E4;Ca=3E4}Ta[Ba]=Ca;Ba=va*A;var eb=50/Ba;Ta=1;for(Ha=0;Ha<
hc.length;Ha++){Ta=Va=hc[Ha];if(eb<=Va)break}eb=Ta*Ba;Fa.font="normal 9px 'Lucida Grande', sans-serif";Fa.fillStyle="#777";for(var lb=tb/Ba%Ta*Ba,Yb=lb-eb;lb<ia;lb+=eb){Yb+=eb;Ha=Math.round(lb)+0.5;if(Da){Fa.moveTo(Ha,15);Fa.lineTo(Ha,0)}else{Fa.moveTo(15,Ha);Fa.lineTo(0,Ha)}Va=(Yb-tb)/Ba;if(Ta>=1)Ha=Math.round(Va);else{Ha=(Ta+"").split(".")[1].length;Ha=Va.toFixed(Ha)-0}if(Ha!==0&&Ha!==1E3&&Ha%1E3===0)Ha=Ha/1E3+"K";if(Da){Fa.fillText(Ha,lb+2,8);Fa.fillStyle="#777"}else{Va=(Ha+"").split("");for(Ha=
0;Ha<Va.length;Ha++){Fa.fillText(Va[Ha],1,lb+9+Ha*9);Fa.fillStyle="#777"}}Va=eb/10;for(Ha=1;Ha<10;Ha++){var Jb=Math.round(lb+Va*Ha)+0.5;if(bb&&Jb>Ca){wb++;Fa.stroke();if(wb>=bb.length){Ha=10;lb=ia;continue}Fa=bb[wb];lb-=3E4;Jb=Math.round(lb+Va*Ha)+0.5}var Xb=Ha%2?12:10;if(Da){Fa.moveTo(Jb,15);Fa.lineTo(Jb,Xb)}else{Fa.moveTo(15,Jb);Fa.lineTo(Xb,Jb)}}}Fa.strokeStyle="#666";Fa.stroke()}}(function(){var q=window.opener;if(q)try{var A=q.document.createEvent("Event");A.initEvent("svgEditorReady",true,true);
q.document.documentElement.dispatchEvent(A)}catch(I){}})();(function(){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 A=q.source,I=a.param.querystring();if(!A)if(I.indexOf("source=data:")>=0)A=I.match(/source=(data:[^&]*)/)[1];if(A)if(A.indexOf("data:")===0){A=A.replace(/ /g,"+");c.loadFromDataURI(A)}else c.loadFromString(A);
else if(I.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(I.substr(9));else q.url&&svgEditor.loadFromURL(q.url)}})();var V=function(){a.each(d.extensions,function(){var A=this;a.getScript(d.extPath+A,function(I){if(!I){I=document.createElement("script");I.src=d.extPath+A;document.querySelector("head").appendChild(I)}})});var q=[];a("#lang_select option").each(function(){q.push(this.value)});c.putLocale(null,q)};document.location.protocol==="file:"?setTimeout(V,100):V();a.svgIcons(d.imgPath+"svg_edit_icons.svg",
{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:d.imgPath,fallback:{new_image:"clear.png",save:"save.png",open:"open.png",source:"source.png",docprops:"document-properties.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.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",clone:"clone.png",node_clone:"node_clone.png","delete":"delete.png",node_delete:"node_delete.png",move_top:"move_top.png",move_bottom:"move_bottom.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.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",go_up:"go-up.png",go_down:"go-down.png",ok:"save.png",cancel:"cancel.png",
arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#tool_docprops > div":"docprops","#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","#linecap_butt,#cur_linecap":"linecap_butt","#linecap_round":"linecap_round","#linecap_square":"linecap_square","#linejoin_miter,#cur_linejoin":"linejoin_miter",
"#linejoin_round":"linejoin_round","#linejoin_bevel":"linejoin_bevel","#url_notice":"warning","#layer_up":"go_up","#layer_down":"go_down","#layer_moreopts":"context_menu","#layerlist td.layervis":"eye","#tool_source_save,#tool_docprops_save,#tool_prefs_save":"ok","#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel":"cancel","#rwidthLabel, #iwidthLabel":"width","#rheightLabel, #iheightLabel":"height","#angleLabel":"angle","#linkLabel,#tool_make_link,#tool_make_link_multi":"globe_link","#zoomLabel":"zoom",
"#blurLabel":"blur",".flyout_arrow_horiz":"arrow_right","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":32,".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":24,".palette_item:first .svg_icon":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)});var q=a("#tools_left");if(q.length!=0){q.offset();q.outerHeight()}a(".tools_flyout").each(function(){var A=a("#"+this.id+"_show"),I=A.attr("data-curopt");if(!A.children("svg, img").length){I=a(I).children().clone();if(I.length){I[0].removeAttribute("style");A.append(I)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},
1)}});c.canvas=f=new a.SvgCanvas(document.getElementById("svgcanvas"),d);c.show_save_warning=false;V=navigator.platform.indexOf("Mac")>=0;var O=navigator.userAgent.indexOf("AppleWebKit")>=0,ga=V?"meta+":"ctrl+",ta=f.pathActions,ha=f.undoMgr,ca=svgedit.utilities,ea=d.imgPath+"placeholder.svg",ra=a("#workarea"),pa=a("#cmenu_canvas");a("#cmenu_layers");var ba=null,S=1,U="toolbars",sa="",la={fill:null,stroke:null};V||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"),A=a("#dialog_buttons"),I=function(R,X,ja,va){a("#dialog_content").html("<p>"+X.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",R=="prompt");A.empty();var ya=a('<input type="button" value="'+e.common.ok+'">').appendTo(A);R!="alert"&&a('<input type="button" value="'+e.common.cancel+'">').appendTo(A).click(function(){q.hide();ja(false)});if(R=="prompt"){var Da=
a('<input type="text">').prependTo(A);Da.val(va||"");Da.bind("keydown","return",function(){ya.click()})}R=="process"&&ya.hide();q.show();ya.click(function(){q.hide();var Ca=R=="prompt"?Da.val():true;ja&&ja(Ca)}).focus();R=="prompt"&&Da.focus()};a.alert=function(R,X){I("alert",R,X)};a.confirm=function(R,X){I("confirm",R,X)};a.process_cancel=function(R,X){I("process",R,X)};a.prompt=function(R,X,ja){I("prompt",R,ja,X)}})();var oa=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");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")}f.setMode("select")},Z=null,Aa=false,Ka=false,Ra=false,Na=false,Sa="",Wa=a("title:first").text(),Oa=function(q,A,I){f.getResolution();a("#svgcanvas").position();if(A=f.setBBoxZoom(A,ra.width()-15,ra.height()-15)){q=A.zoom;A=A.bbox;if(q<0.0010)ob({value:0.1});else{a("#zoom").val(q*100);I?Rb():Rb(false,{x:A.x*q+A.width*
q/2,y:A.y*q+A.height*q/2});f.getMode()=="zoom"&&A.width&&oa();B()}}};a("#cur_context_panel").delegate("a","click",function(){var q=a(this);q.attr("data-root")?f.leaveContext():f.setContext(q.text());return false});var Ia={},Qa=function(q){a.each(q,function(A,I){var R=a(A).children(),X=A+"_show",ja=a(X),va=false;R.addClass("tool_button").unbind("click mousedown mouseup").each(function(Ca){var Ba=I[Ca];Ia[Ba.sel]=Ba.fn;if(Ba.isDefault)va=Ca;Ca=function(tb){var Ta=Ba;if(tb.type==="keydown"){var ia=a(Ta.parent+
"_show").hasClass("tool_button_current"),wb=a(Ta.parent+"_show").attr("data-curopt");a.each(q[Ba.parent],function(Fa,Va){if(Va.sel==wb)Ta=!tb.shiftKey||!ia?Va:q[Ba.parent][Fa+1]||q[Ba.parent][0]})}if(a(this).hasClass("disabled"))return false;xa(X)&&Ta.fn();var bb=Ta.icon?a.getSvgIcon(Ta.icon,true):a(Ta.sel).children().eq(0).clone();bb[0].setAttribute("width",ja.width());bb[0].setAttribute("height",ja.height());ja.children(":not(.flyout_arrow_horiz)").remove();ja.append(bb).attr("data-curopt",Ta.sel)};
a(this).mouseup(Ca);Ba.key&&a(document).bind("keydown",Ba.key[0]+" shift+"+Ba.key[0],Ca)});if(va)ja.attr("data-curopt",I[va].sel);else ja.attr("data-curopt")||ja.attr("data-curopt",I[0].sel);var ya,Da=a(X).position();a(A).css({left:Da.left+34,top:Da.top+77});ja.mousedown(function(Ca){a("#tools_shapelib").is(":visible")&&xa(X,false);if(ja.hasClass("disabled"))return false;var Ba=a(A),tb=Da.left+34,Ta=Ba.width()*-1,ia=Ba.data("shown_popop")?200:0;ya=setTimeout(function(){ja.data("isLibrary")?Ba.css("left",
tb).show():Ba.css("left",Ta).show().animate({left:tb},150);Ba.data("shown_popop",true)},ia);Ca.preventDefault()}).mouseup(function(){clearTimeout(ya);var Ca=a(this).attr("data-curopt");if(ja.data("isLibrary")&&a(X.replace("_show","")).is(":visible"))xa(X,true);else xa(X)&&Ca in Ia&&Ia[Ca]()})});Kb()},Ga=function(q,A){return a("<div>",{"class":"tools_flyout",id:q}).appendTo("#svg_editor").append(A)},Cb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show"),A=q.offset();q=q.outerWidth();
a(this).css({left:(A.left+q)*S,top:A.top})})},Kb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show");if(!q.data("isLibrary")){var A=[];a(this).children().each(function(){A.push(this.title)});q[0].title=A.join(" / ")}})},nb,ab=function(q,A,I){var R=null;if(q.indexOf("url(#")===0){q=(q=f.getRefElem(q))?q.cloneNode(true):a("#"+I+"_color defs *")[0];R={alpha:A};R[q.tagName]=q}else R=q.indexOf("#")===0?{alpha:A,solidColor:q.substr(1)}:{alpha:A,solidColor:"none"};return new a.jGraduate.Paint(R)},
Ya=f.getResolution();if(d.baseUnit!=="px"){Ya.w=svgedit.units.convertUnit(Ya.w)+d.baseUnit;Ya.h=svgedit.units.convertUnit(Ya.h)+d.baseUnit}a(".canvas_width").val(Ya.w);a(".canvas_height").val(Ya.h);a("#docprops_button").on("click",function(){H()});var La=function(q){f.createLayer("background");cur_shape=f.addSvgElementFromJson({element:"rect",attr:{x:0,y:0,width:Ya.w,height:Ya.h,stroke:"none",id:"canvas_background",opacity:1,fill:q||a.pref("bkgd_color"),style:"pointer-events:none"}});f.setCurrentLayer("Layer 1");
f.setCurrentLayerPosition("1")};document.getElementById("canvas_background")?document.getElementById("canvas_background").getAttribute("fill"):La();if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),a.pref("bkgd_url"));else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));var Ea=c.setImageURL=function(q){q||(q=ea);f.setImageURL(q);a("#image_url").val(q);if(q.indexOf("data:")===0){a("#image_url").hide();a("#change_image_url").show()}else{f.embedImage(q,function(A){A?a("#url_notice").hide():a("#url_notice").show();
ea=q});a("#image_url").show();a("#change_image_url").hide()}},qb=function(q){var A=Math.min(Math.max(12+q.value.length*6,50),300);a(q).width(A)},Ja=function(){var q=Z;if(q!=null&&!q.parentNode)q=null;var A=f.getCurrentDrawing().getCurrentLayerName(),I=f.getMode(),R=d.baseUnit!=="px"?d.baseUnit:null,X=I=="pathedit",ja=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 va=q.nodeName,ya=f.getRotationAngle(q);a("#angle").val(Math.round(ya));ya=f.getBlur(q);a("#blur").val(ya);a("#blur_slider").slider("option","value",ya);f.addedNew&&va==="image"&&f.getHref(q).indexOf("data:")!==0&&L();if(!X&&I!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");if(["line","circle","ellipse"].indexOf(va)>=
0)a("#xy_panel").hide();else{var Da,Ca;if(["g","polyline","path"].indexOf(va)>=0){if(I=f.getStrokedBBox([q])){Da=I.x;Ca=I.y}}else{Da=q.getAttribute("x");Ca=q.getAttribute("y")}if(R){Da=svgedit.units.convertUnit(Da);Ca=svgedit.units.convertUnit(Ca)}a("#selected_x").val(Math.round(Ca)||0);a("#selected_y").val(Math.round(Da)||0);a("#xy_panel").show()}["image","text","path","g","use"].indexOf(va)==-1&&a(".action_path_convert_selected").removeClass("disabled");va==="path"&&a(".action_path_selected").removeClass("disabled")}else{A=
ta.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!ta.canDeleteNodes);fa("#tool_openclose_path",ta.closed_subpath?"open_path":"close_path");if(A){X=a("#seg_type");if(R){A.x=svgedit.units.convertUnit(A.x);A.y=svgedit.units.convertUnit(A.y)}a("#path_node_x").val(Math.round(A.x));a("#path_node_y").val(Math.round(A.y));A.type?X.val(A.type).removeAttr("disabled"):X.val(4).attr("disabled","disabled")}return}R=
{g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:[],use:[]};var Ba=q.tagName;a(q).data("gsvg")&&a("#g_panel").show();Ba=="path"&&a("#path_panel").show();if(R[Ba]){R=R[Ba];a("#"+Ba+"_panel").show();a.each(R,function(tb,Ta){var ia=q.getAttribute(Ta);if(d.baseUnit!=="px"&&q[Ta])ia=svgedit.units.convertUnit(q[Ta].baseVal.value);a("#"+Ba+"_"+Ta).val(Math.round(ia)||0)});if(Ba=="text"){a("#text_panel").css("display",
"inline");f.getItalic()?a("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):a("#tool_italic").removeClass("push_button_pressed").addClass("tool_button");f.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);f.addedNew&&setTimeout(function(){a("#text").focus().select()},
100)}else if(Ba=="image")Ea(f.getHref(q));else if(Ba==="g"||Ba==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");R=f.getTitle();va=a("#g_title")[0];va.value=R;qb(va);Ba=="use"?va.setAttribute("disabled","disabled"):va.removeAttribute("disabled")}}ja[(Ba==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");ja[(Ba==="g"||!Aa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(Aa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");
ja.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else ja.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");ha.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");ha.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");f.addedNew=false;if(q&&!X||Aa){a("#selLayerNames").removeAttr("disabled").val(A);pa.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}else a("#selLayerNames").attr("disabled",
"disabled")};a("#text").focus(function(){});a("#text").blur(function(){});f.bind("selected",function(q,A){var I=f.getMode();I==="select"&&oa();I=I=="pathedit";Z=A.length==1||A[1]==null?A[0]:null;Aa=A.length>=2&&A[1]!=null;if(Z!=null)if(!I){if(Z!=null)switch(Z.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var R=null,X=Z.getElementsByTagName("*"),ja=0,va=X.length;ja<va;ja++){var ya=X[ja].getAttribute("stroke-width");if(ja===0)R=ya;else if(R!==ya)R=null}a("#stroke_width").val(R===
null?"":R);la.fill.update(true);la.stroke.update(true);break;default:la.fill.update(true);la.stroke.update(true);a("#stroke_width").val(Z.getAttribute("stroke-width")||1);a("#stroke_style").val(Z.getAttribute("stroke-dasharray")||"none");R=Z.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+R).length!=0&&w(a("#linejoin_"+R)[0]);R=Z.getAttribute("stroke-linecap")||"butt";a("#linecap_"+R).length!=0&&w(a("#linecap_"+R)[0])}if(Z!=null){R=(Z.getAttribute("opacity")||1)*100;a("#group_opacity").val(R);
a("#opac_slider").slider("option","value",R);a("#elem_id").val(Z.id)}}a("#path_node_panel").toggle(I);a("#tools_bottom_2,#tools_bottom_3").toggle(!I);if(I){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");fa("#tool_select","select_node");Aa=false;if(A.length)Z=A[0]}else{if(A[0]){I=f.selectorManager.requestSelector(A[0]);I.reset(A[0]);I.selectorRect.setAttribute("display","inline")}fa("#tool_select",
"select")}Ja();f.runExtensions("selectedChanged",{elems:A,selectedElement:Z,multiselected:Aa})});f.bind("transition",function(q,A){var I=f.getMode(),R=A[0];if(R){Aa=A.length>=2&&A[1]!=null;if(!Aa)switch(I){case "rotate":I=f.getRotationAngle(R);a("#angle").val(Math.round(I));a("#tool_reorient").toggleClass("disabled",I==0)}f.runExtensions("elementTransition",{elems:A})}});f.bind("changed",function(q,A){var I=f.getMode();I==="select"&&oa();for(var R=0;R<A.length;++R){var X=A[R];if(X&&X.tagName==="svg"){Ab();
Rb()}else if(X&&Z&&Z.parentNode==null)Z=X}c.show_save_warning=true;Ja();if(Z&&I==="select"){la.fill.update();la.stroke.update()}f.runExtensions("elementChanged",{elems:A})});f.bind("saved",function(q,A){c.show_save_warning=false;A='<?xml version="1.0"?>\n'+A;var I=navigator.userAgent;if(~I.indexOf("Chrome")&&a.browser.version>=533||~I.indexOf("MSIE"))D(0,true);else{var R=q.open("data:image/svg+xml;base64,"+ca.encode64(A)),X=a.pref("save_notice_done");if(X!=="all"){var ja=e.notification.saveFromBrowser.replace("%s",
"SVG");if(I.indexOf("Gecko/")!==-1)if(A.indexOf("<defs")!==-1){ja+="\n\n"+e.notification.defsFailOnSave;a.pref("save_notice_done","all");X="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");X!=="part"&&R.alert(ja)}}});f.bind("exported",function(q,A){var I=A.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var R=a("#export_canvas")[0];R.width=f.contentW;R.height=f.contentH;canvg(R,A.svg,{renderCallback:function(){var X=R.toDataURL("image/png");
ba.location.href=X;if(a.pref("export_notice_done")!=="all"){X=e.notification.saveFromBrowser.replace("%s","PNG");if(I.length)X+="\n\n"+e.notification.noteTheseIssues+"\n \u2022 "+I.join("\n \u2022 ");a.pref("export_notice_done","all");ba.alert(X)}}})});f.bind("zoomed",Oa);f.bind("contextset",function(q,A){var I="";if(A){var R="";I='<a href="#" data-root="y">'+f.getCurrentDrawing().getCurrentLayerName()+"</a>";a(A).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){R+=" > "+this.id;
I+=this!==A?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Sa=R}else Sa=null;a("#cur_context_panel").toggle(!!A).html(I);W()});f.bind("extension_added",function(q,A){function I(){if(nb){clearTimeout(nb);nb=null}X||(nb=setTimeout(function(){X=true;za(b.iconsize)},50))}var R=false,X=false,ja=true,va=function(){if(A.callback&&!R&&ja){R=true;A.callback()}},ya=[];A.context_tools&&a.each(A.context_tools,function(Ta,ia){var wb=ia.container_id?' id="'+ia.container_id+'"':"",bb=a("#"+ia.panel);bb.length||
(bb=a("<div>",{id:ia.panel}).appendTo("#tools_top"));switch(ia.type){case "tool_button":var Fa='<div class="tool_button">'+ia.id+"</div>",Va=a(Fa).appendTo(bb);ia.events&&a.each(ia.events,function(eb,lb){a(Va).bind(eb,lb)});break;case "select":Fa="<label"+wb+'><select id="'+ia.id+'">';a.each(ia.options,function(eb,lb){Fa+='<option value="'+eb+'"'+(eb==ia.defval?" selected":"")+">"+lb+"</option>"});Fa+="</select></label>";var Ha=a(Fa).appendTo(bb).find("select");a.each(ia.events,function(eb,lb){a(Ha).bind(eb,
lb)});break;case "button-select":Fa='<div id="'+ia.id+'" class="dropdown toolset" title="'+ia.title+'"><div id="cur_'+ia.id+'" class="icon_label"></div><button></button></div>';wb=a('<ul id="'+ia.id+'_opts"></ul>').appendTo("#option_lists");ia.colnum&&wb.addClass("optcols"+ia.colnum);a(Fa).appendTo(bb).children();ya.push({elem:"#"+ia.id,list:"#"+ia.id+"_opts",title:ia.title,callback:ia.events.change,cur:"#cur_"+ia.id});break;case "input":Fa="<label"+wb+'><span id="'+ia.id+'_label">'+ia.label+':</span><input id="'+
ia.id+'" title="'+ia.title+'" size="'+(ia.size||"4")+'" value="'+(ia.defval||"")+'" type="text"/></label>';var kb=a(Fa).appendTo(bb).find("input");ia.spindata&&kb.SpinButton(ia.spindata);ia.events&&a.each(ia.events,function(eb,lb){kb.bind(eb,lb)})}});if(A.buttons){var Da={},Ca={},Ba=A.svgicons,tb={};a.each(A.buttons,function(Ta,ia){for(var wb,bb=ia.id,Fa=Ta;a("#"+bb).length;)bb=ia.id+"_"+ ++Fa;if(Ba){Da[bb]=ia.icon;Fa=ia.svgicon?ia.svgicon:ia.id;if(ia.type=="app_menu")Ca["#"+bb+" > div"]=Fa;else Ca["#"+
bb]=Fa}else wb=ia.type=="menu"?"":a('<img src="'+ia.icon+'">');var Va,Ha;switch(ia.type){case "mode_flyout":case "mode":Va="tool_button";if(ia.cls)Va+=" "+ia.cls;Ha="#tools_left";break;case "context":Va="tool_button";Ha="#"+ia.panel;a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top");break;case "menu":Va="menu_item tool_button";Ha="#"+(ia.after||ia.panel);break;case "app_menu":Va="";Ha=ia.parent||"#main_menu ul";a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top")}var kb=a(ia.list||
ia.type=="app_menu"?"<li/>":"<div/>").attr("id",bb).attr("title",ia.title).addClass(Va);if(!ia.includeWith&&!ia.list){if("position"in ia)a(Ha).children().eq(ia.position).before(kb);else ia.type!="menu"||!ia.after?kb.appendTo(Ha):a(Ha).after(kb);if(ia.type=="mode_flyout"){Fa=a(kb);Va=Fa.parent();if(!Fa.parent().hasClass("tools_flyout")){var eb=Fa[0].id.replace("tool_","tools_"),lb=Fa.clone().attr("id",eb+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Fa.before(lb);Va=Ga(eb,Fa);Va.data("isLibrary",
true);lb.data("isLibrary",true)}Ca["#"+eb+"_show"]=ia.id;bb=tb["#"+Va[0].id]=[{sel:"#"+bb,fn:ia.events.click,icon:ia.id,isDefault:true},Yb]}else if(ia.type=="app_menu"||ia.type=="menu")kb.append(ia.title)}else if(ia.list){kb.addClass("push_button");a("#"+ia.list+"_opts").append(kb);if(ia.isDefault){a("#cur_"+ia.list).append(kb.children().clone());Fa=ia.svgicon?ia.svgicon:ia.id;Ca["#cur_"+ia.list]=Fa}}else if(ia.includeWith){Ha=ia.includeWith;Fa=a(Ha.button);Va=Fa.parent();if(!Fa.parent().hasClass("tools_flyout")){eb=
Fa[0].id.replace("tool_","tools_");lb=Fa.clone().attr("id",eb+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Fa.before(lb);Va=Ga(eb,Fa)}var Yb=oc.getButtonData(Ha.button);if(Ha.isDefault)Ca["#"+eb+"_show"]=ia.id;bb=tb["#"+Va[0].id]=[{sel:"#"+bb,fn:ia.events.click,icon:ia.id,key:ia.key,isDefault:ia.includeWith?ia.includeWith.isDefault:0},Yb];eb="position"in Ha?Ha.position:"last";Yb=Va.children().length;if(!isNaN(eb)&&eb>=0&&eb<Yb)Va.children().eq(eb).before(kb);else{Va.append(kb);bb.reverse()}}Ba||
kb.append(wb);ia.list||a.each(ia.events,function(Jb,Xb){if(Jb=="click")if(ia.type=="mode"){ia.includeWith?kb.bind(Jb,Xb):kb.bind(Jb,function(){xa(kb)&&Xb()});if(ia.key){a(document).bind("keydown",ia.key,Xb);ia.title&&kb.attr("title",ia.title+" ["+ia.key+"]")}}else kb.bind(Jb,Xb);else kb.bind(Jb,Xb)});Qa(tb)});a.each(ya,function(){sb(this.elem,this.list,this.callback,{seticon:true})});if(Ba)ja=false;a.svgIcons(Ba,{w:27,h:27,id_match:false,no_img:!O,fallback:Da,placement:Ca,callback:function(){b.iconsize&&
b.iconsize!="m"&&I();ja=true;va()}})}va()});f.textActions.setInputElem(a("#text")[0]);var Za='<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,A){Za+='<div class="palette_item" style="background-color: '+A+';" data-rgb="'+A+'"></div>'});a("#palette").append(Za);Za="";a.each(["#FFF","#888","#000"],function(){Za+='<div class="color_block" style="background-color:'+this+';"></div>'});a("#bg_blocks").append(Za);var Ma=a("#bg_blocks div");Ma.each(function(){a(this).click(function(){Ma.removeClass("cur_background");a(this).addClass("cur_background")})});if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),a.pref("bkgd_url"));
else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));if(a.pref("img_save")){b.img_save=a.pref("img_save");a("#image_save_opts input").val([b.img_save])}var ob=function(q){var A=q.value/100;if(A<0.0010)q.value=0.1;else{q=f.getZoom();Oa(window,{width:0,height:0,x:(ra[0].scrollLeft+ra.width()/2)/q,y:(ra[0].scrollTop+ra.height()/2)/q,zoom:A},true)}},xb=function(q,A){if(A==null)A=q.value;a("#group_opacity").val(A);if(!q||!q.handle)a("#opac_slider").slider("option","value",A);f.setOpacity(A/100)},
fb=function(q,A,I){if(A==null)A=q.value;a("#blur").val(A);var R=false;if(!q||!q.handle){a("#blur_slider").slider("option","value",A);R=true}I?f.setBlurNoUndo(A):f.setBlur(A,R)},ib=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){f.setStrokeAttr("stroke-dasharray",a(this).val());ib()});a("#stroke_linejoin").change(function(){f.setStrokeAttr("stroke-linejoin",a(this).val());ib()});a("select").change(function(){a(this).blur()});var Lb=false;a("#selLayerNames").change(function(){var q=
this.options[this.selectedIndex].value,A=e.notification.QmoveElemsToLayer.replace("%s",q),I=function(R){if(R){Lb=true;f.moveSelectedToLayer(q);f.clearSelection();Ab()}};if(q)Lb?I(true):a.confirm(A,I)});a("#font_family").change(function(){f.setFontFamily(this.value)});a("#seg_type").change(function(){f.setSegType(a(this).val())});a("#text").keyup(function(){f.setTextContent(this.value)});a("#image_url").change(function(){Ea(this.value)});a("#link_url").change(function(){this.value.length?f.setLinkURL(this.value):
f.removeHyperlink()});a("#g_title").change(function(){f.setGroupTitle(this.value)});a(".attr_changer").change(function(){var q=this.getAttribute("data-attr"),A=this.value;if(svgedit.units.isValidUnit(q,A,Z))this.blur();else{a.alert(e.notification.invalidAttrValGiven);this.value=Z.getAttribute(q);return false}if(q!=="id")if(isNaN(A))A=f.convertToNum(q,A);else if(d.baseUnit!=="px"){var I=svgedit.units.getTypeMap();if(Z[q]||f.getMode()==="pathedit"||q==="x"||q==="y")A*=I[d.baseUnit]}if(q==="id"){q=Z;
f.clearSelection();q.id=A;f.addToSelection([q],true)}else f.changeSelectedAttribute(q,A);this.blur()});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"),A=q?"stroke":"fill",I=a(this).attr("data-rgb"),R=null;if(I==="transparent"||I==="initial"||I==="#none"){I="none";R=new a.jGraduate.Paint}else R=new a.jGraduate.Paint({alpha:100,solidColor:I.substr(1)});la[A].setPaint(R);
if(q){f.setColor("stroke",I);I!="none"&&f.getStrokeOpacity()!=1&&f.setPaintOpacity("stroke",1)}else{f.setColor("fill",I);I!="none"&&f.getFillOpacity()!=1&&f.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");Ub()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Ub()});var xa=function(q,A){if(a(q).hasClass("disabled"))return false;
if(a(q).parent().hasClass("tools_flyout"))return true;var I=I||"normal";A||a(".tools_flyout").fadeOut(I);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,A=null,I=ra[0],R=false,X=false;a("#svgcanvas").bind("mousemove mouseup",function(ja){if(R!==false){I.scrollLeft-=ja.clientX-q;I.scrollTop-=ja.clientY-A;q=ja.clientX;A=ja.clientY;if(ja.type===
"mouseup")R=false;return false}}).mousedown(function(ja){if(ja.button===1||X===true){R=true;q=ja.clientX;A=ja.clientY;return false}});a(window).mouseup(function(){R=false});a(document).bind("keydown","space",function(ja){f.spaceKey=X=true;ja.preventDefault()}).bind("keyup","space",function(ja){ja.preventDefault();f.spaceKey=X=false}).bind("keydown","alt",function(){f.getMode()==="zoom"&&ra.addClass("out")}).bind("keyup","alt",function(){f.getMode()==="zoom"&&ra.removeClass("out")})})();var ub=a(".menu"),
rb=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").live("click",function(q){rb(q)});a("svg, body").on("mousedown",function(q){top!=self&&!q.isTrigger&&typeof top.exports.setEditorFocus==
"function"&&top.exports.setEditorFocus();if(!a(q.target).hasClass("menu_title"))if(!a(q.target).hasClass("disabled")&&a(q.target).hasClass("menu_item"))rb(q);else{a("#menu_bar").removeClass("active");a("#tools_shapelib").is(":visible")&&!a(q.target).parents("#tools_shapelib_show, #tools_shapelib").length&&a("#tools_shapelib").hide();q.target.nodeName.toLowerCase()!="input"&&a("input").blur()}});var yb=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(q,A,
I,R){if(q.altKey){q.preventDefault();q=f.getZoom()*100;A=yb.length;for(Bb=0;Bb<A;Bb++){I=Math.min(A,Bb+1);if(R>0)zoom=yb[Bb]<=q?yb[I]:zoom;if(R<0)zoom=yb[Bb]<q?yb[Bb]:zoom}zoom&&ob({value:zoom})}});a(".menu_title").on("click",function(){a("#menu_bar").toggleClass("active")});a(".menu_title").on("mouseover",function(){ub.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(q,A,I){if(a(q).length!=0){var R=a(q).find("button"),X=a(q).find("ul").attr("id",a(q)[0].id+"-list");
I||a("#option_lists").append(X);var ja=false;I&&a(q).addClass("dropup");X.find("li").bind("mouseup",A);a(window).mouseup(function(){if(!ja){R.removeClass("down");X.hide()}ja=false});R.bind("mousedown",function(){if(R.hasClass("down")){R.removeClass("down");X.hide()}else{R.addClass("down");if(!I){var va=a(q).offset();X.css({top:va.top,left:va.left-110})}X.show();ja=true}}).hover(function(){ja=true}).mouseout(function(){ja=false})}};var sb=function(q,A,I,R){var X=a(q);A=a(A);var ja=false,va=R.dropUp;
va&&a(q).addClass("dropup");A.find("li").bind("mouseup",function(){if(R.seticon){fa("#cur_"+X[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}I.apply(this,arguments)});a(window).mouseup(function(){if(!ja){X.removeClass("down");A.hide();A.css({top:0,left:0})}ja=false});A.height();a(q).bind("mousedown",function(){var ya=a(q).offset();if(va){ya.top-=A.height();ya.left+=8}else ya.top+=a(q).height();a(A).offset(ya);if(X.hasClass("down")){X.removeClass("down");A.hide();
A.css({top:0,left:0})}else{X.addClass("down");A.show();ja=true;return false}}).hover(function(){ja=true}).mouseout(function(){ja=false});R.multiclick&&A.mousedown(function(){ja=true})};c.addDropDown("#font_family_dropdown",function(){a(this).text();a("#font_family").val(a(this).text()).change()});c.addDropDown("#opacity_dropdown",function(){if(!a(this).find("div").length){var q=parseInt(a(this).text().split("%")[0]);xb(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,A){xb(A)}});c.addDropDown("#blur_dropdown",a.noop);var mb=false;a("#blur_slider").slider({max:10,step:0.1,stop:function(q,A){mb=false;fb(A);a("#blur_dropdown li").show();a(window).mouseup()},start:function(){mb=true},slide:function(q,A){fb(A,null,mb)}});c.addDropDown("#zoom_dropdown",function(){var q=a(this),A=q.attr("data-val");A?Oa(window,A):ob({value:parseInt(q.text())})},true);sb("#stroke_linecap","#linecap_opts",
function(){w(this,true)},{dropUp:true});sb("#stroke_linejoin","#linejoin_opts",function(){w(this,true)},{dropUp:true});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var q=this.id.replace("tool_pos","").charAt(0);f.alignSelectedElements(q,"page")})});(function(){var q,A=function(){a(q).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){q=this;U="toolbars";ra.mousedown(A)}).blur(function(){U="canvas";ra.unbind("mousedown",A);f.getMode()==
"textedit"&&a("#text").focus()})})();var Gb=function(){if(xa("#tool_select")){f.setMode("select");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}")}},Hb=function(){xa("#tool_fhpath")&&f.setMode("fhpath")},Mb=function(){xa("#tool_line")&&f.setMode("line")},Nb=function(){xa("#tool_rect")&&f.setMode("rect")},ma=function(){xa("#tool_ellipse")&&f.setMode("ellipse")},Y=function(){xa("#tool_image")&&f.setMode("image")},na=function(){xa("#tool_zoom")&&
f.setMode("zoom")},K=function(){if(xa("#tool_zoom")){E();oa()}},N=function(){xa("#tool_text")&&f.setMode("text")},aa=function(){xa("#tool_path")&&f.setMode("path")},Pa=function(){if(Z!=null||Aa)f.deleteSelectedElements()},Xa=function(){if(Z!=null||Aa){window.event.type==="keydown"&&db(a("#edit_menu"));f.cutSelectedElements()}},hb=function(){if(Z!=null||Aa){window.event.type==="keydown"&&db(a("#edit_menu"));f.copySelectedElements()}},pb=function(){window.event.type==="keydown"&&db(a("#edit_menu"));
var q=f.getZoom(),A=(ra[0].scrollLeft+ra.width()/2)/q-f.contentW;q=(ra[0].scrollTop+ra.height()/2)/q-f.contentH;f.pasteElements("point",A,q)},Db=function(){if(Z!=null){window.event.type==="keydown"&&db(a("#object_menu"));f.moveToTopSelectedElement()}},cb=function(){if(Z!=null){window.event.type==="keydown"&&db(a("#object_menu"));f.moveToBottomSelectedElement()}},Eb=function(){if(Z!=null){window.event.type==="keydown"&&db(a("#object_menu"));f.moveUpDownSelected("Up")}},$a=function(){if(Z!=null){window.event.type===
"keydown"&&db(a("#object_menu"));f.moveUpDownSelected("Down")}},Fb=function(q){if(Z!=null){window.event.type==="keydown"&&db(a("#object_menu"));f.moveUpDownSelected(q)}},Pb=function(){if(Z!=null){f.convertToPath();elems=f.getSelectedElems();f.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");f.setMode("pathedit");ta.toEditMode(elems[0]);f.clearSelection()}},$b=function(){Z!=null&&ta.reorient()},Zb=function(){if(Z!=null||Aa)a.prompt(e.notification.enterNewLinkURL,
"http://",function(q){q&&f.makeHyperlink(q)})},gb=function(q,A){if(Z!=null||Aa){if(d.gridSnapping){var I=f.getZoom()*d.snappingStep;q*=I;A*=I}a("input").blur();f.moveSelectedElements(q,A)}},Ua=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);ta.linkControlPoints(q)},
ic=function(){ta.getNodePoint()&&ta.clonePathNode()},ec=function(){ta.getNodePoint()&&ta.deletePathNode()},cc=function(){var q=a("#tool_add_subpath"),A=!q.hasClass("push_button_pressed");A?q.addClass("push_button_pressed").removeClass("tool_button"):q.removeClass("push_button_pressed").addClass("tool_button");ta.addSubPath(A)},fc=function(){ta.opencloseSubPath()},gc=function(){f.cycleElement(1)},Tb=function(){f.cycleElement(0)},Sb=function(q,A){if(!(Z==null||Aa)){q||(A*=-1);var I=a("#angle").val()*
1+A;f.setRotationAngle(I);Ja()}},mc=function(){var q=d.dimensions;a.confirm(e.notification.QwantToClear,function(A){if(A){oa();f.clear();f.setResolution(q[0],q[1]);Rb(true);E();Ab();Ja();la.fill.prep();la.stroke.prep();f.runExtensions("onNewDocument")}})},Vb=function(){f.setBold(!f.getBold());Ja();return false},vb=function(){f.setItalic(!f.getItalic());Ja();return false},kc=function(){if(!l.pngsave){var q=e.notification.loadingImage;ba=window.open("data:text/html;charset=utf-8,<title>"+q+"</title><h1>"+
q+"</h1>")}window.canvg?f.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){f.rasterExport()})})},jc=function(){f.open()},Wb=function(){},db=function(q){var A=q.prev();A.css("background","#09f");setTimeout(function(){A.css("background","")},200)},dc=function(){if(ha.getUndoStackSize()>0){window.event.type==="keydown"&&db(a("#edit_menu"));ha.undo();Ab()}},g=function(){if(ha.getRedoStackSize()>0){window.event.type==="keydown"&&db(a("#edit_menu"));ha.redo();
Ab()}},h=function(){if(Aa)f.groupSelectedElements();else Z&&f.ungroupSelectedElement()},k=function(){window.event.type==="keydown"&&db(a("#edit_menu"));f.cloneSelectedElements(20,20)},v=function(){var q=this.id.replace("tool_align","").charAt(0);f.alignSelectedElements(q,a("#align_relative_to").val())},s=function(){var q=document.querySelector("#tool_stroke rect"),A=document.querySelector("#tool_fill rect"),I=A.getAttribute("fill"),R=q.getAttribute("fill");q=parseFloat(q.getAttribute("stroke-opacity"));
if(isNaN(q))q=100;A=parseFloat(A.getAttribute("fill-opacity"));if(isNaN(A))A=100;R=ab(R,q,"stroke");I=ab(I,A,"fill");la.fill.setPaint(R,true);la.stroke.setPaint(I,true)},E=function(q){var A=f.getResolution();q=q?A.zoom*q:1;a("#zoom").val(q*100);f.setZoom(q);B();Rb(true)},z=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");ra.toggleClass("wireframe");if(!tc){var q=a("#wireframe_rules");
q.length?q.empty():a('<style id="wireframe_rules"></style>').appendTo("head");B()}},t=function(){f.clearSelection();a("#tool_canvas").trigger("click")},C=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},F=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);d.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);d.showRulers=
true}a("#rulers").toggle(!!d.showRulers)},B=function(){if(!tc){var q="#workarea.wireframe #svgcontent * { stroke-width: "+1/f.getZoom()+"px; }";a("#wireframe_rules").text(ra.hasClass("wireframe")?q:"")}},D=function(q,A){if(!Ka){Ka=true;a("#save_output_btns").toggle(!!A);a("#tool_source_back").toggle(!A);var I=sa=f.getSvgString();a("#svg_source_textarea").val(I);a("#svg_source_editor").fadeIn();P();a("#svg_source_textarea").focus()}},H=function(){if(!Ra){Ra=true;a("#image_save_opts input").val([b.img_save]);
var q=f.getResolution();if(d.baseUnit!=="px"){q.w=svgedit.units.convertUnit(q.w)+d.baseUnit;q.h=svgedit.units.convertUnit(q.h)+d.baseUnit}a(".canvas_width").val(q.w);a(".canvas_height").val(q.h);a("#canvas_title").val(f.getDocumentTitle());a("#svg_docprops").show()}},G=function(){if(!Na){Na=true;var q=a("#bg_blocks div"),A=a.pref("bkgd_color"),I=a.pref("bkgd_url");q.each(function(){var R=a(this),X=R.css("background-color")==A;R.toggleClass("cur_background",X);X&&a("#canvas_bg_url").removeClass("cur_background")});
A||q.eq(0).addClass("cur_background");I&&a("#canvas_bg_url").val(I);a("grid_snapping_step").attr("value",d.snappingStep);d.gridSnapping==true?a("#grid_snapping_on").attr("checked","checked"):a("#grid_snapping_on").removeAttr("checked");a("#svg_prefs").show()}},P=function(){var q=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",q)},Q=function(){if(Ka){var q=function(){f.clearSelection();zb();E();Ab();W();la.fill.prep();la.stroke.prep()};f.setSvgString(a("#svg_source_textarea").val())?
q():a.confirm(e.notification.QerrorsRevertToSource,function(A){if(!A)return false;q()});oa()}},W=function(q){q=q||f.getDocumentTitle();q=Wa+(q?": "+q:"");a("title:first").text(q)},ua=function(){var q=a("#canvas_width"),A=q.val(),I=a("#canvas_height"),R=I.val();if(A!="fit"&&!svgedit.units.isValidUnit("width",A)){a.alert(e.notification.invalidAttrValGiven);q.parent().addClass("error");return false}q.parent().removeClass("error");if(R!="fit"&&!svgedit.units.isValidUnit("height",R)){a.alert(e.notification.invalidAttrValGiven);
I.parent().addClass("error");return false}I.parent().removeClass("error");if(!f.setResolution(A,R)){a.alert(e.notification.noContentToFitTo);return false}b.img_save=a("#image_save_opts :checked").val();a.pref("img_save",b.img_save);Rb();Qb()},wa=function(){var q=a("#bg_blocks div.cur_background").css("background-color")||"#FFF";p(q,a("#canvas_bg_url").val());q=a("#lang_select").val();q!=b.lang&&c.putLocale(q);za(a("#iconsize").val());d.gridSnapping=a("#grid_snapping_on")[0].checked;d.snappingStep=
a("#grid_snapping_step").val();d.showRulers=a("#show_rulers")[0].checked;a("#rulers").toggle(d.showRulers);d.showRulers&&da();d.baseUnit=a("#base_unit").val();f.setConfig(d);Rb();Ib()},fa=c.setIcon=function(q,A){var I=typeof A==="string"?a.getSvgIcon(A,true):A.clone();I?a(q).find("img").replaceWith(I):console.log("NOTE: Icon image missing: "+A)},ka;ka=function(){var q=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,A=document.getElementsByTagName("script")[0],I;for(I in A.style)if(q.test(I))return I.match(q)[0];
if("WebkitOpacity"in A.style)return"Webkit";if("KhtmlOpacity"in A.style)return"Khtml";return""}();var qa=function(q,A){ka.toLowerCase();var I=["top","left","bottom","right"];q.each(function(){for(var R=a(this),X=R.outerWidth()*(A-1),ja=R.outerHeight()*(A-1),va=0;va<4;va++){var ya=I[va],Da=R.data("orig_margin-"+ya);if(Da==null){Da=parseInt(R.css("margin-"+ya));R.data("orig_margin-"+ya,Da)}Da=Da*A;if(ya==="right")Da+=X;else if(ya==="bottom")Da+=ja;R.css("margin-"+ya,Da)}})},za=c.setIconSize=function(q,
A){if(!(q==b.size&&!A)){var I=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"),R=1;R=typeof q=="number"?q:{s:0.75,m:1,l:1.25,xl:1.5}[q];c.tool_scale=S=R;Cb();var X=I.parents(":hidden");X.css("visibility","hidden").show();qa(I,R);X.css("visibility","visible").hide();a.pref("iconsize",q);a("#iconsize").val(q);X={"#tools_top":{left:50,height:72},
"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}};I=a("#tool_size_rules");if(I.length)I.empty();else I=a('<style id="tool_size_rules"></style>').appendTo("head");if(q!="m"){var ja="";a.each(X,function(va,ya){va="#svg_editor "+va.replace(/,/g,", #svg_editor");ja+=va+"{";a.each(ya,function(Da,Ca){if(typeof Ca==="number")var Ba=Ca*R+"px";else if(Ca[q]||Ca.all)Ba=Ca[q]||Ca.all;ja+=Da+":"+Ba+";"});ja+="}"});X="-"+ka.toLowerCase()+"-";ja+="#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{"+
X+"transform: scale("+R+");} #svg_editor div.toolset .toolset {"+X+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+X+"transform: scale("+1/R+");}";I.text(ja)}Cb()}},jb=function(){a("#dialog_box").hide();if(!Ka&&!Ra&&!Na)Sa&&f.leaveContext();else{if(Ka)sa!==a("#svg_source_textarea").val()?a.confirm(e.notification.QignoreSourceChanges,function(q){q&&zb()}):zb();else if(Ra)Qb();else Na&&Ib();Ub()}},zb=function(){a("#svg_source_editor").hide();Ka=false;a("#svg_source_textarea").blur()},
Qb=function(){a("#svg_docprops").hide();a("#canvas_width,#canvas_height").removeAttr("disabled");a("#resolution")[0].selectedIndex=0;a("#image_save_opts input").val([b.img_save]);Ra=false},Ib=function(){a("#svg_prefs").hide();Na=false},Ob={width:a(window).width(),height:a(window).height()},Ub=a.noop,ac;svgedit.browser.isIE()&&function(){Ub=function(){if(ra[0].scrollLeft===0&&ra[0].scrollTop===0){ra[0].scrollLeft=ac.left;ra[0].scrollTop=ac.top}};ac={left:ra[0].scrollLeft,top:ra[0].scrollTop};a(window).resize(Ub);
svgEditor.ready(function(){setTimeout(function(){Ub()},500)});ra.scroll(function(){ac={left:ra[0].scrollLeft,top:ra[0].scrollTop}})}();a(window).resize(function(){Ka&&P();a.each(Ob,function(q,A){var I=a(window)[q]();ra[0]["scroll"+(q==="width"?"Left":"Top")]-=(I-A)/2;Ob[q]=I})});(function(){ra.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=ra[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=ra[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});
a("#change_image_url").click(L);(function(){var q=["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],A="";a.each(q,function(I,R){A+="#tool_"+R+(I==q.length-1?",":"")});a(A).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(V&&!window.opera){V=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"];for(var Bb=V.length;Bb--;){var pc=document.getElementById(V[Bb]);if(pc!=null){var qc=pc.title,uc=qc.indexOf("Ctrl+");pc.title=[qc.substr(0,uc),"Cmd+",qc.substr(uc+5)].join("")}}}var rc=function(q){var A=q[0].id=="stroke_color"?"stroke":"fill",I=q[0].id=="canvas_color";if(I)A="canvas";var R=la[A].paint;q=A=="stroke"?"Pick a Stroke Paint and Opacity":
"Pick a Fill Paint and Opacity";I=I?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(I).jGraduate({paint:R,window:{pickerTitle:q},images:{clientPath:d.jGraduatePath},newstop:"inverse"},function(X){R=new a.jGraduate.Paint(X);la[A].setPaint(R);f.setPaint(A,R);a("#color_picker").hide()},function(){a("#color_picker").hide()})};V=function(q,A){var I=document.getElementById("canvas_background"),
R={color:"#fff",opacity:1};if(A=="stroke")R=d.initStroke;if(A=="fill")R=d.initFill;if(A=="canvas"&&I)if(I=I.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))R={color:("0"+parseInt(I[1],10).toString(16)).slice(-2)+("0"+parseInt(I[2],10).toString(16)).slice(-2)+("0"+parseInt(I[3],10).toString(16)).slice(-2),opacity:1};I=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+R.color+'" opacity="'+R.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',
"text/xml").documentElement;I=a(q)[0].appendChild(document.importNode(I,true));I.setAttribute("width",24.5);this.rect=I.firstChild;this.defs=I.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:R.color});this.type=A;this.setPaint=function(X,ja){this.paint=X;var va="none",ya=X.type,Da=X.alpha/100;switch(ya){case "solidColor":va=X[ya]=="none"||X[ya]=="one"?"none":"#"+X[ya];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);
this.grad=this.defs.appendChild(X[ya]);va="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",va);this.rect.setAttribute("opacity",Da);if(ja){f.setColor(this.type,va,true);f.setPaintOpacity(this.type,Da,true)}if(this.type=="canvas"){(ya=document.getElementById("canvas_background"))?ya.setAttribute("fill",va):La(va);console.log(ya.getAttribute("fill"))}};this.update=function(X){if(Z){var ja=this.type;switch(Z.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var va=
null,ya=Z.getElementsByTagName("*"),Da=0,Ca=ya.length;Da<Ca;Da++){var Ba=ya[Da].getAttribute(ja);if(Da===0)va=Ba;else if(va!==Ba){va=null;break}}if(va===null){ya=null;return}ya=va;va=1;break;default:va=parseFloat(Z.getAttribute(ja+"-opacity"));if(isNaN(va))va=1;ya=ja==="fill"?"black":"none";ya=Z.getAttribute(ja)||ya}if(X){f.setColor(ja,ya,true);f.setPaintOpacity(ja,va,true)}va*=100;this.setPaint(ab(ya,va,ja))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var X=
new a.jGraduate.Paint({copy:this.paint});f.setPaint(A,X)}}};la.fill=new V("#fill_color","fill");la.stroke=new V("#stroke_color","stroke");la.canvas=new V("#canvas_color","canvas");a("#stroke_width").val(d.initStroke.width);a("#group_opacity").val(d.initOpacity*100);V=la.fill.rect.cloneNode(false);V.setAttribute("style","vector-effect:non-scaling-stroke");var tc=V.style.vectorEffect==="non-scaling-stroke";V.removeAttribute("style");V=la.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"feGaussianBlur");typeof V.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(V).remove();setTimeout(function(){f.embedImage("images/placeholder.svg",function(q){if(!q){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);b.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",e.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))rc(a("#fill_color"));else{a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active")}});a("#tool_canvas").click(function(){rc(a("#canvas_color"))});a("#tool_stroke").click(function(){if(a("#tool_stroke").hasClass("active"))rc(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#group_opacityLabel").click(function(){a("#opacity_dropdown button").mousedown();a(window).mouseup()});a("#zoomLabel").click(function(){a("#zoom_dropdown button").mousedown();a(window).mouseup()});a("#tool_move_top").mousedown(function(q){a("#tools_stacking").show();
q.preventDefault()});a(".layer_button").mousedown(function(){a(this).addClass("layer_buttonpressed")}).mouseout(function(){a(this).removeClass("layer_buttonpressed")}).mouseup(function(){a(this).removeClass("layer_buttonpressed")});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("#layer_new").click(function(){var q=f.getCurrentDrawing().getNumLayers();do var A=e.layers.layer+" "+ ++q;while(f.getCurrentDrawing().hasLayer(A));a.prompt(e.notification.enterUniqueLayerName,A,function(I){if(I)if(f.getCurrentDrawing().hasLayer(I))a.alert(e.notification.dupeLayerName);else{f.createLayer(I);Ja();Ab()}})});a("#layer_delete").click(T);a("#layer_up").click(function(){J(-1)});a("#layer_down").click(function(){J(1)});a("#layer_rename").click(function(){a("#layerlist tr.layersel").prevAll();
var q=a("#layerlist tr.layersel td.layername").text();a.prompt(e.notification.enterNewLayerName,"",function(A){if(A)if(q==A||f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.layerHasThatName);else{f.renameCurrentLayer(A);Ab()}})});var bc=-1,lc=false,sc=false,vc=function(q){if(sc)if(bc!=-1){lc=true;q=bc-q.pageX;var A=a("#sidepanels"),I=parseInt(A.css("width"));if(I+q>300)q=300-I;else if(I+q<2)q=2-I;if(q!=0){bc-=q;I=a("#layerpanel");ra.css("right",parseInt(ra.css("right"))+q);A.css("width",
parseInt(A.css("width"))+q);I.css("width",parseInt(I.css("width"))+q);A=a("#ruler_x");A.css("right",parseInt(A.css("right"))+q)}}};a("#sidepanel_handle").mousedown(function(q){bc=q.pageX;a(window).mousemove(vc);sc=false;setTimeout(function(){sc=true},20)}).mouseup(function(){lc||wc();bc=-1;lc=false});a(window).mouseup(function(){bc=-1;lc=false;a("#svg_editor").unbind("mousemove",vc)});var wc=function(q){var A=parseInt(a("#sidepanels").css("width"));q=(A>2||q?2:150)-A;A=a("#sidepanels");var I=a("#layerpanel"),
R=a("#ruler_x");ra.css("right",parseInt(ra.css("right"))+q);A.css("width",parseInt(A.css("width"))+q);I.css("width",parseInt(I.css("width"))+q);R.css("right",parseInt(R.css("right"))+q)},xc=function(q){for(var A=Array(f.getCurrentDrawing().getNumLayers()),I=0;I<A.length;++I)A[I]=f.getCurrentDrawing().getLayerName(I);if(q)for(I=0;I<A.length;++I)A[I]!=q&&f.getCurrentDrawing().setLayerOpacity(A[I],0.5);else for(I=0;I<A.length;++I)f.getCurrentDrawing().setLayerOpacity(A[I],1)},Ab=function(){var q=a("#layerlist tbody"),
A=a("#selLayerNames");q.empty();A.empty();for(var I=f.getCurrentDrawing().getCurrentLayerName(),R=f.getCurrentDrawing().getNumLayers(),X=a.getSvgIcon("eye");R--;){var ja=f.getCurrentDrawing().getLayerName(R),va='<tr class="layer';if(ja==I)va+=" layersel";va+='">';va+=f.getCurrentDrawing().getLayerVisibility(ja)?'<td class="layervis"/><td class="layername" >'+ja+"</td></tr>":'<td class="layervis layerinvis"/><td class="layername" >'+ja+"</td></tr>";q.append(va);A.append('<option value="'+ja+'">'+ja+
"</option>")}if(X!==undefined){X.clone();a("td.layervis",q).append(X.clone());a.resizeSvgIcons({"td.layervis .svg_icon":14})}a("#layerlist td.layername").mouseup(function(ya){a("#layerlist tr.layer").removeClass("layersel");a(this.parentNode).addClass("layersel");f.setCurrentLayer(this.textContent);ya.preventDefault()}).mouseover(function(){a(this).css({"font-style":"italic",color:"blue"});xc(this.textContent)}).mouseout(function(){a(this).css({"font-style":"normal",color:"black"});xc()});a("#layerlist td.layervis").click(function(){var ya=
a(this.parentNode).prevAll().length;ya=a("#layerlist tr.layer:eq("+ya+") td.layername").text();var Da=a(this).hasClass("layerinvis");f.setLayerVisibility(ya,Da);Da?a(this).removeClass("layerinvis"):a(this).addClass("layerinvis")});for(A=5-a("#layerlist tr.layer").size();A-- >0;)q.append('<tr><td style="color:white">_</td><td/></tr>')};Ab();a(window).bind("load resize",function(){ra.css("line-height",ra.height()+"px")});a("#resolution").change(function(){var q=a("#canvas_width,#canvas_height");if(this.selectedIndex)if(this.value==
"content")q.val("fit").attr("disabled","disabled");else{var A=this.value.split("x");a("#canvas_width").val(A[0]);a("#canvas_height").val(A[1]);q.removeAttr("disabled")}else a("#canvas_width").val()=="fit"&&q.removeAttr("disabled").val(100)});a("input,select").attr("autocomplete","off");var oc=function(){var q=[{sel:"#tool_select",fn:Gb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Hb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Mb,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Nb,evt:"click",
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ma,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:aa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:N,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Y,evt:"mouseup"},{sel:"#tool_zoom",fn:na,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:mc,evt:"mouseup",key:[ga+"N",true]},{sel:"#tool_save",fn:function(){Ka?Q():f.save({images:b.img_save,round_digits:6})},evt:"mouseup",key:[ga+"S",true]},{sel:"#tool_export",fn:kc,evt:"mouseup"},
{sel:"#tool_open",fn:jc,evt:"mouseup"},{sel:"#tool_import",fn:Wb,evt:"mouseup"},{sel:"#tool_source",fn:D,evt:"click",key:[ga+"U",true]},{sel:"#tool_wireframe",fn:z,evt:"click"},{sel:"#tool_rulers",fn:F,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:jb,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Q,evt:"click"},{sel:"#tool_docprops_save",fn:ua,evt:"click"},{sel:"#tool_docprops",fn:H,evt:"mouseup"},{sel:"#tool_prefs_save",
fn:wa,evt:"click"},{sel:"#tool_prefs_option",fn:function(){G();return false},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Pa,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:$b,evt:"click"},{sel:"#tool_node_link",fn:Ua,evt:"click"},{sel:"#tool_node_clone",fn:ic,evt:"click"},{sel:"#tool_node_delete",fn:ec,evt:"click"},{sel:"#tool_openclose_path",fn:fc,evt:"click"},{sel:"#tool_add_subpath",fn:cc,evt:"click"},{sel:"#tool_move_top",fn:Db,evt:"click",key:ga+"shift+up"},{sel:"#tool_move_bottom",
fn:cb,evt:"click",key:ga+"shift+down"},{sel:"#tool_move_up",fn:Eb,evt:"click",key:[ga+"up",true]},{sel:"#tool_move_down",fn:$a,evt:"click",key:[ga+"down",true]},{sel:"#tool_topath",fn:Pb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:Zb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:k,evt:"click",key:[ga+"D",true]},{sel:"#tool_group",fn:h,evt:"click",key:[ga+"G",true]},{sel:"#tool_ungroup",fn:h,evt:"click",key:ga+"shift+G"},{sel:"#tool_unlink_use",fn:h,evt:"click"},{sel:"[id^=tool_align]",
fn:v,evt:"click"},{sel:"#tool_switch",fn:s,evt:"click",key:["shift+x",true]},{sel:"#tool_undo",fn:dc,evt:"click",key:ga+"z"},{sel:"#tool_redo",fn:g,evt:"click",key:["y",true]},{sel:"#tool_canvas_color_menu",fn:t,evt:"click"},{sel:"#tool_cut",fn:Xa,evt:"click",key:ga+"x"},{sel:"#tool_copy",fn:hb,evt:"click",key:ga+"c"},{sel:"#tool_paste",fn:pb,evt:"click",key:ga+"v"},{sel:"#tool_bold",fn:Vb,evt:"mousedown",key:[ga+"B",true]},{sel:"#tool_italic",fn:vb,evt:"mousedown",key:[ga+"I",true]},{sel:"#copy_save_done",
fn:jb,evt:"click"},{key:"ctrl+left",fn:function(){Sb(0,1)}},{key:"ctrl+right",fn:function(){Sb(1,1)}},{key:"ctrl+shift+left",fn:function(){Sb(0,5)}},{key:"ctrl+shift+right",fn:function(){Sb(1,5)}},{key:"shift+O",fn:Tb},{key:"shift+P",fn:gc},{key:[ga+"+",true],fn:function(){E(2)}},{key:[ga+"-",true],fn:function(){E(0.5)}},{key:["up",true],fn:function(){gb(0,-1)}},{key:["down",true],fn:function(){gb(0,1)}},{key:["left",true],fn:function(){gb(-1,0)}},{key:["right",true],fn:function(){gb(1,0)}},{key:"shift+up",
fn:function(){gb(0,-10)}},{key:"shift+down",fn:function(){gb(0,10)}},{key:"shift+left",fn:function(){gb(-10,0)}},{key:"shift+right",fn:function(){gb(10,0)}},{key:["alt+up",true],fn:function(){f.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){f.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){f.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){f.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){f.cloneSelectedElements(0,-10)}},
{key:["alt+shift+down",true],fn:function(){f.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){f.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){f.cloneSelectedElements(10,0)}},{key:ga+"A",fn:function(){f.selectAllInCurrentLayer()}},{key:ga+"shift+z",fn:g},{key:"esc",fn:C}],A={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var I={};a.each(q,function(R,X){if(X.sel){var ja=a(X.sel);if(ja.length==0)return true;
if(X.evt){if(svgedit.browser.isTouch()&&X.evt==="click")X.evt="mousedown";ja[X.evt](X.fn)}if(X.parent&&a(X.parent+"_show").length!=0){var va=a(X.parent);va.length||(va=Ga(X.parent.substr(1)));va.append(ja);a.isArray(I[X.parent])||(I[X.parent]=[]);I[X.parent].push(X)}}if(X.key){var ya=X.fn,Da=false;if(a.isArray(X.key)){va=X.key[0];if(X.key.length>1)Da=X.key[1]}else va=X.key;va+="";svgedit.browser.isMac&&va.indexOf("+")!=-1&&va.split("+")[0]=="ctrl"&&va.replace("ctrl","cmd");a.each(va.split("/"),function(Ba,
tb){a(document).bind("keydown",tb,function(Ta){ya();Da&&Ta.preventDefault();return false})});if(X.sel&&!X.hidekey&&ja.attr("title")){var Ca=ja.attr("title").split("[")[0]+" ("+va+")";A[va]=X.sel;ja.parents("#main_menu").length||ja.attr("title",Ca)}}});Qa(I);a(".attr_changer, #image_url").bind("keydown","return",function(R){a(this).change();R.preventDefault()});a(window).bind("keydown","tab",function(R){if(U==="canvas"){R.preventDefault();gc()}}).bind("keydown","shift+tab",function(R){if(U==="canvas"){R.preventDefault();
Tb()}});a("#tool_zoom").dblclick(K)},setTitles:function(){a.each(A,function(I,R){var X=a(R).parents("#main_menu").length;a(R).each(function(){var ja=X?a(this).text().split(" [")[0]:this.title.split(" [")[0],va="";a.each(I.split("/"),function(ya,Da){var Ca=Da.split("+"),Ba="";if(Ca.length>1){Ba=Ca[0]+"+";Da=Ca[1]}va+=(ya?"/":"")+Ba+(e["key_"+Da]||Da)});if(X)this.lastChild.textContent=ja+" ["+va+"]";else this.title=ja+" ["+va+"]"})})},getButtonData:function(I){var R;a.each(q,function(X,ja){if(ja.sel===
I)R=ja});return R}}}();oc.setAll();c.ready(function(){var q=d.initTool,A=a("#tools_left, #svg_editor .tools_flyout"),I=A.find("#tool_"+q);q=A.find("#"+q);(I.length?I:q.length?q:a("#tool_select")).click().mouseup();d.wireframe&&a("#tool_wireframe").click();d.showlayers&&wc();a("#rulers").toggle(!!d.showRulers);if(d.showRulers)a("#show_rulers")[0].checked=true;if(d.gridSnapping)a("#grid_snapping_on")[0].checked=true;d.baseUnit&&a("#base_unit").val(d.baseUnit);d.snappingStep&&a("#grid_snapping_step").val(d.snappingStep)});
a("#rect_rx").SpinButton({min:0,max:1E3,step:1,callback:function(q){f.setRectRadius(q.value)}});a("#stroke_width").SpinButton({min:0,max:99,step:1,smallStep:0.1,callback:function(q){var A=q.value;if(A==0&&Z&&["line","polyline"].indexOf(Z.nodeName)>=0)A=q.value=1;f.setStrokeWidth(A)}});a("#angle").SpinButton({min:-180,max:180,step:5,callback:function(q){f.setRotationAngle(q.value);a("#tool_reorient").toggleClass("disabled",q.value==0)}});a("#font_size").SpinButton({step:1,min:0.0010,stepfunc:function(q,
A){var I=q.value-0,R=I+A,X=R>=I;if(A===0)return I;return I>=24?X?Math.round(I*1.1):Math.round(I/1.1):I<=1?X?I*2:I/2:R},callback:function(q){f.setFontSize(q.value)}});a("#group_opacity").SpinButton({step:5,min:0,max:100,callback:xb});a("#blur").SpinButton({step:0.1,min:0,max:10,callback:fb});a("#zoom").SpinButton({min:0.0010,max:1E4,step:50,stepfunc:function(q,A){var I=q.value-0;if(I===0)return 100;var R=I+A;if(A===0)return I;return I>=100?R:R>=I?I*2:I/2},callback:ob}).val(f.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",
inSpeed:0},function(q){switch(q){case "delete":Pa();break;case "cut":Xa();break;case "copy":hb();break;case "paste":f.pasteElements();break;case "paste_in_place":f.pasteElements("in_place");break;case "group":f.groupSelectedElements();break;case "ungroup":f.ungroupSelectedElement();break;case "move_front":Db();break;case "move_up":Fb("Up");break;case "move_down":Fb("Down");break;case "move_back":cb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(q)&&svgedit.contextmenu.getCustomHandler(q).call()}f.clipBoard.length&&
pa.enableContextMenuItems("#paste,#paste_in_place")});V=function(q){switch(q){case "dupe":M();break;case "delete":T();break;case "merge_down":if(a("#layerlist tr.layersel").index()!=f.getCurrentDrawing().getNumLayers()-1){f.mergeLayer();Ja();Ab()}break;case "merge_all":f.mergeAllLayers();Ja();Ab()}};a("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},V);a("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:true},V);a(".contextMenu li").mousedown(function(q){q.preventDefault()});
a("#cmenu_canvas li").disableContextMenu();pa.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(ha.getUndoStackSize()===0)c.show_save_warning=false;if(!d.no_save_warning&&c.show_save_warning)return e.notification.unsavedChanges};c.openPrep=function(q){a("#main_menu").hide();ha.getUndoStackSize()===0?q(true):a.confirm(e.notification.QwantToOpen,q)};if(window.FileReader){V=a('<input type="file">').change(function(){var q=this;c.openPrep(function(A){if(A){f.clear();if(q.files.length==
1){A=new FileReader;A.onloadend=function(I){n(I.target.result);Rb()};A.readAsText(q.files[0])}}})});a("#tool_open").show().prepend(V);V=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var q=new FileReader;q.onloadend=function(A){f.importSvgString(A.target.result,true);Rb()};q.readAsText(this.files[0])}});a("#tool_import").show().prepend(V)}var Rb=c.updateCanvas=function(q,A){var I=ra.width(),R=ra.height(),X=I,ja=R,va=f.getZoom(),ya=a("#svgcanvas"),Da={x:ra[0].scrollLeft+
X/2,y:ra[0].scrollTop+ja/2},Ca=d.canvas_expansion;I=Math.max(X,f.contentW*va*Ca);R=Math.max(ja,f.contentH*va*Ca);I==X&&R==ja?ra.css("overflow","hidden"):ra.css("overflow","scroll");Ca=ya.height()/2;var Ba=ya.width()/2;ya.width(I).height(R);var tb=R/2,Ta=I/2,ia=f.updateCanvas(I,R),wb=Ta/Ba;I=I/2-X/2;R=R/2-ja/2;if(A){A.x+=ia.x;A.y+=ia.y}else A={x:Ta+(Da.x-Ba)*wb,y:tb+(Da.y-Ca)*wb};if(q)if(f.contentW>ra.width()){ra[0].scrollLeft=ia.x-10;ra[0].scrollTop=ia.y-10}else{ra[0].scrollLeft=I;ra[0].scrollTop=
R}else{ra[0].scrollLeft=A.x-X/2;ra[0].scrollTop=A.y-ja/2}if(d.showRulers){da(ya,va);ra.scroll()}},hc=[];for(Bb=0.1;Bb<1E5;Bb*=10){hc.push(1*Bb);hc.push(2*Bb);hc.push(5*Bb)}Rb(true);try{var yc=function(q){if(window.JSON&&JSON.stringify)return JSON.stringify(q);var A=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(X){return"\\u"+("0000"+X.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(q.length){for(var I=0;I<q.length;I++)q[I]=A(q[I]);return"["+q.join(",")+"]"}else{I=[];for(var R in q)I.push(A(R)+":"+A(q[R]));return"{"+I.join(",")+"}"}};window.addEventListener("message",function(q){var A=parseInt(q.data.substr(0,q.data.indexOf(";")));try{q.source.postMessage("SVGe"+A+";"+yc(eval(q.data)),"*")}catch(I){q.source.postMessage("SVGe"+A+";error:"+I.message,"*")}},false)}catch(zc){window.embed_error=
zc}a(function(){window.svgCanvas=f;f.ready=svgEditor.ready});c.setLang=function(q,A){a.pref("lang",q);a("#lang_select").val(q);if(A){var I=a("#layerlist tr.layersel td.layername").text()==e.common.layer+" 1";a.extend(e,A);f.setUiStrings(A);oc.setTitles();if(I){f.renameCurrentLayer(e.common.layer+" 1");Ab()}f.runExtensions("langChanged",q);Kb();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(R,X){a(X).attr("title",a(R)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var u=[];c.ready=function(w){m?w():u.push(w)};c.runCallbacks=function(){a.each(u,function(){this()});m=true};c.loadFromString=function(w){c.ready(function(){n(w)})};c.disableUI=function(){};c.loadFromURL=function(w,p){p||(p={});var L=p.cache,T=p.callback;c.ready(function(){a.ajax({url:w,dataType:"text",
cache:!!L,success:function(M){n(M,T)},error:function(M,J,da){M.status!=404&&M.responseText?n(M.responseText,T):a.alert(e.notification.URLloadFail+": \n"+da+"",T)}})})};c.loadFromDataURI=function(w){c.ready(function(){var p=w.substring(26);n(svgedit.utilities.decode64(p))})};c.addExtension=function(){var w=arguments;a(function(){f&&f.addExtension.apply(this,w)})};return c}(jQuery);$(svgEditor.init)})();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 f=n.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+n.id+"'>"+n.label+"<span class='shortcut'>"+f+"</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}})();var svgEditor=function(a,n){function f(m,o,b){var d=a("#svg_editor").parent(),e;for(e in o){var l=o[e];l||console.log(e);if(b)e="#"+e;if(d.find(e).length){var u=d.find(e)[0];switch(m){case "content":for(var w=0;w<u.childNodes.length;w++){var p=u.childNodes[w];if(p.nodeType===3&&p.textContent.replace(/\s/g,"")){p.textContent=l;break}}break;case "title":u.title=l}}else console.log("Missing: "+e)}}var c;n.readLang=function(m){var o=n.canvas.runExtensions("addlangData",c,true);a.each(o,function(T,M){if(M.data)m=
@ -602,55 +604,55 @@ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui
return f=this._trimAlignValue(f)}f=this.options.values.slice();for(c=0;c<f.length;c+=1)f[c]=this._trimAlignValue(f[c]);return f},_trimAlignValue:function(n){if(n<=this._valueMin())return this._valueMin();if(n>=this._valueMax())return this._valueMax();var f=this.options.step>0?this.options.step:1,c=(n-this._valueMin())%f;n=n-c;Math.abs(c)*2>=f&&(n+=c>0?f:-f);return parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var n=
this.options.range,f=this.options,c=this,m=this._animateOff?false:f.animate,o,b={},d,e,l,u;this.options.values&&this.options.values.length?this.handles.each(function(w){o=(c.values(w)-c._valueMin())/(c._valueMax()-c._valueMin())*100;b[c.orientation==="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[m?"animate":"css"](b,f.animate);c.options.range===true&&(c.orientation==="horizontal"?(w===0&&c.range.stop(1,1)[m?"animate":"css"]({left:o+"%"},f.animate),w===1&&c.range[m?"animate":"css"]({width:o-
d+"%"},{queue:false,duration:f.animate})):(w===0&&c.range.stop(1,1)[m?"animate":"css"]({bottom:o+"%"},f.animate),w===1&&c.range[m?"animate":"css"]({height:o-d+"%"},{queue:false,duration:f.animate})));d=o}):(e=this.value(),l=this._valueMin(),u=this._valueMax(),o=u!==l?(e-l)/(u-l)*100:0,b[c.orientation==="horizontal"?"left":"bottom"]=o+"%",this.handle.stop(1,1)[m?"animate":"css"](b,f.animate),n==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[m?"animate":"css"]({width:o+"%"},f.animate),
n==="max"&&this.orientation==="horizontal"&&this.range[m?"animate":"css"]({width:100-o+"%"},{queue:false,duration:f.animate}),n==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[m?"animate":"css"]({height:o+"%"},f.animate),n==="max"&&this.orientation==="vertical"&&this.range[m?"animate":"css"]({height:100-o+"%"},{queue:false,duration:f.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(b,d){if(d===undefined)d=0;return Math.round(b*Math.pow(10,d))/Math.pow(10,d)};var n=function(b,d){var e=this,l=b.find("img:first"),u=0,w=100,p=100,L=0,T=100,M=100,J=0,da=0,V,O,fa=[],ua=function(S){for(var U=0;U<fa.length;U++)fa[U].call(e,e,S)},ha=function(S){var U=b.offset();V={l:U.left|0,t:U.top|0};clearTimeout(O);O=setTimeout(function(){ra.call(e,S)},0);a(document).bind("mousemove",ca).bind("mouseup",ea);S.preventDefault()},ca=function(S){clearTimeout(O);O=setTimeout(function(){ra.call(e,
S)},0);S.stopPropagation();S.preventDefault();return false},ea=function(S){a(document).unbind("mouseup",ea).unbind("mousemove",ca);S.stopPropagation();S.preventDefault();return false},ra=function(S){var U=S.pageX-V.l;S=S.pageY-V.t;var sa=b.w,la=b.h;if(U<0)U=0;else if(U>sa)U=sa;if(S<0)S=0;else if(S>la)S=la;qa.call(e,"xy",{x:U/sa*p+u,y:S/la*M+L})},qa=function(S,U,sa){if(U===undefined){if(S===undefined||S==null)S="xy";switch(S.toLowerCase()){case "x":return J;case "y":return da;default:return{x:J,y:da}}}if(!(sa!=
null&&sa==e)){var la=false,oa,Z;if(S==null)S="xy";switch(S.toLowerCase()){case "x":oa=U&&(U.x&&U.x|0||U|0)||0;break;case "y":Z=U&&(U.y&&U.y|0||U|0)||0;break;default:oa=U&&U.x&&U.x|0||0;Z=U&&U.y&&U.y|0||0}if(oa!=null){if(oa<u)oa=u;else if(oa>w)oa=w;if(J!=oa){J=oa;la=true}}if(Z!=null){if(Z<L)Z=L;else if(Z>T)Z=T;if(da!=Z){da=Z;la=true}}la&&ua.call(e,sa||e)}},ba=function(S){a.isFunction(S)&&fa.push(S)};a.extend(true,e,{val:qa,range:function(S,U){if(U===undefined){if(S===undefined||S==null)S="all";switch(S.toLowerCase()){case "minx":return u;
n==="max"&&this.orientation==="horizontal"&&this.range[m?"animate":"css"]({width:100-o+"%"},{queue:false,duration:f.animate}),n==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[m?"animate":"css"]({height:o+"%"},f.animate),n==="max"&&this.orientation==="vertical"&&this.range[m?"animate":"css"]({height:100-o+"%"},{queue:false,duration:f.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(b,d){if(d===undefined)d=0;return Math.round(b*Math.pow(10,d))/Math.pow(10,d)};var n=function(b,d){var e=this,l=b.find("img:first"),u=0,w=100,p=100,L=0,T=100,M=100,J=0,da=0,V,O,ga=[],ta=function(S){for(var U=0;U<ga.length;U++)ga[U].call(e,e,S)},ha=function(S){var U=b.offset();V={l:U.left|0,t:U.top|0};clearTimeout(O);O=setTimeout(function(){ra.call(e,S)},0);a(document).bind("mousemove",ca).bind("mouseup",ea);S.preventDefault()},ca=function(S){clearTimeout(O);O=setTimeout(function(){ra.call(e,
S)},0);S.stopPropagation();S.preventDefault();return false},ea=function(S){a(document).unbind("mouseup",ea).unbind("mousemove",ca);S.stopPropagation();S.preventDefault();return false},ra=function(S){var U=S.pageX-V.l;S=S.pageY-V.t;var sa=b.w,la=b.h;if(U<0)U=0;else if(U>sa)U=sa;if(S<0)S=0;else if(S>la)S=la;pa.call(e,"xy",{x:U/sa*p+u,y:S/la*M+L})},pa=function(S,U,sa){if(U===undefined){if(S===undefined||S==null)S="xy";switch(S.toLowerCase()){case "x":return J;case "y":return da;default:return{x:J,y:da}}}if(!(sa!=
null&&sa==e)){var la=false,oa,Z;if(S==null)S="xy";switch(S.toLowerCase()){case "x":oa=U&&(U.x&&U.x|0||U|0)||0;break;case "y":Z=U&&(U.y&&U.y|0||U|0)||0;break;default:oa=U&&U.x&&U.x|0||0;Z=U&&U.y&&U.y|0||0}if(oa!=null){if(oa<u)oa=u;else if(oa>w)oa=w;if(J!=oa){J=oa;la=true}}if(Z!=null){if(Z<L)Z=L;else if(Z>T)Z=T;if(da!=Z){da=Z;la=true}}la&&ta.call(e,sa||e)}},ba=function(S){a.isFunction(S)&&ga.push(S)};a.extend(true,e,{val:pa,range:function(S,U){if(U===undefined){if(S===undefined||S==null)S="all";switch(S.toLowerCase()){case "minx":return u;
case "maxx":return w;case "rangex":return{minX:u,maxX:w,rangeX:p};case "miny":return L;case "maxy":return T;case "rangey":return{minY:L,maxY:T,rangeY:M};default:return{minX:u,maxX:w,rangeX:p,minY:L,maxY:T,rangeY:M}}}var sa,la,oa,Z;if(S==null)S="all";switch(S.toLowerCase()){case "minx":sa=U&&(U.minX&&U.minX|0||U|0)||0;break;case "maxx":la=U&&(U.maxX&&U.maxX|0||U|0)||0;break;case "rangex":sa=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;break;case "miny":oa=U&&(U.minY&&U.minY|0||U|0)||0;break;case "maxy":Z=
U&&(U.maxY&&U.maxY|0||U|0)||0;break;case "rangey":oa=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0;break;default:sa=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;oa=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0}if(sa!=null&&u!=sa){u=sa;p=w-u}if(la!=null&&w!=la){w=la;p=w-u}if(oa!=null&&L!=oa){L=oa;M=T-L}if(Z!=null&&T!=Z){T=Z;M=T-L}},bind:ba,unbind:function(S){if(a.isFunction(S))for(var U;(U=a.inArray(S,fa))!=-1;)fa.splice(U,1)},destroy:function(){a(document).unbind("mouseup",ea).unbind("mousemove",
ca);b.unbind("mousedown",ha);fa=l=b=null}});l.src=d.arrow&&d.arrow.image;l.w=d.arrow&&d.arrow.width||l.width();l.h=d.arrow&&d.arrow.height||l.height();b.w=d.map&&d.map.width||b.width();b.h=d.map&&d.map.height||b.height();b.bind("mousedown",ha);ba.call(e,function(){var S=0,U=0,sa=b.w,la=b.h,oa=l.w,Z=l.h;setTimeout(function(){if(p>0)S=J==w?sa:J/p*sa|0;if(M>0)U=da==T?la:da/M*la|0;if(oa>=sa)S=(sa>>1)-(oa>>1);else S-=oa>>1;if(Z>=la)U=(la>>1)-(Z>>1);else U-=Z>>1;l.css({left:S+"px",top:U+"px"})},0)})},f=
function(b,d,e,l){var u=this;b=b.find("td.Text input");var w=b.eq(3),p=b.eq(4),L=b.eq(5),T=b.length>7?b.eq(6):null,M=b.eq(0),J=b.eq(1),da=b.eq(2),V=b.eq(b.length>7?7:6),O=b.length>7?b.eq(8):null,fa=function(qa){if(!(qa.target.value==""&&qa.target!=V.get(0)&&(e!=null&&qa.target!=e.get(0)||e==null))){if(!ca(qa))return qa;switch(qa.target){case w.get(0):switch(qa.keyCode){case 38:w.val(ea.call(u,(w.val()<<0)+1,0,255));d.val("r",w.val(),qa.target);return false;case 40:w.val(ea.call(u,(w.val()<<0)-1,0,
255));d.val("r",w.val(),qa.target);return false}break;case p.get(0):switch(qa.keyCode){case 38:p.val(ea.call(u,(p.val()<<0)+1,0,255));d.val("g",p.val(),qa.target);return false;case 40:p.val(ea.call(u,(p.val()<<0)-1,0,255));d.val("g",p.val(),qa.target);return false}break;case L.get(0):switch(qa.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));d.val("b",L.val(),qa.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));d.val("b",L.val(),qa.target);return false}break;case T&&T.get(0):switch(qa.keyCode){case 38:T.val(ea.call(u,
parseFloat(T.val())+1,0,100));d.val("a",Math.precision(T.val()*255/100,l),qa.target);return false;case 40:T.val(ea.call(u,parseFloat(T.val())-1,0,100));d.val("a",Math.precision(T.val()*255/100,l),qa.target);return false}break;case M.get(0):switch(qa.keyCode){case 38:M.val(ea.call(u,(M.val()<<0)+1,0,360));d.val("h",M.val(),qa.target);return false;case 40:M.val(ea.call(u,(M.val()<<0)-1,0,360));d.val("h",M.val(),qa.target);return false}break;case J.get(0):switch(qa.keyCode){case 38:J.val(ea.call(u,(J.val()<<
0)+1,0,100));d.val("s",J.val(),qa.target);return false;case 40:J.val(ea.call(u,(J.val()<<0)-1,0,100));d.val("s",J.val(),qa.target);return false}break;case da.get(0):switch(qa.keyCode){case 38:da.val(ea.call(u,(da.val()<<0)+1,0,100));d.val("v",da.val(),qa.target);return false;case 40:da.val(ea.call(u,(da.val()<<0)-1,0,100));d.val("v",da.val(),qa.target);return false}}}},ua=function(qa){if(!(qa.target.value==""&&qa.target!=V.get(0)&&(e!=null&&qa.target!=e.get(0)||e==null))){if(!ca(qa))return qa;switch(qa.target){case w.get(0):w.val(ea.call(u,
w.val(),0,255));d.val("r",w.val(),qa.target);break;case p.get(0):p.val(ea.call(u,p.val(),0,255));d.val("g",p.val(),qa.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));d.val("b",L.val(),qa.target);break;case T&&T.get(0):T.val(ea.call(u,T.val(),0,100));d.val("a",Math.precision(T.val()*255/100,l),qa.target);break;case M.get(0):M.val(ea.call(u,M.val(),0,360));d.val("h",M.val(),qa.target);break;case J.get(0):J.val(ea.call(u,J.val(),0,100));d.val("s",J.val(),qa.target);break;case da.get(0):da.val(ea.call(u,
da.val(),0,100));d.val("v",da.val(),qa.target);break;case V.get(0):V.val(V.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));e&&e.val(V.val());d.val("hex",V.val()!=""?V.val():null,qa.target);break;case e&&e.get(0):e.val(e.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));V.val(e.val());d.val("hex",e.val()!=""?e.val():null,qa.target);break;case O&&O.get(0):O.val(O.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));d.val("a",O.val()!=null?parseInt(O.val(),16):
null,qa.target)}}},ha=function(qa){if(d.val()!=null)switch(qa.target){case w.get(0):w.val(d.val("r"));break;case p.get(0):p.val(d.val("g"));break;case L.get(0):L.val(d.val("b"));break;case T&&T.get(0):T.val(Math.precision(d.val("a")*100/255,l));break;case M.get(0):M.val(d.val("h"));break;case J.get(0):J.val(d.val("s"));break;case da.get(0):da.val(d.val("v"));break;case V.get(0):case e&&e.get(0):V.val(d.val("hex"));e&&e.val(d.val("hex"));break;case O&&O.get(0):O.val(d.val("ahex").substring(6))}},ca=
function(qa){switch(qa.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(qa.ctrlKey)return false}return true},ea=function(qa,ba,S){if(qa==""||isNaN(qa))return ba;if(qa>S)return S;if(qa<ba)return ba;return qa},ra=function(qa,ba){var S=qa.val("all");if(ba!=w.get(0))w.val(S!=null?S.r:"");if(ba!=p.get(0))p.val(S!=null?S.g:"");if(ba!=L.get(0))L.val(S!=null?S.b:"");if(T&&ba!=T.get(0))T.val(S!=null?Math.precision(S.a*100/255,l):"");if(ba!=M.get(0))M.val(S!=
null?S.h:"");if(ba!=J.get(0))J.val(S!=null?S.s:"");if(ba!=da.get(0))da.val(S!=null?S.v:"");if(ba!=V.get(0)&&(e&&ba!=e.get(0)||!e))V.val(S!=null?S.hex:"");if(e&&ba!=e.get(0)&&ba!=V.get(0))e.val(S!=null?S.hex:"");if(O&&ba!=O.get(0))O.val(S!=null?S.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){w.add(p).add(L).add(T).add(M).add(J).add(da).add(V).add(e).add(O).unbind("keyup",ua).unbind("blur",ha);w.add(p).add(L).add(T).add(M).add(J).add(da).unbind("keydown",fa);d.unbind(ra);O=V=da=J=M=T=L=
p=w=null}});w.add(p).add(L).add(T).add(M).add(J).add(da).add(V).add(e).add(O).bind("keyup",ua).bind("blur",ha);w.add(p).add(L).add(T).add(M).add(J).add(da).bind("keydown",fa);d.bind(ra)};a.jPicker={List:[],Color:function(b){var d=this,e,l,u,w,p,L,T,M=[],J=function(V){for(var O=0;O<M.length;O++)M[O].call(d,d,V)},da=function(V,O,fa){if(O===undefined){if(V===undefined||V==null||V=="")V="all";if(e==null)return null;switch(V.toLowerCase()){case "ahex":return o.rgbaToHex({r:e,g:l,b:u,a:w});case "hex":return da("ahex").substring(0,
6);case "all":return{r:e,g:l,b:u,a:w,h:p,s:L,v:T,hex:da.call(d,"hex"),ahex:da.call(d,"ahex")};default:O={};for(var ua=0;ua<V.length;ua++)switch(V.charAt(ua)){case "r":if(V.length==1)O=e;else O.r=e;break;case "g":if(V.length==1)O=l;else O.g=l;break;case "b":if(V.length==1)O=u;else O.b=u;break;case "a":if(V.length==1)O=w;else O.a=w;break;case "h":if(V.length==1)O=p;else O.h=p;break;case "s":if(V.length==1)O=L;else O.s=L;break;case "v":if(V.length==1)O=T;else O.v=T}return O=={}?da.call(d,"all"):O}}if(!(fa!=
null&&fa==d)){var ha=false;if(V==null)V="";if(O==null){if(e!=null){e=null;ha=true}if(l!=null){l=null;ha=true}if(u!=null){u=null;ha=true}if(w!=null){w=null;ha=true}if(p!=null){p=null;ha=true}if(L!=null){L=null;ha=true}if(T!=null){T=null;ha=true}ha&&J.call(d,fa||d)}else switch(V.toLowerCase()){case "ahex":case "hex":O=o.hexToRgba(O&&(O.ahex||O.hex)||O||"00000000");da.call(d,"rgba",{r:O.r,g:O.g,b:O.b,a:V=="ahex"?O.a:w!=null?w:255},fa);break;default:if(O&&(O.ahex!=null||O.hex!=null)){da.call(d,"ahex",
O.ahex||O.hex||"00000000",fa);break}var ca={},ea=false,ra=false;if(O.r!==undefined&&!V.indexOf("r")==-1)V+="r";if(O.g!==undefined&&!V.indexOf("g")==-1)V+="g";if(O.b!==undefined&&!V.indexOf("b")==-1)V+="b";if(O.a!==undefined&&!V.indexOf("a")==-1)V+="a";if(O.h!==undefined&&!V.indexOf("h")==-1)V+="h";if(O.s!==undefined&&!V.indexOf("s")==-1)V+="s";if(O.v!==undefined&&!V.indexOf("v")==-1)V+="v";for(ua=0;ua<V.length;ua++)switch(V.charAt(ua)){case "r":if(ra)continue;ea=true;ca.r=O&&O.r&&O.r|0||O&&O|0||0;
U&&(U.maxY&&U.maxY|0||U|0)||0;break;case "rangey":oa=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0;break;default:sa=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;oa=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0}if(sa!=null&&u!=sa){u=sa;p=w-u}if(la!=null&&w!=la){w=la;p=w-u}if(oa!=null&&L!=oa){L=oa;M=T-L}if(Z!=null&&T!=Z){T=Z;M=T-L}},bind:ba,unbind:function(S){if(a.isFunction(S))for(var U;(U=a.inArray(S,ga))!=-1;)ga.splice(U,1)},destroy:function(){a(document).unbind("mouseup",ea).unbind("mousemove",
ca);b.unbind("mousedown",ha);ga=l=b=null}});l.src=d.arrow&&d.arrow.image;l.w=d.arrow&&d.arrow.width||l.width();l.h=d.arrow&&d.arrow.height||l.height();b.w=d.map&&d.map.width||b.width();b.h=d.map&&d.map.height||b.height();b.bind("mousedown",ha);ba.call(e,function(){var S=0,U=0,sa=b.w,la=b.h,oa=l.w,Z=l.h;setTimeout(function(){if(p>0)S=J==w?sa:J/p*sa|0;if(M>0)U=da==T?la:da/M*la|0;if(oa>=sa)S=(sa>>1)-(oa>>1);else S-=oa>>1;if(Z>=la)U=(la>>1)-(Z>>1);else U-=Z>>1;l.css({left:S+"px",top:U+"px"})},0)})},f=
function(b,d,e,l){var u=this;b=b.find("td.Text input");var w=b.eq(3),p=b.eq(4),L=b.eq(5),T=b.length>7?b.eq(6):null,M=b.eq(0),J=b.eq(1),da=b.eq(2),V=b.eq(b.length>7?7:6),O=b.length>7?b.eq(8):null,ga=function(pa){if(!(pa.target.value==""&&pa.target!=V.get(0)&&(e!=null&&pa.target!=e.get(0)||e==null))){if(!ca(pa))return pa;switch(pa.target){case w.get(0):switch(pa.keyCode){case 38:w.val(ea.call(u,(w.val()<<0)+1,0,255));d.val("r",w.val(),pa.target);return false;case 40:w.val(ea.call(u,(w.val()<<0)-1,0,
255));d.val("r",w.val(),pa.target);return false}break;case p.get(0):switch(pa.keyCode){case 38:p.val(ea.call(u,(p.val()<<0)+1,0,255));d.val("g",p.val(),pa.target);return false;case 40:p.val(ea.call(u,(p.val()<<0)-1,0,255));d.val("g",p.val(),pa.target);return false}break;case L.get(0):switch(pa.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));d.val("b",L.val(),pa.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));d.val("b",L.val(),pa.target);return false}break;case T&&T.get(0):switch(pa.keyCode){case 38:T.val(ea.call(u,
parseFloat(T.val())+1,0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);return false;case 40:T.val(ea.call(u,parseFloat(T.val())-1,0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);return false}break;case M.get(0):switch(pa.keyCode){case 38:M.val(ea.call(u,(M.val()<<0)+1,0,360));d.val("h",M.val(),pa.target);return false;case 40:M.val(ea.call(u,(M.val()<<0)-1,0,360));d.val("h",M.val(),pa.target);return false}break;case J.get(0):switch(pa.keyCode){case 38:J.val(ea.call(u,(J.val()<<
0)+1,0,100));d.val("s",J.val(),pa.target);return false;case 40:J.val(ea.call(u,(J.val()<<0)-1,0,100));d.val("s",J.val(),pa.target);return false}break;case da.get(0):switch(pa.keyCode){case 38:da.val(ea.call(u,(da.val()<<0)+1,0,100));d.val("v",da.val(),pa.target);return false;case 40:da.val(ea.call(u,(da.val()<<0)-1,0,100));d.val("v",da.val(),pa.target);return false}}}},ta=function(pa){if(!(pa.target.value==""&&pa.target!=V.get(0)&&(e!=null&&pa.target!=e.get(0)||e==null))){if(!ca(pa))return pa;switch(pa.target){case w.get(0):w.val(ea.call(u,
w.val(),0,255));d.val("r",w.val(),pa.target);break;case p.get(0):p.val(ea.call(u,p.val(),0,255));d.val("g",p.val(),pa.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));d.val("b",L.val(),pa.target);break;case T&&T.get(0):T.val(ea.call(u,T.val(),0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);break;case M.get(0):M.val(ea.call(u,M.val(),0,360));d.val("h",M.val(),pa.target);break;case J.get(0):J.val(ea.call(u,J.val(),0,100));d.val("s",J.val(),pa.target);break;case da.get(0):da.val(ea.call(u,
da.val(),0,100));d.val("v",da.val(),pa.target);break;case V.get(0):V.val(V.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));e&&e.val(V.val());d.val("hex",V.val()!=""?V.val():null,pa.target);break;case e&&e.get(0):e.val(e.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));V.val(e.val());d.val("hex",e.val()!=""?e.val():null,pa.target);break;case O&&O.get(0):O.val(O.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));d.val("a",O.val()!=null?parseInt(O.val(),16):
null,pa.target)}}},ha=function(pa){if(d.val()!=null)switch(pa.target){case w.get(0):w.val(d.val("r"));break;case p.get(0):p.val(d.val("g"));break;case L.get(0):L.val(d.val("b"));break;case T&&T.get(0):T.val(Math.precision(d.val("a")*100/255,l));break;case M.get(0):M.val(d.val("h"));break;case J.get(0):J.val(d.val("s"));break;case da.get(0):da.val(d.val("v"));break;case V.get(0):case e&&e.get(0):V.val(d.val("hex"));e&&e.val(d.val("hex"));break;case O&&O.get(0):O.val(d.val("ahex").substring(6))}},ca=
function(pa){switch(pa.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(pa.ctrlKey)return false}return true},ea=function(pa,ba,S){if(pa==""||isNaN(pa))return ba;if(pa>S)return S;if(pa<ba)return ba;return pa},ra=function(pa,ba){var S=pa.val("all");if(ba!=w.get(0))w.val(S!=null?S.r:"");if(ba!=p.get(0))p.val(S!=null?S.g:"");if(ba!=L.get(0))L.val(S!=null?S.b:"");if(T&&ba!=T.get(0))T.val(S!=null?Math.precision(S.a*100/255,l):"");if(ba!=M.get(0))M.val(S!=
null?S.h:"");if(ba!=J.get(0))J.val(S!=null?S.s:"");if(ba!=da.get(0))da.val(S!=null?S.v:"");if(ba!=V.get(0)&&(e&&ba!=e.get(0)||!e))V.val(S!=null?S.hex:"");if(e&&ba!=e.get(0)&&ba!=V.get(0))e.val(S!=null?S.hex:"");if(O&&ba!=O.get(0))O.val(S!=null?S.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){w.add(p).add(L).add(T).add(M).add(J).add(da).add(V).add(e).add(O).unbind("keyup",ta).unbind("blur",ha);w.add(p).add(L).add(T).add(M).add(J).add(da).unbind("keydown",ga);d.unbind(ra);O=V=da=J=M=T=L=
p=w=null}});w.add(p).add(L).add(T).add(M).add(J).add(da).add(V).add(e).add(O).bind("keyup",ta).bind("blur",ha);w.add(p).add(L).add(T).add(M).add(J).add(da).bind("keydown",ga);d.bind(ra)};a.jPicker={List:[],Color:function(b){var d=this,e,l,u,w,p,L,T,M=[],J=function(V){for(var O=0;O<M.length;O++)M[O].call(d,d,V)},da=function(V,O,ga){if(O===undefined){if(V===undefined||V==null||V=="")V="all";if(e==null)return null;switch(V.toLowerCase()){case "ahex":return o.rgbaToHex({r:e,g:l,b:u,a:w});case "hex":return da("ahex").substring(0,
6);case "all":return{r:e,g:l,b:u,a:w,h:p,s:L,v:T,hex:da.call(d,"hex"),ahex:da.call(d,"ahex")};default:O={};for(var ta=0;ta<V.length;ta++)switch(V.charAt(ta)){case "r":if(V.length==1)O=e;else O.r=e;break;case "g":if(V.length==1)O=l;else O.g=l;break;case "b":if(V.length==1)O=u;else O.b=u;break;case "a":if(V.length==1)O=w;else O.a=w;break;case "h":if(V.length==1)O=p;else O.h=p;break;case "s":if(V.length==1)O=L;else O.s=L;break;case "v":if(V.length==1)O=T;else O.v=T}return O=={}?da.call(d,"all"):O}}if(!(ga!=
null&&ga==d)){var ha=false;if(V==null)V="";if(O==null){if(e!=null){e=null;ha=true}if(l!=null){l=null;ha=true}if(u!=null){u=null;ha=true}if(w!=null){w=null;ha=true}if(p!=null){p=null;ha=true}if(L!=null){L=null;ha=true}if(T!=null){T=null;ha=true}ha&&J.call(d,ga||d)}else switch(V.toLowerCase()){case "ahex":case "hex":O=o.hexToRgba(O&&(O.ahex||O.hex)||O||"00000000");da.call(d,"rgba",{r:O.r,g:O.g,b:O.b,a:V=="ahex"?O.a:w!=null?w:255},ga);break;default:if(O&&(O.ahex!=null||O.hex!=null)){da.call(d,"ahex",
O.ahex||O.hex||"00000000",ga);break}var ca={},ea=false,ra=false;if(O.r!==undefined&&!V.indexOf("r")==-1)V+="r";if(O.g!==undefined&&!V.indexOf("g")==-1)V+="g";if(O.b!==undefined&&!V.indexOf("b")==-1)V+="b";if(O.a!==undefined&&!V.indexOf("a")==-1)V+="a";if(O.h!==undefined&&!V.indexOf("h")==-1)V+="h";if(O.s!==undefined&&!V.indexOf("s")==-1)V+="s";if(O.v!==undefined&&!V.indexOf("v")==-1)V+="v";for(ta=0;ta<V.length;ta++)switch(V.charAt(ta)){case "r":if(ra)continue;ea=true;ca.r=O&&O.r&&O.r|0||O&&O|0||0;
if(ca.r<0)ca.r=0;else if(ca.r>255)ca.r=255;if(e!=ca.r){e=ca.r;ha=true}break;case "g":if(ra)continue;ea=true;ca.g=O&&O.g&&O.g|0||O&&O|0||0;if(ca.g<0)ca.g=0;else if(ca.g>255)ca.g=255;if(l!=ca.g){l=ca.g;ha=true}break;case "b":if(ra)continue;ea=true;ca.b=O&&O.b&&O.b|0||O&&O|0||0;if(ca.b<0)ca.b=0;else if(ca.b>255)ca.b=255;if(u!=ca.b){u=ca.b;ha=true}break;case "a":ca.a=O&&O.a!=null?O.a|0:O!=null?O|0:255;if(ca.a<0)ca.a=0;else if(ca.a>255)ca.a=255;if(w!=ca.a){w=ca.a;ha=true}break;case "h":if(ea)continue;
ra=true;ca.h=O&&O.h&&O.h|0||O&&O|0||0;if(ca.h<0)ca.h=0;else if(ca.h>360)ca.h=360;if(p!=ca.h){p=ca.h;ha=true}break;case "s":if(ea)continue;ra=true;ca.s=O&&O.s!=null?O.s|0:O!=null?O|0:100;if(ca.s<0)ca.s=0;else if(ca.s>100)ca.s=100;if(L!=ca.s){L=ca.s;ha=true}break;case "v":if(ea)continue;ra=true;ca.v=O&&O.v!=null?O.v|0:O!=null?O|0:100;if(ca.v<0)ca.v=0;else if(ca.v>100)ca.v=100;if(T!=ca.v){T=ca.v;ha=true}}if(ha){if(ea){e=e||0;l=l||0;u=u||0;O=o.rgbToHsv({r:e,g:l,b:u});p=O.h;L=O.s;T=O.v}else if(ra){p=p||
0;L=L!=null?L:100;T=T!=null?T:100;O=o.hsvToRgb({h:p,s:L,v:T});e=O.r;l=O.g;u=O.b}w=w!=null?w:255;J.call(d,fa||d)}}}};a.extend(true,d,{val:da,bind:function(V){a.isFunction(V)&&M.push(V)},unbind:function(V){if(a.isFunction(V))for(var O;(O=a.inArray(V,M))!=-1;)M.splice(O,1)},destroy:function(){M=null}});if(b)if(b.ahex!=null)da("ahex",b);else if(b.hex!=null)da((b.a!=null?"a":"")+"hex",b.a!=null?{ahex:b.hex+o.intToHex(b.a)}:b);else if(b.r!=null&&b.g!=null&&b.b!=null)da("rgb"+(b.a!=null?"a":""),b);else if(b.h!=
0;L=L!=null?L:100;T=T!=null?T:100;O=o.hsvToRgb({h:p,s:L,v:T});e=O.r;l=O.g;u=O.b}w=w!=null?w:255;J.call(d,ga||d)}}}};a.extend(true,d,{val:da,bind:function(V){a.isFunction(V)&&M.push(V)},unbind:function(V){if(a.isFunction(V))for(var O;(O=a.inArray(V,M))!=-1;)M.splice(O,1)},destroy:function(){M=null}});if(b)if(b.ahex!=null)da("ahex",b);else if(b.hex!=null)da((b.a!=null?"a":"")+"hex",b.a!=null?{ahex:b.hex+o.intToHex(b.a)}:b);else if(b.r!=null&&b.g!=null&&b.b!=null)da("rgb"+(b.a!=null?"a":""),b);else if(b.h!=
null&&b.s!=null&&b.v!=null)da("hsv"+(b.a!=null?"a":""),b)},ColorMethods:{hexToRgba:function(b){b=this.validateHex(b);if(b=="")return{r:null,g:null,b:null,a:null};var d="00",e="00",l="00",u="255";if(b.length==6)b+="ff";if(b.length>6){d=b.substring(0,2);e=b.substring(2,4);l=b.substring(4,6);u=b.substring(6,b.length)}else{if(b.length>4){d=b.substring(4,b.length);b=b.substring(0,4)}if(b.length>2){e=b.substring(2,b.length);b=b.substring(0,2)}if(b.length>0)l=b.substring(0,b.length)}return{r:this.hexToInt(d),
g:this.hexToInt(e),b:this.hexToInt(l),a:this.hexToInt(u)}},validateHex:function(b){if(typeof b=="object")return"";b=b.toLowerCase().replace(/[^a-f0-9]/g,"");if(b.length>8)b=b.substring(0,8);return b},rgbaToHex:function(b){return this.intToHex(b.r)+this.intToHex(b.g)+this.intToHex(b.b)+this.intToHex(b.a)},intToHex:function(b){b=(b|0).toString(16);if(b.length==1)b="0"+b;return b.toLowerCase()},hexToInt:function(b){return parseInt(b,16)},rgbToHsv:function(b){var d=b.r/255,e=b.g/255;b=b.b/255;var l={h:0,
s:0,v:0},u=0,w=0;if(d>=e&&d>=b){w=d;u=e>b?b:e}else if(e>=b&&e>=d){w=e;u=d>b?b:d}else{w=b;u=e>d?d:e}l.v=w;l.s=w?(w-u)/w:0;if(l.s){u=w-u;l.h=d==w?(e-b)/u:e==w?2+(b-d)/u:4+(d-e)/u;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(b){var d={r:0,g:0,b:0,a:100},e=b.h,l=b.s;b=b.v;if(l==0)d.r=b==0?d.g=d.b=0:d.g=d.b=b*255/100|0;else{if(e==360)e=0;e/=60;l/=100;b/=100;var u=e|0,w=e-u;e=b*(1-l);var p=b*(1-l*w);l=b*(1-l*(1-w));switch(u){case 0:d.r=b;d.g=
l;d.b=e;break;case 1:d.r=p;d.g=b;d.b=e;break;case 2:d.r=e;d.g=b;d.b=l;break;case 3:d.r=e;d.g=p;d.b=b;break;case 4:d.r=l;d.g=e;d.b=b;break;case 5:d.r=b;d.g=e;d.b=p}d.r=d.r*255|0;d.g=d.g*255|0;d.b=d.b*255|0}return d}}};var c=a.jPicker.Color,m=a.jPicker.List,o=a.jPicker.ColorMethods;a.fn.jPicker=function(b){var d=arguments;return this.each(function(){var e=this,l=a.extend(true,{},a.fn.jPicker.defaults,b);if(a(e).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,
input:a(e)}});if(a(e).val()==""){l.color.active=new c({hex:null});l.color.current=new c({hex:null})}else if(o.validateHex(a(e).val())){l.color.active=new c({hex:a(e).val(),a:l.color.active.val("a")});l.color.current=new c({hex:a(e).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(e).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>');
else l.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,w=null,p=null,L=null,T=null,M=null,J=null,da=null,V=null,O=null,fa=null,ua=null,ha=null,ca=null,ea=null,ra=null,qa=null,ba=null,S=null,U=null,sa=null,la=null,oa=null,Z=null,Aa=null,Ka=null,Ra=null,Na=null,Sa=null,Wa=function(K){var N=na.active,aa=N.val("hex"),Pa,Xa;l.color.mode=K;switch(K){case "h":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,0);Ea.call(e,T,100);La.call(e,
M,260);Ea.call(e,M,100);ab.call(e,L,"transparent");La.call(e,da,0);Ea.call(e,da,100);La.call(e,V,260);Ea.call(e,V,100);La.call(e,O,260);Ea.call(e,O,100);La.call(e,fa,260);Ea.call(e,fa,100);La.call(e,ha,260);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("s"),y:100-N.val("v")},ca);ea.val("y",360-N.val("h"),ea);break;case "s":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);
else l.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,w=null,p=null,L=null,T=null,M=null,J=null,da=null,V=null,O=null,ga=null,ta=null,ha=null,ca=null,ea=null,ra=null,pa=null,ba=null,S=null,U=null,sa=null,la=null,oa=null,Z=null,Aa=null,Ka=null,Ra=null,Na=null,Sa=null,Wa=function(K){var N=na.active,aa=N.val("hex"),Pa,Xa;l.color.mode=K;switch(K){case "h":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,0);Ea.call(e,T,100);La.call(e,
M,260);Ea.call(e,M,100);ab.call(e,L,"transparent");La.call(e,da,0);Ea.call(e,da,100);La.call(e,V,260);Ea.call(e,V,100);La.call(e,O,260);Ea.call(e,O,100);La.call(e,ga,260);Ea.call(e,ga,100);La.call(e,ha,260);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("s"),y:100-N.val("v")},ca);ea.val("y",360-N.val("h"),ea);break;case "s":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);
La.call(e,M,-520);La.call(e,da,-260);La.call(e,V,-520);La.call(e,ha,260);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("h"),y:100-N.val("v")},ca);ea.val("y",100-N.val("s"),ea);break;case "v":setTimeout(function(){ab.call(e,p,"000000");La.call(e,T,-780);La.call(e,M,260);ab.call(e,L,aa);La.call(e,da,-520);La.call(e,V,260);Ea.call(e,V,100);La.call(e,ha,260);Ea.call(e,ha,100)},0);ca.range("all",
{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("h"),y:100-N.val("s")},ca);ea.val("y",100-N.val("v"),ea);break;case "r":Pa=-1040;Xa=-780;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("b"),y:255-N.val("g")},ca);ea.val("y",255-N.val("r"),ea);break;case "g":Pa=-1560;Xa=-1820;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",
{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("b"),y:255-N.val("r")},ca);ea.val("y",255-N.val("g"),ea);break;case "b":Pa=-2080;Xa=-2860;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("r"),y:255-N.val("g")},ca);ea.val("y",255-N.val("b"),ea);break;case "a":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);La.call(e,M,-520);La.call(e,da,260);La.call(e,V,260);Ea.call(e,V,100);
La.call(e,ha,0);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("h"),y:100-N.val("v")},ca);ea.val("y",255-N.val("a"),ea);break;default:throw"Invalid Mode";}switch(K){case "s":case "v":case "a":setTimeout(function(){Ea.call(e,T,100);Ea.call(e,da,100);La.call(e,O,260);Ea.call(e,O,100);La.call(e,fa,260);Ea.call(e,fa,100)},0);break;case "r":case "g":case "b":setTimeout(function(){ab.call(e,p,
"transparent");ab.call(e,L,"transparent");Ea.call(e,da,100);Ea.call(e,T,100);La.call(e,T,Pa);La.call(e,M,Pa-260);La.call(e,da,Xa-780);La.call(e,V,Xa-520);La.call(e,O,Xa);La.call(e,fa,Xa-260);La.call(e,ha,260);Ea.call(e,ha,100)},0)}N.val("ahex")!=null&&Oa.call(e,N)},Oa=function(K,N){if(N==null||N!=ea&&N!=ca)Ga.call(e,K,N);setTimeout(function(){Cb.call(e,K);Mb.call(e,K);lb.call(e,K)},0)},Ia=function(K,N){var aa=na.active;if(!(N!=ca&&aa.val()==null)){var Pa=K.val("all");switch(l.color.mode){case "h":aa.val("sv",
La.call(e,ha,0);Ea.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(N.val("ahex")==null)break;ca.val("xy",{x:N.val("h"),y:100-N.val("v")},ca);ea.val("y",255-N.val("a"),ea);break;default:throw"Invalid Mode";}switch(K){case "s":case "v":case "a":setTimeout(function(){Ea.call(e,T,100);Ea.call(e,da,100);La.call(e,O,260);Ea.call(e,O,100);La.call(e,ga,260);Ea.call(e,ga,100)},0);break;case "r":case "g":case "b":setTimeout(function(){ab.call(e,p,
"transparent");ab.call(e,L,"transparent");Ea.call(e,da,100);Ea.call(e,T,100);La.call(e,T,Pa);La.call(e,M,Pa-260);La.call(e,da,Xa-780);La.call(e,V,Xa-520);La.call(e,O,Xa);La.call(e,ga,Xa-260);La.call(e,ha,260);Ea.call(e,ha,100)},0)}N.val("ahex")!=null&&Oa.call(e,N)},Oa=function(K,N){if(N==null||N!=ea&&N!=ca)Ga.call(e,K,N);setTimeout(function(){Cb.call(e,K);Kb.call(e,K);nb.call(e,K)},0)},Ia=function(K,N){var aa=na.active;if(!(N!=ca&&aa.val()==null)){var Pa=K.val("all");switch(l.color.mode){case "h":aa.val("sv",
{s:Pa.x,v:100-Pa.y},N);break;case "s":case "a":aa.val("hv",{h:Pa.x,v:100-Pa.y},N);break;case "v":aa.val("hs",{h:Pa.x,s:100-Pa.y},N);break;case "r":aa.val("gb",{g:255-Pa.y,b:Pa.x},N);break;case "g":aa.val("rb",{r:255-Pa.y,b:Pa.x},N);break;case "b":aa.val("rg",{r:Pa.x,g:255-Pa.y},N)}}},Qa=function(K,N){var aa=na.active;if(!(N!=ea&&aa.val()==null))switch(l.color.mode){case "h":aa.val("h",{h:360-K.val("y")},N);break;case "s":aa.val("s",{s:100-K.val("y")},N);break;case "v":aa.val("v",{v:100-K.val("y")},
N);break;case "r":aa.val("r",{r:255-K.val("y")},N);break;case "g":aa.val("g",{g:255-K.val("y")},N);break;case "b":aa.val("b",{b:255-K.val("y")},N);break;case "a":aa.val("a",255-K.val("y"),N)}},Ga=function(K,N){if(N!=ca)switch(l.color.mode){case "h":var aa=K.val("sv");ca.val("xy",{x:aa!=null?aa.s:100,y:100-(aa!=null?aa.v:100)},N);break;case "s":case "a":aa=K.val("hv");ca.val("xy",{x:aa&&aa.h||0,y:100-(aa!=null?aa.v:100)},N);break;case "v":aa=K.val("hs");ca.val("xy",{x:aa&&aa.h||0,y:100-(aa!=null?aa.s:
100)},N);break;case "r":aa=K.val("bg");ca.val("xy",{x:aa&&aa.b||0,y:255-(aa&&aa.g||0)},N);break;case "g":aa=K.val("br");ca.val("xy",{x:aa&&aa.b||0,y:255-(aa&&aa.r||0)},N);break;case "b":aa=K.val("rg");ca.val("xy",{x:aa&&aa.r||0,y:255-(aa&&aa.g||0)},N)}if(N!=ea)switch(l.color.mode){case "h":ea.val("y",360-(K.val("h")||0),N);break;case "s":aa=K.val("s");ea.val("y",100-(aa!=null?aa:100),N);break;case "v":aa=K.val("v");ea.val("y",100-(aa!=null?aa:100),N);break;case "r":ea.val("y",255-(K.val("r")||0),
N);break;case "g":ea.val("y",255-(K.val("g")||0),N);break;case "b":ea.val("y",255-(K.val("b")||0),N);break;case "a":aa=K.val("a");ea.val("y",255-(aa!=null?aa:255),N)}},Cb=function(K){try{var N=K.val("all");sa.css({backgroundColor:N&&"#"+N.hex||"transparent"});Ea.call(e,sa,N&&Math.precision(N.a*100/255,4)||0)}catch(aa){}},Mb=function(K){switch(l.color.mode){case "h":ab.call(e,p,(new c({h:K.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var N=K.val("s");Ea.call(e,M,100-(N!=null?N:100));
break;case "v":N=K.val("v");Ea.call(e,T,N!=null?N:100);break;case "r":Ea.call(e,M,Math.precision((K.val("r")||0)/255*100,4));break;case "g":Ea.call(e,M,Math.precision((K.val("g")||0)/255*100,4));break;case "b":Ea.call(e,M,Math.precision((K.val("b")||0)/255*100))}K=K.val("a");Ea.call(e,J,Math.precision((255-(K||0))*100/255,4))},lb=function(K){switch(l.color.mode){case "h":var N=K.val("a");Ea.call(e,ua,Math.precision((255-(N||0))*100/255,4));break;case "s":N=K.val("hva");var aa=new c({h:N&&N.h||0,s:100,
v:N!=null?N.v:100});ab.call(e,L,aa.val("hex"));Ea.call(e,V,100-(N!=null?N.v:100));Ea.call(e,ua,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "v":N=K.val("hsa");aa=new c({h:N&&N.h||0,s:N!=null?N.s:100,v:100});ab.call(e,L,aa.val("hex"));Ea.call(e,ua,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "r":case "g":case "b":aa=N=0;K=K.val("rgba");if(l.color.mode=="r"){N=K&&K.b||0;aa=K&&K.g||0}else if(l.color.mode=="g"){N=K&&K.b||0;aa=K&&K.r||0}else if(l.color.mode=="b"){N=K&&K.r||0;aa=K&&
K.g||0}var Pa=aa>N?N:aa;Ea.call(e,V,N>aa?Math.precision((N-aa)/(255-aa)*100,4):0);Ea.call(e,O,aa>N?Math.precision((aa-N)/(255-N)*100,4):0);Ea.call(e,fa,Math.precision(Pa/255*100,4));Ea.call(e,ua,Math.precision((255-(K&&K.a||0))*100/255,4));break;case "a":N=K.val("a");ab.call(e,L,K.val("hex")||"000000");Ea.call(e,ua,N!=null?0:100);Ea.call(e,ha,N!=null?100:0)}},ab=function(K,N){K.css({backgroundColor:N&&N.length==6&&"#"+N||"transparent"})},Ya=function(K,N){if(u&&(N.indexOf("AlphaBar.png")!=-1||N.indexOf("Bars.png")!=
N);break;case "g":ea.val("y",255-(K.val("g")||0),N);break;case "b":ea.val("y",255-(K.val("b")||0),N);break;case "a":aa=K.val("a");ea.val("y",255-(aa!=null?aa:255),N)}},Cb=function(K){try{var N=K.val("all");sa.css({backgroundColor:N&&"#"+N.hex||"transparent"});Ea.call(e,sa,N&&Math.precision(N.a*100/255,4)||0)}catch(aa){}},Kb=function(K){switch(l.color.mode){case "h":ab.call(e,p,(new c({h:K.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var N=K.val("s");Ea.call(e,M,100-(N!=null?N:100));
break;case "v":N=K.val("v");Ea.call(e,T,N!=null?N:100);break;case "r":Ea.call(e,M,Math.precision((K.val("r")||0)/255*100,4));break;case "g":Ea.call(e,M,Math.precision((K.val("g")||0)/255*100,4));break;case "b":Ea.call(e,M,Math.precision((K.val("b")||0)/255*100))}K=K.val("a");Ea.call(e,J,Math.precision((255-(K||0))*100/255,4))},nb=function(K){switch(l.color.mode){case "h":var N=K.val("a");Ea.call(e,ta,Math.precision((255-(N||0))*100/255,4));break;case "s":N=K.val("hva");var aa=new c({h:N&&N.h||0,s:100,
v:N!=null?N.v:100});ab.call(e,L,aa.val("hex"));Ea.call(e,V,100-(N!=null?N.v:100));Ea.call(e,ta,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "v":N=K.val("hsa");aa=new c({h:N&&N.h||0,s:N!=null?N.s:100,v:100});ab.call(e,L,aa.val("hex"));Ea.call(e,ta,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "r":case "g":case "b":aa=N=0;K=K.val("rgba");if(l.color.mode=="r"){N=K&&K.b||0;aa=K&&K.g||0}else if(l.color.mode=="g"){N=K&&K.b||0;aa=K&&K.r||0}else if(l.color.mode=="b"){N=K&&K.r||0;aa=K&&
K.g||0}var Pa=aa>N?N:aa;Ea.call(e,V,N>aa?Math.precision((N-aa)/(255-aa)*100,4):0);Ea.call(e,O,aa>N?Math.precision((aa-N)/(255-N)*100,4):0);Ea.call(e,ga,Math.precision(Pa/255*100,4));Ea.call(e,ta,Math.precision((255-(K&&K.a||0))*100/255,4));break;case "a":N=K.val("a");ab.call(e,L,K.val("hex")||"000000");Ea.call(e,ta,N!=null?0:100);Ea.call(e,ha,N!=null?100:0)}},ab=function(K,N){K.css({backgroundColor:N&&N.length==6&&"#"+N||"transparent"})},Ya=function(K,N){if(u&&(N.indexOf("AlphaBar.png")!=-1||N.indexOf("Bars.png")!=
-1||N.indexOf("Maps.png")!=-1)){K.attr("pngSrc",N);K.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+N+"', sizingMethod='scale')"})}else K.css({backgroundImage:"url('"+N+"')"})},La=function(K,N){K.css({top:N+"px"})},Ea=function(K,N){K.css({visibility:N>0?"visible":"hidden"});if(N>0&&N<100)if(u){var aa=K.attr("pngSrc");aa!=null&&(aa.indexOf("AlphaBar.png")!=-1||aa.indexOf("Bars.png")!=-1||aa.indexOf("Maps.png")!=-1)?K.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
aa+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+N+")"}):K.css({opacity:Math.precision(N/100,4)})}else K.css({opacity:Math.precision(N/100,4)});else if(N==0||N==100)if(u){aa=K.attr("pngSrc");aa!=null&&(aa.indexOf("AlphaBar.png")!=-1||aa.indexOf("Bars.png")!=-1||aa.indexOf("Maps.png")!=-1)?K.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aa+"', sizingMethod='scale')"}):K.css({opacity:""})}else K.css({opacity:""})},ob=function(){na.active.val("ahex",
na.current.val("ahex"))},Ja=function(){na.current.val("ahex",na.active.val("ahex"))},Za=function(K){a(this).parents("tbody:first").find('input:radio[value!="'+K.target.value+'"]').removeAttr("checked");Wa.call(e,K.target.value)},Ma=function(){ob.call(e)},mb=function(){ob.call(e);l.window.expandable&&Ob.call(e);a.isFunction(Gb)&&Gb.call(e,na.active,Z)},zb=function(){Ja.call(e);l.window.expandable&&Ob.call(e);a.isFunction(sb)&&sb.call(e,na.active,oa)},eb=function(){Hb.call(e)},gb=function(K){var N=
K.val("hex");la.css({backgroundColor:N&&"#"+N||"transparent"});Ea.call(e,la,Math.precision((K.val("a")||0)*100/255,4))},Nb=function(K){var N=K.val("hex");K=K.val("va");Ka.css({backgroundColor:N&&"#"+N||"transparent"});Ea.call(e,Ra,Math.precision((255-(K&&K.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:N&&"#"+N||"transparent",color:K==null||K.v>75?"#000000":"#ffffff"})},xa=function(K){qa=parseInt(w.css("left"));ba=parseInt(w.css("top"));S=
K.pageX;U=K.pageY;a(document).bind("mousemove",wb).bind("mouseup",qb);K.preventDefault()},wb=function(K){w.css({left:qa-(S-K.pageX)+"px",top:ba-(U-K.pageY)+"px"});l.window.expandable&&!a.support.boxModel&&w.prev().css({left:w.css("left"),top:w.css("top")});K.stopPropagation();K.preventDefault();return false},qb=function(K){a(document).unbind("mousemove",wb).unbind("mouseup",qb);K.stopPropagation();K.preventDefault();return false},Ab=function(K){K.preventDefault();K.stopPropagation();na.active.val("ahex",
a(this).attr("title")||null,K.target);return false},sb=a.isFunction(d[1])&&d[1]||null,kb=a.isFunction(d[2])&&d[2]||null,Gb=a.isFunction(d[3])&&d[3]||null,Hb=function(){na.current.val("ahex",na.active.val("ahex"));var K=function(){if(!(!l.window.expandable||a.support.boxModel)){var N=w.find("table:first");w.before("<iframe/>");w.prev().css({width:N.width(),height:w.height(),opacity:0,position:"absolute",left:w.css("left"),top:w.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});
w.css({zIndex:20})}switch(l.window.effects.type){case "fade":w.fadeIn(l.window.effects.speed.show,K);break;case "slide":w.slideDown(l.window.effects.speed.show,K);break;default:w.show(l.window.effects.speed.show,K)}},Ob=function(){var K=function(){l.window.expandable&&w.css({zIndex:10});!l.window.expandable||a.support.boxModel||w.prev().remove()};switch(l.window.effects.type){case "fade":w.fadeOut(l.window.effects.speed.hide,K);break;case "slide":w.slideUp(l.window.effects.speed.hide,K);break;default:w.hide(l.window.effects.speed.hide,
K)}},Pb=function(){var K=l.window,N=K.expandable?a(e).next().find(".Container:first"):null;w=K.expandable?a("<div/>"):a(e);w.addClass("jPicker Container");K.expandable&&w.hide();w.get(0).onselectstart=function($a){if($a.target.nodeName.toLowerCase()!=="input")return false};var aa=na.active.val("all");if(K.alphaPrecision<0)K.alphaPrecision=0;else if(K.alphaPrecision>2)K.alphaPrecision=2;var Pa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(K.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':
aa+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+N+")"}):K.css({opacity:Math.precision(N/100,4)})}else K.css({opacity:Math.precision(N/100,4)});else if(N==0||N==100)if(u){aa=K.attr("pngSrc");aa!=null&&(aa.indexOf("AlphaBar.png")!=-1||aa.indexOf("Bars.png")!=-1||aa.indexOf("Maps.png")!=-1)?K.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aa+"', sizingMethod='scale')"}):K.css({opacity:""})}else K.css({opacity:""})},qb=function(){na.active.val("ahex",
na.current.val("ahex"))},Ja=function(){na.current.val("ahex",na.active.val("ahex"))},Za=function(K){a(this).parents("tbody:first").find('input:radio[value!="'+K.target.value+'"]').removeAttr("checked");Wa.call(e,K.target.value)},Ma=function(){qb.call(e)},ob=function(){qb.call(e);l.window.expandable&&Mb.call(e);a.isFunction(Gb)&&Gb.call(e,na.active,Z)},xb=function(){Ja.call(e);l.window.expandable&&Mb.call(e);a.isFunction(sb)&&sb.call(e,na.active,oa)},fb=function(){Hb.call(e)},ib=function(K){var N=
K.val("hex");la.css({backgroundColor:N&&"#"+N||"transparent"});Ea.call(e,la,Math.precision((K.val("a")||0)*100/255,4))},Lb=function(K){var N=K.val("hex");K=K.val("va");Ka.css({backgroundColor:N&&"#"+N||"transparent"});Ea.call(e,Ra,Math.precision((255-(K&&K.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:N&&"#"+N||"transparent",color:K==null||K.v>75?"#000000":"#ffffff"})},xa=function(K){pa=parseInt(w.css("left"));ba=parseInt(w.css("top"));S=
K.pageX;U=K.pageY;a(document).bind("mousemove",ub).bind("mouseup",rb);K.preventDefault()},ub=function(K){w.css({left:pa-(S-K.pageX)+"px",top:ba-(U-K.pageY)+"px"});l.window.expandable&&!a.support.boxModel&&w.prev().css({left:w.css("left"),top:w.css("top")});K.stopPropagation();K.preventDefault();return false},rb=function(K){a(document).unbind("mousemove",ub).unbind("mouseup",rb);K.stopPropagation();K.preventDefault();return false},yb=function(K){K.preventDefault();K.stopPropagation();na.active.val("ahex",
a(this).attr("title")||null,K.target);return false},sb=a.isFunction(d[1])&&d[1]||null,mb=a.isFunction(d[2])&&d[2]||null,Gb=a.isFunction(d[3])&&d[3]||null,Hb=function(){na.current.val("ahex",na.active.val("ahex"));var K=function(){if(!(!l.window.expandable||a.support.boxModel)){var N=w.find("table:first");w.before("<iframe/>");w.prev().css({width:N.width(),height:w.height(),opacity:0,position:"absolute",left:w.css("left"),top:w.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});
w.css({zIndex:20})}switch(l.window.effects.type){case "fade":w.fadeIn(l.window.effects.speed.show,K);break;case "slide":w.slideDown(l.window.effects.speed.show,K);break;default:w.show(l.window.effects.speed.show,K)}},Mb=function(){var K=function(){l.window.expandable&&w.css({zIndex:10});!l.window.expandable||a.support.boxModel||w.prev().remove()};switch(l.window.effects.type){case "fade":w.fadeOut(l.window.effects.speed.hide,K);break;case "slide":w.slideUp(l.window.effects.speed.hide,K);break;default:w.hide(l.window.effects.speed.hide,
K)}},Nb=function(){var K=l.window,N=K.expandable?a(e).next().find(".Container:first"):null;w=K.expandable?a("<div/>"):a(e);w.addClass("jPicker Container");K.expandable&&w.hide();w.get(0).onselectstart=function($a){if($a.target.nodeName.toLowerCase()!=="input")return false};var aa=na.active.val("all");if(K.alphaPrecision<0)K.alphaPrecision=0;else if(K.alphaPrecision>2)K.alphaPrecision=2;var Pa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(K.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':
"")+'<tr><td rowspan="9"><h2 class="Title">'+(K.title||Y.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+ma.clientPath+ma.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+
ma.clientPath+ma.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+Y.text.newColor+'<div class="color_preview"><span class="Active" title="'+Y.tooltips.colors.newColor+'">&nbsp;</span><span class="Current" title="'+Y.tooltips.colors.currentColor+'">&nbsp;</span></div></div>'+Y.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+Y.text.ok+'" title="'+Y.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+
Y.text.cancel+'" title="'+Y.tooltips.buttons.cancel+'"/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="'+Y.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="'+(aa!=null?aa.h:"")+'" title="'+Y.tooltips.hue.textbox+'"/>&nbsp;\u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+Y.tooltips.saturation.radio+'"><input type="radio" value="s"'+
@ -660,15 +662,15 @@ Y.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label
"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(K.alphaSupport?'<input type="text" maxlength="'+(3+K.alphaPrecision)+'" value="'+(aa!=null?Math.precision(aa.a*100/255,K.alphaPrecision):"")+'" title="'+Y.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+Y.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(aa!=null?aa.hex:"")+'"/></label>'+(K.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+
(aa!=null?aa.ahex.substring(6):"")+'" title="'+Y.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"</tr></tbody></table>";if(K.expandable){w.html(Pa);a(document.body).children("div.jPicker.Container").length==0?a(document.body).prepend(w):a(document.body).children("div.jPicker.Container:last").after(w);w.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});w.css({zIndex:20})});w.css({left:K.position.x=="left"?N.offset().left-530-(K.position.y=="center"?25:0)+"px":K.position.x==
"center"?N.offset().left-260+"px":K.position.x=="right"?N.offset().left-10+(K.position.y=="center"?25:0)+"px":K.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":N.offset().left+parseInt(K.position.x)+"px",position:"absolute",top:K.position.y=="top"?N.offset().top-312+"px":K.position.y=="center"?N.offset().top-156+"px":K.position.y=="bottom"?N.offset().top+25+"px":N.offset().top+parseInt(K.position.y)+"px"})}else{w=a(e);w.html(Pa)}Pa=w.find("tbody:first");p=Pa.find("div.Map:first");L=Pa.find("div.Bar:first");
var Xa=p.find("span"),fb=L.find("span");T=Xa.filter(".Map1:first");M=Xa.filter(".Map2:first");J=Xa.filter(".Map3:first");da=fb.filter(".Map1:first");V=fb.filter(".Map2:first");O=fb.filter(".Map3:first");fa=fb.filter(".Map4:first");ua=fb.filter(".Map5:first");ha=fb.filter(".Map6:first");ca=new n(p,{map:{width:ma.colorMap.width,height:ma.colorMap.height},arrow:{image:ma.clientPath+ma.colorMap.arrow.file,width:ma.colorMap.arrow.width,height:ma.colorMap.arrow.height}});ca.bind(Ia);ea=new n(L,{map:{width:ma.colorBar.width,
height:ma.colorBar.height},arrow:{image:ma.clientPath+ma.colorBar.arrow.file,width:ma.colorBar.arrow.width,height:ma.colorBar.arrow.height}});ea.bind(Qa);ra=new f(Pa,na.active,K.expandable&&K.bindToInput?K.input:null,K.alphaPrecision);Xa=aa!=null?aa.hex:null;var nb=Pa.find(".Preview");fb=Pa.find(".Button");sa=nb.find(".Active:first").css({backgroundColor:Xa&&"#"+Xa||"transparent"});la=nb.find(".Current:first").css({backgroundColor:Xa&&"#"+Xa||"transparent"}).bind("click",Ma);Ea.call(e,la,Math.precision(na.current.val("a")*
100)/255,4);oa=fb.find(".Ok:first").bind("click",zb);Z=fb.find(".Cancel:first").bind("click",mb);Aa=fb.find(".Grid:first");setTimeout(function(){Ya.call(e,T,ma.clientPath+"Maps.png");Ya.call(e,M,ma.clientPath+"Maps.png");Ya.call(e,J,ma.clientPath+"map-opacity.png");Ya.call(e,da,ma.clientPath+"Bars.png");Ya.call(e,V,ma.clientPath+"Bars.png");Ya.call(e,O,ma.clientPath+"Bars.png");Ya.call(e,fa,ma.clientPath+"Bars.png");Ya.call(e,ua,ma.clientPath+"bar-opacity.png");Ya.call(e,ha,ma.clientPath+"AlphaBar.png");
Ya.call(e,nb.find("div:last"),ma.clientPath+"preview-opacity.png")},0);Pa.find("td.Radio input").bind("click",Za);if(na.quickList&&na.quickList.length>0){fb="";for(i=0;i<na.quickList.length;i++){if((typeof na.quickList[i]).toString().toLowerCase()=="string")na.quickList[i]=new c({hex:na.quickList[i]});var Db=na.quickList[i].val("a"),cb=na.quickList[i].val("ahex");if(!K.alphaSupport&&cb)cb=cb.substring(0,6)+"ff";var Fb=na.quickList[i].val("hex");fb+='<span class="QuickColor"'+(cb&&' title="#'+cb+'"'||
"")+' style="background-color:'+(Fb&&"#"+Fb||"")+";"+(Fb?"":"background-image:url("+ma.clientPath+"NoColor.png)")+(K.alphaSupport&&Db&&Db<255?";opacity:"+Math.precision(Db/255,4)+";filter:Alpha(opacity="+Math.precision(Db/2.55,4)+")":"")+'">&nbsp;</span>'}Ya.call(e,Aa,ma.clientPath+"bar-opacity.png");Aa.html(fb);Aa.find(".QuickColor").click(Ab)}Wa.call(e,l.color.mode);na.active.bind(Oa);a.isFunction(kb)&&na.active.bind(kb);na.current.bind(gb);if(K.expandable){e.icon=N.parents(".Icon:first");Ka=e.icon.find(".Color:first").css({backgroundColor:Xa&&
"#"+Xa||"transparent"});Ra=e.icon.find(".Alpha:first");Ya.call(e,Ra,ma.clientPath+"bar-opacity.png");Ea.call(e,Ra,Math.precision((255-(aa!=null?aa.a:0))*100/255,4));Na=e.icon.find(".Image:first").css({backgroundImage:"url('"+ma.clientPath+ma.picker.file+"')"}).bind("click",eb);if(K.bindToInput&&K.updateInputColor)K.input.css({backgroundColor:Xa&&"#"+Xa||"transparent",color:aa==null||aa.v>75?"#000000":"#ffffff"});Sa=Pa.find(".Move:first").bind("mousedown",xa);na.active.bind(Nb)}else Hb.call(e)},ma=
var Xa=p.find("span"),hb=L.find("span");T=Xa.filter(".Map1:first");M=Xa.filter(".Map2:first");J=Xa.filter(".Map3:first");da=hb.filter(".Map1:first");V=hb.filter(".Map2:first");O=hb.filter(".Map3:first");ga=hb.filter(".Map4:first");ta=hb.filter(".Map5:first");ha=hb.filter(".Map6:first");ca=new n(p,{map:{width:ma.colorMap.width,height:ma.colorMap.height},arrow:{image:ma.clientPath+ma.colorMap.arrow.file,width:ma.colorMap.arrow.width,height:ma.colorMap.arrow.height}});ca.bind(Ia);ea=new n(L,{map:{width:ma.colorBar.width,
height:ma.colorBar.height},arrow:{image:ma.clientPath+ma.colorBar.arrow.file,width:ma.colorBar.arrow.width,height:ma.colorBar.arrow.height}});ea.bind(Qa);ra=new f(Pa,na.active,K.expandable&&K.bindToInput?K.input:null,K.alphaPrecision);Xa=aa!=null?aa.hex:null;var pb=Pa.find(".Preview");hb=Pa.find(".Button");sa=pb.find(".Active:first").css({backgroundColor:Xa&&"#"+Xa||"transparent"});la=pb.find(".Current:first").css({backgroundColor:Xa&&"#"+Xa||"transparent"}).bind("click",Ma);Ea.call(e,la,Math.precision(na.current.val("a")*
100)/255,4);oa=hb.find(".Ok:first").bind("click",xb);Z=hb.find(".Cancel:first").bind("click",ob);Aa=hb.find(".Grid:first");setTimeout(function(){Ya.call(e,T,ma.clientPath+"Maps.png");Ya.call(e,M,ma.clientPath+"Maps.png");Ya.call(e,J,ma.clientPath+"map-opacity.png");Ya.call(e,da,ma.clientPath+"Bars.png");Ya.call(e,V,ma.clientPath+"Bars.png");Ya.call(e,O,ma.clientPath+"Bars.png");Ya.call(e,ga,ma.clientPath+"Bars.png");Ya.call(e,ta,ma.clientPath+"bar-opacity.png");Ya.call(e,ha,ma.clientPath+"AlphaBar.png");
Ya.call(e,pb.find("div:last"),ma.clientPath+"preview-opacity.png")},0);Pa.find("td.Radio input").bind("click",Za);if(na.quickList&&na.quickList.length>0){hb="";for(i=0;i<na.quickList.length;i++){if((typeof na.quickList[i]).toString().toLowerCase()=="string")na.quickList[i]=new c({hex:na.quickList[i]});var Db=na.quickList[i].val("a"),cb=na.quickList[i].val("ahex");if(!K.alphaSupport&&cb)cb=cb.substring(0,6)+"ff";var Eb=na.quickList[i].val("hex");hb+='<span class="QuickColor"'+(cb&&' title="#'+cb+'"'||
"")+' style="background-color:'+(Eb&&"#"+Eb||"")+";"+(Eb?"":"background-image:url("+ma.clientPath+"NoColor.png)")+(K.alphaSupport&&Db&&Db<255?";opacity:"+Math.precision(Db/255,4)+";filter:Alpha(opacity="+Math.precision(Db/2.55,4)+")":"")+'">&nbsp;</span>'}Ya.call(e,Aa,ma.clientPath+"bar-opacity.png");Aa.html(hb);Aa.find(".QuickColor").click(yb)}Wa.call(e,l.color.mode);na.active.bind(Oa);a.isFunction(mb)&&na.active.bind(mb);na.current.bind(ib);if(K.expandable){e.icon=N.parents(".Icon:first");Ka=e.icon.find(".Color:first").css({backgroundColor:Xa&&
"#"+Xa||"transparent"});Ra=e.icon.find(".Alpha:first");Ya.call(e,Ra,ma.clientPath+"bar-opacity.png");Ea.call(e,Ra,Math.precision((255-(aa!=null?aa.a:0))*100/255,4));Na=e.icon.find(".Image:first").css({backgroundImage:"url('"+ma.clientPath+ma.picker.file+"')"}).bind("click",fb);if(K.bindToInput&&K.updateInputColor)K.input.css({backgroundColor:Xa&&"#"+Xa||"transparent",color:aa==null||aa.v>75?"#000000":"#ffffff"});Sa=Pa.find(".Move:first").bind("mousedown",xa);na.active.bind(Lb)}else Hb.call(e)},ma=
l.images,Y=l.localization,na={active:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({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 c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):
new c({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,e,{commitCallback:sb,liveCallback:kb,cancelCallback:Gb,color:na,show:Hb,hide:Ob,destroy:function(){w.find("td.Radio input").unbind("click",Za);la.unbind("click",Ma);Z.unbind("click",mb);oa.unbind("click",zb);if(l.window.expandable){Na.unbind("click",eb);Sa.unbind("mousedown",xa);e.icon=null}w.find(".QuickColor").unbind("click",
Ab);ha=ua=fa=O=V=da=J=M=T=L=p=null;ca.destroy();ca=null;ea.destroy();ea=null;ra.destroy();kb=Gb=sb=Aa=Z=oa=la=sa=ra=null;w.html("");for(i=0;i<m.length;i++)m[i]==e&&m.splice(i,1)}});m.push(e);setTimeout(function(){Pb.call(e)},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 c({ahex:"#ffcc00ff"}),
new c({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,e,{commitCallback:sb,liveCallback:mb,cancelCallback:Gb,color:na,show:Hb,hide:Mb,destroy:function(){w.find("td.Radio input").unbind("click",Za);la.unbind("click",Ma);Z.unbind("click",ob);oa.unbind("click",xb);if(l.window.expandable){Na.unbind("click",fb);Sa.unbind("mousedown",xa);e.icon=null}w.find(".QuickColor").unbind("click",
yb);ha=ta=ga=O=V=da=J=M=T=L=p=null;ca.destroy();ca=null;ea.destroy();ea=null;ra.destroy();mb=Gb=sb=Aa=Z=oa=la=sa=ra=null;w.html("");for(i=0;i<m.length;i++)m[i]==e&&m.splice(i,1)}});m.push(e);setTimeout(function(){Nb.call(e)},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 c({ahex:"#ffcc00ff"}),
quickList:[new c({h:360,s:33,v:100}),new c({h:360,s:66,v:100}),new c({h:360,s:100,v:100}),new c({h:360,s:100,v:75}),new c({h:360,s:100,v:50}),new c({h:180,s:0,v:100}),new c({h:30,s:33,v:100}),new c({h:30,s:66,v:100}),new c({h:30,s:100,v:100}),new c({h:30,s:100,v:75}),new c({h:30,s:100,v:50}),new c({h:180,s:0,v:90}),new c({h:60,s:33,v:100}),new c({h:60,s:66,v:100}),new c({h:60,s:100,v:100}),new c({h:60,s:100,v:75}),new c({h:60,s:100,v:50}),new c({h:180,s:0,v:80}),new c({h:90,s:33,v:100}),new c({h:90,
s:66,v:100}),new c({h:90,s:100,v:100}),new c({h:90,s:100,v:75}),new c({h:90,s:100,v:50}),new c({h:180,s:0,v:70}),new c({h:120,s:33,v:100}),new c({h:120,s:66,v:100}),new c({h:120,s:100,v:100}),new c({h:120,s:100,v:75}),new c({h:120,s:100,v:50}),new c({h:180,s:0,v:60}),new c({h:150,s:33,v:100}),new c({h:150,s:66,v:100}),new c({h:150,s:100,v:100}),new c({h:150,s:100,v:75}),new c({h:150,s:100,v:50}),new c({h:180,s:0,v:50}),new c({h:180,s:33,v:100}),new c({h:180,s:66,v:100}),new c({h:180,s:100,v:100}),
new c({h:180,s:100,v:75}),new c({h:180,s:100,v:50}),new c({h:180,s:0,v:40}),new c({h:210,s:33,v:100}),new c({h:210,s:66,v:100}),new c({h:210,s:100,v:100}),new c({h:210,s:100,v:75}),new c({h:210,s:100,v:50}),new c({h:180,s:0,v:30}),new c({h:240,s:33,v:100}),new c({h:240,s:66,v:100}),new c({h:240,s:100,v:100}),new c({h:240,s:100,v:75}),new c({h:240,s:100,v:50}),new c({h:180,s:0,v:20}),new c({h:270,s:33,v:100}),new c({h:270,s:66,v:100}),new c({h:270,s:100,v:100}),new c({h:270,s:100,v:75}),new c({h:270,