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