!function(){"use strict";var a=AutodeskNamespace("Autodesk.Viewing.Extensions.Markups.Core.Utils");a.getTypeString=function(a){var b=Autodesk.Viewing.Extensions.Markups.Core;switch(a){case b.MARKUP_TYPE_TEXT:return b.MARKUP_EXPORT_TYPE_LABEL;case b.MARKUP_TYPE_ARROW:return b.MARKUP_EXPORT_TYPE_ARROW;case b.MARKUP_TYPE_RECTANGLE:return b.MARKUP_EXPORT_TYPE_RECTANGLE;case b.MARKUP_TYPE_CIRCLE:return b.MARKUP_EXPORT_TYPE_CIRCLE;case b.MARKUP_TYPE_CLOUD:return b.MARKUP_EXPORT_TYPE_CLOUD;case b.MARKUP_TYPE_FREEHAND:return b.MARKUP_EXPORT_TYPE_FREEHAND}return"Unknown("+id+")"},a.isTouchDevice=function(){return"function"==typeof isTouchDevice&&"function"==typeof Hammer?isTouchDevice():!1},a.createSvgElement=function(a){var b="http://www.w3.org/2000/svg",c=document.createElementNS(b,a);return c.setAttribute("pointer-events","inherit"),c},a.setSvgParentAttributes=function(a){return a.setAttribute("version","1.1"),a.setAttribute("baseProfile","full"),a},a.addSvgMetadata=function(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg","metadata"),d=document.createElement("markup_document");return c.appendChild(d),d.setAttribute("data-model-version",b["data-model-version"]),a.insertBefore(c,a.firstChild),c},a.addMarkupMetadata=function(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg","metadata"),d=document.createElement("markup_element");c.appendChild(d);for(var e in b)b.hasOwnProperty(e)&&d.setAttribute(e,b[e]);return a.insertBefore(c,a.firstChild),c},a.removeAllMetadata=function(a){for(var b=a.getElementsByTagName("metadata"),c=0;c<b.length;++c){var d=b[c];d.parentNode&&d.parentNode.removeChild(d)}var e=a.children||a.childNodes;for(c=0;c<e.length;++c)this.removeAllMetadata(e[c])},a.transferChildNodes=function(a,b){for(var c=a.children||a.childNodes,d=[],e=0;e<c.length;++e)d.push(c[e]);d.forEach(function(a){b.appendChild(a)})},a.svgNodeToString=function(a){var b;try{var c=new XMLSerializer;b=c.serializeToString(a)}catch(d){b="",console.warn("svgNodeToString failed to generate string representation of domNode.")}return b},a.stringToSvgNode=function(a){var b=null;try{var c=new DOMParser,d=c.parseFromString(a,"text/xml");b=d.firstChild}catch(e){b=null,console.warn("stringToSvgNode failed to generate an HTMLElement from its string representation.")}return b},a.addTraitEventDispatcher=function(a){a.listeners={},a.addEventListener=function(a,b){"undefined"==typeof this.listeners[a]&&(this.listeners[a]=[]),this.listeners[a].push(b)},a.hasEventListener=function(a,b){if(void 0===this.listeners)return!1;var c=this.listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},a.removeEventListener=function(a,b){if(this.listeners[a]instanceof Array)for(var c=this.listeners[a],d=0,e=c.length;e>d;d++)if(c[d]===b){c.splice(d,1);break}},a.fireEvent=function(a){if("string"==typeof a&&(a={type:a}),a.target||(a.target=this),!a.type)throw new Error("event type unknown.");if(this.listeners[a.type]instanceof Array)for(var b=this.listeners[a.type].slice(),c=0;c<b.length;c++)b[c].call(this,a)}},a.removeTraitEventDispatcher=function(a){try{delete a.listeners,delete a.addEventListener,delete a.hasEventListener,delete a.removeEventListener,delete a.fireEvent}catch(b){}},a.worldToClient=function(b,c,d){var e=a.worldToViewport(b,c),f=c.impl.viewportToClient(e.x,e.y);return f.z=0,d&&(f.x=Math.floor(f.x)+.5,f.y=Math.floor(f.y)+.5),f},a.clientToWorld=function(a,b,c,d){var e=d.impl.clientToViewport(a,b);return e.z=c,e.unproject(d.impl.camera),e},a.worldToViewport=function(a,b){var c=new THREE.Vector3;return c.x=a.x,c.y=a.y,c.z=a.z,c.project(b.impl.camera),c},a.metersToModel=function(a,b){var c=b.model.getUnitScale(),d=1/c;return d*a},a.radiansToDegrees=function(a){return a*(180/Math.PI)},a.degreesToRadians=function(a){return a*(Math.PI/180)},a.sign=function(a){return a>=0?1:-1},a.forceOrthographicCamera=function(a){if(a&&a.navigation&&!a.model.is2d()){var b=a.navigation,c=b.getCamera();c.isPerspective&&b.toOrthographic()}},a.hideLmvUi=function(b){b.setActiveNavigationTool(),a.dismissLmvHudMessage(),a.hideLmvPanels(!0,b),a.hideLmvToolsAndPanels(b)},a.restoreLmvUi=function(b){a.dismissLmvHudMessage(),a.hideLmvPanels(!1,b),a.showLmvToolsAndPanels(b)},a.hideLmvPanels=function(a,b){var c=b.dockingPanels;if(c)for(var d=0;d<c.length;++d){var e=c[d],f=e.container;f.classList.contains("dockingPanelVisible")&&(f.style.display=a?"none":"block",e.visibilityChanged())}},a.showLmvToolsAndPanels=function(a){a.model.is2d()||a.displayViewCube(!0,!1);var b=document.getElementsByClassName("homeViewWrapper"),c=document.getElementsByClassName("infoButton"),d=document.getElementsByClassName("toolbar-animationSubtoolbar");if(b.length>0&&(b[0].style.display=""),c.length>0&&(c[0].style.display=""),d.length>0&&(d[0].style.display=""),a.toolbar)for(var e=a.toolbar.container,f=e.children.length,g=0;f>g;++g)e.children[g].style.display=""},a.hideLmvToolsAndPanels=function(a){a&&a.model&&!a.model.is2d()&&a.displayViewCube(!1,!1);var b=document.getElementsByClassName("homeViewWrapper"),c=document.getElementsByClassName("infoButton"),d=document.getElementsByClassName("toolbar-animationSubtoolbar");if(b.length>0&&(b[0].style.display="none"),c.length>0&&(c[0].style.display="none"),d.length>0){d[0].style.display="none";var e=a.impl.keyFrameAnimator;if(e&&!e.isPaused){e.pauseCameraAnimations(),e.pause();var f=a.modelTools.getControl("toolbar-animationPlay");f&&(f.setIcon("toolbar-animationPauseIcon"),f.setToolTip("Pause"))}}if(a.toolbar)for(var g=a.toolbar.container,h=g.children.length,i=0;h>i;++i)g.children[i].style.display="none"},a.dismissLmvHudMessage=function(){try{for(var a=!0;a;)a=Autodesk.Viewing.Private.HudMessage.dismiss()}catch(b){console.warn("[CO2]Failed to dismiss LMV HudMessage")}},a.createStyle=function(b,c){for(var d={},e=0;e<b.length;++e)d[b[e]]=null;for(var f=a.getStyleDefaultValues(d,c),e=0;e<b.length;++e){var g=b[e];d[g]=f[g].values[f[g]["default"]].value}return d},a.copyStyle=function(a,b){for(var c in b)a.hasOwnProperty(c)&&(b[c]=a[c])},a.cloneStyle=function(a){var b={};for(var c in a)b[c]=a[c];return b},a.getStyleDefaultValues=function(b,c){function d(b){var c=0,d=b.model.getData();if(d.is2d)c=2*a.metersToModel(.0254,b);else{var e=b.impl.viewportToClient(0,0),f=b.impl.viewportToClient(.01,.01);e=a.clientToWorld(e.x,e.y,0,b),f=a.clientToWorld(f.x,f.y,0,b),c=Math.abs(f.y-e.y)}return c}function e(a){return{values:[{name:"Thin",value:a},{name:"Normal",value:3*a},{name:"Thick",value:9*a}],"default":1}}function f(a){return{values:[{name:"Thin",value:5*a},{name:"Normal",value:10*a},{name:"Thick",value:20*a}],"default":1}}function g(){return{values:[{name:"red",value:"#ff0000"},{name:"green",value:"#00ff00"},{name:"blue",value:"#0000ff"},{name:"white",value:"#ffffff"},{name:"black",value:"#000000"}],"default":0}}function h(a){return{values:[{name:"100%",value:1},{name:"75%",value:.75},{name:"50%",value:.5},{name:"25%",value:.25},{name:"0%",value:0}],"default":a?4:0}}function i(){return{values:[{name:"Arial",value:"Arial"},{name:"Arial Black",value:"Arial Black"},{name:"Arial Narrow",value:"Arial Narrow"},{name:"Century Gothic",value:"Century Gothic"},{name:"Courier New",value:"Courier New"},{name:"Georgia",value:"Georgia"},{name:"Impact",value:"Impact"},{name:"Lucida Console",value:"Lucida Console"},{name:"Tahoma",value:"Tahoma"},{name:"Verdana",value:"Verdana"}],"default":0}}function j(){return{values:[{name:"Normal",value:!1},{name:"Italic",value:!0}],"default":0}}function k(){return{values:[{name:"Normal",value:!1},{name:"Bold",value:!0}],"default":0}}var l=a.cloneStyle(b),m=d(c);for(var n in l)switch(n){case"stroke-width":l[n]=e(m);break;case"font-size":l[n]=f(m);break;case"font-family":l[n]=i();break;case"font-style":l[n]=j();break;case"font-weight":l[n]=k();break;case"stroke-color":case"fill-color":l[n]=g();break;case"stroke-opacity":var o=!1;l[n]=h(o);break;case"fill-opacity":var o=!0;l[n]=h(o)}return l},a.composeRGBAString=function(a,b){if(0>=b)return"none";var c=["rgba("+parseInt("0x"+a.substr(1,2)),",",parseInt("0x"+a.substr(3,2)),",",parseInt("0x"+a.substr(5,2)),",",b,")"].join("");return c}}(),function(){"use strict";function a(a,b,c){this.type=b,this.editor=a,this.targetId=c,this.addToHistory=!0,this.selectOnExecution=!0}AutodeskNamespace("Autodesk.Viewing.Extensions.Markups.Core"),Autodesk.Viewing.Extensions.Markups.Core.EditAction=a,Autodesk.Viewing.Extensions.Markups.Core.EditAction.prototype.execute=function(){this.editor.actionManager.execute(this)},Autodesk.Viewing.Extensions.Markups.Core.EditAction.prototype.redo=function(){},Autodesk.Viewing.Extensions.Markups.Core.EditAction.prototype.undo=function(){},Autodesk.Viewing.Extensions.Markups.Core.EditAction.prototype.merge=function(a){return!1},Autodesk.Viewing.Extensions.Markups.Core.EditAction.prototype.isIdentity=function(){return!1}}(),function(){"use strict";function a(a){this.historySize=a,this.undoStack=new Array(a),this.redoStack=new Array(a),c.addTraitEventDispatcher(this)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;b.EVENT_HISTORY_CHANGED="EVENT_HISTORY_CHANGED";var d=a.prototype;d.execute=function(a){var c=this.redoStack,d=this.undoStack;c.splice(0,c.length),a.redo();var e=this.getEditActionGroup();e.isOpen()?e.addAction(a):(e.open(),e.addAction(a),e.close()),d.length>this.historySize&&d.splice(0,1);var f=a.selectOnExecution?a.targetId:-1;this.fireEvent({type:b.EVENT_HISTORY_CHANGED,data:{action:"execute",targetId:f}})},d.beginActionGroup=function(){var a=this.undoStack,b=a.length,c=null;0===b||a[b-1].isClosed()?(c=this.getEditActionGroup(),c.open()):console.warn("Markups - Undo/Redo - Action edit group already open.")},d.closeActionGroup=function(){var a=this.undoStack,b=a.length;if(0===b)return void console.warn("Markups - Undo/Redo - There is no action edit group to close.");var c=a[b-1];c.close()||console.warn("Markups - Undo/Redo - Action edit group already closed."),c.isEmpty()&&a.pop()},d.cancelActionGroup=function(){var a=this.undoStack,c=a.length;if(0===c)return void console.warn("Markups - Undo/Redo - There is no action edit group to close.");var d=a[c-1];return d.close()?(d.undo(),a.pop(),void this.fireEvent({type:b.EVENT_HISTORY_CHANGED,data:{action:"cancel",targetId:-1}})):void console.warn("Markups - Undo/Redo - Action edit group already closed.")},d.undo=function(){var a=this.undoStack,c=this.redoStack;if(0!==a.length){var d=a.pop(),e=d.undo();c.push(d),this.fireEvent({type:b.EVENT_HISTORY_CHANGED,data:{action:"undo",targetId:e}})}},d.redo=function(){var a=this.undoStack,c=this.redoStack;if(0!==c.length){var d=c.pop(),e=d.redo();a.push(d),this.fireEvent({type:b.EVENT_HISTORY_CHANGED,data:{action:"redo",targetId:e}})}},d.clear=function(){this.undoStack.splice(0,this.undoStack.length),this.redoStack.splice(0,this.redoStack.length),this.fireEvent({type:b.EVENT_HISTORY_CHANGED,data:{action:"clear",targetId:-1}})},d.isUndoStackEmpty=function(){return 0===this.undoStack.length},d.isRedoStackEmpty=function(){return 0===this.redoStack.length},d.getEditActionGroup=function(){var a=this.undoStack,c=this.undoStack.length,d=null;return 0===c||a[c-1].isClosed()?(d=new b.EditActionGroup,a.push(d)):d=a[c-1],d},b.EditActionManager=a}(),function(){"use strict";function a(){this.reset()}function b(a){var b=[];for(var c in a){var d=a[c];b.push(c),b.push(":"),b.push(d),b.push("; ")}return b.join("")}var c=Autodesk.Viewing.Extensions.Markups.Core.Utils,d=["-ms-","-webkit-","-moz-","-o-"],e=a.prototype;e.reset=function(){return this.attributes={},this.dirty=!1,this.styleString="",this},e.setAttribute=function(a,b,c){if(this.attributes[a]=b,c&&c.allBrowsers){var e=this;d.forEach(function(c){e.attributes[c+a]=b})}return this.dirty=!0,this},e.removeAttribute=function(a){Array.isArray(a)||(a=[a]);var b=this;return a.forEach(function(a){a in b.attributes&&(delete b.attributes[a],b.dirty=!0)}),this},e.getStyleString=function(){return this.dirty&&(this.styleString=b(this.attributes),this.dirty=!1),this.styleString},e.clone=function(){var a=new c.DomElementStyle,b=this.attributes;for(var d in b)a.setAttribute(d,b[d]);return a},c.DomElementStyle=a}(),function(){"use strict";function a(a,b){this.containingDiv=a,this.editor=b,this.selectionLayer=c(),this.selection={x:0,y:0,width:0,height:0,rotation:0,element:null,active:!1,dragging:!1,resizing:!1,handle:{}},j.bind(this)(),w.isTouchDevice()?(this.onHammerDragBinded=this.onHammerDrag.bind(this),this.hammer=new Hammer.Manager(this.selectionLayer,{recognizers:[[Hammer.Pan,{event:"drag",pointers:1}]],inputClass:Hammer.TouchInput})):(o.bind(this)(),p.bind(this)(),r.bind(this)(),q.bind(this)()),this.containingDiv.appendChild(this.selectionLayer),w.addTraitEventDispatcher(this)}function b(a){a.pageX=a.pointers[0].clientX,a.pageY=a.pointers[0].clientY}function c(){var a=document.createElement("div");return a.style.position="absolute",a.style.top=0,a.style.bottom=0,a.style.left=0,a.style.right=0,a.style.overflow="hidden",a.style.visibility="hidden",s(a,!1),a}function d(a,b){var c=2,d=document.createElement("div");d.style.position="absolute",d.style.backgroundColor="rgba(151, 151, 151, 1)",d.style.border=c+"px solid rgb(95, 98, 100)",d.style.height=a+"px",d.style.width=a+"px",d.style.borderRadius=a/2+c+"px",d.style.boxSizing="border-box",f(d,b),d.className="selector-drag-point sdp-handle-"+b,d.setAttribute("data-sdp-handle",b);var e=-1*((a+c)/2);switch(b){case"n":var g=document.createElement("div");g.style.position="absolute",g.style.width="100%",g.style.height=a+"px",g.style.top=e+"px",d.style.margin="0 auto",d.style.position="",g.appendChild(d),d=g;break;case"s":var g=document.createElement("div");g.style.position="absolute",g.style.width="100%",g.style.height=a+"px",g.style.bottom=e+"px",d.style.margin="0 auto",d.style.position="",g.appendChild(d),d=g;break;case"w":d.style.left=e+"px",d.style.top="50%",d.style.transform="translate3d(0, -50%, 0)";break;case"e":d.style.right=e+"px",d.style.top="50%",d.style.transform="translate3d(0, -50%, 0)";break;case"nw":d.style.top=e+"px",d.style.left=e+"px";break;case"ne":d.style.top=e+"px",d.style.right=e+"px";break;case"sw":d.style.bottom=e+"px",d.style.left=e+"px";break;case"se":d.style.bottom=e+"px",d.style.right=e+"px"}return d}function e(a){var b=2,c=document.createElement("div");return c.style.position="absolute",c.style.backgroundColor="aqua",c.style.border=b+"px solid rgb(95, 98, 100)",c.style.height=a+"px",c.style.width=a+"px",c.style.borderRadius=a/2+b+"px",c.style.boxSizing="border-box",c.classList.add("selector-rotate-point"),c.style.left="50%",c.style.transform="translate3d(-50%, 0px, 0px)",c.style.top="-25px",c}function f(a,b){var c;switch(b){case"n":case"s":c="ns-resize";break;case"w":case"e":c="ew-resize";break;case"ne":case"sw":c="nesw-resize";break;case"nw":case"se":c="nwse-resize"}a.style.cursor=c}function g(a){var b=12;["n","s","w","e","nw","ne","sw","se"].forEach(function(c){this.selection.handle[c]=d(b,c),a.appendChild(this.selection.handle[c])}.bind(this))}function h(a){return u(a,".selector-drag-point")}function i(a){return u(a,".selector-rotate-point")}function j(){var a=1,b="rgb(0, 0, 255)",c=document.createElement("div");return c.style.position="absolute",c.style.border=a+"px solid "+b,c.style.zIndex=1,c.style.cursor="move",c.style.boxSizing="border-box",s(c,!0),c.classList.add("selector-box"),g.bind(this)(c),this.selection.rotationHandle=e(12),c.appendChild(this.selection.rotationHandle),this.selection.element=c,this.selectionLayer.appendChild(this.selection.element),l.bind(this)(!1),c}function k(a,b){return"translate3d("+a+"px,"+b+"px,0)"}function l(a){this.selection.active=a,this.selection.element.style.display=a?"block":"none"}function m(a,b,c){this.selection.x=a,this.selection.y=b,this.selection.rotation=c;var d=this.markup.getClientSize();this.selection.element.style.msTransform=k(a,b)+" rotate("+c+"rad)",this.selection.element.style.msTransformOrigin=d.x/2+"px "+d.y/2+"px",this.selection.element.style.webkitTransform=k(a,b)+" rotate("+c+"rad)",this.selection.element.style.webkitTransformOrigin=d.x/2+"px "+d.y/2+"px",this.selection.element.style.transform=k(a,b)+" rotate("+c+"rad)",this.selection.element.style.transformOrigin=d.x/2+"px "+d.y/2+"px"}function n(a,b){this.selection.width=a,this.selection.height=b,this.selection.element.style.width=a+"px",this.selection.element.style.height=b+"px"}function o(){this.selection.element.addEventListener("mousedown",this._onRepositionMouseDown.bind(this))}function p(){this.selectionLayer.addEventListener("mousedown",this._onResizeMouseDown.bind(this))}function q(){this.selection.element.addEventListener("mousedown",this._onRotationMouseDown.bind(this))}function r(){var a=function(a){this.selection.dragging=!1;var b=this.editor.editMode;b&&b.onDoubleClick(this.markup)}.bind(this),b=this.selectionLayer;b.addEventListener("dblclick",a)}function s(a,b){a.style.pointerEvents=b?"auto":"none"}function t(a,b){return Math.atan2(b.y-a.y,b.x-a.x)}function u(a,b){return a.matches?a.matches(b):a.msMatchesSelector?a.msMatchesSelector(b):a.mozMatchesSelector?a.mozMatchesSelector(b):a.webkitMatchesSelector?a.webkitMatchesSelector(b):!1}var v=Autodesk.Viewing.Extensions.Markups.Core,w=Autodesk.Viewing.Extensions.Markups.Core.Utils;v.EVENT_EDITFRAME_EDITION_START="EVENT_EDITFRAME_EDITION_START",v.EVENT_EDITFRAME_EDITION_END="EVENT_EDITFRAME_EDITION_END";var x=a.prototype;x.setSelection=function(a,b,c,d,e){n.bind(this)(c,d),m.bind(this)(a,b,e),l.bind(this)(!0),this.selectionLayer.style.visibility="visible"},x.setMarkup=function(a){if(!a)return void(this.markup&&(this.markup=null,this.hammer&&this.hammer.off("dragstart dragmove dragend",this.onHammerDragBinded),l.bind(this)(!1)));!this.markup&&this.hammer&&this.hammer.on("dragstart dragmove dragend",this.onHammerDragBinded);var b=a.getClientSize(),c=a.getClientPosition(),d=b.x,e=b.y,f=a.getRotation();this.markup=a,this.setSelection(c.x-d/2,c.y-e/2,d,e,f),this.enableResizeHandles(),this.enableRotationHandle()},x.startDrag=function(){this._onRepositionMouseDown(null,this.editor.getMousePosition())},x.isActive=function(){return this.isDragging()||this.isResizing()||this.isRotating()},x.isDragging=function(){return this.selection.dragging},x.isResizing=function(){return this.selection.resizing},x.isRotating=function(){return this.selection.rotating},x.onMouseMove=function(a){},x.onMouseUp=function(a){},x.onHammerDrag=function(a){function c(a,b,c){var d=b.getBoundingClientRect();a.mousePosition.x=c.pageX-d.left,a.mousePosition.y=c.pageY-d.top}switch(b(a),a.type){case"dragstart":c(this.editor.input,this.editor.svg,a),i(a.target)?this._onRotationMouseDown(a):h(a.target)?this._onResizeMouseDown(a):this.startDrag();break;case"dragmove":c(this.editor.input,this.editor.svg,a),this.onMouseMove(a);break;case"dragend":c(this.editor.input,this.editor.svg,a),this.onMouseUp(a)}},x.enableResizeHandles=function(){var a,b=this.markup;if(b.isHeightConstrained()||b.isWidthConstrained()){for(var c in this.selection.handle)a=this.selection.handle[c],a&&(a.style.display="none");b.isHeightConstrained()&&(this.selection.handle.w.style.display="block",this.selection.handle.e.style.display="block"),b.isWidthConstrained()&&(this.selection.handle.n.style.display="block",this.selection.handle.s.style.display="block")}else for(var c in this.selection.handle)a=this.selection.handle[c],a&&(a.style.display="block")},x.enableRotationHandle=function(){var a=this.markup,b=this.selection.rotationHandle,c=a.isRotationConstrained()?"none":"block";b.style.display=c},x._onRepositionMouseDown=function(a,b){var c=!(a instanceof MouseEvent);if(c||!h(a.target)&&!i(a.target)){if(this.editor.beginActionGroup(),this.selection.dragging=!0,b=c?b:this.editor.getMousePosition(),this.initialCursor=b,this.initialPosition=this.markup.getClientPosition(),this.areAxisConstrained=!1,this.axisConstrains=new THREE.Vector2(1,1),this.onMouseMove=this._onRepositionMouseMove.bind(this),this.onMouseUp=this._onRepositionMouseUp.bind(this),a&&a.altKey){var d=this.editor,e=new v.CloneMarkup(d,d.getId(),this.markup,this.markup.position);e.execute()}this.fireEvent({type:v.EVENT_EDITFRAME_EDITION_START})}},x._onRepositionMouseMove=function(a){if(this.selection.dragging){var b=this.editor.getMousePosition(),c=this.editor.input.constrainAxis;this.areAxisConstrained!==c&&(this.areAxisConstrained=c,this.axisConstrains=c?new THREE.Vector2(0,0):new THREE.Vector2(1,1),this.initialPosition.x+=b.x-this.initialCursor.x,this.initialPosition.y+=b.y-this.initialCursor.y,this.initialCursor.x=b.x,this.initialCursor.y=b.y);var d={x:b.x-this.initialCursor.x,y:b.y-this.initialCursor.y},e=15;0===this.axisConstrains.x&&0===this.axisConstrains.y&&(Math.abs(d.x)>e?(this.axisConstrains.x=1,d.x+=d.x<0?e:-e):Math.abs(d.y)>e&&(this.axisConstrains.y=1,d.y+=d.y<0?e:-e));var f=this.initialPosition.x+d.x*this.axisConstrains.x,g=this.initialPosition.y+d.y*this.axisConstrains.y;m.bind(this)(f,g,this.selection.rotation);var h=this.editor.positionFromClientToMarkups(f,g),i=new v.SetPosition(this.editor,this.markup,h);i.execute()}},x._onRepositionMouseUp=function(){this.last=null,this.onMouseMove=function(){},this.onMouseUp=function(){},this.selection.dragging&&(this.editor.closeActionGroup(),this.selection.dragging=!1,this.fireEvent({type:v.EVENT_EDITFRAME_EDITION_END}))},x._onResizeMouseDown=function(a){var b=a.target;if(h(b)){this.selection.resizing=!0,this.selection.handle.resizing=b;var c=this.selection.handle.resizing.getAttribute("data-sdp-handle");this.containingDiv.style.cursor=c+"-resize";var d=this.editor.getMousePosition(),e=this.markup.getClientPosition(),f=this.markup.getClientSize();this.initial={x:e.x,y:e.y,width:f.x,height:f.y,mouseX:d.x,mouseY:d.y},this.onMouseMove=this._onResizeMouseMove.bind(this),this.onMouseUp=this._onResizeMouseUp.bind(this),this.editor.beginActionGroup(),this.fireEvent({type:v.EVENT_EDITFRAME_EDITION_START})}},x._onResizeMouseMove=function(a){if(this.selection.resizing){var b=this.editor.getMousePosition(),c=this.initial,d={x:b.x-c.mouseX,y:b.y-c.mouseY},e=new THREE.Vector3(d.x,d.y,0),f=(new THREE.Matrix4).makeRotationZ(-this.selection.rotation);d=e.applyMatrix4(f);var g=c.x,h=c.y,i=c.width,j=c.height,k=new THREE.Vector3,l=this.selection.handle.resizing.getAttribute("data-sdp-handle");if(this.editor.input.keepAspectRatio&&-1!==["nw","ne","sw","se"].indexOf(l)){var m=new THREE.Vector3(d.x,d.y,0);switch(l){case"nw":d.set(-c.width,-c.height,0);break;case"ne":d.set(c.width,-c.height,0);break;case"sw":d.set(c.width,-c.height,0);break;case"se":d.set(c.width,c.height,0)}d.normalize(),d=m.projectOnVector(d)}var n={n:function(){j-=d.y,k.y=d.y},s:function(){j+=d.y,k.y=d.y},w:function(){i-=d.x,k.x=d.x},e:function(){i+=d.x,k.x=d.x},nw:function(){this.n(),this.w()},ne:function(){this.n(),this.e()},sw:function(){this.s(),this.w()},se:function(){this.s(),this.e()}};n[l]();var o=(new THREE.Matrix4).makeRotationZ(this.selection.rotation),p=k.applyMatrix4(o),q=this.editor.positionFromClientToMarkups(g+.5*p.x,h+.5*p.y),r=this.editor.sizeFromClientToMarkups(i,j),s=new v.SetSize(this.editor,this.markup,q,r.x,r.y);s.execute()}},x._onResizeMouseUp=function(a){this.selection.resizing=!1,this.selection.handle.resizing=null,this.containingDiv.style.cursor="",this.editor.closeActionGroup(),this.fireEvent({type:v.EVENT_EDITFRAME_EDITION_END}),this.onMouseMove=function(){},this.onMouseUp=function(){}};var y,z;x._onRotationMouseDown=function(a){i(a.target)&&(this.editor.beginActionGroup(),this.selection.rotating=!0,z=this.editor.getMousePosition(),y=this.selection.rotation||0,this.onMouseMove=this._onRotationMouseMove.bind(this),this.onMouseUp=this._onRotationMouseUp.bind(this),this.fireEvent({type:v.EVENT_EDITFRAME_EDITION_START}))},x._onRotationMouseMove=function(a){if(this.selection.rotating){var b=this.editor.getMousePosition(),c=this.markup.getClientPosition(),d=t(c,b),e=t(c,z),f=d-e+y;if(this.editor.input.snapRotations){var g=w.degreesToRadians(22.5);f=Math.ceil(f/g)*g}m.bind(this)(this.selection.x,this.selection.y,f);var h=new v.SetRotation(this.editor,this.markup,f);h.execute()}},x._onRotationMouseUp=function(a){this.selection.rotating=!1,y=null,z=null,this.editor.closeActionGroup(),this.fireEvent({type:v.EVENT_EDITFRAME_EDITION_END})},v.EditFrame=a}(),Autodesk.Viewing.Extensions.Markups.Core.Utils.Localization={MARKUP_TEXT_DEFAULT_TEXT:"Write something..."},function(){"use strict";function a(a,b,d){this.id=a,this.type=0,this.editor=b,this.viewer=b.viewer,this.position={x:0,y:0},this.size={x:0,y:0},this.rotation=0,this.style=c.createStyle(d,this.viewer),this.highlightColor="#FAFF3C",this.constraintWidth=!1,this.constraintHeight=!1,this.constraintRotation=!1,this.highlighted=!1,this.selected=!1,c.addTraitEventDispatcher(this)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;b.MARKUP_TYPE_ARROW=1,b.MARKUP_TYPE_TEXT=2,b.MARKUP_TYPE_RECTANGLE=3,b.MARKUP_TYPE_CIRCLE=4,b.MARKUP_TYPE_CLOUD=5,b.MARKUP_TYPE_FREEHAND=6,b.MARKUP_EXPORT_TYPE_LABEL="Label",b.MARKUP_EXPORT_TYPE_ARROW="Arrow",b.MARKUP_EXPORT_TYPE_RECTANGLE="Rectangle",b.MARKUP_EXPORT_TYPE_CIRCLE="Circle",b.MARKUP_EXPORT_TYPE_CLOUD="Cloud",b.MARKUP_EXPORT_TYPE_FREEHAND="Freehand",b.EVENT_EDITMODE_CHANGED="EVENT_EDITMODE_CHANGED",b.EVENT_MARKUP_SELECTED="EVENT_MARKUP_SELECTED",b.EVENT_MARKUP_DRAGGING="EVENT_MARKUP_DRAGGING",b.EVENT_MARKUP_ENTER_EDITION="EVENT_MARKUP_ENTER_EDITION",b.EVENT_MARKUP_CANCEL_EDITION="EVENT_MARKUP_CANCEL_EDITION",b.EVENT_MARKUP_DELETE_EDITION="EVENT_MARKUP_DELETE_EDITION";var d=a.prototype;b.Markup=a,d.destroy=function(){},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.clone=function(){var a=Object.create(this.__proto__),b=this.getCloneOverrides();for(var c in this)if(this.hasOwnProperty(c)){var d=this[c];b.hasOwnProperty(c)?a[c]=b[c]:d.clone instanceof Function?a[c]=d.clone():d instanceof Function?a[c]=d.bind(a):d.nodeType?a[c]=d.cloneNode(!0):d instanceof Object?a[c]=JSON.parse(JSON.stringify(d)):a[c]=d}return a.bindDomEvents(),a},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.getCloneOverrides=function(){return{viewer:this.viewer,editor:this.editor,hammer:null,listeners:{}}},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.select=function(){this.selected||(this.selected=!0,this.highlighted=!1,this.updateStyle(),this.fireEvent({type:b.EVENT_MARKUP_SELECTED,markup:this}))},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.unselect=function(){this.selected=!1},d.highlight=function(a){this.interactionsDisabled||(this.highlighted=a,this.updateStyle())},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.getStyle=function(){return c.cloneStyle(this.style)},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.setStyle=function(a){c.copyStyle(a,this.style),this.updateStyle()},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.updateStyle=function(){},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.finishDragging=function(){this.fireEvent({type:b.EVENT_MARKUP_DRAGGING,markup:this,dragging:!1})},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.edit=function(){this.fireEvent({type:b.EVENT_MARKUP_ENTER_EDITION,markup:this})},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.cancel=function(){this.fireEvent({type:b.EVENT_MARKUP_CANCEL_EDITION,markup:this})},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.deleteMarkup=function(){this.fireEvent({type:b.EVENT_MARKUP_DELETE_EDITION,markup:this})},d.setParent=function(a){},d.setPosition=function(a,b){},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.getEditMode=function(){return console.warn("EditMode of markup type"+c.getTypeString(this.type)+" not defined."),null},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.getClientPosition=function(){var a=this.position;return this.editor.positionFromMarkupsToClient(a.x,a.y)},Autodesk.Viewing.Extensions.Markups.Core.Markup.prototype.getClientSize=function(){var a=this.size;return this.editor.sizeFromMarkupsToClient(a.x,a.y)},d.setRotation=function(a){},d.getRotation=function(){return this.rotation},d.setSize=function(a,b){},d.isWidthConstrained=function(){return this.constraintWidth},d.isHeightConstrained=function(){return this.constraintHeight},d.isRotationConstrained=function(){return this.constraintRotation},d.disableInteractions=function(a){this.interactionsDisabled=a},d.setStrokeWidth=function(a){},d.constrainsToBounds=function(a){},d.onMouseDown=function(a){this.select(),this.editor.editFrame.startDrag()},d.setMetadata=function(){return null},d.bindTouchEvents=function(a){this.hammer=new Hammer.Manager(a,{recognizers:[[Hammer.Tap,{event:"singletap",pointers:1,threshold:2}]],inputClass:Hammer.TouchInput}),this.onSingleTapBinded=function(a){this.onMouseDown(a)}.bind(this),this.hammer.on("singletap",this.onSingleTapBinded)}}(),function(){"use strict";function a(a,c){var d=["stroke-width","stroke-color","stroke-opacity"];b.Markup.call(this,a,c,d),this.type=b.MARKUP_TYPE_ARROW,this.constraintHeight=!0,this.head=new THREE.Vector3,this.tail=new THREE.Vector3,this.size.y=2*this.style["stroke-width"],this.createSVG(),this.bindDomEvents()}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.Markup.prototype),a.prototype.constructor=a;var d=a.prototype;d.getEditMode=function(){return new b.EditModeArrow(this.editor)},d.createSVG=function(){this.shape=c.createSvgElement("polygon")},d.bindDomEvents=function(){c.isTouchDevice()?this.bindTouchEvents(this.shape):(this.shape.addEventListener("mousedown",this.onMouseDown.bind(this),!0),this.shape.addEventListener("mouseout",function(){this.highlight(!1)}.bind(this)),this.shape.addEventListener("mouseover",function(){this.highlight(!0)}.bind(this)))},d.set=function(a,b,c,d){var e=new THREE.Vector2(a,b),f=new THREE.Vector2(c,d),g=f.clone().sub(e).normalize();this.size.x=e.distanceTo(f),this.rotation=Math.acos(g.dot(new THREE.Vector2(1,0))),this.rotation=d>b?2*Math.PI-this.rotation:this.rotation,this.head.set(a,b,0),this.tail.set(c,d,0),this.updateTransformMatrix(),this.updateStyle()},d.setRotation=function(a){this.rotation=a,this.updateTransformMatrix(),this.updateStyle()},d.setSize=function(a,b,c){var d=Math.cos(this.rotation),e=Math.sin(this.rotation),f=new THREE.Vector2(d,e);f.multiplyScalar(.5*b);var g=new THREE.Vector2(a.x,a.y),h=g.clone().add(f),i=g.clone().sub(f);this.head.set(i.x,i.y,0),this.tail.set(h.x,h.y,0),this.position.x=a.x,this.position.y=a.y,this.size.x=b,this.updateTransformMatrix(),this.updateStyle()},d.updateTransformMatrix=function(){var a=this.head,b=this.tail,d=.5*this.size.x,e=this.style["stroke-width"],f=.5*(a.x+b.x),g=.5*(a.y+b.y);this.transformSvg=["translate(",f,",",g,") ","rotate(",c.radiansToDegrees(-this.rotation),") ","translate(",-d,",",-e,") "].join(""),this.position.x=b.x+.5*(a.x-b.x),this.position.y=b.y+.5*(a.y-b.y)},d.updateStyle=function(){this.size.y=2*this.style["stroke-width"],this.updateTransformMatrix();var a=this.highlighted?this.highlightColor:this.style["stroke-color"],b=this.getPolygonPoints(),c=b.map(function(a){return a[0]+","+a[1]}),d=c.join(" ");this.shape.setAttribute("points",d),this.shape.setAttribute("transform",this.transformSvg),this.shape.setAttribute("fill",a),this.shape.setAttribute("opacity",this.style["stroke-opacity"])},d.getPolygonPoints=function(){var a=this.style["stroke-width"],b=.5*this.size.x,c=a,d=.5*a,e=b-1.2*c,f=[-b,-d],g=[-b,d],h=[b,0],i=[e,-c],j=[e,-d],k=[e,d],l=[e,c],m=[f,j,i,h,l,k,g];return m.forEach(function(a){a[0]+=b,a[1]+=c}),m},d.setParent=function(a){var b=this.shape;b.parentNode&&b.parentNode.removeChild(b),a&&a.appendChild(b)},d.setPosition=function(a,b){var c=this.head,d=this.tail,e=c.x-d.x,f=c.y-d.y,g=a-.5*e,h=b-.5*f;c.x=g,c.y=h,d.x=g+e,d.y=h+f,this.updateTransformMatrix(),this.updateStyle()},d.created=function(){},d.destroy=function(){this.unselect(),this.setParent(null)},d.constrainsToBounds=function(a){},d.setMetadata=function(){
var a=c.cloneStyle(this.style);return a.type="arrow",a.head=[this.head.x,this.head.y].join(" "),a.tail=[this.tail.x,this.tail.y].join(" "),a.rotation=String(this.rotation),c.addMarkupMetadata(this.shape,a)},d.renderToCanvas=function(a){var b=this.style["stroke-width"],d=this.style["stroke-color"],e=this.style["stroke-opacity"],f=this.head,g=this.tail,h=.5*this.size.x,i=b,j=.5*(f.x+g.x),k=.5*(f.y+g.y),l=this.editor.positionFromMarkupsToClient(h,i),m=this.editor.positionFromMarkupsToClient(j,k),n=(new THREE.Matrix4).makeTranslation(-l.x,-l.y,0),o=(new THREE.Matrix4).makeRotationZ(this.rotation),p=(new THREE.Matrix4).makeTranslation(m.x,m.y,0),q=p.multiply(o).multiply(n),r=this.getPolygonPoints();a.fillStyle=c.composeRGBAString(d,e),a.beginPath();var s=this;r.forEach(function(b){var c=b[0],d=b[1],e=s.editor.positionFromMarkupsToClient(c,d);e=e.applyMatrix4(q),a.lineTo(e.x,e.y)}),a.fill()},b.MarkupArrow=a}(),function(){"use strict";function a(a,c){var d=["stroke-width","stroke-color","stroke-opacity","fill-color","fill-opacity"];b.Markup.call(this,a,c,d),this.type=b.MARKUP_TYPE_CIRCLE,this.createSVG(),this.bindDomEvents()}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.Markup.prototype),a.prototype.constructor=a;var d=a.prototype;d.getEditMode=function(){return new b.EditModeCircle(this.editor)},d.createSVG=function(){this.shape=c.createSvgElement("ellipse")},d.bindDomEvents=function(){c.isTouchDevice()?this.bindTouchEvents(this.shape):(this.shape.addEventListener("mousedown",this.onMouseDown.bind(this),!0),this.shape.addEventListener("mouseout",function(){this.highlight(!1)}.bind(this)),this.shape.addEventListener("mouseover",function(){this.highlight(!0)}.bind(this)))},d.set=function(a,b){this.rotation=0,this.position.x=a.x,this.position.y=a.y,this.size.x=b.x,this.size.y=b.y,this.updateTransformMatrix(),this.updateStyle()},d.updateTransformMatrix=function(){var a=this.style["stroke-width"],b=.5*Math.max(this.size.x-a,0),d=.5*Math.max(this.size.y-a,0);this.transformSvg=["translate(",this.position.x,",",this.position.y,") ","rotate(",c.radiansToDegrees(-this.rotation),") ","translate(",-b,",",-d,") "].join("")},d.updateStyle=function(){this.updateTransformMatrix();var a=this.style["stroke-width"],b=this.highlighted?this.highlightColor:this.style["stroke-color"],d=this.style["stroke-opacity"],e=this.style["fill-color"],f=this.style["fill-opacity"],g=.5*Math.max(this.size.x-a,0),h=.5*Math.max(this.size.y-a,0);this.shape.setAttribute("transform",this.transformSvg),this.shape.setAttribute("stroke-width",a),this.shape.setAttribute("stroke",c.composeRGBAString(b,d)),this.shape.setAttribute("fill",c.composeRGBAString(e,f)),this.shape.setAttribute("cx",g),this.shape.setAttribute("cy",h),this.shape.setAttribute("rx",g),this.shape.setAttribute("ry",h)},d.setParent=function(a){var b=this.shape;b.parentNode&&b.parentNode.removeChild(b),a&&a.appendChild(b)},d.setRotation=function(a){this.rotation=a,this.updateTransformMatrix(),this.updateStyle()},d.setSize=function(a,b,c){this.position.x=a.x,this.position.y=a.y,this.size.x=b,this.size.y=c,this.updateTransformMatrix(),this.updateStyle()},d.setPosition=function(a,b){this.position.x=a,this.position.y=b,this.updateTransformMatrix(),this.updateStyle()},d.created=function(){},d.destroy=function(){this.unselect(),this.setParent(null)},d.setMetadata=function(){var a=c.cloneStyle(this.style);return a.type="ellipse",a.position=[this.position.x,this.position.y].join(" "),a.size=[this.size.x,this.size.y].join(" "),a.rotation=String(this.rotation),c.addMarkupMetadata(this.shape,a)},d.renderToCanvas=function(a){function b(a,b,c,d,e){a.beginPath();var f=b-d/2,g=b+d/2,h=c-e/2,i=c+e/2,j=.551784,k=j*d/2,l=j*e/2;a.moveTo(b,h),a.bezierCurveTo(b+k,h,g,c-l,g,c),a.bezierCurveTo(g,c+l,b+k,i,b,i),a.bezierCurveTo(b-k,i,f,c+l,f,c),a.bezierCurveTo(f,c-l,b-k,h,b,h),a.stroke()}var d=this.style["stroke-width"],e=this.style["stroke-color"],f=this.style["stroke-opacity"],g=this.style["fill-color"],h=this.style["fill-opacity"],i=this.size.x-d,j=this.size.y-d,k=this.editor.sizeFromMarkupsToClient(i,j),l=this.editor.positionFromMarkupsToClient(this.position.x,this.position.y);a.strokeStyle=c.composeRGBAString(e,f),a.fillStyle=c.composeRGBAString(g,h),a.lineWidth=this.editor.sizeFromMarkupsToClient(d,0).x,a.translate(l.x,l.y),a.rotate(this.rotation),a.beginPath(),b(a,0,0,k.x,k.y),0!==h&&a.fill(),a.stroke()},b.MarkupCircle=a}(),function(){"use strict";function a(a,b){var d=["stroke-width","stroke-color","stroke-opacity","fill-color","fill-opacity"];c.Markup.call(this,a,b,d),this.type=c.MARKUP_TYPE_CLOUD,this.lineJoint="round",this.createSVG(),this.bindDomEvents()}function b(a){return"top"===a||"bottom"===a}var c=Autodesk.Viewing.Extensions.Markups.Core,d=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(c.Markup.prototype),a.prototype.constructor=a;var e=a.prototype;e.getEditMode=function(){return new c.EditModeCloud(this.editor)},e.createSVG=function(){this.shape=d.createSvgElement("path")},e.bindDomEvents=function(){d.isTouchDevice()?this.bindTouchEvents(this.shape):(this.shape.addEventListener("mousedown",this.onMouseDown.bind(this),!0),this.shape.addEventListener("mouseout",function(){this.highlight(!1)}.bind(this)),this.shape.addEventListener("mouseover",function(){this.highlight(!0)}.bind(this)))},e.set=function(a,b){this.rotation=0,this.position.x=a.x,this.position.y=a.y,this.size.x=b.x,this.size.y=b.y,this.updateTransformMatrix(),this.updateStyle()},e.updateTransformMatrix=function(){var a=.5*this.size.x,b=.5*this.size.y;this.transformSvg=["translate(",this.position.x,",",this.position.y,") ","rotate(",d.radiansToDegrees(-this.rotation),") ","translate(",-a,",",-b,") "].join("")},e.updateStyle=function(){this.updateTransformMatrix();var a=this.style["stroke-width"],b=this.highlighted?this.highlightColor:this.style["stroke-color"],c=this.style["stroke-opacity"],e=this.style["fill-color"],f=this.style["fill-opacity"];this.shape.setAttribute("transform",this.transformSvg),this.shape.setAttribute("stroke-width",a),this.shape.setAttribute("stroke",d.composeRGBAString(b,c)),this.shape.setAttribute("fill",d.composeRGBAString(e,f)),this.shape.setAttribute("stroke-linejoin",this.lineJoint);var g=this.getPathMovements(),h=g.map(function(a,b){if(0===b)return["M"].concat(a.join(",")).join(" ");var c=a.map(function(a){return a.join(",")});return["C"].concat(c).join(" ")});h.push("Z"),this.shape.setAttribute("d",h.join(" "))},e.getPathMovements=function(){function a(a,b,c){var d=.25*a,e=.75*a;switch(c){case"top":return[[o+d,p-b],[o+e,p-b],[o+=a,p]];case"right":return[[o+b,p+d],[o+b,p+e],[o,p+=a]];case"bottom":return[[o-d,p+b],[o-e,p+b],[o-=a,p]];case"left":return[[o-b,p-d],[o-b,p-e],[o,p-=a]]}}var c=this.style["stroke-width"],d=0===this.size.x?1:this.size.x,e=0===this.size.y?1:this.size.y,f=4*c,g=3*c,h=g+c/2,i=d-2*h,j=e-2*h,k=i/f,l=j/f,m=k%1,n=l%1;k=parseInt(k,10),l=parseInt(l,10);var o=h,p=h,q=[[o,p]];return["top","right","bottom","left"].forEach(function(c){for(var d=b(c),e=d?k:l,h=d?m:n,i=0;e>i;i++)q.push(a(f,g,c));0!==h&&q.push(a(h*f,g,c))}),q},e.setParent=function(a){var b=this.shape;b.parentNode&&b.parentNode.removeChild(b),a&&a.appendChild(b)},e.setRotation=function(a){this.rotation=a,this.updateTransformMatrix(),this.updateStyle()},e.setSize=function(a,b,c){this.position.x=a.x,this.position.y=a.y,this.size.x=b,this.size.y=c,this.updateTransformMatrix(),this.updateStyle()},e.setPosition=function(a,b){this.position.x=a,this.position.y=b,this.updateTransformMatrix(),this.updateStyle()},e.created=function(){},e.destroy=function(){this.unselect(),this.setParent(null)},e.constrainsToBounds=function(a){},e.setMetadata=function(){var a=d.cloneStyle(this.style);return a.type="cloud",a.position=[this.position.x,this.position.y].join(" "),a.size=[this.size.x,this.size.y].join(" "),a.rotation=String(this.rotation),d.addMarkupMetadata(this.shape,a)},e.renderToCanvas=function(a){var b=(new THREE.Matrix4).makeTranslation(.5*-this.size.x,.5*-this.size.y,0),c=(new THREE.Matrix4).makeRotationZ(-this.rotation),e=(new THREE.Matrix4).makeTranslation(this.position.x,this.position.y,0),f=e.multiply(c).multiply(b),g=this.highlighted?this.highlightColor:this.style["stroke-color"],h=this.style["stroke-opacity"],i=this.style["fill-color"],j=this.style["fill-opacity"];a.strokeStyle=d.composeRGBAString(g,h),a.fillStyle=d.composeRGBAString(i,j),a.lineJoin=this.lineJoint,a.lineWidth=this.editor.sizeFromMarkupsToClient(this.style["stroke-width"],0).x,a.beginPath();var k=new THREE.Vector3,l=this.editor.positionFromMarkupsToClient.bind(this.editor),m=this.getPathMovements();m.forEach(function(b,c){if(0===c){k.x=b[0],k.y=b[1],k.z=0,k=k.applyMatrix4(f);var d=l(k.x,k.y);a.moveTo(d.x,d.y)}else{k.x=b[0][0],k.y=b[0][1],k.z=0,k=k.applyMatrix4(f);var e=l(k.x,k.y);k.x=b[1][0],k.y=b[1][1],k.z=0,k=k.applyMatrix4(f);var g=l(k.x,k.y);k.x=b[2][0],k.y=b[2][1],k.z=0,k=k.applyMatrix4(f);var h=l(k.x,k.y);a.bezierCurveTo(e.x,e.y,g.x,g.y,h.x,h.y)}}),a.closePath(),0!==j&&a.fill(),a.stroke()},c.MarkupCloud=a}(),function(){"use strict";function a(a,c){var d=["stroke-width","stroke-color","stroke-opacity"];b.Markup.call(this,a,c,d),this.type=b.MARKUP_TYPE_FREEHAND,this.iniSize={x:1,y:1},this.createSVG(),this.bindDomEvents()}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.Markup.prototype),a.prototype.constructor=a;var d=a.prototype;d.getEditMode=function(){return new b.EditModeFreehand(this.editor)},d.createSVG=function(){this.shape=c.createSvgElement("path")},d.bindDomEvents=function(){c.isTouchDevice()?this.bindTouchEvents(this.shape):(this.shape.addEventListener("mousedown",this.onMouseDown.bind(this),!0),this.shape.addEventListener("mouseout",function(){this.highlight(!1)}.bind(this)),this.shape.addEventListener("mouseover",function(){this.highlight(!0)}.bind(this)))},d.set=function(a,b,c){this.rotation=0,this.position.x=a.x,this.position.y=a.y,this.size.x=b.x,this.size.y=b.y,this.locations=c.concat(),this.iniSize.x=0===b.x?1:b.x,this.iniSize.y=0===b.y?1:b.y,this.updateTransformMatrix(),this.updateStyle()},d.updateTransformMatrix=function(){var a=this.size.x/this.iniSize.x,b=this.size.y/this.iniSize.y;this.transformSvg=["translate(",this.position.x,",",this.position.y,") ","rotate(",c.radiansToDegrees(-this.rotation),") ","scale(",a,",",b,") "].join("")},d.updateStyle=function(){this.updateTransformMatrix();var a=this.style["stroke-width"],b=this.highlighted?this.highlightColor:this.style["stroke-color"],d=this.style["stroke-opacity"];this.shape.setAttribute("transform",this.transformSvg),this.shape.setAttribute("stroke-width",a),this.shape.setAttribute("stroke",c.composeRGBAString(b,d)),this.shape.setAttribute("fill","none"),this.shape.setAttribute("opacity",c.composeRGBAString(b,d));var e=this.locations.map(function(a,b){return 0===b?["M"].concat([a.x,a.y]).join(" "):["L"].concat([a.x,a.y]).join(" ")}).join(" ");this.shape.setAttribute("d",e)},d.setParent=function(a){var b=this.shape;b.parentNode&&b.parentNode.removeChild(b),a&&a.appendChild(b)},d.setRotation=function(a){this.rotation=a,this.updateTransformMatrix(),this.updateStyle()},d.setSize=function(a,b,c){this.position.x=a.x,this.position.y=a.y,this.size.x=b,this.size.y=c,this.updateTransformMatrix(),this.updateStyle()},d.setPosition=function(a,b){this.position.x=a,this.position.y=b,this.updateTransformMatrix(),this.updateStyle()},d.created=function(){},d.destroy=function(){this.unselect(),this.setParent(null)},d.constrainsToBounds=function(a){},d.setMetadata=function(){var a=c.cloneStyle(this.style);return a.type="freehand",a.position=[this.position.x,this.position.y].join(" "),a.size=[this.size.x,this.size.y].join(" "),a.rotation=String(this.rotation),a.locations=this.locations.map(function(a){return[a.x,a.y].join(" ")}).join(" "),c.addMarkupMetadata(this.shape,a)},d.renderToCanvas=function(a){var b=this.style["stroke-width"],d=this.style["stroke-color"],e=this.style["stroke-opacity"],f=this.size.x/this.iniSize.x,g=this.size.y/this.iniSize.y,h=(new THREE.Matrix4).makeScale(f,g,1),i=(new THREE.Matrix4).makeRotationZ(-this.rotation),j=(new THREE.Matrix4).makeTranslation(this.position.x,this.position.y,0),k=j.multiply(i).multiply(h);a.strokeStyle=c.composeRGBAString(d,e),a.lineWidth=this.editor.sizeFromMarkupsToClient(b,0).x,a.beginPath();var l=this,m=new THREE.Vector3;this.locations.forEach(function(b,c){m.x=b.x,m.y=b.y,m.z=0,m=m.applyMatrix4(k),b=l.editor.positionFromMarkupsToClient(m.x,m.y),0===c?a.moveTo(b.x,b.y):a.lineTo(b.x,b.y)}),a.stroke()},b.MarkupFreehand=a}(),function(){"use strict";function a(a,c){var d=["stroke-width","stroke-color","stroke-opacity","fill-color","fill-opacity"];b.Markup.call(this,a,c,d),this.type=b.MARKUP_TYPE_RECTANGLE,this.createSVG(),this.bindDomEvents()}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.Markup.prototype),a.prototype.constructor=a;var d=a.prototype;d.getEditMode=function(){return new b.EditModeRectangle(this.editor)},d.createSVG=function(){this.shape=c.createSvgElement("rect")},d.bindDomEvents=function(){c.isTouchDevice()?this.bindTouchEvents(this.shape):(this.shape.addEventListener("mousedown",this.onMouseDown.bind(this),!0),this.shape.addEventListener("mouseout",function(){this.highlight(!1)}.bind(this)),this.shape.addEventListener("mouseover",function(){this.highlight(!0)}.bind(this)))},d.set=function(a,b){this.rotation=0,this.position.x=a.x,this.position.y=a.y,this.size.x=b.x,this.size.y=b.y,this.updateTransformMatrix(),this.updateStyle()},d.updateTransformMatrix=function(){var a=this.style["stroke-width"],b=.5*Math.max(this.size.x-a,0),d=.5*Math.max(this.size.y-a,0);this.transformSvg=["translate(",this.position.x,",",this.position.y,") ","rotate(",c.radiansToDegrees(-this.rotation),") ","translate(",-b,",",-d,") "].join("")},d.updateStyle=function(){this.updateTransformMatrix();var a=this.style["stroke-width"],b=this.highlighted?this.highlightColor:this.style["stroke-color"],d=this.style["stroke-opacity"],e=this.style["fill-color"],f=this.style["fill-opacity"];this.shape.setAttribute("transform",this.transformSvg),this.shape.setAttribute("stroke-width",a),this.shape.setAttribute("stroke",c.composeRGBAString(b,d)),this.shape.setAttribute("fill",c.composeRGBAString(e,f)),this.shape.setAttribute("width",Math.max(this.size.x-a,0)),this.shape.setAttribute("height",Math.max(this.size.y-a,0))},d.setParent=function(a){var b=this.shape;b.parentNode&&b.parentNode.removeChild(b),a&&a.appendChild(b)},d.setRotation=function(a){this.rotation=a,this.updateTransformMatrix(),this.updateStyle()},d.setSize=function(a,b,c){this.position.x=a.x,this.position.y=a.y,this.size.x=b,this.size.y=c,this.updateTransformMatrix(),this.updateStyle()},d.setPosition=function(a,b){this.position.x=a,this.position.y=b,this.updateTransformMatrix(),this.updateStyle()},d.created=function(){},d.destroy=function(){this.unselect(),this.setParent(null)},d.constrainsToBounds=function(a){},d.setMetadata=function(){var a=c.cloneStyle(this.style);return a.type="rectangle",a.position=[this.position.x,this.position.y].join(" "),a.size=[this.size.x,this.size.y].join(" "),a.rotation=String(this.rotation),c.addMarkupMetadata(this.shape,a)},d.renderToCanvas=function(a){var b=this.style["stroke-width"],d=this.highlighted?this.highlightColor:this.style["stroke-color"],e=this.style["stroke-opacity"],f=this.style["fill-color"],g=this.style["fill-opacity"],h=this.size.x-b,i=this.size.y-b,j=this.editor.sizeFromMarkupsToClient(h,i),k=j.x,l=j.y,m=this.editor.positionFromMarkupsToClient(this.position.x,this.position.y);a.strokeStyle=c.composeRGBAString(d,e),a.fillStyle=c.composeRGBAString(f,g),a.lineWidth=this.editor.sizeFromMarkupsToClient(b,0).x,a.translate(m.x,m.y),a.rotate(this.getRotation()),0!==g&&a.fillRect(k/-2,l/-2,k,l),a.strokeRect(k/-2,l/-2,k,l)},b.MarkupRectangle=a}(),function(){"use strict";function a(a,b,d){var e=["font-size","stroke-color","stroke-opacity","fill-color","fill-opacity","font-family","font-style","font-weight"];c.Markup.call(this,a,b,e),this.constraintRotation=!0,this.type=c.MARKUP_TYPE_TEXT,this.size.x=d.x,this.size.y=d.y,this.currentText="",this.currentTextLines=[""],this.textDirty=!0,this.lineHeight=130,this.createSvg(),this.bindDomEvents()}function b(a,b,c,d){var e=0;b.forEach(function(b){e+c>d||(a.fillText(b,0,e),e+=c)})}var c=Autodesk.Viewing.Extensions.Markups.Core,d=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(c.Markup.prototype),a.prototype.constructor=a;var e=a.prototype;e.getEditMode=function(){return new c.EditModeText(this.editor)},e.createSvg=function(){this.clipPath=d.createSvgElement("clipPath"),this.clipPathId="CO2_Markup_clip_"+this.id,this.clipPath.setAttribute("id",this.clipPathId),this.clipPath.removeAttribute("pointer-events"),this.clipRect=d.createSvgElement("rect"),this.clipRect.removeAttribute("pointer-events"),this.clipPath.appendChild(this.clipRect),this.shape=d.createSvgElement("text"),this.shapeBg=d.createSvgElement("rect")},e.bindDomEvents=function(){d.isTouchDevice()?this.bindTouchEvents(this.shape):(this.shape.addEventListener("mousedown",this.onMouseDown.bind(this),!0),this.shape.addEventListener("mouseout",function(){this.highlight(!1)}.bind(this)),this.shape.addEventListener("mouseover",function(){this.highlight(!0)}.bind(this)))},e.set=function(a,b,c,d){this.position.x=a.x,this.position.y=a.y,this.size.x=b.x,this.size.y=b.y,this.updateTransformMatrix(),this.updateStyle(),this.setText(c,d)},e.updateTransformMatrix=function(){var a=.5*this.size.x,b=.5*this.size.y,c=this.position.x-a,d=this.position.y-b;this.transformSvg=["translate(",c,",",d,") ","scale(",1,",",-1,") "].join("")},e.setPosition=function(a,b){this.position.x=a,this.position.y=b,this.updateTransformMatrix(),this.updateStyle()},e.setSize=function(a,b,c){var d=this.size.x!==b;if(this.position.x=a.x,this.position.y=a.y,this.size.x=b,this.size.y=c,d){var e=this.calcTextLines();this.linesAreEqual(e)||(this.currentTextLines=e,this.textDirty=!0,this.forceRedraw())}this.updateTransformMatrix(),this.updateStyle()},e.calcTextLines=function(){return this.editor.editMode.textInputHelper.getTextValuesForMarkup(this).lines},e.setStyle=function(a){d.copyStyle(a,this.style),this.updateStyle(!0)},e.linesAreEqual=function(a){var b=this.currentTextLines;if(a.length!==b.length)return!1;for(var c=b.length,d=0;c>d;++d)if(a[d]!==b[d])return!1;return!0},e.setParent=function(a){var b=this.clipPath.parentNode;b&&b.removeChild(this.clipPath),a&&a.appendChild(this.clipPath),b=this.shapeBg.parentNode,b&&b.removeChild(this.shapeBg),a&&a.appendChild(this.shapeBg),b=this.shape.parentNode,b&&b.removeChild(this.shape),a&&a.appendChild(this.shape)},e.setText=function(a){this.currentText=a,this.currentTextLines=this.calcTextLines(),this.textDirty=!0,this.updateStyle()},e.getText=function(){return this.currentText},e.getTextLines=function(){return this.currentTextLines.concat()},e.updateStyle=function(a){this.updateTransformMatrix();var b=this.style["font-size"],c=this.highlighted?this.highlightColor:this.style["stroke-color"],e=this.style["stroke-opacity"];this.shape.setAttribute("font-family",this.style["font-family"]),this.shape.setAttribute("font-size",b),this.shape.setAttribute("font-weight",this.style["font-weight"]?"bold":""),this.shape.setAttribute("font-style",this.style["font-style"]?"italic":""),this.shape.setAttribute("fill",d.composeRGBAString(c,e));var f=this.shape.getBBox(),g=["translate(0, ",-this.size.y+b,")"].join("");this.shape.setAttribute("transform",this.transformSvg+g),this.shape.setAttribute("clip-path","url(#"+this.clipPathId+")"),(this.textDirty||a)&&(a&&(this.currentTextLines=this.calcTextLines()),this.rebuildTextSvg(),this.textDirty=!1),this.clipRect.setAttribute("x","0"),this.clipRect.setAttribute("y",f.y),this.clipRect.setAttribute("width",this.size.x),this.clipRect.setAttribute("height",this.size.y);var h=this.style["fill-color"],i=this.style["fill-opacity"];g=["translate(0, ",-this.size.y,")"].join(""),this.shapeBg.setAttribute("transform",this.transformSvg+g),this.shapeBg.setAttribute("width",this.size.x),this.shapeBg.setAttribute("height",this.size.y),this.shapeBg.setAttribute("stroke-width","0"),this.shapeBg.setAttribute("fill",d.composeRGBAString(h,i))},e.rebuildTextSvg=function(){for(;this.shape.childNodes.length>0;)this.shape.removeChild(this.shape.childNodes[0]);var a=0,b=0,c=this.getLineHeight();this.currentTextLines.forEach(function(e){var f=d.createSvgElement("tspan");f.setAttribute("x",a),f.setAttribute("y",b),f.textContent=e,this.shape.appendChild(f),b+=c}.bind(this))},e.setMetadata=function(){var a=d.cloneStyle(this.style);return a.type="label",a.position=[this.position.x,this.position.y].join(" "),a.size=[this.size.x,this.size.y].join(" "),a.text=String(this.currentText),d.addMarkupMetadata(this.shape,a)},e.getClientFontSize=function(){return this.editor.sizeFromMarkupsToClient(0,this.style["font-size"]).y},e.getLineHeight=function(){return this.style["font-size"]*(.01*this.lineHeight)},e.forceRedraw=function(){window.requestAnimationFrame(function(){this.highlighted=!this.highlighted,this.updateStyle(),this.highlighted=!this.highlighted,this.updateStyle()}.bind(this))},e.renderToCanvas=function(a){var c=this.style["font-family"],e=this.style["font-style"]?"italic":"",f=this.style["font-weight"]?"bold":"",g=this.style["stroke-color"],h=this.style["stroke-opacity"],i=this.getClientFontSize(),j=i*(.01*this.lineHeight),k=this.editor.positionFromMarkupsToClient(this.position.x,this.position.y),l=this.editor.sizeFromMarkupsToClient(this.size.x,this.size.y);a.save();var m=this.style["fill-color"],n=this.style["fill-opacity"];a.fillStyle=d.composeRGBAString(m,n),a.translate(k.x,k.y),0!==n&&a.fillRect(l.x*-.5,l.y*-.5,l.x,l.y),a.restore(),a.fillStyle=g,a.strokeStyle=g,a.textBaseline="top",a.translate(k.x-.5*l.x,k.y-.5*l.y),a.font=e+" "+f+" "+i+"px "+c,a.globalAlpha=h,b(a,this.currentTextLines,j,l.y)},c.MarkupText=a}(),function(){"use strict";function a(){Autodesk.Viewing.ToolInterface.call(this),this.names=["markups.core"],this.panTool=null,this.allowNav=!1,this.coreExt=null,this.hotkeysEnabled=!0;var a=!1,b=!1;this.allowNavigation=function(a){this.allowNav=a},this.setCoreExtension=function(a){this.coreExt=a},this.setHotkeysEnabled=function(a){this.hotkeysEnabled=a},this.activate=function(a,b){this.panTool=b.toolController.getTool("pan"),this.panTool&&this.panTool.activate("pan")},this.deactivate=function(a){this.panTool&&this.panTool.deactivate("pan"),this.panTool=null},this.handleKeyDown=function(c,d){if(!this.hotkeysEnabled)return!0;switch(d){case Autodesk.Viewing.KeyCode.CONTROL:a=!0;break;case Autodesk.Viewing.KeyCode.SHIFT:b=!0;break;case Autodesk.Viewing.KeyCode.x:a&&!this.allowNav&&this.coreExt.cut();break;case Autodesk.Viewing.KeyCode.c:a&&!this.allowNav&&this.coreExt.copy();break;case Autodesk.Viewing.KeyCode.v:a&&!this.allowNav&&this.coreExt.paste();break;case Autodesk.Viewing.KeyCode.d:a&&!this.allowNav&&(this.coreExt.copy(),this.coreExt.paste());break;case Autodesk.Viewing.KeyCode.z:!a||b||this.allowNav?a&&b&&!this.allowNav&&this.coreExt.redo():this.coreExt.undo();break;case Autodesk.Viewing.KeyCode.y:a&&!this.allowNav&&this.coreExt.redo();break;case Autodesk.Viewing.KeyCode.ESCAPE:this.coreExt.selectMarkup(null)}return!0},this.handleKeyUp=function(c,d){if(!this.hotkeysEnabled)return!0;switch(d){case Autodesk.Viewing.KeyCode.CONTROL:a=!1;break;case Autodesk.Viewing.KeyCode.SHIFT:b=!1}return!0},this.update=function(){return this.allowNav&&this.panTool&&this.panTool.update?this.panTool.update():!1},this.handleSingleClick=function(a,b){return this.allowNav&&this.panTool&&this.panTool.handleSingleClick?this.panTool.handleSingleClick(a,b):!0},this.handleDoubleClick=function(a,b){return this.allowNav&&this.panTool&&this.panTool.handleDoubleClick?this.panTool.handleDoubleClick(a,b):!0},this.handleSingleTap=function(a){return this.allowNav&&this.panTool&&this.panTool.handleSingleTap?this.panTool.handleSingleTap(a):!0},this.handleDoubleTap=function(a){return this.allowNav&&this.panTool&&this.panTool.handleDoubleTap?this.panTool.handleDoubleTap(a):!0},this.handleWheelInput=function(a){return this.allowNav&&this.panTool&&this.panTool.handleWheelInput?this.panTool.handleWheelInput(a):!0},this.handleButtonDown=function(a,b){return this.allowNav&&this.panTool&&this.panTool.handleButtonDown?this.panTool.handleButtonDown(a,b):!0},this.handleButtonUp=function(a,b){return this.allowNav&&this.panTool&&this.panTool.handleButtonUp?this.panTool.handleButtonUp(a,b):!0},this.handleMouseMove=function(a){return this.allowNav&&this.panTool&&this.panTool.handleMouseMove?this.panTool.handleMouseMove(a):!0},this.handleGesture=function(a){return this.allowNav&&this.panTool&&this.panTool.handleGesture?this.panTool.handleGesture(a):!0},this.handleBlur=function(a){return this.allowNav&&this.panTool&&this.panTool.handleBlur?this.panTool.handleBlur(a):!0}}var b=Autodesk.Viewing.Extensions.Markups.Core;b.MarkupTool=a}(),function(){"use strict";function a(a,d){Autodesk.Viewing.Extension.call(this,a,d),this.options=this.options||{},this.markups=[],this.styles={},this.duringViewMode=!1,this.duringEditMode=!1,this.actionManager=new b.EditActionManager(50),this.actionManager.addEventListener(b.EVENT_HISTORY_CHANGED,this.onEditActionHistoryChanged.bind(this)),this.nextId=0,this.clipboard=new b.Clipboard(this),this.input=new b.InputHandler,c.addTraitEventDispatcher(this),this.onCameraChangeBinded=this.onCameraChange.bind(this),this.onViewerResizeBinded=this.onViewerResize.bind(this),this.onMarkupDraggingBinded=this.onMarkupDragging.bind(this),this.onMarkupSelectedBinded=this.onMarkupSelected.bind(this),this.onMarkupEnterEditionBinded=this.onMarkupEnterEdition.bind(this),this.onMarkupCancelEditionBinded=this.onMarkupCancelEdition.bind(this),this.onMarkupDeleteEditionBinded=this.onMarkupDeleteEdition.bind(this)}var b=AutodeskNamespace("Autodesk.Viewing.Extensions.Markups.Core"),c=AutodeskNamespace("Autodesk.Viewing.Extensions.Markups.Core.Utils");a.prototype=Object.create(Autodesk.Viewing.Extension.prototype),a.prototype.constructor=a,b.MarkupsCore=a,b.EVENT_ENTER_EDIT_MODE="EVENT_MARKUP_CORE_ENTER_EDIT_MODE",b.EVENT_LEAVE_EDIT_MODE="EVENT_MARKUP_CORE_LEAVE_EDIT_MODE",b.EVENT_SELECTION_CHANGED="EVENT_MARKUP_SELECTION_CHANGED";var d=a.prototype;d.load=function(){var a=this.svg=c.createSvgElement("svg");c.setSvgParentAttributes(a);var d=new c.DomElementStyle;d.setAttribute("position","absolute"),d.setAttribute("left","0"),d.setAttribute("top","0"),d.setAttribute("transform","scale(1,-1)",{allBrowsers:!0}),d.setAttribute("transformOrigin","0, 0",{allBrowsers:!0}),d.setAttribute("cursor","default"),a.setAttribute("style",d.getStyleString()),this.bounds={x:0,y:0,width:0,height:0},this.input.attachTo(this),this.editFrame=new b.EditFrame(this.viewer.container,this),this.editFrame.addEventListener(b.EVENT_EDITFRAME_EDITION_START,function(){this.disableMarkupInteractions(!0)}.bind(this)),this.editFrame.addEventListener(b.EVENT_EDITFRAME_EDITION_END,function(){this.disableMarkupInteractions(!1)}.bind(this));var e=this.options.markupToolClass||b.MarkupTool;return this.markupTool=new e,this.markupTool.setCoreExtension(this),this.markupTool.setHotkeysEnabled(!this.options.markupDisableHotkeys),this.viewer.toolController.registerTool(this.markupTool),!0},d.unload=function(){this.hide(),this.input.detachFrom(this),this.markupTool&&(this.viewer.toolController.deregisterTool(this.markupTool),this.markupTool=null);var a=this.svg;return a&&this.onMouseDownBinded&&(a.removeEventListener("mousedown",this.onMouseDownBinded),this.onMouseDownBinded=null),a.parentNode&&a.parentNode.removeChild(a),this.editModeSvgLayerNode=null,this.svg=null,!0},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.toggleEditMode=function(){this.duringEditMode?this.leaveEditMode():this.enterEditMode()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.enterEditMode=function(){return this.duringEditMode?!0:this.duringViewMode||this.show()?(this.editModeSvgLayerNode||(this.editModeSvgLayerNode=c.createSvgElement("g")),this.svg.insertBefore(this.editModeSvgLayerNode,this.svg.firstChild),this.input.enterEditMode(),this.viewer.setActiveNavigationTool(this.markupTool.getName()),this.allowNavigation(!1),this.changeEditMode(new b.EditModeArrow(this)),this.actionManager.clear(),this.styles={},this.duringEditMode=!0,!0):!1},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.leaveEditMode=function(){var a=!0,b=!1;if(!this.duringEditMode||!this.duringViewMode)return a;var c=this.viewer;return c?(this.svg.removeChild(this.editModeSvgLayerNode),this.input.leaveEditMode(),this.editFrame.setMarkup(null),c.setActiveNavigationTool(this.markupTool.getName()),this.allowNavigation(!0),this.editMode.destroy(),this.editMode=null,this.duringEditMode=!1,a):b},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.toggle=function(){this.duringViewMode?this.hide():this.show()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.show=function(){var a=this.viewer;return a&&a.model?this.duringViewMode||this.duringEditMode?!0:(a.addEventListener(Autodesk.Viewing.CAMERA_CHANGE_EVENT,this.onCameraChangeBinded),a.addEventListener(Autodesk.Viewing.VIEWER_RESIZE_EVENT,this.onCameraChangeBinded),a.container.appendChild(this.svg),window.addEventListener("resize",this.onViewerResizeBinded),this.input.enterViewMode(),c.hideLmvUi(a),this.onViewerRolloverObject=a.impl.rolloverObject,a.impl.rolloverObject=function(){},this.options.markupBypassOrthoCam||c.forceOrthographicCamera(a),this.cachedNavigationTool=this.viewer.getActiveNavigationTool(),a.setActiveNavigationTool(this.markupTool.getName()),this.allowNavigation(!0),this.onViewerResize(),this.onCameraChange(),this.clear(),this.svgLayersMap={},this.duringViewMode=!0,!0):!1},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.hide=function(){var a=!0,b=!1,d=this.viewer;if(!d||!this.duringViewMode)return a;if(this.duringEditMode&&!this.leaveEditMode())return b;d.removeEventListener(Autodesk.Viewing.CAMERA_CHANGE_EVENT,this.onCameraChangeBinded),d.removeEventListener(Autodesk.Viewing.VIEWER_RESIZE_EVENT,this.onCameraChangeBinded);var e=this.svg;return e.parentNode&&e.parentNode.removeChild(e),this.unloadMarkupsAllLayers(),c.removeAllMetadata(e),window.removeEventListener("resize",this.onViewerResizeBinded),this.input.leaveViewMode(),c.restoreLmvUi(d),this.viewer.impl.rolloverObject=this.onViewerRolloverObject,this.viewer.setActiveNavigationTool(this.cachedNavigationTool),this.cachedNavigationTool=null,this.duringViewMode=!1,a},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.clear=function(){for(var a=this.markups;a.length>0;){var b=a[0];this.removeMarkup(b),b.destroy()}var c=this.editModeSvgLayerNode;if(c&&c.childNodes.length>0)for(;c.childNodes.length;)c.removeChild(c.childNodes[0])},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.generateData=function(){c.removeAllMetadata(this.svg);var a=c.createSvgElement("svg");c.transferChildNodes(this.svg,a),c.transferChildNodes(this.editModeSvgLayerNode,this.svg);var b={"data-model-version":"1"},d=c.addSvgMetadata(this.svg,b),e=[d];this.markups.forEach(function(a){var b=a.setMetadata();b&&e.push(b)});var f=c.svgNodeToString(this.svg);return e.forEach(function(a){a.parentNode.removeChild(a)}),c.transferChildNodes(this.svg,this.editModeSvgLayerNode),c.transferChildNodes(a,this.svg),a=null,f},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.renderToCanvas=function(a){this.markups.forEach(function(b){a.save(),b.renderToCanvas(a),a.restore()})},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.changeEditMode=function(a){var d=this.editMode;d&&d.destroy(),a.addEventListener(b.EVENT_EDITMODE_CREATION_BEGIN,function(){
this.disableMarkupInteractions(!0)}.bind(this)),a.addEventListener(b.EVENT_EDITMODE_CREATION_END,function(){this.disableMarkupInteractions(!1)}.bind(this)),a.addEventListener(b.EVENT_MARKUP_DESELECT,function(a){this.fireEvent(a)}.bind(this)),this.editMode=a,this.styles[a.type]=c.cloneStyle(a.getStyle()),this.fireEvent({type:b.EVENT_EDITMODE_CHANGED,target:a})},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.allowNavigation=function(a){var b=this.editMode;this.navigating=a,a?(this.svg.setAttribute("pointer-events","none"),b&&this.selectMarkup(null)):this.svg.setAttribute("pointer-events","painted"),this.markupTool.allowNavigation(a),b&&b.notifyAllowNavigation(a)},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.disableMarkupInteractions=function(a){this.markups.forEach(function(b){b.disableInteractions(a)})},d.changeInputHandler=function(a){this.input.detachFrom(this),a.attachTo(this),this.input=a,this.duringEditMode&&a.enterEditMode(),this.duringViewMode&&a.enterViewMode()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.copy=function(){this.clipboard.copy()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.cut=function(){this.clipboard.cut()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.paste=function(){this.clipboard.paste()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.undo=function(){this.actionManager.undo()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.redo=function(){this.actionManager.redo()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.isUndoStackEmpty=function(){return this.actionManager.isUndoStackEmpty()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.isRedoStackEmpty=function(){return this.actionManager.isRedoStackEmpty()},d.beginActionGroup=function(){this.actionManager.beginActionGroup()},d.closeActionGroup=function(){this.actionManager.closeActionGroup()},d.cancelActionGroup=function(){this.actionManager.cancelActionGroup()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.getId=function(){return++this.nextId},d.onEditActionHistoryChanged=function(a){var b=a.data,c=this.editMode,d=c&&c.selectedMarkup&&c.selectedMarkup.id===b.targetId;if("undo"!==b.action&&-1!==b.targetId||"undo"===b.action&&d){var e=this.getMarkup(b.targetId);this.selectMarkup(e)}this.fireEvent(a)},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.getMarkup=function(a){for(var b=this.markups,c=b.length,d=0;c>d;++d)if(b[d].id==a)return b[d];return null},d.selectMarkup=function(a){if(a)if(this.editMode.type===a.type)this.editMode.setSelection(a);else{var b=a.getEditMode();b.setSelection(null),this.changeEditMode(b),this.setStyle(a.getStyle()),this.editMode.setSelection(a)}else this.editMode.setSelection(null)},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.getSelection=function(){return this.editMode.getSelection()},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.deleteMarkup=function(a,b){var c=a.getEditMode();c.deleteMarkup(a,b)},d.addMarkup=function(a){a.setParent(this.editModeSvgLayerNode),a.addEventListener(b.EVENT_MARKUP_SELECTED,this.onMarkupSelectedBinded),a.addEventListener(b.EVENT_MARKUP_DRAGGING,this.onMarkupDraggingBinded),a.addEventListener(b.EVENT_MARKUP_ENTER_EDITION,this.onMarkupEnterEditionBinded),a.addEventListener(b.EVENT_MARKUP_CANCEL_EDITION,this.onMarkupCancelEditionBinded),a.addEventListener(b.EVENT_MARKUP_DELETE_EDITION,this.onMarkupDeleteEditionBinded),this.markups.push(a)},d.removeMarkup=function(a){a.setParent(null),a.removeEventListener(b.EVENT_MARKUP_SELECTED,this.onMarkupSelectedBinded),a.removeEventListener(b.EVENT_MARKUP_DRAGGING,this.onMarkupDraggingBinded),a.removeEventListener(b.EVENT_MARKUP_ENTER_EDITION,this.onMarkupEnterEditionBinded),a.removeEventListener(b.EVENT_MARKUP_CANCEL_EDITION,this.onMarkupCancelEditionBinded),a.removeEventListener(b.EVENT_MARKUP_DELETE_EDITION,this.onMarkupDeleteEditionBinded);var c=this.markups,d=c.indexOf(a);-1!==d&&c.splice(d,1);var e=this.editMode;if(e){var f=e.getSelection();f===a&&this.selectMarkup(null)}},d.setStyle=function(a){var b=this.styles,d=this.editMode;c.copyStyle(a,b[d.type]),d.setStyle(b[d.type])},d.getStyle=function(){return c.cloneStyle(this.styles[this.editMode.type])},d.bringToFront=function(a){this.sendMarkupTo(a,this.markups.length-1)},d.sendToBack=function(a){this.sendMarkupTo(a,0)},d.bringForward=function(a){var b=this.markups.indexOf(a);this.sendMarkupTo(a,b+1)},d.bringBackward=function(a){var b=this.markups.indexOf(a);this.sendMarkupTo(a,b-1)},d.sendMarkupTo=function(a,b){var c=this.markups,d=c.indexOf(a);-1!==d||0>b||b>=c.length||(c.splice(d,1),b=d>b?b-1:b,c.splice(b,0,a),a.setParent(null),a.setParent(this.editModeSvgLayerNode))},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.loadMarkups=function(a,b){if(!this.duringViewMode)return!1;if(!b)return console.warn("loadMarkups failed; missing 2nd argument 'layerId'"),!1;var d=c.stringToSvgNode(a);if(!d)return!1;c.removeAllMetadata(d);var e=this.svgLayersMap[b];e||(e=c.createSvgElement("g"),this.svg.appendChild(e),this.svgLayersMap[b]=e);for(var f=d.childNodes;f.length;)e.appendChild(f[0]);return!0},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.unloadMarkups=function(a){if(!a)return console.warn("unloadMarkups failed; No layerId provided."),!1;var b=this.svgLayersMap[a];return b?(this.svg.removeChild(b),delete this.svgLayersMap[a],!0):!1},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.unloadMarkupsAllLayers=function(){for(var a in this.svgLayersMap)this.svgLayersMap.hasOwnProperty(a)&&this.svg.removeChild(this.svgLayersMap[a]);this.svgLayersMap={}},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.hideMarkups=function(a){if(!a)return console.warn("hideMarkups failed; No layerId provided."),!1;var b=this.svgLayersMap[a];return b?void b.setAttribute("visibility","hidden"):!1},Autodesk.Viewing.Extensions.Markups.Core.MarkupsCore.prototype.showMarkups=function(a){if(!a)return console.warn("showMarkups failed; No layerId provided."),!1;var b=this.svgLayersMap[a];return b?void b.setAttribute("visibility","visible"):!1},d.positionFromClientToMarkups=function(a,b){return this.clientToMarkups(a,b)},d.positionFromMarkupsToClient=function(a,b){return this.markupsToClient(a,b)},d.sizeFromClientToMarkups=function(a,b){var c=this.clientToMarkups(0,0),d=this.clientToMarkups(a,b);return{x:Math.abs(d.x-c.x),y:Math.abs(d.y-c.y)}},d.sizeFromMarkupsToClient=function(a,b){var c=this.markupsToClient(0,0),d=this.markupsToClient(a,b);return{x:Math.abs(d.x-c.x),y:Math.abs(d.y-c.y)}},d.markupsToClient=function(a,b){var d=new THREE.Vector3(a,b,0),e=this.viewer.impl.camera;return d.applyMatrix4(e.matrixWorld),d.sub(e.position),d=c.worldToClient(d,this.viewer,!1)},d.clientToMarkups=function(a,b){var d=c.clientToWorld(a,b,0,this.viewer),e=this.viewer.impl.camera;return d.add(e.position).applyMatrix4(e.matrixWorldInverse),d.z=0,d},d.getSvgViewBox=function(a,b){var c=this.clientToMarkups(0,0),d=this.clientToMarkups(a,b),e=Math.min(c.x,d.x),f=Math.min(c.y,d.y),g=Math.max(c.x,d.x),h=Math.max(c.y,d.y);return[e,f,g-e,h-f].join(" ")},d.getBounds=function(){return this.bounds},d.getMousePosition=function(){return this.input.getMousePosition()},d.onCameraChange=function(a){var b=this.getSvgViewBox(this.bounds.width,this.bounds.height);if("NaN NaN NaN NaN"!==b){this.svg.setAttribute("viewBox",b);var c=this.editMode;if(c){var d=c.getSelection();this.editFrame.setMarkup(d)}}},d.onViewerResize=function(a){var b=this.viewer.container.getBoundingClientRect();this.bounds.x=0,this.bounds.y=0,this.bounds.width=b.width,this.bounds.height=b.height,this.svg.setAttribute("width",this.bounds.width),this.svg.setAttribute("height",this.bounds.height);var c=this.getSvgViewBox(this.bounds.width,this.bounds.height);"NaN NaN NaN NaN"!==c&&this.svg.setAttribute("viewBox",c)},d.onMouseMove=function(){return this.navigating?void 0:this.editFrame.isActive()?void this.editFrame.onMouseMove():void(this.editMode&&this.editMode.onMouseMove())},d.onMouseDown=function(a){if(!this.navigating){c.dismissLmvHudMessage();var b=this.getBounds(),d=this.getMousePosition();d.x>=b.x&&d.x<=b.x+b.width&&d.y>=b.y&&d.y<=b.y+b.height&&this.editMode.onMouseDown(),this.editMode.creating||a.target!==this.svg||this.selectMarkup(null),this.ignoreNextMouseUp=!1}},d.onMouseUp=function(){return this.navigating?void 0:this.editFrame.isActive()?void this.editFrame.onMouseUp():void(this.ignoreNextMouseUp||this.editMode.onMouseUp())},d.onMarkupSelected=function(a){this.selectMarkup(a.markup),this.fireEvent(a)},d.onMarkupDragging=function(a){a.dragging?this.editMode.startDragging():this.editMode.finishDragging()},d.onMarkupEnterEdition=function(a){},d.onMarkupCancelEdition=function(a){this.editMode.unselect()},d.onMarkupDeleteEdition=function(a){this.removeMarkup(a.markup),this.editMode.deleteMarkup()},Autodesk.Viewing.theExtensionManager.registerExtension("Autodesk.Viewing.MarkupsCore",a)}(),function(){"use strict";function a(a,c,d,e){b.EditAction.call(this,a,"CLONE-MARKUP",c),this.clone=d.clone(),this.clone.id=c,this.position={x:e.x,y:e.y}}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){var a=this.editor,b=this.clone,c=this.position;if(!a.getMarkup(this.targetId)){var d=b.clone();d.setPosition(c.x,c.y),a.addMarkup(d)}},c.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&this.editor.removeMarkup(a)},b.CloneMarkup=a}(),function(){"use strict";function a(a,d,e,f,g){b.EditAction.call(this,a,"CREATE-ARROW",d),this.selectOnExecution=!1,this.tail=f,this.head=e,this.style=c.cloneStyle(g)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var d=a.prototype;d.redo=function(){var a=this.editor,c=new b.MarkupArrow(this.targetId,a);a.addMarkup(c),c.set(this.head.x,this.head.y,this.tail.x,this.tail.y),c.setStyle(this.style),c.created()},d.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&this.editor.removeMarkup(a)},b.CreateArrow=a}(),function(){"use strict";function a(a,d,e,f,g,h){b.EditAction.call(this,a,"CREATE-CIRCLE",d),this.selectOnExecution=!1,this.position={x:e.x,y:e.y},this.size={x:f.x,y:f.y},this.rotation=g,this.style=c.cloneStyle(h)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var d=a.prototype;d.redo=function(){var a=this.editor,c=new b.MarkupCircle(this.targetId,a);a.addMarkup(c),c.set(this.position,this.size),c.setRotation(this.rotation),c.setStyle(this.style),c.created()},d.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&this.editor.removeMarkup(a)},b.CreateCircle=a}(),function(){"use strict";function a(a,d,e,f,g,h){b.EditAction.call(this,a,"CREATE-CLOUD",d),this.selectOnExecution=!1,this.position={x:e.x,y:e.y},this.size={x:f.x,y:f.y},this.rotation=g,this.style=c.cloneStyle(h)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var d=a.prototype;d.redo=function(){var a=this.editor,c=new b.MarkupCloud(this.targetId,a);a.addMarkup(c),c.set(this.position,this.size),c.setRotation(this.rotation),c.setStyle(this.style),c.created()},d.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&this.editor.removeMarkup(a)},b.CreateCloud=a}(),function(){"use strict";function a(a,d,e,f,g,h,i){b.EditAction.call(this,a,"CREATE-FREEHAND",d),this.selectOnExecution=!1,this.position=e,this.size=f,this.rotation=g,this.movements=h.concat(),this.style=c.cloneStyle(i)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var d=a.prototype;d.redo=function(){var a=this.editor,c=new b.MarkupFreehand(this.targetId,a);a.addMarkup(c),c.set(this.position,this.size,this.movements),c.setRotation(this.rotation),c.setStyle(this.style),c.created()},d.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&this.editor.removeMarkup(a)},b.CreateFreehand=a}(),function(){"use strict";function a(a,d,e,f,g,h){b.EditAction.call(this,a,"CREATE-RECTANGLE",d),this.selectOnExecution=!1,this.position={x:e.x,y:e.y},this.size={x:f.x,y:f.y},this.rotation=g,this.style=c.cloneStyle(h)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var d=a.prototype;d.redo=function(){var a=this.editor,c=new b.MarkupRectangle(this.targetId,a);a.addMarkup(c),c.set(this.position,this.size),c.setRotation(this.rotation),c.setStyle(this.style),c.created()},d.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&this.editor.removeMarkup(a)},b.CreateRectangle=a}(),function(){"use strict";function a(a,d,e,f,g,h){b.EditAction.call(this,a,"CREATE-TEXT",d),this.text=g,this.position={x:e.x,y:e.y},this.size={x:f.x,y:f.y},this.style=c.cloneStyle(h)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var d=a.prototype;d.redo=function(){var a=this.editor,c=this.position,d=this.size,e=new b.MarkupText(this.targetId,a,d);a.addMarkup(e),e.setSize(c,d.x,d.y),e.setText(this.text),e.setStyle(this.style),e.forceRedraw()},d.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&(this.editor.removeMarkup(a),a.destroy())},b.CreateText=a}(),function(){"use strict";function a(a,c){b.EditAction.call(this,a,"DELETE-ARROW",c.id),this.createArrow=new b.CreateArrow(a,c.id,c.head,c.tail,c.getStyle())}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.createArrow.undo()},c.undo=function(){this.createArrow.redo()},b.DeleteArrow=a}(),function(){"use strict";function a(a,c){b.EditAction.call(this,a,"DELETE-CIRCLE",c.id),this.createCircle=new b.CreateCircle(a,c.id,c.position,c.size,c.rotation,c.getStyle())}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.createCircle.undo()},c.undo=function(){this.createCircle.redo()},b.DeleteCircle=a}(),function(){"use strict";function a(a,c){b.EditAction.call(this,a,"DELETE-CLOUD",c.id),this.createCloud=new b.CreateCloud(a,c.id,c.position,c.size,c.rotation,c.getStyle())}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.createCloud.undo()},c.undo=function(){this.createCloud.redo()},b.DeleteCloud=a}(),function(){"use strict";function a(a,c){b.EditAction.call(this,a,"DELETE-FREEHAND",c.id),this.createFreehand=new b.CreateFreehand(a,c.id,c.position,c.size,c.rotation,c.locations,c.getStyle())}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.createFreehand.undo()},c.undo=function(){this.createFreehand.redo()},b.DeleteFreehand=a}(),function(){"use strict";var a=Autodesk.Viewing.Extensions.Markups.Core,b=function(b,c){a.EditAction.call(this,b,"DELETE-RECTANGLE",c.id),this.createRectangle=new a.CreateRectangle(b,c.id,c.position,c.size,c.rotation,c.getStyle())};b.prototype=Object.create(a.EditAction.prototype),b.prototype.constructor=b;var c=b.prototype;c.redo=function(){this.createRectangle.undo()},c.undo=function(){this.createRectangle.redo()},a.DeleteRectangle=b}(),function(){"use strict";function a(a,c){b.EditAction.call(this,a,"DELETE-TEXT",c.id);var d={x:c.position.x,y:c.position.y},e={x:c.size.x,y:c.size.y};this.createText=new b.CreateText(a,c.id,d,e,c.getText(),c.getStyle())}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.createText.undo()},c.undo=function(){this.createText.redo()},b.DeleteText=a}(),function(){"use strict";function a(){this.actions=[],this.closed=!0}var b=Autodesk.Viewing.Extensions.Markups.Core,c=a.prototype;c.open=function(){return this.closed?(this.closed=!1,!0):!1},c.close=function(){return this.closed?!1:(this.closed=!0,!0)},c.undo=function(){for(var a=this.actions,b=a.length-1,c=-1,d=b;d>=0;--d){var e=a[d];e.undo(),-1!==e.targetId&&(c=e.targetId)}return c},c.redo=function(){for(var a=this.actions,b=a.length,c=-1,d=0;b>d;++d){var e=a[d];e.redo(),-1!==e.targetId&&(c=e.targetId)}return c},c.isOpen=function(){return!this.closed},c.isClosed=function(){return this.closed},c.isEmpty=function(){return 0===this.actions.length},c.addAction=function(a){return this.closed?!1:(this.actions.push(a),this.compact(),!0)},c.compact=function(){for(var a=this.actions,b=a.length,c=0;b>c;++c){var d=a[c];if(d.isIdentity())a.splice(c,1),--b,--c;else for(var e=c+1;b>e;++e){var f=a[e];if(d.type===f.type&&d.merge(f)){a.splice(e,1),--b,--c;break}}}},b.EditActionGroup=a}(),function(){"use strict";function a(a,c,d,e){b.EditAction.call(this,a,"SET-ARROW",c.id),this.newHead={x:d.x,y:d.y},this.newTail={x:e.x,y:e.y},this.oldHead={x:c.head.x,y:c.head.y},this.oldTail={x:c.tail.x,y:c.tail.y}}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.applyState(this.targetId,this.newHead,this.newTail)},c.undo=function(){this.applyState(this.targetId,this.oldHead,this.oldTail)},c.merge=function(a){return this.targetId===a.targetId&&this.type===a.type?(this.newHead=a.newHead,this.newTail=a.newTail,!0):!1},c.applyState=function(a,b,c){var d=this.editor.getMarkup(a);if(d){var e=1e-4;(Math.abs(d.head.x-b.x)>=e||Math.abs(d.head.y-b.y)>=e||Math.abs(d.tail.x-c.x)>=e||Math.abs(d.tail.y-c.y)>=e)&&d.set(b.x,b.y,c.x,c.y)}},c.isIdentity=function(){return this.newHead.x===this.oldHead.x&&this.newHead.y===this.oldHead.y&&this.newTail.x===this.oldTail.x&&this.newTail.y===this.oldTail.y},b.SetArrow=a}(),function(){"use strict";function a(a,c,d,e){b.EditAction.call(this,a,"SET-CIRCLE",c.id),this.newPosition={x:d.x,y:d.y},this.newSize={x:e.x,y:e.y},this.oldPosition={x:c.position.x,y:c.position.y},this.oldSize={x:c.size.x,y:c.size.y}}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.applyState(this.targetId,this.newPosition,this.newSize)},c.undo=function(){this.applyState(this.targetId,this.oldPosition,this.oldSize)},c.merge=function(a){return this.targetId===a.targetId&&this.type===a.type?(this.newPosition=a.newPosition,this.newSize=a.newSize,!0):!1},c.applyState=function(a,b,c){var d=this.editor.getMarkup(a);if(d){var e=1e-4;(Math.abs(d.position.x-b.x)>e||Math.abs(d.size.y-c.y)>e||Math.abs(d.position.y-b.y)>e||Math.abs(d.size.y-c.y)>e)&&d.set(b,c)}},c.isIdentity=function(){return this.newPosition.x===this.oldPosition.x&&this.newPosition.y===this.oldPosition.y&&this.newSize.x===this.oldSize.x&&this.newSize.y===this.oldSize.y},b.SetCircle=a}(),function(){"use strict";function a(a,c,d,e){b.EditAction.call(this,a,"SET-CLOUD",c.id),this.newPosition={x:d.x,y:d.y},this.newSize={x:e.x,y:e.y},this.oldPosition={x:c.position.x,y:c.position.y},this.oldSize={x:c.size.x,y:c.size.y}}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.applyState(this.targetId,this.newPosition,this.newSize,this.newStrokeWidth,this.newColor)},c.undo=function(){this.applyState(this.targetId,this.oldPosition,this.oldSize,this.oldStrokeWidth,this.oldColor)},c.merge=function(a){return this.targetId===a.targetId&&this.type===a.type?(this.newPosition=a.newPosition,this.newSize=a.newSize,!0):!1},c.applyState=function(a,b,c){var d=this.editor.getMarkup(a);if(d){var e=1e-4;(Math.abs(d.position.x-b.x)>e||Math.abs(d.size.y-c.y)>e||Math.abs(d.position.y-b.y)>e||Math.abs(d.size.y-c.y)>e)&&d.set(b,c)}},c.isIdentity=function(){return this.newPosition.x===this.oldPosition.x&&this.newPosition.y===this.oldPosition.y&&this.newSize.x===this.oldSize.x&&this.newSize.y===this.oldSize.y},b.SetCloud=a}(),function(){"use strict";function a(a,c,d,e,f){b.EditAction.call(this,a,"SET-FREEHAND",c.id),this.position=d,this.size=e,this.locations=f.concat()}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.set(this.position,this.size,this.locations)},c.undo=function(){},c.merge=function(a){return this.targetId===a.targetId&&this.type===a.type?(this.locations=a.locations.concat(),this.position=a.position,this.size=a.size,!0):!1},c.isIdentity=function(){return!1},b.SetFreehand=a}(),function(){"use strict";function a(a,c,d){b.EditAction.call(this,a,"SET-POSITION",c.id),this.newPosition={x:d.x,y:d.y},this.oldPosition={x:c.position.x,y:c.position.y}}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.setPosition(this.newPosition.x,this.newPosition.y)},c.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.setPosition(this.oldPosition.x,this.oldPosition.y)},c.merge=function(a){return this.targetId===a.targetId&&this.type===a.type?(this.newPosition=a.newPosition,!0):!1},c.isIdentity=function(){var a=this.newPosition,b=this.oldPosition;return a.x===b.x&&a.y===b.y},b.SetPosition=a}(),function(){"use strict";function a(a,c,d,e){b.EditAction.call(this,a,"SET-RECTANGLE",c.id),this.newPosition={x:d.x,y:d.y},this.newSize={x:e.x,y:e.y},this.oldPosition={x:c.position.x,y:c.position.y},this.oldSize={x:c.size.x,y:c.size.y}}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){this.applyState(this.targetId,this.newPosition,this.newSize)},c.undo=function(){this.applyState(this.targetId,this.oldPosition,this.oldSize)},c.merge=function(a){return this.targetId===a.targetId&&this.type===a.type?(this.newPosition=a.newPosition,this.newSize=a.newSize,!0):!1},c.applyState=function(a,b,c){var d=this.editor.getMarkup(a);if(d){var e=1e-4;(Math.abs(d.position.x-b.x)>e||Math.abs(d.size.y-c.y)>e||Math.abs(d.position.y-b.y)>e||Math.abs(d.size.y-c.y)>e)&&d.set(b,c)}},c.isIdentity=function(){return this.newPosition.x===this.oldPosition.x&&this.newPosition.y===this.oldPosition.y&&this.newSize.x===this.oldSize.x&&this.newSize.y===this.oldSize.y},b.SetRectangle=a}(),function(){"use strict";function a(a,c,d){b.EditAction.call(this,a,"SET-ROTATION",c.id);var e=c.getRotation();this.newRotation={angle:d},this.oldRotation={angle:e}}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.setRotation(this.newRotation.angle)},c.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.setRotation(this.oldRotation.angle)},c.merge=function(a){return this.targetId===a.targetId&&this.type===a.type?(this.newRotation=a.newRotation,!0):!1},c.isIdentity=function(){return this.newRotation.angle===this.oldRotation.angle},b.SetRotation=a}(),function(){"use strict";function a(a,c,d,e,f){b.EditAction.call(this,a,"SET-SIZE",c.id),this.newPosition={x:d.x,y:d.y},this.oldPosition={x:c.position.x,y:c.position.y},this.newWidth=e,this.oldWidth=c.size.x,this.newHeight=f,this.oldHeight=c.size.y}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.setSize(this.newPosition,this.newWidth,this.newHeight)},c.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.setSize(this.oldPosition,this.oldWidth,this.oldHeight)},c.merge=function(a){return this.targetId===a.targetId&&this.type===a.type?(this.newPosition=a.newPosition,this.newWidth=a.newWidth,this.newHeight=a.newHeight,!0):!1},c.isIdentity=function(){var a=this.newPosition.x===this.oldPosition.x&&this.newPosition.y===this.oldPosition.y&&this.newWidth===this.oldWidth&&this.newHeight===this.oldHeight;return a},b.SetSize=a}(),function(){"use strict";function a(a,d,e){b.EditAction.call(this,a,"SET-STYLE",d.id),this.newStyle=c.cloneStyle(e),this.oldStyle=d.getStyle()}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var d=a.prototype;d.redo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.setStyle(this.newStyle)},d.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.setStyle(this.oldStyle)},b.SetStyle=a}(),function(){"use strict";function a(a,c,d,e,f){b.EditAction.call(this,a,"SET-TEXT",c.id),this.newPosition={x:d.x,y:d.y},this.oldPosition={x:c.position.x,y:c.position.y},this.newSize={x:e.x,y:e.y},this.oldSize={x:c.size.x,y:c.size.y},this.newText=f,this.oldText=c.getText()}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditAction.prototype),a.prototype.constructor=a;var c=a.prototype;c.redo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.set(this.newPosition,this.newSize,this.newText)},c.undo=function(){var a=this.editor.getMarkup(this.targetId);a&&a.set(this.oldPosition,this.oldSize,this.oldText)},b.SetText=a}(),function(){"use strict";function a(a){this.editor=a,this.content=null,this.pastePosition={x:0,y:0},c.addTraitEventDispatcher(this)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils,d=a.prototype;d.copy=function(){var a=this.editor.getSelection();a&&(this.content=a.clone(),this.pastePosition.x=a.position.x,this.pastePosition.y=a.position.y)},d.cut=function(){var a=this.editor.getSelection();a&&(this.copy(),this.editor.deleteMarkup(a))},d.paste=function(){var a=this.content;if(a){var c=this.editor,d=this.pastePosition,e=c.sizeFromClientToMarkups(20,20);d.x+=e.x,d.y-=e.y;var f=new b.CloneMarkup(c,c.getId(),a,d);f.execute()}},b.Clipboard=a}(),function(){"use strict";function a(){this.editor=null,this.mousePosition={x:0,y:0},this.makeSameXY=!1,this.snapRotations=!1,this.keepAspectRatio=!1,this.constrainAxis=!1,this.onHammerDragBinded=this.onHammerDrag.bind(this),this.onSingleTapBinded=this.onSingleTap.bind(this),this.onMouseMoveBinded=this.onMouseMove.bind(this),this.onMouseUpBinded=this.onMouseUp.bind(this),this.onMouseDownBinded=this.onMouseDown.bind(this)}function b(a,b){var c=a.editor.svg.getBoundingClientRect();a.makeSameXY=b.shiftKey,a.snapRotations=b.shiftKey,a.keepAspectRatio=b.shiftKey,a.constrainAxis=b.shiftKey,a.mousePosition.x=b.clientX-c.left,a.mousePosition.y=b.clientY-c.top}function c(a){a.shiftKey=!1,a.clientX=a.pointers[0].clientX,a.clientY=a.pointers[0].clientY}var d=Autodesk.Viewing.Extensions.Markups.Core,e=Autodesk.Viewing.Extensions.Markups.Core.Utils,f=a.prototype;f.attachTo=function(a){this.editor&&this.detachFrom(this.editor),this.editor=a,e.isTouchDevice()&&(this.hammer=new Hammer.Manager(a.svg,{recognizers:[[Hammer.Pan,{event:"drag",pointers:1}],[Hammer.Tap,{event:"singletap",pointers:1,threshold:2}]],inputClass:Hammer.TouchInput}))},f.detachFrom=function(a){this.hammer&&this.hammer.destroy(),document.removeEventListener("mousemove",this.onMouseMoveBinded,!0),document.removeEventListener("mouseup",this.onMouseUpBinded,!0),this.editor&&this.editor.svg.removeEventListener("mousedown",this.onMouseDownBinded),this.editor=a},f.enterEditMode=function(){this.hammer?(this.hammer.on("dragstart dragmove dragend",this.onHammerDragBinded),this.hammer.on("singletap",this.onSingleTapBinded)):(document.addEventListener("mousemove",this.onMouseMoveBinded,!0),document.addEventListener("mouseup",this.onMouseUpBinded,!0),this.editor.svg.addEventListener("mousedown",this.onMouseDownBinded))},f.leaveEditMode=function(){this.hammer?(this.hammer.off("dragstart dragmove dragend",this.onHammerDragBinded),this.hammer.off("singletap",this.onSingleTapBinded)):(document.removeEventListener("mousemove",this.onMouseMoveBinded,!0),document.removeEventListener("mouseup",this.onMouseUpBinded,!0),this.editor.svg.removeEventListener("mousedown",this.onMouseDownBinded))},f.enterViewMode=function(){},f.leaveViewMode=function(){},f.getMousePosition=function(){return{x:this.mousePosition.x,y:this.mousePosition.y}},f.onMouseMove=function(a){b(this,a),this.editor.onMouseMove()},f.onMouseDown=function(a){b(this,a),this.editor.onMouseDown(a)},f.onMouseUp=function(a){b(this,a),this.editor.onMouseUp()},f.onHammerDrag=function(a){switch(c(a),a.type){case"dragstart":this.onMouseDown(a);break;case"dragmove":this.onMouseMove(a);break;case"dragend":this.onMouseUp(a)}},f.onSingleTap=function(a){c(a),this.onMouseDown(a),this.onMouseUp(a)},d.InputHandler=a}(),function(){"use strict";function a(a,b,d){this.editor=a,this.viewer=a.viewer,this.type=b,this.selectedMarkup=null,this.dragging=!1,this.draggingAnnotationIniPosition=null,this.draggingMouseIniPosition=new THREE.Vector2,this.initialX=0,this.initialY=0,this.minSize=9,this.creating=!1,this.size={x:0,y:0},this.style=c.createStyle(d,this.viewer),c.addTraitEventDispatcher(this)}var b=Autodesk.Viewing.Extensions.Markups.Core,c=Autodesk.Viewing.Extensions.Markups.Core.Utils;b.EVENT_EDITMODE_CREATION_BEGIN="EVENT_EDITMODE_CREATION_BEGIN",b.EVENT_EDITMODE_CREATION_END="EVENT_EDITMODE_CREATION_END",b.EVENT_MARKUP_DESELECT="EVENT_MARKUP_DESELECT";var d=a.prototype;d.destroy=function(){this.unselect(),c.removeTraitEventDispatcher(this)},d.unselect=function(){var a=!1,c=this.selectedMarkup;c&&(c.unselect(),this.selectedMarkup=null,a=!0),this.editor.editFrame.setMarkup(null),a&&this.fireEvent({type:b.EVENT_MARKUP_DESELECT})},d.createBegin=function(){this.creating||(this.creating=!0,this.fireEvent({type:b.EVENT_EDITMODE_CREATION_BEGIN}))},d.createEnd=function(){this.creating&&(this.creating=!1,this.fireEvent({type:b.EVENT_EDITMODE_CREATION_END}))},d.setStyle=function(a){this.style=a;var c=this.selectedMarkup;if(c){var d=new b.SetStyle(this.editor,c,a);d.execute()}},d.getStyle=function(){return this.style},d.setSelection=function(a){this.selectedMarkup!==a&&(this.unselect(),a&&a.select()),this.selectedMarkup=a;var b=this.editor;a&&b.bringToFront(a),this.creating||b.editFrame.setMarkup(a)},d.getSelection=function(){return this.selectedMarkup},d.deleteMarkup=function(a,b){return!1},d.isMinSizeValid=function(){if(0===this.minSize)return!0;var a=this.editor.sizeFromMarkupsToClient(this.size.x,this.size.y);return a.x*a.x+a.y*a.y>=this.minSize*this.minSize},d.startDragging=function(){var a=this.selectedMarkup,b=this.editor.getMousePosition();a&&(this.dragging=!0,this.draggingAnnotationIniPosition=a.getClientPosition(),this.draggingMouseIniPosition.set(b.x,b.y))},d.finishDragging=function(){var a=this.dragging,b=this.selectedMarkup;this.dragging=!1,b&&a&&b.finishDragging()},d.getFinalMouseDraggingPosition=function(){var a=this.editor,b=a.getBounds(),d=a.getMousePosition(),e=this.initialX,f=this.initialY,g=Math.min(Math.max(b.x,d.x),b.x+b.width),h=Math.min(Math.max(b.y,d.y),b.y+b.height);if(g==e&&h==f&&(g++,h++),a.input.makeSameXY){var i=Math.abs(g-e),j=Math.abs(h-f),k=Math.max(i,j);g=e+k*c.sign(g-e),h=f+k*c.sign(h-f)}return{x:g,y:h}},d.notifyAllowNavigation=function(a){},d.onMouseDown=function(){},d.onMouseUp=function(a){if(this.selectedMarkup&&this.creating&&!this.isMinSizeValid())return this.createEnd(),
this.editor.cancelActionGroup(),void(this.selectedMarkup=null);this.finishDragging();var b=this.selectedMarkup;b&&this.creating&&(b.created(),this.createEnd(),this.editor.closeActionGroup(),this.unselect())},d.onMouseMove=function(a){},d.onDoubleClick=function(a){},d.cancelMarkupCreation=function(){this.createEnd(),this.editor.cancelActionGroup(),this.selectedMarkup=null},d.getDraggingPosition=function(){var a=this.editor.getMousePosition(),b=a.x-this.draggingMouseIniPosition.x,c=a.y-this.draggingMouseIniPosition.y;return{x:this.draggingAnnotationIniPosition.x+b,y:this.draggingAnnotationIniPosition.y+c}},d.isInsideBounds=function(a,b,c){return a>=c.x&&a<=c.x+c.width&&b>=c.y&&b<=c.y+c.height},b.EditMode=a}(),function(){"use strict";function a(a){var c=["stroke-width","stroke-color","stroke-opacity"];b.EditMode.call(this,a,b.MARKUP_TYPE_ARROW,c)}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditMode.prototype),a.prototype.constructor=a;var c=a.prototype;c.deleteMarkup=function(a,c){if(a=a||this.selectedMarkup,a&&a.type==this.type){var d=new b.DeleteArrow(this.editor,a);return d.addToHistory=!c,d.execute(),!0}return!1},c.onMouseDown=function(){if(b.EditMode.prototype.onMouseDown.call(this),!this.selectedMarkup){var a=this.editor.getMousePosition();this.initialX=a.x,this.initialY=a.y;var c=1,d={x:this.initialX,y:this.initialY},e={x:Math.round(d.x+Math.cos(.25*Math.PI)*c),y:Math.round(d.y+Math.sin(.25*-Math.PI)*c)},f=function(a,b,c,d){this.isInsideBounds(b.x,b.y,d)||(b.y=Math.round(a.y+Math.sin(.25*Math.PI)*c),this.isInsideBounds(b.x,b.y,d)||(b.x=Math.round(a.y+Math.cos(.25*-Math.PI)*c),this.isInsideBounds(b.x,b.y,d)||(b.y=Math.round(a.y+Math.sin(.25*-Math.PI)*c))))}.bind(this),g=this.editor;f(d,e,c,g.getBounds()),g.beginActionGroup(),d=g.positionFromClientToMarkups(d.x,d.y),e=g.positionFromClientToMarkups(e.x,e.y),this.size={x:e.x-d.x,y:e.y-d.y};var h=g.getId(),i=new b.CreateArrow(g,h,d,e,this.style);i.execute(),this.selectedMarkup=g.getMarkup(h),this.createBegin()}},c.onMouseMove=function(a){b.EditMode.prototype.onMouseMove.call(this,a);var c=this.selectedMarkup;if(c&&this.creating){var d=this.editor,e=this.getFinalMouseDraggingPosition(),f=d.positionFromClientToMarkups(this.initialX,this.initialY),g=d.positionFromClientToMarkups(e.x,e.y);this.size={x:g.x-f.x,y:g.y-f.y};var h=new b.SetArrow(d,c,f,g);h.execute()}},b.EditModeArrow=a}(),function(){"use strict";function a(a){var c=["stroke-width","stroke-color","stroke-opacity","fill-color","fill-opacity"];b.EditMode.call(this,a,b.MARKUP_TYPE_CIRCLE,c)}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditMode.prototype),a.prototype.constructor=a;var c=a.prototype;c.deleteMarkup=function(a,c){if(a=a||this.selectedMarkup,a&&a.type==this.type){var d=new b.DeleteCircle(this.editor,a);return d.addToHistory=!c,d.execute(),!0}return!1},c.onMouseMove=function(a){b.EditMode.prototype.onMouseMove.call(this,a);var c=this.selectedMarkup;if(c&&this.creating){var d=this.editor,e=this.initialX,f=this.initialY,g=this.getFinalMouseDraggingPosition(),h=d.clientToMarkups((e+g.x)/2,(f+g.y)/2),i=this.size=d.sizeFromClientToMarkups(g.x-e,g.y-f),j=new b.SetCircle(d,c,h,i);j.execute()}},c.onMouseDown=function(){if(b.EditMode.prototype.onMouseDown.call(this),!this.selectedMarkup){var a=this.editor,c=a.getMousePosition();this.initialX=c.x,this.initialY=c.y;var d=a.clientToMarkups(this.initialX,this.initialY),e=this.size=a.sizeFromClientToMarkups(1,1);a.beginActionGroup();var f=a.getId(),g=new b.CreateCircle(a,f,d,e,0,this.style);g.execute(),this.selectedMarkup=a.getMarkup(f),this.createBegin()}},b.EditModeCircle=a}(),function(){"use strict";function a(a){var c=["stroke-width","stroke-color","stroke-opacity","fill-color","fill-opacity"];b.EditMode.call(this,a,b.MARKUP_TYPE_CLOUD,c)}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditMode.prototype),a.prototype.constructor=a;var c=a.prototype;c.deleteMarkup=function(a,c){if(a=a||this.selectedMarkup,a&&a.type==this.type){var d=new b.DeleteCloud(this.editor,a);return d.addToHistory=!c,d.execute(),!0}return!1},c.onMouseMove=function(a){b.EditMode.prototype.onMouseMove.call(this,a);var c=this.selectedMarkup;if(c&&this.creating){var d=this.editor,e=this.initialX,f=this.initialY,g=this.getFinalMouseDraggingPosition(),h=d.clientToMarkups((e+g.x)/2,(f+g.y)/2),i=this.size=d.sizeFromClientToMarkups(g.x-e,g.y-f),j=new b.SetCloud(d,c,h,i);j.execute()}},c.onMouseDown=function(){if(b.EditMode.prototype.onMouseDown.call(this),!this.selectedMarkup){var a=this.editor,c=a.getMousePosition();this.initialX=c.x,this.initialY=c.y;var d=a.clientToMarkups(this.initialX,this.initialY),e=this.size=a.sizeFromClientToMarkups(1,1);a.beginActionGroup();var f=a.getId(),g=new b.CreateCloud(a,f,d,e,0,this.style);g.execute(),this.selectedMarkup=a.getMarkup(f),this.createBegin()}},b.EditModeCloud=a}(),function(){"use strict";function a(a){var c=["stroke-width","stroke-color","stroke-opacity"];b.EditMode.call(this,a,b.MARKUP_TYPE_FREEHAND,c),this.style["stroke-opacity"]=.75}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditMode.prototype),a.prototype.constructor=a;var c=a.prototype;c.deleteMarkup=function(a,c){if(a=a||this.selectedMarkup,a&&a.type==this.type){var d=new b.DeleteFreehand(this.editor,a);return d.addToHistory=!c,d.execute(),!0}return!1},c.onMouseMove=function(a){b.EditMode.prototype.onMouseMove.call(this,a);var c=this.selectedMarkup;if(c&&this.creating){var d=this.editor,e=d.getMousePosition(),f=this.movements,g=d.clientToMarkups(e.x,e.y);f.push(g);var h=function(a,b){var c=a.map(function(a){return a[b]});return Math.min.apply(null,c)},i=function(a,b){var c=a.map(function(a){return a[b]});return Math.max.apply(null,c)},j=h(f,"x"),k=h(f,"y"),l=i(f,"x"),m=i(f,"y"),n=l-j,o=m-k,p={x:j+.5*n,y:k+.5*o},q=this.size={x:n,y:o},r=f.map(function(a){return{x:a.x-p.x,y:a.y-p.y}}),s=new b.SetFreehand(d,c,p,q,r);s.execute()}},c.onMouseDown=function(){if(b.EditMode.prototype.onMouseDown.call(this),!this.selectedMarkup){var a=this.editor,c=a.getMousePosition();this.initialX=c.x,this.initialY=c.y;var d=a.clientToMarkups(this.initialX,this.initialY);this.movements=[d];var e=this.size=a.sizeFromClientToMarkups(1,1);a.beginActionGroup();var f=a.getId(),g=new b.CreateFreehand(a,f,d,e,0,[{x:0,y:0}],this.style);g.execute(),this.selectedMarkup=a.getMarkup(f),this.createBegin()}},b.EditModeFreehand=a}(),function(){"use strict";function a(a){var c=["stroke-width","stroke-color","stroke-opacity","fill-color","fill-opacity"];b.EditMode.call(this,a,b.MARKUP_TYPE_RECTANGLE,c)}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditMode.prototype),a.prototype.constructor=a;var c=a.prototype;c.deleteMarkup=function(a,c){if(a=a||this.selectedMarkup,a&&a.type==this.type){var d=new b.DeleteRectangle(this.editor,a);return d.addToHistory=!c,d.execute(),!0}return!1},c.setStyle=function(a){b.EditMode.prototype.setStyle.call(this,a);var c=this.selectedMarkup;if(c){var d=new b.SetRectangle(this.editor,c,c.position,c.size);d.execute()}},c.onMouseMove=function(a){b.EditMode.prototype.onMouseMove.call(this,a);var c=this.selectedMarkup;if(c&&this.creating){var d=this.editor,e=this.initialX,f=this.initialY,g=this.getFinalMouseDraggingPosition(),h=d.clientToMarkups((e+g.x)/2,(f+g.y)/2),i=this.size=d.sizeFromClientToMarkups(g.x-e,g.y-f),j=new b.SetRectangle(d,c,h,i);j.execute()}},c.onMouseDown=function(){if(b.EditMode.prototype.onMouseDown.call(this),!this.selectedMarkup){var a=this.editor,c=a.getMousePosition();this.initialX=c.x,this.initialY=c.y;var d=a.clientToMarkups(this.initialX,this.initialY),e=this.size=a.sizeFromClientToMarkups(1,1);a.beginActionGroup();var f=a.getId(),g=new b.CreateRectangle(a,f,d,e,0,this.style);g.execute(),this.selectedMarkup=a.getMarkup(f),this.createBegin()}},b.EditModeRectangle=a}(),function(){"use strict";function a(a){var c=["font-size","stroke-color","stroke-opacity","fill-color","fill-opacity","font-family","font-style","font-weight"];b.EditMode.call(this,a,b.MARKUP_TYPE_TEXT,c),this.style["fill-color"]="#ffffff";var d=new b.EditorTextInput(this.viewer.container,this.editor);d.addEventListener(d.EVENT_TEXT_CHANGE,this.onHelperTextChange.bind(this),!1),this.textInputHelper=d,this.onHistoryChangeBinded=this.onHistoryChange.bind(this),this.minSize=0}var b=Autodesk.Viewing.Extensions.Markups.Core;a.prototype=Object.create(b.EditMode.prototype),a.prototype.constructor=a;var c=a.prototype;c.deleteMarkup=function(a,c){if(a=a||this.selectedMarkup,a&&a.type==this.type){var d=new b.DeleteText(this.editor,a);return d.addToHistory=!c,d.execute(),!0}return!1},c.onMouseDown=function(){if(this.textInputHelper.isActive())return void this.textInputHelper.acceptAndExit();if(!this.selectedMarkup){var a=this.editor,c=a.getMousePosition(),d=a.sizeFromMarkupsToClient(0,this.style["font-size"]).y,e=15*d,f=3*d,g=this.size=a.sizeFromClientToMarkups(e,f),h=a.positionFromClientToMarkups(c.x+.5*e,c.y+.5*f);a.beginActionGroup();var i=new b.CreateText(a,a.getId(),h,g,"",this.style);i.execute(),this.createBegin(),this.createEnd(),this.selectedMarkup=a.getMarkup(i.targetId),this.textInputHelper.setActive(this.selectedMarkup,!0),this.editor.actionManager.addEventListener(b.EVENT_HISTORY_CHANGED,this.onHistoryChangeBinded)}},c.onDoubleClick=function(a){a===this.selectedMarkup&&(this.editor.selectMarkup(null),this.textInputHelper.setActive(a,!1))},c.onHelperTextChange=function(a){var c=a.data,d=c.markup,e=c.style;if(this.editor.actionManager.removeEventListener(b.EVENT_HISTORY_CHANGED,this.onHistoryChangeBinded),""===c.newText){if(c.firstEdit)return this.editor.cancelActionGroup(),void this.editor.selectMarkup(null);var f=new b.DeleteText(this.editor,d);return f.execute(),void this.editor.selectMarkup(null)}c.firstEdit||this.editor.beginActionGroup();var g=this.editor.positionFromClientToMarkups(c.newPos.x,c.newPos.y),h=this.editor.sizeFromClientToMarkups(c.width,c.height),i=new b.SetSize(this.editor,d,g,h.x,h.y);i.execute();var j=new b.SetText(this.editor,d,d.position,d.size,c.newText);j.execute();var k=new b.SetStyle(this.editor,d,e);k.execute(),this.editor.closeActionGroup(),this.editor.selectMarkup(null),d.forceRedraw()},c.setStyle=function(a){if(this.textInputHelper.isActive())this.textInputHelper.setStyle(a);else{b.EditMode.prototype.setStyle.call(this,a);var c=this.selectedMarkup;c&&c.forceRedraw()}},c.onHistoryChange=function(a){this.textInputHelper.isActive()&&(this.editor.actionManager.removeEventListener(b.EVENT_HISTORY_CHANGED,this.onHistoryChangeBinded),this.textInputHelper.setInactive())},c.notifyAllowNavigation=function(a){a&&this.textInputHelper.isActive()&&this.textInputHelper.acceptAndExit()},c.destroy=function(){this.textInputHelper&&(this.textInputHelper.isActive()&&this.textInputHelper.acceptAndExit(),this.textInputHelper.destroy(),this.textInputHelper=null),b.EditMode.prototype.destroy.call(this)},b.EditModeText=a}(),function(){"use strict";function a(a,b){this.parentDiv=a,this.editor=b,this.EVENT_TEXT_CHANGE="EVENT_CO2_TEXT_CHANGE",this.textArea=document.createElement("textarea"),this.textArea.setAttribute("maxlength","260"),this.textArea.setAttribute("placeholder",e.Localization.MARKUP_TEXT_DEFAULT_TEXT),this.onKeyHandlerBinded=this.onKeyHandler.bind(this),this.textArea.addEventListener("keydown",this.onKeyHandlerBinded),this.styleTextArea=new e.DomElementStyle,this.styleTextArea.setAttribute("position","absolute").setAttribute("overflow-y","hidden"),this.measureDiv=document.createElement("div"),e.addTraitEventDispatcher(this),this.onResizeBinded=this.onWindowResize.bind(this)}function b(a){if(0===a.length)return"";for(var b=a.length-1,c=b;c>=0;--c)if(" "!==a.charAt(c)){b=c;break}return a.substr(0,b+1)}function c(a){if(0===a.length)return"";for(var b=0,c=0;c<a.length;++c)if(" "!==a.charAt(c)){b=c;break}return a.substr(b)}var d=Autodesk.Viewing.Extensions.Markups.Core,e=Autodesk.Viewing.Extensions.Markups.Core.Utils,f=a.prototype;f.destroy=function(){this.textArea.removeEventListener("keydown",this.onKeyHandlerBinded),this.setInactive()},f.setActive=function(a,b){if(this.textMarkup!==a){this.setInactive(),this.parentDiv.appendChild(this.textArea),this.textMarkup=a,this.firstEdit=b||!1,this.initFromMarkup(),window.addEventListener("resize",this.onResizeBinded);var c=this.textArea;window.requestAnimationFrame(function(){c.focus()})}},f.setInactive=function(){window.removeEventListener("resize",this.onResizeBinded),this.textMarkup&&(this.textMarkup=null,this.parentDiv.removeChild(this.textArea)),this.style=null},f.isActive=function(){return!!this.textMarkup},f.initFromMarkup=function(){var a=this.textMarkup,b=a.getClientPosition(),c=a.getClientSize(),d=b.x-.5*c.x,e=b.y-.5*c.y,f=a.lineHeight+"%";this.styleTextArea.setAttribute("line-height",f),this.setPosAndSize(d,e,c.x,c.y),this.setStyle(a.getStyle()),this.textArea.value=a.getText()},f.setPosAndSize=function(a,b,c,d){a+c>=this.editor.viewer.container.clientWidth&&(a=this.editor.viewer.container.clientWidth-(c+10)),b+d>=this.editor.viewer.container.clientHeight&&(b=this.editor.viewer.container.clientHeight-(d+10)),this.styleTextArea.setAttribute("left",a+"px").setAttribute("top",b+"px").setAttribute("width",c+"px").setAttribute("height",d+"px")},f.setStyle=function(a){if(this.style){var b={};this.injectSizeValues(b),this.setPosAndSize(b.newPos.x-.5*b.width,b.newPos.y-.5*b.height,b.width,b.height)}var c=this.editor.sizeFromMarkupsToClient(0,a["font-size"]).y,d=this.styleTextArea.setAttribute("color",a["stroke-color"]).setAttribute("font-family",a["font-family"]).setAttribute("font-size",c+"px").setAttribute("font-weight",a["font-weight"]?"bold":"").setAttribute("font-style",a["font-style"]?"italic":"").getStyleString();this.textArea.setAttribute("style",d),this.style=e.cloneStyle(a)},f.getTextValuesForMarkup=function(a){this.setActive(a,!1);var b=this.getTextValues();return this.setInactive(),b},f.getTextValues=function(){var a=this.textArea.value;return a===e.Localization.MARKUP_TEXT_DEFAULT_TEXT&&(a=""),{text:a,lines:this.generateLines()}},f.acceptAndExit=function(){var a=this.getTextValues(),b={markup:this.textMarkup,style:this.style,firstEdit:this.firstEdit,newText:a.text,newLines:a.lines};this.injectSizeValues(b),this.fireEvent({type:this.EVENT_TEXT_CHANGE,data:b}),this.setInactive()},f.injectSizeValues=function(a){var b=parseFloat(this.textArea.style.width),c=parseFloat(this.textArea.style.height),d=parseFloat(this.textArea.style.left),e=parseFloat(this.textArea.style.top);a.width=b,a.height=c,a.newPos={x:d+.5*b,y:e+.5*c}},f.onWindowResize=function(a){window.requestAnimationFrame(function(){var a=this.textArea.value;this.style=null,this.initFromMarkup(),this.textArea.value=a}.bind(this))},f.onKeyHandler=function(a){var b=a.keyCode,c=a.shiftKey;c||13!==b||(a.preventDefault(),this.acceptAndExit())},f.generateLines=function(){var a=this.textArea.value,c=a.split(/\r*\n/),d=this.styleTextArea.clone().removeAttribute(["top","left","width","height","overflow-y"]).setAttribute("position","absolute").setAttribute("white-space","nowrap").setAttribute("float","left").setAttribute("visibility","hidden").getStyleString();this.measureDiv.setAttribute("style",d),this.parentDiv.appendChild(this.measureDiv);for(var e=parseFloat(this.textArea.style.width),f=[],g=0,h=c.length;h>g;++g){var i=b(c[g]);this.splitLine(i,e,f)}return this.parentDiv.removeChild(this.measureDiv),f},f.splitLine=function(a,b,d){if(""!==a)for(var e="",f=!1;!f;){this.measureDiv.innerHTML=a;var g=this.measureDiv.clientWidth;if(b>=g)d.push(a),this.splitLine(c(e),b,d),f=!0;else{var h=this.getShorterLine(a);1===h.length?(this.splitWord(a,e,b,d),f=!0):(a=h[0],e=h[1]+e)}}},f.getShorterLine=function(a){var b=a.lastIndexOf(" ");if(-1===b)return[a];for(;" "===a.charAt(b-1);)b--;var c=a.substr(b),d=a.substr(0,b);return[d,c]},f.splitWord=function(a,b,c,d){for(var e=1,f=!0;f;){var g=a.substr(0,e);this.measureDiv.innerHTML=g;var h=this.measureDiv.clientWidth;if(h>c){if(1===e)return d.push(g),void this.splitWord(a.substr(1),b,c,d);var i=a.substr(0,e-1);d.push(i);var j=a.substr(e-1);return void this.splitLine(j+b,c,d)}if(e++,e>a.length)return void d.push(a)}},d.EditorTextInput=a}();