@reachfive/identity-ui 1.18.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/identity-ui.js CHANGED
@@ -8,11 +8,13 @@ import styled, { keyframes, css } from 'styled-components';
8
8
  import { Transition } from 'react-transition-group';
9
9
  import classes from 'classnames';
10
10
  import { Remarkable } from 'remarkable';
11
- import validator, { isISO8601, isNumeric } from 'validator';
11
+ import validator, { isNumeric, isISO8601 } from 'validator';
12
12
  import { isValidNumber, AsYouType, format as format$1, parse } from 'libphonenumber-js';
13
13
  import { isEqual } from 'lodash-es';
14
+ import { DateTime } from 'luxon';
14
15
  import { isLower, isUpper, isDigit } from 'char-info';
15
16
  import zxcvbn from '@reachfive/zxcvbn';
17
+ import 'Buffer';
16
18
 
17
19
  function ownKeys(object, enumerableOnly) {
18
20
  var keys = Object.keys(object);
@@ -2816,7 +2818,13 @@ var UserError = /*#__PURE__*/function (_Error) {
2816
2818
  _this.isUserError = true;
2817
2819
  return _this;
2818
2820
  }
2819
- return _createClass(UserError);
2821
+ _createClass(UserError, null, [{
2822
+ key: "fromAppError",
2823
+ value: function fromAppError(appError) {
2824
+ return new UserError(appError.errorUserMsg || appError.errorDescription || appError.error);
2825
+ }
2826
+ }]);
2827
+ return UserError;
2820
2828
  }( /*#__PURE__*/_wrapNativeSuper(Error));
2821
2829
 
2822
2830
  /** `Object#toString` result references. */
@@ -3399,6 +3407,7 @@ function get(object, path, defaultValue) {
3399
3407
  return result === undefined ? defaultValue : result;
3400
3408
  }
3401
3409
 
3410
+ /* eslint-disable @typescript-eslint/no-unused-vars */
3402
3411
  var white = '#fff';
3403
3412
  var gray200 = '#e9ecef';
3404
3413
  var gray400 = '#ced4da';
@@ -3406,6 +3415,8 @@ var gray500 = '#adb5bd';
3406
3415
  var gray600 = '#868e96';
3407
3416
  var gray700 = '#495057';
3408
3417
  var gray900 = '#212529';
3418
+ /* eslint-enable @typescript-eslint/no-unused-vars */
3419
+
3409
3420
  var inputBtnFocusBoxShadow = function inputBtnFocusBoxShadow(borderColor) {
3410
3421
  return "0 0 0 3px ".concat(transparentize(0.5, borderColor));
3411
3422
  };
@@ -3796,7 +3807,7 @@ var WidgetContent = styled(function (_ref) {
3796
3807
  }, function (props) {
3797
3808
  return props.standalone && "\n padding: ".concat(props.theme.get('spacing') * 2, "px;\n border-radius: ").concat(props.theme.get('borderRadius'), "px;\n background-color: ").concat(props.theme.get('backgroundColor'), ";\n max-width: ").concat(props.theme.get('maxWidth'), "px;\n box-sizing: border-box;\n margin: 0 auto;\n ");
3798
3809
  });
3799
- var WidgetContainer = (function (_ref2) {
3810
+ function widgetContainer(_ref2) {
3800
3811
  var name = _ref2.name,
3801
3812
  _ref2$standalone = _ref2.standalone,
3802
3813
  standalone = _ref2$standalone === void 0 ? true : _ref2$standalone,
@@ -3818,7 +3829,7 @@ var WidgetContainer = (function (_ref2) {
3818
3829
  transition: state
3819
3830
  }, title && /*#__PURE__*/React__default.createElement(Heading, null, title), !noIntro && intro && /*#__PURE__*/React__default.createElement(Intro, null, intro), children);
3820
3831
  });
3821
- });
3832
+ }
3822
3833
 
3823
3834
  var _excluded = ["component", "prepare"],
3824
3835
  _excluded2 = ["i18n", "theme"],
@@ -3851,7 +3862,7 @@ function createWidget(_ref) {
3851
3862
  i18n: resolveI18n(context.defaultI18n, i18n),
3852
3863
  theme: resolveTheme(theme)
3853
3864
  });
3854
- return /*#__PURE__*/React__default.createElement(WidgetContainer, _extends({}, widgetAttrs, fullProps), /*#__PURE__*/React__default.createElement(Component, fullProps));
3865
+ return /*#__PURE__*/React__default.createElement(widgetContainer, _extends({}, widgetAttrs, fullProps), /*#__PURE__*/React__default.createElement(Component, fullProps));
3855
3866
  });
3856
3867
  };
3857
3868
  }
