((typeof self !== 'undefined' ? self : this)["webpackJsonpctos3_lowcode"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpctos3_lowcode"] || []).push([[2],{

/***/ "5326":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_style_index_0_id_c23022b2_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("e0aa");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_style_index_0_id_c23022b2_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_style_index_0_id_c23022b2_lang_less_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */


/***/ }),

/***/ "ac2a":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"2d08ed0a-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/user/Login.vue?vue&type=template&id=c23022b2&scoped=true&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"main",staticStyle:{"margin-top":"20%"}},[_c('a-form',{ref:"formLogin",staticClass:"user-layout-login",staticStyle:{"margin-top":"10px"},attrs:{"id":"formLogin","form":_vm.form}},[(_vm.isLoginError)?_c('a-alert',{staticStyle:{"margin-bottom":"24px"},attrs:{"type":"error","showIcon":"","message":"账户或密码错误"}}):_vm._e(),_c('a-form-item',[_c('j-input',{directives:[{name:"decorator",rawName:"v-decorator",value:([
          'username',
          {
            rules: [{ required: true, message: '请输入帐户名或邮箱地址' }, { validator: _vm.handleUsernameOrEmail }],
            validateTrigger: 'change',
          } ]),expression:"[\n          'username',\n          {\n            rules: [{ required: true, message: '请输入帐户名或邮箱地址' }, { validator: handleUsernameOrEmail }],\n            validateTrigger: 'change',\n          },\n        ]"}],staticStyle:{"height":"50px"},attrs:{"size":_vm.size,"type":"text","placeholder":"账户","hasIcon":true,"iconType":_vm.userIcon}})],1),_c('a-form-item',[_c('a-input',{directives:[{name:"decorator",rawName:"v-decorator",value:(['password', { rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur' }]),expression:"['password', { rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur' }]"}],staticStyle:{"height":"50px"},attrs:{"size":"large","type":"password","autocomplete":"false","placeholder":"密码"}},[_c('a-icon',{style:({ color: 'rgba(0,0,0,.25)' }),attrs:{"slot":"prefix","type":"lock"},slot:"prefix"})],1)],1),_c('a-form-item',{staticStyle:{"margin-top":"24px"}},[_c('a-button',{staticClass:"login-button",attrs:{"size":"large","type":"primary","loading":_vm.state.loginBtn,"disabled":_vm.state.loginBtn},on:{"click":_vm.handleSubmit}},[_vm._v("登录")])],1)],1),_c('a-row',{staticStyle:{"font-size":"16px","line-height":"27px","color":"#ffffff"}},[_c('a-col',{staticStyle:{"text-align":"right","cursor":"pointer"},attrs:{"span":24},on:{"click":_vm.register}},[_vm._v("还没有账号 "),_c('a-icon',{staticStyle:{"padding":"0 4px"},attrs:{"type":"question-circle"}}),_vm._v("立即注册")],1)],1)],1)}
var staticRenderFns = []


// CONCATENATED MODULE: ./src/views/user/Login.vue?vue&type=template&id=c23022b2&scoped=true&

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
var objectSpread2 = __webpack_require__("5530");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
var es_object_to_string = __webpack_require__("d3b7");

// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.for-each.js
var web_dom_collections_for_each = __webpack_require__("159b");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
var es_object_keys = __webpack_require__("b64b");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.exec.js
var es_regexp_exec = __webpack_require__("ac1f");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.test.js
var es_regexp_test = __webpack_require__("00b4");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
var es_promise = __webpack_require__("e6cf");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.finally.js
var es_promise_finally = __webpack_require__("a79d");

// EXTERNAL MODULE: ./node_modules/vuex/dist/vuex.esm.js
var vuex_esm = __webpack_require__("2f62");

// EXTERNAL MODULE: ./packages/utils/util.js + 3 modules
var util = __webpack_require__("1ae5");

// EXTERNAL MODULE: ./packages/api/manage.js
var manage = __webpack_require__("5b4e");

// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);

// EXTERNAL MODULE: ./node_modules/js-base64/base64.mjs
var base64 = __webpack_require__("e762");

// EXTERNAL MODULE: ./node_modules/moment/moment.js
var moment = __webpack_require__("c1df");
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/user/Login.vue?vue&type=script&lang=js&








//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//






/* harmony default export */ var Loginvue_type_script_lang_js_ = ({
  data: function data() {
    return {
      customActiveKey: 'tab1',
      loginBtn: false,
      // login type: 0 email, 1 username, 2 telephone
      loginType: 1,
      uname: external_commonjs_vue_commonjs2_vue_root_Vue_default.a.ls.get('uname', 'ADMIN'),
      rememberName: external_commonjs_vue_commonjs2_vue_root_Vue_default.a.ls.get('rememberName'),
      isLoginError: false,
      form: this.$form.createForm(this),
      size: 'large',
      userIcon: 'user',
      state: {
        time: 60,
        loginBtn: false,
        // login type: 0 email, 1 username, 2 telephone
        loginType: 1
      },
      visible: false,
      confirmLoading: false,
      labelCol: {
        xs: {
          span: 24
        },
        sm: {
          span: 5
        }
      },
      wrapperCol: {
        xs: {
          span: 24
        },
        sm: {
          span: 16
        }
      },
      companyLst: []
    };
  },
  mounted: function mounted() {
    // this.requiredTwoStepCaptcha = true
    Object.keys(localStorage).forEach(function (item) {
      return item.indexOf('requestTime') !== -1 ? localStorage.removeItem(item) : '';
    });

    if (this.rememberName) {
      var userName = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.ls.get('uname', '');
      this.form.setFieldsValue({
        username: userName
      });
      this.loadData(userName);
    }
  },
  methods: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, Object(vuex_esm["b" /* mapActions */])(['Login', 'Logout'])), {}, {
    // handler
    handleUsernameOrEmail: function handleUsernameOrEmail(rule, value, callback) {
      var state = this.state;
      var regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;

      if (regex.test(value)) {
        state.loginType = 0;
      } else {
        state.loginType = 1;
      }

      callback();
    },
    handleTabClick: function handleTabClick(key) {
      this.customActiveKey = key;
    },
    handleSubmit: function handleSubmit() {
      var _this = this;

      external_commonjs_vue_commonjs2_vue_root_Vue_default.a.ls.clear(); //  e.preventDefault()

      var validateFields = this.form.validateFields,
          state = this.state,
          customActiveKey = this.customActiveKey,
          Login = this.Login;
      state.loginBtn = true;
      var validateFieldsKey = customActiveKey === ['username', 'password'];
      validateFields(validateFieldsKey, {
        force: true
      }, function (err, values) {
        if (!err) {
          var loginParams = Object(objectSpread2["a" /* default */])({}, values);

          delete loginParams.username;
          loginParams.username = values.username; // Base64加密三次

          loginParams.password = base64["a" /* Base64 */].encode(loginParams.password);
          loginParams.password = base64["a" /* Base64 */].encode(loginParams.password);
          loginParams.password = base64["a" /* Base64 */].encode(loginParams.password); // loginParams.password = Base64.decode(loginParams.password)

          var parameter = {};
          parameter.serviceName = 'userService';
          parameter.methodName = 'login';
          parameter.rpcParams = [loginParams.username, loginParams.password];
          Object.keys(localStorage).forEach(function (item) {
            return item.indexOf('requestTime') !== -1 ? localStorage.removeItem(item) : '';
          });
          Login(parameter).then(function (res) {
            _this.loginSuccess(res);
          }).catch(function (err) {
            return _this.requestFailed(err);
          }).finally(function () {
            state.loginBtn = false;
            external_commonjs_vue_commonjs2_vue_root_Vue_default.a.ls.set('rememberName', values.rememberName);

            if (values.rememberName) {
              external_commonjs_vue_commonjs2_vue_root_Vue_default.a.ls.set('uname', values.username);
            } else {
              external_commonjs_vue_commonjs2_vue_root_Vue_default.a.ls.set('uname', '');
            }
          });
        } else {
          setTimeout(function () {
            state.loginBtn = false;
          }, 600);
        }
      });
    },
    loginSuccess: function loginSuccess(res) {
      var _this2 = this;

      // console.log(res)
      var time = moment_default()().format('YYYY-MM-DD HH:mm:ss');
      var tailInfos = res.responseData.resultData.tailInfos;
      localStorage.setItem('requestTime', time);
      localStorage.setItem('loginTime', moment_default()().format('YYYY-MM-DD HH:mm:ss'));
      localStorage.setItem('isForcePW', tailInfos.isForcePW);
      localStorage.setItem('isFirstLogin', tailInfos.isFirstLogin);
      localStorage.setItem('isInitialPassword', tailInfos.isInitialPassword);
      localStorage.setItem('userName', res.responseData.resultData.userid);
      localStorage.setItem('realname', res.responseData.resultData.username);
      localStorage.setItem('userid', res.responseData.resultData.id);
      localStorage.setItem('companyId', res.responseData.resultData.companyId);
      localStorage.setItem('userType', res.responseData.resultData.userType);
      this.$router.push({
        path: '/'
      }); // 延迟 1 秒显示欢迎信息

      setTimeout(function () {
        _this2.$notification.success({
          message: '欢迎',
          description: "".concat(Object(util["q" /* timeFix */])(), "\uFF0C\u6B22\u8FCE\u56DE\u6765")
        });
      }, 1000);
      this.isLoginError = false;
    },
    requestFailed: function requestFailed(err) {
      this.isLoginError = true;
    },
    register: function register() {
      this.$refs.register.visible = true;
    }
  })
});
// CONCATENATED MODULE: ./src/views/user/Login.vue?vue&type=script&lang=js&
 /* harmony default export */ var user_Loginvue_type_script_lang_js_ = (Loginvue_type_script_lang_js_); 
// EXTERNAL MODULE: ./src/views/user/Login.vue?vue&type=style&index=0&id=c23022b2&lang=less&scoped=true&
var Loginvue_type_style_index_0_id_c23022b2_lang_less_scoped_true_ = __webpack_require__("5326");

// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__("2877");

// CONCATENATED MODULE: ./src/views/user/Login.vue






/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  user_Loginvue_type_script_lang_js_,
  render,
  staticRenderFns,
  false,
  null,
  "c23022b2",
  null
  
)

/* harmony default export */ var user_Login = __webpack_exports__["default"] = (component.exports);

/***/ }),

/***/ "e0aa":
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin

/***/ }),

