Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

opentok-annotation

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentok-annotation - npm Package Compare versions

Comparing version 1.0.20 to 1.0.21

2

dist/opentok-annotation.min.js

@@ -1,1 +0,1 @@

var _otkanalytics,_logEventData={clientVersion:"js-vsol-1.0.0",componentId:"annotationsAccPack",name:"guidAnnotationsKit",actionStartDrawing:"Start Drawing",actionEndDrawing:"End Drawing",variationSuccess:"Success"},_logAnalytics=function(){var t=window.location.href,e={clientVersion:_logEventData.clientVersion,source:t,componentId:_logEventData.componentId,name:_logEventData.name};_otkanalytics=new OTKAnalytics(e);var n={sessionId:_session.id,connectionId:_session.connection.connectionId,partnerId:_session.apiKey};_otkanalytics.addSessionInfo(n)},_log=function(t,e){var n={action:t,variation:e};_otkanalytics.logEvent(n)};window.OTSolution=window.OTSolution||{},OTSolution.Annotations=function(t){function e(t,e,n){for(var i=e.split(" "),o=0,a=i.length;o<a;o++)t.addEventListener(i[o],n,!0)}function n(t,e){0===a.width&&(a.width=o.parent.getBoundingClientRect().width),0===a.height&&(a.height=o.parent.getBoundingClientRect().height);var n,i=e?t.canvas.width:o.parent.clientWidth,s=e?t.canvas.height:o.parent.clientHeight,c=e?t.canvas.offsetLeft:a.offsetLeft,l=e?t.canvas.offsetTop:a.offsetTop,d=a.width/i,h=a.height/s,g=t.offsetX||t.pageX-c||t.changedTouches&&t.changedTouches[0].pageX-c,m=t.offsetY||t.pageY-l||t.changedTouches&&t.changedTouches[0].pageY-l,f=g*d,v=m*h,y=e?t.selectedItem:o.selectedItem;if(y)if("OT_pen"===y.id)switch(t.type){case"mousedown":case"touchstart":p.dragging=!0,p.lastX=f,p.lastY=v,o.isStartPoint=!0,_log(_logEventData.actionStartDrawing,_logEventData.variationSuccess);break;case"mousemove":case"touchmove":p.dragging&&(n={id:o.videoFeed.stream.connection.connectionId,fromId:o.session.connection.connectionId,fromX:p.lastX,fromY:p.lastY,toX:f,toY:v,color:e?t.userColor:o.userColor,lineWidth:o.lineWidth,videoWidth:o.videoFeed.videoElement().clientWidth,videoHeight:o.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,startPoint:o.isStartPoint,endPoint:!1,selectedItem:y},x(n,!0),p.lastX=f,p.lastY=v,!e&&A(n),o.isStartPoint=!1);break;case"mouseup":case"touchend":p.dragging=!1,n={id:o.videoFeed.stream.connection.connectionId,fromId:o.session.connection.connectionId,fromX:p.lastX,fromY:p.lastY,toX:f,toY:v,color:e?t.userColor:o.userColor,lineWidth:o.lineWidth,videoWidth:o.videoFeed.videoElement().clientWidth,videoHeight:o.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,startPoint:o.isStartPoint,endPoint:!0,selectedItem:y},x(n,!0),p.lastX=f,p.lastY=v,!e&&A(n),o.isStartPoint=!1,_log(_logEventData.actionEndDrawing,_logEventData.variationSuccess);break;case"mouseout":p.dragging=!1}else if("OT_text"===y.id)n={id:o.videoFeed.stream.connection.connectionId,fromId:o.session.connection.connectionId,fromX:f,fromY:v+t.inputHeight,color:t.userColor,font:t.font,text:t.text,videoWidth:o.videoFeed.videoElement().clientWidth,videoHeight:o.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,selectedItem:y},x(n),!e&&A(n);else if(y&&y.points)switch(p.mX=f,p.mY=v,t.type){case"mousedown":case"touchstart":p.isDrawing=!0,p.dragging=!0,p.startX=f,p.startY=v;break;case"mousemove":case"touchmove":p.dragging&&(n={color:e?t.userColor:o.userColor,lineWidth:e?t.lineWidth:o.lineWidth,selectedItem:y},x(n,!0));break;case"mouseup":case"touchend":p.isDrawing=!1;var I=y.points;if(2===I.length)n={id:o.videoFeed.stream.connection.connectionId,fromId:o.session.connection.connectionId,fromX:p.startX,fromY:p.startY,toX:p.mX,toY:p.mY,color:e?t.userColor:o.userColor,lineWidth:e?t.lineWidth:o.lineWidth,videoWidth:o.videoFeed.videoElement().clientWidth,videoHeight:o.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,smoothed:!1,startPoint:!0,endPoint:!0,selectedItem:y},u.push(n),!e&&A(n);else{for(var b=P(I),w=0;w<I.length;w++){var _=!1,T=!1,W=p.startX+b.x*I[w][0],M=p.startY+b.y*I[w][1];0===w?(p.lastX=W,p.lastY=M,_=!0):w===I.length-1&&(T=!0),n={id:o.videoFeed.stream.connection.connectionId,fromId:o.session.connection.connectionId,fromX:p.lastX,fromY:p.lastY,toX:W,toY:M,color:e?t.userColor:o.userColor,lineWidth:e?t.lineWidth:o.lineWidth,videoWidth:o.videoFeed.videoElement().clientWidth,videoHeight:o.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,smoothed:y.enableSmoothing,startPoint:_,endPoint:T},u.push(n),!e&&A(n),p.lastX=W,p.lastY=M}x(null)}p.dragging=!1}}t=t||{},this.widgetVersion="js-1.0.0-beta",_otkanalytics||_logAnalytics(),this.parent=t.container,this.videoFeed=t.feed;var i=t.externalWindow?t.externalWindow.document:window.document,o=this;if(this.parent){var a=document.createElement("canvas");a.setAttribute("id","opentok_canvas"),a.style.position="absolute",this.parent.appendChild(a),a.setAttribute("width",this.parent.clientWidth+"px"),a.style.width=window.getComputedStyle(this.parent).width,a.setAttribute("height",this.parent.clientHeight+"px"),a.style.height=window.getComputedStyle(this.parent).height}var s,r,c,l,o=this,d=[],h=[],u=[],g=[],m=[],p={dragging:!1};r=(" "+o.videoFeed.element.className+" ").indexOf(" OT_mirrored ")>-1,c=(" "+o.videoFeed.element.className+" ").indexOf(" OT_fit-mode-cover ")>-1,this.canvas=function(){return a},this.link=function(t){this.session=t},this.changeColor=function(t){o.userColor=t,o.lineWidth||(o.lineWidth=2)},this.changeLineWidth=function(t){this.lineWidth=t},this.selectItem=function(t){o.overlay&&(o.overlay.style.display="none",o.overlay=null),"OT_capture"===t.id?(o.selectedItem=t,o.overlay?o.overlay.style="inline":(o.overlay=document.createElement("div"),o.overlay.style.position="absolute",o.overlay.style.width=o.parent.clientWidth+"px",o.overlay.style.height=o.parent.clientHeight+"px",o.overlay.style.background='rgba(0,0,0,0.4) url("../images/annotation/camera.png") no-repeat center',o.overlay.style.backgroundSize="50px 50px",o.overlay.style.cursor="pointer",o.overlay.style.opacity=0,o.parent.appendChild(o.overlay),o.parent.onmouseover=function(){o.overlay.style.opacity=1},o.parent.onmouseout=function(){o.overlay.style.opacity=0},o.overlay.onclick=function(){o.captureScreenshot()})):t.id.indexOf("OT_line_width")!==-1?t.size&&o.changeLineWidth(t.size):o.selectedItem=t},this.colors=function(t){this.colors=t,this.changeColor(t[0])},this.clear=function(){O(!1,o.session.connection.connectionId),o.session&&o.session.signal({type:"otAnnotation_clear"})},this.captureScreenshot=function(){var t=document.createElement("canvas");t.width=a.width,t.height=a.height;var e=o.videoFeed.videoWidth(),n=o.videoFeed.videoHeight(),i=1,s=0,l=0;c?(e<n?(i=a.width/e,e=a.width,n*=i):(i=a.height/n,n=a.height,e*=i),s=(e-a.width)/2,l=(n-a.height)/2):e>n?(i=a.width/e,e=a.width,n*=i):(i=a.height/n,n=a.height,e*=i);var h=new Image;h.onload=function(){var i=t.getContext("2d");r&&(i.translate(e,0),i.scale(-1,1)),i.drawImage(h,s,l,e,n),r&&(i.translate(e,0),i.scale(-1,1)),i.drawImage(a,0,0),d.forEach(function(e){e.call(o,t.toDataURL())}),t=null},h.src="data:image/png;base64,"+o.videoFeed.getImgData()},this.onScreenCapture=function(t){d.push(t)},this.onResize=function(){u=[],E(g,!0),m.forEach(function(t){n(t,!0)})},e(a,"mousedown mousemove mouseup mouseout touchstart touchmove touchend",function(t){var e=o.selectedItem&&"OT_text"===o.selectedItem.id,i="mousemove"===t.type&&!p.dragging;e||i||(t.preventDefault(),t.selectedItem=o.selectedItem,t.selectedItem&&(t.canvas={width:a.width,height:a.height,offsetLeft:a.offsetLeft,offsetTop:a.offsetTop},t.userColor=o.userColor,t.lineWidth=o.lineWidth,m.push(t)),n(t))});var f,v="textAnnotation",y=!1,I=function(t){t.preventDefault(),o.selectedItem&&"OT_text"===o.selectedItem.id&&!y&&(y=!0,t.selectedItem=o.selectedItem,W(t))},b=function(t){13===t.which&&T(),27===t.which&&(i.getElementById(v).remove(),f=null),y=!1},w=function(){i.addEventListener("keydown",b)},_=function(){i.removeEventListener("keydown",b)},T=function(){var t=i.getElementById(v);t.clientHeight;return t.value?(t.remove(),_(),f.text=t.value,f.font="16px Arial",f.userColor=o.userColor,f.canvas={width:a.width,height:a.height,offsetLeft:a.offsetLeft,offsetTop:a.offsetTop},m.push(f),void n(f)):void(f=null)},W=function(t){var e=i.createElement("input");e.setAttribute("type","text"),e.style.position="absolute",e.style.top=t.clientY+"px",e.style.left=t.clientX+"px",e.style.background="rgba(255,255,255, .5)",e.style.width="100px",e.style.maxWidth="200px",e.style.border="1px dashed red",e.style.fontSize="16px",e.style.color=o.userColor,e.style.fontFamily="Arial",e.style.zIndex="1001",e.setAttribute("data-canvas-origin",JSON.stringify({x:t.offsetX,y:t.offsetY})),e.id=v,i.body.appendChild(e),e.focus(),f=t,f.inputHeight=e.clientHeight,w()};e(a,"click",I);var x=function(t,e){s||(s=a.getContext("2d"),s.lineCap="round",s.lineJoin="round",s.fillStyle="solid"),s.clearRect(0,0,a.width,a.height),u.forEach(function(t){s.strokeStyle=t.color,s.lineWidth=t.lineWidth,t.smoothed=!!t.smoothed,t.startPoint=!!t.startPoint;var e=!1,n=!!t.selectedItem&&"Text"===t.selectedItem.title&&t.text;n?(s.font=t.font,s.fillStyle=t.color,s.fillText(t.text,t.fromX,t.fromY)):t.smoothed?(t.startPoint?o.isStartPoint=!0:o.isStartPoint&&(e=!0,o.isStartPoint=!1),t.startPoint?(s.closePath(),s.beginPath()):e?s.moveTo((t.fromX+t.toX)/2,(t.fromY+t.toY)/2):(s.quadraticCurveTo(t.fromX,t.fromY,(t.fromX+t.toX)/2,(t.fromY+t.toY)/2),s.stroke())):(s.beginPath(),s.moveTo(t.fromX,t.fromY),s.lineTo(t.toX,t.toY),s.stroke(),s.closePath())});var n=e?t.selectedItem:o.selectedItem;!n||"Pen"!==n.title&&"Text"!==n.title?p.isDrawing&&(t&&(s.strokeStyle=t.color,s.lineWidth=t.lineWidth),n&&n.points&&M(s,o.selectedItem.points)):t&&("Pen"===n.title&&(s.strokeStyle=t.color,s.lineWidth=t.lineWidth,s.beginPath(),s.moveTo(t.fromX,t.fromY),s.lineTo(t.toX,t.toY),s.stroke(),s.closePath()),"Text"===n.title&&(s.font=t.font,s.fillStyle=t.color,s.fillText(t.text,t.fromX,t.fromY)),u.push(t))},M=function(t,e){var n=P(e);if(t.beginPath(),2===e.length)t.moveTo(p.startX,p.startY),t.lineTo(p.mX,p.mY);else for(var i=0;i<e.length;i++){var a=p.startX+n.x*e[i][0],s=p.startY+n.y*e[i][1];o.selectedItem.enableSmoothing?0===i||(1===i?(t.moveTo((a+p.lastX)/2,(s+p.lastY)/2),p.lastX=(a+p.lastX)/2,p.lastX=(s+p.lastY)/2):(t.quadraticCurveTo(p.lastX,p.lastY,(a+p.lastX)/2,(s+p.lastY)/2),p.lastX=(a+p.lastX)/2,p.lastY=(s+p.lastY)/2)):0===i?t.moveTo(a,s):t.lineTo(a,s),p.lastX=a,p.lastY=s}t.stroke(),t.closePath()},P=function(t){for(var e=Number.MAX_VALUE,n=Number.MAX_VALUE,i=0,o=0,a=0;a<t.length;a++)t[a][0]<e?e=t[a][0]:t[a][0]>i&&(i=t[a][0]),t[a][1]<n?n=t[a][1]:t[a][1]>o&&(o=t[a][1]);var s=Math.abs(i-e),r=Math.abs(o-n),c=(p.mX-p.startX)/s,l=(p.mY-p.startY)/r;return{x:c,y:l}},k=function(t,e,n){var i={width:t.canvasWidth,height:t.canvasHeight},s={width:t.videoWidth,height:t.videoHeight},c={width:o.videoFeed.videoElement().clientWidth,height:o.videoFeed.videoElement().clientHeight},l=1,d=a.width/a.height;c.width/c.height,i.width/i.height,s.width/s.height;l=d<0?a.width/i.width:a.height/i.height;var h=a.width/2,m=a.height/2,p=i.width/2,f=i.height/2;t.fromX=h-l*(p-t.fromX),t.fromY=m-l*(f-t.fromY),t.toX=h-l*(p-t.toX),t.toY=m-l*(f-t.toY),t.mirrored=!!t.mirrored,t.mirrored&&(t.fromX=a.width-t.fromX,t.toX=a.width-t.toX),r&&(t.fromX=a.width-t.fromX,t.toX=a.width-t.toX);var v=JSON.parse(JSON.stringify(t));v.canvasWidth=a.width,v.canvasHeight=a.height,v.videoWidth=c.width,v.videoHeight=c.height,e?g[n]=v:g.push(v),u.push(t),x(null)},E=function(t,e){t.forEach(function(t,n){t.id===o.videoFeed.stream.connection.connectionId&&k(t,e,n)})},O=function(t,e){u=u.filter(function(t){return console.log(t.fromId),t.fromId!==e}),t?g=[]:(o.session&&o.session.signal({type:"otAnnotation_clear"}),m=[]),x()};o.videoFeed.session&&o.videoFeed.session.on({"signal:otAnnotation_pen":function(t){t.from.connectionId!==o.session.connection.connectionId&&E(JSON.parse(t.data))},"signal:otAnnotation_text":function(t){t.from.connectionId!==o.session.connection.connectionId&&E(JSON.parse(t.data))},"signal:otAnnotation_history":function(t){l&&l!==t.from.connectionId||(l=t.from.connectionId,E(JSON.parse(t.data)))},"signal:otAnnotation_clear":function(t){t.from.connectionId!==o.session.connection.connectionId&&O(!0,t.from.connectionId)},connectionCreated:function(t){u.length>0&&t.connection.connectionId!==o.session.connection.connectionId&&S("otWhiteboard_history",u,t.connection)}});var C,S=function(t,e){for(var n=t.slice(),i=function(t){t&&TB.error(t)},a="otAnnotation_pen",s=function(t){if(t&&t[0]&&t[0].selectedItem&&t[0].selectedItem.id){var e=t[0].selectedItem.id;a="OT_text"===e?"otAnnotation_text":"otAnnotation_pen"}};n.length;){var r=n.splice(0,Math.min(n.length,32));s(r);var c={type:a,data:JSON.stringify(r)};e&&(c.to=e),o.session.signal(c,i)}},A=function(t){o.session&&(h.push(t),C||(C=setTimeout(function(){S(h),h=[],C=null},100)))}},OTSolution.Annotations.Toolbar=function(t){var e=this,n=this;_otkanalytics||_logAnalytics(),t||(t={}),this.session=t.session,this.parent=t.container,this.externalWindow=t.externalWindow,this.backgroundColor=t.backgroundColor||"rgba(0, 0, 0, 0.7)",this.buttonWidth=t.buttonWidth||"40px",this.buttonHeight=t.buttonHeight||"40px",this.iconWidth=t.iconWidth||"30px",this.iconHeight=t.iconHeight||"30px",this.items=t.items||[{id:"OT_pen",title:"Pen",icon:"../images/annotation/freehand.png",selectedIcon:"../images/annotation/freehand_selected.png"},{id:"OT_line",title:"Line",icon:"../images/annotation/line.png",selectedIcon:"../images/annotation/line_selected.png",points:[[0,0],[0,1]]},{id:"OT_shapes",title:"Shapes",icon:"../images/annotation/shapes.png",items:[{id:"OT_arrow",title:"Arrow",icon:"../images/annotation/arrow.png",points:[[0,1],[3,1],[3,0],[5,2],[3,4],[3,3],[0,3],[0,1]]},{id:"OT_rect",title:"Rectangle",icon:"../images/annotation/rectangle.png",points:[[0,0],[1,0],[1,1],[0,1],[0,0]]},{id:"OT_oval",title:"Oval",icon:"../images/annotation/oval.png",enableSmoothing:!0,points:[[0,.5],[.5+.5*Math.cos(5*Math.PI/4),.5+.5*Math.sin(5*Math.PI/4)],[.5,0],[.5+.5*Math.cos(7*Math.PI/4),.5+.5*Math.sin(7*Math.PI/4)],[1,.5],[.5+.5*Math.cos(Math.PI/4),.5+.5*Math.sin(Math.PI/4)],[.5,1],[.5+.5*Math.cos(3*Math.PI/4),.5+.5*Math.sin(3*Math.PI/4)],[0,.5],[.5+.5*Math.cos(5*Math.PI/4),.5+.5*Math.sin(5*Math.PI/4)]]}]},{id:"OT_text",title:"Text",icon:"../images/annotation/text.png",selectedIcon:"../images/annotation/text.png"},{id:"OT_colors",title:"Colors",icon:"",items:{}},{id:"OT_line_width",title:"Line Width",icon:"../images/annotation/line_width.png",items:{}},{id:"OT_clear",title:"Clear",icon:"../images/annotation/clear.png"},{id:"OT_capture",title:"Capture",icon:"../images/annotation/camera.png",selectedIcon:"../images/annotation/camera_selected.png"}],this.colors=t.colors||["#1abc9c","#2ecc71","#3498db","#9b59b6","#34495e","#16a085","#27ae60","#2980b9","#8e44ad","#2c3e50","#f1c40f","#e67e22","#e74c3c","#ecf0f1","#95a5a6","#f39c12","#d35400","#c0392b","#bdc3c7","#7f8c8d"],this.cbs=[];var i,o=[],a=function(t,e,i){var o=this,a=n.externalWindow?n.externalWindow.document:document;this.getElm=function(t){return"string"==typeof t?a.querySelector(t):t},this.render=function(){var t=this,e="";t.colors.forEach(function(n){e+=t.options.template.replace(/\{color\}/g,n)}),t.elm.innerHTML=e},this.close=function(){this.elm.style.display="none"},this.open=function(){this.elm.style.display=this.options.style.display},this.colorChosen=function(t){this.cbs.push(t)},this.set=function(t,e){var n=this;n.color=t,e!==!1&&n.cbs.forEach(function(e){e.call(n,t)})},i=i||{},i.openEvent=i.openEvent||"click",i.style=Object(i.style),i.style.display=i.style.display||"block",i.template=i.template||'<div class="color-choice" data-col="{color}" style="background-color: {color}"></div>',o.elm=o.getElm(t),o.cbs=[],o.colors=e,o.options=i,o.render(),o.elm.addEventListener("click",function(t){var e=t.target.getAttribute("data-col");e&&(o.set(e),o.close())}),i.autoclose!==!1&&o.close()};this.createPanel=function(t){if(n.parent){var r=t?t.document:document;i=r.createElement("div"),i.setAttribute("id","OT_toolbar"),i.setAttribute("class","OT_panel"),i.style.width="100%",i.style.height="100%",i.style.backgroundColor=this.backgroundColor,this.parent.appendChild(i),this.parent.style.position="relative",this.parent.zIndex=1e3;for(var c=[],l=r.createElement("div"),d=0,h=this.items.length;d<h;d++){var u=this.items[d],g=r.createElement("input");if(g.setAttribute("type","button"),g.setAttribute("id",u.id),g.style.position="relative",g.style.top="50%",g.style.transform="translateY(-50%)","OT_colors"===u.id){g.style.webkitTransform="translateY(-85%)";var m=r.createElement("div");m.setAttribute("class","color-picker"),m.style.backgroundColor=this.backgroundColor,this.parent.appendChild(m);var p=new a(".color-picker",this.colors,{externalWindow:n.externalWindow});p.colorChosen(function(t){var e=r.getElementById("OT_colors");e.style.backgroundColor=t,o.forEach(function(e){e.changeColor(t)})});for(var f=r.querySelectorAll(".color-choice"),v=0;v<f.length;v++)f[v].style.display="inline-block",f[v].style.width="30px",f[v].style.height="30px",f[v].style.margin="5px",f[v].style.cursor="pointer",f[v].style.borderRadius="100%",f[v].style.opacity=.7,f[v].onmouseover=function(){this.style.opacity=1},f[v].onmouseout=function(){this.style.opacity=.7};g.setAttribute("class","OT_color"),g.style.marginLeft="10px",g.style.marginRight="10px",g.style.borderRadius="50%",g.style.backgroundColor=this.colors[0],g.style.width=this.iconWidth,g.style.height=this.iconHeight,g.style.paddingTop=this.buttonHeight.replace("px","")-this.iconHeight.replace("px","")+"px"}else g.style.background='url("'+u.icon+'") no-repeat',g.style.backgroundSize=this.iconWidth+" "+this.iconHeight,g.style.backgroundPosition="center",g.style.width=this.buttonWidth,g.style.height=this.buttonHeight;"Line Width"!==u.title||Array.isArray(u.items)||(u.items=[{id:"OT_line_width_2",title:"Line Width 2",size:2},{id:"OT_line_width_4",title:"Line Width 4",size:4},{id:"OT_line_width_6",title:"Line Width 6",size:6},{id:"OT_line_width_8",title:"Line Width 8",size:8},{id:"OT_line_width_10",title:"Line Width 10",size:10},{id:"OT_line_width_12",title:"Line Width 12",size:12},{id:"OT_line_width_14",title:"Line Width 14",size:14}]),u.items&&g.setAttribute("data-type","group"),g.setAttribute("data-col",u.title),g.style.border="none",g.style.cursor="pointer",c.push(g.outerHTML)}i.innerHTML=c.join(""),i.onclick=function(t){var n="group"===t.target.getAttribute("data-type"),i=t.target.getAttribute("data-col"),a=t.target.getAttribute("id");n?e.items.forEach(function(t){if(t.title===i){if(e.selectedGroup=t,t.items&&(l.setAttribute("class","OT_subpanel"),l.style.backgroundColor=e.backgroundColor,l.style.width="100%",l.style.height="100%",l.style.paddingLeft="15px",l.style.display="none",e.parent.appendChild(l),Array.isArray(t.items))){var n=[];"OT_line_width"===t.id?t.items.forEach(function(t){var i=r.createElement("div");i.setAttribute("data-col",t.title),i.setAttribute("id",t.id),i.style.position="relative",i.style.top="50%",i.style.transform="translateY(-50%)",i.style["float"]="left",i.style.width=e.buttonWidth,i.style.height=e.buttonHeight,i.style.border="none",i.style.cursor="pointer";var o=r.createElement("div");o.style.backgroundColor="#FFFFFF",o.style.width="80%",o.style.height=t.size+"px",o.style.position="relative",o.style.left="50%",o.style.top="50%",o.style.transform="translateX(-50%) translateY(-50%)",o.style.pointerEvents="none",i.appendChild(o),n.push(i.outerHTML)}):t.items.forEach(function(t){var i=r.createElement("input");i.setAttribute("type","button"),i.setAttribute("data-col",t.title),i.setAttribute("id",t.id),i.style.background='url("'+t.icon+'") no-repeat',i.style.position="relative",i.style.top="50%",i.style.transform="translateY(-50%)",i.style.backgroundSize=e.iconWidth+" "+e.iconHeight,i.style.backgroundPosition="center",i.style.width=e.buttonWidth,i.style.height=e.buttonHeight,i.style.border="none",i.style.cursor="pointer",n.push(i.outerHTML)}),l.innerHTML=n.join("")}"OT_shapes"===a||"OT_line_width"===a?(l&&(l.style.display="block"),p.close()):"OT_colors"===a&&(l&&(l.style.display="none"),p.open())}}):(e.items.forEach(function(t){if("Clear"!==t.title&&t.title===i){if(e.selectedItem){var n=r.getElementById(e.selectedItem.id);n&&(n.style.background='url("'+e.selectedItem.icon+'") no-repeat',n.style.backgroundSize=e.iconWidth+" "+e.iconHeight,n.style.backgroundPosition="center")}if(t.selectedIcon){var a=r.getElementById(t.id);a&&(a.style.background='url("'+t.selectedIcon+'") no-repeat',a.style.backgroundSize=e.iconWidth+" "+e.iconHeight,a.style.backgroundPosition="center")}return e.selectedItem=t,s(t),o.forEach(function(t){t.selectItem(e.selectedItem)}),!1}}),l.style.display="none"),e.cbs.forEach(function(t){t.call(e,a)})},l.onclick=function(t){var n="group"===t.target.getAttribute("data-type"),i=(t.target.getAttribute("data-col"),t.target.getAttribute("id"));l.style.display="none",n||e.selectedGroup.items.forEach(function(t){if("OT_clear"!==t.id&&t.id===i){if(e.selectedItem){var n=document.getElementById(e.selectedItem.id);n&&(n.style.background='url("'+e.selectedItem.icon+'") no-repeat',n.style.backgroundSize=e.iconWidth+" "+e.iconHeight,n.style.backgroundPosition="center")}if(t.selectedIcon){var a=document.getElementById(t.id);n&&(a.style.background='url("'+t.selectedIcon+'") no-repeat',a.style.backgroundSize=e.iconWidth+" "+e.iconHeight,a.style.backgroundPosition="center")}return e.selectedItem=t,s(t),o.forEach(function(t){t.selectItem(e.selectedItem)}),!1}}),e.cbs.forEach(function(t){t.call(e,i)})},r.getElementById("OT_clear").onclick=function(){o.forEach(function(t){t.clear()})}}},!this.externalWindow&&this.createPanel();var s=function(t){t.points||("OT_line"===t.id?e.selectedItem.points=[[0,0],[0,1]]:"OT_arrow"===t.id?e.selectedItem.points=[[0,1],[3,1],[3,0],[5,2],[3,4],[3,3],[0,3],[0,1]]:"OT_rect"===t.id?e.selectedItem.points=[[0,0],[1,0],[1,1],[0,1],[0,0]]:"OT_oval"===t.id&&(e.selectedItem.enableSmoothing=!0,e.selectedItem.points=[[0,.5],[.5+.5*Math.cos(5*Math.PI/4),.5+.5*Math.sin(5*Math.PI/4)],[.5,0],[.5+.5*Math.cos(7*Math.PI/4),.5+.5*Math.sin(7*Math.PI/4)],[1,.5],[.5+.5*Math.cos(Math.PI/4),.5+.5*Math.sin(Math.PI/4)],[.5,1],[.5+.5*Math.cos(3*Math.PI/4),.5+.5*Math.sin(3*Math.PI/4)],[0,.5],[.5+.5*Math.cos(5*Math.PI/4),.5+.5*Math.sin(5*Math.PI/4)]]))};this.itemClicked=function(t){this.cbs.push(t)},this.addCanvas=function(t){var e=this;t.link(e.session),t.colors(e.colors),o.push(t)},this.removeCanvas=function(t){o.forEach(function(e){var n=e.canvas();e.videoFeed.stream.connection.connectionId===t&&n.parentNode&&n.parentNode.removeChild(n)}),o=o.filter(function(e){return e.videoFeed.stream.connection.connectionId!==t})},this.remove=function(){try{i.parentNode.removeChild(i)}catch(t){console.log(t)}o.forEach(function(t){var e=t.canvas();e.parentNode&&e.parentNode.removeChild(e)}),o=[]}},function(){var t,e,n;"object"==typeof module&&"object"==typeof module.exports?(t=require("underscore"),e=require("jquery"),n=require("opentok-solutions-logging")):(t=this._,e=this.$,n=this.OTKAnalytics);var i,o,a,s,r,c={},l={clientVersion:"js-vsol-1.0.0",componentId:"annotationsAccPack",name:"guidAnnotationsKit",actionInitialize:"Init",actionStart:"Start",actionEnd:"End",actionFreeHand:"Free Hand",actionPickerColor:"Picker Color",actionText:"Text",actionScreenCapture:"Screen Capture",actionErase:"Erase",actionUseToolbar:"Use Toolbar",variationAttempt:"Attempt",variationError:"Failure",variationSuccess:"Success"},d=function(){var t=window.location.href,e={clientVersion:l.clientVersion,source:t,componentId:l.componentId,name:l.name};r=new n(e);var i={sessionId:a.id,connectionId:a.connection.connectionId,partnerId:a.apiKey};r.addSessionInfo(i)},h=function(t,e){var n={action:t,variation:e};r.logEvent(n)},u=function(t,e){o&&o.triggerEvent(t,e)},g=function(){var t=["startAnnotation","linkAnnotation","resizeCanvas","annotationWindowClosed","endAnnotation"];o.registerEvents(t)},m=function(){var t=['<div class="annotation-toolbar-container">','<div id="toolbar"></div>',"</div>"].join("\n");e("body").append(t),h(l.actionUseToolbar,l.variationSuccess)},p=[{id:"OT_pen",title:"Pen",icon:"../images/annotation/freehand.png",selectedIcon:"../images/annotation/freehand_selected.png"},{id:"OT_line",title:"Line",icon:"../images/annotation/line.png",selectedIcon:"../images/annotation/line_selected.png"},{id:"OT_text",title:"Text",icon:"../images/annotation/text.png",selectedIcon:"../images/annotation/text.png"},{id:"OT_shapes",title:"Shapes",icon:"../images/annotation/shapes.png",items:[{id:"OT_arrow",title:"Arrow",icon:"../images/annotation/arrow.png"},{id:"OT_rect",title:"Rectangle",icon:"../images/annotation/rectangle.png"},{id:"OT_oval",title:"Oval",icon:"../images/annotation/oval.png"},{id:"OT_star",title:"Star",icon:"../images/annotation/star.png",points:[[.5+.5*Math.cos(90*(Math.PI/180)),.5+.5*Math.sin(90*(Math.PI/180))],[.5+.25*Math.cos(126*(Math.PI/180)),.5+.25*Math.sin(126*(Math.PI/180))],[.5+.5*Math.cos(162*(Math.PI/180)),.5+.5*Math.sin(162*(Math.PI/180))],[.5+.25*Math.cos(198*(Math.PI/180)),.5+.25*Math.sin(198*(Math.PI/180))],[.5+.5*Math.cos(234*(Math.PI/180)),.5+.5*Math.sin(234*(Math.PI/180))],[.5+.25*Math.cos(270*(Math.PI/180)),.5+.25*Math.sin(270*(Math.PI/180))],[.5+.5*Math.cos(306*(Math.PI/180)),.5+.5*Math.sin(306*(Math.PI/180))],[.5+.25*Math.cos(342*(Math.PI/180)),.5+.25*Math.sin(342*(Math.PI/180))],[.5+.5*Math.cos(18*(Math.PI/180)),.5+.5*Math.sin(18*(Math.PI/180))],[.5+.25*Math.cos(54*(Math.PI/180)),.5+.25*Math.sin(54*(Math.PI/180))],[.5+.5*Math.cos(90*(Math.PI/180)),.5+.5*Math.sin(90*(Math.PI/180))]]}]},{id:"OT_colors",title:"Colors",icon:"",items:{}},{id:"OT_line_width",title:"Line Width",icon:"../images/annotation/line_width.png",items:{}},{id:"OT_clear",title:"Clear",icon:"../images/annotation/clear.png"}],f=["#1abc9c","#2ecc71","#3498db","#9b59b6","#8e44ad","#f1c40f","#e67e22","#e74c3c","#ded5d5"],v=10/6,y=t.throttle(function(){s.onResize()},1e3),I=function(){var t,n;if(c.externalWindow){var i={width:c.externalWindow.innerWidth,height:c.externalWindow.innerHeight},o=i.width/v;o<=i.height?(t=i.width,n=o):(n=i.height,t=n*v)}else{var a=c.absoluteParent||c.canvasContainer;t=e(a).width(),n=e(a).height()}e(c.canvasContainer).css({width:t,height:n}),e(c.canvas).css({width:t,height:n}),e(c.canvas).attr({width:t,height:n}),y(),u("resizeCanvas")},b=function(){e(c.resizeSubject).on("resize",t.throttle(function(){I()},500))},w=function(e,n,i){var o=t.property("toolbarId")(n)||"toolbar",a=t.property("toolbarItems")(n)||p,s=t.property("colors")(n)||f,r=function(){var t=i?i:window;return t.document.getElementById(o)};toolbar=new OTSolution.Annotations.Toolbar({session:e,container:r(),colors:s,items:a,externalWindow:i||null}),toolbar.itemClicked(function(t){var e={OT_pen:l.actionFreeHand,OT_colors:l.actionPickerColor,OT_text:l.actionText,OT_clear:l.actionErase},n=e[t];n&&h(n,l.variationSuccess)})},_=function(){var t=e.Deferred(),n=.8*screen.width|0,i=n/v,o=["templates/screenshare.html?opentok-annotation"].join(""),a=["toolbar=no","location=no","directories=no","status=no","menubar=no","scrollbars=no","resizable=no","copyhistory=no",["width=",n].join(""),["height=",i].join(""),["left=",screen.width/2-n/2].join(""),["top=",screen.height/2-i/2].join("")].join(","),s=window.open(o,"",a);window.onbeforeunload=function(){s.close()},s.toolbar=toolbar,s.OT=OT,s.$=e,s.triggerCloseEvent=function(){u("annotationWindowClosed")};var r=function(){s.createContainerElements?e(s.document).ready(function(){t.resolve(s)}):setTimeout(r,100)};return r(),t.promise()},T=function(){e(c.resizeSubject).off("resize",I),toolbar.remove()},W=function(n,i){var o=e.Deferred();return t.property("screensharing")(i)?_().then(function(t){w(n,i,t),toolbar.createPanel(t),u("startAnnotation",t),h(l.actionStart,l.variationSuccess),o.resolve(t)}):(w(n,i),u("startAnnotation"),h(l.actionStart,l.variationSuccess),o.resolve()),o.promise()},x=function(n,i,o){c.resizeSubject=t.property("externalWindow")(o)||window,c.externalWindow=t.property("externalWindow")(o)||null,c.absoluteParent=t.property("absoluteParent")(o)||null,c.canvasContainer=i,s=new OTSolution.Annotations({feed:n,container:i,externalWindow:c.externalWindow}),toolbar.addCanvas(s),s.onScreenCapture(function(t){var e=window.open(t,"_blank");e.focus()});var a=c.externalWindow?c.externalWindow:window;c.canvas=e(t.first(a.document.getElementsByTagName("canvas"))),b(),I(),u("linkAnnotation")},M=function(){I()},P=function(t){T(),c.canvas=null,t&&(c.externalWindow&&(c.externalWindow.close(),c.externalWindow=null,c.resizeSubject=null),u("endAnnotation")),h(l.actionEnd,l.variationSuccess)},k=function(e){if(i=this,i.options=t.omit(e,"accPack","session"),o=t.property("accPack")(e),a=t.property("session")(e),!a)throw new Error("OpenTok Annotation Accelerator Pack requires an OpenTok session");g(),d(),h(l.actionInitialize,l.variationSuccess),m()};k.prototype={constructor:k,start:W,linkCanvas:x,resizeCanvas:M,end:P},"object"==typeof exports?module.exports=k:"function"==typeof define&&define.amd?define(function(){return k}):this.AnnotationAccPack=k}.call(this);
var _otkanalytics,_session,_logEventData={clientVersion:"js-vsol-1.0.0",componentId:"annotationsAccPack",name:"guidAnnotationsKit",actionStartDrawing:"Start Drawing",actionEndDrawing:"End Drawing",variationSuccess:"Success"},_logAnalytics=function(){var t=window.location.href,e={clientVersion:_logEventData.clientVersion,source:t,componentId:_logEventData.componentId,name:_logEventData.name};_otkanalytics=new OTKAnalytics(e);var n={sessionId:_session.id,connectionId:_session.connection.connectionId,partnerId:_session.apiKey};_otkanalytics.addSessionInfo(n)},_log=function(t,e){var n={action:t,variation:e};_otkanalytics.logEvent(n)};window.OTSolution=window.OTSolution||{},OTSolution.Annotations=function(t){function e(t,e,n){for(var o=e.split(" "),i=0,a=o.length;i<a;i++)t.addEventListener(o[i],n,!0)}function n(t,e){0===a.width&&(a.width=i.parent.getBoundingClientRect().width),0===a.height&&(a.height=i.parent.getBoundingClientRect().height);var n,o=e?t.canvas.width:i.parent.clientWidth,s=e?t.canvas.height:i.parent.clientHeight,c=e?t.canvas.offsetLeft:a.offsetLeft,l=e?t.canvas.offsetTop:a.offsetTop,d=a.width/o,h=a.height/s,g=t.offsetX||t.pageX-c||t.changedTouches&&t.changedTouches[0].pageX-c,m=t.offsetY||t.pageY-l||t.changedTouches&&t.changedTouches[0].pageY-l,f=g*d,v=m*h,y=e?t.selectedItem:i.selectedItem;if(y)if("OT_pen"===y.id)switch(t.type){case"mousedown":case"touchstart":p.dragging=!0,p.lastX=f,p.lastY=v,i.isStartPoint=!0,_log(_logEventData.actionStartDrawing,_logEventData.variationSuccess);break;case"mousemove":case"touchmove":p.dragging&&(n={id:i.videoFeed.stream.connection.connectionId,fromId:i.session.connection.connectionId,fromX:p.lastX,fromY:p.lastY,toX:f,toY:v,color:e?t.userColor:i.userColor,lineWidth:i.lineWidth,videoWidth:i.videoFeed.videoElement().clientWidth,videoHeight:i.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,startPoint:i.isStartPoint,endPoint:!1,selectedItem:y},x(n,!0),p.lastX=f,p.lastY=v,!e&&A(n),i.isStartPoint=!1);break;case"mouseup":case"touchend":p.dragging=!1,n={id:i.videoFeed.stream.connection.connectionId,fromId:i.session.connection.connectionId,fromX:p.lastX,fromY:p.lastY,toX:f,toY:v,color:e?t.userColor:i.userColor,lineWidth:i.lineWidth,videoWidth:i.videoFeed.videoElement().clientWidth,videoHeight:i.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,startPoint:i.isStartPoint,endPoint:!0,selectedItem:y},x(n,!0),p.lastX=f,p.lastY=v,!e&&A(n),i.isStartPoint=!1,_log(_logEventData.actionEndDrawing,_logEventData.variationSuccess);break;case"mouseout":p.dragging=!1}else if("OT_text"===y.id)n={id:i.videoFeed.stream.connection.connectionId,fromId:i.session.connection.connectionId,fromX:f,fromY:v+t.inputHeight,color:t.userColor,font:t.font,text:t.text,videoWidth:i.videoFeed.videoElement().clientWidth,videoHeight:i.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,selectedItem:y},x(n),!e&&A(n);else if(y&&y.points)switch(p.mX=f,p.mY=v,t.type){case"mousedown":case"touchstart":p.isDrawing=!0,p.dragging=!0,p.startX=f,p.startY=v;break;case"mousemove":case"touchmove":p.dragging&&(n={color:e?t.userColor:i.userColor,lineWidth:e?t.lineWidth:i.lineWidth,selectedItem:y},x(n,!0));break;case"mouseup":case"touchend":p.isDrawing=!1;var w=y.points;if(2===w.length)n={id:i.videoFeed.stream.connection.connectionId,fromId:i.session.connection.connectionId,fromX:p.startX,fromY:p.startY,toX:p.mX,toY:p.mY,color:e?t.userColor:i.userColor,lineWidth:e?t.lineWidth:i.lineWidth,videoWidth:i.videoFeed.videoElement().clientWidth,videoHeight:i.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,smoothed:!1,startPoint:!0,endPoint:!0,selectedItem:y},u.push(n),!e&&A(n);else{for(var I=P(w),b=0;b<w.length;b++){var _=!1,T=!1,W=p.startX+I.x*w[b][0],M=p.startY+I.y*w[b][1];0===b?(p.lastX=W,p.lastY=M,_=!0):b===w.length-1&&(T=!0),n={id:i.videoFeed.stream.connection.connectionId,fromId:i.session.connection.connectionId,fromX:p.lastX,fromY:p.lastY,toX:W,toY:M,color:e?t.userColor:i.userColor,lineWidth:e?t.lineWidth:i.lineWidth,videoWidth:i.videoFeed.videoElement().clientWidth,videoHeight:i.videoFeed.videoElement().clientHeight,canvasWidth:a.width,canvasHeight:a.height,mirrored:r,smoothed:y.enableSmoothing,startPoint:_,endPoint:T},u.push(n),!e&&A(n),p.lastX=W,p.lastY=M}x(null)}p.dragging=!1}}t=t||{},this.widgetVersion="js-1.0.0-beta",this.parent=t.container,this.videoFeed=t.feed;var o=t.externalWindow?t.externalWindow.document:window.document,i=this;if(this.parent){var a=document.createElement("canvas");a.setAttribute("id","opentok_canvas"),a.style.position="absolute",this.parent.appendChild(a),a.setAttribute("width",this.parent.clientWidth+"px"),a.style.width=window.getComputedStyle(this.parent).width,a.setAttribute("height",this.parent.clientHeight+"px"),a.style.height=window.getComputedStyle(this.parent).height}var s,r,c,l,i=this,d=[],h=[],u=[],g=[],m=[],p={dragging:!1};r=(" "+i.videoFeed.element.className+" ").indexOf(" OT_mirrored ")>-1,c=(" "+i.videoFeed.element.className+" ").indexOf(" OT_fit-mode-cover ")>-1,this.canvas=function(){return a},this.link=function(t){this.session=t},this.changeColor=function(t){i.userColor=t,i.lineWidth||(i.lineWidth=2)},this.changeLineWidth=function(t){this.lineWidth=t},this.selectItem=function(t){i.overlay&&(i.overlay.style.display="none",i.overlay=null),"OT_capture"===t.id?(i.selectedItem=t,i.overlay?i.overlay.style="inline":(i.overlay=document.createElement("div"),i.overlay.style.position="absolute",i.overlay.style.width=i.parent.clientWidth+"px",i.overlay.style.height=i.parent.clientHeight+"px",i.overlay.style.background='rgba(0,0,0,0.4) url("../images/annotation/camera.png") no-repeat center',i.overlay.style.backgroundSize="50px 50px",i.overlay.style.cursor="pointer",i.overlay.style.opacity=0,i.parent.appendChild(i.overlay),i.parent.onmouseover=function(){i.overlay.style.opacity=1},i.parent.onmouseout=function(){i.overlay.style.opacity=0},i.overlay.onclick=function(){i.captureScreenshot()})):t.id.indexOf("OT_line_width")!==-1?t.size&&i.changeLineWidth(t.size):i.selectedItem=t},this.colors=function(t){this.colors=t,this.changeColor(t[0])},this.clear=function(){O(!1,i.session.connection.connectionId),i.session&&i.session.signal({type:"otAnnotation_clear"})},this.captureScreenshot=function(){var t=document.createElement("canvas");t.width=a.width,t.height=a.height;var e=i.videoFeed.videoWidth(),n=i.videoFeed.videoHeight(),o=1,s=0,l=0;c?(e<n?(o=a.width/e,e=a.width,n*=o):(o=a.height/n,n=a.height,e*=o),s=(e-a.width)/2,l=(n-a.height)/2):e>n?(o=a.width/e,e=a.width,n*=o):(o=a.height/n,n=a.height,e*=o);var h=new Image;h.onload=function(){var o=t.getContext("2d");r&&(o.translate(e,0),o.scale(-1,1)),o.drawImage(h,s,l,e,n),r&&(o.translate(e,0),o.scale(-1,1)),o.drawImage(a,0,0),d.forEach(function(e){e.call(i,t.toDataURL())}),t=null},h.src="data:image/png;base64,"+i.videoFeed.getImgData()},this.onScreenCapture=function(t){d.push(t)},this.onResize=function(){u=[],E(g,!0),m.forEach(function(t){n(t,!0)})},e(a,"mousedown mousemove mouseup mouseout touchstart touchmove touchend",function(t){var e=i.selectedItem&&"OT_text"===i.selectedItem.id,o="mousemove"===t.type&&!p.dragging;e||o||(t.preventDefault(),t.selectedItem=i.selectedItem,t.selectedItem&&(t.canvas={width:a.width,height:a.height,offsetLeft:a.offsetLeft,offsetTop:a.offsetTop},t.userColor=i.userColor,t.lineWidth=i.lineWidth,m.push(t)),n(t))});var f,v="textAnnotation",y=!1,w=function(t){t.preventDefault(),i.selectedItem&&"OT_text"===i.selectedItem.id&&!y&&(y=!0,t.selectedItem=i.selectedItem,W(t))},I=function(t){13===t.which&&T(),27===t.which&&(o.getElementById(v).remove(),f=null),y=!1},b=function(){o.addEventListener("keydown",I)},_=function(){o.removeEventListener("keydown",I)},T=function(){var t=o.getElementById(v);t.clientHeight;return t.value?(t.remove(),_(),f.text=t.value,f.font="16px Arial",f.userColor=i.userColor,f.canvas={width:a.width,height:a.height,offsetLeft:a.offsetLeft,offsetTop:a.offsetTop},m.push(f),void n(f)):void(f=null)},W=function(t){var e=o.createElement("input");e.setAttribute("type","text"),e.style.position="absolute",e.style.top=t.clientY+"px",e.style.left=t.clientX+"px",e.style.background="rgba(255,255,255, .5)",e.style.width="100px",e.style.maxWidth="200px",e.style.border="1px dashed red",e.style.fontSize="16px",e.style.color=i.userColor,e.style.fontFamily="Arial",e.style.zIndex="1001",e.setAttribute("data-canvas-origin",JSON.stringify({x:t.offsetX,y:t.offsetY})),e.id=v,o.body.appendChild(e),e.focus(),f=t,f.inputHeight=e.clientHeight,b()};e(a,"click",w);var x=function(t,e){s||(s=a.getContext("2d"),s.lineCap="round",s.lineJoin="round",s.fillStyle="solid"),s.clearRect(0,0,a.width,a.height),u.forEach(function(t){s.strokeStyle=t.color,s.lineWidth=t.lineWidth,t.smoothed=!!t.smoothed,t.startPoint=!!t.startPoint;var e=!1,n=!!t.selectedItem&&"Text"===t.selectedItem.title&&t.text;n?(s.font=t.font,s.fillStyle=t.color,s.fillText(t.text,t.fromX,t.fromY)):t.smoothed?(t.startPoint?i.isStartPoint=!0:i.isStartPoint&&(e=!0,i.isStartPoint=!1),t.startPoint?(s.closePath(),s.beginPath()):e?s.moveTo((t.fromX+t.toX)/2,(t.fromY+t.toY)/2):(s.quadraticCurveTo(t.fromX,t.fromY,(t.fromX+t.toX)/2,(t.fromY+t.toY)/2),s.stroke())):(s.beginPath(),s.moveTo(t.fromX,t.fromY),s.lineTo(t.toX,t.toY),s.stroke(),s.closePath())});var n=e?t.selectedItem:i.selectedItem;!n||"Pen"!==n.title&&"Text"!==n.title?p.isDrawing&&(t&&(s.strokeStyle=t.color,s.lineWidth=t.lineWidth),n&&n.points&&M(s,i.selectedItem.points)):t&&("Pen"===n.title&&(s.strokeStyle=t.color,s.lineWidth=t.lineWidth,s.beginPath(),s.moveTo(t.fromX,t.fromY),s.lineTo(t.toX,t.toY),s.stroke(),s.closePath()),"Text"===n.title&&(s.font=t.font,s.fillStyle=t.color,s.fillText(t.text,t.fromX,t.fromY)),u.push(t))},M=function(t,e){var n=P(e);if(t.beginPath(),2===e.length)t.moveTo(p.startX,p.startY),t.lineTo(p.mX,p.mY);else for(var o=0;o<e.length;o++){var a=p.startX+n.x*e[o][0],s=p.startY+n.y*e[o][1];i.selectedItem.enableSmoothing?0===o||(1===o?(t.moveTo((a+p.lastX)/2,(s+p.lastY)/2),p.lastX=(a+p.lastX)/2,p.lastX=(s+p.lastY)/2):(t.quadraticCurveTo(p.lastX,p.lastY,(a+p.lastX)/2,(s+p.lastY)/2),p.lastX=(a+p.lastX)/2,p.lastY=(s+p.lastY)/2)):0===o?t.moveTo(a,s):t.lineTo(a,s),p.lastX=a,p.lastY=s}t.stroke(),t.closePath()},P=function(t){for(var e=Number.MAX_VALUE,n=Number.MAX_VALUE,o=0,i=0,a=0;a<t.length;a++)t[a][0]<e?e=t[a][0]:t[a][0]>o&&(o=t[a][0]),t[a][1]<n?n=t[a][1]:t[a][1]>i&&(i=t[a][1]);var s=Math.abs(o-e),r=Math.abs(i-n),c=(p.mX-p.startX)/s,l=(p.mY-p.startY)/r;return{x:c,y:l}},k=function(t,e,n){var o={width:t.canvasWidth,height:t.canvasHeight},s={width:t.videoWidth,height:t.videoHeight},c={width:i.videoFeed.videoElement().clientWidth,height:i.videoFeed.videoElement().clientHeight},l=1,d=a.width/a.height;c.width/c.height,o.width/o.height,s.width/s.height;l=d<0?a.width/o.width:a.height/o.height;var h=a.width/2,m=a.height/2,p=o.width/2,f=o.height/2;t.fromX=h-l*(p-t.fromX),t.fromY=m-l*(f-t.fromY),t.toX=h-l*(p-t.toX),t.toY=m-l*(f-t.toY),t.mirrored=!!t.mirrored,t.mirrored&&(t.fromX=a.width-t.fromX,t.toX=a.width-t.toX),r&&(t.fromX=a.width-t.fromX,t.toX=a.width-t.toX);var v=JSON.parse(JSON.stringify(t));v.canvasWidth=a.width,v.canvasHeight=a.height,v.videoWidth=c.width,v.videoHeight=c.height,e?g[n]=v:g.push(v),u.push(t),x(null)},E=function(t,e){t.forEach(function(t,n){t.id===i.videoFeed.stream.connection.connectionId&&k(t,e,n)})},O=function(t,e){u=u.filter(function(t){return console.log(t.fromId),t.fromId!==e}),t?g=[]:(i.session&&i.session.signal({type:"otAnnotation_clear"}),m=[]),x()};i.videoFeed.session&&i.videoFeed.session.on({"signal:otAnnotation_pen":function(t){t.from.connectionId!==i.session.connection.connectionId&&E(JSON.parse(t.data))},"signal:otAnnotation_text":function(t){t.from.connectionId!==i.session.connection.connectionId&&E(JSON.parse(t.data))},"signal:otAnnotation_history":function(t){l&&l!==t.from.connectionId||(l=t.from.connectionId,E(JSON.parse(t.data)))},"signal:otAnnotation_clear":function(t){t.from.connectionId!==i.session.connection.connectionId&&O(!0,t.from.connectionId)},connectionCreated:function(t){u.length>0&&t.connection.connectionId!==i.session.connection.connectionId&&S("otWhiteboard_history",u,t.connection)}});var C,S=function(t,e){for(var n=t.slice(),o=function(t){t&&TB.error(t)},a="otAnnotation_pen",s=function(t){if(t&&t[0]&&t[0].selectedItem&&t[0].selectedItem.id){var e=t[0].selectedItem.id;a="OT_text"===e?"otAnnotation_text":"otAnnotation_pen"}};n.length;){var r=n.splice(0,Math.min(n.length,32));s(r);var c={type:a,data:JSON.stringify(r)};e&&(c.to=e),i.session.signal(c,o)}},A=function(t){i.session&&(h.push(t),C||(C=setTimeout(function(){S(h),h=[],C=null},100)))}},OTSolution.Annotations.Toolbar=function(t){var e=this,n=this;if(_otkanalytics||_logAnalytics(),t||(t={}),!t.session)throw new Error("OpenTok Annotation Widget requires an OpenTok session");_session=t.session,this.session=t.session,this.parent=t.container,this.externalWindow=t.externalWindow,this.backgroundColor=t.backgroundColor||"rgba(0, 0, 0, 0.7)",this.buttonWidth=t.buttonWidth||"40px",this.buttonHeight=t.buttonHeight||"40px",this.iconWidth=t.iconWidth||"30px",this.iconHeight=t.iconHeight||"30px",this.items=t.items||[{id:"OT_pen",title:"Pen",icon:"../images/annotation/freehand.png",selectedIcon:"../images/annotation/freehand_selected.png"},{id:"OT_line",title:"Line",icon:"../images/annotation/line.png",selectedIcon:"../images/annotation/line_selected.png",points:[[0,0],[0,1]]},{id:"OT_shapes",title:"Shapes",icon:"../images/annotation/shapes.png",items:[{id:"OT_arrow",title:"Arrow",icon:"../images/annotation/arrow.png",points:[[0,1],[3,1],[3,0],[5,2],[3,4],[3,3],[0,3],[0,1]]},{id:"OT_rect",title:"Rectangle",icon:"../images/annotation/rectangle.png",points:[[0,0],[1,0],[1,1],[0,1],[0,0]]},{id:"OT_oval",title:"Oval",icon:"../images/annotation/oval.png",enableSmoothing:!0,points:[[0,.5],[.5+.5*Math.cos(5*Math.PI/4),.5+.5*Math.sin(5*Math.PI/4)],[.5,0],[.5+.5*Math.cos(7*Math.PI/4),.5+.5*Math.sin(7*Math.PI/4)],[1,.5],[.5+.5*Math.cos(Math.PI/4),.5+.5*Math.sin(Math.PI/4)],[.5,1],[.5+.5*Math.cos(3*Math.PI/4),.5+.5*Math.sin(3*Math.PI/4)],[0,.5],[.5+.5*Math.cos(5*Math.PI/4),.5+.5*Math.sin(5*Math.PI/4)]]}]},{id:"OT_text",title:"Text",icon:"../images/annotation/text.png",selectedIcon:"../images/annotation/text.png"},{id:"OT_colors",title:"Colors",icon:"",items:{}},{id:"OT_line_width",title:"Line Width",icon:"../images/annotation/line_width.png",items:{}},{id:"OT_clear",title:"Clear",icon:"../images/annotation/clear.png"},{id:"OT_capture",title:"Capture",icon:"../images/annotation/camera.png",selectedIcon:"../images/annotation/camera_selected.png"}],this.colors=t.colors||["#1abc9c","#2ecc71","#3498db","#9b59b6","#34495e","#16a085","#27ae60","#2980b9","#8e44ad","#2c3e50","#f1c40f","#e67e22","#e74c3c","#ecf0f1","#95a5a6","#f39c12","#d35400","#c0392b","#bdc3c7","#7f8c8d"],this.cbs=[];var o,i=[],a=function(t,e,o){var i=this,a=n.externalWindow?n.externalWindow.document:document;this.getElm=function(t){return"string"==typeof t?a.querySelector(t):t},this.render=function(){var t=this,e="";t.colors.forEach(function(n){e+=t.options.template.replace(/\{color\}/g,n)}),t.elm.innerHTML=e},this.close=function(){this.elm.style.display="none"},this.open=function(){this.elm.style.display=this.options.style.display},this.colorChosen=function(t){this.cbs.push(t)},this.set=function(t,e){var n=this;n.color=t,e!==!1&&n.cbs.forEach(function(e){e.call(n,t)})},o=o||{},o.openEvent=o.openEvent||"click",o.style=Object(o.style),o.style.display=o.style.display||"block",o.template=o.template||'<div class="color-choice" data-col="{color}" style="background-color: {color}"></div>',i.elm=i.getElm(t),i.cbs=[],i.colors=e,i.options=o,i.render(),i.elm.addEventListener("click",function(t){var e=t.target.getAttribute("data-col");e&&(i.set(e),i.close())}),o.autoclose!==!1&&i.close()};this.createPanel=function(t){if(n.parent){var r=t?t.document:document;o=r.createElement("div"),o.setAttribute("id","OT_toolbar"),o.setAttribute("class","OT_panel"),o.style.width="100%",o.style.height="100%",o.style.backgroundColor=this.backgroundColor,this.parent.appendChild(o),this.parent.style.position="relative",this.parent.zIndex=1e3;for(var c=[],l=r.createElement("div"),d=0,h=this.items.length;d<h;d++){var u=this.items[d],g=r.createElement("input");if(g.setAttribute("type","button"),g.setAttribute("id",u.id),g.style.position="relative",g.style.top="50%",g.style.transform="translateY(-50%)","OT_colors"===u.id){g.style.webkitTransform="translateY(-85%)";var m=r.createElement("div");m.setAttribute("class","color-picker"),m.style.backgroundColor=this.backgroundColor,this.parent.appendChild(m);var p=new a(".color-picker",this.colors,{externalWindow:n.externalWindow});p.colorChosen(function(t){var e=r.getElementById("OT_colors");e.style.backgroundColor=t,i.forEach(function(e){e.changeColor(t)})});for(var f=r.querySelectorAll(".color-choice"),v=0;v<f.length;v++)f[v].style.display="inline-block",f[v].style.width="30px",f[v].style.height="30px",f[v].style.margin="5px",f[v].style.cursor="pointer",f[v].style.borderRadius="100%",f[v].style.opacity=.7,f[v].onmouseover=function(){this.style.opacity=1},f[v].onmouseout=function(){this.style.opacity=.7};g.setAttribute("class","OT_color"),g.style.marginLeft="10px",g.style.marginRight="10px",g.style.borderRadius="50%",g.style.backgroundColor=this.colors[0],g.style.width=this.iconWidth,g.style.height=this.iconHeight,g.style.paddingTop=this.buttonHeight.replace("px","")-this.iconHeight.replace("px","")+"px"}else g.style.background='url("'+u.icon+'") no-repeat',g.style.backgroundSize=this.iconWidth+" "+this.iconHeight,g.style.backgroundPosition="center",g.style.width=this.buttonWidth,g.style.height=this.buttonHeight;"Line Width"!==u.title||Array.isArray(u.items)||(u.items=[{id:"OT_line_width_2",title:"Line Width 2",size:2},{id:"OT_line_width_4",title:"Line Width 4",size:4},{id:"OT_line_width_6",title:"Line Width 6",size:6},{id:"OT_line_width_8",title:"Line Width 8",size:8},{id:"OT_line_width_10",title:"Line Width 10",size:10},{id:"OT_line_width_12",title:"Line Width 12",size:12},{id:"OT_line_width_14",title:"Line Width 14",size:14}]),u.items&&g.setAttribute("data-type","group"),g.setAttribute("data-col",u.title),g.style.border="none",g.style.cursor="pointer",c.push(g.outerHTML)}o.innerHTML=c.join(""),o.onclick=function(t){var n="group"===t.target.getAttribute("data-type"),o=t.target.getAttribute("data-col"),a=t.target.getAttribute("id");n?e.items.forEach(function(t){if(t.title===o){if(e.selectedGroup=t,t.items&&(l.setAttribute("class","OT_subpanel"),l.style.backgroundColor=e.backgroundColor,l.style.width="100%",l.style.height="100%",l.style.paddingLeft="15px",l.style.display="none",e.parent.appendChild(l),Array.isArray(t.items))){var n=[];"OT_line_width"===t.id?t.items.forEach(function(t){var o=r.createElement("div");o.setAttribute("data-col",t.title),o.setAttribute("id",t.id),o.style.position="relative",o.style.top="50%",o.style.transform="translateY(-50%)",o.style["float"]="left",o.style.width=e.buttonWidth,o.style.height=e.buttonHeight,o.style.border="none",o.style.cursor="pointer";var i=r.createElement("div");i.style.backgroundColor="#FFFFFF",i.style.width="80%",i.style.height=t.size+"px",i.style.position="relative",i.style.left="50%",i.style.top="50%",i.style.transform="translateX(-50%) translateY(-50%)",i.style.pointerEvents="none",o.appendChild(i),n.push(o.outerHTML)}):t.items.forEach(function(t){var o=r.createElement("input");o.setAttribute("type","button"),o.setAttribute("data-col",t.title),o.setAttribute("id",t.id),o.style.background='url("'+t.icon+'") no-repeat',o.style.position="relative",o.style.top="50%",o.style.transform="translateY(-50%)",o.style.backgroundSize=e.iconWidth+" "+e.iconHeight,o.style.backgroundPosition="center",o.style.width=e.buttonWidth,o.style.height=e.buttonHeight,o.style.border="none",o.style.cursor="pointer",n.push(o.outerHTML)}),l.innerHTML=n.join("")}"OT_shapes"===a||"OT_line_width"===a?(l&&(l.style.display="block"),p.close()):"OT_colors"===a&&(l&&(l.style.display="none"),p.open())}}):(e.items.forEach(function(t){if("Clear"!==t.title&&t.title===o){if(e.selectedItem){var n=r.getElementById(e.selectedItem.id);n&&(n.style.background='url("'+e.selectedItem.icon+'") no-repeat',n.style.backgroundSize=e.iconWidth+" "+e.iconHeight,n.style.backgroundPosition="center")}if(t.selectedIcon){var a=r.getElementById(t.id);a&&(a.style.background='url("'+t.selectedIcon+'") no-repeat',a.style.backgroundSize=e.iconWidth+" "+e.iconHeight,a.style.backgroundPosition="center")}return e.selectedItem=t,s(t),i.forEach(function(t){t.selectItem(e.selectedItem)}),!1}}),l.style.display="none"),e.cbs.forEach(function(t){t.call(e,a)})},l.onclick=function(t){var n="group"===t.target.getAttribute("data-type"),o=(t.target.getAttribute("data-col"),t.target.getAttribute("id"));l.style.display="none",n||e.selectedGroup.items.forEach(function(t){if("OT_clear"!==t.id&&t.id===o){if(e.selectedItem){var n=document.getElementById(e.selectedItem.id);n&&(n.style.background='url("'+e.selectedItem.icon+'") no-repeat',n.style.backgroundSize=e.iconWidth+" "+e.iconHeight,n.style.backgroundPosition="center")}if(t.selectedIcon){var a=document.getElementById(t.id);n&&(a.style.background='url("'+t.selectedIcon+'") no-repeat',a.style.backgroundSize=e.iconWidth+" "+e.iconHeight,a.style.backgroundPosition="center")}return e.selectedItem=t,s(t),i.forEach(function(t){t.selectItem(e.selectedItem)}),!1}}),e.cbs.forEach(function(t){t.call(e,o)})},r.getElementById("OT_clear").onclick=function(){i.forEach(function(t){t.clear()})}}},!this.externalWindow&&this.createPanel();var s=function(t){t.points||("OT_line"===t.id?e.selectedItem.points=[[0,0],[0,1]]:"OT_arrow"===t.id?e.selectedItem.points=[[0,1],[3,1],[3,0],[5,2],[3,4],[3,3],[0,3],[0,1]]:"OT_rect"===t.id?e.selectedItem.points=[[0,0],[1,0],[1,1],[0,1],[0,0]]:"OT_oval"===t.id&&(e.selectedItem.enableSmoothing=!0,e.selectedItem.points=[[0,.5],[.5+.5*Math.cos(5*Math.PI/4),.5+.5*Math.sin(5*Math.PI/4)],[.5,0],[.5+.5*Math.cos(7*Math.PI/4),.5+.5*Math.sin(7*Math.PI/4)],[1,.5],[.5+.5*Math.cos(Math.PI/4),.5+.5*Math.sin(Math.PI/4)],[.5,1],[.5+.5*Math.cos(3*Math.PI/4),.5+.5*Math.sin(3*Math.PI/4)],[0,.5],[.5+.5*Math.cos(5*Math.PI/4),.5+.5*Math.sin(5*Math.PI/4)]]))};this.itemClicked=function(t){this.cbs.push(t)},this.addCanvas=function(t){var e=this;t.link(e.session),t.colors(e.colors),i.push(t)},this.removeCanvas=function(t){i.forEach(function(e){var n=e.canvas();e.videoFeed.stream.connection.connectionId===t&&n.parentNode&&n.parentNode.removeChild(n)}),i=i.filter(function(e){return e.videoFeed.stream.connection.connectionId!==t})},this.remove=function(){try{o.parentNode.removeChild(o)}catch(t){console.log(t)}i.forEach(function(t){var e=t.canvas();e.parentNode&&e.parentNode.removeChild(e)}),i=[]}},function(){var t,e,n;"object"==typeof module&&"object"==typeof module.exports?(t=require("underscore"),e=require("jquery"),n=require("opentok-solutions-logging")):(t=this._,e=this.$,n=this.OTKAnalytics);var o,i,a,s,r,c={},l={clientVersion:"js-vsol-1.0.0",componentId:"annotationsAccPack",name:"guidAnnotationsKit",actionInitialize:"Init",actionStart:"Start",actionEnd:"End",actionFreeHand:"Free Hand",actionPickerColor:"Picker Color",actionText:"Text",actionScreenCapture:"Screen Capture",actionErase:"Erase",actionUseToolbar:"Use Toolbar",variationAttempt:"Attempt",variationError:"Failure",variationSuccess:"Success"},d=function(){var t=window.location.href,e={clientVersion:l.clientVersion,source:t,componentId:l.componentId,name:l.name};r=new n(e);var o={sessionId:a.id,connectionId:a.connection.connectionId,partnerId:a.apiKey};r.addSessionInfo(o)},h=function(t,e){var n={action:t,variation:e};r.logEvent(n)},u=function(t,e){i&&i.triggerEvent(t,e)},g=function(){var t=["startAnnotation","linkAnnotation","resizeCanvas","annotationWindowClosed","endAnnotation"];i.registerEvents(t)},m=function(){var t=['<div class="annotation-toolbar-container">','<div id="toolbar"></div>',"</div>"].join("\n");e("body").append(t),h(l.actionUseToolbar,l.variationSuccess)},p=[{id:"OT_pen",title:"Pen",icon:"../images/annotation/freehand.png",selectedIcon:"../images/annotation/freehand_selected.png"},{id:"OT_line",title:"Line",icon:"../images/annotation/line.png",selectedIcon:"../images/annotation/line_selected.png"},{id:"OT_text",title:"Text",icon:"../images/annotation/text.png",selectedIcon:"../images/annotation/text.png"},{id:"OT_shapes",title:"Shapes",icon:"../images/annotation/shapes.png",items:[{id:"OT_arrow",title:"Arrow",icon:"../images/annotation/arrow.png"},{id:"OT_rect",title:"Rectangle",icon:"../images/annotation/rectangle.png"},{id:"OT_oval",title:"Oval",icon:"../images/annotation/oval.png"},{id:"OT_star",title:"Star",icon:"../images/annotation/star.png",points:[[.5+.5*Math.cos(90*(Math.PI/180)),.5+.5*Math.sin(90*(Math.PI/180))],[.5+.25*Math.cos(126*(Math.PI/180)),.5+.25*Math.sin(126*(Math.PI/180))],[.5+.5*Math.cos(162*(Math.PI/180)),.5+.5*Math.sin(162*(Math.PI/180))],[.5+.25*Math.cos(198*(Math.PI/180)),.5+.25*Math.sin(198*(Math.PI/180))],[.5+.5*Math.cos(234*(Math.PI/180)),.5+.5*Math.sin(234*(Math.PI/180))],[.5+.25*Math.cos(270*(Math.PI/180)),.5+.25*Math.sin(270*(Math.PI/180))],[.5+.5*Math.cos(306*(Math.PI/180)),.5+.5*Math.sin(306*(Math.PI/180))],[.5+.25*Math.cos(342*(Math.PI/180)),.5+.25*Math.sin(342*(Math.PI/180))],[.5+.5*Math.cos(18*(Math.PI/180)),.5+.5*Math.sin(18*(Math.PI/180))],[.5+.25*Math.cos(54*(Math.PI/180)),.5+.25*Math.sin(54*(Math.PI/180))],[.5+.5*Math.cos(90*(Math.PI/180)),.5+.5*Math.sin(90*(Math.PI/180))]]}]},{id:"OT_colors",title:"Colors",icon:"",items:{}},{id:"OT_line_width",title:"Line Width",icon:"../images/annotation/line_width.png",items:{}},{id:"OT_clear",title:"Clear",icon:"../images/annotation/clear.png"}],f=["#1abc9c","#2ecc71","#3498db","#9b59b6","#8e44ad","#f1c40f","#e67e22","#e74c3c","#ded5d5"],v=10/6,y=t.throttle(function(){s.onResize()},1e3),w=function(){var t,n;if(c.externalWindow){var o={width:c.externalWindow.innerWidth,height:c.externalWindow.innerHeight},i=o.width/v;i<=o.height?(t=o.width,n=i):(n=o.height,t=n*v)}else{var a=c.absoluteParent||c.canvasContainer;t=e(a).width(),n=e(a).height()}e(c.canvasContainer).css({width:t,height:n}),e(c.canvas).css({width:t,height:n}),e(c.canvas).attr({width:t,height:n}),y(),u("resizeCanvas")},I=function(){e(c.resizeSubject).on("resize",t.throttle(function(){w()},500))},b=function(e,n,o){var i=t.property("toolbarId")(n)||"toolbar",a=t.property("toolbarItems")(n)||p,s=t.property("colors")(n)||f,r=function(){var t=o?o:window;return t.document.getElementById(i)};toolbar=new OTSolution.Annotations.Toolbar({session:e,container:r(),colors:s,items:a,externalWindow:o||null}),toolbar.itemClicked(function(t){var e={OT_pen:l.actionFreeHand,OT_colors:l.actionPickerColor,OT_text:l.actionText,OT_clear:l.actionErase},n=e[t];n&&h(n,l.variationSuccess)})},_=function(){var t=e.Deferred(),n=.8*screen.width|0,o=n/v,i=["templates/screenshare.html?opentok-annotation"].join(""),a=["toolbar=no","location=no","directories=no","status=no","menubar=no","scrollbars=no","resizable=no","copyhistory=no",["width=",n].join(""),["height=",o].join(""),["left=",screen.width/2-n/2].join(""),["top=",screen.height/2-o/2].join("")].join(","),s=window.open(i,"",a);window.onbeforeunload=function(){s.close()},s.toolbar=toolbar,s.OT=OT,s.$=e,s.triggerCloseEvent=function(){u("annotationWindowClosed")};var r=function(){s.createContainerElements?e(s.document).ready(function(){t.resolve(s)}):setTimeout(r,100)};return r(),t.promise()},T=function(){e(c.resizeSubject).off("resize",w),toolbar.remove()},W=function(n,o){var i=e.Deferred();return t.property("screensharing")(o)?_().then(function(t){b(n,o,t),toolbar.createPanel(t),u("startAnnotation",t),h(l.actionStart,l.variationSuccess),i.resolve(t)}):(b(n,o),u("startAnnotation"),h(l.actionStart,l.variationSuccess),i.resolve()),i.promise()},x=function(n,o,i){c.resizeSubject=t.property("externalWindow")(i)||window,c.externalWindow=t.property("externalWindow")(i)||null,c.absoluteParent=t.property("absoluteParent")(i)||null,c.canvasContainer=o,s=new OTSolution.Annotations({feed:n,container:o,externalWindow:c.externalWindow}),toolbar.addCanvas(s),s.onScreenCapture(function(t){var e=window.open(t,"_blank");e.focus()});var a=c.externalWindow?c.externalWindow:window;c.canvas=e(t.first(a.document.getElementsByTagName("canvas"))),I(),w(),u("linkAnnotation")},M=function(){w()},P=function(t){T(),c.canvas=null,t&&(c.externalWindow&&(c.externalWindow.close(),c.externalWindow=null,c.resizeSubject=null),u("endAnnotation")),h(l.actionEnd,l.variationSuccess)},k=function(e){if(o=this,o.options=t.omit(e,"accPack","session"),i=t.property("accPack")(e),a=t.property("session")(e),!a)throw new Error("OpenTok Annotation Accelerator Pack requires an OpenTok session");g(),d(),h(l.actionInitialize,l.variationSuccess),m()};k.prototype={constructor:k,start:W,linkCanvas:x,resizeCanvas:M,end:P},"object"==typeof exports?module.exports=k:"function"==typeof define&&define.amd?define(function(){return k}):this.AnnotationAccPack=k}.call(this);
{
"name": "opentok-annotation",
"version": "1.0.20",
"version": "1.0.21",
"description": "OpenTok annotation accelerator pack",

@@ -5,0 +5,0 @@ "main": "dist/opentok-annotation.js",

@@ -1086,10 +1086,6 @@ /*!

if (!_otkanalytics) {
_logAnalytics();
}
options || (options = {});
if (!options.session) {
throw new Error('OpenTok Annotation Widget requires an OpenTok session');
throw new Error('OpenTok Annotation Widget requires an OpenTok session');
} else {

@@ -1099,2 +1095,6 @@ _session = options.session;

if (!_otkanalytics) {
_logAnalytics();
}
this.session = options.session;

@@ -1101,0 +1101,0 @@ this.parent = options.container;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc