<\/td><\/tr><\/table>');!r||(s=f.find("td.thumbnail"),h=s.find("img"),r(h)&&s.show());f.find("td.filename").text(t).attr("title",t);e=f.find("input.comments").keypress(function(n){n.which===13&&(!e.val()||(o=!0,f.dialog("close")))});f.dialog({resizable:!1,width:400,modal:!0,autoOpen:!0,buttons:{Upload:function(){e.val()?(o=!0,f.dialog("close"),n.setTimeout(function(){e.focus()},1)):alert("Please provide a comment for this attachment.")},Cancel:function(){f.dialog("close")}},close:function(){var n=e.val();f.dialog("destroy").remove();u(o,n)}})},o._uploadImage=function(n){o._hideFlashVideoOverlay()&&i("#webcam_movie_obj, #webcam_movie_embed").css("display","none");var u=n.replace(/^data\:image\/\w+\;base64\,/,""),f=new Blob([r.base64DecToArr(u)],{type:"image/jpeg"}),t="CapturedImage-"+moment().format("YYYYMMDD-HHmmss")+".jpg";o.getFileComments(t,function(t){return t.attr("src",n),!0},function(n,r){(o._hideFlashVideoOverlay()&&i("#webcam_movie_obj, #webcam_movie_embed").css("display",""),n)&&o._uploadFile(f,t,r)})},o._uploadFiles=function(n){var t=i.makeArray(n),r=function(){if(t&&t.length!==0){var n=t.shift();o.getFileComments(n.name,function(t){if(!!n.type&&n.type.indexOf("image/")===0){var i=new FileReader;return i.onload=function(n){t.attr("src",n.target.result)},i.readAsDataURL(n),!0}return!1},function(t,i){t&&(o._uploadFile(n,n.name,i),r())})}};r()},o._uploadFile=function(n,t,r){var f=new FormData,u=new XMLHttpRequest,e=i("").append(i(" ").addClass("fa fa-cog fa-spin")).append(i("").text("Uploading: "+t)).appendTo(o.uploadProgressContainer);f.append("Comments",r);f.append("File",n,t);u.open("POST",o.uploadUrl,!0);u.onreadystatechange=function(){u.readyState===4&&(u.status!==200&&alert("Error Uploading ["+t+"]: "+u.statusText),e.slideUp(400,function(){e.remove()}))};u.send(f)},o.__hideFlashVideoOverlay=null,o._hideFlashVideoOverlay=function(){if(o.__hideFlashVideoOverlay===null){o.__hideFlashVideoOverlay=!1;try{var n=/(windows nt) ([\w.]+)/.exec(navigator.userAgent.toLowerCase());!!n&&parseFloat(n[2])<=6.2&&(o.__hideFlashVideoOverlay=!0)}catch(t){}}return o.__hideFlashVideoOverlay},o};t.Disco||(t.Disco={});t.Disco.AttachmentUploader=u}(this,document,$,Webcam);
\ No newline at end of file
+(function(t){function i(){var n=Error.apply(this,arguments);n.name=this.name="FlashError";this.stack=n.stack;this.message=n.message}function r(){var n=Error.apply(this,arguments);n.name=this.name="WebcamError";this.stack=n.stack;this.message=n.message}var f,e=function(){},u;e.prototype=Error.prototype;i.prototype=new e;r.prototype=new e;u={version:"1.0.26",protocol:location.protocol.match(/https/i)?"https":"http",loaded:!1,live:!1,userMedia:!0,iOS:/iPad|iPhone|iPod/.test(navigator.userAgent)&&!t.MSStream,params:{width:0,height:0,dest_width:0,dest_height:0,image_format:"jpeg",jpeg_quality:90,enable_flash:!0,force_flash:!1,flip_horiz:!1,fps:30,upload_name:"webcam",constraints:null,swfURL:"",flashNotDetectedText:"ERROR: No Adobe Flash Player detected. Webcam.js relies on Flash for browsers that do not support getUserMedia (like yours).",noInterfaceFoundText:"No supported webcam interface found.",unfreeze_snap:!0,iosPlaceholderText:"Click here to open camera.",user_callback:null,user_canvas:null},errors:{FlashError:i,WebcamError:r},hooks:{},init:function(){var n=this;this.mediaDevices=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?navigator.mediaDevices:navigator.mozGetUserMedia||navigator.webkitGetUserMedia?{getUserMedia:function(n){return new Promise(function(t,i){(navigator.mozGetUserMedia||navigator.webkitGetUserMedia).call(navigator,n,t,i)})}}:null;t.URL=t.URL||t.webkitURL||t.mozURL||t.msURL;this.userMedia=this.userMedia&&!!this.mediaDevices&&!!t.URL;navigator.userAgent.match(/Firefox\D+(\d+)/)&&parseInt(RegExp.$1,10)<21&&(this.userMedia=null);this.userMedia&&t.addEventListener("beforeunload",function(){n.reset()})},exifOrientation:function(t){var i=new DataView(t),r,s,h,u,c,l,y,o,f,a,v,e;if(i.getUint8(0)!=255||i.getUint8(1)!=216)return console.log("Not a valid JPEG file"),0;for(r=2,s=null;r8)?(console.log("Invalid EXIF orientation value ("+e+")"),0):e}else r+=2+i.getUint16(r+2)}return 0},fixOrientation:function(n,t,i){var r=new Image;r.addEventListener("load",function(){var u=document.createElement("canvas"),n=u.getContext("2d");t<5?(u.width=r.width,u.height=r.height):(u.width=r.height,u.height=r.width);switch(t){case 2:n.transform(-1,0,0,1,r.width,0);break;case 3:n.transform(-1,0,0,-1,r.width,r.height);break;case 4:n.transform(1,0,0,-1,0,r.height);break;case 5:n.transform(0,1,1,0,0,0);break;case 6:n.transform(0,1,-1,0,r.height,0);break;case 7:n.transform(0,-1,-1,0,r.height,r.width);break;case 8:n.transform(0,-1,1,0,0,r.width)}n.drawImage(r,0,0);i.src=u.toDataURL()},!1);r.src=n},attach:function(n){var y,c,l,i,v,a,s,o,h,e,p,w;if(typeof n=="string"&&(n=document.getElementById(n)||document.querySelector(n)),!n)return this.dispatch("error",new r("Could not locate DOM element to attach to."));if(this.container=n,n.innerHTML="",y=document.createElement("div"),n.appendChild(y),this.peg=y,this.params.width||(this.params.width=n.offsetWidth),this.params.height||(this.params.height=n.offsetHeight),!this.params.width||!this.params.height)return this.dispatch("error",new r("No width and/or height for webcam. Please call set() first, or attach to a visible element."));this.params.dest_width||(this.params.dest_width=this.params.width);this.params.dest_height||(this.params.dest_height=this.params.height);this.userMedia=f===undefined?this.userMedia:f;this.params.force_flash&&(f=this.userMedia,this.userMedia=null);typeof this.params.fps!="number"&&(this.params.fps=30);c=this.params.width/this.params.dest_width;l=this.params.height/this.params.dest_height;this.userMedia?(i=document.createElement("video"),i.setAttribute("autoplay","autoplay"),i.setAttribute("playsinline","playsinline"),i.style.width=""+this.params.dest_width+"px",i.style.height=""+this.params.dest_height+"px",(c!=1||l!=1)&&(n.style.overflow="hidden",i.style.webkitTransformOrigin="0px 0px",i.style.mozTransformOrigin="0px 0px",i.style.msTransformOrigin="0px 0px",i.style.oTransformOrigin="0px 0px",i.style.transformOrigin="0px 0px",i.style.webkitTransform="scaleX("+c+") scaleY("+l+")",i.style.mozTransform="scaleX("+c+") scaleY("+l+")",i.style.msTransform="scaleX("+c+") scaleY("+l+")",i.style.oTransform="scaleX("+c+") scaleY("+l+")",i.style.transform="scaleX("+c+") scaleY("+l+")"),n.appendChild(i),this.video=i,o=this,this.mediaDevices.getUserMedia({audio:!1,video:this.params.constraints||{mandatory:{minWidth:this.params.dest_width,minHeight:this.params.dest_height}}}).then(function(n){i.onloadedmetadata=function(){o.stream=n;o.loaded=!0;o.live=!0;o.dispatch("load");o.dispatch("live");o.flip()};"srcObject"in i?i.srcObject=n:i.src=t.URL.createObjectURL(n)}).catch(function(t){o.params.enable_flash&&o.detectFlash()?setTimeout(function(){o.params.force_flash=1;o.attach(n)},1):o.dispatch("error",t)})):this.iOS?(e=document.createElement("div"),e.id=this.container.id+"-ios_div",e.className="webcamjs-ios-placeholder",e.style.width=""+this.params.width+"px",e.style.height=""+this.params.height+"px",e.style.textAlign="center",e.style.display="table-cell",e.style.verticalAlign="middle",e.style.backgroundRepeat="no-repeat",e.style.backgroundSize="contain",e.style.backgroundPosition="center",v=document.createElement("span"),v.className="webcamjs-ios-text",v.innerHTML=this.params.iosPlaceholderText,e.appendChild(v),a=document.createElement("img"),a.id=this.container.id+"-ios_img",a.style.width=""+this.params.dest_width+"px",a.style.height=""+this.params.dest_height+"px",a.style.display="none",e.appendChild(a),s=document.createElement("input"),s.id=this.container.id+"-ios_input",s.setAttribute("type","file"),s.setAttribute("accept","image/*"),s.setAttribute("capture","camera"),o=this,h=this.params,s.addEventListener("change",function(n){var r,t,u,i;n.target.files.length>0&&n.target.files[0].type.indexOf("image/")==0&&(r=URL.createObjectURL(n.target.files[0]),t=new Image,t.addEventListener("load",function(){var n=document.createElement("canvas"),r,i;n.width=h.dest_width;n.height=h.dest_height;r=n.getContext("2d");ratio=Math.min(t.width/h.dest_width,t.height/h.dest_height);var u=h.dest_width*ratio,f=h.dest_height*ratio,o=(t.width-u)/2,s=(t.height-f)/2;r.drawImage(t,o,s,u,f,0,0,h.dest_width,h.dest_height);i=n.toDataURL();a.src=i;e.style.backgroundImage="url('"+i+"')"},!1),u=new FileReader,u.addEventListener("load",function(n){var i=o.exifOrientation(n.target.result);i>1?o.fixOrientation(r,i,t):t.src=r},!1),i=new XMLHttpRequest,i.open("GET",r,!0),i.responseType="blob",i.onload=function(){(this.status==200||this.status===0)&&u.readAsArrayBuffer(this.response)},i.send())},!1),s.style.display="none",n.appendChild(s),e.addEventListener("click",function(){h.user_callback?o.snap(h.user_callback,h.user_canvas):(s.style.display="block",s.focus(),s.click(),s.style.display="none")},!1),n.appendChild(e),this.loaded=!0,this.live=!0):this.params.enable_flash&&this.detectFlash()?(t.Webcam=u,e=document.createElement("div"),e.innerHTML=this.getSWFHTML(),n.appendChild(e)):this.dispatch("error",new r(this.params.noInterfaceFoundText));this.params.crop_width&&this.params.crop_height?(p=Math.floor(this.params.crop_width*c),w=Math.floor(this.params.crop_height*l),n.style.width=""+p+"px",n.style.height=""+w+"px",n.style.overflow="hidden",n.scrollLeft=Math.floor(this.params.width/2-p/2),n.scrollTop=Math.floor(this.params.height/2-w/2)):(n.style.width=""+this.params.width+"px",n.style.height=""+this.params.height+"px")},reset:function(){var n,t;this.preview_active&&this.unfreeze();this.unflip();this.userMedia&&(this.stream&&(this.stream.getVideoTracks?(n=this.stream.getVideoTracks(),n&&n[0]&&n[0].stop&&n[0].stop()):this.stream.stop&&this.stream.stop()),delete this.stream,delete this.video);this.userMedia!==!0&&this.loaded&&!this.iOS&&(t=this.getMovie(),t&&t._releaseCamera&&t._releaseCamera());this.container&&(this.container.innerHTML="",delete this.container);this.loaded=!1;this.live=!1},set:function(){if(arguments.length==1)for(var n in arguments[0])this.params[n]=arguments[0][n];else this.params[arguments[0]]=arguments[1]},on:function(n,t){n=n.replace(/^on/i,"").toLowerCase();this.hooks[n]||(this.hooks[n]=[]);this.hooks[n].push(t)},off:function(n,t){if(n=n.replace(/^on/i,"").toLowerCase(),this.hooks[n])if(t){var i=this.hooks[n].indexOf(t);i>-1&&this.hooks[n].splice(i,1)}else this.hooks[n]=[]},dispatch:function(){var f=arguments[0].replace(/^on/i,"").toLowerCase(),u=Array.prototype.slice.call(arguments,1),e,o,n,s;if(this.hooks[f]&&this.hooks[f].length){for(e=0,o=this.hooks[f].length;eERROR: the Webcam.js Flash fallback does not work from local disk. Please run it from a web server.<\/h3>';if(!this.detectFlash())return this.dispatch("error",new i("Adobe Flash Player not found. Please install from get.adobe.com/flashplayer and try again.")),''+this.params.flashNotDetectedText+"<\/h3>";if(!u){for(f="",o=document.getElementsByTagName("script"),r=0,s=o.length;r |