/***/ "e762":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {/* unused harmony export version */
/* unused harmony export VERSION */
/* unused harmony export atob */
/* unused harmony export atobPolyfill */
/* unused harmony export btoa */
/* unused harmony export btoaPolyfill */
/* unused harmony export fromBase64 */
/* unused harmony export toBase64 */
/* unused harmony export utob */
/* unused harmony export encode */
/* unused harmony export encodeURI */
/* unused harmony export encodeURL */
/* unused harmony export btou */
/* unused harmony export decode */
/* unused harmony export isValid */
/* unused harmony export fromUint8Array */
/* unused harmony export toUint8Array */
/* unused harmony export extendString */
/* unused harmony export extendUint8Array */
/* unused harmony export extendBuiltins */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return gBase64; });
/**
 *  base64.ts
 *
 *  Licensed under the BSD 3-Clause License.
 *    http://opensource.org/licenses/BSD-3-Clause
 *
 *  References:
 *    http://en.wikipedia.org/wiki/Base64
 *
 * @author Dan Kogai (https://github.com/dankogai)
 */
const version = '3.7.2';
/**
 * @deprecated use lowercase `version`.
 */
const VERSION = version;
const _hasatob = typeof atob === 'function';
const _hasbtoa = typeof btoa === 'function';
const _hasBuffer = typeof Buffer === 'function';
const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
const b64chs = Array.prototype.slice.call(b64ch);
const b64tab = ((a) => {
    let tab = {};
    a.forEach((c, i) => tab[c] = i);
    return tab;
})(b64chs);
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
const _fromCC = String.fromCharCode.bind(String);
const _U8Afrom = typeof Uint8Array.from === 'function'
    ? Uint8Array.from.bind(Uint8Array)
    : (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));
