System.register([],(function(e,t){"use strict";return{execute:function(){function asyncGeneratorStep(e,t,n,r,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function _next(e){asyncGeneratorStep(i,r,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,r,o,_next,_throw,"throw",e)}_next(void 0)}))}}
/**
* @file ext-foreignobject.js
*
* @license Apache-2.0
*
* @copyright 2010 Jacques Distler, 2010 Alexis Deveria
*
*/e("default",{name:"foreignobject",init:function init(e){var n=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee2(){var r,o,i,a,c,s,l,u,g,f,_,d,h,v,p,m,b,x,y,S;return regeneratorRuntime.wrap((function _callee2$(w){for(;;)switch(w.prev=w.next){case 0:return x=function _setAttr(e,t){c.changeSelectedAttribute(e,t),c.call("changed",d)},b=function _showForeignEditor(){var e=d[0];if(e&&!p){p=!0,_(!0),e.removeAttribute("fill");var t=c.svgToString(e,0);o("#svg_source_textarea").val(t),o("#svg_source_editor").fadeIn(),g(),o("#svg_source_textarea").focus()}},m=function _setForeignString(e){var t=d[0];try{var n=i('");c.sanitizeSvg(n.documentElement),t.replaceWith(s.importNode(n.documentElement.firstChild,!0)),c.call("changed",[t]),c.clearSelection()}catch(e){return console.log(e),!1}return!0},_=function _toggleSourceButtons(e){o("#tool_source_save, #tool_source_cancel").toggle(!e),o("#foreign_save, #foreign_cancel").toggle(e)},f=function _showPanel(e){var t=o("#fc_rules");t.length||(t=o('').appendTo("head")),t.text(e?" #tool_topath { display: none !important; }":""),o("#foreignObject_panel").toggle(e)},r=n,o=e.$,i=e.text2xml,a=e.NS,c=r.canvas,s=e.svgroot.parentNode.ownerDocument,w.next=11,t.import("./locale/".concat(r.curPrefs.lang,".js"));case 11:return l=w.sent,u=l.default,g=function properlySourceSizeTextArea(){var e=o("#svg_source_container").height()-80;o("#svg_source_textarea").css("height",e)},p=!1,y=[{id:"tool_foreign",icon:"foreignobject-tool.png",type:"mode",events:{click:function click(){c.setMode("foreign")}}},{id:"edit_foreign",icon:"foreignobject-edit.png",type:"context",panel:"foreignObject_panel",events:{click:function click(){b()}}}],S=[{type:"input",panel:"foreignObject_panel",id:"foreign_width",size:3,events:{change:function change(){x("width",this.value)}}},{type:"input",panel:"foreignObject_panel",id:"foreign_height",events:{change:function change(){x("height",this.value)}}},{type:"input",panel:"foreignObject_panel",id:"foreign_font_size",size:2,defval:16,events:{change:function change(){x("font-size",this.value)}}}],w.abrupt("return",{name:u.name,svgicons:"foreignobject-icons.xml",buttons:u.buttons.map((function(e,t){return Object.assign(y[t],e)})),context_tools:u.contextTools.map((function(e,t){return Object.assign(S[t],e)})),callback:function callback(){o("#foreignObject_panel").hide();var e=function endChanges(){o("#svg_source_editor").hide(),p=!1,o("#svg_source_textarea").blur(),_(!1)};setTimeout((function(){o("#tool_source_save").clone().hide().attr("id","foreign_save").unbind().appendTo("#tool_source_back").click(_asyncToGenerator(regeneratorRuntime.mark((function _callee(){return regeneratorRuntime.wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:if(p){t.next=2;break}return t.abrupt("return");case 2:if(m(o("#svg_source_textarea").val())){t.next=11;break}return t.next=5,o.confirm("Errors found. Revert to original?");case 5:if(t.sent){t.next=8;break}return t.abrupt("return");case 8:e(),t.next=12;break;case 11:e();case 12:case"end":return t.stop()}}),_callee)})))),o("#tool_source_cancel").clone().hide().attr("id","foreign_cancel").unbind().appendTo("#tool_source_back").click((function(){e()}))}),3e3)},mouseDown:function mouseDown(e){if("foreign"===c.getMode()){h=!0,v=c.addSVGElementFromJson({element:"foreignObject",attr:{x:e.start_x,y:e.start_y,id:c.getNextId(),"font-size":16,width:"48",height:"20",style:"pointer-events:inherit"}});var t=s.createElementNS(a.MATH,"math");t.setAttributeNS(a.XMLNS,"xmlns",a.MATH),t.setAttribute("display","inline");var n=s.createElementNS(a.MATH,"mi");n.setAttribute("mathvariant","normal"),n.textContent="Φ";var r=s.createElementNS(a.MATH,"mo");r.textContent="∪";var o=s.createElementNS(a.MATH,"mi");return o.textContent="ℳ",t.append(n,r,o),v.append(t),{started:!0}}},mouseUp:function mouseUp(e){if("foreign"===c.getMode()&&h){var t=o(v).attr(["width","height"]),n="0"!==t.width||"0"!==t.height;return c.addToSelection([v],!0),{keep:n,element:v}}},selectedChanged:function selectedChanged(e){for(var t=(d=e.elems).length;t--;){var n=d[t];n&&"foreignObject"===n.tagName&&e.selectedElement&&!e.multiselected?(o("#foreign_font_size").val(n.getAttribute("font-size")),o("#foreign_width").val(n.getAttribute("width")),o("#foreign_height").val(n.getAttribute("height")),f(!0)):f(!1)}},elementChanged:function elementChanged(e){}});case 18:case"end":return w.stop()}}),_callee2)})))()}})}}}));