wodax-login-qrcode.react
Version:
login component with qrcode for WodaX applications
3 lines (2 loc) • 49.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).WodaXLoginWithQrCode=t(e.React)}(this,function(e){"use strict";var t="default"in e?e.default:e;function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var i=o(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,i=Object.create(o.prototype),a=new x(n||[]);return i._invoke=function(e,t,r){var n=l;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return M()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=O(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=c(e,t,r);if("normal"===u.type){if(n=r.done?d:f,u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}(e,r,a),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",f="suspendedYield",p="executing",d="completed",h={};function g(){}function y(){}function m(){}var v={};v[i]=function(){return this};var C=Object.getPrototypeOf,b=C&&C(C(T([])));b&&b!==r&&n.call(b,i)&&(v=b);var w=m.prototype=g.prototype=Object.create(v);function E(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function S(e){var t;this._invoke=function(r,o){function i(){return new Promise(function(t,i){!function t(r,o,i,a){var s=c(e[r],e,o);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,i,a)},function(e){t("throw",e,i,a)}):Promise.resolve(l).then(function(e){u.value=e,i(u)},function(e){return t("throw",e,i,a)})}a(s.arg)}(r,o,t,i)})}return t=t?t.then(i,i):i()}}function O(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=c(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:M}}function M(){return{value:t,done:!0}}return y.prototype=w.constructor=m,m.constructor=y,m[s]=y.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},E(S.prototype),S.prototype[a]=function(){return this},e.AsyncIterator=S,e.async=function(t,r,n,o){var i=new S(u(t,r,n,o));return e.isGeneratorFunction(r)?i:i.next().then(function(e){return e.done?e.value:i.next()})},E(w),w[s]="Generator",w[i]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=T,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),h}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});function a(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var u=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,a=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,u=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,l=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,d=r?Symbol.for("react.suspense"):60113,h=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116,m=r?Symbol.for("react.fundamental"):60117,v=r?Symbol.for("react.responder"):60118;function C(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case l:case f:case i:case s:case a:case d:return e;default:switch(e=e&&e.$$typeof){case c:case p:case u:return e;default:return t}}case y:case g:case o:return t}}}function b(e){return C(e)===f}t.typeOf=C,t.AsyncMode=l,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=u,t.Element=n,t.ForwardRef=p,t.Fragment=i,t.Lazy=y,t.Memo=g,t.Portal=o,t.Profiler=s,t.StrictMode=a,t.Suspense=d,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===f||e===s||e===a||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===u||e.$$typeof===c||e.$$typeof===p||e.$$typeof===m||e.$$typeof===v)},t.isAsyncMode=function(e){return b(e)||C(e)===l},t.isConcurrentMode=b,t.isContextConsumer=function(e){return C(e)===c},t.isContextProvider=function(e){return C(e)===u},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return C(e)===p},t.isFragment=function(e){return C(e)===i},t.isLazy=function(e){return C(e)===y},t.isMemo=function(e){return C(e)===g},t.isPortal=function(e){return C(e)===o},t.isProfiler=function(e){return C(e)===s},t.isStrictMode=function(e){return C(e)===a},t.isSuspense=function(e){return C(e)===d}});n(u);u.typeOf,u.AsyncMode,u.ConcurrentMode,u.ContextConsumer,u.ContextProvider,u.Element,u.ForwardRef,u.Fragment,u.Lazy,u.Memo,u.Portal,u.Profiler,u.StrictMode,u.Suspense,u.isValidElementType,u.isAsyncMode,u.isConcurrentMode,u.isContextConsumer,u.isContextProvider,u.isElement,u.isForwardRef,u.isFragment,u.isLazy,u.isMemo,u.isPortal,u.isProfiler,u.isStrictMode,u.isSuspense;var c=o(function(e,t){!function(){Object.defineProperty(t,"__esModule",{value:!0});var e="function"==typeof Symbol&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.fundamental"):60117,m=e?Symbol.for("react.responder"):60118;var v=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0,i="Warning: "+e.replace(/%s/g,function(){return r[o++]});"undefined"!=typeof console&&console.warn(i);try{throw new Error(i)}catch(e){}},C=function(e,t){if(void 0===t)throw new Error("`lowPriorityWarning(condition, format, ...args)` requires a warning message argument");if(!e){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];v.apply(void 0,[t].concat(n))}};function b(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:var d=e.type;switch(d){case c:case l:case o:case a:case i:case p:return d;default:var y=d&&d.$$typeof;switch(y){case u:case f:case s:return y;default:return t}}case g:case h:case n:return t}}}var w=c,E=l,S=u,O=s,P=r,L=f,x=o,T=g,M=h,_=n,A=a,j=i,R=p,k=!1;function B(e){return b(e)===l}t.typeOf=b,t.AsyncMode=w,t.ConcurrentMode=E,t.ContextConsumer=S,t.ContextProvider=O,t.Element=P,t.ForwardRef=L,t.Fragment=x,t.Lazy=T,t.Memo=M,t.Portal=_,t.Profiler=A,t.StrictMode=j,t.Suspense=R,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===l||e===a||e===i||e===p||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===s||e.$$typeof===u||e.$$typeof===f||e.$$typeof===y||e.$$typeof===m)},t.isAsyncMode=function(e){return k||(k=!0,C(!1,"The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),B(e)||b(e)===c},t.isConcurrentMode=B,t.isContextConsumer=function(e){return b(e)===u},t.isContextProvider=function(e){return b(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return b(e)===f},t.isFragment=function(e){return b(e)===o},t.isLazy=function(e){return b(e)===g},t.isMemo=function(e){return b(e)===h},t.isPortal=function(e){return b(e)===n},t.isProfiler=function(e){return b(e)===a},t.isStrictMode=function(e){return b(e)===i},t.isSuspense=function(e){return b(e)===p}}()});n(c);c.typeOf,c.AsyncMode,c.ConcurrentMode,c.ContextConsumer,c.ContextProvider,c.Element,c.ForwardRef,c.Fragment,c.Lazy,c.Memo,c.Portal,c.Profiler,c.StrictMode,c.Suspense,c.isValidElementType,c.isAsyncMode,c.isConcurrentMode,c.isContextConsumer,c.isContextProvider,c.isElement,c.isForwardRef,c.isFragment,c.isLazy,c.isMemo,c.isPortal,c.isProfiler,c.isStrictMode,c.isSuspense;var l=o(function(e){e.exports=c}),f=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;function h(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function g(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}var y=g()?Object.assign:function(e,t){for(var r,n,o=h(e),i=1;i<arguments.length;i++){for(var a in r=Object(arguments[i]))p.call(r,a)&&(o[a]=r[a]);if(f){n=f(r);for(var s=0;s<n.length;s++)d.call(r,n[s])&&(o[n[s]]=r[n[s]])}}return o},m="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",v=function(){},C=m,b={},w=Function.call.bind(Object.prototype.hasOwnProperty);function E(e,t,r,n,o){for(var i in e)if(w(e,i)){var a;try{if("function"!=typeof e[i]){var s=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.");throw s.name="Invariant Violation",s}a=e[i](t,i,n,r,null,C)}catch(e){a=e}if(!a||a instanceof Error||v((n||"React class")+": type specification of "+r+" `"+i+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),a instanceof Error&&!(a.message in b)){b[a.message]=!0;var u=o?o():"";v("Failed "+r+" type: "+a.message+(null!=u?u:""))}}}v=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}},E.resetWarningCache=function(){b={}};var S=E,O=Function.call.bind(Object.prototype.hasOwnProperty),P=function(){};function L(){return null}P=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}};var x=function(e,t){var r="function"==typeof Symbol&&Symbol.iterator,n="@@iterator";var o="<<anonymous>>",i={array:c("array"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:u(L),arrayOf:function(e){return u(function(t,r,n,o,i){if("function"!=typeof e)return new s("Property `"+i+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var a=t[r];if(!Array.isArray(a))return new s("Invalid "+o+" `"+i+"` of type `"+p(a)+"` supplied to `"+n+"`, expected an array.");for(var u=0;u<a.length;u++){var c=e(a,u,n,o,i+"["+u+"]",m);if(c instanceof Error)return c}return null})},element:u(function(t,r,n,o,i){var a=t[r];return e(a)?null:new s("Invalid "+o+" `"+i+"` of type `"+p(a)+"` supplied to `"+n+"`, expected a single ReactElement.")}),elementType:u(function(e,t,r,n,o){var i=e[t];return l.isValidElementType(i)?null:new s("Invalid "+n+" `"+o+"` of type `"+p(i)+"` supplied to `"+r+"`, expected a single ReactElement type.")}),instanceOf:function(e){return u(function(t,r,n,i,a){if(!(t[r]instanceof e)){var u=e.name||o;return new s("Invalid "+i+" `"+a+"` of type `"+function(e){if(!e.constructor||!e.constructor.name)return o;return e.constructor.name}(t[r])+"` supplied to `"+n+"`, expected instance of `"+u+"`.")}return null})},node:u(function(e,t,r,n,o){return f(e[t])?null:new s("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")}),objectOf:function(e){return u(function(t,r,n,o,i){if("function"!=typeof e)return new s("Property `"+i+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var a=t[r],u=p(a);if("object"!==u)return new s("Invalid "+o+" `"+i+"` of type `"+u+"` supplied to `"+n+"`, expected an object.");for(var c in a)if(O(a,c)){var l=e(a,c,n,o,i+"."+c,m);if(l instanceof Error)return l}return null})},oneOf:function(e){if(!Array.isArray(e))return arguments.length>1?P("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):P("Invalid argument supplied to oneOf, expected an array."),L;return u(function(t,r,n,o,i){for(var u=t[r],c=0;c<e.length;c++)if(a(u,e[c]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===d(t)?String(t):t});return new s("Invalid "+o+" `"+i+"` of value `"+String(u)+"` supplied to `"+n+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return P("Invalid argument supplied to oneOfType, expected an instance of array."),L;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return P("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+h(r)+" at index "+t+"."),L}return u(function(t,r,n,o,i){for(var a=0;a<e.length;a++){if(null==(0,e[a])(t,r,n,o,i,m))return null}return new s("Invalid "+o+" `"+i+"` supplied to `"+n+"`.")})},shape:function(e){return u(function(t,r,n,o,i){var a=t[r],u=p(a);if("object"!==u)return new s("Invalid "+o+" `"+i+"` of type `"+u+"` supplied to `"+n+"`, expected `object`.");for(var c in e){var l=e[c];if(l){var f=l(a,c,n,o,i+"."+c,m);if(f)return f}}return null})},exact:function(e){return u(function(t,r,n,o,i){var a=t[r],u=p(a);if("object"!==u)return new s("Invalid "+o+" `"+i+"` of type `"+u+"` supplied to `"+n+"`, expected `object`.");var c=y({},t[r],e);for(var l in c){var f=e[l];if(!f)return new s("Invalid "+o+" `"+i+"` key `"+l+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(t[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var d=f(a,l,n,o,i+"."+l,m);if(d)return d}return null})}};function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function s(e){this.message=e,this.stack=""}function u(e){var r={},n=0;function i(i,a,u,c,l,f,p){if(c=c||o,f=f||u,p!==m){if(t){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}if("undefined"!=typeof console){var h=c+":"+u;!r[h]&&n<3&&(P("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),r[h]=!0,n++)}}return null==a[u]?i?null===a[u]?new s("The "+l+" `"+f+"` is marked as required in `"+c+"`, but its value is `null`."):new s("The "+l+" `"+f+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(a,u,c,l,f)}var a=i.bind(null,!1);return a.isRequired=i.bind(null,!0),a}function c(e){return u(function(t,r,n,o,i,a){var u=t[r];return p(u)!==e?new s("Invalid "+o+" `"+i+"` of type `"+d(u)+"` supplied to `"+n+"`, expected `"+e+"`."):null})}function f(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(f);if(null===t||e(t))return!0;var o=function(e){var t=e&&(r&&e[r]||e[n]);if("function"==typeof t)return t}(t);if(!o)return!1;var i,a=o.call(t);if(o!==t.entries){for(;!(i=a.next()).done;)if(!f(i.value))return!1}else for(;!(i=a.next()).done;){var s=i.value;if(s&&!f(s[1]))return!1}return!0;default:return!1}}function p(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function d(e){if(null==e)return""+e;var t=p(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function h(e){var t=d(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return s.prototype=Error.prototype,i.checkPropTypes=S,i.resetWarningCache=S.resetWarningCache,i.PropTypes=i,i},T=o(function(e){var t=l;e.exports=x(t.isElement,!0)}),M={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8};function _(e){this.mode=M.MODE_8BIT_BYTE,this.data=e}_.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t<this.data.length;t++)e.put(this.data.charCodeAt(t),8)}};var A=_,j={L:1,M:0,Q:3,H:2};function R(e,t){this.totalCount=e,this.dataCount=t}R.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],R.getRSBlocks=function(e,t){var r=R.getRsBlockTable(e,t);if(null==r)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=r.length/3,o=new Array,i=0;i<n;i++)for(var a=r[3*i+0],s=r[3*i+1],u=r[3*i+2],c=0;c<a;c++)o.push(new R(s,u));return o},R.getRsBlockTable=function(e,t){switch(t){case j.L:return R.RS_BLOCK_TABLE[4*(e-1)+0];case j.M:return R.RS_BLOCK_TABLE[4*(e-1)+1];case j.Q:return R.RS_BLOCK_TABLE[4*(e-1)+2];case j.H:return R.RS_BLOCK_TABLE[4*(e-1)+3];default:return}};var k=R;function B(){this.buffer=new Array,this.length=0}B.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};for(var D=B,N={glog:function(e){if(e<1)throw new Error("glog("+e+")");return N.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return N.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},I=0;I<8;I++)N.EXP_TABLE[I]=1<<I;for(I=8;I<256;I++)N.EXP_TABLE[I]=N.EXP_TABLE[I-4]^N.EXP_TABLE[I-5]^N.EXP_TABLE[I-6]^N.EXP_TABLE[I-8];for(I=0;I<255;I++)N.LOG_TABLE[N.EXP_TABLE[I]]=I;var F=N;function q(e,t){if(null==e.length)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&0==e[r];)r++;this.num=new Array(e.length-r+t);for(var n=0;n<e.length-r;n++)this.num[n]=e[n+r]}q.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<e.getLength();n++)t[r+n]^=F.gexp(F.glog(this.get(r))+F.glog(e.get(n)));return new q(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=F.glog(this.get(0))-F.glog(e.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(n=0;n<e.getLength();n++)r[n]^=F.gexp(F.glog(e.get(n))+t);return new q(r,0).mod(e)}};var G=q,$=0,H=1,Q=2,z=3,W=4,U=5,Y=6,K=7,X={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;X.getBCHDigit(t)-X.getBCHDigit(X.G15)>=0;)t^=X.G15<<X.getBCHDigit(t)-X.getBCHDigit(X.G15);return(e<<10|t)^X.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;X.getBCHDigit(t)-X.getBCHDigit(X.G18)>=0;)t^=X.G18<<X.getBCHDigit(t)-X.getBCHDigit(X.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;0!=e;)t++,e>>>=1;return t},getPatternPosition:function(e){return X.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case $:return(t+r)%2==0;case H:return t%2==0;case Q:return r%3==0;case z:return(t+r)%3==0;case W:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case U:return t*r%2+t*r%3==0;case Y:return(t*r%2+t*r%3)%2==0;case K:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new G([1],0),r=0;r<e;r++)t=t.multiply(new G([1,F.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case M.MODE_NUMBER:return 10;case M.MODE_ALPHA_NUM:return 9;case M.MODE_8BIT_BYTE:case M.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case M.MODE_NUMBER:return 12;case M.MODE_ALPHA_NUM:return 11;case M.MODE_8BIT_BYTE:return 16;case M.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else{if(!(t<41))throw new Error("type:"+t);switch(e){case M.MODE_NUMBER:return 14;case M.MODE_ALPHA_NUM:return 13;case M.MODE_8BIT_BYTE:return 16;case M.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}}},getLostPoint:function(e){for(var t=e.getModuleCount(),r=0,n=0;n<t;n++)for(var o=0;o<t;o++){for(var i=0,a=e.isDark(n,o),s=-1;s<=1;s++)if(!(n+s<0||t<=n+s))for(var u=-1;u<=1;u++)o+u<0||t<=o+u||0==s&&0==u||a==e.isDark(n+s,o+u)&&i++;i>5&&(r+=3+i-5)}for(n=0;n<t-1;n++)for(o=0;o<t-1;o++){var c=0;e.isDark(n,o)&&c++,e.isDark(n+1,o)&&c++,e.isDark(n,o+1)&&c++,e.isDark(n+1,o+1)&&c++,0!=c&&4!=c||(r+=3)}for(n=0;n<t;n++)for(o=0;o<t-6;o++)e.isDark(n,o)&&!e.isDark(n,o+1)&&e.isDark(n,o+2)&&e.isDark(n,o+3)&&e.isDark(n,o+4)&&!e.isDark(n,o+5)&&e.isDark(n,o+6)&&(r+=40);for(o=0;o<t;o++)for(n=0;n<t-6;n++)e.isDark(n,o)&&!e.isDark(n+1,o)&&e.isDark(n+2,o)&&e.isDark(n+3,o)&&e.isDark(n+4,o)&&!e.isDark(n+5,o)&&e.isDark(n+6,o)&&(r+=40);var l=0;for(o=0;o<t;o++)for(n=0;n<t;n++)e.isDark(n,o)&&l++;return r+=10*(Math.abs(100*l/t/t-50)/5)}},V=X;function J(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var Z=J.prototype;Z.addData=function(e){var t=new A(e);this.dataList.push(t),this.dataCache=null},Z.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},Z.getModuleCount=function(){return this.moduleCount},Z.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=k.getRSBlocks(e,this.errorCorrectLevel),r=new D,n=0,o=0;o<t.length;o++)n+=t[o].dataCount;for(o=0;o<this.dataList.length;o++){var i=this.dataList[o];r.put(i.mode,4),r.put(i.getLength(),V.getLengthInBits(i.mode,e)),i.write(r)}if(r.getLengthInBits()<=8*n)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},Z.makeImpl=function(e,t){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=J.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},Z.setupPositionProbePattern=function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(this.modules[e+r][t+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},Z.getBestMaskPattern=function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=V.getLostPoint(this);(0==r||e>n)&&(e=n,t=r)}return t},Z.createMovieClip=function(e,t,r){var n=e.createEmptyMovieClip(t,r);this.make();for(var o=0;o<this.modules.length;o++)for(var i=1*o,a=0;a<this.modules[o].length;a++){var s=1*a;this.modules[o][a]&&(n.beginFill(0,100),n.moveTo(s,i),n.lineTo(s+1,i),n.lineTo(s+1,i+1),n.lineTo(s,i+1),n.endFill())}return n},Z.setupTimingPattern=function(){for(var e=8;e<this.moduleCount-8;e++)null==this.modules[e][6]&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)},Z.setupPositionAdjustPattern=function(){for(var e=V.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var n=e[t],o=e[r];if(null==this.modules[n][o])for(var i=-2;i<=2;i++)for(var a=-2;a<=2;a++)this.modules[n+i][o+a]=-2==i||2==i||-2==a||2==a||0==i&&0==a}},Z.setupTypeNumber=function(e){for(var t=V.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var n=!e&&1==(t>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!e&&1==(t>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},Z.setupTypeInfo=function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=V.getBCHTypeInfo(r),o=0;o<15;o++){var i=!e&&1==(n>>o&1);o<6?this.modules[o][8]=i:o<8?this.modules[o+1][8]=i:this.modules[this.moduleCount-15+o][8]=i}for(o=0;o<15;o++){i=!e&&1==(n>>o&1);o<8?this.modules[8][this.moduleCount-o-1]=i:o<9?this.modules[8][15-o-1+1]=i:this.modules[8][15-o-1]=i}this.modules[this.moduleCount-8][8]=!e},Z.mapData=function(e,t){for(var r=-1,n=this.moduleCount-1,o=7,i=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;s<2;s++)if(null==this.modules[n][a-s]){var u=!1;i<e.length&&(u=1==(e[i]>>>o&1)),V.getMask(t,n,a-s)&&(u=!u),this.modules[n][a-s]=u,-1==--o&&(i++,o=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}},J.PAD0=236,J.PAD1=17,J.createData=function(e,t,r){for(var n=k.getRSBlocks(e,t),o=new D,i=0;i<r.length;i++){var a=r[i];o.put(a.mode,4),o.put(a.getLength(),V.getLengthInBits(a.mode,e)),a.write(o)}var s=0;for(i=0;i<n.length;i++)s+=n[i].dataCount;if(o.getLengthInBits()>8*s)throw new Error("code length overflow. ("+o.getLengthInBits()+">"+8*s+")");for(o.getLengthInBits()+4<=8*s&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*s||(o.put(J.PAD0,8),o.getLengthInBits()>=8*s));)o.put(J.PAD1,8);return J.createBytes(o,n)},J.createBytes=function(e,t){for(var r=0,n=0,o=0,i=new Array(t.length),a=new Array(t.length),s=0;s<t.length;s++){var u=t[s].dataCount,c=t[s].totalCount-u;n=Math.max(n,u),o=Math.max(o,c),i[s]=new Array(u);for(var l=0;l<i[s].length;l++)i[s][l]=255&e.buffer[l+r];r+=u;var f=V.getErrorCorrectPolynomial(c),p=new G(i[s],f.getLength()-1).mod(f);a[s]=new Array(f.getLength()-1);for(l=0;l<a[s].length;l++){var d=l+p.getLength()-a[s].length;a[s][l]=d>=0?p.get(d):0}}var h=0;for(l=0;l<t.length;l++)h+=t[l].totalCount;var g=new Array(h),y=0;for(l=0;l<n;l++)for(s=0;s<t.length;s++)l<i[s].length&&(g[y++]=i[s][l]);for(l=0;l<o;l++)for(s=0;s<t.length;s++)l<a[s].length&&(g[y++]=a[s][l]);return g};var ee=J;function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function re(){return(re=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){de(e,t,r[t])})}return e}function oe(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function se(e,t,r){return t&&ae(e.prototype,t),r&&ae(e,r),e}function ue(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?pe(e):t}function ce(e){return(ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fe(e,t)}function fe(e,t){return(fe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function de(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function he(e){for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):n<2048?(t+=String.fromCharCode(192|n>>6),t+=String.fromCharCode(128|63&n)):n<55296||n>=57344?(t+=String.fromCharCode(224|n>>12),t+=String.fromCharCode(128|n>>6&63),t+=String.fromCharCode(128|63&n)):(r++,n=65536+((1023&n)<<10|1023&e.charCodeAt(r)),t+=String.fromCharCode(240|n>>18),t+=String.fromCharCode(128|n>>12&63),t+=String.fromCharCode(128|n>>6&63),t+=String.fromCharCode(128|63&n))}return t}var ge={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},ye={value:T.string.isRequired,size:T.number,level:T.oneOf(["L","M","Q","H"]),bgColor:T.string,fgColor:T.string,includeMargin:T.bool};function me(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[];return e.forEach(function(e,n){var o=null;e.forEach(function(i,a){if(!i&&null!==o)return r.push("M".concat(o+t," ").concat(n+t,"h").concat(a-o,"v1H").concat(o+t,"z")),void(o=null);if(a!==e.length-1)i&&null===o&&(o=a);else{if(!i)return;null===o?r.push("M".concat(a+t,",").concat(n+t," h1v1H").concat(a+t,"z")):r.push("M".concat(o+t,",").concat(n+t," h").concat(a+1-o,"v1H").concat(o+t,"z"))}})}),r.join("")}var ve=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}(),Ce=function(e){function r(){var e,t;ie(this,r);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return de(pe(pe(t=ue(this,(e=ce(r)).call.apply(e,[this].concat(o))))),"_canvas",void 0),t}return le(r,t.PureComponent),se(r,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var e=this.props,t=e.value,r=e.size,n=e.level,o=e.bgColor,i=e.fgColor,a=e.includeMargin,s=new ee(-1,j[n]);if(s.addData(he(t)),s.make(),null!=this._canvas){var u=this._canvas,c=u.getContext("2d");if(!c)return;var l=s.modules;if(null===l)return;var f=a?4:0,p=l.length+2*f,d=window.devicePixelRatio||1;u.height=u.width=r*d;var h=r/p*d;c.scale(h,h),c.fillStyle=o,c.fillRect(0,0,p,p),c.fillStyle=i,ve?c.fill(new Path2D(me(l,f))):l.forEach(function(e,t){e.forEach(function(e,r){e&&c.fillRect(r+f,t+f,1,1)})})}}},{key:"render",value:function(){var e=this,r=this.props,n=(r.value,r.size),o=(r.level,r.bgColor,r.fgColor,r.style),i=(r.includeMargin,oe(r,["value","size","level","bgColor","fgColor","style","includeMargin"])),a=ne({height:n,width:n},o);return t.createElement("canvas",re({style:a,height:n,width:n,ref:function(t){return e._canvas=t}},i))}}]),r}();de(Ce,"defaultProps",ge),de(Ce,"propTypes",ye);var be=function(e){function r(){return ie(this,r),ue(this,ce(r).apply(this,arguments))}return le(r,t.PureComponent),se(r,[{key:"render",value:function(){var e=this.props,r=e.value,n=e.size,o=e.level,i=e.bgColor,a=e.fgColor,s=e.includeMargin,u=oe(e,["value","size","level","bgColor","fgColor","includeMargin"]),c=new ee(-1,j[o]);c.addData(he(r)),c.make();var l=c.modules;if(null===l)return null;var f=s?4:0,p=me(l,f),d=l.length+2*f;return t.createElement("svg",re({shapeRendering:"crispEdges",height:n,width:n,viewBox:"0 0 ".concat(d," ").concat(d)},u),t.createElement("path",{fill:i,d:"M0,0 h".concat(d,"v").concat(d,"H0z")}),t.createElement("path",{fill:a,d:p}))}}]),r}();de(be,"defaultProps",ge),de(be,"propTypes",ye);var we=function(e){var r=e.renderAs,n=oe(e,["renderAs"]),o="svg"===r?be:Ce;return t.createElement(o,n)};we.defaultProps=ne({renderAs:"canvas"},ge);var Ee=we,Se={ready:"ready",loginFailed:"loginFailed",loginSuccess:"loginSuccess",scanComplete:"scanComplete",codeOutWork:"codeOutWork",networkLost:"networkLost",qrCodeGetting:"qrCodeGetting",qrCodeGetSuccess:"qrCodeGetSuccess",qrCodeGetFailed:"qrCodeGetFailed"},Oe={eventSourceError:0},Pe=!1,Le=function(e){try{if(Pe){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];console[e||"log"].apply(console,[" [WODAX_DEBUG]: "].concat(r))}}catch(e){console.error(e)}},xe=function(e){var n,o;function u(){for(var t,n=arguments.length,o=new Array(n),c=0;c<n;c++)o[c]=arguments[c];return(t=e.call.apply(e,[this].concat(o))||this).state={currentQrLoginState:Se.ready,qrcode:"",sseEvents:[]},t.updateQrCode=function(){var e=t.props,r=e.options,n=e.fetchQrCodeHandler,o=t.state.qrcode,u=r.useEventSourceForFetchQrCode;t.setState({currentQrLoginState:Se.qrCodeGetting},function(){var e;u?(t.uninstallEventSource(),t.installEventSource()):(e=i.mark(function e(){var r,a,u;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=12;break}return e.prev=1,e.next=4,n(s(t));case 4:r=e.sent,a=r.code,u=r.data,0===a?o===u?t.setState({currentQrLoginState:Se.qrCodeGetSuccess}):(t.uninstallEventSource(),t.setState({currentQrLoginState:Se.qrCodeGetSuccess,qrcode:u},function(){t.installEventSource({qrcode:u})})):(t.uninstallEventSource(),t.setState({currentQrLoginState:Se.qrCodeGetFailed})),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.error(e.t0);case 12:case"end":return e.stop()}},e,null,[[1,9]])}),function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){a(i,n,o,s,u,"next",e)}function u(e){a(i,n,o,s,u,"throw",e)}s(void 0)})})()})},t.installEventSource=function(e){void 0===e&&(e={});var n=u.defaultProps.options,o=t.props,i=o.options,a=o.onReceiveMessageHandler,c=o.debugEnable;Pe=c;var l=r({},n,{},i).clientEventSource,f=l.url,p=l.params,d=l.messageTypes,h=l.withCredentials,g=l.saveAllEvents,y=Object.entries(r({},p,{},e)).map(function(e){return e[0]+"="+e[1]}).join("&"),m=encodeURI(f+(y.length>0?"?":"")+y);if(Le("log","---\x3e SSE url",m),EventSource){if(t.sse){if(t.sse.url===m)return;t.uninstallEventSource()}Le("log","--\x3e installEventSource"),t.sse=new EventSource(m,{withCredentials:!!h});var v=d||[];(v=v.includes("message")?v:v.concat(["message"])).forEach(function(e){t.sse.addEventListener(e,function(e){t.setState(function(t){return{sseEvents:(g?t.sseEvents:[]).concat(e)}}),a&&a(e,s(t))},!1)}),t.sse.onopen=function(e){Le("log","---\x3e SSE Open"),a&&a(e,s(t))},t.sse.onerror=function(e){var r=e.target.readyState;EventSource.CLOSED===r?Le("log","---\x3e SSE Disconnected"):EventSource.CONNECTING===r&&Le("log","---\x3e SSE Connecting..."),a&&a(e,s(t)),t.onErrorEventHandler({type:Oe.eventSourceError,data:e})}}else console.error("Your browser doesn't support SSE")},t.uninstallEventSource=function(){t.props.debugEnable;if(t.sse)try{Le("log","--\x3e uninstallEventSource"),t.sse.close()}catch(e){Le("error","--\x3e uninstallEventSource [error]",e)}},t.onErrorEventHandler=function(e){try{e.type,e.data;Oe.eventSourceError}catch(e){console.error(e)}},t}o=e,(n=u).prototype=Object.create(o.prototype),n.prototype.constructor=n,n.__proto__=o;var c=u.prototype;return c.componentDidMount=function(){this.updateQrCode()},c.componentWillUnmount=function(){this.uninstallEventSource()},c.render=function(){var e=this.props,n=e.className,o=e.style,i=e.titleRender,a=e.qrCodeRender,s=e.toolTipRender,u=e.additionLayerRender,c=e.refreshQrCodeRender,l=e.sseMessageRender;return t.createElement("div",{className:n,style:r({display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column"},o)},i(this),a(this),s(this),u(this),c(this),l(this))},u}(e.PureComponent);xe.getEnumStateQrCodeLogin=function(){return Se};var Te={titleRender:function(e){var n=r({},xe.defaultProps.options,{},e.props.options),o=n.title,i=n.titleStyle,a=n.titleClassName,s=n.appLogo,u=n.appLogoClassName,c=n.appLogoStyle;return t.createElement("div",{className:a,style:r({padding:"4px"},i),wodaxuiname:"TitleContainer"},t.createElement("span",null,o),""!==s?t.createElement("div",{className:u,style:c,wodaxuiname:"appLogoContainer"},t.createElement("img",{src:s,alt:s})):null)},qrCodeRender:function(e){var n=r({},xe.defaultProps.options,{},e.props.options),o=n.qrCodeContainerClassName,i=n.qrCodeContainerStyle,a=n.qrCodeContainerOpacity,s=n.qrCodeConfig,u=e.state,c=u.qrcode,l=u.currentQrLoginState,f=[Se.loginFailed,Se.loginSuccess,Se.scanComplete,Se.codeOutWork,Se.networkLost,Se.qrCodeGetting,Se.qrCodeGetFailed].includes(l)?a.min:a.max;return t.createElement("div",{className:o,style:r({padding:"4px"},i,{opacity:f}),wodaxuiname:"qrCodeContainer"},""!==c&&t.createElement(Ee,{value:c,renderAs:s.renderAs,size:s.size,bgColor:s.bgColor,fgColor:s.fgColor,level:s.level,includeMargin:s.includeMargin}))},toolTipRender:function(n){var o=xe.defaultProps.options,i=n.props.options,a=r({},o,{},i),s=a.toolTipContainerClassName,u=a.toolTipContainerStyle,c=a.toolTipContainerProps,l=n.state.currentQrLoginState;return function(){var n={};Object.entries(Se).map(function(e){var t=e[0];e[1];["Text","ClassName","Style"].forEach(function(e){var a;r({},o,{},i).hasOwnProperty(""+t+e)&&(n[t]=n[t]||{},n[t]=r(((a={})[""+e]=r({},o,{},i)[""+t+e],a),n[t]))})});var a=n[l];return a?e.createElement("div",r({className:s,style:u,wodaxuiname:"toolTipContainer"},c),t.createElement("div",{className:a.ClassName,style:r({padding:"4px"},a.Style)},t.createElement("span",null,a.Text))):null}()},additionLayerRender:function(e){return null},refreshQrCodeRender:function(t){var n=r({},xe.defaultProps.options,{},t.props.options),o=n.refreshContainerShowEveryTime,i=n.refreshContainerProps,a=n.refreshButtonCaption,s=n.refreshButtonElement,u=n.refreshButtonProps,c=t.state.currentQrLoginState;return([Se.loginFailed,Se.codeOutWork,Se.qrCodeGetFailed].indexOf(c)>0||o)&&e.createElement("div",r({wodaxuiname:"RefreshContainer"},i),e.createElement(s,r({wodaxuiname:"RefreshButton",onClick:function(){t.updateQrCode()}},u),a))},sseMessageRender:function(e){var n=e.state.sseEvents,o=r({},xe.defaultProps.options,{},e.props.options).showSSEMessage;return e.sse&&n.length>0&&o?t.createElement("div",{wodaxuiname:"sseMessageRender",children:n.map(function(e){return t.createElement("p",null,e.data)})}):null},fetchQrCodeHandler:function(e){return new Promise(function(e,t){e({code:0,data:"http://ops.woda.ink/wodax/umi/"+Date.now()})})},onReceiveMessageHandler:function(e,t){}};return xe.propTypes={className:T.string,Style:T.object,debugEnable:T.bool,options:T.shape({useEventSourceForFetchQrCode:T.bool,clientEventSource:T.shape({url:T.string,params:T.object,messageTypes:T.array,withCredentials:T.bool,saveAllEvents:T.bool}),title:T.string,titleStyle:T.object,titleClassName:T.string,appLogo:T.string,appLogoClassName:T.string,appLogoStyle:T.object,qrCodeConfig:T.shape({renderAs:T.string,size:T.number,bgColor:T.string,fgColor:T.string,level:T.string,includeMargin:T.bool}),qrCodeContainerClassName:T.string,qrCodeContainerStyle:T.object,qrCodeContainerOpacity:T.shape({min:T.number,max:T.number}),toolTipContainerClassName:T.string,toolTipContainerStyle:T.object,toolTipContainerProps:T.object,codeOutWorkText:T.string,codeOutWorkClassName:T.string,codeOutWorkStyle:T.object,loginFailedText:T.string,loginFailedClassName:T.string,loginFailedStyle:T.object,loginSuccessText:T.string,loginSuccessClassName:T.string,loginSuccessStyle:T.object,qrCodeGetFailedText:T.string,qrCodeGetFailedClassName:T.string,qrCodeGetFailedStyle:T.object,scanCompleteText:T.string,scanCompleteClassName:T.string,scanCompleteStyle:T.object,refreshContainerShowEveryTime:T.bool,refreshContainerProps:T.object,refreshButtonCaption:T.string,refreshButtonElement:T.string|T.element|T.elementType|T.func,refreshButtonProps:T.object,showSSEMessage:T.bool}),fetchQrCodeHandler:T.func.isRequired,onReceiveMessageHandler:T.func,titleRender:T.func.isRequired,qrCodeRender:T.func.isRequired,toolTipRender:T.func.isRequired,additionLayerRender:T.func,refreshQrCodeRender:T.func.isRequired,sseMessageRender:T.func.isRequired},xe.defaultProps={className:"wodax-login-with-qrcode",Style:{},debugEnable:!1,options:{useEventSourceForFetchQrCode:!1,clientEventSource:{url:"https://stream.wikimedia.org/v2/stream/recentchange",params:{},messageTypes:["message"],withCredentials:!1,saveAllEvents:!1},title:"打开App,扫码登录",titleClassName:"qr-login-title",appLogo:"",qrCodeConfig:{renderAs:"canvas",size:128,bgColor:"#FFFFFF",fgColor:"#000000",level:"L",includeMargin:!1},qrCodeContainerOpacity:{min:.01,max:1},toolTipContainerClassName:"qr-login-tooltip",toolTipContainerStyle:{padding:"4px",position:"absolute"},codeOutWorkText:"二维码已失效",loginFailedText:"登录失败",loginSuccessText:"登录成功",qrCodeGetFailedText:"获取二维码失败",scanCompleteText:"扫描成功! 请在手机上确认登录",refreshContainerShowEveryTime:!1,refreshContainerProps:{style:{padding:"4px",position:"absolute",marginTop:"40px"}},refreshButtonCaption:"请点击刷新",refreshButtonElement:"button",refreshButtonProps:{style:{padding:"4px"}},showSSEMessage:!1},fetchQrCodeHandler:Te.fetchQrCodeHandler,onReceiveMessageHandler:Te.onReceiveMessageHandler,titleRender:Te.titleRender,qrCodeRender:Te.qrCodeRender,toolTipRender:Te.toolTipRender,additionLayerRender:Te.additionLayerRender,refreshQrCodeRender:Te.refreshQrCodeRender,sseMessageRender:Te.sseMessageRender},xe});
//# sourceMappingURL=index-dev.umd.js.map