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=n.screenX,i=n.screenY,o=n.clientX,s=n.clientY,l=new MouseEvent(a,{bubbles:!0,cancelable:!0,view:window,detail:1,screenX:r,screenY:i,clientX:o,clientY:s,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});t.length<2&&(n.target.dispatchEvent(l),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 window.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}},{key:"insertItemBefore",value: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}},{key:"removeItem",value: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}}]),t}();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)}}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(),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 F=snapToAngle(V,j,v,m);v=F.x,m=F.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 D="M"+v+","+m+" ";editorContext_.setDrawnPath(editorContext_.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:D,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(/'/g,"'")},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)),"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=slicedToArray(n,2),r=a[0],i=a[1];t+=r;for(var o=0;o-.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|:\\-]","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?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(),(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(),(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(k)/(1-Math.cos(k)):2/k;for(var E=0;E=3&&3===a.getItem(G-2).type&&2===a.getItem(G-3).type&&2===a.getItem(G-1).type){I=3;for(var O=a.getItem(G-3).matrix,B=a.getItem(G-2).matrix,V=a.getItem(G-1).matrix,j=t.childNodes,F=j.length;F--;){var D=j.item(F);if(N=0,L=0,1===D.nodeType){var U=getTransformList(D);if(!U)continue;var H=transformListToTransform(U).matrix,z=getRotationAngle(D);if(R=context_.getStartTransform(),context_.setStartTransform(D.getAttribute("transform")),z||hasMatrixTransform(U)){var q=n.createSVGTransform();q.setMatrix(matrixMultiply(O,B,V,H)),U.clear(),U.appendItem(q)}else{var W=matrixMultiply(H.inverse(),V,H),Y=n.createSVGMatrix();Y.e=-W.e,Y.f=-W.f;var X=matrixMultiply(Y.inverse(),H.inverse(),O,B,V,H,W.inverse()),Q=n.createSVGTransform(),K=n.createSVGTransform(),Z=n.createSVGTransform();Q.setTranslate(W.e,W.f),K.setScale(X.a,X.d),Z.setTranslate(Y.e,Y.f),U.appendItem(Z),U.appendItem(K),U.appendItem(Q)}p.addSubCommand(e(D)),context_.setStartTransform(R)}}a.removeItem(G-1),a.removeItem(G-2),a.removeItem(G-3)}else if(G>=3&&1===a.getItem(G-1).type){I=3;var J=transformListToTransform(a).matrix,ee=n.createSVGTransform();ee.setMatrix(J),a.clear(),a.appendItem(ee)}else if((1===G||G>1&&3!==a.getItem(1).type)&&2===a.getItem(0).type){I=2;var te=transformListToTransform(a).matrix;a.removeItem(0);var ne=transformListToTransform(a).matrix.inverse(),ae=matrixMultiply(ne,te);if(N=ae.e,L=ae.f,0!==N||0!==L){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,N,L),oe.push(le))}R=context_.getStartTransform(),context_.setStartTransform(se.getAttribute("transform"));var ce=getTransformList(se);if(ce){var ue=n.createSVGTransform();ue.setTranslate(N,L),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(-N,-L),getTransformList(pe).insertItemBefore(fe,0),p.addSubCommand(e(pe))}}context_.setStartTransform(R)}}}context_.setStartTransform(R)}}else{if(1!==G||1!==a.getItem(0).type||$){if($){var ve=n.createSVGTransform();ve.setRotate($,S.x,S.y),a.numberOfItems?a.insertItemBefore(ve,0):a.appendItem(ve)}return 0===a.numberOfItems&&t.removeAttribute("transform"),null}I=1;for(var me=a.getItem(0).matrix,_e=t.childNodes,be=_e.length;be--;){var ye=_e.item(be);if(1===ye.nodeType){R=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(R);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===I){if($){S={x:C.x+M.e,y:C.y+M.f};var ke=n.createSVGTransform();ke.setRotate($,S.x,S.y),a.numberOfItems?a.insertItemBefore(ke,0):a.appendItem(ke)}}else if(3===I){var Ae=transformListToTransform(a).matrix,Ee=n.createSVGTransform();Ee.setRotate($,C.x,C.y);var Pe=Ee.matrix,Te=n.createSVGTransform();Te.setRotate($,S.x,S.y);var Ge=Te.matrix.inverse(),Ne=Ae.inverse(),Le=matrixMultiply(Ne,Ge,Pe,Ae);if(N=Le.e,L=Le.f,0!==N||0!==L)for(var Ie=t.childNodes,Me=Ie.length;Me--;){var Re=Ie.item(Me);if(1===Re.nodeType){R=context_.getStartTransform(),context_.setStartTransform(Re.getAttribute("transform"));var Oe=getTransformList(Re),Be=n.createSVGTransform();Be.setTranslate(N,L),Oe.numberOfItems?Oe.insertItemBefore(Be,0):Oe.appendItem(Be),p.addSubCommand(e(Re)),context_.setStartTransform(R)}}$&&(a.numberOfItems?a.insertItemBefore(Te,0):a.appendItem(Te))}}else{var Ve=getBBox(t);if(!Ve&&"path"!==t.tagName)return null;var je=void 0,Fe=getRotationAngle(t);if(Fe){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 De=Fe*Math.PI/180,Ue=Math.abs(De)>1e-10?Math.sin(De)/(1-Math.cos(De)):2/De,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||Fe){if(Fe){var it=n.createSVGTransform();it.setRotate(Fe,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;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=slicedToArray(config_.dimensions,2),a=n[0],r=n[1],i=svgFactory_.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:a,height:r,x:0,y:0,overflow:isWebkit()?"none":"visible",style:"pointer-events:none"}}),o=svgFactory_.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});i.append(o),svgFactory_.svgRoot().insertBefore(i,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;var _=function(){return a.baseUnit};init({getBaseUnit:_,getElement:getElem,getHeight:function(){return l.getAttribute("height")/d},getWidth:function(){return l.getAttribute("width")/d},getRoundDigits:function(){return z.round_digits}}),i.convertToNum=convertToNum;var b=function(){return l},y=this.getSelectedElems=function(){return f},x=pathActions,C=function(){return s};init$2({pathActions:x,getSVGContent:b,addSVGElementFromJson:m,getSelectedElements:y,getDOMDocument:function(){return o},getDOMContainer:function(){return t},getSVGRoot:C,getBaseUnit:_,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 S=function(){return a.gridSnapping};init$4({getDrawing:function(){return u()},getSVGRoot:C,getGridSnapping:S}),this.remapElement=remapElement,init$5({getSVGRoot:C,getStartTransform:function(){return Z},setStartTransform:function(e){Z=e}}),this.recalculateDimensions=recalculateDimensions;var w=getReverseNS();i.sanitizeSvg=sanitizeSvg;var $=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(),N("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&&U(t.elem):o||U(t.elem),"use"===t.elem.tagName&&Oe(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)}}}}),k=function(e){i.undoMgr.addCommandToHistory(e)},A=this.getZoom=function(){return d},E=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:A});var P=this.selectorManager=getSelectorManager(),T=i.getNextId=function(){return u().getNextId()},G=i.getId=function(){return u().getId()},N=function(e,t){if(ue[e])return ue[e](window,t)},L=this.clearSelection=function(e){f.forEach(function(e){null!=e&&P.releaseSelector(e)}),f=[],e||N("selected",f)},I=this.addToSelection=function(e,t){if(e.length){for(var n=0;n1&&o.showGrips(!1)}}}for(N("selected",f),t||1===f.length?P.requestSelector(f[0]).showGrips(!0):P.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)}},M=function(){return p.opacity},R=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 P.selectorParentGroup;for(;n.parentNode!==(h||a);)n=n.parentNode;return n};i.pathActions=x,init$1({selectorManager:P,canvas:i,call:N,resetD:function(e){e.setAttribute("d",x.convertPath(e))},round:E,clearSelection:L,addToSelection:I,addCommandToHistory:k,remapElement:remapElement,addSVGElementFromJson:m,getGridSnapping:S,getOpacity:M,getSelectedElements:y,getContainer:function(){return t},setStarted:function(e){K=e},getRubberBox:function(){return ae},setRubberBox:function(e){return ae=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;x.canDeleteNodes=!0,x.closed_subpath=t,N("pointsAdded",{closedSubpath:t,grips:n}),N("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;k(t),N("changed",[n])},getCurrentZoom:A,getId:G,getNextId:T,getMouseTarget:R,getCurrentMode:function(){return J},setCurrentMode:function(e){return J=e},getDrawnPath:function(){return Ge},setDrawnPath:function(e){return Ge=e},getSVGRoot:C});var O={},B="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",V=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],j=$$9.data,F=document.createElementNS(NS.SVG,"animate");$$9(F).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(s);var D,U=function e(t){var n=$$9(t).attr(V);for(var a in n){var r=n[a];if(r&&r.startsWith("url(")){var i=getUrlFromAttr(r).substr(1);getElem(i)||(findDefs().append(X[i]),delete X[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),ze("transform",d,f),N("changed",f)}var h=P.requestSelector(f[0]);h.resize(),h.updateGripCursors(e)};var he=this.recalculateAllSelectedDimensions=function(){for(var e=new BatchCommand$1("none"===ee?"position":"size"),t=f.length;t--;){var n=f[t],a=recalculateDimensions(n);a&&e.addSubCommand(a)}e.isEmpty()||(k(e),N("changed",f))},ge=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},pe=null,fe=this.selectOnly=function(e,t){L(!0),I(e,t)};this.removeFromSelection=function(e){if(null!=f[0]&&e.length){for(var t=[],n=f.length,a=0;a0&&i.removeFromSelection(E),T.length>0&&i.addToSelection(T);break;case"resize":k=getTransformList(v);var R=hasMatrixTransform(k),O=(p=R?xe:getBBox(v)).x,B=p.y,V=p,j=V.width,F=V.height;if(c=S-me,u=$-_e,a.gridSnapping&&(c=snapToGrid(c),u=snapToGrid(u),F=snapToGrid(F),j=snapToGrid(j)),g=getRotationAngle(v)){var D=Math.sqrt(c*c+u*u),U=Math.atan2(u,c)-g*Math.PI/180;c=D*Math.cos(U),u=D*Math.sin(U)}ee.includes("n")||ee.includes("s")||(u=0),ee.includes("e")||ee.includes("w")||(c=0);var H=0,z=0,q=F?(F+u)/F:1,W=j?(j+c)/j:1;ee.includes("n")&&(q=F?(F-u)/F:1,z=F),ee.includes("w")&&(W=j?(j-c)/j:1,H=j);var Y=s.createSVGTransform(),X=s.createSVGTransform(),Q=s.createSVGTransform();if(a.gridSnapping&&(O=snapToGrid(O),H=snapToGrid(H),B=snapToGrid(B),z=snapToGrid(z)),Y.setTranslate(-(O+H),-(B+z)),e.shiftKey&&(1===W?W=q:q=W),X.setScale(W,q),Q.setTranslate(O+H,B+z),R){var Z=g?1:0;k.replaceItem(Y,2+Z),k.replaceItem(X,1+Z),k.replaceItem(Q,Number(Z))}else{var te=k.numberOfItems;k.replaceItem(Q,te-3),k.replaceItem(X,te-2),k.replaceItem(Y,te-1)}P.requestSelector(v).resize(),N("transition",f);break;case"zoom":C*=d,w*=d,assignAttributes(ae,{x:Math.min(be*d,C),y:Math.min(ye*d,w),width:Math.abs(C-be*d),height:Math.abs(w-ye*d)},100);break;case"text":assignAttributes(y,{x:S,y:$},1e3);break;case"line":a.gridSnapping&&(S=snapToGrid(S),$=snapToGrid($));var ne=S,re=$;e.shiftKey&&(ne=(n=snapToAngle(me,_e,ne,re)).x,re=n.y),y.setAttributeNS(null,"x2",ne),y.setAttributeNS(null,"y2",re);break;case"foreignObject":case"square":case"rect":case"image":var ie="square"===J||e.shiftKey,le=Math.abs(S-me),ce=Math.abs($-_e),ue=void 0,de=void 0;ie?(le=ce=Math.max(le,ce),ue=me.8){Ce-=.8;var Le=l.createSVGPoint();Le.x=Ae.x,Le.y=Ae.y,y.points.appendItem(Le)}Se={x:we.x,y:we.y},we={x:$e.x,y:$e.y},$e={x:ke.x,y:ke.y};break;case"path":case"pathedit":if(S*=d,$*=d,a.gridSnapping&&(S=snapToGrid(S),$=snapToGrid($),me=snapToGrid(me),_e=snapToGrid(_e)),e.shiftKey){var Ie=path,Me=void 0,Re=void 0;Ie?(Me=Ie.dragging?Ie.dragging[0]:me,Re=Ie.dragging?Ie.dragging[1]:_e):(Me=me,Re=_e);var Oe=n=snapToAngle(Me,Re,S,$);S=Oe.x,$=Oe.y}ae&&"none"!==ae.getAttribute("display")&&(C*=d,w*=d,assignAttributes(ae,{x:Math.min(be*d,C),y:Math.min(ye*d,w),width:Math.abs(C-be*d),height:Math.abs(w-ye*d)},100)),x.mouseMove(S,$);break;case"textedit":S*=d,$*=d,Ne.mouseMove(_,b);break;case"rotate":r=(p=getBBox(v)).x+p.width/2,o=p.y+p.height/2;var Be=getMatrix(v),Ve=transformPoint(r,o,Be);r=Ve.x,o=Ve.y,g=(Math.atan2(o-$,r-S)*(180/Math.PI)-90)%360,a.gridSnapping&&(g=snapToGrid(g)),e.shiftKey&&(g=45*Math.round(g/45)),i.setRotationAngle(g<-180?360+g:g,!0),N("transition",f)}oe("mouseMove",{event:e,mouse_x:_,mouse_y:b,selected:v})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==h){var n=R(e),a=n.tagName;if("text"===a&&"textedit"!==J){var r=transformPoint(e.pageX,e.pageY,pe);Ne.select(n,r.x,r.y)}"g"!==a&&"a"!==a||!getRotationAngle(n)||(qe(n),n=f[0],L(!0)),h&&leaveContext(),"g"!==t.tagName&&"a"!==t.tagName||t===u().getCurrentLayer()||n===P.selectorParentGroup||setContext(n)}}).mouseup(function(e){if(2!==e.button){var t=ne;if(ne=null,K){var n=transformPoint(e.pageX,e.pageY,pe),r=n.x*d,o=n.y*d,s=r/d,l=o/d,c=getElem(G()),h=!1,g=s,v=l;K=!1;var _=void 0,b=void 0;switch(J){case"resize":case"multiselect":null!=ae&&(ae.setAttribute("display","none"),re=[]),J="select";case"select":if(null!=f[0]){if(null==f[1]){var y=f[0];switch(y.tagName){case"g":case"use":case"image":case"foreignObject":break;default:te.fill=y.getAttribute("fill"),te.fill_opacity=y.getAttribute("fill-opacity"),te.stroke=y.getAttribute("stroke"),te.stroke_opacity=y.getAttribute("stroke-opacity"),te.stroke_width=y.getAttribute("stroke-width"),te.stroke_dasharray=y.getAttribute("stroke-dasharray"),te.stroke_linejoin=y.getAttribute("stroke-linejoin"),te.stroke_linecap=y.getAttribute("stroke-linecap")}"text"===y.tagName&&(W.font_size=y.getAttribute("font-size"),W.font_family=y.getAttribute("font-family")),P.requestSelector(y).showGrips(!0)}if(he(),g!==be||v!==ye)for(var C=f.length,S=0;S=0?A.indexOf(",",E+1)>=0:A.indexOf(" ",A.indexOf(" ")+1)>=0)&&(c=x.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=_.width||_.height||"image"===J;break;case"circle":h="0"!==c.getAttribute("r");break;case"ellipse":_=$$9(c).attr(["rx","ry"]),h=_.rx||_.ry;break;case"fhellipse":ve.maxx-ve.minx>0&&ve.maxy-ve.miny>0&&(c=m({element:"ellipse",curStyles:!0,attr:{cx:(ve.minx+ve.maxx)/2,cy:(ve.miny+ve.maxy)/2,rx:(ve.maxx-ve.minx)/2,ry:(ve.maxy-ve.miny)/2,id:G()}}),N("changed",[c]),h=!0);break;case"fhrect":ve.maxx-ve.minx>0&&ve.maxy-ve.miny>0&&(c=m({element:"rect",curStyles:!0,attr:{x:ve.minx,y:ve.miny,width:ve.maxx-ve.minx,height:ve.maxy-ve.miny,id:G()}}),N("changed",[c]),h=!0);break;case"text":h=!0,fe([c]),Ne.start(c);break;case"path":c=null,K=!0;var T=x.mouseUp(e,c,r,o);c=T.element,h=T.keep;break;case"pathedit":h=!0,c=null,x.mouseUp(e);break;case"textedit":h=!1,c=null,Ne.mouseUp(e,r,o);break;case"rotate":h=!0,c=null,J="select";var L=i.undoMgr.finishUndoableChange();L.isEmpty()||k(L),he(),N("changed",f)}var I=oe("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,K=t.started||K)}),h||null==c){if(null!=c){i.addedNew=!0;var M=.2,R=void 0;if(F.beginElement&&parseFloat(c.getAttribute("opacity"))!==p.opacity){R=$$9(F).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"===J?x.toEditMode(c):a.selectNew&&fe([c],!0),k(new InsertElementCommand$1(c)),N("changed",[c])},1e3*M)}}else{for(u().releaseId(G()),c.remove(),c=null,b=e.target;b&&b.parentNode&&b.parentNode.parentNode&&"g"===b.parentNode.parentNode.tagName;)b=b.parentNode;"path"===J&&Ge||!b||!b.parentNode||"selectorParentGroup"===b.parentNode.id||"svgcanvas"===b.id||"svgroot"===b.id||(i.setMode("select"),fe([b],!0))}Z=null}}}),$$9(t).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;pe=$$9("#svgcontent g")[0].getScreenCTM().inverse();var n=$$9("#workarea"),r=a.showRulers?16:0,o=transformPoint(t.pageX,t.pageY,pe),s=n.width(),l=n.height(),c=s-15-r,u=l-15-r,h=c*pe.a,g=u*pe.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,pe),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)),N("updateCanvas",{center:!1,newCtr:S}),N("zoomDone")}}}});var Ne=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,pe),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,Ne.toEditMode(n,a)},start:function(t){e=t,Ne.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&&Ne.toSelectMode(!0)},setCursor:p,toEditMode:function(t,n){if(g=!1,J="textedit",P.requestSelector(e).showGrips(!1),P.requestSelector(e),Ne.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){J="select",clearInterval(r),r=null,a&&$$9(a).attr("display","none"),n&&$$9(n).attr("visibility","hidden"),$$9(e).css("cursor","move"),o&&(L(),$$9(e).css("cursor","move"),N("selected",[e]),I([e],!0)),e&&!e.textContent.length&&i.deleteSelectedElements(),$$9(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===J&&Ne.toSelectMode()},init:function(n){if(e){var a=void 0,r=void 0;e.parentNode||(e=f[0],P.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=O.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(;Le()>0;);x.clear(!0),$$9.each(l.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&l.firstChild.before(t)}),h&&(leaveContext(),fe([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=x.convertPath(e,!0)),isNaN(v)?i.test(v)&&(v=shortFloat(v)+r):v=shortFloat(v),z.apply&&"image"===e.nodeName&&"href"===f.localName&&z.images&&"embed"===z.images){var m=H[v];m&&(v=m)}f.namespaceURI&&f.namespaceURI!==NS.SVG&&!w[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){return new Promise(function(n,a){$$9(new Image).load(function(r,i,o){if("error"!==i){var s=document.createElement("canvas");s.width=this.width,s.height=this.height,s.getContext("2d").drawImage(this,0,0);try{var l=";svgedit_url="+encodeURIComponent(e);l=s.toDataURL().replace(";base64",l+";base64"),H[e]=l}catch(t){H[e]=!1}Q=e,t&&t(H[e]),n(H[e])}else a(new Error("Error loading image: "+o.status+" "+o.statusText))}).attr("src",e)})},this.setGoodImage=function(e){Q=e},this.open=function(){},this.save=function(e){L(),e&&$$9.extend(z,e),z.apply=!0;var t=this.svgCanvasToString();N("saved",t)};var Me=void 0;this.rasterExport=function(e,t,n,r){var o,s=this,l="ICO"===e?"BMP":e||"PNG",c="image/"+l.toLowerCase(),u=Ie(),d=u.issues,h=u.issueCodes,g=this.svgCanvasToString();return new Promise((o=asyncToGenerator(regeneratorRuntime.mark(function o(u,p){var 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:g,issues:d,issueCodes:h,type:e,mimeType:c,quality:t,exportWindowName:n};N("exported",a),r&&r(a),u(a)},Me){o.next=6;break}return o.next=4,importSetGlobal(a.canvgPath+"canvg.js",{global:"canvg"});case 4:f=o.sent,Me=f.canvg;case 6:return $$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=12,Me(v,g);case 12:if(m=l.toLowerCase(),_=t?v.toDataURL("image/"+m,t):v.toDataURL("image/"+m),b=void 0,!v.toBlob){o.next=18;break}return v.toBlob(function(e){b=createObjectURL(e),y()},c,t),o.abrupt("return");case 18:b=dataURLToObjectURL(_),y();case 20: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,_;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=je(),d=u.w>u.h?"landscape":"portrait","pt",h=jsPDF({orientation:d,unit:"pt",format:[u.w,u.h]}),g=Fe(),h.setProperties({title:g}),p=Ie(),f=p.issues,v=p.issueCodes,m=o.svgCanvasToString(),h.addSVG(m,0,0),(_={svg:m,issues:f,issueCodes:v,exportWindowName:e,outputType:t=t||"dataurlstring"}).output=h.output(t,"save"===t?e||"svg.pdf":void 0),n&&n(_),s(_),N("exportedPDF",_);case 21:case"end":return r.stop()}},r,i)})),function(e,t){return r.apply(this,arguments)}))},this.getSvgString=function(){return z.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?randomizeIds(!1,u()):randomizeIds(!0,u())};var Re=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(V,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=T();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)}}}},Oe=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))})},Be=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")}}})},Ve=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),N("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(Re(m),isGecko()&&$$9(findDefs()).append($$9(m).find("linearGradient,radialGradient,pattern")),m.id=T(),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))}Oe(m),isGecko()?Be(findDefs()):Be(m),walkTreePost(m,function(e){try{recalculateDimensions(e)}catch(e){console.log(e)}}),$$9(m).find(B).each(function(){this.id||(this.id=T())}),fe([m]);var S=qe(m,!0);S&&n.addSubCommand(S),k(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?N("setnonce",f):N("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){Re(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?($$9(e).data("gsvg",this),e.id=e.id||T()):ce(this)}}),isGecko()&&p.find("linearGradient, radialGradient, pattern").appendTo(findDefs()),Oe(p),Be(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(B).each(function(){this.id||(this.id=T())}),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(),L(),clearData(),s.append(P.selectorParentGroup),t||k(r),N("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;q[r]&&$$9(q[r].symbol).parents("#svgroot").length&&(i=!0);var s=new BatchCommand$1("Import Image"),c=void 0;if(i)c=q[r].symbol,n=q[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),Re(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?He(e,t,a):(ze(e,t,a),N("changed",a)))};var De=this.setGradient=function(e){if(te[e+"_paint"]&&"solidColor"!==te[e+"_paint"].type){var t=i[e+"Grad"],n=Ue(t),a=findDefs();n?t=n:(t=a.appendChild(o.importNode(t,!0))).id=T(),i.setColor(e,"url(#"+t.id+")")}},Ue=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),te[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],De(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return te.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(J))i.setStrokeWidth(1);else{te.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&&(ze("stroke-width",e,t),N("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&&(ze(e,t,n),N("changed",f))},this.getStyle=function(){return p},this.getOpacity=M,this.setOpacity=function(e){p.opacity=e,ze("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?He(e+"-opacity",t):ze(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),k(e),e=null,t=null}i.setBlurNoUndo=function(e){if(t)if(0===e)He("filter",""),n=!0;else{var a=f[0];n&&He("filter","url(#"+a.id+"_blur)"),isWebkit()&&(console.log("e",a),a.removeAttribute("filter"),a.setAttribute("filter","url(#"+a.id+"_blur)")),He("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));ze("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]&&ze("font-weight",e?"bold":"normal"),f[0].textContent||Ne.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]&&ze("font-style",e?"italic":"normal"),f[0].textContent||Ne.setCursor()},this.getFontFamily=function(){return W.font_family},this.setFontFamily=function(e){W.font_family=e,ze("font-family",e),f[0]&&!f[0].textContent&&Ne.setCursor()},this.setFontColor=function(e){W.fill=e,ze("fill",e)},this.getFontColor=function(){return W.fill},this.getFontSize=function(){return W.font_size},this.setFontSize=function(e){W.font_size=e,ze("font-size",e),f[0].textContent||Ne.setCursor()},this.getText=function(){var e=f[0];return null==e?"":e.textContent},this.setTextContent=function(e){ze("#text",e),Ne.init(e),Ne.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){var i=new BatchCommand$1("Change Image URL");setHref(t,e),i.addSubCommand(new ChangeElementCommand$1(t,{"#href":r})),$$9(new Image).load(function(){var e=$$9(t).attr(["width","height"]);$$9(t).attr({width:this.width,height:this.height}),P.requestSelector(t).resize(),i.addSubCommand(new ChangeElementCommand$1(t,e)),k(i),N("changed",[t])}).attr("src",e)}}},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})),k(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),k(new ChangeElementCommand$1(t,{rx:n,ry:n},"Radius")),N("changed",[t]))}},this.makeHyperlink=function(e){i.groupSelectedElements("a",e)},this.removeHyperlink=function(){i.ungroupSelectedElement()},this.setSegType=function(e){x.setSegType(e)},this.convertToPath=function(e,t){if(null!=e){if(t)return getBBoxOfElementAsPath(e,m,x);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,x,L,I,history,k)}var a=f;$$9.each(a,function(e,t){t&&i.convertToPath(t)})};var He=function(e,t,n){"pathedit"===J&&x.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=de(l))):"#href"===e?setHref(l,t):l.setAttribute(e,t),"textedit"===J&&"#text"!==e&&l.textContent.length&&Ne.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=de(l)),f.includes(l)&&setTimeout(function(){l.parentNode&&P.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()},ze=this.changeSelectedAttribute=function(e,t,n){n=n||f,i.undoMgr.beginUndoableChange(e,n),He(e,t,n);var a=i.undoMgr.finishUndoableChange();a.isEmpty()||k(a)};this.deleteSelectedElements=function(){for(var e=new BatchCommand$1("Delete Elements"),t=f.length,n=[],a=0;an[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}fe([a],!0),N("selected",f)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:k,BatchCommand:BatchCommand$1,ChangeElementCommand:ChangeElementCommand$1,decode64:decode64,encode64:encode64,ffClone:de,findDefs:findDefs,findDuplicateGradient:Ue,getElem:getElem,getPathBBox:getPathBBox,getTypeMap:getTypeMap,getUrlFromAttr:getUrlFromAttr,identifyLayers:identifyLayers,InsertElementCommand:InsertElementCommand$1,isChrome:isChrome,isIdentity:isIdentity,isIE:isIE,logMatrix:ge,MoveElementCommand:MoveElementCommand$1,NS:NS,preventClickDefault:preventClickDefault,RemoveElementCommand:RemoveElementCommand$1,SVGEditTransformList:SVGTransformList,text2xml:text2xml,transformBox:transformBox,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){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},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()})}}function y(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)}var x=void 0;function C(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),C(e(new Image).attr({class:"svg_icon",src:p+n,width:s,height:l,alt:"icon"}),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 g=e(l+"> .jGraduate_colPick"),p=e(l+"> .jGraduate_gradPick");p.html('

    '+o.window.pickerTitle+'


    ');var f=256,v=f-0,m=f-0,_={};e(".jGraduate_SliderBar").width(145);var b=e("#"+s+"_jGraduate_GradContainer")[0],y=n("svg",{id:s+"_jgraduate_svg",width:f,height:f,xmlns:ns.svg},b),x=i.paint.type,C=i.paint[x],S=C,w=i.paint.alpha,$="solidColor"===x;switch(x){case"solidColor":case"linearGradient":if($||(S.id=s+"_lg_jgraduate_grad",C=S=y.appendChild(S)),n("radialGradient",{id:s+"_rg_jgraduate_grad"},y),"linearGradient"===x)break;case"radialGradient":$||(S.id=s+"_rg_jgraduate_grad",C=S=y.appendChild(S)),n("linearGradient",{id:s+"_lg_jgraduate_grad"},y)}var k=void 0;if($){C=S=e("#"+s+"_lg_jgraduate_grad")[0],Le(0,"#"+(d=i.paint[x]),1);var A=_typeof(o.newstop);if("string"===A)switch(o.newstop){case"same":Le(1,"#"+d,1);break;case"inverse":for(var E="",P=0;P<6;P+=2){var T=(255-parseInt(d.substr(P,2),16)).toString(16);T.length<2&&(T=0+T),E+=T}Le(1,"#"+E,1);break;case"white":Le(1,"#ffffff",1);break;case"black":Le(1,"#000000",1)}else if("object"===A){var G="opac"in o.newstop?o.newstop.opac:1;Le(1,o.newstop.color||"#"+d,G)}}var N=parseFloat(C.getAttribute("x1")||0),L=parseFloat(C.getAttribute("y1")||0),I=parseFloat(C.getAttribute("x2")||1),M=parseFloat(C.getAttribute("y2")||0),R=parseFloat(C.getAttribute("cx")||.5),O=parseFloat(C.getAttribute("cy")||.5),B=parseFloat(C.getAttribute("fx")||R),V=parseFloat(C.getAttribute("fy")||O),j=n("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:v,height:m,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":w/100},y),F=e("
    ").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:L*f,left:N*f}).data("coord","start").appendTo(b),D=F.clone().text(2).css({top:M*f,left:I*f}).attr("title","End stop").data("coord","end").appendTo(b),U=e("
    ").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:O*f,left:R*f}).data("coord","center").appendTo(b),H=U.clone().text("F").css({top:V*f,left:B*f,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(b);H[0].id=s+"_jGraduate_focusCoord";var z=void 0;e.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(t,n){var a=isNaN(n[1]),r=S.getAttribute(n);r||(r=a?"0.5":"x2"===n?"1.0":"0.0"),_[n]=e("#"+s+"_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]||z)&&(a&&"radialGradient"===x||!a&&"linearGradient"===x)&&S.setAttribute(n,this.value);var e=a?"c"===n[0]?U:H:"1"===n[1]?F:D,t=n.includes("x")?"left":"top";e.css(t,this.value*f)}).change()});var q=e("#"+s+"_jGraduate_StopSlider"),W=void 0,Y=void 0,X=void 0,Q=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,Z=1,J=1,ee=0,te=R,ne=O,ae=n("svg",{width:"100%",height:45},q[0]),re=n("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ae),ie=n("image",{width:16,height:16},re),oe=o.images.clientPath+"map-opacity.png";ie.setAttributeNS(ns.xlink,"xlink:href",oe),e(ae).click(function(e){if(K=q.offset(),"path"!==e.target.tagName){var t=e.pageX-K.left-8;Le((t=t<10?10:t>f+10?f+10:t)/f,0,0,!0),e.stopPropagation()}}),e(ae).mouseover(function(){ae.append(Q)}),k=n("g",{},ae),n("line",{x1:10,y1:15,x2:f+10,y2:15,"stroke-width":2,stroke:"#000"},ae);var se=p.find(".jGraduate_spreadMethod").change(function(){S.setAttribute("spreadMethod",e(this).val())}),le=null,ce=function(e){var t=e.pageX-ge.left,n=e.pageY-ge.top;t=t<0?0:t>f?f:t,n=n<0?0:n>f?f:n,le.css("left",t).css("top",n);var a=t/v,r=n/m,i=le.data("coord"),o=S;switch(i){case"start":_.x1.val(a),_.y1.val(r),o.setAttribute("x1",a),o.setAttribute("y1",r);break;case"end":_.x2.val(a),_.y2.val(r),o.setAttribute("x2",a),o.setAttribute("y2",r);break;case"center":_.cx.val(a),_.cy.val(r),o.setAttribute("cx",a),o.setAttribute("cy",r),te=a,ne=r,Re();break;case"focus":_.fx.val(a),_.fy.val(r),o.setAttribute("fx",a),o.setAttribute("fy",r),Re()}e.preventDefault()},ue=function e(){le=null,h.unbind("mousemove",ce).unbind("mouseup",e)},de=(W=S.getElementsByTagNameNS(ns.svg,"stop")).length;if(de<2){for(;de<2;)S.append(document.createElementNS(ns.svg,"stop")),++de;W=S.getElementsByTagNameNS(ns.svg,"stop")}for(var he=0;he99.5&&(n=99.5),n>0?J=1-n/100:Z=-n/100-1,r=(n+100)/2*145/100,e&&Re();break;case"angle":r=(ee=n)/180,r+=.5,r*=145,e&&Re()}r>145?r=145:r<0&&(r=0),a.css({"margin-left":r-5})}).change()});for(var Ee=function(e){!function(e){var t=ve.offset,n=ve.parent,a=e.pageX-t.left-parseInt(n.css("border-left-width"));a>145&&(a=145),a<=0&&(a=0);var r=a-5;switch(a/=145,ve.type){case"radius":(a=Math.pow(2*a,2.5))>.98&&a<1.02&&(a=1),a<=.01&&(a=.01),S.setAttribute("r",a);break;case"opacity":i.paint.alpha=parseInt(100*a),j.setAttribute("fill-opacity",a);break;case"ellip":Z=1,J=1,a<.5?Z=(a/=.5)<=0?.01:a:a>.5&&(J=(a=2-(a/=.5))<=0?.01:a),Re(),J===1+(a-=1)&&(a=Math.abs(a));break;case"angle":a-=.5,ee=a*=180,Re(),a/=100}ve.elem.css({"margin-left":r}),a=Math.round(100*a),ve.input.val(a)}(e),e.preventDefault()},Pe=function e(t){h.unbind("mousemove",Ee).unbind("mouseup",e),ve=null},Te=(255*i.paint.alpha/100).toString(16);Te.length<2;)Te="0"+Te;Te=Te.split(".")[0],d="none"===i.paint.solidColor?"":i.paint.solidColor+Te,$||(d=W[0].getAttribute("stop-color")),e.extend(e.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),g.jPicker({window:{title:o.window.pickerTitle},images:{clientPath:o.images.clientPath},color:{active:d,alphaSupport:!0}},function(e){i.paint.type="solidColor",i.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,i.paint.solidColor=e.val("hex")?e.val("hex"):"none",i.paint.radialGradient=null,c()},null,function(){u()});var Ge=e(l+" .jGraduate_tabs li");Ge.click(function(){Ge.removeClass("jGraduate_tab_current"),e(this).addClass("jGraduate_tab_current"),e(l+" > div").hide();var t=e(this).attr("data-type");if(e(l+" .jGraduate_gradPick").show(),"rg"===t||"lg"===t){e(".jGraduate_"+t+"_field").show(),e(".jGraduate_"+("lg"===t?"rg":"lg")+"_field").hide(),e("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+t+"_jgraduate_grad)"),x="lg"===t?"linearGradient":"radialGradient",e("#"+s+"_jGraduate_OpacInput").val(i.paint.alpha).change();var n=e("#"+s+"_"+t+"_jgraduate_grad")[0];if(S!==n){var a=e(S).find("stop");e(n).empty().append(a),S=n;var r=se.val();S.setAttribute("spreadMethod",r)}z="rg"===t&&null!=S.getAttribute("fx")&&!(R===B&&O===V),e("#"+s+"_jGraduate_focusCoord").toggle(z),z&&(e("#"+s+"_jGraduate_match_ctr")[0].checked=!1)}else e(l+" .jGraduate_gradPick").hide(),e(l+" .jGraduate_colPick").show()}),e(l+" > div").hide(),Ge.removeClass("jGraduate_tab_current");var Ne=void 0;switch(i.paint.type){case"linearGradient":Ne=e(l+" .jGraduate_tab_lingrad");break;case"radialGradient":Ne=e(l+" .jGraduate_tab_radgrad");break;default:Ne=e(l+" .jGraduate_tab_color")}i.show(),setTimeout(function(){Ne.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Le(t,a,r,i,l){var c=l||n("stop",{"stop-color":a,"stop-opacity":r,offset:t},S);l?(a=l.getAttribute("stop-color"),r=l.getAttribute("stop-opacity"),t=l.getAttribute("offset")):S.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",d=n("path",{d:u,fill:"url(#jGraduate_trans)",transform:"translate("+(10+t*f)+", 26)"},k),g=n("path",{d:u,fill:a,"fill-opacity":r,transform:"translate("+(10+t*f)+", 26)",stroke:"#000","stroke-width":1.5},k);return e(g).mousedown(function(e){return Ie(this),X=Y,h.mousemove(Oe).mouseup(Me),K=q.offset(),e.preventDefault(),!1}).data("stop",c).data("bg",d).dblclick(function(){e("div.jGraduate_LightBox").show();for(var t=this,n=+c.getAttribute("stop-opacity")||1,r=c.getAttribute("stop-color")||1,i=(255*parseFloat(n)).toString(16);i.length<2;)i="0"+i;a=r.substr(1)+i,e("#"+s+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:o.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("#"+s+"_jGraduate_stopPicker").hide()},null,function(){e("div.jGraduate_LightBox").hide(),e("#"+s+"_jGraduate_stopPicker").hide()})}),e(S).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}}),i&&Ie(g),c}function Ie(e){Y&&Y.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),(Y=e).parentNode.append(Y)}function Me(){h.unbind("mousemove",Oe),"none"!==Q.getAttribute("display")&&function(){Q.setAttribute("display","none");var t=e(Y),n=t.data("stop"),a=t.data("bg");e([Y,n,a]).remove()}(),X=null}function Re(){var e=ee?"rotate("+ee+","+te+","+ne+") ":"";if(1===Z&&1===J)S.removeAttribute("gradientTransform");else{var t=-te*(Z-1),n=-ne*(J-1);S.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+Z+","+J+")")}}function Oe(t){var n=t.pageX-K.left,a=t.pageY-K.top,r="translate("+(n=n<10?10:n>f+10?f+10:n)+", 26)";a<-60||a>130?(Q.setAttribute("display","block"),Q.setAttribute("transform",r)):Q.setAttribute("display","none"),X.setAttribute("transform",r),e.data(X,"bg").setAttribute("transform",r);var i=e.data(X,"stop"),o=(n-10)/f;i.setAttribute("offset",o);var s=0;e(S).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 jQueryContextMenu(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)})}function n(t,n,a,r){var i=this,o=t.find("td.Text input");function s(e){if(""!==e.target.value||e.target===y.get(0)||(null==a||e.target===a.get(0))&&null!=a){if(!u(e))return e;switch(e.target){case g.get(0):switch(e.keyCode){case 38:return g.val(d.call(i,1+(g.val()<<0),0,255)),n.val("r",g.val(),e.target),!1;case 40:return g.val(d.call(i,(g.val()<<0)-1,0,255)),n.val("r",g.val(),e.target),!1}break;case p.get(0):switch(e.keyCode){case 38:return p.val(d.call(i,1+(p.val()<<0),0,255)),n.val("g",p.val(),e.target),!1;case 40:return p.val(d.call(i,(p.val()<<0)-1,0,255)),n.val("g",p.val(),e.target),!1}break;case f.get(0):switch(e.keyCode){case 38:return f.val(d.call(i,1+(f.val()<<0),0,255)),n.val("b",f.val(),e.target),!1;case 40:return f.val(d.call(i,(f.val()<<0)-1,0,255)),n.val("b",f.val(),e.target),!1}break;case v&&v.get(0):switch(e.keyCode){case 38:return v.val(d.call(i,parseFloat(v.val())+1,0,100)),n.val("a",toFixedNumeric(255*v.val()/100,r),e.target),!1;case 40:return v.val(d.call(i,parseFloat(v.val())-1,0,100)),n.val("a",toFixedNumeric(255*v.val()/100,r),e.target),!1}break;case m.get(0):switch(e.keyCode){case 38:return m.val(d.call(i,1+(m.val()<<0),0,360)),n.val("h",m.val(),e.target),!1;case 40:return m.val(d.call(i,(m.val()<<0)-1,0,360)),n.val("h",m.val(),e.target),!1}break;case _.get(0):switch(e.keyCode){case 38:return _.val(d.call(i,1+(_.val()<<0),0,100)),n.val("s",_.val(),e.target),!1;case 40:return _.val(d.call(i,(_.val()<<0)-1,0,100)),n.val("s",_.val(),e.target),!1}break;case b.get(0):switch(e.keyCode){case 38:return b.val(d.call(i,1+(b.val()<<0),0,100)),n.val("v",b.val(),e.target),!1;case 40:return b.val(d.call(i,(b.val()<<0)-1,0,100)),n.val("v",b.val(),e.target),!1}}}}function l(e){if(""!==e.target.value||e.target===y.get(0)||(null==a||e.target===a.get(0))&&null!=a){if(!u(e))return e;switch(e.target){case g.get(0):g.val(d.call(i,g.val(),0,255)),n.val("r",g.val(),e.target);break;case p.get(0):p.val(d.call(i,p.val(),0,255)),n.val("g",p.val(),e.target);break;case f.get(0):f.val(d.call(i,f.val(),0,255)),n.val("b",f.val(),e.target);break;case v&&v.get(0):v.val(d.call(i,v.val(),0,100)),n.val("a",toFixedNumeric(255*v.val()/100,r),e.target);break;case m.get(0):m.val(d.call(i,m.val(),0,360)),n.val("h",m.val(),e.target);break;case _.get(0):_.val(d.call(i,_.val(),0,100)),n.val("s",_.val(),e.target);break;case b.get(0):b.val(d.call(i,b.val(),0,100)),n.val("v",b.val(),e.target);break;case y.get(0):y.val(y.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),a&&a.val(y.val()),n.val("hex",""!==y.val()?y.val():null,e.target);break;case a&&a.get(0):a.val(a.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),y.val(a.val()),n.val("hex",""!==a.val()?a.val():null,e.target);break;case x&&x.get(0):x.val(x.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2)),n.val("a",null!=x.val()?parseInt(x.val(),16):null,e.target)}}}function c(e){if(null!=n.val())switch(e.target){case g.get(0):g.val(n.val("r"));break;case p.get(0):p.val(n.val("g"));break;case f.get(0):f.val(n.val("b"));break;case v&&v.get(0):v.val(toFixedNumeric(100*n.val("a")/255,r));break;case m.get(0):m.val(n.val("h"));break;case _.get(0):_.val(n.val("s"));break;case b.get(0):b.val(n.val("v"));break;case y.get(0):case a&&a.get(0):y.val(n.val("hex")),a&&a.val(n.val("hex"));break;case x&&x.get(0):x.val(n.val("ahex").substring(6))}}function u(e){switch(e.keyCode){case 9:case 16:case 29:case 37:case 39:return!1;case"c".charCodeAt():case"v".charCodeAt():if(e.ctrlKey)return!1}return!0}function d(e,t,n){return""===e||isNaN(e)?t:e>n?n:e7?o.eq(6):null,m=o.eq(0),_=o.eq(1),b=o.eq(2),y=o.eq(o.length>7?7:6),x=o.length>7?o.eq(8):null;e.extend(!0,i,{destroy:function(){g.add(p).add(f).add(v).add(m).add(_).add(b).add(y).add(a).add(x).unbind("keyup",l).unbind("blur",c),g.add(p).add(f).add(v).add(m).add(_).add(b).unbind("keydown",s),n.unbind(h),g=null,p=null,f=null,v=null,m=null,_=null,b=null,y=null,x=null}}),g.add(p).add(f).add(v).add(m).add(_).add(b).add(y).add(a).add(x).bind("keyup",l).bind("blur",c),g.add(p).add(f).add(v).add(m).add(_).add(b).bind("keydown",s),n.bind(h)}e.loadingStylesheets.includes("jgraduate/css/jPicker.css")||e.loadingStylesheets.push("jgraduate/css/jPicker.css"),e.jPicker={List:[],Color:function(t){var n=this;function a(e){for(var t=0;t255&&(b.r=255),i!==b.r&&(i=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),s!==b.g&&(s=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),l!==b.b&&(l=b.b,m=!0);break;case"a":b.a=t&&null!=t.a?0|t.a:0|t,b.a<0?b.a=0:b.a>255&&(b.a=255),c!==b.a&&(c=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),u!==b.h&&(u=b.h,m=!0);break;case"s":if(y)continue;x=!0,b.s=null!=t.s?0|t.s:0|t,b.s<0?b.s=0:b.s>100&&(b.s=100),d!==b.s&&(d=b.s,m=!0);break;case"v":if(y)continue;x=!0,b.v=null!=t.v?0|t.v:0|t,b.v<0?b.v=0:b.v>100&&(b.v=100),h!==b.v&&(h=b.v,m=!0)}if(m){if(y){i=i||0,s=s||0,l=l||0;var S=o.rgbToHsv({r:i,g:s,b:l});u=S.h,d=S.s,h=S.v}else if(x){u=u||0,d=null!=d?d:100,h=null!=h?h:100;var w=o.hsvToRgb({h:u,s:d,v:h});i=w.r,s=w.g,l=w.b}c=null!=c?c:255,a.call(n,g||n)}}}}var i=void 0,s=void 0,l=void 0,c=void 0,u=void 0,d=void 0,h=void 0,g=[];e.extend(!0,n,{val:r,bind:function(e){"function"==typeof e&&g.push(e)},unbind:function(e){if("function"==typeof e)for(var t=void 0;t=g.includes(e);)g.splice(t,1)},destroy:function(){g=null}}),t&&(null!=t.ahex?r("ahex",t):null!=t.hex?r((null!=t.a?"a":"")+"hex",null!=t.a?{ahex:t.hex+o.intToHex(t.a)}:t):null!=t.r&&null!=t.g&&null!=t.b?r("rgb"+(null!=t.a?"a":""),t):null!=t.h&&null!=t.s&&null!=t.v&&r("hsv"+(null!=t.a?"a":""),t))},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 a=e.jPicker,r=a.Color,i=a.List,o=a.ColorMethods;return e.fn.jPicker=function(a){var s=arguments;return this.each(function(){var l=this,c=e.extend(!0,{},e.fn.jPicker.defaults,a);"input"===e(l).get(0).nodeName.toLowerCase()&&(e.extend(!0,c,{window:{bindToInput:!0,expandable:!0,input:e(l)}}),""===e(l).val()?(c.color.active=new r({hex:null}),c.color.current=new r({hex:null})):o.validateHex(e(l).val())&&(c.color.active=new r({hex:e(l).val(),a:c.color.active.val("a")}),c.color.current=new r({hex:e(l).val(),a:c.color.active.val("a")}))),c.window.expandable?e(l).after('    '):c.window.liveUpdate=!1;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function d(e){var t=M.active,n=t.val("hex"),a=void 0,r=void 0;switch(c.color.mode=e,e){case"h":if(setTimeout(function(){f.call(l,F,"transparent"),m.call(l,U,0),_.call(l,U,100),m.call(l,H,260),_.call(l,H,100),f.call(l,D,"transparent"),m.call(l,q,0),_.call(l,q,100),m.call(l,W,260),_.call(l,W,100),m.call(l,Y,260),_.call(l,Y,100),m.call(l,X,260),_.call(l,X,100),m.call(l,K,260),_.call(l,K,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(){f.call(l,F,"transparent"),m.call(l,U,-260),m.call(l,H,-520),m.call(l,q,-260),m.call(l,W,-520),m.call(l,K,260),_.call(l,K,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(){f.call(l,F,"000000"),m.call(l,U,-780),m.call(l,H,260),f.call(l,D,n),m.call(l,q,-520),m.call(l,W,260),_.call(l,W,100),m.call(l,K,260),_.call(l,K,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(){f.call(l,F,"transparent"),m.call(l,U,-260),m.call(l,H,-520),m.call(l,q,260),m.call(l,W,260),_.call(l,W,100),m.call(l,K,0),_.call(l,K,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(){_.call(l,U,100),_.call(l,q,100),m.call(l,Y,260),_.call(l,Y,100),m.call(l,X,260),_.call(l,X,100)},0);break;case"r":case"g":case"b":setTimeout(function(){f.call(l,F,"transparent"),f.call(l,D,"transparent"),_.call(l,q,100),_.call(l,U,100),m.call(l,U,a),m.call(l,H,a-260),m.call(l,q,r-780),m.call(l,W,r-520),m.call(l,Y,r),m.call(l,X,r-260),m.call(l,K,260),_.call(l,K,100)},0)}null!=t.val("ahex")&&h.call(l,t)}function h(e,t){(null==t||t!==J&&t!==Z)&&function(e,t){if(t!==Z)switch(c.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(c.color.mode){case"h":J.val("y",360-(e.val("h")||0),t);break;case"s":var l=e.val("s");J.val("y",100-(null!=l?l: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(l,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");te.css({backgroundColor:t&&"#"+t.hex||"transparent"}),_.call(l,te,t&&toFixedNumeric(100*t.a/255,4)||0)}catch(e){}}).call(l,e),function(e){switch(c.color.mode){case"h":f.call(l,F,new r({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");_.call(l,H,100-(null!=t?t:100));break;case"v":var n=e.val("v");_.call(l,U,null!=n?n:100);break;case"r":_.call(l,H,toFixedNumeric((e.val("r")||0)/255*100,4));break;case"g":_.call(l,H,toFixedNumeric((e.val("g")||0)/255*100,4));break;case"b":_.call(l,H,toFixedNumeric((e.val("b")||0)/255*100))}var a=e.val("a");_.call(l,z,toFixedNumeric(100*(255-(a||0))/255,4))}.call(l,e),function(e){switch(c.color.mode){case"h":var t=e.val("a");_.call(l,Q,toFixedNumeric(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),a=new r({h:n&&n.h||0,s:100,v:null!=n?n.v:100});f.call(l,D,a.val("hex")),_.call(l,W,100-(null!=n?n.v:100)),_.call(l,Q,toFixedNumeric(100*(255-(n&&n.a||0))/255,4));break;case"v":var i=e.val("hsa"),o=new r({h:i&&i.h||0,s:null!=i?i.s:100,v:100});f.call(l,D,o.val("hex")),_.call(l,Q,toFixedNumeric(100*(255-(i&&i.a||0))/255,4));break;case"r":case"g":case"b":var s=e.val("rgba"),u=0,d=0;"r"===c.color.mode?(u=s&&s.b||0,d=s&&s.g||0):"g"===c.color.mode?(u=s&&s.b||0,d=s&&s.r||0):"b"===c.color.mode&&(u=s&&s.r||0,d=s&&s.g||0);var h=d>u?u:d;_.call(l,W,u>d?toFixedNumeric((u-d)/(255-d)*100,4):0),_.call(l,Y,d>u?toFixedNumeric((d-u)/(255-u)*100,4):0),_.call(l,X,toFixedNumeric(h/255*100,4)),_.call(l,Q,toFixedNumeric(100*(255-(s&&s.a||0))/255,4));break;case"a":var g=e.val("a");f.call(l,D,e.val("hex")||"000000"),_.call(l,Q,null!=g?0:100),_.call(l,K,null!=g?100:0)}}.call(l,e)},0)}function g(e,t){var n=M.active;if(t===Z||null!=n.val()){var a=e.val("all");switch(c.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 p(e,t){var n=M.active;if(t===J||null!=n.val())switch(c.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 f(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function v(e,t){u&&(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 m(e,t){e.css({top:t+"px"})}function _(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(u){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:toFixedNumeric(t/100,4)})}else e.css({opacity:toFixedNumeric(t/100,4)});else if(0===t||100===t)if(u){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 b(){M.active.val("ahex",M.current.val("ahex"))}function y(t){e(this).parents("tbody:first").find('input:radio[value!="'+t.target.value+'"]').removeAttr("checked"),d.call(l,t.target.value)}function x(){b.call(l)}function C(){b.call(l),c.window.expandable&&N.call(l),"function"==typeof he&&he.call(l,M.active,re)}function S(){(function(){M.current.val("ahex",M.active.val("ahex"))}).call(l),c.window.expandable&&N.call(l),"function"==typeof ue&&ue.call(l,M.active,ae)}function w(){G.call(l)}function $(e,t){var n=e.val("hex");ne.css({backgroundColor:n&&"#"+n||"transparent"}),_.call(l,ne,toFixedNumeric(100*(e.val("a")||0)/255,4))}function k(e,t){var n=e.val("hex"),a=e.val("va");oe.css({backgroundColor:n&&"#"+n||"transparent"}),_.call(l,se,toFixedNumeric(100*(255-(a&&a.a||0))/255,4)),c.window.bindToInput&&c.window.updateInputColor&&c.window.input.css({backgroundColor:n&&"#"+n||"transparent",color:null==a||a.v>75?"#000000":"#ffffff"})}function A(t){R=parseInt(j.css("left")),O=parseInt(j.css("top")),B=t.pageX,V=t.pageY,e(document).bind("mousemove",E).bind("mouseup",P),t.preventDefault()}function E(t){return j.css({left:R-(B-t.pageX)+"px",top:O-(V-t.pageY)+"px"}),c.window.expandable&&!e.support.boxModel&&j.prev().css({left:j.css("left"),top:j.css("top")}),t.stopPropagation(),t.preventDefault(),!1}function P(t){return e(document).unbind("mousemove",E).unbind("mouseup",P),t.stopPropagation(),t.preventDefault(),!1}function T(t){return t.preventDefault(),t.stopPropagation(),M.active.val("ahex",e(this).attr("title")||null,t.target),!1}function G(){function t(){if(c.window.expandable&&!e.support.boxModel){var t=j.find("table:first");j.before("