diff --git a/CHANGES.md b/CHANGES.md index e682bb387..9b2591e7d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # SVG-Edit CHANGES -# ? +# 4.1.0 - Fix: Avoid cross-frame unsafe `instanceof` - Enhancement: Add svgcanvas distributions diff --git a/README.md b/README.md index d45ebd449..9429e4696 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ incorporating SVGEdit. ## Recent news +- 2018-11-29 Published 4.0.2 (Fix for hyphenated locales, svgcanvas distributions) - 2018-11-16 Published 4.0.0/4.0.1 (Move to Promise-based APIs) - 2018-11-01 Published 3.2.0 (Update qunit to resolve security vulnerability of a dependency) - 2018-10-25 Published 3.1.1 (Fix for saving SVG on Firefox) diff --git a/dist/index-es.js b/dist/index-es.js index 3e1b509db..b074836c7 100644 --- a/dist/index-es.js +++ b/dist/index-es.js @@ -28897,7 +28897,7 @@ function getImportLocale(_ref) { importLocale = function _ref3(language) { var url = "".concat(curConfig.extPath, "ext-locale/").concat(name, "/").concat(language, ".js"); return importSetGlobalDefault(url, { - global: "svgEditorExtensionLocale_".concat(name, "_").concat(language) + global: "svgEditorExtensionLocale_".concat(name, "_").concat(language.replace(/-/g, '_')) }); }; diff --git a/dist/index-es.min.js b/dist/index-es.min.js index f47093205..262daf64c 100644 --- a/dist/index-es.min.js +++ b/dist/index-es.min.js @@ -1,2 +1,2 @@ -function _typeof(e){return(_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})(e)}function asyncGeneratorStep(e,t,n,r,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,a)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var i=e.apply(t,n);function s(e){asyncGeneratorStep(i,r,a,s,o,"next",e)}function o(e){asyncGeneratorStep(i,r,a,s,o,"throw",e)}s(void 0)})}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(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=r,window.SVGPathSegLinetoAbs=a,window.SVGPathSegLinetoRel=i,window.SVGPathSegCurvetoCubicAbs=s,window.SVGPathSegCurvetoCubicRel=o,window.SVGPathSegCurvetoQuadraticAbs=l,window.SVGPathSegCurvetoQuadraticRel=c,window.SVGPathSegArcAbs=u,window.SVGPathSegArcRel=d,window.SVGPathSegLinetoHorizontalAbs=h,window.SVGPathSegLinetoHorizontalRel=p,window.SVGPathSegLinetoVerticalAbs=g,window.SVGPathSegLinetoVerticalRel=f,window.SVGPathSegCurvetoCubicSmoothAbs=m,window.SVGPathSegCurvetoCubicSmoothRel=v,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}(),r=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,r=0,a=1,i=1,s=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!==this._string.charAt(this._currentIndex))){for(var o=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==o)for(var l=this._currentIndex-1,c=1;l>=o;)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,r+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==s&&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+r;if(u*=a,e&&(u*=Math.pow(10,i*e)),s!==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 r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,a.x,a.y,a.x1,a.y1,a.x2,a.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 s={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,s.x,s.y,s.x2,s.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var o={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,o.x,o.y,o.x1,o.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}(),a=new n,i=new r(e);if(!i.initialCommandIsMoveTo())return[];for(;i.hasMoreData();){var s=i.parseSegment();if(!s)return[];a.appendSegment(s)}return a.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_=Boolean(document.createElementNS&&document.createElementNS(NS.SVG,"svg").createSVGRect),_navigator=navigator,userAgent=_navigator.userAgent,svg=document.createElementNS(NS.SVG,"svg"),isOpera_=Boolean(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_=Boolean(svg.querySelector),supportsXpath_=Boolean(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);try{return 0===n.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),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 r=document.createElementNS(NS.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.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),r=function(e){return e&&"object"===_typeof(e)&&"function"==typeof e.setMatrix&&"angle"in e};return r(n)&&r(t)&&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 jQueryPluginSVG(e){var t=e.fn.attr;return e.fn.attr=function(e,n){var r=this.length;if(!r)return t.call(this,e,n);for(var a=0;a=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,n=this._xforms[e],r=new Array(this.numberOfItems-1);for(t=0;t=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(),r=n.length;r--;)e.includes(n[r])||e.push(n[r]);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,r=t.length,a=new Array(r),i=new Array(r);r--;){var s=t[r];isNullish(s)||(i[r]=s,a[r]=s.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:a,elements:i}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,r=new BatchCommand("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(!isNullish(i)){var s={};s[n]=t.oldValues[a],s[n]!==i.getAttribute(n)&&r.addSubCommand(new ChangeElementCommand(i,s,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),hstry=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=new Array(e),n=0;n(n=parseInt(n))){var r=n;n=t,t=r}for(var a=svg$1.createSVGMatrix(),i=t;i<=n;++i){var s=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 r=e.pathSegList;if(supportsPathInsertItemBefore())r.insertItemBefore(t,n);else{for(var a=r.numberOfItems,i=[],s=0;s0?(p=f 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[o+1],u=o-1<0?null:i[o-1];if(2===l.type){if(u&&1!==u.type){var d=i[s];d.next=i[s+1],d.next.prev=d,d.addGrip()}s=o}else if(c&&1===c.type)l.next=i[s+1],l.next.prev=l,l.mate=i[s],l.addGrip(),isNullish(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[s];h.next=i[s+1],h.next.prev=h,h.addGrip(),l.addGrip(),this.first_seg||(this.first_seg=i[s])}}return this}},{key:"eachSeg",value:function(e){for(var t=this.segs.length,n=0;n=0&&this.selected_pts.push(r)}this.selected_pts.sort();var a=this.selected_pts.length,i=[];for(i.length=a;a--;){var s=this.selected_pts[a],o=this.segs[s];o.select(!0),i[a]=o.ptgrip}var l=e.subpathIsClosed(this.selected_pts[0]);editorContext_.addPtsToSelection({grips:i,closedSubpath:l})}}]),e}();Path.subpathIsClosed=function(e){var t=!1;return path.eachSeg(function(n){return n<=e||2!==this.type&&(1!==this.type||(t=!0,!1))}),t};var newcx,newcy,oldcx,oldcy,angle,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]},getRotVals=function(e,t){var n=e-oldcx,r=t-oldcy,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+angle;return n=a*Math.cos(i)+oldcx,r=a*Math.sin(i)+oldcy,n-=newcx,r-=newcy,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-angle,{x:a*Math.cos(i)+newcx,y:a*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 r=newcx-oldcx,a=newcy-oldcy,i=Math.sqrt(r*r+a*a),s=Math.atan2(a,r)+angle;newcx=i*Math.cos(s)+oldcx,newcy=i*Math.sin(s)+oldcy;for(var o=e.pathSegList,l=o.numberOfItems;l;){l-=1;var c=o.getItem(l),u=c.pathSegType;if(1!==u){var d=getRotVals(c.x,c.y),h=[d.x,d.y];if(!isNullish(c.x1)&&!isNullish(c.x2)){var p=getRotVals(c.x1,c.y1),g=getRotVals(c.x2,c.y2);h.splice(h.length,0,p.x,p.y,g.x,g.y)}replacePathSeg(u,l,h)}}getBBox(e);var f=editorContext_.getSVGRoot().createSVGTransform(),m=getTransformList(e);f.setRotate(180*angle/Math.PI,newcx,newcy),m.replaceItem(f,0)}},clearData=function(){pathData={}},reorientGrads=function(e,t){for(var n=getBBox(e),r=0;r<2;r++){var a=0===r?"fill":"stroke",i=e.getAttribute(a);if(i&&i.startsWith("url(")){var s=getRefElem(i);if("linearGradient"===s.tagName){var o=s.getAttribute("x1")||0,l=s.getAttribute("y1")||0,c=s.getAttribute("x2")||1,u=s.getAttribute("y2")||0;o=n.width*o+n.x,l=n.height*l+n.y,c=n.width*c+n.x,u=n.height*u+n.y;var d=transformPoint(o,l,t),h=transformPoint(c,u,t),p={};p.x1=(d.x-n.x)/n.width,p.y1=(d.y-n.y)/n.height,p.x2=(h.x-n.x)/n.width,p.y2=(h.y-n.y)/n.height;var g=s.cloneNode(!0);$$1(g).attr(p),g.id=editorContext_.getNextId(),findDefs().append(g),e.setAttribute(a,"url(#"+g.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,r=n.numberOfItems,a=0,i=0,s="",o=null,l=0;l=k-S&&m<=k+S&&v>=A-S&&v<=A+S){w=!0;break}}s=editorContext_.getId(),removePath_(s);var E,N,T=getElem(s),P=x.numberOfItems;if(w){if(C<=1&&P>=2){var G=x.getItem(0).x,L=x.getItem(0).y;E=4===(N=_.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(G,L):y.createSVGPathSegCurvetoCubicAbs(G,L,N.x1/f,N.y1/f,G,L);var I=y.createSVGPathSegClosePath();x.appendItem(E),x.appendItem(I)}else if(P<3)return!1;if($$1(_).remove(),editorContext_.setDrawnPath(null),editorContext_.setStarted(!1),n){path.matrix&&editorContext_.remapElement(T,{},path.matrix.inverse());var M=T.getAttribute("d"),R=$$1(path.elem).attr("d");return $$1(path.elem).attr("d",R+M),$$1(T).remove(),path.matrix&&recalcRotatedPath(),init$1(),pathActions.toEditMode(path.elem),path.selectPt(),!1}}else{if(!$$1.contains(editorContext_.getContainer(),editorContext_.getMouseTarget(t)))return!1;var O=y.pathSegList.numberOfItems,B=y.pathSegList.getItem(O-1),V=B.x,j=B.y;if(t.shiftKey){var F=snapToAngle(V,j,m,v);m=F.x,v=F.y}E=4===(N=_.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(editorContext_.round(m),editorContext_.round(v)):y.createSVGPathSegCurvetoCubicAbs(editorContext_.round(m),editorContext_.round(v),N.x1/f,N.y1/f,N.x2/f,N.y2/f),y.pathSegList.appendItem(E),m*=f,v*=f,_.setAttribute("d",["M",m,v,m,v].join(" ")),b=O,n&&(b+=path.segs.length),addPointGrip(b,m,v)}}else{var D="M"+m+","+v+" ";editorContext_.setDrawnPath(editorContext_.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:D,id:editorContext_.getNextId(),opacity:editorContext_.getOpacity()/2}})),_.setAttribute("d",["M",p,g,p,g].join(" ")),b=n?path.segs.length:0,addPointGrip(b,p,g)}}},mouseMove:function(n,r){var i=editorContext_.getCurrentZoom();a=!0;var s=editorContext_.getDrawnPath();if("path"!==editorContext_.getCurrentMode())if(path.dragging){var o=getPointFromGrip({x:path.dragging[0],y:path.dragging[1]},path),l=getPointFromGrip({x:n,y:r},path),c=l.x-o.x,u=l.y-o.y;path.dragging=[n,r],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),r={x:n.x,y:n.y,width:0,height:0},a=rectsIntersect(t,r);this.select(a),a&&path.selected_pts.push(this.index)}});else{if(!s)return;var d=s.pathSegList,h=d.numberOfItems-1;if(e){var p=addCtrlGrip("1c1"),g=addCtrlGrip("0c2");p.setAttribute("cx",n),p.setAttribute("cy",r),p.setAttribute("display","inline");var f=e[0],m=e[1],v=f+(f-n/i),_=m+(m-r/i);g.setAttribute("cx",v*i),g.setAttribute("cy",_*i),g.setAttribute("display","inline");var b=getCtrlLine(1);if(assignAttributes(b,{x1:n,y1:r,x2:v*i,y2:_*i,display:"inline"}),0===h)t=[n,r];else{var y=d.getItem(h-1),x=y.x,C=y.y;6===y.pathSegType?(x+=x-y.x2,C+=C-y.y2):t&&(x=t[0]/i,C=t[1]/i),replacePathSeg(6,h,[f,m,x,C,v,_],s)}}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,[n,r,$*i,k*i,n,r],S)}else t?replacePathSeg(6,1,[n,r,t[0],t[1],n,r],S):replacePathSeg(4,1,[n,r],S)}}}},mouseUp:function(n,r,i,s){var o=editorContext_.getDrawnPath();if("path"===editorContext_.getCurrentMode())return e=null,o||(r=getElem(editorContext_.getId()),editorContext_.setStarted(!1),t=null),{keep:!0,element:r};var l=editorContext_.getRubberBox();if(path.dragging){var c=path.cur_pt;path.dragging=!1,path.dragctrl=!1,path.update(),a&&path.endChanges("Move path point(s)"),n.shiftKey||a||path.selectPt(c)}else l&&"none"!==l.getAttribute("display")?(l.setAttribute("display","none"),l.getAttribute("width")<=2&&l.getAttribute("height")<=2&&pathActions.toSelectMode(n.target)):pathActions.toSelectMode(n.target);a=!1},toEditMode:function(e){path=getPath_(e),editorContext_.setCurrentMode("pathedit"),editorContext_.clearSelection(),path.show(!0).update(),path.oldbbox=getBBox(path.elem),n=!1},toSelectMode:function(e){var t=e===path.elem;editorContext_.setCurrentMode("select"),path.show(!1),r=!1,editorContext_.clearSelection(),path.matrix&&recalcRotatedPath(),t&&(editorContext_.call("selected",[e]),editorContext_.addToSelection([e],!0))},addSubPath:function(e){e?(editorContext_.setCurrentMode("path"),n=!0):(pathActions.clear(!0),pathActions.toEditMode(path.elem))},select:function(e){r===e?(pathActions.toEditMode(e),editorContext_.setCurrentMode("pathedit")):r=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 n=editorContext_.getDrawnPath();if(r=null,n){var a=getElem(editorContext_.getId());$$1(getElem("path_stretch_line")).remove(),$$1(a).remove(),$$1(getElem("pathpointgrip_container")).find("*").attr("display","none"),t=null,editorContext_.setDrawnPath(null),editorContext_.setStarted(!1)}else"pathedit"===editorContext_.getCurrentMode()&&this.toSelectMode();path&&path.init().show(!1)},resetOrientation:function(e){if(isNullish(e)||"path"!==e.nodeName)return!1;var t=getTransformList(e),n=transformListToTransform(t).matrix;t.clear(),e.removeAttribute("transform");for(var r=e.pathSegList,a=r.numberOfItems,i=function(t){var a=r.getItem(t),i=a.pathSegType;if(1===i)return"continue";var s=[];$$1.each(["",1,2],function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var o=transformPoint(r,i,n);s.splice(s.length,0,o.x,o.y)}}),replacePathSeg(i,t,s,e)},s=0;s0){var o=t.getItem(n-1).pathSegType;if(2===o){r(n-1,1),e();break}if(1===o&&t.numberOfItems-1===n){r(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 r=$$1(path.elem);r.attr("d",r.attr("d"))}path.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t,n=e.points,r=n.numberOfItems;if(r>=4){var a=n.getItem(0),i=null,s=[];for(s.push(["M",a.x,",",a.y," C"].join("")),t=1;t<=r-4;t+=3){var o=n.getItem(t),l=n.getItem(t+1),c=n.getItem(t+2);if(i){var u=smoothControlPoints(i,o,a);if(u&&2===u.length){var d=s[s.length-1].split(",");d[2]=u[0].x,d[3]=u[0].y,s[s.length-1]=d.join(","),o=u[1]}}s.push([o.x,o.y,l.x,l.y,c.x,c.y].join(",")),a=c,i=l}for(s.push("L");t)/,"$1$2")},toXml=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")};function encode64(e){if(e=encodeUTF8(e),window.btoa)return window.btoa(e);var t=new Array(4*Math.floor((e.length+2)/3)),n=0,r=0;do{var a=e.charCodeAt(n++),i=e.charCodeAt(n++),s=e.charCodeAt(n++),o=a>>2,l=(3&a)<<4|i>>4,c=(15&i)<<2|s>>6,u=63&s;isNaN(i)?(c=64,u=64):isNaN(s)&&(u=64),t[r++]=KEYSTR.charAt(o),t[r++]=KEYSTR.charAt(l),t[r++]=KEYSTR.charAt(c),t[r++]=KEYSTR.charAt(u)}while(n>4,l=(15&a)<<4|i>>2,c=(3&i)<<6|s;t+=String.fromCharCode(o),64!==i&&(t+=String.fromCharCode(l)),64!==s&&(t+=String.fromCharCode(c))}while(nSVG-edit "],{type:"text/html"});return createObjectURL(e)}(),text2xml=function(e){var t,n;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,r=[[],[]],a=t.getItem(0),i=[a.x,a.y],s=function(e,t,n,r){return function(a){return 1-Math.pow(a,3)*i[e]+3-Math.pow(a,2)*a*t[e]+3*(1-a)*Math.pow(a,2)*n[e]+Math.pow(a,3)*r[e]}},o=0;o0&&_<1&&r[h].push(p(_));var b=(-g-Math.sqrt(v))/(2*f);b>0&&b<1&&r[h].push(p(b))}}else{if(0===g)continue;var y=-m/g;y>0&&y<1&&r[h].push(p(y))}}i=d}else r[0].push(l.x),r[1].push(l.y)}var x=Math.min.apply(null,r[0]),C=Math.max.apply(null,r[0])-x,S=Math.min.apply(null,r[1]);return{x:x,y:S,width:C,height:Math.max.apply(null,r[1])-S}};function groupBBFix(e){if(supportsHVLineContainerBBox())try{return e.getBBox()}catch(e){}var t,n,r=$$2.data(e,"ref"),a=null;r?(n=$$2(r).children().clone().attr("visibility","hidden"),$$2(svgroot_).append(n),a=n.filter("line, path")):a=$$2(e).find("line, path");var i=!1;if(a.length)if(a.each(function(){var e=this.getBBox();e.width&&e.height||(i=!0)}),i){var s=r?n:$$2(e).children();t=getStrokedBBox(s)}else t=e.getBBox();else t=e.getBBox();return r&&n.remove(),t}var getBBox=function(e){var t=e||editorContext_$1.geSelectedElements()[0];if(1!==e.nodeType)return null;var n=t.nodeName,r=null;switch(n){case"text":""===t.textContent?(t.textContent="a",r=t.getBBox(),t.textContent=""):t.getBBox&&(r=t.getBBox());break;case"path":supportsPathBBox()?t.getBBox&&(r=t.getBBox()):r=getPathBBox(t);break;case"g":case"a":r=groupBBFix(t);break;default:if("use"===n&&(r=groupBBFix(t)),"use"===n||"foreignObject"===n&&isWebkit()){if(r||(r=t.getBBox()),!isWebkit()){var a={};a.width=r.width,a.height=r.height,a.x=r.x+parseFloat(t.getAttribute("x")||0),a.y=r.y+parseFloat(t.getAttribute("y")||0),r=a}}else if(visElemsArr.includes(n))if(t)try{r=t.getBBox()}catch(e){var i=t.getExtentOfChar(0),s=t.getComputedTextLength();r={x:i.x,y:i.y,width:s,height:i.height}}else{var o=$$2(t).closest("foreignObject");o.length&&o[0].getBBox&&(r=o[0].getBBox())}}return r&&(r=bboxToObj(r)),r},getPathDFromSegments=function(e){var t="";return $$2.each(e,function(e,n){var r=_slicedToArray(n,2),a=r[0],i=r[1];t+=a;for(var s=0;s-.001&&n<.001||(n<-89.99||n>89.99))}var getBBoxWithTransform=function(e,t,n){var r=getBBox(e);if(!r)return null;var a=getTransformList(e),i=getRotationAngleFromTransformList(a),s=hasMatrixTransform(a);if(i||s){var o=!1;if(bBoxCanBeOptimizedOverNativeGetBBox(i,s)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))r=o=getBBoxOfElementAsPath(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(r=o=getBBoxOfElementAsPath(e,t,n))}}if(!o){var u=transformListToTransform(a).matrix;r=transformBox(r.x,r.y,r.width,r.height,u).aabox}}return r};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 r;if($$2.each(e,function(){r||this.parentNode&&(r=getBBoxWithTransform(this,t,n))}),void 0===r)return null;var a=r.x+r.width,i=r.y+r.height,s=r.x,o=r.y;if(1===e.length){var l=getStrokeOffsetForBBox(e[0]);s-=l,o-=l,a+=l,i+=l}else $$2.each(e,function(e,r){var l=getBBoxWithTransform(r,t,n);if(l){var c=getStrokeOffsetForBBox(r);s=Math.min(s,l.x-c),o=Math.min(o,l.y-c),1===r.nodeType&&(a=Math.max(a,l.x+l.width+c),i=Math.max(i,l.y+l.height+c))}});return r.x=s,r.y=o,r.width=a-s,r.height=i-o,r},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,r=0;r|:\\-]","g"),"\\$&")},preventClickDefault=function(e){$$2(e).click(function(e){e.preventDefault()})},copyElem=function e(t,n){var r=document.createElementNS(t.namespaceURI,t.nodeName);if($$2.each(t.attributes,function(e,t){"-moz-math-font-style"!==t.localName&&r.setAttributeNS(t.namespaceURI,t.nodeName,t.value)}),r.removeAttribute("id"),r.id=n(),isWebkit()&&"path"===t.nodeName){var a=convertPath(t);r.setAttribute("d",a)}if($$2.each(t.childNodes,function(t,a){switch(a.nodeType){case 1:r.append(e(a,n));break;case 3:r.textContent=a.nodeValue}}),$$2(t).data("gsvg"))$$2(r).data("gsvg",r.firstChild);else if($$2(t).data("symbol")){var i=$$2(t).data("symbol");$$2(r).data("ref",i).data("symbol",i)}else"image"===r.tagName&&preventClickDefault(r);return r},isNullish=function(e){return null==e},$$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(){Object.values(contextMenuExtensions).forEach(function(e){injectExtendedContextMenuItemIntoDom(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])})}function importSetGlobalDefault(e,t){return importSetGlobal(e,_extends({},t,{returnDefault:!0}))}function importSetGlobal(e,t){return _importSetGlobal.apply(this,arguments)}function _importSetGlobal(){return(_importSetGlobal=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n){var r,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.global,a=n.returnDefault,!!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)){e.next=4;break}return e.abrupt("return",importModule(t,void 0,{returnDefault:a}));case 4:return e.next=6,importScript(t);case 6:return e.abrupt("return",window[r]);case 7:case"end":return e.stop()}},e,this)}))).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,r){var a=document.createElement("script");function i(){r(new Error("Failed to import: ".concat(e))),o()}function s(){n(),o()}var o=function(){a.removeEventListener("error",i),a.removeEventListener("load",s),a.remove(),a.src=""};a.defer="defer",addScriptAtts(a,t),a.addEventListener("error",i),a.addEventListener("load",s),a.src=e,document.head.append(a)})}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,r=void 0!==n&&n;return Array.isArray(e)?Promise.all(e.map(function(e){return importModule(e,t)})):new Promise(function(n,a){var i="$importModule$"+Math.random().toString(32).slice(2),s=document.createElement("script");function o(){a(new Error("Failed to import: ".concat(e))),c()}function l(){n(window[i]),c()}var c=function(){delete window[i],s.removeEventListener("error",o),s.removeEventListener("load",l),s.remove(),URL.revokeObjectURL(s.src),s.src=""};addScriptAtts(s,t),s.defer="defer",s.type="module",s.addEventListener("error",o),s.addEventListener("load",l);var u=toAbsoluteURL(e),d="import * as m from '".concat(u.replace(/'/g,"\\'"),"'; window.").concat(i," = ").concat(r?"m.default || ":"","m;"),h=new Blob([d],{type:"text/javascript"});s.src=URL.createObjectURL(h),document.head.append(s)})}function jQueryPluginDBox(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ok:"Ok",cancel:"Cancel"};e("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var n=e("#dialog_box"),r=e("#dialog_buttons"),a=e("#dialog_content");function i(i,s,o,l,c,u){a.html("

    "+s.replace(/\n/g,"

    ")+"

    ").toggleClass("prompt","prompt"===i),r.empty();var d=e('').appendTo(r);return new Promise(function(s,h){var p,g;if("alert"!==i&&e('').appendTo(r).click(function(){n.hide(),s(!1)}),"prompt"===i)(p=e('').prependTo(r)).val(o||""),p.bind("keydown","return",function(){d.click()});else if("select"===i){var f=e('
    ');if(p=e("').appendTo(m)).val(u.value),u.tooltip&&m.attr("title",u.tooltip),g.prop("checked",Boolean(u.checked)),f.append(e("
    ").append(m))}e.each(l||[],function(t,n){"object"===_typeof(n)?p.append(e("