const _mkUriSafe = (src) => src
    .replace(/=/g, '').replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_');
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, '');
/**
 * polyfill version of `btoa`
 */
const btoaPolyfill = (bin) => {
    // console.log('polyfilled');
    let u32, c0, c1, c2, asc = '';
    const pad = bin.length % 3;
    for (let i = 0; i < bin.length;) {
        if ((c0 = bin.charCodeAt(i++)) > 255 ||
            (c1 = bin.charCodeAt(i++)) > 255 ||
            (c2 = bin.charCodeAt(i++)) > 255)
            throw new TypeError('invalid character found');
        u32 = (c0 << 16) | (c1 << 8) | c2;
        asc += b64chs[u32 >> 18 & 63]
            + b64chs[u32 >> 12 & 63]
            + b64chs[u32 >> 6 & 63]
            + b64chs[u32 & 63];
    }
    return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
};
/**
 * does what `window.btoa` of web browsers do.
 * @param {String} bin binary string
 * @returns {string} Base64-encoded string
 */
const _btoa = _hasbtoa ? (bin) => btoa(bin)
    : _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64')
        : btoaPolyfill;
const _fromUint8Array = _hasBuffer
    ? (u8a) => Buffer.from(u8a).toString('base64')
    : (u8a) => {
        // cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326
        const maxargs = 0x1000;
        let strs = [];
        for (let i = 0, l = u8a.length; i < l; i += maxargs) {
            strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
        }
        return _btoa(strs.join(''));
    };
