removed custom fonts and added support for dimensions

master
Mark MacKay 2012-08-01 18:07:04 -05:00
parent 1307c9b1af
commit d111ff1542
7 changed files with 248 additions and 244 deletions

BIN
editor/.DS_Store vendored

Binary file not shown.

View File

@ -324,11 +324,12 @@
<input id="font_family" data-title="Change Font Family" size="12" type="hidden" /> <input id="font_family" data-title="Change Font Family" size="12" type="hidden" />
<select id="font_family_dropdown"> <select id="font_family_dropdown">
<option value="Helvetica, Arial, sans-serif" selected>Helvetica</option> <option value="Helvetica, Arial, sans-serif" selected>Helvetica</option>
<option value="Arvo, sans-serif">Arvo</option> <!--<option value="Arvo, sans-serif">Arvo</option>
<option value="Euphoria, sans-serif">Euphoria</option> <option value="Euphoria, sans-serif">Euphoria</option>
<option value="Oswald, sans-serif">Oswald</option> <option value="Oswald, sans-serif">Oswald</option>
<option value="'Shadows Into Light', serif">Shadows Into Light</option> <option value="'Shadows Into Light', serif">Shadows Into Light</option>
<option value="'Simonetta', serif">Simonetta</option> <option value="'Simonetta', serif">Simonetta</option>-->
<option value="'Trebuchet MS', Gadget, sans-serif">Georgia</option>
<option value="Georgia, Times, 'Times New Roman', serif">Georgia</option> <option value="Georgia, Times, 'Times New Roman', serif">Georgia</option>
<option value="'Palatino Linotype', 'Book Antiqua', Palatino, serif">Palatino</option> <option value="'Palatino Linotype', 'Book Antiqua', Palatino, serif">Palatino</option>
<option value="'Times New Roman', Times, serif">Times</option> <option value="'Times New Roman', Times, serif">Times</option>

View File

