UNPKG

twitch-panels

Version:

CLI that generates Twitch panels as PNGs.

6 lines 36.7 kB
#!/usr/bin/env node /*! *** TwitchPanels 3.5.0 *** Copyright © 2020, Jaid <jaid.jsx@gmail.com> (https://github.com/Jaid) *** @license MIT !*/!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=61)}([function(t,e){var n=Array.isArray;t.exports=n},function(t,e,n){var r=n(29),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(16);const o=new(n.n(r).a)({name:"TwitchPanels",version:"3.5.0",useGot:!0,configSetup:{defaults:{dry:!0,twitchUser:"jaidchen",outputFolder:!0,rainbow:!1,twitchWebClientId:"kimne78kx3ncx6brgo4mv6wki5h1ko",extensionsOnTop:!0},secretKeys:["twitchApiToken","twitchAccessToken"]}}),i=(o.logger,o.got,o.config,o.appFolder);e.b=o},function(t,e,n){var r=n(10),o=n(66),i=n(67),a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?o(t):i(t)}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){var r=n(88),o=n(91);t.exports=function(t,e){var n=o(t,e);return r(n)?n:void 0}},function(t,e){t.exports=require("ensure-array")},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){var r=n(3),o=n(4);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},function(t,e,n){var r=n(28),o=n(19);t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}},function(t,e,n){var r=n(1).Symbol;t.exports=r},function(t,e,n){var r=n(78),o=n(79),i=n(80),a=n(81),s=n(82);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){var r=n(18);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},function(t,e,n){var r=n(5)(Object,"create");t.exports=r},function(t,e,n){var r=n(100);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},function(t,e,n){var r=n(8);t.exports=function(t){if("string"==typeof t||r(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},function(t,e){t.exports=require("jaid-core")},function(t,e){t.exports=require("path")},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&9007199254740991>=t}},function(t,e){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&e>t}},function(t,e,n){var r=n(5)(n(1),"Map");t.exports=r},function(t,e,n){var r=n(92),o=n(99),i=n(101),a=n(102),s=n(103);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){var r=n(121),o=n(127),i=n(9);t.exports=function(t){return i(t)?r(t):o(t)}},function(t,e,n){var r=n(0),o=n(8),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!o(t))||a.test(t)||!i.test(t)||null!=e&&t in Object(e)}},function(t,e){t.exports=require("@absolunet/fsp")},function(t,e){t.exports=require("query-string")},function(t,e){t.exports=require("tough-cookie")},function(t,e,n){var r=n(3),o=n(7);t.exports=function(t){if(!o(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e){var n="object"==typeof global&&global&&global.Object===Object&&global;t.exports=n},function(t,e,n){"use strict";n.r(e),e.default=t=>t.map(({question:t,answer:e,panel:n},r)=>({title:t,content:e,icon:"question-circle-o",titleFontSize:20,themeColor:`hsl(${130+4*r}, 100%, 45%)`,...n||{}}))},function(t,e,n){"use strict";n.r(e);var r=n(60),o=n.n(r),i=n(6),a=n.n(i);const s={blackDesert:{title:"Black Desert Online",icon:"https://i.imgur.com/gjUoNFG.png"}};e.default=t=>o()(t,[t=>t.permission,t=>t.usage],["desc","asc"]).map(t=>{let e="";const n=s[t.for];return n&&(e+=`{imgcenter:${n.icon}::Ausgelegt auf ${n.title}}{br:6}`),"mod"===t.permission&&(e+="{iconcenter:lock/Nur für Moderatoren}{br:6}"),"subOrVip"===t.permission&&(e+="{iconcenter:star/Nur für Subscriber, VIPs und Moderatoren}{br:6}"),e+=t.description,t.example&&(e+=`{br:10}{colored:Beispiel:}{br:4}{chat:${a()(t.example).join("\n")}}`),{content:e,title:t.usage,titleFont:"Ubuntu",titleFontSize:24,themeColor:{mod:"#E40000",subOrVip:"#00D8EB"}[t.permission]||"#0072AE",...t.panel||{}}})},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}},function(t,e,n){var r=n(11),o=n(83),i=n(84),a=n(85),s=n(86),u=n(87);function c(t){var e=this.__data__=new r(t);this.size=e.size}c.prototype.clear=o,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=s,c.prototype.set=u,t.exports=c},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e,n){var r=n(104),o=n(4);t.exports=function t(e,n,i,a,s){return e===n||(null==e||null==n||!o(e)&&!o(n)?e!=e&&n!=n:r(e,n,i,a,t,s))}},function(t,e,n){var r=n(105),o=n(108),i=n(109);t.exports=function(t,e,n,a,s,u){var c=1&n,f=t.length,p=e.length;if(!(f==p||c&&p>f))return!1;var l=u.get(t);if(l&&u.get(e))return l==e;var h=-1,v=!0,d=2&n?new r:void 0;for(u.set(t,e),u.set(e,t);++h<f;){var b=t[h],y=e[h];if(a)var m=c?a(y,b,h,e,t,u):a(b,y,h,t,e,u);if(void 0!==m){if(m)continue;v=!1;break}if(d){if(!o(e,(function(t,e){if(!i(d,e)&&(b===t||s(b,t,n,a,u)))return d.push(e)}))){v=!1;break}}else if(b!==y&&!s(b,y,n,a,u)){v=!1;break}}return u.delete(t),u.delete(e),v}},function(t,e,n){var r=n(123),o=n(4),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return o(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=u},function(t,e,n){(function(t){var r=n(1),o=n(124),i=e&&!e.nodeType&&e,a=i&&"object"==typeof t&&t&&!t.nodeType&&t,s=a&&a.exports===i?r.Buffer:void 0,u=(s?s.isBuffer:void 0)||o;t.exports=u}).call(this,n(39)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){var r=n(125),o=n(41),i=n(126),a=i&&i.isTypedArray,s=a?o(a):r;t.exports=s},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){var r=n(7);t.exports=function(t){return t==t&&!r(t)}},function(t,e){t.exports=function(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}}},function(t,e,n){var r=n(45),o=n(15);t.exports=function(t,e){for(var n=0,i=(e=r(e,t)).length;null!=t&&i>n;)t=t[o(e[n++])];return n&&n==i?t:void 0}},function(t,e,n){var r=n(0),o=n(24),i=n(139),a=n(142);t.exports=function(t,e){return r(t)?t:o(t,e)?[t]:i(a(t))}},function(t,e){t.exports=function(t){return t}},function(t,e,n){"use strict";n.r(e),e.default=t=>t.map(t=>({...t}))},function(t,e){t.exports=require("yargs")},function(t,e,n){var r=n(64),o=n(65),i=n(68),a=parseFloat,s=Math.min,u=Math.random;t.exports=function(t,e,n){if(n&&"boolean"!=typeof n&&o(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=i(t),void 0===e?(e=t,t=0):e=i(e)),t>e){var c=t;t=e,e=c}if(n||t%1||e%1){var f=u();return s(t+f*(e-t+a("1e-"+((f+"").length-1))),e)}return r(t,e)}},function(t,e,n){var r=n(3),o=n(0),i=n(4);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==r(t)}},function(t,e,n){var r=n(3),o=n(4);t.exports=function(t){return"number"==typeof t||o(t)&&"[object Number]"==r(t)}},function(t,e){t.exports=require("has-content")},function(t,e){t.exports=require("puppeteer")},function(t,e){t.exports=require("read-file-yaml")},function(t,e){t.exports=require("sharp")},function(t,e){t.exports=require("tough-cookie-file-store")},function(t,e){t.exports=require("user-agents")},function(t,e,n){"use strict";const r=()=>{const t=new Error("Delay aborted");return t.name="AbortError",t},o=({clearTimeout:t,setTimeout:e,willResolve:n})=>(o,{value:i,signal:a}={})=>{if(a&&a.aborted)return Promise.reject(r());let s,u,c;const f=t||clearTimeout,p=()=>{f(s),c(r())},l=()=>{a&&a.removeEventListener("abort",p)},h=new Promise((t,r)=>{u=()=>{l(),n?t(i):r(i)},c=r,s=(e||setTimeout)(u,o)});return a&&a.addEventListener("abort",p,{once:!0}),h.clear=()=>{f(s),s=null,l(),u()},h},i=o({willResolve:!0});i.reject=o({willResolve:!1}),i.createWithTimers=({clearTimeout:t,setTimeout:e})=>{const n=o({clearTimeout:t,setTimeout:e,willResolve:!0});return n.reject=o({clearTimeout:t,setTimeout:e,willResolve:!1}),n},t.exports=i,t.exports.default=i},function(t,e,n){"use strict";const r=n(70);class o extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,({message:t}=t)):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}function i(t,e,n){const r=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=r,t}t.exports=(t,e)=>new Promise((n,a)=>{e=Object.assign({onFailedAttempt:()=>{},retries:10},e);const s=r.operation(e);s.attempt(r=>Promise.resolve(r).then(t).then(n,t=>{t instanceof o?(s.stop(),a(t.originalError)):t instanceof TypeError?(s.stop(),a(t)):s.retry(t)?(i(t,r,e),e.onFailedAttempt(t)):(i(t,r,e),e.onFailedAttempt(t),a(s.mainError()))}))}),t.exports.AbortError=o},function(t,e,n){var r=n(74),o=n(0);t.exports=function(t,e,n,i){return null==t?[]:(o(e)||(e=null==e?[]:[e]),o(n=i?void 0:n)||(n=null==n?[]:[n]),r(t,e,n))}},function(t,e,n){"use strict";n.r(e);var r=n(48),o=n.n(r),i=n(2);function a(t){var e;(null===i.b||void 0===i.b||null===(e=i.b.logger)||void 0===e?void 0:e.error)?i.b.logger.error(t):console.error(t)}process.on("unhandledRejection",t=>{a(t?`Unhandled promise rejection: ${(null==t?void 0:t.message)||t}`:"Unhandled promise rejection"),(null==t?void 0:t.stack)&&a(t.stack)}),o.a.scriptName("twitch-panels").version("3.5.0").command("$0","CLI that generates Twitch panels as PNGs.",{},(function(){(async function(){const t={},e=n(62);for(const n of e.keys()){const{pluginName:r}=n.match(/[/\\](?<pluginName>.+?)[/\\]index\.js$/).groups;t[r]=e(n).default}await i.b.init(t)})().catch(t=>{a("Core process crashed"),a(t),process.exit(1)})})).argv},function(t,e,n){var r={"./main/index.js":63};function o(t){var e=i(t);return n(e)}function i(t){if(!n.o(r,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r[t]}o.keys=function(){return Object.keys(r)},o.resolve=i,t.exports=o,o.id=62},function(t,e,n){"use strict";n.r(e);var r=n(49),o=n.n(r),i=n(50),a=n.n(i),s=n(51),u=n.n(s),c=n(25),f=n.n(c),p=n(6),l=n.n(p),h=n(52),v=n(16),d=n(17),b=n.n(d),y=n(53),m=n.n(y),g=n(26),x=n(54),_=n.n(x),j=n(55),w=n.n(j),O=n(27),T=n(56),A=n.n(T),k=n(57),P=n.n(k),E=n(58),S=n.n(E),C=n(59),$=n.n(C),F=n(2);const U=new P.a({deviceCategory:"tablet"}),z=["panels","answers","commands"];e.default=class extends v.JaidCorePlugin{constructor(...t){super(...t),this.got=null}async init(){}handleConfig(t){this.config=t}handleGot(t){this.got=t}async ready(){var t;let e;try{var r,i;const t=a()(this.config.outputFolder)?this.config.outputFolder:"dist/panels";await f.a.emptyDir(t),e=await m.a.launch({defaultViewport:{width:320,height:600},devtools:!1,args:["--no-sandbox","--disable-setuid-sandbox","--font-render-hinting=medium","--enable-font-antialiasing"]});const s=[];for(const t of z){const e=b.a.join(this.core.appFolder,`${t}.yml`);this.log(`Reading ${e}`);const r=await _()(e);if(null===r)continue;if(Object(h.isEmpty)(r))continue;this[t]=l()(r),this.log(`Loaded ${t}: ${this[t].length}`);const o=n(73)(`./${t}`).default;Array.prototype.push.apply(s,o(this[t]))}const c=o()(360),p=async(n,r)=>{var o;const i={contentFont:"Lexend Deca",centerFont:"Blinker",centerFontSize:18,titleUppercase:"",hasLink:n.link?"1":"",mode:"output",...n};o=this.config.rainbow,u()(o)&&(i.themeColor=`hsl(${c+r*this.config.rainbow}, 100%, 47%)`),i.points&&(i.content=i.content||"",i.content+="{br:6}",i.content+=l()(i.points).map(t=>`{center:${t}}`).join("{br:2}"));const a=`https://panel.jaid.codes?${Object(g.stringify)(i)}`,s=(r+1+"").padStart(3,0);this.log(`Rendering ${s}: ${i.title||"(no title)"}`),this.logDebug(`https://panel.jaid.codes?${Object(g.stringify)(i)}`);const p=await e.newPage();await p.goto(a,{waitUntil:"domcontentloaded"}),await p.waitForSelector("body div"),await S()(1e3);const h=await p.screenshot({omitBackground:!0});await p.close();const v=w()(h);v.trim(),v.png();const d=await v.metadata(),y=await v.toBuffer();return await f.a.outputFile(b.a.join(t,`${s}.png`),y),{imageBuffer:y,imageMeta:d,query:i}},v=Array(s.length);for(let t=0;t<=s.length-1;t++)v[t]=p(s[t],t,s);const d=await Promise.all(v);this.config.dry&&(this.log("Ended early, because this was a dry run"),process.exit(0));const y=b.a.join(F.a,"cookies.json"),x=new A.a(y),j=new O.CookieJar(x),T={api_token:this.config.twitchApiToken,"auth-token":this.config.twitchAccessToken};for(const[t,e]of Object.entries(T)){const n=new O.Cookie({key:t,value:e,domain:"twitch.tv",pathIsDefault:!0,secure:!0});j.setCookieSync(n,"https://twitch.tv")}const k=this.got.extend({headers:{"Accept-Language":"en-US","User-Agent":U.random().toString(),"Client-Id":this.config.twitchWebClientId,Authorization:`OAuth ${this.config.twitchAccessToken}`,"Content-Type":"text/plain;charset=UTF-8"},cookieJar:j}),P=k.extend({prefixUrl:"https://gql.twitch.tv/gql",method:"post",responseType:"json",hooks:{beforeRequest:[t=>(t.body=JSON.stringify(l()(t.body)),t)]}}),E=null===(r=(await P({body:{operationName:"VerifyEmail_CurrentUser",extensions:{persistedQuery:{version:1,sha256Hash:"f9e7dcdf7e99c314c82d8f7f725fab5f99d1df3d7359b53c9ae122deec590198"}}}})).body[0].data)||void 0===r||null===(i=r.currentUser)||void 0===i?void 0:i.id;if(!E)throw new Error("Not logged in!");const C=await P({body:{operationName:"ChannelPanels",variables:{id:E},extensions:{persistedQuery:{version:1,sha256Hash:"236b0ec07489e5172ee1327d114172f27aceca206a1a8053106d60926a7f622e"}}}}),N=[],M=[],R=C.body[0].data.user.panels;for(const t of R)"extension"===t.type.toLowerCase()&&(this.log(`Keeping panel #${t.id}, it's an extension`),M.push(t.id));if(this.config.extensionsOnTop)for(const t of M)N.push(t);const q=({type:t})=>"default"===t.toLowerCase(),D=[];for(let t=0;t<=R.length-1;t++)q(R[t],t,R)&&D.push(R[t]);const L=async({id:t})=>{await P({body:{operationName:"ChannelPanelsDeletePanel",variables:{input:{id:t,type:"DEFAULT"}},extensions:{persistedQuery:{version:1,sha256Hash:"9c0664f015f542319bc15a338a4f489789803bd32c3d3f51b46777728045e3bc"}}}})},B=Array(D.length);for(let t=0;t<=D.length-1;t++)B[t]=L(D[t],t,D);await Promise.all(B);for(const t of d){const e=(await P({body:{operationName:"ChannelPanelsCreatePanel",variables:{input:{channelID:E,type:"DEFAULT"}},extensions:{persistedQuery:{version:1,sha256Hash:"b48b02ec8bf74c237d95efbbeff3bb73f8955b5305c5ac2a234baee5f0a06d61"}}}})).body[0].data.createPanel.panel.id;N.push(e);const n=await $()(async()=>await k.post(`https://api.twitch.tv/v5/users/${E}/upload_panel_image`,{json:{left:0,top:0,width:t.imageMeta.width,height:t.imageMeta.height},headers:{Accept:"application/vnd.twitchtv.v5+json; charset=UTF-8","Content-Type":"application/json; charset=UTF-8","X-Requested-With":"XMLHttpRequest","Twitch-Api-Token":this.config.twitchApiToken}}),{retries:5,onFailedAttempt:()=>{this.logWarn("Retry...")}}),{url:r,upload_id:o}=JSON.parse(n.body);await this.got.put(r,{body:t.imageBuffer}),await P({body:{operationName:"ChannelPanelsUpdatePanel",variables:{input:{id:e,description:"",title:"",linkURL:t.query.link||"",imageURL:`https://panels-images.twitch.tv/panel-${E}-image-${o}`}},extensions:{persistedQuery:{version:1,sha256Hash:"d6edd5143b243785d26200074f7cf287f7fc7484be7b866fd86eec4ed80fb16b"}}}})}if(!this.config.extensionsOnTop)for(const t of M)N.push(t);await P({body:{operationName:"ChannelPanelsOrderPanels",variables:{input:{ids:N}},extensions:{persistedQuery:{version:1,sha256Hash:"c94ed25caf158e3c976b8df8f1875970046ada6aeebf47b8eac3f5208a65828b"}}}})}catch(t){this.logError("Failed to run %s",t)}await(null===(t=e)||void 0===t?void 0:t.close())}}},function(t,e){var n=Math.floor,r=Math.random;t.exports=function(t,e){return t+n(r()*(e-t+1))}},function(t,e,n){var r=n(18),o=n(9),i=n(20),a=n(7);t.exports=function(t,e,n){if(!a(n))return!1;var s=typeof e;return!!("number"==s?o(n)&&i(e,n.length):"string"==s&&e in n)&&r(n[e],t)}},function(t,e,n){var r=n(10),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,s),n=t[s];try{t[s]=void 0;var r=!0}catch(t){}var o=a.call(t);return r&&(e?t[s]=n:delete t[s]),o}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var r=n(69);t.exports=function(t){return t?(t=r(t))===1/0||t===-1/0?17976931348623157e292*(0>t?-1:1):t==t?t:0:0===t?t:0}},function(t,e,n){var r=n(7),o=n(8),i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(o(t))return NaN;if(r(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=r(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(/^\s+|\s+$/g,"");var n=a.test(t);return n||s.test(t)?u(t.slice(2),n?2:8):i.test(t)?NaN:+t}},function(t,e,n){t.exports=n(71)},function(t,e,n){var r=n(72);e.operation=function(t){var n=e.timeouts(t);return new r(n,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<e.retries;o++)r.push(this.createTimeout(o,e));return t&&t.forever&&!r.length&&r.push(this.createTimeout(o,e)),r.sort((function(t,e){return t-e})),r},e.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,r=Math.round(n*e.minTimeout*Math.pow(e.factor,t));return Math.min(r,e.maxTimeout)},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var o in r=[],t)"function"==typeof t[o]&&r.push(o);for(var i=0;i<r.length;i++){var a=r[i],s=t[a];t[a]=function(r){var o=e.operation(n),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push((function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),a.apply(this,arguments))})),o.attempt((function(){r.apply(t,i)}))}.bind(t,s),t[a].options=n}}},function(t,e){function n(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift()}var r=this,o=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n);return this._options.unref&&o.unref(),!0},n.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){n._operationTimeoutCb()}),n._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},n.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},n.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(t[i]||0)+1;t[i]=a,n>a||(e=o,n=a)}return e}},function(t,e,n){var r={"./answers":30,"./answers.js":30,"./commands":31,"./commands.js":31,"./panels":47,"./panels.js":47};function o(t){var e=i(t);return n(e)}function i(t){if(!n.o(r,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r[t]}o.keys=function(){return Object.keys(r)},o.resolve=i,t.exports=o,o.id=73},function(t,e,n){var r=n(32),o=n(75),i=n(150),a=n(156),s=n(41),u=n(157),c=n(46);t.exports=function(t,e,n){var f=-1;e=r(e.length?e:[c],s(o));var p=i(t,(function(t,n,o){return{criteria:r(e,(function(e){return e(t)})),index:++f,value:t}}));return a(p,(function(t,e){return u(t,e,n)}))}},function(t,e,n){var r=n(76),o=n(137),i=n(46),a=n(0),s=n(147);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?a(t)?o(t[0],t[1]):r(t):s(t)}},function(t,e,n){var r=n(77),o=n(136),i=n(43);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(n){return n===t||r(n,t,e)}}},function(t,e,n){var r=n(33),o=n(35);t.exports=function(t,e,n,i){var a=n.length,s=a,u=!i;if(null==t)return!s;for(t=Object(t);a--;){var c=n[a];if(u&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++a<s;){var f=(c=n[a])[0],p=t[f],l=c[1];if(u&&c[2]){if(void 0===p&&!(f in t))return!1}else{var h=new r;if(i)var v=i(p,l,f,t,e,h);if(!(void 0===v?o(l,p,3,i,h):v))return!1}}return!0}},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,n){var r=n(12),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return n>=0&&(n==e.length-1?e.pop():o.call(e,n,1),--this.size,!0)}},function(t,e,n){var r=n(12);t.exports=function(t){var e=this.__data__,n=r(e,t);return 0>n?void 0:e[n][1]}},function(t,e,n){var r=n(12);t.exports=function(t){return r(this.__data__,t)>-1}},function(t,e,n){var r=n(12);t.exports=function(t,e){var n=this.__data__,o=r(n,t);return 0>o?(++this.size,n.push([t,e])):n[o][1]=e,this}},function(t,e,n){var r=n(11);t.exports=function(){this.__data__=new r,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,n){var r=n(11),o=n(21),i=n(22);t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||199>a.length)return a.push([t,e]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(t,e),this.size=n.size,this}},function(t,e,n){var r=n(28),o=n(89),i=n(7),a=n(34),s=Function.prototype,u=Object.prototype,c=s.toString,f=u.hasOwnProperty,p=RegExp("^"+c.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(r(t)?p:/^\[object .+?Constructor\]$/).test(a(t))}},function(t,e,n){var r,o=n(90),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!i&&i in t}},function(t,e,n){var r=n(1)["__core-js_shared__"];t.exports=r},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,n){var r=n(93),o=n(11),i=n(21);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},function(t,e,n){var r=n(94),o=n(95),i=n(96),a=n(97),s=n(98);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){var r=n(13);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,n){var r=n(13),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(e,t)?e[t]:void 0}},function(t,e,n){var r=n(13),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:o.call(e,t)}},function(t,e,n){var r=n(13);t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e,n){var r=n(14);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,n){var r=n(14);t.exports=function(t){return r(this,t).get(t)}},function(t,e,n){var r=n(14);t.exports=function(t){return r(this,t).has(t)}},function(t,e,n){var r=n(14);t.exports=function(t,e){var n=r(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this}},function(t,e,n){var r=n(33),o=n(36),i=n(110),a=n(114),s=n(131),u=n(0),c=n(38),f=n(40),p="[object Object]",l=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,h,v,d){var b=u(t),y=u(e),m=b?"[object Array]":s(t),g=y?"[object Array]":s(e),x=(m="[object Arguments]"==m?p:m)==p,_=(g="[object Arguments]"==g?p:g)==p,j=m==g;if(j&&c(t)){if(!c(e))return!1;b=!0,x=!1}if(j&&!x)return d||(d=new r),b||f(t)?o(t,e,n,h,v,d):i(t,e,m,n,h,v,d);if(!(1&n)){var w=x&&l.call(t,"__wrapped__"),O=_&&l.call(e,"__wrapped__");if(w||O){var T=w?t.value():t,A=O?e.value():e;return d||(d=new r),v(T,A,n,h,d)}}return!!j&&(d||(d=new r),a(t,e,n,h,v,d))}},function(t,e,n){var r=n(22),o=n(106),i=n(107);function a(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new r;++e<n;)this.add(t[e])}a.prototype.add=a.prototype.push=o,a.prototype.has=i,t.exports=a},function(t,e){t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}},function(t,e){t.exports=function(t,e){return t.has(e)}},function(t,e,n){var r=n(10),o=n(111),i=n(18),a=n(36),s=n(112),u=n(113),c=r?r.prototype:void 0,f=c?c.valueOf:void 0;t.exports=function(t,e,n,r,c,p,l){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!p(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var h=s;case"[object Set]":var v=1&r;if(h||(h=u),t.size!=e.size&&!v)return!1;var d=l.get(t);if(d)return d==e;r|=2,l.set(t,e);var b=a(h(t),h(e),r,c,p,l);return l.delete(t),b;case"[object Symbol]":if(f)return f.call(t)==f.call(e)}return!1}},function(t,e,n){var r=n(1).Uint8Array;t.exports=r},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}},function(t,e,n){var r=n(115),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,i,a,s){var u=1&n,c=r(t),f=c.length;if(f!=r(e).length&&!u)return!1;for(var p=f;p--;){var l=c[p];if(!(u?l in e:o.call(e,l)))return!1}var h=s.get(t);if(h&&s.get(e))return h==e;var v=!0;s.set(t,e),s.set(e,t);for(var d=u;++p<f;){var b=t[l=c[p]],y=e[l];if(i)var m=u?i(y,b,l,e,t,s):i(b,y,l,t,e,s);if(!(void 0===m?b===y||a(b,y,n,i,s):m)){v=!1;break}d||(d="constructor"==l)}if(v&&!d){var g=t.constructor,x=e.constructor;g!=x&&"constructor"in t&&"constructor"in e&&!("function"==typeof g&&g instanceof g&&"function"==typeof x&&x instanceof x)&&(v=!1)}return s.delete(t),s.delete(e),v}},function(t,e,n){var r=n(116),o=n(118),i=n(23);t.exports=function(t){return r(t,i,o)}},function(t,e,n){var r=n(117),o=n(0);t.exports=function(t,e,n){var i=e(t);return o(t)?i:r(i,n(t))}},function(t,e){t.exports=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}},function(t,e,n){var r=n(119),o=n(120),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(t){return null==t?[]:(t=Object(t),r(a(t),(function(e){return i.call(t,e)})))}:o;t.exports=s},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i}},function(t,e){t.exports=function(){return[]}},function(t,e,n){var r=n(122),o=n(37),i=n(0),a=n(38),s=n(20),u=n(40),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=i(t),f=!n&&o(t),p=!n&&!f&&a(t),l=!n&&!f&&!p&&u(t),h=n||f||p||l,v=h?r(t.length,String):[],d=v.length;for(var b in t)!e&&!c.call(t,b)||h&&("length"==b||p&&("offset"==b||"parent"==b)||l&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||s(b,d))||v.push(b);return v}},function(t,e){t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},function(t,e,n){var r=n(3),o=n(4);t.exports=function(t){return o(t)&&"[object Arguments]"==r(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var r=n(3),o=n(19),i=n(4),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!a[r(t)]}},function(t,e,n){(function(t){var r=n(29),o=e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o&&r.process,s=function(){try{return i&&i.require&&i.require("util").types||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=s}).call(this,n(39)(t))},function(t,e,n){var r=n(128),o=n(129),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=[];for(var n in Object(t))i.call(t,n)&&"constructor"!=n&&e.push(n);return e}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(130)(Object.keys,Object);t.exports=r},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var r=n(132),o=n(21),i=n(133),a=n(134),s=n(135),u=n(3),c=n(34),f=c(r),p=c(o),l=c(i),h=c(a),v=c(s),d=u;(r&&"[object DataView]"!=d(new r(new ArrayBuffer(1)))||o&&"[object Map]"!=d(new o)||i&&"[object Promise]"!=d(i.resolve())||a&&"[object Set]"!=d(new a)||s&&"[object WeakMap]"!=d(new s))&&(d=function(t){var e=u(t),n="[object Object]"==e?t.constructor:void 0,r=n?c(n):"";if(r)switch(r){case f:return"[object DataView]";case p:return"[object Map]";case l:return"[object Promise]";case h:return"[object Set]";case v:return"[object WeakMap]"}return e}),t.exports=d},function(t,e,n){var r=n(5)(n(1),"DataView");t.exports=r},function(t,e,n){var r=n(5)(n(1),"Promise");t.exports=r},function(t,e,n){var r=n(5)(n(1),"Set");t.exports=r},function(t,e,n){var r=n(5)(n(1),"WeakMap");t.exports=r},function(t,e,n){var r=n(42),o=n(23);t.exports=function(t){for(var e=o(t),n=e.length;n--;){var i=e[n],a=t[i];e[n]=[i,a,r(a)]}return e}},function(t,e,n){var r=n(35),o=n(138),i=n(144),a=n(24),s=n(42),u=n(43),c=n(15);t.exports=function(t,e){return a(t)&&s(e)?u(c(t),e):function(n){var a=o(n,t);return void 0===a&&a===e?i(n,t):r(e,a,3)}}},function(t,e,n){var r=n(44);t.exports=function(t,e,n){var o=null==t?void 0:r(t,e);return void 0===o?n:o}},function(t,e,n){var r=n(140)((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,(function(t,n,r,o){e.push(r?o.replace(/\\(\\)?/g,"$1"):n||t)})),e}));t.exports=r},function(t,e,n){var r=n(141);t.exports=function(t){var e=r(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}},function(t,e,n){var r=n(22);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(o.Cache||r),n}o.Cache=r,t.exports=o},function(t,e,n){var r=n(143);t.exports=function(t){return null==t?"":r(t)}},function(t,e,n){var r=n(10),o=n(32),i=n(0),a=n(8),s=r?r.prototype:void 0,u=s?s.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(a(e))return u?u.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n}},function(t,e,n){var r=n(145),o=n(146);t.exports=function(t,e){return null!=t&&o(t,e,r)}},function(t,e){t.exports=function(t,e){return null!=t&&e in Object(t)}},function(t,e,n){var r=n(45),o=n(37),i=n(0),a=n(20),s=n(19),u=n(15);t.exports=function(t,e,n){for(var c=-1,f=(e=r(e,t)).length,p=!1;++c<f;){var l=u(e[c]);if(!(p=null!=t&&n(t,l)))break;t=t[l]}return p||++c!=f?p:!!(f=null==t?0:t.length)&&s(f)&&a(l,f)&&(i(t)||o(t))}},function(t,e,n){var r=n(148),o=n(149),i=n(24),a=n(15);t.exports=function(t){return i(t)?r(a(t)):o(t)}},function(t,e){t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},function(t,e,n){var r=n(44);t.exports=function(t){return function(e){return r(e,t)}}},function(t,e,n){var r=n(151),o=n(9);t.exports=function(t,e){var n=-1,i=o(t)?Array(t.length):[];return r(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}},function(t,e,n){var r=n(152),o=n(155)(r);t.exports=o},function(t,e,n){var r=n(153),o=n(23);t.exports=function(t,e){return t&&r(t,e,o)}},function(t,e,n){var r=n(154)();t.exports=r},function(t,e){t.exports=function(t){return function(e,n,r){for(var o=-1,i=Object(e),a=r(e),s=a.length;s--;){var u=a[t?s:++o];if(!1===n(i[u],u,i))break}return e}}},function(t,e,n){var r=n(9);t.exports=function(t,e){return function(n,o){if(null==n)return n;if(!r(n))return t(n,o);for(var i=n.length,a=e?i:-1,s=Object(n);(e?a--:++a<i)&&!1!==o(s[a],a,s););return n}}},function(t,e){t.exports=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}},function(t,e,n){var r=n(158);t.exports=function(t,e,n){for(var o=-1,i=t.criteria,a=e.criteria,s=i.length,u=n.length;++o<s;){var c=r(i[o],a[o]);if(c)return u>o?c*("desc"==n[o]?-1:1):c}return t.index-e.index}},function(t,e,n){var r=n(8);t.exports=function(t,e){if(t!==e){var n=void 0!==t,o=null===t,i=t==t,a=r(t),s=void 0!==e,u=null===e,c=e==e,f=r(e);if(!u&&!f&&!a&&t>e||a&&s&&c&&!u&&!f||o&&s&&c||!n&&c||!i)return 1;if(!o&&!a&&!f&&e>t||f&&n&&i&&!o&&!a||u&&n&&i||!s&&i||!c)return-1}return 0}}]);