(void 0===window.QSI.ScreenCaptureRectangle||window.QTest)&&(QSI.ScreenCaptureRectangle=QSI.util.Class({initialize:function(a,b){this.isCanvasDirty=!1,this.rectangles=[],this.canvas=QSI.util.build("canvas",{"data-qsi-sc-class":"qsi_sc_annotations_canvas",width:a.width,height:a.height},[]),this.context=this.canvas.getContext("2d"),this.selectedRectangle=null,this.clickedObject=null,this.setupMouseListeners(),setInterval(this.mainDraw.bind(this),b)},getCanvas:function(){return this.canvas},getCleanedCanvas:function(){return this.selectedRectangle&&this.selectedRectangle.deselect(),this.isCanvasDirty=!0,this.mainDraw(),this.canvas},addRectangle:function(a,b,c,d,e,f){f||(f=1);var g=new this.Rectangle(this,a,b,c,d,e,f);this.rectangles.push(g),g.select(),this.isCanvasDirty=!0},save:function(){this.savedRectangles=[],this.cloneRectangles(this.rectangles,this.savedRectangles)},cancel:function(){this.savedRectangles?this.cloneRectangles(this.savedRectangles,this.rectangles):this.rectangles=[],this.isCanvasDirty=!0},cloneRectangles:function(a,b){b.splice(0,b.length);for(var c=0;cthis.canvas.width||b.y<0||b.y>this.canvas.height?void this.upHandler(a):void this.moveHandler(a,b.x,b.y)},moveHandler:function(a,b,c){if(a.preventDefault(),!this.mouseState.isMouseDown){var d=this.getObjectAtCoordinates(b,c);return void(d?d.hover(this.canvas):this.canvas.style.cursor="auto")}var e=b-this.mouseState.mouseDownPosition.x,f=c-this.mouseState.mouseDownPosition.y;this.clickedObject&&this.clickedObject.drag(e,f),this.mouseState.mouseDownPosition.x=b,this.mouseState.mouseDownPosition.y=c,this.isCanvasDirty=!0},upHandler:function(a){this.mouseState.isMouseDown=!1,a.preventDefault()},getTouchLocationInCanvas:function(a){if(!a||!a.targetTouches||!a.targetTouches[0])return null;var b=a.targetTouches[0];return this.getLocationInCanvas(b.clientX,b.clientY)},getMouseLocationInCanvas:function(a){return a?this.getLocationInCanvas(a.clientX,a.clientY):null},getLocationInCanvas:function(a,b){return this.canvas.getBoundingClientRect(),canvasTopOffset=parseInt(this.canvas.parentElement.style.top,10),canvasLeftOffset=parseInt(this.canvas.parentElement.style.left,10),a-=canvasLeftOffset,b-=canvasTopOffset,{x:a,y:b}},getObjectAtCoordinates:function(a,b){var c=[];if(this.selectedRectangle){c.push(this.selectedRectangle.removeButton);for(var d=this.selectedRectangle.resizePoints,e=0;e=0;f--)c.push(this.rectangles[f]);for(var g=0;g=c.x-d&&a<=c.x+d&&b>=c.y-d&&b<=c.y+d},select:function(){this.rectangle.destroy()},hover:function(a){a.style.cursor="pointer"},drag:function(){},draw:function(a){var b=this.getButtonLocation();this.drawHelper(a,b.x,b.y,4,5,"white",.5),this.drawHelper(a,b.x,b.y,2,4,"black",1)},drawHelper:function(a,b,c,d,e,f,g){a.beginPath(),a.lineWidth=d,a.strokeStyle=f,a.lineCap="round",a.globalAlpha=g,a.moveTo(b-e,c-e),a.lineTo(b+e,c+e),a.stroke(),a.moveTo(b+e,c-5),a.lineTo(b-e,c+e),a.stroke()}}),ResizePoint:QSI.util.Class({initialize:function(a,b,c,d,e){this.rectangleAnnotations=a,this.rectangle=b,this.direction=c,this.circleRadius=d,this.interactionSquareLength=e},getPointLocation:function(){var a=0,b=0;switch(this.direction){case"nw":a=this.rectangle.x,b=this.rectangle.y;break;case"ne":a=this.rectangle.x+this.rectangle.w,b=this.rectangle.y;break;case"se":a=this.rectangle.x+this.rectangle.w,b=this.rectangle.y+this.rectangle.h;break;case"sw":a=this.rectangle.x,b=this.rectangle.y+this.rectangle.h}return{x:a,y:b}},isAtLocation:function(a,b){var c=this.getPointLocation(),d=this.interactionSquareLength/2;return a>=c.x-d&&a<=c.x+d&&b>=c.y-d&&b<=c.y+d},draw:function(a){var b=this.getPointLocation();a.beginPath(),a.arc(b.x,b.y,this.circleRadius,0,2*Math.PI,!1),a.fillStyle="red",a.fill(),a.lineWidth=1,a.strokeStyle="red",a.stroke()},select:function(){},drag:function(a,b){switch(this.direction){case"nw":this.transform(a,b,-a,-b);break;case"ne":this.transform(0,b,a,-b);break;case"se":this.transform(0,0,a,b);break;case"sw":this.transform(a,0,-a,b)}},transform:function(a,b,c,d){this.rectangle.x+a<0?this.rectangle.x=0:this.rectangle.w+c<0?this.rectangle.w=0:this.rectangle.x+a+this.rectangle.w+c>this.rectangleAnnotations.canvas.width?this.rectangle.w=this.rectangleAnnotations.canvas.width-this.rectangle.x:(this.rectangle.x+=a,this.rectangle.w+=c),this.rectangle.y+b<0?this.rectangle.y=0:this.rectangle.h+d<0?this.rectangle.h=0:this.rectangle.y+b+this.rectangle.h+d>this.rectangleAnnotations.canvas.height?this.rectangle.h=this.rectangleAnnotations.canvas.height-this.rectangle.y:(this.rectangle.y+=b,this.rectangle.h+=d)},hover:function(a){switch(this.direction){case"nw":case"se":a.style.cursor="nwse-resize";break;case"ne":case"sw":a.style.cursor="nesw-resize"}}}),Rectangle:QSI.util.Class({initialize:function(a,b,c,d,e,f,g){this.rectangleAnnotations=a,this.x=b,this.y=c,this.w=d,this.h=e,this.color=f,this.opacity=g?g:1,this.resizePoints=[],this.removeButton=null,this.isSelected=!1},isAtLocation:function(a,b){return a>=this.x&&a<=this.x+this.w&&b>=this.y&&b<=this.y+this.h},select:function(){if(0===this.resizePoints.length)for(var a=["nw","ne","se","sw"],b=0;bthis.rectangleAnnotations.canvas.width&&(this.x=this.rectangleAnnotations.canvas.width-this.w),this.y+this.h>this.rectangleAnnotations.canvas.height&&(this.y=this.rectangleAnnotations.canvas.height-this.h)},hover:function(a){a.style.cursor="move"}})})); (void 0===window.QSI.ScreenCaptureHandler||window.QTest)&&(QSI.ScreenCaptureHandler=QSI.util.Class({initialize:function(a,b,c,d){this.intercept=a,this.embeddedTarget=b,this.surveySessionId=c,this.scZIndex=QSI.global.currentZIndex++,this.translations=d||{},this.createCapturingScreen(this.translations)},createCapturingScreen:function(a){var b=this,c=QSI.util.build("div",{"data-qsi-sc-class":"qsi_sc_backdrop",style:{width:"100%",height:"100%",backgroundColor:"black",opacity:"0.7",filter:"alpha(opacity=70)",position:"fixed",top:"0px",left:"0px",zIndex:this.scZIndex-1}},[]),d=100,e=QSI.util.build("img",{"data-qsi-sc-class":"qsi_sc_loading_icon",src:QSI.baseURL+"../WRQualtricsShared/Graphics/siteintercept/building_preview.gif",style:{width:d+"px"},alt:""},[]),f=QSI.util.build("img",{"data-qsi-sc-class":"qsi_sc_cancel_capture_button",src:QSI.baseURL+"../WRQualtricsShared/Graphics/siteintercept/remove_screen_capture.png",title:"Cancel Capturing Screen",style:{"-webkit-filter":"brightness(0) invert(1)",filter:"brightness(0) invert(1)",display:"block",width:"15px",height:"15px",marginLeft:d+"px",cursor:"pointer"},alt:"Cancel"},[]);this.isScreenCaptureCancelled=!1,QSI.util.observe(f,"click",function(){b.isScreenCaptureCancelled=!0,b.hideCapturingScreen()});var g=QSI.util.build("div",{"data-qsi-sc-class":"qsi_sc_building_preview_text",style:{color:"white"}},[]);g.innerText=a.ScreenCaptureBuilding||"Building Preview ...";var h=parseInt(window.innerWidth,10),i=parseInt(window.innerHeight,10);this.scCapturingScreen=QSI.util.build("div",{"data-qsi-sc-class":"qsi_sc_capturing_screen",style:{position:"fixed",top:i/2+"px",left:h/2+"px",marginTop:d/-2+"px",marginLeft:d/-2+"px",zIndex:this.scZIndex}},[f,e,g]),this.scScreen=QSI.util.build("div",{className:"QSI_ScreenCapture",style:{visibility:"hidden"}},[c,this.scCapturingScreen]),document.body.appendChild(this.scScreen)},showCapturingScreen:function(){this.setInterceptVisibilty("hidden"),this.scScreen.style.visibility="visible"},hideCapturingScreen:function(){this.setInterceptVisibilty("visible"),this.scScreen.style.visibility="hidden"},setInterceptVisibilty:function(a){if(this.intercept.container?this.intercept.container.style.visibility=a:this.intercept.link&&"FeedbackLink"===this.intercept.type?this.intercept.link.style.visibility=a:this.intercept.bar&&(this.intercept.bar.style.visibility=a),this.intercept.embeddedWindows)for(var b=0;b