@ -148,8 +148,6 @@
})(); })();
(function() { (function() {
$("#canvas_width").val(curConfig.dimensions[0]);
$("#canvas_height").val(curConfig.dimensions[1]);
$("body").toggleClass("touch", svgedit.browser.isTouch()); $("body").toggleClass("touch", svgedit.browser.isTouch());
// Load config/data from URL if given // Load config/data from URL if given
var urldata = $.deparam.querystring(true); var urldata = $.deparam.querystring(true);
@ -194,6 +192,9 @@
} }
})(); })();
$("#canvas_width").val(curConfig.dimensions[0]);
$("#canvas_height").val(curConfig.dimensions[1]);
var extFunc = function() { var extFunc = function() {
$.each(curConfig.extensions, function() { $.each(curConfig.extensions, function() {
var extname = this; var extname = this;

View File

@ -379,124 +379,124 @@ key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},
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...", 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" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions}; saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions};
b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,n){var s=g.id,A=s.split("_"),F=A[0];A=A[1];n&&h.setStrokeAttr("stroke-"+F,A);wa();Ib("#cur_"+F,s,20);a(g).addClass("current").siblings().removeClass("current")}(function(){var g= b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,n){var s=g.id,A=s.split("_"),F=A[0];A=A[1];n&&h.setStrokeAttr("stroke-"+F,A);wa();Ib("#cur_"+F,s,20);a(g).addClass("current").siblings().removeClass("current")}(function(){var g=
window.opener;if(g)try{var n=g.document.createEvent("Event");n.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(n)}catch(s){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color= window.opener;if(g)try{var n=g.document.createEvent("Event");n.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(n)}catch(s){}})();(function(){a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color="#"+g.bkgd_color;svgEditor.setConfig(g);var n=g.source,s=a.param.querystring();
"#"+g.bkgd_color;svgEditor.setConfig(g);var n=g.source,s=a.param.querystring();if(!n)if(s.indexOf("source=data:")>=0)n=s.match(/source=(data:[^&]*)/)[1];if(n)if(n.indexOf("data:")===0){n=n.replace(/ /g,"+");b.loadFromDataURI(n)}else b.loadFromString(n);else if(s.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(s.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();var l=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(n){if(!n){n=document.createElement("script"); if(!n)if(s.indexOf("source=data:")>=0)n=s.match(/source=(data:[^&]*)/)[1];if(n)if(n.indexOf("data:")===0){n=n.replace(/ /g,"+");b.loadFromDataURI(n)}else b.loadFromString(n);else if(s.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(s.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);var l=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(n){if(!n){n=
n.src=curConfig.extPath+g;document.querySelector("head").appendChild(n)}})})};document.location.protocol==="file:"?setTimeout(l,100):l();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png", document.createElement("script");n.src=curConfig.extPath+g;document.querySelector("head").appendChild(n)}})})};document.location.protocol==="file:"?setTimeout(l,100):l();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png",
node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image", "delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path",
"#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"}, "#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",
resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var n= "#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");
a("#"+this.id+"_show"),s=n.attr("data-curopt");if(!n.children("svg, img").length){s=a(s).children().clone();if(s.length){s[0].removeAttribute("style");n.append(s)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter", var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+"_show"),s=n.attr("data-curopt");if(!n.children("svg, img").length){s=a(s).children().clone();if(s.length){s[0].removeAttribute("style");n.append(s)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-
function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};l=navigator.platform.indexOf("Mac")>=0;var v=navigator.userAgent.indexOf("AppleWebKit")>=0,B=l?"meta+":"ctrl+",q=h.pathActions,K=h.undoMgr,R=svgedit.utilities,O=curConfig.imgPath+ 10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};l=navigator.platform.indexOf("Mac")>=0;var v=navigator.userAgent.indexOf("AppleWebKit")>=
"placeholder.svg",H=a("#workarea"),S=a("#cmenu_canvas"),U=null,N=1,ga="toolbars",pa="";l||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),n=a("#dialog_buttons"),s=function(A,F,J,L){a("#dialog_content").html("<p>"+F.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",A=="prompt");n.empty();var Z=a('<input type="button" value="'+ 0,B=l?"meta+":"ctrl+",q=h.pathActions,K=h.undoMgr,R=svgedit.utilities,O=curConfig.imgPath+"placeholder.svg",H=a("#workarea"),S=a("#cmenu_canvas"),U=null,N=1,ga="toolbars",pa="";l||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),n=a("#dialog_buttons"),s=function(A,F,J,L){a("#dialog_content").html("<p>"+F.replace(/\n/g,
uiStrings.common.ok+'">').appendTo(n);A!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(n).on("click, touchstart",function(){g.hide();J(false)});if(A=="prompt"){var ba=a('<input type="text">').prependTo(n);ba.val(L||"");ba.bind("keydown","return",function(){Z.trigger("click touchstart")})}A=="process"&&Z.hide();g.show();Z.on("click touchstart",function(){g.hide();var T=A=="prompt"?ba.val():true;J&&J(T)}).focus();A=="prompt"&&ba.focus()};a.alert=function(A,F){s("alert", "</p><p>")+"</p>").toggleClass("prompt",A=="prompt");n.empty();var Z=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(n);A!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(n).on("click, touchstart",function(){g.hide();J(false)});if(A=="prompt"){var ba=a('<input type="text">').prependTo(n);ba.val(L||"");ba.bind("keydown","return",function(){Z.trigger("click touchstart")})}A=="process"&&Z.hide();g.show();Z.on("click touchstart",function(){g.hide();
A,F)};a.confirm=function(A,F){s("confirm",A,F)};a.process_cancel=function(A,F){s("process",A,F)};a.prompt=function(A,F,J){s("prompt",A,J,F)}})();var fa=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},Q=null,Y=false,xa=false,ja="",ca=function(g,n){var s=h.getResolution();a("#svgcanvas").position();var A=h.setBBoxZoom(n, var T=A=="prompt"?ba.val():true;J&&J(T)}).focus();A=="prompt"&&ba.focus()};a.alert=function(A,F){s("alert",A,F)};a.confirm=function(A,F){s("confirm",A,F)};a.process_cancel=function(A,F){s("process",A,F)};a.prompt=function(A,F,J){s("prompt",A,J,F)}})();var fa=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},Q=
H.width()-15,H.height()-15);if(A){var F=A.zoom;A=A.bbox;if(F<0.0010)Fa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),L=F-s.zoom;a("#zoom");var Z=s.zoom,ba=function(T){T=(T-J)/500;T=Math.pow(T-1,3)+1;h.setZoom(Z+L*T);D();if(T<1)g.animatedZoom=requestAnimationFrame(ba);else{a("#zoom").val(parseInt(F*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(F*100)+"]","#zoom_select").attr("selected","selected")}};ba(Date.now()); null,Y=false,xa=false,ja="",ca=function(g,n){var s=h.getResolution();a("#svgcanvas").position();var A=h.setBBoxZoom(n,H.width()-15,H.height()-15);if(A){var F=A.zoom;A=A.bbox;if(F<0.0010)Fa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),L=F-s.zoom;a("#zoom");var Z=s.zoom,ba=function(T){T=(T-J)/500;T=Math.pow(T-1,3)+1;h.setZoom(Z+L*T);D();if(T<1)g.animatedZoom=requestAnimationFrame(ba);else{a("#zoom").val(parseInt(F*100));a("option","#zoom_select").removeAttr("selected");
h.getMode()=="zoom"&&A.width&&fa();Jb()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var V=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},W={},na=function(g){a.each(g,function(n,s){var A=a(n).children(),F=n+"_show",J=a(F),L=false;A.addClass("tool_button").unbind("click mousedown mouseup").each(function(T){var X=s[T];W[X.sel]=X.fn;if(X.isDefault)L=T;T=function(ha){var oa=X;if(ha.type=== a("option[value="+parseInt(F*100)+"]","#zoom_select").attr("selected","selected")}};ba(Date.now());h.getMode()=="zoom"&&A.width&&fa();Jb()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var V=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},W={},na=function(g){a.each(g,function(n,s){var A=a(n).children(),F=n+"_show",J=a(F),L=false;A.addClass("tool_button").unbind("click mousedown mouseup").each(function(T){var X=
"keydown"){var ea=a(oa.parent+"_show").hasClass("tool_button_current"),ua=a(oa.parent+"_show").attr("data-curopt");a.each(g[X.parent],function(sa,ra){if(ra.sel==ua)oa=!ha.shiftKey||!ea?ra:g[X.parent][sa+1]||g[X.parent][0]})}if(a(this).hasClass("disabled"))return false;Ua(F)&&oa.fn();var Ma=oa.icon?a.getSvgIcon(oa.icon,true):a(oa.sel).children().eq(0).clone();Ma[0].setAttribute("width",J.width());Ma[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ma).attr("data-curopt", s[T];W[X.sel]=X.fn;if(X.isDefault)L=T;T=function(ha){var oa=X;if(ha.type==="keydown"){var ea=a(oa.parent+"_show").hasClass("tool_button_current"),ua=a(oa.parent+"_show").attr("data-curopt");a.each(g[X.parent],function(sa,ra){if(ra.sel==ua)oa=!ha.shiftKey||!ea?ra:g[X.parent][sa+1]||g[X.parent][0]})}if(a(this).hasClass("disabled"))return false;Ua(F)&&oa.fn();var Ma=oa.icon?a.getSvgIcon(oa.icon,true):a(oa.sel).children().eq(0).clone();Ma[0].setAttribute("width",J.width());Ma[0].setAttribute("height",
oa.sel)};a(this).mouseup(T);X.key&&a(document).bind("keydown",X.key[0]+" shift+"+X.key[0],T)});if(L)J.attr("data-curopt",s[L].sel);else J.attr("data-curopt")||J.attr("data-curopt",s[0].sel);var Z,ba=a(F).position();a(n).css({left:ba.left+34,top:ba.top+77});J.mousedown(function(T){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ua(F,false);if(J.hasClass("disabled"))return false;var X=a(n),ha=ba.left+34,oa=X.width()*-1,ea=X.data("shown_popop")? J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ma).attr("data-curopt",oa.sel)};a(this).mouseup(T);X.key&&a(document).bind("keydown",X.key[0]+" shift+"+X.key[0],T)});if(L)J.attr("data-curopt",s[L].sel);else J.attr("data-curopt")||J.attr("data-curopt",s[0].sel);var Z,ba=a(F).position();a(n).css({left:ba.left+34,top:ba.top+77});J.mousedown(function(T){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ua(F,false);if(J.hasClass("disabled"))return false;
200:0;Z=setTimeout(function(){J.data("isLibrary")?X.css("left",ha).show():X.css("left",oa).show().animate({left:ha},50);X.data("shown_popop",true)},ea);T.preventDefault()}).mouseup(function(){clearTimeout(Z);var T=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(F.replace("_show","")).is(":visible"))Ua(F,true);else Ua(F)&&T in W&&W[T]()})});la()},qa=function(g,n){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(n)},ma=function(){a(".tools_flyout").each(function(){var g= var X=a(n),ha=ba.left+34,oa=X.width()*-1,ea=X.data("shown_popop")?200:0;Z=setTimeout(function(){J.data("isLibrary")?X.css("left",ha).show():X.css("left",oa).show().animate({left:ha},50);X.data("shown_popop",true)},ea);T.preventDefault()}).mouseup(function(){clearTimeout(Z);var T=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(F.replace("_show","")).is(":visible"))Ua(F,true);else Ua(F)&&T in W&&W[T]()})});la()},qa=function(g,n){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(n)},
a("#"+this.id+"_show"),n=g.offset();g=g.outerWidth();a(this).css({left:(n.left+g)*N,top:n.top})})},la=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});g[0].title=n.join(" / ")}})},za,Ga=function(g,n,s){var A=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+s+"_color defs *")[0];A={alpha:n};A[g.tagName]=g}else A=g.indexOf("#")===0?{alpha:n,solidColor:g.substr(1)}: ma=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show"),n=g.offset();g=g.outerWidth();a(this).css({left:(n.left+g)*N,top:n.top})})},la=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});g[0].title=n.join(" / ")}})},za,Ga=function(g,n,s){var A=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+s+"_color defs *")[0];A={alpha:n};A[g.tagName]=
{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(A)},Aa=h.getResolution();if(curConfig.baseUnit!=="px"){Aa.w=svgedit.units.convertUnit(Aa.w)+curConfig.baseUnit;Aa.h=svgedit.units.convertUnit(Aa.h)+curConfig.baseUnit}var Ha=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Aa.w+2,height:Aa.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")}; g}else A=g.indexOf("#")===0?{alpha:n,solidColor:g.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(A)},Aa=h.getResolution();if(curConfig.baseUnit!=="px"){Aa.w=svgedit.units.convertUnit(Aa.w)+curConfig.baseUnit;Aa.h=svgedit.units.convertUnit(Aa.h)+curConfig.baseUnit}var Ha=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Aa.w+2,height:Aa.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});
document.getElementById("canvas_background")||Ha();document.getElementById("canvas_background").getAttribute("fill");var Ja=b.setImageURL=function(g){g||(g=O);h.setImageURL(g);a("#image_url").val(g)},Ia=function(){var g=Q;if(g!=null&&!g.parentNode)g=null;if(Y&&Y[0]!=null&&!Y[0].parentNode)Y=false;var n=h.getCurrentDrawing().getCurrentLayerName(),s=h.getMode(),A=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,F=s=="pathedit";if(F){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide(); h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ha();document.getElementById("canvas_background").getAttribute("fill");var Ja=b.setImageURL=function(g){g||(g=O);h.setImageURL(g);a("#image_url").val(g)},Ia=function(){var g=Q;if(g!=null&&!g.parentNode)g=null;if(Y&&Y[0]!=null&&!Y[0].parentNode)Y=false;var n=h.getCurrentDrawing().getCurrentLayerName(),s=h.getMode(),A=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,F=s=="pathedit";if(F){a(".context_panel").hide();
n=q.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!q.canDeleteNodes);Ib("#tool_openclose_path",q.closed_subpath?"open_path":"close_path");if(n){F=a("#seg_type");if(A){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));n.type?F.val(n.type).removeAttr("disabled"):F.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected"); a("#path_node_panel").show();a("#stroke_panel").hide();n=q.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!q.canDeleteNodes);Ib("#tool_openclose_path",q.closed_subpath?"open_path":"close_path");if(n){F=a("#seg_type");if(A){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));n.type?F.val(n.type).removeAttr("disabled"):
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(Y){Y=Y.filter(Boolean);(g=h.elementsAreSame(Y)?Y[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!Y){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var L=g.nodeName,Z=h.getRotationAngle(g); F.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(Y){Y=Y.filter(Boolean);(g=h.elementsAreSame(Y)?Y[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!Y){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=
a("#angle").val(Math.round(Z));Z=h.getBlur(g);a("#blur").val(Z);if(!F&&s!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var ba,T;if(["g","polyline","path"].indexOf(L)>=0)if(s=h.getStrokedBBox([g])){ba=s.x;T=s.y}if(A){ba=svgedit.units.convertUnit(ba);T=svgedit.units.convertUnit(T)}a("#"+L+"_x").val(Math.round(ba));a("#"+L+"_y").val(Math.round(T));if(L==="polyline"){a("#path_x").val(Math.round(ba));a("#path_y").val(Math.round(T))}["image","text","path","g","use"].indexOf(L)== null){a("#stroke_panel").show();var L=g.nodeName,Z=h.getRotationAngle(g);a("#angle").val(Math.round(Z));Z=h.getBlur(g);a("#blur").val(Z);if(!F&&s!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var ba,T;if(["g","polyline","path"].indexOf(L)>=0)if(s=h.getStrokedBBox([g])){ba=s.x;T=s.y}if(A){ba=svgedit.units.convertUnit(ba);T=svgedit.units.convertUnit(T)}a("#"+L+"_x").val(Math.round(ba));a("#"+L+"_y").val(Math.round(T));if(L==="polyline"){a("#path_x").val(Math.round(ba));
-1&&a(".action_path_convert_selected").removeClass("disabled");L==="path"&&a(".action_path_selected").removeClass("disabled")}A=null;if(X==="a"){A=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();A=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!A);A&&a("#link_url").val(A);A={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1", a("#path_y").val(Math.round(T))}["image","text","path","g","use"].indexOf(L)==-1&&a(".action_path_convert_selected").removeClass("disabled");L==="path"&&a(".action_path_selected").removeClass("disabled")}A=null;if(X==="a"){A=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();A=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!A);A&&a("#link_url").val(A);A={g:[],a:[],rect:["rx","width","height","x","y"],image:["width",
"y1","x2","y2"],text:["x","y"],use:[],path:[]};var X=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(X=="path"||X=="polyline")a("#path_panel").show();if(A[X]){A=A[X];a("#"+X+"_panel").show();X=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(A,function(ha,oa){var ea=g.getAttribute(oa);if(curConfig.baseUnit!=="px"&&g[oa])ea=svgedit.units.convertUnit(g[oa].baseVal.value);var ua=document.getElementById(X+"_"+oa);ua.value=Math.round(ea)||0;ua.getAttribute("data-cursor")=== "height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var X=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(X=="path"||X=="polyline")a("#path_panel").show();if(A[X]){A=A[X];a("#"+X+"_panel").show();X=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(A,function(ha,oa){var ea=g.getAttribute(oa);if(curConfig.baseUnit!=="px"&&g[oa])ea=svgedit.units.convertUnit(g[oa].baseVal.value);var ua=document.getElementById(X+
"true"&&a.fn.dragInput.updateCursor(ua)});if(X=="text"){A=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(A);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(A.split(",")[0].replace(/'/g,"")).css("font-family",A);h.addedNew&&setTimeout(function(){a("#text").focus().select()}, "_"+oa);ua.value=Math.round(ea)||0;ua.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(ua)});if(X=="text"){A=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(A);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(A.split(",")[0].replace(/'/g,
100)}else if(X=="image")Ja(h.getHref(g));else if(X==="g"||X==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(X==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(X==="g"||!Y?"dis":"en")+"ableContextMenuItems"]("#group")}if(Y){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back"); "")).css("font-family",A);h.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(X=="image")Ja(h.getHref(g));else if(X==="g"||X==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(X==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(X==="g"||!Y?"dis":"en")+"ableContextMenuItems"]("#group")}if(Y){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||
K.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");K.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!F||Y){a("#selLayerNames").removeAttr("disabled").val(n);S.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,n){var s=h.getMode();s==="select"&& J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");K.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");K.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!F||Y){a("#selLayerNames").removeAttr("disabled").val(n);S.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",
fa();if(s==="pathedit")return Ia();Q=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);Y=n.length>=2?n:false;if(h.elementsAreSame(Y))Q=Y[0];if(Q!=null){a("#multiselected_panel").hide();if(Q!=null)switch(Q.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":s=null;for(var A=Q.getElementsByTagName("*"),F=0,J=A.length;F<J;F++){var L=A[F].getAttribute("stroke-width");if(F===0)s=L;else if(s!==L)s=null}a("#stroke_width").val(s===null?"":s);break;default:a("#stroke_width").val(Q.getAttribute("stroke-width")|| function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,n){var s=h.getMode();s==="select"&&fa();if(s==="pathedit")return Ia();Q=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);Y=n.length>=2?n:false;if(h.elementsAreSame(Y))Q=Y[0];if(Q!=null){a("#multiselected_panel").hide();if(Q!=null)switch(Q.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":s=null;for(var A=Q.getElementsByTagName("*"),F=0,J=A.length;F<J;F++){var L=A[F].getAttribute("stroke-width");
1);s=Q.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+s+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);s=Q.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+s).length!=0&&d(a("#linejoin_"+s)[0]);s=Q.getAttribute("stroke-linecap")||"butt";a("#linecap_"+s).length!=0&&d(a("#linecap_"+s)[0])}if(Q!=null){s=(Q.getAttribute("opacity")||1)*100;a("#group_opacity").val(s); if(F===0)s=L;else if(s!==L)s=null}a("#stroke_width").val(s===null?"":s);break;default:a("#stroke_width").val(Q.getAttribute("stroke-width")||1);s=Q.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+s+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);s=Q.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+s).length!=0&&d(a("#linejoin_"+s)[0]);s=Q.getAttribute("stroke-linecap")||
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}Y.length&&a("#tools_top").addClass("multiselected")}else if(Y.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:n,selectedElement:Q,multiselected:Y})});h.bind("transition",function(g,n){var s=h.getMode(),A=n[0];if(A){Y=n.length>=2&&n[1]!=null? "butt";a("#linecap_"+s).length!=0&&d(a("#linecap_"+s)[0])}if(Q!=null){s=(Q.getAttribute("opacity")||1)*100;a("#group_opacity").val(s);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}Y.length&&a("#tools_top").addClass("multiselected")}else if(Y.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:n,
n:null;if(!Y)switch(s){case "rotate":s=h.getRotationAngle(A);a("#angle").val(Math.round(s));rotateCursor(s);a("#tool_reorient").toggleClass("disabled",s==0)}h.runExtensions("elementTransition",{elems:n})}});h.bind("changed",function(g,n){var s=h.getMode();s==="select"&&fa();for(var A=0;A<n.length;++A){var F=n[A];if(F&&F.tagName==="svg")D();else if(F&&Q&&Q.parentNode==null)Q=F}b.show_save_warning=true;Ia();if(Q&&s==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged", selectedElement:Q,multiselected:Y})});h.bind("transition",function(g,n){var s=h.getMode(),A=n[0];if(A){Y=n.length>=2&&n[1]!=null?n:null;if(!Y)switch(s){case "rotate":s=h.getRotationAngle(A);a("#angle").val(Math.round(s));rotateCursor(s);a("#tool_reorient").toggleClass("disabled",s==0)}h.runExtensions("elementTransition",{elems:n})}});h.bind("changed",function(g,n){var s=h.getMode();s==="select"&&fa();for(var A=0;A<n.length;++A){var F=n[A];if(F&&F.tagName==="svg")D();else if(F&&Q&&Q.parentNode==null)Q=
{elems:n})});h.bind("saved",function(g,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var s=navigator.userAgent;if(~s.indexOf("Chrome")&&a.browser.version>=533||~s.indexOf("MSIE"))zb(0,true);else{var A=g.open("data:image/svg+xml;base64,"+R.encode64(n)),F=a.pref("save_notice_done");if(F!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(s.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done", F}b.show_save_warning=true;Ia();if(Q&&s==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged",{elems:n})});h.bind("saved",function(g,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var s=navigator.userAgent;if(~s.indexOf("Chrome")&&a.browser.version>=533||~s.indexOf("MSIE"))zb(0,true);else{var A=g.open("data:image/svg+xml;base64,"+R.encode64(n)),F=a.pref("save_notice_done");if(F!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s",
"all");F="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");F!=="part"&&A.alert(J)}}});h.bind("exported",function(g,n){var s=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var A=a("#export_canvas")[0];A.width=h.contentW;A.height=h.contentH;canvg(A,n.svg,{renderCallback:function(){var F=A.toDataURL("image/png");U.location.href=F;if(a.pref("export_notice_done")!=="all"){F=uiStrings.notification.saveFromBrowser.replace("%s", "SVG");if(s.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");F="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");F!=="part"&&A.alert(J)}}});h.bind("exported",function(g,n){var s=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var A=a("#export_canvas")[0];A.width=h.contentW;A.height=h.contentH;canvg(A,n.svg,{renderCallback:function(){var F=
"PNG");if(s.length)F+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+s.join("\n \u2022 ");a.pref("export_notice_done","all");U.alert(F)}}})});h.bind("zoomed",ca);h.bind("contextset",function(g,n){var s="";if(n){var A="";s='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){A+=" > "+this.id;s+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});ja=A}else ja=null;a("#cur_context_panel").toggle(!!n).html(s)}); A.toDataURL("image/png");U.location.href=F;if(a.pref("export_notice_done")!=="all"){F=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(s.length)F+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+s.join("\n \u2022 ");a.pref("export_notice_done","all");U.alert(F)}}})});h.bind("zoomed",ca);h.bind("contextset",function(g,n){var s="";if(n){var A="";s='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){A+=
h.bind("extension_added",function(g,n){function s(){if(za){clearTimeout(za);za=null}F||(za=setTimeout(function(){F=true;hb(u.iconsize)},50))}var A=false,F=false,J=true,L=function(){if(n.callback&&!A&&J){A=true;n.callback()}},Z=[];n.context_tools&&a.each(n.context_tools,function(oa,ea){var ua=ea.container_id?' id="'+ea.container_id+'"':"",Ma=a("#"+ea.panel);Ma.length||(Ma=a("<div>",{id:ea.panel}).appendTo("#tools_top").hide());switch(ea.type){case "tool_button":var sa='<div class="tool_button">'+ea.id+ " > "+this.id;s+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});ja=A}else ja=null;a("#cur_context_panel").toggle(!!n).html(s)});h.bind("extension_added",function(g,n){function s(){if(za){clearTimeout(za);za=null}F||(za=setTimeout(function(){F=true;hb(u.iconsize)},50))}var A=false,F=false,J=true,L=function(){if(n.callback&&!A&&J){A=true;n.callback()}},Z=[];n.context_tools&&a.each(n.context_tools,function(oa,ea){var ua=ea.container_id?' id="'+ea.container_id+'"':"",Ma=a("#"+ea.panel);Ma.length||
"</div>",ra=a(sa).appendTo(Ma);ea.events&&a.each(ea.events,function(Oa,lb){a(ra).bind(Oa,lb)});break;case "select":sa="<label"+ua+'><select id="'+ea.id+'">';a.each(ea.options,function(Oa,lb){sa+='<option value="'+Oa+'"'+(Oa==ea.defval?" selected":"")+">"+lb+"</option>"});sa+="</select></label>";var Za=a(sa).appendTo(Ma).find("select");a.each(ea.events,function(Oa,lb){a(Za).bind(Oa,lb)});break;case "button-select":sa='<div id="'+ea.id+'" class="dropdown toolset" title="'+ea.title+'"><div id="cur_'+ (Ma=a("<div>",{id:ea.panel}).appendTo("#tools_top").hide());switch(ea.type){case "tool_button":var sa='<div class="tool_button">'+ea.id+"</div>",ra=a(sa).appendTo(Ma);ea.events&&a.each(ea.events,function(Oa,lb){a(ra).bind(Oa,lb)});break;case "select":sa="<label"+ua+'><select id="'+ea.id+'">';a.each(ea.options,function(Oa,lb){sa+='<option value="'+Oa+'"'+(Oa==ea.defval?" selected":"")+">"+lb+"</option>"});sa+="</select></label>";var Za=a(sa).appendTo(Ma).find("select");a.each(ea.events,function(Oa,
ea.id+'" class="icon_label"></div><button></button></div>';ua=a('<ul id="'+ea.id+'_opts"></ul>').appendTo("#option_lists");ea.colnum&&ua.addClass("optcols"+ea.colnum);a(sa).appendTo(Ma).children();Z.push({elem:"#"+ea.id,list:"#"+ea.id+"_opts",title:ea.title,callback:ea.events.change,cur:"#cur_"+ea.id});break;case "input":sa="<label"+ua+'><span id="'+ea.id+'_label">'+ea.label+':</span><input id="'+ea.id+'" title="'+ea.title+'" size="'+(ea.size||"4")+'" value="'+(ea.defval||"")+'" type="text"/></label>'; lb){a(Za).bind(Oa,lb)});break;case "button-select":sa='<div id="'+ea.id+'" class="dropdown toolset" title="'+ea.title+'"><div id="cur_'+ea.id+'" class="icon_label"></div><button></button></div>';ua=a('<ul id="'+ea.id+'_opts"></ul>').appendTo("#option_lists");ea.colnum&&ua.addClass("optcols"+ea.colnum);a(sa).appendTo(Ma).children();Z.push({elem:"#"+ea.id,list:"#"+ea.id+"_opts",title:ea.title,callback:ea.events.change,cur:"#cur_"+ea.id});break;case "input":sa="<label"+ua+'><span id="'+ea.id+'_label">'+
var Qa=a(sa).appendTo(Ma).find("input");ea.spindata&&Qa.SpinButton(ea.spindata);ea.events&&a.each(ea.events,function(Oa,lb){Qa.bind(Oa,lb)})}});if(n.buttons){var ba={},T={},X=n.svgicons,ha={};a.each(n.buttons,function(oa,ea){for(var ua,Ma=ea.id,sa=oa;a("#"+Ma).length;)Ma=ea.id+"_"+ ++sa;if(X){ba[Ma]=ea.icon;sa=ea.svgicon?ea.svgicon:ea.id;if(ea.type=="app_menu")T["#"+Ma+" > div"]=sa;else T["#"+Ma]=sa}else ua=ea.type=="menu"?"":a('<img src="'+ea.icon+'">');var ra,Za;switch(ea.type){case "mode_flyout":case "mode":ra= ea.label+':</span><input id="'+ea.id+'" title="'+ea.title+'" size="'+(ea.size||"4")+'" value="'+(ea.defval||"")+'" type="text"/></label>';var Qa=a(sa).appendTo(Ma).find("input");ea.spindata&&Qa.SpinButton(ea.spindata);ea.events&&a.each(ea.events,function(Oa,lb){Qa.bind(Oa,lb)})}});if(n.buttons){var ba={},T={},X=n.svgicons,ha={};a.each(n.buttons,function(oa,ea){for(var ua,Ma=ea.id,sa=oa;a("#"+Ma).length;)Ma=ea.id+"_"+ ++sa;if(X){ba[Ma]=ea.icon;sa=ea.svgicon?ea.svgicon:ea.id;if(ea.type=="app_menu")T["#"+
"tool_button";if(ea.cls)ra+=" "+ea.cls;Za="#tools_left";break;case "context":ra="tool_button";Za="#"+ea.panel;a(Za).length||a("<div>",{id:ea.panel}).appendTo("#tools_top");break;case "menu":ra="menu_item tool_button";Za="#"+(ea.after||ea.panel);break;case "app_menu":ra="";Za=ea.parent||"#main_menu ul";a(Za).length||a("<div>",{id:ea.panel}).appendTo("#tools_top")}var Qa=a(ea.list||ea.type=="app_menu"?"<li/>":"<div/>").attr("id",Ma).attr("title",ea.title).addClass(ra);if(!ea.includeWith&&!ea.list){if("position"in Ma+" > div"]=sa;else T["#"+Ma]=sa}else ua=ea.type=="menu"?"":a('<img src="'+ea.icon+'">');var ra,Za;switch(ea.type){case "mode_flyout":case "mode":ra="tool_button";if(ea.cls)ra+=" "+ea.cls;Za="#tools_left";break;case "context":ra="tool_button";Za="#"+ea.panel;a(Za).length||a("<div>",{id:ea.panel}).appendTo("#tools_top");break;case "menu":ra="menu_item tool_button";Za="#"+(ea.after||ea.panel);break;case "app_menu":ra="";Za=ea.parent||"#main_menu ul";a(Za).length||a("<div>",{id:ea.panel}).appendTo("#tools_top")}var Qa=
ea)a(Za).children().eq(ea.position).before(Qa);else ea.type!="menu"||!ea.after?Qa.appendTo(Za):a(Za).after(Qa);if(ea.type=="mode_flyout"){sa=a(Qa);ra=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Oa=sa[0].id.replace("tool_","tools_"),lb=sa.clone().attr("id",Oa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(lb);ra=qa(Oa,sa);ra.data("isLibrary",true);lb.data("isLibrary",true)}T["#"+Oa+"_show"]=ea.id;Ma=ha["#"+ra[0].id]=[{sel:"#"+Ma,fn:ea.events.click,icon:ea.id,isDefault:true}, a(ea.list||ea.type=="app_menu"?"<li/>":"<div/>").attr("id",Ma).attr("title",ea.title).addClass(ra);if(!ea.includeWith&&!ea.list){if("position"in ea)a(Za).children().eq(ea.position).before(Qa);else ea.type!="menu"||!ea.after?Qa.appendTo(Za):a(Za).after(Qa);if(ea.type=="mode_flyout"){sa=a(Qa);ra=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Oa=sa[0].id.replace("tool_","tools_"),lb=sa.clone().attr("id",Oa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(lb);ra=qa(Oa,sa);
xb]}else if(ea.type=="app_menu"||ea.type=="menu")Qa.append(ea.title)}else if(ea.list){Qa.addClass("push_button");a("#"+ea.list+"_opts").append(Qa);if(ea.isDefault){a("#cur_"+ea.list).append(Qa.children().clone());sa=ea.svgicon?ea.svgicon:ea.id;T["#cur_"+ea.list]=sa}}else if(ea.includeWith){Za=ea.includeWith;sa=a(Za.button);ra=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Oa=sa[0].id.replace("tool_","tools_");lb=sa.clone().attr("id",Oa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"})); ra.data("isLibrary",true);lb.data("isLibrary",true)}T["#"+Oa+"_show"]=ea.id;Ma=ha["#"+ra[0].id]=[{sel:"#"+Ma,fn:ea.events.click,icon:ea.id,isDefault:true},xb]}else if(ea.type=="app_menu"||ea.type=="menu")Qa.append(ea.title)}else if(ea.list){Qa.addClass("push_button");a("#"+ea.list+"_opts").append(Qa);if(ea.isDefault){a("#cur_"+ea.list).append(Qa.children().clone());sa=ea.svgicon?ea.svgicon:ea.id;T["#cur_"+ea.list]=sa}}else if(ea.includeWith){Za=ea.includeWith;sa=a(Za.button);ra=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Oa=
sa.before(lb);ra=qa(Oa,sa)}var xb=G.getButtonData(Za.button);if(Za.isDefault)T["#"+Oa+"_show"]=ea.id;Ma=ha["#"+ra[0].id]=[{sel:"#"+Ma,fn:ea.events.click,icon:ea.id,key:ea.key,isDefault:ea.includeWith?ea.includeWith.isDefault:0},xb];Oa="position"in Za?Za.position:"last";xb=ra.children().length;if(!isNaN(Oa)&&Oa>=0&&Oa<xb)ra.children().eq(Oa).before(Qa);else{ra.append(Qa);Ma.reverse()}}X||Qa.append(ua);ea.list||a.each(ea.events,function(Cb,Mb){if(Cb=="click")if(ea.type=="mode"){ea.includeWith?Qa.bind(Cb, sa[0].id.replace("tool_","tools_");lb=sa.clone().attr("id",Oa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(lb);ra=qa(Oa,sa)}var xb=G.getButtonData(Za.button);if(Za.isDefault)T["#"+Oa+"_show"]=ea.id;Ma=ha["#"+ra[0].id]=[{sel:"#"+Ma,fn:ea.events.click,icon:ea.id,key:ea.key,isDefault:ea.includeWith?ea.includeWith.isDefault:0},xb];Oa="position"in Za?Za.position:"last";xb=ra.children().length;if(!isNaN(Oa)&&Oa>=0&&Oa<xb)ra.children().eq(Oa).before(Qa);else{ra.append(Qa);Ma.reverse()}}X||
Mb):Qa.bind(Cb,function(){Ua(Qa)&&Mb()});if(ea.key){a(document).bind("keydown",ea.key,Mb);ea.title&&Qa.attr("title",ea.title+" ["+ea.key+"]")}}else Qa.bind(Cb,Mb);else Qa.bind(Cb,Mb)});na(ha)});a.each(Z,function(){Va(this.elem,this.list,this.callback,{seticon:true})});if(X)J=false;a.svgIcons(X,{w:27,h:27,id_match:false,no_img:!v,fallback:ba,placement:T,callback:function(){u.iconsize&&u.iconsize!="m"&&s();J=true;L()}})}L()});h.textActions.setInputElem(a("#text")[0]);var Da='<div class="palette_item" data-rgb="none"></div>'; Qa.append(ua);ea.list||a.each(ea.events,function(Cb,Mb){if(Cb=="click")if(ea.type=="mode"){ea.includeWith?Qa.bind(Cb,Mb):Qa.bind(Cb,function(){Ua(Qa)&&Mb()});if(ea.key){a(document).bind("keydown",ea.key,Mb);ea.title&&Qa.attr("title",ea.title+" ["+ea.key+"]")}}else Qa.bind(Cb,Mb);else Qa.bind(Cb,Mb)});na(ha)});a.each(Z,function(){Va(this.elem,this.list,this.callback,{seticon:true})});if(X)J=false;a.svgIcons(X,{w:27,h:27,id_match:false,no_img:!v,fallback:ba,placement:T,callback:function(){u.iconsize&&
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(g,n){Da+='<div class="palette_item" style="background-color: '+n+';" data-rgb="'+n+'"></div>'});a("#palette").append(Da); u.iconsize!="m"&&s();J=true;L()}})}L()});h.textActions.setInputElem(a("#text")[0]);var Da='<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",
var ya=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";ya.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var Fa=function(g){var n=g.value/100;if(n<0.0010)g.value=0.1;else{g=h.getZoom();ca(window,{width:0,height:0,x:(H[0].scrollLeft+H.width()/2)/g,y:(H[0].scrollTop+H.height()/2)/g,zoom:n},true)}},wa=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray", "#aad4ff"],function(g,n){Da+='<div class="palette_item" style="background-color: '+n+';" data-rgb="'+n+'"></div>'});a("#palette").append(Da);var ya=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";ya.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var Fa=function(g){var n=g.value/100;if(n<0.0010)g.value=0.1;else{g=h.getZoom();ca(window,{width:0,height:0,x:(H[0].scrollLeft+H.width()/2)/g,y:(H[0].scrollTop+H.height()/
a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);wa()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});changeAttribute=function(g){var n=g.getAttribute("data-attr"),s=g.getAttribute("data-multiplier")||1;s=parseFloat(s); 2)/g,zoom:n},true)}},wa=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);wa()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});
s=g.value*s;if(!svgedit.units.isValidUnit(n,s,Q)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=Q.getAttribute(n);return false}h.changeSelectedAttributeNoUndo(n,s)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),n=g?"stroke":"fill",s=a(this).attr("data-rgb"),A=null;if(s==="transparent"||s==="initial"||s==="#none"){s= changeAttribute=function(g){var n=g.getAttribute("data-attr"),s=g.getAttribute("data-multiplier")||1;s=parseFloat(s);s=g.value*s;if(!svgedit.units.isValidUnit(n,s,Q)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=Q.getAttribute(n);return false}h.changeSelectedAttributeNoUndo(n,s)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),
"none";A=new a.jGraduate.Paint}else A=new a.jGraduate.Paint({alpha:100,solidColor:s.substr(1)});b.paintBox[n].setPaint(A);if(g){h.setColor("stroke",s);s!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",s);s!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");k()},function(){a(".stroke_tool").css("display", n=g?"stroke":"fill",s=a(this).attr("data-rgb"),A=null;if(s==="transparent"||s==="initial"||s==="#none"){s="none";A=new a.jGraduate.Paint}else A=new a.jGraduate.Paint({alpha:100,solidColor:s.substr(1)});b.paintBox[n].setPaint(A);if(g){h.setColor("stroke",s);s!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",s);s!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
"none");a(this).removeClass("expanded");k()});var Ua=function(g,n){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var s=s||"normal";n||a(".tools_flyout").fadeOut(s);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=null,n=null,s=H[0],A=false,F=false;a("#svgcanvas").on("mousemove mouseup touchend", "table-cell");a(this).addClass("expanded");k()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");k()});var Ua=function(g,n){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var s=s||"normal";n||a(".tools_flyout").fadeOut(s);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=
function(J){if(A!==false){s.scrollLeft-=J.clientX-g;s.scrollTop-=J.clientY-n;g=J.clientX;n=J.clientY;if(J.type==="mouseup"||J.type==="touchend")A=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||F===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){A=true;g=J.clientX;n=J.clientY;return false}});a(window).mouseup(function(){A=false});a(document).bind("keydown","space",function(J){J.preventDefault();h.spaceKey=F=true}).bind("keyup","space",function(J){J.preventDefault(); null,n=null,s=H[0],A=false,F=false;a("#svgcanvas").on("mousemove mouseup touchend",function(J){if(A!==false){s.scrollLeft-=J.clientX-g;s.scrollTop-=J.clientY-n;g=J.clientX;n=J.clientY;if(J.type==="mouseup"||J.type==="touchend")A=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||F===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){A=true;g=J.clientX;n=J.clientY;return false}});a(window).mouseup(function(){A=false});a(document).bind("keydown","space",function(J){J.preventDefault();
h.spaceKey=F=false}).bind("keydown","alt",function(){h.getMode()==="zoom"&&H.addClass("out")}).bind("keyup","alt",function(){h.getMode()==="zoom"&&H.removeClass("out")})})();var tb=a(".menu"),eb=function(g){g.target.style.background="#fff";setTimeout(function(){g.target.style.background="#ddd"},50);setTimeout(function(){g.target.style.background="#fff"},150);setTimeout(function(){g.target.style.background="#ddd"},200);setTimeout(function(){g.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")}, h.spaceKey=F=true}).bind("keyup","space",function(J){J.preventDefault();h.spaceKey=F=false}).bind("keydown","alt",function(){h.getMode()==="zoom"&&H.addClass("out")}).bind("keyup","alt",function(){h.getMode()==="zoom"&&H.removeClass("out")})})();var tb=a(".menu"),eb=function(g){g.target.style.background="#fff";setTimeout(function(){g.target.style.background="#ddd"},50);setTimeout(function(){g.target.style.background="#fff"},150);setTimeout(function(){g.target.style.background="#ddd"},200);setTimeout(function(){g.target.style.background=
220);return false};a(".menu_item").on("mousedown touchstart",function(g){eb(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?eb(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,n,s,A){if(g.altKey){g.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+ ""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(g){eb(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?eb(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,n,s,A){if(g.altKey){g.preventDefault();
A*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");tb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){tb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,n,s){if(a(g).length!=0){var A=a(g).find("button"),F=a(g).find("ul").attr("id",a(g)[0].id+"-list");s||a("#option_lists").append(F);var J=false;s&&a(g).addClass("dropup");F.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!J){A.removeClass("down"); zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+A*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");tb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){tb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,n,s){if(a(g).length!=0){var A=a(g).find("button"),F=a(g).find("ul").attr("id",a(g)[0].id+"-list");s||a("#option_lists").append(F);var J=false;s&&
F.hide()}J=false});A.bind("mousedown",function(){if(A.hasClass("down")){A.removeClass("down");F.hide()}else{A.addClass("down");if(!s){var L=a(g).offset();F.css({top:L.top,left:L.left-110})}F.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Va=function(g,n,s,A){var F=a(g);n=a(n);var J=false,L=A.dropUp;L&&a(g).addClass("dropup");n.find("li").bind("mouseup",function(){if(A.seticon){Ib("#cur_"+F[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}s.apply(this, a(g).addClass("dropup");F.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!J){A.removeClass("down");F.hide()}J=false});A.bind("mousedown",function(){if(A.hasClass("down")){A.removeClass("down");F.hide()}else{A.addClass("down");if(!s){var L=a(g).offset();F.css({top:L.top,left:L.left-110})}F.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Va=function(g,n,s,A){var F=a(g);n=a(n);var J=false,L=A.dropUp;L&&a(g).addClass("dropup");n.find("li").bind("mouseup",function(){if(A.seticon){Ib("#cur_"+
arguments)});a(window).mouseup(function(){if(!J){F.removeClass("down");n.hide();n.css({top:0,left:0})}J=false});n.height();a(g).bind("mousedown",function(){var Z=a(g).offset();if(L){Z.top-=n.height();Z.left+=8}else Z.top+=a(g).height();a(n).offset(Z);if(F.hasClass("down")){F.removeClass("down");n.hide();n.css({top:0,left:0})}else{F.addClass("down");n.show();J=true;return false}}).hover(function(){J=true}).mouseout(function(){J=false});A.multiclick&&n.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g= F[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}s.apply(this,arguments)});a(window).mouseup(function(){if(!J){F.removeClass("down");n.hide();n.css({top:0,left:0})}J=false});n.height();a(g).bind("mousedown",function(){var Z=a(g).offset();if(L){Z.top-=n.height();Z.left+=8}else Z.top+=a(g).height();a(n).offset(Z);if(F.hasClass("down")){F.removeClass("down");n.hide();n.css({top:0,left:0})}else{F.addClass("down");n.show();J=true;return false}}).hover(function(){J=
this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,n=function(){a(g).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;ga="toolbars";H.mousedown(n)}).blur(function(){ga= true}).mouseout(function(){J=false});A.multiclick&&n.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,n=function(){a(g).blur()};
"canvas";H.unbind("mousedown",n);h.getMode()=="textedit"&&a("#text").focus()})})();var Wa=function(){Ua("#tool_select")&&h.setMode("select")},Ba=function(){Ua("#tool_fhpath")&&h.setMode("fhpath")},va=function(){Ua("#tool_line")&&h.setMode("line")},cb=function(){Ua("#tool_rect")&&h.setMode("rect")},Ka=function(){Ua("#tool_ellipse")&&h.setMode("ellipse")},Ta=function(){Ua("#tool_image")&&h.setMode("image")},Ca=function(){Ua("#tool_zoom")&&h.setMode("zoom")},gb=function(){if(Ua("#tool_zoom")){yb();fa()}}, a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;ga="toolbars";H.mousedown(n)}).blur(function(){ga="canvas";H.unbind("mousedown",n);h.getMode()=="textedit"&&a("#text").focus()})})();var Wa=function(){Ua("#tool_select")&&h.setMode("select")},Ba=function(){Ua("#tool_fhpath")&&h.setMode("fhpath")},va=function(){Ua("#tool_line")&&h.setMode("line")},cb=function(){Ua("#tool_rect")&&h.setMode("rect")},Ka=function(){Ua("#tool_ellipse")&&h.setMode("ellipse")},Ta=function(){Ua("#tool_image")&&
pb=function(){Ua("#tool_text")&&h.setMode("text")},Xa=function(){Ua("#tool_path")&&h.setMode("path")},Ya=function(){if(Q!=null||Y)h.deleteSelectedElements()},ub=function(){if(Q!=null||Y){window.event.type==="keydown"&&$a(a("#edit_menu"));h.cutSelectedElements()}},ta=function(){if(Q!=null||Y){window.event.type==="keydown"&&$a(a("#edit_menu"));h.copySelectedElements()}},jb=function(){window.event.type==="keydown"&&$a(a("#edit_menu"));var g=h.getZoom(),n=(H[0].scrollLeft+H.width()/2)/g-h.contentW;g= h.setMode("image")},Ca=function(){Ua("#tool_zoom")&&h.setMode("zoom")},gb=function(){if(Ua("#tool_zoom")){yb();fa()}},pb=function(){Ua("#tool_text")&&h.setMode("text")},Xa=function(){Ua("#tool_path")&&h.setMode("path")},Ya=function(){if(Q!=null||Y)h.deleteSelectedElements()},ub=function(){if(Q!=null||Y){window.event.type==="keydown"&&$a(a("#edit_menu"));h.cutSelectedElements()}},ta=function(){if(Q!=null||Y){window.event.type==="keydown"&&$a(a("#edit_menu"));h.copySelectedElements()}},jb=function(){window.event.type===
(H[0].scrollTop+H.height()/2)/g-h.contentH;h.pasteElements("point",n,g)},fb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveToTopSelectedElement()}},sb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveToBottomSelectedElement()}},kb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected("Up")}},db=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected("Down")}}, "keydown"&&$a(a("#edit_menu"));var g=h.getZoom(),n=(H[0].scrollLeft+H.width()/2)/g-h.contentW;g=(H[0].scrollTop+H.height()/2)/g-h.contentH;h.pasteElements("point",n,g)},fb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveToTopSelectedElement()}},sb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveToBottomSelectedElement()}},kb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected("Up")}},db=
mb=function(g){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected(g)}},qb=function(){if(Q!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");q.toEditMode(elems[0]);h.clearSelection();Ia()}},vb=function(){Q!=null&&q.reorient()},wb=function(){if(Q!=null||Y)a.prompt(uiStrings.notification.enterNewLinkURL, function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected("Down")}},mb=function(g){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected(g)}},qb=function(){if(Q!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");q.toEditMode(elems[0]);h.clearSelection();Ia()}},
"http://",function(g){g&&h.makeHyperlink(g)})},ia=function(g,n){if(Q!=null||Y){if(curConfig.gridSnapping){var s=h.getZoom()*curConfig.snappingStep;g*=s;n*=s}a("input").blur();h.moveSelectedElements(g,n)}},aa=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);q.linkControlPoints(g)},ka=function(){q.getNodePoint()&&q.clonePathNode()},M= vb=function(){Q!=null&&q.reorient()},wb=function(){if(Q!=null||Y)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ia=function(g,n){if(Q!=null||Y){if(curConfig.gridSnapping){var s=h.getZoom()*curConfig.snappingStep;g*=s;n*=s}a("input").blur();h.moveSelectedElements(g,n)}},aa=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
function(){q.getNodePoint()&&q.deletePathNode()},P=function(){var g=a("#tool_add_subpath"),n=!g.hasClass("push_button_pressed");n?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");q.addSubPath(n)},da=function(){q.opencloseSubPath()},Ea=function(){h.cycleElement(1)},Na=function(){h.cycleElement(0)},Ra=function(g,n){if(!(Q==null||Y)){g||(n*=-1);var s=a("#angle").val()*1+n;h.setRotationAngle(s);Ia()}},bb=function(){var g=curConfig.dimensions; false);q.linkControlPoints(g)},ka=function(){q.getNodePoint()&&q.clonePathNode()},M=function(){q.getNodePoint()&&q.deletePathNode()},P=function(){var g=a("#tool_add_subpath"),n=!g.hasClass("push_button_pressed");n?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");q.addSubPath(n)},da=function(){q.opencloseSubPath()},Ea=function(){h.cycleElement(1)},Na=function(){h.cycleElement(0)},Ra=function(g,n){if(!(Q==null||Y)){g||(n*=-1);
a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){fa();h.clear();h.setResolution(g[0],g[1]);D(true);yb();Ia();V();h.runExtensions("onNewDocument")}})},ob=function(){h.setBold(!h.getBold());Ia()},Sa=function(){h.setItalic(!h.getItalic());Ia()},nb=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;U=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg?h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js", var s=a("#angle").val()*1+n;h.setRotationAngle(s);Ia()}},bb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){fa();h.clear();h.setResolution(g[0],g[1]);D(true);yb();Ia();V();h.runExtensions("onNewDocument")}})},ob=function(){h.setBold(!h.getBold());Ia()},Sa=function(){h.setItalic(!h.getItalic());Ia()},nb=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;U=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg?
function(){h.rasterExport()})})},Pa=function(){h.open()},rb=function(){},$a=function(g){var n=g.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},Eb=function(){if(K.getUndoStackSize()>0){window.event.type==="keydown"&&$a(a("#edit_menu"));K.undo()}},Db=function(){if(K.getRedoStackSize()>0){window.event.type==="keydown"&&$a(a("#edit_menu"));K.redo()}},ab=function(){if(Y)h.groupSelectedElements();else Q&&h.ungroupSelectedElement()},La=function(){window.event.type=== h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){h.rasterExport()})})},Pa=function(){h.open()},rb=function(){},$a=function(g){var n=g.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},Eb=function(){if(K.getUndoStackSize()>0){window.event.type==="keydown"&&$a(a("#edit_menu"));K.undo()}},Db=function(){if(K.getRedoStackSize()>0){window.event.type==="keydown"&&$a(a("#edit_menu"));K.redo()}},ab=function(){if(Y)h.groupSelectedElements();
"keydown"&&$a(a("#edit_menu"));h.cloneSelectedElements(20,20)},Nb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Kb=function(){var g=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),s=n.getAttribute("fill"),A=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;A=Ga(A,g,"stroke");s=Ga(s,n,"fill"); else Q&&h.ungroupSelectedElement()},La=function(){window.event.type==="keydown"&&$a(a("#edit_menu"));h.cloneSelectedElements(20,20)},Nb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Kb=function(){var g=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),s=n.getAttribute("fill"),A=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;n=parseFloat(n.getAttribute("fill-opacity"));
b.paintBox.fill.setPaint(A,true);b.paintBox.stroke.setPaint(s,true)},yb=function(g){var n=h.getResolution();g=g?n.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Jb();D(true)},Lb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");H.toggleClass("wireframe");if(!C){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head");Jb()}},Ob=function(){var g= if(isNaN(n))n=100;A=Ga(A,g,"stroke");s=Ga(s,n,"fill");b.paintBox.fill.setPaint(A,true);b.paintBox.stroke.setPaint(s,true)},yb=function(g){var n=h.getResolution();g=g?n.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Jb();D(true)},Lb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");H.toggleClass("wireframe");if(!C){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head");
!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Ab=function(){window.self!=window.top&&top.exit_fullscreen()},Gb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked", Jb()}},Ob=function(){var g=!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Ab=function(){window.self!=window.top&&top.exit_fullscreen()},Gb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");
true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Jb=function(){if(!C){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(H.hasClass("wireframe")?g:"")}},zb=function(g,n){if(!xa){xa=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var s=pa=h.getSvgString();a("#svg_source_textarea").val(s);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},ib=function(){if(xa){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection(); a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Jb=function(){if(!C){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(H.hasClass("wireframe")?g:"")}},zb=function(g,n){if(!xa){xa=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var s=pa=h.getSvgString();a("#svg_source_textarea").val(s);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},
e();yb();V()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();e();yb();V()});fa()}},Ib=b.setIcon=function(g,n){var s=typeof n==="string"?a.getSvgIcon(n,true):n.clone();s?a(g).find("img").replaceWith(s):console.log("NOTE: Icon image missing: "+n)},Hb;Hb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],s;for(s in n.style)if(g.test(s))return s.match(g)[0];if("WebkitOpacity"in n.style)return"Webkit"; ib=function(){if(xa){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();e();yb();V()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();e();yb();V()});fa()}},Ib=b.setIcon=function(g,n){var s=typeof n==="string"?a.getSvgIcon(n,true):n.clone();s?a(g).find("img").replaceWith(s):console.log("NOTE: Icon image missing: "+n)},Hb;Hb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],
if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Bb=function(g,n){Hb.toLowerCase();var s=["top","left","bottom","right"];g.each(function(){for(var A=a(this),F=A.outerWidth()*(n-1),J=A.outerHeight()*(n-1),L=0;L<4;L++){var Z=s[L],ba=A.data("orig_margin-"+Z);if(ba==null){ba=parseInt(A.css("margin-"+Z));A.data("orig_margin-"+Z,ba)}ba=ba*n;if(Z==="right")ba+=F;else if(Z==="bottom")ba+=J;A.css("margin-"+Z,ba)}})},hb=b.setIconSize=function(g,n){if(!(g==u.size&&!n)){var s=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"), s;for(s in n.style)if(g.test(s))return s.match(g)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Bb=function(g,n){Hb.toLowerCase();var s=["top","left","bottom","right"];g.each(function(){for(var A=a(this),F=A.outerWidth()*(n-1),J=A.outerHeight()*(n-1),L=0;L<4;L++){var Z=s[L],ba=A.data("orig_margin-"+Z);if(ba==null){ba=parseInt(A.css("margin-"+Z));A.data("orig_margin-"+Z,ba)}ba=ba*n;if(Z==="right")ba+=F;else if(Z==="bottom")ba+=J;A.css("margin-"+
A=1;A=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=N=A;ma();var F=s.parents(":hidden");F.css("visibility","hidden").show();Bb(s,A);F.css("visibility","visible").hide();s=a("#tool_size_rules");if(s.length)s.empty();else s=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(L,Z){L="#svg_editor "+L.replace(/,/g,", #svg_editor");J+=L+"{";a.each(Z,function(ba,T){if(typeof T==="number")var X=T*A+"px";else if(T[g]||T.all)X=T[g]|| Z,ba)}})},hb=b.setIconSize=function(g,n){if(!(g==u.size&&!n)){var s=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"),A=1;A=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=N=A;ma();var F=s.parents(":hidden");F.css("visibility","hidden").show();Bb(s,A);F.css("visibility","visible").hide();s=a("#tool_size_rules");if(s.length)s.empty();
T.all;J+=ba+":"+X+";"});J+="}"});F="-"+Hb.toLowerCase()+"-";J+="#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{"+F+"transform: scale("+A+");} #svg_editor div.toolset .toolset {"+F+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+F+"transform: scale("+1/A+");}";s.text(J)}ma()}},Fb=function(){a("#dialog_box").hide();if(xa){if(xa)pa!== else s=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(L,Z){L="#svg_editor "+L.replace(/,/g,", #svg_editor");J+=L+"{";a.each(Z,function(ba,T){if(typeof T==="number")var X=T*A+"px";else if(T[g]||T.all)X=T[g]||T.all;J+=ba+":"+X+";"});J+="}"});F="-"+Hb.toLowerCase()+"-";J+="#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{"+
a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&e()}):e();k()}else ja&&h.leaveContext()},e=function(){a("#svg_source_editor").hide();xa=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var k=a.noop;a(window).resize(function(){D()});(function(){H.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=H[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=H[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)}); F+"transform: scale("+A+");} #svg_editor div.toolset .toolset {"+F+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+F+"transform: scale("+1/A+");}";s.text(J)}ma()}},Fb=function(){a("#dialog_box").hide();if(xa){if(xa)pa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&e()}):e();k()}else ja&&h.leaveContext()},e=function(){a("#svg_source_editor").hide();xa=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
a("#change_image_url").click(function(){var g=h.getHref(Q);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(n){n&&Ja(n)})});var m=function(g){var n=g[0].id=="stroke_color"?"stroke":"fill",s=g[0].id=="canvas_color";if(s)n="canvas";var A=b.paintBox[n].paint;g=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";s=s?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker", var k=a.noop;a(window).resize(function(){D()});(function(){H.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=H[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=H[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(Q);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(n){n&&Ja(n)})});var m=function(g){var n=g[0].id=="stroke_color"?"stroke":
containment:"window"}).removeAttr("style").css(s).jGraduate({paint:A,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(F){A=new a.jGraduate.Paint(F);b.paintBox[n].setPaint(A);h.setPaint(n,A);a("#color_picker").hide()},function(){a("#color_picker").hide()})};l=function(g,n){var s=document.getElementById("canvas_background"),A={color:"fff",opacity:1};if(n=="stroke")A=curConfig.initStroke;if(n=="fill")A=curConfig.initFill;if(n=="canvas"&&s)if(s=s.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))A= "fill",s=g[0].id=="canvas_color";if(s)n="canvas";var A=b.paintBox[n].paint;g=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";s=s?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(s).jGraduate({paint:A,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(F){A=new a.jGraduate.Paint(F);b.paintBox[n].setPaint(A);
{color:("0"+parseInt(s[1],10).toString(16)).slice(-2)+("0"+parseInt(s[2],10).toString(16)).slice(-2)+("0"+parseInt(s[3],10).toString(16)).slice(-2),opacity:1};s=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+A.color+'" opacity="'+A.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;s=a(g)[0].appendChild(document.importNode(s,true));n==="canvas"?s.setAttribute("width",60.5): h.setPaint(n,A);a("#color_picker").hide()},function(){a("#color_picker").hide()})};l=function(g,n){var s=document.getElementById("canvas_background"),A={color:"fff",opacity:1};if(n=="stroke")A=curConfig.initStroke;if(n=="fill")A=curConfig.initFill;if(n=="canvas"&&s)if(s=s.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))A={color:("0"+parseInt(s[1],10).toString(16)).slice(-2)+("0"+parseInt(s[2],10).toString(16)).slice(-2)+("0"+parseInt(s[3],10).toString(16)).slice(-2),opacity:1};s=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
s.setAttribute("width","100%");this.rect=s.firstChild;this.defs=s.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:A.color});this.type=n;this.setPaint=function(F,J){this.paint=F;var L="none",Z=F.type,ba=F.alpha/100;switch(Z){case "solidColor":L=F[Z]=="none"||F[Z]=="one"?"none":"#"+F[Z];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(F[Z]);L="url(#"+(this.grad.id="gradbox_"+ A.color+'" opacity="'+A.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;s=a(g)[0].appendChild(document.importNode(s,true));n==="canvas"?s.setAttribute("width",60.5):s.setAttribute("width","100%");this.rect=s.firstChild;this.defs=s.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:A.color});this.type=n;this.setPaint=function(F,J){this.paint=F;var L="none",Z=F.type,ba=F.alpha/100;switch(Z){case "solidColor":L=
this.type)+")"}this.rect.setAttribute("fill",L);this.rect.setAttribute("opacity",ba);if(J){h.setColor(this.type,L,true);h.setPaintOpacity(this.type,ba,true)}if(this.type=="canvas")if(Z=document.getElementById("canvas_background")){Aa=h.getResolution();Z.setAttribute("x",-1);Z.setAttribute("y",-1);Z.setAttribute("width",Aa.w+2);Z.setAttribute("height",Aa.h+2);Z.setAttribute("fill",L)}else Ha(L)};this.update=function(F){if(Q){var J=this.type;switch(Q.tagName){case "use":case "image":case "foreignObject":return; F[Z]=="none"||F[Z]=="one"?"none":"#"+F[Z];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(F[Z]);L="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",L);this.rect.setAttribute("opacity",ba);if(J){h.setColor(this.type,L,true);h.setPaintOpacity(this.type,ba,true)}if(this.type=="canvas")if(Z=document.getElementById("canvas_background")){Aa=h.getResolution();Z.setAttribute("x",-1);Z.setAttribute("y",-1);Z.setAttribute("width",
case "g":case "a":for(var L=null,Z=Q.getElementsByTagName("*"),ba=0,T=Z.length;ba<T;ba++){var X=Z[ba].getAttribute(J);if(ba===0)L=X;else if(L!==X){L=null;break}}if(L===null){Z=null;return}Z=L;L=1;break;default:L=parseFloat(Q.getAttribute(J+"-opacity"));if(isNaN(L))L=1;Z=J==="fill"?"black":"none";Z=Q.getAttribute(J)||Z}if(F){h.setColor(J,Z,true);h.setPaintOpacity(J,L,true)}L*=100;this.setPaint(Ga(Z,L,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var F= Aa.w+2);Z.setAttribute("height",Aa.h+2);Z.setAttribute("fill",L)}else Ha(L)};this.update=function(F){if(Q){var J=this.type;switch(Q.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var L=null,Z=Q.getElementsByTagName("*"),ba=0,T=Z.length;ba<T;ba++){var X=Z[ba].getAttribute(J);if(ba===0)L=X;else if(L!==X){L=null;break}}if(L===null){Z=null;return}Z=L;L=1;break;default:L=parseFloat(Q.getAttribute(J+"-opacity"));if(isNaN(L))L=1;Z=J==="fill"?"black":"none";Z=Q.getAttribute(J)||
new a.jGraduate.Paint({copy:this.paint});h.setPaint(n,F)}}};b.paintBox.fill=new l("#fill_color","fill");b.paintBox.stroke=new l("#stroke_color","stroke");b.paintBox.canvas=new l("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);l=b.paintBox.fill.rect.cloneNode(false);l.setAttribute("style","vector-effect:non-scaling-stroke");var C=l.style.vectorEffect==="non-scaling-stroke";l.removeAttribute("style");l=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg", Z}if(F){h.setColor(J,Z,true);h.setPaintOpacity(J,L,true)}L*=100;this.setPaint(Ga(Z,L,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var F=new a.jGraduate.Paint({copy:this.paint});h.setPaint(n,F)}}};b.paintBox.fill=new l("#fill_color","fill");b.paintBox.stroke=new l("#stroke_color","stroke");b.paintBox.canvas=new l("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);l=b.paintBox.fill.rect.cloneNode(false);
"feGaussianBlur");typeof l.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(l).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);u.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))m(a("#fill_color"));else{a("#tool_fill").addClass("active"); l.setAttribute("style","vector-effect:non-scaling-stroke");var C=l.style.vectorEffect==="non-scaling-stroke";l.removeAttribute("style");l=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof l.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(l).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);u.img_save=
a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))m(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){m(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");m(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active"); "ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))m(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))m(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
a("#tool_stroke").removeClass("active");m(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});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")}); function(){m(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");m(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");m(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||
a(window).bind("load resize",function(){H.css("line-height",H.height()+"px")});var z=function(){var g=a("#canvas_width"),n=a("#canvas_height"),s=g.val(),A=n.val();if(s!="fit"&&!svgedit.units.isValidUnit("width",s)){a.alert(uiStrings.notification.invalidAttrValGiven);g.parent().addClass("error");return false}g.parent().removeClass("error");if(A!="fit"&&!svgedit.units.isValidUnit("height",A)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error"); a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){H.css("line-height",H.height()+"px")});var z=function(){var g=a("#canvas_width"),n=a("#canvas_height"),s=g.val(),A=n.val();if(s!="fit"&&!svgedit.units.isValidUnit("width",s)){a.alert(uiStrings.notification.invalidAttrValGiven);
if(!h.setResolution(s,A)){a.alert(uiStrings.notification.noContentToFitTo);s=h.getResolution();g.val(s.w);n.val(s.h);return false}D()};a("#resolution").change(function(){var g=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){g.value="fit";n.value="fit";z();var s=h.getResolution();g.value=s.w;n.value=s.h}else{var A=this.value.split("x");A[0]=parseInt(A[0]);A[1]=parseInt(A[1]);var F=A[0]-g.value,J=A[1]-n.value,L=Date.now(),Z=function(ba){ba=(ba-L)/1E3;ba= g.parent().addClass("error");return false}g.parent().removeClass("error");if(A!="fit"&&!svgedit.units.isValidUnit("height",A)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");if(!h.setResolution(s,A)){a.alert(uiStrings.notification.noContentToFitTo);s=h.getResolution();g.val(s.w);n.val(s.h);return false}D()};a("#resolution").change(function(){var g=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
Math.pow(ba-1,3)+1;g.value=(A[0]-F+ba*F).toFixed(0);n.value=(A[1]-J+ba*J).toFixed(0);z();if(ba>=1){ba=h.getResolution();a("#canvas_width").val(ba.w.toFixed());a("#canvas_height").val(ba.h.toFixed());a("#resolution_label").html("<div class='pull'>"+ba.w+"<span>\u00d7</span></br>"+ba.h+"</div>")}else requestAnimationFrame(Z)};Z(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;n.value=100}}});a("#zoom").change(function(){Fa(this)}); "content"){g.value="fit";n.value="fit";z();var s=h.getResolution();g.value=s.w;n.value=s.h}else{var A=this.value.split("x");A[0]=parseInt(A[0]);A[1]=parseInt(A[1]);var F=A[0]-g.value,J=A[1]-n.value,L=Date.now(),Z=function(ba){ba=(ba-L)/1E3;ba=Math.pow(ba-1,3)+1;g.value=(A[0]-F+ba*F).toFixed(0);n.value=(A[1]-J+ba*J).toFixed(0);z();if(ba>=1){ba=h.getResolution();a("#canvas_width").val(ba.w.toFixed());a("#canvas_height").val(ba.h.toFixed());a("#resolution_label").html("<div class='pull'>"+ba.w+"<span>\u00d7</span></br>"+
a("input,select").attr("autocomplete","off");var G=function(){var g=[{sel:"#tool_select",fn:Wa,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ba,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:cb,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ka,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Xa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:pb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Ta,evt:"mouseup"}, ba.h+"</div>")}else requestAnimationFrame(Z)};Z(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;n.value=100}}});a("#zoom").change(function(){Fa(this)});a("input,select").attr("autocomplete","off");var G=function(){var g=[{sel:"#tool_select",fn:Wa,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ba,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:cb,evt:"click",
{sel:"#tool_zoom",fn:Ca,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:bb,evt:"mouseup",key:[B+"N",true]},{sel:"#tool_save",fn:function(){xa?ib():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[B+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},{sel:"#tool_open",fn:Pa,evt:"mouseup"},{sel:"#tool_import",fn:rb,evt:"mouseup"},{sel:"#tool_source",fn:zb,evt:"click",key:[B+"U",true]},{sel:"#tool_wireframe",fn:Lb,evt:"click"},{sel:"#tool_snap",fn:Ob,evt:"click"},{sel:"#tool_rulers", key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ka,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Xa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:pb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Ta,evt:"mouseup"},{sel:"#tool_zoom",fn:Ca,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:bb,evt:"mouseup",key:[B+"N",true]},{sel:"#tool_save",fn:function(){xa?ib():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[B+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},
fn:Gb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Fb,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:ib,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:Ya,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:vb,evt:"click"},{sel:"#tool_node_link",fn:aa,evt:"click"},{sel:"#tool_node_clone",fn:ka,evt:"click"},{sel:"#tool_node_delete",fn:M,evt:"click"},{sel:"#tool_openclose_path",fn:da,evt:"click"}, {sel:"#tool_open",fn:Pa,evt:"mouseup"},{sel:"#tool_import",fn:rb,evt:"mouseup"},{sel:"#tool_source",fn:zb,evt:"click",key:[B+"U",true]},{sel:"#tool_wireframe",fn:Lb,evt:"click"},{sel:"#tool_snap",fn:Ob,evt:"click"},{sel:"#tool_rulers",fn:Gb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Fb,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:ib,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:Ya,evt:"click",key:["del/backspace",
{sel:"#tool_add_subpath",fn:P,evt:"click"},{sel:"#tool_move_top",fn:fb,evt:"click",key:B+"shift+up"},{sel:"#tool_move_bottom",fn:sb,evt:"click",key:B+"shift+down"},{sel:"#tool_move_up",fn:kb,evt:"click",key:[B+"up",true]},{sel:"#tool_move_down",fn:db,evt:"click",key:[B+"down",true]},{sel:"#tool_topath",fn:qb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:wb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:La,evt:"click",key:[B+"D",true]},{sel:"#tool_group",fn:ab,evt:"click",key:[B+ true]},{sel:"#tool_reorient",fn:vb,evt:"click"},{sel:"#tool_node_link",fn:aa,evt:"click"},{sel:"#tool_node_clone",fn:ka,evt:"click"},{sel:"#tool_node_delete",fn:M,evt:"click"},{sel:"#tool_openclose_path",fn:da,evt:"click"},{sel:"#tool_add_subpath",fn:P,evt:"click"},{sel:"#tool_move_top",fn:fb,evt:"click",key:B+"shift+up"},{sel:"#tool_move_bottom",fn:sb,evt:"click",key:B+"shift+down"},{sel:"#tool_move_up",fn:kb,evt:"click",key:[B+"up",true]},{sel:"#tool_move_down",fn:db,evt:"click",key:[B+"down",true]},
"G",true]},{sel:"#tool_ungroup",fn:ab,evt:"click",key:B+"shift+G"},{sel:"#tool_unlink_use",fn:ab,evt:"click"},{sel:"[id^=tool_align]",fn:Nb,evt:"click"},{sel:"#tool_undo",fn:Eb,evt:"click",key:B+"z"},{sel:"#tool_redo",fn:Db,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ub,evt:"click",key:[B+"x",true]},{sel:"#tool_copy",fn:ta,evt:"click",key:B+"c"},{sel:"#tool_paste",fn:jb,evt:"click",key:B+"v"},{sel:"#tool_switch",fn:Kb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:ob,evt:"mousedown",key:[B+ {sel:"#tool_topath",fn:qb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:wb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:La,evt:"click",key:[B+"D",true]},{sel:"#tool_group",fn:ab,evt:"click",key:[B+"G",true]},{sel:"#tool_ungroup",fn:ab,evt:"click",key:B+"shift+G"},{sel:"#tool_unlink_use",fn:ab,evt:"click"},{sel:"[id^=tool_align]",fn:Nb,evt:"click"},{sel:"#tool_undo",fn:Eb,evt:"click",key:B+"z"},{sel:"#tool_redo",fn:Db,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ub,evt:"click",
"B",true]},{sel:"#tool_italic",fn:Sa,evt:"mousedown",key:[B+"I",true]},{sel:"#copy_save_done",fn:Fb,evt:"click"},{key:"ctrl+left",fn:function(){Ra(0,1)}},{key:"ctrl+right",fn:function(){Ra(1,1)}},{key:"ctrl+shift+left",fn:function(){Ra(0,5)}},{key:"ctrl+shift+right",fn:function(){Ra(1,5)}},{key:"shift+O",fn:Na},{key:"shift+P",fn:Ea},{key:[B+"+",true],fn:function(){yb(2)}},{key:[B+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){ia(0,-1)}},{key:["down",true],fn:function(){ia(0,1)}}, key:[B+"x",true]},{sel:"#tool_copy",fn:ta,evt:"click",key:B+"c"},{sel:"#tool_paste",fn:jb,evt:"click",key:B+"v"},{sel:"#tool_switch",fn:Kb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:ob,evt:"mousedown",key:[B+"B",true]},{sel:"#tool_italic",fn:Sa,evt:"mousedown",key:[B+"I",true]},{sel:"#copy_save_done",fn:Fb,evt:"click"},{key:"ctrl+left",fn:function(){Ra(0,1)}},{key:"ctrl+right",fn:function(){Ra(1,1)}},{key:"ctrl+shift+left",fn:function(){Ra(0,5)}},{key:"ctrl+shift+right",fn:function(){Ra(1,5)}},
{key:["left",true],fn:function(){ia(-1,0)}},{key:["right",true],fn:function(){ia(1,0)}},{key:"shift+up",fn:function(){ia(0,-10)}},{key:"shift+down",fn:function(){ia(0,10)}},{key:"shift+left",fn:function(){ia(-10,0)}},{key:"shift+right",fn:function(){ia(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1, {key:"shift+O",fn:Na},{key:"shift+P",fn:Ea},{key:[B+"+",true],fn:function(){yb(2)}},{key:[B+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){ia(0,-1)}},{key:["down",true],fn:function(){ia(0,1)}},{key:["left",true],fn:function(){ia(-1,0)}},{key:["right",true],fn:function(){ia(1,0)}},{key:"shift+up",fn:function(){ia(0,-10)}},{key:"shift+down",fn:function(){ia(0,10)}},{key:"shift+left",fn:function(){ia(-10,0)}},{key:"shift+right",fn:function(){ia(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0,
0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10,0)}},{key:B+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var s=a(".tool_button_current");if(s.length&&s[0].id!=="tool_eyedropper"){s.removeClass("tool_button_current").addClass("tool_button"); -1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10,
a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:B+"shift+z",fn:Db},{key:"esc",fn:Ab}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var s={};a.each(g,function(A,F){if(F.sel){var J=a(F.sel);if(J.length==0)return true;if(F.evt){if(svgedit.browser.isTouch()&&F.evt==="click")F.evt="mousedown";J[F.evt](F.fn)}if(F.parent&&a(F.parent+"_show").length!=0){var L=a(F.parent);L.length||(L=qa(F.parent.substr(1))); 0)}},{key:B+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var s=a(".tool_button_current");if(s.length&&s[0].id!=="tool_eyedropper"){s.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:B+"shift+z",fn:Db},{key:"esc",fn:Ab}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var s={};a.each(g,function(A,F){if(F.sel){var J=
L.append(J);a.isArray(s[F.parent])||(s[F.parent]=[]);s[F.parent].push(F)}}if(F.key){var Z=F.fn,ba=false;if(a.isArray(F.key)){L=F.key[0];if(F.key.length>1)ba=F.key[1]}else L=F.key;L+="";svgedit.browser.isMac&&L.indexOf("+")!=-1&&L.split("+")[0]=="ctrl"&&L.replace("ctrl","cmd");a.each(L.split("/"),function(X,ha){a(document).bind("keydown",ha,function(oa){Z();ba&&oa.preventDefault();return false})});if(F.sel&&!F.hidekey&&J.attr("title")){var T=J.attr("title").split("[")[0]+" ("+L+")";n[L]=F.sel;J.parents("#main_menu").length|| a(F.sel);if(J.length==0)return true;if(F.evt){if(svgedit.browser.isTouch()&&F.evt==="click")F.evt="mousedown";J[F.evt](F.fn)}if(F.parent&&a(F.parent+"_show").length!=0){var L=a(F.parent);L.length||(L=qa(F.parent.substr(1)));L.append(J);a.isArray(s[F.parent])||(s[F.parent]=[]);s[F.parent].push(F)}}if(F.key){var Z=F.fn,ba=false;if(a.isArray(F.key)){L=F.key[0];if(F.key.length>1)ba=F.key[1]}else L=F.key;L+="";svgedit.browser.isMac&&L.indexOf("+")!=-1&&L.split("+")[0]=="ctrl"&&L.replace("ctrl","cmd");
J.attr("title",T)}}});na(s);a(window).bind("keydown","tab",function(A){if(ga==="canvas"){A.preventDefault();Ea()}}).bind("keydown","shift+tab",function(A){if(ga==="canvas"){A.preventDefault();Na()}});a("#tool_zoom").dblclick(gb)},setTitles:function(){a.each(n,function(s,A){var F=a(A).parents("#main_menu").length;a(A).each(function(){var J=F?a(this).text().split(" [")[0]:this.title.split(" [")[0],L="";a.each(s.split("/"),function(Z,ba){var T=ba.split("+"),X="";if(T.length>1){X=T[0]+"+";ba=T[1]}L+= a.each(L.split("/"),function(X,ha){a(document).bind("keydown",ha,function(oa){Z();ba&&oa.preventDefault();return false})});if(F.sel&&!F.hidekey&&J.attr("title")){var T=J.attr("title").split("[")[0]+" ("+L+")";n[L]=F.sel;J.parents("#main_menu").length||J.attr("title",T)}}});na(s);a(window).bind("keydown","tab",function(A){if(ga==="canvas"){A.preventDefault();Ea()}}).bind("keydown","shift+tab",function(A){if(ga==="canvas"){A.preventDefault();Na()}});a("#tool_zoom").dblclick(gb)},setTitles:function(){a.each(n,
(Z?"/":"")+X+(uiStrings["key_"+ba]||ba)});if(F)this.lastChild.textContent=J+" ["+L+"]";else this.title=J+" ["+L+"]"})})},getButtonData:function(s){var A;a.each(g,function(F,J){if(J.sel===s)A=J});return A}}}();G.setAll();b.ready(function(){var g=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"),s=n.find("#tool_"+g);g=n.find("#"+g);(s.length?s:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)}); function(s,A){var F=a(A).parents("#main_menu").length;a(A).each(function(){var J=F?a(this).text().split(" [")[0]:this.title.split(" [")[0],L="";a.each(s.split("/"),function(Z,ba){var T=ba.split("+"),X="";if(T.length>1){X=T[0]+"+";ba=T[1]}L+=(Z?"/":"")+X+(uiStrings["key_"+ba]||ba)});if(F)this.lastChild.textContent=J+" ["+L+"]";else this.title=J+" ["+L+"]"})})},getButtonData:function(s){var A;a.each(g,function(F,J){if(J.sel===s)A=J});return A}}}();G.setAll();b.ready(function(){var g=curConfig.initTool,
a("#canvas_height").dragInput({min:10,max:null,step:10,callback:z,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:z,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null, n=a("#tools_left, #svg_editor .tools_flyout"),s=n.find("#tool_"+g);g=n.find("#"+g);(s.length?s:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:z,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:z,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,
step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1, max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute, a("#image_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,
cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null, callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null, a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,
max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var n=g.value;if(n==0&& cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,
Q&&["line","polyline"].indexOf(Q.nodeName)>=0)n=g.value=1;h.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled",g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,n){var s=g.value-0,A=s+n,F=A>=s;if(n===0)return s;return s>= callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var n=g.value;if(n==0&&Q&&["line","polyline"].indexOf(Q.nodeName)>=0)n=g.value=1;h.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);
24?F?Math.round(s*1.1):Math.round(s/1.1):s<=1?F?s*2:s/2:A},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(g){val=g.value;a("#blur").val(val);h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":Ya();break;case "cut":ub();break;case "copy":ta();break; rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled",g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,n){var s=g.value-0,A=s+n,F=A>=s;if(n===0)return s;return s>=24?F?Math.round(s*1.1):Math.round(s/1.1):s<=1?F?s*2:s/2:A},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,
case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":fb();break;case "move_up":mb("Up");break;case "move_down":mb("Down");break;case "move_back":sb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu(); step:0.1,callback:function(g){val=g.value;a("#blur").val(val);h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":Ya();break;case "cut":ub();break;case "copy":ta();break;case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":fb();break;
S.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(K.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(g){a("#main_menu").hide();K.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){l=a('<input type="file">').change(function(){var g=this;b.openPrep(function(n){if(n){h.clear();if(g.files.length==1){n=new FileReader; case "move_up":mb("Up");break;case "move_down":mb("Down");break;case "move_back":sb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu();S.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(K.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};
n.onloadend=function(s){p(s.target.result);D()};n.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(l);l=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;g.onloadend=function(n){h.importSvgString(n.target.result,true);D()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(l)}var D=b.updateCanvas=function(g,n){var s=H.width(),A=H.height(),F=s,J=A,L=h.getZoom(),Z=a("#svgcanvas"),ba={x:H[0].scrollLeft+F/2,y:H[0].scrollTop+ b.openPrep=function(g){a("#main_menu").hide();K.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){l=a('<input type="file">').change(function(){var g=this;b.openPrep(function(n){if(n){h.clear();if(g.files.length==1){n=new FileReader;n.onloadend=function(s){p(s.target.result);D()};n.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(l);l=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;
J/2},T=curConfig.canvas_expansion;s=Math.max(F,h.contentW*L*T);A=Math.max(J,h.contentH*L*T);s==F&&A==J?H.css("overflow","hidden"):H.css("overflow","scroll");T=Z.height()/2;var X=Z.width()/2;Z.width(s).height(A);var ha=A/2,oa=s/2,ea=h.updateCanvas(s,A),ua=oa/X;s=s/2-F/2;A=A/2-J/2;if(n){n.x+=ea.x;n.y+=ea.y}else n={x:oa+(ba.x-X)*ua,y:ha+(ba.y-T)*ua};if(g)if(h.contentW>H.width()){H[0].scrollLeft=ea.x-10;H[0].scrollTop=ea.y-10}else{H[0].scrollLeft=s;H[0].scrollTop=A}else{H[0].scrollLeft=n.x-F/2;H[0].scrollTop= g.onloadend=function(n){h.importSvgString(n.target.result,true);D()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(l)}var D=b.updateCanvas=function(g,n){var s=H.width(),A=H.height(),F=s,J=A,L=h.getZoom(),Z=a("#svgcanvas"),ba={x:H[0].scrollLeft+F/2,y:H[0].scrollTop+J/2},T=curConfig.canvas_expansion;s=Math.max(F,h.contentW*L*T);A=Math.max(J,h.contentH*L*T);s==F&&A==J?H.css("overflow","hidden"):H.css("overflow","scroll");T=Z.height()/2;var X=Z.width()/2;Z.width(s).height(A);var ha=
n.y-J/2}if(curConfig.showRulers){F=Z;L=L;document.getElementById("workarea");document.getElementById("title_show");L||(L=h.getZoom());F||(F=a("#svgcanvas"));J=h.getContentElem();Z=svgedit.units.getTypeMap()[curConfig.baseUnit];for(ba=0;ba<2;ba++){ha=(T=ba===0)?"x":"y";s=T?"width":"height";X=J.getAttribute(ha)-0;ha=a("#ruler_"+ha+" canvas:first");$hcanv=ha.clone();ha.replaceWith($hcanv);A=$hcanv[0];oa=ha=F[s]()*2;A.parentNode.style[s]=oa+"px";ea=0;var Ma;ua=A.getContext("2d");ua.fillStyle="rgb(200,0,0)"; A/2,oa=s/2,ea=h.updateCanvas(s,A),ua=oa/X;s=s/2-F/2;A=A/2-J/2;if(n){n.x+=ea.x;n.y+=ea.y}else n={x:oa+(ba.x-X)*ua,y:ha+(ba.y-T)*ua};if(g)if(h.contentW>H.width()){H[0].scrollLeft=ea.x-10;H[0].scrollTop=ea.y-10}else{H[0].scrollLeft=s;H[0].scrollTop=A}else{H[0].scrollLeft=n.x-F/2;H[0].scrollTop=n.y-J/2}if(curConfig.showRulers){F=Z;L=L;document.getElementById("workarea");document.getElementById("title_show");L||(L=h.getZoom());F||(F=a("#svgcanvas"));J=h.getContentElem();Z=svgedit.units.getTypeMap()[curConfig.baseUnit];
ua.fillRect(0,0,A.width,A.height);$hcanv.siblings().remove();if(ha>=3E4){var sa=parseInt(ha/3E4)+1;Ma=Array(sa);Ma[0]=ua;for(var ra=1;ra<sa;ra++){A[s]=3E4;var Za=A.cloneNode(true);A.parentNode.appendChild(Za);Ma[ra]=Za.getContext("2d")}Za[s]=ha%3E4;ha=3E4}A[s]=ha;s=Z*L;var Qa=50/s;A=1;for(ra=0;ra<w.length;ra++){A=sa=w[ra];if(Qa<=sa)break}Qa=A*s;ua.font="normal 9px 'Lucida Grande', sans-serif";ua.fillStyle="#777";for(var Oa=X/s%A*s,lb=Oa-Qa;Oa<oa;Oa+=Qa){lb+=Qa;ra=Math.round(Oa)+0.5;if(T){ua.moveTo(ra, for(ba=0;ba<2;ba++){ha=(T=ba===0)?"x":"y";s=T?"width":"height";X=J.getAttribute(ha)-0;ha=a("#ruler_"+ha+" canvas:first");$hcanv=ha.clone();ha.replaceWith($hcanv);A=$hcanv[0];oa=ha=F[s]()*2;A.parentNode.style[s]=oa+"px";ea=0;var Ma;ua=A.getContext("2d");ua.fillStyle="rgb(200,0,0)";ua.fillRect(0,0,A.width,A.height);$hcanv.siblings().remove();if(ha>=3E4){var sa=parseInt(ha/3E4)+1;Ma=Array(sa);Ma[0]=ua;for(var ra=1;ra<sa;ra++){A[s]=3E4;var Za=A.cloneNode(true);A.parentNode.appendChild(Za);Ma[ra]=Za.getContext("2d")}Za[s]=
15);ua.lineTo(ra,0)}else{ua.moveTo(15,ra);ua.lineTo(0,ra)}sa=(lb-X)/s;if(A>=1)ra=Math.round(sa);else{ra=(A+"").split(".")[1].length;ra=sa.toFixed(ra)-0}if(ra!==0&&ra!==1E3&&ra%1E3===0)ra=ra/1E3+"K";if(T){ua.fillText(ra,Oa+2,8);ua.fillStyle="#777"}else{sa=(ra+"").split("");for(ra=0;ra<sa.length;ra++){ua.fillText(sa[ra],1,Oa+9+ra*9);ua.fillStyle="#777"}}sa=Qa/10;for(ra=1;ra<10;ra++){var xb=Math.round(Oa+sa*ra)+0.5;if(Ma&&xb>ha){ea++;ua.stroke();if(ea>=Ma.length){ra=10;Oa=oa;continue}ua=Ma[ea];Oa-=3E4; ha%3E4;ha=3E4}A[s]=ha;s=Z*L;var Qa=50/s;A=1;for(ra=0;ra<w.length;ra++){A=sa=w[ra];if(Qa<=sa)break}Qa=A*s;ua.font="normal 9px 'Lucida Grande', sans-serif";ua.fillStyle="#777";for(var Oa=X/s%A*s,lb=Oa-Qa;Oa<oa;Oa+=Qa){lb+=Qa;ra=Math.round(Oa)+0.5;if(T){ua.moveTo(ra,15);ua.lineTo(ra,0)}else{ua.moveTo(15,ra);ua.lineTo(0,ra)}sa=(lb-X)/s;if(A>=1)ra=Math.round(sa);else{ra=(A+"").split(".")[1].length;ra=sa.toFixed(ra)-0}if(ra!==0&&ra!==1E3&&ra%1E3===0)ra=ra/1E3+"K";if(T){ua.fillText(ra,Oa+2,8);ua.fillStyle=
xb=Math.round(Oa+sa*ra)+0.5}var Cb=ra%2?12:10;if(T){ua.moveTo(xb,15);ua.lineTo(xb,Cb)}else{ua.moveTo(15,xb);ua.lineTo(Cb,xb)}}}ua.strokeStyle="#666";ua.stroke()}H.scroll()}},w=[];for(l=0.1;l<1E5;l*=10){w.push(1*l);w.push(2*l);w.push(5*l)}D(true);try{var E=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var n=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+"";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, "#777"}else{sa=(ra+"").split("");for(ra=0;ra<sa.length;ra++){ua.fillText(sa[ra],1,Oa+9+ra*9);ua.fillStyle="#777"}}sa=Qa/10;for(ra=1;ra<10;ra++){var xb=Math.round(Oa+sa*ra)+0.5;if(Ma&&xb>ha){ea++;ua.stroke();if(ea>=Ma.length){ra=10;Oa=oa;continue}ua=Ma[ea];Oa-=3E4;xb=Math.round(Oa+sa*ra)+0.5}var Cb=ra%2?12:10;if(T){ua.moveTo(xb,15);ua.lineTo(xb,Cb)}else{ua.moveTo(15,xb);ua.lineTo(Cb,xb)}}}ua.strokeStyle="#666";ua.stroke()}H.scroll()}},w=[];for(l=0.1;l<1E5;l*=10){w.push(1*l);w.push(2*l);w.push(5*l)}D(true);
function(F){return"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var s=0;s<g.length;s++)g[s]=n(g[s]);return"["+g.join(",")+"]"}else{s=[];for(var A in g)s.push(n(A)+":"+n(g[A]));return"{"+s.join(",")+"}"}};window.addEventListener("message",function(g){var n=parseInt(g.data.substr(0,g.data.indexOf(";")));try{g.source.postMessage("SVGe"+n+";"+E(eval(g.data)),"*")}catch(s){g.source.postMessage("SVGe"+n+";error:"+s.message,"*")}},false)}catch(I){window.embed_error=I}a(function(){window.svgCanvas= try{var E=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var n=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+"";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(F){return"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var s=0;s<g.length;s++)g[s]=n(g[s]);return"["+g.join(",")+"]"}else{s=[];for(var A in g)s.push(n(A)+
h;h.ready=svgEditor.ready});b.setLang=function(g,n){a.pref("lang",g);a("#lang_select").val(g);if(n){h.runExtensions("langChanged",g);la();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(s,A){a(A).attr("title",a(s)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}}; ":"+n(g[A]));return"{"+s.join(",")+"}"}};window.addEventListener("message",function(g){var n=parseInt(g.data.substr(0,g.data.indexOf(";")));try{g.source.postMessage("SVGe"+n+";"+E(eval(g.data)),"*")}catch(s){g.source.postMessage("SVGe"+n+";error:"+s.message,"*")}},false)}catch(I){window.embed_error=I}a(function(){window.svgCanvas=h;h.ready=svgEditor.ready});b.setLang=function(g,n){a.pref("lang",g);a("#lang_select").val(g);if(n){h.runExtensions("langChanged",g);la();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block",
var f=[];b.ready=function(d){o?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});o=true};b.loadFromString=function(d){b.ready(function(){p(d)})};b.loadFromURL=function(d,l){l||(l={});var v=l.cache,B=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!v,success:function(q){p(q,B)},error:function(q,K,R){q.status!=404&&q.responseText?p(q.responseText,B):a.alert(uiStrings.notification.URLloadFail+": \n"+R+"",B)}})})};b.loadFromDataURI=function(d){b.ready(function(){var l= "#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(s,A){a(A).attr("title",a(s)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(d){o?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});o=true};b.loadFromString=function(d){b.ready(function(){p(d)})};b.loadFromURL=function(d,l){l||(l={});var v=
d.substring(26);p(svgedit.utilities.decode64(l))})};b.addExtension=function(){var d=arguments;a(function(){h&&h.addExtension.apply(this,d)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep= l.cache,B=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!v,success:function(q){p(q,B)},error:function(q,K,R){q.status!=404&&q.responseText?p(q.responseText,B):a.alert(uiStrings.notification.URLloadFail+": \n"+R+"",B)}})})};b.loadFromDataURI=function(d){b.ready(function(){var l=d.substring(26);p(svgedit.utilities.decode64(l))})};b.addExtension=function(){var d=arguments;a(function(){h&&h.addExtension.apply(this,d)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var p=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),o=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/o*f,v=0,B=this.getAttribute("data-attr"),q=svgEditor.canvas,K=q.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,H=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");H&&!isNaN(this.dragCfg.start)&&H.css("top",this.dragCfg.start* a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var p=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),o=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/o*f,v=0,B=this.getAttribute("data-attr"),q=svgEditor.canvas,K=q.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,H=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");H&&!isNaN(this.dragCfg.start)&&H.css("top",this.dragCfg.start*
-1/l+o);this.adjustValue=function(S,U){var N;S=parseFloat(S);if(isNaN(this.value))N=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){N=this.dragCfg.stepfunc(this,S);console.log(N)}else N=Number((Number(this.value)+Number(S)).toFixed(5));if(c!==null)N=Math.min(N,c);if(u!==null)N=Math.max(N,u);H&&this.updateCursor(N);this.value=N;h.attr("data-value",N);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,U)};h.toggleClass("draginput",h.is("label"));this.move=function(S,U,N){if(R)S= -1/l+o);this.adjustValue=function(S,U){var N;S=parseFloat(S);if(isNaN(this.value))N=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){N=this.dragCfg.stepfunc(this,S);console.log(N)}else N=Number((Number(this.value)+Number(S)).toFixed(5));if(c!==null)N=Math.min(N,c);if(u!==null)N=Math.max(N,u);H&&this.updateCursor(N);this.value=N;h.attr("data-value",N);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,U)};h.toggleClass("draginput",h.is("label"));this.move=function(S,U,N){if(R)S=
S.originalEvent.touches[0];if(v===0)v=U;U=(S.pageY-v)*-1;v=S.pageY;N=U*l*p;this.adjustValue(N.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");v=0;if(K[0]){var S=q.undoMgr.finishUndoableChange();S.isEmpty()||q.undoMgr.addCommandToHistory(S)}this.adjustValue(0,O)};this.updateCursor=function(){var S=parseFloat(this.value)*-1/l+o;H.css("top",S)};this.start= S.originalEvent.touches[0];if(v===0)v=U;U=(S.pageY-v)*-1;v=S.pageY;N=U*l*p;this.adjustValue(N.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");v=0;if(K[0]){var S=q.undoMgr.finishUndoableChange();S.isEmpty()||q.undoMgr.addCommandToHistory(S)}this.adjustValue(0,O)};this.updateCursor=function(){var S=parseFloat(this.value)*-1/l+o;H.css("top",S)};this.start=

View File

@ -324,11 +324,12 @@
<input id="font_family" data-title="Change Font Family" size="12" type="hidden" /> <input id="font_family" data-title="Change Font Family" size="12" type="hidden" />
<select id="font_family_dropdown"> <select id="font_family_dropdown">
<option value="Helvetica, Arial, sans-serif" selected>Helvetica</option> <option value="Helvetica, Arial, sans-serif" selected>Helvetica</option>
<option value="Arvo, sans-serif">Arvo</option> <!--<option value="Arvo, sans-serif">Arvo</option>
<option value="Euphoria, sans-serif">Euphoria</option> <option value="Euphoria, sans-serif">Euphoria</option>
<option value="Oswald, sans-serif">Oswald</option> <option value="Oswald, sans-serif">Oswald</option>
<option value="'Shadows Into Light', serif">Shadows Into Light</option> <option value="'Shadows Into Light', serif">Shadows Into Light</option>
<option value="'Simonetta', serif">Simonetta</option> <option value="'Simonetta', serif">Simonetta</option>-->
<option value="'Trebuchet MS', Gadget, sans-serif">Georgia</option>
<option value="Georgia, Times, 'Times New Roman', serif">Georgia</option> <option value="Georgia, Times, 'Times New Roman', serif">Georgia</option>
<option value="'Palatino Linotype', 'Book Antiqua', Palatino, serif">Palatino</option> <option value="'Palatino Linotype', 'Book Antiqua', Palatino, serif">Palatino</option>
<option value="'Times New Roman', Times, serif">Times</option> <option value="'Times New Roman', Times, serif">Times</option>

View File

@ -148,8 +148,6 @@
})(); })();
(function() { (function() {
$("#canvas_width").val(curConfig.dimensions[0]);
$("#canvas_height").val(curConfig.dimensions[1]);
$("body").toggleClass("touch", svgedit.browser.isTouch()); $("body").toggleClass("touch", svgedit.browser.isTouch());
// Load config/data from URL if given // Load config/data from URL if given
var urldata = $.deparam.querystring(true); var urldata = $.deparam.querystring(true);
@ -194,6 +192,9 @@
} }
})(); })();
$("#canvas_width").val(curConfig.dimensions[0]);
$("#canvas_height").val(curConfig.dimensions[1]);
var extFunc = function() { var extFunc = function() {
$.each(curConfig.extensions, function() { $.each(curConfig.extensions, function() {
var extname = this; var extname = this;

View File

@ -379,124 +379,124 @@ key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},
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...", 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" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions}; saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions};
b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,n){var s=g.id,A=s.split("_"),F=A[0];A=A[1];n&&h.setStrokeAttr("stroke-"+F,A);wa();Ib("#cur_"+F,s,20);a(g).addClass("current").siblings().removeClass("current")}(function(){var g= b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,n){var s=g.id,A=s.split("_"),F=A[0];A=A[1];n&&h.setStrokeAttr("stroke-"+F,A);wa();Ib("#cur_"+F,s,20);a(g).addClass("current").siblings().removeClass("current")}(function(){var g=
window.opener;if(g)try{var n=g.document.createEvent("Event");n.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(n)}catch(s){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color= window.opener;if(g)try{var n=g.document.createEvent("Event");n.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(n)}catch(s){}})();(function(){a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color="#"+g.bkgd_color;svgEditor.setConfig(g);var n=g.source,s=a.param.querystring();
"#"+g.bkgd_color;svgEditor.setConfig(g);var n=g.source,s=a.param.querystring();if(!n)if(s.indexOf("source=data:")>=0)n=s.match(/source=(data:[^&]*)/)[1];if(n)if(n.indexOf("data:")===0){n=n.replace(/ /g,"+");b.loadFromDataURI(n)}else b.loadFromString(n);else if(s.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(s.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();var l=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(n){if(!n){n=document.createElement("script"); if(!n)if(s.indexOf("source=data:")>=0)n=s.match(/source=(data:[^&]*)/)[1];if(n)if(n.indexOf("data:")===0){n=n.replace(/ /g,"+");b.loadFromDataURI(n)}else b.loadFromString(n);else if(s.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(s.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);var l=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(n){if(!n){n=
n.src=curConfig.extPath+g;document.querySelector("head").appendChild(n)}})})};document.location.protocol==="file:"?setTimeout(l,100):l();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png", document.createElement("script");n.src=curConfig.extPath+g;document.querySelector("head").appendChild(n)}})})};document.location.protocol==="file:"?setTimeout(l,100):l();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png",
node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image", "delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path",
"#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"}, "#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",
resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var n= "#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");
a("#"+this.id+"_show"),s=n.attr("data-curopt");if(!n.children("svg, img").length){s=a(s).children().clone();if(s.length){s[0].removeAttribute("style");n.append(s)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter", var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+"_show"),s=n.attr("data-curopt");if(!n.children("svg, img").length){s=a(s).children().clone();if(s.length){s[0].removeAttribute("style");n.append(s)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-
function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};l=navigator.platform.indexOf("Mac")>=0;var v=navigator.userAgent.indexOf("AppleWebKit")>=0,B=l?"meta+":"ctrl+",q=h.pathActions,K=h.undoMgr,R=svgedit.utilities,O=curConfig.imgPath+ 10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};l=navigator.platform.indexOf("Mac")>=0;var v=navigator.userAgent.indexOf("AppleWebKit")>=
"placeholder.svg",H=a("#workarea"),S=a("#cmenu_canvas"),U=null,N=1,ga="toolbars",pa="";l||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),n=a("#dialog_buttons"),s=function(A,F,J,L){a("#dialog_content").html("<p>"+F.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",A=="prompt");n.empty();var Z=a('<input type="button" value="'+ 0,B=l?"meta+":"ctrl+",q=h.pathActions,K=h.undoMgr,R=svgedit.utilities,O=curConfig.imgPath+"placeholder.svg",H=a("#workarea"),S=a("#cmenu_canvas"),U=null,N=1,ga="toolbars",pa="";l||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),n=a("#dialog_buttons"),s=function(A,F,J,L){a("#dialog_content").html("<p>"+F.replace(/\n/g,
uiStrings.common.ok+'">').appendTo(n);A!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(n).on("click, touchstart",function(){g.hide();J(false)});if(A=="prompt"){var ba=a('<input type="text">').prependTo(n);ba.val(L||"");ba.bind("keydown","return",function(){Z.trigger("click touchstart")})}A=="process"&&Z.hide();g.show();Z.on("click touchstart",function(){g.hide();var T=A=="prompt"?ba.val():true;J&&J(T)}).focus();A=="prompt"&&ba.focus()};a.alert=function(A,F){s("alert", "</p><p>")+"</p>").toggleClass("prompt",A=="prompt");n.empty();var Z=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(n);A!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(n).on("click, touchstart",function(){g.hide();J(false)});if(A=="prompt"){var ba=a('<input type="text">').prependTo(n);ba.val(L||"");ba.bind("keydown","return",function(){Z.trigger("click touchstart")})}A=="process"&&Z.hide();g.show();Z.on("click touchstart",function(){g.hide();
A,F)};a.confirm=function(A,F){s("confirm",A,F)};a.process_cancel=function(A,F){s("process",A,F)};a.prompt=function(A,F,J){s("prompt",A,J,F)}})();var fa=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},Q=null,Y=false,xa=false,ja="",ca=function(g,n){var s=h.getResolution();a("#svgcanvas").position();var A=h.setBBoxZoom(n, var T=A=="prompt"?ba.val():true;J&&J(T)}).focus();A=="prompt"&&ba.focus()};a.alert=function(A,F){s("alert",A,F)};a.confirm=function(A,F){s("confirm",A,F)};a.process_cancel=function(A,F){s("process",A,F)};a.prompt=function(A,F,J){s("prompt",A,J,F)}})();var fa=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},Q=
H.width()-15,H.height()-15);if(A){var F=A.zoom;A=A.bbox;if(F<0.0010)Fa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),L=F-s.zoom;a("#zoom");var Z=s.zoom,ba=function(T){T=(T-J)/500;T=Math.pow(T-1,3)+1;h.setZoom(Z+L*T);D();if(T<1)g.animatedZoom=requestAnimationFrame(ba);else{a("#zoom").val(parseInt(F*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(F*100)+"]","#zoom_select").attr("selected","selected")}};ba(Date.now()); null,Y=false,xa=false,ja="",ca=function(g,n){var s=h.getResolution();a("#svgcanvas").position();var A=h.setBBoxZoom(n,H.width()-15,H.height()-15);if(A){var F=A.zoom;A=A.bbox;if(F<0.0010)Fa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),L=F-s.zoom;a("#zoom");var Z=s.zoom,ba=function(T){T=(T-J)/500;T=Math.pow(T-1,3)+1;h.setZoom(Z+L*T);D();if(T<1)g.animatedZoom=requestAnimationFrame(ba);else{a("#zoom").val(parseInt(F*100));a("option","#zoom_select").removeAttr("selected");
h.getMode()=="zoom"&&A.width&&fa();Jb()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var V=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},W={},na=function(g){a.each(g,function(n,s){var A=a(n).children(),F=n+"_show",J=a(F),L=false;A.addClass("tool_button").unbind("click mousedown mouseup").each(function(T){var X=s[T];W[X.sel]=X.fn;if(X.isDefault)L=T;T=function(ha){var oa=X;if(ha.type=== a("option[value="+parseInt(F*100)+"]","#zoom_select").attr("selected","selected")}};ba(Date.now());h.getMode()=="zoom"&&A.width&&fa();Jb()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var V=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},W={},na=function(g){a.each(g,function(n,s){var A=a(n).children(),F=n+"_show",J=a(F),L=false;A.addClass("tool_button").unbind("click mousedown mouseup").each(function(T){var X=
"keydown"){var ea=a(oa.parent+"_show").hasClass("tool_button_current"),ua=a(oa.parent+"_show").attr("data-curopt");a.each(g[X.parent],function(sa,ra){if(ra.sel==ua)oa=!ha.shiftKey||!ea?ra:g[X.parent][sa+1]||g[X.parent][0]})}if(a(this).hasClass("disabled"))return false;Ua(F)&&oa.fn();var Ma=oa.icon?a.getSvgIcon(oa.icon,true):a(oa.sel).children().eq(0).clone();Ma[0].setAttribute("width",J.width());Ma[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ma).attr("data-curopt", s[T];W[X.sel]=X.fn;if(X.isDefault)L=T;T=function(ha){var oa=X;if(ha.type==="keydown"){var ea=a(oa.parent+"_show").hasClass("tool_button_current"),ua=a(oa.parent+"_show").attr("data-curopt");a.each(g[X.parent],function(sa,ra){if(ra.sel==ua)oa=!ha.shiftKey||!ea?ra:g[X.parent][sa+1]||g[X.parent][0]})}if(a(this).hasClass("disabled"))return false;Ua(F)&&oa.fn();var Ma=oa.icon?a.getSvgIcon(oa.icon,true):a(oa.sel).children().eq(0).clone();Ma[0].setAttribute("width",J.width());Ma[0].setAttribute("height",
oa.sel)};a(this).mouseup(T);X.key&&a(document).bind("keydown",X.key[0]+" shift+"+X.key[0],T)});if(L)J.attr("data-curopt",s[L].sel);else J.attr("data-curopt")||J.attr("data-curopt",s[0].sel);var Z,ba=a(F).position();a(n).css({left:ba.left+34,top:ba.top+77});J.mousedown(function(T){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ua(F,false);if(J.hasClass("disabled"))return false;var X=a(n),ha=ba.left+34,oa=X.width()*-1,ea=X.data("shown_popop")? J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ma).attr("data-curopt",oa.sel)};a(this).mouseup(T);X.key&&a(document).bind("keydown",X.key[0]+" shift+"+X.key[0],T)});if(L)J.attr("data-curopt",s[L].sel);else J.attr("data-curopt")||J.attr("data-curopt",s[0].sel);var Z,ba=a(F).position();a(n).css({left:ba.left+34,top:ba.top+77});J.mousedown(function(T){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ua(F,false);if(J.hasClass("disabled"))return false;
200:0;Z=setTimeout(function(){J.data("isLibrary")?X.css("left",ha).show():X.css("left",oa).show().animate({left:ha},50);X.data("shown_popop",true)},ea);T.preventDefault()}).mouseup(function(){clearTimeout(Z);var T=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(F.replace("_show","")).is(":visible"))Ua(F,true);else Ua(F)&&T in W&&W[T]()})});la()},qa=function(g,n){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(n)},ma=function(){a(".tools_flyout").each(function(){var g= var X=a(n),ha=ba.left+34,oa=X.width()*-1,ea=X.data("shown_popop")?200:0;Z=setTimeout(function(){J.data("isLibrary")?X.css("left",ha).show():X.css("left",oa).show().animate({left:ha},50);X.data("shown_popop",true)},ea);T.preventDefault()}).mouseup(function(){clearTimeout(Z);var T=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(F.replace("_show","")).is(":visible"))Ua(F,true);else Ua(F)&&T in W&&W[T]()})});la()},qa=function(g,n){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(n)},
a("#"+this.id+"_show"),n=g.offset();g=g.outerWidth();a(this).css({left:(n.left+g)*N,top:n.top})})},la=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});g[0].title=n.join(" / ")}})},za,Ga=function(g,n,s){var A=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+s+"_color defs *")[0];A={alpha:n};A[g.tagName]=g}else A=g.indexOf("#")===0?{alpha:n,solidColor:g.substr(1)}: ma=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show"),n=g.offset();g=g.outerWidth();a(this).css({left:(n.left+g)*N,top:n.top})})},la=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});g[0].title=n.join(" / ")}})},za,Ga=function(g,n,s){var A=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+s+"_color defs *")[0];A={alpha:n};A[g.tagName]=
{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(A)},Aa=h.getResolution();if(curConfig.baseUnit!=="px"){Aa.w=svgedit.units.convertUnit(Aa.w)+curConfig.baseUnit;Aa.h=svgedit.units.convertUnit(Aa.h)+curConfig.baseUnit}var Ha=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Aa.w+2,height:Aa.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")}; g}else A=g.indexOf("#")===0?{alpha:n,solidColor:g.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(A)},Aa=h.getResolution();if(curConfig.baseUnit!=="px"){Aa.w=svgedit.units.convertUnit(Aa.w)+curConfig.baseUnit;Aa.h=svgedit.units.convertUnit(Aa.h)+curConfig.baseUnit}var Ha=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Aa.w+2,height:Aa.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});
document.getElementById("canvas_background")||Ha();document.getElementById("canvas_background").getAttribute("fill");var Ja=b.setImageURL=function(g){g||(g=O);h.setImageURL(g);a("#image_url").val(g)},Ia=function(){var g=Q;if(g!=null&&!g.parentNode)g=null;if(Y&&Y[0]!=null&&!Y[0].parentNode)Y=false;var n=h.getCurrentDrawing().getCurrentLayerName(),s=h.getMode(),A=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,F=s=="pathedit";if(F){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide(); h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ha();document.getElementById("canvas_background").getAttribute("fill");var Ja=b.setImageURL=function(g){g||(g=O);h.setImageURL(g);a("#image_url").val(g)},Ia=function(){var g=Q;if(g!=null&&!g.parentNode)g=null;if(Y&&Y[0]!=null&&!Y[0].parentNode)Y=false;var n=h.getCurrentDrawing().getCurrentLayerName(),s=h.getMode(),A=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,F=s=="pathedit";if(F){a(".context_panel").hide();
n=q.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!q.canDeleteNodes);Ib("#tool_openclose_path",q.closed_subpath?"open_path":"close_path");if(n){F=a("#seg_type");if(A){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));n.type?F.val(n.type).removeAttr("disabled"):F.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected"); a("#path_node_panel").show();a("#stroke_panel").hide();n=q.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!q.canDeleteNodes);Ib("#tool_openclose_path",q.closed_subpath?"open_path":"close_path");if(n){F=a("#seg_type");if(A){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));n.type?F.val(n.type).removeAttr("disabled"):
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(Y){Y=Y.filter(Boolean);(g=h.elementsAreSame(Y)?Y[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!Y){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var L=g.nodeName,Z=h.getRotationAngle(g); F.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(Y){Y=Y.filter(Boolean);(g=h.elementsAreSame(Y)?Y[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!Y){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=
a("#angle").val(Math.round(Z));Z=h.getBlur(g);a("#blur").val(Z);if(!F&&s!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var ba,T;if(["g","polyline","path"].indexOf(L)>=0)if(s=h.getStrokedBBox([g])){ba=s.x;T=s.y}if(A){ba=svgedit.units.convertUnit(ba);T=svgedit.units.convertUnit(T)}a("#"+L+"_x").val(Math.round(ba));a("#"+L+"_y").val(Math.round(T));if(L==="polyline"){a("#path_x").val(Math.round(ba));a("#path_y").val(Math.round(T))}["image","text","path","g","use"].indexOf(L)== null){a("#stroke_panel").show();var L=g.nodeName,Z=h.getRotationAngle(g);a("#angle").val(Math.round(Z));Z=h.getBlur(g);a("#blur").val(Z);if(!F&&s!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var ba,T;if(["g","polyline","path"].indexOf(L)>=0)if(s=h.getStrokedBBox([g])){ba=s.x;T=s.y}if(A){ba=svgedit.units.convertUnit(ba);T=svgedit.units.convertUnit(T)}a("#"+L+"_x").val(Math.round(ba));a("#"+L+"_y").val(Math.round(T));if(L==="polyline"){a("#path_x").val(Math.round(ba));
-1&&a(".action_path_convert_selected").removeClass("disabled");L==="path"&&a(".action_path_selected").removeClass("disabled")}A=null;if(X==="a"){A=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();A=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!A);A&&a("#link_url").val(A);A={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1", a("#path_y").val(Math.round(T))}["image","text","path","g","use"].indexOf(L)==-1&&a(".action_path_convert_selected").removeClass("disabled");L==="path"&&a(".action_path_selected").removeClass("disabled")}A=null;if(X==="a"){A=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();A=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!A);A&&a("#link_url").val(A);A={g:[],a:[],rect:["rx","width","height","x","y"],image:["width",
"y1","x2","y2"],text:["x","y"],use:[],path:[]};var X=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(X=="path"||X=="polyline")a("#path_panel").show();if(A[X]){A=A[X];a("#"+X+"_panel").show();X=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(A,function(ha,oa){var ea=g.getAttribute(oa);if(curConfig.baseUnit!=="px"&&g[oa])ea=svgedit.units.convertUnit(g[oa].baseVal.value);var ua=document.getElementById(X+"_"+oa);ua.value=Math.round(ea)||0;ua.getAttribute("data-cursor")=== "height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var X=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(X=="path"||X=="polyline")a("#path_panel").show();if(A[X]){A=A[X];a("#"+X+"_panel").show();X=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(A,function(ha,oa){var ea=g.getAttribute(oa);if(curConfig.baseUnit!=="px"&&g[oa])ea=svgedit.units.convertUnit(g[oa].baseVal.value);var ua=document.getElementById(X+
"true"&&a.fn.dragInput.updateCursor(ua)});if(X=="text"){A=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(A);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(A.split(",")[0].replace(/'/g,"")).css("font-family",A);h.addedNew&&setTimeout(function(){a("#text").focus().select()}, "_"+oa);ua.value=Math.round(ea)||0;ua.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(ua)});if(X=="text"){A=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(A);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(A.split(",")[0].replace(/'/g,
100)}else if(X=="image")Ja(h.getHref(g));else if(X==="g"||X==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(X==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(X==="g"||!Y?"dis":"en")+"ableContextMenuItems"]("#group")}if(Y){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back"); "")).css("font-family",A);h.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(X=="image")Ja(h.getHref(g));else if(X==="g"||X==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(X==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(X==="g"||!Y?"dis":"en")+"ableContextMenuItems"]("#group")}if(Y){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||
K.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");K.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!F||Y){a("#selLayerNames").removeAttr("disabled").val(n);S.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,n){var s=h.getMode();s==="select"&& J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");K.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");K.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!F||Y){a("#selLayerNames").removeAttr("disabled").val(n);S.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",
fa();if(s==="pathedit")return Ia();Q=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);Y=n.length>=2?n:false;if(h.elementsAreSame(Y))Q=Y[0];if(Q!=null){a("#multiselected_panel").hide();if(Q!=null)switch(Q.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":s=null;for(var A=Q.getElementsByTagName("*"),F=0,J=A.length;F<J;F++){var L=A[F].getAttribute("stroke-width");if(F===0)s=L;else if(s!==L)s=null}a("#stroke_width").val(s===null?"":s);break;default:a("#stroke_width").val(Q.getAttribute("stroke-width")|| function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,n){var s=h.getMode();s==="select"&&fa();if(s==="pathedit")return Ia();Q=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);Y=n.length>=2?n:false;if(h.elementsAreSame(Y))Q=Y[0];if(Q!=null){a("#multiselected_panel").hide();if(Q!=null)switch(Q.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":s=null;for(var A=Q.getElementsByTagName("*"),F=0,J=A.length;F<J;F++){var L=A[F].getAttribute("stroke-width");
1);s=Q.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+s+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);s=Q.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+s).length!=0&&d(a("#linejoin_"+s)[0]);s=Q.getAttribute("stroke-linecap")||"butt";a("#linecap_"+s).length!=0&&d(a("#linecap_"+s)[0])}if(Q!=null){s=(Q.getAttribute("opacity")||1)*100;a("#group_opacity").val(s); if(F===0)s=L;else if(s!==L)s=null}a("#stroke_width").val(s===null?"":s);break;default:a("#stroke_width").val(Q.getAttribute("stroke-width")||1);s=Q.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+s+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);s=Q.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+s).length!=0&&d(a("#linejoin_"+s)[0]);s=Q.getAttribute("stroke-linecap")||
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}Y.length&&a("#tools_top").addClass("multiselected")}else if(Y.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:n,selectedElement:Q,multiselected:Y})});h.bind("transition",function(g,n){var s=h.getMode(),A=n[0];if(A){Y=n.length>=2&&n[1]!=null? "butt";a("#linecap_"+s).length!=0&&d(a("#linecap_"+s)[0])}if(Q!=null){s=(Q.getAttribute("opacity")||1)*100;a("#group_opacity").val(s);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}Y.length&&a("#tools_top").addClass("multiselected")}else if(Y.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:n,
n:null;if(!Y)switch(s){case "rotate":s=h.getRotationAngle(A);a("#angle").val(Math.round(s));rotateCursor(s);a("#tool_reorient").toggleClass("disabled",s==0)}h.runExtensions("elementTransition",{elems:n})}});h.bind("changed",function(g,n){var s=h.getMode();s==="select"&&fa();for(var A=0;A<n.length;++A){var F=n[A];if(F&&F.tagName==="svg")D();else if(F&&Q&&Q.parentNode==null)Q=F}b.show_save_warning=true;Ia();if(Q&&s==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged", selectedElement:Q,multiselected:Y})});h.bind("transition",function(g,n){var s=h.getMode(),A=n[0];if(A){Y=n.length>=2&&n[1]!=null?n:null;if(!Y)switch(s){case "rotate":s=h.getRotationAngle(A);a("#angle").val(Math.round(s));rotateCursor(s);a("#tool_reorient").toggleClass("disabled",s==0)}h.runExtensions("elementTransition",{elems:n})}});h.bind("changed",function(g,n){var s=h.getMode();s==="select"&&fa();for(var A=0;A<n.length;++A){var F=n[A];if(F&&F.tagName==="svg")D();else if(F&&Q&&Q.parentNode==null)Q=
{elems:n})});h.bind("saved",function(g,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var s=navigator.userAgent;if(~s.indexOf("Chrome")&&a.browser.version>=533||~s.indexOf("MSIE"))zb(0,true);else{var A=g.open("data:image/svg+xml;base64,"+R.encode64(n)),F=a.pref("save_notice_done");if(F!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(s.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done", F}b.show_save_warning=true;Ia();if(Q&&s==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged",{elems:n})});h.bind("saved",function(g,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var s=navigator.userAgent;if(~s.indexOf("Chrome")&&a.browser.version>=533||~s.indexOf("MSIE"))zb(0,true);else{var A=g.open("data:image/svg+xml;base64,"+R.encode64(n)),F=a.pref("save_notice_done");if(F!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s",
"all");F="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");F!=="part"&&A.alert(J)}}});h.bind("exported",function(g,n){var s=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var A=a("#export_canvas")[0];A.width=h.contentW;A.height=h.contentH;canvg(A,n.svg,{renderCallback:function(){var F=A.toDataURL("image/png");U.location.href=F;if(a.pref("export_notice_done")!=="all"){F=uiStrings.notification.saveFromBrowser.replace("%s", "SVG");if(s.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");F="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");F!=="part"&&A.alert(J)}}});h.bind("exported",function(g,n){var s=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var A=a("#export_canvas")[0];A.width=h.contentW;A.height=h.contentH;canvg(A,n.svg,{renderCallback:function(){var F=
"PNG");if(s.length)F+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+s.join("\n \u2022 ");a.pref("export_notice_done","all");U.alert(F)}}})});h.bind("zoomed",ca);h.bind("contextset",function(g,n){var s="";if(n){var A="";s='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){A+=" > "+this.id;s+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});ja=A}else ja=null;a("#cur_context_panel").toggle(!!n).html(s)}); A.toDataURL("image/png");U.location.href=F;if(a.pref("export_notice_done")!=="all"){F=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(s.length)F+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+s.join("\n \u2022 ");a.pref("export_notice_done","all");U.alert(F)}}})});h.bind("zoomed",ca);h.bind("contextset",function(g,n){var s="";if(n){var A="";s='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){A+=
h.bind("extension_added",function(g,n){function s(){if(za){clearTimeout(za);za=null}F||(za=setTimeout(function(){F=true;hb(u.iconsize)},50))}var A=false,F=false,J=true,L=function(){if(n.callback&&!A&&J){A=true;n.callback()}},Z=[];n.context_tools&&a.each(n.context_tools,function(oa,ea){var ua=ea.container_id?' id="'+ea.container_id+'"':"",Ma=a("#"+ea.panel);Ma.length||(Ma=a("<div>",{id:ea.panel}).appendTo("#tools_top").hide());switch(ea.type){case "tool_button":var sa='<div class="tool_button">'+ea.id+ " > "+this.id;s+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});ja=A}else ja=null;a("#cur_context_panel").toggle(!!n).html(s)});h.bind("extension_added",function(g,n){function s(){if(za){clearTimeout(za);za=null}F||(za=setTimeout(function(){F=true;hb(u.iconsize)},50))}var A=false,F=false,J=true,L=function(){if(n.callback&&!A&&J){A=true;n.callback()}},Z=[];n.context_tools&&a.each(n.context_tools,function(oa,ea){var ua=ea.container_id?' id="'+ea.container_id+'"':"",Ma=a("#"+ea.panel);Ma.length||
"</div>",ra=a(sa).appendTo(Ma);ea.events&&a.each(ea.events,function(Oa,lb){a(ra).bind(Oa,lb)});break;case "select":sa="<label"+ua+'><select id="'+ea.id+'">';a.each(ea.options,function(Oa,lb){sa+='<option value="'+Oa+'"'+(Oa==ea.defval?" selected":"")+">"+lb+"</option>"});sa+="</select></label>";var Za=a(sa).appendTo(Ma).find("select");a.each(ea.events,function(Oa,lb){a(Za).bind(Oa,lb)});break;case "button-select":sa='<div id="'+ea.id+'" class="dropdown toolset" title="'+ea.title+'"><div id="cur_'+ (Ma=a("<div>",{id:ea.panel}).appendTo("#tools_top").hide());switch(ea.type){case "tool_button":var sa='<div class="tool_button">'+ea.id+"</div>",ra=a(sa).appendTo(Ma);ea.events&&a.each(ea.events,function(Oa,lb){a(ra).bind(Oa,lb)});break;case "select":sa="<label"+ua+'><select id="'+ea.id+'">';a.each(ea.options,function(Oa,lb){sa+='<option value="'+Oa+'"'+(Oa==ea.defval?" selected":"")+">"+lb+"</option>"});sa+="</select></label>";var Za=a(sa).appendTo(Ma).find("select");a.each(ea.events,function(Oa,
ea.id+'" class="icon_label"></div><button></button></div>';ua=a('<ul id="'+ea.id+'_opts"></ul>').appendTo("#option_lists");ea.colnum&&ua.addClass("optcols"+ea.colnum);a(sa).appendTo(Ma).children();Z.push({elem:"#"+ea.id,list:"#"+ea.id+"_opts",title:ea.title,callback:ea.events.change,cur:"#cur_"+ea.id});break;case "input":sa="<label"+ua+'><span id="'+ea.id+'_label">'+ea.label+':</span><input id="'+ea.id+'" title="'+ea.title+'" size="'+(ea.size||"4")+'" value="'+(ea.defval||"")+'" type="text"/></label>'; lb){a(Za).bind(Oa,lb)});break;case "button-select":sa='<div id="'+ea.id+'" class="dropdown toolset" title="'+ea.title+'"><div id="cur_'+ea.id+'" class="icon_label"></div><button></button></div>';ua=a('<ul id="'+ea.id+'_opts"></ul>').appendTo("#option_lists");ea.colnum&&ua.addClass("optcols"+ea.colnum);a(sa).appendTo(Ma).children();Z.push({elem:"#"+ea.id,list:"#"+ea.id+"_opts",title:ea.title,callback:ea.events.change,cur:"#cur_"+ea.id});break;case "input":sa="<label"+ua+'><span id="'+ea.id+'_label">'+
var Qa=a(sa).appendTo(Ma).find("input");ea.spindata&&Qa.SpinButton(ea.spindata);ea.events&&a.each(ea.events,function(Oa,lb){Qa.bind(Oa,lb)})}});if(n.buttons){var ba={},T={},X=n.svgicons,ha={};a.each(n.buttons,function(oa,ea){for(var ua,Ma=ea.id,sa=oa;a("#"+Ma).length;)Ma=ea.id+"_"+ ++sa;if(X){ba[Ma]=ea.icon;sa=ea.svgicon?ea.svgicon:ea.id;if(ea.type=="app_menu")T["#"+Ma+" > div"]=sa;else T["#"+Ma]=sa}else ua=ea.type=="menu"?"":a('<img src="'+ea.icon+'">');var ra,Za;switch(ea.type){case "mode_flyout":case "mode":ra= ea.label+':</span><input id="'+ea.id+'" title="'+ea.title+'" size="'+(ea.size||"4")+'" value="'+(ea.defval||"")+'" type="text"/></label>';var Qa=a(sa).appendTo(Ma).find("input");ea.spindata&&Qa.SpinButton(ea.spindata);ea.events&&a.each(ea.events,function(Oa,lb){Qa.bind(Oa,lb)})}});if(n.buttons){var ba={},T={},X=n.svgicons,ha={};a.each(n.buttons,function(oa,ea){for(var ua,Ma=ea.id,sa=oa;a("#"+Ma).length;)Ma=ea.id+"_"+ ++sa;if(X){ba[Ma]=ea.icon;sa=ea.svgicon?ea.svgicon:ea.id;if(ea.type=="app_menu")T["#"+
"tool_button";if(ea.cls)ra+=" "+ea.cls;Za="#tools_left";break;case "context":ra="tool_button";Za="#"+ea.panel;a(Za).length||a("<div>",{id:ea.panel}).appendTo("#tools_top");break;case "menu":ra="menu_item tool_button";Za="#"+(ea.after||ea.panel);break;case "app_menu":ra="";Za=ea.parent||"#main_menu ul";a(Za).length||a("<div>",{id:ea.panel}).appendTo("#tools_top")}var Qa=a(ea.list||ea.type=="app_menu"?"<li/>":"<div/>").attr("id",Ma).attr("title",ea.title).addClass(ra);if(!ea.includeWith&&!ea.list){if("position"in Ma+" > div"]=sa;else T["#"+Ma]=sa}else ua=ea.type=="menu"?"":a('<img src="'+ea.icon+'">');var ra,Za;switch(ea.type){case "mode_flyout":case "mode":ra="tool_button";if(ea.cls)ra+=" "+ea.cls;Za="#tools_left";break;case "context":ra="tool_button";Za="#"+ea.panel;a(Za).length||a("<div>",{id:ea.panel}).appendTo("#tools_top");break;case "menu":ra="menu_item tool_button";Za="#"+(ea.after||ea.panel);break;case "app_menu":ra="";Za=ea.parent||"#main_menu ul";a(Za).length||a("<div>",{id:ea.panel}).appendTo("#tools_top")}var Qa=
ea)a(Za).children().eq(ea.position).before(Qa);else ea.type!="menu"||!ea.after?Qa.appendTo(Za):a(Za).after(Qa);if(ea.type=="mode_flyout"){sa=a(Qa);ra=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Oa=sa[0].id.replace("tool_","tools_"),lb=sa.clone().attr("id",Oa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(lb);ra=qa(Oa,sa);ra.data("isLibrary",true);lb.data("isLibrary",true)}T["#"+Oa+"_show"]=ea.id;Ma=ha["#"+ra[0].id]=[{sel:"#"+Ma,fn:ea.events.click,icon:ea.id,isDefault:true}, a(ea.list||ea.type=="app_menu"?"<li/>":"<div/>").attr("id",Ma).attr("title",ea.title).addClass(ra);if(!ea.includeWith&&!ea.list){if("position"in ea)a(Za).children().eq(ea.position).before(Qa);else ea.type!="menu"||!ea.after?Qa.appendTo(Za):a(Za).after(Qa);if(ea.type=="mode_flyout"){sa=a(Qa);ra=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Oa=sa[0].id.replace("tool_","tools_"),lb=sa.clone().attr("id",Oa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(lb);ra=qa(Oa,sa);
xb]}else if(ea.type=="app_menu"||ea.type=="menu")Qa.append(ea.title)}else if(ea.list){Qa.addClass("push_button");a("#"+ea.list+"_opts").append(Qa);if(ea.isDefault){a("#cur_"+ea.list).append(Qa.children().clone());sa=ea.svgicon?ea.svgicon:ea.id;T["#cur_"+ea.list]=sa}}else if(ea.includeWith){Za=ea.includeWith;sa=a(Za.button);ra=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Oa=sa[0].id.replace("tool_","tools_");lb=sa.clone().attr("id",Oa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"})); ra.data("isLibrary",true);lb.data("isLibrary",true)}T["#"+Oa+"_show"]=ea.id;Ma=ha["#"+ra[0].id]=[{sel:"#"+Ma,fn:ea.events.click,icon:ea.id,isDefault:true},xb]}else if(ea.type=="app_menu"||ea.type=="menu")Qa.append(ea.title)}else if(ea.list){Qa.addClass("push_button");a("#"+ea.list+"_opts").append(Qa);if(ea.isDefault){a("#cur_"+ea.list).append(Qa.children().clone());sa=ea.svgicon?ea.svgicon:ea.id;T["#cur_"+ea.list]=sa}}else if(ea.includeWith){Za=ea.includeWith;sa=a(Za.button);ra=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Oa=
sa.before(lb);ra=qa(Oa,sa)}var xb=G.getButtonData(Za.button);if(Za.isDefault)T["#"+Oa+"_show"]=ea.id;Ma=ha["#"+ra[0].id]=[{sel:"#"+Ma,fn:ea.events.click,icon:ea.id,key:ea.key,isDefault:ea.includeWith?ea.includeWith.isDefault:0},xb];Oa="position"in Za?Za.position:"last";xb=ra.children().length;if(!isNaN(Oa)&&Oa>=0&&Oa<xb)ra.children().eq(Oa).before(Qa);else{ra.append(Qa);Ma.reverse()}}X||Qa.append(ua);ea.list||a.each(ea.events,function(Cb,Mb){if(Cb=="click")if(ea.type=="mode"){ea.includeWith?Qa.bind(Cb, sa[0].id.replace("tool_","tools_");lb=sa.clone().attr("id",Oa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(lb);ra=qa(Oa,sa)}var xb=G.getButtonData(Za.button);if(Za.isDefault)T["#"+Oa+"_show"]=ea.id;Ma=ha["#"+ra[0].id]=[{sel:"#"+Ma,fn:ea.events.click,icon:ea.id,key:ea.key,isDefault:ea.includeWith?ea.includeWith.isDefault:0},xb];Oa="position"in Za?Za.position:"last";xb=ra.children().length;if(!isNaN(Oa)&&Oa>=0&&Oa<xb)ra.children().eq(Oa).before(Qa);else{ra.append(Qa);Ma.reverse()}}X||
Mb):Qa.bind(Cb,function(){Ua(Qa)&&Mb()});if(ea.key){a(document).bind("keydown",ea.key,Mb);ea.title&&Qa.attr("title",ea.title+" ["+ea.key+"]")}}else Qa.bind(Cb,Mb);else Qa.bind(Cb,Mb)});na(ha)});a.each(Z,function(){Va(this.elem,this.list,this.callback,{seticon:true})});if(X)J=false;a.svgIcons(X,{w:27,h:27,id_match:false,no_img:!v,fallback:ba,placement:T,callback:function(){u.iconsize&&u.iconsize!="m"&&s();J=true;L()}})}L()});h.textActions.setInputElem(a("#text")[0]);var Da='<div class="palette_item" data-rgb="none"></div>'; Qa.append(ua);ea.list||a.each(ea.events,function(Cb,Mb){if(Cb=="click")if(ea.type=="mode"){ea.includeWith?Qa.bind(Cb,Mb):Qa.bind(Cb,function(){Ua(Qa)&&Mb()});if(ea.key){a(document).bind("keydown",ea.key,Mb);ea.title&&Qa.attr("title",ea.title+" ["+ea.key+"]")}}else Qa.bind(Cb,Mb);else Qa.bind(Cb,Mb)});na(ha)});a.each(Z,function(){Va(this.elem,this.list,this.callback,{seticon:true})});if(X)J=false;a.svgIcons(X,{w:27,h:27,id_match:false,no_img:!v,fallback:ba,placement:T,callback:function(){u.iconsize&&
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(g,n){Da+='<div class="palette_item" style="background-color: '+n+';" data-rgb="'+n+'"></div>'});a("#palette").append(Da); u.iconsize!="m"&&s();J=true;L()}})}L()});h.textActions.setInputElem(a("#text")[0]);var Da='<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",
var ya=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";ya.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var Fa=function(g){var n=g.value/100;if(n<0.0010)g.value=0.1;else{g=h.getZoom();ca(window,{width:0,height:0,x:(H[0].scrollLeft+H.width()/2)/g,y:(H[0].scrollTop+H.height()/2)/g,zoom:n},true)}},wa=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray", "#aad4ff"],function(g,n){Da+='<div class="palette_item" style="background-color: '+n+';" data-rgb="'+n+'"></div>'});a("#palette").append(Da);var ya=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";ya.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var Fa=function(g){var n=g.value/100;if(n<0.0010)g.value=0.1;else{g=h.getZoom();ca(window,{width:0,height:0,x:(H[0].scrollLeft+H.width()/2)/g,y:(H[0].scrollTop+H.height()/
a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);wa()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});changeAttribute=function(g){var n=g.getAttribute("data-attr"),s=g.getAttribute("data-multiplier")||1;s=parseFloat(s); 2)/g,zoom:n},true)}},wa=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);wa()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});
s=g.value*s;if(!svgedit.units.isValidUnit(n,s,Q)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=Q.getAttribute(n);return false}h.changeSelectedAttributeNoUndo(n,s)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),n=g?"stroke":"fill",s=a(this).attr("data-rgb"),A=null;if(s==="transparent"||s==="initial"||s==="#none"){s= changeAttribute=function(g){var n=g.getAttribute("data-attr"),s=g.getAttribute("data-multiplier")||1;s=parseFloat(s);s=g.value*s;if(!svgedit.units.isValidUnit(n,s,Q)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=Q.getAttribute(n);return false}h.changeSelectedAttributeNoUndo(n,s)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),
"none";A=new a.jGraduate.Paint}else A=new a.jGraduate.Paint({alpha:100,solidColor:s.substr(1)});b.paintBox[n].setPaint(A);if(g){h.setColor("stroke",s);s!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",s);s!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");k()},function(){a(".stroke_tool").css("display", n=g?"stroke":"fill",s=a(this).attr("data-rgb"),A=null;if(s==="transparent"||s==="initial"||s==="#none"){s="none";A=new a.jGraduate.Paint}else A=new a.jGraduate.Paint({alpha:100,solidColor:s.substr(1)});b.paintBox[n].setPaint(A);if(g){h.setColor("stroke",s);s!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",s);s!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
"none");a(this).removeClass("expanded");k()});var Ua=function(g,n){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var s=s||"normal";n||a(".tools_flyout").fadeOut(s);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=null,n=null,s=H[0],A=false,F=false;a("#svgcanvas").on("mousemove mouseup touchend", "table-cell");a(this).addClass("expanded");k()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");k()});var Ua=function(g,n){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var s=s||"normal";n||a(".tools_flyout").fadeOut(s);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=
function(J){if(A!==false){s.scrollLeft-=J.clientX-g;s.scrollTop-=J.clientY-n;g=J.clientX;n=J.clientY;if(J.type==="mouseup"||J.type==="touchend")A=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||F===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){A=true;g=J.clientX;n=J.clientY;return false}});a(window).mouseup(function(){A=false});a(document).bind("keydown","space",function(J){J.preventDefault();h.spaceKey=F=true}).bind("keyup","space",function(J){J.preventDefault(); null,n=null,s=H[0],A=false,F=false;a("#svgcanvas").on("mousemove mouseup touchend",function(J){if(A!==false){s.scrollLeft-=J.clientX-g;s.scrollTop-=J.clientY-n;g=J.clientX;n=J.clientY;if(J.type==="mouseup"||J.type==="touchend")A=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||F===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){A=true;g=J.clientX;n=J.clientY;return false}});a(window).mouseup(function(){A=false});a(document).bind("keydown","space",function(J){J.preventDefault();
h.spaceKey=F=false}).bind("keydown","alt",function(){h.getMode()==="zoom"&&H.addClass("out")}).bind("keyup","alt",function(){h.getMode()==="zoom"&&H.removeClass("out")})})();var tb=a(".menu"),eb=function(g){g.target.style.background="#fff";setTimeout(function(){g.target.style.background="#ddd"},50);setTimeout(function(){g.target.style.background="#fff"},150);setTimeout(function(){g.target.style.background="#ddd"},200);setTimeout(function(){g.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")}, h.spaceKey=F=true}).bind("keyup","space",function(J){J.preventDefault();h.spaceKey=F=false}).bind("keydown","alt",function(){h.getMode()==="zoom"&&H.addClass("out")}).bind("keyup","alt",function(){h.getMode()==="zoom"&&H.removeClass("out")})})();var tb=a(".menu"),eb=function(g){g.target.style.background="#fff";setTimeout(function(){g.target.style.background="#ddd"},50);setTimeout(function(){g.target.style.background="#fff"},150);setTimeout(function(){g.target.style.background="#ddd"},200);setTimeout(function(){g.target.style.background=
220);return false};a(".menu_item").on("mousedown touchstart",function(g){eb(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?eb(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,n,s,A){if(g.altKey){g.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+ ""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(g){eb(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?eb(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,n,s,A){if(g.altKey){g.preventDefault();
A*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");tb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){tb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,n,s){if(a(g).length!=0){var A=a(g).find("button"),F=a(g).find("ul").attr("id",a(g)[0].id+"-list");s||a("#option_lists").append(F);var J=false;s&&a(g).addClass("dropup");F.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!J){A.removeClass("down"); zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+A*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");tb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){tb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,n,s){if(a(g).length!=0){var A=a(g).find("button"),F=a(g).find("ul").attr("id",a(g)[0].id+"-list");s||a("#option_lists").append(F);var J=false;s&&
F.hide()}J=false});A.bind("mousedown",function(){if(A.hasClass("down")){A.removeClass("down");F.hide()}else{A.addClass("down");if(!s){var L=a(g).offset();F.css({top:L.top,left:L.left-110})}F.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Va=function(g,n,s,A){var F=a(g);n=a(n);var J=false,L=A.dropUp;L&&a(g).addClass("dropup");n.find("li").bind("mouseup",function(){if(A.seticon){Ib("#cur_"+F[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}s.apply(this, a(g).addClass("dropup");F.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!J){A.removeClass("down");F.hide()}J=false});A.bind("mousedown",function(){if(A.hasClass("down")){A.removeClass("down");F.hide()}else{A.addClass("down");if(!s){var L=a(g).offset();F.css({top:L.top,left:L.left-110})}F.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Va=function(g,n,s,A){var F=a(g);n=a(n);var J=false,L=A.dropUp;L&&a(g).addClass("dropup");n.find("li").bind("mouseup",function(){if(A.seticon){Ib("#cur_"+
arguments)});a(window).mouseup(function(){if(!J){F.removeClass("down");n.hide();n.css({top:0,left:0})}J=false});n.height();a(g).bind("mousedown",function(){var Z=a(g).offset();if(L){Z.top-=n.height();Z.left+=8}else Z.top+=a(g).height();a(n).offset(Z);if(F.hasClass("down")){F.removeClass("down");n.hide();n.css({top:0,left:0})}else{F.addClass("down");n.show();J=true;return false}}).hover(function(){J=true}).mouseout(function(){J=false});A.multiclick&&n.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g= F[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}s.apply(this,arguments)});a(window).mouseup(function(){if(!J){F.removeClass("down");n.hide();n.css({top:0,left:0})}J=false});n.height();a(g).bind("mousedown",function(){var Z=a(g).offset();if(L){Z.top-=n.height();Z.left+=8}else Z.top+=a(g).height();a(n).offset(Z);if(F.hasClass("down")){F.removeClass("down");n.hide();n.css({top:0,left:0})}else{F.addClass("down");n.show();J=true;return false}}).hover(function(){J=
this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,n=function(){a(g).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;ga="toolbars";H.mousedown(n)}).blur(function(){ga= true}).mouseout(function(){J=false});A.multiclick&&n.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,n=function(){a(g).blur()};
"canvas";H.unbind("mousedown",n);h.getMode()=="textedit"&&a("#text").focus()})})();var Wa=function(){Ua("#tool_select")&&h.setMode("select")},Ba=function(){Ua("#tool_fhpath")&&h.setMode("fhpath")},va=function(){Ua("#tool_line")&&h.setMode("line")},cb=function(){Ua("#tool_rect")&&h.setMode("rect")},Ka=function(){Ua("#tool_ellipse")&&h.setMode("ellipse")},Ta=function(){Ua("#tool_image")&&h.setMode("image")},Ca=function(){Ua("#tool_zoom")&&h.setMode("zoom")},gb=function(){if(Ua("#tool_zoom")){yb();fa()}}, a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;ga="toolbars";H.mousedown(n)}).blur(function(){ga="canvas";H.unbind("mousedown",n);h.getMode()=="textedit"&&a("#text").focus()})})();var Wa=function(){Ua("#tool_select")&&h.setMode("select")},Ba=function(){Ua("#tool_fhpath")&&h.setMode("fhpath")},va=function(){Ua("#tool_line")&&h.setMode("line")},cb=function(){Ua("#tool_rect")&&h.setMode("rect")},Ka=function(){Ua("#tool_ellipse")&&h.setMode("ellipse")},Ta=function(){Ua("#tool_image")&&
pb=function(){Ua("#tool_text")&&h.setMode("text")},Xa=function(){Ua("#tool_path")&&h.setMode("path")},Ya=function(){if(Q!=null||Y)h.deleteSelectedElements()},ub=function(){if(Q!=null||Y){window.event.type==="keydown"&&$a(a("#edit_menu"));h.cutSelectedElements()}},ta=function(){if(Q!=null||Y){window.event.type==="keydown"&&$a(a("#edit_menu"));h.copySelectedElements()}},jb=function(){window.event.type==="keydown"&&$a(a("#edit_menu"));var g=h.getZoom(),n=(H[0].scrollLeft+H.width()/2)/g-h.contentW;g= h.setMode("image")},Ca=function(){Ua("#tool_zoom")&&h.setMode("zoom")},gb=function(){if(Ua("#tool_zoom")){yb();fa()}},pb=function(){Ua("#tool_text")&&h.setMode("text")},Xa=function(){Ua("#tool_path")&&h.setMode("path")},Ya=function(){if(Q!=null||Y)h.deleteSelectedElements()},ub=function(){if(Q!=null||Y){window.event.type==="keydown"&&$a(a("#edit_menu"));h.cutSelectedElements()}},ta=function(){if(Q!=null||Y){window.event.type==="keydown"&&$a(a("#edit_menu"));h.copySelectedElements()}},jb=function(){window.event.type===
(H[0].scrollTop+H.height()/2)/g-h.contentH;h.pasteElements("point",n,g)},fb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveToTopSelectedElement()}},sb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveToBottomSelectedElement()}},kb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected("Up")}},db=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected("Down")}}, "keydown"&&$a(a("#edit_menu"));var g=h.getZoom(),n=(H[0].scrollLeft+H.width()/2)/g-h.contentW;g=(H[0].scrollTop+H.height()/2)/g-h.contentH;h.pasteElements("point",n,g)},fb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveToTopSelectedElement()}},sb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveToBottomSelectedElement()}},kb=function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected("Up")}},db=
mb=function(g){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected(g)}},qb=function(){if(Q!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");q.toEditMode(elems[0]);h.clearSelection();Ia()}},vb=function(){Q!=null&&q.reorient()},wb=function(){if(Q!=null||Y)a.prompt(uiStrings.notification.enterNewLinkURL, function(){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected("Down")}},mb=function(g){if(Q!=null){window.event.type==="keydown"&&$a(a("#object_menu"));h.moveUpDownSelected(g)}},qb=function(){if(Q!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");q.toEditMode(elems[0]);h.clearSelection();Ia()}},
"http://",function(g){g&&h.makeHyperlink(g)})},ia=function(g,n){if(Q!=null||Y){if(curConfig.gridSnapping){var s=h.getZoom()*curConfig.snappingStep;g*=s;n*=s}a("input").blur();h.moveSelectedElements(g,n)}},aa=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);q.linkControlPoints(g)},ka=function(){q.getNodePoint()&&q.clonePathNode()},M= vb=function(){Q!=null&&q.reorient()},wb=function(){if(Q!=null||Y)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ia=function(g,n){if(Q!=null||Y){if(curConfig.gridSnapping){var s=h.getZoom()*curConfig.snappingStep;g*=s;n*=s}a("input").blur();h.moveSelectedElements(g,n)}},aa=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
function(){q.getNodePoint()&&q.deletePathNode()},P=function(){var g=a("#tool_add_subpath"),n=!g.hasClass("push_button_pressed");n?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");q.addSubPath(n)},da=function(){q.opencloseSubPath()},Ea=function(){h.cycleElement(1)},Na=function(){h.cycleElement(0)},Ra=function(g,n){if(!(Q==null||Y)){g||(n*=-1);var s=a("#angle").val()*1+n;h.setRotationAngle(s);Ia()}},bb=function(){var g=curConfig.dimensions; false);q.linkControlPoints(g)},ka=function(){q.getNodePoint()&&q.clonePathNode()},M=function(){q.getNodePoint()&&q.deletePathNode()},P=function(){var g=a("#tool_add_subpath"),n=!g.hasClass("push_button_pressed");n?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");q.addSubPath(n)},da=function(){q.opencloseSubPath()},Ea=function(){h.cycleElement(1)},Na=function(){h.cycleElement(0)},Ra=function(g,n){if(!(Q==null||Y)){g||(n*=-1);
a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){fa();h.clear();h.setResolution(g[0],g[1]);D(true);yb();Ia();V();h.runExtensions("onNewDocument")}})},ob=function(){h.setBold(!h.getBold());Ia()},Sa=function(){h.setItalic(!h.getItalic());Ia()},nb=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;U=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg?h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js", var s=a("#angle").val()*1+n;h.setRotationAngle(s);Ia()}},bb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){fa();h.clear();h.setResolution(g[0],g[1]);D(true);yb();Ia();V();h.runExtensions("onNewDocument")}})},ob=function(){h.setBold(!h.getBold());Ia()},Sa=function(){h.setItalic(!h.getItalic());Ia()},nb=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;U=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg?
function(){h.rasterExport()})})},Pa=function(){h.open()},rb=function(){},$a=function(g){var n=g.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},Eb=function(){if(K.getUndoStackSize()>0){window.event.type==="keydown"&&$a(a("#edit_menu"));K.undo()}},Db=function(){if(K.getRedoStackSize()>0){window.event.type==="keydown"&&$a(a("#edit_menu"));K.redo()}},ab=function(){if(Y)h.groupSelectedElements();else Q&&h.ungroupSelectedElement()},La=function(){window.event.type=== h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){h.rasterExport()})})},Pa=function(){h.open()},rb=function(){},$a=function(g){var n=g.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},Eb=function(){if(K.getUndoStackSize()>0){window.event.type==="keydown"&&$a(a("#edit_menu"));K.undo()}},Db=function(){if(K.getRedoStackSize()>0){window.event.type==="keydown"&&$a(a("#edit_menu"));K.redo()}},ab=function(){if(Y)h.groupSelectedElements();
"keydown"&&$a(a("#edit_menu"));h.cloneSelectedElements(20,20)},Nb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Kb=function(){var g=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),s=n.getAttribute("fill"),A=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;A=Ga(A,g,"stroke");s=Ga(s,n,"fill"); else Q&&h.ungroupSelectedElement()},La=function(){window.event.type==="keydown"&&$a(a("#edit_menu"));h.cloneSelectedElements(20,20)},Nb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Kb=function(){var g=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),s=n.getAttribute("fill"),A=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;n=parseFloat(n.getAttribute("fill-opacity"));
b.paintBox.fill.setPaint(A,true);b.paintBox.stroke.setPaint(s,true)},yb=function(g){var n=h.getResolution();g=g?n.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Jb();D(true)},Lb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");H.toggleClass("wireframe");if(!C){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head");Jb()}},Ob=function(){var g= if(isNaN(n))n=100;A=Ga(A,g,"stroke");s=Ga(s,n,"fill");b.paintBox.fill.setPaint(A,true);b.paintBox.stroke.setPaint(s,true)},yb=function(g){var n=h.getResolution();g=g?n.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Jb();D(true)},Lb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");H.toggleClass("wireframe");if(!C){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head");
!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Ab=function(){window.self!=window.top&&top.exit_fullscreen()},Gb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked", Jb()}},Ob=function(){var g=!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Ab=function(){window.self!=window.top&&top.exit_fullscreen()},Gb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");
true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Jb=function(){if(!C){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(H.hasClass("wireframe")?g:"")}},zb=function(g,n){if(!xa){xa=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var s=pa=h.getSvgString();a("#svg_source_textarea").val(s);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},ib=function(){if(xa){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection(); a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Jb=function(){if(!C){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(H.hasClass("wireframe")?g:"")}},zb=function(g,n){if(!xa){xa=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var s=pa=h.getSvgString();a("#svg_source_textarea").val(s);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},
e();yb();V()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();e();yb();V()});fa()}},Ib=b.setIcon=function(g,n){var s=typeof n==="string"?a.getSvgIcon(n,true):n.clone();s?a(g).find("img").replaceWith(s):console.log("NOTE: Icon image missing: "+n)},Hb;Hb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],s;for(s in n.style)if(g.test(s))return s.match(g)[0];if("WebkitOpacity"in n.style)return"Webkit"; ib=function(){if(xa){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();e();yb();V()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();e();yb();V()});fa()}},Ib=b.setIcon=function(g,n){var s=typeof n==="string"?a.getSvgIcon(n,true):n.clone();s?a(g).find("img").replaceWith(s):console.log("NOTE: Icon image missing: "+n)},Hb;Hb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],
if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Bb=function(g,n){Hb.toLowerCase();var s=["top","left","bottom","right"];g.each(function(){for(var A=a(this),F=A.outerWidth()*(n-1),J=A.outerHeight()*(n-1),L=0;L<4;L++){var Z=s[L],ba=A.data("orig_margin-"+Z);if(ba==null){ba=parseInt(A.css("margin-"+Z));A.data("orig_margin-"+Z,ba)}ba=ba*n;if(Z==="right")ba+=F;else if(Z==="bottom")ba+=J;A.css("margin-"+Z,ba)}})},hb=b.setIconSize=function(g,n){if(!(g==u.size&&!n)){var s=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"), s;for(s in n.style)if(g.test(s))return s.match(g)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Bb=function(g,n){Hb.toLowerCase();var s=["top","left","bottom","right"];g.each(function(){for(var A=a(this),F=A.outerWidth()*(n-1),J=A.outerHeight()*(n-1),L=0;L<4;L++){var Z=s[L],ba=A.data("orig_margin-"+Z);if(ba==null){ba=parseInt(A.css("margin-"+Z));A.data("orig_margin-"+Z,ba)}ba=ba*n;if(Z==="right")ba+=F;else if(Z==="bottom")ba+=J;A.css("margin-"+
A=1;A=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=N=A;ma();var F=s.parents(":hidden");F.css("visibility","hidden").show();Bb(s,A);F.css("visibility","visible").hide();s=a("#tool_size_rules");if(s.length)s.empty();else s=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(L,Z){L="#svg_editor "+L.replace(/,/g,", #svg_editor");J+=L+"{";a.each(Z,function(ba,T){if(typeof T==="number")var X=T*A+"px";else if(T[g]||T.all)X=T[g]|| Z,ba)}})},hb=b.setIconSize=function(g,n){if(!(g==u.size&&!n)){var s=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"),A=1;A=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=N=A;ma();var F=s.parents(":hidden");F.css("visibility","hidden").show();Bb(s,A);F.css("visibility","visible").hide();s=a("#tool_size_rules");if(s.length)s.empty();
T.all;J+=ba+":"+X+";"});J+="}"});F="-"+Hb.toLowerCase()+"-";J+="#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{"+F+"transform: scale("+A+");} #svg_editor div.toolset .toolset {"+F+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+F+"transform: scale("+1/A+");}";s.text(J)}ma()}},Fb=function(){a("#dialog_box").hide();if(xa){if(xa)pa!== else s=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(L,Z){L="#svg_editor "+L.replace(/,/g,", #svg_editor");J+=L+"{";a.each(Z,function(ba,T){if(typeof T==="number")var X=T*A+"px";else if(T[g]||T.all)X=T[g]||T.all;J+=ba+":"+X+";"});J+="}"});F="-"+Hb.toLowerCase()+"-";J+="#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{"+
a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&e()}):e();k()}else ja&&h.leaveContext()},e=function(){a("#svg_source_editor").hide();xa=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var k=a.noop;a(window).resize(function(){D()});(function(){H.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=H[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=H[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)}); F+"transform: scale("+A+");} #svg_editor div.toolset .toolset {"+F+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+F+"transform: scale("+1/A+");}";s.text(J)}ma()}},Fb=function(){a("#dialog_box").hide();if(xa){if(xa)pa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&e()}):e();k()}else ja&&h.leaveContext()},e=function(){a("#svg_source_editor").hide();xa=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
a("#change_image_url").click(function(){var g=h.getHref(Q);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(n){n&&Ja(n)})});var m=function(g){var n=g[0].id=="stroke_color"?"stroke":"fill",s=g[0].id=="canvas_color";if(s)n="canvas";var A=b.paintBox[n].paint;g=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";s=s?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker", var k=a.noop;a(window).resize(function(){D()});(function(){H.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=H[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=H[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(Q);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(n){n&&Ja(n)})});var m=function(g){var n=g[0].id=="stroke_color"?"stroke":
containment:"window"}).removeAttr("style").css(s).jGraduate({paint:A,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(F){A=new a.jGraduate.Paint(F);b.paintBox[n].setPaint(A);h.setPaint(n,A);a("#color_picker").hide()},function(){a("#color_picker").hide()})};l=function(g,n){var s=document.getElementById("canvas_background"),A={color:"fff",opacity:1};if(n=="stroke")A=curConfig.initStroke;if(n=="fill")A=curConfig.initFill;if(n=="canvas"&&s)if(s=s.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))A= "fill",s=g[0].id=="canvas_color";if(s)n="canvas";var A=b.paintBox[n].paint;g=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";s=s?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(s).jGraduate({paint:A,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(F){A=new a.jGraduate.Paint(F);b.paintBox[n].setPaint(A);
{color:("0"+parseInt(s[1],10).toString(16)).slice(-2)+("0"+parseInt(s[2],10).toString(16)).slice(-2)+("0"+parseInt(s[3],10).toString(16)).slice(-2),opacity:1};s=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+A.color+'" opacity="'+A.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;s=a(g)[0].appendChild(document.importNode(s,true));n==="canvas"?s.setAttribute("width",60.5): h.setPaint(n,A);a("#color_picker").hide()},function(){a("#color_picker").hide()})};l=function(g,n){var s=document.getElementById("canvas_background"),A={color:"fff",opacity:1};if(n=="stroke")A=curConfig.initStroke;if(n=="fill")A=curConfig.initFill;if(n=="canvas"&&s)if(s=s.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))A={color:("0"+parseInt(s[1],10).toString(16)).slice(-2)+("0"+parseInt(s[2],10).toString(16)).slice(-2)+("0"+parseInt(s[3],10).toString(16)).slice(-2),opacity:1};s=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
s.setAttribute("width","100%");this.rect=s.firstChild;this.defs=s.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:A.color});this.type=n;this.setPaint=function(F,J){this.paint=F;var L="none",Z=F.type,ba=F.alpha/100;switch(Z){case "solidColor":L=F[Z]=="none"||F[Z]=="one"?"none":"#"+F[Z];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(F[Z]);L="url(#"+(this.grad.id="gradbox_"+ A.color+'" opacity="'+A.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;s=a(g)[0].appendChild(document.importNode(s,true));n==="canvas"?s.setAttribute("width",60.5):s.setAttribute("width","100%");this.rect=s.firstChild;this.defs=s.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:A.color});this.type=n;this.setPaint=function(F,J){this.paint=F;var L="none",Z=F.type,ba=F.alpha/100;switch(Z){case "solidColor":L=
this.type)+")"}this.rect.setAttribute("fill",L);this.rect.setAttribute("opacity",ba);if(J){h.setColor(this.type,L,true);h.setPaintOpacity(this.type,ba,true)}if(this.type=="canvas")if(Z=document.getElementById("canvas_background")){Aa=h.getResolution();Z.setAttribute("x",-1);Z.setAttribute("y",-1);Z.setAttribute("width",Aa.w+2);Z.setAttribute("height",Aa.h+2);Z.setAttribute("fill",L)}else Ha(L)};this.update=function(F){if(Q){var J=this.type;switch(Q.tagName){case "use":case "image":case "foreignObject":return; F[Z]=="none"||F[Z]=="one"?"none":"#"+F[Z];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(F[Z]);L="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",L);this.rect.setAttribute("opacity",ba);if(J){h.setColor(this.type,L,true);h.setPaintOpacity(this.type,ba,true)}if(this.type=="canvas")if(Z=document.getElementById("canvas_background")){Aa=h.getResolution();Z.setAttribute("x",-1);Z.setAttribute("y",-1);Z.setAttribute("width",
case "g":case "a":for(var L=null,Z=Q.getElementsByTagName("*"),ba=0,T=Z.length;ba<T;ba++){var X=Z[ba].getAttribute(J);if(ba===0)L=X;else if(L!==X){L=null;break}}if(L===null){Z=null;return}Z=L;L=1;break;default:L=parseFloat(Q.getAttribute(J+"-opacity"));if(isNaN(L))L=1;Z=J==="fill"?"black":"none";Z=Q.getAttribute(J)||Z}if(F){h.setColor(J,Z,true);h.setPaintOpacity(J,L,true)}L*=100;this.setPaint(Ga(Z,L,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var F= Aa.w+2);Z.setAttribute("height",Aa.h+2);Z.setAttribute("fill",L)}else Ha(L)};this.update=function(F){if(Q){var J=this.type;switch(Q.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var L=null,Z=Q.getElementsByTagName("*"),ba=0,T=Z.length;ba<T;ba++){var X=Z[ba].getAttribute(J);if(ba===0)L=X;else if(L!==X){L=null;break}}if(L===null){Z=null;return}Z=L;L=1;break;default:L=parseFloat(Q.getAttribute(J+"-opacity"));if(isNaN(L))L=1;Z=J==="fill"?"black":"none";Z=Q.getAttribute(J)||
new a.jGraduate.Paint({copy:this.paint});h.setPaint(n,F)}}};b.paintBox.fill=new l("#fill_color","fill");b.paintBox.stroke=new l("#stroke_color","stroke");b.paintBox.canvas=new l("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);l=b.paintBox.fill.rect.cloneNode(false);l.setAttribute("style","vector-effect:non-scaling-stroke");var C=l.style.vectorEffect==="non-scaling-stroke";l.removeAttribute("style");l=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg", Z}if(F){h.setColor(J,Z,true);h.setPaintOpacity(J,L,true)}L*=100;this.setPaint(Ga(Z,L,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var F=new a.jGraduate.Paint({copy:this.paint});h.setPaint(n,F)}}};b.paintBox.fill=new l("#fill_color","fill");b.paintBox.stroke=new l("#stroke_color","stroke");b.paintBox.canvas=new l("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);l=b.paintBox.fill.rect.cloneNode(false);
"feGaussianBlur");typeof l.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(l).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);u.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))m(a("#fill_color"));else{a("#tool_fill").addClass("active"); l.setAttribute("style","vector-effect:non-scaling-stroke");var C=l.style.vectorEffect==="non-scaling-stroke";l.removeAttribute("style");l=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof l.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(l).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);u.img_save=
a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))m(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){m(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");m(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active"); "ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))m(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))m(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
a("#tool_stroke").removeClass("active");m(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});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")}); function(){m(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");m(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");m(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||
a(window).bind("load resize",function(){H.css("line-height",H.height()+"px")});var z=function(){var g=a("#canvas_width"),n=a("#canvas_height"),s=g.val(),A=n.val();if(s!="fit"&&!svgedit.units.isValidUnit("width",s)){a.alert(uiStrings.notification.invalidAttrValGiven);g.parent().addClass("error");return false}g.parent().removeClass("error");if(A!="fit"&&!svgedit.units.isValidUnit("height",A)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error"); a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){H.css("line-height",H.height()+"px")});var z=function(){var g=a("#canvas_width"),n=a("#canvas_height"),s=g.val(),A=n.val();if(s!="fit"&&!svgedit.units.isValidUnit("width",s)){a.alert(uiStrings.notification.invalidAttrValGiven);
if(!h.setResolution(s,A)){a.alert(uiStrings.notification.noContentToFitTo);s=h.getResolution();g.val(s.w);n.val(s.h);return false}D()};a("#resolution").change(function(){var g=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){g.value="fit";n.value="fit";z();var s=h.getResolution();g.value=s.w;n.value=s.h}else{var A=this.value.split("x");A[0]=parseInt(A[0]);A[1]=parseInt(A[1]);var F=A[0]-g.value,J=A[1]-n.value,L=Date.now(),Z=function(ba){ba=(ba-L)/1E3;ba= g.parent().addClass("error");return false}g.parent().removeClass("error");if(A!="fit"&&!svgedit.units.isValidUnit("height",A)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");if(!h.setResolution(s,A)){a.alert(uiStrings.notification.noContentToFitTo);s=h.getResolution();g.val(s.w);n.val(s.h);return false}D()};a("#resolution").change(function(){var g=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
Math.pow(ba-1,3)+1;g.value=(A[0]-F+ba*F).toFixed(0);n.value=(A[1]-J+ba*J).toFixed(0);z();if(ba>=1){ba=h.getResolution();a("#canvas_width").val(ba.w.toFixed());a("#canvas_height").val(ba.h.toFixed());a("#resolution_label").html("<div class='pull'>"+ba.w+"<span>\u00d7</span></br>"+ba.h+"</div>")}else requestAnimationFrame(Z)};Z(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;n.value=100}}});a("#zoom").change(function(){Fa(this)}); "content"){g.value="fit";n.value="fit";z();var s=h.getResolution();g.value=s.w;n.value=s.h}else{var A=this.value.split("x");A[0]=parseInt(A[0]);A[1]=parseInt(A[1]);var F=A[0]-g.value,J=A[1]-n.value,L=Date.now(),Z=function(ba){ba=(ba-L)/1E3;ba=Math.pow(ba-1,3)+1;g.value=(A[0]-F+ba*F).toFixed(0);n.value=(A[1]-J+ba*J).toFixed(0);z();if(ba>=1){ba=h.getResolution();a("#canvas_width").val(ba.w.toFixed());a("#canvas_height").val(ba.h.toFixed());a("#resolution_label").html("<div class='pull'>"+ba.w+"<span>\u00d7</span></br>"+
a("input,select").attr("autocomplete","off");var G=function(){var g=[{sel:"#tool_select",fn:Wa,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ba,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:cb,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ka,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Xa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:pb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Ta,evt:"mouseup"}, ba.h+"</div>")}else requestAnimationFrame(Z)};Z(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;n.value=100}}});a("#zoom").change(function(){Fa(this)});a("input,select").attr("autocomplete","off");var G=function(){var g=[{sel:"#tool_select",fn:Wa,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ba,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:cb,evt:"click",
{sel:"#tool_zoom",fn:Ca,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:bb,evt:"mouseup",key:[B+"N",true]},{sel:"#tool_save",fn:function(){xa?ib():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[B+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},{sel:"#tool_open",fn:Pa,evt:"mouseup"},{sel:"#tool_import",fn:rb,evt:"mouseup"},{sel:"#tool_source",fn:zb,evt:"click",key:[B+"U",true]},{sel:"#tool_wireframe",fn:Lb,evt:"click"},{sel:"#tool_snap",fn:Ob,evt:"click"},{sel:"#tool_rulers", key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ka,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Xa,evt:"click",key:["P",true]},{sel:"#tool_text",fn:pb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Ta,evt:"mouseup"},{sel:"#tool_zoom",fn:Ca,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:bb,evt:"mouseup",key:[B+"N",true]},{sel:"#tool_save",fn:function(){xa?ib():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[B+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},
fn:Gb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Fb,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:ib,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:Ya,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:vb,evt:"click"},{sel:"#tool_node_link",fn:aa,evt:"click"},{sel:"#tool_node_clone",fn:ka,evt:"click"},{sel:"#tool_node_delete",fn:M,evt:"click"},{sel:"#tool_openclose_path",fn:da,evt:"click"}, {sel:"#tool_open",fn:Pa,evt:"mouseup"},{sel:"#tool_import",fn:rb,evt:"mouseup"},{sel:"#tool_source",fn:zb,evt:"click",key:[B+"U",true]},{sel:"#tool_wireframe",fn:Lb,evt:"click"},{sel:"#tool_snap",fn:Ob,evt:"click"},{sel:"#tool_rulers",fn:Gb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Fb,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:ib,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:Ya,evt:"click",key:["del/backspace",
{sel:"#tool_add_subpath",fn:P,evt:"click"},{sel:"#tool_move_top",fn:fb,evt:"click",key:B+"shift+up"},{sel:"#tool_move_bottom",fn:sb,evt:"click",key:B+"shift+down"},{sel:"#tool_move_up",fn:kb,evt:"click",key:[B+"up",true]},{sel:"#tool_move_down",fn:db,evt:"click",key:[B+"down",true]},{sel:"#tool_topath",fn:qb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:wb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:La,evt:"click",key:[B+"D",true]},{sel:"#tool_group",fn:ab,evt:"click",key:[B+ true]},{sel:"#tool_reorient",fn:vb,evt:"click"},{sel:"#tool_node_link",fn:aa,evt:"click"},{sel:"#tool_node_clone",fn:ka,evt:"click"},{sel:"#tool_node_delete",fn:M,evt:"click"},{sel:"#tool_openclose_path",fn:da,evt:"click"},{sel:"#tool_add_subpath",fn:P,evt:"click"},{sel:"#tool_move_top",fn:fb,evt:"click",key:B+"shift+up"},{sel:"#tool_move_bottom",fn:sb,evt:"click",key:B+"shift+down"},{sel:"#tool_move_up",fn:kb,evt:"click",key:[B+"up",true]},{sel:"#tool_move_down",fn:db,evt:"click",key:[B+"down",true]},
"G",true]},{sel:"#tool_ungroup",fn:ab,evt:"click",key:B+"shift+G"},{sel:"#tool_unlink_use",fn:ab,evt:"click"},{sel:"[id^=tool_align]",fn:Nb,evt:"click"},{sel:"#tool_undo",fn:Eb,evt:"click",key:B+"z"},{sel:"#tool_redo",fn:Db,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ub,evt:"click",key:[B+"x",true]},{sel:"#tool_copy",fn:ta,evt:"click",key:B+"c"},{sel:"#tool_paste",fn:jb,evt:"click",key:B+"v"},{sel:"#tool_switch",fn:Kb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:ob,evt:"mousedown",key:[B+ {sel:"#tool_topath",fn:qb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:wb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:La,evt:"click",key:[B+"D",true]},{sel:"#tool_group",fn:ab,evt:"click",key:[B+"G",true]},{sel:"#tool_ungroup",fn:ab,evt:"click",key:B+"shift+G"},{sel:"#tool_unlink_use",fn:ab,evt:"click"},{sel:"[id^=tool_align]",fn:Nb,evt:"click"},{sel:"#tool_undo",fn:Eb,evt:"click",key:B+"z"},{sel:"#tool_redo",fn:Db,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ub,evt:"click",
"B",true]},{sel:"#tool_italic",fn:Sa,evt:"mousedown",key:[B+"I",true]},{sel:"#copy_save_done",fn:Fb,evt:"click"},{key:"ctrl+left",fn:function(){Ra(0,1)}},{key:"ctrl+right",fn:function(){Ra(1,1)}},{key:"ctrl+shift+left",fn:function(){Ra(0,5)}},{key:"ctrl+shift+right",fn:function(){Ra(1,5)}},{key:"shift+O",fn:Na},{key:"shift+P",fn:Ea},{key:[B+"+",true],fn:function(){yb(2)}},{key:[B+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){ia(0,-1)}},{key:["down",true],fn:function(){ia(0,1)}}, key:[B+"x",true]},{sel:"#tool_copy",fn:ta,evt:"click",key:B+"c"},{sel:"#tool_paste",fn:jb,evt:"click",key:B+"v"},{sel:"#tool_switch",fn:Kb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:ob,evt:"mousedown",key:[B+"B",true]},{sel:"#tool_italic",fn:Sa,evt:"mousedown",key:[B+"I",true]},{sel:"#copy_save_done",fn:Fb,evt:"click"},{key:"ctrl+left",fn:function(){Ra(0,1)}},{key:"ctrl+right",fn:function(){Ra(1,1)}},{key:"ctrl+shift+left",fn:function(){Ra(0,5)}},{key:"ctrl+shift+right",fn:function(){Ra(1,5)}},
{key:["left",true],fn:function(){ia(-1,0)}},{key:["right",true],fn:function(){ia(1,0)}},{key:"shift+up",fn:function(){ia(0,-10)}},{key:"shift+down",fn:function(){ia(0,10)}},{key:"shift+left",fn:function(){ia(-10,0)}},{key:"shift+right",fn:function(){ia(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1, {key:"shift+O",fn:Na},{key:"shift+P",fn:Ea},{key:[B+"+",true],fn:function(){yb(2)}},{key:[B+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){ia(0,-1)}},{key:["down",true],fn:function(){ia(0,1)}},{key:["left",true],fn:function(){ia(-1,0)}},{key:["right",true],fn:function(){ia(1,0)}},{key:"shift+up",fn:function(){ia(0,-10)}},{key:"shift+down",fn:function(){ia(0,10)}},{key:"shift+left",fn:function(){ia(-10,0)}},{key:"shift+right",fn:function(){ia(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0,
0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10,0)}},{key:B+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var s=a(".tool_button_current");if(s.length&&s[0].id!=="tool_eyedropper"){s.removeClass("tool_button_current").addClass("tool_button"); -1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10,
a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:B+"shift+z",fn:Db},{key:"esc",fn:Ab}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var s={};a.each(g,function(A,F){if(F.sel){var J=a(F.sel);if(J.length==0)return true;if(F.evt){if(svgedit.browser.isTouch()&&F.evt==="click")F.evt="mousedown";J[F.evt](F.fn)}if(F.parent&&a(F.parent+"_show").length!=0){var L=a(F.parent);L.length||(L=qa(F.parent.substr(1))); 0)}},{key:B+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var s=a(".tool_button_current");if(s.length&&s[0].id!=="tool_eyedropper"){s.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:B+"shift+z",fn:Db},{key:"esc",fn:Ab}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var s={};a.each(g,function(A,F){if(F.sel){var J=
L.append(J);a.isArray(s[F.parent])||(s[F.parent]=[]);s[F.parent].push(F)}}if(F.key){var Z=F.fn,ba=false;if(a.isArray(F.key)){L=F.key[0];if(F.key.length>1)ba=F.key[1]}else L=F.key;L+="";svgedit.browser.isMac&&L.indexOf("+")!=-1&&L.split("+")[0]=="ctrl"&&L.replace("ctrl","cmd");a.each(L.split("/"),function(X,ha){a(document).bind("keydown",ha,function(oa){Z();ba&&oa.preventDefault();return false})});if(F.sel&&!F.hidekey&&J.attr("title")){var T=J.attr("title").split("[")[0]+" ("+L+")";n[L]=F.sel;J.parents("#main_menu").length|| a(F.sel);if(J.length==0)return true;if(F.evt){if(svgedit.browser.isTouch()&&F.evt==="click")F.evt="mousedown";J[F.evt](F.fn)}if(F.parent&&a(F.parent+"_show").length!=0){var L=a(F.parent);L.length||(L=qa(F.parent.substr(1)));L.append(J);a.isArray(s[F.parent])||(s[F.parent]=[]);s[F.parent].push(F)}}if(F.key){var Z=F.fn,ba=false;if(a.isArray(F.key)){L=F.key[0];if(F.key.length>1)ba=F.key[1]}else L=F.key;L+="";svgedit.browser.isMac&&L.indexOf("+")!=-1&&L.split("+")[0]=="ctrl"&&L.replace("ctrl","cmd");
J.attr("title",T)}}});na(s);a(window).bind("keydown","tab",function(A){if(ga==="canvas"){A.preventDefault();Ea()}}).bind("keydown","shift+tab",function(A){if(ga==="canvas"){A.preventDefault();Na()}});a("#tool_zoom").dblclick(gb)},setTitles:function(){a.each(n,function(s,A){var F=a(A).parents("#main_menu").length;a(A).each(function(){var J=F?a(this).text().split(" [")[0]:this.title.split(" [")[0],L="";a.each(s.split("/"),function(Z,ba){var T=ba.split("+"),X="";if(T.length>1){X=T[0]+"+";ba=T[1]}L+= a.each(L.split("/"),function(X,ha){a(document).bind("keydown",ha,function(oa){Z();ba&&oa.preventDefault();return false})});if(F.sel&&!F.hidekey&&J.attr("title")){var T=J.attr("title").split("[")[0]+" ("+L+")";n[L]=F.sel;J.parents("#main_menu").length||J.attr("title",T)}}});na(s);a(window).bind("keydown","tab",function(A){if(ga==="canvas"){A.preventDefault();Ea()}}).bind("keydown","shift+tab",function(A){if(ga==="canvas"){A.preventDefault();Na()}});a("#tool_zoom").dblclick(gb)},setTitles:function(){a.each(n,
(Z?"/":"")+X+(uiStrings["key_"+ba]||ba)});if(F)this.lastChild.textContent=J+" ["+L+"]";else this.title=J+" ["+L+"]"})})},getButtonData:function(s){var A;a.each(g,function(F,J){if(J.sel===s)A=J});return A}}}();G.setAll();b.ready(function(){var g=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"),s=n.find("#tool_"+g);g=n.find("#"+g);(s.length?s:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)}); function(s,A){var F=a(A).parents("#main_menu").length;a(A).each(function(){var J=F?a(this).text().split(" [")[0]:this.title.split(" [")[0],L="";a.each(s.split("/"),function(Z,ba){var T=ba.split("+"),X="";if(T.length>1){X=T[0]+"+";ba=T[1]}L+=(Z?"/":"")+X+(uiStrings["key_"+ba]||ba)});if(F)this.lastChild.textContent=J+" ["+L+"]";else this.title=J+" ["+L+"]"})})},getButtonData:function(s){var A;a.each(g,function(F,J){if(J.sel===s)A=J});return A}}}();G.setAll();b.ready(function(){var g=curConfig.initTool,
a("#canvas_height").dragInput({min:10,max:null,step:10,callback:z,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:z,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null, n=a("#tools_left, #svg_editor .tools_flyout"),s=n.find("#tool_"+g);g=n.find("#"+g);(s.length?s:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:z,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:z,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,
step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1, max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute, a("#image_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,
cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null, callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null, a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,
max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var n=g.value;if(n==0&& cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,
Q&&["line","polyline"].indexOf(Q.nodeName)>=0)n=g.value=1;h.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled",g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,n){var s=g.value-0,A=s+n,F=A>=s;if(n===0)return s;return s>= callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var n=g.value;if(n==0&&Q&&["line","polyline"].indexOf(Q.nodeName)>=0)n=g.value=1;h.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);
24?F?Math.round(s*1.1):Math.round(s/1.1):s<=1?F?s*2:s/2:A},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(g){val=g.value;a("#blur").val(val);h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":Ya();break;case "cut":ub();break;case "copy":ta();break; rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled",g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,n){var s=g.value-0,A=s+n,F=A>=s;if(n===0)return s;return s>=24?F?Math.round(s*1.1):Math.round(s/1.1):s<=1?F?s*2:s/2:A},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,
case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":fb();break;case "move_up":mb("Up");break;case "move_down":mb("Down");break;case "move_back":sb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu(); step:0.1,callback:function(g){val=g.value;a("#blur").val(val);h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":Ya();break;case "cut":ub();break;case "copy":ta();break;case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":fb();break;
S.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(K.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(g){a("#main_menu").hide();K.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){l=a('<input type="file">').change(function(){var g=this;b.openPrep(function(n){if(n){h.clear();if(g.files.length==1){n=new FileReader; case "move_up":mb("Up");break;case "move_down":mb("Down");break;case "move_back":sb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu();S.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(K.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};
n.onloadend=function(s){p(s.target.result);D()};n.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(l);l=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;g.onloadend=function(n){h.importSvgString(n.target.result,true);D()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(l)}var D=b.updateCanvas=function(g,n){var s=H.width(),A=H.height(),F=s,J=A,L=h.getZoom(),Z=a("#svgcanvas"),ba={x:H[0].scrollLeft+F/2,y:H[0].scrollTop+ b.openPrep=function(g){a("#main_menu").hide();K.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){l=a('<input type="file">').change(function(){var g=this;b.openPrep(function(n){if(n){h.clear();if(g.files.length==1){n=new FileReader;n.onloadend=function(s){p(s.target.result);D()};n.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(l);l=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;
J/2},T=curConfig.canvas_expansion;s=Math.max(F,h.contentW*L*T);A=Math.max(J,h.contentH*L*T);s==F&&A==J?H.css("overflow","hidden"):H.css("overflow","scroll");T=Z.height()/2;var X=Z.width()/2;Z.width(s).height(A);var ha=A/2,oa=s/2,ea=h.updateCanvas(s,A),ua=oa/X;s=s/2-F/2;A=A/2-J/2;if(n){n.x+=ea.x;n.y+=ea.y}else n={x:oa+(ba.x-X)*ua,y:ha+(ba.y-T)*ua};if(g)if(h.contentW>H.width()){H[0].scrollLeft=ea.x-10;H[0].scrollTop=ea.y-10}else{H[0].scrollLeft=s;H[0].scrollTop=A}else{H[0].scrollLeft=n.x-F/2;H[0].scrollTop= g.onloadend=function(n){h.importSvgString(n.target.result,true);D()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(l)}var D=b.updateCanvas=function(g,n){var s=H.width(),A=H.height(),F=s,J=A,L=h.getZoom(),Z=a("#svgcanvas"),ba={x:H[0].scrollLeft+F/2,y:H[0].scrollTop+J/2},T=curConfig.canvas_expansion;s=Math.max(F,h.contentW*L*T);A=Math.max(J,h.contentH*L*T);s==F&&A==J?H.css("overflow","hidden"):H.css("overflow","scroll");T=Z.height()/2;var X=Z.width()/2;Z.width(s).height(A);var ha=
n.y-J/2}if(curConfig.showRulers){F=Z;L=L;document.getElementById("workarea");document.getElementById("title_show");L||(L=h.getZoom());F||(F=a("#svgcanvas"));J=h.getContentElem();Z=svgedit.units.getTypeMap()[curConfig.baseUnit];for(ba=0;ba<2;ba++){ha=(T=ba===0)?"x":"y";s=T?"width":"height";X=J.getAttribute(ha)-0;ha=a("#ruler_"+ha+" canvas:first");$hcanv=ha.clone();ha.replaceWith($hcanv);A=$hcanv[0];oa=ha=F[s]()*2;A.parentNode.style[s]=oa+"px";ea=0;var Ma;ua=A.getContext("2d");ua.fillStyle="rgb(200,0,0)"; A/2,oa=s/2,ea=h.updateCanvas(s,A),ua=oa/X;s=s/2-F/2;A=A/2-J/2;if(n){n.x+=ea.x;n.y+=ea.y}else n={x:oa+(ba.x-X)*ua,y:ha+(ba.y-T)*ua};if(g)if(h.contentW>H.width()){H[0].scrollLeft=ea.x-10;H[0].scrollTop=ea.y-10}else{H[0].scrollLeft=s;H[0].scrollTop=A}else{H[0].scrollLeft=n.x-F/2;H[0].scrollTop=n.y-J/2}if(curConfig.showRulers){F=Z;L=L;document.getElementById("workarea");document.getElementById("title_show");L||(L=h.getZoom());F||(F=a("#svgcanvas"));J=h.getContentElem();Z=svgedit.units.getTypeMap()[curConfig.baseUnit];
ua.fillRect(0,0,A.width,A.height);$hcanv.siblings().remove();if(ha>=3E4){var sa=parseInt(ha/3E4)+1;Ma=Array(sa);Ma[0]=ua;for(var ra=1;ra<sa;ra++){A[s]=3E4;var Za=A.cloneNode(true);A.parentNode.appendChild(Za);Ma[ra]=Za.getContext("2d")}Za[s]=ha%3E4;ha=3E4}A[s]=ha;s=Z*L;var Qa=50/s;A=1;for(ra=0;ra<w.length;ra++){A=sa=w[ra];if(Qa<=sa)break}Qa=A*s;ua.font="normal 9px 'Lucida Grande', sans-serif";ua.fillStyle="#777";for(var Oa=X/s%A*s,lb=Oa-Qa;Oa<oa;Oa+=Qa){lb+=Qa;ra=Math.round(Oa)+0.5;if(T){ua.moveTo(ra, for(ba=0;ba<2;ba++){ha=(T=ba===0)?"x":"y";s=T?"width":"height";X=J.getAttribute(ha)-0;ha=a("#ruler_"+ha+" canvas:first");$hcanv=ha.clone();ha.replaceWith($hcanv);A=$hcanv[0];oa=ha=F[s]()*2;A.parentNode.style[s]=oa+"px";ea=0;var Ma;ua=A.getContext("2d");ua.fillStyle="rgb(200,0,0)";ua.fillRect(0,0,A.width,A.height);$hcanv.siblings().remove();if(ha>=3E4){var sa=parseInt(ha/3E4)+1;Ma=Array(sa);Ma[0]=ua;for(var ra=1;ra<sa;ra++){A[s]=3E4;var Za=A.cloneNode(true);A.parentNode.appendChild(Za);Ma[ra]=Za.getContext("2d")}Za[s]=
15);ua.lineTo(ra,0)}else{ua.moveTo(15,ra);ua.lineTo(0,ra)}sa=(lb-X)/s;if(A>=1)ra=Math.round(sa);else{ra=(A+"").split(".")[1].length;ra=sa.toFixed(ra)-0}if(ra!==0&&ra!==1E3&&ra%1E3===0)ra=ra/1E3+"K";if(T){ua.fillText(ra,Oa+2,8);ua.fillStyle="#777"}else{sa=(ra+"").split("");for(ra=0;ra<sa.length;ra++){ua.fillText(sa[ra],1,Oa+9+ra*9);ua.fillStyle="#777"}}sa=Qa/10;for(ra=1;ra<10;ra++){var xb=Math.round(Oa+sa*ra)+0.5;if(Ma&&xb>ha){ea++;ua.stroke();if(ea>=Ma.length){ra=10;Oa=oa;continue}ua=Ma[ea];Oa-=3E4; ha%3E4;ha=3E4}A[s]=ha;s=Z*L;var Qa=50/s;A=1;for(ra=0;ra<w.length;ra++){A=sa=w[ra];if(Qa<=sa)break}Qa=A*s;ua.font="normal 9px 'Lucida Grande', sans-serif";ua.fillStyle="#777";for(var Oa=X/s%A*s,lb=Oa-Qa;Oa<oa;Oa+=Qa){lb+=Qa;ra=Math.round(Oa)+0.5;if(T){ua.moveTo(ra,15);ua.lineTo(ra,0)}else{ua.moveTo(15,ra);ua.lineTo(0,ra)}sa=(lb-X)/s;if(A>=1)ra=Math.round(sa);else{ra=(A+"").split(".")[1].length;ra=sa.toFixed(ra)-0}if(ra!==0&&ra!==1E3&&ra%1E3===0)ra=ra/1E3+"K";if(T){ua.fillText(ra,Oa+2,8);ua.fillStyle=
xb=Math.round(Oa+sa*ra)+0.5}var Cb=ra%2?12:10;if(T){ua.moveTo(xb,15);ua.lineTo(xb,Cb)}else{ua.moveTo(15,xb);ua.lineTo(Cb,xb)}}}ua.strokeStyle="#666";ua.stroke()}H.scroll()}},w=[];for(l=0.1;l<1E5;l*=10){w.push(1*l);w.push(2*l);w.push(5*l)}D(true);try{var E=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var n=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+"";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, "#777"}else{sa=(ra+"").split("");for(ra=0;ra<sa.length;ra++){ua.fillText(sa[ra],1,Oa+9+ra*9);ua.fillStyle="#777"}}sa=Qa/10;for(ra=1;ra<10;ra++){var xb=Math.round(Oa+sa*ra)+0.5;if(Ma&&xb>ha){ea++;ua.stroke();if(ea>=Ma.length){ra=10;Oa=oa;continue}ua=Ma[ea];Oa-=3E4;xb=Math.round(Oa+sa*ra)+0.5}var Cb=ra%2?12:10;if(T){ua.moveTo(xb,15);ua.lineTo(xb,Cb)}else{ua.moveTo(15,xb);ua.lineTo(Cb,xb)}}}ua.strokeStyle="#666";ua.stroke()}H.scroll()}},w=[];for(l=0.1;l<1E5;l*=10){w.push(1*l);w.push(2*l);w.push(5*l)}D(true);
function(F){return"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var s=0;s<g.length;s++)g[s]=n(g[s]);return"["+g.join(",")+"]"}else{s=[];for(var A in g)s.push(n(A)+":"+n(g[A]));return"{"+s.join(",")+"}"}};window.addEventListener("message",function(g){var n=parseInt(g.data.substr(0,g.data.indexOf(";")));try{g.source.postMessage("SVGe"+n+";"+E(eval(g.data)),"*")}catch(s){g.source.postMessage("SVGe"+n+";error:"+s.message,"*")}},false)}catch(I){window.embed_error=I}a(function(){window.svgCanvas= try{var E=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var n=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+"";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(F){return"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var s=0;s<g.length;s++)g[s]=n(g[s]);return"["+g.join(",")+"]"}else{s=[];for(var A in g)s.push(n(A)+
h;h.ready=svgEditor.ready});b.setLang=function(g,n){a.pref("lang",g);a("#lang_select").val(g);if(n){h.runExtensions("langChanged",g);la();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(s,A){a(A).attr("title",a(s)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}}; ":"+n(g[A]));return"{"+s.join(",")+"}"}};window.addEventListener("message",function(g){var n=parseInt(g.data.substr(0,g.data.indexOf(";")));try{g.source.postMessage("SVGe"+n+";"+E(eval(g.data)),"*")}catch(s){g.source.postMessage("SVGe"+n+";error:"+s.message,"*")}},false)}catch(I){window.embed_error=I}a(function(){window.svgCanvas=h;h.ready=svgEditor.ready});b.setLang=function(g,n){a.pref("lang",g);a("#lang_select").val(g);if(n){h.runExtensions("langChanged",g);la();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block",
var f=[];b.ready=function(d){o?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});o=true};b.loadFromString=function(d){b.ready(function(){p(d)})};b.loadFromURL=function(d,l){l||(l={});var v=l.cache,B=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!v,success:function(q){p(q,B)},error:function(q,K,R){q.status!=404&&q.responseText?p(q.responseText,B):a.alert(uiStrings.notification.URLloadFail+": \n"+R+"",B)}})})};b.loadFromDataURI=function(d){b.ready(function(){var l= "#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(s,A){a(A).attr("title",a(s)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(d){o?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});o=true};b.loadFromString=function(d){b.ready(function(){p(d)})};b.loadFromURL=function(d,l){l||(l={});var v=
d.substring(26);p(svgedit.utilities.decode64(l))})};b.addExtension=function(){var d=arguments;a(function(){h&&h.addExtension.apply(this,d)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep= l.cache,B=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!v,success:function(q){p(q,B)},error:function(q,K,R){q.status!=404&&q.responseText?p(q.responseText,B):a.alert(uiStrings.notification.URLloadFail+": \n"+R+"",B)}})})};b.loadFromDataURI=function(d){b.ready(function(){var l=d.substring(26);p(svgedit.utilities.decode64(l))})};b.addExtension=function(){var d=arguments;a(function(){h&&h.addExtension.apply(this,d)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var p=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),o=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/o*f,v=0,B=this.getAttribute("data-attr"),q=svgEditor.canvas,K=q.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,H=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");H&&!isNaN(this.dragCfg.start)&&H.css("top",this.dragCfg.start* a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var p=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),o=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/o*f,v=0,B=this.getAttribute("data-attr"),q=svgEditor.canvas,K=q.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,H=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");H&&!isNaN(this.dragCfg.start)&&H.css("top",this.dragCfg.start*
-1/l+o);this.adjustValue=function(S,U){var N;S=parseFloat(S);if(isNaN(this.value))N=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){N=this.dragCfg.stepfunc(this,S);console.log(N)}else N=Number((Number(this.value)+Number(S)).toFixed(5));if(c!==null)N=Math.min(N,c);if(u!==null)N=Math.max(N,u);H&&this.updateCursor(N);this.value=N;h.attr("data-value",N);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,U)};h.toggleClass("draginput",h.is("label"));this.move=function(S,U,N){if(R)S= -1/l+o);this.adjustValue=function(S,U){var N;S=parseFloat(S);if(isNaN(this.value))N=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){N=this.dragCfg.stepfunc(this,S);console.log(N)}else N=Number((Number(this.value)+Number(S)).toFixed(5));if(c!==null)N=Math.min(N,c);if(u!==null)N=Math.max(N,u);H&&this.updateCursor(N);this.value=N;h.attr("data-value",N);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,U)};h.toggleClass("draginput",h.is("label"));this.move=function(S,U,N){if(R)S=
S.originalEvent.touches[0];if(v===0)v=U;U=(S.pageY-v)*-1;v=S.pageY;N=U*l*p;this.adjustValue(N.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");v=0;if(K[0]){var S=q.undoMgr.finishUndoableChange();S.isEmpty()||q.undoMgr.addCommandToHistory(S)}this.adjustValue(0,O)};this.updateCursor=function(){var S=parseFloat(this.value)*-1/l+o;H.css("top",S)};this.start= S.originalEvent.touches[0];if(v===0)v=U;U=(S.pageY-v)*-1;v=S.pageY;N=U*l*p;this.adjustValue(N.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");v=0;if(K[0]){var S=q.undoMgr.finishUndoableChange();S.isEmpty()||q.undoMgr.addCommandToHistory(S)}this.adjustValue(0,O)};this.updateCursor=function(){var S=parseFloat(this.value)*-1/l+o;H.css("top",S)};this.start=