8 lines
34 KiB
JavaScript
8 lines
34 KiB
JavaScript
!function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=7)}([function(t,n,e){"use strict";n.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};n.getVersion=function(){return o},n.getConfig=function(t){var n=u[t];n||(n=i[t]);return n},n.setConfig=function(t){t&&"object"==(void 0===t?"undefined":r(t))&&Object.assign(u,t)};var o="${lib_version}",i={},u={}},function(t,n,e){"use strict";n.__esModule=!0;var r={};r="undefined"!=typeof GameGlobal?Object.assign({},GameGlobal):"undefined"==typeof window?{setTimeout:function(t){function n(){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(){return setTimeout.apply(void 0,arguments)})),setInterval:function(t){function n(){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(){return setInterval.apply(void 0,arguments)})),clearTimeout:function(t){function n(){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(){return clearTimeout.apply(void 0,arguments)})),clearInterval:function(t){function n(){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(){return clearInterval.apply(void 0,arguments)}))}:window,n.default=r},function(t,n,e){"use strict";n.__esModule=!0,n.createUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=16*Math.random()|0;return("x"==t?n:3&n|8).toString(16)}))}},function(t,n,e){"use strict";n.__esModule=!0,n.isReadyCalled=function(){return l},e(8);var r,o=e(1),i=(r=o)&&r.__esModule?r:{default:r},u=e(0),c=e(13),a=e(6),s=e(5);var f=null,l=!1;i.default.__IScanReady__&&i.default.__IScanReady__(),n.default=Object.assign({},{config:function(t){return t&&(0,u.setConfig)(t),f||(f=Promise.resolve().then((function(){return(0,s.printDebug)("-------------------------------"),(0,s.printDebug)("sdk_version:",(0,u.getVersion)()),(0,s.printDebug)("-------------------------------"),(0,a.initWxJssdk)(),Promise.resolve().then((function(){l=!0})).catch((function(t){throw f=null,t}))})))},onScanListener:c.onScanListener,offScanListener:c.offScanListener,setStatusListener:c.setStatusListener,getStatus:c.getStatus,startScan:c.startScan,stopScan:c.stopScan,clear:c.clear})},function(t,n,e){"use strict";n.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};n.toAny=function(t,n){if(null==t)return n;var e=function(t){if("string"!=typeof t)return void 0===t?"undefined":r(t);try{var n=JSON.parse(t);return void 0===n?"undefined":r(n)}catch(n){var e=parseFloat(t);return isNaN(e)||""+e!==t?"string":"number"}}(t);null!=n&&(e=void 0===n?"undefined":r(n));switch(e){case"number":return function(t){try{return JSON.parse(t)}catch(n){return parseFloat(t)}}(t);case"boolean":return function(t){return!!t&&"false"!=t&&"0"!=t}(t);case"object":return function(t,n){if("object"===(void 0===t?"undefined":r(t)))return t;try{return JSON.parse(t)}catch(t){}return n}(t,n);case"string":return function(t,n){try{var e=void 0===t?"undefined":r(t);if("string"===e)return t;if("boolean"===e)return t?"true":"false";if("number"===e)return""+t;if("object"===e)return JSON.stringify(t)}catch(t){}return n}(t,n)}return n}},function(t,n,e){"use strict";n.__esModule=!0,n.printError=function(t){for(var n,e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];(n=console).error.apply(n,["[IScan] ",t].concat(r))},n.printWarn=function(t){for(var n,e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];(n=console).warn.apply(n,["[IScan] ",t].concat(r))},n.printDebug=function(t){for(var n,e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];(n=console).log.apply(n,["[IScan] ",t].concat(r))}},function(t,n,e){"use strict";n.__esModule=!0,n.isWxEnv=s,n.isSupportWxScan=function(){var t=a();return s()&&c&&t&&t.scanQRCode},n.initWxJssdk=f,n.startScanForWx=function(t){return f().then((function(){return new Promise((function(n,e){var r=t||{},o=r.needResult,i=void 0===o?1:o,u=r.scanType,c=void 0===u?["qrCode","barCode"]:u,s=a();s&&s.scanQRCode?s.scanQRCode({needResult:i,scanType:c,success:function(t){n({success:!0,result:t.resultStr,code:t.resultStr})},cancel:function(){n({success:!1,error:"用户取消扫码"})},fail:function(t){e(t)}}):e(new Error("wx.scanQRCode is not supported"))}))}))};var r=e(0),o=e(16),i=e(4),u=null,c=!1;function a(){return"undefined"==typeof window?null:window.wx}function s(){return"undefined"!=typeof navigator&&/micromessenger/i.test(navigator.userAgent||"")}function f(){return s()?u||(u=Promise.all([new Promise((function(t,n){var e=a();if(e&&e.config&&e.scanQRCode)t(e);else{var o=(0,i.toAny)((0,r.getConfig)("initWechatJssdk"),{}),u=(0,i.toAny)(o.sdkUrl,"https://res.wx.qq.com/open/js/jweixin-1.6.0.js");if(u){var c=document.getElementById("__wx_jssdk__");if(c)return c.addEventListener("load",(function(){return t(a())})),void c.addEventListener("error",n);(c=document.createElement("script")).id="__wx_jssdk__",c.src=u,c.onload=function(){return t(a())},c.onerror=n,document.head.appendChild(c)}else n(new Error("initWechatJssdk.sdkUrl is required, but not found"))}})),(t=(0,i.toAny)((0,r.getConfig)("initWechatJssdk"),{}),n=(0,i.toAny)(t.apiUrl,""),n?(0,o.request)({url:n,method:"GET",data:{url:window.location.href.split("#")[0]}}).then((function(t){var n=(0,i.toAny)(t.data,{});if(!n)return null;if(0!==n.code)throw new Error(n.msg||"wx config fetch failed");return n.data?n.data:n})):Promise.reject(new Error("initWechatJssdk.apiUrl is required, but not found")))]).then((function(t){var n=t[0],e=t[1];if(!n||!n.config)throw new Error("wx jssdk is not ready");if(!e)throw new Error("wx config is empty");var r=e.jsApiList||[];return-1===r.indexOf("scanQRCode")&&r.push("scanQRCode"),new Promise((function(t,o){n.ready((function(){c=!0,t(n)})),n.error((function(t){c=!1,u=null,o(t)})),n.config(Object.assign({},e,{jsApiList:r}))}))})).catch((function(t){throw c=!1,u=null,t}))):Promise.resolve();var t,n}},function(t,n,e){"use strict";var r,o=e(3),i=(r=o)&&r.__esModule?r:{default:r};var u=(0,e(20).exportSDK)(i.default,null,"config","setStatusListener","onScanListener","offScanListener","stopScan","startScan","clear");"undefined"!=typeof window&&(window.IScan=u),t.exports={IScan:u}},function(t,n,e){"use strict";e(1),e(9)},function(t,n,e){"use strict";var r=e(10);"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,n){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),r=1;r<arguments.length;r++){var o=arguments[r];if(null!=o)for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},writable:!0,configurable:!0}),(0,r.polyfill)()},function(t,n,e){(function(n,e){
|
|
/*!
|
|
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
* @license Licensed under MIT license
|
|
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
|
|
* @version v4.2.6+9869a4bc
|
|
*/var r;r=function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=0,i=void 0,u=void 0,c=function(t,n){h[o]=t,h[o+1]=n,2===(o+=2)&&(u?u(v):b())},a="undefined"!=typeof window?window:void 0,s=a||{},f=s.MutationObserver||s.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<o;t+=2)(0,h[t])(h[t+1]),h[t]=void 0,h[t+1]=void 0;o=0}var y,g,m,_,b=void 0;function w(t,n){var e=this,r=new this.constructor(j);void 0===r[x]&&U(r);var o=e._state;if(o){var i=arguments[o-1];c((function(){return I(o,r,i,e._result)}))}else R(e,r,t,n);return r}function S(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var n=new this(j);return T(n,t),n}l?b=function(){return n.nextTick(v)}:f?(g=0,m=new f(v),_=document.createTextNode(""),m.observe(_,{characterData:!0}),b=function(){_.data=g=++g%2}):d?((y=new MessageChannel).port1.onmessage=v,b=function(){return y.port2.postMessage(0)}):b=void 0===a?function(){try{var t=Function("return this")().require("vertx");return void 0!==(i=t.runOnLoop||t.runOnContext)?function(){i(v)}:p()}catch(t){return p()}}():p();var x=Math.random().toString(36).substring(2);function j(){}var O={error:null};function A(t){try{return t.then}catch(t){return O.error=t,O}}function C(n,e,r){e.constructor===n.constructor&&r===w&&e.constructor.resolve===S?function(t,n){1===n._state?k(t,n._result):2===n._state?P(t,n._result):R(n,void 0,(function(n){return T(t,n)}),(function(n){return P(t,n)}))}(n,e):r===O?(P(n,O.error),O.error=null):void 0===r?k(n,e):t(r)?function(t,n,e){c((function(t){var r=!1,o=function(t,n,e,r){try{t.call(n,e,r)}catch(t){return t}}(e,n,(function(e){r||(r=!0,n!==e?T(t,e):k(t,e))}),(function(n){r||(r=!0,P(t,n))}),t._label);!r&&o&&(r=!0,P(t,o))}),t)}(n,e,r):k(n,e)}function T(t,n){var e,r;t===n?P(t,new TypeError("You cannot resolve a promise with itself")):(r=typeof(e=n),null===e||"object"!==r&&"function"!==r?k(t,n):C(t,n,A(n)))}function E(t){t._onerror&&t._onerror(t._result),M(t)}function k(t,n){void 0===t._state&&(t._result=n,t._state=1,0!==t._subscribers.length&&c(M,t))}function P(t,n){void 0===t._state&&(t._state=2,t._result=n,c(E,t))}function R(t,n,e,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=n,o[i+1]=e,o[i+2]=r,0===i&&t._state&&c(M,t)}function M(t){var n=t._subscribers,e=t._state;if(0!==n.length){for(var r=void 0,o=void 0,i=t._result,u=0;u<n.length;u+=3)r=n[u],o=n[u+e],r?I(e,r,o,i):o(i);t._subscribers.length=0}}function I(n,e,r,o){var i=t(r),u=void 0,c=void 0,a=void 0,s=void 0;if(i){if((u=function(t,n){try{return t(n)}catch(t){return O.error=t,O}}(r,o))===O?(s=!0,c=u.error,u.error=null):a=!0,e===u)return void P(e,new TypeError("A promises callback cannot return that same promise."))}else u=o,a=!0;void 0!==e._state||(i&&a?T(e,u):s?P(e,c):1===n?k(e,u):2===n&&P(e,u))}var L=0;function U(t){t[x]=L++,t._state=void 0,t._result=void 0,t._subscribers=[]}var D=function(){function t(t,n){this._instanceConstructor=t,this.promise=new t(j),this.promise[x]||U(this.promise),r(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&k(this.promise,this._result))):P(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var n=0;void 0===this._state&&n<t.length;n++)this._eachEntry(t[n],n)},t.prototype._eachEntry=function(t,n){var e=this._instanceConstructor,r=e.resolve;if(r===S){var o=A(t);if(o===w&&void 0!==t._state)this._settledAt(t._state,n,t._result);else if("function"!=typeof o)this._remaining--,this._result[n]=t;else if(e===F){var i=new e(j);C(i,t,o),this._willSettleAt(i,n)}else this._willSettleAt(new e((function(n){return n(t)})),n)}else this._willSettleAt(r(t),n)},t.prototype._settledAt=function(t,n,e){var r=this.promise;void 0===r._state&&(this._remaining--,2===t?P(r,e):this._result[n]=e),0===this._remaining&&k(r,this._result)},t.prototype._willSettleAt=function(t,n){var e=this;R(t,void 0,(function(t){return e._settledAt(1,n,t)}),(function(t){return e._settledAt(2,n,t)}))},t}(),F=function(){function n(t){this[x]=L++,this._result=this._state=void 0,this._subscribers=[],j!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof n?function(t,n){try{n((function(n){T(t,n)}),(function(n){P(t,n)}))}catch(n){P(t,n)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return n.prototype.catch=function(t){return this.then(null,t)},n.prototype.finally=function(n){var e=this.constructor;return t(n)?this.then((function(t){return e.resolve(n()).then((function(){return t}))}),(function(t){return e.resolve(n()).then((function(){throw t}))})):this.then(n,n)},n}();return F.prototype.then=w,F.all=function(t){return new D(this,t).promise},F.race=function(t){var n=this;return r(t)?new n((function(e,r){for(var o=t.length,i=0;i<o;i++)n.resolve(t[i]).then(e,r)})):new n((function(t,n){return n(new TypeError("You must pass an array to race."))}))},F.resolve=S,F.reject=function(t){var n=new this(j);return P(n,t),n},F._setScheduler=function(t){u=t},F._setAsap=function(t){c=t},F._asap=c,F.polyfill=function(){var t=void 0;if(void 0!==e)t=e;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(t){}if("[object Promise]"===r&&!n.cast)return}t.Promise=F},F.Promise=F,F},t.exports=r()}).call(this,e(11),e(12))},function(t,n){var e,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var a,s=[],f=!1,l=-1;function d(){f&&a&&(f=!1,a.length?s=a.concat(s):l=-1,s.length&&p())}function p(){if(!f){var t=c(d);f=!0;for(var n=s.length;n;){for(a=s,s=[];++l<n;)a&&a[l].run();l=-1,n=s.length}a=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(n){try{return r.call(null,t)}catch(n){return r.call(this,t)}}}(t)}}function h(t,n){this.fun=t,this.array=n}function v(){}o.nextTick=function(t){var n=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)n[e-1]=arguments[e];s.push(new h(t,n)),1!==s.length||f||c(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){"use strict";n.__esModule=!0,n.isScanning=_,n.clear=function(){for(var t=0;t<f.length;t++){f[t].cancel()}f.length=0,h()},n.onScanListener=function(t,n,e,r){if("function"!=typeof t)return;for(var o=null,i=0;i<f.length;i++){var u=f[i];if(u.listener===t){o=u;break}}o?(o.key=n,o.level=r,o.match=e):(o={key:n,match:e,level:r,listener:t,cancel:function(){var t=f.indexOf(o);if(-1!==t)for(var n=f.splice(t,1),e=0;e<n.length;e++){var r=n[e];r.listener&&r.listener({cancel:1})}}},f.push(o));return f.sort((function(t,n){return n.level-t.level})),h(),o},n.offScanListener=function(t){for(var n=0;n<f.length;n++){var e=f[n];if(e.listener===t){e.cancel();break}}h()},n.setStatusListener=function(t){if("function"!=typeof t)return;s=t},n.getStatus=function(){return a},n.stopScan=function(){if(!_())return;m().then((function(){g()}))},n.startScan=function(){if(_()||d||Date.now()<p)return;Promise.resolve().then((function(){"scanning"!==a&&(a="scanning",s&&s({status:"scanning"}));var t=new Promise((function(t){l=t})),n=Promise.resolve();return(0,r.inRuntime)()?(console.log("startScanForBridge"),n=function t(){return(0,r.bridgeAsync)("startScan",{closeable:!0}).then((function(n){return _()&&n&&n.result?y(n.result)?n:_()?t():n:n})).catch((function(n){return _()&&n&&n.result?y(n.result)?n:_()?t():n:n}))}()):(0,i.isSupportWxScan)()?(console.log("startScanForWx"),n=function t(){return(0,i.startScanForWx)({needResult:1,scanType:["qrCode","barCode"]}).then((function(n){return _()&&n&&n.result?y(n.result)?n:_()?t():n:n})).catch((function(n){return _()&&n&&n.result?y(n.result)?n:_()?t():n:n}))}()):(0,o.isSupportWebScan)()?(console.log("startScanForWeb"),n=(0,o.startScanForWeb)((0,c.getConfig)("webCanvasStyle"),y)):(0,o.isSupportImageScan)()?(console.log("startScanForImage"),n=function t(){return(0,o.startScanForImage)().then((function(n){return _()&&n&&n.result?y(n.result)?n:_()?t():n:n})).catch((function(n){return _()&&n&&n.result?y(n.result)?n:_()?t():n:n}))}()):console.log("not support scanner"),Promise.race([n,t])})).finally((function(){l=null,g()}))};var r=e(14),o=e(15),i=e(6),u=e(19),c=e(0),a="closed",s=null,f=[],l=null,d=!1,p=0;function h(){f.length>0?(0,u.startScanner)((function(t){!function(t){if(!function(t){for(var n=0;n<f.length;n++){var e=f[n];if(e.listener&&v(t,e.match))return!0}return!1}(t))return;if(_()){var n=function(){var t=l;return l=null,g(),t}();return d=!0,m().then((function(){setTimeout((function(){d=!1}),0)})),y(t),void(n&&n({result:t}))}y(t)}(t)})):(0,u.stopScanner)()}function v(t,n){var e=null;return n&&"string"==typeof n&&(e=new RegExp(n)),!e||e.test(t)}function y(t){for(var n=!1,e=0;e<f.length;e++){var r=f[e];r.listener&&v(t,r.match)&&(n=!0,r.listener({result:t,key:r.key}),console.log("__result",{result:t,key:r.key}))}return n&&(p=Date.now()+2e3),n}function g(){"closed"!==a&&(a="closed",s&&s({status:"closed"}))}function m(){return(0,r.inRuntime)()?(0,r.bridgeAsync)("stopScan").catch((function(){})):(0,o.isSupportWebScan)()?(0,o.stopScanForWeb)().catch((function(){})):Promise.resolve()}function _(){return"scanning"===a}},function(t,n,e){"use strict";n.__esModule=!0,n.inRuntime=f,n.onEvent=function(t,n){if(s(),t&&n&&"function"==typeof n){var e=u[t]||[];-1==e.indexOf(n)&&e.push(n),u[t]=e}},n.offEvent=function(t,n){if(s(),t&&n&&"function"==typeof n){var e=u[t]||[],r=e.indexOf(n);r>=0&&e.splice(r,1)}},n.bridgeSync=l,n.bridgeAsync=function(t,n,e){return new Promise((function(r,o){if(f()){var u=!1,a=null;e>0&&(a=setTimeout((function(){u=!0,a=null,o("bridgeAsync timeout")}),e));var s=(0,i.createUUID)()+"_"+Date.now();d=s,(p=function(t,n){u||(a&&clearTimeout(a),0==t?r(n):o(n))})&&"function"==typeof p&&(c[d]=p),l(t,Object.assign({request_id:s},n))}else o("Can't bridgeAsync, because not in runtime");var d,p})).then((function(e){var r=[t];return n&&(r.push("params:"),r.push(n)),e&&(r.push("resp:"),r.push(e)),o.printDebug.apply(void 0,["bridge resp >>>"].concat(r)),e})).catch((function(e){throw n?(0,o.printWarn)("bridge err >>>",t,"params:",n,e):(0,o.printWarn)("bridge err >>>",t,e),e}))};var r=e(4),o=e(5),i=e(2),u={},c={},a="__bridge_client__";function s(){var t=a+"_handle_callback";window[t]||(window[t]=function(t){var n=(0,r.toAny)(t,{}),e=n.method,o=n.payload,i=n.code,a=n.request_id,s=(0,r.toAny)(o,{});a?c[a]&&c[a](i,s):u[e]&&u[e].forEach((function(t){t&&t(s)}))})}function f(){return!!window[a]}function l(t,n){s();var e=(0,r.toAny)(function(t){for(var n=t.split("."),e=window;n.length>1;)e=e[n.shift()];if(e&&1==n.length&&e.hasOwnProperty(n[0])){for(var r,o=arguments.length,i=Array(o>1?o-1:0),u=1;u<o;u++)i[u-1]=arguments[u];return(r=e)[n[0]].apply(r,i)}}(a+".call",t,(0,r.toAny)(n,""))),i=[t];return n&&(i.push("params:"),i.push(n)),e&&(i.push("result:"),i.push(e)),o.printDebug.apply(void 0,["bridge call >>>"].concat(i)),e}},function(t,n,e){"use strict";n.__esModule=!0,n.isSupportWebScan=function(){return"undefined"!=typeof navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&"undefined"!=typeof BarcodeDetector},n.isSupportImageScan=function(){return"undefined"!=typeof document&&"undefined"!=typeof BarcodeDetector&&"undefined"!=typeof URL&&URL.createObjectURL},n.stopScanForWeb=f,n.startScanForImage=function(){return s((0,o.getConfig)("scanType")).then((function(t){return new Promise((function(t){var n=document.createElement("input");n.type="file",n.accept="image/*",n.style.display="none";var e=!1,r=function(n){e||(e=!0,u("__webscan_image_input__"),t(n))};n.id="__webscan_image_input__",n.onchange=function(){r(n.files&&n.files[0])},n.oncancel=function(){r(null)},document.body.appendChild(n),n.click()})).then((function(n){return function(t,n){if(!n)return Promise.resolve(null);if("undefined"!=typeof createImageBitmap)return createImageBitmap(n).then((function(n){return t.detect(n).then((function(t){return n.close&&n.close(),t&&t[0]})).catch((function(t){throw n.close&&n.close(),t}))}));return new Promise((function(e,r){var o=new Image,i=URL.createObjectURL(n);o.onload=function(){t.detect(o).then((function(t){URL.revokeObjectURL(i),e(t&&t[0])})).catch((function(t){URL.revokeObjectURL(i),r(t)}))},o.onerror=function(t){URL.revokeObjectURL(i),r(t)},o.src=i}))}(t,n)}))})).then((function(t){return t&&t.rawValue?{result:t.rawValue}:{success:!1,error:"未识别到二维码或条形码"}}))},n.startScanForWeb=function(t,n){return new Promise((function(e,u){try{i.uuid=(0,r.createUUID)(),i.finish=!1;var l,d=c("video","__webscan_video__","display: none",!1),p=t||"position: fixed; width: 300px; height: 240px; top: 0; left: 0; z-index: 9999;",h=c("canvas","__webscan_canvas__",p+" display: none;",!0);h.style.display,h.style.cssText=p,l=h.style.display,h.style.display="none";var v=h.getContext("2d"),y=i.uuid;d.width=300,d.height=300,d.uuid=i.uuid,s((0,o.getConfig)("scanType")).then((function(t){return navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}).then((function(n){return{detector:t,stream:n}}))})).then((function(t){var r=t.detector,c=t.stream;d.srcObject=c,d.setAttribute("playsinline",!0),d.play();var s=(0,o.getConfig)("closeWebScan",(function(){})),p=(0,o.getConfig)("displayWebScan",(function(t,n){}));p&&p(h,(function(){f()})),h.style.display="none";var g=!1,m=!1,_=!1,b=function(){if(!_){_=!0;try{c.getTracks()[0].stop()}catch(t){}s&&s()}},w=function t(){try{d.readyState!==d.HAVE_ENOUGH_DATA||g||(h.height=d.videoHeight,h.width=d.videoWidth,v.setTransform(-1,0,0,1,h.width,0),v.drawImage(d,0,0,h.width,h.height),v.setTransform(1,0,0,1,0,0),m||(m=!0,h.style.display=l||""),g=!0,r.detect(d).then((function(t){var r=t&&t[0];if(r&&r.rawValue&&i.uuid==y){if(n&&!n(r.rawValue))return;!function(t,n,e){var r=e.cornerPoints;if(r&&r.length){for(var o=0;o<r.length;o++)a(t,n,r[o],r[(o+1)%r.length],"#FF3B58");return}if(e.boundingBox)for(var i=e.boundingBox,u=[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}],c=0;c<u.length;c++)a(t,n,u[c],u[(c+1)%u.length],"#FF3B58")}(v,h.width,r),i.uuid=null,i.finish=!0,b(),e({result:r.rawValue})}})).catch((function(){})).finally((function(){g=!1})))}catch(t){g=!1}i.uuid==y?requestAnimationFrame((function(){t()})):(i.finish||(u({cancel:1}),i.finish=!0),b()),i.finish&&b()};requestAnimationFrame((function(){w()}))})).catch((function(t){u({error:t})}))}catch(t){u({error:t})}})).finally((function(){u("__webscan_video__"),u("__webscan_canvas__")}))};var r=e(2),o=e(0),i={uuid:null,finish:!0};function u(t){try{var n=document.getElementById(t);document.body.removeChild(n)}catch(t){}}function c(t,n,e,r){var o=document.getElementById(n);return o||((o=document.createElement(t)).id=n,o.style=e,r&&document.body.appendChild(o)),o}function a(t,n,e,r,o){t.beginPath(),t.moveTo(n-e.x,e.y),t.lineTo(n-r.x,r.y),t.lineWidth=4,t.strokeStyle=o,t.stroke()}function s(t){return Promise.resolve().then((function(){if("undefined"==typeof BarcodeDetector)throw new Error("BarcodeDetector is not supported");var n=function(t){var n=[];return t||(t=["qrCode","barCode"]),t.includes("qrCode")&&n.push("qr_code"),t.includes("barCode")&&n.push("ean_13","ean_8","code_128","code_39","codabar","upc_a","upc_e","itf","aztec","data_matrix","pdf417"),n}(t);return BarcodeDetector.getSupportedFormats?BarcodeDetector.getSupportedFormats().then((function(t){var e=n.filter((function(n){return-1!==t.indexOf(n)}));if(!e.length)throw new Error("No supported barcode formats");return new BarcodeDetector({formats:e})})):new BarcodeDetector({formats:n})}))}function f(){return Promise.resolve().then((function(){i.uuid=null}))}},function(t,n,e){"use strict";n.__esModule=!0,n.request=function(t){var n=t.url,e=t.method,u=t.data,c=t.headers,a=t.json,s=t.timeout,f=Object.assign({request_id:(0,o.hex_md5)((0,r.createUUID)()+"_"+Date.now())},u);return new Promise((function(t,r){!function(t){var n,e=t.url||"",r=t.method||"GET",o=t.headers||{},u=t.data||{},c=t.json||!1,a=t.timeout||6e3,s=new XMLHttpRequest;if("GET"==r.toUpperCase())e=(0,i.appendQueryParams)(e,u),n=void 0;else{if("POST"!=r.toUpperCase())return void(t.fail&&t.fail({errMsg:"request:un support "+r}));c?n=JSON.stringify(u):(n=new FormData,Object.keys(u).forEach((function(t){var e=u[t];e instanceof File?n.append(t,e,e.name):n.append(t,e)})))}if(s.timeout=a,s.open(r.toUpperCase(),e,!0),o)for(var f in o)s.setRequestHeader(f,o[f]);c&&s.setRequestHeader("Content-Type","application/json");s.onreadystatechange=function(){if(4==s.readyState){var n=s.getAllResponseHeaders(),e={};if(n)n.split("\n").forEach((function(t){if(t){var n=t.split(": ");n.length>1&&(e[n[0]]=n[1])}}));if(s.status>=200&&s.status<300){var r={errMsg:"request:ok"};try{var o=JSON.parse(s.response);r.data=o}catch(t){r.data=s.response}r.header=e,r.statusCode=s.status,t.success&&t.success(r)}else t.fail&&t.fail({errMsg:"request:fail",data:s.response,header:e})}},s.send(n)}(Object.assign({},{url:n,method:e,data:f,headers:c,json:a,timeout:s},{success:t,fail:r}))})).then((function(t){if(t.statusCode&&200!=t.statusCode)throw t;return t}))};var r=e(2),o=e(17),i=e(18)},function(t,n,e){"use strict";n.__esModule=!0,n.hex_md5=function(t){return p(r(l(t),8*t.length))},n.b64_md5=function(t){return h(r(l(t),8*t.length))},n.str_md5=function(t){return d(r(l(t),8*t.length))},n.hex_hmac_md5=function(t,n){return p(s(t,n))},n.b64_hmac_md5=function(t,n){return h(s(t,n))},n.str_hmac_md5=function(t,n){return d(s(t,n))};function r(t,n){t[n>>5]|=128<<n%32,t[14+(n+64>>>9<<4)]=n;for(var e=1732584193,r=-271733879,o=-1732584194,s=271733878,l=0;l<t.length;l+=16){var d=e,p=r,h=o,v=s;e=i(e,r,o,s,t[l+0],7,-680876936),s=i(s,e,r,o,t[l+1],12,-389564586),o=i(o,s,e,r,t[l+2],17,606105819),r=i(r,o,s,e,t[l+3],22,-1044525330),e=i(e,r,o,s,t[l+4],7,-176418897),s=i(s,e,r,o,t[l+5],12,1200080426),o=i(o,s,e,r,t[l+6],17,-1473231341),r=i(r,o,s,e,t[l+7],22,-45705983),e=i(e,r,o,s,t[l+8],7,1770035416),s=i(s,e,r,o,t[l+9],12,-1958414417),o=i(o,s,e,r,t[l+10],17,-42063),r=i(r,o,s,e,t[l+11],22,-1990404162),e=i(e,r,o,s,t[l+12],7,1804603682),s=i(s,e,r,o,t[l+13],12,-40341101),o=i(o,s,e,r,t[l+14],17,-1502002290),e=u(e,r=i(r,o,s,e,t[l+15],22,1236535329),o,s,t[l+1],5,-165796510),s=u(s,e,r,o,t[l+6],9,-1069501632),o=u(o,s,e,r,t[l+11],14,643717713),r=u(r,o,s,e,t[l+0],20,-373897302),e=u(e,r,o,s,t[l+5],5,-701558691),s=u(s,e,r,o,t[l+10],9,38016083),o=u(o,s,e,r,t[l+15],14,-660478335),r=u(r,o,s,e,t[l+4],20,-405537848),e=u(e,r,o,s,t[l+9],5,568446438),s=u(s,e,r,o,t[l+14],9,-1019803690),o=u(o,s,e,r,t[l+3],14,-187363961),r=u(r,o,s,e,t[l+8],20,1163531501),e=u(e,r,o,s,t[l+13],5,-1444681467),s=u(s,e,r,o,t[l+2],9,-51403784),o=u(o,s,e,r,t[l+7],14,1735328473),e=c(e,r=u(r,o,s,e,t[l+12],20,-1926607734),o,s,t[l+5],4,-378558),s=c(s,e,r,o,t[l+8],11,-2022574463),o=c(o,s,e,r,t[l+11],16,1839030562),r=c(r,o,s,e,t[l+14],23,-35309556),e=c(e,r,o,s,t[l+1],4,-1530992060),s=c(s,e,r,o,t[l+4],11,1272893353),o=c(o,s,e,r,t[l+7],16,-155497632),r=c(r,o,s,e,t[l+10],23,-1094730640),e=c(e,r,o,s,t[l+13],4,681279174),s=c(s,e,r,o,t[l+0],11,-358537222),o=c(o,s,e,r,t[l+3],16,-722521979),r=c(r,o,s,e,t[l+6],23,76029189),e=c(e,r,o,s,t[l+9],4,-640364487),s=c(s,e,r,o,t[l+12],11,-421815835),o=c(o,s,e,r,t[l+15],16,530742520),e=a(e,r=c(r,o,s,e,t[l+2],23,-995338651),o,s,t[l+0],6,-198630844),s=a(s,e,r,o,t[l+7],10,1126891415),o=a(o,s,e,r,t[l+14],15,-1416354905),r=a(r,o,s,e,t[l+5],21,-57434055),e=a(e,r,o,s,t[l+12],6,1700485571),s=a(s,e,r,o,t[l+3],10,-1894986606),o=a(o,s,e,r,t[l+10],15,-1051523),r=a(r,o,s,e,t[l+1],21,-2054922799),e=a(e,r,o,s,t[l+8],6,1873313359),s=a(s,e,r,o,t[l+15],10,-30611744),o=a(o,s,e,r,t[l+6],15,-1560198380),r=a(r,o,s,e,t[l+13],21,1309151649),e=a(e,r,o,s,t[l+4],6,-145523070),s=a(s,e,r,o,t[l+11],10,-1120210379),o=a(o,s,e,r,t[l+2],15,718787259),r=a(r,o,s,e,t[l+9],21,-343485551),e=f(e,d),r=f(r,p),o=f(o,h),s=f(s,v)}return Array(e,r,o,s)}function o(t,n,e,r,o,i){return f((u=f(f(n,t),f(r,i)))<<(c=o)|u>>>32-c,e);var u,c}function i(t,n,e,r,i,u,c){return o(n&e|~n&r,t,n,i,u,c)}function u(t,n,e,r,i,u,c){return o(n&r|e&~r,t,n,i,u,c)}function c(t,n,e,r,i,u,c){return o(n^e^r,t,n,i,u,c)}function a(t,n,e,r,i,u,c){return o(e^(n|~r),t,n,i,u,c)}function s(t,n){var e=l(t);e.length>16&&(e=r(e,8*t.length));for(var o=Array(16),i=Array(16),u=0;u<16;u++)o[u]=909522486^e[u],i[u]=1549556828^e[u];var c=r(o.concat(l(n)),512+8*n.length);return r(i.concat(c),640)}function f(t,n){var e=(65535&t)+(65535&n);return(t>>16)+(n>>16)+(e>>16)<<16|65535&e}function l(t){for(var n=Array(),e=0;e<8*t.length;e+=8)n[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return n}function d(t){for(var n="",e=0;e<32*t.length;e+=8)n+=String.fromCharCode(t[e>>5]>>>e%32&255);return n}function p(t){for(var n="0123456789abcdef",e="",r=0;r<4*t.length;r++)e+=n.charAt(t[r>>2]>>r%4*8+4&15)+n.charAt(t[r>>2]>>r%4*8&15);return e}function h(t){for(var n="",e=0;e<4*t.length;e+=3)for(var r=(t[e>>2]>>e%4*8&255)<<16|(t[e+1>>2]>>(e+1)%4*8&255)<<8|t[e+2>>2]>>(e+2)%4*8&255,o=0;o<4;o++)8*e+6*o>32*t.length?n+="":n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>6*(3-o)&63);return n}},function(t,n,e){"use strict";n.__esModule=!0,n.stringifyQuery=function(t){return Object.keys(t).map((function(n){var e=t[n];return n+"="+encodeURIComponent(e)})).join("&")},n.decodeQuery=function(t){return Object.keys(t).reduce((function(n,e){var r=t[e];return n[e]=decodeURIComponent(r),n}),{})},n.parseQueryParams=u,n.appendQueryParams=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=u(t),r=e.url,o=e.params;Object.keys(n).forEach((function(t){var e=n[t];null!=e?o[t]=e:delete o[t]}));var i=Object.keys(o).map((function(t){var n=o[t];return t+"="+encodeURIComponent(n)})).join("&");if(!r)return i;if(!i)return r;return r+"?"+i},n.getQueryString=function(t,n){var e=i.default.location.search,r=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),o=e.substr(1).match(r);if(null!=o)return decodeURIComponent(unescape(o[2]));return n};var r,o=e(1),i=(r=o)&&r.__esModule?r:{default:r};function u(t){var n="",e={};if(!t||"string"!=typeof t)return{url:n,params:e};var r="",o=t.indexOf("?"),i=t.indexOf("#"),u=t.indexOf("=");return o>=0?(n=t.substring(0,o),r=t.substring(o+1,i>0?i:t.length)):u>=0?(n="",r=t):(n=t,r=""),r.split("&").map((function(t){var n=t.indexOf("=");if(n>0){var r=t.substring(0,n),o=t.substring(n+1);e[r]=decodeURIComponent(o)}})),{url:n,params:e}}},function(t,n,e){"use strict";n.__esModule=!0,n.startScanner=function(t){if(!t||"function"!=typeof t)return;if(r=t,"scanning"===o)return;o="scanning",a(),window.addEventListener("keydown",s)},n.stopScanner=function(){if("scanning"!==o)return;o="closed",r=null,a(),window.removeEventListener("keydown",s)};var r=null,o="closed",i="",u=null,c=0;function a(){i="",c=0,u&&(clearTimeout(u),u=null)}function s(t){if("scanning"===o&&!(t.ctrlKey||t.metaKey||t.altKey)){if("Enter"===t.key){var n=i.replace(/[\uFF01-\uFF5E]/g,(function(t){return String.fromCharCode(t.charCodeAt(0)-65248)})).replace(/\u3002/g,".");return n&&function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()}(t),console.log("onScannerKeydown",n),a(),void(n&&r&&r(n))}if(t.key&&1===t.key.length){var e=Date.now();c&&e-c>100&&a(),c=e,i+=t.key,u&&clearTimeout(u),u=setTimeout((function(){a()}),100)}}}},function(t,n,e){"use strict";n.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};n.exportSDK=function(t,n){for(var e=arguments.length,o=Array(e>2?e-2:0),f=2;f<e;f++)o[f-2]=arguments[f];var l={};l=n&&"object"===(void 0===n?"undefined":r(n))?n:a(t);var d={};return Object.keys(l).forEach((function(n){var e=l[n],r=e&&e.method||n;c(d,n,(function(){for(var e=arguments.length,c=Array(e),a=0;a<e;a++)c[a]=arguments[a];if(!(0,i.isReadyCalled)()&&o&&o.indexOf(n)<0)throw"[IScan]:Can't call the \"IScan."+n+'" method, because "IScan" not ready, please confirm that "IScan.ready()" has been called. params: '+JSON.stringify(c);return u.apply(void 0,[t,r].concat(c))}))})),s(d),d};var o,i=e(3);(o=i)&&o.__esModule;function u(t,n){for(var e=t,r=n.split(".");r.length>1;)e=e[r.shift()];if(e&&1==r.length&&e.hasOwnProperty(r[0])){for(var o,i=arguments.length,u=Array(i>2?i-2:0),c=2;c<i;c++)u[c-2]=arguments[c];return(o=e)[r[0]].apply(o,u)}throw"IScan."+n+" not defined"}function c(t,n,e){var r=n.split(".");r.forEach((function(n,o){o==r.length-1?t[n]=e:t[n]||(t[n]={}),t=t[n]}))}function a(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e={};return Object.keys(t).forEach((function(o){var i=t[o];if("object"===(void 0===i?"undefined":r(i)))Object.assign(e,a(i,""+n+o+"."));else if("function"==typeof i){var u,c=""+n+o;Object.assign(e,((u={})[c]=c,u))}})),e}function s(t){Object.keys(t).forEach((function(n){var e=t[n];"object"===(void 0===e?"undefined":r(e))&&s(e)})),Object.freeze(t)}}]); |