!(function (e, t) { typeof exports === "object" && typeof module !== "undefined" ? t(exports) : typeof define === "function" && define.amd ? define(["exports"], t) : t((e = typeof globalThis !== "undefined" ? globalThis : e || self).suplink = {}) }(this, function (e) { "use strict"; function t() { return window.navigator.userAgent.includes("Zhizhi") } function n() { return window.self !== window.top } function o(e, ...t) { const n = { code: "404", msg: `暂不支持此方法: ${e}`, data: "" }; return Promise.reject(n) } typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" && self; var r = { exports: {} }; !(function (e, t) { !(function (e) { var t; var n = new Uint8Array(16); function o() { if (!t && !(t = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== "undefined" && typeof msCrypto.getRandomValues === "function" && msCrypto.getRandomValues.bind(msCrypto))) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); return t(n) } var r = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; function i(e) { return typeof e === "string" && r.test(e) } for (var s = [], a = 0; a < 256; ++a)s.push((a + 256).toString(16).substr(1)); function c(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; var n = (s[e[t + 0]] + s[e[t + 1]] + s[e[t + 2]] + s[e[t + 3]] + "-" + s[e[t + 4]] + s[e[t + 5]] + "-" + s[e[t + 6]] + s[e[t + 7]] + "-" + s[e[t + 8]] + s[e[t + 9]] + "-" + s[e[t + 10]] + s[e[t + 11]] + s[e[t + 12]] + s[e[t + 13]] + s[e[t + 14]] + s[e[t + 15]]).toLowerCase(); if (!i(n)) throw TypeError("Stringified UUID is invalid"); return n } function u(e, t, n) { function o(e, o, r, s) { if (typeof e === "string" && (e = (function (e) { e = unescape(encodeURIComponent(e)); for (var t = [], n = 0; n < e.length; ++n)t.push(e.charCodeAt(n)); return t }(e))), typeof o === "string" && (o = (function (e) { if (!i(e)) throw TypeError("Invalid UUID"); var t; var n = new Uint8Array(16); return n[0] = (t = parseInt(e.slice(0, 8), 16)) >>> 24, n[1] = t >>> 16 & 255, n[2] = t >>> 8 & 255, n[3] = 255 & t, n[4] = (t = parseInt(e.slice(9, 13), 16)) >>> 8, n[5] = 255 & t, n[6] = (t = parseInt(e.slice(14, 18), 16)) >>> 8, n[7] = 255 & t, n[8] = (t = parseInt(e.slice(19, 23), 16)) >>> 8, n[9] = 255 & t, n[10] = (t = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255, n[11] = t / 4294967296 & 255, n[12] = t >>> 24 & 255, n[13] = t >>> 16 & 255, n[14] = t >>> 8 & 255, n[15] = 255 & t, n }(o))), o.length !== 16) throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); var a = new Uint8Array(16 + e.length); if (a.set(o), a.set(e, o.length), (a = n(a))[6] = 15 & a[6] | t, a[8] = 63 & a[8] | 128, r) { s = s || 0; for (var u = 0; u < 16; ++u)r[s + u] = a[u]; return r } return c(a) } try { o.name = e } catch (e) { } return o.DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", o.URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8", o } function d(e) { return 14 + (e + 64 >>> 9 << 4) + 1 } function l(e, t) { var n = (65535 & e) + (65535 & t); return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n } function f(e, t, n, o, r, i) { return l((s = l(l(t, e), l(o, i))) << (a = r) | s >>> 32 - a, n); var s, a } function p(e, t, n, o, r, i, s) { return f(t & n | ~t & o, e, t, r, i, s) } function g(e, t, n, o, r, i, s) { return f(t & o | n & ~o, e, t, r, i, s) } function h(e, t, n, o, r, i, s) { return f(t ^ n ^ o, e, t, r, i, s) } function m(e, t, n, o, r, i, s) { return f(n ^ (t | ~o), e, t, r, i, s) } function y(e, t, n) { var r = (e = e || {}).random || (e.rng || o)(); if (r[6] = 15 & r[6] | 64, r[8] = 63 & r[8] | 128, t) { n = n || 0; for (var i = 0; i < 16; ++i)t[n + i] = r[i]; return t } return c(r) } function w(e, t, n, o) { switch (e) { case 0: return t & n ^ ~t & o; case 1: case 3: return t ^ n ^ o; case 2: return t & n ^ t & o ^ n & o } } function b(e, t) { return e << t | e >>> 32 - t } u("v3", 48, function (e) { if (typeof e === "string") { var t = unescape(encodeURIComponent(e)); e = new Uint8Array(t.length); for (var n = 0; n < t.length; ++n)e[n] = t.charCodeAt(n) } return (function (e) { for (var t = [], n = 32 * e.length, o = "0123456789abcdef", r = 0; r < n; r += 8) { var i = e[r >> 5] >>> r % 32 & 255; var s = parseInt(o.charAt(i >>> 4 & 15) + o.charAt(15 & i), 16); t.push(s) } return t }(function (e, t) { e[t >> 5] |= 128 << t % 32, e[d(t) - 1] = t; for (var n = 1732584193, o = -271733879, r = -1732584194, i = 271733878, s = 0; s < e.length; s += 16) { var a = n; var c = o; var u = r; var f = i; n = p(n, o, r, i, e[s], 7, -680876936), i = p(i, n, o, r, e[s + 1], 12, -389564586), r = p(r, i, n, o, e[s + 2], 17, 606105819), o = p(o, r, i, n, e[s + 3], 22, -1044525330), n = p(n, o, r, i, e[s + 4], 7, -176418897), i = p(i, n, o, r, e[s + 5], 12, 1200080426), r = p(r, i, n, o, e[s + 6], 17, -1473231341), o = p(o, r, i, n, e[s + 7], 22, -45705983), n = p(n, o, r, i, e[s + 8], 7, 1770035416), i = p(i, n, o, r, e[s + 9], 12, -1958414417), r = p(r, i, n, o, e[s + 10], 17, -42063), o = p(o, r, i, n, e[s + 11], 22, -1990404162), n = p(n, o, r, i, e[s + 12], 7, 1804603682), i = p(i, n, o, r, e[s + 13], 12, -40341101), r = p(r, i, n, o, e[s + 14], 17, -1502002290), n = g(n, o = p(o, r, i, n, e[s + 15], 22, 1236535329), r, i, e[s + 1], 5, -165796510), i = g(i, n, o, r, e[s + 6], 9, -1069501632), r = g(r, i, n, o, e[s + 11], 14, 643717713), o = g(o, r, i, n, e[s], 20, -373897302), n = g(n, o, r, i, e[s + 5], 5, -701558691), i = g(i, n, o, r, e[s + 10], 9, 38016083), r = g(r, i, n, o, e[s + 15], 14, -660478335), o = g(o, r, i, n, e[s + 4], 20, -405537848), n = g(n, o, r, i, e[s + 9], 5, 568446438), i = g(i, n, o, r, e[s + 14], 9, -1019803690), r = g(r, i, n, o, e[s + 3], 14, -187363961), o = g(o, r, i, n, e[s + 8], 20, 1163531501), n = g(n, o, r, i, e[s + 13], 5, -1444681467), i = g(i, n, o, r, e[s + 2], 9, -51403784), r = g(r, i, n, o, e[s + 7], 14, 1735328473), n = h(n, o = g(o, r, i, n, e[s + 12], 20, -1926607734), r, i, e[s + 5], 4, -378558), i = h(i, n, o, r, e[s + 8], 11, -2022574463), r = h(r, i, n, o, e[s + 11], 16, 1839030562), o = h(o, r, i, n, e[s + 14], 23, -35309556), n = h(n, o, r, i, e[s + 1], 4, -1530992060), i = h(i, n, o, r, e[s + 4], 11, 1272893353), r = h(r, i, n, o, e[s + 7], 16, -155497632), o = h(o, r, i, n, e[s + 10], 23, -1094730640), n = h(n, o, r, i, e[s + 13], 4, 681279174), i = h(i, n, o, r, e[s], 11, -358537222), r = h(r, i, n, o, e[s + 3], 16, -722521979), o = h(o, r, i, n, e[s + 6], 23, 76029189), n = h(n, o, r, i, e[s + 9], 4, -640364487), i = h(i, n, o, r, e[s + 12], 11, -421815835), r = h(r, i, n, o, e[s + 15], 16, 530742520), n = m(n, o = h(o, r, i, n, e[s + 2], 23, -995338651), r, i, e[s], 6, -198630844), i = m(i, n, o, r, e[s + 7], 10, 1126891415), r = m(r, i, n, o, e[s + 14], 15, -1416354905), o = m(o, r, i, n, e[s + 5], 21, -57434055), n = m(n, o, r, i, e[s + 12], 6, 1700485571), i = m(i, n, o, r, e[s + 3], 10, -1894986606), r = m(r, i, n, o, e[s + 10], 15, -1051523), o = m(o, r, i, n, e[s + 1], 21, -2054922799), n = m(n, o, r, i, e[s + 8], 6, 1873313359), i = m(i, n, o, r, e[s + 15], 10, -30611744), r = m(r, i, n, o, e[s + 6], 15, -1560198380), o = m(o, r, i, n, e[s + 13], 21, 1309151649), n = m(n, o, r, i, e[s + 4], 6, -145523070), i = m(i, n, o, r, e[s + 11], 10, -1120210379), r = m(r, i, n, o, e[s + 2], 15, 718787259), o = m(o, r, i, n, e[s + 9], 21, -343485551), n = l(n, a), o = l(o, c), r = l(r, u), i = l(i, f) } return [n, o, r, i] }((function (e) { if (e.length === 0) return []; for (var t = 8 * e.length, n = new Uint32Array(d(t)), o = 0; o < t; o += 8)n[o >> 5] |= (255 & e[o / 8]) << o % 32; return n }(e)), 8 * e.length))) }), u("v5", 80, function (e) { var t = [1518500249, 1859775393, 2400959708, 3395469782]; var n = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]; if (typeof e === "string") { var o = unescape(encodeURIComponent(e)); e = []; for (var r = 0; r < o.length; ++r)e.push(o.charCodeAt(r)) } else Array.isArray(e) || (e = Array.prototype.slice.call(e)); e.push(128); for (var i = e.length / 4 + 2, s = Math.ceil(i / 16), a = new Array(s), c = 0; c < s; ++c) { for (var u = new Uint32Array(16), d = 0; d < 16; ++d)u[d] = e[64 * c + 4 * d] << 24 | e[64 * c + 4 * d + 1] << 16 | e[64 * c + 4 * d + 2] << 8 | e[64 * c + 4 * d + 3]; a[c] = u } a[s - 1][14] = 8 * (e.length - 1) / Math.pow(2, 32), a[s - 1][14] = Math.floor(a[s - 1][14]), a[s - 1][15] = 8 * (e.length - 1) & 4294967295; for (var l = 0; l < s; ++l) { for (var f = new Uint32Array(80), p = 0; p < 16; ++p)f[p] = a[l][p]; for (var g = 16; g < 80; ++g)f[g] = b(f[g - 3] ^ f[g - 8] ^ f[g - 14] ^ f[g - 16], 1); for (var h = n[0], m = n[1], y = n[2], v = n[3], O = n[4], S = 0; S < 80; ++S) { var P = Math.floor(S / 20); var I = b(h, 5) + w(P, m, y, v) + O + t[P] + f[S] >>> 0; O = v, v = y, y = b(m, 30) >>> 0, m = h, h = I } n[0] = n[0] + h >>> 0, n[1] = n[1] + m >>> 0, n[2] = n[2] + y >>> 0, n[3] = n[3] + v >>> 0, n[4] = n[4] + O >>> 0 } return [n[0] >> 24 & 255, n[0] >> 16 & 255, n[0] >> 8 & 255, 255 & n[0], n[1] >> 24 & 255, n[1] >> 16 & 255, n[1] >> 8 & 255, 255 & n[1], n[2] >> 24 & 255, n[2] >> 16 & 255, n[2] >> 8 & 255, 255 & n[2], n[3] >> 24 & 255, n[3] >> 16 & 255, n[3] >> 8 & 255, 255 & n[3], n[4] >> 24 & 255, n[4] >> 16 & 255, n[4] >> 8 & 255, 255 & n[4]] }); class v { constructor(e) { this.config = {}, this.listenerMap = {}, this.createId = () => y(), this.init = e => { this.setConfig(e), this.close(), this.connect() }, this.connect = () => { this.onMessage && window.addEventListener("message", this.onMessage) }, this.disconnect = () => { this.onMessage && window.removeEventListener("message", this.onMessage) }, this.close = () => { this.disconnect(), this.listenerMap = {} }, this.onMessage = e => { Object.values(this.listenerMap).forEach(t => t(e)) }, this.dispatch = (e, t) => { const n = Object.assign(Object.assign({}, this.config), t); const o = { targetOrigin: n.origin || window.location.origin }; (n.target || window.top || window).postMessage(e, o) }, this.subscribe = e => { const t = this.createId(); return this.listenerMap[t] = e, t }, this.unsubscribe = e => { (Array.isArray(e) ? e : [e]).forEach(e => delete this.listenerMap[e]) }, this.init(e) } setConfig(e) { this.config = Object.assign(Object.assign({}, this.config), e) } } class O { constructor(e) { this.responseListenerMap = {}, this.resume = () => { this.messageId = this.message.subscribe(this.onResponse) }, this.cancel = () => { this.message.unsubscribe(this.messageId) }, this.onResponse = e => { const { type: t, id: n } = e.data; if (t === "response" && this.responseListenerMap[n]) { const t = this.responseListenerMap[n]; delete this.responseListenerMap[n], t(e.data) } }, this.request = (e, t, n) => { const o = this.message.createId(); const r = { type: "request", path: e, id: o, data: t }; return new Promise((e, t) => { try { this.responseListenerMap[o] = t => e(t), this.message.dispatch(r, n) } catch (e) { t(e) } }) }, this.message = new v(e), this.messageId = this.message.subscribe(this.onResponse) } } var S = window && window.__awaiter || function (e, t, n, o) { return new (n || (n = Promise))(function (r, i) { function s(e) { try { c(o.next(e)) } catch (e) { i(e) } } function a(e) { try { c(o.throw(e)) } catch (e) { i(e) } } function c(e) { var t; e.done ? r(e.value) : (t = e.value, t instanceof n ? t : new n(function (e) { e(t) })).then(s, a) } c((o = o.apply(e, t || [])).next()) }) }; class P { constructor(e) { this.routerMap = {}, this.resume = () => { this.messageId = this.message.subscribe(this.onRequest) }, this.cancel = () => { this.message.unsubscribe(this.messageId) }, this.onRequest = e => S(this, void 0, void 0, function * () { const { type: t } = e.data; if (t !== "request") return; const { source: n, origin: o } = e; const { path: r, id: i } = e.data; if (n && this.routerMap[r]) { const t = (0, this.routerMap[r])(e.data, e); const s = { type: "response", path: r, id: i, data: typeof t === "object" && "then" in t ? yield t : t }; n.postMessage(s, { targetOrigin: o }) } }), this.router = (e, t) => { this.routerMap[e] = t }, this.message = new v(e), this.messageId = this.message.subscribe(this.onRequest) } } var I = { Message: v, Client: O, Server: P }; e.Client = O, e.Message = v, e.Server = P, e.default = I, Object.defineProperty(e, "__esModule", { value: !0 }) }(t)) }(0, r.exports)); const i = new r.exports.Client({ origin: "*" }); const s = (e, t = {}) => i.request(e, t).then(e => { const { data: t } = e; return t }); function a() { return { code: "200", msg: "", data: { suplink: t(), iframe: n() } } } var c = { getSystemInfo: function () { return s("/base/getSystemInfo") }, getEnvInfo: a }; var u = window && window.__rest || function (e, t) { var n = {}; for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && typeof Object.getOwnPropertySymbols === "function") { var r = 0; for (o = Object.getOwnPropertySymbols(e); r < o.length; r++)t.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (n[o[r]] = e[o[r]]) } return n }; var d = { setNavigationBar: function (e) { const { title: t = "", backgroundColor: n = "#ffffff", backButton: o = !0, theme: r = "dark", goast: i = !1, hidden: a = !1, atomicBond: c = !0, underline: u = !0 } = e; return s("/ui/setNavigationBar", { title: t, backgroundColor: n, backButton: o, theme: r, goast: i, hidden: a, atomicBond: c, underline: u }) }, datePicker: function (e) { const { value: t } = e; const n = u(e, ["value"]); return s("/ui/datePicker", Object.assign(Object.assign({}, n), { value: typeof t === "number" ? t : (new Date()).getTime() })) } }; var l = { getLoginInfo: function () { return s("/openApi/getLoginInfo") }, getUserInfo: function () { return s("/openApi/getUserInfo") }, employeeSelector: function (e) { const { type: t = 1, title: n = "人员选择", max: o, selected: r = [] } = e; return s("/openApi/employeeSelector", { type: t, title: n, max: o, selected: r }) } }; var f = { launchMiniProgram: function (e) { return s("/navigate/launchMiniProgram", e) } }; var p = { getStorage: function (e) { return s("/storage/getStorage", e).then(e => { let t; try { t = JSON.parse(e.data) } catch (n) { t = e.data } return Object.assign(Object.assign({}, e), { data: t }) }) }, setStorage: function (e) { const { key: t, value: n } = e; let o; try { o = JSON.stringify(n) } catch (e) { o = n } return s("/storage/setStorage", { key: t, value: o }) } }; const g = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, c), d), l), f), p); const h = n(); const m = new r.exports.Client({ origin: "*" }); const y = new r.exports.Server(); const w = {}; function b(e, t) { return m.request("/iframe/callHandler", { handlerName: e, data: t }).then(e => e.data) } function v() { return (typeof window !== "undefined" ? navigator.userAgent.toLowerCase() : "android").indexOf("android") > -1 } function O(e) { if (typeof window !== "undefined" && window.WebViewJavascriptBridge) e(window.WebViewJavascriptBridge); else { if (typeof window !== "undefined" && window.WVJBCallbacks) return console.log("callback存到WVJBCallbacks"), void window.WVJBCallbacks.push(e); if (typeof window !== "undefined") { window.WVJBCallbacks = [e]; const t = window.document.createElement("iframe"); t.style.display = "none", t.src = "https://__bridge_loaded__", window.document.documentElement.appendChild(t), setTimeout(function () { window.document.documentElement.removeChild(t) }, 0) } } } function S(e, t) { h ? (function (e, t) { w[e] = t, m.request("/iframe/registerHandler", { handlerName: e }) }(e, t)) : O(function (n) { n.registerHandler(e, function (e, n) { try { const o = JSON.parse(e); const r = { code: o.responseCode, msg: o.responseMsg, data: o.responseResult }; t(r, n) } catch (e) { t(e, n) } }) }) } function P(e, t = {}) { return h ? b(e, t) : v() ? new Promise((n, o) => { typeof window !== "undefined" && window.WebViewJavascriptBridge && window.WebViewJavascriptBridge.callHandler ? window.WebViewJavascriptBridge.callHandler(e, JSON.stringify(t), e => { try { const t = JSON.parse(e); const r = { code: t.responseCode, msg: t.responseMsg, data: t.responseResult }; r.code === "200" ? n(r) : o(r) } catch (e) { o(e) } }) : (console.log("dispatchAppEvent - fail"), o(new Error("window.WebViewJavascriptBridge.callHandler is undefined"))) }) : new Promise((n, o) => { !(function (e, t, n) { h ? b(e, t).then(e => { n(e) }) : O(function (o) { o.callHandler(e, t, n) }) }(e, JSON.stringify(t), e => { try { const t = JSON.parse(e); const r = { code: t.responseCode, msg: t.responseMsg, data: t.responseResult }; r.code === "200" ? n(r) : o(r) } catch (e) { o(e) } })) }) } typeof window !== "undefined" && (v() ? (function () { if (typeof window !== "undefined" && window.WebViewJavascriptBridge) return; let e; let t; let n; let o = []; let r = []; let i = 1; const s = {}; const a = {}; function c(e, n) { if (n) { const t = `cb_${i++}_${(new Date()).getTime()}`; a[t] = n, e.callbackId = t } o.push(e), t.src = "yy://__bridge_loaded__" } function u(e) { setTimeout(function () { const t = JSON.parse(e); let n; if (t.responseId) { if (n = a[t.responseId], !n) return; n(t.responseData), delete a[t.responseId] } else { if (t.callbackId) { const e = t.callbackId; n = function (t) { c({ responseId: e, responseData: t }) } } if (typeof window !== "undefined") { let e = window.WebViewJavascriptBridge._messageHandler; t.handlerName && (e = s[t.handlerName]); try { e && e(t.data, n) } catch (e) { typeof console !== "undefined" && console.log(e) } } } }) } var d; typeof window !== "undefined" && (e = { init: function (e) { if (typeof window !== "undefined" && window.WebViewJavascriptBridge._messageHandler) throw new Error("WebViewJavascriptBridge.init called twice"); if (typeof window !== "undefined") { window.WebViewJavascriptBridge._messageHandler = e; const t = r || []; r = null; for (let e = 0; e < t.length; e++)u(t[e]) } }, send: function (e, t) { c({ data: e }, t) }, registerHandler: function (e, t) { s[e] = t }, callHandler: function (e, t, n) { c({ handlerName: e, data: t }, n) }, _fetchQueue: function () { const e = JSON.stringify(o); o = [], n.src = `yy://return/_fetchQueue/${encodeURIComponent(e)}` }, _handleMessageFromNative: function (e) { r && r.push(e), u(e) } }, window.WebViewJavascriptBridge = e), d = window.document, t = d.createElement("iframe"), t.style.display = "none", d.documentElement.appendChild(t), (function (e) { n = e.createElement("iframe"), n.style.display = "none", e.documentElement.appendChild(n) }(window.document)); const l = new Event("WebViewJavascriptBridgeReady"); l.bridge = e, window.document.dispatchEvent(l) }()) : O(function (e) { }), h ? y.router("/iframe/registerHandler/result", e => { const { handlerName: t, data: n } = e.data; w[t] && w[t](n) }) : (y.router("/iframe/callHandler", e => { const { handlerName: t, data: n } = e.data; let o; try { o = JSON.parse(n) } catch (e) { o = n } return P(t, o) }), y.router("/iframe/registerHandler", (e, t) => { const { handlerName: n } = e.data; S(n, e => { m.request("/iframe/registerHandler/result", { handlerName: n, data: e }, { origin: t.origin, target: t.source || void 0 }) }) }))); var I = { getSystemInfo: function () { return P("sl.system.deviceInfo") }, renderFinish: function () { return P("sl.notification.webRenderFinish") }, getEnvInfo: a }; var j = { biometrics: function () { return P("sl.security.biometrics") }, compass: function () { return P("sl.location.compass") }, flashlight: function (e) { const { open: t } = e; return P("sl.camera.flashlight", { open: t ? 1 : 0 }) }, gesture: function () { return P("sl.security.gesture") }, getNetworkInfo: function () { return P("reqGetNetworkType") }, makePhoneCall: function (e) { const { phoneNumber: t } = e; return P("sl.other.call", { phoneNum: t }) }, nfc: function (e) { const { type: t } = e || {}; return P("sl.security.nfc", { functionType: t || 0 }) }, ocr: function () { return P("sl.intelligentFunction.ocr") }, scanCode: function () { return P("sl.camera.scan") }, scanner: function (e) { const { outputMode: t = 1, success: n } = e || {}; return typeof n === "function" && S("sl.camera.scanner.data", e => { n(e) }), P("sl.camera.scanner.setConfig", { mode: t }) }, setScreenOrientation: function (e) { const { mode: t } = e; return P("sl.operation.setScreenOrientation", { type: t }) }, startContinuousScan: function (e) { const { interval: t = 1e3, vibrate: n = !1, success: o } = e; return typeof o !== "function" ? Promise.reject(new Error("success must be a function!")) : (S("sl.camera.continuousScan.responseData", o), P("sl.camera.continuousScan.requestOpen", { scanTimeInterval: t, vibrate: n })) }, stopContinuousScan: function () { return P("sl.camera.continuousScan.requestClose") }, connectPrinter: function (e) { const { mode: t, host: n = "", mac: o = "" } = e; const [r = "", i = 0] = (n || "").split(":"); return P("sl.printer.connect", { mode: t, ipAddress: r, port: i, bluetoothAddress: o }) }, disconnectPrinter: function () { return P("sl.printer.disconnect") }, print: function (e) { const { content: t } = e; return P("sl.printer.print", { content: t }) }, oncePrint: function (e) { const { mode: t, content: n, host: o = "", mac: r = "" } = e; const [i = "", s = 0] = (o || "").split(":"); return P("sl.printer.singlePrint", { mode: t, content: n, ipAddress: i, port: s, bluetoothAddress: r }) }, getBluetoothPairedDevices: function () { return P("sl.printer.getBluetoothDevices") }, vibrate: function () { return P("sl.notification.vibrate") } }; function C() { const e = []; const t = "0123456789abcdef"; for (let n = 0; n < 36; n++)e[n] = t.substring(Math.floor(16 * Math.random()), 1); return e[14] = "4", e[19] = t.substring(Number(e[19]) ? 3 : 8, 1), e[8] = "-", e[13] = "-", e[18] = "-", e[23] = "-", e.join("") } const M = new class { constructor() { this._events = [] } on(e, t) { const n = C(); t._uuid = n, this._events.push({ [e]: t, type: "always", key: n }) } once(e, t) { const n = C(); t._uuid = n, this._events.push({ type: "once", [e]: t, key: n }) } off(e, t) { typeof t === "function" ? t._uuid && (this._events = this._events.filter(n => !(n[e] && n.key === t._uuid))) : this._events = this._events.filter(t => !t[e]) } emit(e) { this._events.filter(t => t[e]).forEach(t => { try { t.type !== "done" && (t[e](), t.type === "once" && (t.type = "done")) } catch (e) { console.log(e) } }), this._events = this._events.filter(e => e.type !== "done") } }(); const k = { show: "1002", hide: "1003" }; const _ = { 1002: {}, 1003: {} }; let A = !1; function N(e, t) { _[k[e]][t._uuid] = t, A || (A = !0, S("sl.lifeCycle.status", e => { const t = _[e.data]; Object.getOwnPropertySymbols(t).forEach(e => t[e]()) })) } typeof window !== "undefined" && document.addEventListener("visibilitychange", () => { document.visibilityState === "visible" ? M.emit("pageShow") : M.emit("pageHide") }); var B = { offPageHide: function (e) { const { listener: t } = e || {}; M.off("pageHide", t) }, offPageShow: function (e) { const { listener: t } = e || {}; M.off("pageShow", t) }, onPageHide: function (e) { const { listener: t } = e; typeof t === "function" ? M.on("pageHide", t) : console.error("listener must be a function") }, onPageShow: function (e) { const { listener: t } = e; typeof t === "function" ? M.on("pageShow", t) : console.error("listener must be a function") }, onAppHide: function (e) { const { listener: t } = e; typeof t === "function" ? (t._uuid = Symbol("app hide"), N("hide", t)) : console.error("listener must be a function") }, onAppShow: function (e) { const { listener: t } = e; typeof t === "function" ? (t._uuid = Symbol("app show"), N("show", t)) : console.error("listener must be a function") } }; var E = { previewFile: function (e) { const { url: t, title: n = "预览" } = e; return t ? P("sl.multiMedia.preview", { previewUrl: t, sourceFileUrl: t, title: n }) : Promise.reject(new Error("invalid url")) } }; var U = { getLocation: function (e) { const { inverseEnabled: t = !1 } = e; return P("sl.location.singleLocation", { reGeocodeEnabled: t }) }, startLocationUpdate: function (e) { const { success: t } = e; return typeof t !== "function" ? Promise.reject(new Error("success must be a function!")) : (S("sl.location.serialLocation.response", t), P("sl.location.serialLocation.start")) }, stopLocationUpdate: function () { return P("sl.location.serialLocation.stop") } }; var H = { record: function () { return P("sl.multiMedia.voiceRecording") } }; var x = window && window.__rest || function (e, t) { var n = {}; for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && typeof Object.getOwnPropertySymbols === "function") { var r = 0; for (o = Object.getOwnPropertySymbols(e); r < o.length; r++)t.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (n[o[r]] = e[o[r]]) } return n }; var L = { exitMiniProgram: function () { return P("sl.operation.close") }, launchApp: function (e) { const { android: t, ios: n } = e; const o = x(e, ["android", "ios"]); return P("sl.other.openApp", Object.assign(Object.assign({}, o), { pkgName: t, url: n })) }, launchMiniProgram: function (e) { return P("sl.operation.openMinApp", e) } }; var J = { upload: function (e) { const { type: t = 2, mode: n = [], max: o = 9, mediaType: r = 0, days: i = 0 } = e; return P("sl.multiMedia.fileSelector", { optionalType: t, optionalTypeList: Array.isArray(n) ? n : [n], maximumCount: o > 0 ? o : 9, mediaContentType: r, saveDays: Math.floor(i) }) } }; var R = window && window.__rest || function (e, t) { var n = {}; for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && typeof Object.getOwnPropertySymbols === "function") { var r = 0; for (o = Object.getOwnPropertySymbols(e); r < o.length; r++)t.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (n[o[r]] = e[o[r]]) } return n }; var T = window && window.__rest || function (e, t) { var n = {}; for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && typeof Object.getOwnPropertySymbols === "function") { var r = 0; for (o = Object.getOwnPropertySymbols(e); r < o.length; r++)t.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (n[o[r]] = e[o[r]]) } return n }; var V = { departmentSelector: function (e) { const { title: t = "部门选择", max: n, selected: o = [], selectedCode: r = [] } = e; return P("sl.contact.departmentSelector", { title: t, maxLimit: n, selected: o.map(e => ({ uuid: e })), selectedCode: r.map(e => ({ code: e })) }) }, employeeSelector: function (e) { const { type: t = 1, title: n = "人员选择", max: o, selected: r = [] } = e; return P("sl.contact.selector", { type: t, title: n, maxLimit: o, selected: r.map(e => ({ staffCode: e })) }) }, getStepCount: function () { return P("sl.health.stepCount") }, getUserInfo: function () { return P("sl.contact.userInfo").then(e => { const t = e.data; const { userInfo: n = {} } = t; const o = R(t, ["userInfo"]); return { code: e.code, msg: e.msg, data: Object.assign(Object.assign({}, o), n) } }) }, getLoginInfo: function () { return P("reqGetOpenId").then(e => { const { data: t } = e; const n = T(e, ["data"]); return Object.assign(Object.assign({}, n), { data: { token: t.token, userName: t.requestUser, appId: t.appId, baseUrl: t.baseUrl, appName: t.minappName, suposToken: t.supostoken } }) }) }, signature: function () { return P("sl.security.signature") }, openUserInfo: function (e) { return P("sl.contact.openUserInfoPage", e) } }; var D = { getStorage: function (e) { return P("sl.storage.json.get", e).then(e => { let t; try { t = JSON.parse(e.data) } catch (n) { t = e.data } return Object.assign(Object.assign({}, e), { data: t }) }) }, setStorage: function (e) { const { key: t, value: n } = e; let o; try { o = JSON.stringify(n) } catch (e) { o = n } return P("sl.storage.json.set", { key: t, value: o }) } }; var q = { setNavigationBar: function (e) { const { title: t = "", backgroundColor: n = "#ffffff", backButton: o = !0, theme: r = "dark", goast: i = !1, hidden: s = !1, atomicBond: a = !0, underline: c = !0 } = e; return P("sl.config.viewInterface", { toolbarTitle: t, toolbarBackColor: n, isShowBackBtn: o, toolbarMode: r, isFloat: i, isHideToolBar: s, isHideFunctionButton: !a, isHideBottomLine: !c }) }, datePicker: function (e) { const { title: t, min: n, max: o, value: r, showTime: i } = e; return P("reqDatePicker", { format: "yyyy-MM-dd" + (i ? " HH:mm:ss" : ""), title: t, startDate: n, enzzate: o, currentDate: typeof r === "number" ? r : (new Date()).getTime() }) }, dateRangePicker: function (e) { const { value: t = [0, 0], min: n, max: o, showTime: r, limitMin: i, limitMax: s } = e; const [a, c] = t; return P("reqBegEndDatePicker", { format: "yyyy-MM-dd" + (r ? " HH:mm:ss" : ""), beginDate: a, endDate: c, startDate: n, enzzate: o, minMillsecond: i, maxMillsecond: s }) } }; const W = (function (e, n) { const r = Object.keys(e); const i = Object.keys(n); const s = [...new Set([...r, ...i])]; const a = t(); const c = {}; for (let t = 0; t < s.length; t++) { const r = s[t]; c[r] = a ? e[r] || o.bind(o, r) : n[r] || o.bind(o, r) } return c }(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, I), j), B), E), U), H), L), J), V), D), q), g)); const { getEnvInfo: F } = W; const { getSystemInfo: z } = W; const { renderFinish: $ } = W; const { biometrics: G } = W; const { compass: Q } = W; const { flashlight: Z } = W; const { gesture: K } = W; const { getNetworkInfo: X } = W; const { makePhoneCall: Y } = W; const { nfc: ee } = W; const { ocr: te } = W; const { scanCode: ne } = W; const { scanner: oe } = W; const { setScreenOrientation: re } = W; const { startContinuousScan: ie } = W; const { stopContinuousScan: se } = W; const { connectPrinter: ae } = W; const { disconnectPrinter: ce } = W; const { print: ue } = W; const { oncePrint: de } = W; const { getBluetoothPairedDevices: le } = W; const { vibrate: fe } = W; const { offPageHide: pe } = W; const { offPageShow: ge } = W; const { onPageHide: he } = W; const { onPageShow: me } = W; const { onAppHide: ye } = W; const { onAppShow: we } = W; const { previewFile: be } = W; const { getLocation: ve } = W; const { startLocationUpdate: Oe } = W; const { stopLocationUpdate: Se } = W; const { record: Pe } = W; const { exitMiniProgram: Ie } = W; const { launchApp: je } = W; const { launchMiniProgram: Ce } = W; const { upload: Me } = W; const { departmentSelector: ke } = W; const { employeeSelector: _e } = W; const { getStepCount: Ae } = W; const { getUserInfo: Ne } = W; const { getLoginInfo: Be } = W; const { signature: Ee } = W; const { openUserInfo: Ue } = W; const { getStorage: He } = W; const { setStorage: xe } = W; const { setNavigationBar: Le } = W; const { datePicker: Je } = W; const { dateRangePicker: Re } = W; e.biometrics = G, e.compass = Q, e.connectPrinter = ae, e.datePicker = Je, e.dateRangePicker = Re, e.default = W, e.departmentSelector = ke, e.disconnectPrinter = ce, e.employeeSelector = _e, e.exitMiniProgram = Ie, e.flashlight = Z, e.gesture = K, e.getBluetoothPairedDevices = le, e.getEnvInfo = F, e.getLocation = ve, e.getLoginInfo = Be, e.getNetworkInfo = X, e.getStepCount = Ae, e.getStorage = He, e.getSystemInfo = z, e.getUserInfo = Ne, e.launchApp = je, e.launchMiniProgram = Ce, e.makePhoneCall = Y, e.nfc = ee, e.ocr = te, e.offPageHide = pe, e.offPageShow = ge, e.onAppHide = ye, e.onAppShow = we, e.onPageHide = he, e.onPageShow = me, e.oncePrint = de, e.openUserInfo = Ue, e.previewFile = be, e.print = ue, e.record = Pe, e.renderFinish = $, e.scanCode = ne, e.scanner = oe, e.setNavigationBar = Le, e.setScreenOrientation = re, e.setStorage = xe, e.signature = Ee, e.startContinuousScan = ie, e.startLocationUpdate = Oe, e.stopContinuousScan = se, e.stopLocationUpdate = Se, e.upload = Me, e.vibrate = fe, Object.defineProperty(e, "__esModule", { value: !0 }) }));