Interactive interface for browsing global, full-resolution satellite imagery
added compiled gifshot
Benjamindf5841d305ba
diff --git a/web/ext/node_modules/gifshot/demo/gifshot.custom.js b/web/ext/node_modules/gifshot/build/custom/gifshot.custom.jssimilarity index 97%rename from web/ext/node_modules/gifshot/demo/gifshot.custom.jsrename to web/ext/node_modules/gifshot/build/custom/gifshot.custom.jsindex 630862810..8dfa9e300 100644--- a/web/ext/node_modules/gifshot/demo/gifshot.custom.js+++ b/web/ext/node_modules/gifshot/build/custom/gifshot.custom.js@@ -1,10 +1,3 @@-/*Copyrights for code authored by Yahoo Inc. is licensed under the following terms:-MIT License-Copyright 2015 Yahoo Inc.-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.-*/;(function(window, document, navigator, undefined) {var utils, error, defaultOptions, isSupported, isWebCamGIFSupported, isExistingImagesGIFSupported, isExistingVideoGIFSupported, NeuQuant, processFrameWorker, gifWriter, AnimatedGIF, getBase64GIF, existingImages, screenShot, videoStream, stopVideoStreaming, createAndGetGIF, existingVideo, existingWebcam, createGIF, takeSnapShot, API;utils = function () {diff --git a/web/ext/node_modules/gifshot/build/custom/gifshot.custom.min.js b/web/ext/node_modules/gifshot/build/custom/gifshot.custom.min.jsnew file mode 100644index 000000000..27cb877eb--- /dev/null+++ b/web/ext/node_modules/gifshot/build/custom/gifshot.custom.min.js@@ -0,0 +1,8 @@+/*Copyrights for code authored by Yahoo Inc. is licensed under the following terms:+MIT License+Copyright 2015 Yahoo Inc.+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+*/+!function(e,t,r,n){var i,o,a,s,c,d,l,u,f,h,g,p,m,v,b,w,y,x,F,C,k;i=function(){var n={URL:e.URL||e.webkitURL||e.mozURL||e.msURL,getUserMedia:function(){var e=r.getUserMedia||r.webkitGetUserMedia||r.mozGetUserMedia||r.msGetUserMedia;return e?e.bind(r):e}(),requestAnimFrame:e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame,requestTimeout:function(e,t){function r(){var n=(new Date).getTime(),s=n-i;s>=t?e.call():o.value=a(r)}if(e=e||n.noop,t=t||0,!n.requestAnimFrame)return setTimeout(e,t);var i=(new Date).getTime(),o=new Object,a=n.requestAnimFrame;return o.value=a(r),o},Blob:e.Blob||e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||e.MSBlobBuilder,btoa:function(){var t=e.btoa||function(e){for(var t,r,n,i,o,a,s,c="",d=0,l=e.length,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";l>d;)t=e.charCodeAt(d++),r=e.charCodeAt(d++),n=e.charCodeAt(d++),i=t>>2,o=(3&t)<<4|r>>4,a=(15&r)<<2|n>>6,s=63&n,isNaN(r)?a=s=64:isNaN(n)&&(s=64),c=c+u.charAt(i)+u.charAt(o)+u.charAt(a)+u.charAt(s);return c};return t?t.bind(e):function(){}}(),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return n.isObject(e)&&!Object.keys(e).length},isArray:function(e){return e&&Array.isArray(e)},isFunction:function(e){return e&&"function"==typeof e},isElement:function(e){return e&&1===e.nodeType},isString:function(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)},isSupported:{canvas:function(){var e=t.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return e.Worker},blob:function(){return n.Blob},Uint8Array:function(){return e.Uint8Array},Uint32Array:function(){return e.Uint32Array},videoCodecs:function(){var e=t.createElement("video"),r={mp4:!1,h264:!1,ogv:!1,ogg:!1,webm:!1};try{e&&e.canPlayType&&(r.mp4=""!==e.canPlayType('video/mp4; codecs="mp4v.20.8"'),r.h264=""!==(e.canPlayType('video/mp4; codecs="avc1.42E01E"')||e.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')),r.ogv=""!==e.canPlayType('video/ogg; codecs="theora"'),r.ogg=""!==e.canPlayType('video/ogg; codecs="theora"'),r.webm=-1!==e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(n){}return r}()},noop:function(){},each:function(e,t){var r,i;if(n.isArray(e))for(r=-1,i=e.length;++r<i&&t(r,e[r])!==!1;);else if(n.isObject(e))for(r in e)if(e.hasOwnProperty(r)&&t(r,e[r])===!1)break},mergeOptions:function i(e,t){if(n.isObject(e)&&n.isObject(t)&&Object.keys){var r={};return n.each(e,function(t){r[t]=e[t]}),n.each(t,function(o){var a=t[o];r[o]=n.isObject(a)?e[o]?i(e[o],a):a:a}),r}},setCSSAttr:function(e,t,r){n.isElement(e)&&(n.isString(t)&&n.isString(r)?e.style[t]=r:n.isObject(t)&&n.each(t,function(t,r){e.style[t]=r}))},removeElement:function(e){n.isElement(e)&&e.parentNode&&e.parentNode.removeChild(e)},createWebWorker:function(e){if(!n.isString(e))return{};try{var t=new n.Blob([e],{type:"text/javascript"}),r=n.URL.createObjectURL(t),i=new Worker(r);return{objectUrl:r,worker:i}}catch(o){return""+o}},getExtension:function(e){return e.substr(e.lastIndexOf(".")+1,e.length)},getFontSize:function(e){if(e=e||{},!t.body||e.resizeFont===!1)return e.fontSize;var r=e.text,n=e.gifWidth,i=parseInt(e.fontSize,10),o=parseInt(e.minFontSize,10),a=t.createElement("div"),s=t.createElement("span");for(a.setAttribute("width",n),a.appendChild(s),s.innerHTML=r,s.style.fontSize=i+"px",s.style.textIndent="-9999px",s.style.visibility="hidden",t.body.appendChild(s);s.offsetWidth>n&&i>=o;)s.style.fontSize=--i+"px";return t.body.removeChild(s),i+"px"},webWorkerError:!1};return n}(),o=function(e){var t={validate:function(r){r=e.isObject(r)?r:{};var n={};return e.each(t.validators,function(e,t){var i=t.errorCode;return r[i]||t.condition?void 0:(n=t,n.error=!0,!1)}),delete n.condition,n},isValid:function(e){var r=t.validate(e),n=r.error!==!0?!0:!1;return n},validators:[{condition:e.isFunction(e.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:e.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:e.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:e.isFunction(e.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:e.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:e.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:e.isSupported.Uint32Array(),errorCode:"window.Uint32Array",errorMsg:"The window.Uint32Array function constructor is not supported in your browser"}],messages:{videoCodecs:{errorCode:"videocodec",errorMsg:"The video codec you are trying to use is not supported in your browser"}}};return t}(i),a={sampleInterval:10,numWorkers:2,gifWidth:200,gifHeight:200,interval:.1,numFrames:10,keepCameraOn:!1,images:[],video:null,stamp:null,webcamVideoElement:null,cameraStream:null,text:"",fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,progressCallback:function(){},completeCallback:function(){},saveRenderingContexts:!1,savedRenderingContexts:[],crossOrigin:"Anonymous"},s=function(){return o.isValid()},d=function(){var e={getUserMedia:!0};return o.isValid(e)},u=function(){function e(){function e(e,t,r){var n,i;for(u=e,f=t,h=r,g=new Array(p),n=0;p>n;n++)g[n]=new Array(4),i=g[n],i[0]=i[1]=i[2]=(n<<F+8)/p|0,D[n]=W/p|0,q[n]=0}function t(){for(var e=[],t=new Array(p),r=0;p>r;r++)t[g[r][3]]=r;for(var n=0,i=0;p>i;i++){var o=t[i];e[n++]=g[o][0],e[n++]=g[o][1],e[n++]=g[o][2]}return e}function r(){var e,t,r,n,i,o,a,s;for(a=0,s=0,e=0;p>e;e++){for(i=g[e],r=e,n=i[1],t=e+1;p>t;t++)o=g[t],o[1]<n&&(r=t,n=o[1]);if(o=g[r],e!=r&&(t=o[0],o[0]=i[0],i[0]=t,t=o[1],o[1]=i[1],i[1]=t,t=o[2],o[2]=i[2],i[2]=t,t=o[3],o[3]=i[3],i[3]=t),n!=a){for(L[a]=s+e>>1,t=a+1;n>t;t++)L[t]=e;a=n,s=e}}for(L[a]=s+x>>1,t=a+1;256>t;t++)L[t]=x}function n(){var e,t,r,n,i,o,a,g,p,x,k,W,A,S;for(y>f&&(h=1),l=30+(h-1)/3,W=u,A=0,S=f,k=f/(3*h),x=k/C|0,g=B,o=U,a=o>>E,1>=a&&(a=0),e=0;a>e;e++)V[e]=g*((a*a-e*e)*P/(a*a));for(p=y>f?3:f%m!==0?3*m:f%v!==0?3*v:f%b!==0?3*b:3*w,e=0;k>e;)if(r=(255&W[A+0])<<F,n=(255&W[A+1])<<F,i=(255&W[A+2])<<F,t=d(r,n,i),c(g,t,r,n,i),0!==a&&s(a,t,r,n,i),A+=p,A>=S&&(A-=f),e++,0===x&&(x=1),e%x===0)for(g-=g/l,o-=o/T,a=o>>E,1>=a&&(a=0),t=0;a>t;t++)V[t]=g*((a*a-t*t)*P/(a*a))}function i(e,t,r){var n,i,o,a,s,c,d;for(s=1e3,d=-1,n=L[t],i=n-1;p>n||i>=0;)p>n&&(c=g[n],o=c[1]-t,o>=s?n=p:(n++,0>o&&(o=-o),a=c[0]-e,0>a&&(a=-a),o+=a,s>o&&(a=c[2]-r,0>a&&(a=-a),o+=a,s>o&&(s=o,d=c[3])))),i>=0&&(c=g[i],o=t-c[1],o>=s?i=-1:(i--,0>o&&(o=-o),a=c[0]-e,0>a&&(a=-a),o+=a,s>o&&(a=c[2]-r,0>a&&(a=-a),o+=a,s>o&&(s=o,d=c[3]))));return d}function o(){return n(),a(),r(),t()}function a(){var e;for(e=0;p>e;e++)g[e][0]>>=F,g[e][1]>>=F,g[e][2]>>=F,g[e][3]=e}function s(e,t,r,n,i){var o,a,s,c,d,l,u;for(s=t-e,-1>s&&(s=-1),c=t+e,c>p&&(c=p),o=t+1,a=t-1,l=1;c>o||a>s;){if(d=V[l++],c>o){u=g[o++];try{u[0]-=d*(u[0]-r)/G|0,u[1]-=d*(u[1]-n)/G|0,u[2]-=d*(u[2]-i)/G|0}catch(f){}}if(a>s){u=g[a--];try{u[0]-=d*(u[0]-r)/G|0,u[1]-=d*(u[1]-n)/G|0,u[2]-=d*(u[2]-i)/G|0}catch(f){}}}}function c(e,t,r,n,i){var o=g[t],a=e/B;o[0]-=a*(o[0]-r)|0,o[1]-=a*(o[1]-n)|0,o[2]-=a*(o[2]-i)|0}function d(e,t,r){var n,i,o,a,s,c,d,l,u,f;for(l=~(1<<31),u=l,c=-1,d=c,n=0;p>n;n++)f=g[n],i=f[0]-e,0>i&&(i=-i),o=f[1]-t,0>o&&(o=-o),i+=o,o=f[2]-r,0>o&&(o=-o),i+=o,l>i&&(l=i,c=n),a=i-(q[n]>>k-F),u>a&&(u=a,d=n),s=D[n]>>S,D[n]-=s,q[n]+=s<<A;return D[c]+=I,q[c]-=R,d}var l,u,f,h,g,p=256,m=499,v=491,b=487,w=503,y=3*w,x=p-1,F=4,C=100,k=16,W=1<<k,A=10,S=10,I=W>>S,R=W<<A-S,O=p>>3,E=6,M=1<<E,U=O*M,T=30,j=10,B=1<<j,H=8,P=1<<H,z=j+H,G=1<<z,L=[],q=[],D=[],V=[];e.apply(this,arguments);var N={};return N.map=i,N.process=o,N}return e}(),f=function(e){var t=function(){try{self.onmessage=function(e){var t,n=e.data||{};n.gifshot&&(t=r.run(n),postMessage(t))}}catch(t){}var r={dataToRGB:function(e,t,r){for(var n=0,i=t*r*4,o=[];i>n;)o.push(e[n++]),o.push(e[n++]),o.push(e[n++]),n++;return o},componentizedPaletteToArray:function(e){var t,r,n,i,o=[];for(t=0;t<e.length;t+=3)r=e[t],n=e[t+1],i=e[t+2],o.push(r<<16|n<<8|i);return o},processFrameWithQuantizer:function(t,r,n,i){var o,a,s,c,d=this.dataToRGB(t,r,n),l=new e(d,d.length,i),u=l.process(),f=new Uint32Array(this.componentizedPaletteToArray(u)),h=r*n,g=new Uint8Array(h),p=0;for(o=0;h>o;o++)a=d[p++],s=d[p++],c=d[p++],g[o]=l.map(a,s,c);return{pixels:g,palette:f}},run:function(e){var t=e.width,r=e.height,n=e.data,i=(e.palette,e.sampleInterval);return this.processFrameWithQuantizer(n,t,r,i)}};return r};return t}(u),h=function(e,t,r,i){function o(e){var t=e.length;if(2>t||t>256||t&t-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return t}function a(e,t,r,i){function o(r){for(;h>=r;)e[t++]=255&g,g>>=8,h-=8,t===s+256&&(e[s]=255,s=t++)}function a(e){g|=e<<h,h+=f,o(8)}e[t++]=r;var s=t++,c=1<<r,d=c-1,l=c+1,u=l+1,f=r+1,h=0,g=0,p=i[0]&d,m={};a(c);for(var v=1,b=i.length;b>v;++v){var w=i[v]&d,y=p<<8|w,x=m[y];if(x===n){for(g|=p<<h,h+=f;h>=8;)e[t++]=255&g,g>>=8,h-=8,t===s+256&&(e[s]=255,s=t++);4096===u?(a(c),u=l+1,f=r+1,m={}):(u>=1<<f&&++f,m[y]=u++),p=w}else p=x}return a(p),a(l),o(1),s+1===t?e[s]=0:(e[s]=t-s-1,e[t++]=0),t}var s=0;i=i===n?{}:i;var c=i.loop===n?null:i.loop,d=i.palette===n?null:i.palette;if(0>=t||0>=r||t>65535||r>65535)throw"Width/Height invalid.";e[s++]=71,e[s++]=73,e[s++]=70,e[s++]=56,e[s++]=57,e[s++]=97;var l=0,u=0;if(e[s++]=255&t,e[s++]=t>>8&255,e[s++]=255&r,e[s++]=r>>8&255,e[s++]=(null!==d?128:0)|l,e[s++]=u,e[s++]=0,null!==c){if(0>c||c>65535)throw"Loop count invalid.";e[s++]=33,e[s++]=255,e[s++]=11,e[s++]=78,e[s++]=69,e[s++]=84,e[s++]=83,e[s++]=67,e[s++]=65,e[s++]=80,e[s++]=69,e[s++]=50,e[s++]=46,e[s++]=48,e[s++]=3,e[s++]=1,e[s++]=255&c,e[s++]=c>>8&255,e[s++]=0}var f=!1;this.addFrame=function(t,r,i,c,l,u){if(f===!0&&(--s,f=!1),u=u===n?{}:u,0>t||0>r||t>65535||r>65535)throw"x/y invalid.";if(0>=i||0>=c||i>65535||c>65535)throw"Width/Height invalid.";if(l.length<i*c)throw"Not enough pixels for the frame size.";var h=!0,g=u.palette;if((g===n||null===g)&&(h=!1,g=d),g===n||null===g)throw"Must supply either a local or global palette.";for(var p=o(g),m=0;p>>=1;)++m;p=1<<m;var v=u.delay===n?0:u.delay,b=u.disposal===n?0:u.disposal;if(0>b||b>3)throw"Disposal out of range.";var w=!1,y=0;if(u.transparent!==n&&null!==u.transparent&&(w=!0,y=u.transparent,0>y||y>=p))throw"Transparent color index.";if((0!==b||w||0!==v)&&(e[s++]=33,e[s++]=249,e[s++]=4,e[s++]=b<<2|(w===!0?1:0),e[s++]=255&v,e[s++]=v>>8&255,e[s++]=y,e[s++]=0),e[s++]=44,e[s++]=255&t,e[s++]=t>>8&255,e[s++]=255&r,e[s++]=r>>8&255,e[s++]=255&i,e[s++]=i>>8&255,e[s++]=255&c,e[s++]=c>>8&255,e[s++]=h===!0?128|m-1:0,h===!0)for(var x=0,F=g.length;F>x;++x){var C=g[x];e[s++]=C>>16&255,e[s++]=C>>8&255,e[s++]=255&C}s=a(e,s,2>m?2:m,l)},this.end=function(){return f===!1&&(e[s++]=59,f=!0),s}},g=function(e,r,n,i){var o=function(t){this.canvas=null,this.ctx=null,this.repeat=0,this.frames=[],this.numRenderedFrames=0,this.onRenderCompleteCallback=e.noop,this.onRenderProgressCallback=e.noop,this.workers=[],this.availableWorkers=[],this.generatingGIF=!1,this.options=t,this.initializeWebWorkers(t)};return o.prototype={workerMethods:r(),initializeWebWorkers:function(i){var o,a,s,c,d=n.toString()+"("+r.toString()+"());",l=-1,u="";for(c=i.numWorkers;++l<c;)o=e.createWebWorker(d),e.isObject(o)?(a=o.objectUrl,s=o.worker,this.workers.push({worker:s,objectUrl:a}),this.availableWorkers.push(s)):(u=o,e.webWorkerError=!!o);this.workerError=u,this.canvas=t.createElement("canvas"),this.canvas.width=i.gifWidth,this.canvas.height=i.gifHeight,this.ctx=this.canvas.getContext("2d"),this.frames=[]},getWorker:function(){return this.availableWorkers.pop()},freeWorker:function(e){this.availableWorkers.push(e)},byteMap:function(){for(var e=[],t=0;256>t;t++)e[t]=String.fromCharCode(t);return e}(),bufferToString:function(e){for(var t=e.length,r="",n=-1;++n<t;)r+=this.byteMap[e[n]];return r},onFrameFinished:function(t){var r=this,n=r.frames,i=r.options;hasExistingImages=!!(i.images||[]).length,allDone=n.every(function(e){return!e.beingProcessed&&e.done}),r.numRenderedFrames++,hasExistingImages&&t(r.numRenderedFrames/n.length),r.onRenderProgressCallback(.75*r.numRenderedFrames/n.length),allDone?r.generatingGIF||r.generateGIF(n,r.onRenderCompleteCallback):e.requestTimeout(function(){r.processNextFrame()},1)},processFrame:function(e){var t,r,n=this,i=this.options,o=i.progressCallback,a=i.sampleInterval,s=this.frames,c=function(e){var i=e.data;delete t.data,t.pixels=Array.prototype.slice.call(i.pixels),t.palette=Array.prototype.slice.call(i.palette),t.done=!0,t.beingProcessed=!1,n.freeWorker(r),n.onFrameFinished(o)};return t=s[e],t.beingProcessed||t.done?(this.onFrameFinished(),void 0):(t.sampleInterval=a,t.beingProcessed=!0,t.gifshot=!0,r=this.getWorker(),r?(r.onmessage=c,r.postMessage(t)):c({data:n.workerMethods.run(t)}),void 0)},startRendering:function(e){this.onRenderCompleteCallback=e;for(var t=0;t<this.options.numWorkers&&t<this.frames.length;t++)this.processFrame(t)},processNextFrame:function(){for(var e=-1,t=0;t<this.frames.length;t++){var r=this.frames[t];if(!r.done&&!r.beingProcessed){e=t;break}}e>=0&&this.processFrame(e)},generateGIF:function(t,r){var n,o,a=[],s={loop:this.repeat},c=this.options,d=c.interval,l=c.images,u=!!l.length,f=c.gifHeight,h=c.gifWidth,g=new i(a,h,f,s),p=this.onRenderProgressCallback,m=u?100*d:0;this.generatingGIF=!0,e.each(t,function(e,r){var n=r.palette;p(.75+.25*r.position*1/t.length),g.addFrame(0,0,h,f,r.pixels,{palette:n,delay:m})}),g.end(),p(1),this.frames=[],this.generatingGIF=!1,e.isFunction(r)&&(n=this.bufferToString(a),o="data:image/gif;base64,"+e.btoa(n),r(o))},setRepeat:function(e){this.repeat=e},addFrame:function(t,r,n){r=e.isObject(r)?r:{};var i,o,a=this,s=a.ctx,c=a.options,d=c.gifWidth,l=c.gifHeight,u=c.stamp,f=26,h=f/.192,g=(r.gifHeight,r.gifWidth,r.text),p=r.fontWeight,m=e.getFontSize(r),v=r.fontFamily,b=r.fontColor,w=r.textAlign,y=r.textBaseline,x=r.textXCoordinate?r.textXCoordinate:"left"===w?1:"right"===w?d-7:d/2,F=r.textYCoordinate?r.textYCoordinate:"top"===y?7:"center"===y?l/2:l,C=p+" "+m+" "+v;250>d&&(90>d?(u=null,n=null):50>l?u=null:(x=90,F=l-30));try{s.drawImage(t,0,0,d,l),u&&h>80&&s.drawImage(u,2.5,2.5),(g||n)&&(s.font=C,s.fillStyle=b,s.textAlign=w,s.textBaseline=y,r.stroke&&n&&(o=r.stroke,s.strokeStyle=o.color,s.lineWidth=2*o.pixels,s.strokeText(n,x,F)),n?s.fillText(n,x,F):s.fillText(g,x,F)),i=s.getImageData(0,0,d,l),a.addFrameImageData(i)}catch(k){return""+k}},addFrameImageData:function(e){var t=this.frames,r=e.data;this.frames.push({data:r,width:e.width,height:e.height,palette:null,dithering:null,done:!1,beingProcessed:!1,position:t.length})},onRenderProgress:function(e){this.onRenderProgressCallback=e},isRendering:function(){return this.generatingGIF},getBase64GIF:function(t){var r=this,n=function(n){r.destroyWorkers(),e.requestTimeout(function(){t(n)},0)};r.startRendering(n)},destroyWorkers:function(){if(!this.workerError){var t=this.workers;e.each(t,function(t,r){var n=r.worker,i=r.objectUrl;n.terminate(),e.URL.revokeObjectURL(i)})}}},o}(i,f,u,h),p=function(e,t){e.getBase64GIF(function(e){t({error:!1,errorCode:"",errorMsg:"",image:e})})},m=function(e){function r(e){for(var t=1/e.interval,r=t*e.pause,n=m[m.length-1],i=0;r>i;i++)m.push(n)}function n(){i.each(m,function(e,t){t&&(t.text?s.addFrame(t.img,u,t.text):s.addFrame(t,u))}),p(s,l)}var a,s,c=e.images,d=e.imagesLength,l=e.callback,u=e.options,f={getUserMedia:!0,"window.URL":!0},h=o.validate(f),m=[],v=0;return h.error?l(h):(s=new g(u),i.each(c,function(o,s){var c=s;s.src&&(c=c.src),i.isElement(c)?(u.crossOrigin&&(c.crossOrigin=u.crossOrigin),m[o]=c,v+=1,v===d&&n()):i.isString(c)&&(a=new Image,u.crossOrigin&&(a.crossOrigin=u.crossOrigin),function(t){s.text&&(t.text=s.text),t.onerror=function(){var t;return--d,0===d?(t={},t.error="None of the requested images was capable of being retrieved",l(t)):(v===d&&(e.options.pause&&r(e.options),n()),void 0)},t.onload=function(){m[o]=s.text?{img:t,text:t.text}:t,v+=1,v===d&&(e.options.pause&&r(e.options),n()),i.removeElement(t)},t.src=c}(a),i.setCSSAttr(a,{position:"fixed",opacity:"0"}),t.body.appendChild(a))}),void 0)},v={getGIF:function(e,r){r=i.isFunction(r)?r:i.noop;var n,o=t.createElement("canvas"),a=e.images,s=!!a.length,c=e.videoElement,d=e.keepCameraOn,l=e.webcamVideoElement,u=e.cameraStream,f=+e.gifWidth,h=+e.gifHeight,p=e.videoWidth,m=e.videoHeight,v=(+e.sampleInterval,+e.numWorkers,e.crop),b=+e.interval,w=s?0:1e3*b,y=e.progressCallback,x=e.savedRenderingContexts,F=e.saveRenderingContexts,C=[],k=x.length?x.length:e.numFrames,W=k,A=new g(e),S=e.text,I=e.fontWeight,R=i.getFontSize(e),O=e.fontFamily,E=e.fontColor,M=e.textAlign,U=e.textBaseline,T=e.textXCoordinate?e.textXCoordinate:"left"===M?1:"right"===M?f:f/2,j=e.textYCoordinate?e.textYCoordinate:"top"===U?1:"center"===U?h/2:h,B=I+" "+R+" "+O,H=v?Math.floor(v.scaledWidth/2):0,P=v?p-v.scaledWidth:0,z=v?Math.floor(v.scaledHeight/2):0,G=v?m-v.scaledHeight:0,L=function q(){function e(){try{P>p&&(P=p),G>m&&(G=m),0>H&&(H=0),0>z&&(z=0),n.drawImage(c,H,z,P,G,0,0,f,h),t()}catch(r){if("NS_ERROR_NOT_AVAILABLE"!==r.name)throw r;i.requestTimeout(e,100)}}function t(){W=o;var t,a,s,g,p=k-W;F&&C.push(n.getImageData(0,0,f,h)),S&&(n.font=B,n.fillStyle=E,n.textAlign=M,n.textBaseline=U,n.fillText(S,T,j)),t=n.getImageData(0,0,f,h),a=t.data,s=a[0]+a[1]+a[2]+a[3],g=0===s,g?1===p&&1===k&&e():A.addFrameImageData(t),y(p/k),o>0&&i.requestTimeout(q,w),W||A.getBase64GIF(function(e){r({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:u,videoElement:c,webcamVideoElement:l,savedRenderingContexts:C,keepCameraOn:d})})}var o=W-1;x.length?(n.putImageData(x[k-W],0,0),t()):e()};k=null!=k?k:10,b=null!=b?b:.1,o.width=f,o.height=h,n=o.getContext("2d"),function D(){return x.length||0!==c.currentTime?(L(),void 0):(i.requestTimeout(D,100),void 0)}()},getCropDimensions:function(e){var t=e.videoWidth,r=e.videoHeight,n=e.gifWidth,i=e.gifHeight,o={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>r?(o.width=Math.round(t*(i/r))-n,o.scaledWidth=Math.round(o.width*(r/i))):(o.height=Math.round(r*(n/t))-i,o.scaledHeight=Math.round(o.height*(t/n))),o}},w=function(e,r){var n=e.options||{},o=n.images,a=n.video,s=(+n.numFrames,e.cameraStream),c=e.videoElement,d=e.videoWidth,l=e.videoHeight,u=+n.gifWidth,f=+n.gifHeight,h=v.getCropDimensions({videoWidth:d,videoHeight:l,gifHeight:f,gifWidth:u}),g=r;n.crop=h,n.videoElement=c,n.videoWidth=d,n.videoHeight=l,n.cameraStream=s,i.isElement(c)&&(c.width=u+h.width,c.height=f+h.height,n.webcamVideoElement||(i.setCSSAttr(c,{position:"fixed",opacity:"0"}),t.body.appendChild(c)),c.play(),v.getGIF(n,function(e){o&&o.length||a&&a.length||b(e),g(e)}))},F=function(e,t){if(t=i.isFunction(e)?e:t,e=i.isObject(e)?e:{},i.isFunction(t)){var r=i.mergeOptions(a,e)||{},n=e.cameraStream,o=r.images,s=o?o.length:0,c=r.video,d=r.webcamVideoElement;r=i.mergeOptions(r,{gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)}),s?m({images:o,imagesLength:s,callback:t,options:r}):c?y({existingVideo:c,callback:t,options:r}):x({lastCameraStream:n,callback:t,webcamVideoElement:d,options:r})}},C=function(e,t){if(t=i.isFunction(e)?e:t,e=i.isObject(e)?e:{},i.isFunction(t)){var r=i.mergeOptions(a,e),n=i.mergeOptions(r,{interval:.1,numFrames:1,gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)});F(n,t)}},k=function(e,t,r,n,i,o,a,s,c,d){var l={utils:e,error:t,defaultOptions:r,createGIF:s,takeSnapShot:c,stopVideoStreaming:d,isSupported:n,isWebCamGIFSupported:i,isExistingVideoGIFSupported:a,isExistingImagesGIFSupported:o,VERSION:"0.3.2"};return l}(i,o,a,s,c,d,l,F,C,b),function(t){"function"==typeof define&&define.amd?define([],function(){return t}):"undefined"!=typeof exports?module.exports=t:e.gifshot=t}(k)}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{createElement:function(){}},"undefined"!=typeof window?window.navigator:{});\ No newline at end of file