constEventEmitter=require("events"),{arrayToHex:arrayToHex}=require("./utils"),Raven=window.Raven;classFileSenderextendsEventEmitter{constructor(e){super(),this.file=e,this.iv=window.crypto.getRandomValues(newUint8Array(12)),this.uploadXHR=newXMLHttpRequest}staticdelete(e,t){returnnewPromise((n,a)=>{if(!e||!t)returna();constr=newXMLHttpRequest;r.open("post","/delete/"+e,!0),r.setRequestHeader("Content-Type","application/json"),r.onreadystatechange=(()=>{r.readyState===XMLHttpRequest.DONE&&n(),200===r.status?console.log("The file was successfully deleted."):console.log("The file has expired, or has already been deleted.")}),r.send(JSON.stringify({delete_token:t}))})}cancel(){this.uploadXHR.abort()}upload(){conste=this;returne.emit("loading",!0),Promise.all([window.crypto.subtle.generateKey({name:"AES-GCM",length:128},!0,["encrypt","decrypt"]).catch(e=>console.log("There was an error generating a crypto key")),newPromise((t,n)=>{consta=newFileReader;a.readAsArrayBuffer(this.file),a.onload=function(n){e.emit("loading",!1),e.emit("hashing",!0);consta=newUint8Array(this.result);window.crypto.subtle.digest("SHA-256",a).then(n=>{e.emit("hashing",!1),e.emit("encrypting",!0),t({plaintext:a,hash:newUint8Array(n)})})},a.onerror=function(e){n(e)}})]).then(([t,n])=>Promise.all([window.crypto.subtle.encrypt({name:"AES-GCM",iv:this.iv,additionalData:n.hash,tagLength:128},t,n.plaintext).then(t=>(e.emit("encrypting",!1),newPromise((e,n)=>{e(t)}))),window.crypto.subtle.exportKey("jwk",t),newPromise((e,t)=>{e(n.hash)})])).then(([t,n,a])=>newPromise((r,s)=>{consto=this.file,i=arrayToHex(this.iv),l=newDataView(t),d=newBlob([l],{type:o.type}),p=newFormData;p.append("data",d,o.name);constc=e.uploadXHR;c.upload.addEventListener("progress",t=>{t.lengthComputable&&e.emit("progress",[t.loaded,t.total])}),c.onreadystatechange=(()=>{if(c.readyState===XMLHttpRequest.DONE){if(200===c.status){conste=JSON.parse(c.responseText);returnr({url:e.url,fileId:e.id,secretKey:n.k,deleteToken:e.delete})}s(c.status)}}),c.open("post","/upload",!0),c.setRequestHeader("X-File-Metadata",JSON.stringify({aad:arrayToHex(a),id:i,filename:encodeURIComponent(o.name)})),c.send(p)})).catch(e=>(Raven.captureException(e),Promise.reject(e)))}}module.exports=FileSender;
functionEventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void0}functionisFunction(e){return"function"==typeofe}functionisNumber(e){return"number"==typeofe}functionisObject(e){return"object"==typeofe&&null!==e}functionisUndefined(e){returnvoid0===e}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void0,EventEmitter.prototype._maxListeners=void0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!isNumber(e)||e<0||isNaN(e))throwTypeError("n must be a positive number");returnthis._maxListeners=e,this},EventEmitter.prototype.emit=function(e){vart,i,n,s,r,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceofError)throwt;varh=newError('Uncaught, unspecified "error" event. ('+t+")");throwh.context=t,h}if(i=this._events[e],isUndefined(i))return!1;if(isFunction(i))switch(arguments.length){case1:i.call(this);break;case2:i.call(this,arguments[1]);break;case3:i.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),i.apply(this,s)}elseif(isObject(i))for(s=Array.prototype.slice.call(arguments,1),n=(o=i.slice()).length,r=0;r<n;r++)o[r].apply(this,s);return!0},EventEmitter.prototype.addListener=function(e,t){vari;if(!isFunction(t))throwTypeError("listener must be a function");returnthis._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,isFunction(t.listener)?t.listener:t),this._events[e]?isObject(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,isObject(this._events[e])&&!this._events[e].warned&&(i=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeofconsole.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(e,t){functioni(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}if(!isFunction(t))throwTypeError("listener must be a function");varn=!1;returni.listener=t,this.on(e,i),this},EventEmitter.prototype.removeListener=function(e,t){vari,n,s,r;if(!isFunction(t))throwTypeError("listener must be a function");if(!this._events||!this._events[e])returnthis;if(i=this._events[e],s=i.length,n=-1,i===t||isFunction(i.listener)&&i.listener===t)deletethis._events[e],this._events.removeListener&&this.emit("removeListener",e,t);elseif(isObject(i)){for(r=s;r-->0;)if(i[r]===t||i[r].listener&&i[r].listener===t){n=r;break}if(n<0)returnthis;1===i.length?(i.length=0,deletethis._events[e]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}returnthis},EventEmitter.prototype.removeAllListeners=function(e){vart,i;if(!this._events)returnthis;if(!this._events.removeListener)return0===arguments.length?this._events={}:this._events[e]&&deletethis._events[e],this;if(0===arguments.length){for(tinthis._events)"removeListener"!==t&&this.removeAllListeners(t);returnthis.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],isFunction(i))this.removeListener(e,i);elseif(i)for(;i.length;)this.removeListener(e,i[i.length-1]);returndeletethis._events[e],this},EventEmitter.prototype.listeners=function(e){returnthis._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[]},EventEmitter.prototype.listenerCount=function(e){if(this._events){vart=this._events[e];if(isFunction(t))return1;if(t)returnt.length}return0},EventEmitter.listenerCount=function(e,t){returne.listenerCount(t)};
},{}],8:[function(require,module,exports){
!function(i){if("function"==typeofdefine&&define.amd)define(["jquery"],i);elseif("object"==typeofmodule&&module.exports){vart=require("jquery");i(t),module.exports=t}elsei(jQuery)}(function(i){functiont(i){this.init(i)}t.prototype={value:0,size:100,startAngle:-Math.PI,thickness:"auto",fill:{gradient:["#3aeabb","#fdd250"]},emptyFill:"rgba(0, 0, 0, .1)",animation:{duration:1200,easing:"circleProgressEasing"},animationStartValue:0,reverse:!1,lineCap:"butt",insertMode:"prepend",constructor:t,el:null,canvas:null,ctx:null,radius:0,arcFill:null,lastFrameValue:0,init:function(t){i.extend(this,t),this.radius=this.size/2,this.initWidget(),this.initFill(),this.draw(),this.el.trigger("circle-inited")},initWidget:function(){this.canvas||(this.canvas=i("<canvas>")["prepend"==this.insertMode?"prependTo":"appendTo"](this.el)[0]);vart=this.canvas;if(t.width=this.size,t.height=this.size,this.ctx=t.getContext("2d"),window.devicePixelRatio>1){vare=window.devicePixelRatio;t.style.width=t.style.height=this.size+"px",t.width=t.height=this.size*e,this.ctx.scale(e,e)}},initFill:function(){functiont(){vart=i("<canvas>")[0];t.width=e.size,t.height=e.size,t.getContext("2d").drawImage(g,0,0,r,r),e.arcFill=e.ctx.createPattern(t,"no-repeat"),e.drawFrame(e.lastFrameValue)}vare=this,a=this.fill,n=this.ctx,r=this.size;if(!a)throwError("The fill is not specified!");if("string"==typeofa&&(a={color:a}),a.color&&(this.arcFill=a.color),a.gradient){vars=a.gradient;if(1==s.length)this.arcFill=s[0];elseif(s.length>1){for(varl=a.gradientAngle||0,o=a.gradientDirection||[r/2*(1-Math.cos(l)),r/2*(1+Math.sin(l)),r/2*(1+Math.cos(l)),r/2*(1-Math.sin(l))],h=n.createLinearGradient.apply(n,o),c=0;c<s.length;c++){vard=s[c],u=c/(s.length-1);i.isArray(d)&&(u=d[1],d=d[0]),h.addColorStop(u,d)}this.arcFill=h}}if(a.image){varg;a.imageinstanceofImage?g=a.image:(g=newImage).src=a.image,g.complete?t():g.onload=t}},draw:function(){this.animation?this.drawAnimated(this.value):this.drawFrame(this.value)},drawFrame:function(i){this.lastFrameValue=i,this.ctx.clearRect(0,0,this.size,this.size),this.drawEmptyArc(i),this.drawArc(i)},drawArc:function(i){if(0!==i){vart=this.ctx,e=this.radius,a=this.getThickness(),n=this.startAngle;t.save(),t.beginPath(),this.reverse?t.arc(e,e,e-a/2,n-2*Math.PI*i,n):t.arc(e,e,e-a/2,n,n+2*Math.PI*i),t.lineWidth=a,t.lineCap=this.lineCap,t.strokeStyle=this.arcFill,t.stroke(),t.restore()}},drawEmptyArc:function(i){vart=this.ctx,e=this.radius,a=this.getThickness(),n=this.startAngle;i<1&&(t.save(),t.beginPath(),i<=0?t.arc(e,e,e-a/2,0,2*Math.PI):this.reverse?t.arc(e,e,e-a/2,n,n-2*Math.PI*i):t.arc(e,e,e-a/2,n+2*Math.PI*i,n),t.lineWidth=a,t.strokeStyle=this.emptyFill,t.stroke(),t.restore())},drawAnimated:function(t){vare=this,a=this.el,n=i(this.canvas);n.stop(!0,!1),a.trigger("circle-animation-start"),n.css({animationProgress:0}).animate({animationProgress:1},i.extend({},this.animation,{step:function(i){varn=e.animationStartValue*(1-i)+t*i;e.drawFrame(n),a.trigger("circle-animation-progress",[i,n])}})).promise().always(function(){a.trigger("circle-animation-end")})},getThickness:function(){returni.isNumeric(this.thickness)?this.thickness:this.size/14},getValue:function(){returnthis.value},setValue:function(i){this.animation&&(this.animationStartValue=this.lastFrameValue),this.value=i,this.draw()}},i.circleProgress={defaults:t.prototype},i.easing.circleProgressEasing=function(i){returni<.5?.5*(i*=2)*i*i:1-.5*(i=2-2*i)*i*i},i.fn.circleProgress=function(e,a){varn="circle-progress",r=this.data(n);if("widget"==e){if(!r)throwError('Calling "widget" method on not initialized instance is forbidden');returnr.canvas}if("value"==e){if(!r)throwError('Calling "value" method on not initialized instance is forbidden');if(void0===a)returnr.getValue();vars=arguments[1];returnthis.each(function(){i(this).data(n).setValue(s)})}returnthis.each(function(){vara=i(this),r=a.data(n),s=i.isPlainObject(e)?e:{};if(r)r.init(s);else{varl=i.extend({},a.data());"string"==typeofl.fill&&(l.fill=JSON.parse(l.fill)),"string"==typeofl.animation&&(l.animation=JSO
!function(e,t){"use strict";"object"==typeofmodule&&"object"==typeofmodule.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)thrownewError("jQuery requires a window with a document");returnt(e)}:t(e)}("undefined"!=typeofwindow?window:this,function(e,t){"use strict";functionn(e,t){varn=(t=t||te).createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)}functionr(e){vart=!!e&&"length"ine&&e.length,n=de.type(e);return"function"!==n&&!de.isWindow(e)&&("array"===n||0===t||"number"==typeoft&&t>0&&t-1ine)}functioni(e,t){returne.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}functiono(e,t,n){returnde.isFunction(t)?de.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?de.grep(e,function(e){returne===t!==n}):"string"!=typeoft?de.grep(e,function(e){returnae.call(t,e)>-1!==n}):Ce.test(t)?de.filter(t,e,n):(t=de.filter(t,e),de.grep(e,function(e){returnae.call(t,e)>-1!==n&&1===e.nodeType}))}functiona(e,t){for(;(e=e[t])&&1!==e.nodeType;);returne}functions(e){vart={};returnde.each(e.match(De)||[],function(e,n){t[n]=!0}),t}functionu(e){returne}functionl(e){throwe}functionc(e,t,n,r){vari;try{e&&de.isFunction(i=e.promise)?i.call(e).done(t).fail(n):e&&de.isFunction(i=e.then)?i.call(e,t,n):t.apply(void0,[e].slice(r))}catch(e){n.apply(void0,[e])}}functionf(){te.removeEventListener("DOMContentLoaded",f),e.removeEventListener("load",f),de.ready()}functionp(){this.expando=de.expando+p.uid++}functiond(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Oe.test(e)?JSON.parse(e):e)}functionh(e,t,n){varr;if(void0===n&&1===e.nodeType)if(r="data-"+t.replace(Pe,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=d(n)}catch(e){}Fe.set(e,t,n)}elsen=void0;returnn}functiong(e,t,n,r){vari,o=1,a=20,s=r?function(){returnr.cur()}:function(){returnde.css(e,t,"")},u=s(),l=n&&n[3]||(de.cssNumber[t]?"":"px"),c=(de.cssNumber[t]||"px"!==l&&+u)&&Me.exec(de.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do{c/=o=o||".5",de.style(e,t,c+l)}while(o!==(o=s()/u)&&1!==o&&--a)}returnn&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}functionv(e){vart,n=e.ownerDocument,r=e.nodeName,i=Be[r];returni||(t=n.body.appendChild(n.createElement(r)),i=de.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),Be[r]=i,i)}functionm(e,t){for(varn,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=He.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&We(r)&&(i[o]=v(r))):"none"!==n&&(i[o]="none",He.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);returne}functiony(e,t){varn;returnn=void0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void0===t||t&&i(e,t)?de.merge([e],n):n}functionx(e,t){for(varn=0,r=e.length;n<r;n++)He.set(e[n],"globalEval",!t||He.get(t[n],"globalEval"))}functionb(e,t,n,r,i){for(varo,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===de.type(o))de.merge(p,o.nodeType?[o]:o);elseif(Ve.test(o)){for(a=a||f.appendChild(t.createElement("div")),s=(ze.exec(o)||["",""])[1].toLowerCase(),u=Ue[s]||Ue._default,a.innerHTML=u[1]+de.htmlPrefilter(o)+u[2],c=u[0];c--;)a=a.lastChild;de.merge(p,a.childNodes),(a=f.firstChild).textContent=""}elsep.push(t.createTextNode(o));for(f.textContent="",d=0;o=p[d++];)if(r&&de.inArray(o,r)>-1)i&&i.push(o);elseif(l=de.contains(o.ownerDocument,o),a=y(f.appendChild(o),"script"),l&&x(a),n)for(c=0;o=a[c++];)Xe.test(o.type||"")&&n.push(o);returnf}functionw(){return!0}functionT(){return!1}functionC(){try{returnte.activeElement}catch(e){}}functionE(e,t,n,r,i,o){vara,s;if("object"==typeoft){"string"!=typeofn&&(r=r||n,n=void0);for(sint)E(e,s,n,r,t[s],o);returne}if(null==r&&null==i?(i=n,r=n=void0):null==i&&("string"==typeofn?(i=r,r=void0):(i=r,r=n,n=void0)),!1===i)i=T;elseif(!i)returne;return1===o&&(a=i,(i=function(e){returnde().off(e),a.apply(this,arguments
!function(e,t){if("function"==typeofdefine&&define.amd)define(["module","exports"],t);elseif("undefined"!=typeofexports)t(module,exports);else{vars={exports:{}};t(s,s.exports),e.TestPilotGA=s.exports}}(this,function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});consts={FIREFOX_NIGHTLY:"nightly",FIREFOX_AURORA:"release",FIREFOX_ESR:"esr",FIREFOX_ESR_NEXT:"esr",LATEST_FIREFOX_DEVEL_VERSION:"developer",LATEST_FIREFOX_RELEASED_DEVEL_VERSION:"developer",LATEST_FIREFOX_VERSION:"release"},n="testpilot_ga__cid",o="https://product-details.mozilla.org/1.0/firefox_versions.json";classr{constructor(e){this.debug=e.debug||!1,this.setOptions(e),this.getChannel(),this.validateOptions()}getChannel(){"undefined"!=typeofbrowser&&Promise.all([this.getProductDetails(),browser.runtime.getBrowserInfo()]).then(([e,t])=>{consts=this.getVersionMap(e);this.cd20=this.getChannelConstant(t,s)})}getVersionMap(e){constt={};returnObject.entries(e).forEach(([e,s])=>{s&&s.length&&(t[s]=e);constn=s.match(/^[^a-z]+/);n&&n.length&&(t[n[0]]=e)}),t}getChannelConstant(e,t){returne&&e.version&&t.hasOwnProperty(e.version)&&s.hasOwnProperty(t[e.version])?s[t[e.version]]:"other"}getProductDetails(){returnnewPromise((e,t)=>{consts=newwindow.XMLHttpRequest;s.open("GET",o),s.onload=function(){s.status<400?e(JSON.parse(s.response)):t(s,Error(s.statusText))},s.onerror=function(){t(s,Error("Network Error"))},s.send()})}setOptions(e){constt=Object.assign({},r.defaultOptions,e);Object.entries(t).forEach(([e,t])=>this[e]=t)}validateOptions(e){constt=r.requiredOptions.reduce((e,t)=>(this.hasOwnProperty(t)||e.push(t),e),[]);t.length&&console.error(`Missing required options: ${t.join(", ")}`)}makeUUID(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(newUint8Array(1))[0]&15>>e/4).toString(16))}getCID(){lete=window.localStorage.getItem(n);returne||(e=this.makeUUID(),window.localStorage.setItem(n,e)),e}getParams(e){const{an:t,aid:s,aiid:n,aip:o,av:r,cd19:i,cd20:a,ds:d,t:l,tid:u,uid:c,v:p,xid:g,xvar:h}=this,O=Object.assign({an:t,aid:s,aiid:n,aip:o,av:r,cd19:i,cd20:a,ds:d,t:l,tid:u,uid:c,v:p,xid:g,xvar:h},{cid:this.getCID(),ua:navigator.userAgent,ul:navigator.language,z:Date.now()},e);returnObject.keys(O).forEach(e=>{null===O[e]&&deleteO[e]}),O}serializeObject(e){returnObject.keys(e).reduce((t,s)=>(t.push(`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`),t),[]).join("&")}requestBody(e){constt=this.getParams(e);return{allParams:t,requestBody:this.serializeObject(t)}}requestURI(){return`https://www.google-analytics.com/${this.debug?"debug/":""}collect`}sendEvent(e,t,s={}){constn=Object.assign({ec:e,ea:t},s),{allParams:o,requestBody:r}=this.requestBody(n);console.log(`Sending '${e}' '${t}':`,o);consti=this.requestURI();returnnewPromise((e,t)=>{if("1"===navigator.doNotTrack)t("Metrics not sent due to DNT.");else{consts=newwindow.XMLHttpRequest;s.open("POST",i),s.onload=function(){s.status<400?e(s):t(`Request error: ${s.statusText}`)},s.onerror=function(){t(`Request error: ${s.status}`)},s.send(r)}})}}t.default=r,r.defaultOptions={aid:null,aiid:"testpilot",aip:"1",av:null,cd19:"dev",cd20:null,ds:"addon",t:"event",uid:null,v:"1",xid:null,xvar:null},r.requiredOptions=["an","ds","tid"],e.exports=t.default});