Socket
Socket
Sign inDemoInstall

opentok-annotation

Package Overview
Dependencies
3
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.11 to 1.0.12

2

dist/opentok-annotation.min.js

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

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;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},M(n,!0),p.lastX=f,p.lastY=v,!e&&S(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:!1,selectedItem:y},M(n,!0),p.lastX=f,p.lastY=v,!e&&S(n),o.isStartPoint=!1;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},M(n),!e&&S(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},M(n,!0));break;case"mouseup":case"touchend":p.isDrawing=!1;var b=y.points;if(2===b.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&&S(n);else{for(var I=P(b),w=0;w<b.length;w++){var T=!1,_=!1,W=p.startX+I.x*b[w][0],x=p.startY+I.y*b[w][1];0===w?(p.lastX=W,p.lastY=x,T=!0):w===b.length-1&&(_=!0),n={id:o.videoFeed.stream.connection.connectionId,fromId:o.session.connection.connectionId,fromX:p.lastX,fromY:p.lastY,toX:W,toY:x,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:T,endPoint:_},u.push(n),!e&&S(n),p.lastX=W,p.lastY=x}M(null)}p.dragging=!1}}t=t||{},this.widgetVersion="js-1.0.0-beta",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(){k(!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=[],O(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,b=function(t){t.preventDefault(),o.selectedItem&&"OT_text"!==o.selectedItem.id||y||(y=!0,t.selectedItem=o.selectedItem,W(t))},I=function(t){13===t.which&&_(),27===t.which&&(i.getElementById(v).remove(),f=null),y=!1},w=function(){i.addEventListener("keydown",I)},T=function(){i.removeEventListener("keydown",I)},_=function(){var t=i.getElementById(v);t.clientHeight;return t.value?(t.remove(),T(),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",b);var M=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&&x(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))},x=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}},C=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),M(null)},O=function(t,e){t.forEach(function(t,n){t.id===o.videoFeed.stream.connection.connectionId&&C(t,e,n)})},k=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=[]),M()};o.videoFeed.session&&o.videoFeed.session.on({"signal:otAnnotation_pen":function(t){t.from.connectionId!==o.session.connection.connectionId&&O(JSON.parse(t.data))},"signal:otAnnotation_text":function(t){t.from.connectionId!==o.session.connection.connectionId&&O(JSON.parse(t.data))},"signal:otAnnotation_history":function(t){l&&l!==t.from.connectionId||(l=t.from.connectionId,O(JSON.parse(t.data)))},"signal:otAnnotation_clear":function(t){t.from.connectionId!==o.session.connection.connectionId&&k(!0,t.from.connectionId)},connectionCreated:function(t){u.length>0&&t.connection.connectionId!==o.session.connection.connectionId&&A("otWhiteboard_history",u,t.connection)}});var E,A=function(t,e,n){for(var i=e.slice(),a=function(t){t&&TB.error(t)};i.length;){var s=i.splice(0,Math.min(i.length,32)),r={type:t,data:JSON.stringify(s)};n&&(r.to=n),o.session.signal(r,a)}},S=function(t){o.session&&(h.push(t),E||(E=setTimeout(function(){A("otAnnotation_pen",h),h=[],E=null},100)))}},OTSolution.Annotations.Toolbar=function(t){var e=this,n=this;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,i,o,a={},s={clientVersion:"js-vsol-1.0.0",componentId:"annotationsKit",name:"guidAnnotationsKit",actionInitialize:"Init",actionStart:"Start",actionEnd:"Done",actionFreeHand:"FreeHand",actionPickerColor:"PickerColor",actionText:"Text",actionScreenCapture:"ScreenCapture",actionErase:"Erase",variationAttempt:"Attempt",variationError:"Failure",variationSuccess:"Success"},r=function(){var t=window.location.href,e={clientVersion:s.clientVersion,source:t,componentId:s.componentId,name:s.name};o=new OTKAnalytics(e);var i={sessionId:n.id,connectionId:n.connection.connectionId,partnerId:n.apiKey};o.addSessionInfo(i)},c=function(t,e){var n={action:t,variation:e};o.logEvent(n)},l=function(t,n){e&&e.triggerEvent(t,n)},d=function(){var t=["startAnnotation","linkAnnotation","resizeCanvas","annotationWindowClosed","endAnnotation"];e.registerEvents(t)},h=function(){var t=['<div id="toolbar"></div>'].join("\n");$("body").append(t)},u=[{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"}],g=["#1abc9c","#2ecc71","#3498db","#9b59b6","#8e44ad","#f1c40f","#e67e22","#e74c3c","#ded5d5"],m=10/6,p=_.throttle(function(){i.onResize()},1e3),f=function(){var t,e;if(a.externalWindow){var n={width:a.externalWindow.innerWidth,height:a.externalWindow.innerHeight},i=n.width/m;i<=n.height?(t=n.width,e=i):(e=n.height,t=e*m)}else{var o=a.absoluteParent||a.canvasContainer;t=$(o).width(),e=$(o).height()}$(a.canvasContainer).css({width:t,height:e}),$(a.canvas).css({width:t,height:e}),$(a.canvas).attr({width:t,height:e}),p(),l("resizeCanvas")},v=function(){$(a.resizeSubject).on("resize",_.throttle(function(){f()},500))},y=function(t,e,n){var i=_.property("toolbarId")(e)||"toolbar",o=_.property("toolbarItems")(e)||u,a=_.property("colors")(e)||g,r=function(){var t=n?n:window;return t.document.getElementById(i)};toolbar=new OTSolution.Annotations.Toolbar({session:t,container:r(),colors:a,items:o,externalWindow:n||null}),toolbar.itemClicked(function(t){var e={OT_pen:s.actionFreeHand,OT_colors:s.actionPickerColor,OT_text:s.actionText,OT_clear:s.actionErase},n=e[t];n&&(c(n,s.variationAttempt),c(n,s.variationSuccess))})},b=function(){var t=$.Deferred(),e=.8*screen.width|0,n=e/m,i=["templates/screenshare.html?opentok-annotation"].join(""),o=["toolbar=no","location=no","directories=no","status=no","menubar=no","scrollbars=no","resizable=no","copyhistory=no",["width=",e].join(""),["height=",n].join(""),["left=",screen.width/2-e/2].join(""),["top=",screen.height/2-n/2].join("")].join(","),a=window.open(i,"",o);window.onbeforeunload=function(){a.close()},a.toolbar=toolbar,a.OT=OT,a.$=$,a.triggerCloseEvent=function(){l("annotationWindowClosed")};var s=function(){a.createContainerElements?$(a.document).ready(function(){t.resolve(a)}):setTimeout(s,100)};return s(),t.promise()},I=function(){$(a.resizeSubject).off("resize",f),toolbar.remove()},w=function(t,e){var n=$.Deferred();return c(s.actionStart,s.variationAttempt),_.property("screensharing")(e)?b().then(function(i){y(t,e,i),toolbar.createPanel(i),l("startAnnotation",i),c(s.actionStart,s.variationSuccess),n.resolve(i)}):(y(t,e),l("startAnnotation"),c(s.actionStart,s.variationSuccess),n.resolve()),n.promise()},T=function(t,e,n){a.resizeSubject=_.property("externalWindow")(n)||window,a.externalWindow=_.property("externalWindow")(n)||null,a.absoluteParent=_.property("absoluteParent")(n)||null,a.canvasContainer=e,i=new OTSolution.Annotations({feed:t,container:e,externalWindow:a.externalWindow}),toolbar.addCanvas(i),i.onScreenCapture(function(t){var e=window.open(t,"_blank");e.focus()});var o=a.externalWindow?a.externalWindow:window;a.canvas=$(_.first(o.document.getElementsByTagName("canvas"))),v(),f(),l("linkAnnotation")},W=function(){f()},M=function(t){c(s.actionEnd,s.variationAttempt),I(),a.canvas=null,t&&(a.externalWindow&&(a.externalWindow.close(),a.externalWindow=null,a.resizeSubject=null),l("endAnnotation")),c(s.actionEnd,s.variationSuccess)},x=function(i){if(t=this,t.options=_.omit(i,"accPack","session"),e=_.property("accPack")(i),n=_.property("session")(i),!n)throw new Error("OpenTok Annotation Accelerator Pack requires an OpenTok session");d(),h(),r(),c(s.actionInitialize,s.variationAttempt),c(s.actionInitialize,s.variationSuccess)};x.prototype={constructor:x,start:w,linkCanvas:T,resizeCanvas:W,end:M},"object"==typeof exports?module.exports=x:"function"==typeof define&&define.amd?define(function(){return x}):this.AnnotationAccPack=x}.call(this);
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;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&&S(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&&S(n),o.isStartPoint=!1;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&&S(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&&S(n);else{for(var b=P(I),w=0;w<I.length;w++){var T=!1,_=!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,T=!0):w===I.length-1&&(_=!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:T,endPoint:_},u.push(n),!e&&S(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 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(){k(!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=[],O(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&&_(),27===t.which&&(i.getElementById(v).remove(),f=null),y=!1},w=function(){i.addEventListener("keydown",b)},T=function(){i.removeEventListener("keydown",b)},_=function(){var t=i.getElementById(v);t.clientHeight;return t.value?(t.remove(),T(),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}},C=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)},O=function(t,e){t.forEach(function(t,n){t.id===o.videoFeed.stream.connection.connectionId&&C(t,e,n)})},k=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&&O(JSON.parse(t.data))},"signal:otAnnotation_text":function(t){t.from.connectionId!==o.session.connection.connectionId&&O(JSON.parse(t.data))},"signal:otAnnotation_history":function(t){l&&l!==t.from.connectionId||(l=t.from.connectionId,O(JSON.parse(t.data)))},"signal:otAnnotation_clear":function(t){t.from.connectionId!==o.session.connection.connectionId&&k(!0,t.from.connectionId)},connectionCreated:function(t){u.length>0&&t.connection.connectionId!==o.session.connection.connectionId&&A("otWhiteboard_history",u,t.connection)}});var E,A=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)}},S=function(t){o.session&&(h.push(t),E||(E=setTimeout(function(){A(h),h=[],E=null},100)))}},OTSolution.Annotations.Toolbar=function(t){var e=this,n=this;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,i,o,a={},s={clientVersion:"js-vsol-1.0.0",componentId:"annotationsKit",name:"guidAnnotationsKit",actionInitialize:"Init",actionStart:"Start",actionEnd:"Done",actionFreeHand:"FreeHand",actionPickerColor:"PickerColor",actionText:"Text",actionScreenCapture:"ScreenCapture",actionErase:"Erase",variationAttempt:"Attempt",variationError:"Failure",variationSuccess:"Success"},r=function(){var t=window.location.href,e={clientVersion:s.clientVersion,source:t,componentId:s.componentId,name:s.name};o=new OTKAnalytics(e);var i={sessionId:n.id,connectionId:n.connection.connectionId,partnerId:n.apiKey};o.addSessionInfo(i)},c=function(t,e){var n={action:t,variation:e};o.logEvent(n)},l=function(t,n){e&&e.triggerEvent(t,n)},d=function(){var t=["startAnnotation","linkAnnotation","resizeCanvas","annotationWindowClosed","endAnnotation"];e.registerEvents(t)},h=function(){var t=['<div id="toolbar"></div>'].join("\n");$("body").append(t)},u=[{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"}],g=["#1abc9c","#2ecc71","#3498db","#9b59b6","#8e44ad","#f1c40f","#e67e22","#e74c3c","#ded5d5"],m=10/6,p=_.throttle(function(){i.onResize()},1e3),f=function(){var t,e;if(a.externalWindow){var n={width:a.externalWindow.innerWidth,height:a.externalWindow.innerHeight},i=n.width/m;i<=n.height?(t=n.width,e=i):(e=n.height,t=e*m)}else{var o=a.absoluteParent||a.canvasContainer;t=$(o).width(),e=$(o).height()}$(a.canvasContainer).css({width:t,height:e}),$(a.canvas).css({width:t,height:e}),$(a.canvas).attr({width:t,height:e}),p(),l("resizeCanvas")},v=function(){$(a.resizeSubject).on("resize",_.throttle(function(){f()},500))},y=function(t,e,n){var i=_.property("toolbarId")(e)||"toolbar",o=_.property("toolbarItems")(e)||u,a=_.property("colors")(e)||g,r=function(){var t=n?n:window;return t.document.getElementById(i)};toolbar=new OTSolution.Annotations.Toolbar({session:t,container:r(),colors:a,items:o,externalWindow:n||null}),toolbar.itemClicked(function(t){var e={OT_pen:s.actionFreeHand,OT_colors:s.actionPickerColor,OT_text:s.actionText,OT_clear:s.actionErase},n=e[t];n&&(c(n,s.variationAttempt),c(n,s.variationSuccess))})},I=function(){var t=$.Deferred(),e=.8*screen.width|0,n=e/m,i=["templates/screenshare.html?opentok-annotation"].join(""),o=["toolbar=no","location=no","directories=no","status=no","menubar=no","scrollbars=no","resizable=no","copyhistory=no",["width=",e].join(""),["height=",n].join(""),["left=",screen.width/2-e/2].join(""),["top=",screen.height/2-n/2].join("")].join(","),a=window.open(i,"",o);window.onbeforeunload=function(){a.close()},a.toolbar=toolbar,a.OT=OT,a.$=$,a.triggerCloseEvent=function(){l("annotationWindowClosed")};var s=function(){a.createContainerElements?$(a.document).ready(function(){t.resolve(a)}):setTimeout(s,100)};return s(),t.promise()},b=function(){$(a.resizeSubject).off("resize",f),toolbar.remove()},w=function(t,e){var n=$.Deferred();return c(s.actionStart,s.variationAttempt),_.property("screensharing")(e)?I().then(function(i){y(t,e,i),toolbar.createPanel(i),l("startAnnotation",i),c(s.actionStart,s.variationSuccess),n.resolve(i)}):(y(t,e),l("startAnnotation"),c(s.actionStart,s.variationSuccess),n.resolve()),n.promise()},T=function(t,e,n){a.resizeSubject=_.property("externalWindow")(n)||window,a.externalWindow=_.property("externalWindow")(n)||null,a.absoluteParent=_.property("absoluteParent")(n)||null,a.canvasContainer=e,i=new OTSolution.Annotations({feed:t,container:e,externalWindow:a.externalWindow}),toolbar.addCanvas(i),i.onScreenCapture(function(t){var e=window.open(t,"_blank");e.focus()});var o=a.externalWindow?a.externalWindow:window;a.canvas=$(_.first(o.document.getElementsByTagName("canvas"))),v(),f(),l("linkAnnotation")},W=function(){f()},x=function(t){c(s.actionEnd,s.variationAttempt),b(),a.canvas=null,t&&(a.externalWindow&&(a.externalWindow.close(),a.externalWindow=null,a.resizeSubject=null),l("endAnnotation")),c(s.actionEnd,s.variationSuccess)},M=function(i){if(t=this,t.options=_.omit(i,"accPack","session"),e=_.property("accPack")(i),n=_.property("session")(i),!n)throw new Error("OpenTok Annotation Accelerator Pack requires an OpenTok session");d(),h(),r(),c(s.actionInitialize,s.variationAttempt),c(s.actionInitialize,s.variationSuccess)};M.prototype={constructor:M,start:w,linkCanvas:T,resizeCanvas:W,end:x},"object"==typeof exports?module.exports=M:"function"==typeof define&&define.amd?define(function(){return M}):this.AnnotationAccPack=M}.call(this);
{
"name": "opentok-annotation",
"version": "1.0.11",
"version": "1.0.12",
"description": "OpenTok annotation accelerator pack",

@@ -53,3 +53,8 @@ "main": "dist/opentok-annotation.js",

"yuidocjs": "^0.9.0"
},
"dependencies": {
"jquery": "^3.1.0",
"opentok-solutions-logging": "^1.0.6",
"underscore": "^1.8.3"
}
}
/* global OT OTSolution OTKAnalytics ScreenSharingAccPack define */
(function () {
/** Include external dependencies */
var _require = function (dependency) {
var canRequire = typeof exports === 'object' && require !== undefined;
if (canRequire) {
return require(dependency);
}
throw new Error(['Please include', dependency, 'in your project'].join(' '));
};
var _ = this._ || _require('underscore');
var $ = this.$ || _require('jquery');
var OTKAnalytics = this.OTKAnalytics || _require('opentok-solutions-logging');
/** Private variables */
var _this;

@@ -280,7 +294,3 @@ var _accPack;

'resizable=no',
'copyhistory=no',
['width=', width].join(''),
['height=', height].join(''),
['left=', ((screen.width / 2) - (width / 2))].join(''),
['top=', ((screen.height / 2) - (height / 2))].join('')
'copyhistory=no', ['width=', width].join(''), ['height=', height].join(''), ['left=', ((screen.width / 2) - (width / 2))].join(''), ['top=', ((screen.height / 2) - (height / 2))].join('')
].join(',');

@@ -287,0 +297,0 @@

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc