UNPKG

react-alpha-beta

Version:

Simple declarative A/B testing component for React.

1 lines 26.9 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactAlphaBeta=e(require("react")):t.ReactAlphaBeta=e(t.React)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o=n(21),i=r(o),s=n(22),u=r(s),a=n(7),c=r(a);t.exports={ABComponent:u["default"],DevTools:function(){return i["default"].createElement("div",null)},getExperimentData:c["default"]}},function(t,e){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(t,e){var n=t.exports={version:"1.2.6"};"number"==typeof __e&&(__e=n)},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){var r=n(3),o=n(2),i=n(12),s="prototype",u=function(t,e,n){var a,c,f,l=t&u.F,p=t&u.G,d=t&u.S,h=t&u.P,y=t&u.B,v=t&u.W,m=p?o:o[e]||(o[e]={}),b=p?r:d?r[e]:(r[e]||{})[s];p&&(n=e);for(a in n)c=!l&&b&&a in b,c&&a in m||(f=c?b[a]:n[a],m[a]=p&&"function"!=typeof b[a]?n[a]:y&&c?i(f,r):v&&b[a]==f?function(t){var e=function(e){return this instanceof t?new t(e):t(e)};return e[s]=t[s],e}(f):h&&"function"==typeof f?i(Function.call,f):f,h&&((m[s]||(m[s]={}))[a]=f))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,t.exports=u},function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,n){var r=n(46),o=n(13);t.exports=function(t){return r(o(t))}},function(t,e,n){(function(t){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(e,n){var r=arguments.length<=2||void 0===arguments[2]?null:arguments[2],o=arguments.length<=3||void 0===arguments[3]?null:arguments[3];return(0,y["default"])(m["default"].endPoint+"/"+e+"/",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:(0,d["default"])({experimentId:e,metaId:o,success:r,userCohortValue:JSON.parse(t.localStorage.getItem("alphaBetaMap"))[e],variant:n})})}function i(t,e,n,r){var o=(n+r)/(t+e);return o*(1-o)*(1/t+1/e)}function s(t,e,n,r){return Math.sqrt(i(t,e,n,r))}function u(t,e,n,r){return Math.sqrt(n/t+r/e)}function a(t,e){return t*e>5}function c(t,e,n){var r=t-e,o=t+e,i=void 0,s="We are "+Math.round(100*n,-2)+"% confident the true difference is between "+Math.round(100*r,-2)+"% and "+Math.round(100*o,-2)+"%.",u=void 0;return i=t>0?"Our best estimate is that the absolute rate of success is "+Math.round(100*Math.abs(t),-2)+"% higher with variant B":"Our best estimate is that the absolute rate of success is "+Math.round(100*Math.abs(t),-2)+"% lower with variant B",r*o>0?(i+=", and this result is statistically significant",u=t>0?"It looks like a safe bet to go with variant B.":"Given this information, you should probably stick with variant A."):(i+=", but this result is not statistically significant",u="You don't yet have enough information to make a confident decision, so you should keep running this experiment."),i+" ("+s+"). "+u}function f(t){var e=t.variantA.trialCount,n=t.variantB.trialCount,r=t.variantA.successCount,o=t.variantB.successCount,i=t.confidenceInterval,f=r/e,l=o/n,p=l-f,d=e*f*(1-f),h=n*l*(1-l),y=d/h,v=s(e,n,r,o),m=u(e,n,d,h),g=(0,b.zScoreByConfidenceInterval)(i),_=a(e,f),w=a(n,l);if(_===!1||w===!1)return{statisticalSignificance:!1,details:"You do not have enough sample data for one or both of your variants to make any assertions."};var x=void 0;x=.5>=y||y>=2?g*m*Math.sqrt(1/e+1/n):g*v*Math.sqrt(1/e+1/n);var O=p-x,P=p+x,E=O*P>0,T={statisticalSignificance:E,meanDifferenceValue:p,marginOfError:x,details:c(p,x,i)};return T}function l(t){return(0,y["default"])(m["default"].endPoint+"/"+t+"/",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}}).then(function(t){return t.json()}).then(function(t){return f(t)})}Object.defineProperty(e,"__esModule",{value:!0});var p=n(9),d=r(p);e.postExperimentData=o,e.getPooledVariance=i,e.getPooledStandardDeviation=s,e.getUnpooledVariance=u,e.assumeNormalDistribution=a,e.computeStats=f,e.getExperimentData=l;var h=n(59),y=r(h),v=n(24),m=r(v),b=n(25)}).call(e,function(){return this}())},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.localStorageKey="alphaBetaMap"},function(t,e,n){t.exports={"default":n(36),__esModule:!0}},function(t,e,n){var r=n(16);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(42);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){t.exports=!n(5)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(3),o="__core-js_shared__",i=r[o]||(r[o]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(18)("wks"),o=n(19),i=n(3).Symbol;t.exports=function(t){return r[t]||(r[t]=i&&i[t]||(i||o)("Symbol."+t))}},function(e,n){e.exports=t},function(t,e,n){(function(t){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(28),i=r(o),s=n(31),u=r(s),a=n(32),c=r(a),f=n(34),l=r(f),p=n(33),d=r(p),h=n(21),y=r(h),v=n(23),m=n(8),b=n(7),g=function(e){function n(t){(0,u["default"])(this,n);var e=(0,l["default"])(this,(0,i["default"])(n).call(this,t));return e.successAction=function(){var t=e.state.isInCohort?"b":"a",n=e.props.experimentParams.id;if((0,b.postExperimentData)(n,t,!0),e.props.successAction){var r;(r=e.props).successAction.apply(r,arguments)}},e.onStorageEvent=function(t){t.key===m.localStorageKey&&e.setState({isInCohort:(0,v.isInCohort)(e.props.experimentParams)})},e.state={isInCohort:!1},e}return(0,d["default"])(n,e),(0,c["default"])(n,[{key:"componentWillMount",value:function(){this.setState({isInCohort:(0,v.isInCohort)(this.props.experimentParams)}),t.addEventListener("storage",this.onStorageEvent)}},{key:"componentDidMount",value:function(){var t=this.state.isInCohort?"b":"a",e=this.props.experimentParams.id;(0,b.postExperimentData)(e,t,!1)}},{key:"componentWillUnmount",value:function(){t.removeEventListener("storage",this.onStorageEvent)}},{key:"renderElementOrComponent",value:function(t){var e={successAction:this.successAction};return y["default"].isValidElement(t)?y["default"].cloneElement(t,e):y["default"].createElement(t,e)}},{key:"render",value:function(){var t=this.props,e=t.ComponentA,n=t.ComponentB;return this.state.isInCohort?this.renderElementOrComponent(n):this.renderElementOrComponent(e)}}]),n}(y["default"].Component);g.displayName="ABComponent",g.propTypes={experimentParams:y["default"].PropTypes.object,ComponentA:y["default"].PropTypes.oneOfType([y["default"].PropTypes.element,y["default"].PropTypes.oneOfType([y["default"].PropTypes.string,y["default"].PropTypes.func])]),ComponentB:y["default"].PropTypes.oneOfType([y["default"].PropTypes.element,y["default"].PropTypes.oneOfType([y["default"].PropTypes.string,y["default"].PropTypes.func])]),successAction:y["default"].PropTypes.func},e["default"]=g}).call(e,function(){return this}())},function(t,e,n){(function(t){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(e){var n=e.id,r=void 0;try{var o=t.localStorage.getItem(u.localStorageKey);r=o&&JSON.parse(o)||{}}catch(i){r={}}if(!(n in r)){r[n]=Math.random();var a=(0,s["default"])(r);t.localStorage.setItem(u.localStorageKey,a)}return r[n]<e.testCohortSize}Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),s=r(i);e.isInCohort=o;var u=n(8)}).call(e,function(){return this}())},function(t,e,n){(function(t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={endPoint:t.env.ALPHA_BETA_ENDPOINT||"http://127.0.0.1:8000/api/alphabeta"}}).call(e,n(60))},function(t,e){"use strict";function n(t){var e=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=0,o=e?1-(1-t)/2:t;if(.5>o||o>.9998)throw e?new Error("Your confidenceInterval must be between 0.5000 and 0.9996"):new Error("Your confidenceInterval must be between 0.5000 and 0.9998");for(var i=0;i<r.length;i++)if(o>r[i][0]){n=r[i][1];break}return n}Object.defineProperty(e,"__esModule",{value:!0}),e.zScoreByConfidenceInterval=n;var r=[[.9997,3.49],[.9996,3.39],[.9995,3.33],[.9994,3.27],[.9993,3.22],[.9992,3.18],[.9991,3.14],[.999,3.11],[.9989,3.08],[.9988,3.05],[.9987,3.03],[.9986,3],[.9985,2.98],[.9984,2.96],[.9983,2.94],[.9982,2.93],[.9981,2.91],[.998,2.89],[.9979,2.88],[.9978,2.86],[.9977,2.85],[.9976,2.83],[.9975,2.82],[.9974,2.81],[.9973,2.79],[.9972,2.78],[.9971,2.77],[.997,2.76],[.9969,2.75],[.9968,2.74],[.9967,2.73],[.9966,2.72],[.9965,2.71],[.9964,2.7],[.9963,2.69],[.9962,2.68],[.9961,2.67],[.996,2.66],[.9959,2.65],[.9957,2.64],[.9956,2.63],[.9955,2.62],[.9953,2.61],[.9952,2.6],[.9951,2.59],[.9949,2.58],[.9948,2.57],[.9946,2.56],[.9945,2.55],[.9943,2.54],[.9941,2.53],[.994,2.52],[.9938,2.51],[.9936,2.5],[.9934,2.49],[.9932,2.48],[.9931,2.47],[.9929,2.46],[.9927,2.45],[.9925,2.44],[.9922,2.43],[.992,2.42],[.9918,2.41],[.9916,2.4],[.9913,2.39],[.9911,2.38],[.9909,2.37],[.9906,2.36],[.9904,2.35],[.9901,2.34],[.9898,2.33],[.9896,2.32],[.9893,2.31],[.989,2.3],[.9887,2.29],[.9884,2.28],[.9881,2.27],[.9878,2.26],[.9875,2.25],[.9871,2.24],[.9868,2.23],[.9864,2.22],[.9861,2.21],[.9857,2.2],[.9854,2.19],[.985,2.18],[.9846,2.17],[.9842,2.16],[.9838,2.15],[.9834,2.14],[.983,2.13],[.9826,2.12],[.9821,2.11],[.9817,2.1],[.9812,2.09],[.9808,2.08],[.9803,2.07],[.9798,2.06],[.9793,2.05],[.9788,2.04],[.9783,2.03],[.9778,2.02],[.9772,2.01],[.9767,2],[.9761,1.99],[.9756,1.98],[.975,1.97],[.9744,1.96],[.9738,1.95],[.9732,1.94],[.9726,1.93],[.9719,1.92],[.9713,1.91],[.9706,1.9],[.9699,1.89],[.9693,1.88],[.9686,1.87],[.9678,1.86],[.9671,1.85],[.9664,1.84],[.9656,1.83],[.9649,1.82],[.9641,1.81],[.9633,1.8],[.9625,1.79],[.9616,1.78],[.9608,1.77],[.9599,1.76],[.9591,1.75],[.9582,1.74],[.9573,1.73],[.9564,1.72],[.9554,1.71],[.9545,1.7],[.9535,1.69],[.9525,1.68],[.9515,1.67],[.9505,1.66],[.9495,1.65],[.9484,1.64],[.9474,1.63],[.9463,1.62],[.9452,1.61],[.9441,1.6],[.9429,1.59],[.9418,1.58],[.9406,1.57],[.9394,1.56],[.9382,1.55],[.937,1.54],[.9357,1.53],[.9345,1.52],[.9332,1.51],[.9319,1.5],[.9306,1.49],[.9292,1.48],[.9279,1.47],[.9265,1.46],[.9251,1.45],[.9236,1.44],[.9222,1.43],[.9207,1.42],[.9192,1.41],[.9177,1.4],[.9162,1.39],[.9147,1.38],[.9131,1.37],[.9115,1.36],[.9099,1.35],[.9082,1.34],[.9066,1.33],[.9049,1.32],[.9032,1.31],[.9015,1.3],[.8997,1.29],[.898,1.28],[.8962,1.27],[.8944,1.26],[.8925,1.25],[.8907,1.24],[.8888,1.23],[.8869,1.22],[.8849,1.21],[.883,1.2],[.881,1.19],[.879,1.18],[.877,1.17],[.8749,1.16],[.8729,1.15],[.8708,1.14],[.8686,1.13],[.8665,1.12],[.8643,1.11],[.8621,1.1],[.8599,1.09],[.8577,1.08],[.8554,1.07],[.8531,1.06],[.8508,1.05],[.8485,1.04],[.8461,1.03],[.8438,1.02],[.8413,1.01],[.8389,1],[.8365,.99],[.834,.98],[.8315,.97],[.8289,.96],[.8264,.95],[.8238,.94],[.8212,.93],[.8186,.92],[.8159,.91],[.8133,.9],[.8106,.89],[.8078,.88],[.8051,.87],[.8023,.86],[.7995,.85],[.7967,.84],[.7939,.83],[.791,.82],[.7881,.81],[.7852,.8],[.7823,.79],[.7794,.78],[.7764,.77],[.7734,.76],[.7704,.75],[.7673,.74],[.7642,.73],[.7611,.72],[.758,.71],[.7549,.7],[.7517,.69],[.7486,.68],[.7454,.67],[.7422,.66],[.7389,.65],[.7357,.64],[.7324,.63],[.7291,.62],[.7257,.61],[.7224,.6],[.719,.59],[.7157,.58],[.7123,.57],[.7088,.56],[.7054,.55],[.7019,.54],[.6985,.53],[.695,.52],[.6915,.51],[.6879,.5],[.6844,.49],[.6808,.48],[.6772,.47],[.6736,.46],[.67,.45],[.6664,.44],[.6628,.43],[.6591,.42],[.6554,.41],[.6517,.4],[.648,.39],[.6443,.38],[.6406,.37],[.6368,.36],[.6331,.35],[.6293,.34],[.6255,.33],[.6217,.32],[.6179,.31],[.6141,.3],[.6103,.29],[.6064,.28],[.6026,.27],[.5987,.26],[.5948,.25],[.591,.24],[.5871,.23],[.5832,.22],[.5793,.21],[.5753,.2],[.5714,.19],[.5675,.18],[.5636,.17],[.5596,.16],[.5557,.15],[.5517,.14],[.5478,.13],[.5438,.12],[.5398,.11],[.5359,.1],[.5319,.09],[.5279,.08],[.5239,.07],[.5199,.06],[.516,.05],[.512,.04],[.508,.03],[.504,.02],[.5,.01]]},function(t,e,n){t.exports={"default":n(37),__esModule:!0}},function(t,e,n){t.exports={"default":n(38),__esModule:!0}},function(t,e,n){t.exports={"default":n(39),__esModule:!0}},function(t,e,n){t.exports={"default":n(40),__esModule:!0}},function(t,e,n){t.exports={"default":n(41),__esModule:!0}},function(t,e){"use strict";e.__esModule=!0,e["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=n(27),i=r(o);e["default"]=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,i["default"])(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}()},function(t,e,n){"use strict";var r=n(26)["default"],o=n(29)["default"];e["default"]=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=r(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(o?o(t,e):t.__proto__=e)},e.__esModule=!0},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=n(35),i=r(o);e["default"]=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":(0,i["default"])(e))&&"function"!=typeof e?t:e}},function(t,e,n){"use strict";var r=n(30)["default"];e["default"]=function(t){return t&&t.constructor===r?"symbol":typeof t},e.__esModule=!0},function(t,e,n){var r=n(2);t.exports=function(t){return(r.JSON&&r.JSON.stringify||JSON.stringify).apply(JSON,arguments)}},function(t,e,n){var r=n(1);t.exports=function(t,e){return r.create(t,e)}},function(t,e,n){var r=n(1);t.exports=function(t,e,n){return r.setDesc(t,e,n)}},function(t,e,n){n(55),t.exports=n(2).Object.getPrototypeOf},function(t,e,n){n(56),t.exports=n(2).Object.setPrototypeOf},function(t,e,n){n(58),n(57),t.exports=n(2).Symbol},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(1);t.exports=function(t){var e=r.getKeys(t),n=r.getSymbols;if(n)for(var o,i=n(t),s=r.isEnum,u=0;i.length>u;)s.call(t,o=i[u++])&&e.push(o);return e}},function(t,e,n){var r=n(6),o=n(1).getNames,i={}.toString,s="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],u=function(t){try{return o(t)}catch(e){return s.slice()}};t.exports.get=function(t){return s&&"[object Window]"==i.call(t)?u(t):o(r(t))}},function(t,e,n){var r=n(1),o=n(17);t.exports=n(14)?function(t,e,n){return r.setDesc(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(11);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(11);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var r=n(1),o=n(6);t.exports=function(t,e){for(var n,i=o(t),s=r.getKeys(i),u=s.length,a=0;u>a;)if(i[n=s[a++]]===e)return n}},function(t,e){t.exports=!0},function(t,e,n){var r=n(4),o=n(2),i=n(5);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],s={};s[t]=e(n),r(r.S+r.F*i(function(){n(1)}),"Object",s)}},function(t,e,n){t.exports=n(45)},function(t,e,n){var r=n(1).getDesc,o=n(16),i=n(10),s=function(t,e){if(i(t),!o(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,o){try{o=n(12)(Function.call,r(Object.prototype,"__proto__").set,2),o(t,[]),e=!(t instanceof Array)}catch(i){e=!0}return function(t,n){return s(t,n),e?t.__proto__=n:o(t,n),t}}({},!1):void 0),check:s}},function(t,e,n){var r=n(1).setDesc,o=n(15),i=n(20)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){var r=n(13);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(54);n(50)("getPrototypeOf",function(t){return function(e){return t(r(e))}})},function(t,e,n){var r=n(4);r(r.S,"Object",{setPrototypeOf:n(52).set})},function(t,e){},function(t,e,n){"use strict";var r=n(1),o=n(3),i=n(15),s=n(14),u=n(4),a=n(51),c=n(5),f=n(18),l=n(53),p=n(19),d=n(20),h=n(48),y=n(44),v=n(43),m=n(47),b=n(10),g=n(6),_=n(17),w=r.getDesc,x=r.setDesc,O=r.create,P=y.get,E=o.Symbol,T=o.JSON,S=T&&T.stringify,M=!1,j=d("_hidden"),B=r.isEnum,D=f("symbol-registry"),A=f("symbols"),C="function"==typeof E,I=Object.prototype,N=s&&c(function(){return 7!=O(x({},"a",{get:function(){return x(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=w(I,e);r&&delete I[e],x(t,e,n),r&&t!==I&&x(I,e,r)}:x,k=function(t){var e=A[t]=O(E.prototype);return e._k=t,s&&M&&N(I,t,{configurable:!0,set:function(e){i(this,j)&&i(this[j],t)&&(this[j][t]=!1),N(this,t,_(1,e))}}),e},R=function(t){return"symbol"==typeof t},F=function(t,e,n){return n&&i(A,e)?(n.enumerable?(i(t,j)&&t[j][e]&&(t[j][e]=!1),n=O(n,{enumerable:_(0,!1)})):(i(t,j)||x(t,j,_(1,{})),t[j][e]=!0),N(t,e,n)):x(t,e,n)},U=function(t,e){b(t);for(var n,r=v(e=g(e)),o=0,i=r.length;i>o;)F(t,n=r[o++],e[n]);return t},q=function(t,e){return void 0===e?O(t):U(O(t),e)},L=function(t){var e=B.call(this,t);return e||!i(this,t)||!i(A,t)||i(this,j)&&this[j][t]?e:!0},J=function(t,e){var n=w(t=g(t),e);return!n||!i(A,e)||i(t,j)&&t[j][e]||(n.enumerable=!0),n},H=function(t){for(var e,n=P(g(t)),r=[],o=0;n.length>o;)i(A,e=n[o++])||e==j||r.push(e);return r},G=function(t){for(var e,n=P(g(t)),r=[],o=0;n.length>o;)i(A,e=n[o++])&&r.push(A[e]);return r},K=function(t){if(void 0!==t&&!R(t)){for(var e,n,r=[t],o=1,i=arguments;i.length>o;)r.push(i[o++]);return e=r[1],"function"==typeof e&&(n=e),!n&&m(e)||(e=function(t,e){return n&&(e=n.call(this,t,e)),R(e)?void 0:e}),r[1]=e,S.apply(T,r)}},W=c(function(){var t=E();return"[null]"!=S([t])||"{}"!=S({a:t})||"{}"!=S(Object(t))});C||(E=function(){if(R(this))throw TypeError("Symbol is not a constructor");return k(p(arguments.length>0?arguments[0]:void 0))},a(E.prototype,"toString",function(){return this._k}),R=function(t){return t instanceof E},r.create=q,r.isEnum=L,r.getDesc=J,r.setDesc=F,r.setDescs=U,r.getNames=y.get=H,r.getSymbols=G,s&&!n(49)&&a(I,"propertyIsEnumerable",L,!0));var z={"for":function(t){return i(D,t+="")?D[t]:D[t]=E(t)},keyFor:function(t){return h(D,t)},useSetter:function(){M=!0},useSimple:function(){M=!1}};r.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(t){var e=d(t);z[t]=C?e:k(e)}),M=!0,u(u.G+u.W,{Symbol:E}),u(u.S,"Symbol",z),u(u.S+u.F*!C,"Object",{create:q,defineProperty:F,defineProperties:U,getOwnPropertyDescriptor:J,getOwnPropertyNames:H,getOwnPropertySymbols:G}),T&&u(u.S+u.F*(!C||W),"JSON",{stringify:K}),l(E,"Symbol"),l(Math,"Math",!0),l(o.JSON,"JSON",!0)},function(t,e,n){n(61),t.exports=self.fetch.bind(self)},function(t,e){function n(){c=!1,s.length?a=s.concat(a):f=-1,a.length&&r()}function r(){if(!c){var t=setTimeout(n);c=!0;for(var e=a.length;e;){for(s=a,a=[];++f<e;)s&&s[f].run();f=-1,e=a.length}s=null,c=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function i(){}var s,u=t.exports={},a=[],c=!1,f=-1;u.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new o(t,e)),1!==a.length||c||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=i,u.addListener=i,u.once=i,u.off=i,u.removeListener=i,u.removeAllListeners=i,u.emit=i,u.binding=function(t){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(t){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(t,e){!function(t){"use strict";function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!=typeof t&&(t=String(t)),t}function r(t){this.map={},t instanceof r?t.forEach(function(t,e){this.append(e,t)},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function o(t){return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function i(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function s(t){var e=new FileReader;return e.readAsArrayBuffer(t),i(e)}function u(t){var e=new FileReader;return e.readAsText(t),i(e)}function a(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,"string"==typeof t)this._bodyText=t;else if(h.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(h.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(t){if(!h.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t))throw new Error("unsupported BodyInit type")}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type&&this.headers.set("content-type",this._bodyBlob.type))},h.blob?(this.blob=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(s)},this.text=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return u(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var t=o(this);return t?t:Promise.resolve(this._bodyText)},h.formData&&(this.formData=function(){return this.text().then(l)}),this.json=function(){return this.text().then(JSON.parse)},this}function c(t){var e=t.toUpperCase();return y.indexOf(e)>-1?e:t}function f(t,e){e=e||{};var n=e.body;if(f.prototype.isPrototypeOf(t)){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new r(t.headers)),this.method=t.method,this.mode=t.mode,n||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=t;if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new r(e.headers)),this.method=c(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function l(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(o))}}),e}function p(t){var e=new r,n=t.getAllResponseHeaders().trim().split("\n");return n.forEach(function(t){var n=t.trim().split(":"),r=n.shift().trim(),o=n.join(":").trim();e.append(r,o)}),e}function d(t,e){e||(e={}),this.type="default",this.status=e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText,this.headers=e.headers instanceof r?e.headers:new r(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){r.prototype.append=function(t,r){t=e(t),r=n(r);var o=this.map[t];o||(o=[],this.map[t]=o),o.push(r)},r.prototype["delete"]=function(t){delete this.map[e(t)]},r.prototype.get=function(t){var n=this.map[e(t)];return n?n[0]:null},r.prototype.getAll=function(t){return this.map[e(t)]||[]},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(t,r){this.map[e(t)]=[n(r)]},r.prototype.forEach=function(t,e){Object.getOwnPropertyNames(this.map).forEach(function(n){this.map[n].forEach(function(r){t.call(e,r,n,this)},this)},this)};var h={blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t},y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];f.prototype.clone=function(){return new f(this)},a.call(f.prototype),a.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},d.error=function(){var t=new d(null,{status:0,statusText:""});return t.type="error",t};var v=[301,302,303,307,308];d.redirect=function(t,e){if(-1===v.indexOf(e))throw new RangeError("Invalid status code");return new d(null,{status:e,headers:{location:t}})},t.Headers=r,t.Request=f,t.Response=d,t.fetch=function(t,e){return new Promise(function(n,r){function o(){return"responseURL"in s?s.responseURL:/^X-Request-URL:/m.test(s.getAllResponseHeaders())?s.getResponseHeader("X-Request-URL"):void 0}var i;i=f.prototype.isPrototypeOf(t)&&!e?t:new f(t,e);var s=new XMLHttpRequest;s.onload=function(){var t=1223===s.status?204:s.status;if(100>t||t>599)return void r(new TypeError("Network request failed"));var e={status:t,statusText:s.statusText,headers:p(s),url:o()},i="response"in s?s.response:s.responseText;n(new d(i,e))},s.onerror=function(){r(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials&&(s.withCredentials=!0),"responseType"in s&&h.blob&&(s.responseType="blob"),i.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send("undefined"==typeof i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)}])});