/**
 * converts a Uint8Array to a Base64 string.
 * @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5
 * @returns {string} Base64 string
 */
const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
// const utob = (src: string) => unescape(encodeURIComponent(src));
// reverting good old fationed regexp
const cb_utob = (c) => {
    if (c.length < 2) {
        var cc = c.charCodeAt(0);
        return cc < 0x80 ? c
            : cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6))
                + _fromCC(0x80 | (cc & 0x3f)))
                : (_fromCC(0xe0 | ((cc >>> 12) & 0x0f))
                    + _fromCC(0x80 | ((cc >>> 6) & 0x3f))
                    + _fromCC(0x80 | (cc & 0x3f)));
    }
    else {
        var cc = 0x10000
            + (c.charCodeAt(0) - 0xD800) * 0x400
            + (c.charCodeAt(1) - 0xDC00);
        return (_fromCC(0xf0 | ((cc >>> 18) & 0x07))
            + _fromCC(0x80 | ((cc >>> 12) & 0x3f))
            + _fromCC(0x80 | ((cc >>> 6) & 0x3f))
            + _fromCC(0x80 | (cc & 0x3f)));
    }
};
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
/**
 * @deprecated should have been internal use only.
 * @param {string} src UTF-8 string
 * @returns {string} UTF-16 string
 */
const utob = (u) => u.replace(re_utob, cb_utob);
//
const _encode = _hasBuffer
    ? (s) => Buffer.from(s, 'utf8').toString('base64')
    : _TE
        ? (s) => _fromUint8Array(_TE.encode(s))
        : (s) => _btoa(utob(s));
/**
 * converts a UTF-8-encoded string to a Base64 string.
 * @param {boolean} [urlsafe] if `true` make the result URL-safe
 * @returns {string} Base64 string
 */
const encode = (src, urlsafe = false) => urlsafe
    ? _mkUriSafe(_encode(src))
    : _encode(src);
/**
 * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5.
 * @returns {string} Base64 string
 */
const encodeURI = (src) => encode(src, true);
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
// const btou = (src: string) => decodeURIComponent(escape(src));
// reverting good old fationed regexp
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
const cb_btou = (cccc) => {
    switch (cccc.length) {
        case 4:
            var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
                | ((0x3f & cccc.charCodeAt(1)) << 12)
                | ((0x3f & cccc.charCodeAt(2)) << 6)
                | (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000;
            return (_fromCC((offset >>> 10) + 0xD800)
                + _fromCC((offset & 0x3FF) + 0xDC00));
        case 3:
            return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12)
                | ((0x3f & cccc.charCodeAt(1)) << 6)
                | (0x3f & cccc.charCodeAt(2)));
        default:
            return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6)
                | (0x3f & cccc.charCodeAt(1)));
    }
};
/**
 * @deprecated should have been internal use only.
 * @param {string} src UTF-16 string
 * @returns {string} UTF-8 string
 */
