UNPKG

stellar-wallet-js-sdk

Version:

> # :warning: Alpha version. Don't use in production.

2 lines 386 kB
var StellarWallet=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";t.exports=r(1)},function(t,e,r){"use strict";function n(t){var e=new c(t);return s.resolve(e)}var i=r(10),o=r(2),s=r(23),u=r(4),a={crypto:r(5),totp:r(6),keypair:r(7)},c=r(3);t.exports={createWallet:function(t){var e=i.cloneDeep(t);return u.createWallet(e).then(n)},getWallet:function(t){var e=i.cloneDeep(t);return u.login(e).then(n)},createFromData:function(t){return new c(t)},lostTotpDevice:function(t){var e=i.cloneDeep(t);return u.lostTotpDevice(e)},recover:function(t){var e=i.cloneDeep(t);return u.showRecovery(e)},errors:o,util:{generateRandomTotpKey:a.totp.generateRandomTotpKey,generateRandomRecoveryCode:a.crypto.generateRandomRecoveryCode,generateTotpUri:a.totp.generateTotpUri,generateKeyPair:a.keypair.generateKeyPair}}},function(t,e,r){"use strict";var n=r(28);Error.subclass=function(t){var e=function(e){this.name=t,this.message=e||""};return e.subclass=this.subclass,n.inherits(e,this),e};var i=t.exports;i.Forbidden=Error.subclass("Forbidden"),i.WalletNotFound=Error.subclass("WalletNotFound"),i.UsernameAlreadyTaken=Error.subclass("UsernameAlreadyTaken"),i.InvalidUsername=Error.subclass("InvalidUsername"),i.DataCorrupt=Error.subclass("DataCorrupt"),i.InvalidField=Error.subclass("InvalidField"),i.MissingField=Error.subclass("MissingField"),i.TotpCodeRequired=Error.subclass("TotpCodeRequired"),i.InvalidTotpCode=Error.subclass("InvalidTotpCode"),i.ConnectionError=Error.subclass("ConnectionError"),i.UnknownError=Error.subclass("UnknownError"),i.getProtocolError=function(t){switch(t){case"not_found":return new i.WalletNotFound;case"already_taken":return new i.UsernameAlreadyTaken;case"invalid_username":return new i.InvalidUsername;case"invalid_totp_code":return new i.InvalidTotpCode;case"forbidden":return new i.Forbidden;default:return new i.UnknownError}}},function(t,e,r){"use strict";function n(t){var e=i.cloneDeep(t),r=this,n=["server","username","rawMasterKey","rawWalletId","rawWalletKey","rawMainData","rawKeychainData","lockVersion","totpEnabled"];i.each(n,function(t){r[t]=e[t]}),this.updateEncodedValues=function(){this.masterKey=o.codec.base64.fromBits(this.rawMasterKey),this.walletId=o.codec.base64.fromBits(this.rawWalletId),this.walletKey=o.codec.base64.fromBits(this.rawWalletKey)},this.server=this.server.replace(/\/+$/g,""),this.updateEncodedValues()}var i=r(10),o=(r(5),r(2),r(9)),s=(r(26),r(23)),u=r(4);n.prototype.getServer=function(){return this.server},n.prototype.getUsername=function(){return this.username},n.prototype.getWalletId=function(){return this.walletId},n.prototype.getWalletKey=function(){return this.walletKey},n.prototype.getMainData=function(){return this.rawMainData},n.prototype.getKeychainData=function(){return this.rawKeychainData},n.prototype.updateMainData=function(t){var e=i.cloneDeep(t);e=i.extend(e,i.pick(this,["server","walletId","username","lockVersion","rawWalletKey"]));var r=this;return u.updateMainData(e).then(function(t){return r.lockVersion=t.newLockVersion,r.rawMainData=t.rawMainData,s.resolve()})},n.prototype.delete=function(t){var e=i.cloneDeep(t);return e=i.extend(e,i.pick(this,["server","walletId","username","lockVersion"])),u.deleteWallet(e)},n.prototype.changePassword=function(t){var e=i.cloneDeep(t);e=i.extend(e,i.pick(this,["server","username","walletId","rawMainData","rawKeychainData","lockVersion"]));var r=this;return u.changePassword(e).then(function(t){return r.rawWalletId=t.rawWalletId,r.rawWalletKey=t.rawWalletKey,r.rawMasterKey=t.rawMasterKey,r.lockVersion=t.newLockVersion,r.updateEncodedValues(),s.resolve()})},n.prototype.isTotpEnabled=function(){return this.totpEnabled},n.prototype.enableTotp=function(t){var e=i.cloneDeep(t);e=i.extend(e,i.pick(this,["server","username","walletId","lockVersion"]));var r=this;return u.enableTotp(e).then(function(t){return r.lockVersion=t.newLockVersion,r.totpEnabled=!0,s.resolve()})},n.prototype.enableRecovery=function(t){var e=i.cloneDeep(t);e=i.extend(e,i.pick(this,["server","username","walletId","masterKey","lockVersion"]));var r=this;return u.enableRecovery(e).then(function(t){return r.lockVersion=t.newLockVersion,s.resolve()})},n.prototype.disableTotp=function(t){var e=i.cloneDeep(t);e=i.extend(e,i.pick(this,["server","username","walletId","lockVersion"]));var r=this;return u.disableTotp(e).then(function(t){return r.lockVersion=t.newLockVersion,r.totpEnabled=!1,s.resolve()})},n.prototype.updateLockVersion=function(t){var e=i.cloneDeep(t);e=i.extend(e,i.pick(this,["server","username","walletId"]));var r=this;return u.getLockVersion(e).then(function(t){return r.lockVersion=t,s.resolve()})},t.exports=n},function(t,e,r){"use strict";var n=r(10),i=r(27),o=r(23);t.exports={};var s=["login","create_wallet","change_password","update_main_data","enable_recovery","show_recovery","enable_totp","disable_totp","lost_totp_device","delete_wallet","get_lock_version"];n.each(s,function(e){t.exports[i(e)]=function(t){return o.resolve(t).then(r(8)("./"+e))}})},function(t,e,r){(function(e){"use strict";function n(t){return new e(t).toString("base64")}function i(t){return new e(t,"base64").toString()}function o(t,e,r){return function(n){var i=g.util.decodeBase64(r),o=g.util.decodeUTF8(JSON.stringify(n._data)),s=g.sign.detached(o,i);s=g.util.encodeBase64(s),n.set("Authorization",'STELLAR-WALLET-V2 username="'+t+'", wallet-id="'+e+'", signature="'+s+'"')}}function s(t){return function(e){var r=v.createHash(t);return r.update(e).digest("hex")}}function u(t){return function(e){var r=new m.misc.hmac(e,m.hash.sha256);return r.encrypt(t)}}function a(t,e){if(!p.isString(t))throw new TypeError("data must be a String.");var r="aes",i="gcm",o=new m.cipher[r](e),s=m.random.randomWords(3),u=m.mode[i].encrypt(o,m.codec.utf8String.toBits(t),s);return t=JSON.stringify({IV:m.codec.base64.fromBits(s),cipherText:m.codec.base64.fromBits(u),cipherName:r,modeName:i}),n(t)}function c(t,e){var r,n,o,s;try{var u=JSON.parse(i(t));n=m.codec.base64.toBits(u.IV),r=m.codec.base64.toBits(u.cipherText),o=u.cipherName,s=u.modeName}catch(a){new y.DataCorrupt}var c=new m.cipher[o](e),h=m.mode[s].decrypt(c,r,n);return m.codec.utf8String.fromBits(h)}function h(t,e,r,n){var i=m.codec.hex.toBits("0x01"),o=m.codec.base64.toBits(t),s=m.codec.utf8String.toBits(e),u=p.reduce([i,o,s],m.bitArray.concat),a=m.hash.sha256.hash(u);return m.misc.scrypt(r,a,n.n,n.r,n.p,n.bits/8)}function l(){var t=g.randomBytes(32);return d.encode(new e(t))}function f(t){for(var e=[],r=0,n=0;r<t.length;r++,n+=8)e[n>>>5]|=t[r]<<24-n%32;return e}var p=r(10),d=r(30),v=r(24),y=r(2),g=r(26),m=r(9);t.exports={calculateMasterKey:h,bytesToWords:f,decryptData:c,deriveWalletId:u("WALLET_ID"),deriveWalletKey:u("WALLET_KEY"),encryptData:a,generateRandomRecoveryCode:l,sha1:s("sha1"),sha256:s("sha256"),signRequest:o}}).call(e,r(25).Buffer)},function(t,e,r){function n(){var t=u.randomBytes(10);return a.encode(t).toString().replace(/=/g,"")}function i(t,e){var r=function(t){var e=new s.MissingField;throw e.field=t,e},n=["issuer","accountName"];return o.each(n,function(t){o.isString(e[t])||r(t)}),e=o.mapValues(e,encodeURI),"otpauth://totp/"+e.issuer+":"+e.accountName+"?secret="+t+"&issuer="+e.issuer}var o=r(10),s=r(2),u=r(26),a=r(32);t.exports={generateRandomTotpKey:n,generateTotpUri:i}},function(t,e,r){function n(t){t=t?(new o).parse_json(t):(new o).random();var e=t.get_key(),r=e.get_address(),n=i.util.encodeBase64(e._pubkey),s=i.util.encodeBase64(e._secret);return{address:r.to_json(),secret:t.to_json(),secretKey:s,publicKey:n}}var i=(r(10),r(2),r(26)),o=r(38).Seed;t.exports={generateKeyPair:n}},function(t,e,r){function n(t){return r(i(t))}function i(t){return o[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var o={"./change_password":11,"./change_password.js":11,"./common":12,"./common.js":12,"./create_wallet":13,"./create_wallet.js":13,"./delete_wallet":14,"./delete_wallet.js":14,"./disable_totp":15,"./disable_totp.js":15,"./enable_recovery":16,"./enable_recovery.js":16,"./enable_totp":17,"./enable_totp.js":17,"./get_lock_version":18,"./get_lock_version.js":18,"./index":4,"./index.js":4,"./login":19,"./login.js":19,"./lost_totp_device":20,"./lost_totp_device.js":20,"./show_recovery":21,"./show_recovery.js":21,"./update_main_data":22,"./update_main_data.js":22};n.keys=function(){return Object.keys(o)},n.resolve=i,t.exports=n,n.id=8},function(t,e,r){var n=r(39).sjcl;r(33).extendSjcl(n);var i=n.random.randomWords;n.random.randomWords=function(t){if(!n.random.isReady()){for(var e=0;8>e;e++)n.random.addEntropy(Math.random(),32,"Math.random()");if(!n.random.isReady())throw"Unable to seed sjcl entropy pool"}return i.call(n.random,t)},t.exports=n},function(t,e,r){var n;(function(t,i){(function(){function o(t,e,r){for(var n=(r||0)-1,i=t?t.length:0;++n<i;)if(t[n]===e)return n;return-1}function s(t,e){var r=typeof e;if(t=t.cache,"boolean"==r||null==e)return t[e]?0:-1;"number"!=r&&"string"!=r&&(r="object");var n="number"==r?e:C+e;return t=(t=t[r])&&t[n],"object"==r?t&&o(t,e)>-1?0:-1:t?0:-1}function u(t){var e=this.cache,r=typeof t;if("boolean"==r||null==t)e[t]=!0;else{"number"!=r&&"string"!=r&&(r="object");var n="number"==r?t:C+t,i=e[r]||(e[r]={});"object"==r?(i[n]||(i[n]=[])).push(t):i[n]=!0}}function a(t){return t.charCodeAt(0)}function c(t,e){for(var r=t.criteria,n=e.criteria,i=-1,o=r.length;++i<o;){var s=r[i],u=n[i];if(s!==u){if(s>u||"undefined"==typeof s)return 1;if(u>s||"undefined"==typeof u)return-1}}return t.index-e.index}function h(t){var e=-1,r=t.length,n=t[0],i=t[r/2|0],o=t[r-1];if(n&&"object"==typeof n&&i&&"object"==typeof i&&o&&"object"==typeof o)return!1;var s=p();s["false"]=s["null"]=s["true"]=s.undefined=!1;var a=p();for(a.array=t,a.cache=s,a.push=u;++e<r;)a.push(t[e]);return a}function l(t){return"\\"+ie[t]}function f(){return _.pop()||[]}function p(){return w.pop()||{array:null,cache:null,criteria:null,"false":!1,index:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,value:null}}function d(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function v(t){t.length=0,_.length<F&&_.push(t)}function y(t){var e=t.cache;e&&y(e),t.array=t.cache=t.criteria=t.object=t.number=t.string=t.value=null,w.length<F&&w.push(t)}function g(t,e,r){e||(e=0),"undefined"==typeof r&&(r=t?t.length:0);for(var n=-1,i=r-e||0,o=Array(0>i?0:i);++n<i;)o[n]=t[e+n];return o}function m(t){function e(t){return t&&"object"==typeof t&&!li(t)&&qn.call(t,"__wrapped__")?t:new r(t)}function r(t,e){this.__chain__=!!e,this.__wrapped__=t}function n(t){function e(){if(n){var t=g(n);Hn.apply(t,arguments)}if(this instanceof e){var o=u(r.prototype),s=r.apply(o,t||arguments);return Pe(s)?s:o}return r.apply(i,t||arguments)}var r=t[0],n=t[2],i=t[4];return hi(e,t),e}function i(t,e,r,n,o){if(r){var s=r(t);if("undefined"!=typeof s)return s}var u=Pe(t);if(!u)return t;var a=Pn.call(t);if(!Q[a]||!ai.nodeClass&&d(t))return t;var c=si[a];switch(a){case H:case W:return new c(+t);case $:case J:return new c(t);case Z:return s=c(t.source,R.exec(t)),s.lastIndex=t.lastIndex,s}var h=li(t);if(e){var l=!n;n||(n=f()),o||(o=f());for(var p=n.length;p--;)if(n[p]==t)return o[p];s=h?c(t.length):{}}else s=h?g(t):Ei({},t);return h&&(qn.call(t,"index")&&(s.index=t.index),qn.call(t,"input")&&(s.input=t.input)),e?(n.push(t),o.push(s),(h?wi:Bi)(t,function(t,u){s[u]=i(t,e,r,n,o)}),l&&(v(n),v(o)),s):s}function u(t){return Pe(t)?Zn(t):{}}function _(t,e,r){if("function"!=typeof t)return on;if("undefined"==typeof e||!("prototype"in t))return t;var n=t.__bindData__;if("undefined"==typeof n&&(ai.funcNames&&(n=!t.name),n=n||!ai.funcDecomp,!n)){var i=Vn.call(t);ai.funcNames||(n=!O.test(i)),n||(n=I.test(i),hi(t,n))}if(n===!1||n!==!0&&1&n[1])return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)};case 4:return function(r,n,i,o){return t.call(e,r,n,i,o)}}return Nr(t,e)}function w(t){function e(){var t=c?s:this;if(i){var d=g(i);Hn.apply(d,arguments)}if((o||l)&&(d||(d=g(arguments)),o&&Hn.apply(d,o),l&&d.length<a))return n|=16,w([r,f?n:-4&n,d,null,s,a]);if(d||(d=arguments),h&&(r=t[p]),this instanceof e){t=u(r.prototype);var v=r.apply(t,d);return Pe(v)?v:t}return r.apply(t,d)}var r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=1&n,h=2&n,l=4&n,f=8&n,p=r;return hi(e,t),e}function F(t,e){var r=-1,n=ve(),i=t?t.length:0,u=i>=B&&n===o,a=[];if(u){var c=h(e);c?(n=s,e=c):u=!1}for(;++r<i;){var l=t[r];n(e,l)<0&&a.push(l)}return u&&y(e),a}function ie(t,e,r,n){for(var i=(n||0)-1,o=t?t.length:0,s=[];++i<o;){var u=t[i];if(u&&"object"==typeof u&&"number"==typeof u.length&&(li(u)||be(u))){e||(u=ie(u,e,r));var a=-1,c=u.length,h=s.length;for(s.length+=c;++a<c;)s[h++]=u[a]}else r||s.push(u)}return s}function se(t,e,r,n,i,o){if(r){var s=r(t,e);if("undefined"!=typeof s)return!!s}if(t===e)return 0!==t||1/t==1/e;var u=typeof t,a=typeof e;if(!(t!==t||t&&ne[u]||e&&ne[a]))return!1;if(null==t||null==e)return t===e;var c=Pn.call(t),h=Pn.call(e);if(c==K&&(c=G),h==K&&(h=G),c!=h)return!1;switch(c){case H:case W:return+t==+e;case $:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case Z:case J:return t==Sn(e)}var l=c==q;if(!l){var p=qn.call(t,"__wrapped__"),y=qn.call(e,"__wrapped__");if(p||y)return se(p?t.__wrapped__:t,y?e.__wrapped__:e,r,n,i,o);if(c!=G||!ai.nodeClass&&(d(t)||d(e)))return!1;var g=!ai.argsObject&&be(t)?xn:t.constructor,m=!ai.argsObject&&be(e)?xn:e.constructor;if(g!=m&&!(Ue(g)&&g instanceof g&&Ue(m)&&m instanceof m)&&"constructor"in t&&"constructor"in e)return!1}var b=!i;i||(i=f()),o||(o=f());for(var _=i.length;_--;)if(i[_]==t)return o[_]==e;var w=0;if(s=!0,i.push(t),o.push(e),l){if(_=t.length,w=e.length,s=w==_,s||n)for(;w--;){var E=_,A=e[w];if(n)for(;E--&&!(s=se(t[E],A,r,n,i,o)););else if(!(s=se(t[w],A,r,n,i,o)))break}}else Ci(e,function(e,u,a){return qn.call(a,u)?(w++,s=qn.call(t,u)&&se(t[u],e,r,n,i,o)):void 0}),s&&!n&&Ci(t,function(t,e,r){return qn.call(r,e)?s=--w>-1:void 0});return i.pop(),o.pop(),b&&(v(i),v(o)),s}function ue(t,e,r,n,i){(li(e)?nr:Bi)(e,function(e,o){var s,u,a=e,c=t[o];if(e&&((u=li(e))||Fi(e))){for(var h=n.length;h--;)if(s=n[h]==e){c=i[h];break}if(!s){var l;r&&(a=r(c,e),(l="undefined"!=typeof a)&&(c=a)),l||(c=u?li(c)?c:[]:Fi(c)?c:{}),n.push(e),i.push(c),l||ue(c,e,r,n,i)}}else r&&(a=r(c,e),"undefined"==typeof a&&(a=e)),"undefined"!=typeof a&&(c=a);t[o]=c})}function ae(t,e){return t+Nn(oi()*(e-t+1))}function he(t,e,r){var n=-1,i=ve(),u=t?t.length:0,a=[],c=!e&&u>=B&&i===o,l=r||c?f():a;if(c){var p=h(l);i=s,l=p}for(;++n<u;){var d=t[n],g=r?r(d,n,t):d;(e?!n||l[l.length-1]!==g:i(l,g)<0)&&((r||c)&&l.push(g),a.push(d))}return c?(v(l.array),y(l)):r&&v(l),a}function le(t){return function(r,n,i){var o={};if(n=e.createCallback(n,i,3),li(r))for(var s=-1,u=r.length;++s<u;){var a=r[s];t(o,a,n(a,s,r),r)}else wi(r,function(e,r,i){t(o,e,n(e,r,i),i)});return o}}function fe(t,e,r,i,o,s){var u=1&e,a=2&e,c=4&e,h=16&e,l=32&e;if(!a&&!Ue(t))throw new Tn;h&&!r.length&&(e&=-17,h=r=!1),l&&!i.length&&(e&=-33,l=i=!1);var f=t&&t.__bindData__;if(f&&f!==!0)return f=g(f),f[2]&&(f[2]=g(f[2])),f[3]&&(f[3]=g(f[3])),!u||1&f[1]||(f[4]=o),!u&&1&f[1]&&(e|=8),!c||4&f[1]||(f[5]=s),h&&Hn.apply(f[2]||(f[2]=[]),r),l&&$n.apply(f[3]||(f[3]=[]),i),f[1]|=e,fe.apply(null,f);var p=1==e||17===e?n:w;return p([t,e,r,i,o,s])}function pe(){re.shadowedProps=N,re.array=re.bottom=re.loop=re.top="",re.init="iterable",re.useHas=!0;for(var t,e=0;t=arguments[e];e++)for(var r in t)re[r]=t[r];var n=re.args;re.firstArg=/^[^,]+/.exec(n)[0];var i=Bn("baseCreateCallback, errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments, isArray, isString, keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString","return function("+n+") {\n"+ci(re)+"\n}");return i(_,Y,Rn,qn,A,be,li,Ve,re.keys,On,ne,ui,J,Mn,Pn)}function de(t){return gi[t]}function ve(){var t=(t=e.indexOf)===Cr?o:t;return t}function ye(t){return"function"==typeof t&&In.test(t)}function ge(t){var e,r;return!t||Pn.call(t)!=G||(e=t.constructor,Ue(e)&&!(e instanceof e))||!ai.argsClass&&be(t)||!ai.nodeClass&&d(t)?!1:ai.ownLast?(Ci(t,function(t,e,n){return r=qn.call(n,e),!1}),r!==!1):(Ci(t,function(t,e){r=e}),"undefined"==typeof r||qn.call(t,r))}function me(t){return mi[t]}function be(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Pn.call(t)==K||!1}function _e(t,e,r,n){return"boolean"!=typeof e&&null!=e&&(n=r,r=e,e=!1),i(t,e,"function"==typeof r&&_(r,n,1))}function we(t,e,r){return i(t,!0,"function"==typeof e&&_(e,r,1))}function Ee(t,e){var r=u(t);return e?Ei(r,e):r}function Ae(t,r,n){var i;return r=e.createCallback(r,n,3),Bi(t,function(t,e,n){return r(t,e,n)?(i=e,!1):void 0}),i}function Ce(t,r,n){var i;return r=e.createCallback(r,n,3),Fe(t,function(t,e,n){return r(t,e,n)?(i=e,!1):void 0}),i}function Be(t,e,r){var n=[];Ci(t,function(t,e){n.push(e,t)});var i=n.length;for(e=_(e,r,3);i--&&e(n[i--],n[i],t)!==!1;);return t}function Fe(t,e,r){var n=pi(t),i=n.length;for(e=_(e,r,3);i--;){var o=n[i];if(e(t[o],o,t)===!1)break}return t}function ke(t){var e=[];return Ci(t,function(t,r){Ue(t)&&e.push(r)}),e.sort()}function xe(t,e){return t?qn.call(t,e):!1}function De(t){for(var e=-1,r=pi(t),n=r.length,i={};++e<n;){var o=r[e];i[t[o]]=o}return i}function Se(t){return t===!0||t===!1||t&&"object"==typeof t&&Pn.call(t)==H||!1}function Te(t){return t&&"object"==typeof t&&Pn.call(t)==W||!1}function je(t){return t&&1===t.nodeType||!1}function Re(t){var e=!0;if(!t)return e;var r=Pn.call(t),n=t.length;return r==q||r==J||(ai.argsClass?r==K:be(t))||r==G&&"number"==typeof n&&Ue(t.splice)?!n:(Bi(t,function(){return e=!1}),e)}function Oe(t,e,r,n){return se(t,e,"function"==typeof r&&_(r,n,2))}function Me(t){return Qn(t)&&!ti(parseFloat(t))}function Ue(t){return"function"==typeof t}function Pe(t){return!(!t||!ne[typeof t])}function Ie(t){return ze(t)&&t!=+t}function Le(t){return null===t}function ze(t){return"number"==typeof t||t&&"object"==typeof t&&Pn.call(t)==$||!1}function Ne(t){return t&&ne[typeof t]&&Pn.call(t)==Z||!1}function Ve(t){return"string"==typeof t||t&&"object"==typeof t&&Pn.call(t)==J||!1}function Ke(t){return"undefined"==typeof t}function qe(t,r,n){var i={};return r=e.createCallback(r,n,3),Bi(t,function(t,e,n){i[e]=r(t,e,n)}),i}function He(t){var e=arguments,r=2;if(!Pe(t))return t;if("number"!=typeof e[2]&&(r=e.length),r>3&&"function"==typeof e[r-2])var n=_(e[--r-1],e[r--],2);else r>2&&"function"==typeof e[r-1]&&(n=e[--r]);for(var i=g(arguments,1,r),o=-1,s=f(),u=f();++o<r;)ue(t,i[o],n,s,u);return v(s),v(u),t}function We(t,r,n){var i={};if("function"!=typeof r){var o=[];Ci(t,function(t,e){o.push(e)}),o=F(o,ie(arguments,!0,!1,1));for(var s=-1,u=o.length;++s<u;){var a=o[s];i[a]=t[a]}}else r=e.createCallback(r,n,3),Ci(t,function(t,e,n){r(t,e,n)||(i[e]=t)});return i}function Ye(t){for(var e=-1,r=pi(t),n=r.length,i=wn(n);++e<n;){var o=r[e];i[e]=[o,t[o]]}return i}function Xe(t,r,n){var i={};if("function"!=typeof r)for(var o=-1,s=ie(arguments,!0,!1,1),u=Pe(t)?s.length:0;++o<u;){var a=s[o];a in t&&(i[a]=t[a])}else r=e.createCallback(r,n,3),Ci(t,function(t,e,n){r(t,e,n)&&(i[e]=t)});return i}function $e(t,r,n,i){var o=li(t);if(null==n)if(o)n=[];else{var s=t&&t.constructor,a=s&&s.prototype;n=u(a)}return r&&(r=e.createCallback(r,i,4),(o?wi:Bi)(t,function(t,e,i){return r(n,t,e,i)})),n}function Ge(t){for(var e=-1,r=pi(t),n=r.length,i=wn(n);++e<n;)i[e]=t[r[e]];return i}function Ze(t){var e=arguments,r=-1,n=ie(e,!0,!1,1),i=e[2]&&e[2][e[1]]===t?1:n.length,o=wn(i);for(ai.unindexedChars&&Ve(t)&&(t=t.split(""));++r<i;)o[r]=t[n[r]];return o}function Je(t,e,r){var n=-1,i=ve(),o=t?t.length:0,s=!1;return r=(0>r?ri(0,o+r):r)||0,li(t)?s=i(t,e,r)>-1:"number"==typeof o?s=(Ve(t)?t.indexOf(e,r):i(t,e,r))>-1:wi(t,function(t){return++n>=r?!(s=t===e):void 0}),s}function Qe(t,r,n){var i=!0;if(r=e.createCallback(r,n,3),li(t))for(var o=-1,s=t.length;++o<s&&(i=!!r(t[o],o,t)););else wi(t,function(t,e,n){return i=!!r(t,e,n)});return i}function tr(t,r,n){var i=[];if(r=e.createCallback(r,n,3),li(t))for(var o=-1,s=t.length;++o<s;){var u=t[o];r(u,o,t)&&i.push(u)}else wi(t,function(t,e,n){r(t,e,n)&&i.push(t)});return i}function er(t,r,n){if(r=e.createCallback(r,n,3),!li(t)){var i;return wi(t,function(t,e,n){return r(t,e,n)?(i=t,!1):void 0}),i}for(var o=-1,s=t.length;++o<s;){var u=t[o];if(r(u,o,t))return u}}function rr(t,r,n){var i;return r=e.createCallback(r,n,3),ir(t,function(t,e,n){return r(t,e,n)?(i=t,!1):void 0}),i}function nr(t,e,r){if(e&&"undefined"==typeof r&&li(t))for(var n=-1,i=t.length;++n<i&&e(t[n],n,t)!==!1;);else wi(t,e,r);return t}function ir(t,e,r){var n=t,i=t?t.length:0;if(e=e&&"undefined"==typeof r?e:_(e,r,3),li(t))for(;i--&&e(t[i],i,t)!==!1;);else{if("number"!=typeof i){var o=pi(t);i=o.length}else ai.unindexedChars&&Ve(t)&&(n=t.split(""));wi(t,function(t,r,s){return r=o?o[--i]:--i,e(n[r],r,s)})}return t}function or(t,e){var r=g(arguments,2),n=-1,i="function"==typeof e,o=t?t.length:0,s=wn("number"==typeof o?o:0);return nr(t,function(t){s[++n]=(i?e:t[e]).apply(t,r)}),s}function sr(t,r,n){var i=-1,o=t?t.length:0,s=wn("number"==typeof o?o:0);if(r=e.createCallback(r,n,3),li(t))for(;++i<o;)s[i]=r(t[i],i,t);else wi(t,function(t,e,n){s[++i]=r(t,e,n)});return s}function ur(t,r,n){var i=-1/0,o=i;if("function"!=typeof r&&n&&n[r]===t&&(r=null),null==r&&li(t))for(var s=-1,u=t.length;++s<u;){var c=t[s];c>o&&(o=c)}else r=null==r&&Ve(t)?a:e.createCallback(r,n,3),wi(t,function(t,e,n){var s=r(t,e,n);s>i&&(i=s,o=t)});return o}function ar(t,r,n){var i=1/0,o=i;if("function"!=typeof r&&n&&n[r]===t&&(r=null),null==r&&li(t))for(var s=-1,u=t.length;++s<u;){var c=t[s];o>c&&(o=c)}else r=null==r&&Ve(t)?a:e.createCallback(r,n,3),wi(t,function(t,e,n){var s=r(t,e,n);i>s&&(i=s,o=t)});return o}function cr(t,r,n,i){var o=arguments.length<3;if(r=e.createCallback(r,i,4),li(t)){var s=-1,u=t.length;for(o&&(n=t[++s]);++s<u;)n=r(n,t[s],s,t)}else wi(t,function(t,e,i){n=o?(o=!1,t):r(n,t,e,i)});return n}function hr(t,r,n,i){var o=arguments.length<3;return r=e.createCallback(r,i,4),ir(t,function(t,e,i){n=o?(o=!1,t):r(n,t,e,i)}),n}function lr(t,r,n){return r=e.createCallback(r,n,3),tr(t,function(t,e,n){return!r(t,e,n)})}function fr(t,e,r){if(t&&"number"!=typeof t.length?t=Ge(t):ai.unindexedChars&&Ve(t)&&(t=t.split("")),null==e||r)return t?t[ae(0,t.length-1)]:b;var n=pr(t);return n.length=ni(ri(0,e),n.length),n}function pr(t){var e=-1,r=t?t.length:0,n=wn("number"==typeof r?r:0);return nr(t,function(t){var r=ae(0,++e);n[e]=n[r],n[r]=t}),n}function dr(t){var e=t?t.length:0;return"number"==typeof e?e:pi(t).length}function vr(t,r,n){var i;if(r=e.createCallback(r,n,3),li(t))for(var o=-1,s=t.length;++o<s&&!(i=r(t[o],o,t)););else wi(t,function(t,e,n){return!(i=r(t,e,n))});return!!i}function yr(t,r,n){var i=-1,o=li(r),s=t?t.length:0,u=wn("number"==typeof s?s:0);for(o||(r=e.createCallback(r,n,3)),nr(t,function(t,e,n){var s=u[++i]=p();o?s.criteria=sr(r,function(e){return t[e]}):(s.criteria=f())[0]=r(t,e,n),s.index=i,s.value=t}),s=u.length,u.sort(c);s--;){var a=u[s];u[s]=a.value,o||v(a.criteria),y(a)}return u}function gr(t){return t&&"number"==typeof t.length?ai.unindexedChars&&Ve(t)?t.split(""):g(t):Ge(t)}function mr(t){for(var e=-1,r=t?t.length:0,n=[];++e<r;){var i=t[e];i&&n.push(i)}return n}function br(t){return F(t,ie(arguments,!0,!0,1))}function _r(t,r,n){var i=-1,o=t?t.length:0;for(r=e.createCallback(r,n,3);++i<o;)if(r(t[i],i,t))return i;return-1}function wr(t,r,n){var i=t?t.length:0;for(r=e.createCallback(r,n,3);i--;)if(r(t[i],i,t))return i;return-1}function Er(t,r,n){var i=0,o=t?t.length:0;if("number"!=typeof r&&null!=r){var s=-1;for(r=e.createCallback(r,n,3);++s<o&&r(t[s],s,t);)i++}else if(i=r,null==i||n)return t?t[0]:b;return g(t,0,ni(ri(0,i),o))}function Ar(t,e,r,n){return"boolean"!=typeof e&&null!=e&&(n=r,r="function"!=typeof e&&n&&n[e]===t?null:e,e=!1),null!=r&&(t=sr(t,r,n)),ie(t,e)}function Cr(t,e,r){if("number"==typeof r){var n=t?t.length:0;r=0>r?ri(0,n+r):r||0}else if(r){var i=Rr(t,e);return t[i]===e?i:-1}return o(t,e,r)}function Br(t,r,n){var i=0,o=t?t.length:0;if("number"!=typeof r&&null!=r){var s=o;for(r=e.createCallback(r,n,3);s--&&r(t[s],s,t);)i++}else i=null==r||n?1:r||i;return g(t,0,ni(ri(0,o-i),o))}function Fr(){for(var t=[],e=-1,r=arguments.length,n=f(),i=ve(),u=i===o,a=f();++e<r;){var c=arguments[e];(li(c)||be(c))&&(t.push(c),n.push(u&&c.length>=B&&h(e?t[e]:a)))}var l=t[0],p=-1,d=l?l.length:0,g=[];t:for(;++p<d;){var m=n[0];if(c=l[p],(m?s(m,c):i(a,c))<0){for(e=r,(m||a).push(c);--e;)if(m=n[e],(m?s(m,c):i(t[e],c))<0)continue t;g.push(c)}}for(;r--;)m=n[r],m&&y(m);return v(n),v(a),g}function kr(t,r,n){var i=0,o=t?t.length:0;if("number"!=typeof r&&null!=r){var s=o;for(r=e.createCallback(r,n,3);s--&&r(t[s],s,t);)i++}else if(i=r,null==i||n)return t?t[o-1]:b;return g(t,ri(0,o-i))}function xr(t,e,r){var n=t?t.length:0;for("number"==typeof r&&(n=(0>r?ri(0,n+r):ni(r,n-1))+1);n--;)if(t[n]===e)return n;return-1}function Dr(t){for(var e=arguments,r=0,n=e.length,i=t?t.length:0;++r<n;)for(var o=-1,s=e[r];++o<i;)t[o]===s&&(Xn.call(t,o--,1),i--);return t}function Sr(t,e,r){t=+t||0,r="number"==typeof r?r:+r||1,null==e&&(e=t,t=0);for(var n=-1,i=ri(0,Ln((e-t)/(r||1))),o=wn(i);++n<i;)o[n]=t,t+=r;return o}function Tr(t,r,n){var i=-1,o=t?t.length:0,s=[];for(r=e.createCallback(r,n,3);++i<o;){var u=t[i];r(u,i,t)&&(s.push(u),Xn.call(t,i--,1),o--)}return s}function jr(t,r,n){if("number"!=typeof r&&null!=r){var i=0,o=-1,s=t?t.length:0;for(r=e.createCallback(r,n,3);++o<s&&r(t[o],o,t);)i++}else i=null==r||n?1:ri(0,r);return g(t,i)}function Rr(t,r,n,i){var o=0,s=t?t.length:o;for(n=n?e.createCallback(n,i,1):on,r=n(r);s>o;){var u=o+s>>>1;n(t[u])<r?o=u+1:s=u}return o}function Or(){return he(ie(arguments,!0,!0))}function Mr(t,r,n,i){return"boolean"!=typeof r&&null!=r&&(i=n,n="function"!=typeof r&&i&&i[r]===t?null:r,r=!1),null!=n&&(n=e.createCallback(n,i,3)),he(t,r,n)}function Ur(t){return F(t,g(arguments,1))}function Pr(){for(var t=-1,e=arguments.length;++t<e;){var r=arguments[t];if(li(r)||be(r))var n=n?he(F(n,r).concat(F(r,n))):r}return n||[]}function Ir(){for(var t=arguments.length>1?arguments:arguments[0],e=-1,r=t?ur(Si(t,"length")):0,n=wn(0>r?0:r);++e<r;)n[e]=Si(t,e);return n}function Lr(t,e){var r=-1,n=t?t.length:0,i={};for(e||!n||li(t[0])||(e=[]);++r<n;){var o=t[r];e?i[o]=e[r]:o&&(i[o[0]]=o[1])}return i}function zr(t,e){if(!Ue(e))throw new Tn;return function(){return--t<1?e.apply(this,arguments):void 0}}function Nr(t,e){return arguments.length>2?fe(t,17,g(arguments,2),null,e):fe(t,1,null,null,e)}function Vr(t){for(var e=arguments.length>1?ie(arguments,!0,!1,1):ke(t),r=-1,n=e.length;++r<n;){var i=e[r];t[i]=fe(t[i],1,null,null,t)}return t}function Kr(t,e){return arguments.length>2?fe(e,19,g(arguments,2),null,t):fe(e,3,null,null,t)}function qr(){for(var t=arguments,e=t.length;e--;)if(!Ue(t[e]))throw new Tn;return function(){for(var e=arguments,r=t.length;r--;)e=[t[r].apply(this,e)];return e[0]}}function Hr(t,e){return e="number"==typeof e?e:+e||t.length,fe(t,4,null,null,null,e)}function Wr(t,e,r){var n,i,o,s,u,a,c,h=0,l=!1,f=!0;if(!Ue(t))throw new Tn;if(e=ri(0,e)||0,r===!0){var p=!0;f=!1}else Pe(r)&&(p=r.leading,l="maxWait"in r&&(ri(e,r.maxWait)||0),f="trailing"in r?r.trailing:f);var d=function(){var r=e-(ji()-s);if(0>=r){i&&zn(i);var l=c;i=a=c=b,l&&(h=ji(),o=t.apply(u,n),a||i||(n=u=null))}else a=Yn(d,r)},v=function(){a&&zn(a),i=a=c=b,(f||l!==e)&&(h=ji(),o=t.apply(u,n),a||i||(n=u=null))};return function(){if(n=arguments,s=ji(),u=this,c=f&&(a||!p),l===!1)var r=p&&!a;else{i||p||(h=s);var y=l-(s-h),g=0>=y;g?(i&&(i=zn(i)),h=s,o=t.apply(u,n)):i||(i=Yn(v,y))}return g&&a?a=zn(a):a||e===l||(a=Yn(d,e)),r&&(g=!0,o=t.apply(u,n)),!g||a||i||(n=u=null),o}}function Yr(t){if(!Ue(t))throw new Tn;var e=g(arguments,1);return Yn(function(){t.apply(b,e)},1)}function Xr(t,e){if(!Ue(t))throw new Tn;var r=g(arguments,2);return Yn(function(){t.apply(b,r)},e)}function $r(t,e){if(!Ue(t))throw new Tn;var r=function(){var n=r.cache,i=e?e.apply(this,arguments):C+arguments[0];return qn.call(n,i)?n[i]:n[i]=t.apply(this,arguments)};return r.cache={},r}function Gr(t){var e,r;if(!Ue(t))throw new Tn;return function(){return e?r:(e=!0,r=t.apply(this,arguments),t=null,r)}}function Zr(t){return fe(t,16,g(arguments,1))}function Jr(t){return fe(t,32,null,g(arguments,1))}function Qr(t,e,r){var n=!0,i=!0;if(!Ue(t))throw new Tn;return r===!1?n=!1:Pe(r)&&(n="leading"in r?r.leading:n,i="trailing"in r?r.trailing:i),te.leading=n,te.maxWait=e,te.trailing=i,Wr(t,e,te)}function tn(t,e){return fe(e,16,[t])}function en(t){return function(){return t}}function rn(t,e,r){var n=typeof t;if(null==t||"function"==n)return _(t,e,r);if("object"!=n)return cn(t);var i=pi(t),o=i[0],s=t[o];return 1!=i.length||s!==s||Pe(s)?function(e){for(var r=i.length,n=!1;r--&&(n=se(e[i[r]],t[i[r]],null,!0)););return n}:function(t){var e=t[o];return s===e&&(0!==s||1/s==1/e)}}function nn(t){return null==t?"":Sn(t).replace(_i,de)}function on(t){return t}function sn(t,n,i){var o=!0,s=n&&ke(n);n&&(i||s.length)||(null==i&&(i=n),u=r,n=t,t=e,s=ke(n)),i===!1?o=!1:Pe(i)&&"chain"in i&&(o=i.chain);var u=t,a=Ue(u);nr(s,function(e){var r=t[e]=n[e];a&&(u.prototype[e]=function(){var e=this.__chain__,n=this.__wrapped__,i=[n];Hn.apply(i,arguments);var s=r.apply(t,i);if(o||e){if(n===s&&Pe(s))return this;s=new u(s),s.__chain__=e}return s})})}function un(){return t._=Un,this}function an(){}function cn(t){return function(e){return e[t]}}function hn(t,e,r){var n=null==t,i=null==e;if(null==r&&("boolean"==typeof t&&i?(r=t,t=1):i||"boolean"!=typeof e||(r=e,i=!0)),n&&i&&(e=1),t=+t||0,i?(e=t,t=0):e=+e||0,r||t%1||e%1){var o=oi();return ni(t+o*(e-t+parseFloat("1e-"+((o+"").length-1))),e)}return ae(t,e)}function ln(t,e){if(t){var r=t[e];return Ue(r)?t[e]():r}}function fn(t,r,n){var i=e.templateSettings;t=Sn(t||""),n=Ai({},n,i);var o,s=Ai({},n.imports,i.imports),u=pi(s),a=Ge(s),c=0,h=n.interpolate||P,f="__p += '",p=Dn((n.escape||P).source+"|"+h.source+"|"+(h===M?j:P).source+"|"+(n.evaluate||P).source+"|$","g");t.replace(p,function(e,r,n,i,s,u){return n||(n=i),f+=t.slice(c,u).replace(L,l),r&&(f+="' +\n__e("+r+") +\n'"),s&&(o=!0,f+="';\n"+s+";\n__p += '"),n&&(f+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=u+e.length,e}),f+="';\n";var d=n.variable,v=d;v||(d="obj",f="with ("+d+") {\n"+f+"\n}\n"),f=(o?f.replace(D,""):f).replace(S,"$1").replace(T,"$1;"),f="function("+d+") {\n"+(v?"":d+" || ("+d+" = {});\n")+"var __t, __p = '', __e = _.escape"+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var y="\n/*\n//# sourceURL="+(n.sourceURL||"/lodash/template/source["+V++ +"]")+"\n*/";try{var g=Bn(u,"return "+f+y).apply(b,a)}catch(m){throw m.source=f,m}return r?g(r):(g.source=f,g)}function pn(t,e,r){t=(t=+t)>-1?t:0;var n=-1,i=wn(t);for(e=_(e,r,1);++n<t;)i[n]=e(n);return i}function dn(t){return null==t?"":Sn(t).replace(bi,me)}function vn(t){var e=++E;return Sn(null==t?"":t)+e}function yn(t){return t=new r(t),t.__chain__=!0,t}function gn(t,e){return e(t),t}function mn(){return this.__chain__=!0,this}function bn(){return Sn(this.__wrapped__)}function _n(){return this.__wrapped__}t=t?ce.defaults(oe.Object(),t,ce.pick(oe,z)):oe;var wn=t.Array,En=t.Boolean,An=t.Date,Cn=t.Error,Bn=t.Function,Fn=t.Math,kn=t.Number,xn=t.Object,Dn=t.RegExp,Sn=t.String,Tn=t.TypeError,jn=[],Rn=Cn.prototype,On=xn.prototype,Mn=Sn.prototype,Un=t._,Pn=On.toString,In=Dn("^"+Sn(Pn).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Ln=Fn.ceil,zn=t.clearTimeout,Nn=Fn.floor,Vn=Bn.prototype.toString,Kn=ye(Kn=xn.getPrototypeOf)&&Kn,qn=On.hasOwnProperty,Hn=jn.push,Wn=On.propertyIsEnumerable,Yn=t.setTimeout,Xn=jn.splice,$n=jn.unshift,Gn=function(){try{var t={},e=ye(e=xn.defineProperty)&&e,r=e(t,t,t)&&e}catch(n){}return r}(),Zn=ye(Zn=xn.create)&&Zn,Jn=ye(Jn=wn.isArray)&&Jn,Qn=t.isFinite,ti=t.isNaN,ei=ye(ei=xn.keys)&&ei,ri=Fn.max,ni=Fn.min,ii=t.parseInt,oi=Fn.random,si={}; si[q]=wn,si[H]=En,si[W]=An,si[X]=Bn,si[G]=xn,si[$]=kn,si[Z]=Dn,si[J]=Sn;var ui={};ui[q]=ui[W]=ui[$]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ui[H]=ui[J]={constructor:!0,toString:!0,valueOf:!0},ui[Y]=ui[X]=ui[Z]={constructor:!0,toString:!0},ui[G]={constructor:!0},function(){for(var t=N.length;t--;){var e=N[t];for(var r in ui)qn.call(ui,r)&&!qn.call(ui[r],e)&&(ui[r][e]=!1)}}(),r.prototype=e.prototype;var ai=e.support={};!function(){var e=function(){this.x=1},r={0:1,length:1},n=[];e.prototype={valueOf:1,y:1};for(var i in new e)n.push(i);for(i in arguments);ai.argsClass=Pn.call(arguments)==K,ai.argsObject=arguments.constructor==xn&&!(arguments instanceof wn),ai.enumErrorProps=Wn.call(Rn,"message")||Wn.call(Rn,"name"),ai.enumPrototypes=Wn.call(e,"prototype"),ai.funcDecomp=!ye(t.WinRTError)&&I.test(m),ai.funcNames="string"==typeof Bn.name,ai.nonEnumArgs=0!=i,ai.nonEnumShadows=!/valueOf/.test(n),ai.ownLast="x"!=n[0],ai.spliceObjects=(jn.splice.call(r,0,1),!r[0]),ai.unindexedChars="x"[0]+xn("x")[0]!="xx";try{ai.nodeClass=!(Pn.call(document)==G&&!({toString:0}+""))}catch(o){ai.nodeClass=!0}}(1),e.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:M,variable:"",imports:{_:e}};var ci=function(t){var e="var index, iterable = "+t.firstArg+", result = "+t.init+";\nif (!iterable) return result;\n"+t.top+";";t.array?(e+="\nvar length = iterable.length; index = -1;\nif ("+t.array+") { ",ai.unindexedChars&&(e+="\n if (isString(iterable)) {\n iterable = iterable.split('')\n } "),e+="\n while (++index < length) {\n "+t.loop+";\n }\n}\nelse { "):ai.nonEnumArgs&&(e+="\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += '';\n "+t.loop+";\n }\n } else { "),ai.enumPrototypes&&(e+="\n var skipProto = typeof iterable == 'function';\n "),ai.enumErrorProps&&(e+="\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n ");var r=[];if(ai.enumPrototypes&&r.push('!(skipProto && index == "prototype")'),ai.enumErrorProps&&r.push('!(skipErrorProps && (index == "message" || index == "name"))'),t.useHas&&t.keys)e+="\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n",r.length&&(e+=" if ("+r.join(" && ")+") {\n "),e+=t.loop+"; ",r.length&&(e+="\n }"),e+="\n } ";else if(e+="\n for (index in iterable) {\n",t.useHas&&r.push("hasOwnProperty.call(iterable, index)"),r.length&&(e+=" if ("+r.join(" && ")+") {\n "),e+=t.loop+"; ",r.length&&(e+="\n }"),e+="\n } ",ai.nonEnumShadows){for(e+="\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n ",k=0;7>k;k++)e+="\n index = '"+t.shadowedProps[k]+"';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))",t.useHas||(e+=" || (!nonEnum[index] && iterable[index] !== objectProto[index])"),e+=") {\n "+t.loop+";\n } ";e+="\n } "}return(t.array||ai.nonEnumArgs)&&(e+="\n}"),e+=t.bottom+";\nreturn result"};Zn||(u=function(){function e(){}return function(r){if(Pe(r)){e.prototype=r;var n=new e;e.prototype=null}return n||t.Object()}}());var hi=Gn?function(t,e){ee.value=e,Gn(t,"__bindData__",ee)}:an;ai.argsClass||(be=function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&qn.call(t,"callee")&&!Wn.call(t,"callee")||!1});var li=Jn||function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Pn.call(t)==q||!1},fi=pe({args:"object",init:"[]",top:"if (!(objectTypes[typeof object])) return result",loop:"result.push(index)"}),pi=ei?function(t){return Pe(t)?ai.enumPrototypes&&"function"==typeof t||ai.nonEnumArgs&&t.length&&be(t)?fi(t):ei(t):[]}:fi,di={args:"collection, callback, thisArg",top:"callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",array:"typeof length == 'number'",keys:pi,loop:"if (callback(iterable[index], index, collection) === false) return result"},vi={args:"object, source, guard",top:"var args = arguments,\n argsIndex = 0,\n argsLength = typeof guard == 'number' ? 2 : args.length;\nwhile (++argsIndex < argsLength) {\n iterable = args[argsIndex];\n if (iterable && objectTypes[typeof iterable]) {",keys:pi,loop:"if (typeof result[index] == 'undefined') result[index] = iterable[index]",bottom:" }\n}"},yi={top:"if (!objectTypes[typeof iterable]) return result;\n"+di.top,array:!1},gi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},mi=De(gi),bi=Dn("("+pi(mi).join("|")+")","g"),_i=Dn("["+pi(gi).join("")+"]","g"),wi=pe(di),Ei=pe(vi,{top:vi.top.replace(";",";\nif (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n callback = args[--argsLength];\n}"),loop:"result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]"}),Ai=pe(vi),Ci=pe(di,yi,{useHas:!1}),Bi=pe(di,yi);Ue(/x/)&&(Ue=function(t){return"function"==typeof t&&Pn.call(t)==X});var Fi=Kn?function(t){if(!t||Pn.call(t)!=G||!ai.argsClass&&be(t))return!1;var e=t.valueOf,r=ye(e)&&(r=Kn(e))&&Kn(r);return r?t==r||Kn(t)==r:ge(t)}:ge,ki=le(function(t,e,r){qn.call(t,r)?t[r]++:t[r]=1}),xi=le(function(t,e,r){(qn.call(t,r)?t[r]:t[r]=[]).push(e)}),Di=le(function(t,e,r){t[r]=e}),Si=sr,Ti=tr,ji=ye(ji=An.now)&&ji||function(){return(new An).getTime()},Ri=8==ii(x+"08")?ii:function(t,e){return ii(Ve(t)?t.replace(U,""):t,e||0)};return e.after=zr,e.assign=Ei,e.at=Ze,e.bind=Nr,e.bindAll=Vr,e.bindKey=Kr,e.chain=yn,e.compact=mr,e.compose=qr,e.constant=en,e.countBy=ki,e.create=Ee,e.createCallback=rn,e.curry=Hr,e.debounce=Wr,e.defaults=Ai,e.defer=Yr,e.delay=Xr,e.difference=br,e.filter=tr,e.flatten=Ar,e.forEach=nr,e.forEachRight=ir,e.forIn=Ci,e.forInRight=Be,e.forOwn=Bi,e.forOwnRight=Fe,e.functions=ke,e.groupBy=xi,e.indexBy=Di,e.initial=Br,e.intersection=Fr,e.invert=De,e.invoke=or,e.keys=pi,e.map=sr,e.mapValues=qe,e.max=ur,e.memoize=$r,e.merge=He,e.min=ar,e.omit=We,e.once=Gr,e.pairs=Ye,e.partial=Zr,e.partialRight=Jr,e.pick=Xe,e.pluck=Si,e.property=cn,e.pull=Dr,e.range=Sr,e.reject=lr,e.remove=Tr,e.rest=jr,e.shuffle=pr,e.sortBy=yr,e.tap=gn,e.throttle=Qr,e.times=pn,e.toArray=gr,e.transform=$e,e.union=Or,e.uniq=Mr,e.values=Ge,e.where=Ti,e.without=Ur,e.wrap=tn,e.xor=Pr,e.zip=Ir,e.zipObject=Lr,e.collect=sr,e.drop=jr,e.each=nr,e.eachRight=ir,e.extend=Ei,e.methods=ke,e.object=Lr,e.select=tr,e.tail=jr,e.unique=Mr,e.unzip=Ir,sn(e),e.clone=_e,e.cloneDeep=we,e.contains=Je,e.escape=nn,e.every=Qe,e.find=er,e.findIndex=_r,e.findKey=Ae,e.findLast=rr,e.findLastIndex=wr,e.findLastKey=Ce,e.has=xe,e.identity=on,e.indexOf=Cr,e.isArguments=be,e.isArray=li,e.isBoolean=Se,e.isDate=Te,e.isElement=je,e.isEmpty=Re,e.isEqual=Oe,e.isFinite=Me,e.isFunction=Ue,e.isNaN=Ie,e.isNull=Le,e.isNumber=ze,e.isObject=Pe,e.isPlainObject=Fi,e.isRegExp=Ne,e.isString=Ve,e.isUndefined=Ke,e.lastIndexOf=xr,e.mixin=sn,e.noConflict=un,e.noop=an,e.now=ji,e.parseInt=Ri,e.random=hn,e.reduce=cr,e.reduceRight=hr,e.result=ln,e.runInContext=m,e.size=dr,e.some=vr,e.sortedIndex=Rr,e.template=fn,e.unescape=dn,e.uniqueId=vn,e.all=Qe,e.any=vr,e.detect=er,e.findWhere=er,e.foldl=cr,e.foldr=hr,e.include=Je,e.inject=cr,sn(function(){var t={};return Bi(e,function(r,n){e.prototype[n]||(t[n]=r)}),t}(),!1),e.first=Er,e.last=kr,e.sample=fr,e.take=Er,e.head=Er,Bi(e,function(t,n){var i="sample"!==n;e.prototype[n]||(e.prototype[n]=function(e,n){var o=this.__chain__,s=t(this.__wrapped__,e,n);return o||null!=e&&(!n||i&&"function"==typeof e)?new r(s,o):s})}),e.VERSION="2.4.1",e.prototype.chain=mn,e.prototype.toString=bn,e.prototype.value=_n,e.prototype.valueOf=_n,wi(["join","pop","shift"],function(t){var n=jn[t];e.prototype[t]=function(){var t=this.__chain__,e=n.apply(this.__wrapped__,arguments);return t?new r(e,t):e}}),wi(["push","reverse","sort","unshift"],function(t){var r=jn[t];e.prototype[t]=function(){return r.apply(this.__wrapped__,arguments),this}}),wi(["concat","slice","splice"],function(t){var n=jn[t];e.prototype[t]=function(){return new r(n.apply(this.__wrapped__,arguments),this.__chain__)}}),ai.spliceObjects||wi(["pop","shift","splice"],function(t){var n=jn[t],i="splice"==t;e.prototype[t]=function(){var t=this.__chain__,e=this.__wrapped__,o=n.apply(e,arguments);return 0===e.length&&delete e[0],t||i?new r(o,t):o}}),e}var b,_=[],w=[],E=0,A={},C=+new Date+"",B=75,F=40,x=" \f \n\r\u2028\u2029 ᠎              ",D=/\b__p \+= '';/g,S=/\b(__p \+=) '' \+/g,T=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,R=/\w*$/,O=/^\s*function[ \n\r\t]+\w/,M=/<%=([\s\S]+?)%>/g,U=RegExp("^["+x+"]*0+(?=.$)"),P=/($^)/,I=/\bthis\b/,L=/['\n\r\t\u2028\u2029\\]/g,z=["Array","Boolean","Date","Error","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"],N=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],V=0,K="[object Arguments]",q="[object Array]",H="[object Boolean]",W="[object Date]",Y="[object Error]",X="[object Function]",$="[object Number]",G="[object Object]",Z="[object RegExp]",J="[object String]",Q={};Q[X]=!1,Q[K]=Q[q]=Q[H]=Q[W]=Q[$]=Q[G]=Q[Z]=Q[J]=!0;var te={leading:!1,maxWait:0,trailing:!1},ee={configurable:!1,enumerable:!1,value:null,writable:!1},re={args:"",array:null,bottom:"",firstArg:"",init:"",keys:null,loop:"",shadowedProps:null,support:null,top:"",useHas:!1},ne={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},ie={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},oe=ne[typeof window]&&window||this,se=ne[typeof e]&&e&&!e.nodeType&&e,ue=ne[typeof t]&&t&&!t.nodeType&&t,ae=(ue&&ue.exports===se&&se,ne[typeof i]&&i);!ae||ae.global!==ae&&ae.window!==ae||(oe=ae);var ce=m();oe._=ce,n=function(){return ce}.call(e,r,e,t),!(n!==b&&(t.exports=n))}).call(this)}).call(e,r(40)(t),function(){return this}())},function(t,e,r){"use strict";function n(t){return l.resolve(t).then(d.present("server")).then(d.present("walletId")).then(d.present("rawMainData")).then(d.present("rawKeychainData")).then(d.number("lockVersion")).then(d.string("newPassword")).then(d.string("secretKey"))}function i(t){t.oldWalletId=t.walletId;var e=h.util.encodeBase64(h.randomBytes(16)),r=a.calculateMasterKey(e,t.username,t.newPassword,t.kdfParams),n=a.deriveWalletId(r),i=a.deriveWalletKey(r);return t.kdfParams=JSON.stringify(t.kdfParams),t.salt=e,t.rawMasterKey=r,t.rawWalletId=n,t.walletId=p.codec.base64.fromBits(n),t.rawWalletKey=i,t.mainData=a.encryptData(t.rawMainData,i),t.mainDataHash=a.sha1(t.mainData),t.keychainData=a.encryptData(t.rawKeychainData,i),t.keychainDataHash=a.sha1(t.keychainData),l.resolve(t)}function o(t){var e=l.pending();return f.post(t.server+"/wallets/update").type("json").send(s.pick(t,["walletId","salt","kdfParams","mainData","mainDataHash","keychainData","keychainDataHash","lockVersion"])).use(a.signRequest(t.username,t.oldWalletId,t.secretKey)).end(function(r,n){if(r)e.reject(new c.ConnectionError);else if("fail"===n.body.status)e.reject(c.getProtocolError(n.body.code));else if("success"===n.body.status){var i={rawWalletId:t.rawWalletId,rawWalletKey:t.rawWalletKey,rawMasterKey:t.rawMasterKey,newLockVersion:n.body.newLockVersion};e.resolve(i)}else e.reject(new c.UnknownError(JSON.stringify(n.body)))}),e.promise}var s=r(10),u=r(12),a=r(5),c=r(2),h=r(26),l=r(23),f=r(73),p=r(9),d=r(29);t.exports=function(t){return l.resolve(t).then(n).then(u.getKdfParams).then(i).then(o)}},function(t,e,r){"use strict";function n(t){return s.isNumber(t.totpCode)&&(t.totpCode=t.totpCode.toString()),a.resolve(t)}function i(t){var e=a.pending();return c.post(t.server+"/wallets/show_login_params").type("json").send({username:t.username}).end(function(r,n){r?e.reject(new u.ConnectionError):"fail"===n.body.status?e.reject(u.getProtocolError(n.body.code)):(t.salt=n.body.salt,t.kdfParams=JSON.parse(n.body.kdfParams),t.totpRequired=n.body.totpRequired,e.resolve(t))}),e.promise}function o(t){if(s.isObject(t.kdfParams))return a.resolve(t);if(h)return t.kdfParams=h,a.resolve(t);var e=a.pending();return c.get(t.server+"/kdf_params").end(function(r,n){r?e.reject(new u.ConnectionError):"fail"===n.body.status?e.reject(u.getProtocolError(n.body.code)):(h=n.body,t.kdfParams=h,e.resolve(t))}),e.promise}var s=r(10),u=r(2),a=r(23),c=r(73);t.exports={totpCodeToString:n,walletShowLoginParams:i,getKdfParams:o};var h=null},function(t,e,r){"use strict";function n(t){return l.resolve(t).then(d.present("server")).then(d.present("username")).then(d.present("password")).then(d.string("publicKey")).then(d.string("mainData")).then(d.string("keychainData"))}function i(t){var e=h.util.encodeBase64(h.randomBytes(16)),r=a.calculateMasterKey(e,t.username,t.password,t.kdfParams),n=a.deriveWalletId(r),i=a.deriveWalletKey(r);return t.kdfParams=JSON.stringify(t.kdfParams),t.salt=e,t.rawMasterKey=r,t.rawWalletId=n,t.walletId=p.codec.base64.fromBits(n),t.rawWalletKey=i,t.rawMainData=t.mainData,t.mainData=a.encryptData(t.mainData,i),t.mainDataHash=a.sha1(t.mainData),t.rawKeychainData=t.keychainData,t.keychainData=a.encryptData(t.keychainData,i),t.keychainDataHash=a.sha1(t.keychainData),l.resolve(t)}function o(t){var e=l.pending();return f.post(t.server+"/wallets/create").type("json").send(s.pick(t,["username","walletId","salt","publicKey","mainData","mainDataHash","keychainData","keychainDataHash","kdfParams","usernameProof"])).end(function(r,n){if(r)e.reject(new c.ConnectionError);else if("fail"===n.body.status)e.reject(c.getProtocolError(n.body.code));else{var i=s.pick(t,["server","username","rawMasterKey","rawWalletId","rawWalletKey","rawMainData","rawKeychainData"]);i.lockVersion=0,i.totpEnabled=!1,e.resolve(i)}}),e.promise}var s=r(10),u=r(12),a=r(5),c=r(2),h=r(26),l=r(23),f=r(73),p=r(9),d=r(29);t.exports=function(t){return l.resolve(t).then(n).then(u.getKdfParams).then(i).then(o)}},function(t,e,r){"use strict";var n=r(2),i=r(23),o=r(73),s=r(5).signRequest;t.exports=function(t){var e=i.pending();return o.post(t.server+"/wallets/delete").send({username:t.username,walletId:t.walletId,lockVersion:t.lockVersion}).use(s(t.username,t.walletId,t.secretKey)).end(function(t,r){t?e.reject(new n.ConnectionError):"fail"===r.body.status?e.reject(n.getProtocolError(r.body.code)):e.resolve(r.body)}),e.promise}},function(t,e,r){"use strict";function n(t){return c.resolve(t).then(l.present("server")).then(l.present("username")).then(l.present("walletId")).then(l.present("secretKey")).then(l.present("totpCode")).then(l.number("lockVersion"))}function i(t){var e=c.pending();return h.post(t.server+"/totp/disable").type("json").send(o.pick(t,["lockVersion","totpCode"])).use(u.signRequest(t.username,t.walletId,t.secretKey)).end(function(t,r){t?e.reject(new a.ConnectionError):"fail"===r.body.status?e.reject(a.getProtocolError(r.body.code)):e.resolve(o.pick(r.body,"newLockVersion"))}),e.promise}var o=r(10),s=r(12),u=r(5),a=r(2),c=r(23),h=r(73),l=r(29);t.exports=function(t){return c.resolve(t).then(s.totpCodeToString).then(n).then(i)}},function(t,e,r){"use strict";function n(t){return h.resolve(t).then(f.present("server")).then(f.present("username")).then(f.present("walletId")).then(f.present("masterKey")).then(f.present("secretKey")).then(f.present("recoveryCode")).then(f.number("lockVersion"))}function i(t){t.recoveryId=a.sha1(t.recoveryCode);var e=u.decode(t.recoveryCode);return e=a.bytesToWords(e),t.recoveryData=a.encryptData(t.masterKey,e),h.resolve(t)}function o(t){var e=h.pending();return l.post(t.server+"/wallets/recovery/enable").type("json").send(s.pick(t,["lockVersion","recoveryId","recoveryData"])).use(a.signRequest(t.username,t.walletId,t.secretKey)).end(function(r,n){r?e.reject(new c.ConnectionError):"fail"===n.body.status?e.reject(c.getProtocolError(n.body.code)):(t.newLockVersion=n.body.newLockVersion,e.resolve(t))}),e.promise}var s=r(10),u=r(30),a=r(5),c=r(2),h=(r(9),r(23)),l=r(73),f=r(29);t.exports=function(t){return h.resolve(t).then(n).then(i).then(o)}},function(t,e,r){"use strict";function n(t){return l.resolve(t).then(p.present("server")).then(p.present("username")).then(p.present("walletId")).then(p.present("secretKey")).then(p.present("totpKey")).then(p.present("totpCode")).then(p.number("lockVersion"))}function i(t){return t.totpKey=u.decode(t.totpKey),t.totpKey=t.totpKey.toString("base64"),l.resolve(t)}function o(t){var e=l.pending();return f.post(t.server+"/totp/enable").type("json").send(s.pick(t,["lockVersion","totpKey","totpCode"])).use(c.signRequest(t.username,t.walletId,t.secretKey)).end(function(t,r){t?e.reject(new h.ConnectionError):"fail"===r.body.status?e.reject(h.getProtocolError(r.body.code)):e.resolve(s.pick(r.body,"newLockVersion"))}),e.promise}var s=r(10),u=r(32),a=r(12),c=r(5),h=r(2),l=r(23),f=r(73),p=r(29);t.exports=function(t){return l.resolve(t).then(a.totpCodeToString).then(n).then(i).then(o)}},function(t,e,r){"use strict";function n(t){return u.resolve(t).then(c.present("server")).then(c.present("walletId")).then(c.present("username")).then(c.present("secretKey"))}function i(t){var e=u.pending();return a.post(t.server+"/wallets/get_lock_version").type("json").send({username:t.username}).use(o.signRequest(t.username,t.walletId,t.secretKey)).end(function(t,r){t?e.reject(new s.ConnectionError):"fail"===r.body.status?e.reject(s.getProtocolError(r.body.code)):e.resolve(r.body.lockVersion)}),e.promise}var o=(r(10),r(5)),s=r(2),u=r(23),a=r(73),c=r(29);t.exports=functio