@frangoteam/fuxa-min 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@ FUXA is a web-based Process Visualization (SCADA/HMI/Dashboard) software. With F
4
4
 
5
5
  ![fuxa editor](/screenshot/fuxa-editor.png)
6
6
 
7
- ![fuxa ani](/screenshot/fuxa-ani.gif)
7
+ ![fuxa ani](/screenshot/fuxa-thinglinks.gif)
8
8
 
9
9
  ![fuxa action](/screenshot/feature-action-move.gif)
10
10
 
@@ -20,6 +20,7 @@ Here is a [live demo](https://frangoteam.github.io) example of FUXA editor.
20
20
  FUXA is developed with NodeJS (backend) and Angular (frontend).
21
21
 
22
22
  **WARNING** You need to have installed [Node](https://nodejs.org/en/about/previous-releases) Version 14 || 16 || 18
23
+ If you don't intend communicate with Siemens PLCs via S7 (node-snap7 library) you can install from [NPM @frangoteam/fuxa-min](https://www.npmjs.com/package/@frangoteam/fuxa-min)
23
24
 
24
25
  Install from [NPM](https://www.npmjs.com/package/@frangoteam/fuxa)
25
26
  ```
@@ -815,6 +815,36 @@ indexof
815
815
  isarray
816
816
  MIT
817
817
 
818
+ leaflet
819
+ BSD-2-Clause
820
+ BSD 2-Clause License
821
+
822
+ Copyright (c) 2010-2023, Volodymyr Agafonkin
823
+ Copyright (c) 2010-2011, CloudMade
824
+ All rights reserved.
825
+
826
+ Redistribution and use in source and binary forms, with or without
827
+ modification, are permitted provided that the following conditions are met:
828
+
829
+ 1. Redistributions of source code must retain the above copyright notice, this
830
+ list of conditions and the following disclaimer.
831
+
832
+ 2. Redistributions in binary form must reproduce the above copyright notice,
833
+ this list of conditions and the following disclaimer in the documentation
834
+ and/or other materials provided with the distribution.
835
+
836
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
837
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
838
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
839
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
840
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
841
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
842
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
843
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
844
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
845
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
846
+
847
+
818
848
  lodash-es
819
849
  MIT
820
850
  Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -75,9 +75,11 @@
75
75
  "dlg.menuitem-link": "Link by Click",
76
76
  "dlg.menuitem-alarms": "Alarms by Click",
77
77
  "dlg.menuitem-address": "Link address",
78
+ "dlg.menuitem-icons-filter": "Icons Filter",
78
79
 
79
80
  "dlg.headeritem-title": "Header Item",
80
81
  "dlg.headeritem-icon": "Icon",
82
+ "dlg.headeritem-icons-filter": "Icons Filter",
81
83
 
82
84
  "dlg.docproperty-title": "View properties",
83
85
  "dlg.docproperty-name": "Name",
@@ -248,6 +250,13 @@
248
250
  "chart.config-interpo-stepAfter": "step after",
249
251
  "chart.config-interpo-stepBefore": "step before",
250
252
  "chart.config-interpo-spline": "spline",
253
+ "chart.config-line-width": "Line Width",
254
+ "chart.config-line-gap": "Fill Gaps",
255
+ "chart.config-line-add-zone": "Add Zone",
256
+ "chart.config-line-zone-min": "Min",
257
+ "chart.config-line-zone-max": "Max",
258
+ "chart.config-line-zone-stroke": "Stroke",
259
+ "chart.config-line-zone-fill": "Fill",
251
260
 
252
261
  "chart.property-data": "Data",
253
262
  "chart.property-props": "Property",
@@ -492,6 +501,7 @@
492
501
 
493
502
  "editor.view-svg": "Canvas/SVG",
494
503
  "editor.view-cards": "Multi views container",
504
+ "editor.view-maps": "Maps",
495
505
  "editor.views": "Views",
496
506
  "editor.resources": "Resources",
497
507
  "editor.view-delete": "Delete",
@@ -753,6 +763,10 @@
753
763
  "pipe.property-content-color": "Content color",
754
764
  "pipe.property-content-space": "Content dash",
755
765
  "pipe.action-hide-content": "Hide content",
766
+ "pipe.property-style-animation": "Animation Image",
767
+ "pipe.property-style-animation-image": "Select Image (SVG)",
768
+ "pipe.property-style-animation-count": "Image count",
769
+ "pipe.property-style-animation-delay": "Animation delay (msec.)",
756
770
 
757
771
  "slider.property-props": "Property",
758
772
  "slider.property-horizontal": "Horizontal",
@@ -1042,6 +1056,7 @@
1042
1056
  "gauges.property-event-destination-relative-from": "Relative from",
1043
1057
  "gauges.property-event-destination-panel": "Panel",
1044
1058
  "gauges.property-event-destination-hide-close": "Hide Close",
1059
+ "gauges.property-event-newtab": "New Tab",
1045
1060
  "gauges.property-event-single-card": "Single Card",
1046
1061
  "gauges.property-event-value": "Value",
1047
1062
  "gauges.property-event-function": "Function",
@@ -1143,6 +1158,7 @@
1143
1158
  "bag.property-format-digits": "Format digits",
1144
1159
  "bag.property-zones": "Zones",
1145
1160
  "bag.property-color": "Color",
1161
+ "bag.property-fill": "Fill",
1146
1162
 
1147
1163
  "alarms.list-title": "Alarms settings",
1148
1164
  "alarms.list-name": "Name",
@@ -1194,10 +1210,13 @@
1194
1210
  "alarm.action-onsetview": "Set View",
1195
1211
  "alarm.action-onsetvalue": "Set Value",
1196
1212
  "alarm.action-onRunScript": "Run Script",
1213
+ "alarm.action-toastMessage": "Show Message",
1197
1214
  "alarm.action-sendMsg": "Send Message",
1198
1215
  "alarm.property-action-type": "Action type",
1199
1216
  "alarm.property-action-value": "Value to set",
1200
1217
  "alarm.property-action-destination": "View to show",
1218
+ "alarm.property-action-toastMessage": "Message to show",
1219
+ "alarm.property-action-toastType": "Type",
1201
1220
 
1202
1221
  "notifications.list-title": "Notifications settings",
1203
1222
  "notifications.list-name": "Name",
@@ -1400,6 +1419,28 @@
1400
1419
  "report.chart-width": "Width",
1401
1420
  "report.chart-height": "Height",
1402
1421
 
1422
+ "maps.locations-list-title": "Locations settings",
1423
+ "maps.locations-list-name": "Name",
1424
+ "maps.locations-list-view": "View",
1425
+ "maps.locations-list-description": "Description",
1426
+ "maps.location-property-title": "Location",
1427
+ "maps.location-property-name": "Name",
1428
+ "maps.location-property-description": "Description",
1429
+ "maps.location-property-latitude": "Latitude",
1430
+ "maps.location-property-longitude": "Longitude",
1431
+ "maps.location-property-card": "Card",
1432
+ "maps.location-property-view": "View",
1433
+ "maps.location-property-url": "URL",
1434
+ "maps.edit-add-location": "Add Location",
1435
+ "maps.edit-import-location": "Import Location",
1436
+ "maps.edit-edit-location": "Edit Location",
1437
+ "maps.edit-remove-location": "Remove Location",
1438
+ "maps.edit-start-location": "Set as start Location",
1439
+ "maps.edit-start-location-saved": "Start Location saved",
1440
+ "maps.close-popups": "Close all popups",
1441
+ "maps.location-to-import": "Location to import",
1442
+ "maps.location-to-import-input-title": "Select Location to import",
1443
+
1403
1444
  "logs.view-title": "System Logs",
1404
1445
  "logs.view-files": "Logs files",
1405
1446
 
@@ -1472,6 +1513,7 @@
1472
1513
  "dlg.setup-alarms": "Alarms",
1473
1514
  "dlg.setup-line-charts": "Line charts",
1474
1515
  "dlg.setup-bar-charts": "Bar charts",
1516
+ "dlg.setup-maps-locations": "Locations",
1475
1517
  "dlg.setup-layout": "Layout",
1476
1518
  "dlg.setup-plugins": "Plugins",
1477
1519
  "dlg.setup-scripts": "Scripts",
@@ -1608,5 +1650,7 @@
1608
1650
  "msg.view-name-exist": "View name exist!",
1609
1651
  "msg.notification-name-exist": "Notification name exist!",
1610
1652
  "msg.file-remove": "Would you like to remove '{{value}}'?",
1611
- "msg.notification-remove": "Would you like to remove Notification '{{value}}'?"
1653
+ "msg.notification-remove": "Would you like to remove Notification '{{value}}'?",
1654
+ "msg.maps-location-remove": "Would you like to remove Maps Location '{{value}}'?",
1655
+ "msg.maps-location-name-exist": "The Maps Location name already exist!"
1612
1656
  }
@@ -1 +1 @@
1
- window.extConnector=function(){window.svgEditor&&svgEditor.addExtension("Connector",function(e){var u,v,f,p,m,h,x=e.svgcontent,g=e.svgroot,l=e.getNextId,w=e.getElem,y=e.addSvgElementFromJson,b=e.selectorManager,c=svgEditor.curConfig,k=!1,_=[],C=".se_connector",E=[],A=$.data,t={en:[{id:"mode_connect",title:"Connect two objects"}],fr:[{id:"mode_connect",title:"Connecter deux objets"}]};function S(e,t,r,n){n&&(n-=0,(r=$.extend({},r)).width+=n,r.height+=n,r.x-=n/2,r.y-=n/2);var i,o=r.x+r.width/2,a=r.y+r.height/2,s=e-o,d=t-a;return{x:o+s*(i=Math.abs(d/s)<r.height/r.width?r.width/2/Math.abs(s):r.height/2/Math.abs(d)),y:a+d*i}}function I(e,t){var r=!!t.getAttribute("marker-"+e),n=5*t.getAttribute("stroke-width");return r?n:0}function n(e){var t=$("#connector_rules");t.length||(t=$('<style id="connector_rules"></style>').appendTo("head")),t.text(e?"#tool_clone, #tool_topath, #tool_angle, #xy_panel { display: none !important; }":""),$("#connector_panel").toggle(e)}function M(t,r,n,i,e){var o,a=t.points,s=g.createSVGPoint();s.x=n,s.y=i,"end"===r&&(r=a.numberOfItems-1);try{a.replaceItem(s,r)}catch(e){var d=t.getAttribute("points").split(" ");for(o=0;o<d.length;o++)o===r&&(d[o]=n+","+i);t.setAttribute("points",d.join(" "))}if(e){var l=a.getItem(0),c=a.getItem(a.numberOfItems-1);M(t,1,(c.x+l.x)/2,(c.y+l.y)/2)}}function N(s){var d;s||(s=E);var e=$(x).find(C);_=[],e.each(function(){var e;function t(){-1!==$.inArray(this,s)&&(e=!0)}var r=A(this,"c_start"),n=A(this,"c_end"),i=[w(r),w(n)];for(d=0;d<2;d++){var o=i[d];if(e=!1,$(o).parents().each(t),o&&o.parentNode){if(-1!==$.inArray(o,s)||e){var a=svgCanvas.getStrokedBBox([o]);_.push({elem:o,connector:this,is_start:0===d,start_x:a.x,start_y:a.y})}}else $(this).remove()}})}function F(e){var t,r;if(N(e),_.length)for(t=_.length;t--;){var n=_[t],i=n.connector,o=n.elem,a=(i.getAttribute("stroke-width"),n.is_start?"start":"end"),s=svgCanvas.getStrokedBBox([o]);s.x=n.start_x,s.y=n.start_y,A(i,a+"_bb",s);A(i,a+"_off");var d=n.is_start?"end":"start",l=A(i,d+"_bb"),c=S(l.x+l.width/2,l.y+l.height/2,s,I(a,i));M(i,n.is_start?0:"end",c.x,c.y,!0);var g=S(c.x,c.y,A(i,d+"_bb"),I(d,i));if(M(i,n.is_start?"end":0,g.x,g.y,!0),-1!==navigator.userAgent.indexOf("AppleWebKit")){var u=i.points,v=u.numberOfItems,f=[];for(r=0;r<v;r++)c=u.getItem(r),f[r]=c.x+","+c.y;i.setAttribute("points",f.join(" "))}}}return function(){var e=svgCanvas.groupSelectedElements;svgCanvas.groupSelectedElements=function(){return svgCanvas.removeFromSelection($(C).toArray()),e.apply(this,arguments)};var t=svgCanvas.moveSelectedElements;svgCanvas.moveSelectedElements=function(){svgCanvas.removeFromSelection($(C).toArray());var e=t.apply(this,arguments);return F(),e},h=svgCanvas.getEditorNS()}(),{name:"Connector",buttons:[{id:"mode_connect",type:"mode",title:"Connect two objects",includeWith:{button:"#tool_line",isDefault:!1,position:1},events:{click:function(){svgCanvas.setMode("connector")}}}],addLangData:function(e){return{data:t[e]}},mouseDown:function(e){var t=e.event;u=e.start_x,v=e.start_y;var r=svgCanvas.getMode();if("connector"==r){if(k)return;var n=t.target,i=$(n).parents();if(-1!==$.inArray(x,i)){var o=$(n).closest("foreignObject");p=o.length?o[0]:n;var a=svgCanvas.getStrokedBBox([p]),s=a.x+a.width/2,d=a.y+a.height/2;k=!0,f=y({element:"polyline",attr:{id:l(),points:s+","+d+" "+s+","+d+" "+u+","+v,stroke:"#"+c.initStroke.color,"stroke-width":p.stroke_width&&0!=p.stroke_width?p.stroke_width:c.initStroke.width,fill:"none",opacity:c.initStroke.opacity,style:"pointer-events:none"}}),A(f,"start_bb",a)}return{started:!0}}"select"==r&&N()},mouseMove:function(e){var t=svgCanvas.getZoom(),r=(e.event,e.mouse_x/t),n=e.mouse_y/t,i=r-u,o=n-v,a=svgCanvas.getMode();if("connector"==a&&k){f.getAttribute("stroke-width");var s=S(r,n,A(f,"start_bb"),I("start",f));u=s.x,v=s.y,M(f,0,s.x,s.y,!0),M(f,"end",r,n,!0)}else if("select"==a){for(var d=E.length;d--;){var l=E[d];l&&A(l,"c_start")&&(svgCanvas.removeFromSelection([l]),svgCanvas.getTransformList(l).clear())}_.length&&function(e,t){for(var r=_.length;r--;){var n=_[r],i=n.connector,o=(n.elem,n.is_start?"start":"end"),a=A(i,o+"_bb");a.x=n.start_x+e,a.y=n.start_y+t,A(i,o+"_bb",a);var s=n.is_start?"end":"start",d=A(i,s+"_bb"),l=S(d.x+d.width/2,d.y+d.height/2,a,I(o,i));M(i,n.is_start?0:"end",l.x,l.y,!0);var c=S(l.x,l.y,A(i,s+"_bb"),I(s,i));M(i,n.is_start?"end":0,c.x,c.y,!0)}}(i,o)}},mouseUp:function(e){var t=svgCanvas.getZoom(),r=e.event,n=(e.mouse_x,e.mouse_y,r.target);if("connector"==svgCanvas.getMode()){var i=$(n).closest("foreignObject");i.length&&(n=i[0]);var o=$(n).parents();if(n==p)return{keep:k=!0,element:null,started:k};if(-1===$.inArray(x,o))return $(f).remove(),{keep:k=!1,element:null,started:k};m=n;var a=p.id,s=m.id,d=a+" "+s,l=s+" "+a;if($(x).find(C).filter(function(){var e=this.getAttributeNS(h,"connector");if(e==d||e==l)return!0}).length)return $(f).remove(),{keep:!1,element:null,started:!1};var c=svgCanvas.getStrokedBBox([m]),g=S(u,v,c,I("start",f));return M(f,"end",g.x,g.y,!0),$(f).data("c_start",a).data("c_end",s).data("end_bb",c),h=svgCanvas.getEditorNS(!0),f.setAttributeNS(h,"se:connector",d),f.setAttribute("class",C.substr(1)),f.setAttribute("opacity",1),svgCanvas.addToSelection([f]),svgCanvas.moveToBottomSelectedElement(),b.requestSelector(f).showGrips(!1),{keep:!(k=!1),element:f,started:k}}},selectedChanged:function(e){if($(x).find(C).length){"connector"==svgCanvas.getMode()&&svgCanvas.setMode("select");for(var t=(E=e.elems).length;t--;){var r=E[t];r&&A(r,"c_start")?(b.requestSelector(r).showGrips(!1),e.selectedElement&&!e.multiselected?n(!0):n(!1)):n(!1)}F()}},elementChanged:function(e){var t,r=e.elems[0];if(r&&"svg"===r.tagName&&"svgcontent"===r.id&&(x=r,$(x).find("*").each(function(){var e=this.getAttributeNS(h,"connector");if(e){this.setAttribute("class",C.substr(1));var t=e.split(" "),r=svgCanvas.getStrokedBBox([w(t[0])]),n=svgCanvas.getStrokedBBox([w(t[1])]);$(this).data("c_start",t[0]).data("c_end",t[1]).data("start_bb",r).data("end_bb",n),svgCanvas.getEditorNS(!0)}})),r&&(r.getAttribute("marker-start")||r.getAttribute("marker-mid")||r.getAttribute("marker-end"))){t=r.getAttribute("marker-start");var n=r.getAttribute("marker-mid"),i=r.getAttribute("marker-end");if(f=r,$(r).data("start_off",!!t).data("end_off",!!i),"line"===r.tagName&&n){var o=Number(r.getAttribute("x1")),a=Number(r.getAttribute("x2")),s=Number(r.getAttribute("y1")),d=Number(r.getAttribute("y2")),l=r.id,c=y({element:"polyline",attr:{points:o+","+s+(" "+(o+a)/2+","+(s+d)/2+" ")+a+","+d,stroke:r.getAttribute("stroke"),"stroke-width":r.getAttribute("stroke-width"),"marker-mid":n,fill:"none",opacity:r.getAttribute("opacity")||1}});$(r).after(c).remove(),svgCanvas.clearSelection(),c.id=l,svgCanvas.addToSelection([c]),r=c}}r.getAttribute("class")==C.substr(1)?F([t=w(A(r,"c_start"))]):F()},toolButtonStateUpdate:function(e){e.nostroke&&$("#mode_connect").hasClass("tool_button_current")&&svgEditor.clickSelect(),$("#mode_connect").toggleClass("disabled",e.nostroke)}}})},window.extEyedropper=function(){window.svgEditor&&svgEditor.addExtension("eyedropper",function(e){"use strict";var o=svgEditor.canvas,a=svgedit.history.ChangeElementCommand,s={fillPaint:"red",fillOpacity:1,strokePaint:"black",strokeOpacity:1,strokeWidth:5,strokeDashArray:null,opacity:1,strokeLinecap:"butt",strokeLinejoin:"miter"};function t(e){if("eyedropper"!=o.getMode()){var t=null,r=$("#tool_eyedropper");!e.multiselected&&e.elems[0]&&-1===$.inArray(e.elems[0].nodeName,["svg","g","use"])?(t=e.elems[0],r.removeClass("disabled"),s.fillPaint=t.getAttribute("fill")||"black",s.fillOpacity=t.getAttribute("fill-opacity")||1,s.strokePaint=t.getAttribute("stroke"),s.strokeOpacity=t.getAttribute("stroke-opacity")||1,s.strokeWidth=t.getAttribute("stroke-width"),s.strokeDashArray=t.getAttribute("stroke-dasharray"),s.strokeLinecap=t.getAttribute("stroke-linecap"),s.strokeLinejoin=t.getAttribute("stroke-linejoin"),s.opacity=t.getAttribute("opacity")||1):r.addClass("disabled")}}return{name:"eyedropper",buttons:[{id:"tool_eyedropper",type:"mode",title:"Eye Dropper Tool",key:"I",events:{click:function(){o.setMode("eyedropper")}}}],selectedChanged:t,elementChanged:t,mouseDown:function(e){var t;if("eyedropper"==o.getMode()){var r=e.event.target;if(-1===$.inArray(r.nodeName,["svg","g","use"])){var n={},i=function(e,t,r){n[t]=e.getAttribute(t),e.setAttribute(t,r)};s.fillPaint&&i(r,"fill",s.fillPaint),s.fillOpacity&&i(r,"fill-opacity",s.fillOpacity),s.strokePaint&&i(r,"stroke",s.strokePaint),s.strokeOpacity&&i(r,"stroke-opacity",s.strokeOpacity),s.strokeWidth&&i(r,"stroke-width",s.strokeWidth),s.strokeDashArray&&i(r,"stroke-dasharray",s.strokeDashArray),s.opacity&&i(r,"opacity",s.opacity),s.strokeLinecap&&i(r,"stroke-linecap",s.strokeLinecap),s.strokeLinejoin&&i(r,"stroke-linejoin",s.strokeLinejoin),t=new a(r,n),o.undoMgr.addCommandToHistory(t)}}}}})},window.extGrid=function(){window.svgEditor&&svgEditor.addExtension("view_grid",function(){"use strict";var e=svgedit.NS,g=svgEditor.canvas,t=document.getElementById("svgcanvas").ownerDocument,r=svgEditor.curConfig.showGrid||!1,n=g.assignAttributes,u=document.createElement("canvas"),i=$("#canvasBackground"),v=svgedit.units.getTypeMap(),f=[.01,.1,1,10,100,1e3];$(u).hide().appendTo("body");var o=t.createElementNS(e.SVG,"svg");n(o,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"}),i.append(o);var a=t.createElementNS(e.SVG,"pattern");n(a,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var p=t.createElementNS(e.SVG,"image");n(p,{x:0,y:0,width:100,height:100}),a.appendChild(p),$("#svgroot defs").append(a);var s=t.createElementNS(e.SVG,"rect");function d(e){var t,r=v[svgEditor.curConfig.baseUnit]*e,n=100/r,i=1;for(t=0;t<f.length;t++){var o=f[t];if(n<=(i=o))break}var a=i*r;u.width=a,u.height=a;var s=u.getContext("2d"),d=a/10;for(s.globalAlpha=.2,s.strokeStyle=svgEditor.curConfig.gridColor,t=1;t<10;t++){var l=Math.round(d*t)+.5;s.moveTo(l,a),s.lineTo(l,0),s.moveTo(a,l),s.lineTo(0,l)}s.stroke(),s.beginPath(),s.globalAlpha=.5,s.moveTo(.5,a),s.lineTo(.5,0),s.moveTo(a,.5),s.lineTo(0,.5),s.stroke();var c=u.toDataURL("image/png");p.setAttribute("width",a),p.setAttribute("height",a),p.parentNode.setAttribute("width",a),p.parentNode.setAttribute("height",a),g.setHref(p,c)}function l(){r&&d(g.getZoom()),$("#canvasGrid").toggle(r)}return n(s,{width:"100%",height:"100%",x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"}),$("#canvasGrid").append(s),{name:"view_grid",zoomChanged:function(e){r&&d(e)},callback:function(){r&&l()},buttons:[{id:"view_grid",events:{click:function(){svgEditor.curConfig.showGrid=r=!r,l()}}}]}})},window.extMarkers=function(){window.svgEditor&&svgEditor.addExtension("Markers",function(m){var h,x=m.addSvgElementFromJson,l=["start","mid","end"],c="se_marker_",w={nomarker:{label:"&#x2014;"},leftarrow:{element:"path",attr:{d:"M0,50 L100,90 L70,50 L100,10 Z"},label:"&#x25C4;"},rightarrow:{element:"path",attr:{d:"M100,50 L0,90 L30,50 L0,10 Z"},label:"&#x25BA;"},leftpointing:{element:"path",attr:{d:"M50,48 L90,90 M50,52 L90,10"},label:"&#x2009;&#x02C2;"},rightpointing:{element:"path",attr:{d:"M50,48 L10,90 L50,52 L10,10 Z"},label:"&#x2009;&#x003E;"},break:{element:"path",attr:{d:"M50,20 L50,80"},label:"&#x2009;&#x2223;"},mcircle:{element:"circle",attr:{r:30,cx:50,cy:50},label:"&#x2009;&#x25CF;"}};function g(e,t){var r=e.getAttribute(t);if(!r)return null;var n=r.match(/\(\#(.*)\)/);return n&&2===n.length?m.getElem(n[1]):null}function s(e,r){"\\"!==r.substr(0,1)&&(r="\\textmarker");var t=document.getElementById(e+"_marker"),n=0;$.each(w,function(e,t){if(-1!==r.indexOf(e))return!1;n++}),t.selectedIndex=n}function i(e){if($("#marker_panel").toggle(e),e){var i,o,a=h[0];$.each(l,function(e,t){var r=g(a,"marker-"+t),n=$("#"+t+"_marker");if(r){if(!r.attributes.se_type)return;i="\\"+r.attributes.se_type.textContent,"\\textmarker"===(o=i)?i=r.lastChild.textContent:n.hide()}else o=i="\\nomarker",n.hide();n.val(i),s(t,o)})}}function u(e,t){var r=m.getElem(e);if(!r&&""!=t&&"\\nomarker"!=t){var n,i=h[0].getAttribute("stroke"),o=50,a=50,s="0 0 100 100",d=10,l=10;if(n="\\"===t.substr(0,1)?t.substr(1):"textmarker",w[n]){if(r=x({element:"marker",attr:{id:e,orient:"auto",style:"pointer-events:none",se_type:n}}),"textmarker"!=n){var c=x(w[n]),g=i;"_o"===n.substr(-2)&&(g="none"),c.setAttribute("fill",g),c.setAttribute("stroke",i),c.setAttribute("stroke-width",10),r.appendChild(c)}else{var u=x(w[n]);u.textContent=t;var v=u.getBBox(),f=v;f.x=0,f.y=0,f.width+=2,f.height+=2,u.setAttribute("x",1),u.setAttribute("y",f.height-1-v.height/4),u.setAttribute("fill",i),o=f.width/2+1,a=f.height/2+1,s=f.x+" "+f.y+" "+f.width+" "+f.height,d=f.width/10,l=f.height/10;var p=x({element:"rect",attr:{x:f.x,y:f.y,width:f.width,height:f.height,fill:"#ffffff",stroke:"none","stroke-width":0}});r.setAttribute("orient",0),r.appendChild(p),r.appendChild(u)}return r.setAttribute("viewBox",s),r.setAttribute("markerWidth",d),r.setAttribute("markerHeight",l),r.setAttribute("refX",o),r.setAttribute("refY",a),m.findDefs().appendChild(r),r}}}function v(n){if("line"!==n.tagName)return n;var e=Number(n.getAttribute("x1")),t=Number(n.getAttribute("x2")),r=Number(n.getAttribute("y1")),i=Number(n.getAttribute("y2")),o=n.id,a=x({element:"polyline",attr:{points:e+","+r+(" "+(e+t)/2+","+(r+i)/2+" ")+t+","+i,stroke:n.getAttribute("stroke"),"stroke-width":n.getAttribute("stroke-width"),fill:"none",opacity:n.getAttribute("opacity")||1}});$.each(l,function(e,t){var r="marker-"+t;n.getAttribute(r)&&a.setAttribute(r,n.getAttribute(r))});var s=new m.BatchCommand;return s.addSubCommand(new m.RemoveElementCommand(n,n.parentNode)),s.addSubCommand(new m.InsertElementCommand(a)),$(n).after(a).remove(),svgCanvas.clearSelection(),a.id=o,svgCanvas.addToSelection([a]),m.addCommandToHistory(s),a}return{name:"Markers",mySetMarker:function(e,r){var n=void 0,i=0;$.each(w,function(e,t){r===i++&&(n=e)}),function(e,t){var r={start_marker:"start",mid_marker:"mid",end_marker:"end"}[e],n="marker-"+r,i=t,o=h[0],a=g(o,n);if(a&&$(a).remove(),o.removeAttribute(n),""==i&&(i="\\nomarker"),"\\nomarker"==i)return s(r,i),m.call("changed",h);u(e=c+r+"_"+o.id,i),svgCanvas.changeSelectedAttribute(n,"url(#"+e+")"),"line"===o.tagName&&"mid"==r&&(o=v(o)),m.call("changed",h),s(r,i)}(e,"\\"+n)},callback:function(){var a=document.getElementById("start_marker"),s=document.getElementById("mid_marker"),d=document.getElementById("end_marker");$.each(w,function(e,t){if(t.label){var r=document.createElement("option");r.value=t.label,r.innerHTML=t.label,r.setAttribute("style","background-color: rgba(33,33,33,1);color: rgba(255,255,255,1);");var n=r.cloneNode(!0),i=r.cloneNode(!0),o=r.cloneNode(!0);a.appendChild(n),s.appendChild(i),d.appendChild(o)}})},selectedChanged:function(e){for(var t=(h=e.elems).length,r=["line","path","polyline"];t--;){var n=h[t];n&&-1!==$.inArray(n.tagName,r)&&e.selectedElement&&!e.multiselected?i(!0):i(!1)}},elementChanged:function(e){var d,a,s,t=e.elems[0];if(t&&(t.getAttribute("marker-start")||t.getAttribute("marker-mid")||t.getAttribute("marker-end"))){s=(a=t).getAttribute("stroke"),$.each(l,function(e,t){var r=g(a,"marker-"+t);if(r&&r.attributes.se_type){var n=r.lastElementChild;if(n){var i=n.getAttribute("fill"),o=n.getAttribute("stroke");i&&"none"!=i&&n.setAttribute("fill",s),o&&"none"!=o&&n.setAttribute("stroke",s)}}}),d=t,$.each(l,function(e,t){var r=c+t+"_"+d.id,n="marker-"+t,i=g(d,n);if(i&&i.attributes.se_type){var o=d.getAttribute(n);if(o){var a=d.id.length,s=o.substr(-a-1,a);d.id!=s&&(u(r,$("#"+t+"_marker").attr("value")),svgCanvas.changeSelectedAttribute(n,"url(#"+r+")"),"line"===d.tagName&&"mid"==t&&(d=v(d)),m.call("changed",h))}}});t&&-1!==$.inArray(t.tagName,["line","path","polyline"])&&i(!0)}}}})},window.extOverview=function(){if(window.svgEditor){var t={};svgEditor.addExtension("overview_window",function(){"use strict";$("#sidepanels").append('\t\t<div id="overview_window_content_pane" style=" width:100%; word-wrap:break-word; display:inline-block; margin-top:20px;">\t\t\t<div id="overview_window_content" style="position:relative; left:12px; top:0px;">\t\t\t\t<div style="background-color:#A0A0A0; display:inline-block; overflow:visible;">\t\t\t\t\t<svg id="overviewMiniView" width="150" height="100" x="0" y="0" viewBox="0 0 4800 3600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\t\t\t\t\t\t<use x="0" y="0" xlink:href="#svgroot"> </use>\t\t\t\t\t </svg>\t\t\t\t\t <div id="overview_window_view_box" style="min-width:50px; min-height:50px; position:absolute; top:30px; left:30px; z-index:5; background-color:rgba(255,0,102,0.3);">\t\t\t\t\t </div>\t\t\t\t </div>\t\t\t</div>\t\t</div>');var o=function(){var e=parseFloat($("#workarea").css("height")),t=parseFloat($("#workarea").css("width")),r=$("#workarea").scrollLeft(),n=$("#workarea").scrollTop(),i=parseFloat($("#svgcanvas").css("width")),o=parseFloat($("#svgcanvas").css("height")),a=$("#overviewMiniView").attr("width"),s=$("#overviewMiniView").attr("height"),d=r/i*a,l=n/o*s,c=t/i*a,g=e/o*s;$("#overview_window_view_box").css("min-width",c+"px"),$("#overview_window_view_box").css("min-height",g+"px"),$("#overview_window_view_box").css("top",l+"px"),$("#overview_window_view_box").css("left",d+"px")};$("#workarea").scroll(function(){t.viewBoxDragging||o()}),$("#workarea").resize(o),o();var e=function(){var e=$("#svgroot").attr("width"),t=$("#svgroot").attr("height"),r=640,n=480;svgedit.browser.isIE()&&(n=r=0);var i=t/e*$("#overviewMiniView").attr("width");$("#overviewMiniView").attr("viewBox",r+" "+n+" "+e+" "+t),$("#overviewMiniView").attr("height",i),o()};e(),t.viewBoxDragging=!1;var l=function(){var e=parseFloat($("#svgcanvas").css("width")),t=parseFloat($("#svgcanvas").css("height")),r=$("#overviewMiniView").attr("width"),n=$("#overviewMiniView").attr("height"),i=parseFloat($("#overview_window_view_box").css("left"))/r*e,o=parseFloat($("#overview_window_view_box").css("top"))/n*t;$("#workarea").scrollLeft(i),$("#workarea").scrollTop(o)};return $("#overview_window_view_box").draggable({containment:"parent",drag:l,start:function(){t.viewBoxDragging=!0},stop:function(){t.viewBoxDragging=!1}}),$("#overviewMiniView").click(function(e){var t=e.offsetX||e.originalEvent.layerX,r=e.offsetY||e.originalEvent.layerY,n=$("#overviewMiniView").attr("width"),i=$("#overviewMiniView").attr("height"),o=parseFloat($("#overview_window_view_box").css("min-width")),a=parseFloat($("#overview_window_view_box").css("min-height")),s=t-.5*o,d=r-.5*a;s<0&&(s=0),d<0&&(d=0),n<s+o&&(s=n-o),i<d+a&&(d=i-a),$("#overview_window_view_box").css("top",d+"px"),$("#overview_window_view_box").css("left",s+"px"),l()}),{name:"overview window",canvasUpdated:e,workareaResized:o}})}},window.extPanning=function(){window.svgEditor&&svgEditor.addExtension("ext-panning",function(){"use strict";return{name:"Extension Panning",buttons:[{id:"ext-panning",type:"mode",title:"Panning",events:{click:function(){svgCanvas.setMode("ext-panning")}}}],mouseDown:function(){if("ext-panning"==svgCanvas.getMode())return svgEditor.setPanning(!0),{started:!0}},mouseUp:function(){if("ext-panning"==svgCanvas.getMode())return svgEditor.setPanning(!1),{keep:!1,element:null}}}})},window.extStorage=function(){window.svgEditor&&svgEditor.addExtension("storage",function(){var d=svgEditor.curConfig.emptyStorageOnDecline,l=svgEditor.curConfig.noStorageOnLoad,c=svgEditor.curConfig.forceStorage,g=svgEditor.storage;function u(n){n=n?"storagePrompt="+n:"";var e=top.location;-1<e.href.indexOf("storagePrompt=")?e.href=e.href.replace(/([&?])storagePrompt=[^&]*(&?)/,function(e,t,r){return(n?t:"")+n+(!n&&r?t:r||"")}):e.href+=(-1<e.href.indexOf("?")?"&":"?")+n}function v(e){if(g){var t="svgedit-"+svgEditor.curConfig.canvasName;e?g.setItem(t,e):g.removeItem(t)}}function f(e){document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"}function p(){window.addEventListener("beforeunload",function(e){if(document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)){var t;document.cookie.match(/(?:^|;\s*)store=prefsAndContent/)&&v(svgCanvas.getSvgString()),svgEditor.setConfig({no_save_warning:!0});var r=svgEditor.curPrefs;for(t in r)if(r.hasOwnProperty(t)){var n=r[t];if(t="web-edit-"+t,!(null!=n))continue;g?g.setItem(t,n):window.widget?widget.setPreferenceForKey(n,t):(n=encodeURIComponent(n),document.cookie=encodeURIComponent(t)+"="+n+"; expires=Fri, 31 Dec 9999 23:59:59 GMT")}}},!1)}var m=!1;return{name:"storage",langReady:function(e){var t=e.uiStrings,r=$.deparam.querystring(!0).storagePrompt;if(!m)if(m=!0,c||!0!==r&&(!1===r||document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)))l&&!c||p();else{var n=[];g?n.unshift({value:"prefsAndContent",text:t.confirmSetStorage.storagePrefsAndContent},{value:"prefsOnly",text:t.confirmSetStorage.storagePrefsOnly},{value:"noPrefsOrContent",text:t.confirmSetStorage.storageNoPrefsOrContent}):n.unshift({value:"prefsOnly",text:t.confirmSetStorage.storagePrefs},{value:"noPrefsOrContent",text:t.confirmSetStorage.storageNoPrefs});var i=$("#dialog_container")[0].style.width,o=$("#dialog_container")[0].style.marginLeft,a=$("#dialog_content")[0].style.height,s=$("#dialog_container")[0].style.height;$("#dialog_content")[0].style.height="120px",$("#dialog_container")[0].style.height="170px",$("#dialog_container")[0].style.width="800px",$("#dialog_container")[0].style.marginLeft="-400px",$.select(t.confirmSetStorage.message,n,function(e,t){if(e&&"noPrefsOrContent"!==e){if(document.cookie="store="+encodeURIComponent(e)+"; expires=Fri, 31 Dec 9999 23:59:59 GMT",!0===r&&t)return void u()}else if(f("store"),e&&d&&function(){var e;for(e in v(""),svgEditor.curPrefs)svgEditor.curPrefs.hasOwnProperty(e)&&(e="web-edit-"+e,g&&g.removeItem(e),f(e))}(),e&&t)return void u("false");$("#dialog_container")[0].style.width=i,$("#dialog_container")[0].style.marginLeft=o,$("#dialog_content")[0].style.height=a,$("#dialog_container")[0].style.height=s,p(),svgEditor.storagePromptClosed=!0},null,null,{label:t.confirmSetStorage.rememberLabel,checked:!1,tooltip:t.confirmSetStorage.rememberTooltip})}}}})},window.extSwitch=function(){svgEditor.addExtension("switch",function(_){"use strict";var c,C,E,A,S=svgEditor.canvas,I=S.getRootElem(),M={},N="switch",g="svg-ext-"+N,u="SWI_",v={};return{callback:function(){$("#switch_panel").hide()},mouseDown:function(e){var t=S.getColor("fill"),r=S.getColor("stroke"),n=S.getStrokeWidth();if(S.getMode()===N){for(var i=E=e.start_x,o=A=e.start_y,a={fill:t,stroke:r,"font-size":S.getFontSize(),stroke:r,"stroke-width":n,"font-family":S.getFontFamily(),"text-anchor":"middle","xml:space":"preserve"},s={elements:[{type:"path",attr:{id:"X-"+S.getNextId().replace("svg_",u),d:"m2.9674 294.65-1.9091-2.9389"}},{type:"path",attr:{id:S.getNextId().replace("svg_",u),d:"m2.9959 290.12v1.0583"}},{type:"circle",attr:{id:S.getNextId().replace("svg_",u),cx:"2.9891",cy:"291.41",r:".2581"}},{type:"path",attr:{id:S.getNextId().replace("svg_",u),d:"m2.9959 295.94v-1.0583"}},{type:"circle",attr:{id:S.getNextId().replace("svg_",u),cx:"2.9891",cy:"-294.66",r:".2581",transform:"scale(1,-1)"}}]},d={type:g,x:i,y:o,style:"pointer-events:none"},l=0;l<s.elements.length;l++)$.extend(s.elements[l].attr,a);return $.extend(d,a),v.x=i,v.y=o,c=S.getNextId().replace("svg_",u),(C=_.addSvgGroupFromJson({group:"g",id:c,type:g,attr:d,elements:s.elements})).setAttribute("transform","translate("+i+","+o+") scale(0.005) translate("+-i+","+-o+")"),_.recalculateDimensions(C),M=C.getBBox(),{started:!0}}},mouseMove:function(e){if(S.getMode()===N){var t=S.getZoom(),r=e.event,n=e.mouse_x/t,i=e.mouse_y/t,o=S.getTransformList(C),a=C.getBBox(),s=a.x,d=a.y,l=a.width,c=a.height,g=n-E,u=i-A,v=(Math.min(E,n),Math.min(A,i),Math.abs(n-E)),f=Math.abs(i-A),p=0,m=0,h=c?(c+u)/c:1,x=l?(l+g)/l:1;x=v/M.width||1,h=f/M.height||1,n<E&&(p=M.width),i<A&&(m=M.height);var w=I.createSVGTransform(),y=I.createSVGTransform(),b=I.createSVGTransform();if(w.setTranslate(-(s+p),-(d+m)),!r.shiftKey){var k=Math.min(Math.abs(x),Math.abs(h));x=k*(x<0?-1:1),h=k*(h<0?-1:1)}y.setScale(x,h),b.setTranslate(s+p,d+m),o.appendItem(b),o.appendItem(y),o.appendItem(w),_.recalculateDimensions(C),M=C.getBBox()}},mouseUp:function(e){if(S.getMode()===N)return{keep:e.event.clientX!=v.x&&e.event.clientY!=v.y,element:C,started:!1}},getClassId:function(){return g},getPrefixId:function(){return u}}})},window.extValue=function(){svgEditor.addExtension("value",function(l){"use strict";var c,g,u=svgEditor.canvas,v="value",f="svg-ext-"+v,p="VAL_",m={};return{callback:function(){$("#value_panel").hide()},mouseDown:function(e){if(u.getMode()===v){var t=u.getColor("fill"),r=u.getColor("stroke");t!==r&&(t=r);for(var n=e.start_x,i=e.start_y,o={fill:t,stroke:r,"font-size":14,stroke:r,"stroke-width":0,"font-family":"sans-serif","text-anchor":"middle","xml:space":"preserve",x:n,y:i},a={elements:[{type:"text",content:"##.##",attr:{id:u.getNextId().replace("svg_",p)}}]},s={type:f,x:n,y:i,style:"pointer-events:none"},d=0;d<a.elements.length;d++)$.extend(a.elements[d].attr,o);return $.extend(s,o),m.x=n,m.y=i,c=u.getNextId().replace("svg_",p),g=l.addSvgGroupFromJson({group:"g",id:c,type:f,attr:s,elements:a.elements}),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(u.getMode()===v)return{keep:e.event.clientX!=m.x&&e.event.clientY!=m.y,element:g,started:!1}},getClassId:function(){return f},setGaugeAttribute:function(e){0===e.elem.id.indexOf(p)&&e.elem.children&&e.elem.children.length&&e.elem.children[0].setAttribute(e.attr,e.value)},getPrefixId:function(){return p}}})},window.extHtmlInput=function(){window.svgEditor&&svgEditor.addExtension("html_input",function(d){"use strict";var l,c,g=svgEditor.canvas,u=80,v=24,f="html_input",p="svg-ext-"+f,m="HXI_",t={};return{callback:function(){$("#html_input_panel").hide()},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m);"font-size:14px;","font-family:sans-serif;";var s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"input",attr:{id:"I-"+a,type:"text",value:"#.##"},style:"width:calc(100% - 7px);height:calc(100% - 7px);text-align:right;border: unset;font-size:14px;font-family:sans-serif;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=d.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(g.getMode()===f)return{keep:e.event.clientX!=t.x&&e.event.clientY!=t.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m},setFontAttribute:function(t){t.elem.getAttribute("type")===p&&d.walkTree(t.elem,function(e){"input"===e.nodeName.toLowerCase()&&(t.attr=t.attr.replace("text-anchor","text-align"),t.value=t.value.replace("end","right").replace("middle","center").replace("start","left"),e.style[t.attr]=t.value)})},getFontAttribute:function(e){if(e.elem.getAttribute("type")===p){var r=!1;return d.walkTree(e.elem,function(e){if("input"===e.nodeName.toLowerCase()){var t=e.style["text-align"];t=t.replace("right","end").replace("center","middle").replace("left","start"),r={fontSize:e.style["font-size"],fontFamily:e.style["font-family"],textAnchor:t}}}),r}}}})},window.extHtmlButton=function(){window.svgEditor&&svgEditor.addExtension("html_button",function(l){"use strict";var c,g,u=svgEditor.canvas,v=80,f=32,p="html_button",m="svg-ext-"+p,h="HXB_",t={};return{callback:function(){$("#html_button_panel").hide()},mouseDown:function(e){if(u.getMode()===p){!0;var t=u.getColor("fill"),r=u.getColor("stroke"),n=e.start_x,i=e.start_y,o=u.getNextId(),a=u.getNextId().replace("svg_",h),s="width:calc(100% - 6px);height:calc(100% - 6px);text-align:center;background-color:"+t+";color:"+r+";";s+="font-size:14px;";var d={elements:[{type:"rect",attr:{x:n,y:i-f,width:v,height:f,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"button",attr:{id:"B-"+a,class:"md-btn md-btn-raised"},style:s+="font-family:sans-serif;"}],attr:{x:n,y:i-f,height:f,width:v,id:"H-"+a}}]};return c=u.getNextId().replace("svg_",h),g=l.addSvgGroupFromJson({group:"g",id:c,type:m,attr:{type:m,style:"pointer-events:none",fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)","xml:space":"preserve"},elements:d.elements}),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(u.getMode()===p)return{keep:e.event.clientX!=t.x&&e.event.clientY!=t.y,element:g,started:!1}},getClassId:function(){return m},getPrefixId:function(){return h},setFontAttribute:function(t){t.elem.getAttribute("type")===m&&l.walkTree(t.elem,function(e){"button"===e.nodeName.toLowerCase()&&(t.attr=t.attr.replace("text-anchor","text-align"),t.value=t.value.replace("end","right").replace("middle","center").replace("start","left"),e.style[t.attr]=t.value)})},getFontAttribute:function(e){if(e.elem.getAttribute("type")===m){var r=!1;return l.walkTree(e.elem,function(e){if("button"===e.nodeName.toLowerCase()){var t=e.style["text-align"];t=t.replace("right","end").replace("center","middle").replace("left","start"),r={fontSize:e.style["font-size"],fontFamily:e.style["font-family"],textAnchor:t}}}),r}}}})},window.extHtmlSelect=function(){window.svgEditor&&svgEditor.addExtension("html_select",function(l){"use strict";var c,g,u=svgEditor.canvas,v=80,f=26,p="html_select",m="svg-ext-"+p,h="HXS_",t={};return{callback:function(){$("#html_select_panel").hide()},mouseDown:function(e){if(u.getMode()===p){!0;var t=u.getColor("fill"),r=u.getColor("stroke"),n=e.start_x,i=e.start_y,o=u.getNextId(),a=u.getNextId().replace("svg_",h),s="width:100%;height:100%;text-align: left;margin-top:unset;background-color:"+t+";color:"+r+";";s+="font-size:14px;";var d={elements:[{type:"rect",attr:{x:n,y:i-f,width:v,height:f,fill:t,stroke:r,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"select",attr:{id:"S-"+a},style:s+="font-family:sans-serif;"}],attr:{x:n,y:i-f,height:f,width:v,id:"H-"+a}}]};return c=l.getNextId().replace("svg_",h),g=l.addSvgGroupFromJson({group:"g",id:c,type:m,attr:{type:m,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"xml:space":"preserve"},elements:d.elements}),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(u.getMode()===p)return{keep:e.event.clientX!=t.x&&e.event.clientY!=t.y,element:g,started:!1}},getClassId:function(){return m},getPrefixId:function(){return h},setFontAttribute:function(t){t.elem.getAttribute("type")===m&&l.walkTree(t.elem,function(e){"select"===e.nodeName.toLowerCase()&&(t.attr=t.attr.replace("text-anchor","text-align"),t.value=t.value.replace("end","right").replace("middle","center").replace("start","left"),e.style[t.attr]=t.value)})},getFontAttribute:function(e){if(e.elem.getAttribute("type")===m){var r=!1;return l.walkTree(e.elem,function(e){if("select"===e.nodeName.toLowerCase()){var t=e.style["text-align"];t=t.replace("right","end").replace("center","middle").replace("left","start"),r={fontSize:e.style["font-size"],fontFamily:e.style["font-family"],textAnchor:t}}}),r}}}})},window.extHtmlSwitch=function(){window.svgEditor&&svgEditor.addExtension("html_switch",function(d){"use strict";var l,c,g=svgEditor.canvas,u=50,v=28,f="html_switch",p="svg-ext-"+f,m="HXT_",t={};return{callback:function(){$("#html_switch_panel").hide()},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m),s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"label",attr:{id:"T-"+a,class:"md-switch"},style:"width:calc(100% - 6px);height:calc(100% - 6px);text-align:center;background-color:"+t+";color:"+r+";margin: 3px 3px 3px 3px;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=g.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)","xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){if("resize"===g.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m))return e.selected.id},mouseUp:function(e){if(g.getMode()===f)return{keep:e.event.clientX!=t.x&&e.event.clientY!=t.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extHtmlChart=function(){window.svgEditor&&svgEditor.addExtension("html_chart",function(d){"use strict";var l,c,g=svgEditor.canvas,u=380,v=240,f="html_chart",p="svg-ext-"+f,m="HXC_",r={};return{callback:function(){$("#html_chart_panel").hide()},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m),s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"div",attr:{id:"D-"+a},style:"width:100%;height:100%;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=d.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"font-size":g.getFontSize(),"font-family":g.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){if("resize"===g.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m))return e.selected.id},mouseUp:function(e){var t=g.getMode();return t!==f?"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m)?e.selected.id:void 0:{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extHtmlGraph=function(){window.svgEditor&&svgEditor.addExtension("html_graph",function(c){"use strict";var g,u,v=svgEditor.canvas,f={width:380,height:240},p={width:240,height:240},m=f,h="html_graph",x="svg-ext-"+h,w="HXC_",r={};return{callback:function(){$("#html_graph_panel").hide()},mouseDown:function(e){var t=v.getMode();if(t.startsWith(h)){-1!==t.indexOf("pie")?(m=p,x+="-pie"):(m=f,x+="-bar"),!0;var r=v.getColor("fill"),n=v.getColor("stroke"),i=e.start_x,o=e.start_y,a=v.getNextId(),s=v.getNextId().replace("svg_",w),d=[{tag:"div",attr:{id:"D-"+s},style:"width:100%;height:100%;"}],l={elements:[{type:"rect",attr:{x:i,y:o-m.height,width:m.width,height:m.height,"stroke-width":0,id:a}},{type:"foreignObject",content:d,attr:{x:i,y:o-m.height,height:m.height,width:m.width,id:"H-"+s}}]};return g=c.getNextId().replace("svg_",w),u=c.addSvgGroupFromJson({group:"g",id:g,type:x,attr:{type:x,style:"pointer-events:none",fill:r,stroke:n,"stroke-width":1,"font-size":v.getFontSize(),"font-family":v.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:l.elements}),{started:!0}}},mouseMove:function(e){if("resize"===v.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(w))return e.selected.id},mouseUp:function(e){var t=v.getMode();return t.startsWith(h)?{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:u,started:!1}:"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(w)?e.selected.id:void 0},getClassId:function(){return x},getPrefixId:function(){return w}}})},window.extHtmlBag=function(){window.svgEditor&&svgEditor.addExtension("html_bag",function(d){"use strict";var l,c,g=svgEditor.canvas,u=200,v=160,f="html_bag",p="svg-ext-"+f,m="BAG_",r={};return{callback:function(){},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m),s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"div",attr:{id:"D-"+a},style:"width:100%;height:100%;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=d.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"font-size":g.getFontSize(),"font-family":g.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){if("resize"===g.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m))return e.selected.id},mouseUp:function(e){var t=g.getMode();return t!==f?"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m)?e.selected.id:void 0:{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extGaugeProgress=function(){window.svgEditor&&svgEditor.addExtension("gauge_progress",function(v){"use strict";var f,p,m=svgEditor.canvas,h=100,x=25,w="gauge_progress",y="svg-ext-"+w,b="GXP_",k={};return{callback:function(){$("#gauge_progress_panel").hide()},mouseDown:function(e){if(m.getMode()===w){var t,r=m.getColor("fill"),n=m.getColor("stroke"),i=m.getStrokeWidth(),o=m.getFontSize(),a=e.start_x,s=e.start_y-h,d={"font-size":o,stroke:n,"stroke-width":i,"font-family":m.getFontFamily(),"xml:space":"preserve"},l=m.getNextId().replace("svg_",b);t=[];for(var c={elements:[{type:"rect",attr:{id:"A-"+m.getNextId().replace("svg_",b),x:a,y:s,width:x,height:h,fill:r}},{type:"rect",attr:{id:"B-"+m.getNextId().replace("svg_",b),x:a,y:s+h/2,width:x,height:h/2,fill:"#1565c0"}},{type:"foreignObject",content:t,attr:{x:a,y:s,height:h,width:x,id:"H-"+l}}]},g={type:y,x:a,y:s,style:"pointer-events:none"},u=0;u<c.elements.length;u++)$.extend(c.elements[u].attr,d);return $.extend(g,d),k.x=a,k.y=s,f=m.getNextId().replace("svg_",b),p=v.addSvgGroupFromJson({group:"g",id:f,type:y,attr:g,elements:c.elements}),{started:!0}}},mouseMove:function(e){m.getMode()},mouseUp:function(e){if(m.getMode()===w)return{keep:e.event.clientX!=k.x&&e.event.clientY!=k.y,element:p,started:!1}},getClassId:function(){return y},getPrefixId:function(){return b}}})},window.extGaugeSemaphore=function(){svgEditor.addExtension("gauge_semaphore",function(c){"use strict";var g,u,v=svgEditor.canvas,f="gauge_semaphore",p="svg-ext-"+f,m="GSE_",h={};return{callback:function(){$("#gauge_semaphore_panel").hide()},mouseDown:function(e){if(v.getMode()===f){for(var t=v.getColor("fill"),r=v.getColor("stroke"),n=v.getStrokeWidth(),i=e.start_x,o=e.start_y-30,a={fill:t,"font-size":v.getFontSize(),stroke:r,"stroke-width":n,"font-family":v.getFontFamily(),"xml:space":"preserve"},s={elements:[{type:"ellipse",attr:{id:v.getNextId().replace("svg_",m),cx:"15",cy:"15",rx:"14",ry:"14","stroke-width":"none"}}]},d={type:p,x:i,y:o,style:"pointer-events:none"},l=0;l<s.elements.length;l++)$.extend(s.elements[l].attr,a);return $.extend(d,a),h.x=i,h.y=o,g=v.getNextId().replace("svg_",m),(u=c.addSvgGroupFromJson({group:"g",id:g,type:p,attr:d,elements:s.elements})).setAttribute("transform","translate("+i+","+o+")"),c.recalculateDimensions(u),u.getBBox(),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(v.getMode()===f)return{keep:e.event.clientX!=h.x&&e.event.clientY!=h.y,element:u,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extShapes=function(){window.svgEditor&&svgEditor.addExtension("shapes",function(){"use strict";var _,p,C,E,A,m=svgEditor.shapesList,S=svgEditor.canvas,h="SHE_",I={},x="svg-ext-",w={};return{callback:function(){},mouseDown:function(e){var t=S.getMode();if(x="svg-ext-"+t,p=t,void 0!==(_=m.find(function(e){return e.name===p}))){var r=S.getColor("fill"),n=S.getColor("stroke"),i=S.getFontSize(),o=S.getFontFamily(),a=S.getStrokeWidth();S.getStyle();r===n&&(r="#FFFFFF",n="#000000");for(var s=E=e.start_x,d=A=e.start_y,l={fill:r,stroke:n,"stroke-width":a,"font-size":i,"font-family":o,"text-anchor":"middle","xml:space":"preserve"},c={elements:[]},g=0;g<_.content.length;g++){var u=_.content[g],v={id:u.id+S.getNextId().replace("svg_",h),"stroke-width":a};$.extend(v,u.attr),c.elements.push({type:u.type,content:u.content,attr:v})}var f={type:x,x:s,y:d,style:"pointer-events:none"};return $.extend(f,l),w.x=s,w.y=d,p=S.getNextId().replace("svg_",h),(C=S.addSvgGroupFromJson({group:"g",id:p,type:x,attr:f,elements:c.elements})).setAttribute("transform","translate("+s+","+d+")"),S.recalculateDimensions(C),I=C.getBBox(),{started:!0}}},mouseMove:function(e){if(void 0!==_){var t=S.getZoom(),r=e.event,n=e.mouse_x/t,i=e.mouse_y/t;svgEditor.curConfig.gridSnapping&&(n=svgedit.utilities.snapToGrid(n),i=svgedit.utilities.snapToGrid(i));var o=S.getTransformList(C),a=C.getBBox(),s=a.x,d=a.y,l=a.width,c=a.height,g=n-E,u=i-A,v=(Math.min(E,n),Math.min(A,i),Math.abs(n-E)),f=Math.abs(i-A),p=0,m=0,h=c?(c+u)/c:1,x=l?(l+g)/l:1;x=v/I.width||1,h=f/I.height||1,n<E&&(p=I.width),i<A&&(m=I.height);var w=svgroot.createSVGTransform(),y=svgroot.createSVGTransform(),b=svgroot.createSVGTransform();if(w.setTranslate(-(s+p),-(d+m)),!r.shiftKey){var k=Math.min(Math.abs(x),Math.abs(h));x=k*(x<0?-1:1),h=k*(h<0?-1:1)}y.setScale(x,h),b.setTranslate(s+p,d+m),o.appendItem(b),o.appendItem(y),o.appendItem(w),S.recalculateDimensions(C),I=C.getBBox()}},mouseUp:function(e){if(void 0!==_)return{keep:e.event.clientX!=w.x&&e.event.clientY!=w.y,element:C,started:!1}},getClassId:function(){return x},getPrefixId:function(){return h}}})},window.extLinear=function(){window.svgEditor&&svgEditor.addExtension("help-linear",function(){"use strict";var e="rgba(255, 0, 0, 0.5)",o=svgEditor.canvas,a=["line","path","pipe"],s=!1,t=svgedit.NS,d=o.assignAttributes,r=document.getElementById("svgcanvas").ownerDocument,l=document.getElementById("canvasBackground"),c=r.createElementNS(t.SVG,"line");d(c,{x1:0,y1:0,x2:0,y2:0,"stroke-width":1,stroke:e});var g=r.createElementNS(t.SVG,"line");function n(){s=!1,d(c,{x1:0,y1:0,x2:0,y2:0}),d(g,{x1:0,y1:0,x2:0,y2:0})}return d(g,{x1:0,y1:0,x2:0,y2:0,"stroke-width":1,stroke:e}),l.append(c),l.append(g),{callback:function(){},mouseDown:function(e){var t=o.getMode();-1!==a.indexOf(t)?s=!0:n()},mouseMove:function(e){if(s){var t=o.getMode();-1!==a.indexOf(t)&&(r=e.mouse_x,n=e.mouse_y,i=l.getBBox(),d(c,{x1:r,y1:0,x2:r,y2:i.height}),d(g,{x1:0,y1:n,x2:i.width,y2:n}))}var r,n,i},mouseUp:function(e){if(s&&"line"!=o.getMode())return;n()}}})},window.extPipe=function(){window.svgEditor&&svgEditor.addExtension("pipe",function(e){"use strict";var g=svgEditor.canvas,u="svg-ext-pipe",v="PIE_";return{name:"pipe",initPipe:function(e){if(!e||!e[0])return!1;var t=document.getElementById(e[0].id);if(!t)return!1;var r=e[0].property;if("path"==t.nodeName){var n=t.getBBox(),i=t.getAttribute("d"),o=r.contentSpace+" "+r.contentSpace;t.remove();var a=[{type:"path",attr:{id:"b"+g.getNextId().replace("svg_",v),d:i,"stroke-width":r.borderWidth,stroke:r.border,fill:"none"}},{type:"path",attr:{id:"p"+g.getNextId().replace("svg_",v),d:i,"stroke-width":r.pipeWidth,stroke:r.pipe,fill:"none"}},{type:"path",attr:{id:"c"+g.getNextId().replace("svg_",v),d:i,"stroke-width":r.contentWidth,stroke:r.content,fill:"none","stroke-dasharray":o}}],s=g.getNextId().replace("svg_",v),d={type:u,x:n.x,y:n.y,style:"pointer-events:none"};return $.extend(d,{"xml:space":"preserve"}),{keep:!0,element:g.addSvgGroupFromJson({group:"g",id:s,type:u,attr:d,elements:a}),started:!1}}for(var l=0;l<t.childNodes.length;l++){var c=t.childNodes[l];if(0<=c.id.indexOf("b"+v))c.setAttribute("stroke-width",r.borderWidth),c.setAttribute("stroke",r.border);else if(0<=c.id.indexOf("p"+v))c.setAttribute("stroke-width",r.pipeWidth),c.setAttribute("stroke",r.pipe);else if(0<=c.id.indexOf("c"+v)){c.setAttribute("stroke-width",r.contentWidth),c.setAttribute("stroke",r.content);o=r.contentSpace+" "+r.contentSpace;c.setAttribute("stroke-dasharray",o)}}return{keep:!0,element:t,started:!1}},getClassId:function(){return u},getPrefixId:function(){return v}}})},window.extHtmlSlider=function(){window.svgEditor&&svgEditor.addExtension("html_slider",function(d){"use strict";var l,c,g=svgEditor.canvas,u=200,v=200,f="html_slider",p="svg-ext-"+f,m="SLI_",r={};return{callback:function(){},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m),s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"div",attr:{id:"D-"+a},style:"width:100%;height:100%;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=d.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"font-size":g.getFontSize(),"font-family":g.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){if("resize"===g.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m))return e.selected.id},mouseUp:function(e){var t=g.getMode();return t!==f?"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m)?e.selected.id:void 0:{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extOwnCtrl=function(){window.svgEditor&&svgEditor.addExtension("own_ctrl",function(c){"use strict";var g,u,v=svgEditor.canvas,f=220,p=140,m="own_ctrl",h="svg-ext-"+m,x=h,w="OXC_",r={};return{callback:function(){$("#own_ctrl_panel").hide()},mouseDown:function(e){var t=v.getMode();if(t.startsWith(m)){var r=t.replace(m,"");x=h+r,!0;var n=v.getColor("fill"),i=v.getColor("stroke"),o=e.start_x,a=e.start_y,s=v.getNextId(),d=v.getNextId().replace("svg_",w),l={elements:[{type:"rect",attr:{x:o,y:a-p,width:f,height:p,"stroke-width":0,id:s}},{type:"foreignObject",content:[{tag:"div",attr:{id:"D-"+d},style:"width:100%;height:100%;"}],attr:{x:o,y:a-p,height:p,width:f,id:"H-"+d}}]};return g=c.getNextId().replace("svg_",w),u=c.addSvgGroupFromJson({group:"g",id:g,type:x,attr:{type:x,style:"pointer-events:none",fill:n,stroke:i,"stroke-width":1,"font-size":v.getFontSize(),"font-family":v.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:l.elements}),{started:!0}}},mouseMove:function(e){if("resize"===v.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(w))return e.selected.id},mouseUp:function(e){var t=v.getMode();return t.startsWith(m)?{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:u,started:!1}:"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(w)?e.selected.id:void 0},getClassId:function(){return x},getPrefixId:function(){return w}}})};
1
+ window.extConnector=function(){window.svgEditor&&svgEditor.addExtension("Connector",function(e){var u,v,f,p,m,h,x=e.svgcontent,g=e.svgroot,l=e.getNextId,w=e.getElem,y=e.addSvgElementFromJson,b=e.selectorManager,c=svgEditor.curConfig,k=!1,_=[],C=".se_connector",E=[],A=$.data,t={en:[{id:"mode_connect",title:"Connect two objects"}],fr:[{id:"mode_connect",title:"Connecter deux objets"}]};function S(e,t,r,n){n&&(n-=0,(r=$.extend({},r)).width+=n,r.height+=n,r.x-=n/2,r.y-=n/2);var i,o=r.x+r.width/2,a=r.y+r.height/2,s=e-o,d=t-a;return{x:o+s*(i=Math.abs(d/s)<r.height/r.width?r.width/2/Math.abs(s):r.height/2/Math.abs(d)),y:a+d*i}}function I(e,t){var r=!!t.getAttribute("marker-"+e),n=5*t.getAttribute("stroke-width");return r?n:0}function n(e){var t=$("#connector_rules");t.length||(t=$('<style id="connector_rules"></style>').appendTo("head")),t.text(e?"#tool_clone, #tool_topath, #tool_angle, #xy_panel { display: none !important; }":""),$("#connector_panel").toggle(e)}function M(t,r,n,i,e){var o,a=t.points,s=g.createSVGPoint();s.x=n,s.y=i,"end"===r&&(r=a.numberOfItems-1);try{a.replaceItem(s,r)}catch(e){var d=t.getAttribute("points").split(" ");for(o=0;o<d.length;o++)o===r&&(d[o]=n+","+i);t.setAttribute("points",d.join(" "))}if(e){var l=a.getItem(0),c=a.getItem(a.numberOfItems-1);M(t,1,(c.x+l.x)/2,(c.y+l.y)/2)}}function N(s){var d;s||(s=E);var e=$(x).find(C);_=[],e.each(function(){var e;function t(){-1!==$.inArray(this,s)&&(e=!0)}var r=A(this,"c_start"),n=A(this,"c_end"),i=[w(r),w(n)];for(d=0;d<2;d++){var o=i[d];if(e=!1,$(o).parents().each(t),o&&o.parentNode){if(-1!==$.inArray(o,s)||e){var a=svgCanvas.getStrokedBBox([o]);_.push({elem:o,connector:this,is_start:0===d,start_x:a.x,start_y:a.y})}}else $(this).remove()}})}function F(e){var t,r;if(N(e),_.length)for(t=_.length;t--;){var n=_[t],i=n.connector,o=n.elem,a=(i.getAttribute("stroke-width"),n.is_start?"start":"end"),s=svgCanvas.getStrokedBBox([o]);s.x=n.start_x,s.y=n.start_y,A(i,a+"_bb",s);A(i,a+"_off");var d=n.is_start?"end":"start",l=A(i,d+"_bb"),c=S(l.x+l.width/2,l.y+l.height/2,s,I(a,i));M(i,n.is_start?0:"end",c.x,c.y,!0);var g=S(c.x,c.y,A(i,d+"_bb"),I(d,i));if(M(i,n.is_start?"end":0,g.x,g.y,!0),-1!==navigator.userAgent.indexOf("AppleWebKit")){var u=i.points,v=u.numberOfItems,f=[];for(r=0;r<v;r++)c=u.getItem(r),f[r]=c.x+","+c.y;i.setAttribute("points",f.join(" "))}}}return function(){var e=svgCanvas.groupSelectedElements;svgCanvas.groupSelectedElements=function(){return svgCanvas.removeFromSelection($(C).toArray()),e.apply(this,arguments)};var t=svgCanvas.moveSelectedElements;svgCanvas.moveSelectedElements=function(){svgCanvas.removeFromSelection($(C).toArray());var e=t.apply(this,arguments);return F(),e},h=svgCanvas.getEditorNS()}(),{name:"Connector",buttons:[{id:"mode_connect",type:"mode",title:"Connect two objects",includeWith:{button:"#tool_line",isDefault:!1,position:1},events:{click:function(){svgCanvas.setMode("connector")}}}],addLangData:function(e){return{data:t[e]}},mouseDown:function(e){var t=e.event;u=e.start_x,v=e.start_y;var r=svgCanvas.getMode();if("connector"==r){if(k)return;var n=t.target,i=$(n).parents();if(-1!==$.inArray(x,i)){var o=$(n).closest("foreignObject");p=o.length?o[0]:n;var a=svgCanvas.getStrokedBBox([p]),s=a.x+a.width/2,d=a.y+a.height/2;k=!0,f=y({element:"polyline",attr:{id:l(),points:s+","+d+" "+s+","+d+" "+u+","+v,stroke:"#"+c.initStroke.color,"stroke-width":p.stroke_width&&0!=p.stroke_width?p.stroke_width:c.initStroke.width,fill:"none",opacity:c.initStroke.opacity,style:"pointer-events:none"}}),A(f,"start_bb",a)}return{started:!0}}"select"==r&&N()},mouseMove:function(e){var t=svgCanvas.getZoom(),r=(e.event,e.mouse_x/t),n=e.mouse_y/t,i=r-u,o=n-v,a=svgCanvas.getMode();if("connector"==a&&k){f.getAttribute("stroke-width");var s=S(r,n,A(f,"start_bb"),I("start",f));u=s.x,v=s.y,M(f,0,s.x,s.y,!0),M(f,"end",r,n,!0)}else if("select"==a){for(var d=E.length;d--;){var l=E[d];l&&A(l,"c_start")&&(svgCanvas.removeFromSelection([l]),svgCanvas.getTransformList(l).clear())}_.length&&function(e,t){for(var r=_.length;r--;){var n=_[r],i=n.connector,o=(n.elem,n.is_start?"start":"end"),a=A(i,o+"_bb");a.x=n.start_x+e,a.y=n.start_y+t,A(i,o+"_bb",a);var s=n.is_start?"end":"start",d=A(i,s+"_bb"),l=S(d.x+d.width/2,d.y+d.height/2,a,I(o,i));M(i,n.is_start?0:"end",l.x,l.y,!0);var c=S(l.x,l.y,A(i,s+"_bb"),I(s,i));M(i,n.is_start?"end":0,c.x,c.y,!0)}}(i,o)}},mouseUp:function(e){var t=svgCanvas.getZoom(),r=e.event,n=(e.mouse_x,e.mouse_y,r.target);if("connector"==svgCanvas.getMode()){var i=$(n).closest("foreignObject");i.length&&(n=i[0]);var o=$(n).parents();if(n==p)return{keep:k=!0,element:null,started:k};if(-1===$.inArray(x,o))return $(f).remove(),{keep:k=!1,element:null,started:k};m=n;var a=p.id,s=m.id,d=a+" "+s,l=s+" "+a;if($(x).find(C).filter(function(){var e=this.getAttributeNS(h,"connector");if(e==d||e==l)return!0}).length)return $(f).remove(),{keep:!1,element:null,started:!1};var c=svgCanvas.getStrokedBBox([m]),g=S(u,v,c,I("start",f));return M(f,"end",g.x,g.y,!0),$(f).data("c_start",a).data("c_end",s).data("end_bb",c),h=svgCanvas.getEditorNS(!0),f.setAttributeNS(h,"se:connector",d),f.setAttribute("class",C.substr(1)),f.setAttribute("opacity",1),svgCanvas.addToSelection([f]),svgCanvas.moveToBottomSelectedElement(),b.requestSelector(f).showGrips(!1),{keep:!(k=!1),element:f,started:k}}},selectedChanged:function(e){if($(x).find(C).length){"connector"==svgCanvas.getMode()&&svgCanvas.setMode("select");for(var t=(E=e.elems).length;t--;){var r=E[t];r&&A(r,"c_start")?(b.requestSelector(r).showGrips(!1),e.selectedElement&&!e.multiselected?n(!0):n(!1)):n(!1)}F()}},elementChanged:function(e){var t,r=e.elems[0];if(r&&"svg"===r.tagName&&"svgcontent"===r.id&&(x=r,$(x).find("*").each(function(){var e=this.getAttributeNS(h,"connector");if(e){this.setAttribute("class",C.substr(1));var t=e.split(" "),r=svgCanvas.getStrokedBBox([w(t[0])]),n=svgCanvas.getStrokedBBox([w(t[1])]);$(this).data("c_start",t[0]).data("c_end",t[1]).data("start_bb",r).data("end_bb",n),svgCanvas.getEditorNS(!0)}})),r&&(r.getAttribute("marker-start")||r.getAttribute("marker-mid")||r.getAttribute("marker-end"))){t=r.getAttribute("marker-start");var n=r.getAttribute("marker-mid"),i=r.getAttribute("marker-end");if(f=r,$(r).data("start_off",!!t).data("end_off",!!i),"line"===r.tagName&&n){var o=Number(r.getAttribute("x1")),a=Number(r.getAttribute("x2")),s=Number(r.getAttribute("y1")),d=Number(r.getAttribute("y2")),l=r.id,c=y({element:"polyline",attr:{points:o+","+s+(" "+(o+a)/2+","+(s+d)/2+" ")+a+","+d,stroke:r.getAttribute("stroke"),"stroke-width":r.getAttribute("stroke-width"),"marker-mid":n,fill:"none",opacity:r.getAttribute("opacity")||1}});$(r).after(c).remove(),svgCanvas.clearSelection(),c.id=l,svgCanvas.addToSelection([c]),r=c}}r.getAttribute("class")==C.substr(1)?F([t=w(A(r,"c_start"))]):F()},toolButtonStateUpdate:function(e){e.nostroke&&$("#mode_connect").hasClass("tool_button_current")&&svgEditor.clickSelect(),$("#mode_connect").toggleClass("disabled",e.nostroke)}}})},window.extEyedropper=function(){window.svgEditor&&svgEditor.addExtension("eyedropper",function(e){"use strict";var o=svgEditor.canvas,a=svgedit.history.ChangeElementCommand,s={fillPaint:"red",fillOpacity:1,strokePaint:"black",strokeOpacity:1,strokeWidth:5,strokeDashArray:null,opacity:1,strokeLinecap:"butt",strokeLinejoin:"miter"};function t(e){if("eyedropper"!=o.getMode()){var t=null,r=$("#tool_eyedropper");!e.multiselected&&e.elems[0]&&-1===$.inArray(e.elems[0].nodeName,["svg","g","use"])?(t=e.elems[0],r.removeClass("disabled"),s.fillPaint=t.getAttribute("fill")||"black",s.fillOpacity=t.getAttribute("fill-opacity")||1,s.strokePaint=t.getAttribute("stroke"),s.strokeOpacity=t.getAttribute("stroke-opacity")||1,s.strokeWidth=t.getAttribute("stroke-width"),s.strokeDashArray=t.getAttribute("stroke-dasharray"),s.strokeLinecap=t.getAttribute("stroke-linecap"),s.strokeLinejoin=t.getAttribute("stroke-linejoin"),s.opacity=t.getAttribute("opacity")||1):r.addClass("disabled")}}return{name:"eyedropper",buttons:[{id:"tool_eyedropper",type:"mode",title:"Eye Dropper Tool",key:"I",events:{click:function(){o.setMode("eyedropper")}}}],selectedChanged:t,elementChanged:t,mouseDown:function(e){var t;if("eyedropper"==o.getMode()){var r=e.event.target;if(-1===$.inArray(r.nodeName,["svg","g","use"])){var n={},i=function(e,t,r){n[t]=e.getAttribute(t),e.setAttribute(t,r)};s.fillPaint&&i(r,"fill",s.fillPaint),s.fillOpacity&&i(r,"fill-opacity",s.fillOpacity),s.strokePaint&&i(r,"stroke",s.strokePaint),s.strokeOpacity&&i(r,"stroke-opacity",s.strokeOpacity),s.strokeWidth&&i(r,"stroke-width",s.strokeWidth),s.strokeDashArray&&i(r,"stroke-dasharray",s.strokeDashArray),s.opacity&&i(r,"opacity",s.opacity),s.strokeLinecap&&i(r,"stroke-linecap",s.strokeLinecap),s.strokeLinejoin&&i(r,"stroke-linejoin",s.strokeLinejoin),t=new a(r,n),o.undoMgr.addCommandToHistory(t)}}}}})},window.extGrid=function(){window.svgEditor&&svgEditor.addExtension("view_grid",function(){"use strict";var e=svgedit.NS,g=svgEditor.canvas,t=document.getElementById("svgcanvas").ownerDocument,r=svgEditor.curConfig.showGrid||!1,n=g.assignAttributes,u=document.createElement("canvas"),i=$("#canvasBackground"),v=svgedit.units.getTypeMap(),f=[.01,.1,1,10,100,1e3];$(u).hide().appendTo("body");var o=t.createElementNS(e.SVG,"svg");n(o,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"}),i.append(o);var a=t.createElementNS(e.SVG,"pattern");n(a,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var p=t.createElementNS(e.SVG,"image");n(p,{x:0,y:0,width:100,height:100}),a.appendChild(p),$("#svgroot defs").append(a);var s=t.createElementNS(e.SVG,"rect");function d(e){var t,r=v[svgEditor.curConfig.baseUnit]*e,n=100/r,i=1;for(t=0;t<f.length;t++){var o=f[t];if(n<=(i=o))break}var a=i*r;u.width=a,u.height=a;var s=u.getContext("2d"),d=a/10;for(s.globalAlpha=.2,s.strokeStyle=svgEditor.curConfig.gridColor,t=1;t<10;t++){var l=Math.round(d*t)+.5;s.moveTo(l,a),s.lineTo(l,0),s.moveTo(a,l),s.lineTo(0,l)}s.stroke(),s.beginPath(),s.globalAlpha=.5,s.moveTo(.5,a),s.lineTo(.5,0),s.moveTo(a,.5),s.lineTo(0,.5),s.stroke();var c=u.toDataURL("image/png");p.setAttribute("width",a),p.setAttribute("height",a),p.parentNode.setAttribute("width",a),p.parentNode.setAttribute("height",a),g.setHref(p,c)}function l(){r&&d(g.getZoom()),$("#canvasGrid").toggle(r)}return n(s,{width:"100%",height:"100%",x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"}),$("#canvasGrid").append(s),{name:"view_grid",zoomChanged:function(e){r&&d(e)},callback:function(){r&&l()},buttons:[{id:"view_grid",events:{click:function(){svgEditor.curConfig.showGrid=r=!r,l()}}}]}})},window.extMarkers=function(){window.svgEditor&&svgEditor.addExtension("Markers",function(m){var h,x=m.addSvgElementFromJson,l=["start","mid","end"],c="se_marker_",w={nomarker:{label:"&#x2014;"},leftarrow:{element:"path",attr:{d:"M0,50 L100,90 L70,50 L100,10 Z"},label:"&#x25C4;"},rightarrow:{element:"path",attr:{d:"M100,50 L0,90 L30,50 L0,10 Z"},label:"&#x25BA;"},leftpointing:{element:"path",attr:{d:"M50,48 L90,90 M50,52 L90,10"},label:"&#x2009;&#x02C2;"},rightpointing:{element:"path",attr:{d:"M50,48 L10,90 L50,52 L10,10 Z"},label:"&#x2009;&#x003E;"},break:{element:"path",attr:{d:"M50,20 L50,80"},label:"&#x2009;&#x2223;"},mcircle:{element:"circle",attr:{r:30,cx:50,cy:50},label:"&#x2009;&#x25CF;"}};function g(e,t){var r=e.getAttribute(t);if(!r)return null;var n=r.match(/\(\#(.*)\)/);return n&&2===n.length?m.getElem(n[1]):null}function s(e,r){"\\"!==r.substr(0,1)&&(r="\\textmarker");var t=document.getElementById(e+"_marker"),n=0;$.each(w,function(e,t){if(-1!==r.indexOf(e))return!1;n++}),t.selectedIndex=n}function i(e){if($("#marker_panel").toggle(e),e){var i,o,a=h[0];$.each(l,function(e,t){var r=g(a,"marker-"+t),n=$("#"+t+"_marker");if(r){if(!r.attributes.se_type)return;i="\\"+r.attributes.se_type.textContent,"\\textmarker"===(o=i)?i=r.lastChild.textContent:n.hide()}else o=i="\\nomarker",n.hide();n.val(i),s(t,o)})}}function u(e,t){var r=m.getElem(e);if(!r&&""!=t&&"\\nomarker"!=t){var n,i=h[0].getAttribute("stroke"),o=50,a=50,s="0 0 100 100",d=10,l=10;if(n="\\"===t.substr(0,1)?t.substr(1):"textmarker",w[n]){if(r=x({element:"marker",attr:{id:e,orient:"auto",style:"pointer-events:none",se_type:n}}),"textmarker"!=n){var c=x(w[n]),g=i;"_o"===n.substr(-2)&&(g="none"),c.setAttribute("fill",g),c.setAttribute("stroke",i),c.setAttribute("stroke-width",10),r.appendChild(c)}else{var u=x(w[n]);u.textContent=t;var v=u.getBBox(),f=v;f.x=0,f.y=0,f.width+=2,f.height+=2,u.setAttribute("x",1),u.setAttribute("y",f.height-1-v.height/4),u.setAttribute("fill",i),o=f.width/2+1,a=f.height/2+1,s=f.x+" "+f.y+" "+f.width+" "+f.height,d=f.width/10,l=f.height/10;var p=x({element:"rect",attr:{x:f.x,y:f.y,width:f.width,height:f.height,fill:"#ffffff",stroke:"none","stroke-width":0}});r.setAttribute("orient",0),r.appendChild(p),r.appendChild(u)}return r.setAttribute("viewBox",s),r.setAttribute("markerWidth",d),r.setAttribute("markerHeight",l),r.setAttribute("refX",o),r.setAttribute("refY",a),m.findDefs().appendChild(r),r}}}function v(n){if("line"!==n.tagName)return n;var e=Number(n.getAttribute("x1")),t=Number(n.getAttribute("x2")),r=Number(n.getAttribute("y1")),i=Number(n.getAttribute("y2")),o=n.id,a=x({element:"polyline",attr:{points:e+","+r+(" "+(e+t)/2+","+(r+i)/2+" ")+t+","+i,stroke:n.getAttribute("stroke"),"stroke-width":n.getAttribute("stroke-width"),fill:"none",opacity:n.getAttribute("opacity")||1}});$.each(l,function(e,t){var r="marker-"+t;n.getAttribute(r)&&a.setAttribute(r,n.getAttribute(r))});var s=new m.BatchCommand;return s.addSubCommand(new m.RemoveElementCommand(n,n.parentNode)),s.addSubCommand(new m.InsertElementCommand(a)),$(n).after(a).remove(),svgCanvas.clearSelection(),a.id=o,svgCanvas.addToSelection([a]),m.addCommandToHistory(s),a}return{name:"Markers",mySetMarker:function(e,r){var n=void 0,i=0;$.each(w,function(e,t){r===i++&&(n=e)}),function(e,t){var r={start_marker:"start",mid_marker:"mid",end_marker:"end"}[e],n="marker-"+r,i=t,o=h[0],a=g(o,n);if(a&&$(a).remove(),o.removeAttribute(n),""==i&&(i="\\nomarker"),"\\nomarker"==i)return s(r,i),m.call("changed",h);u(e=c+r+"_"+o.id,i),svgCanvas.changeSelectedAttribute(n,"url(#"+e+")"),"line"===o.tagName&&"mid"==r&&(o=v(o)),m.call("changed",h),s(r,i)}(e,"\\"+n)},callback:function(){var a=document.getElementById("start_marker"),s=document.getElementById("mid_marker"),d=document.getElementById("end_marker");$.each(w,function(e,t){if(t.label){var r=document.createElement("option");r.value=t.label,r.innerHTML=t.label,r.setAttribute("style","background-color: rgba(33,33,33,1);color: rgba(255,255,255,1);");var n=r.cloneNode(!0),i=r.cloneNode(!0),o=r.cloneNode(!0);a.appendChild(n),s.appendChild(i),d.appendChild(o)}})},selectedChanged:function(e){for(var t=(h=e.elems).length,r=["line","path","polyline"];t--;){var n=h[t];n&&-1!==$.inArray(n.tagName,r)&&e.selectedElement&&!e.multiselected?i(!0):i(!1)}},elementChanged:function(e){var d,a,s,t=e.elems[0];if(t&&(t.getAttribute("marker-start")||t.getAttribute("marker-mid")||t.getAttribute("marker-end"))){s=(a=t).getAttribute("stroke"),$.each(l,function(e,t){var r=g(a,"marker-"+t);if(r&&r.attributes.se_type){var n=r.lastElementChild;if(n){var i=n.getAttribute("fill"),o=n.getAttribute("stroke");i&&"none"!=i&&n.setAttribute("fill",s),o&&"none"!=o&&n.setAttribute("stroke",s)}}}),d=t,$.each(l,function(e,t){var r=c+t+"_"+d.id,n="marker-"+t,i=g(d,n);if(i&&i.attributes.se_type){var o=d.getAttribute(n);if(o){var a=d.id.length,s=o.substr(-a-1,a);d.id!=s&&(u(r,$("#"+t+"_marker").attr("value")),svgCanvas.changeSelectedAttribute(n,"url(#"+r+")"),"line"===d.tagName&&"mid"==t&&(d=v(d)),m.call("changed",h))}}});t&&-1!==$.inArray(t.tagName,["line","path","polyline"])&&i(!0)}}}})},window.extOverview=function(){if(window.svgEditor){var t={};svgEditor.addExtension("overview_window",function(){"use strict";$("#sidepanels").append('\t\t<div id="overview_window_content_pane" style=" width:100%; word-wrap:break-word; display:inline-block; margin-top:20px;">\t\t\t<div id="overview_window_content" style="position:relative; left:12px; top:0px;">\t\t\t\t<div style="background-color:#A0A0A0; display:inline-block; overflow:visible;">\t\t\t\t\t<svg id="overviewMiniView" width="150" height="100" x="0" y="0" viewBox="0 0 4800 3600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\t\t\t\t\t\t<use x="0" y="0" xlink:href="#svgroot"> </use>\t\t\t\t\t </svg>\t\t\t\t\t <div id="overview_window_view_box" style="min-width:50px; min-height:50px; position:absolute; top:30px; left:30px; z-index:5; background-color:rgba(255,0,102,0.3);">\t\t\t\t\t </div>\t\t\t\t </div>\t\t\t</div>\t\t</div>');var o=function(){var e=parseFloat($("#workarea").css("height")),t=parseFloat($("#workarea").css("width")),r=$("#workarea").scrollLeft(),n=$("#workarea").scrollTop(),i=parseFloat($("#svgcanvas").css("width")),o=parseFloat($("#svgcanvas").css("height")),a=$("#overviewMiniView").attr("width"),s=$("#overviewMiniView").attr("height"),d=r/i*a,l=n/o*s,c=t/i*a,g=e/o*s;$("#overview_window_view_box").css("min-width",c+"px"),$("#overview_window_view_box").css("min-height",g+"px"),$("#overview_window_view_box").css("top",l+"px"),$("#overview_window_view_box").css("left",d+"px")};$("#workarea").scroll(function(){t.viewBoxDragging||o()}),$("#workarea").resize(o),o();var e=function(){var e=$("#svgroot").attr("width"),t=$("#svgroot").attr("height"),r=640,n=480;svgedit.browser.isIE()&&(n=r=0);var i=t/e*$("#overviewMiniView").attr("width");$("#overviewMiniView").attr("viewBox",r+" "+n+" "+e+" "+t),$("#overviewMiniView").attr("height",i),o()};e(),t.viewBoxDragging=!1;var l=function(){var e=parseFloat($("#svgcanvas").css("width")),t=parseFloat($("#svgcanvas").css("height")),r=$("#overviewMiniView").attr("width"),n=$("#overviewMiniView").attr("height"),i=parseFloat($("#overview_window_view_box").css("left"))/r*e,o=parseFloat($("#overview_window_view_box").css("top"))/n*t;$("#workarea").scrollLeft(i),$("#workarea").scrollTop(o)};return $("#overview_window_view_box").draggable({containment:"parent",drag:l,start:function(){t.viewBoxDragging=!0},stop:function(){t.viewBoxDragging=!1}}),$("#overviewMiniView").click(function(e){var t=e.offsetX||e.originalEvent.layerX,r=e.offsetY||e.originalEvent.layerY,n=$("#overviewMiniView").attr("width"),i=$("#overviewMiniView").attr("height"),o=parseFloat($("#overview_window_view_box").css("min-width")),a=parseFloat($("#overview_window_view_box").css("min-height")),s=t-.5*o,d=r-.5*a;s<0&&(s=0),d<0&&(d=0),n<s+o&&(s=n-o),i<d+a&&(d=i-a),$("#overview_window_view_box").css("top",d+"px"),$("#overview_window_view_box").css("left",s+"px"),l()}),{name:"overview window",canvasUpdated:e,workareaResized:o}})}},window.extPanning=function(){window.svgEditor&&svgEditor.addExtension("ext-panning",function(){"use strict";return{name:"Extension Panning",buttons:[{id:"ext-panning",type:"mode",title:"Panning",events:{click:function(){svgCanvas.setMode("ext-panning")}}}],mouseDown:function(){if("ext-panning"==svgCanvas.getMode())return svgEditor.setPanning(!0),{started:!0}},mouseUp:function(){if("ext-panning"==svgCanvas.getMode())return svgEditor.setPanning(!1),{keep:!1,element:null}}}})},window.extStorage=function(){window.svgEditor&&svgEditor.addExtension("storage",function(){var d=svgEditor.curConfig.emptyStorageOnDecline,l=svgEditor.curConfig.noStorageOnLoad,c=svgEditor.curConfig.forceStorage,g=svgEditor.storage;function u(n){n=n?"storagePrompt="+n:"";var e=top.location;-1<e.href.indexOf("storagePrompt=")?e.href=e.href.replace(/([&?])storagePrompt=[^&]*(&?)/,function(e,t,r){return(n?t:"")+n+(!n&&r?t:r||"")}):e.href+=(-1<e.href.indexOf("?")?"&":"?")+n}function v(e){if(g){var t="svgedit-"+svgEditor.curConfig.canvasName;e?g.setItem(t,e):g.removeItem(t)}}function f(e){document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"}function p(){window.addEventListener("beforeunload",function(e){if(document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)){var t;document.cookie.match(/(?:^|;\s*)store=prefsAndContent/)&&v(svgCanvas.getSvgString()),svgEditor.setConfig({no_save_warning:!0});var r=svgEditor.curPrefs;for(t in r)if(r.hasOwnProperty(t)){var n=r[t];if(t="web-edit-"+t,!(null!=n))continue;g?g.setItem(t,n):window.widget?widget.setPreferenceForKey(n,t):(n=encodeURIComponent(n),document.cookie=encodeURIComponent(t)+"="+n+"; expires=Fri, 31 Dec 9999 23:59:59 GMT")}}},!1)}var m=!1;return{name:"storage",langReady:function(e){var t=e.uiStrings,r=$.deparam.querystring(!0).storagePrompt;if(!m)if(m=!0,c||!0!==r&&(!1===r||document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)))l&&!c||p();else{var n=[];g?n.unshift({value:"prefsAndContent",text:t.confirmSetStorage.storagePrefsAndContent},{value:"prefsOnly",text:t.confirmSetStorage.storagePrefsOnly},{value:"noPrefsOrContent",text:t.confirmSetStorage.storageNoPrefsOrContent}):n.unshift({value:"prefsOnly",text:t.confirmSetStorage.storagePrefs},{value:"noPrefsOrContent",text:t.confirmSetStorage.storageNoPrefs});var i=$("#dialog_container")[0].style.width,o=$("#dialog_container")[0].style.marginLeft,a=$("#dialog_content")[0].style.height,s=$("#dialog_container")[0].style.height;$("#dialog_content")[0].style.height="120px",$("#dialog_container")[0].style.height="170px",$("#dialog_container")[0].style.width="800px",$("#dialog_container")[0].style.marginLeft="-400px",$.select(t.confirmSetStorage.message,n,function(e,t){if(e&&"noPrefsOrContent"!==e){if(document.cookie="store="+encodeURIComponent(e)+"; expires=Fri, 31 Dec 9999 23:59:59 GMT",!0===r&&t)return void u()}else if(f("store"),e&&d&&function(){var e;for(e in v(""),svgEditor.curPrefs)svgEditor.curPrefs.hasOwnProperty(e)&&(e="web-edit-"+e,g&&g.removeItem(e),f(e))}(),e&&t)return void u("false");$("#dialog_container")[0].style.width=i,$("#dialog_container")[0].style.marginLeft=o,$("#dialog_content")[0].style.height=a,$("#dialog_container")[0].style.height=s,p(),svgEditor.storagePromptClosed=!0},null,null,{label:t.confirmSetStorage.rememberLabel,checked:!1,tooltip:t.confirmSetStorage.rememberTooltip})}}}})},window.extSwitch=function(){svgEditor.addExtension("switch",function(_){"use strict";var c,C,E,A,S=svgEditor.canvas,I=S.getRootElem(),M={},N="switch",g="svg-ext-"+N,u="SWI_",v={};return{callback:function(){$("#switch_panel").hide()},mouseDown:function(e){var t=S.getColor("fill"),r=S.getColor("stroke"),n=S.getStrokeWidth();if(S.getMode()===N){for(var i=E=e.start_x,o=A=e.start_y,a={fill:t,stroke:r,"font-size":S.getFontSize(),stroke:r,"stroke-width":n,"font-family":S.getFontFamily(),"text-anchor":"middle","xml:space":"preserve"},s={elements:[{type:"path",attr:{id:"X-"+S.getNextId().replace("svg_",u),d:"m2.9674 294.65-1.9091-2.9389"}},{type:"path",attr:{id:S.getNextId().replace("svg_",u),d:"m2.9959 290.12v1.0583"}},{type:"circle",attr:{id:S.getNextId().replace("svg_",u),cx:"2.9891",cy:"291.41",r:".2581"}},{type:"path",attr:{id:S.getNextId().replace("svg_",u),d:"m2.9959 295.94v-1.0583"}},{type:"circle",attr:{id:S.getNextId().replace("svg_",u),cx:"2.9891",cy:"-294.66",r:".2581",transform:"scale(1,-1)"}}]},d={type:g,x:i,y:o,style:"pointer-events:none"},l=0;l<s.elements.length;l++)$.extend(s.elements[l].attr,a);return $.extend(d,a),v.x=i,v.y=o,c=S.getNextId().replace("svg_",u),(C=_.addSvgGroupFromJson({group:"g",id:c,type:g,attr:d,elements:s.elements})).setAttribute("transform","translate("+i+","+o+") scale(0.005) translate("+-i+","+-o+")"),_.recalculateDimensions(C),M=C.getBBox(),{started:!0}}},mouseMove:function(e){if(S.getMode()===N){var t=S.getZoom(),r=e.event,n=e.mouse_x/t,i=e.mouse_y/t,o=S.getTransformList(C),a=C.getBBox(),s=a.x,d=a.y,l=a.width,c=a.height,g=n-E,u=i-A,v=(Math.min(E,n),Math.min(A,i),Math.abs(n-E)),f=Math.abs(i-A),p=0,m=0,h=c?(c+u)/c:1,x=l?(l+g)/l:1;x=v/M.width||1,h=f/M.height||1,n<E&&(p=M.width),i<A&&(m=M.height);var w=I.createSVGTransform(),y=I.createSVGTransform(),b=I.createSVGTransform();if(w.setTranslate(-(s+p),-(d+m)),!r.shiftKey){var k=Math.min(Math.abs(x),Math.abs(h));x=k*(x<0?-1:1),h=k*(h<0?-1:1)}y.setScale(x,h),b.setTranslate(s+p,d+m),o.appendItem(b),o.appendItem(y),o.appendItem(w),_.recalculateDimensions(C),M=C.getBBox()}},mouseUp:function(e){if(S.getMode()===N)return{keep:e.event.clientX!=v.x&&e.event.clientY!=v.y,element:C,started:!1}},getClassId:function(){return g},getPrefixId:function(){return u}}})},window.extValue=function(){svgEditor.addExtension("value",function(l){"use strict";var c,g,u=svgEditor.canvas,v="value",f="svg-ext-"+v,p="VAL_",m={};return{callback:function(){$("#value_panel").hide()},mouseDown:function(e){if(u.getMode()===v){var t=u.getColor("fill"),r=u.getColor("stroke");t!==r&&(t=r);for(var n=e.start_x,i=e.start_y,o={fill:t,stroke:r,"font-size":14,stroke:r,"stroke-width":0,"font-family":"sans-serif","text-anchor":"middle","xml:space":"preserve",x:n,y:i},a={elements:[{type:"text",content:"##.##",attr:{id:u.getNextId().replace("svg_",p)}}]},s={type:f,x:n,y:i,style:"pointer-events:none"},d=0;d<a.elements.length;d++)$.extend(a.elements[d].attr,o);return $.extend(s,o),m.x=n,m.y=i,c=u.getNextId().replace("svg_",p),g=l.addSvgGroupFromJson({group:"g",id:c,type:f,attr:s,elements:a.elements}),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(u.getMode()===v)return{keep:e.event.clientX!=m.x&&e.event.clientY!=m.y,element:g,started:!1}},getClassId:function(){return f},setGaugeAttribute:function(e){0===e.elem.id.indexOf(p)&&e.elem.children&&e.elem.children.length&&e.elem.children[0].setAttribute(e.attr,e.value)},getPrefixId:function(){return p}}})},window.extHtmlInput=function(){window.svgEditor&&svgEditor.addExtension("html_input",function(d){"use strict";var l,c,g=svgEditor.canvas,u=80,v=24,f="html_input",p="svg-ext-"+f,m="HXI_",t={};return{callback:function(){$("#html_input_panel").hide()},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m);"font-size:14px;","font-family:sans-serif;";var s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"input",attr:{id:"I-"+a,type:"text",value:"#.##"},style:"width:calc(100% - 7px);height:calc(100% - 7px);text-align:right;border: unset;font-size:14px;font-family:sans-serif;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=d.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(g.getMode()===f)return{keep:e.event.clientX!=t.x&&e.event.clientY!=t.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m},setFontAttribute:function(t){t.elem.getAttribute("type")===p&&d.walkTree(t.elem,function(e){"input"===e.nodeName.toLowerCase()&&(t.attr=t.attr.replace("text-anchor","text-align"),t.value=t.value.replace("end","right").replace("middle","center").replace("start","left"),e.style[t.attr]=t.value)})},getFontAttribute:function(e){if(e.elem.getAttribute("type")===p){var r=!1;return d.walkTree(e.elem,function(e){if("input"===e.nodeName.toLowerCase()){var t=e.style["text-align"];t=t.replace("right","end").replace("center","middle").replace("left","start"),r={fontSize:e.style["font-size"],fontFamily:e.style["font-family"],textAnchor:t}}}),r}}}})},window.extHtmlButton=function(){window.svgEditor&&svgEditor.addExtension("html_button",function(l){"use strict";var c,g,u=svgEditor.canvas,v=80,f=32,p="html_button",m="svg-ext-"+p,h="HXB_",t={};return{callback:function(){$("#html_button_panel").hide()},mouseDown:function(e){if(u.getMode()===p){!0;var t=u.getColor("fill"),r=u.getColor("stroke"),n=e.start_x,i=e.start_y,o=u.getNextId(),a=u.getNextId().replace("svg_",h),s="width:calc(100% - 6px);height:calc(100% - 6px);text-align:center;background-color:"+t+";color:"+r+";";s+="font-size:14px;";var d={elements:[{type:"rect",attr:{x:n,y:i-f,width:v,height:f,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"button",attr:{id:"B-"+a,class:"md-btn md-btn-raised"},style:s+="font-family:sans-serif;"}],attr:{x:n,y:i-f,height:f,width:v,id:"H-"+a}}]};return c=u.getNextId().replace("svg_",h),g=l.addSvgGroupFromJson({group:"g",id:c,type:m,attr:{type:m,style:"pointer-events:none",fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)","xml:space":"preserve"},elements:d.elements}),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(u.getMode()===p)return{keep:e.event.clientX!=t.x&&e.event.clientY!=t.y,element:g,started:!1}},getClassId:function(){return m},getPrefixId:function(){return h},setFontAttribute:function(t){t.elem.getAttribute("type")===m&&l.walkTree(t.elem,function(e){"button"===e.nodeName.toLowerCase()&&(t.attr=t.attr.replace("text-anchor","text-align"),t.value=t.value.replace("end","right").replace("middle","center").replace("start","left"),e.style[t.attr]=t.value)})},getFontAttribute:function(e){if(e.elem.getAttribute("type")===m){var r=!1;return l.walkTree(e.elem,function(e){if("button"===e.nodeName.toLowerCase()){var t=e.style["text-align"];t=t.replace("right","end").replace("center","middle").replace("left","start"),r={fontSize:e.style["font-size"],fontFamily:e.style["font-family"],textAnchor:t}}}),r}}}})},window.extHtmlSelect=function(){window.svgEditor&&svgEditor.addExtension("html_select",function(l){"use strict";var c,g,u=svgEditor.canvas,v=80,f=26,p="html_select",m="svg-ext-"+p,h="HXS_",t={};return{callback:function(){$("#html_select_panel").hide()},mouseDown:function(e){if(u.getMode()===p){!0;var t=u.getColor("fill"),r=u.getColor("stroke"),n=e.start_x,i=e.start_y,o=u.getNextId(),a=u.getNextId().replace("svg_",h),s="width:100%;height:100%;text-align: left;margin-top:unset;background-color:"+t+";color:"+r+";";s+="font-size:14px;";var d={elements:[{type:"rect",attr:{x:n,y:i-f,width:v,height:f,fill:t,stroke:r,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"select",attr:{id:"S-"+a},style:s+="font-family:sans-serif;"}],attr:{x:n,y:i-f,height:f,width:v,id:"H-"+a}}]};return c=l.getNextId().replace("svg_",h),g=l.addSvgGroupFromJson({group:"g",id:c,type:m,attr:{type:m,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"xml:space":"preserve"},elements:d.elements}),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(u.getMode()===p)return{keep:e.event.clientX!=t.x&&e.event.clientY!=t.y,element:g,started:!1}},getClassId:function(){return m},getPrefixId:function(){return h},setFontAttribute:function(t){t.elem.getAttribute("type")===m&&l.walkTree(t.elem,function(e){"select"===e.nodeName.toLowerCase()&&(t.attr=t.attr.replace("text-anchor","text-align"),t.value=t.value.replace("end","right").replace("middle","center").replace("start","left"),e.style[t.attr]=t.value)})},getFontAttribute:function(e){if(e.elem.getAttribute("type")===m){var r=!1;return l.walkTree(e.elem,function(e){if("select"===e.nodeName.toLowerCase()){var t=e.style["text-align"];t=t.replace("right","end").replace("center","middle").replace("left","start"),r={fontSize:e.style["font-size"],fontFamily:e.style["font-family"],textAnchor:t}}}),r}}}})},window.extHtmlSwitch=function(){window.svgEditor&&svgEditor.addExtension("html_switch",function(d){"use strict";var l,c,g=svgEditor.canvas,u=50,v=28,f="html_switch",p="svg-ext-"+f,m="HXT_",t={};return{callback:function(){$("#html_switch_panel").hide()},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m),s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"label",attr:{id:"T-"+a,class:"md-switch"},style:"width:calc(100% - 6px);height:calc(100% - 6px);text-align:center;background-color:"+t+";color:"+r+";margin: 3px 3px 3px 3px;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=g.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)","xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){if("resize"===g.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m))return e.selected.id},mouseUp:function(e){if(g.getMode()===f)return{keep:e.event.clientX!=t.x&&e.event.clientY!=t.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extHtmlChart=function(){window.svgEditor&&svgEditor.addExtension("html_chart",function(d){"use strict";var l,c,g=svgEditor.canvas,u=380,v=240,f="html_chart",p="svg-ext-"+f,m="HXC_",r={};return{callback:function(){$("#html_chart_panel").hide()},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m),s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"div",attr:{id:"D-"+a},style:"width:100%;height:100%;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=d.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"font-size":g.getFontSize(),"font-family":g.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){if("resize"===g.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m))return e.selected.id},mouseUp:function(e){var t=g.getMode();return t!==f?"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m)?e.selected.id:void 0:{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extHtmlGraph=function(){window.svgEditor&&svgEditor.addExtension("html_graph",function(c){"use strict";var g,u,v=svgEditor.canvas,f={width:380,height:240},p={width:240,height:240},m=f,h="html_graph",x="svg-ext-"+h,w="HXC_",r={};return{callback:function(){$("#html_graph_panel").hide()},mouseDown:function(e){var t=v.getMode();if(t.startsWith(h)){-1!==t.indexOf("pie")?(m=p,x+="-pie"):(m=f,x+="-bar"),!0;var r=v.getColor("fill"),n=v.getColor("stroke"),i=e.start_x,o=e.start_y,a=v.getNextId(),s=v.getNextId().replace("svg_",w),d=[{tag:"div",attr:{id:"D-"+s},style:"width:100%;height:100%;"}],l={elements:[{type:"rect",attr:{x:i,y:o-m.height,width:m.width,height:m.height,"stroke-width":0,id:a}},{type:"foreignObject",content:d,attr:{x:i,y:o-m.height,height:m.height,width:m.width,id:"H-"+s}}]};return g=c.getNextId().replace("svg_",w),u=c.addSvgGroupFromJson({group:"g",id:g,type:x,attr:{type:x,style:"pointer-events:none",fill:r,stroke:n,"stroke-width":1,"font-size":v.getFontSize(),"font-family":v.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:l.elements}),{started:!0}}},mouseMove:function(e){if("resize"===v.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(w))return e.selected.id},mouseUp:function(e){var t=v.getMode();return t.startsWith(h)?{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:u,started:!1}:"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(w)?e.selected.id:void 0},getClassId:function(){return x},getPrefixId:function(){return w}}})},window.extHtmlBag=function(){window.svgEditor&&svgEditor.addExtension("html_bag",function(d){"use strict";var l,c,g=svgEditor.canvas,u=200,v=160,f="html_bag",p="svg-ext-"+f,m="BAG_",r={};return{callback:function(){},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m),s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"div",attr:{id:"D-"+a},style:"width:100%;height:100%;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=d.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"font-size":g.getFontSize(),"font-family":g.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){if("resize"===g.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m))return e.selected.id},mouseUp:function(e){var t=g.getMode();return t!==f?"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m)?e.selected.id:void 0:{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extGaugeProgress=function(){window.svgEditor&&svgEditor.addExtension("gauge_progress",function(v){"use strict";var f,p,m=svgEditor.canvas,h=100,x=25,w="gauge_progress",y="svg-ext-"+w,b="GXP_",k={};return{callback:function(){$("#gauge_progress_panel").hide()},mouseDown:function(e){if(m.getMode()===w){var t,r=m.getColor("fill"),n=m.getColor("stroke"),i=m.getStrokeWidth(),o=m.getFontSize(),a=e.start_x,s=e.start_y-h,d={"font-size":o,stroke:n,"stroke-width":i,"font-family":m.getFontFamily(),"xml:space":"preserve"},l=m.getNextId().replace("svg_",b);t=[];for(var c={elements:[{type:"rect",attr:{id:"A-"+m.getNextId().replace("svg_",b),x:a,y:s,width:x,height:h,fill:r}},{type:"rect",attr:{id:"B-"+m.getNextId().replace("svg_",b),x:a,y:s+h/2,width:x,height:h/2,fill:"#1565c0"}},{type:"foreignObject",content:t,attr:{x:a,y:s,height:h,width:x,id:"H-"+l}}]},g={type:y,x:a,y:s,style:"pointer-events:none"},u=0;u<c.elements.length;u++)$.extend(c.elements[u].attr,d);return $.extend(g,d),k.x=a,k.y=s,f=m.getNextId().replace("svg_",b),p=v.addSvgGroupFromJson({group:"g",id:f,type:y,attr:g,elements:c.elements}),{started:!0}}},mouseMove:function(e){m.getMode()},mouseUp:function(e){if(m.getMode()===w)return{keep:e.event.clientX!=k.x&&e.event.clientY!=k.y,element:p,started:!1}},getClassId:function(){return y},getPrefixId:function(){return b}}})},window.extGaugeSemaphore=function(){svgEditor.addExtension("gauge_semaphore",function(c){"use strict";var g,u,v=svgEditor.canvas,f="gauge_semaphore",p="svg-ext-"+f,m="GSE_",h={};return{callback:function(){$("#gauge_semaphore_panel").hide()},mouseDown:function(e){if(v.getMode()===f){for(var t=v.getColor("fill"),r=v.getColor("stroke"),n=v.getStrokeWidth(),i=e.start_x,o=e.start_y-30,a={fill:t,"font-size":v.getFontSize(),stroke:r,"stroke-width":n,"font-family":v.getFontFamily(),"xml:space":"preserve"},s={elements:[{type:"ellipse",attr:{id:v.getNextId().replace("svg_",m),cx:"15",cy:"15",rx:"14",ry:"14","stroke-width":"none"}}]},d={type:p,x:i,y:o,style:"pointer-events:none"},l=0;l<s.elements.length;l++)$.extend(s.elements[l].attr,a);return $.extend(d,a),h.x=i,h.y=o,g=v.getNextId().replace("svg_",m),(u=c.addSvgGroupFromJson({group:"g",id:g,type:p,attr:d,elements:s.elements})).setAttribute("transform","translate("+i+","+o+")"),c.recalculateDimensions(u),u.getBBox(),{started:!0}}},mouseMove:function(e){},mouseUp:function(e){if(v.getMode()===f)return{keep:e.event.clientX!=h.x&&e.event.clientY!=h.y,element:u,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extShapes=function(){window.svgEditor&&svgEditor.addExtension("shapes",function(){"use strict";var _,p,C,E,A,m=svgEditor.shapesList,S=svgEditor.canvas,h="SHE_",I={},x="svg-ext-",w={};return{callback:function(){},mouseDown:function(e){var t=S.getMode();if(x="svg-ext-"+t,p=t,void 0!==(_=m.find(function(e){return e.name===p}))){var r=S.getColor("fill"),n=S.getColor("stroke"),i=S.getFontSize(),o=S.getFontFamily(),a=S.getStrokeWidth();S.getStyle();r===n&&(r="#FFFFFF",n="#000000");for(var s=E=e.start_x,d=A=e.start_y,l={fill:r,stroke:n,"stroke-width":a,"font-size":i,"font-family":o,"text-anchor":"middle","xml:space":"preserve"},c={elements:[]},g=0;g<_.content.length;g++){var u=_.content[g],v={id:u.id+S.getNextId().replace("svg_",h),"stroke-width":a};$.extend(v,u.attr),c.elements.push({type:u.type,content:u.content,attr:v})}var f={type:x,x:s,y:d,style:"pointer-events:none"};return $.extend(f,l),w.x=s,w.y=d,p=S.getNextId().replace("svg_",h),(C=S.addSvgGroupFromJson({group:"g",id:p,type:x,attr:f,elements:c.elements})).setAttribute("transform","translate("+s+","+d+")"),S.recalculateDimensions(C),I=C.getBBox(),{started:!0}}},mouseMove:function(e){if(void 0!==_){var t=S.getZoom(),r=e.event,n=e.mouse_x/t,i=e.mouse_y/t;svgEditor.curConfig.gridSnapping&&(n=svgedit.utilities.snapToGrid(n),i=svgedit.utilities.snapToGrid(i));var o=S.getTransformList(C),a=C.getBBox(),s=a.x,d=a.y,l=a.width,c=a.height,g=n-E,u=i-A,v=(Math.min(E,n),Math.min(A,i),Math.abs(n-E)),f=Math.abs(i-A),p=0,m=0,h=c?(c+u)/c:1,x=l?(l+g)/l:1;x=v/I.width||1,h=f/I.height||1,n<E&&(p=I.width),i<A&&(m=I.height);var w=svgroot.createSVGTransform(),y=svgroot.createSVGTransform(),b=svgroot.createSVGTransform();if(w.setTranslate(-(s+p),-(d+m)),!r.shiftKey){var k=Math.min(Math.abs(x),Math.abs(h));x=k*(x<0?-1:1),h=k*(h<0?-1:1)}y.setScale(x,h),b.setTranslate(s+p,d+m),o.appendItem(b),o.appendItem(y),o.appendItem(w),S.recalculateDimensions(C),I=C.getBBox()}},mouseUp:function(e){if(void 0!==_)return{keep:e.event.clientX!=w.x&&e.event.clientY!=w.y,element:C,started:!1}},getClassId:function(){return x},getPrefixId:function(){return h}}})},window.extLinear=function(){window.svgEditor&&svgEditor.addExtension("help-linear",function(){"use strict";var e="rgba(255, 0, 0, 0.5)",o=svgEditor.canvas,a=["line","path","pipe"],s=!1,t=svgedit.NS,d=o.assignAttributes,r=document.getElementById("svgcanvas").ownerDocument,l=document.getElementById("canvasBackground"),c=r.createElementNS(t.SVG,"line");d(c,{x1:0,y1:0,x2:0,y2:0,"stroke-width":1,stroke:e});var g=r.createElementNS(t.SVG,"line");function n(){s=!1,d(c,{x1:0,y1:0,x2:0,y2:0}),d(g,{x1:0,y1:0,x2:0,y2:0})}return d(g,{x1:0,y1:0,x2:0,y2:0,"stroke-width":1,stroke:e}),l.append(c),l.append(g),{callback:function(){},mouseDown:function(e){var t=o.getMode();-1!==a.indexOf(t)?s=!0:n()},mouseMove:function(e){if(s){var t=o.getMode();-1!==a.indexOf(t)&&(r=e.mouse_x,n=e.mouse_y,i=l.getBBox(),d(c,{x1:r,y1:0,x2:r,y2:i.height}),d(g,{x1:0,y1:n,x2:i.width,y2:n}))}var r,n,i},mouseUp:function(e){if(s&&"line"!=o.getMode())return;n()}}})},window.extPipe=function(){window.svgEditor&&svgEditor.addExtension("pipe",function(e){"use strict";var g,u=svgEditor.canvas,v="svg-ext-pipe",f="PIE_";return{name:"pipe",initPipe:function(e){if(!e||!e[0])return!1;var t=document.getElementById(e[0].id);if(!t)return!1;var r=e[0].property;if("path"==t.nodeName){var n=t.getBBox(),i=t.getAttribute("d"),o=r.contentSpace+" "+r.contentSpace;t.remove();var a=[{type:"path",attr:{id:"b"+u.getNextId().replace("svg_",f),d:i,"stroke-width":r.borderWidth,stroke:r.border,fill:"none"}},{type:"path",attr:{id:"p"+u.getNextId().replace("svg_",f),d:i,"stroke-width":r.pipeWidth,stroke:r.pipe,fill:"none"}},{type:"path",attr:{id:"c"+u.getNextId().replace("svg_",f),d:i,"stroke-width":r.contentWidth,stroke:r.content,fill:"none","stroke-dasharray":o}}],s=u.getNextId().replace("svg_",f),d={type:v,x:n.x,y:n.y,style:"pointer-events:none"};return $.extend(d,{"xml:space":"preserve"}),{keep:!0,element:g=u.addSvgGroupFromJson({group:"g",id:s,type:v,attr:d,elements:a}),started:!1}}for(var l=0;l<t.childNodes.length;l++){var c=t.childNodes[l];if(0<=c.id.indexOf("b"+f))c.setAttribute("stroke-width",r.borderWidth),c.setAttribute("stroke",r.border);else if(0<=c.id.indexOf("p"+f))c.setAttribute("stroke-width",r.pipeWidth),c.setAttribute("stroke",r.pipe);else if(0<=c.id.indexOf("c"+f)){c.setAttribute("stroke-width",r.contentWidth),c.setAttribute("stroke",r.content);o=r.contentSpace+" "+r.contentSpace;c.setAttribute("stroke-dasharray",o)}}return{keep:!0,element:t,started:!1}},toResize:function(){return g},getClassId:function(){return v},getPrefixId:function(){return f}}})},window.extHtmlSlider=function(){window.svgEditor&&svgEditor.addExtension("html_slider",function(d){"use strict";var l,c,g=svgEditor.canvas,u=200,v=200,f="html_slider",p="svg-ext-"+f,m="SLI_",r={};return{callback:function(){},mouseDown:function(e){if(g.getMode()===f){!0;var t=g.getColor("fill"),r=g.getColor("stroke"),n=e.start_x,i=e.start_y,o=g.getNextId(),a=g.getNextId().replace("svg_",m),s={elements:[{type:"rect",attr:{x:n,y:i-v,width:u,height:v,"stroke-width":0,id:o}},{type:"foreignObject",content:[{tag:"div",attr:{id:"D-"+a},style:"width:100%;height:100%;"}],attr:{x:n,y:i-v,height:v,width:u,id:"H-"+a}}]};return l=d.getNextId().replace("svg_",m),c=d.addSvgGroupFromJson({group:"g",id:l,type:p,attr:{type:p,style:"pointer-events:none",fill:t,stroke:r,"stroke-width":1,"font-size":g.getFontSize(),"font-family":g.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:s.elements}),{started:!0}}},mouseMove:function(e){if("resize"===g.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m))return e.selected.id},mouseUp:function(e){var t=g.getMode();return t!==f?"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(m)?e.selected.id:void 0:{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:c,started:!1}},getClassId:function(){return p},getPrefixId:function(){return m}}})},window.extOwnCtrl=function(){window.svgEditor&&svgEditor.addExtension("own_ctrl",function(c){"use strict";var g,u,v=svgEditor.canvas,f=220,p=140,m="own_ctrl",h="svg-ext-"+m,x=h,w="OXC_",r={};return{callback:function(){$("#own_ctrl_panel").hide()},mouseDown:function(e){var t=v.getMode();if(t.startsWith(m)){var r=t.replace(m,"");x=h+r,!0;var n=v.getColor("fill"),i=v.getColor("stroke"),o=e.start_x,a=e.start_y,s=v.getNextId(),d=v.getNextId().replace("svg_",w),l={elements:[{type:"rect",attr:{x:o,y:a-p,width:f,height:p,"stroke-width":0,id:s}},{type:"foreignObject",content:[{tag:"div",attr:{id:"D-"+d},style:"width:100%;height:100%;"}],attr:{x:o,y:a-p,height:p,width:f,id:"H-"+d}}]};return g=c.getNextId().replace("svg_",w),u=c.addSvgGroupFromJson({group:"g",id:g,type:x,attr:{type:x,style:"pointer-events:none",fill:n,stroke:i,"stroke-width":1,"font-size":v.getFontSize(),"font-family":v.getFontFamily(),"text-anchor":"right","xml:space":"preserve"},elements:l.elements}),{started:!0}}},mouseMove:function(e){if("resize"===v.getMode()&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(w))return e.selected.id},mouseUp:function(e){var t=v.getMode();return t.startsWith(m)?{keep:e.event.clientX!=r.x&&e.event.clientY!=r.y,element:u,started:!1}:"select"===t&&e&&e.selected&&e.selected.id&&e.selected.id.startsWith(w)?e.selected.id:void 0},getClassId:function(){return x},getPrefixId:function(){return w}}})};