-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path12.bfd8017d0598e728e6fe.js
1 lines (1 loc) · 27.2 KB
/
12.bfd8017d0598e728e6fe.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{"1BiQ":function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return l}));var n=r("1c9+"),o=r("9oXm"),s=r("vULT"),i=r("jq2n");const a=e=>e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),c=e=>e.replace(/-/g,"+").replace(/_/g,"/")+"==".substring(0,3*e.length%4);let u=[];class l extends o.a{static async open(e,t=5e3){return new l}constructor(){super(),this.scrambleKey=void 0,this.unwrap=!0,u.push(this)}async exchange(t){try{return await function(t,r,o,i){const u=function(t,r){const n=e.alloc(t.length);for(let e=0;e<t.length;e++)n[e]=t[e]^r[e%r.length];return n}(t,o),l=e.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),p={version:"U2F_V2",keyHandle:a(u.toString("base64")),challenge:a(l.toString("base64")),appId:location.origin};return Object(s.a)("apdu","=> "+t.toString("hex")),Object(n.sign)(p,r/1e3).then(t=>{const{signatureData:r}=t;if("string"==typeof r){const t=e.from(c(r),"base64");let n;return n=i?t.slice(5):t,Object(s.a)("apdu","<= "+n.toString("hex")),n}throw t})}(t,this.exchangeTimeout,this.scrambleKey,this.unwrap)}catch(r){throw"object"==typeof r.metaData?(5===r.metaData.code&&(u.forEach(e=>e.emit("disconnect")),u=[]),function(e,t,r){const n=new i.c(t,r);return n.originalError=e,n}(r,"Failed to sign with Ledger device: U2F "+r.metaData.type,"U2F_"+r.metaData.code)):r}}setScrambleKey(t){this.scrambleKey=e.from(t,"ascii")}setUnwrap(e){this.unwrap=e}close(){return Promise.resolve()}}l.isSupported=n.isSupported,l.list=()=>Object(n.isSupported)().then(e=>e?[null]:[]),l.listen=e=>{let t=!1;return Object(n.isSupported)().then(r=>{t||(r?(e.next({type:"add",descriptor:null}),e.complete()):e.error(new i.c("U2F browser support is needed for Ledger. Please use Chrome, Opera or Firefox with a U2F extension. Also make sure you're on an HTTPS connection","U2FNotSupported")))}),{unsubscribe:()=>{t=!0}}}}).call(this,r("HDXh").Buffer)},"1c9+":function(e,t,r){"use strict";e.exports=r("d5mW")},"7HJV":function(e,t,r){"use strict";r.r(t),r("f4g2"),r("WPTD"),r("Rlsf"),r("EqmL"),r("cC/c");var n=r("1oSv"),o=r("jSND"),s=r("1BiQ"),i=r("HRdN"),a=r("HDXh"),c=r.n(a);function u(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function l(e,t,r,n,o,s,i){try{var a=e[s](i),c=a.value}catch(u){return void r(u)}a.done?t(c):Promise.resolve(c).then(n,o)}function p(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var s=e.apply(t,r);function i(e){l(s,n,o,i,a,"next",e)}function a(e){l(s,n,o,i,a,"throw",e)}i(void 0)}))}}function d(e){return h.apply(this,arguments)}function h(){return(h=p(regeneratorRuntime.mark((function e(t){var r,a,l,d,h,f,g,m,E,v,_,w,T,I,S,N,y,A;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return A=function(){return(A=p(regeneratorRuntime.mark((function e(t){var n,a,l,p,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=u(f.values())[0],e.prev=1,e.next=4,s.a.create();case 4:l=new i.a(a=e.sent),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(1),new Error("Error connecting to Ledger wallet");case 11:return e.prev=11,(p=new o.Transaction(t,{chain:d(r)})).raw[6]=c.a.Buffer.from([r]),p.raw[7]=c.a.Buffer.from([]),p.raw[8]=c.a.Buffer.from([]),e.next=18,l.signTransaction(n,p.serialize().toString("hex"));case 18:return p.v=c.a.Buffer.from((h=e.sent).v,"hex"),p.r=c.a.Buffer.from(h.r,"hex"),p.s=c.a.Buffer.from(h.s,"hex"),e.abrupt("return","0x".concat(p.serialize().toString("hex")));case 25:throw e.prev=25,e.t1=e.catch(11),e.t1;case 28:return e.prev=28,a.close(),e.finish(28);case 31:case"end":return e.stop()}}),e,null,[[1,8],[11,25,28,31]])})))).apply(this,arguments)},y=function(e){return A.apply(this,arguments)},N=function(e){return new Promise((function(t,r){m.sendAsync({jsonrpc:"2.0",method:"eth_getBalance",params:[e,"latest"],id:42},(function(e,n){e&&r(e);var o=n&&n.result;t(null!=o?new l(o).toString(10):null)}))}))},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;return new Promise(function(){var r=p(regeneratorRuntime.mark((function r(n,o){var a,c,u,l,p,d,m,E,_,w,T;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(g||n([null]),!((a=f.size)>0)||t){r.next=4;break}return r.abrupt("return",n(v()));case 4:if(c=[],e>1)for(u=a;u<e+a;u++)l="".concat(h,"/").concat(u,"'/0/0"),p="".concat(h,"/0'/").concat(u,"'"),c.push(l,p);else c.push("".concat(h,"/0'/0"));return r.prev=6,r.next=9,s.a.create();case 9:m=new i.a(d=r.sent),r.next=16;break;case 13:r.prev=13,r.t0=r.catch(6),o({message:"Error connecting to Ledger wallet"});case 16:E=0,_=c;case 17:if(!(E<_.length)){r.next=33;break}return w=_[E],r.prev=19,r.next=22,m.getAddress(w);case 22:f.set(r.sent.address.toLowerCase(),w),r.next=30;break;case 27:return r.prev=27,r.t1=r.catch(19),r.abrupt("return",o({message:"There was a problem trying to connect to your Ledger."}));case 30:E++,r.next=17;break;case 33:T=v(),d.close(),n(T);case 36:case"end":return r.stop()}}),r,null,[[6,13],[19,27]])})));return function(e,t){return r.apply(this,arguments)}}())},I=function(e){var t=u(f.entries()),r=t.findIndex((function(t){return(r=t,1,function(e){if(Array.isArray(e))return e}(r)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,o=!1,s=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),1!==r.length);n=!0);}catch(c){o=!0,s=c}finally{try{n||null==a.return||a.return()}finally{if(o)throw s}}return r}}(r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}())[0]===e;var r}));t.unshift(t.splice(r,1)[0]),f=new Map(t)},T=function(){return(T=p(regeneratorRuntime.mark((function e(){var t,r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:5,e.next=3,S(t,!0);case 3:return r=e.sent,e.abrupt("return",Promise.all(r.map((function(e){return new Promise(function(){var t=p(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,N(e);case 2:r({address:e,balance:t.sent});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}))));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)},w=function(){return T.apply(this,arguments)},_=function(){return g?v()[0]:void 0},v=function(){return Array.from(f.keys())},E=function(){return g=!0,S(1)},a=t.rpcUrl,l=t.BigNumber,d=t.networkName,r=t.networkId,h="m/44'/60'",f=new Map,g=!1,(m=Object(n.a)({getAccounts:function(e){S().then((function(t){return e(null,t)})).catch((function(t){return e(t,null)}))},signTransaction:function(e,t){y(e).then((function(e){return t(null,e)})).catch((function(e){return t(e,null)}))},rpcUrl:a})).getPrimaryAddress=_,m.getAllAccountsAndBalances=w,m.enable=E,m.setPrimaryAccount=I,m.getBalance=N,m.send=m.sendAsync,e.abrupt("return",m);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}t.default=function(e){var t,r=e.rpcUrl,n=e.networkId,o=e.preferred;return{name:e.label||"Ledger",svg:e.svg||'\n\t<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 450 450" width="37" height="37"><style>.st0{fill:currentColor}</style><g id="squares_1_"><path class="st0" d="M578.2 392.7V24.3h25.6v344.1h175.3v24.3H578.2zm327.5 5.1c-39.7 0-70.4-12.8-93.4-37.1-21.7-24.3-33.3-58.8-33.3-103.6 0-43.5 10.2-79.3 32-104.9 21.7-26.9 49.9-39.7 87-39.7 32 0 57.6 11.5 76.8 33.3 19.2 23 28.1 53.7 28.1 92.1v20.5H804.6c0 37.1 9 66.5 26.9 85.7 16.6 20.5 42.2 29.4 74.2 29.4 15.3 0 29.4-1.3 40.9-3.8 11.5-2.6 26.9-6.4 44.8-14.1v24.3c-15.3 6.4-29.4 11.5-42.2 14.1-14.3 2.6-28.9 3.9-43.5 3.8zM898 135.6c-26.9 0-47.3 9-64 25.6-15.3 17.9-25.6 42.2-28.1 75.5h168.9c0-32-6.4-56.3-20.5-74.2-12.8-18-32-26.9-56.3-26.9zm238-21.8c19.2 0 37.1 3.8 51.2 10.2 14.1 7.7 26.9 19.2 38.4 37.1h1.3c-1.3-21.7-1.3-42.2-1.3-62.7V0h24.3v392.7h-16.6l-6.4-42.2c-20.5 30.7-51.2 47.3-89.6 47.3s-66.5-11.5-87-35.8c-20.5-23-29.4-57.6-29.4-102.3 0-47.3 10.2-83.2 29.4-108.7 19.2-25.6 48.6-37.2 85.7-37.2zm0 21.8c-29.4 0-52.4 10.2-67.8 32-15.3 20.5-23 51.2-23 92.1 0 78 30.7 116.4 90.8 116.4 30.7 0 53.7-9 67.8-26.9 14.1-17.9 21.7-47.3 21.7-89.6v-3.8c0-42.2-7.7-72.9-21.7-90.8-12.8-20.5-35.8-29.4-67.8-29.4zm379.9-16.6v17.9l-56.3 3.8c15.3 19.2 23 39.7 23 61.4 0 26.9-9 47.3-26.9 64-17.9 16.6-40.9 24.3-70.4 24.3-12.8 0-21.7 0-25.6-1.3-10.2 5.1-17.9 11.5-23 17.9-5.1 7.7-7.7 14.1-7.7 23s3.8 15.3 10.2 19.2c6.4 3.8 17.9 6.4 33.3 6.4h47.3c29.4 0 52.4 6.4 67.8 17.9s24.3 29.4 24.3 53.7c0 29.4-11.5 51.2-34.5 66.5-23 15.3-56.3 23-99.8 23-34.5 0-61.4-6.4-80.6-20.5-19.2-12.8-28.1-32-28.1-55 0-19.2 6.4-34.5 17.9-47.3s28.1-20.5 47.3-25.6c-7.7-3.8-15.3-9-19.2-15.3-5-6.2-7.7-13.8-7.7-21.7 0-17.9 11.5-34.5 34.5-48.6-15.3-6.4-28.1-16.6-37.1-30.7-9-14.1-12.8-30.7-12.8-48.6 0-26.9 9-49.9 25.6-66.5 17.9-16.6 40.9-24.3 70.4-24.3 17.9 0 32 1.3 42.2 5.1h85.7v1.3h.2zm-222.6 319.8c0 37.1 28.1 56.3 84.4 56.3 71.6 0 107.5-23 107.5-69.1 0-16.6-5.1-28.1-16.6-35.8-11.5-7.7-29.4-11.5-55-11.5h-44.8c-49.9 1.2-75.5 20.4-75.5 60.1zm21.8-235.4c0 21.7 6.4 37.1 19.2 49.9 12.8 11.5 29.4 17.9 51.2 17.9 23 0 40.9-6.4 52.4-17.9 12.8-11.5 17.9-28.1 17.9-49.9 0-23-6.4-40.9-19.2-52.4-12.8-11.5-29.4-17.9-52.4-17.9-21.7 0-39.7 6.4-51.2 19.2-12.8 11.4-17.9 29.3-17.9 51.1z"/><path class="st0" d="M1640 397.8c-39.7 0-70.4-12.8-93.4-37.1-21.7-24.3-33.3-58.8-33.3-103.6 0-43.5 10.2-79.3 32-104.9 21.7-26.9 49.9-39.7 87-39.7 32 0 57.6 11.5 76.8 33.3 19.2 23 28.1 53.7 28.1 92.1v20.5h-197c0 37.1 9 66.5 26.9 85.7 16.6 20.5 42.2 29.4 74.2 29.4 15.3 0 29.4-1.3 40.9-3.8 11.5-2.6 26.9-6.4 44.8-14.1v24.3c-15.3 6.4-29.4 11.5-42.2 14.1-14.1 2.6-28.2 3.8-44.8 3.8zm-6.4-262.2c-26.9 0-47.3 9-64 25.6-15.3 17.9-25.6 42.2-28.1 75.5h168.9c0-32-6.4-56.3-20.5-74.2-12.8-18-32-26.9-56.3-26.9zm245.6-21.8c11.5 0 24.3 1.3 37.1 3.8l-5.1 24.3c-11.8-2.6-23.8-3.9-35.8-3.8-23 0-42.2 10.2-57.6 29.4-15.3 20.5-23 44.8-23 75.5v149.7h-25.6V119h21.7l2.6 49.9h1.3c11.5-20.5 23-34.5 35.8-42.2 15.4-9 30.7-12.9 48.6-12.9zM333.9 12.8h-183v245.6h245.6V76.7c.1-34.5-28.1-63.9-62.6-63.9zm-239.2 0H64c-34.5 0-64 28.1-64 64v30.7h94.7V12.8zM0 165h94.7v94.7H0V165zm301.9 245.6h30.7c34.5 0 64-28.1 64-64V316h-94.7v94.6zm-151-94.6h94.7v94.7h-94.7V316zM0 316v30.7c0 34.5 28.1 64 64 64h30.7V316H0z"/></g></svg>\n',iconSrc:e.iconSrc,wallet:(t=p(regeneratorRuntime.mark((function e(t){var o,s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.BigNumber,s=t.networkName,e.next=3,d({rpcUrl:r,networkId:n,BigNumber:o,networkName:s});case 3:return e.abrupt("return",{provider:i=e.sent,interface:{name:"Ledger",connect:i.enable,disconnect:function(){return i.stop()},address:{get:function(){var e=p(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.getPrimaryAddress());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},network:{get:function(){var e=p(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},balance:{get:function(){var e=p(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.getPrimaryAddress(),e.abrupt("return",t&&i.getBalance(t));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}}});case 5:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)}),type:"hardware",desktop:!0,preferred:o}}},"9oXm":function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return i}));var n=r("+qE3"),o=r.n(n),s=r("jq2n");class i{constructor(){this.exchangeTimeout=3e4,this.unresponsiveTimeout=15e3,this._events=new o.a,this.send=async(t,r,n,o,i=e.alloc(0),a=[s.b.OK])=>{if(i.length>=256)throw new s.c("data.length exceed 256 bytes limit. Got: "+i.length,"DataLengthTooBig");const c=await this.exchange(e.concat([e.from([t,r,n,o]),e.from([i.length]),i])),u=c.readUInt16BE(c.length-2);if(!a.some(e=>e===u))throw new s.e(u);return c},this.exchangeBusyPromise=void 0,this.exchangeAtomicImpl=async e=>{if(this.exchangeBusyPromise)throw new s.d("An action was already pending on the Ledger device. Please deny or reconnect.");let t;const r=new Promise(e=>{t=e});this.exchangeBusyPromise=r;let n=!1;const o=setTimeout(()=>{n=!0,this.emit("unresponsive")},this.unresponsiveTimeout);try{const r=await e();return n&&this.emit("responsive"),r}finally{clearTimeout(o),t&&t(),this.exchangeBusyPromise=null}},this._appAPIlock=null}exchange(e){throw new Error("exchange not implemented")}setScrambleKey(e){}close(){return Promise.resolve()}on(e,t){this._events.on(e,t)}off(e,t){this._events.removeListener(e,t)}emit(e,...t){this._events.emit(e,...t)}setDebugMode(){console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.")}setExchangeTimeout(e){this.exchangeTimeout=e}setExchangeUnresponsiveTimeout(e){this.unresponsiveTimeout=e}static create(e=3e3,t){return new Promise((r,n)=>{let o=!1;const i=this.listen({next:t=>{o=!0,i&&i.unsubscribe(),a&&clearTimeout(a),this.open(t.descriptor,e).then(r,n)},error:e=>{a&&clearTimeout(a),n(e)},complete:()=>{a&&clearTimeout(a),o||n(new s.c(this.ErrorMessage_NoDeviceFound,"NoDeviceFound"))}}),a=t?setTimeout(()=>{i.unsubscribe(),n(new s.c(this.ErrorMessage_ListenTimeout,"ListenTimeout"))},t):null})}decorateAppAPIMethods(e,t,r){for(let n of t)e[n]=this.decorateAppAPIMethod(n,e[n],e,r)}decorateAppAPIMethod(e,t,r,n){return async(...o)=>{const{_appAPIlock:i}=this;if(i)return Promise.reject(new s.c("Ledger Device is busy (lock "+i+")","TransportLocked"));try{return this._appAPIlock=e,this.setScrambleKey(n),await t.apply(r,o)}finally{this._appAPIlock=null}}}}i.isSupported=void 0,i.list=void 0,i.listen=void 0,i.open=void 0,i.ErrorMessage_ListenTimeout="No Ledger device found (timeout)",i.ErrorMessage_NoDeviceFound="No Ledger device found"}).call(this,r("HDXh").Buffer)},HRdN:function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return i}));var n=r("pn0g"),o=r("jq2n");const s=e=>e&&27264===e.statusCode?new o.a("Please enable Contract data on the Ethereum app Settings"):e;class i{constructor(e,t="w0w"){this.transport=void 0,this.transport=e,e.decorateAppAPIMethods(this,["getAddress","provideERC20TokenInformation","signTransaction","signPersonalMessage","getAppConfiguration"],t)}getAddress(t,r,o){let s=Object(n.b)(t),i=e.alloc(1+4*s.length);return i[0]=s.length,s.forEach((e,t)=>{i.writeUInt32BE(e,1+4*t)}),this.transport.send(224,2,r?1:0,o?1:0,i).then(e=>{let t={},r=e[0],n=e[1+r];return t.publicKey=e.slice(1,1+r).toString("hex"),t.address="0x"+e.slice(1+r+1,1+r+1+n).toString("ascii"),o&&(t.chainCode=e.slice(1+r+1+n,1+r+1+n+32).toString("hex")),t})}provideERC20TokenInformation({data:e}){return this.transport.send(224,10,0,0,e).then(()=>!0,e=>{if(e&&27904===e.statusCode)return!1;throw e})}signTransaction(t,r){let o,i=Object(n.b)(t),a=0,c=e.from(r,"hex"),u=[];for(;a!==c.length;){let t=0===a?149-4*i.length:150,r=a+t>c.length?c.length-a:t,n=e.alloc(0===a?1+4*i.length+r:r);0===a?(n[0]=i.length,i.forEach((e,t)=>{n.writeUInt32BE(e,1+4*t)}),c.copy(n,1+4*i.length,a,a+r)):c.copy(n,0,a,a+r),u.push(n),a+=r}return Object(n.a)(u,(e,t)=>this.transport.send(224,4,0===t?0:128,0,e).then(e=>{o=e})).then(()=>({v:o.slice(0,1).toString("hex"),r:o.slice(1,33).toString("hex"),s:o.slice(33,65).toString("hex")}),e=>{throw s(e)})}getAppConfiguration(){return this.transport.send(224,6,0,0).then(e=>{let t={};return t.arbitraryDataEnabled=1&e[0],t.version=e[1]+"."+e[2]+"."+e[3],t})}signPersonalMessage(t,r){let o,s=Object(n.b)(t),i=0,a=e.from(r,"hex"),c=[];for(;i!==a.length;){let t=0===i?149-4*s.length-4:150,r=i+t>a.length?a.length-i:t,n=e.alloc(0===i?1+4*s.length+4+r:r);0===i?(n[0]=s.length,s.forEach((e,t)=>{n.writeUInt32BE(e,1+4*t)}),n.writeUInt32BE(a.length,1+4*s.length),a.copy(n,1+4*s.length+4,i,i+r)):a.copy(n,0,i,i+r),c.push(n),i+=r}return Object(n.a)(c,(e,t)=>this.transport.send(224,8,0===t?0:128,0,e).then(e=>{o=e})).then(()=>({v:o[0],r:o.slice(1,33).toString("hex"),s:o.slice(33,65).toString("hex")}))}}}).call(this,r("HDXh").Buffer)},adUY:function(e,t,r){"use strict";var n=n||{};e.exports=n,n.EXTENSION_ID="kmendfapggjehodndflmmgagdbamhnfd",n.MessageTypes={U2F_REGISTER_REQUEST:"u2f_register_request",U2F_SIGN_REQUEST:"u2f_sign_request",U2F_REGISTER_RESPONSE:"u2f_register_response",U2F_SIGN_RESPONSE:"u2f_sign_response"},n.ErrorCodes={OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5},n.disconnect=function(){n.port_&&n.port_.port_&&(n.port_.port_.disconnect(),n.port_=null)},n.getMessagePort=function(e){"undefined"!=typeof chrome&&chrome.runtime?chrome.runtime.sendMessage(n.EXTENSION_ID,{type:n.MessageTypes.U2F_SIGN_REQUEST,signRequests:[]},(function(){chrome.runtime.lastError?n.getIframePort_(e):n.getChromeRuntimePort_(e)})):n.getIframePort_(e)},n.getChromeRuntimePort_=function(e){var t=chrome.runtime.connect(n.EXTENSION_ID,{includeTlsChannelId:!0});setTimeout((function(){e(null,new n.WrappedChromeRuntimePort_(t))}),0)},n.WrappedChromeRuntimePort_=function(e){this.port_=e},n.WrappedChromeRuntimePort_.prototype.postMessage=function(e){this.port_.postMessage(e)},n.WrappedChromeRuntimePort_.prototype.addEventListener=function(e,t){var r=e.toLowerCase();"message"==r||"onmessage"==r?this.port_.onMessage.addListener((function(e){t({data:e})})):console.error("WrappedChromeRuntimePort only supports onMessage")},n.getIframePort_=function(e){var t="chrome-extension://"+n.EXTENSION_ID,r=document.createElement("iframe");r.src=t+"/u2f-comms.html",r.setAttribute("style","display:none"),document.body.appendChild(r);var o=!1,s=new MessageChannel,i=function(t){"ready"==t.data?(s.port1.removeEventListener("message",i),o||(o=!0,e(null,s.port1))):console.error('First event on iframe port was not "ready"')};s.port1.addEventListener("message",i),s.port1.start(),r.addEventListener("load",(function(){r.contentWindow.postMessage("init",t,[s.port2])})),setTimeout((function(){o||(o=!0,e(new Error("IFrame extension not supported")))}),200)},n.EXTENSION_TIMEOUT_SEC=30,n.port_=null,n.waitingForPort_=[],n.reqCounter_=0,n.callbackMap_={},n.getPortSingleton_=function(e){n.port_?e(null,n.port_):(0==n.waitingForPort_.length&&n.getMessagePort((function(e,t){for(e||(n.port_=t,n.port_.addEventListener("message",n.responseHandler_));n.waitingForPort_.length;)n.waitingForPort_.shift()(e,t)})),n.waitingForPort_.push(e))},n.responseHandler_=function(e){var t=e.data,r=t.requestId;if(r&&n.callbackMap_[r]){var o=n.callbackMap_[r];delete n.callbackMap_[r],o(null,t.responseData)}else console.error("Unknown or missing requestId in response.")},n.isSupported=function(e){n.getPortSingleton_((function(t,r){e(!t)}))},n.sign=function(e,t,r){n.getPortSingleton_((function(o,s){if(o)return t(o);var i=++n.reqCounter_;n.callbackMap_[i]=t,s.postMessage({type:n.MessageTypes.U2F_SIGN_REQUEST,signRequests:e,timeoutSeconds:void 0!==r?r:n.EXTENSION_TIMEOUT_SEC,requestId:i})}))},n.register=function(e,t,r,o){n.getPortSingleton_((function(s,i){if(s)return r(s);var a=++n.reqCounter_;n.callbackMap_[a]=r,i.postMessage({type:n.MessageTypes.U2F_REGISTER_REQUEST,signRequests:t,registerRequests:e,timeoutSeconds:void 0!==o?o:n.EXTENSION_TIMEOUT_SEC,requestId:a})}))}},d5mW:function(e,t,r){"use strict";(function(t){e.exports=u;var n=r("adUY"),o="undefined"!=typeof navigator&&!!navigator.userAgent,s=o&&navigator.userAgent.match(/Safari\//)&&!navigator.userAgent.match(/Chrome\//),i=o&&navigator.userAgent.match(/Edge\/1[2345]/),a=null;function c(e){return a||(a=new e((function(e,t){function r(){e({u2f:null,native:!0})}return o?s?r():(void 0!==window.u2f&&"function"==typeof window.u2f.sign&&e({u2f:window.u2f,native:!0}),i?r():"http:"===location.protocol?r():"undefined"==typeof MessageChannel?r():void n.isSupported((function(t){t?e({u2f:n,native:!1}):r()}))):r()}))),a}function u(e){return{isSupported:d.bind(e),ensureSupport:f.bind(e),register:g.bind(e),sign:m.bind(e),ErrorCodes:u.ErrorCodes,ErrorNames:u.ErrorNames}}function l(e,t){var r=null!=t?t.errorCode:1,n=u.ErrorNames[""+r],o=new Error(e);return o.metaData={type:n,code:r},o}function p(e,t){var r={};return r.promise=new e((function(e,n){r.resolve=e,r.reject=n,t.then(e,n)})),r.promise.cancel=function(t,n){c(e).then((function(e){n&&!e.native&&e.u2f.disconnect(),r.reject(l(t,{errorCode:-1}))}))},r}function d(){return c(this).then((function(e){return!!e.u2f}))}function h(e){if(!e.u2f){if("http:"===location.protocol)throw new Error("U2F isn't supported over http, only https");throw new Error("U2F not supported")}}function f(){return c(this).then(h)}function g(e,t,r){var n=this;return Array.isArray(e)||(e=[e]),"number"==typeof t&&void 0===r&&(r=t,t=null),t||(t=[]),p(n,c(n).then((function(o){h(o);var s=o.native,i=o.u2f;return new n((function(n,o){s?i.register(e[0].appId,e,t,(function(e){e.errorCode?o(l("Registration failed",e)):(delete e.errorCode,n(e))}),r):i.register(e,t,(function(e,t){e?o(e):t.errorCode?o(l("Registration failed",t)):n(t)}),r)}))}))).promise}function m(e,t){var r=this;return Array.isArray(e)||(e=[e]),p(r,c(r).then((function(n){h(n);var o=n.native,s=n.u2f;return new r((function(r,n){o?s.sign(e[0].appId,e[0].challenge,e,(function(e){e.errorCode?n(l("Sign failed",e)):(delete e.errorCode,r(e))}),t):s.sign(e,(function(e,t){e?n(e):t.errorCode?n(l("Sign failed",t)):r(t)}),t)}))}))).promise}function E(e){u[e]=function(){if(!t.Promise)throw new Error("The platform doesn't natively support promises");var r=[].slice.call(arguments);return u(t.Promise)[e].apply(null,r)}}u.ErrorCodes={CANCELLED:-1,OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5},u.ErrorNames={"-1":"CANCELLED",0:"OK",1:"OTHER_ERROR",2:"BAD_REQUEST",3:"CONFIGURATION_UNSUPPORTED",4:"DEVICE_INELIGIBLE",5:"TIMEOUT"},E("isSupported"),E("ensureSupport"),E("register"),E("sign")}).call(this,r("yLpj"))},jq2n:function(e,t,r){"use strict";const n={},o={},s=(e,t)=>{o[e]=t},i=e=>{const t=function(t,r){Object.assign(this,r),this.name=e,this.message=t||e,this.stack=(new Error).stack};return t.prototype=new Error,n[e]=t,t};r.d(t,"a",(function(){return a})),r.d(t,"d",(function(){return c})),r.d(t,"c",(function(){return u})),r.d(t,"b",(function(){return l})),r.d(t,"e",(function(){return p})),i("AccountNameRequired"),i("AccountNotSupported"),i("AmountRequired"),i("BluetoothRequired"),i("BtcUnmatchedApp"),i("CantOpenDevice"),i("CashAddrNotSupported"),i("CurrencyNotSupported"),i("DeviceAppVerifyNotSupported"),i("DeviceGenuineSocketEarlyClose"),i("DeviceNotGenuine"),i("DeviceOnDashboardExpected"),i("DeviceOnDashboardUnexpected"),i("DeviceInOSUExpected"),i("DeviceHalted"),i("DeviceNameInvalid"),i("DeviceSocketFail"),i("DeviceSocketNoBulkStatus"),i("DisconnectedDevice"),i("DisconnectedDeviceDuringOperation"),i("EnpointConfig");const a=i("EthAppPleaseEnableContractData"),c=(i("FeeEstimationFailed"),i("FirmwareNotRecognized"),i("HardResetFail"),i("InvalidXRPTag"),i("InvalidAddress"),i("InvalidAddressBecauseDestinationIsAlsoSource"),i("LatestMCUInstalledError"),i("UnknownMCU"),i("LedgerAPIError"),i("LedgerAPIErrorWithMessage"),i("LedgerAPINotAvailable"),i("ManagerAppAlreadyInstalled"),i("ManagerAppRelyOnBTC"),i("ManagerAppDepInstallRequired"),i("ManagerAppDepUninstallRequired"),i("ManagerDeviceLocked"),i("ManagerFirmwareNotEnoughSpace"),i("ManagerNotEnoughSpace"),i("ManagerUninstallBTCDep"),i("NetworkDown"),i("NoAddressesFound"),i("NotEnoughBalance"),i("NotEnoughBalanceToDelegate"),i("NotEnoughBalanceInParentAccount"),i("NotEnoughSpendableBalance"),i("NotEnoughBalanceBecauseDestinationNotCreated"),i("NoAccessToCamera"),i("NotEnoughGas"),i("NotSupportedLegacyAddress"),i("GasLessThanEstimate"),i("PasswordsDontMatch"),i("PasswordIncorrect"),i("RecommendSubAccountsToEmpty"),i("RecommendUndelegation"),i("TimeoutTagged"),i("UnexpectedBootloader"),i("MCUNotGenuineToDashboard"),i("RecipientRequired"),i("UnavailableTezosOriginatedAccountReceive"),i("UnavailableTezosOriginatedAccountSend"),i("UpdateFetchFileFail"),i("UpdateIncorrectHash"),i("UpdateIncorrectSig"),i("UpdateYourApp"),i("UserRefusedDeviceNameChange"),i("UserRefusedAddress"),i("UserRefusedFirmwareUpdate"),i("UserRefusedAllowManager"),i("UserRefusedOnDevice"),i("TransportOpenUserCancelled"),i("TransportInterfaceNotAvailable"),i("TransportRaceCondition"));function u(e,t){this.name="TransportError",this.message=e,this.stack=(new Error).stack,this.id=t}i("TransportWebUSBGestureRequired"),i("DeviceShouldStayInApp"),i("WebsocketConnectionError"),i("WebsocketConnectionFailed"),i("WrongDeviceForAccount"),i("WrongAppForCurrency"),i("ETHAddressNonEIP"),i("CantScanQRCode"),i("FeeNotLoaded"),i("FeeRequired"),i("FeeTooHigh"),i("SyncError"),i("PairingFailed"),i("GenuineCheckFailed"),i("LedgerAPI4xx"),i("LedgerAPI5xx"),i("FirmwareOrAppUpdateRequired"),i("NoDBPathGiven"),i("DBWrongPassword"),i("DBNotReset"),u.prototype=new Error,s("TransportError",e=>new u(e.message,e.id));const l={PIN_REMAINING_ATTEMPTS:25536,INCORRECT_LENGTH:26368,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,SECURITY_STATUS_NOT_SATISFIED:27010,CONDITIONS_OF_USE_NOT_SATISFIED:27013,INCORRECT_DATA:27264,NOT_ENOUGH_MEMORY_SPACE:27268,REFERENCED_DATA_NOT_FOUND:27272,FILE_ALREADY_EXISTS:27273,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,CLA_NOT_SUPPORTED:28160,TECHNICAL_PROBLEM:28416,OK:36864,MEMORY_PROBLEM:37440,NO_EF_SELECTED:37888,INVALID_OFFSET:37890,FILE_NOT_FOUND:37892,INCONSISTENT_FILE:37896,ALGORITHM_NOT_SUPPORTED:38020,INVALID_KCV:38021,CODE_NOT_INITIALIZED:38914,ACCESS_CONDITION_NOT_FULFILLED:38916,CONTRADICTION_SECRET_CODE_STATUS:38920,CONTRADICTION_INVALIDATION:38928,CODE_BLOCKED:38976,MAX_VALUE_REACHED:38992,GP_AUTH_FAILED:25344,LICENSING:28482,HALTED:28586};function p(e){this.name="TransportStatusError";const t=Object.keys(l).find(t=>l[t]===e)||"UNKNOWN_ERROR",r=function(e){switch(e){case 26368:return"Incorrect length";case 27010:return"Security not satisfied (dongle locked or have invalid access rights)";case 27013:return"Condition of use not satisfied (denied by the user?)";case 27264:return"Invalid data received";case 27392:return"Invalid parameter received"}if(28416<=e&&e<=28671)return"Internal error, please report"}(e)||t,n=e.toString(16);this.message=`Ledger device: ${r} (0x${n})`,this.stack=(new Error).stack,this.statusCode=e,this.statusText=t}p.prototype=new Error,s("TransportStatusError",e=>new p(e.statusCode))},pn0g:function(e,t,r){"use strict";function n(e){let t=[];return e.split("/").forEach(e=>{let r=parseInt(e,10);isNaN(r)||(e.length>1&&"'"===e[e.length-1]&&(r+=2147483648),t.push(r))}),t}function o(e,t){return Promise.resolve().then(()=>(function e(r,n,o){return r>=n.length?o:t(n[r],r).then((function(t){return o.push(t),e(r+1,n,o)}))})(0,e,[]))}r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return o}))},vULT:function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return s}));let n=0;const o=[],s=(e,t,r)=>{const s={type:e,id:String(++n),date:new Date};t&&(s.message=t),r&&(s.data=r),function(e){for(let r=0;r<o.length;r++)try{o[r](e)}catch(t){console.error(t)}}(s)};e.__ledgerLogsListen=e=>(o.push(e),()=>{const t=o.indexOf(e);-1!==t&&(o[t]=o[o.length-1],o.pop())})}).call(this,r("yLpj"))}}]);