function touchHandler(e){var t=e.changedTouches,n=t[0],a="";switch(e.type){case"touchstart":a="mousedown";break;case"touchmove":a="mousemove";break;case"touchend":a="mouseup";break;default:return}var r=document.createEvent("MouseEvent");r.initMouseEvent(a,!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),t.length<2&&(n.target.dispatchEvent(r),e.preventDefault())}document.addEventListener("touchstart",touchHandler,!0),document.addEventListener("touchmove",touchHandler,!0),document.addEventListener("touchend",touchHandler,!0),document.addEventListener("touchcancel",touchHandler,!0);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},asyncToGenerator=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){return function a(r,i){try{var o=t[r](i),s=o.value}catch(e){return void n(e)}if(!o.done)return Promise.resolve(s).then(function(e){a("next",e)},function(e){a("throw",e)});e(s)}("next")})}},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var n=0;nt.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=a,window.SVGPathSegLinetoAbs=r,window.SVGPathSegLinetoRel=i,window.SVGPathSegCurvetoCubicAbs=o,window.SVGPathSegCurvetoCubicRel=s,window.SVGPathSegCurvetoQuadraticAbs=l,window.SVGPathSegCurvetoQuadraticRel=c,window.SVGPathSegArcAbs=u,window.SVGPathSegArcRel=d,window.SVGPathSegLinetoHorizontalAbs=h,window.SVGPathSegLinetoHorizontalRel=g,window.SVGPathSegLinetoVerticalAbs=p,window.SVGPathSegLinetoVerticalRel=f,window.SVGPathSegCurvetoCubicSmoothAbs=v,window.SVGPathSegCurvetoCubicSmoothRel=m,window.SVGPathSegCurvetoQuadraticSmoothAbs=_,window.SVGPathSegCurvetoQuadraticSmoothRel=b}if(!("SVGPathSegList"in window&&"appendItem"in SVGPathSegList.prototype)){var y=function(){function e(t){classCallCheck(this,e),this._pathElement=t,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}return createClass(e,[{key:"_checkPathSynchronizedToList",value:function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())}},{key:"_updateListFromPathMutations",value:function(e){if(this._pathElement){var t=!1;e.forEach(function(e){"d"===e.attributeName&&(t=!0)}),t&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}}},{key:"_writeListToPath",value:function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",e._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}},{key:"segmentChanged",value:function(e){this._writeListToPath()}},{key:"clear",value:function(){this._checkPathSynchronizedToList(),this._list.forEach(function(e){e._owningPathSegList=null}),this._list=[],this._writeListToPath()}},{key:"initialize",value:function(e){return this._checkPathSynchronizedToList(),this._list=[e],e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_checkValidIndex",value:function(e){if(isNaN(e)||e<0||e>=this.numberOfItems)throw new Error("INDEX_SIZE_ERR")}},{key:"getItem",value:function(e){return this._checkPathSynchronizedToList(),this._checkValidIndex(e),this._list[e]}},{key:"insertItemBefore",value:function(e,t){return this._checkPathSynchronizedToList(),t>this.numberOfItems&&(t=this.numberOfItems),e._owningPathSegList&&(e=e.clone()),this._list.splice(t,0,e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"replaceItem",value:function(e,t){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._checkValidIndex(t),this._list[t]=e,e._owningPathSegList=this,this._writeListToPath(),e}},{key:"removeItem",value:function(e){this._checkPathSynchronizedToList(),this._checkValidIndex(e);var t=this._list[e];return this._list.splice(e,1),this._writeListToPath(),t}},{key:"appendItem",value:function(e){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._list.push(e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_parsePath",value:function(e){if(!e||!e.length)return[];var t=this,n=function(){function e(){classCallCheck(this,e),this.pathSegList=[]}return createClass(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){classCallCheck(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return createClass(e,[{key:"_isCurrentSpace",value:function(){var e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}},{key:"_skipOptionalSpaces",value:function(){for(;this._currentIndex="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}},{key:"initialCommandIsMoveTo",value:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}},{key:"_parseNumber",value:function(){var e=0,t=0,n=1,a=0,r=1,i=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!==this._string.charAt(this._currentIndex))){for(var s=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==s)for(var l=this._currentIndex-1,c=1;l>=s;)t+=c*(this._string.charAt(l--)-"0"),c*=10;if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,a+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==o&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var u=t+a;if(u*=r,e&&(u*=Math.pow(10,i*e)),o!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),u}}},{key:"_parseArcFlag",value:function(){if(!(this._currentIndex>=this._endIndex)){var e=!1,t=this._string.charAt(this._currentIndex++);if("0"===t)e=!1;else{if("1"!==t)return;e=!0}return this._skipOptionalSpacesOrDelimiter(),e}}},{key:"parseSegment",value:function(){var e=this._string[this._currentIndex],n=this._pathSegTypeFromChar(e);if(n===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if((n=this._nextCommandHelper(e,this._previousCommand))===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(t);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,a.x,a.y,a.x1,a.y1,a.x2,a.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,i.x,i.y,i.x2,i.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var o={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,o.x,o.y,o.x2,o.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var s={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,s.x,s.y,s.x1,s.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:var l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(t,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:var c={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(t,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:var u={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(t,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),r=new n,i=new a(e);if(!i.initialCommandIsMoveTo())return[];for(;i.hasMoreData();){var o=i.parseSegment();if(!o)return[];r.appendSegment(o)}return r.pathSegList}}]),e}();y.prototype.classname="SVGPathSegList",Object.defineProperty(y.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),y._pathSegArrayAsString=function(e){var t="",n=!0;return e.forEach(function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()}),t},Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new y(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=y}}();var $=jQuery,supportsSvg_=!!document.createElementNS&&!!document.createElementNS(NS.SVG,"svg").createSVGRect,_navigator=navigator,userAgent=_navigator.userAgent,svg=document.createElementNS(NS.SVG,"svg"),isOpera_=!!window.opera,isWebkit_=userAgent.includes("AppleWebKit"),isGecko_=userAgent.includes("Gecko/"),isIE_=userAgent.includes("MSIE"),isChrome_=userAgent.includes("Chrome/"),isWindows_=userAgent.includes("Windows"),isMac_=userAgent.includes("Macintosh"),isTouch_="ontouchstart"in window,supportsSelectors_=!!svg.querySelector,supportsXpath_=!!document.evaluate,supportsPathReplaceItem_=function(){var e=document.createElementNS(NS.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.replaceItem(n,1),!0}catch(e){}return!1}(),supportsPathInsertItemBefore_=function(){var e=document.createElementNS(NS.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.insertItemBefore(n,1),!0}catch(e){}return!1}(),supportsGoodTextCharPos_=function(){var e=document.createElementNS(NS.SVG,"svg"),t=document.createElementNS(NS.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(NS.SVG,"text");n.textContent="a",t.append(n);var a=n.getStartPositionOfChar(0).x;return e.remove(),0===a}(),supportsPathBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.append(t);var n=t.getBBox();return e.remove(),n.height>4&&n.height<5}(),supportsHVLineContainerBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(NS.SVG,"path");n.setAttribute("d","M5,0 15,0");var a=document.createElementNS(NS.SVG,"g");a.append(t,n),e.append(a);var r=a.getBBox();return e.remove(),15===r.width}(),supportsGoodDecimals_=function(){var e=document.createElementNS(NS.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");return t||$.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the latest version in which the problems have been fixed.'),t}(),supportsNonScalingStroke_=function(){var e=document.createElementNS(NS.SVG,"rect");return e.setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===e.style.vectorEffect}(),supportsNativeSVGTransformLists_=function(){var e=document.createElementNS(NS.SVG,"rect").transform.baseVal,t=svg.createSVGTransform();e.appendItem(t);var n=e.getItem(0);return n instanceof SVGTransform&&t instanceof SVGTransform&&n.type===t.type&&n.angle===t.angle&&n.matrix.a===t.matrix.a&&n.matrix.b===t.matrix.b&&n.matrix.c===t.matrix.c&&n.matrix.d===t.matrix.d&&n.matrix.e===t.matrix.e&&n.matrix.f===t.matrix.f}(),isOpera=function(){return isOpera_},isWebkit=function(){return isWebkit_},isGecko=function(){return isGecko_},isIE=function(){return isIE_},isChrome=function(){return isChrome_},isMac=function(){return isMac_},isTouch=function(){return isTouch_},supportsSelectors=function(){return supportsSelectors_},supportsXpath=function(){return supportsXpath_},supportsPathReplaceItem=function(){return supportsPathReplaceItem_},supportsPathInsertItemBefore=function(){return supportsPathInsertItemBefore_},supportsPathBBox=function(){return supportsPathBBox_},supportsHVLineContainerBBox=function(){return supportsHVLineContainerBBox_},supportsGoodTextCharPos=function(){return supportsGoodTextCharPos_},supportsNonScalingStroke=function(){return supportsNonScalingStroke_},supportsNativeTransformLists=function(){return supportsNativeSVGTransformLists_};function jqPluginSVG(e){var t=e.fn.attr;return e.fn.attr=function(e,n){var a=this.length;if(!a)return t.apply(this,arguments);for(var r=0;r=0)return this._xforms[e];var t=new Error("DOMException with code=INDEX_SIZE_ERR");throw t.code=1,t},this.insertItemBefore=function(e,t){var n=null;if(t>=0)if(t=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n},this.removeItem=function(e){if(e=0){var t=this._xforms[e],n=new Array(this.numberOfItems-1),a=void 0;for(a=0;a=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)for(var n=this.stack[t].elements(),a=n.length;a--;)e.includes(n[a])||e.push(n[a]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),e}();BatchCommand.type=BatchCommand.prototype.type;var UndoManager=function(){function e(t){classCallCheck(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return createClass(e,[{key:"resetUndoStack",value:function(){this.undoStack=[],this.undoStackPointer=0}},{key:"getUndoStackSize",value:function(){return this.undoStackPointer}},{key:"getRedoStackSize",value:function(){return this.undoStack.length-this.undoStackPointer}},{key:"getNextUndoCommandText",value:function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}},{key:"getNextRedoCommandText",value:function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(e),this.undoStackPointer=this.undoStack.length}},{key:"beginUndoableChange",value:function(e,t){for(var n=++this.undoChangeStackPointer,a=t.length,r=new Array(a),i=new Array(a);a--;){var o=t[a];null!=o&&(i[a]=o,r[a]=o.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:r,elements:i}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,a=new BatchCommand("Change "+n),r=t.elements.length;r--;){var i=t.elements[r];if(null!=i){var o={};o[n]=t.oldValues[r],o[n]!==i.getAttribute(n)&&a.addSubCommand(new ChangeElementCommand(i,o,n))}}return this.undoableChangeStack[e]=null,a}}]),e}(),history=Object.freeze({HistoryEventTypes:HistoryEventTypes,MoveElementCommand:MoveElementCommand,InsertElementCommand:InsertElementCommand,RemoveElementCommand:RemoveElementCommand,ChangeElementCommand:ChangeElementCommand,BatchCommand:BatchCommand,UndoManager:UndoManager}),NEAR_ZERO=1e-14,svg$1=document.createElementNS(NS.SVG,"svg"),transformPoint=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},isIdentity=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},matrixMultiply=function(){for(var e=arguments.length,t=Array(e),n=0;n(n=parseInt(n,10))){var a=n;n=t,t=a}for(var r=svg$1.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&ie.x&&t.ye.y},$$1=jQuery,segData={2:["x","y"],4:["x","y"],6:["x","y","x1","y1","x2","y2"],8:["x","y","x1","y1"],10:["x","y","r1","r2","angle","largeArcFlag","sweepFlag"],12:["x"],14:["y"],16:["x","y","x2","y2"],18:["x","y"]},uiStrings={},setUiStrings=function(e){Object.assign(uiStrings,e.ui)},pathFuncs=[],linkControlPts=!0,pathData={},setLinkControlPoints=function(e){linkControlPts=e},path=null,editorContext_=null,init$1=function(e){editorContext_=e,pathFuncs=[0,"ClosePath"];$$1.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){pathFuncs.push(t+"Abs"),pathFuncs.push(t+"Rel")})},insertItemBefore=function(e,t,n){var a=e.pathSegList;if(supportsPathInsertItemBefore())a.insertItemBefore(t,n);else{for(var r=a.numberOfItems,i=[],o=0;o0?(f=g element");this.elem=t,this.segs=[],this.selected_pts=[],path=this,this.init()}return createClass(e,[{key:"init",value:function(){$$1(getGripContainer()).find("*").each(function(){$$1(this).attr("display","none")});var e=this.elem.pathSegList,t=e.numberOfItems;this.segs=[],this.selected_pts=[],this.first_seg=null;for(var n=0;n=t?null:i[s+1],u=s-1<0?null:i[s-1];if(2===l.type){if(u&&1!==u.type){var d=i[o];d.next=i[o+1],d.next.prev=d,d.addGrip()}o=s}else if(c&&1===c.type)l.next=i[o+1],l.next.prev=l,l.mate=i[o],l.addGrip(),null==this.first_seg&&(this.first_seg=l);else if(c)1!==l.type&&(l.addGrip(),c&&2!==c.type&&(l.next=c,l.next.prev=l));else if(1!==l.type){var h=i[o];h.next=i[o+1],h.next.prev=h,h.addGrip(),l.addGrip(),this.first_seg||(this.first_seg=i[o])}}return this}},{key:"eachSeg",value:function(e){for(var t=this.segs.length,n=0;n=0&&this.selected_pts.push(n)}this.selected_pts.sort();var a=this.selected_pts.length,r=[];for(r.length=a;a--;){var i=this.selected_pts[a],o=this.segs[i];o.select(!0),r[a]=o.ptgrip}var s=this.subpathIsClosed(this.selected_pts[0]);editorContext_.addPtsToSelection({grips:r,closedSubpath:s})}}]),e}(),getPath_=function(e){var t=pathData[e.id];return t||(t=pathData[e.id]=new Path(e)),t},removePath_=function(e){e in pathData&&delete pathData[e]},newcx=void 0,newcy=void 0,oldcx=void 0,oldcy=void 0,angle=void 0,getRotVals=function(e,t){var n=e-oldcx,a=t-oldcy,r=Math.sqrt(n*n+a*a),i=Math.atan2(a,n)+angle;return n=r*Math.cos(i)+oldcx,a=r*Math.sin(i)+oldcy,n-=newcx,a-=newcy,r=Math.sqrt(n*n+a*a),i=Math.atan2(a,n)-angle,{x:r*Math.cos(i)+newcx,y:r*Math.sin(i)+newcy}},recalcRotatedPath=function(){var e=path.elem;if(angle=getRotationAngle(e,!0)){var t=path.oldbbox;oldcx=t.x+t.width/2,oldcy=t.y+t.height/2;var n=getBBox(e);newcx=n.x+n.width/2,newcy=n.y+n.height/2;var a=newcx-oldcx,r=newcy-oldcy,i=Math.sqrt(a*a+r*r),o=Math.atan2(r,a)+angle;newcx=i*Math.cos(o)+oldcx,newcy=i*Math.sin(o)+oldcy;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=getRotVals(c.x,c.y),h=[d.x,d.y];if(null!=c.x1&&null!=c.x2){var g=getRotVals(c.x1,c.y1),p=getRotVals(c.x2,c.y2);h.splice(h.length,0,g.x,g.y,p.x,p.y)}replacePathSeg(u,l,h)}}n=getBBox(e);var f=editorContext_.getSVGRoot().createSVGTransform(),v=getTransformList(e);f.setRotate(180*angle/Math.PI,newcx,newcy),v.replaceItem(f,0)}},clearData=function(){pathData={}},reorientGrads=function(e,t){for(var n=getBBox(e),a=0;a<2;a++){var r=0===a?"fill":"stroke",i=e.getAttribute(r);if(i&&i.startsWith("url(")){var o=getRefElem(i);if("linearGradient"===o.tagName){var s=o.getAttribute("x1")||0,l=o.getAttribute("y1")||0,c=o.getAttribute("x2")||1,u=o.getAttribute("y2")||0;s=n.width*s+n.x,l=n.height*l+n.y,c=n.width*c+n.x,u=n.height*u+n.y;var d=transformPoint(s,l,t),h=transformPoint(c,u,t),g={};g.x1=(d.x-n.x)/n.width,g.y1=(d.y-n.y)/n.height,g.x2=(h.x-n.x)/n.width,g.y2=(h.y-n.y)/n.height;var p=o.cloneNode(!0);$$1(p).attr(g),p.id=editorContext_.getNextId(),findDefs().append(p),e.setAttribute(r,"url(#"+p.id+")")}}}},pathMap=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],convertPath=function(e,t){for(var n=e.pathSegList,a=n.numberOfItems,r=0,i=0,o="",s=null,l=0;l=k-S&&v<=k+S&&m>=A-S&&m<=A+S){w=!0;break}}o=editorContext_.getId(),removePath_(o);var E=getElem(o),P=void 0,T=void 0,G=x.numberOfItems;if(w){if(C<=1&&G>=2){var N=x.getItem(0).x,L=x.getItem(0).y;P=4===(T=_.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(N,L):y.createSVGPathSegCurvetoCubicAbs(N,L,T.x1/f,T.y1/f,N,L);var I=y.createSVGPathSegClosePath();x.appendItem(P),x.appendItem(I)}else if(G<3)return!1;if($$1(_).remove(),y=editorContext_.setDrawnPath(null),editorContext_.setStarted(!1),e){path.matrix&&editorContext_.remapElement(E,{},path.matrix.inverse());var M=E.getAttribute("d"),R=$$1(path.elem).attr("d");return $$1(path.elem).attr("d",R+M),$$1(E).remove(),path.matrix&&recalcRotatedPath(),init$1(),pathActions.toEditMode(path.elem),path.selectPt(),!1}}else{if(!$$1.contains(editorContext_.getContainer(),editorContext_.getMouseTarget(n)))return console.log("Clicked outside canvas"),!1;var O=y.pathSegList.numberOfItems,B=y.pathSegList.getItem(O-1),V=B.x,j=B.y;if(n.shiftKey){var D=snapToAngle(V,j,v,m);v=D.x,m=D.y}P=4===(T=_.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(editorContext_.round(v),editorContext_.round(m)):y.createSVGPathSegCurvetoCubicAbs(editorContext_.round(v),editorContext_.round(m),T.x1/f,T.y1/f,T.x2/f,T.y2/f),y.pathSegList.appendItem(P),v*=f,m*=f,_.setAttribute("d",["M",v,m,v,m].join(" ")),b=O,e&&(b+=path.segs.length),addPointGrip(b,v,m)}}else{var F="M"+v+","+m+" ";y=editorContext_.setDrawnPath(editorContext_.addSvgElementFromJson({element:"path",curStyles:!0,attr:{d:F,id:editorContext_.getNextId(),opacity:editorContext_.getOpacity()/2}})),_.setAttribute("d",["M",g,p,g,p].join(" ")),b=e?path.segs.length:0,addPointGrip(b,g,p)}}},mouseMove:function(e,a){var i=editorContext_.getCurrentZoom();r=!0;var o=editorContext_.getDrawnPath();if("path"!==editorContext_.getCurrentMode())if(path.dragging){var s=getPointFromGrip({x:path.dragging[0],y:path.dragging[1]},path),l=getPointFromGrip({x:e,y:a},path),c=l.x-s.x,u=l.y-s.y;path.dragging=[e,a],path.dragctrl?path.moveCtrl(c,u):path.movePts(c,u)}else path.selected_pts=[],path.eachSeg(function(e){if(this.next||this.prev){var t=editorContext_.getRubberBox().getBBox(),n=getGripPt(this),a={x:n.x,y:n.y,width:0,height:0},r=rectsIntersect(t,a);this.select(r),r&&path.selected_pts.push(this.index)}});else{if(!o)return;var d=o.pathSegList,h=d.numberOfItems-1;if(t){var g=addCtrlGrip("1c1"),p=addCtrlGrip("0c2");g.setAttribute("cx",e),g.setAttribute("cy",a),g.setAttribute("display","inline");var f=t[0],v=t[1],m=f+(f-e/i),_=v+(v-a/i);p.setAttribute("cx",m*i),p.setAttribute("cy",_*i),p.setAttribute("display","inline");var b=getCtrlLine(1);if(assignAttributes(b,{x1:e,y1:a,x2:m*i,y2:_*i,display:"inline"}),0===h)n=[e,a];else{var y=d.getItem(h-1),x=y.x,C=y.y;6===y.pathSegType?(x+=x-y.x2,C+=C-y.y2):n&&(x=n[0]/i,C=n[1]/i),replacePathSeg(6,h,[f,v,x,C,m,_],o)}}else{var S=getElem("path_stretch_line");if(S){var w=d.getItem(h);if(6===w.pathSegType){var $=w.x+(w.x-w.x2),k=w.y+(w.y-w.y2);replacePathSeg(6,1,[e,a,$*i,k*i,e,a],S)}else n?replacePathSeg(6,1,[e,a,n[0],n[1],e,a],S):replacePathSeg(4,1,[e,a],S)}}}},mouseUp:function(e,a,i,o){var s=editorContext_.getDrawnPath();if("path"===editorContext_.getCurrentMode())return t=null,s||(a=getElem(editorContext_.getId()),editorContext_.setStarted(!1),n=null),{keep:!0,element:a};var l=editorContext_.getRubberBox();if(path.dragging){var c=path.cur_pt;path.dragging=!1,path.dragctrl=!1,path.update(),r&&path.endChanges("Move path point(s)"),e.shiftKey||r||path.selectPt(c)}else l&&"none"!==l.getAttribute("display")?(l.setAttribute("display","none"),l.getAttribute("width")<=2&&l.getAttribute("height")<=2&&pathActions.toSelectMode(e.target)):pathActions.toSelectMode(e.target);r=!1},toEditMode:function(t){path=getPath_(t),editorContext_.setCurrentMode("pathedit"),editorContext_.clearSelection(),path.show(!0).update(),path.oldbbox=getBBox(path.elem),e=!1},toSelectMode:function(e){var t=e===path.elem;editorContext_.setCurrentMode("select"),path.show(!1),a=!1,editorContext_.clearSelection(),path.matrix&&recalcRotatedPath(),t&&(editorContext_.call("selected",[e]),editorContext_.addToSelection([e],!0))},addSubPath:function(t){t?(editorContext_.setCurrentMode("path"),e=!0):(pathActions.clear(!0),pathActions.toEditMode(path.elem))},select:function(e){a===e?(pathActions.toEditMode(e),editorContext_.setCurrentMode("pathedit")):a=e},reorient:function(){var e=editorContext_.getSelectedElements()[0];if(e&&0!==getRotationAngle(e)){var t=new BatchCommand("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new ChangeElementCommand(e,n)),editorContext_.clearSelection(),this.resetOrientation(e),editorContext_.addCommandToHistory(t),getPath_(e).show(!1).matrix=null,this.clear(),editorContext_.addToSelection([e],!0),editorContext_.call("changed",editorContext_.getSelectedElements())}},clear:function(e){var t=editorContext_.getDrawnPath();if(a=null,t){var r=getElem(editorContext_.getId());$$1(getElem("path_stretch_line")).remove(),$$1(r).remove(),$$1(getElem("pathpointgrip_container")).find("*").attr("display","none"),n=null,editorContext_.setDrawnPath(null),editorContext_.setStarted(!1)}else"pathedit"===editorContext_.getCurrentMode()&&this.toSelectMode();path&&path.init().show(!1)},resetOrientation:function(e){if(null==e||"path"!==e.nodeName)return!1;var t=getTransformList(e),n=transformListToTransform(t).matrix;t.clear(),e.removeAttribute("transform");for(var a=e.pathSegList,r=a.numberOfItems,i=function(t){var r=a.getItem(t),i=r.pathSegType;if(1===i)return"continue";var o=[];$$1.each(["",1,2],function(e,t){var a=r["x"+t],i=r["y"+t];if(void 0!==a&&void 0!==i){var s=transformPoint(a,i,n);o.splice(o.length,0,s.x,s.y)}}),replacePathSeg(i,t,o,e)},o=0;o0){var s=t.getItem(n-1).pathSegType;if(2===s){a(n-1,1),e();break}if(1===s&&t.numberOfItems-1===n){a(n,1),e();break}}}return!1}(),path.elem.pathSegList.numberOfItems<=1)return pathActions.toSelectMode(path.elem),void editorContext_.canvas.deleteSelectedElements();if(path.init(),path.clearSelection(),window.opera){var a=$$1(path.elem);a.attr("d",a.attr("d"))}path.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t=void 0,n=e.points,a=n.numberOfItems;if(a>=4){var r=n.getItem(0),i=null,o=[];for(o.push(["M",r.x,",",r.y," C"].join("")),t=1;t<=a-4;t+=3){var s=n.getItem(t),l=n.getItem(t+1),c=n.getItem(t+2);if(i){var u=smoothControlPoints(i,s,r);if(u&&2===u.length){var d=o[o.length-1].split(",");d[2]=u[0].x,d[3]=u[0].y,o[o.length-1]=d.join(","),s=u[1]}}o.push([s.x,s.y,l.x,l.y,c.x,c.y].join(",")),r=c,i=l}for(o.push("L");t/g,">").replace(/"/g,""").replace(/'/,"'")},encode64=function(e){if(e=encodeUTF8(e),window.btoa)return window.btoa(e);var t=[];t.length=4*Math.floor((e.length+2)/3);var n=0,a=0;do{var r=e.charCodeAt(n++),i=e.charCodeAt(n++),o=e.charCodeAt(n++),s=r>>2,l=(3&r)<<4|i>>4,c=(15&i)<<2|o>>6,u=63&o;isNaN(i)?c=u=64:isNaN(o)&&(u=64),t[a++]=KEYSTR.charAt(s),t[a++]=KEYSTR.charAt(l),t[a++]=KEYSTR.charAt(c),t[a++]=KEYSTR.charAt(u)}while(n>4,l=(15&r)<<4|i>>2,c=(3&i)<<6|o;t+=String.fromCharCode(s),64!==i&&(t+=String.fromCharCode(l)),64!==o&&(t+=String.fromCharCode(c))}while(nSVG-edit "],{type:"text/html"});return createObjectURL(e)}(),text2xml=function(e){e.includes("0?t=t[0]:(t=e.ownerDocument.createElementNS(NS.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},getPathBBox=function(e){for(var t=e.pathSegList,n=t.numberOfItems,a=[[],[]],r=t.getItem(0),i=[r.x,r.y],o=0;o0&&u<1&&a[r].push(o(u)),"continue"}var d=Math.pow(s,2)-4*c*l;if(d<0)return"continue";var h=(-s+Math.sqrt(d))/(2*l);h>0&&h<1&&a[r].push(o(h));var g=(-s-Math.sqrt(d))/(2*l);g>0&&g<1&&a[r].push(o(g))},o=0;o<2;o++)r(o);i=n}():(a[0].push(s.x),a[1].push(s.y)))}var l=Math.min.apply(null,a[0]),c=Math.max.apply(null,a[0])-l,u=Math.min.apply(null,a[1]);return{x:l,y:u,width:c,height:Math.max.apply(null,a[1])-u}};function groupBBFix(e){if(supportsHVLineContainerBBox())try{return e.getBBox()}catch(e){}var t=$$2.data(e,"ref"),n=null,a=void 0,r=void 0;t?(r=$$2(t).children().clone().attr("visibility","hidden"),$$2(svgroot_).append(r),n=r.filter("line, path")):n=$$2(e).find("line, path");var i=!1;if(n.length)if(n.each(function(){var e=this.getBBox();e.width&&e.height||(i=!0)}),i){var o=t?r:$$2(e).children();a=getStrokedBBox(o)}else a=e.getBBox();else a=e.getBBox();return t&&r.remove(),a}var getBBox=function(e){var t=e||editorContext_$1.geSelectedElements()[0];if(1!==e.nodeType)return null;var n=t.nodeName,a=null;switch(n){case"text":""===t.textContent?(t.textContent="a",a=t.getBBox(),t.textContent=""):t.getBBox&&(a=t.getBBox());break;case"path":supportsPathBBox()?t.getBBox&&(a=t.getBBox()):a=getPathBBox(t);break;case"g":case"a":a=groupBBFix(t);break;default:if("use"===n&&(a=groupBBFix(t,!0)),"use"===n||"foreignObject"===n&&isWebkit()){if(a||(a=t.getBBox()),!isWebkit()){var r={};r.width=a.width,r.height=a.height,r.x=a.x+parseFloat(t.getAttribute("x")||0),r.y=a.y+parseFloat(t.getAttribute("y")||0),a=r}}else if(visElemsArr.includes(n))if(t)try{a=t.getBBox()}catch(e){var i=t.getExtentOfChar(0),o=t.getComputedTextLength();a={x:i.x,y:i.y,width:o,height:i.height}}else{var s=$$2(t).closest("foreignObject");s.length&&s[0].getBBox&&(a=s[0].getBBox())}}return a&&(a=bboxToObj(a)),a},getPathDFromSegments=function(e){var t="";return $$2.each(e,function(e,n){var a=n[1];t+=n[0];for(var r=0;r-.001&&n<.001||(n<-89.99||n>89.99))}var getBBoxWithTransform=function(e,t,n){var a=getBBox(e);if(!a)return null;var r=getTransformList(e),i=getRotationAngleFromTransformList(r),o=hasMatrixTransform(r);if(i||o){var s=!1;if(bBoxCanBeOptimizedOverNativeGetBBox(i,o)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))a=s=getBBoxOfElementAsPath(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(a=s=getBBoxOfElementAsPath(e,t,n))}}if(!s){var u=transformListToTransform(r).matrix;a=transformBox(a.x,a.y,a.width,a.height,u).aabox}}return a};function getStrokeOffsetForBBox(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var getStrokedBBox=function(e,t,n){if(!e||!e.length)return!1;var a=void 0;if($$2.each(e,function(){a||this.parentNode&&(a=getBBoxWithTransform(this,t,n))}),void 0===a)return null;var r=a.x+a.width,i=a.y+a.height,o=a.x,s=a.y;if(1===e.length){var l=getStrokeOffsetForBBox(e[0]);o-=l,s-=l,r+=l,i+=l}else $$2.each(e,function(e,a){var l=getBBoxWithTransform(a,t,n);if(l){var c=getStrokeOffsetForBBox(a);o=Math.min(o,l.x-c),s=Math.min(s,l.y-c),1===a.nodeType&&(r=Math.max(r,l.x+l.width+c),i=Math.max(i,l.y+l.height+c))}});return a.x=o,a.y=s,a.width=r-o,a.height=i-s,a},getVisibleElements=function(e){e||(e=$$2(editorContext_$1.getSVGContent()).children());var t=[];return $$2(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},getStrokedBBoxDefaultVisible=function(e){return e||(e=getVisibleElements()),getStrokedBBox(e,editorContext_$1.addSvgElementFromJson,editorContext_$1.pathActions)},getRotationAngleFromTransformList=function(e,t){if(!e)return 0;for(var n=e.numberOfItems,a=0;a|:\\"+(t||"")+"-]","g"),"\\$&")},preventClickDefault=function(e){$$2(e).click(function(e){e.preventDefault()})},copyElem=function e(t,n){var a=document.createElementNS(t.namespaceURI,t.nodeName);if($$2.each(t.attributes,function(e,t){"-moz-math-font-style"!==t.localName&&a.setAttributeNS(t.namespaceURI,t.nodeName,t.value)}),a.removeAttribute("id"),a.id=n(),isWebkit()&&"path"===t.nodeName){var r=convertPath(t);a.setAttribute("d",r)}if($$2.each(t.childNodes,function(t,r){switch(r.nodeType){case 1:a.append(e(r,n));break;case 3:a.textContent=r.nodeValue}}),$$2(t).data("gsvg"))$$2(a).data("gsvg",a.firstChild);else if($$2(t).data("symbol")){var i=$$2(t).data("symbol");$$2(a).data("ref",i).data("symbol",i)}else"image"===a.tagName&&preventClickDefault(a);return a},$$3=jQuery,contextMenuExtensions={},hasCustomHandler=function(e){return Boolean(contextMenuExtensions[e])},getCustomHandler=function(e){return contextMenuExtensions[e].action},injectExtendedContextMenuItemIntoDom=function(e){Object.keys(contextMenuExtensions).length||$$3("#cmenu_canvas").append("
  • ");var t=e.shortcut||"";$$3("#cmenu_canvas").append("
  • "+e.label+""+t+"
  • ")},injectExtendedContextMenuItemsIntoDom=function(){for(var e in contextMenuExtensions)injectExtendedContextMenuItemIntoDom(contextMenuExtensions[e])};function toAbsoluteURL(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}function addScriptAtts(e,t){["id","class","type"].forEach(function(n){n in t&&(e[n]=t[n])})}var importSetGlobalDefault=function(){var e=asyncToGenerator(regeneratorRuntime.mark(function e(t,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",importSetGlobal(t,_extends({},n,{returnDefault:!0})));case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),importSetGlobal=function(){var e=asyncToGenerator(regeneratorRuntime.mark(function e(t,n){var a=n.global,r=n.returnDefault;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)){e.next=3;break}return e.abrupt("return",importModule(t,void 0,{returnDefault:r}));case 3:return e.next=5,importScript(t);case 5:return e.abrupt("return",window[a]);case 6:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}();function importScript(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map(function(e){return importScript(e,t)})):new Promise(function(n,a){var r=document.createElement("script"),i=function(){r.onerror=null,r.onload=null,r.remove(),r.src=""};r.defer="defer",addScriptAtts(r,t),r.onerror=function(){a(new Error("Failed to import: "+e)),i()},r.onload=function(){n(),i()},r.src=e,document.head.append(r)})}function importModule(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).returnDefault,a=void 0!==n&&n;return Array.isArray(e)?Promise.all(e.map(function(e){return importModule(e,t)})):new Promise(function(n,r){var i="$importModule$"+Math.random().toString(32).slice(2),o=document.createElement("script"),s=function(){delete window[i],o.onerror=null,o.onload=null,o.remove(),URL.revokeObjectURL(o.src),o.src=""};addScriptAtts(o,t),o.defer="defer",o.type="module",o.onerror=function(){r(new Error("Failed to import: "+e)),s()},o.onload=function(){n(window[i]),s()};var l="import * as m from '"+toAbsoluteURL(e).replace(/'/g,"\\'")+"'; window."+i+" = "+(a?"m.default || ":"")+"m;",c=new Blob([l],{type:"text/javascript"});o.src=URL.createObjectURL(c),document.head.append(o)})}var $$4=jQuery,Layer=function(){function e(t,n,a){if(classCallCheck(this,e),this.name_=t,this.group_=a?null:n,a){var r=a.ownerDocument;this.group_=r.createElementNS(NS.SVG,"g");var i=r.createElementNS(NS.SVG,"title");i.textContent=t,this.group_.append(i),n?$$4(n).after(this.group_):a.append(this.group_)}addLayerClass(this.group_),walkTree(this.group_,function(e){e.setAttribute("style","pointer-events:inherit")}),this.group_.setAttribute("style",a?"pointer-events:all":"pointer-events:none")}return createClass(e,[{key:"getName",value:function(){return this.name_}},{key:"getGroup",value:function(){return this.group_}},{key:"activate",value:function(){this.group_.setAttribute("style","pointer-events:all")}},{key:"deactivate",value:function(){this.group_.setAttribute("style","pointer-events:none")}},{key:"setVisible",value:function(e){var t=void 0===e||e?"inline":"none";this.group_.getAttribute("display")!==t&&this.group_.setAttribute("display",t)}},{key:"isVisible",value:function(){return"none"!==this.group_.getAttribute("display")}},{key:"getOpacity",value:function(){var e=this.group_.getAttribute("opacity");return null===e||void 0===e?1:parseFloat(e)}},{key:"setOpacity",value:function(e){"number"==typeof e&&e>=0&&e<=1&&this.group_.setAttribute("opacity",e)}},{key:"appendChildren",value:function(e){for(var t=0;t element");this.svgElem_=t,this.obj_num=0,this.idPrefix=n||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";var a=this.svgElem_.getAttributeNS(NS.SE,"nonce");a&&randIds!==RandomizeModes.NEVER_RANDOMIZE?this.nonce_=a:randIds===RandomizeModes.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return createClass(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):$$5(this.svgElem_).find("[id="+e+"]")[0]}},{key:"getSvgElem",value:function(){return this.svgElem_}},{key:"getNonce",value:function(){return this.nonce_}},{key:"setNonce",value:function(e){this.svgElem_.setAttributeNS(NS.XMLNS,"xmlns:se",NS.SE),this.svgElem_.setAttributeNS(NS.SE,"se:nonce",e),this.nonce_=e}},{key:"clearNonce",value:function(){this.nonce_=""}},{key:"getId",value:function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num}},{key:"getNextId",value:function(){var e=this.obj_num,t=!1;this.releasedNums.length>0?(this.obj_num=this.releasedNums.pop(),t=!0):this.obj_num++;for(var n=this.getId();this.getElem_(n);)t&&(this.obj_num=e,t=!1),this.obj_num++,n=this.getId();return t&&(this.obj_num=e),n}},{key:"releaseId",value:function(e){var t=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if("string"!=typeof e||!e.startsWith(t))return!1;var n=parseInt(e.substr(t.length),10);return!("number"!=typeof n||n<=0||this.releasedNums.includes(n))&&(this.releasedNums.push(n),!0)}},{key:"getNumLayers",value:function(){return this.all_layers.length}},{key:"hasLayer",value:function(e){return void 0!==this.layer_map[e]}},{key:"getLayerName",value:function(e){return e>=0&&e=t)return null;var n=void 0;for(n=0;nn?e0){var s=this.current_layer.getName();this.current_layer=this.all_layers[o-1],this.all_layers.splice(o,1),delete this.layer_map[s]}e.endBatchCommand()}}},{key:"mergeAllLayers",value:function(e){for(this.current_layer=this.all_layers[this.all_layers.length-1],e.startBatchCommand("Merge all Layers");this.all_layers.length>1;)this.mergeLayer(e);e.endBatchCommand()}},{key:"setCurrentLayer",value:function(e){var t=this.layer_map[e];return!!t&&(this.current_layer&&this.current_layer.deactivate(),this.current_layer=t,this.current_layer.activate(),!0)}},{key:"deleteCurrentLayer",value:function(){if(this.current_layer&&this.getNumLayers()>1){var e=this.current_layer.removeGroup();return this.identifyLayers(),e}return null}},{key:"identifyLayers",value:function(){this.all_layers=[],this.layer_map={};for(var e=this.svgElem_.childNodes.length,t=[],n=[],a=null,r=!1,i=0;i0||!r?((a=new Layer(getNewLayerName(n),null,this.svgElem_)).appendChildren(t),this.all_layers.push(a),this.layer_map[name]=a):a.activate(),this.current_layer=a}},{key:"createLayer",value:function(e,t){this.current_layer&&this.current_layer.deactivate(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=getNewLayerName(Object.keys(this.layer_map)));var n=new Layer(e,null,this.svgElem_);return t&&(t.startBatchCommand("Create Layer"),t.insertElement(n.getGroup()),t.endBatchCommand()),this.all_layers.push(n),this.layer_map[e]=n,this.current_layer=n,n.getGroup()}},{key:"cloneLayer",value:function(e,t){if(!this.current_layer)return null;this.current_layer.deactivate(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=getNewLayerName(Object.keys(this.layer_map)));for(var n=this.current_layer.getGroup(),a=new Layer(e,n,this.svgElem_),r=a.getGroup(),i=n.childNodes,o=0;o=0?this.all_layers.splice(l+1,0,a):this.all_layers.push(a),this.layer_map[e]=a,this.current_layer=a,r}},{key:"getLayerVisibility",value:function(e){var t=this.layer_map[e];return!!t&&t.isVisible()}},{key:"setLayerVisibility",value:function(e,t){if("boolean"!=typeof t)return null;var n=this.layer_map[e];return n?(n.setVisible(t),n.getGroup()):null}},{key:"getLayerOpacity",value:function(e){var t=this.layer_map[e];return t?t.getOpacity():null}},{key:"setLayerOpacity",value:function(e,t){if(!("number"!=typeof t||t<0||t>1)){var n=this.layer_map[e];n&&n.setOpacity(t)}}},{key:"copyElem",value:function(e){var t=this;return copyElem(e,function(){return t.getNextId()})}}]),e}(),randomizeIds=function(e,t){(randIds=!1===e?RandomizeModes.NEVER_RANDOMIZE:RandomizeModes.ALWAYS_RANDOMIZE)!==RandomizeModes.ALWAYS_RANDOMIZE||t.getNonce()?randIds===RandomizeModes.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},canvas_=void 0,init$3=function(e){canvas_=e},identifyLayers=function(){leaveContext(),canvas_.getCurrentDrawing().identifyLayers()},createLayer=function(e,t){var n=canvas_.getCurrentDrawing().createLayer(e,historyRecordingService(t));canvas_.clearSelection(),canvas_.call("changed",[n])},cloneLayer=function(e,t){var n=canvas_.getCurrentDrawing().cloneLayer(e,historyRecordingService(t));canvas_.clearSelection(),leaveContext(),canvas_.call("changed",[n])},deleteCurrentLayer=function(){var e=canvas_.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=canvas_.getCurrentDrawing().deleteCurrentLayer()){var a=new BatchCommand("Delete Layer");return a.addSubCommand(new RemoveElementCommand(e,t,n)),canvas_.addCommandToHistory(a),canvas_.clearSelection(),canvas_.call("changed",[n]),!0}return!1},setCurrentLayer=function(e){var t=canvas_.getCurrentDrawing().setCurrentLayer(toXml(e));return t&&canvas_.clearSelection(),t},renameCurrentLayer=function(e){var t=canvas_.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,historyRecordingService()))return canvas_.call("changed",[n]),!0;return!1},setCurrentLayerPosition=function(e){var t=canvas_.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(canvas_.addCommandToHistory(new MoveElementCommand(t.currentGroup,t.oldNextSibling,canvas_.getSVGContent())),!0)},setLayerVisibility=function(e,t){var n=canvas_.getCurrentDrawing(),a=n.getLayerVisibility(e),r=n.setLayerVisibility(e,t);if(!r)return!1;var i=a?"inline":"none";return canvas_.addCommandToHistory(new ChangeElementCommand(r,{display:i},"Layer Visibility")),r===n.getCurrentLayer()&&(canvas_.clearSelection(),canvas_.pathActions.clear()),!0},moveSelectedToLayer=function(e){var t=canvas_.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new BatchCommand("Move Elements to Layer"),a=canvas_.getSelectedElements(),r=a.length;r--;){var i=a[r];if(i){var o=i.nextSibling,s=i.parentNode;t.append(i),n.addSubCommand(new MoveElementCommand(i,o,s))}}return canvas_.addCommandToHistory(n),!0},mergeLayer=function(e){canvas_.getCurrentDrawing().mergeLayer(historyRecordingService(e)),canvas_.clearSelection(),leaveContext(),canvas_.changeSvgcontent()},mergeAllLayers=function(e){canvas_.getCurrentDrawing().mergeAllLayers(historyRecordingService(e)),canvas_.clearSelection(),leaveContext(),canvas_.changeSvgcontent()},leaveContext=function(){var e=disabledElems.length;if(e){for(var t=0;t0){for(var r=a.numberOfItems,i=r;r--;){var o=a.getItem(r);if(0===o.type)a.removeItem(r);else if(1===o.type){if(isIdentity(o.matrix)){if(1===i)return t.removeAttribute("transform"),null;a.removeItem(r)}}else 4===o.type&&0===o.angle&&a.removeItem(r)}if(1===a.numberOfItems&&getRotationAngle(t))return null}if(!a||0===a.numberOfItems)return t.setAttribute("transform",""),t.removeAttribute("transform"),null;if(a){for(var s=[],l=a.numberOfItems;l--;){var c=a.getItem(l);1===c.type?s.push([c.matrix,l]):s.length&&(s=[])}if(2===s.length){var u=n.createSVGTransformFromMatrix(matrixMultiply(s[1][0],s[0][0]));a.removeItem(s[0][1]),a.removeItem(s[1][1]),a.insertItemBefore(u,s[1][1])}if((l=a.numberOfItems)>=2&&1===a.getItem(l-2).type&&2===a.getItem(l-1).type){var d=n.createSVGTransform(),h=matrixMultiply(a.getItem(l-2).matrix,a.getItem(l-1).matrix);d.setMatrix(h),a.removeItem(l-2),a.removeItem(l-2),a.appendItem(d)}}switch(t.tagName){case"line":case"polyline":case"polygon":case"path":break;default:if(1===a.numberOfItems&&1===a.getItem(0).type||2===a.numberOfItems&&1===a.getItem(0).type&&4===a.getItem(0).type)return null}var g=$$7(t).data("gsvg"),p=new BatchCommand("Transform"),f={},v=null,m=[];switch(t.tagName){case"line":m=["x1","y1","x2","y2"];break;case"circle":m=["cx","cy","r"];break;case"ellipse":m=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":m=["width","height","x","y"];break;case"use":case"text":case"tspan":m=["x","y"];break;case"polygon":case"polyline":(v={}).points=t.getAttribute("points");var _=t.points,b=_.numberOfItems;f.points=new Array(b);for(var y=0;y1e-10?Math.sin(A)/(1-Math.cos(A)):2/A;for(var P=0;P=3&&3===a.getItem(N-2).type&&2===a.getItem(N-3).type&&2===a.getItem(N-1).type){M=3;for(var B=a.getItem(N-3).matrix,V=a.getItem(N-2).matrix,j=a.getItem(N-1).matrix,D=t.childNodes,F=D.length;F--;){var U=D.item(F);if(L=0,I=0,1===U.nodeType){var H=getTransformList(U);if(!H)continue;var z=transformListToTransform(H).matrix,q=getRotationAngle(U);if(O=context_.getStartTransform(),context_.setStartTransform(U.getAttribute("transform")),q||hasMatrixTransform(H)){var W=n.createSVGTransform();W.setMatrix(matrixMultiply(B,V,j,z)),H.clear(),H.appendItem(W)}else{var Y=matrixMultiply(z.inverse(),j,z),X=n.createSVGMatrix();X.e=-Y.e,X.f=-Y.f;var K=matrixMultiply(X.inverse(),z.inverse(),B,V,j,z,Y.inverse()),Q=n.createSVGTransform(),Z=n.createSVGTransform(),J=n.createSVGTransform();Q.setTranslate(Y.e,Y.f),Z.setScale(K.a,K.d),J.setTranslate(X.e,X.f),H.appendItem(J),H.appendItem(Z),H.appendItem(Q)}p.addSubCommand(e(U)),context_.setStartTransform(O)}}a.removeItem(N-1),a.removeItem(N-2),a.removeItem(N-3)}else if(N>=3&&1===a.getItem(N-1).type){M=3,$=transformListToTransform(a).matrix;var ee=n.createSVGTransform();ee.setMatrix($),a.clear(),a.appendItem(ee)}else if((1===N||N>1&&3!==a.getItem(1).type)&&2===a.getItem(0).type){M=2;var te=transformListToTransform(a).matrix;a.removeItem(0);var ne=transformListToTransform(a).matrix.inverse(),ae=matrixMultiply(ne,te);if(L=ae.e,I=ae.f,0!==L||0!==I){for(var re=t.childNodes,ie=re.length,oe=[];ie--;){var se=re.item(ie);if(1===se.nodeType){if(se.getAttribute("clip-path")){var le=se.getAttribute("clip-path");oe.includes(le)||(updateClipPath(le,L,I),oe.push(le))}O=context_.getStartTransform(),context_.setStartTransform(se.getAttribute("transform"));var ce=getTransformList(se);if(ce){var ue=n.createSVGTransform();ue.setTranslate(L,I),ce.numberOfItems?ce.insertItemBefore(ue,0):ce.appendItem(ue),p.addSubCommand(e(se));for(var de=t.getElementsByTagNameNS(NS.SVG,"use"),he="#"+se.id,ge=de.length;ge--;){var pe=de.item(ge);if(he===getHref(pe)){var fe=n.createSVGTransform();fe.setTranslate(-L,-I),getTransformList(pe).insertItemBefore(fe,0),p.addSubCommand(e(pe))}}context_.setStartTransform(O)}}}oe=[],context_.setStartTransform(O)}}else{if(1!==N||1!==a.getItem(0).type||k){if(k){var ve=n.createSVGTransform();ve.setRotate(k,S.x,S.y),a.numberOfItems?a.insertItemBefore(ve,0):a.appendItem(ve)}return 0===a.numberOfItems&&t.removeAttribute("transform"),null}M=1;for(var me=a.getItem(0).matrix,_e=t.childNodes,be=_e.length;be--;){var ye=_e.item(be);if(1===ye.nodeType){O=context_.getStartTransform(),context_.setStartTransform(ye.getAttribute("transform"));var xe=getTransformList(ye);if(!xe)continue;var Ce=matrixMultiply(me,transformListToTransform(xe).matrix),Se=n.createSVGTransform();Se.setMatrix(Ce),xe.clear(),xe.appendItem(Se,0),p.addSubCommand(e(ye)),context_.setStartTransform(O);var we=ye.getAttribute("stroke-width");if("none"!==ye.getAttribute("stroke")&&!isNaN(we)){var $e=(Math.abs(Ce.a)+Math.abs(Ce.d))/2;ye.setAttribute("stroke-width",we*$e)}}}a.clear()}if(2===M){if(k){S={x:C.x+R.e,y:C.y+R.f};var ke=n.createSVGTransform();ke.setRotate(k,S.x,S.y),a.numberOfItems?a.insertItemBefore(ke,0):a.appendItem(ke)}}else if(3===M){var Ae=transformListToTransform(a).matrix,Ee=n.createSVGTransform();Ee.setRotate(k,C.x,C.y);var Pe=Ee.matrix,Te=n.createSVGTransform();Te.setRotate(k,S.x,S.y);var Ge=Te.matrix.inverse(),Ne=Ae.inverse(),Le=matrixMultiply(Ne,Ge,Pe,Ae);if(L=Le.e,I=Le.f,0!==L||0!==I)for(var Ie=t.childNodes,Me=Ie.length;Me--;){var Re=Ie.item(Me);if(1===Re.nodeType){O=context_.getStartTransform(),context_.setStartTransform(Re.getAttribute("transform"));var Oe=getTransformList(Re),Be=n.createSVGTransform();Be.setTranslate(L,I),Oe.numberOfItems?Oe.insertItemBefore(Be,0):Oe.appendItem(Be),p.addSubCommand(e(Re)),context_.setStartTransform(O)}}k&&(a.numberOfItems?a.insertItemBefore(Te,0):a.appendItem(Te))}}else{var Ve=getBBox(t);if(!Ve&&"path"!==t.tagName)return null;var je=n.createSVGMatrix(),De=getRotationAngle(t);if(De){C={x:Ve.x+Ve.width/2,y:Ve.y+Ve.height/2},S=transformPoint(Ve.x+Ve.width/2,Ve.y+Ve.height/2,transformListToTransform(a).matrix);for(var Fe=De*Math.PI/180,Ue=Math.abs(Fe)>1e-10?Math.sin(Fe)/(1-Math.cos(Fe)):2/Fe,He=0;He=3&&3===a.getItem(Ye-2).type&&2===a.getItem(Ye-3).type&&2===a.getItem(Ye-1).type)We=3,je=transformListToTransform(a,Ye-3,Ye-1).matrix,a.removeItem(Ye-1),a.removeItem(Ye-2),a.removeItem(Ye-3);else if(4===Ye&&1===a.getItem(Ye-1).type){We=3,je=transformListToTransform(a).matrix;var tt=n.createSVGTransform();tt.setMatrix(je),a.clear(),a.appendItem(tt),je=n.createSVGMatrix()}else if((1===Ye||Ye>1&&3!==a.getItem(1).type)&&2===a.getItem(0).type){We=2;var nt=a.getItem(0).matrix,at=transformListToTransform(a,1).matrix,rt=at.inverse();je=matrixMultiply(rt,nt,at),a.removeItem(0)}else{if(1!==Ye||1!==a.getItem(0).type||De){if(We=4,De){var it=n.createSVGTransform();it.setRotate(De,S.x,S.y),a.numberOfItems?a.insertItemBefore(it,0):a.appendItem(it)}return 0===a.numberOfItems&&t.removeAttribute("transform"),null}switch(je=transformListToTransform(a).matrix,t.tagName){case"line":f=$$7(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(f.points=t.getAttribute("points"),f.points){var ot=t.points,st=ot.numberOfItems;f.points=new Array(st);for(var lt=0;lt0;)n.push(n.shift()),a--;var r=0;for(t in selectorManager_.selectorGrips)selectorManager_.selectorGrips[t].setAttribute("style","cursor:"+n[r]+"-resize"),r++}},{key:"showGrips",value:function(e){var t=e?"inline":"none";selectorManager_.selectorGripsGroup.setAttribute("display",t);var n=this.selectedElement;this.hasGrips=e,n&&e&&(this.selectorGroup.append(selectorManager_.selectorGripsGroup),this.updateGripCursors(getRotationAngle(n)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=selectorManager_,a=n.selectorGrips,r=this.selectedElement,i=r.getAttribute("stroke-width"),o=svgFactory_.getCurrentZoom(),s=1/o;"none"===r.getAttribute("stroke")||isNaN(i)||(s+=i/2);var l=r.tagName;"text"===l&&(s+=2/o);var c=getTransformList(r),u=transformListToTransform(c).matrix;if(u.e*=o,u.f*=o,e||(e=getBBox(r)),"g"===l&&!$$8.data(r,"gsvg")){var d=getStrokedBBox([r.childNodes]);d&&(e=d)}var h=e.x,g=e.y,p=e.width,f=e.height;e={x:h,y:g,width:p,height:f},s*=o;var v=transformBox(h*o,g*o,p*o,f*o,u),m=v.aabox,_=m.x-s,b=m.y-s,y=m.width+2*s,x=m.height+2*s,C=_+y/2,S=b+x/2,w=getRotationAngle(r);if(w){var $=svgFactory_.svgRoot().createSVGTransform();$.setRotate(-w,C,S);var k=$.matrix;v.tl=transformPoint(v.tl.x,v.tl.y,k),v.tr=transformPoint(v.tr.x,v.tr.y,k),v.bl=transformPoint(v.bl.x,v.bl.y,k),v.br=transformPoint(v.br.x,v.br.y,k);var A=v.tl,E=A.x,P=A.y,T=A.x,G=A.y,N=Math.min,L=Math.max;_=E=N(E,N(v.tr.x,N(v.bl.x,v.br.x)))-s,b=P=N(P,N(v.tr.y,N(v.bl.y,v.br.y)))-s,y=(T=L(T,L(v.tr.x,L(v.bl.x,v.br.x)))+s)-E,x=(G=L(G,L(v.tr.y,L(v.bl.y,v.br.y)))+s)-P}var I="M"+_+","+b+" L"+(_+y)+","+b+" "+(_+y)+","+(b+x)+" "+_+","+(b+x)+"z";t.setAttribute("d",I);var M=w?"rotate("+[w,C,S].join(",")+")":"";for(var R in this.selectorGroup.setAttribute("transform",M),this.gripCoords={nw:[_,b],ne:[_+y,b],sw:[_,b+x],se:[_+y,b+x],n:[_+y/2,b],w:[_,b+x/2],e:[_+y,b+x/2],s:[_+y/2,b+x]},this.gripCoords){var O=this.gripCoords[R];a[R].setAttribute("cx",O[0]),a[R].setAttribute("cy",O[1])}n.rotateGripConnector.setAttribute("x1",_+y/2),n.rotateGripConnector.setAttribute("y1",b),n.rotateGripConnector.setAttribute("x2",_+y/2),n.rotateGripConnector.setAttribute("y2",b-5*gripRadius),n.rotateGrip.setAttribute("cx",_+y/2),n.rotateGrip.setAttribute("cy",b-5*gripRadius)}}]),e}(),SelectorManager=function(){function e(){classCallCheck(this,e),this.selectorParentGroup=null,this.rubberBandBox=null,this.selectors=[],this.selectorMap={},this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.selectorGripsGroup=null,this.rotateGripConnector=null,this.rotateGrip=null,this.initGroup()}return createClass(e,[{key:"initGroup",value:function(){for(var e in this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=svgFactory_.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=svgFactory_.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),svgFactory_.svgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,this.selectorGrips){var t=svgFactory_.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+e,fill:"#22C",r:gripRadius,style:"cursor:"+e+"-resize","stroke-width":2,"pointer-events":"all"}});$$8.data(t,"dir",e),$$8.data(t,"type","resize"),this.selectorGrips[e]=this.selectorGripsGroup.appendChild(t)}if(this.rotateGripConnector=this.selectorGripsGroup.appendChild(svgFactory_.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(svgFactory_.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:gripRadius,stroke:"#22C","stroke-width":2,style:"cursor:url("+config_.imgPath+"rotate.png) 12 12, auto;"}})),$$8.data(this.rotateGrip,"type","rotate"),!$$8("#canvasBackground").length){var n=config_.dimensions,a=svgFactory_.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:n[0],height:n[1],x:0,y:0,overflow:isWebkit()?"none":"visible",style:"pointer-events:none"}}),r=svgFactory_.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});a.append(r),svgFactory_.svgRoot().insertBefore(a,svgFactory_.svgContent())}}},{key:"requestSelector",value:function(e,t){if(null==e)return null;var n=this.selectors.length;if("object"===_typeof(this.selectorMap[e.id]))return this.selectorMap[e.id].locked=!0,this.selectorMap[e.id];for(var a=0;a').documentElement,!0);t.append(s);var l=o.createElementNS(NS.SVG,"svg");(i.clearSvgContentElement=function(){$$9(l).empty(),$$9(l).attr({id:"svgcontent",width:r[0],height:r[1],x:r[0],y:r[1],overflow:a.show_outside_canvas?"visible":"hidden",xmlns:NS.SVG,"xmlns:se":NS.SE,"xmlns:xlink":NS.XLINK}).appendTo(s);var e=o.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");l.append(e)})();var c="svg_";i.setIdPrefix=function(e){c=e},i.current_drawing_=new Drawing(l,c);var u=i.getCurrentDrawing=function(){return i.current_drawing_},d=1,h=null,g={shape:{fill:("none"===a.initFill.color?"":"#")+a.initFill.color,fill_paint:null,fill_opacity:a.initFill.opacity,stroke:"#"+a.initStroke.color,stroke_paint:null,stroke_opacity:a.initStroke.opacity,stroke_width:a.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:a.initOpacity}};g.text=$$9.extend(!0,{},g.shape),$$9.extend(g.text,{fill:"#000000",stroke_width:a.text&&a.text.stroke_width,font_size:a.text&&a.text.font_size,font_family:a.text&&a.text.font_family});var p=g.shape,f=[],v=this.getJsonFromSvgElement=function(e){if(3===e.nodeType)return e.nodeValue;for(var t,n={element:e.tagName,attr:{},children:[]},a=0;t=e.attributes[a];a++)n.attr[t.name]=t.value;for(var r,i=0;r=e.childNodes[i];i++)n.children[i]=v(r);return n},m=this.addSvgElementFromJson=function(e){if("string"==typeof e)return o.createTextNode(e);var t=getElem(e.attr.id),n=u().getCurrentLayer();if(t&&e.element!==t.tagName&&(t.remove(),t=null),!t){var a=e.namespace||NS.SVG;t=o.createElementNS(a,e.element),n&&(h||n).append(t)}return e.curStyles&&assignAttributes(t,{fill:p.fill,stroke:p.stroke,"stroke-width":p.stroke_width,"stroke-dasharray":p.stroke_dasharray,"stroke-linejoin":p.stroke_linejoin,"stroke-linecap":p.stroke_linecap,"stroke-opacity":p.stroke_opacity,"fill-opacity":p.fill_opacity,opacity:p.opacity/2,style:"pointer-events:inherit"},100),assignAttributes(t,e.attr,100),cleanupElement(t),e.children&&e.children.forEach(function(e){t.append(m(e))}),t};i.getTransformList=getTransformList,i.matrixMultiply=matrixMultiply,i.hasMatrixTransform=hasMatrixTransform,i.transformListToTransform=transformListToTransform,init({getBaseUnit:function(){return a.baseUnit},getElement:getElem,getHeight:function(){return l.getAttribute("height")/d},getWidth:function(){return l.getAttribute("width")/d},getRoundDigits:function(){return F.round_digits}}),i.convertToNum=convertToNum;var _=function(){return l},b=this.getSelectedElems=function(){return f},y=pathActions;init$2({pathActions:y,getSVGContent:_,addSvgElementFromJson:m,getSelectedElements:b,getDOMDocument:function(){return o},getDOMContainer:function(){return t},getSVGRoot:function(){return s},getBaseUnit:function(){return a.baseUnit},getSnappingStep:function(){return a.snappingStep}}),i.findDefs=findDefs,i.getUrlFromAttr=getUrlFromAttr,i.getHref=getHref,i.setHref=setHref,i.getBBox=getBBox,i.getRotationAngle=getRotationAngle,i.getElem=getElem,i.getRefElem=getRefElem,i.assignAttributes=assignAttributes,this.cleanupElement=cleanupElement;var x=function(){return a.gridSnapping};init$4({getDrawing:function(){return u()},getSVGRoot:function(){return s},getGridSnapping:x}),this.remapElement=remapElement,init$5({getSVGRoot:function(){return s},getStartTransform:function(){return X},setStartTransform:function(e){X=e}}),this.recalculateDimensions=recalculateDimensions;var C=getReverseNS();i.sanitizeSvg=sanitizeSvg;var S=i.undoMgr=new UndoManager$1({handleHistoryEvent:function(e,t){var n=HistoryEventTypes$1;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)i.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var a=t.elements();i.pathActions.clear(),T("changed",a);var r=t.type(),o=e===n.AFTER_APPLY;if(r===MoveElementCommand$1.type())(o?t.newParent:t.oldParent)===l&&identifyLayers();else if(r===InsertElementCommand$1.type()||r===RemoveElementCommand$1.type())t.parent===l&&identifyLayers(),r===InsertElementCommand$1.type()?o&&j(t.elem):o||j(t.elem),"use"===t.elem.tagName&&Me(t.elem);else if(r===ChangeElementCommand$1.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===l&&identifyLayers();var s=o?t.newValues:t.oldValues;s.stdDeviation&&i.setBlurOffsets(t.elem.parentNode,s.stdDeviation)}}}}),w=function(e){i.undoMgr.addCommandToHistory(e)},$=this.getZoom=function(){return d},k=this.round=function(e){return parseInt(e*d,10)/d};init$6(a,{createSVGElement:function(e){return i.addSvgElementFromJson(e)},svgRoot:function(){return s},svgContent:function(){return l},getCurrentZoom:$});var A=this.selectorManager=getSelectorManager(),E=i.getNextId=function(){return u().getNextId()},P=i.getId=function(){return u().getId()},T=function(e,t){if(se[e])return se[e](window,t)},G=function(e){f.map(function(e){null!=e&&A.releaseSelector(e)}),f=[],e||T("selected",f)},N=function(e,t){if(e.length){for(var n=0;n1&&o.showGrips(!1)}}}for(T("selected",f),t||1===f.length?A.requestSelector(f[0]).showGrips(!0):A.requestSelector(f[0]).showGrips(!1),f.sort(function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):null==e?1:void 0});null==f[0];)f.shift(0)}},L=function(){return p.opacity},I=this.getMouseTarget=function(e){if(null==e)return null;var n=e.target;if(n.correspondingUseElement&&(n=n.correspondingUseElement),[NS.MATH,NS.HTML].includes(n.namespaceURI)&&"svgcanvas"!==n.id)for(;"foreignObject"!==n.nodeName;)if(!(n=n.parentNode))return s;var a=u().getCurrentLayer();if([s,t,l,a].includes(n))return s;if($$9(n).closest("#selectorParentGroup").length)return A.selectorParentGroup;for(;n.parentNode!==(h||a);)n=n.parentNode;return n};i.pathActions=y,init$1({selectorManager:A,canvas:i,call:T,resetD:function(e){e.setAttribute("d",y.convertPath(e))},round:k,clearSelection:G,addToSelection:N,addCommandToHistory:w,remapElement:remapElement,addSvgElementFromJson:m,getGridSnapping:x,getOpacity:L,getSelectedElements:b,getContainer:function(){return t},setStarted:function(e){Y=e},getRubberBox:function(){return ee},setRubberBox:function(e){return ee=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;y.canDeleteNodes=!0,y.closed_subpath=t,T("pointsAdded",{closedSubpath:t,grips:n}),T("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;w(t),T("changed",[n])},getCurrentZoom:$,getId:P,getNextId:E,getMouseTarget:I,getCurrentMode:function(){return K},setCurrentMode:function(e){return K=e},getDrawnPath:function(){return Pe},setDrawnPath:function(e){return Pe=e},getSVGRoot:function(){return s}});var M={},R="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",O=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],B=$$9.data,V=document.createElementNS(NS.SVG,"animate");$$9(V).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(s);var j=function e(t){var n=$$9(t).attr(O);for(var a in n){var r=n[a];if(r&&r.startsWith("url(")){var i=getUrlFromAttr(r).substr(1);getElem(i)||(findDefs().append(q[i]),delete q[i])}}var o=t.getElementsByTagName("*");if(o.length)for(var s=0,l=o.length;s0&&(4===l.getItem(0).type&&l.removeItem(0));if(0!==e){var c=transformPoint(i,o,transformListToTransform(l).matrix),u=s.createSVGTransform();u.setRotate(e,c.x,c.y),l.numberOfItems?l.insertItemBefore(u,0):l.appendItem(u)}else 0===l.numberOfItems&&n.removeAttribute("transform");if(!t){var d=n.getAttribute("transform");n.setAttribute("transform",a),Ue("transform",d,f),T("changed",f)}var h=A.requestSelector(f[0]);h.resize(),h.updateGripCursors(e)};var ce=this.recalculateAllSelectedDimensions=function(){for(var e=new BatchCommand$1("none"===Q?"position":"size"),t=f.length;t--;){var n=f[t],a=recalculateDimensions(n);a&&e.addSubCommand(a)}e.isEmpty()||(w(e),T("changed",f))},ue=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},de=null;this.clearSelection=G,this.addToSelection=N;var he=this.selectOnly=function(e,t){G(!0),N(e,t)};this.removeFromSelection=function(e){if(null!=f[0]&&e.length){var t=0,n=[],a=f.length;n.length=a;for(var r=0;r0&&i.removeFromSelection(G),N.length>0&&i.addToSelection(N);break;case"resize":$=getTransformList(p);var R=hasMatrixTransform($),O=(g=R?be:getBBox(p)).x,B=g.y,V=g,j=V.width,D=V.height;if(l=C-fe,c=w-ve,a.gridSnapping&&(l=snapToGrid(l),c=snapToGrid(c),D=snapToGrid(D),j=snapToGrid(j)),h=getRotationAngle(p)){var F=Math.sqrt(l*l+c*c),U=Math.atan2(c,l)-h*Math.PI/180;l=F*Math.cos(U),c=F*Math.sin(U)}Q.includes("n")||Q.includes("s")||(c=0),Q.includes("e")||Q.includes("w")||(l=0);var H=0,z=0,q=D?(D+c)/D:1,W=j?(j+l)/j:1;Q.includes("n")&&(q=D?(D-c)/D:1,z=D),Q.includes("w")&&(W=j?(j-l)/j:1,H=j);var X=s.createSVGTransform(),Z=s.createSVGTransform(),J=s.createSVGTransform();if(a.gridSnapping&&(O=snapToGrid(O),H=snapToGrid(H),B=snapToGrid(B),z=snapToGrid(z)),X.setTranslate(-(O+H),-(B+z)),e.shiftKey&&(1===W?W=q:q=W),Z.setScale(W,q),J.setTranslate(O+H,B+z),R){var te=h?1:0;$.replaceItem(X,2+te),$.replaceItem(Z,1+te),$.replaceItem(J,Number(te))}else{var ne=$.numberOfItems;$.replaceItem(J,ne-3),$.replaceItem(Z,ne-2),$.replaceItem(X,ne-1)}A.requestSelector(p).resize(),T("transition",f);break;case"zoom":x*=d,S*=d,assignAttributes(ee,{x:Math.min(me*d,x),y:Math.min(_e*d,S),width:Math.abs(x-me*d),height:Math.abs(S-_e*d)},100);break;case"text":assignAttributes(b,{x:C,y:w},1e3);break;case"line":a.gridSnapping&&(C=snapToGrid(C),w=snapToGrid(w));var ie=C,oe=w;e.shiftKey&&(ie=(n=snapToAngle(fe,ve,ie,oe)).x,oe=n.y),b.setAttributeNS(null,"x2",ie),b.setAttributeNS(null,"y2",oe);break;case"foreignObject":case"square":case"rect":case"image":var se="square"===K||e.shiftKey,le=Math.abs(C-fe),ce=Math.abs(w-ve),ue=void 0,he=void 0;se?(le=ce=Math.max(le,ce),ue=fe.8&&(pe+=+$e.x+","+$e.y+" ",b.setAttributeNS(null,"points",pe),ye-=.8);xe={x:Ce.x,y:Ce.y},Ce={x:Se.x,y:Se.y},Se={x:we.x,y:we.y};break;case"path":case"pathedit":if(C*=d,w*=d,a.gridSnapping&&(C=snapToGrid(C),w=snapToGrid(w),fe=snapToGrid(fe),ve=snapToGrid(ve)),e.shiftKey){var Ie=path,Me=void 0,Re=void 0;Ie?(Me=Ie.dragging?Ie.dragging[0]:fe,Re=Ie.dragging?Ie.dragging[1]:ve):(Me=fe,Re=ve);var Oe=n=snapToAngle(Me,Re,C,w);C=Oe.x,w=Oe.y}ee&&"none"!==ee.getAttribute("display")&&(x*=d,S*=d,assignAttributes(ee,{x:Math.min(me*d,x),y:Math.min(_e*d,S),width:Math.abs(x-me*d),height:Math.abs(S-_e*d)},100)),y.mouseMove(C,w);break;case"textedit":C*=d,w*=d,Te.mouseMove(m,_);break;case"rotate":r=(g=getBBox(p)).x+g.width/2,o=g.y+g.height/2;var Be=getMatrix(p),Ve=transformPoint(r,o,Be);r=Ve.x,o=Ve.y,h=(Math.atan2(o-w,r-C)*(180/Math.PI)-90)%360,a.gridSnapping&&(h=snapToGrid(h)),e.shiftKey&&(h=45*Math.round(h/45)),i.setRotationAngle(h<-180?360+h:h,!0),T("transition",f)}ae("mouseMove",{event:e,mouse_x:m,mouse_y:_,selected:p})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==h){var n=I(e),a=n.tagName;if("text"===a&&"textedit"!==K){var r=transformPoint(e.pageX,e.pageY,de);Te.select(n,r.x,r.y)}"g"!==a&&"a"!==a||!getRotationAngle(n)||(He(n),n=f[0],G(!0)),h&&leaveContext(),"g"!==t.tagName&&"a"!==t.tagName||t===u().getCurrentLayer()||n===A.selectorParentGroup||setContext(n)}}).mouseup(function(e){if(2!==e.button){var t=J;if(J=null,Y){var n=transformPoint(e.pageX,e.pageY,de),r=n.x*d,o=n.y*d,s=r/d,l=o/d,c=getElem(P()),h=!1,g=s,v=l;Y=!1;var _=void 0,b=void 0;switch(K){case"resize":case"multiselect":null!=ee&&(ee.setAttribute("display","none"),te=[]),K="select";case"select":if(null!=f[0]){if(null==f[1]){var x=f[0];switch(x.tagName){case"g":case"use":case"image":case"foreignObject":break;default:Z.fill=x.getAttribute("fill"),Z.fill_opacity=x.getAttribute("fill-opacity"),Z.stroke=x.getAttribute("stroke"),Z.stroke_opacity=x.getAttribute("stroke-opacity"),Z.stroke_width=x.getAttribute("stroke-width"),Z.stroke_dasharray=x.getAttribute("stroke-dasharray"),Z.stroke_linejoin=x.getAttribute("stroke-linejoin"),Z.stroke_linecap=x.getAttribute("stroke-linecap")}"text"===x.tagName&&(H.font_size=x.getAttribute("font-size"),H.font_family=x.getAttribute("font-family")),A.requestSelector(x).showGrips(!0)}if(ce(),g!==me||v!==_e)for(var C=f.length,S=0;S=0?E.indexOf(",",G+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)&&(c=y.smoothPolylineIntoPath(c));break;case"line":_=$$9(c).attr(["x1","x2","y1","y2"]),h=_.x1!==_.x2||_.y1!==_.y2;break;case"foreignObject":case"square":case"rect":case"image":_=$$9(c).attr(["width","height"]),h="0"!==_.width||"0"!==_.height||"image"===K;break;case"circle":h="0"!==c.getAttribute("r");break;case"ellipse":_=$$9(c).attr(["rx","ry"]),h=null!=_.rx||null!=_.ry;break;case"fhellipse":ge.maxx-ge.minx>0&&ge.maxy-ge.miny>0&&(c=m({element:"ellipse",curStyles:!0,attr:{cx:(ge.minx+ge.maxx)/2,cy:(ge.miny+ge.maxy)/2,rx:(ge.maxx-ge.minx)/2,ry:(ge.maxy-ge.miny)/2,id:P()}}),T("changed",[c]),h=!0);break;case"fhrect":ge.maxx-ge.minx>0&&ge.maxy-ge.miny>0&&(c=m({element:"rect",curStyles:!0,attr:{x:ge.minx,y:ge.miny,width:ge.maxx-ge.minx,height:ge.maxy-ge.miny,id:P()}}),T("changed",[c]),h=!0);break;case"text":h=!0,he([c]),Te.start(c);break;case"path":c=null,Y=!0;var N=y.mouseUp(e,c,r,o);c=N.element,h=N.keep;break;case"pathedit":h=!0,c=null,y.mouseUp(e);break;case"textedit":h=!1,c=null,Te.mouseUp(e,r,o);break;case"rotate":h=!0,c=null,K="select";var L=i.undoMgr.finishUndoableChange();L.isEmpty()||w(L),ce(),T("changed",f)}var I=ae("mouseUp",{event:e,mouse_x:r,mouse_y:o},!0);if($$9.each(I,function(e,t){t&&(h=t.keep||h,c=t.element,Y=t.started||Y)}),h||null==c){if(null!=c){i.addedNew=!0;var M=.2,R=void 0;if(V.beginElement&&parseFloat(c.getAttribute("opacity"))!==p.opacity){R=$$9(V).clone().attr({to:p.opacity,dur:M}).appendTo(c);try{R[0].beginElement()}catch(e){}}else M=0;setTimeout(function(){R&&R.remove(),c.setAttribute("opacity",p.opacity),c.setAttribute("style","pointer-events:inherit"),cleanupElement(c),"path"===K?y.toEditMode(c):a.selectNew&&he([c],!0),w(new InsertElementCommand$1(c)),T("changed",[c])},1e3*M)}}else{for(u().releaseId(P()),c.remove(),c=null,b=e.target;b&&b.parentNode&&b.parentNode.parentNode&&"g"===b.parentNode.parentNode.tagName;)b=b.parentNode;"path"===K&&Pe||!b||!b.parentNode||"selectorParentGroup"===b.parentNode.id||"svgcanvas"===b.id||"svgroot"===b.id||(i.setMode("select"),he([b],!0))}X=null}}}),$$9(t).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;de=$$9("#svgcontent g")[0].getScreenCTM().inverse();var n=$$9("#workarea"),r=a.showRulers?16:0,o=transformPoint(t.pageX,t.pageY,de),s=n.width(),l=n.height(),c=s-15-r,u=l-15-r,h=c*de.a,g=u*de.d,p=n.offset(),f=p.left+r,v=p.top+r,m=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(m){var _=Math.max(.75,Math.min(4/3,m)),b=void 0,y=void 0;_>1?(b=Math.ceil(c/h*_*100)/100,y=Math.ceil(u/g*_*100)/100):(b=Math.floor(c/h*_*100)/100,y=Math.floor(u/g*_*100)/100);var x=Math.min(b,y);if((x=Math.min(10,Math.max(.01,x)))!==d){_=x/d;var C=transformPoint(f,v,de),S={x:(o.x-(o.x-C.x)/_)*x-r+s/2,y:(o.y-(o.y-C.y)/_)*x-r+l/2};i.setZoom(x),$$9("#zoom").val((100*x).toFixed(1)),T("updateCanvas",{center:!1,newCtr:S}),T("zoomDone")}}}});var Te=i.textActions=function(){var e=void 0,t=void 0,n=void 0,a=void 0,r=void 0,o=[],l=void 0,c=void 0,u=void 0,h=void 0,g=void 0;function p(e){var i=""===t.value;if($$9(t).focus(),!arguments.length)if(i)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var s=o[e];i||t.setSelectionRange(e,e),(n=getElem("text_cursor"))||(n=document.createElementNS(NS.SVG,"line"),assignAttributes(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=getElem("selectorParentGroup").appendChild(n)),r||(r=setInterval(function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")},600));var c=x(s.x,l.y),u=x(s.x,l.y+l.height);assignAttributes(n,{x1:c.x,y1:c.y,x2:u.x,y2:u.y,visibility:"visible",display:"inline"}),a&&a.setAttribute("d","")}function v(e,r,i){if(e!==r){i||t.setSelectionRange(e,r),(a=getElem("text_selectblock"))||(a=document.createElementNS(NS.SVG,"path"),assignAttributes(a,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),getElem("selectorParentGroup").append(a));var s=o[e],c=o[r];n.setAttribute("visibility","hidden");var u=x(s.x,l.y),d=x(s.x+(c.x-s.x),l.y),h=x(s.x,l.y+l.height),g=x(s.x+(c.x-s.x),l.y+l.height),f="M"+u.x+","+u.y+" L"+d.x+","+d.y+" "+g.x+","+g.y+" "+h.x+","+h.y+"z";assignAttributes(a,{d:f,display:"inline"})}else p(r)}function m(t,n){var a=s.createSVGPoint();if(a.x=t,a.y=n,1===o.length)return 0;var r=e.getCharNumAtPosition(a);r<0?(r=o.length-2,t<=o[0].x&&(r=0)):r>=o.length-2&&(r=o.length-2);var i=o[r];return t>i.x+i.width/2&&r++,r}function _(e,t){p(m(e,t))}function b(e,n,a){var r=t.selectionStart,i=m(e,n);v(Math.min(r,i),Math.max(r,i),!a)}function y(e,t){var n={x:e,y:t};if(n.x/=d,n.y/=d,c){var a=transformPoint(n.x,n.y,c.inverse());n.x=a.x,n.y=a.y}return n}function x(e,t){var n={x:e,y:t};if(c){var a=transformPoint(n.x,n.y,c);n.x=a.x,n.y=a.y}return n.x*=d,n.y*=d,n}function C(t){v(0,e.textContent.length),$$9(this).unbind(t)}function S(t){if(g&&e){var n=transformPoint(t.pageX,t.pageY,de),a=y(n.x*d,n.y*d),r=m(a.x,a.y),i=e.textContent,o=i.substr(0,r).replace(/[a-z0-9]+$/i,"").length,s=i.substr(r).match(/^[a-z0-9]+/i);v(o,(s?s[0].length:0)+r),$$9(t.target).click(C),setTimeout(function(){$$9(t.target).unbind("click",C)},300)}}return{select:function(t,n,a){e=t,Te.toEditMode(n,a)},start:function(t){e=t,Te.toEditMode()},mouseDown:function(e,n,a,r){var i=y(a,r);t.focus(),_(i.x,i.y),u=a,h=r},mouseMove:function(e,t){var n=y(e,t);b(n.x,n.y)},mouseUp:function(t,n,a){var r=y(n,a);b(r.x,r.y,!0),t.target!==e&&nu-2&&ah-2&&Te.toSelectMode(!0)},setCursor:p,toEditMode:function(t,n){if(g=!1,K="textedit",A.requestSelector(e).showGrips(!1),A.requestSelector(e),Te.init(),$$9(e).css("cursor","text"),arguments.length){var a=y(t,n);_(a.x,a.y)}else p();setTimeout(function(){g=!0},300)},toSelectMode:function(o){K="select",clearInterval(r),r=null,a&&$$9(a).attr("display","none"),n&&$$9(n).attr("visibility","hidden"),$$9(e).css("cursor","move"),o&&(G(),$$9(e).css("cursor","move"),T("selected",[e]),N([e],!0)),e&&!e.textContent.length&&i.deleteSelectedElements(),$$9(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===K&&Te.toSelectMode()},init:function(n){if(e){var a=void 0,r=void 0;e.parentNode||(e=f[0],A.requestSelector(e).showGrips(!1));var s=e.textContent.length,u=e.getAttribute("transform");for(l=getBBox(e),c=u?getMatrix(e):null,(o=[]).length=s,t.focus(),$$9(e).unbind("dblclick",S).dblclick(S),s||(r={x:l.x+l.width/2,width:0}),a=0;a")[0].getContext("2d")||(n.text=M.exportNoText),$$9.each(n,function(n,r){a.find(n).length&&(t.push(n),e.push(r))}),{issues:e,issueCodes:t}}this.svgCanvasToString=function(){for(;Ge()>0;);y.clear(!0),$$9.each(l.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&l.firstChild.before(t)}),h&&(leaveContext(),he([h]));var e=[];$$9(l).find("g:data(gsvg)").each(function(){for(var t=this.attributes,n=t.length,a=0;at.name?-1:1}),s=0;s=0;s--){var f=o[s],v=toXml(f.value);if(!p.includes(f.localName)&&""!==v){if(v.startsWith("pointer-events"))continue;if("class"===f.localName&&v.startsWith("se_"))continue;if(n.push(" "),"d"===f.localName&&(v=y.convertPath(e,!0)),isNaN(v)?i.test(v)&&(v=shortFloat(v)+r):v=shortFloat(v),F.apply&&"image"===e.nodeName&&"href"===f.localName&&F.images&&"embed"===F.images){var m=D[v];m&&(v=m)}f.namespaceURI&&f.namespaceURI!==NS.SVG&&!C[f.namespaceURI]||(n.push(f.nodeName),n.push('="'),n.push(v),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;var _=!1;for(s=0;s");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(b.data),n.push("--\x3e")}}if(t--,!_)for(n.push("\n"),s=0;s")}else n.push("/>")}return n.join("")},this.embedImage=function(e,t){$$9(new Image).load(function(){var n=document.createElement("canvas");n.width=this.width,n.height=this.height,n.getContext("2d").drawImage(this,0,0);try{var a=";svgedit_url="+encodeURIComponent(e);a=n.toDataURL().replace(";base64",a+";base64"),D[e]=a}catch(t){D[e]=!1}W=e,t&&t(D[e])}).attr("src",e)},this.setGoodImage=function(e){W=e},this.open=function(){},this.save=function(e){G(),e&&$$9.extend(F,e),F.apply=!0;var t=this.svgCanvasToString();T("saved",t)};var Le=void 0;this.rasterExport=function(e,t,n,r){var o,s=this,l="image/"+e.toLowerCase(),c=Ne(),u=c.issues,d=c.issueCodes,h=this.svgCanvasToString();return new Promise((o=asyncToGenerator(regeneratorRuntime.mark(function o(c,g){var p,f,v,m,_,b,y;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(y=function(){var a={datauri:_,bloburl:b,svg:h,issues:u,issueCodes:d,type:e,mimeType:l,quality:t,exportWindowName:n};T("exported",a),r&&r(a),c(a)},Le){o.next=6;break}return o.next=4,importSetGlobal(a.canvgPath+"canvg.js",{global:"canvg"});case 4:p=o.sent,Le=p.canvg;case 6:return f=e||"PNG",$$9("#export_canvas").length||$$9("",{id:"export_canvas"}).hide().appendTo("body"),(v=$$9("#export_canvas")[0]).width=i.contentW,v.height=i.contentH,o.next=13,Le(v,h);case 13:if(m=("ICO"===f?"BMP":f).toLowerCase(),_=t?v.toDataURL("image/"+m,t):v.toDataURL("image/"+m),b=void 0,!v.toBlob){o.next=19;break}return v.toBlob(function(e){b=createObjectURL(e),y()},l,t),o.abrupt("return");case 19:b=dataURLToObjectURL(_),y();case 21:case"end":return o.stop()}},o,s)})),function(e,t){return o.apply(this,arguments)}))},this.exportPDF=function(e,t,n){var r,i=this,o=this;return new Promise((r=asyncToGenerator(regeneratorRuntime.mark(function r(s,l){var c,u,d,h,g,p,f,v,m,_,b;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(window.jsPDF){r.next=6;break}return r.next=3,importScript(["jspdf/underscore-min.js","jspdf/jspdf.min.js"]);case 3:return c=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules),r.next=6,importScript(a.jspdfPath+"jspdf.plugin.svgToPdf.js",{type:c?"module":"text/javascript"});case 6:u=Be(),d=u.w>u.h?"landscape":"portrait",h=jsPDF({orientation:d,unit:"pt",format:[u.w,u.h]}),g=Ve(),h.setProperties({title:g}),p=Ne(),f=p.issues,v=p.issueCodes,m=o.svgCanvasToString(),h.addSVG(m,0,0),(_={svg:m,issues:f,issueCodes:v,exportWindowName:e})[b=t||"dataurlstring"]=h.output(b),n&&n(_),s(_),T("exportedPDF",_);case 21:case"end":return r.stop()}},r,i)})),function(e,t){return r.apply(this,arguments)}))},this.getSvgString=function(){return F.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?randomizeIds(!1,u()):randomizeIds(!0,u())};var Ie=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var a in walkTree(e,function(e){if(1===e.nodeType){e.id&&(e.id in t||(t[e.id]={elem:null,attrs:[],hrefs:[]}),t[e.id].elem=e),$$9.each(O,function(n,a){var r=e.getAttributeNode(a);if(r){var i=getUrlFromAttr(r.value),o=i?i.substr(1):null;o&&(o in t||(t[o]={elem:null,attrs:[],hrefs:[]}),t[o].attrs.push(r))}});var a=getHref(e);if(a&&n.includes(e.nodeName)){var r=a.substr(1);r&&(r in t||(t[r]={elem:null,attrs:[],hrefs:[]}),t[r].hrefs.push(e))}}}),t)if(a){var r=t[a].elem;if(r){var i=E();r.id=i;for(var o=t[a].attrs,s=o.length;s--;){var l=o[s];l.ownerElement.setAttribute(l.name,"url(#"+i+")")}for(var c=t[a].hrefs,u=c.length;u--;){var d=c[u];setHref(d,"#"+i)}}}},Me=this.setUseData=function(e){var t=$$9(e);"use"!==e.tagName&&(t=t.find("use")),t.each(function(){var e=getHref(this).substr(1),t=getElem(e);t&&($$9(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||$$9(this).data("symbol",t).data("ref",t))})},Re=this.convertGradients=function(e){var t=$$9(e).find("linearGradient, radialGradient");!t.length&&isWebkit()&&(t=$$9(e).find("*").filter(function(){return this.tagName.includes("Gradient")})),t.each(function(){if("userSpaceOnUse"===$$9(this).attr("gradientUnits")){var e=$$9(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=getBBox(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=$$9(this).attr(["x1","y1","x2","y2"]),a=this.gradientTransform.baseVal;if(a&&a.numberOfItems>0){var r=transformListToTransform(a).matrix,i=transformPoint(n.x1,n.y1,r),o=transformPoint(n.x2,n.y2,r);n.x1=i.x,n.y1=i.y,n.x2=o.x,n.y2=o.y,this.removeAttribute("gradientTransform")}$$9(this).attr({x1:(n.x1-t.x)/t.width,y1:(n.y1-t.y)/t.height,x2:(n.x2-t.x)/t.width,y2:(n.y2-t.y)/t.height}),this.removeAttribute("gradientUnits")}}})},Oe=this.convertToGroup=function(e){e||(e=f[0]);var t=$$9(e),n=new BatchCommand$1,a=void 0;if(t.data("gsvg")){var r=e.firstChild,i=$$9(r).attr(["x","y"]);$$9(e.firstChild.firstChild).unwrap(),$$9(e).removeData("gsvg");var c=getTransformList(e),u=s.createSVGTransform();u.setTranslate(i.x,i.y),c.appendItem(u),recalculateDimensions(e),T("selected",[e])}else if(t.data("symbol")){e=t.data("symbol"),a=t.attr("transform");var d=t.attr(["x","y"]),h=e.getAttribute("viewBox");if(h){var g=h.split(" ");d.x-=+g[0],d.y-=+g[1]}a+=" translate("+(d.x||0)+","+(d.y||0)+")";var p=t.prev();n.addSubCommand(new RemoveElementCommand$1(t[0],t[0].nextSibling,t[0].parentNode)),t.remove();var v=$$9(l).find("use:data(symbol)").length,m=o.createElementNS(NS.SVG,"g"),_=e.childNodes,b=void 0;for(b=0;b<_.length;b++)m.append(_[b].cloneNode(!0));if(isGecko()){var y=$$9(findDefs()).children("linearGradient,radialGradient,pattern").clone();$$9(m).append(y)}a&&m.setAttribute("transform",a);var x=e.parentNode;if(Ie(m),isGecko()&&$$9(findDefs()).append($$9(m).find("linearGradient,radialGradient,pattern")),m.id=E(),p.after(m),x){if(!v){var C=e.nextSibling;e.remove(),n.addSubCommand(new RemoveElementCommand$1(e,C,x))}n.addSubCommand(new InsertElementCommand$1(m))}Me(m),isGecko()?Re(findDefs()):Re(m),walkTreePost(m,function(e){try{recalculateDimensions(e)}catch(e){console.log(e)}}),$$9(m).find(R).each(function(){this.id||(this.id=E())}),he([m]);var S=He(m,!0);S&&n.addSubCommand(S),w(n)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=text2xml(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==NS.SVG)return!1;this.prepareSvg(n);var r=new BatchCommand$1("Change Source"),h=l.nextSibling,g=s.removeChild(l);r.addSubCommand(new RemoveElementCommand$1(g,h,s)),l=o.adoptNode?o.adoptNode(n.documentElement):o.importNode(n.documentElement,!0),s.append(l);var p=$$9(l);i.current_drawing_=new Drawing(l,c);var f=u().getNonce();f?T("setnonce",f):T("unsetnonce"),p.find("image").each(function(){var e=this;preventClickDefault(e);var t=getHref(this);if(t){if(t.startsWith("data:")){var n=t.match(/svgedit_url=(.*?);/);if(n){var a=decodeURIComponent(n[1]);$$9(new Image).load(function(){e.setAttributeNS(NS.XLINK,"xlink:href",a)}).attr("src",a)}}i.embedImage(t)}}),p.find("svg").each(function(){if(!$$9(this).closest("defs").length){Ie(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?($$9(e).data("gsvg",this),e.id=e.id||E()):oe(this)}}),isGecko()&&p.find("linearGradient, radialGradient, pattern").appendTo(findDefs()),Me(p),Re(p[0]);var v={id:"svgcontent",overflow:a.show_outside_canvas?"visible":"hidden"},m=!1;if(p.attr("viewBox")){var _=p.attr("viewBox").split(" ");v.width=_[2],v.height=_[3]}else $$9.each(["width","height"],function(e,t){var n=p.attr(t)||"100%";"%"===String(n).substr(-1)?m=!0:v[t]=convertToNum(t,n)});if(identifyLayers(),p.children().find(R).each(function(){this.id||(this.id=E())}),m){var b=getStrokedBBoxDefaultVisible();v.width=b.width+b.x,v.height=b.height+b.y}v.width<=0&&(v.width=100),v.height<=0&&(v.height=100),p.attr(v),this.contentW=v.width,this.contentH=v.height,r.addSubCommand(new InsertElementCommand$1(l));var y=p.attr(["width","height"]);r.addSubCommand(new ChangeElementCommand$1(s,y)),d=1,resetListMap(),G(),clearData(),s.append(A.selectorParentGroup),t||w(r),T("changed",[l])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t=void 0,n=void 0,a=void 0;try{var r=encode64(e.length+e).substr(0,32),i=!1;U[r]&&$$9(U[r].symbol).parents("#svgroot").length&&(i=!0);var s=new BatchCommand$1("Import Image"),c=void 0;if(i)c=U[r].symbol,n=U[r].xform;else{var d=text2xml(e);this.prepareSvg(d);var g=void 0;g=o.adoptNode?o.adoptNode(d.documentElement):o.importNode(d.documentElement,!0),Ie(g);var p=convertToNum("width",g.getAttribute("width")),f=convertToNum("height",g.getAttribute("height")),v=g.getAttribute("viewBox"),m=v?v.split(" "):[0,0,p,f];for(t=0;t<4;++t)m[t]=+m[t];var _=+l.getAttribute("height");n="translate(0) "+(n=f>p?"scale("+_/3/m[3]+")":"scale("+_/3/m[2]+")")+" translate(0)",c=o.createElementNS(NS.SVG,"symbol");var b=findDefs();for(isGecko()&&$$9(g).find("linearGradient, radialGradient, pattern").appendTo(b);g.firstChild;){var y=g.firstChild;c.append(y)}for(var x=g.attributes,C=0;C0&&(n?Fe(e,t,a):(Ue(e,t,a),T("changed",a)))};var je=this.setGradient=function(e){if(Z[e+"_paint"]&&"solidColor"!==Z[e+"_paint"].type){var t=i[e+"Grad"],n=De(t),a=findDefs();n?t=n:(t=a.appendChild(o.importNode(t,!0))).id=E(),i.setColor(e,"url(#"+t.id+")")}},De=function(e){for(var t=findDefs(),n=$$9(t).find("linearGradient, radialGradient"),a=n.length,r=["r","cx","cy","fx","fy"];a--;){var i=n[a];if("linearGradient"===e.tagName){if(e.getAttribute("x1")!==i.getAttribute("x1")||e.getAttribute("y1")!==i.getAttribute("y1")||e.getAttribute("x2")!==i.getAttribute("x2")||e.getAttribute("y2")!==i.getAttribute("y2"))continue}else if("continue"===function(){var t=$$9(e).attr(r),n=$$9(i).attr(r),a=!1;if($$9.each(r,function(e,r){t[r]!==n[r]&&(a=!0)}),a)return"continue"}())continue;var o=e.getElementsByTagNameNS(NS.SVG,"stop"),s=i.getElementsByTagNameNS(NS.SVG,"stop");if(o.length===s.length){for(var l=o.length;l--;){var c=o[l],u=s[l];if(c.getAttribute("offset")!==u.getAttribute("offset")||c.getAttribute("stop-opacity")!==u.getAttribute("stop-opacity")||c.getAttribute("stop-color")!==u.getAttribute("stop-color"))break}if(-1===l)return i}}return null};this.setPaint=function(e,t){var n=new $$9.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),Z[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":i[e+"Grad"]=n[n.type],je(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return Z.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(K))i.setStrokeWidth(1);else{Z.stroke_width=e;for(var t=[],n=f.length;n--;){var a=f[n];a&&("g"===a.tagName?walkTree(a,r):t.push(a))}t.length>0&&(Ue("stroke-width",e,t),T("changed",f))}function r(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){p[e.replace("-","_")]=t;for(var n=[],a=f.length;a--;){var r=f[a];r&&("g"===r.tagName?walkTree(r,function(e){"g"!==e.nodeName&&n.push(e)}):n.push(r))}n.length>0&&(Ue(e,t,n),T("changed",f))},this.getStyle=function(){return p},this.getOpacity=L,this.setOpacity=function(e){p.opacity=e,Ue("opacity",e)},this.getFillOpacity=function(){return p.fill_opacity},this.getStrokeOpacity=function(){return p.stroke_opacity},this.setPaintOpacity=function(e,t,n){p[e+"_opacity"]=t,n?Fe(e+"-opacity",t):Ue(e+"-opacity",t)},this.getPaintOpacity=function(e){return"fill"===e?this.getFillOpacity():this.getStrokeOpacity()},this.getBlur=function(e){var t=0;if(e&&e.getAttribute("filter")){var n=getElem(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function a(){var n=i.undoMgr.finishUndoableChange();e.addSubCommand(n),w(e),e=null,t=null}i.setBlurNoUndo=function(e){if(t)if(0===e)Fe("filter",""),n=!0;else{var a=f[0];n&&Fe("filter","url(#"+a.id+"_blur)"),isWebkit()&&(console.log("e",a),a.removeAttribute("filter"),a.setAttribute("filter","url(#"+a.id+"_blur)")),Fe("stdDeviation",e,[t.firstChild]),i.setBlurOffsets(t,e)}else i.setBlur(e)},i.setBlurOffsets=function(e,t){t>3?assignAttributes(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):isWebkit()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},i.setBlur=function(n,r){if(e)a();else{var o=f[0],s=o.id;t=getElem(s+"_blur"),n-=0;var l=new BatchCommand$1;if(t)0===n&&(t=null);else{var c=m({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=m({element:"filter",attr:{id:s+"_blur"}})).append(c),findDefs().append(t),l.addSubCommand(new InsertElementCommand$1(t))}var u={filter:o.getAttribute("filter")};if(0===n)return o.removeAttribute("filter"),void l.addSubCommand(new ChangeElementCommand$1(o,u));Ue("filter","url(#"+s+"_blur)"),l.addSubCommand(new ChangeElementCommand$1(o,u)),i.setBlurOffsets(t,n),e=l,i.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),r&&(i.setBlurNoUndo(n),a())}}}(),this.getBold=function(){var e=f[0];return null!=e&&"text"===e.tagName&&null==f[1]&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=f[0];null!=t&&"text"===t.tagName&&null==f[1]&&Ue("font-weight",e?"bold":"normal"),f[0].textContent||Te.setCursor()},this.getItalic=function(){var e=f[0];return null!=e&&"text"===e.tagName&&null==f[1]&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=f[0];null!=t&&"text"===t.tagName&&null==f[1]&&Ue("font-style",e?"italic":"normal"),f[0].textContent||Te.setCursor()},this.getFontFamily=function(){return H.font_family},this.setFontFamily=function(e){H.font_family=e,Ue("font-family",e),f[0]&&!f[0].textContent&&Te.setCursor()},this.setFontColor=function(e){H.fill=e,Ue("fill",e)},this.getFontColor=function(){return H.fill},this.getFontSize=function(){return H.font_size},this.setFontSize=function(e){H.font_size=e,Ue("font-size",e),f[0].textContent||Te.setCursor()},this.getText=function(){var e=f[0];return null==e?"":e.textContent},this.setTextContent=function(e){Ue("#text",e),Te.init(e),Te.setCursor()},this.setImageURL=function(e){var t=f[0];if(t){var n=$$9(t).attr(["width","height"]),a=!n.width||!n.height,r=getHref(t);if(r!==e)a=!0;else if(!a)return;var i=new BatchCommand$1("Change Image URL");setHref(t,e),i.addSubCommand(new ChangeElementCommand$1(t,{"#href":r})),a?$$9(new Image).load(function(){var e=$$9(t).attr(["width","height"]);$$9(t).attr({width:this.width,height:this.height}),A.requestSelector(t).resize(),i.addSubCommand(new ChangeElementCommand$1(t,e)),w(i),T("changed",[t])}).attr("src",e):w(i)}},this.setLinkURL=function(e){var t=f[0];if(t){if("a"!==t.tagName){var n=$$9(t).parents("a");if(!n.length)return;t=n[0]}var a=getHref(t);if(a!==e){var r=new BatchCommand$1("Change Link URL");setHref(t,e),r.addSubCommand(new ChangeElementCommand$1(t,{"#href":a})),w(r)}}},this.setRectRadius=function(e){var t=f[0];if(null!=t&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),w(new ChangeElementCommand$1(t,{rx:n,ry:n},"Radius")),T("changed",[t]))}},this.makeHyperlink=function(e){i.groupSelectedElements("a",e)},this.removeHyperlink=function(){i.ungroupSelectedElement()},this.setSegType=function(e){y.setSegType(e)},this.convertToPath=function(e,t){if(null!=e){if(t)return getBBoxOfElementAsPath(e,m,y);var n={fill:p.fill,"fill-opacity":p.fill_opacity,stroke:p.stroke,"stroke-width":p.stroke_width,"stroke-dasharray":p.stroke_dasharray,"stroke-linejoin":p.stroke_linejoin,"stroke-linecap":p.stroke_linecap,"stroke-opacity":p.stroke_opacity,opacity:p.opacity,visibility:"hidden"};return convertToPath(e,n,m,y,G,N,history,w)}var a=f;$$9.each(a,function(e,t){t&&i.convertToPath(t)})};var Fe=function(e,t,n){"pathedit"===K&&y.moveNode(e,t);for(var a=(n=n||f).length,r=["g","polyline","path"],o=["transform","opacity","filter"],l=function(){var l=n[a];if(null==l)return"continue";if(("x"===e||"y"===e)&&r.includes(l.tagName)){var c=getStrokedBBoxDefaultVisible([l]),u="x"===e?t-c.x:0,h="y"===e?t-c.y:0;return i.moveSelectedElements(u*d,h*d,!0),"continue"}"g"===l.tagName&&o.includes(e);var g="#text"===e?l.textContent:l.getAttribute(e);if(null==g&&(g=""),g!==String(t)){"#text"===e?(l.textContent=t,/rotate/.test(l.getAttribute("transform"))&&(l=le(l))):"#href"===e?setHref(l,t):l.setAttribute(e,t),"textedit"===K&&"#text"!==e&&l.textContent.length&&Te.toSelectMode(l),isGecko()&&"text"===l.nodeName&&/rotate/.test(l.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&l.textContent)&&(l=le(l)),f.includes(l)&&setTimeout(function(){l.parentNode&&A.requestSelector(l).resize()},0);var p=getRotationAngle(l);if(0!==p&&"transform"!==e)for(var v=getTransformList(l),m=v.numberOfItems;m--;){if(4===v.getItem(m).type){v.removeItem(m);var _=getBBox(l),b=transformPoint(_.x+_.width/2,_.y+_.height/2,transformListToTransform(v).matrix),y=b.x,x=b.y,C=s.createSVGTransform();C.setRotate(p,y,x),v.insertItemBefore(C,m);break}}}};a--;)l()},Ue=this.changeSelectedAttribute=function(e,t,n){n=n||f,i.undoMgr.beginUndoableChange(e,n),Fe(e,t,n);var a=i.undoMgr.finishUndoableChange();a.isEmpty()||w(a)};this.deleteSelectedElements=function(){for(var e=new BatchCommand$1("Delete Elements"),t=f.length,n=[],a=0;a1&&(a=t);break;default:e="g",n="Group Elements"}var r=new BatchCommand$1(n),i=m({element:e,attr:{id:E()}});"a"===e&&setHref(i,a),r.addSubCommand(new InsertElementCommand$1(i));for(var o=f.length;o--;){var s=f[o];if(null!=s){"a"===s.parentNode.tagName&&1===s.parentNode.childNodes.length&&(s=s.parentNode);var l=s.nextSibling,c=s.parentNode;i.append(s),r.addSubCommand(new MoveElementCommand$1(s,l,c))}}r.isEmpty()||w(r),he([i],!0)};var He=this.pushGroupProperties=function(e,t){for(var n=e.childNodes,a=n.length,r=e.getAttribute("transform"),o=getTransformList(e),l=transformListToTransform(o).matrix,c=new BatchCommand$1("Push group properties"),d=getRotationAngle(e),h=$$9(e).attr(["filter","opacity"]),g=void 0,p=void 0,f=void 0,v=u(),m=0;mn[d].width)||("t"===e||"m"===e||"b"===e)&&(u===Number.MIN_VALUE||u>n[d].height))&&(r=n[d].x,s=n[d].y,o=n[d].x+n[d].width,l=n[d].y+n[d].height,c=n[d].width,u=n[d].height);break;case"largest":(("l"===e||"c"===e||"r"===e)&&(c===Number.MIN_VALUE||co&&(o=n[d].x+n[d].width),n[d].y+n[d].height>l&&(l=n[d].y+n[d].height)}}"page"===t&&(r=0,s=0,o=i.contentW,l=i.contentH);for(var g=new Array(a),p=new Array(a),v=0;v=r.length?t=0:t<0&&(t=r.length-1),a=r[t];break}he([a],!0),T("selected",f)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:w,setGradient:je,addSvgElementFromJson:m,assignAttributes:assignAttributes,BatchCommand:BatchCommand$1,call:T,ChangeElementCommand:ChangeElementCommand$1,copyElem:function(e){return u().copyElem(e)},decode64:decode64,encode64:encode64,ffClone:le,findDefs:findDefs,findDuplicateGradient:De,getElem:getElem,getId:P,getIntersectionList:re,getMouseTarget:I,getNextId:E,getPathBBox:getPathBBox,getTypeMap:getTypeMap,getUrlFromAttr:getUrlFromAttr,hasMatrixTransform:hasMatrixTransform,identifyLayers:identifyLayers,InsertElementCommand:InsertElementCommand$1,isChrome:isChrome,isIdentity:isIdentity,isIE:isIE,logMatrix:ue,matrixMultiply:matrixMultiply,MoveElementCommand:MoveElementCommand$1,NS:NS,preventClickDefault:preventClickDefault,recalculateAllSelectedDimensions:ce,recalculateDimensions:recalculateDimensions,remapElement:remapElement,RemoveElementCommand:RemoveElementCommand$1,removeUnusedDefElems:Ge,round:k,runExtensions:ae,sanitizeSvg:sanitizeSvg,SVGEditTransformList:SVGTransformList,text2xml:text2xml,toString:toString,transformBox:transformBox,transformListToTransform:transformListToTransform,transformPoint:transformPoint,walkTree:walkTree}}};function jqPluginJSHotkeys(e){function t(t){if("string"==typeof t.data){var n=t.handler,a=t.data.toLowerCase().split(" ");t.handler=function(t){if(this===t.target||!/textarea|select/i.test(t.target.nodeName)&&"text"!==t.target.type){var r="keypress"!==t.type&&e.hotkeys.specialKeys[t.which],i=String.fromCharCode(t.which).toLowerCase(),o="",s={};t.altKey&&"alt"!==r&&(o+="alt+"),t.ctrlKey&&"ctrl"!==r&&(o+="ctrl+"),t.metaKey&&!t.ctrlKey&&"meta"!==r&&(o+="meta+"),t.shiftKey&&"shift"!==r&&(o+="shift+"),r?s[o+r]=!0:(s[o+i]=!0,s[o+e.hotkeys.shiftNums[i]]=!0,"shift+"===o&&(s[e.hotkeys.shiftNums[i]]=!0));for(var l=0,c=a.length;l","/":"?","\\":"|"}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}}),e}function jqPluginBBQ(e){return function(e,t){var n,a,r,i,o,s,l,c,u=Array.prototype.slice,d=decodeURIComponent,h=e.param,g=e.bbq=e.bbq||{},p=e.event.special,f="hashchange",v="querystring",m="fragment",_="elemUrlAttr",b="location",y="href",x="src",C=/^.*\?|#.*$/g,S=/^.*\#/,w={};function $(e){return"string"==typeof e}function k(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}}function A(a,i,o,s,l){var u,g,p,f,_;return s!==n?(_=(p=o.match(a?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&$(s)?g=s.replace(a?S:C,""):(f=r(p[2]),s=$(s)?r[a?m:v](s):s,g=2===l?s:1===l?e.extend({},s,f):e.extend({},f,s),g=h(g),a&&(g=g.replace(c,d))),u=p[1]+(a?"#":g||!p[1]?"?":"")+g+_):u=i(o!==n?o:t[b][y]),u}function E(e,t,a){return t===n||"boolean"==typeof t?(a=t,t=h[e?m:v]()):t=$(t)?t.replace(e?S:C,""):t,r(t,a)}function P(t,a,r,i){return $(r)||"object"===(void 0===r?"undefined":_typeof(r))||(i=r,r=a,a=n),this.each(function(){var n=e(this),o=a||l()[(this.nodeName||"").toLowerCase()]||"",s=o&&n.attr(o)||"";n.attr(o,h[t](s,r,i))})}h[v]=k(A,0,function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}),h[m]=a=k(A,1,function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}),a.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);c=new RegExp(n.join("|"),"g")},a.noEscape(",/"),e.deparam=r=function(t,a){var r={},i={true:!0,false:!1,null:null};return e.each(t.replace(/\+/g," ").split("&"),function(t,o){var s,l=o.split("="),c=d(l[0]),u=r,h=0,g=c.split("]["),p=g.length-1;if(/\[/.test(g[0])&&/\]$/.test(g[p])?(g[p]=g[p].replace(/\]$/,""),p=(g=g.shift().split("[").concat(g)).length-1):p=0,2===l.length)if(s=d(l[1]),a&&(s=s&&!isNaN(s)?+s:"undefined"===s?n:i[s]!==n?i[s]:s),p)for(;h<=p;h++)u=u[c=""===g[h]?u.length:g[h]]=h').hide().insertAfter("body")[0].contentWindow,l=function(){return h(a.document[i][s])},(r=function(e,t){if(e!==t){var n=a.document;n.open().close(),n[i].hash="#"+e}})(h()))),function a(){var u=h(),d=l(c);u!==c?(r(c=u,d),e(t).trigger(o)):d!==c&&(t[i][s]=t[i][s].replace(/#.*/,"")+"#"+d),n=setTimeout(a,e[o+"Delay"])}()}},c.stop=function(){a||(n&&clearTimeout(n),n=0)},c}()}(e,window),e}function jqPluginSVGIcons(e){var t={},n=void 0;return e.svgIcons=function(a,r){var i="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xlink",s=r.w||24,l=r.h||24,c=void 0,u=void 0,d=void 0,h=!1,g=!1,p=0,f=!!window.opera,v="data:image/svg+xml;charset=utf-8;base64,",m=void 0;if(r.svgz){m=e('').appendTo("body").hide();try{u=m[0].contentDocument,m.load(b),b(0,!0)}catch(e){w()}}else{var _=new DOMParser;e.ajax({url:a,dataType:"string",success:function(t){t?(u=_.parseFromString(t,"text/xml"),e(function(){b("ajax")})):e(w)},error:function(t){window.opera?e(function(){w()}):t.responseText?((u=_.parseFromString(t.responseText,"text/xml")).childNodes.length||e(w),e(function(){b("ajax")})):e(w)}})}function b(t,n){if("ajax"!==t){if(g)return;var a=(u=m[0].contentDocument)&&u.getElementById("svg_eof");if(!(a||n&&a))return void(++p<50?setTimeout(b,20):(w(),g=!0));g=!0}if(c=e(u.firstChild).children(),r.no_img)setTimeout(function(){h||S()},500);else{var i=v+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";d=e(new Image).attr({src:i,width:0,height:0}).appendTo("body").load(function(){S(!0)}).error(function(){S()})}}var y=function(e,t,n,a){if(f&&t.css("visibility","hidden"),r.replace){a&&t.attr("id",n);var i=e.attr("class");i&&t.attr("class","svg_icon "+i),e.replaceWith(t)}else e.append(t);f&&setTimeout(function(){t.removeAttr("style")},1)},x=void 0,C=function(e,n){void 0!==r.id_match&&!1===r.id_match||y(x,e,n,!0),t[n]=e};function S(a,u){if(!h){r.no_img&&(a=!1);var g=void 0;if(a&&(g=e(document.createElement("div"))).hide().appendTo("body"),u){var p=r.fallback_path||"";e.each(u,function(t,n){x=e("#"+t);var a=e(new Image).attr({class:"svg_icon",src:p+n,width:s,height:l,alt:"icon"});C(a,t)})}else for(var _=c.length,b=0;b<_;b++){var S=c[b],w=S.id;if("svg_eof"===w)break;x=e("#"+w);var k=document.createElementNS(i,"svg");k.setAttributeNS(null,"viewBox",[0,0,s,l].join(" "));var A=S.getElementsByTagNameNS(i,"svg")[0],E=A.getAttribute("width"),P=A.getAttribute("height");A.removeAttribute("width"),A.removeAttribute("height"),A.getAttribute("viewBox")||A.setAttribute("viewBox",[0,0,E,P].join(" ")),k.setAttribute("xmlns",i),k.setAttribute("width",s),k.setAttribute("height",l),k.setAttribute("xmlns:xlink",o),k.setAttribute("class","svg_icon"),f||(A=A.cloneNode(!0)),k.append(A);var T=void 0;if(a){g.empty().append(k);var G=v+$(unescape(encodeURIComponent((new XMLSerializer).serializeToString(k))));T=e(new Image).attr({class:"svg_icon",src:G})}else T=n(e(k),b);C(T,w)}r.placement&&e.each(r.placement,function(r,i){t[i]&&e(r).each(function(r){var o=t[i].clone();r>0&&!a&&(o=n(o,r,!0)),y(e(this),o,i)})}),u||(a&&g.remove(),m&&m.remove(),d&&d.remove()),r.resize&&e.resizeSvgIcons(r.resize),h=!0,r.callback&&r.callback(t)}}function w(){if(a.includes(".svgz")){var t=a.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,r)}else r.fallback&&S(!1,r.fallback)}function $(e){if(window.btoa)return window.btoa(e);var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=new Array(4*Math.floor((e.length+2)/3)),a=0,r=0;do{var i=e.charCodeAt(a++),o=e.charCodeAt(a++),s=e.charCodeAt(a++),l=i>>2,c=(3&i)<<4|o>>4,u=(15&o)<<2|s>>6,d=63&s;isNaN(o)?u=d=64:isNaN(s)&&(d=64),n[r++]=t.charAt(l),n[r++]=t.charAt(c),n[r++]=t.charAt(u),n[r++]=t.charAt(d)}while(a
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var h=e(s+"> .jGraduate_colPick"),g=e(s+"> .jGraduate_gradPick");g.html('

    '+i.window.pickerTitle+'


    ');var p=256,f=p-0,v=p-0,m={};e(".jGraduate_SliderBar").width(145);var _=e("#"+o+"_jGraduate_GradContainer")[0],b=n("svg",{id:o+"_jgraduate_svg",width:p,height:p,xmlns:ns.svg},_),y=r.paint.type,x=r.paint[y],C=x,S=r.paint.alpha,w="solidColor"===y;switch(y){case"solidColor":case"linearGradient":if(w||(C.id=o+"_lg_jgraduate_grad",x=C=b.appendChild(C)),n("radialGradient",{id:o+"_rg_jgraduate_grad"},b),"linearGradient"===y)break;case"radialGradient":w||(C.id=o+"_rg_jgraduate_grad",x=C=b.appendChild(C)),n("linearGradient",{id:o+"_lg_jgraduate_grad"},b)}var $=void 0;if(w){x=C=e("#"+o+"_lg_jgraduate_grad")[0],Ge(0,"#"+(u=r.paint[y]),1);var k=_typeof(i.newstop);if("string"===k)switch(i.newstop){case"same":Ge(1,"#"+u,1);break;case"inverse":for(var A="",E=0;E<6;E+=2){var P=(255-parseInt(u.substr(E,2),16)).toString(16);P.length<2&&(P=0+P),A+=P}Ge(1,"#"+A,1);break;case"white":Ge(1,"#ffffff",1);break;case"black":Ge(1,"#000000",1)}else if("object"===k){var T="opac"in i.newstop?i.newstop.opac:1;Ge(1,i.newstop.color||"#"+u,T)}}var G=parseFloat(x.getAttribute("x1")||0),N=parseFloat(x.getAttribute("y1")||0),L=parseFloat(x.getAttribute("x2")||1),I=parseFloat(x.getAttribute("y2")||0),M=parseFloat(x.getAttribute("cx")||.5),R=parseFloat(x.getAttribute("cy")||.5),O=parseFloat(x.getAttribute("fx")||M),B=parseFloat(x.getAttribute("fy")||R),V=n("rect",{id:o+"_jgraduate_rect",x:0,y:0,width:f,height:v,fill:"url(#"+o+"_jgraduate_grad)","fill-opacity":S/100},b),j=e("
    ").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:N*p,left:G*p}).data("coord","start").appendTo(_),D=j.clone().text(2).css({top:I*p,left:L*p}).attr("title","End stop").data("coord","end").appendTo(_),F=e("
    ").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:R*p,left:M*p}).data("coord","center").appendTo(_),U=F.clone().text("F").css({top:B*p,left:O*p,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(_);U[0].id=o+"_jGraduate_focusCoord";var H=void 0;e.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(t,n){var a=isNaN(n[1]),r=C.getAttribute(n);r||(r=a?"0.5":"x2"===n?"1.0":"0.0"),m[n]=e("#"+o+"_jGraduate_"+n).val(r).change(function(){isNaN(parseFloat(this.value))||this.value<0?this.value=0:this.value>1&&(this.value=1),("f"!==n[0]||H)&&(a&&"radialGradient"===y||!a&&"linearGradient"===y)&&C.setAttribute(n,this.value);var e=a?"c"===n[0]?F:U:"1"===n[1]?j:D,t=n.includes("x")?"left":"top";e.css(t,this.value*p)}).change()});var z=e("#"+o+"_jGraduate_StopSlider"),q=void 0,W=void 0,Y=void 0,X=n("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},void 0),K=void 0,Q=1,Z=1,J=0,ee=M,te=R,ne=n("svg",{width:"100%",height:45},z[0]),ae=n("image",{width:16,height:16},n("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ne)),re=i.images.clientPath+"map-opacity.png";ae.setAttributeNS(ns.xlink,"xlink:href",re),e(ne).click(function(e){if(K=z.offset(),"path"!==e.target.tagName){var t=e.pageX-K.left-8;Ge((t=t<10?10:t>p+10?p+10:t)/p,0,0,!0),e.stopPropagation()}}),e(ne).mouseover(function(){ne.append(X)}),$=n("g",{},ne),n("line",{x1:10,y1:15,x2:p+10,y2:15,"stroke-width":2,stroke:"#000"},ne);var ie=g.find(".jGraduate_spreadMethod").change(function(){C.setAttribute("spreadMethod",e(this).val())}),oe=null,se=function(e){var t=e.pageX-de.left,n=e.pageY-de.top;t=t<0?0:t>p?p:t,n=n<0?0:n>p?p:n,oe.css("left",t).css("top",n);var a=t/f,r=n/v,i=oe.data("coord"),o=C;switch(i){case"start":m.x1.val(a),m.y1.val(r),o.setAttribute("x1",a),o.setAttribute("y1",r);break;case"end":m.x2.val(a),m.y2.val(r),o.setAttribute("x2",a),o.setAttribute("y2",r);break;case"center":m.cx.val(a),m.cy.val(r),o.setAttribute("cx",a),o.setAttribute("cy",r),ee=a,te=r,Ie();break;case"focus":m.fx.val(a),m.fy.val(r),o.setAttribute("fx",a),o.setAttribute("fy",r),Ie()}e.preventDefault()},le=function e(){oe=null,d.unbind("mousemove",se).unbind("mouseup",e)},ce=(q=C.getElementsByTagNameNS(ns.svg,"stop")).length;if(ce<2){for(;ce<2;)C.append(document.createElementNS(ns.svg,"stop")),++ce;q=C.getElementsByTagNameNS(ns.svg,"stop")}for(var ue=0;ue99.5&&(n=99.5),n>0?Z=1-n/100:Q=-n/100-1,i=(n+100)/2*145/100,e&&Ie();break;case"angle":i=(J=n)/180,i+=.5,i*=145,e&&Ie()}i>145?i=145:i<0&&(i=0),a.css({"margin-left":i-5})}).change()});for(var ke=function(e){!function(e){var t=pe.offset,n=pe.parent,a=e.pageX-t.left-parseInt(n.css("border-left-width"));a>145&&(a=145),a<=0&&(a=0);var i=a-5;switch(a/=145,pe.type){case"radius":(a=Math.pow(2*a,2.5))>.98&&a<1.02&&(a=1),a<=.01&&(a=.01),C.setAttribute("r",a);break;case"opacity":r.paint.alpha=parseInt(100*a),V.setAttribute("fill-opacity",a);break;case"ellip":Q=1,Z=1,a<.5?Q=(a/=.5)<=0?.01:a:a>.5&&(Z=(a=2-(a/=.5))<=0?.01:a),Ie(),Z===1+(a-=1)&&(a=Math.abs(a));break;case"angle":a-=.5,J=a*=180,Ie(),a/=100}pe.elem.css({"margin-left":i}),a=Math.round(100*a),pe.input.val(a)}(e),e.preventDefault()},Ae=function e(t){d.unbind("mousemove",ke).unbind("mouseup",e),pe=null},Ee=(255*r.paint.alpha/100).toString(16);Ee.length<2;)Ee="0"+Ee;Ee=Ee.split(".")[0],u="none"===r.paint.solidColor?"":r.paint.solidColor+Ee,w||(u=q[0].getAttribute("stop-color")),e.extend(e.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),h.jPicker({window:{title:i.window.pickerTitle},images:{clientPath:i.images.clientPath},color:{active:u,alphaSupport:!0}},function(e){r.paint.type="solidColor",r.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,r.paint.solidColor=e.val("hex")?e.val("hex"):"none",r.paint.radialGradient=null,l()},null,function(){c()});var Pe=e(s+" .jGraduate_tabs li");Pe.click(function(){Pe.removeClass("jGraduate_tab_current"),e(this).addClass("jGraduate_tab_current"),e(s+" > div").hide();var t=e(this).attr("data-type");if(e(s+" .jGraduate_gradPick").show(),"rg"===t||"lg"===t){e(".jGraduate_"+t+"_field").show(),e(".jGraduate_"+("lg"===t?"rg":"lg")+"_field").hide(),e("#"+o+"_jgraduate_rect")[0].setAttribute("fill","url(#"+o+"_"+t+"_jgraduate_grad)"),y="lg"===t?"linearGradient":"radialGradient",e("#"+o+"_jGraduate_OpacInput").val(r.paint.alpha).change();var n=e("#"+o+"_"+t+"_jgraduate_grad")[0];if(C!==n){var a=e(C).find("stop");e(n).empty().append(a),C=n;var i=ie.val();C.setAttribute("spreadMethod",i)}H="rg"===t&&null!=C.getAttribute("fx")&&!(M===O&&R===B),e("#"+o+"_jGraduate_focusCoord").toggle(H),H&&(e("#"+o+"_jGraduate_match_ctr")[0].checked=!1)}else e(s+" .jGraduate_gradPick").hide(),e(s+" .jGraduate_colPick").show()}),e(s+" > div").hide(),Pe.removeClass("jGraduate_tab_current");var Te=void 0;switch(r.paint.type){case"linearGradient":Te=e(s+" .jGraduate_tab_lingrad");break;case"radialGradient":Te=e(s+" .jGraduate_tab_radgrad");break;default:Te=e(s+" .jGraduate_tab_color")}r.show(),setTimeout(function(){Te.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Ge(t,a,r,s,l){var c=l||n("stop",{"stop-color":a,"stop-opacity":r,offset:t},C);l?(a=l.getAttribute("stop-color"),r=l.getAttribute("stop-opacity"),t=l.getAttribute("offset")):C.append(c),null===r&&(r=1);var u="M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",h=n("path",{d:u,fill:"url(#jGraduate_trans)",transform:"translate("+(10+t*p)+", 26)"},$),g=n("path",{d:u,fill:a,"fill-opacity":r,transform:"translate("+(10+t*p)+", 26)",stroke:"#000","stroke-width":1.5},$);return e(g).mousedown(function(e){return Ne(this),Y=W,d.mousemove(Me).mouseup(Le),K=z.offset(),e.preventDefault(),!1}).data("stop",c).data("bg",h).dblclick(function(){e("div.jGraduate_LightBox").show();for(var t=this,n=+c.getAttribute("stop-opacity")||1,r=c.getAttribute("stop-color")||1,s=(255*parseFloat(n)).toString(16);s.length<2;)s="0"+s;a=r.substr(1)+s,e("#"+o+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:i.images.clientPath},color:{active:a,alphaSupport:!0}},function(a,i){r=a.val("hex")?"#"+a.val("hex"):"none",n=null!==a.val("a")?a.val("a")/256:1,t.setAttribute("fill",r),t.setAttribute("fill-opacity",n),c.setAttribute("stop-color",r),c.setAttribute("stop-opacity",n),e("div.jGraduate_LightBox").hide(),e("#"+o+"_jGraduate_stopPicker").hide()},null,function(){e("div.jGraduate_LightBox").hide(),e("#"+o+"_jGraduate_stopPicker").hide()})}),e(C).find("stop").each(function(){var n=e(this);if(+this.getAttribute("offset")>t){if(!a){var r=this.getAttribute("stop-color"),i=this.getAttribute("stop-opacity");c.setAttribute("stop-color",r),g.setAttribute("fill",r),c.setAttribute("stop-opacity",null===i?1:i),g.setAttribute("fill-opacity",null===i?1:i)}return n.before(c),!1}}),s&&Ne(g),c}function Ne(e){W&&W.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),(W=e).parentNode.append(W)}function Le(){d.unbind("mousemove",Me),"none"!==X.getAttribute("display")&&function(){X.setAttribute("display","none");var t=e(W),n=t.data("stop"),a=t.data("bg");e([W,n,a]).remove()}(),Y=null}function Ie(){var e=J?"rotate("+J+","+ee+","+te+") ":"";if(1===Q&&1===Z)C.removeAttribute("gradientTransform");else{var t=-ee*(Q-1),n=-te*(Z-1);C.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+Q+","+Z+")")}}function Me(t){var n=t.pageX-K.left,a=t.pageY-K.top,r="translate("+(n=n<10?10:n>p+10?p+10:n)+", 26)";a<-60||a>130?(X.setAttribute("display","block"),X.setAttribute("transform",r)):X.setAttribute("display","none"),Y.setAttribute("transform",r),e.data(Y,"bg").setAttribute("transform",r);var i=e.data(Y,"stop"),o=(n-10)/p;i.setAttribute("offset",o);var s=0;e(C).find("stop").each(function(t){var n=this.getAttribute("offset"),a=e(this);nn(o,"offsetLeft")+o.offsetWidth*s-this.spinCfg._btn_width?i=120?this.adjustValue(this.spinCfg.step):e.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step),e.preventDefault()}).change(function(e){this.adjustValue(0)}),this.addEventListener&&this.addEventListener("DOMMouseScroll",function(e){e.detail>0?this.adjustValue(-this.spinCfg.step):e.detail<0&&this.adjustValue(this.spinCfg.step),e.preventDefault()},!1)})},e}function jqPluginContextMenu(e){var t=e(window),n=e(document);return e.extend(e.fn,{contextMenu:function(a,r){return void 0!==a.menu&&(void 0===a.inSpeed&&(a.inSpeed=150),void 0===a.outSpeed&&(a.outSpeed=75),0===a.inSpeed&&(a.inSpeed=-1),0===a.outSpeed&&(a.outSpeed=-1),e(this).each(function(){var i=e(this),o=e(i).offset(),s=e("#"+a.menu);s.addClass("contextMenu"),e(this).bind("mousedown",function(l){var c=l;e(this).mouseup(function(l){var u=e(this);if(u.unbind("mouseup"),2===c.button||a.allowLeft||c.ctrlKey&&isMac()){if(l.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var d=l.pageX,h=l.pageY,g=t.width()-s.width(),p=t.height()-s.height();d>g-15&&(d=g-15),h>p-30&&(h=p-30),n.unbind("click"),s.css({top:h,left:d}).fadeIn(a.inSpeed),s.find("A").mouseover(function(){s.find("LI.hover").removeClass("hover"),e(this).parent().addClass("hover")}).mouseout(function(){s.find("LI.hover").removeClass("hover")}),n.keypress(function(e){switch(e.keyCode){case 38:s.find("LI.hover").length?(s.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"),s.find("LI.hover").length||s.find("LI:last").addClass("hover")):s.find("LI:last").addClass("hover");break;case 40:s.find("LI.hover").length?(s.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover"),s.find("LI.hover").length||s.find("LI:first").addClass("hover")):s.find("LI:first").addClass("hover");break;case 13:s.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}}),s.find("A").unbind("mouseup"),s.find("LI:not(.disabled) A").mouseup(function(){return n.unbind("click").unbind("keypress"),e(".contextMenu").hide(),r&&r(e(this).attr("href").substr(1),e(u),{x:d-o.left,y:h-o.top,docX:d,docY:h}),!1}),setTimeout(function(){n.click(function(){return n.unbind("click").unbind("keypress"),s.fadeOut(a.outSpeed),!1})},0)}})}),e.browser.mozilla?e("#"+a.menu).each(function(){e(this).css({MozUserSelect:"none"})}):e.browser.msie?e("#"+a.menu).each(function(){e(this).bind("selectstart.disableTextSelect",function(){return!1})}):e("#"+a.menu).each(function(){e(this).bind("mousedown.disableTextSelect",function(){return!1})}),e(i).add(e("UL.contextMenu")).bind("contextmenu",function(){return!1})}),e(this))},disableContextMenuItems:function(t){return void 0===t?(e(this).find("LI").addClass("disabled"),e(this)):(e(this).each(function(){if(void 0!==t)for(var n=t.split(","),a=0;an&&(i=n),o<0?o=0:o>r&&(o=r),l.call(a,"xy",{x:i/n*v+p,y:o/r*b+m})}function l(e,t,n){if(!(void 0!==t))switch(void 0!==e&&null!=e||(e="xy"),e.toLowerCase()){case"x":return h;case"y":return g;case"xy":default:return{x:h,y:g}}if(null==n||n!==a){var r=!1,i=void 0,o=void 0;switch(null==e&&(e="xy"),e.toLowerCase()){case"x":i=t&&(t.x&&0|t.x||0|t)||0;break;case"y":o=t&&(t.y&&0|t.y||0|t)||0;break;case"xy":default:i=t&&t.x&&0|t.x||0,o=t&&t.y&&0|t.y||0}null!=i&&(if&&(i=f),h!==i&&(h=i,r=!0)),null!=o&&(o_&&(o=_),g!==o&&(g=o,r=!0)),r&&function(e){for(var t=0;t0&&(i=h===f?e:h/v*e|0),b>0&&(o=g===_?n:g/b*n|0),a>=e?i=(e>>1)-(a>>1):i-=a>>1,r>=n?o=(n>>1)-(r>>1):o-=r>>1,y.css({left:i+"px",top:o+"px"})},0)})}e.loadingStylesheets.includes("jgraduate/css/jPicker.css")||e.loadingStylesheets.push("jgraduate/css/jPicker.css"),e.jPicker={List:[],Color:function t(n){classCallCheck(this,t);var a=this;function r(e){for(var t=0;t255&&(b.r=255),s!==b.r&&(s=b.r,m=!0);break;case"g":if(x)continue;y=!0,b.g=t&&t.g&&0|t.g||t&&0|t||0,b.g<0?b.g=0:b.g>255&&(b.g=255),l!==b.g&&(l=b.g,m=!0);break;case"b":if(x)continue;y=!0,b.b=t&&t.b&&0|t.b||t&&0|t||0,b.b<0?b.b=0:b.b>255&&(b.b=255),c!==b.b&&(c=b.b,m=!0);break;case"a":b.a=t&&null!=t.a?0|t.a:null!=t?0|t:255,b.a<0?b.a=0:b.a>255&&(b.a=255),u!==b.a&&(u=b.a,m=!0);break;case"h":if(y)continue;x=!0,b.h=t&&t.h&&0|t.h||t&&0|t||0,b.h<0?b.h=0:b.h>360&&(b.h=360),d!==b.h&&(d=b.h,m=!0);break;case"s":if(y)continue;x=!0,b.s=t&&null!=t.s?0|t.s:null!=t?0|t:100,b.s<0?b.s=0:b.s>100&&(b.s=100),h!==b.s&&(h=b.s,m=!0);break;case"v":if(y)continue;x=!0,b.v=t&&null!=t.v?0|t.v:null!=t?0|t:100,b.v<0?b.v=0:b.v>100&&(b.v=100),g!==b.v&&(g=b.v,m=!0)}if(m){if(y){s=s||0,l=l||0,c=c||0;var S=i.rgbToHsv({r:s,g:l,b:c});d=S.h,h=S.s,g=S.v}else if(x){d=d||0,h=null!=h?h:100,g=null!=g?g:100;var w=i.hsvToRgb({h:d,s:h,v:g});s=w.r,l=w.g,c=w.b}u=null!=u?u:255,r.call(a,n||a)}}}}var s=void 0,l=void 0,c=void 0,u=void 0,d=void 0,h=void 0,g=void 0,p=[];e.extend(!0,a,{val:o,bind:function(e){"function"==typeof e&&p.push(e)},unbind:function(e){if("function"==typeof e)for(var t=void 0;t=p.includes(e);)p.splice(t,1)},destroy:function(){p=null}}),n&&(null!=n.ahex?o("ahex",n):null!=n.hex?o((null!=n.a?"a":"")+"hex",null!=n.a?{ahex:n.hex+i.intToHex(n.a)}:n):null!=n.r&&null!=n.g&&null!=n.b?o("rgb"+(null!=n.a?"a":""),n):null!=n.h&&null!=n.s&&null!=n.v&&o("hsv"+(null!=n.a?"a":""),n))},ColorMethods:{hexToRgba:function(e){if(""===e||"none"===e)return{r:null,g:null,b:null,a:null};var t="00",n="00",a="00",r="255";return 6===(e=this.validateHex(e)).length&&(e+="ff"),e.length>6?(t=e.substring(0,2),n=e.substring(2,4),a=e.substring(4,6),r=e.substring(6,e.length)):(e.length>4&&(t=e.substring(4,e.length),e=e.substring(0,4)),e.length>2&&(n=e.substring(2,e.length),e=e.substring(0,2)),e.length>0&&(a=e.substring(0,e.length))),{r:this.hexToInt(t),g:this.hexToInt(n),b:this.hexToInt(a),a:this.hexToInt(r)}},validateHex:function(e){return(e=e.toLowerCase().replace(/[^a-f0-9]/g,"")).length>8&&(e=e.substring(0,8)),e},rgbaToHex:function(e){return this.intToHex(e.r)+this.intToHex(e.g)+this.intToHex(e.b)+this.intToHex(e.a)},intToHex:function(e){var t=(0|e).toString(16);return 1===t.length&&(t="0"+t),t.toLowerCase()},hexToInt:function(e){return parseInt(e,16)},rgbToHsv:function(e){var t=e.r/255,n=e.g/255,a=e.b/255,r={h:0,s:0,v:0},i=0,o=0;t>=n&&t>=a?(o=t,i=n>a?a:n):n>=a&&n>=t?(o=n,i=t>a?a:t):(o=a,i=n>t?t:n),r.v=o,r.s=o?(o-i)/o:0;var s=void 0;return r.s?(s=o-i,r.h=t===o?(n-a)/s:n===o?2+(a-t)/s:4+(t-n)/s,r.h=parseInt(60*r.h),r.h<0&&(r.h+=360)):r.h=0,r.s=100*r.s|0,r.v=100*r.v|0,r},hsvToRgb:function(e){var t={r:0,g:0,b:0,a:100},n=e.h,a=e.s,r=e.v;if(0===a)t.r=t.g=t.b=0===r?0:255*r/100|0;else{360===n&&(n=0);var i=0|(n/=60),o=n-i,s=(r/=100)*(1-(a/=100)),l=r*(1-a*o),c=r*(1-a*(1-o));switch(i){case 0:t.r=r,t.g=c,t.b=s;break;case 1:t.r=l,t.g=r,t.b=s;break;case 2:t.r=s,t.g=r,t.b=c;break;case 3:t.r=s,t.g=l,t.b=r;break;case 4:t.r=c,t.g=s,t.b=r;break;case 5:t.r=r,t.g=s,t.b=l}t.r=255*t.r|0,t.g=255*t.g|0,t.b=255*t.b|0}return t}}};var n=e.jPicker,a=n.Color,r=n.List,i=n.ColorMethods;return e.fn.jPicker=function(n){var o=arguments;return this.each(function(){var s=this,l=e.extend(!0,{},e.fn.jPicker.defaults,n);"input"===e(s).get(0).nodeName.toLowerCase()&&(e.extend(!0,l,{window:{bindToInput:!0,expandable:!0,input:e(s)}}),""===e(s).val()?(l.color.active=new a({hex:null}),l.color.current=new a({hex:null})):i.validateHex(e(s).val())&&(l.color.active=new a({hex:e(s).val(),a:l.color.active.val("a")}),l.color.current=new a({hex:e(s).val(),a:l.color.active.val("a")}))),l.window.expandable?e(s).after('    '):l.window.liveUpdate=!1;var c=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function u(e){var t=M.active,n=t.val("hex"),a=void 0,r=void 0;switch(l.color.mode=e,e){case"h":if(setTimeout(function(){p.call(s,D,"transparent"),v.call(s,U,0),m.call(s,U,100),v.call(s,H,260),m.call(s,H,100),p.call(s,F,"transparent"),v.call(s,q,0),m.call(s,q,100),v.call(s,W,260),m.call(s,W,100),v.call(s,Y,260),m.call(s,Y,100),v.call(s,X,260),m.call(s,X,100),v.call(s,Q,260),m.call(s,Q,100)},0),Z.range("all",{minX:0,maxX:100,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:360}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("s"),y:100-t.val("v")},Z),J.val("y",360-t.val("h"),J);break;case"s":if(setTimeout(function(){p.call(s,D,"transparent"),v.call(s,U,-260),v.call(s,H,-520),v.call(s,q,-260),v.call(s,W,-520),v.call(s,Q,260),m.call(s,Q,100)},0),Z.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("h"),y:100-t.val("v")},Z),J.val("y",100-t.val("s"),J);break;case"v":if(setTimeout(function(){p.call(s,D,"000000"),v.call(s,U,-780),v.call(s,H,260),p.call(s,F,n),v.call(s,q,-520),v.call(s,W,260),m.call(s,W,100),v.call(s,Q,260),m.call(s,Q,100)},0),Z.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("h"),y:100-t.val("s")},Z),J.val("y",100-t.val("v"),J);break;case"r":if(a=-1040,r=-780,Z.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("b"),y:255-t.val("g")},Z),J.val("y",255-t.val("r"),J);break;case"g":if(a=-1560,r=-1820,Z.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("b"),y:255-t.val("r")},Z),J.val("y",255-t.val("g"),J);break;case"b":if(a=-2080,r=-2860,Z.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("r"),y:255-t.val("g")},Z),J.val("y",255-t.val("b"),J);break;case"a":if(setTimeout(function(){p.call(s,D,"transparent"),v.call(s,U,-260),v.call(s,H,-520),v.call(s,q,260),v.call(s,W,260),m.call(s,W,100),v.call(s,Q,0),m.call(s,Q,100)},0),Z.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("h"),y:100-t.val("v")},Z),J.val("y",255-t.val("a"),J);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout(function(){m.call(s,U,100),m.call(s,q,100),v.call(s,Y,260),m.call(s,Y,100),v.call(s,X,260),m.call(s,X,100)},0);break;case"r":case"g":case"b":setTimeout(function(){p.call(s,D,"transparent"),p.call(s,F,"transparent"),m.call(s,q,100),m.call(s,U,100),v.call(s,U,a),v.call(s,H,a-260),v.call(s,q,r-780),v.call(s,W,r-520),v.call(s,Y,r),v.call(s,X,r-260),v.call(s,Q,260),m.call(s,Q,100)},0)}null!=t.val("ahex")&&d.call(s,t)}function d(e,t){(null==t||t!==J&&t!==Z)&&function(e,t){if(t!==Z)switch(l.color.mode){case"h":var n=e.val("sv");Z.val("xy",{x:null!=n?n.s:100,y:100-(null!=n?n.v:100)},t);break;case"s":case"a":var a=e.val("hv");Z.val("xy",{x:a&&a.h||0,y:100-(null!=a?a.v:100)},t);break;case"v":var r=e.val("hs");Z.val("xy",{x:r&&r.h||0,y:100-(null!=r?r.s:100)},t);break;case"r":var i=e.val("bg");Z.val("xy",{x:i&&i.b||0,y:255-(i&&i.g||0)},t);break;case"g":var o=e.val("br");Z.val("xy",{x:o&&o.b||0,y:255-(o&&o.r||0)},t);break;case"b":var s=e.val("rg");Z.val("xy",{x:s&&s.r||0,y:255-(s&&s.g||0)},t)}if(t!==J)switch(l.color.mode){case"h":J.val("y",360-(e.val("h")||0),t);break;case"s":var c=e.val("s");J.val("y",100-(null!=c?c:100),t);break;case"v":var u=e.val("v");J.val("y",100-(null!=u?u:100),t);break;case"r":J.val("y",255-(e.val("r")||0),t);break;case"g":J.val("y",255-(e.val("g")||0),t);break;case"b":J.val("y",255-(e.val("b")||0),t);break;case"a":var d=e.val("a");J.val("y",255-(null!=d?d:255),t)}}.call(s,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");te.css({backgroundColor:t&&"#"+t.hex||"transparent"}),m.call(s,te,t&&Math.precision(100*t.a/255,4)||0)}catch(e){}}).call(s,e),function(e){switch(l.color.mode){case"h":p.call(s,D,new a({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");m.call(s,H,100-(null!=t?t:100));break;case"v":var n=e.val("v");m.call(s,U,null!=n?n:100);break;case"r":m.call(s,H,Math.precision((e.val("r")||0)/255*100,4));break;case"g":m.call(s,H,Math.precision((e.val("g")||0)/255*100,4));break;case"b":m.call(s,H,Math.precision((e.val("b")||0)/255*100))}var r=e.val("a");m.call(s,z,Math.precision(100*(255-(r||0))/255,4))}.call(s,e),function(e){switch(l.color.mode){case"h":var t=e.val("a");m.call(s,K,Math.precision(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),r=new a({h:n&&n.h||0,s:100,v:null!=n?n.v:100});p.call(s,F,r.val("hex")),m.call(s,W,100-(null!=n?n.v:100)),m.call(s,K,Math.precision(100*(255-(n&&n.a||0))/255,4));break;case"v":var i=e.val("hsa"),o=new a({h:i&&i.h||0,s:null!=i?i.s:100,v:100});p.call(s,F,o.val("hex")),m.call(s,K,Math.precision(100*(255-(i&&i.a||0))/255,4));break;case"r":case"g":case"b":var c=e.val("rgba"),u=0,d=0;"r"===l.color.mode?(u=c&&c.b||0,d=c&&c.g||0):"g"===l.color.mode?(u=c&&c.b||0,d=c&&c.r||0):"b"===l.color.mode&&(u=c&&c.r||0,d=c&&c.g||0);var h=d>u?u:d;m.call(s,W,u>d?Math.precision((u-d)/(255-d)*100,4):0),m.call(s,Y,d>u?Math.precision((d-u)/(255-u)*100,4):0),m.call(s,X,Math.precision(h/255*100,4)),m.call(s,K,Math.precision(100*(255-(c&&c.a||0))/255,4));break;case"a":var g=e.val("a");p.call(s,F,e.val("hex")||"000000"),m.call(s,K,null!=g?0:100),m.call(s,Q,null!=g?100:0)}}.call(s,e)},0)}function h(e,t){var n=M.active;if(t===Z||null!=n.val()){var a=e.val("all");switch(l.color.mode){case"h":n.val("sv",{s:a.x,v:100-a.y},t);break;case"s":case"a":n.val("hv",{h:a.x,v:100-a.y},t);break;case"v":n.val("hs",{h:a.x,s:100-a.y},t);break;case"r":n.val("gb",{g:255-a.y,b:a.x},t);break;case"g":n.val("rb",{r:255-a.y,b:a.x},t);break;case"b":n.val("rg",{r:a.x,g:255-a.y},t)}}}function g(e,t){var n=M.active;if(t===J||null!=n.val())switch(l.color.mode){case"h":n.val("h",{h:360-e.val("y")},t);break;case"s":n.val("s",{s:100-e.val("y")},t);break;case"v":n.val("v",{v:100-e.val("y")},t);break;case"r":n.val("r",{r:255-e.val("y")},t);break;case"g":n.val("g",{g:255-e.val("y")},t);break;case"b":n.val("b",{b:255-e.val("y")},t);break;case"a":n.val("a",255-e.val("y"),t)}}function p(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function f(e,t){c&&(t.includes("AlphaBar.png")||t.includes("Bars.png")||t.includes("Maps.png"))?(e.attr("pngSrc",t),e.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+t+"', sizingMethod='scale')"})):e.css({backgroundImage:"url('"+t+"')"})}function v(e,t){e.css({top:t+"px"})}function m(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(c){var n=e.attr("pngSrc");null!=n&&(n.includes("AlphaBar.png")||n.includes("Bars.png")||n.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+n+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+t+")"}):e.css({opacity:Math.precision(t/100,4)})}else e.css({opacity:Math.precision(t/100,4)});else if(0===t||100===t)if(c){var a=e.attr("pngSrc");null!=a&&(a.includes("AlphaBar.png")||a.includes("Bars.png")||a.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"', sizingMethod='scale')"}):e.css({opacity:""})}else e.css({opacity:""})}function _(){M.active.val("ahex",M.current.val("ahex"))}function b(t){e(this).parents("tbody:first").find('input:radio[value!="'+t.target.value+'"]').removeAttr("checked"),u.call(s,t.target.value)}function y(){_.call(s)}function x(){_.call(s),l.window.expandable&&G.call(s),"function"==typeof he&&he.call(s,M.active,re)}function C(){(function(){M.current.val("ahex",M.active.val("ahex"))}).call(s),l.window.expandable&&G.call(s),"function"==typeof ue&&ue.call(s,M.active,ae)}function S(){T.call(s)}function w(e,t){var n=e.val("hex");ne.css({backgroundColor:n&&"#"+n||"transparent"}),m.call(s,ne,Math.precision(100*(e.val("a")||0)/255,4))}function $(e,t){var n=e.val("hex"),a=e.val("va");oe.css({backgroundColor:n&&"#"+n||"transparent"}),m.call(s,se,Math.precision(100*(255-(a&&a.a||0))/255,4)),l.window.bindToInput&&l.window.updateInputColor&&l.window.input.css({backgroundColor:n&&"#"+n||"transparent",color:null==a||a.v>75?"#000000":"#ffffff"})}function k(t){R=parseInt(j.css("left")),O=parseInt(j.css("top")),B=t.pageX,V=t.pageY,e(document).bind("mousemove",A).bind("mouseup",E),t.preventDefault()}function A(t){return j.css({left:R-(B-t.pageX)+"px",top:O-(V-t.pageY)+"px"}),l.window.expandable&&!e.support.boxModel&&j.prev().css({left:j.css("left"),top:j.css("top")}),t.stopPropagation(),t.preventDefault(),!1}function E(t){return e(document).unbind("mousemove",A).unbind("mouseup",E),t.stopPropagation(),t.preventDefault(),!1}function P(t){return t.preventDefault(),t.stopPropagation(),M.active.val("ahex",e(this).attr("title")||null,t.target),!1}function T(){function t(){if(l.window.expandable&&!e.support.boxModel){var t=j.find("table:first");j.before("