@@ -3873,11 +3884,11 @@ function multiViewWidget(_ref3) {
3873
3884
  onStartup = _ref3.onStartup,
3874
3885
  handlers = _ref3.handlers;
3875
3886
  return _class = /*#__PURE__*/function (_React$Component) {
3876
- _inherits(_class, _React$Component);
3877
- var _super = _createSuper(_class);
3878
- function _class() {
3887
+ _inherits(MultiViewWidget, _React$Component);
3888
+ var _super = _createSuper(MultiViewWidget);
3889
+ function MultiViewWidget() {
3879
3890
  var _this;
3880
- _classCallCheck(this, _class);
3891
+ _classCallCheck(this, MultiViewWidget);
3881
3892
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3882
3893
  args[_key] = arguments[_key];
3883
3894
  }
@@ -3895,7 +3906,7 @@ function multiViewWidget(_ref3) {
3895
3906
  });
3896
3907
  return _this;
3897
3908
  }
3898
- _createClass(_class, [{
3909
+ _createClass(MultiViewWidget, [{
3899
3910
  key: "getChildContext",
3900
3911
  value: function getChildContext() {
3901
3912
  return {
@@ -3917,7 +3928,7 @@ function multiViewWidget(_ref3) {
3917
3928
  }));
3918
3929
  }
3919
3930
  }]);
3920
- return _class;
3931
+ return MultiViewWidget;
3921
3932
  }(React__default.Component), _defineProperty(_class, "childContextTypes", {
3922
3933
  goTo: PropTypes.func.isRequired
3923
3934
  }), _class;
@@ -4117,7 +4128,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
4117
4128
  }
4118
4129
 
4119
4130
  /** Built-in value references. */
4120
- var Uint8Array$1 = root.Uint8Array;
4131
+ var Uint8Array = root.Uint8Array;
4121
4132
 
4122
4133
  /**
4123
4134
  * Converts `map` to its key-value pairs.
@@ -4182,7 +4193,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
4182
4193
  object = object.buffer;
4183
4194
  other = other.buffer;
4184
4195
  case arrayBufferTag:
4185
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
4196
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
4186
4197
  return false;
4187
4198
  }
4188
4199
  return true;
@@ -6226,103 +6237,116 @@ var microsoft = {
6226
6237
  icon: icon$a
6227
6238
  };
6228
6239
 
6229
- var icon$b = "data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%201500%20750%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M%20145.507812%20616.734375%20C%2093.640625%20616.734375%2051.414062%20574.609375%2051.414062%20520.867188%20C%2051.414062%20467.121094%2093.640625%20424.894531%20145.507812%20424.894531%20C%20197.03125%20424.894531%20239.46875%20467.121094%20239.46875%20520.867188%20C%20239.46875%20574.609375%20197.03125%20616.734375%20145.507812%20616.734375%20M%20145.507812%20375.074219%20C%2063.894531%20375.074219%200%20439.054688%200%20520.867188%20C%200%20602.574219%2063.894531%20666.65625%20145.507812%20666.65625%20C%20226.910156%20666.65625%20290.804688%20602.574219%20290.804688%20520.867188%20C%20290.804688%20439.054688%20226.910156%20375.074219%20145.507812%20375.074219%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%20893.976562%20517.019531%20C%20893.496094%20438.929688%20830.347656%20375.402344%20753.089844%20375.402344%20C%20673.589844%20375.402344%20611.269531%20439.15625%20611.269531%20520.511719%20C%20611.269531%20558.714844%20625.914062%20594.980469%20652.265625%20622.667969%20C%20679.09375%20650.6875%20714.476562%20666.128906%20752.128906%20666.128906%20C%20795.101562%20666.128906%20855.308594%20645.53125%20883.929688%20587.082031%20L%20884.679688%20585.195312%20L%20827.0625%20585.195312%20L%20826.714844%20585.625%20C%20811.242188%20604.109375%20782.035156%20616.582031%20754.214844%20616.582031%20C%20718.886719%20616.582031%20676.503906%20593.320312%20664.90625%20540.808594%20L%20892.855469%20540.808594%20C%20893.363281%20535.375%20893.976562%20524.511719%20893.976562%20517.019531%20M%20666.589844%20494.433594%20C%20673.589844%20459.25%20707.316406%20424.894531%20752.664062%20424.894531%20C%20797.933594%20424.894531%20831.632812%20459.25%20838.554688%20494.433594%20Z%20M%20666.589844%20494.433594%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%20451.410156%20423.234375%20C%20400.050781%20423.234375%20373.941406%20450.722656%20373.941406%20505.148438%20L%20373.941406%20666.253906%20L%20321.1875%20666.253906%20L%20321.1875%20501.351562%20C%20321.695312%20472.453125%20326.828125%20452.007812%20338.640625%20432.816406%20C%20352.613281%20411.265625%20385.804688%20375%20451.410156%20375%20C%20516.855469%20375%20550.15625%20411.265625%20564.105469%20432.816406%20C%20575.808594%20452.007812%20581.101562%20472.453125%20581.421875%20501.351562%20L%20581.421875%20666.253906%20L%20528.722656%20666.253906%20L%20528.722656%20505.148438%20C%20528.722656%20450.722656%20502.773438%20423.234375%20451.410156%20423.234375%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%201168.1875%20375.074219%20L%201057.015625%20645.933594%20L%201029.546875%20712.957031%20L%201014.367188%20750%20L%20959.53125%20750%20L%201002.074219%20645.984375%20L%20888.445312%20375.074219%20L%20946.382812%20375.074219%20L%201029.570312%20578.734375%20L%201112.921875%20375.074219%20Z%20M%201168.1875%20375.074219%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6240
+ var icon$b = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20width%3D%22800px%22%20height%3D%22800px%22%20viewBox%3D%220%200%20512%20512%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M9%2032V480H181.366V255.862L331.358%20480H504V32H331.358V255.862L181.366%2032H9Z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E";
6241
+
6242
+ var naver = {
6243
+ key: 'naver',
6244
+ name: 'Naver',
6245
+ color: '#19CE60',
6246
+ icon: icon$b,
6247
+ windowSize: {
6248
+ width: 450,
6249
+ height: 400
6250
+ }
6251
+ };
6252
+
6253
+ var icon$c = "data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%201500%20750%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M%20145.507812%20616.734375%20C%2093.640625%20616.734375%2051.414062%20574.609375%2051.414062%20520.867188%20C%2051.414062%20467.121094%2093.640625%20424.894531%20145.507812%20424.894531%20C%20197.03125%20424.894531%20239.46875%20467.121094%20239.46875%20520.867188%20C%20239.46875%20574.609375%20197.03125%20616.734375%20145.507812%20616.734375%20M%20145.507812%20375.074219%20C%2063.894531%20375.074219%200%20439.054688%200%20520.867188%20C%200%20602.574219%2063.894531%20666.65625%20145.507812%20666.65625%20C%20226.910156%20666.65625%20290.804688%20602.574219%20290.804688%20520.867188%20C%20290.804688%20439.054688%20226.910156%20375.074219%20145.507812%20375.074219%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%20893.976562%20517.019531%20C%20893.496094%20438.929688%20830.347656%20375.402344%20753.089844%20375.402344%20C%20673.589844%20375.402344%20611.269531%20439.15625%20611.269531%20520.511719%20C%20611.269531%20558.714844%20625.914062%20594.980469%20652.265625%20622.667969%20C%20679.09375%20650.6875%20714.476562%20666.128906%20752.128906%20666.128906%20C%20795.101562%20666.128906%20855.308594%20645.53125%20883.929688%20587.082031%20L%20884.679688%20585.195312%20L%20827.0625%20585.195312%20L%20826.714844%20585.625%20C%20811.242188%20604.109375%20782.035156%20616.582031%20754.214844%20616.582031%20C%20718.886719%20616.582031%20676.503906%20593.320312%20664.90625%20540.808594%20L%20892.855469%20540.808594%20C%20893.363281%20535.375%20893.976562%20524.511719%20893.976562%20517.019531%20M%20666.589844%20494.433594%20C%20673.589844%20459.25%20707.316406%20424.894531%20752.664062%20424.894531%20C%20797.933594%20424.894531%20831.632812%20459.25%20838.554688%20494.433594%20Z%20M%20666.589844%20494.433594%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%20451.410156%20423.234375%20C%20400.050781%20423.234375%20373.941406%20450.722656%20373.941406%20505.148438%20L%20373.941406%20666.253906%20L%20321.1875%20666.253906%20L%20321.1875%20501.351562%20C%20321.695312%20472.453125%20326.828125%20452.007812%20338.640625%20432.816406%20C%20352.613281%20411.265625%20385.804688%20375%20451.410156%20375%20C%20516.855469%20375%20550.15625%20411.265625%20564.105469%20432.816406%20C%20575.808594%20452.007812%20581.101562%20472.453125%20581.421875%20501.351562%20L%20581.421875%20666.253906%20L%20528.722656%20666.253906%20L%20528.722656%20505.148438%20C%20528.722656%20450.722656%20502.773438%20423.234375%20451.410156%20423.234375%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%201168.1875%20375.074219%20L%201057.015625%20645.933594%20L%201029.546875%20712.957031%20L%201014.367188%20750%20L%20959.53125%20750%20L%201002.074219%20645.984375%20L%20888.445312%20375.074219%20L%20946.382812%20375.074219%20L%201029.570312%20578.734375%20L%201112.921875%20375.074219%20Z%20M%201168.1875%20375.074219%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6230
6254
 
6231
6255
  var oney = {
6232
6256
  key: 'oney',
6233
6257
  name: 'Oney',
6234
6258
  color: '#8bbc06',
6235
- icon: icon$b
6259
+ icon: icon$c
6236
6260
  };
6237
6261
 
6238
- var icon$c = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%22350%22%20height%3D%22350%22%3E%20%20%20%20%3Cpath%20id%3D%22background%22%20style%3D%22fill%3A%20rgb%28255%2C%20255%2C%20255%29%3B%22%20d%3D%22M%20350%2C350%200%2C350%200%2C0%20l%20350%2C0%200%2C350%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_o%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%2043.07789%2C321.77478%20c%20-12.673527%2C0%20-24.106883%2C-8.06959%20-24.106883%2C-25.70382%200%2C-17.63421%2011.433356%2C-25.7038%2024.106883%2C-25.7038%2012.673527%2C0%2024.089894%2C8.06959%2024.089894%2C25.7038%200%2C17.63422%20-11.416367%2C25.70382%20-24.089894%2C25.70382%20m%200%2C-40.56887%20c%20-9.581594%2C0%20-11.331424%2C8.63023%20-11.331424%2C14.86505%200%2C6.23485%201.74983%2C14.88207%2011.331424%2C14.88207%209.581594%2C0%2011.331424%2C-8.64722%2011.331424%2C-14.88207%200%2C-6.23482%20-1.74983%2C-14.86505%20-11.331424%2C-14.86505%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_r%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%2075.959576%2C271.65166%2012.197845%2C0%200%2C5.72518%20c%202.327444%2C-3.09194%208.052616%2C-6.72751%2013.421029%2C-6.72751%200.50966%2C0%201.13824%2C0%201.66489%2C0.068%20l%200%2C12.04495%20-0.62858%2C0%20c%20-5.572279%2C0%20-11.671202%2C0.86642%20-13.641884%2C5.19853%20l%200%2C32.39734%20-13.0133%2C0%200%2C-48.70644%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_a%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20137.30386%2C316.11774%20c%20-4.96068%2C3.26181%20-10.32909%2C4.84176%20-16.10523%2C4.84176%20-9.08892%2C0%20-14.47432%2C-6.04795%20-14.47432%2C-14.16853%200%2C-10.9067%2010.0233%2C-16.66585%2030.68149%2C-18.9933%20l%200%2C-2.71819%20c%200%2C-3.53364%20-2.68421%2C-5.60624%20-7.64489%2C-5.60624%20-4.96069%2C0%20-8.98699%2C1.97068%20-11.89205%2C5.60624%20l%20-8.64722%2C-4.9267%20c%204.53597%2C-6.35375%2011.45034%2C-9.53062%2020.74313%2C-9.53062%2012.70751%2C0%2019.84274%2C5.50432%2019.84274%2C14.45732%200%2C0%20-0.017%2C35.21747%200%2C35.3024%20l%20-11.36541%2C0%20-1.13824%2C-4.26414%20z%20m%20-17.95699%2C-10.26115%20c%200%2C3.27881%202.05563%2C6.33676%205.77614%2C6.33676%204.02631%2C0%207.95068%2C-1.66487%2011.87506%2C-5.13056%20l%200%2C-11.53528%20c%20-11.97699%2C1.47801%20-17.6512%2C4.56993%20-17.6512%2C10.32909%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_n%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20159.93783%2C272.9496%2010.6179%2C-1.46103%201.17222%2C5.77615%20c%205.98%2C-4.38307%2010.73682%2C-6.71052%2016.71682%2C-6.71052%2010.0233%2C0%2015.20483%2C5.31745%2015.20483%2C15.85039%20l%200%2C33.90934%20-12.82642%2C0%200%2C-31.68381%20c%200%2C-5.96302%20-1.54596%2C-8.64723%20-6.18386%2C-8.64723%20-3.82245%2C0%20-7.64489%2C1.73284%20-12.01097%2C5.4024%20l%200%2C34.92864%20-12.69052%2C0%200%2C-47.36433%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_g%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20235.02253%2C309.88953%20c%209.7175%2C-0.0679%2010.54995%2C-9.97234%2010.54995%2C-16.41103%200%2C-7.64489%20-3.72052%2C-13.81176%20-10.63489%2C-13.81176%20-4.60393%2C0%20-9.75148%2C3.36374%20-9.75148%2C14.33841%200%2C5.99699%200.42471%2C15.96931%209.83642%2C15.88438%20m%2022.86671%2C-38.41132%200%2C46.12416%20c%200%2C8.12057%20-0.64557%2C21.55859%20-23.83506%2C21.67751%20-9.5816%2C0.068%20-18.46666%2C-3.77148%20-20.23348%2C-12.12989%20l%2012.63955%2C-2.03864%20c%200.52665%2C2.3954%202.00466%2C4.77381%209.17387%2C4.77381%206.64256%2C0%209.83642%2C-3.17687%209.83642%2C-10.78779%20l%200%2C-5.6742%20-0.16988%2C-0.16989%20c%20-2.03864%2C3.65256%20-5.13057%2C7.10125%20-12.5716%2C7.10125%20-11.3654%2C0%20-20.30142%2C-7.88273%20-20.30142%2C-24.34472%200%2C-16.29211%209.22483%2C-25.41501%2019.57091%2C-25.432%209.73449%2C-0.017%2013.3191%2C4.41705%2014.16853%2C6.74449%20l%20-0.16989%2C-0.017%201.07029%2C-5.8271%2010.82176%2C0%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_e%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20288.54015%2C321.24644%20c%20-14.3554%2C0%20-22.91768%2C-9.24183%20-22.91768%2C-25.26212%200%2C-16.20717%208.66421%2C-25.432%2022.71382%2C-25.432%2014.0496%2C0%2022.40802%2C8.95302%2022.40802%2C24.78643%200%2C0.84943%20-0.10194%2C1.68188%20-0.10194%2C2.51432%20l%20-32.43131%2C0%20c%200.0849%2C9.24182%203.92437%2C13.89671%2011.46733%2C13.89671%204.84176%2C0%208.05262%2C-1.95369%2011.0596%2C-6.23483%20l%209.37774%2C5.19852%20c%20-4.12824%2C6.91438%20-11.56927%2C10.53296%20-21.57558%2C10.53296%20m%209.61557%2C-31.70081%20c%200%2C-6.50665%20-3.7375%2C-10.34608%20-9.81943%2C-10.34608%20-5.79313%2C0%20-9.41171%2C3.75449%20-9.92137%2C10.34608%20l%2019.7408%2C0%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_TM%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20332.69028%2C253.16977%20-4.72284%2C12.21483%20-4.80779%2C-12.21483%20-4.11125%2C0%200%2C16.10523%202.66722%2C0%200%2C-13.43801%200.0679%2C0%205.28347%2C13.43801%201.69886%2C0%205.24949%2C-13.43801%200.0849%2C0%200%2C13.43801%202.65023%2C0%200%2C-16.10523%20-4.06029%2C0%20z%20m%20-29.64518%2C0%200%2C2.14057%205.02864%2C0%200%2C13.96466%202.66721%2C0%200%2C-13.96466%205.04563%2C0%200%2C-2.14057%20-12.74148%2C0%20z%22%2F%3E%3C%2Fsvg%3E";
6262
+ var icon$d = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%22350%22%20height%3D%22350%22%3E%20%20%20%20%3Cpath%20id%3D%22background%22%20style%3D%22fill%3A%20rgb%28255%2C%20255%2C%20255%29%3B%22%20d%3D%22M%20350%2C350%200%2C350%200%2C0%20l%20350%2C0%200%2C350%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_o%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%2043.07789%2C321.77478%20c%20-12.673527%2C0%20-24.106883%2C-8.06959%20-24.106883%2C-25.70382%200%2C-17.63421%2011.433356%2C-25.7038%2024.106883%2C-25.7038%2012.673527%2C0%2024.089894%2C8.06959%2024.089894%2C25.7038%200%2C17.63422%20-11.416367%2C25.70382%20-24.089894%2C25.70382%20m%200%2C-40.56887%20c%20-9.581594%2C0%20-11.331424%2C8.63023%20-11.331424%2C14.86505%200%2C6.23485%201.74983%2C14.88207%2011.331424%2C14.88207%209.581594%2C0%2011.331424%2C-8.64722%2011.331424%2C-14.88207%200%2C-6.23482%20-1.74983%2C-14.86505%20-11.331424%2C-14.86505%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_r%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%2075.959576%2C271.65166%2012.197845%2C0%200%2C5.72518%20c%202.327444%2C-3.09194%208.052616%2C-6.72751%2013.421029%2C-6.72751%200.50966%2C0%201.13824%2C0%201.66489%2C0.068%20l%200%2C12.04495%20-0.62858%2C0%20c%20-5.572279%2C0%20-11.671202%2C0.86642%20-13.641884%2C5.19853%20l%200%2C32.39734%20-13.0133%2C0%200%2C-48.70644%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_a%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20137.30386%2C316.11774%20c%20-4.96068%2C3.26181%20-10.32909%2C4.84176%20-16.10523%2C4.84176%20-9.08892%2C0%20-14.47432%2C-6.04795%20-14.47432%2C-14.16853%200%2C-10.9067%2010.0233%2C-16.66585%2030.68149%2C-18.9933%20l%200%2C-2.71819%20c%200%2C-3.53364%20-2.68421%2C-5.60624%20-7.64489%2C-5.60624%20-4.96069%2C0%20-8.98699%2C1.97068%20-11.89205%2C5.60624%20l%20-8.64722%2C-4.9267%20c%204.53597%2C-6.35375%2011.45034%2C-9.53062%2020.74313%2C-9.53062%2012.70751%2C0%2019.84274%2C5.50432%2019.84274%2C14.45732%200%2C0%20-0.017%2C35.21747%200%2C35.3024%20l%20-11.36541%2C0%20-1.13824%2C-4.26414%20z%20m%20-17.95699%2C-10.26115%20c%200%2C3.27881%202.05563%2C6.33676%205.77614%2C6.33676%204.02631%2C0%207.95068%2C-1.66487%2011.87506%2C-5.13056%20l%200%2C-11.53528%20c%20-11.97699%2C1.47801%20-17.6512%2C4.56993%20-17.6512%2C10.32909%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_n%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20159.93783%2C272.9496%2010.6179%2C-1.46103%201.17222%2C5.77615%20c%205.98%2C-4.38307%2010.73682%2C-6.71052%2016.71682%2C-6.71052%2010.0233%2C0%2015.20483%2C5.31745%2015.20483%2C15.85039%20l%200%2C33.90934%20-12.82642%2C0%200%2C-31.68381%20c%200%2C-5.96302%20-1.54596%2C-8.64723%20-6.18386%2C-8.64723%20-3.82245%2C0%20-7.64489%2C1.73284%20-12.01097%2C5.4024%20l%200%2C34.92864%20-12.69052%2C0%200%2C-47.36433%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_g%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20235.02253%2C309.88953%20c%209.7175%2C-0.0679%2010.54995%2C-9.97234%2010.54995%2C-16.41103%200%2C-7.64489%20-3.72052%2C-13.81176%20-10.63489%2C-13.81176%20-4.60393%2C0%20-9.75148%2C3.36374%20-9.75148%2C14.33841%200%2C5.99699%200.42471%2C15.96931%209.83642%2C15.88438%20m%2022.86671%2C-38.41132%200%2C46.12416%20c%200%2C8.12057%20-0.64557%2C21.55859%20-23.83506%2C21.67751%20-9.5816%2C0.068%20-18.46666%2C-3.77148%20-20.23348%2C-12.12989%20l%2012.63955%2C-2.03864%20c%200.52665%2C2.3954%202.00466%2C4.77381%209.17387%2C4.77381%206.64256%2C0%209.83642%2C-3.17687%209.83642%2C-10.78779%20l%200%2C-5.6742%20-0.16988%2C-0.16989%20c%20-2.03864%2C3.65256%20-5.13057%2C7.10125%20-12.5716%2C7.10125%20-11.3654%2C0%20-20.30142%2C-7.88273%20-20.30142%2C-24.34472%200%2C-16.29211%209.22483%2C-25.41501%2019.57091%2C-25.432%209.73449%2C-0.017%2013.3191%2C4.41705%2014.16853%2C6.74449%20l%20-0.16989%2C-0.017%201.07029%2C-5.8271%2010.82176%2C0%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_e%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20288.54015%2C321.24644%20c%20-14.3554%2C0%20-22.91768%2C-9.24183%20-22.91768%2C-25.26212%200%2C-16.20717%208.66421%2C-25.432%2022.71382%2C-25.432%2014.0496%2C0%2022.40802%2C8.95302%2022.40802%2C24.78643%200%2C0.84943%20-0.10194%2C1.68188%20-0.10194%2C2.51432%20l%20-32.43131%2C0%20c%200.0849%2C9.24182%203.92437%2C13.89671%2011.46733%2C13.89671%204.84176%2C0%208.05262%2C-1.95369%2011.0596%2C-6.23483%20l%209.37774%2C5.19852%20c%20-4.12824%2C6.91438%20-11.56927%2C10.53296%20-21.57558%2C10.53296%20m%209.61557%2C-31.70081%20c%200%2C-6.50665%20-3.7375%2C-10.34608%20-9.81943%2C-10.34608%20-5.79313%2C0%20-9.41171%2C3.75449%20-9.92137%2C10.34608%20l%2019.7408%2C0%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_TM%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20332.69028%2C253.16977%20-4.72284%2C12.21483%20-4.80779%2C-12.21483%20-4.11125%2C0%200%2C16.10523%202.66722%2C0%200%2C-13.43801%200.0679%2C0%205.28347%2C13.43801%201.69886%2C0%205.24949%2C-13.43801%200.0849%2C0%200%2C13.43801%202.65023%2C0%200%2C-16.10523%20-4.06029%2C0%20z%20m%20-29.64518%2C0%200%2C2.14057%205.02864%2C0%200%2C13.96466%202.66721%2C0%200%2C-13.96466%205.04563%2C0%200%2C-2.14057%20-12.74148%2C0%20z%22%2F%3E%3C%2Fsvg%3E";
6239
6263
 
6240
6264
  var orange = {
6241
6265
  key: 'orange',
6242
6266
  name: 'Orange',
6243
6267
  color: '#ff6600',
6244
- icon: icon$c,
6268
+ icon: icon$d,
6245
6269
  hidden: true
6246
6270
  };
6247
6271
 
6248
- var icon$d = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1647%20646q18%2084-4%20204-87%20444-565%20444h-44q-25%200-44%2016.5t-24%2042.5l-4%2019-55%20346-2%2015q-5%2026-24.5%2042.5t-44.5%2016.5h-251q-21%200-33-15t-9-36q9-56%2026.5-168t26.5-168%2027-167.5%2027-167.5q5-37%2043-37h131q133%202%20236-21%20175-39%20287-144%20102-95%20155-246%2024-70%2035-133%201-6%202.5-7.5t3.5-1%206%203.5q79%2059%2098%20162zm-172-282q0%20107-46%20236-80%20233-302%20315-113%2040-252%2042%200%201-90%201l-90-1q-100%200-118%2096-2%208-85%20530-1%2010-12%2010h-295q-22%200-36.5-16.5t-11.5-38.5l232-1471q5-29%2027.5-48t51.5-19h598q34%200%2097.5%2013t111.5%2032q107%2041%20163.5%20123t56.5%20196z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6272
+ var icon$e = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1647%20646q18%2084-4%20204-87%20444-565%20444h-44q-25%200-44%2016.5t-24%2042.5l-4%2019-55%20346-2%2015q-5%2026-24.5%2042.5t-44.5%2016.5h-251q-21%200-33-15t-9-36q9-56%2026.5-168t26.5-168%2027-167.5%2027-167.5q5-37%2043-37h131q133%202%20236-21%20175-39%20287-144%20102-95%20155-246%2024-70%2035-133%201-6%202.5-7.5t3.5-1%206%203.5q79%2059%2098%20162zm-172-282q0%20107-46%20236-80%20233-302%20315-113%2040-252%2042%200%201-90%201l-90-1q-100%200-118%2096-2%208-85%20530-1%2010-12%2010h-295q-22%200-36.5-16.5t-11.5-38.5l232-1471q5-29%2027.5-48t51.5-19h598q34%200%2097.5%2013t111.5%2032q107%2041%20163.5%20123t56.5%20196z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6249
6273
 
6250
6274
  var paypal = {
6251
6275
  key: 'paypal',
6252
6276
  name: 'PayPal',
6253
6277
  color: '#003087',
6254
- icon: icon$d
6278
+ icon: icon$e
6255
6279
  };
6256
6280
 
6257
- var icon$e = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M270%20806q-8-19-8-52%200-20%2011-49t24-45q-1-22%207.5-53t22.5-43q0-139%2092.5-288.5t217.5-209.5q139-66%20324-66%20133%200%20266%2055%2049%2021%2090%2048t71%2056%2055%2068%2042%2074%2032.5%2084.5%2025.5%2089.5%2022%2098l1%205q55%2083%2055%20150%200%2014-9%2040t-9%2038q0%201%201.5%203.5t3.5%205%202%203.5q77%20114%20120.5%20214.5t43.5%20208.5q0%2043-19.5%20100t-55.5%2057q-9%200-19.5-7.5t-19-17.5-19-26-16-26.5-13.5-26-9-17.5q-1-1-3-1l-5%204q-59%20154-132%20223%2020%2020%2061.5%2038.5t69%2041.5%2035.5%2065q-2%204-4%2016t-7%2018q-64%2097-302%2097-53%200-110.5-9t-98-20-104.5-30q-15-5-23-7-14-4-46-4.5t-40-1.5q-41%2045-127.5%2065t-168.5%2020q-35%200-69-1.5t-93-9-101-20.5-74.5-40-32.5-64q0-40%2010-59.5t41-48.5q11-2%2040.5-13t49.5-12q4%200%2014-2%202-2%202-4l-2-3q-48-11-108-105.5t-73-156.5l-5-3q-4%200-12%2020-18%2041-54.5%2074.5t-77.5%2037.5h-1q-4%200-6-4.5t-5-5.5q-23-54-23-100%200-275%20252-466z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6281
+ var icon$f = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M270%20806q-8-19-8-52%200-20%2011-49t24-45q-1-22%207.5-53t22.5-43q0-139%2092.5-288.5t217.5-209.5q139-66%20324-66%20133%200%20266%2055%2049%2021%2090%2048t71%2056%2055%2068%2042%2074%2032.5%2084.5%2025.5%2089.5%2022%2098l1%205q55%2083%2055%20150%200%2014-9%2040t-9%2038q0%201%201.5%203.5t3.5%205%202%203.5q77%20114%20120.5%20214.5t43.5%20208.5q0%2043-19.5%20100t-55.5%2057q-9%200-19.5-7.5t-19-17.5-19-26-16-26.5-13.5-26-9-17.5q-1-1-3-1l-5%204q-59%20154-132%20223%2020%2020%2061.5%2038.5t69%2041.5%2035.5%2065q-2%204-4%2016t-7%2018q-64%2097-302%2097-53%200-110.5-9t-98-20-104.5-30q-15-5-23-7-14-4-46-4.5t-40-1.5q-41%2045-127.5%2065t-168.5%2020q-35%200-69-1.5t-93-9-101-20.5-74.5-40-32.5-64q0-40%2010-59.5t41-48.5q11-2%2040.5-13t49.5-12q4%200%2014-2%202-2%202-4l-2-3q-48-11-108-105.5t-73-156.5l-5-3q-4%200-12%2020-18%2041-54.5%2074.5t-77.5%2037.5h-1q-4%200-6-4.5t-5-5.5q-23-54-23-100%200-275%20252-466z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6258
6282
 
6259
6283
  var qq = {
6260
6284
  key: 'qq',
6261
6285
  name: 'QQ',
6262
6286
  color: '#0071c3',
6263
- icon: icon$e,
6287
+ icon: icon$f,
6264
6288
  windowSize: {
6265
6289
  width: 450,
6266
6290
  height: 400
6267
6291
  }
6268
6292
  };
6269
6293
 
6270
- var icon$f = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1684%20408q-67%2098-162%20167%201%2014%201%2042%200%20130-38%20259.5t-115.5%20248.5-184.5%20210.5-258%20146-323%2054.5q-271%200-496-145%2035%204%2078%204%20225%200%20401-138-105-2-188-64.5t-114-159.5q33%205%2061%205%2043%200%2085-11-112-23-185.5-111.5t-73.5-205.5v-4q68%2038%20146%2041-66-44-105-115t-39-154q0-88%2044-163%20121%20149%20294.5%20238.5t371.5%2099.5q-8-38-8-74%200-134%2094.5-228.5t228.5-94.5q140%200%20236%20102%20109-21%20205-78-37%20115-142%20178%2093-10%20186-50z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6294
+ var icon$g = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1684%20408q-67%2098-162%20167%201%2014%201%2042%200%20130-38%20259.5t-115.5%20248.5-184.5%20210.5-258%20146-323%2054.5q-271%200-496-145%2035%204%2078%204%20225%200%20401-138-105-2-188-64.5t-114-159.5q33%205%2061%205%2043%200%2085-11-112-23-185.5-111.5t-73.5-205.5v-4q68%2038%20146%2041-66-44-105-115t-39-154q0-88%2044-163%20121%20149%20294.5%20238.5t371.5%2099.5q-8-38-8-74%200-134%2094.5-228.5t228.5-94.5q140%200%20236%20102%20109-21%20205-78-37%20115-142%20178%2093-10%20186-50z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6271
6295
 
6272
6296
  var twitter = {
6273
6297
  key: 'twitter',
6274
6298
  name: 'Twitter',
6275
6299
  color: '#55acee',
6276
- icon: icon$f,
6300
+ icon: icon$g,
6277
6301
  windowSize: {
6278
6302
  width: 800,
6279
6303
  height: 440
6280
6304
  }
6281
6305
  };
6282
6306
 
6283
- var icon$g = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1853%20520q23%2064-150%20294-24%2032-65%2085-78%20100-90%20131-17%2041%2014%2081%2017%2021%2081%2082h1l1%201%201%201%202%202q141%20131%20191%20221%203%205%206.5%2012.5t7%2026.5-.5%2034-25%2027.5-59%2012.5l-256%204q-24%205-56-5t-52-22l-20-12q-30-21-70-64t-68.5-77.5-61-58-56.5-15.5q-3%201-8%203.5t-17%2014.5-21.5%2029.5-17%2052-6.5%2077.5q0%2015-3.5%2027.5t-7.5%2018.5l-4%205q-18%2019-53%2022h-115q-71%204-146-16.5t-131.5-53-103-66-70.5-57.5l-25-24q-10-10-27.5-30t-71.5-91-106-151-122.5-211-130.5-272q-6-16-6-27t3-16l4-6q15-19%2057-19l274-2q12%202%2023%206.5t16%208.5l5%203q16%2011%2024%2032%2020%2050%2046%20103.5t41%2081.5l16%2029q29%2060%2056%20104t48.5%2068.5%2041.5%2038.5%2034%2014%2027-5q2-1%205-5t12-22%2013.5-47%209.5-81%200-125q-2-40-9-73t-14-46l-6-12q-25-34-85-43-13-2%205-24%2017-19%2038-30%2053-26%20239-24%2082%201%20135%2013%2020%205%2033.5%2013.5t20.5%2024%2010.5%2032%203.5%2045.5-1%2055-2.5%2070.5-1.5%2082.5q0%2011-1%2042t-.5%2048%203.5%2040.5%2011.5%2039%2022.5%2024.5q8%202%2017%204t26-11%2038-34.5%2052-67%2068-107.5q60-104%20107-225%204-10%2010-17.5t11-10.5l4-3%205-2.5%2013-3%2020-.5%20288-2q39-5%2064%202.5t31%2016.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6307
+ var icon$h = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1853%20520q23%2064-150%20294-24%2032-65%2085-78%20100-90%20131-17%2041%2014%2081%2017%2021%2081%2082h1l1%201%201%201%202%202q141%20131%20191%20221%203%205%206.5%2012.5t7%2026.5-.5%2034-25%2027.5-59%2012.5l-256%204q-24%205-56-5t-52-22l-20-12q-30-21-70-64t-68.5-77.5-61-58-56.5-15.5q-3%201-8%203.5t-17%2014.5-21.5%2029.5-17%2052-6.5%2077.5q0%2015-3.5%2027.5t-7.5%2018.5l-4%205q-18%2019-53%2022h-115q-71%204-146-16.5t-131.5-53-103-66-70.5-57.5l-25-24q-10-10-27.5-30t-71.5-91-106-151-122.5-211-130.5-272q-6-16-6-27t3-16l4-6q15-19%2057-19l274-2q12%202%2023%206.5t16%208.5l5%203q16%2011%2024%2032%2020%2050%2046%20103.5t41%2081.5l16%2029q29%2060%2056%20104t48.5%2068.5%2041.5%2038.5%2034%2014%2027-5q2-1%205-5t12-22%2013.5-47%209.5-81%200-125q-2-40-9-73t-14-46l-6-12q-25-34-85-43-13-2%205-24%2017-19%2038-30%2053-26%20239-24%2082%201%20135%2013%2020%205%2033.5%2013.5t20.5%2024%2010.5%2032%203.5%2045.5-1%2055-2.5%2070.5-1.5%2082.5q0%2011-1%2042t-.5%2048%203.5%2040.5%2011.5%2039%2022.5%2024.5q8%202%2017%204t26-11%2038-34.5%2052-67%2068-107.5q60-104%20107-225%204-10%2010-17.5t11-10.5l4-3%205-2.5%2013-3%2020-.5%20288-2q39-5%2064%202.5t31%2016.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6284
6308
 
6285
6309
  var vkontakte = {
6286
6310
  key: 'vkontakte',
6287
6311
  fontKey: 'vk',
6288
6312
  name: 'VKontakte',
6289
6313
  color: '#45668e',
6290
- icon: icon$g,
6314
+ icon: icon$h,
6291
6315
  windowSize: {
6292
6316
  width: 655,
6293
6317
  height: 430
6294
6318
  }
6295
6319
  };
6296
6320
 
6297
- var icon$h = "data:image/svg+xml,%3Csvg%20width%3D%222048%22%20height%3D%221792%22%20viewBox%3D%220%200%202048%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M580%20461q0-41-25-66t-66-25q-43%200-76%2025.5t-33%2065.5q0%2039%2033%2064.5t76%2025.5q41%200%2066-24.5t25-65.5zm743%20507q0-28-25.5-50t-65.5-22q-27%200-49.5%2022.5t-22.5%2049.5q0%2028%2022.5%2050.5t49.5%2022.5q40%200%2065.5-22t25.5-51zm-236-507q0-41-24.5-66t-65.5-25q-43%200-76%2025.5t-33%2065.5q0%2039%2033%2064.5t76%2025.5q41%200%2065.5-24.5t24.5-65.5zm635%20507q0-28-26-50t-65-22q-27%200-49.5%2022.5t-22.5%2049.5q0%2028%2022.5%2050.5t49.5%2022.5q39%200%2065-22t26-51zm-266-397q-31-4-70-4-169%200-311%2077t-223.5%20208.5-81.5%20287.5q0%2078%2023%20152-35%203-68%203-26%200-50-1.5t-55-6.5-44.5-7-54.5-10.5-50-10.5l-253%20127%2072-218q-290-203-290-490%200-169%2097.5-311t264-223.5%20363.5-81.5q176%200%20332.5%2066t262%20182.5%20136.5%20260.5zm592%20561q0%20117-68.5%20223.5t-185.5%20193.5l55%20181-199-109q-150%2037-218%2037-169%200-311-70.5t-223.5-191.5-81.5-264%2081.5-264%20223.5-191.5%20311-70.5q161%200%20303%2070.5t227.5%20192%2085.5%20263.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6321
+ var icon$i = "data:image/svg+xml,%3Csvg%20width%3D%222048%22%20height%3D%221792%22%20viewBox%3D%220%200%202048%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M580%20461q0-41-25-66t-66-25q-43%200-76%2025.5t-33%2065.5q0%2039%2033%2064.5t76%2025.5q41%200%2066-24.5t25-65.5zm743%20507q0-28-25.5-50t-65.5-22q-27%200-49.5%2022.5t-22.5%2049.5q0%2028%2022.5%2050.5t49.5%2022.5q40%200%2065.5-22t25.5-51zm-236-507q0-41-24.5-66t-65.5-25q-43%200-76%2025.5t-33%2065.5q0%2039%2033%2064.5t76%2025.5q41%200%2065.5-24.5t24.5-65.5zm635%20507q0-28-26-50t-65-22q-27%200-49.5%2022.5t-22.5%2049.5q0%2028%2022.5%2050.5t49.5%2022.5q39%200%2065-22t26-51zm-266-397q-31-4-70-4-169%200-311%2077t-223.5%20208.5-81.5%20287.5q0%2078%2023%20152-35%203-68%203-26%200-50-1.5t-55-6.5-44.5-7-54.5-10.5-50-10.5l-253%20127%2072-218q-290-203-290-490%200-169%2097.5-311t264-223.5%20363.5-81.5q176%200%20332.5%2066t262%20182.5%20136.5%20260.5zm592%20561q0%20117-68.5%20223.5t-185.5%20193.5l55%20181-199-109q-150%2037-218%2037-169%200-311-70.5t-223.5-191.5-81.5-264%2081.5-264%20223.5-191.5%20311-70.5q161%200%20303%2070.5t227.5%20192%2085.5%20263.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6298
6322
 
6299
6323
  var wechat = {
6300
6324
  key: 'wechat',
6301
6325
  name: 'WeChat',
6302
6326
  color: '#44b549',
6303
- icon: icon$h,
6327
+ icon: icon$i,
6304
6328
  windowSize: {
6305
6329
  width: 450,
6306
6330
  height: 400
6307
6331
  }
6308
6332
  };
6309
6333
 
6310
- var icon$i = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M675%201284q21-34%2011-69t-45-50q-34-14-73-1t-60%2046q-22%2034-13%2068.5t43%2050.5%2074.5%202.5%2062.5-47.5zm94-121q8-13%203.5-26.5t-17.5-18.5q-14-5-28.5.5t-21.5%2018.5q-17%2031%2013%2045%2014%205%2029-.5t22-18.5zm174%20107q-45%20102-158%20150t-224%2012q-107-34-147.5-126.5t6.5-187.5q47-93%20151.5-139t210.5-19q111%2029%20158.5%20119.5t2.5%20190.5zm312-160q-9-96-89-170t-208.5-109-274.5-21q-223%2023-369.5%20141.5t-132.5%20264.5q9%2096%2089%20170t208.5%20109%20274.5%2021q223-23%20369.5-141.5t132.5-264.5zm308%204q0%2068-37%20139.5t-109%20137-168.5%20117.5-226%2083-270.5%2031-275-33.5-240.5-93-171.5-151-65-199.5q0-115%2069.5-245t197.5-258q169-169%20341.5-236t246.5%207q65%2064%2020%20209-4%2014-1%2020t10%207%2014.5-.5%2013.5-3.5l6-2q139-59%20246-59t153%2061q45%2063%200%20178-2%2013-4.5%2020t4.5%2012.5%2012%207.5%2017%206q57%2018%20103%2047t80%2081.5%2034%20116.5zm-74-624q42%2047%2054.5%20108.5t-6.5%20117.5q-8%2023-29.5%2034t-44.5%204q-23-8-34-29.5t-4-44.5q20-63-24-111t-107-35q-24%205-45-8t-25-37q-5-24%208-44.5t37-25.5q60-13%20119%205.5t101%2065.5zm181-163q87%2096%20112.5%20222.5t-13.5%20241.5q-9%2027-34%2040t-52%204-40-34-5-52q28-82%2010-172t-80-158q-62-69-148-95.5t-173-8.5q-28%206-52-9.5t-30-43.5%209.5-51.5%2043.5-29.5q123-26%20244%2011.5t208%20134.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6334
+ var icon$j = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M675%201284q21-34%2011-69t-45-50q-34-14-73-1t-60%2046q-22%2034-13%2068.5t43%2050.5%2074.5%202.5%2062.5-47.5zm94-121q8-13%203.5-26.5t-17.5-18.5q-14-5-28.5.5t-21.5%2018.5q-17%2031%2013%2045%2014%205%2029-.5t22-18.5zm174%20107q-45%20102-158%20150t-224%2012q-107-34-147.5-126.5t6.5-187.5q47-93%20151.5-139t210.5-19q111%2029%20158.5%20119.5t2.5%20190.5zm312-160q-9-96-89-170t-208.5-109-274.5-21q-223%2023-369.5%20141.5t-132.5%20264.5q9%2096%2089%20170t208.5%20109%20274.5%2021q223-23%20369.5-141.5t132.5-264.5zm308%204q0%2068-37%20139.5t-109%20137-168.5%20117.5-226%2083-270.5%2031-275-33.5-240.5-93-171.5-151-65-199.5q0-115%2069.5-245t197.5-258q169-169%20341.5-236t246.5%207q65%2064%2020%20209-4%2014-1%2020t10%207%2014.5-.5%2013.5-3.5l6-2q139-59%20246-59t153%2061q45%2063%200%20178-2%2013-4.5%2020t4.5%2012.5%2012%207.5%2017%206q57%2018%20103%2047t80%2081.5%2034%20116.5zm-74-624q42%2047%2054.5%20108.5t-6.5%20117.5q-8%2023-29.5%2034t-44.5%204q-23-8-34-29.5t-4-44.5q20-63-24-111t-107-35q-24%205-45-8t-25-37q-5-24%208-44.5t37-25.5q60-13%20119%205.5t101%2065.5zm181-163q87%2096%20112.5%20222.5t-13.5%20241.5q-9%2027-34%2040t-52%204-40-34-5-52q28-82%2010-172t-80-158q-62-69-148-95.5t-173-8.5q-28%206-52-9.5t-30-43.5%209.5-51.5%2043.5-29.5q123-26%20244%2011.5t208%20134.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6311
6335
 
6312
6336
  var weibo = {
6313
6337
  key: 'weibo',
6314
6338
  name: 'Weibo',
6315
6339
  color: '#e71d34',
6316
- icon: icon$i
6340
+ icon: icon$j
6317
6341
  };
6318
6342
 
6319
- var icon$j = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M937%201004l266-499h-112l-157%20312q-24%2048-44%2092l-42-92-155-312h-120l263%20493v324h101v-318zm727-588v960q0%20119-84.5%20203.5t-203.5%2084.5h-960q-119%200-203.5-84.5t-84.5-203.5v-960q0-119%2084.5-203.5t203.5-84.5h960q119%200%20203.5%2084.5t84.5%20203.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6343
+ var icon$k = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M937%201004l266-499h-112l-157%20312q-24%2048-44%2092l-42-92-155-312h-120l263%20493v324h101v-318zm727-588v960q0%20119-84.5%20203.5t-203.5%2084.5h-960q-119%200-203.5-84.5t-84.5-203.5v-960q0-119%2084.5-203.5t203.5-84.5h960q119%200%20203.5%2084.5t84.5%20203.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
6320
6344
 
6321
6345
  var yandex = {
6322
6346
  key: 'yandex',
6323
6347
  name: 'Yandex',
6324
6348
  color: '#d43b2f',
6325
- icon: icon$j,
6349
+ icon: icon$k,
6326
6350
  windowSize: {
6327
6351
  width: 655,
6328
6352
  height: 700
@@ -6342,6 +6366,7 @@ var providers = /*#__PURE__*/Object.freeze({
6342
6366
  linkedin: linkedin,
6343
6367
  mailru: mailru,
6344
6368
  microsoft: microsoft,
6369
+ naver: naver,
6345
6370
  oney: oney,
6346
6371
  orange: orange,
6347
6372
  paypal: paypal,
@@ -6501,7 +6526,7 @@ var SocialButton = withTheme(function (_ref3) {
6501
6526
  textVisible: textVisible,
6502
6527
  width: width,
6503
6528
  height: height,
6504
- onClick: function onClick(_) {
6529
+ onClick: function onClick() {
6505
6530
  return _onClick(provider.key);
6506
6531
  }
6507
6532
  }, /*#__PURE__*/React__default.createElement(SocialButtonIcon, {
@@ -6515,18 +6540,21 @@ var SocialButtons = styled(function (_ref4) {
6515
6540
  className = _ref4.className;
6516
6541
  return /*#__PURE__*/React__default.createElement("div", {
6517
6542
  className: classes(['r5-social-buttons', className])
6518
- }, providers.filter(function (providerKey) {
6519
- if (providerKey === 'bconnect') return queryParams['bconnectActivation'] === 'true';else if (socialButtons[providerKey] === undefined) {
6520
- console.error("".concat(providerKey, " provider not found."));
6521
- return false;
6522
- } else return true;
6523
- }).map(function (providerKey) {
6524
- return /*#__PURE__*/React__default.createElement(SocialButton, {
6525
- provider: socialButtons[providerKey],
6543
+ }, providers.flatMap(function (providerKey) {
6544
+ var _providerKey$split = providerKey.split(':'),
6545
+ _providerKey$split2 = _slicedToArray(_providerKey$split, 1),
6546
+ providerName = _providerKey$split2[0];
6547
+ if (providerName === 'bconnect' && queryParams['bconnectActivation'] !== 'true') return [];else if (socialButtons[providerName] === undefined) {
6548
+ console.error("".concat(providerName, " provider not found."));
6549
+ return [];
6550
+ } else return [/*#__PURE__*/React__default.createElement(SocialButton, {
6551
+ provider: socialButtons[providerName],
6526
6552
  count: providers.length,
6527
- onClick: clickHandler,
6553
+ onClick: function onClick() {
6554
+ return clickHandler(providerKey);
6555
+ },
6528
6556
  key: providerKey
6529
- });
6557
+ })];
6530
6558
  }));
6531
6559
  })(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n text-align: center;\n ", "\n"])), function (props) {
6532
6560
  return props.theme.get('socialButton.inline') && 'margin: 0 -4px';
@@ -7285,7 +7313,7 @@ function formatISO8601Date(year, month, day) {
7285
7313
  return null;
7286
7314
  }
7287
7315
  function specializeIdentifierData(data) {
7288
- return !!data.identifier ? _objectSpread2(_objectSpread2(_objectSpread2({}, data), {}, {
7316
+ return data.identifier ? _objectSpread2(_objectSpread2(_objectSpread2({}, data), {}, {
7289
7317
  identifier: undefined
7290
7318
  }, isValidEmail(data.identifier) ? {
7291
7319
  email: data.identifier
@@ -7332,7 +7360,7 @@ var Validator = /*#__PURE__*/function () {
7332
7360
  parameters = _ref$parameters === void 0 ? [] : _ref$parameters;
7333
7361
  _classCallCheck(this, Validator);
7334
7362
  this.rule = rule;
7335
- this.hint = !isFunction(hint) ? function (_) {
7363
+ this.hint = !isFunction(hint) ? function () {
7336
7364
  return hint;
7337
7365
  } : hint;
7338
7366
  this.parameters = parameters;
@@ -7606,8 +7634,7 @@ var createField = function createField(_ref) {
7606
7634
  return mapping.unbind(model, format.unbind(value));
7607
7635
  },
7608
7636
  validate: function validate(_ref5, ctx) {
7609
- var value = _ref5.value,
7610
- isDirty = _ref5.isDirty;
7637
+ var value = _ref5.value;
7611
7638
  return required$1 || isValued(value) ? fullValidator(value, ctx) : {};
7612
7639
  }
7613
7640
  };
@@ -7798,7 +7825,7 @@ function initCloneArray(array) {
7798
7825
  */
7799
7826
  function cloneArrayBuffer(arrayBuffer) {
7800
7827
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
7801
- new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
7828
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
7802
7829
  return result;
7803
7830
  }
7804
7831
 
@@ -8263,7 +8290,7 @@ var omit = flatRest(function (object, paths) {
8263
8290
  });
8264
8291
 
8265
8292
  var _excluded$2 = ["options", "placeholder"],
8266
- _excluded2$1 = ["options", "onChange", "value", "name", "inputId"];
8293
+ _excluded2$1 = ["options", "onChange", "value", "inputId"];
8267
8294
  var _templateObject$5, _templateObject2$2, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8, _templateObject9, _templateObject10;
8268
8295
  var errorFadeIn = keyframes(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n"])));
8269
8296
  var FormError = withTheme(styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n padding-top: 3px;\n animation: ", " 0.3s both;\n color: ", ";\n"])), errorFadeIn, function (props) {
@@ -8390,7 +8417,6 @@ var RadioGroup = function RadioGroup(_ref6) {
8390
8417
  var options = _ref6.options,
8391
8418
  onChange = _ref6.onChange,
8392
8419
  value = _ref6.value,
8393
- name = _ref6.name,
8394
8420
  inputId = _ref6.inputId,
8395
8421
  props = _objectWithoutProperties(_ref6, _excluded2$1);
8396
8422
  var handleChange = function handleChange(event) {
@@ -8597,13 +8623,13 @@ function checkboxField(config) {
8597
8623
  */
8598
8624
 
8599
8625
  function specializeRawIdentifier(withPhoneNumber, inputValue) {
8600
- var telCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (_) {
8626
+ var telCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
8601
8627
  return undefined;
8602
8628
  };
8603
- var emailCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (_) {
8629
+ var emailCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {
8604
8630
  return undefined;
8605
8631
  };
8606
- var otherCall = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (_) {
8632
+ var otherCall = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
8607
8633
  return undefined;
8608
8634
  };
8609
8635
  if (withPhoneNumber && /^\+?[0-9]+$/.test(inputValue)) {
@@ -8672,7 +8698,9 @@ var IdentifierField = /*#__PURE__*/function (_React$Component) {
8672
8698
  var parsed = parse(userInput, country);
8673
8699
  var phoneValue = country === parsed.country ? format$1(parsed, 'National') : userInput;
8674
8700
  this.asYouType(phoneValue);
8675
- } catch (e) {}
8701
+ } catch (e) {
8702
+ console.error(e);
8703
+ }
8676
8704
  }
8677
8705
  }, {
8678
8706
  key: "componentWillUnmount",
@@ -8733,17 +8761,17 @@ function identifierField(props, config) {
8733
8761
  label: 'identifier',
8734
8762
  format: {
8735
8763
  bind: function bind(x) {
8736
- return specializeRawIdentifier(props.withPhoneNumber, x, function (_) {
8764
+ return specializeRawIdentifier(props.withPhoneNumber, x, function () {
8737
8765
  return {
8738
8766
  country: config.countryCode,
8739
8767
  isValid: true
8740
8768
  };
8741
- }, function (_) {
8769
+ }, function () {
8742
8770
  return {
8743
8771
  country: config.countryCode,
8744
8772
  isValid: true
8745
8773
  };
8746
- }, function (_) {
8774
+ }, function () {
8747
8775
  return {
8748
8776
  country: config.countryCode,
8749
8777
  isValid: true
@@ -8771,11 +8799,11 @@ function identifierField(props, config) {
8771
8799
  });
8772
8800
  },
8773
8801
  hint: function hint(value) {
8774
- return specializeRefinedIdentifier(value, function (_) {
8802
+ return specializeRefinedIdentifier(value, function () {
8775
8803
  return 'phone';
8776
- }, function (_) {
8804
+ }, function () {
8777
8805
  return 'email';
8778
- }, function (_) {
8806
+ }, function () {
8779
8807
  return 'identifier';
8780
8808
  });
8781
8809
  }
@@ -8939,8 +8967,7 @@ var LoginForm = createForm({
8939
8967
  defaultIdentifier = _ref.defaultIdentifier,
8940
8968
  i18n = _ref.i18n,
8941
8969
  config = _ref.config,
8942
- allowCustomIdentifier = _ref.allowCustomIdentifier,
8943
- customIdentifierLabel = _ref.customIdentifierLabel;
8970
+ allowCustomIdentifier = _ref.allowCustomIdentifier;
8944
8971
  return [showIdentifier && config.sms ? identifierField({
8945
8972
  defaultValue: defaultIdentifier,
8946
8973
  withPhoneNumber: true,
@@ -9016,8 +9043,7 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
9016
9043
  _this$props$session = _this$props.session,
9017
9044
  session = _this$props$session === void 0 ? {} : _this$props$session,
9018
9045
  i18n = _this$props.i18n,
9019
- allowCustomIdentifier = _this$props.allowCustomIdentifier,
9020
- customIdentifierLabel = _this$props.customIdentifierLabel;
9046
+ allowCustomIdentifier = _this$props.allowCustomIdentifier;
9021
9047
  var defaultIdentifier = session.lastLoginType === 'password' ? session.email : null;
9022
9048
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('login.title')), socialProviders && socialProviders.length > 0 && /*#__PURE__*/React__default.createElement(SocialButtons$1, {
9023
9049
  providers: socialProviders,
@@ -9717,25 +9743,15 @@ var BirthdateField = function BirthdateField(props) {
9717
9743
  "data-testid": "".concat(BIRTHDAY_PATH, ".year")
9718
9744
  }))));
9719
9745
  };
9720
- var validateDay = function validateDay(day) {
9721
- if (isNumeric(day)) {
9722
- var dayNbr = parseInt(day);
9723
- if (dayNbr <= 31 && dayNbr >= 1) {
9724
- return false;
9725
- }
9726
- }
9727
- return 'birthdate.dayOfMonth';
9728
- };
9729
- var validateYear = function validateYear(year) {
9730
- if (isNumeric(year)) {
9731
- var yearNbr = parseInt(year);
9732
- var currentYear = new Date().getFullYear();
9733
- var age = currentYear - yearNbr;
9734
- if (age > 5 && age < 130) {
9735
- return false;
9736
- }
9746
+ var validateLimitAge = function validateLimitAge(day, month, year) {
9747
+ var yearNbr = parseInt(year, 10);
9748
+ var dayNbr = parseInt(day, 10);
9749
+ var monthNbr = parseInt(month, 10);
9750
+ var age = DateTime.now().diff(DateTime.local(yearNbr, monthNbr, dayNbr), "years").years;
9751
+ if (age < 6 || age > 129) {
9752
+ return 'birthdate.yearLimit';
9737
9753
  }
9738
- return 'birthdate.year';
9754
+ return false;
9739
9755
  };
9740
9756
  var format = function format(_ref3) {
9741
9757
  var day = _ref3.day,
@@ -9817,25 +9833,15 @@ function birthdateField(_ref4) {
9817
9833
  return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, field, true));
9818
9834
  }, {})) : {};
9819
9835
  }
9820
- if (isSubmitted || day.isDirty) {
9821
- var dayError = validateDay(day.value);
9822
- if (dayError) {
9823
- return {
9824
- error: i18n("validation.".concat(dayError)),
9825
- day: true
9826
- };
9827
- }
9828
- }
9829
- if (isSubmitted || year.isDirty) {
9830
- var yearError = validateYear(year.value);
9831
- if (yearError) {
9836
+ if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
9837
+ if (!isNumeric(year.value.toString()) || !DateTime.fromObject({
9838
+ year: parseInt(year.value, 10)
9839
+ }).isValid) {
9832
9840
  return {
9833
- error: i18n("validation.".concat(yearError)),
9841
+ error: i18n("validation.birthdate.year"),
9834
9842
  year: true
9835
9843
  };
9836
9844
  }
9837
- }
9838
- if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
9839
9845
  var birthdate = format(state);
9840
9846
  if (!birthdate || !isISO8601(birthdate)) {
9841
9847
  return {
@@ -9843,6 +9849,22 @@ function birthdateField(_ref4) {
9843
9849
  day: true
9844
9850
  };
9845
9851
  }
9852
+ if (!(isNumeric(month.value.toString()) && isNumeric(day.value.toString())) || !DateTime.fromObject({
9853
+ year: year.value,
9854
+ month: month.value,
9855
+ day: day.value
9856
+ }).isValid) {
9857
+ return {
9858
+ error: i18n("validation.birthdate.dayOfMonth"),
9859
+ day: true
9860
+ };
9861
+ }
9862
+ var limitAge = validateLimitAge(day.value, month.value, year.value);
9863
+ if (limitAge) {
9864
+ return {
9865
+ error: i18n("validation.".concat(limitAge))
9866
+ };
9867
+ }
9846
9868
  }
9847
9869
  return {};
9848
9870
  }
@@ -9887,7 +9909,9 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
9887
9909
  var parsed = parse(raw, country);
9888
9910
  var phoneValue = country === parsed.country ? format$1(parsed, 'National') : raw;
9889
9911
  this.asYouType(phoneValue);
9890
- } catch (e) {}
9912
+ } catch (e) {
9913
+ console.error(e);
9914
+ }
9891
9915
  }
9892
9916
  }, {
9893
9917
  key: "componentWillUnmount",
@@ -10002,7 +10026,7 @@ var PasswordPolicyRules = withI18n(withTheme(styled(function (_ref3) {
10002
10026
  checked: props.strength >= props.minStrength
10003
10027
  }), /*#__PURE__*/React__default.createElement(Label, {
10004
10028
  visible: true
10005
- }, i18n('passwordStrength.minimum.required'), " ", i18n("passwordStrength.score".concat(props.minStrength)).toLowerCase(), ".")), /*#__PURE__*/React__default.createElement(PasswordPolicyIntro, null), Object.keys(props.rules).map(function (key, _) {
10029
+ }, i18n('passwordStrength.minimum.required'), " ", i18n("passwordStrength.score".concat(props.minStrength)).toLowerCase(), ".")), /*#__PURE__*/React__default.createElement(PasswordPolicyIntro, null), Object.keys(props.rules).map(function (key) {
10006
10030
  var rule = props.rules[key];
10007
10031
  return /*#__PURE__*/React__default.createElement(PasswordPolicyRule, {
10008
10032
  key: key
@@ -10074,7 +10098,7 @@ var PasswordField = /*#__PURE__*/function (_React$Component) {
10074
10098
  }
10075
10099
  _createClass(PasswordField, [{
10076
10100
  key: "componentDidUpdate",
10077
- value: function componentDidUpdate(prevProps, prevState, snapshot) {
10101
+ value: function componentDidUpdate(prevProps) {
10078
10102
  var blacklistUpdated = isEqual(prevProps.blacklist, this.props.blacklist);
10079
10103
  if (!blacklistUpdated) {
10080
10104
  var _this$props = this.props,
@@ -10549,8 +10573,10 @@ function consentFieldComponent(consent, fieldConfig, versionIdPath) {
10549
10573
  consentCannotBeGranted: !fieldConfig.errorArchivedConsents && consent.status === 'archived'
10550
10574
  },
10551
10575
  type: consent.consentType,
10552
- key: "consents.".concat(consent.key)
10576
+ key: "consents.".concat(consent.key, ".").concat(versionId),
10577
+ path: "consents.".concat(consent.key) // Will target the same profile consent value for different versions of the consent
10553
10578
  });
10579
+
10554
10580
  return consentField(baseConfig);
10555
10581
  }
10556
10582
  var findCustomField = function findCustomField(config, camelPath) {
@@ -10574,10 +10600,12 @@ var resolveField = function resolveField(fieldConfig, config) {
10574
10600
  if (customField) {
10575
10601
  return customFieldComponent(customField, fieldConfig);
10576
10602
  }
10577
- var camelPathSplit = camelPath.split('.v');
10603
+ var camelPathSplit = camelPath.split('.v'); // TODO What if consent start with a `v`?
10578
10604
  var consentField = findConsentField(config, camelPathSplit[0]);
10605
+ // Find most recent consent version if not given
10579
10606
  if (consentField) {
10580
- return consentFieldComponent(consentField, fieldConfig, camelPathSplit[1]);
10607
+ var highestConsentVersion = consentField.versions[0].versionId;
10608
+ return consentFieldComponent(consentField, fieldConfig, camelPathSplit[1] || highestConsentVersion);
10581
10609
  }
10582
10610
  throw new UserError("Unknown field: ".concat(fieldConfig.key));
10583
10611
  };
@@ -11109,7 +11137,7 @@ var MfaStepUpView = /*#__PURE__*/function (_React$Component) {
11109
11137
  args[_key] = arguments[_key];
11110
11138
  }
11111
11139
  _this = _super.call.apply(_super, [this].concat(args));
11112
- _defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function (_) {
11140
+ _defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function () {
11113
11141
  return _this.props.apiClient.getMfaStepUpToken({
11114
11142
  options: _this.props.auth,
11115
11143
  accessToken: _this.props.accessToken
@@ -11296,7 +11324,7 @@ var MainView = /*#__PURE__*/function (_React$Component) {
11296
11324
  args[_key] = arguments[_key];
11297
11325
  }
11298
11326
  _this = _super.call.apply(_super, [this].concat(args));
11299
- _defineProperty(_assertThisInitialized(_this), "handleSubmit", function (data) {
11327
+ _defineProperty(_assertThisInitialized(_this), "callback", function (data) {
11300
11328
  var _this$props = _this.props,
11301
11329
  apiClient = _this$props.apiClient,
11302
11330
  accessToken = _this$props.accessToken,
@@ -11312,11 +11340,19 @@ var MainView = /*#__PURE__*/function (_React$Component) {
11312
11340
  return _this;
11313
11341
  }
11314
11342
  _createClass(MainView, [{
11343
+ key: "componentDidMount",
11344
+ value: function componentDidMount() {
11345
+ importGoogleRecaptchaScript(this.props.recaptcha_site_key);
11346
+ }
11347
+ }, {
11315
11348
  key: "render",
11316
11349
  value: function render() {
11350
+ var _this2 = this;
11317
11351
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Intro, null, this.props.i18n('emailEditor.intro')), /*#__PURE__*/React__default.createElement(EmailEditorForm, {
11318
11352
  showLabels: this.props.showLabels,
11319
- handler: this.handleSubmit,
11353
+ handler: function handler(data) {
11354
+ return ReCaptcha.handle(data, _this2.props, _this2.callback, "update_email");
11355
+ },
11320
11356
  onSuccess: this.handleSuccess
11321
11357
  }));
11322
11358
  }
@@ -11483,7 +11519,7 @@ var MainView$1 = /*#__PURE__*/function (_React$Component) {
11483
11519
  accessToken = _this$props.accessToken;
11484
11520
  return apiClient.updatePhoneNumber(_objectSpread2(_objectSpread2({}, data), {}, {
11485
11521
  accessToken: accessToken
11486
- })).then(function (_) {
11522
+ })).then(function () {
11487
11523
  return data;
11488
11524
  });
11489
11525
  });
@@ -11652,7 +11688,7 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
11652
11688
  }
11653
11689
  _this = _super.call.apply(_super, [this].concat(args));
11654
11690
  _defineProperty(_assertThisInitialized(_this), "callback", function (data) {
11655
- return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function (_) {
11691
+ return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function () {
11656
11692
  return data;
11657
11693
  });
11658
11694
  });
@@ -11817,6 +11853,8 @@ var profileEditorWidget = createWidget({
11817
11853
  if (haveNotAllowedFields) {
11818
11854
  throw new UserError('These fields are not allowed: password, password_confirmation.');
11819
11855
  }
11856
+
11857
+ // This step removes the version from the consents
11820
11858
  var resolvedFields = buildFormFields(fields, _objectSpread2(_objectSpread2({}, config), {}, {
11821
11859
  errorArchivedConsents: false
11822
11860
  }));
@@ -11824,16 +11862,40 @@ var profileEditorWidget = createWidget({
11824
11862
  accessToken: accessToken,
11825
11863
  fields: computeFieldList(resolvedFields)
11826
11864
  }).then(function (profile) {
11865
+ var camelProfile = camelCaseProperties(profile);
11866
+ var profileConsents = camelProfile && camelProfile.consents;
11867
+ var filteredProfileConsents = profileConsents && Object.keys(profileConsents).length && filterProfileConsents(fields, config.consentsVersions, profileConsents);
11868
+ var filteredOutConsentsProfile = _objectSpread2(_objectSpread2({}, profile), {}, {
11869
+ consents: filteredProfileConsents
11870
+ });
11827
11871
  return _objectSpread2(_objectSpread2({}, opts), {}, {
11828
- profile: camelCaseProperties(profile),
11872
+ profile: filteredOutConsentsProfile,
11829
11873
  resolvedFields: resolvedFields.filter(function (field) {
11830
- return (field.path !== 'email' || !profile.email) && (field.path !== 'phone_number' || !config.sms || !profile.phoneNumber);
11874
+ return (field.path !== 'email' || !filteredOutConsentsProfile.email) && (field.path !== 'phone_number' || !config.sms || !filteredOutConsentsProfile.phoneNumber);
11831
11875
  })
11832
11876
  });
11833
11877
  });
11834
11878
  }
11835
11879
  });
11836
11880
 
11881
+ // Filter out the profile consents with different version than the one the given consent field own
11882
+ var filterProfileConsents = function filterProfileConsents(fields, consentsVersions, profileConsents) {
11883
+ return Object.keys(profileConsents).filter(function (profileConsentKey) {
11884
+ var consentField = fields.find(function (field) {
11885
+ return field.startsWith("consents.".concat(profileConsentKey));
11886
+ });
11887
+ var consentFieldSplit = consentField.split('.v');
11888
+ // Find most recent consent version if not given
11889
+ var highestConsentVersion = consentsVersions[profileConsentKey].versions[0].versionId;
11890
+ var consentFieldVersion = consentFieldSplit[1] || highestConsentVersion;
11891
+ var profileConsentVersion = profileConsents[profileConsentKey].consentVersion.versionId;
11892
+ return !consentFieldVersion || parseInt(consentFieldVersion) === profileConsentVersion;
11893
+ }).reduce(function (filteredProfileConsents, consentKey) {
11894
+ filteredProfileConsents[consentKey] = profileConsents[consentKey];
11895
+ return filteredProfileConsents;
11896
+ }, {});
11897
+ };
11898
+
11837
11899
  /** Used as the size to enable large array optimizations. */
11838
11900
  var LARGE_ARRAY_SIZE$2 = 200;
11839
11901
 
@@ -12258,7 +12320,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
12258
12320
  args[_key] = arguments[_key];
12259
12321
  }
12260
12322
  _this = _super.call.apply(_super, [this].concat(args));
12261
- _defineProperty(_assertThisInitialized(_this), "onEmailRegistering", function (_) {
12323
+ _defineProperty(_assertThisInitialized(_this), "onEmailRegistering", function () {
12262
12324
  return _this.props.apiClient.startMfaEmailRegistration({
12263
12325
  accessToken: _this.props.accessToken
12264
12326
  });
@@ -12268,7 +12330,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
12268
12330
  accessToken: _this.props.accessToken
12269
12331
  }, data));
12270
12332
  });
12271
- _defineProperty(_assertThisInitialized(_this), "onEmailRemoval", function (_) {
12333
+ _defineProperty(_assertThisInitialized(_this), "onEmailRemoval", function () {
12272
12334
  return _this.props.apiClient.removeMfaEmail({
12273
12335
  accessToken: _this.props.accessToken
12274
12336
  });
@@ -12314,7 +12376,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
12314
12376
  }
12315
12377
  }))), /*#__PURE__*/React__default.createElement(DivCredentialBlock, null, showRemoveMfaCredentials && config.mfaEmailEnabled && isEmailCredentialRegistered && /*#__PURE__*/React__default.createElement("div", null, showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('mfa.email.remove.explain')), /*#__PURE__*/React__default.createElement(EmailCredentialRemovalForm, {
12316
12378
  handler: this.onEmailRemoval,
12317
- onSuccess: function onSuccess(_) {
12379
+ onSuccess: function onSuccess() {
12318
12380
  return _this2.props.goTo('credential-removed', {
12319
12381
  credentialType: 'email'
12320
12382
  });
@@ -12323,7 +12385,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
12323
12385
  handler: function handler(data) {
12324
12386
  return _this2.onPhoneNumberRemoval(_objectSpread2(_objectSpread2({}, data), phoneNumberCredentialRegistered));
12325
12387
  },
12326
- onSuccess: function onSuccess(_) {
12388
+ onSuccess: function onSuccess() {
12327
12389
  return _this2.props.goTo('credential-removed', {
12328
12390
  credentialType: 'sms'
12329
12391
  });
@@ -12406,7 +12468,9 @@ var mfaCredentialsWidget = createMultiViewWidget({
12406
12468
  },
12407
12469
  prepare: function prepare(options, _ref3) {
12408
12470
  var apiClient = _ref3.apiClient;
12409
- return apiClient.listMfaCredentials(options.accessToken).then(function (credentials) {
12471
+ return apiClient.listMfaCredentials(options.accessToken)["catch"](function (error) {
12472
+ throw new UserError.fromAppError(error);
12473
+ }).then(function (credentials) {
12410
12474
  return deepDefaults(_objectSpread2(_objectSpread2({
12411
12475
  showIntro: true,
12412
12476
  showRemoveMfaCredentials: true
@@ -12493,7 +12557,9 @@ var mfaListWidget = createWidget({
12493
12557
  component: MfaList,
12494
12558
  prepare: function prepare(options, _ref3) {
12495
12559
  var apiClient = _ref3.apiClient;
12496
- return apiClient.listMfaCredentials(options.accessToken).then(function (credentials) {
12560
+ return apiClient.listMfaCredentials(options.accessToken)["catch"](function (error) {
12561
+ throw new UserError.fromAppError(error);
12562
+ }).then(function (credentials) {
12497
12563
  return _objectSpread2(_objectSpread2({}, options), credentials);
12498
12564
  });
12499
12565
  }
@@ -12504,7 +12570,7 @@ var UiClient = /*#__PURE__*/function () {
12504
12570
  _classCallCheck(this, UiClient);
12505
12571
  this.config = config;
12506
12572
  this.urlParser = urlParser;
12507
- this.client = coreClient;
12573
+ this.core = coreClient;
12508
12574
  this.defaultI18n = defaultI18n;
12509
12575
  }
12510
12576
 
@@ -12611,7 +12677,7 @@ var UiClient = /*#__PURE__*/function () {
12611
12677
  _context.next = 9;
12612
12678
  return widget(options, _objectSpread2(_objectSpread2({}, props), {}, {
12613
12679
  config: config,
12614
- apiClient: this.client,
12680
+ apiClient: this.core,
12615
12681
  defaultI18n: this.defaultI18n
12616
12682
  }));
12617
12683
  case 9:
@@ -12664,10 +12730,10 @@ var UiClient = /*#__PURE__*/function () {
12664
12730
  return Promise.resolve(_this.urlParser.parseUrlFragment(window.location.href)).then(function (authResult) {
12665
12731
  // Avoid authentication triggering when an authentication response is present
12666
12732
  if (authResult) return;
12667
- _this.client.getSessionInfo().then(function (session) {
12733
+ _this.core.getSessionInfo().then(function (session) {
12668
12734
  var reAuthenticate = auth && auth.prompt && auth.prompt === 'login';
12669
12735
  if (session.isAuthenticated && !reAuthenticate) {
12670
- _this.client.loginFromSession(auth);
12736
+ _this.core.loginFromSession(auth);
12671
12737
  } else {
12672
12738
  showAuthWidget(session);
12673
12739
  }
@@ -12685,1676 +12751,6 @@ var UiClient = /*#__PURE__*/function () {
12685
12751
  return UiClient;
12686
12752
  }();
12687
12753
 
12688
- var lookup = [];
12689
- var revLookup = [];
12690
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
12691
- var inited = false;
12692
- function init() {
12693
- inited = true;
12694
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
12695
- for (var i = 0, len = code.length; i < len; ++i) {
12696
- lookup[i] = code[i];
12697
- revLookup[code.charCodeAt(i)] = i;
12698
- }
12699
- revLookup['-'.charCodeAt(0)] = 62;
12700
- revLookup['_'.charCodeAt(0)] = 63;
12701
- }
12702
- function toByteArray(b64) {
12703
- if (!inited) {
12704
- init();
12705
- }
12706
- var i, j, l, tmp, placeHolders, arr;
12707
- var len = b64.length;
12708
- if (len % 4 > 0) {
12709
- throw new Error('Invalid string. Length must be a multiple of 4');
12710
- }
12711
-
12712
- // the number of equal signs (place holders)
12713
- // if there are two placeholders, than the two characters before it
12714
- // represent one byte
12715
- // if there is only one, then the three characters before it represent 2 bytes
12716
- // this is just a cheap hack to not do indexOf twice
12717
- placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
12718
-
12719
- // base64 is 4/3 + up to two characters of the original data
12720
- arr = new Arr(len * 3 / 4 - placeHolders);
12721
-
12722
- // if there are placeholders, only get up to the last complete 4 chars
12723
- l = placeHolders > 0 ? len - 4 : len;
12724
- var L = 0;
12725
- for (i = 0, j = 0; i < l; i += 4, j += 3) {
12726
- tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
12727
- arr[L++] = tmp >> 16 & 0xFF;
12728
- arr[L++] = tmp >> 8 & 0xFF;
12729
- arr[L++] = tmp & 0xFF;
12730
- }
12731
- if (placeHolders === 2) {
12732
- tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
12733
- arr[L++] = tmp & 0xFF;
12734
- } else if (placeHolders === 1) {
12735
- tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
12736
- arr[L++] = tmp >> 8 & 0xFF;
12737
- arr[L++] = tmp & 0xFF;
12738
- }
12739
- return arr;
12740
- }
12741
- function tripletToBase64(num) {
12742
- return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
12743
- }
12744
- function encodeChunk(uint8, start, end) {
12745
- var tmp;
12746
- var output = [];
12747
- for (var i = start; i < end; i += 3) {
12748
- tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
12749
- output.push(tripletToBase64(tmp));
12750
- }
12751
- return output.join('');
12752
- }
12753
- function fromByteArray(uint8) {
12754
- if (!inited) {
12755
- init();
12756
- }
12757
- var tmp;
12758
- var len = uint8.length;
12759
- var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
12760
- var output = '';
12761
- var parts = [];
12762
- var maxChunkLength = 16383; // must be multiple of 3
12763
-
12764
- // go through the array every three bytes, we'll deal with trailing stuff later
12765
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
12766
- parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
12767
- }
12768
-
12769
- // pad the end with zeros, but make sure to not forget the extra bytes
12770
- if (extraBytes === 1) {
12771
- tmp = uint8[len - 1];
12772
- output += lookup[tmp >> 2];
12773
- output += lookup[tmp << 4 & 0x3F];
12774
- output += '==';
12775
- } else if (extraBytes === 2) {
12776
- tmp = (uint8[len - 2] << 8) + uint8[len - 1];
12777
- output += lookup[tmp >> 10];
12778
- output += lookup[tmp >> 4 & 0x3F];
12779
- output += lookup[tmp << 2 & 0x3F];
12780
- output += '=';
12781
- }
12782
- parts.push(output);
12783
- return parts.join('');
12784
- }
12785
-
12786
- function read(buffer, offset, isLE, mLen, nBytes) {
12787
- var e, m;
12788
- var eLen = nBytes * 8 - mLen - 1;
12789
- var eMax = (1 << eLen) - 1;
12790
- var eBias = eMax >> 1;
12791
- var nBits = -7;
12792
- var i = isLE ? nBytes - 1 : 0;
12793
- var d = isLE ? -1 : 1;
12794
- var s = buffer[offset + i];
12795
- i += d;
12796
- e = s & (1 << -nBits) - 1;
12797
- s >>= -nBits;
12798
- nBits += eLen;
12799
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
12800
- m = e & (1 << -nBits) - 1;
12801
- e >>= -nBits;
12802
- nBits += mLen;
12803
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
12804
- if (e === 0) {
12805
- e = 1 - eBias;
12806
- } else if (e === eMax) {
12807
- return m ? NaN : (s ? -1 : 1) * Infinity;
12808
- } else {
12809
- m = m + Math.pow(2, mLen);
12810
- e = e - eBias;
12811
- }
12812
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
12813
- }
12814
- function write(buffer, value, offset, isLE, mLen, nBytes) {
12815
- var e, m, c;
12816
- var eLen = nBytes * 8 - mLen - 1;
12817
- var eMax = (1 << eLen) - 1;
12818
- var eBias = eMax >> 1;
12819
- var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
12820
- var i = isLE ? 0 : nBytes - 1;
12821
- var d = isLE ? 1 : -1;
12822
- var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
12823
- value = Math.abs(value);
12824
- if (isNaN(value) || value === Infinity) {
12825
- m = isNaN(value) ? 1 : 0;
12826
- e = eMax;
12827
- } else {
12828
- e = Math.floor(Math.log(value) / Math.LN2);
12829
- if (value * (c = Math.pow(2, -e)) < 1) {
12830
- e--;
12831
- c *= 2;
12832
- }
12833
- if (e + eBias >= 1) {
12834
- value += rt / c;
12835
- } else {
12836
- value += rt * Math.pow(2, 1 - eBias);
12837
- }
12838
- if (value * c >= 2) {
12839
- e++;
12840
- c /= 2;
12841
- }
12842
- if (e + eBias >= eMax) {
12843
- m = 0;
12844
- e = eMax;
12845
- } else if (e + eBias >= 1) {
12846
- m = (value * c - 1) * Math.pow(2, mLen);
12847
- e = e + eBias;
12848
- } else {
12849
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
12850
- e = 0;
12851
- }
12852
- }
12853
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
12854
- e = e << mLen | m;
12855
- eLen += mLen;
12856
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
12857
- buffer[offset + i - d] |= s * 128;
12858
- }
12859
-
12860
- var toString$1 = {}.toString;
12861
- var isArray$1 = Array.isArray || function (arr) {
12862
- return toString$1.call(arr) == '[object Array]';
12863
- };
12864
-
12865
- var INSPECT_MAX_BYTES = 50;
12866
-
12867
- /**
12868
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
12869
- * === true Use Uint8Array implementation (fastest)
12870
- * === false Use Object implementation (most compatible, even IE6)
12871
- *
12872
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
12873
- * Opera 11.6+, iOS 4.2+.
12874
- *
12875
- * Due to various browser bugs, sometimes the Object implementation will be used even
12876
- * when the browser supports typed arrays.
12877
- *
12878
- * Note:
12879
- *
12880
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
12881
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
12882
- *
12883
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
12884
- *
12885
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
12886
- * incorrect length in some situations.
12887
-
12888
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
12889
- * get the Object implementation, which is slower but behaves correctly.
12890
- */
12891
- Buffer$2.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined ? global$1.TYPED_ARRAY_SUPPORT : true;
12892
-
12893
- function kMaxLength() {
12894
- return Buffer$2.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
12895
- }
12896
- function createBuffer(that, length) {
12897
- if (kMaxLength() < length) {
12898
- throw new RangeError('Invalid typed array length');
12899
- }
12900
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
12901
- // Return an augmented `Uint8Array` instance, for best performance
12902
- that = new Uint8Array(length);
12903
- that.__proto__ = Buffer$2.prototype;
12904
- } else {
12905
- // Fallback: Return an object instance of the Buffer class
12906
- if (that === null) {
12907
- that = new Buffer$2(length);
12908
- }
12909
- that.length = length;
12910
- }
12911
- return that;
12912
- }
12913
-
12914
- /**
12915
- * The Buffer constructor returns instances of `Uint8Array` that have their
12916
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
12917
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
12918
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
12919
- * returns a single octet.
12920
- *
12921
- * The `Uint8Array` prototype remains unmodified.
12922
- */
12923
-
12924
- function Buffer$2(arg, encodingOrOffset, length) {
12925
- if (!Buffer$2.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$2)) {
12926
- return new Buffer$2(arg, encodingOrOffset, length);
12927
- }
12928
-
12929
- // Common case.
12930
- if (typeof arg === 'number') {
12931
- if (typeof encodingOrOffset === 'string') {
12932
- throw new Error('If encoding is specified then the first argument must be a string');
12933
- }
12934
- return allocUnsafe$1(this, arg);
12935
- }
12936
- return from(this, arg, encodingOrOffset, length);
12937
- }
12938
- Buffer$2.poolSize = 8192; // not used by this implementation
12939
-
12940
- // TODO: Legacy, not needed anymore. Remove in next major version.
12941
- Buffer$2._augment = function (arr) {
12942
- arr.__proto__ = Buffer$2.prototype;
12943
- return arr;
12944
- };
12945
- function from(that, value, encodingOrOffset, length) {
12946
- if (typeof value === 'number') {
12947
- throw new TypeError('"value" argument must not be a number');
12948
- }
12949
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
12950
- return fromArrayBuffer(that, value, encodingOrOffset, length);
12951
- }
12952
- if (typeof value === 'string') {
12953
- return fromString(that, value, encodingOrOffset);
12954
- }
12955
- return fromObject(that, value);
12956
- }
12957
-
12958
- /**
12959
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
12960
- * if value is a number.
12961
- * Buffer.from(str[, encoding])
12962
- * Buffer.from(array)
12963
- * Buffer.from(buffer)
12964
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
12965
- **/
12966
- Buffer$2.from = function (value, encodingOrOffset, length) {
12967
- return from(null, value, encodingOrOffset, length);
12968
- };
12969
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
12970
- Buffer$2.prototype.__proto__ = Uint8Array.prototype;
12971
- Buffer$2.__proto__ = Uint8Array;
12972
- }
12973
- function assertSize(size) {
12974
- if (typeof size !== 'number') {
12975
- throw new TypeError('"size" argument must be a number');
12976
- } else if (size < 0) {
12977
- throw new RangeError('"size" argument must not be negative');
12978
- }
12979
- }
12980
- function alloc(that, size, fill, encoding) {
12981
- assertSize(size);
12982
- if (size <= 0) {
12983
- return createBuffer(that, size);
12984
- }
12985
- if (fill !== undefined) {
12986
- // Only pay attention to encoding if it's a string. This
12987
- // prevents accidentally sending in a number that would
12988
- // be interpretted as a start offset.
12989
- return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
12990
- }
12991
- return createBuffer(that, size);
12992
- }
12993
-
12994
- /**
12995
- * Creates a new filled Buffer instance.
12996
- * alloc(size[, fill[, encoding]])
12997
- **/
12998
- Buffer$2.alloc = function (size, fill, encoding) {
12999
- return alloc(null, size, fill, encoding);
13000
- };
13001
- function allocUnsafe$1(that, size) {
13002
- assertSize(size);
13003
- that = createBuffer(that, size < 0 ? 0 : checked$1(size) | 0);
13004
- if (!Buffer$2.TYPED_ARRAY_SUPPORT) {
13005
- for (var i = 0; i < size; ++i) {
13006
- that[i] = 0;
13007
- }
13008
- }
13009
- return that;
13010
- }
13011
-
13012
- /**
13013
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
13014
- * */
13015
- Buffer$2.allocUnsafe = function (size) {
13016
- return allocUnsafe$1(null, size);
13017
- };
13018
- /**
13019
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
13020
- */
13021
- Buffer$2.allocUnsafeSlow = function (size) {
13022
- return allocUnsafe$1(null, size);
13023
- };
13024
- function fromString(that, string, encoding) {
13025
- if (typeof encoding !== 'string' || encoding === '') {
13026
- encoding = 'utf8';
13027
- }
13028
- if (!Buffer$2.isEncoding(encoding)) {
13029
- throw new TypeError('"encoding" must be a valid string encoding');
13030
- }
13031
- var length = byteLength(string, encoding) | 0;
13032
- that = createBuffer(that, length);
13033
- var actual = that.write(string, encoding);
13034
- if (actual !== length) {
13035
- // Writing a hex string, for example, that contains invalid characters will
13036
- // cause everything after the first invalid character to be ignored. (e.g.
13037
- // 'abxxcd' will be treated as 'ab')
13038
- that = that.slice(0, actual);
13039
- }
13040
- return that;
13041
- }
13042
- function fromArrayLike(that, array) {
13043
- var length = array.length < 0 ? 0 : checked$1(array.length) | 0;
13044
- that = createBuffer(that, length);
13045
- for (var i = 0; i < length; i += 1) {
13046
- that[i] = array[i] & 255;
13047
- }
13048
- return that;
13049
- }
13050
- function fromArrayBuffer(that, array, byteOffset, length) {
13051
- array.byteLength; // this throws if `array` is not a valid ArrayBuffer
13052
-
13053
- if (byteOffset < 0 || array.byteLength < byteOffset) {
13054
- throw new RangeError('\'offset\' is out of bounds');
13055
- }
13056
- if (array.byteLength < byteOffset + (length || 0)) {
13057
- throw new RangeError('\'length\' is out of bounds');
13058
- }
13059
- if (byteOffset === undefined && length === undefined) {
13060
- array = new Uint8Array(array);
13061
- } else if (length === undefined) {
13062
- array = new Uint8Array(array, byteOffset);
13063
- } else {
13064
- array = new Uint8Array(array, byteOffset, length);
13065
- }
13066
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
13067
- // Return an augmented `Uint8Array` instance, for best performance
13068
- that = array;
13069
- that.__proto__ = Buffer$2.prototype;
13070
- } else {
13071
- // Fallback: Return an object instance of the Buffer class
13072
- that = fromArrayLike(that, array);
13073
- }
13074
- return that;
13075
- }
13076
- function fromObject(that, obj) {
13077
- if (internalIsBuffer(obj)) {
13078
- var len = checked$1(obj.length) | 0;
13079
- that = createBuffer(that, len);
13080
- if (that.length === 0) {
13081
- return that;
13082
- }
13083
- obj.copy(that, 0, 0, len);
13084
- return that;
13085
- }
13086
- if (obj) {
13087
- if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
13088
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
13089
- return createBuffer(that, 0);
13090
- }
13091
- return fromArrayLike(that, obj);
13092
- }
13093
- if (obj.type === 'Buffer' && isArray$1(obj.data)) {
13094
- return fromArrayLike(that, obj.data);
13095
- }
13096
- }
13097
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
13098
- }
13099
- function checked$1(length) {
13100
- // Note: cannot use `length < kMaxLength()` here because that fails when
13101
- // length is NaN (which is otherwise coerced to zero.)
13102
- if (length >= kMaxLength()) {
13103
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
13104
- }
13105
- return length | 0;
13106
- }
13107
- Buffer$2.isBuffer = isBuffer$1;
13108
- function internalIsBuffer(b) {
13109
- return !!(b != null && b._isBuffer);
13110
- }
13111
- Buffer$2.compare = function compare(a, b) {
13112
- if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
13113
- throw new TypeError('Arguments must be Buffers');
13114
- }
13115
- if (a === b) return 0;
13116
- var x = a.length;
13117
- var y = b.length;
13118
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
13119
- if (a[i] !== b[i]) {
13120
- x = a[i];
13121
- y = b[i];
13122
- break;
13123
- }
13124
- }
13125
- if (x < y) return -1;
13126
- if (y < x) return 1;
13127
- return 0;
13128
- };
13129
- Buffer$2.isEncoding = function isEncoding(encoding) {
13130
- switch (String(encoding).toLowerCase()) {
13131
- case 'hex':
13132
- case 'utf8':
13133
- case 'utf-8':
13134
- case 'ascii':
13135
- case 'latin1':
13136
- case 'binary':
13137
- case 'base64':
13138
- case 'ucs2':
13139
- case 'ucs-2':
13140
- case 'utf16le':
13141
- case 'utf-16le':
13142
- return true;
13143
- default:
13144
- return false;
13145
- }
13146
- };
13147
- Buffer$2.concat = function concat(list, length) {
13148
- if (!isArray$1(list)) {
13149
- throw new TypeError('"list" argument must be an Array of Buffers');
13150
- }
13151
- if (list.length === 0) {
13152
- return Buffer$2.alloc(0);
13153
- }
13154
- var i;
13155
- if (length === undefined) {
13156
- length = 0;
13157
- for (i = 0; i < list.length; ++i) {
13158
- length += list[i].length;
13159
- }
13160
- }
13161
- var buffer = Buffer$2.allocUnsafe(length);
13162
- var pos = 0;
13163
- for (i = 0; i < list.length; ++i) {
13164
- var buf = list[i];
13165
- if (!internalIsBuffer(buf)) {
13166
- throw new TypeError('"list" argument must be an Array of Buffers');
13167
- }
13168
- buf.copy(buffer, pos);
13169
- pos += buf.length;
13170
- }
13171
- return buffer;
13172
- };
13173
- function byteLength(string, encoding) {
13174
- if (internalIsBuffer(string)) {
13175
- return string.length;
13176
- }
13177
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
13178
- return string.byteLength;
13179
- }
13180
- if (typeof string !== 'string') {
13181
- string = '' + string;
13182
- }
13183
- var len = string.length;
13184
- if (len === 0) return 0;
13185
-
13186
- // Use a for loop to avoid recursion
13187
- var loweredCase = false;
13188
- for (;;) {
13189
- switch (encoding) {
13190
- case 'ascii':
13191
- case 'latin1':
13192
- case 'binary':
13193
- return len;
13194
- case 'utf8':
13195
- case 'utf-8':
13196
- case undefined:
13197
- return utf8ToBytes(string).length;
13198
- case 'ucs2':
13199
- case 'ucs-2':
13200
- case 'utf16le':
13201
- case 'utf-16le':
13202
- return len * 2;
13203
- case 'hex':
13204
- return len >>> 1;
13205
- case 'base64':
13206
- return base64ToBytes(string).length;
13207
- default:
13208
- if (loweredCase) return utf8ToBytes(string).length; // assume utf8
13209
- encoding = ('' + encoding).toLowerCase();
13210
- loweredCase = true;
13211
- }
13212
- }
13213
- }
13214
- Buffer$2.byteLength = byteLength;
13215
- function slowToString(encoding, start, end) {
13216
- var loweredCase = false;
13217
-
13218
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
13219
- // property of a typed array.
13220
-
13221
- // This behaves neither like String nor Uint8Array in that we set start/end
13222
- // to their upper/lower bounds if the value passed is out of range.
13223
- // undefined is handled specially as per ECMA-262 6th Edition,
13224
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
13225
- if (start === undefined || start < 0) {
13226
- start = 0;
13227
- }
13228
- // Return early if start > this.length. Done here to prevent potential uint32
13229
- // coercion fail below.
13230
- if (start > this.length) {
13231
- return '';
13232
- }
13233
- if (end === undefined || end > this.length) {
13234
- end = this.length;
13235
- }
13236
- if (end <= 0) {
13237
- return '';
13238
- }
13239
-
13240
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
13241
- end >>>= 0;
13242
- start >>>= 0;
13243
- if (end <= start) {
13244
- return '';
13245
- }
13246
- if (!encoding) encoding = 'utf8';
13247
- while (true) {
13248
- switch (encoding) {
13249
- case 'hex':
13250
- return hexSlice(this, start, end);
13251
- case 'utf8':
13252
- case 'utf-8':
13253
- return utf8Slice(this, start, end);
13254
- case 'ascii':
13255
- return asciiSlice(this, start, end);
13256
- case 'latin1':
13257
- case 'binary':
13258
- return latin1Slice(this, start, end);
13259
- case 'base64':
13260
- return base64Slice(this, start, end);
13261
- case 'ucs2':
13262
- case 'ucs-2':
13263
- case 'utf16le':
13264
- case 'utf-16le':
13265
- return utf16leSlice(this, start, end);
13266
- default:
13267
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
13268
- encoding = (encoding + '').toLowerCase();
13269
- loweredCase = true;
13270
- }
13271
- }
13272
- }
13273
-
13274
- // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
13275
- // Buffer instances.
13276
- Buffer$2.prototype._isBuffer = true;
13277
- function swap(b, n, m) {
13278
- var i = b[n];
13279
- b[n] = b[m];
13280
- b[m] = i;
13281
- }
13282
- Buffer$2.prototype.swap16 = function swap16() {
13283
- var len = this.length;
13284
- if (len % 2 !== 0) {
13285
- throw new RangeError('Buffer size must be a multiple of 16-bits');
13286
- }
13287
- for (var i = 0; i < len; i += 2) {
13288
- swap(this, i, i + 1);
13289
- }
13290
- return this;
13291
- };
13292
- Buffer$2.prototype.swap32 = function swap32() {
13293
- var len = this.length;
13294
- if (len % 4 !== 0) {
13295
- throw new RangeError('Buffer size must be a multiple of 32-bits');
13296
- }
13297
- for (var i = 0; i < len; i += 4) {
13298
- swap(this, i, i + 3);
13299
- swap(this, i + 1, i + 2);
13300
- }
13301
- return this;
13302
- };
13303
- Buffer$2.prototype.swap64 = function swap64() {
13304
- var len = this.length;
13305
- if (len % 8 !== 0) {
13306
- throw new RangeError('Buffer size must be a multiple of 64-bits');
13307
- }
13308
- for (var i = 0; i < len; i += 8) {
13309
- swap(this, i, i + 7);
13310
- swap(this, i + 1, i + 6);
13311
- swap(this, i + 2, i + 5);
13312
- swap(this, i + 3, i + 4);
13313
- }
13314
- return this;
13315
- };
13316
- Buffer$2.prototype.toString = function toString() {
13317
- var length = this.length | 0;
13318
- if (length === 0) return '';
13319
- if (arguments.length === 0) return utf8Slice(this, 0, length);
13320
- return slowToString.apply(this, arguments);
13321
- };
13322
- Buffer$2.prototype.equals = function equals(b) {
13323
- if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer');
13324
- if (this === b) return true;
13325
- return Buffer$2.compare(this, b) === 0;
13326
- };
13327
- Buffer$2.prototype.inspect = function inspect() {
13328
- var str = '';
13329
- var max = INSPECT_MAX_BYTES;
13330
- if (this.length > 0) {
13331
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
13332
- if (this.length > max) str += ' ... ';
13333
- }
13334
- return '<Buffer ' + str + '>';
13335
- };
13336
- Buffer$2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
13337
- if (!internalIsBuffer(target)) {
13338
- throw new TypeError('Argument must be a Buffer');
13339
- }
13340
- if (start === undefined) {
13341
- start = 0;
13342
- }
13343
- if (end === undefined) {
13344
- end = target ? target.length : 0;
13345
- }
13346
- if (thisStart === undefined) {
13347
- thisStart = 0;
13348
- }
13349
- if (thisEnd === undefined) {
13350
- thisEnd = this.length;
13351
- }
13352
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
13353
- throw new RangeError('out of range index');
13354
- }
13355
- if (thisStart >= thisEnd && start >= end) {
13356
- return 0;
13357
- }
13358
- if (thisStart >= thisEnd) {
13359
- return -1;
13360
- }
13361
- if (start >= end) {
13362
- return 1;
13363
- }
13364
- start >>>= 0;
13365
- end >>>= 0;
13366
- thisStart >>>= 0;
13367
- thisEnd >>>= 0;
13368
- if (this === target) return 0;
13369
- var x = thisEnd - thisStart;
13370
- var y = end - start;
13371
- var len = Math.min(x, y);
13372
- var thisCopy = this.slice(thisStart, thisEnd);
13373
- var targetCopy = target.slice(start, end);
13374
- for (var i = 0; i < len; ++i) {
13375
- if (thisCopy[i] !== targetCopy[i]) {
13376
- x = thisCopy[i];
13377
- y = targetCopy[i];
13378
- break;
13379
- }
13380
- }
13381
- if (x < y) return -1;
13382
- if (y < x) return 1;
13383
- return 0;
13384
- };
13385
-
13386
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
13387
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
13388
- //
13389
- // Arguments:
13390
- // - buffer - a Buffer to search
13391
- // - val - a string, Buffer, or number
13392
- // - byteOffset - an index into `buffer`; will be clamped to an int32
13393
- // - encoding - an optional encoding, relevant is val is a string
13394
- // - dir - true for indexOf, false for lastIndexOf
13395
- function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
13396
- // Empty buffer means no match
13397
- if (buffer.length === 0) return -1;
13398
-
13399
- // Normalize byteOffset
13400
- if (typeof byteOffset === 'string') {
13401
- encoding = byteOffset;
13402
- byteOffset = 0;
13403
- } else if (byteOffset > 0x7fffffff) {
13404
- byteOffset = 0x7fffffff;
13405
- } else if (byteOffset < -0x80000000) {
13406
- byteOffset = -0x80000000;
13407
- }
13408
- byteOffset = +byteOffset; // Coerce to Number.
13409
- if (isNaN(byteOffset)) {
13410
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
13411
- byteOffset = dir ? 0 : buffer.length - 1;
13412
- }
13413
-
13414
- // Normalize byteOffset: negative offsets start from the end of the buffer
13415
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
13416
- if (byteOffset >= buffer.length) {
13417
- if (dir) return -1;else byteOffset = buffer.length - 1;
13418
- } else if (byteOffset < 0) {
13419
- if (dir) byteOffset = 0;else return -1;
13420
- }
13421
-
13422
- // Normalize val
13423
- if (typeof val === 'string') {
13424
- val = Buffer$2.from(val, encoding);
13425
- }
13426
-
13427
- // Finally, search either indexOf (if dir is true) or lastIndexOf
13428
- if (internalIsBuffer(val)) {
13429
- // Special case: looking for empty string/buffer always fails
13430
- if (val.length === 0) {
13431
- return -1;
13432
- }
13433
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
13434
- } else if (typeof val === 'number') {
13435
- val = val & 0xFF; // Search for a byte value [0-255]
13436
- if (Buffer$2.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
13437
- if (dir) {
13438
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
13439
- } else {
13440
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
13441
- }
13442
- }
13443
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
13444
- }
13445
- throw new TypeError('val must be string, number or Buffer');
13446
- }
13447
- function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
13448
- var indexSize = 1;
13449
- var arrLength = arr.length;
13450
- var valLength = val.length;
13451
- if (encoding !== undefined) {
13452
- encoding = String(encoding).toLowerCase();
13453
- if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
13454
- if (arr.length < 2 || val.length < 2) {
13455
- return -1;
13456
- }
13457
- indexSize = 2;
13458
- arrLength /= 2;
13459
- valLength /= 2;
13460
- byteOffset /= 2;
13461
- }
13462
- }
13463
- function read(buf, i) {
13464
- if (indexSize === 1) {
13465
- return buf[i];
13466
- } else {
13467
- return buf.readUInt16BE(i * indexSize);
13468
- }
13469
- }
13470
- var i;
13471
- if (dir) {
13472
- var foundIndex = -1;
13473
- for (i = byteOffset; i < arrLength; i++) {
13474
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
13475
- if (foundIndex === -1) foundIndex = i;
13476
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
13477
- } else {
13478
- if (foundIndex !== -1) i -= i - foundIndex;
13479
- foundIndex = -1;
13480
- }
13481
- }
13482
- } else {
13483
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
13484
- for (i = byteOffset; i >= 0; i--) {
13485
- var found = true;
13486
- for (var j = 0; j < valLength; j++) {
13487
- if (read(arr, i + j) !== read(val, j)) {
13488
- found = false;
13489
- break;
13490
- }
13491
- }
13492
- if (found) return i;
13493
- }
13494
- }
13495
- return -1;
13496
- }
13497
- Buffer$2.prototype.includes = function includes(val, byteOffset, encoding) {
13498
- return this.indexOf(val, byteOffset, encoding) !== -1;
13499
- };
13500
- Buffer$2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
13501
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
13502
- };
13503
- Buffer$2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
13504
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
13505
- };
13506
- function hexWrite(buf, string, offset, length) {
13507
- offset = Number(offset) || 0;
13508
- var remaining = buf.length - offset;
13509
- if (!length) {
13510
- length = remaining;
13511
- } else {
13512
- length = Number(length);
13513
- if (length > remaining) {
13514
- length = remaining;
13515
- }
13516
- }
13517
-
13518
- // must be an even number of digits
13519
- var strLen = string.length;
13520
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
13521
- if (length > strLen / 2) {
13522
- length = strLen / 2;
13523
- }
13524
- for (var i = 0; i < length; ++i) {
13525
- var parsed = parseInt(string.substr(i * 2, 2), 16);
13526
- if (isNaN(parsed)) return i;
13527
- buf[offset + i] = parsed;
13528
- }
13529
- return i;
13530
- }
13531
- function utf8Write(buf, string, offset, length) {
13532
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
13533
- }
13534
- function asciiWrite(buf, string, offset, length) {
13535
- return blitBuffer(asciiToBytes(string), buf, offset, length);
13536
- }
13537
- function latin1Write(buf, string, offset, length) {
13538
- return asciiWrite(buf, string, offset, length);
13539
- }
13540
- function base64Write(buf, string, offset, length) {
13541
- return blitBuffer(base64ToBytes(string), buf, offset, length);
13542
- }
13543
- function ucs2Write(buf, string, offset, length) {
13544
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
13545
- }
13546
- Buffer$2.prototype.write = function write(string, offset, length, encoding) {
13547
- // Buffer#write(string)
13548
- if (offset === undefined) {
13549
- encoding = 'utf8';
13550
- length = this.length;
13551
- offset = 0;
13552
- // Buffer#write(string, encoding)
13553
- } else if (length === undefined && typeof offset === 'string') {
13554
- encoding = offset;
13555
- length = this.length;
13556
- offset = 0;
13557
- // Buffer#write(string, offset[, length][, encoding])
13558
- } else if (isFinite(offset)) {
13559
- offset = offset | 0;
13560
- if (isFinite(length)) {
13561
- length = length | 0;
13562
- if (encoding === undefined) encoding = 'utf8';
13563
- } else {
13564
- encoding = length;
13565
- length = undefined;
13566
- }
13567
- // legacy write(string, encoding, offset, length) - remove in v0.13
13568
- } else {
13569
- throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
13570
- }
13571
- var remaining = this.length - offset;
13572
- if (length === undefined || length > remaining) length = remaining;
13573
- if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
13574
- throw new RangeError('Attempt to write outside buffer bounds');
13575
- }
13576
- if (!encoding) encoding = 'utf8';
13577
- var loweredCase = false;
13578
- for (;;) {
13579
- switch (encoding) {
13580
- case 'hex':
13581
- return hexWrite(this, string, offset, length);
13582
- case 'utf8':
13583
- case 'utf-8':
13584
- return utf8Write(this, string, offset, length);
13585
- case 'ascii':
13586
- return asciiWrite(this, string, offset, length);
13587
- case 'latin1':
13588
- case 'binary':
13589
- return latin1Write(this, string, offset, length);
13590
- case 'base64':
13591
- // Warning: maxLength not taken into account in base64Write
13592
- return base64Write(this, string, offset, length);
13593
- case 'ucs2':
13594
- case 'ucs-2':
13595
- case 'utf16le':
13596
- case 'utf-16le':
13597
- return ucs2Write(this, string, offset, length);
13598
- default:
13599
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
13600
- encoding = ('' + encoding).toLowerCase();
13601
- loweredCase = true;
13602
- }
13603
- }
13604
- };
13605
- Buffer$2.prototype.toJSON = function toJSON() {
13606
- return {
13607
- type: 'Buffer',
13608
- data: Array.prototype.slice.call(this._arr || this, 0)
13609
- };
13610
- };
13611
- function base64Slice(buf, start, end) {
13612
- if (start === 0 && end === buf.length) {
13613
- return fromByteArray(buf);
13614
- } else {
13615
- return fromByteArray(buf.slice(start, end));
13616
- }
13617
- }
13618
- function utf8Slice(buf, start, end) {
13619
- end = Math.min(buf.length, end);
13620
- var res = [];
13621
- var i = start;
13622
- while (i < end) {
13623
- var firstByte = buf[i];
13624
- var codePoint = null;
13625
- var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
13626
- if (i + bytesPerSequence <= end) {
13627
- var secondByte, thirdByte, fourthByte, tempCodePoint;
13628
- switch (bytesPerSequence) {
13629
- case 1:
13630
- if (firstByte < 0x80) {
13631
- codePoint = firstByte;
13632
- }
13633
- break;
13634
- case 2:
13635
- secondByte = buf[i + 1];
13636
- if ((secondByte & 0xC0) === 0x80) {
13637
- tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
13638
- if (tempCodePoint > 0x7F) {
13639
- codePoint = tempCodePoint;
13640
- }
13641
- }
13642
- break;
13643
- case 3:
13644
- secondByte = buf[i + 1];
13645
- thirdByte = buf[i + 2];
13646
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
13647
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
13648
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
13649
- codePoint = tempCodePoint;
13650
- }
13651
- }
13652
- break;
13653
- case 4:
13654
- secondByte = buf[i + 1];
13655
- thirdByte = buf[i + 2];
13656
- fourthByte = buf[i + 3];
13657
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
13658
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
13659
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
13660
- codePoint = tempCodePoint;
13661
- }
13662
- }
13663
- }
13664
- }
13665
- if (codePoint === null) {
13666
- // we did not generate a valid codePoint so insert a
13667
- // replacement char (U+FFFD) and advance only 1 byte
13668
- codePoint = 0xFFFD;
13669
- bytesPerSequence = 1;
13670
- } else if (codePoint > 0xFFFF) {
13671
- // encode to utf16 (surrogate pair dance)
13672
- codePoint -= 0x10000;
13673
- res.push(codePoint >>> 10 & 0x3FF | 0xD800);
13674
- codePoint = 0xDC00 | codePoint & 0x3FF;
13675
- }
13676
- res.push(codePoint);
13677
- i += bytesPerSequence;
13678
- }
13679
- return decodeCodePointsArray(res);
13680
- }
13681
-
13682
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
13683
- // the lowest limit is Chrome, with 0x10000 args.
13684
- // We go 1 magnitude less, for safety
13685
- var MAX_ARGUMENTS_LENGTH = 0x1000;
13686
- function decodeCodePointsArray(codePoints) {
13687
- var len = codePoints.length;
13688
- if (len <= MAX_ARGUMENTS_LENGTH) {
13689
- return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
13690
- }
13691
-
13692
- // Decode in chunks to avoid "call stack size exceeded".
13693
- var res = '';
13694
- var i = 0;
13695
- while (i < len) {
13696
- res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
13697
- }
13698
- return res;
13699
- }
13700
- function asciiSlice(buf, start, end) {
13701
- var ret = '';
13702
- end = Math.min(buf.length, end);
13703
- for (var i = start; i < end; ++i) {
13704
- ret += String.fromCharCode(buf[i] & 0x7F);
13705
- }
13706
- return ret;
13707
- }
13708
- function latin1Slice(buf, start, end) {
13709
- var ret = '';
13710
- end = Math.min(buf.length, end);
13711
- for (var i = start; i < end; ++i) {
13712
- ret += String.fromCharCode(buf[i]);
13713
- }
13714
- return ret;
13715
- }
13716
- function hexSlice(buf, start, end) {
13717
- var len = buf.length;
13718
- if (!start || start < 0) start = 0;
13719
- if (!end || end < 0 || end > len) end = len;
13720
- var out = '';
13721
- for (var i = start; i < end; ++i) {
13722
- out += toHex(buf[i]);
13723
- }
13724
- return out;
13725
- }
13726
- function utf16leSlice(buf, start, end) {
13727
- var bytes = buf.slice(start, end);
13728
- var res = '';
13729
- for (var i = 0; i < bytes.length; i += 2) {
13730
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
13731
- }
13732
- return res;
13733
- }
13734
- Buffer$2.prototype.slice = function slice(start, end) {
13735
- var len = this.length;
13736
- start = ~~start;
13737
- end = end === undefined ? len : ~~end;
13738
- if (start < 0) {
13739
- start += len;
13740
- if (start < 0) start = 0;
13741
- } else if (start > len) {
13742
- start = len;
13743
- }
13744
- if (end < 0) {
13745
- end += len;
13746
- if (end < 0) end = 0;
13747
- } else if (end > len) {
13748
- end = len;
13749
- }
13750
- if (end < start) end = start;
13751
- var newBuf;
13752
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
13753
- newBuf = this.subarray(start, end);
13754
- newBuf.__proto__ = Buffer$2.prototype;
13755
- } else {
13756
- var sliceLen = end - start;
13757
- newBuf = new Buffer$2(sliceLen, undefined);
13758
- for (var i = 0; i < sliceLen; ++i) {
13759
- newBuf[i] = this[i + start];
13760
- }
13761
- }
13762
- return newBuf;
13763
- };
13764
-
13765
- /*
13766
- * Need to make sure that buffer isn't trying to write out of bounds.
13767
- */
13768
- function checkOffset(offset, ext, length) {
13769
- if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
13770
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
13771
- }
13772
- Buffer$2.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
13773
- offset = offset | 0;
13774
- byteLength = byteLength | 0;
13775
- if (!noAssert) checkOffset(offset, byteLength, this.length);
13776
- var val = this[offset];
13777
- var mul = 1;
13778
- var i = 0;
13779
- while (++i < byteLength && (mul *= 0x100)) {
13780
- val += this[offset + i] * mul;
13781
- }
13782
- return val;
13783
- };
13784
- Buffer$2.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
13785
- offset = offset | 0;
13786
- byteLength = byteLength | 0;
13787
- if (!noAssert) {
13788
- checkOffset(offset, byteLength, this.length);
13789
- }
13790
- var val = this[offset + --byteLength];
13791
- var mul = 1;
13792
- while (byteLength > 0 && (mul *= 0x100)) {
13793
- val += this[offset + --byteLength] * mul;
13794
- }
13795
- return val;
13796
- };
13797
- Buffer$2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
13798
- if (!noAssert) checkOffset(offset, 1, this.length);
13799
- return this[offset];
13800
- };
13801
- Buffer$2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
13802
- if (!noAssert) checkOffset(offset, 2, this.length);
13803
- return this[offset] | this[offset + 1] << 8;
13804
- };
13805
- Buffer$2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
13806
- if (!noAssert) checkOffset(offset, 2, this.length);
13807
- return this[offset] << 8 | this[offset + 1];
13808
- };
13809
- Buffer$2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
13810
- if (!noAssert) checkOffset(offset, 4, this.length);
13811
- return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
13812
- };
13813
- Buffer$2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
13814
- if (!noAssert) checkOffset(offset, 4, this.length);
13815
- return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
13816
- };
13817
- Buffer$2.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
13818
- offset = offset | 0;
13819
- byteLength = byteLength | 0;
13820
- if (!noAssert) checkOffset(offset, byteLength, this.length);
13821
- var val = this[offset];
13822
- var mul = 1;
13823
- var i = 0;
13824
- while (++i < byteLength && (mul *= 0x100)) {
13825
- val += this[offset + i] * mul;
13826
- }
13827
- mul *= 0x80;
13828
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
13829
- return val;
13830
- };
13831
- Buffer$2.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
13832
- offset = offset | 0;
13833
- byteLength = byteLength | 0;
13834
- if (!noAssert) checkOffset(offset, byteLength, this.length);
13835
- var i = byteLength;
13836
- var mul = 1;
13837
- var val = this[offset + --i];
13838
- while (i > 0 && (mul *= 0x100)) {
13839
- val += this[offset + --i] * mul;
13840
- }
13841
- mul *= 0x80;
13842
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
13843
- return val;
13844
- };
13845
- Buffer$2.prototype.readInt8 = function readInt8(offset, noAssert) {
13846
- if (!noAssert) checkOffset(offset, 1, this.length);
13847
- if (!(this[offset] & 0x80)) return this[offset];
13848
- return (0xff - this[offset] + 1) * -1;
13849
- };
13850
- Buffer$2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
13851
- if (!noAssert) checkOffset(offset, 2, this.length);
13852
- var val = this[offset] | this[offset + 1] << 8;
13853
- return val & 0x8000 ? val | 0xFFFF0000 : val;
13854
- };
13855
- Buffer$2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
13856
- if (!noAssert) checkOffset(offset, 2, this.length);
13857
- var val = this[offset + 1] | this[offset] << 8;
13858
- return val & 0x8000 ? val | 0xFFFF0000 : val;
13859
- };
13860
- Buffer$2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
13861
- if (!noAssert) checkOffset(offset, 4, this.length);
13862
- return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
13863
- };
13864
- Buffer$2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
13865
- if (!noAssert) checkOffset(offset, 4, this.length);
13866
- return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
13867
- };
13868
- Buffer$2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
13869
- if (!noAssert) checkOffset(offset, 4, this.length);
13870
- return read(this, offset, true, 23, 4);
13871
- };
13872
- Buffer$2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
13873
- if (!noAssert) checkOffset(offset, 4, this.length);
13874
- return read(this, offset, false, 23, 4);
13875
- };
13876
- Buffer$2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
13877
- if (!noAssert) checkOffset(offset, 8, this.length);
13878
- return read(this, offset, true, 52, 8);
13879
- };
13880
- Buffer$2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
13881
- if (!noAssert) checkOffset(offset, 8, this.length);
13882
- return read(this, offset, false, 52, 8);
13883
- };
13884
- function checkInt(buf, value, offset, ext, max, min) {
13885
- if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
13886
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
13887
- if (offset + ext > buf.length) throw new RangeError('Index out of range');
13888
- }
13889
- Buffer$2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
13890
- value = +value;
13891
- offset = offset | 0;
13892
- byteLength = byteLength | 0;
13893
- if (!noAssert) {
13894
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
13895
- checkInt(this, value, offset, byteLength, maxBytes, 0);
13896
- }
13897
- var mul = 1;
13898
- var i = 0;
13899
- this[offset] = value & 0xFF;
13900
- while (++i < byteLength && (mul *= 0x100)) {
13901
- this[offset + i] = value / mul & 0xFF;
13902
- }
13903
- return offset + byteLength;
13904
- };
13905
- Buffer$2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
13906
- value = +value;
13907
- offset = offset | 0;
13908
- byteLength = byteLength | 0;
13909
- if (!noAssert) {
13910
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
13911
- checkInt(this, value, offset, byteLength, maxBytes, 0);
13912
- }
13913
- var i = byteLength - 1;
13914
- var mul = 1;
13915
- this[offset + i] = value & 0xFF;
13916
- while (--i >= 0 && (mul *= 0x100)) {
13917
- this[offset + i] = value / mul & 0xFF;
13918
- }
13919
- return offset + byteLength;
13920
- };
13921
- Buffer$2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
13922
- value = +value;
13923
- offset = offset | 0;
13924
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
13925
- if (!Buffer$2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
13926
- this[offset] = value & 0xff;
13927
- return offset + 1;
13928
- };
13929
- function objectWriteUInt16(buf, value, offset, littleEndian) {
13930
- if (value < 0) value = 0xffff + value + 1;
13931
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
13932
- buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
13933
- }
13934
- }
13935
- Buffer$2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
13936
- value = +value;
13937
- offset = offset | 0;
13938
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
13939
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
13940
- this[offset] = value & 0xff;
13941
- this[offset + 1] = value >>> 8;
13942
- } else {
13943
- objectWriteUInt16(this, value, offset, true);
13944
- }
13945
- return offset + 2;
13946
- };
13947
- Buffer$2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
13948
- value = +value;
13949
- offset = offset | 0;
13950
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
13951
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
13952
- this[offset] = value >>> 8;
13953
- this[offset + 1] = value & 0xff;
13954
- } else {
13955
- objectWriteUInt16(this, value, offset, false);
13956
- }
13957
- return offset + 2;
13958
- };
13959
- function objectWriteUInt32(buf, value, offset, littleEndian) {
13960
- if (value < 0) value = 0xffffffff + value + 1;
13961
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
13962
- buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
13963
- }
13964
- }
13965
- Buffer$2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
13966
- value = +value;
13967
- offset = offset | 0;
13968
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
13969
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
13970
- this[offset + 3] = value >>> 24;
13971
- this[offset + 2] = value >>> 16;
13972
- this[offset + 1] = value >>> 8;
13973
- this[offset] = value & 0xff;
13974
- } else {
13975
- objectWriteUInt32(this, value, offset, true);
13976
- }
13977
- return offset + 4;
13978
- };
13979
- Buffer$2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
13980
- value = +value;
13981
- offset = offset | 0;
13982
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
13983
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
13984
- this[offset] = value >>> 24;
13985
- this[offset + 1] = value >>> 16;
13986
- this[offset + 2] = value >>> 8;
13987
- this[offset + 3] = value & 0xff;
13988
- } else {
13989
- objectWriteUInt32(this, value, offset, false);
13990
- }
13991
- return offset + 4;
13992
- };
13993
- Buffer$2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
13994
- value = +value;
13995
- offset = offset | 0;
13996
- if (!noAssert) {
13997
- var limit = Math.pow(2, 8 * byteLength - 1);
13998
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
13999
- }
14000
- var i = 0;
14001
- var mul = 1;
14002
- var sub = 0;
14003
- this[offset] = value & 0xFF;
14004
- while (++i < byteLength && (mul *= 0x100)) {
14005
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
14006
- sub = 1;
14007
- }
14008
- this[offset + i] = (value / mul >> 0) - sub & 0xFF;
14009
- }
14010
- return offset + byteLength;
14011
- };
14012
- Buffer$2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
14013
- value = +value;
14014
- offset = offset | 0;
14015
- if (!noAssert) {
14016
- var limit = Math.pow(2, 8 * byteLength - 1);
14017
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
14018
- }
14019
- var i = byteLength - 1;
14020
- var mul = 1;
14021
- var sub = 0;
14022
- this[offset + i] = value & 0xFF;
14023
- while (--i >= 0 && (mul *= 0x100)) {
14024
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
14025
- sub = 1;
14026
- }
14027
- this[offset + i] = (value / mul >> 0) - sub & 0xFF;
14028
- }
14029
- return offset + byteLength;
14030
- };
14031
- Buffer$2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
14032
- value = +value;
14033
- offset = offset | 0;
14034
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
14035
- if (!Buffer$2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
14036
- if (value < 0) value = 0xff + value + 1;
14037
- this[offset] = value & 0xff;
14038
- return offset + 1;
14039
- };
14040
- Buffer$2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
14041
- value = +value;
14042
- offset = offset | 0;
14043
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
14044
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
14045
- this[offset] = value & 0xff;
14046
- this[offset + 1] = value >>> 8;
14047
- } else {
14048
- objectWriteUInt16(this, value, offset, true);
14049
- }
14050
- return offset + 2;
14051
- };
14052
- Buffer$2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
14053
- value = +value;
14054
- offset = offset | 0;
14055
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
14056
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
14057
- this[offset] = value >>> 8;
14058
- this[offset + 1] = value & 0xff;
14059
- } else {
14060
- objectWriteUInt16(this, value, offset, false);
14061
- }
14062
- return offset + 2;
14063
- };
14064
- Buffer$2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
14065
- value = +value;
14066
- offset = offset | 0;
14067
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
14068
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
14069
- this[offset] = value & 0xff;
14070
- this[offset + 1] = value >>> 8;
14071
- this[offset + 2] = value >>> 16;
14072
- this[offset + 3] = value >>> 24;
14073
- } else {
14074
- objectWriteUInt32(this, value, offset, true);
14075
- }
14076
- return offset + 4;
14077
- };
14078
- Buffer$2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
14079
- value = +value;
14080
- offset = offset | 0;
14081
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
14082
- if (value < 0) value = 0xffffffff + value + 1;
14083
- if (Buffer$2.TYPED_ARRAY_SUPPORT) {
14084
- this[offset] = value >>> 24;
14085
- this[offset + 1] = value >>> 16;
14086
- this[offset + 2] = value >>> 8;
14087
- this[offset + 3] = value & 0xff;
14088
- } else {
14089
- objectWriteUInt32(this, value, offset, false);
14090
- }
14091
- return offset + 4;
14092
- };
14093
- function checkIEEE754(buf, value, offset, ext, max, min) {
14094
- if (offset + ext > buf.length) throw new RangeError('Index out of range');
14095
- if (offset < 0) throw new RangeError('Index out of range');
14096
- }
14097
- function writeFloat(buf, value, offset, littleEndian, noAssert) {
14098
- if (!noAssert) {
14099
- checkIEEE754(buf, value, offset, 4);
14100
- }
14101
- write(buf, value, offset, littleEndian, 23, 4);
14102
- return offset + 4;
14103
- }
14104
- Buffer$2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
14105
- return writeFloat(this, value, offset, true, noAssert);
14106
- };
14107
- Buffer$2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
14108
- return writeFloat(this, value, offset, false, noAssert);
14109
- };
14110
- function writeDouble(buf, value, offset, littleEndian, noAssert) {
14111
- if (!noAssert) {
14112
- checkIEEE754(buf, value, offset, 8);
14113
- }
14114
- write(buf, value, offset, littleEndian, 52, 8);
14115
- return offset + 8;
14116
- }
14117
- Buffer$2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
14118
- return writeDouble(this, value, offset, true, noAssert);
14119
- };
14120
- Buffer$2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
14121
- return writeDouble(this, value, offset, false, noAssert);
14122
- };
14123
-
14124
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
14125
- Buffer$2.prototype.copy = function copy(target, targetStart, start, end) {
14126
- if (!start) start = 0;
14127
- if (!end && end !== 0) end = this.length;
14128
- if (targetStart >= target.length) targetStart = target.length;
14129
- if (!targetStart) targetStart = 0;
14130
- if (end > 0 && end < start) end = start;
14131
-
14132
- // Copy 0 bytes; we're done
14133
- if (end === start) return 0;
14134
- if (target.length === 0 || this.length === 0) return 0;
14135
-
14136
- // Fatal error conditions
14137
- if (targetStart < 0) {
14138
- throw new RangeError('targetStart out of bounds');
14139
- }
14140
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
14141
- if (end < 0) throw new RangeError('sourceEnd out of bounds');
14142
-
14143
- // Are we oob?
14144
- if (end > this.length) end = this.length;
14145
- if (target.length - targetStart < end - start) {
14146
- end = target.length - targetStart + start;
14147
- }
14148
- var len = end - start;
14149
- var i;
14150
- if (this === target && start < targetStart && targetStart < end) {
14151
- // descending copy from end
14152
- for (i = len - 1; i >= 0; --i) {
14153
- target[i + targetStart] = this[i + start];
14154
- }
14155
- } else if (len < 1000 || !Buffer$2.TYPED_ARRAY_SUPPORT) {
14156
- // ascending copy from start
14157
- for (i = 0; i < len; ++i) {
14158
- target[i + targetStart] = this[i + start];
14159
- }
14160
- } else {
14161
- Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
14162
- }
14163
- return len;
14164
- };
14165
-
14166
- // Usage:
14167
- // buffer.fill(number[, offset[, end]])
14168
- // buffer.fill(buffer[, offset[, end]])
14169
- // buffer.fill(string[, offset[, end]][, encoding])
14170
- Buffer$2.prototype.fill = function fill(val, start, end, encoding) {
14171
- // Handle string cases:
14172
- if (typeof val === 'string') {
14173
- if (typeof start === 'string') {
14174
- encoding = start;
14175
- start = 0;
14176
- end = this.length;
14177
- } else if (typeof end === 'string') {
14178
- encoding = end;
14179
- end = this.length;
14180
- }
14181
- if (val.length === 1) {
14182
- var code = val.charCodeAt(0);
14183
- if (code < 256) {
14184
- val = code;
14185
- }
14186
- }
14187
- if (encoding !== undefined && typeof encoding !== 'string') {
14188
- throw new TypeError('encoding must be a string');
14189
- }
14190
- if (typeof encoding === 'string' && !Buffer$2.isEncoding(encoding)) {
14191
- throw new TypeError('Unknown encoding: ' + encoding);
14192
- }
14193
- } else if (typeof val === 'number') {
14194
- val = val & 255;
14195
- }
14196
-
14197
- // Invalid ranges are not set to a default, so can range check early.
14198
- if (start < 0 || this.length < start || this.length < end) {
14199
- throw new RangeError('Out of range index');
14200
- }
14201
- if (end <= start) {
14202
- return this;
14203
- }
14204
- start = start >>> 0;
14205
- end = end === undefined ? this.length : end >>> 0;
14206
- if (!val) val = 0;
14207
- var i;
14208
- if (typeof val === 'number') {
14209
- for (i = start; i < end; ++i) {
14210
- this[i] = val;
14211
- }
14212
- } else {
14213
- var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer$2(val, encoding).toString());
14214
- var len = bytes.length;
14215
- for (i = 0; i < end - start; ++i) {
14216
- this[i + start] = bytes[i % len];
14217
- }
14218
- }
14219
- return this;
14220
- };
14221
-
14222
- // HELPER FUNCTIONS
14223
- // ================
14224
-
14225
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
14226
- function base64clean(str) {
14227
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
14228
- str = stringtrim(str).replace(INVALID_BASE64_RE, '');
14229
- // Node converts strings with length < 2 to ''
14230
- if (str.length < 2) return '';
14231
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
14232
- while (str.length % 4 !== 0) {
14233
- str = str + '=';
14234
- }
14235
- return str;
14236
- }
14237
- function stringtrim(str) {
14238
- if (str.trim) return str.trim();
14239
- return str.replace(/^\s+|\s+$/g, '');
14240
- }
14241
- function toHex(n) {
14242
- if (n < 16) return '0' + n.toString(16);
14243
- return n.toString(16);
14244
- }
14245
- function utf8ToBytes(string, units) {
14246
- units = units || Infinity;
14247
- var codePoint;
14248
- var length = string.length;
14249
- var leadSurrogate = null;
14250
- var bytes = [];
14251
- for (var i = 0; i < length; ++i) {
14252
- codePoint = string.charCodeAt(i);
14253
-
14254
- // is surrogate component
14255
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
14256
- // last char was a lead
14257
- if (!leadSurrogate) {
14258
- // no lead yet
14259
- if (codePoint > 0xDBFF) {
14260
- // unexpected trail
14261
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
14262
- continue;
14263
- } else if (i + 1 === length) {
14264
- // unpaired lead
14265
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
14266
- continue;
14267
- }
14268
-
14269
- // valid lead
14270
- leadSurrogate = codePoint;
14271
- continue;
14272
- }
14273
-
14274
- // 2 leads in a row
14275
- if (codePoint < 0xDC00) {
14276
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
14277
- leadSurrogate = codePoint;
14278
- continue;
14279
- }
14280
-
14281
- // valid surrogate pair
14282
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
14283
- } else if (leadSurrogate) {
14284
- // valid bmp char, but last char was a lead
14285
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
14286
- }
14287
- leadSurrogate = null;
14288
-
14289
- // encode utf8
14290
- if (codePoint < 0x80) {
14291
- if ((units -= 1) < 0) break;
14292
- bytes.push(codePoint);
14293
- } else if (codePoint < 0x800) {
14294
- if ((units -= 2) < 0) break;
14295
- bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
14296
- } else if (codePoint < 0x10000) {
14297
- if ((units -= 3) < 0) break;
14298
- bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
14299
- } else if (codePoint < 0x110000) {
14300
- if ((units -= 4) < 0) break;
14301
- bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
14302
- } else {
14303
- throw new Error('Invalid code point');
14304
- }
14305
- }
14306
- return bytes;
14307
- }
14308
- function asciiToBytes(str) {
14309
- var byteArray = [];
14310
- for (var i = 0; i < str.length; ++i) {
14311
- // Node's code seems to be doing this and not & 0x7F..
14312
- byteArray.push(str.charCodeAt(i) & 0xFF);
14313
- }
14314
- return byteArray;
14315
- }
14316
- function utf16leToBytes(str, units) {
14317
- var c, hi, lo;
14318
- var byteArray = [];
14319
- for (var i = 0; i < str.length; ++i) {
14320
- if ((units -= 2) < 0) break;
14321
- c = str.charCodeAt(i);
14322
- hi = c >> 8;
14323
- lo = c % 256;
14324
- byteArray.push(lo);
14325
- byteArray.push(hi);
14326
- }
14327
- return byteArray;
14328
- }
14329
- function base64ToBytes(str) {
14330
- return toByteArray(base64clean(str));
14331
- }
14332
- function blitBuffer(src, dst, offset, length) {
14333
- for (var i = 0; i < length; ++i) {
14334
- if (i + offset >= dst.length || i >= src.length) break;
14335
- dst[i + offset] = src[i];
14336
- }
14337
- return i;
14338
- }
14339
- function isnan(val) {
14340
- return val !== val; // eslint-disable-line no-self-compare
14341
- }
14342
-
14343
- // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
14344
- // The _isBuffer check is for Safari 5-7 support, because it's missing
14345
- // Object.prototype.constructor. Remove this eventually
14346
- function isBuffer$1(obj) {
14347
- return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
14348
- }
14349
- function isFastBuffer(obj) {
14350
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
14351
- }
14352
-
14353
- // For Node v0.10 support. Remove this eventually.
14354
- function isSlowBuffer(obj) {
14355
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0));
14356
- }
14357
-
14358
12754
  /**
14359
12755
  * return an decoded URL Safe Base64 as UTF-8 encoded string
14360
12756
  */
@@ -14362,8 +12758,8 @@ function decodeBase64UrlSafe(base64) {
14362
12758
  // Add removed at end '='
14363
12759
  // base64 += Array(5 - base64.length % 4).join('=');
14364
12760
 
14365
- base64 = base64.replace(/\-/g, '+') // Convert '-' to '+'
14366
- .replace(/\_/g, '/'); // Convert '_' to '/'
12761
+ base64 = base64.replace(/-/g, '+') // Convert '-' to '+'
12762
+ .replace(/_/g, '/'); // Convert '_' to '/'
14367
12763
 
14368
12764
  return decodeBase64(base64); // Cf: https://developer.mozilla.org/fr/docs/D%C3%A9coder_encoder_en_base64
14369
12765
  }
@@ -14619,6 +13015,7 @@ function createClient(creationConfig) {
14619
13015
  })["catch"](console.error);
14620
13016
  });
14621
13017
  return {
13018
+ core: coreClient,
14622
13019
  showAuth: function showAuth(options) {
14623
13020
  return client.then(function (client) {
14624
13021
  return client.showAuth(options);