vare={name:"markers",init:functioninit(e){vart=this;return_asyncToGenerator(regeneratorRuntime.mark((function_callee3(){varr,n,a,i,o,s,l,u,c,m,d,h,f,p,_,k,v,g,b,y,x,w,A,L,C,S;returnregeneratorRuntime.wrap((function_callee3$(G){for(;;)switch(G.prev=G.next){case0:returnC=function_buildButtonList(){vare=[];returna.each(s,(function(t,r){varn=r+"_marker_list",a=!0;Object.keys(c).forEach((function(t){vari=L(String(t));e.push({id:u+r+"_"+t,svgicon:t,icon:"markers-"+t+".png",title:i,type:"context",events:{click:w},panel:"marker_panel",list:n,isDefault:a}),a=!1}))})),e},L=function_getTitle(e){vart=r.langList.find((function(t){returnt.id===e}));returnt?t.title:e},A=function_setArrowFromButton3(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function_callee2(e){vart,r,n;returnregeneratorRuntime.wrap((function_callee2$(e){for(;;)switch(e.prev=e.next){case0:if(t=this.id.split("_"),r=t[1],n=t[2],t[3]&&(n+="_"+t[3]),"textmarker"===n){e.next=8;break}b(r,"\\"+n),e.next=10;break;case8:returne.next=10,y(r);case10:case"end":returne.stop()}}),_callee2,this)})))).apply(this,arguments)},w=function_setArrowFromButton2(e){returnA.apply(this,arguments)},x=function_showTextPrompt3(){return(x=_asyncToGenerator(regeneratorRuntime.mark((function_callee(e){vart,r;returnregeneratorRuntime.wrap((function_callee$(n){for(;;)switch(n.prev=n.next){case0:return"\\"===(t=a("#"+e+"_marker").val()).substr(0,1)&&(t=""),n.next=4,a.prompt("Enter text for "+e+" marker",t);case4:(r=n.sent)&&b(e,r);case6:case"end":returnn.stop()}}),_callee)})))).apply(this,arguments)},y=function_showTextPrompt2(e){returnx.apply(this,arguments)},b=function_triggerTextEntry(e,t){a("#"+e+"_marker").val(t),a("#"+e+"_marker").change()},g=function_updateReferences(e){a.each(s,(function(t,r){varn=l+r+"_"+e.id,o="marker-"+r,s=m(e,o);if(s&&s.attributes.se_type){varu=e.getAttribute(o);if(u){varc=e.id.length,d=u.substr(-c-1,c);if(e.id!==d){varf=a("#"+r+"_marker").attr("value");p(n,f),i.changeSelectedAttribute(o,"url(#"+n+")"),"line"===e.tagName&&"mid"===r&&(e=_(e)),i.call("changed",h)}}}}))},v=function_colorChanged(e){vart=e.getAttribute("stroke");a.each(s,(function(r,n){vara=m(e,"marker-"+n);if(a&&a.attributes.se_type){vari=a.lastElementChild;if(i){varo=i.getAttribute("fill"),s=i.getAttribute("stroke");o&&"none"!==o&&i.setAttribute("fill",t),s&&"none"!==s&&i.setAttribute("stroke",t)}}}))},k=function_setMarker(){vare={start_marker:"start",mid_marker:"mid",end_marker:"end"}[this.id],t="marker-"+e,r=h[0],n=m(r,t);n&&a(n).remove(),r.removeAttribute(t);varo=this.value;if(""===o&&(o="\\nomarker"),"\\nomarker"===o)returnd(e,o),voidi.call("changed",h);vars=l+e+"_"+r.id;p(s,o),i.changeSelectedAttribute(t,"url(#"+s+")"),"line"===r.tagName&&"mid"===e&&_(r),i.call("changed",h),d(e,o)},_=function_convertline(t){if("line"!==t.tagName)returnt;varr=Number(t.getAttribute("x1")),n=Number(t.getAttribute("x2")),l=Number(t.getAttribute("y1")),u=Number(t.getAttribute("y2")),c=t.id,m=o({element:"polyline",attr:{points:r+","+l+(" "+(r+n)/2+","+(l+u)/2+" ")+n+","+u,stroke:t.getAttribute("stroke"),"stroke-width":t.getAttribute("stroke-width"),fill:"none",opacity:t.getAttribute("opacity")||1}});a.each(s,(function(e,r){varn="marker-"+r;t.getAttribute(n)&&m.setAttribute(n,t.getAttribute(n))}));vard=newe.BatchCommand;returnd.addSubCommand(newe.RemoveElementCommand(t,t.parentNode)),d.addSubCommand(newe.InsertElementCommand(m)),a(t).after(m).remove(),i.clearSelection(),m.id=c,i.addToSelection([m]),e.addCommandToHistory(d),m},p=function_addMarker(e,t){varr=i.getElem(e);if(!r&&""!==t&&"\\nomarker"!==t){varn,a=h[0].getAttribute("stroke"),s=50,l=50,u="0 0 100 100",m=5,d=5;if(n="\\"===t.substr(0,1)?t.substr(1):"textmarker",c[n]){if(r=o({element:"marker",attr:{id:e,markerUnits:"strokeWidth",orient:"auto",style:"pointer-events:none",se_type:n}}),"textmarker"!==n){varf=o(c[n]),p="_o"===n.substr(-2)?"none":a;f.setAttribute("fill",p),f.setAttribute("stroke",a),f.setAttribute("stroke-width",10),r.append(f)}else{var_=o(c[n]);_.textContent=t;vark=_.getBBox()