const btou = (b) => b.replace(re_btou, cb_btou);
/**
 * polyfill version of `atob`
 */
const atobPolyfill = (asc) => {
    // console.log('polyfilled');
    asc = asc.replace(/\s+/g, '');
    if (!b64re.test(asc))
        throw new TypeError('malformed base64.');
    asc += '=='.slice(2 - (asc.length & 3));
    let u24, bin = '', r1, r2;
    for (let i = 0; i < asc.length;) {
        u24 = b64tab[asc.charAt(i++)] << 18
            | b64tab[asc.charAt(i++)] << 12
            | (r1 = b64tab[asc.charAt(i++)]) << 6
            | (r2 = b64tab[asc.charAt(i++)]);
        bin += r1 === 64 ? _fromCC(u24 >> 16 & 255)
            : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255)
                : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
    }
    return bin;
};
/**
 * does what `window.atob` of web browsers do.
 * @param {String} asc Base64-encoded string
 * @returns {string} binary string
 */
const _atob = _hasatob ? (asc) => atob(_tidyB64(asc))
    : _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary')
        : atobPolyfill;
//
const _toUint8Array = _hasBuffer
    ? (a) => _U8Afrom(Buffer.from(a, 'base64'))
    : (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0));
/**
 * converts a Base64 string to a Uint8Array.
 */
const toUint8Array = (a) => _toUint8Array(_unURI(a));
//
const _decode = _hasBuffer
    ? (a) => Buffer.from(a, 'base64').toString('utf8')
    : _TD
        ? (a) => _TD.decode(_toUint8Array(a))
        : (a) => btou(_atob(a));
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));
/**
 * converts a Base64 string to a UTF-8 string.
 * @param {String} src Base64 string.  Both normal and URL-safe are supported
 * @returns {string} UTF-8 string
 */
const decode = (src) => _decode(_unURI(src));
/**
 * check if a value is a valid Base64 string
 * @param {String} src a value to check
  */
const isValid = (src) => {
    if (typeof src !== 'string')
        return false;
    const s = src.replace(/\s+/g, '').replace(/={0,2}$/, '');
    return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
};
//
const _noEnum = (v) => {
    return {
        value: v, enumerable: false, writable: true, configurable: true
    };
};
/**
 * extend String.prototype with relevant methods
 */
const extendString = function () {
    const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
    _add('fromBase64', function () { return decode(this); });
    _add('toBase64', function (urlsafe) { return encode(this, urlsafe); });
    _add('toBase64URI', function () { return encode(this, true); });
    _add('toBase64URL', function () { return encode(this, true); });
    _add('toUint8Array', function () { return toUint8Array(this); });
};
/**
 * extend Uint8Array.prototype with relevant methods
 */
const extendUint8Array = function () {
    const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
    _add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); });
    _add('toBase64URI', function () { return fromUint8Array(this, true); });
    _add('toBase64URL', function () { return fromUint8Array(this, true); });
};
/**
 * extend Builtin prototypes with relevant methods
 */
const extendBuiltins = () => {
    extendString();
    extendUint8Array();
};
const gBase64 = {
    version: version,
    VERSION: VERSION,
    atob: _atob,
    atobPolyfill: atobPolyfill,
    btoa: _btoa,
    btoaPolyfill: btoaPolyfill,
    fromBase64: decode,
    toBase64: encode,
    encode: encode,
    encodeURI: encodeURI,
    encodeURL: encodeURI,
    utob: utob,
    btou: btou,
    decode: decode,
    isValid: isValid,
    fromUint8Array: fromUint8Array,
    toUint8Array: toUint8Array,
    extendString: extendString,
    extendUint8Array: extendUint8Array,
    extendBuiltins: extendBuiltins,
};
// makecjs:CUT //




















// and finally,


/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("1c35").Buffer))

/***/ })

}]);
//# sourceMappingURL=ctos3-lowcode.common.user.js.map