conste={HTML:"http://www.w3.org/1999/xhtml",MATH:"http://www.w3.org/1998/Math/MathML",SE:"http://svg-edit.googlecode.com",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"},n=function(){constt={};returnObject.entries(e).forEach(([e,n])=>{t[n]=e.toLowerCase()}),t},r=jQuery,{userAgent:s}=(Boolean(document.createElementNS&&document.createElementNS(e.SVG,"svg").createSVGRect),navigator),i=document.createElementNS(e.SVG,"svg"),o=Boolean(window.opera),a=s.includes("AppleWebKit"),c=s.includes("Gecko/"),l=s.includes("MSIE"),h=s.includes("Chrome/"),u=(s.includes("Windows"),s.includes("Macintosh"),"ontouchstart"inwindow),d=Boolean(i.querySelector),m=Boolean(document.evaluate),g=function(){constt=document.createElementNS(e.SVG,"path");t.setAttribute("d","M0,0 10,10");constn=t.pathSegList,r=t.createSVGPathSegLinetoAbs(5,5);try{returnn.replaceItem(r,1),!0}catch(t){}return!1}(),p=function(){constt=document.createElementNS(e.SVG,"path");t.setAttribute("d","M0,0 10,10");constn=t.pathSegList,r=t.createSVGPathSegLinetoAbs(5,5);try{returnn.insertItemBefore(r,1),!0}catch(t){}return!1}(),f=function(){constt=document.createElementNS(e.SVG,"svg"),n=document.createElementNS(e.SVG,"svg");document.documentElement.append(t),n.setAttribute("x",5),t.append(n);constr=document.createElementNS(e.SVG,"text");r.textContent="a",n.append(r);try{return0===r.getStartPositionOfChar(0).x}catch(t){return!1}finally{t.remove()}}(),y=function(){constt=document.createElementNS(e.SVG,"svg");document.documentElement.append(t);constn=document.createElementNS(e.SVG,"path");n.setAttribute("d","M0,0 C0,0 10,10 10,0"),t.append(n);constr=n.getBBox();returnt.remove(),r.height>4&&r.height<5}(),x=function(){constt=document.createElementNS(e.SVG,"svg");document.documentElement.append(t);constn=document.createElementNS(e.SVG,"path");n.setAttribute("d","M0,0 10,0");constr=document.createElementNS(e.SVG,"path");r.setAttribute("d","M5,0 15,0");consts=document.createElementNS(e.SVG,"g");s.append(n,r),t.append(s);consti=s.getBBox();returnt.remove(),15===i.width}(),S=(function(){constt=document.createElementNS(e.SVG,"rect");t.setAttribute("x",.1);constn=!t.cloneNode(!1).getAttribute("x").includes(",");n||r.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the <a href="http://opera.com">latest version</a> in which the problems have been fixed.')}(),function(){constt=document.createElementNS(e.SVG,"rect");returnt.setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===t.style.vectorEffect}());let_=function(){constt=document.createElementNS(e.SVG,"rect").transform.baseVal,n=i.createSVGTransform();t.appendItem(n);constr=t.getItem(0),s=t=>t&&"object"==typeoft&&"function"==typeoft.setMatrix&&"angle"int;returns(r)&&s(n)&&r.type===n.type&&r.angle===n.angle&&r.matrix.a===n.matrix.a&&r.matrix.b===n.matrix.b&&r.matrix.c===n.matrix.c&&r.matrix.d===n.matrix.d&&r.matrix.e===n.matrix.e&&r.matrix.f===n.matrix.f}();constb=()=>a,w=()=>c,A=()=>l,C=()=>h,v=()=>S,E=document.createElementNS(e.SVG,"svg");functionG(t){conste=t.matrix;letn="";switch(t.type){case1:n="matrix("+[e.a,e.b,e.c,e.d,e.e,e.f].join(",")+")";break;case2:n="translate("+e.e+","+e.f+")";break;case3:n=e.a===e.d?"scale("+e.a+")":"scale("+e.a+","+e.d+")";break;case4:{letr=0,s=0;if(0!==t.angle){constt=1-e.a;s=(t*e.f+e.b*e.e)/(t*t+e.b*e.b),r=(e.e-e.b*s)/t}n="rotate("+t.angle+" "+r+","+s+")";break}}returnn}letN={};classk{constructor(t){this._elem=t||null,this._xforms=[],this._update=function(){lett="";for(lete=0;e<this.numberOfItems;++e){t+=G(this._list.getItem(e))+" "}this._elem.setAttribute("transform",t)},this._list=this,this._init=function(){lett=this._elem.getAttribute("transform");if(!t)return;conste=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/;letn=!0;for(;n;)if(n=t.match(e),t=t.replace(e,""),n&&n[1]){constt=n[1].split(/\s*\(/),e=t[0],r=t[1].match(/\s*(.*?)\s*\)/);r[1]=r[1].replace(/(\d)-/g,"$1 -");consts=r[
*/let q=null,Q=null,W=null,X=null;const K=t=>t.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?]>)/,"$1$2"),Z=function(t){returnt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")};functionY(t){if(t=tt(t),window.btoa)returnwindow.btoa(t);conste=newArray(4*Math.floor((t.length+2)/3));letn=0,r=0;do{consts=t.charCodeAt(n++),i=t.charCodeAt(n++),o=t.charCodeAt(n++),a=s>>2,c=(3&s)<<4|i>>4;letl=(15&i)<<2|o>>6,h=63&o;Number.isNaN(i)?(l=64,h=64):Number.isNaN(o)&&(h=64),e[r++]=D.charAt(a),e[r++]=D.charAt(c),e[r++]=D.charAt(l),e[r++]=D.charAt(h)}while(n<t.length);returne.join("")}function$(t){if(window.atob)returnJ(window.atob(t));t=t.replace(/[^A-Za-z\d+/=]/g,"");lete="",n=0;do{constr=D.indexOf(t.charAt(n++)),s=D.indexOf(t.charAt(n++)),i=D.indexOf(t.charAt(n++)),o=D.indexOf(t.charAt(n++)),a=r<<2|s>>4,c=(15&s)<<4|i>>2,l=(3&i)<<6|o;e+=String.fromCharCode(a),64!==i&&(e+=String.fromCharCode(c)),64!==o&&(e+=String.fromCharCode(l))}while(n<t.length);returnJ(e)}functionJ(t){returndecodeURIComponent(escape(t))}consttt=function(t){returnunescape(encodeURIComponent(t))},et=function(t){returnt&&"undefined"!=typeofURL&&URL.createObjectURL?URL.createObjectURL(t):""},nt=(function(){if("undefined"==typeofBlob)return"";constt=newBlob(["<html><head><title>SVG-edit</title></head><body> </body></html>"],{type:"text/html"});et(t)}(),function(t){lete,n;t.includes("<svg:svg")&&(t=t.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns"));try{n=window.DOMParser?newDOMParser:newwindow.ActiveXObject("Microsoft.XMLDOM"),n.async=!1}catch(t){thrownewError("XML Parser could not be instantiated")}try{e=n.loadXML?!!n.loadXML(t)&&n:n.parseFromString(t,"text/xml")}catch(t){thrownewError("Error parsing XML string")}returne}),rt=function(t,e){if(t&&1===t.nodeType){e(t);letn=t.childNodes.length;for(;n--;)rt(t.childNodes.item(n),e)}},st=function(t){if(t){if(t.startsWith('url("'))returnt.substring(5,t.indexOf('"',6));if(t.startsWith("url('"))returnt.substring(5,t.indexOf("'",6));if(t.startsWith("url("))returnt.substring(4,t.indexOf(")"))}returnnull};letit=function(t){returnt.getAttributeNS(e.XLINK,"href")},ot=function(t,n){t.setAttributeNS(e.XLINK,"xlink:href",n)};constat=function(){constt=q.getSVGContent();letn=t.getElementsByTagNameNS(e.SVG,"defs");returnn.length>0?n=n[0]:(n=t.ownerDocument.createElementNS(e.SVG,"defs"),t.firstChild?t.insertBefore(n,t.firstChild.nextSibling):t.append(n)),n},ct=function(t){conste=t.pathSegList,n=e.numberOfItems,r=[[],[]],s=e.getItem(0);leti=[s.x,s.y];consto=function(t,e,n,r){returnfunction(s){return1-s**3*i[t]+3-s**2*s*e[t]+3*(1-s)*s**2*n[t]+s**3*r[t]}};for(lett=0;t<n;t++){constn=e.getItem(t);if(void0!==n.x)if(r[0].push(i[0]),r[1].push(i[1]),n.x1){constt=[n.x1,n.y1],e=[n.x2,n.y2],s=[n.x,n.y];for(letn=0;n<2;n++){consta=o(n,t,e,s),c=6*i[n]-12*t[n]+6*e[n],l=-3*i[n]+9*t[n]-9*e[n]+3*s[n],h=3*t[n]-3*i[n];if(0===l){if(0===c)continue;constt=-h/c;t>0&&t<1&&r[n].push(a(t));continue}constu=c**2-4*h*l;if(u<0)continue;constd=(-c+Math.sqrt(u))/(2*l);d>0&&d<1&&r[n].push(a(d));constm=(-c-Math.sqrt(u))/(2*l);m>0&&m<1&&r[n].push(a(m))}i=s}elser[0].push(n.x),r[1].push(n.y)}consta=Math.min.apply(null,r[0]),c=Math.max.apply(null,r[0])-a,l=Math.min.apply(null,r[1]);return{x:a,y:l,width:c,height:Math.max.apply(null,r[1])-l}};functionlt(t){if(x)try{returnt.getBBox()}catch(t){}conste=F.data(t,"ref");letn,r,s=null;e?(r=F(e).children().clone().attr("visibility","hidden"),F(X).append(r),s=r.filter("line, path")):s=F(t).find("line, path");leti=!1;if(s.length)if(s.each((function(){constt=this.getBBox();t.width&&t.height||(i=!0)})),i){consts=e?r:F(t).children();n=yt(s)}elsen=t.getBBox();elsen=t.getBBox();returne&&r.remove(),n}constht=function(t){conste=t||q.geSelectedElements()[0];if(1!==t.nodeType)returnnull;constn=e.nodeName;letr=null;switch(n){case"text":""===e.textContent?(e.textContent="a",r=e.getBBox(),e.textContent=""):e.getBBox&&(r=e.getBBox());break;case"path":y?e.getBBox&&(r=e.getBBox()):r=ct(e);break;case"g":case"a":r=lt(e